Skip to content

feat(cordova): move Cordova guidance to SDK v6 (6.0.0-rc.1) - #18

Merged
kherembourg merged 1 commit into
mainfrom
feat/cordova-v6-support
Jul 7, 2026
Merged

feat(cordova): move Cordova guidance to SDK v6 (6.0.0-rc.1)#18
kherembourg merged 1 commit into
mainfrom
feat/cordova-v6-support

Conversation

@kherembourg

@kherembourg kherembourg commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

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 to 2.0.0-rc.6 to stay above the current main prerelease.

Cordova targets @purchasely/cordova-plugin-purchasely 6.0.0-rc.1, which pulls the 6.0.0-rc.2 native SDKs. Its JS API remains method-based, but v6 changes the breaking surfaces: options-object start, per-action interceptAction returning InterceptResult, explicit presentation display modes, renamed deeplink/campaign APIs, and removed subscription/product/plan presentation helpers.

What changed

  • Rewrote references/cordova/integration.md for Cordova v6, including options-object init, TransitionType display modes, per-action interceptors, and safe Observer-mode sequencing.
  • Added references/cordova/migration-v6.md and references/cordova/v5-api-reference.md, including closePaywall() -> closePresentation().
  • Updated shared concepts, architecture docs, sdk-versions.md, and all Purchasely skills so Cordova is treated as a v6 platform.
  • Added a guard for positional Cordova Purchasely.start('...') and active Cordova closePaywall() usage while allowing migration/v5 examples.
  • Updated README supported-platforms and bumped package.json / .claude-plugin/plugin.json / CHANGELOG to 2.0.0-rc.6.

Review fixes

  • Resolved the semver-backward version comment by rebasing on main and bumping to 2.0.0-rc.6.
  • Added the missing closePaywall() -> closePresentation() migration-table mapping.
  • Added the closePaywall() guard requested by Greptile's outside-diff note.
  • Fixed Cordova navigate interceptor examples to return InterceptResult.success when the app opens the URL itself.
  • Fixed Cordova Observer/promotional-offer examples to wait for 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.

@greptile-apps

greptile-apps Bot commented Jun 23, 2026

Copy link
Copy Markdown

Greptile Summary

This PR moves the Cordova plugin documentation from v5 (5.7.3) to v6 (6.0.0-rc.1), updating integration guides, migration references, concept docs, and skills to reflect the three breaking surfaces (options-object start, per-action interceptAction + InterceptResult, and TransitionType display mode) and several renamed/removed methods.

  • New files migration-v6.md and v5-api-reference.md provide a complete v5→v6 mapping and legacy-token recognition list for the Cordova surface.
  • Guard script inverted: positional Purchasely.start('APIKEY', …) is now flagged as v5 (v6 takes an options object); closePaywall is also guarded; the stale object-start and allowDeeplink guards were removed.
  • Concept docs and skills (paywall-actions, running-modes, observer-mode-post-purchase, purchasely-migrate) updated to group Cordova with the v6 platforms using interceptAction + InterceptResult instead of the v5 setPaywallActionInterceptor / onProcessAction model.

Confidence Score: 4/5

Safe to merge after fixing the Observer mode code example in integration.md; all other documentation changes are accurate and consistent.

The Observer mode example in integration.md calls synchronize with empty callbacks and resolves the interceptor immediately — effectively making the receipt upload fire-and-forget. This contradicts both the inline note on line 230 ('synchronize now reports completion') and the canonical observer-mode-post-purchase.md concept doc, which correctly resolves only from inside synchronize's success callback. Developers copying this snippet will ship code where a synchronize failure goes undetected and subscription state may be stale when the paywall closes.

purchasely/references/cordova/integration.md — the Observer mode / synchronize example at the 'Observer Mode — Processing Transactions Yourself' section.

Important Files Changed

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
Loading
%%{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
Loading

Reviews (2): Last reviewed commit: "feat(cordova): document SDK v6 support" | Re-trigger Greptile

Comment thread CHANGELOG.md Outdated
Comment thread purchasely/references/cordova/migration-v6.md Outdated
chouaibMo added a commit that referenced this pull request Jul 7, 2026
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>
@kherembourg
kherembourg force-pushed the feat/cordova-v6-support branch from 950b989 to d16b300 Compare July 7, 2026 14:17
@kherembourg
kherembourg requested a review from Copilot July 7, 2026 14:22
@kherembourg
kherembourg force-pushed the feat/cordova-v6-support branch from d16b300 to 01ba864 Compare July 7, 2026 14:23
@kherembourg

Copy link
Copy Markdown
Contributor Author

@greptileai review

@kherembourg

Copy link
Copy Markdown
Contributor Author

Addressed the remaining Greptile outside-diff note in 01ba864: scripts/guard-known-bad-snippets.mjs now flags active Cordova closePaywall() usage while still allowing v5/migration mapping examples. Local npm test passes.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-action interceptAction + InterceptResult, display-mode TransitionType, 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.

Comment thread purchasely/references/cordova/integration.md
Comment thread purchasely/references/cordova/integration.md Outdated
Comment thread purchasely/references/concepts/promotional-offers.md Outdated
Comment thread package.json
Comment thread README.md
@kherembourg
kherembourg force-pushed the feat/cordova-v6-support branch from 01ba864 to bd158de Compare July 7, 2026 14:28
@kherembourg
kherembourg merged commit ec9d42d into main Jul 7, 2026
2 checks passed
@kherembourg
kherembourg deleted the feat/cordova-v6-support branch July 7, 2026 14:42
kherembourg added a commit that referenced this pull request Jul 7, 2026
Cordova joins the v6 line. Bumps all marketplace/plugin manifests
and package.json to 2.0.0-rc.6 (CHANGELOG already updated in #18).

Includes PRs #18, #22, #23.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants