feat(cordova): move Cordova guidance to SDK v6 (6.0.0-rc.1) - #18
Conversation
|
| Filename | Overview |
|---|---|
| purchasely/references/cordova/integration.md | Comprehensive v5→v6 rewrite; Observer mode example makes synchronize fire-and-forget before resolving the interceptor, which contradicts the adjacent prose and the concept docs. |
| purchasely/references/cordova/migration-v6.md | New file; well-structured v5→v6 mapping with before/after code blocks covering all three breaking surfaces plus renamed/removed methods. Correctly awaits synchronize in its examples. |
| purchasely/references/cordova/v5-api-reference.md | New file; compact v5 legacy token reference for migration recognition. Accurate and consistent with migration-v6.md. |
| scripts/guard-known-bad-snippets.mjs | Guard inverted for Cordova v6: now flags positional start syntax and closePaywall; removes the stale object-start and allowDeeplink guards. Logic correct; exemption regexes reasonably scoped. |
| purchasely/references/sdk-versions.md | Cordova row updated from 5.7.3 to 6.0.0-rc.1 with accurate transitive native SDK version (6.0.0-rc.2); universal rules and plugin-native mapping table updated consistently. |
| purchasely/skills/purchasely-migrate/SKILL.md | Adds a full 13-step Cordova migration workflow matching the concept docs; build-gate and arguments updated to include Cordova. Consistent with migration-v6.md. |
| purchasely/references/concepts/paywall-actions.md | Cordova updated from legacy proceed/processAction model to per-action interceptAction + InterceptResult, matching the v6 surface. Table simplified and Cordova action-kind constants corrected. |
| purchasely/references/concepts/observer-mode-post-purchase.md | Cordova v6 example correctly awaits synchronize inside the interceptor Promise before resolving; dismissal table updated to reflect InterceptResult.success. |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant App as Cordova App (JS)
participant SDK as Purchasely SDK
participant Store as App Store / Play
App->>SDK: "start({ apiKey, runningMode: full, … })"
SDK-->>App: isConfigured callback
App->>SDK: interceptAction(PresentationAction.purchase, handler)
App->>SDK: fetchPresentationForPlacement('ONBOARDING', …)
SDK-->>App: presentation object
App->>SDK: presentPresentation(presentation, TransitionType.fullScreen, …)
SDK-->>App: (paywall displayed)
Note over App,SDK: User taps Buy
SDK->>App: handler(info, parameters)
alt Full mode
App->>SDK: return InterceptResult.notHandled
SDK->>Store: Purchase
Store-->>SDK: Receipt
SDK-->>App: result callback (PURCHASED)
else Observer mode
App->>Store: MyPurchaseSystem.purchase(...)
Store-->>App: ok
App->>SDK: synchronize(success, error)
SDK-->>App: success callback (receipt synced)
App->>SDK: resolve(InterceptResult.success)
App->>SDK: closePresentation()
end
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant App as Cordova App (JS)
participant SDK as Purchasely SDK
participant Store as App Store / Play
App->>SDK: "start({ apiKey, runningMode: full, … })"
SDK-->>App: isConfigured callback
App->>SDK: interceptAction(PresentationAction.purchase, handler)
App->>SDK: fetchPresentationForPlacement('ONBOARDING', …)
SDK-->>App: presentation object
App->>SDK: presentPresentation(presentation, TransitionType.fullScreen, …)
SDK-->>App: (paywall displayed)
Note over App,SDK: User taps Buy
SDK->>App: handler(info, parameters)
alt Full mode
App->>SDK: return InterceptResult.notHandled
SDK->>Store: Purchase
Store-->>SDK: Receipt
SDK-->>App: result callback (PURCHASED)
else Observer mode
App->>Store: MyPurchaseSystem.purchase(...)
Store-->>App: ok
App->>SDK: synchronize(success, error)
SDK-->>App: success callback (receipt synced)
App->>SDK: resolve(InterceptResult.success)
App->>SDK: closePresentation()
end
Reviews (2): Last reviewed commit: "feat(cordova): document SDK v6 support" | Re-trigger Greptile
The Cordova v6 guidance in PR #18 was written against an earlier understanding where the plugin "kept its method-based JS API with only renames". The finalized Cordova SDK (Purchasely/Purchasely-Cordova#57, verified against `purchasely/www/Purchasely.js` + `MIGRATION-v6.md`) has three breaking surfaces that the docs got wrong: - `start()` now takes a single options object (was positional) - the action interceptor is per-action `interceptAction(kind, handler)` returning an `InterceptResult`; `setPaywallActionInterceptor` + `onProcessAction` were removed; `PaywallAction` → `PresentationAction` - `isFullscreen` became a display mode (`TransitionType`) Also: `presentSubscriptions` / `presentProductWithIdentifier` / `presentPlanWithIdentifier` / `showPresentation` / `hidePresentation` were removed (not no-ops); `RunningMode` values are now name strings; the `6.0.0-rc.1` plugin pulls the `6.0.0-rc.2` native SDKs; new `allowCampaigns` + constants. Reconciles the three Cordova references, sdk-versions, all five skills, the affected concept docs, the README platform table, and inverts the guard's Cordova `start` rule (positional is now the v5 leftover). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
950b989 to
d16b300
Compare
d16b300 to
01ba864
Compare
|
@greptileai review |
|
Addressed the remaining Greptile outside-diff note in |
There was a problem hiding this comment.
Pull request overview
Moves the Cordova documentation and assistant guidance onto the Purchasely SDK v6 generation (Cordova 6.0.0-rc.1 plugin), aligning shared references/skills/concepts and the snippet guard with the v6 method-based Cordova JS surface.
Changes:
- Rewrites Cordova integration guidance and adds Cordova-specific v5→v6 migration/reference docs (options-object
start, per-actioninterceptAction+InterceptResult, display-modeTransitionType, deeplink renames, removed APIs). - Updates shared skills/concept references to treat Cordova as a v6 platform (running-mode defaults, interceptor semantics, dismissal APIs, version pins).
- Updates the known-bad snippet guard and bumps plugin version/changelog entries.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/guard-known-bad-snippets.mjs | Updates Cordova snippet-guard rules for v6 (flags positional start, flags closePaywall). |
| README.md | Updates supported platform table to show Cordova on v6 and documents the v6 Cordova init/interceptor/presentation surfaces. |
| purchasely/skills/purchasely-sdk-expert/SKILL.md | Updates SDK-generation rules and guidance to treat Cordova as v6 (including running mode and interceptor semantics). |
| purchasely/skills/purchasely-review/SKILL.md | Updates review checklist/patterns for Cordova v6 (interceptors, deeplinks, init, presentation display mode). |
| purchasely/skills/purchasely-migrate/SKILL.md | Extends migration workflow to include Cordova v5→v6 and adds Cordova-specific steps and verification gate. |
| purchasely/skills/purchasely-integrate/SKILL.md | Updates integration workflow docs for Cordova v6 (pins, requirements, API surface changes). |
| purchasely/skills/purchasely-debug/SKILL.md | Updates debugging guidance to reflect Cordova v6 interceptor/result model and deeplink APIs. |
| purchasely/references/troubleshooting/common-issues.md | Updates troubleshooting guidance for Cordova v6 dismissal/interceptor semantics. |
| purchasely/references/sdk-versions.md | Moves Cordova to v6, updates pins and transitive native dependency mapping, and refreshes “last updated” date. |
| purchasely/references/purchasely-architecture.md | Updates architecture description to reference Cordova v6 init surface. |
| purchasely/references/cordova/v5-api-reference.md | Adds a compact v5 token snapshot for migration recognition only. |
| purchasely/references/cordova/migration-v6.md | Adds Cordova-specific v5→v6 migration guide (breaking surfaces + mapping). |
| purchasely/references/cordova/integration.md | Rewrites Cordova integration reference to v6 (options-object init, per-action interceptors, display modes, deeplinks). |
| purchasely/references/concepts/user-attributes-targeting.md | Updates placement-resolution timing examples to include Cordova v6. |
| purchasely/references/concepts/subscription-checks.md | Updates Observer-mode restore/dismiss guidance to Cordova v6 semantics. |
| purchasely/references/concepts/running-modes.md | Updates v6 default running mode guidance to include Cordova v6 and updates Cordova init example. |
| purchasely/references/concepts/README.md | Updates concept index blurbs to reflect Cordova v6 interceptor model. |
| purchasely/references/concepts/promotional-offers.md | Updates Cordova section to the v6 per-action interceptor API and parameters. |
| purchasely/references/concepts/presentation-types.md | Updates Cordova presentation-display signature and examples for v6 display-mode arg. |
| purchasely/references/concepts/presentation-cache.md | Updates Cordova references to the v6 fetch bridge. |
| purchasely/references/concepts/paywall-actions.md | Updates “golden rule” and Cordova examples to v6 result-returning interceptors. |
| purchasely/references/concepts/observer-mode-post-purchase.md | Updates Observer-mode sequencing guidance and Cordova examples for v6 semantics. |
| purchasely/references/concepts/campaigns.md | Updates campaigns gating guidance to Cordova v6 (allowCampaigns / allowDeeplink). |
| purchasely/references/architecture-patterns.md | Updates wrapper-architecture guidance to include Cordova v6 method-based surface. |
| package.json | Bumps plugin package version. |
| CHANGELOG.md | Adds 2.0.0-rc.6 release notes describing Cordova’s move to v6 and related doc/skill changes. |
| .claude-plugin/plugin.json | Bumps plugin manifest version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
01ba864 to
bd158de
Compare
Summary
Cordova joins the SDK v6 line in the Purchasely assistant. This PR is now rebased on
main, where React Native is already documented on v6 (6.0.0-rc.2). The plugin release metadata is bumped to2.0.0-rc.6to stay above the currentmainprerelease.Cordova targets
@purchasely/cordova-plugin-purchasely 6.0.0-rc.1, which pulls the6.0.0-rc.2native SDKs. Its JS API remains method-based, but v6 changes the breaking surfaces: options-objectstart, per-actioninterceptActionreturningInterceptResult, explicit presentation display modes, renamed deeplink/campaign APIs, and removed subscription/product/plan presentation helpers.What changed
references/cordova/integration.mdfor Cordova v6, including options-object init,TransitionTypedisplay modes, per-action interceptors, and safe Observer-mode sequencing.references/cordova/migration-v6.mdandreferences/cordova/v5-api-reference.md, includingclosePaywall()->closePresentation().sdk-versions.md, and all Purchasely skills so Cordova is treated as a v6 platform.Purchasely.start('...')and active CordovaclosePaywall()usage while allowing migration/v5 examples.package.json/.claude-plugin/plugin.json/ CHANGELOG to2.0.0-rc.6.Review fixes
mainand bumping to2.0.0-rc.6.closePaywall()->closePresentation()migration-table mapping.closePaywall()guard requested by Greptile's outside-diff note.navigateinterceptor examples to returnInterceptResult.successwhen the app opens the URL itself.synchronize(success, error)before resolving success and to dismiss after the interceptor resolves.Verification
npm test(node scripts/guard-known-bad-snippets.mjs) -> passed.git diff --check-> passed.