@wirexapp/card-wallet-topup-web 0.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # @wirexapp/card-wallet-topup-web
2
+
3
+ ## 0.1.0-beta.3
4
+
5
+ ### Minor Changes
6
+
7
+ - da3aa2e: Add wallet top-up (Apple Pay / Google Pay) capability — `@wirexapp/card-wallet-topup-web`.
8
+
9
+ New hosted checkout model per docs/WALLET-TOPUP-DESIGN.md: a Wirex-served frame renders the transaction review (amounts fetched from the backend by estimation id — the host cannot spoof them) and the wallet buttons under Wirex's single merchant identity, so partners need no Apple/Google onboarding. Public API: `checkWalletAvailability()` (Phase-A probe, cached per session) and `createWalletTopUpForm()` (mount / update / destroy, results via callbacks with an execute watchdog and a designed-in `threeDsRequired` fallback into `@wirexapp/card-3ds-web`). React bindings: `useWalletAvailability()` + `<WalletTopUpForm />`. Protocol additions are purely additive within v1 (new init modes + wallet event types). Frame-side backend paths are the frontend contract proposal (§9) pending backend agreement.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [da3aa2e]
14
+ - @wirexapp/card-sdk-core@0.1.0-beta.3
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # @wirexapp/card-wallet-topup-web
2
+
3
+ Top up via Apple Pay / Google Pay inside a Wirex-served checkout frame: the
4
+ frame renders the transaction review (amounts fetched by estimation id — the
5
+ host cannot spoof them) and the wallet buttons under Wirex's single merchant
6
+ identity, so partners need no Apple/Google onboarding of their own. The host
7
+ passes only an estimation reference and receives status callbacks.
8
+
9
+ - `checkWalletAvailability(sdk)` — Phase-A probe (hidden frame, cached per
10
+ page session): `{ applePay, googlePay }` as the real tokenization path
11
+ would answer, per browser/context.
12
+ - `createWalletTopUpForm(sdk, config)` — mount / update / destroy the checkout
13
+ frame; results via callbacks, with an execute watchdog and a designed-in
14
+ `threeDsRequired` fallback into `@wirexapp/card-3ds-web`.
15
+
16
+ Availability rule: render a wallet entry point only where the probe says it
17
+ can tokenize (Safari → Apple Pay, Android Chrome → Google Pay).
18
+
19
+ React bindings: `useWalletAvailability()` + `<WalletTopUpForm />` in
20
+ `@wirexapp/card-react`. Full partner docs: `partner-docs/` in the repo
21
+ (packages → card-wallet-topup-web).
@@ -0,0 +1,33 @@
1
+ /**
2
+ * `@wirexapp/card-wallet-topup-web` — top up via Apple Pay / Google Pay inside
3
+ * a Wirex-served checkout iframe. Design: docs/WALLET-TOPUP-DESIGN.md.
4
+ *
5
+ * The flow (partner's view):
6
+ * 1. Your backend prices the top-up through the Wirex estimate API and hands
7
+ * your frontend an `estimation_id` + a short-lived `checkout_token`.
8
+ * 2. `checkWalletAvailability()` (once per session, before showing the row).
9
+ * 3. `createWalletTopUpForm(...).mount(container)` — the frame renders the
10
+ * review screen (amounts fetched from the backend, not from your page) and
11
+ * the wallet buttons under Wirex's merchant identity. No Apple/Google
12
+ * registration, no certificates, no PCI exposure on your side.
13
+ * 4. The outcome arrives in `onResult`; reconcile the money-moved truth on
14
+ * your backend. A `threeDsRequired` outcome plugs into
15
+ * `@wirexapp/card-3ds-web`.
16
+ */
17
+ import { PciWalletTopUpElement, type PciSdkConfig, type PciWalletAvailability, type PciWalletTopUpElementConfig } from '@wirexapp/card-sdk-core';
18
+ /** Config of the combined (review + buttons) wallet checkout element. */
19
+ export type WalletTopUpFormConfig = PciWalletTopUpElementConfig;
20
+ export type WalletTopUpForm = PciWalletTopUpElement;
21
+ /**
22
+ * Phase-A availability check. Run it before showing the wallet row at all —
23
+ * `false` means hide the row (`googlePay: false` on desktop/non-Chrome is
24
+ * expected: the cryptogram-only policy has no eligible cards there).
25
+ */
26
+ export declare const checkWalletAvailability: (sdk: PciSdkConfig, options?: {
27
+ force?: boolean;
28
+ }) => Promise<PciWalletAvailability>;
29
+ /** Combined variant: review screen + wallet buttons in one Wirex-served frame. */
30
+ export declare const createWalletTopUpForm: (sdk: PciSdkConfig, config: WalletTopUpFormConfig) => WalletTopUpForm;
31
+ export type * from '@wirexapp/card-sdk-core';
32
+ export { PciFrameRequestError } from '@wirexapp/card-sdk-core';
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAGL,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EACjC,MAAM,yBAAyB,CAAC;AAEjC,yEAAyE;AACzE,MAAM,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAChE,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAOpD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,KAAK,YAAY,EACjB,UAAU;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,KAC5B,OAAO,CAAC,qBAAqB,CAY/B,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,qBAAqB,GAChC,KAAK,YAAY,EACjB,QAAQ,qBAAqB,KAC5B,eAA2F,CAAC;AAI/F,mBAAmB,yBAAyB,CAAC;AAG7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,46 @@
1
+ /**
2
+ * `@wirexapp/card-wallet-topup-web` — top up via Apple Pay / Google Pay inside
3
+ * a Wirex-served checkout iframe. Design: docs/WALLET-TOPUP-DESIGN.md.
4
+ *
5
+ * The flow (partner's view):
6
+ * 1. Your backend prices the top-up through the Wirex estimate API and hands
7
+ * your frontend an `estimation_id` + a short-lived `checkout_token`.
8
+ * 2. `checkWalletAvailability()` (once per session, before showing the row).
9
+ * 3. `createWalletTopUpForm(...).mount(container)` — the frame renders the
10
+ * review screen (amounts fetched from the backend, not from your page) and
11
+ * the wallet buttons under Wirex's merchant identity. No Apple/Google
12
+ * registration, no certificates, no PCI exposure on your side.
13
+ * 4. The outcome arrives in `onResult`; reconcile the money-moved truth on
14
+ * your backend. A `threeDsRequired` outcome plugs into
15
+ * `@wirexapp/card-3ds-web`.
16
+ */
17
+ import { buildFrameUrl, probeWalletAvailability, PciWalletTopUpElement, } from '@wirexapp/card-sdk-core';
18
+ /** One probe per frame URL (environment + client) per page session — the
19
+ * checks take no transaction context, so the result cannot go stale within a
20
+ * session. Failed probes are not cached. */
21
+ const availabilityCache = new Map();
22
+ /**
23
+ * Phase-A availability check. Run it before showing the wallet row at all —
24
+ * `false` means hide the row (`googlePay: false` on desktop/non-Chrome is
25
+ * expected: the cryptogram-only policy has no eligible cards there).
26
+ */
27
+ export const checkWalletAvailability = (sdk, options) => {
28
+ const frameUrl = buildFrameUrl(sdk, 'wallet-probe');
29
+ if (!options?.force) {
30
+ const cached = availabilityCache.get(frameUrl);
31
+ if (cached)
32
+ return cached;
33
+ }
34
+ const probe = probeWalletAvailability(frameUrl).catch((error) => {
35
+ availabilityCache.delete(frameUrl);
36
+ throw error;
37
+ });
38
+ availabilityCache.set(frameUrl, probe);
39
+ return probe;
40
+ };
41
+ /** Combined variant: review screen + wallet buttons in one Wirex-served frame. */
42
+ export const createWalletTopUpForm = (sdk, config) => new PciWalletTopUpElement(buildFrameUrl(sdk, 'wallet-checkout'), config);
43
+ // Value re-export so `error instanceof PciFrameRequestError` works when
44
+ // imported from this package.
45
+ export { PciFrameRequestError } from '@wirexapp/card-sdk-core';
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,qBAAqB,GAItB,MAAM,yBAAyB,CAAC;AAMjC;;6CAE6C;AAC7C,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAA0C,CAAC;AAE5E;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,GAAiB,EACjB,OAA6B,EACG,EAAE;IAClC,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IACpD,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC/C,IAAI,MAAM;YAAE,OAAO,MAAM,CAAC;IAC5B,CAAC;IACD,MAAM,KAAK,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACvE,iBAAiB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACnC,MAAM,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;IACH,iBAAiB,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACvC,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,kFAAkF;AAClF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,GAAiB,EACjB,MAA6B,EACZ,EAAE,CAAC,IAAI,qBAAqB,CAAC,aAAa,CAAC,GAAG,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC;AAK/F,wEAAwE;AACxE,8BAA8B;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@wirexapp/card-wallet-topup-web",
3
+ "version": "0.1.0-beta.3",
4
+ "type": "module",
5
+ "description": "Top up via Apple Pay / Google Pay inside a Wirex-served checkout iframe — review screen + wallet buttons under Wirex's merchant identity; the host passes only an estimation reference. No wallet onboarding on the partner side.",
6
+ "license": "UNLICENSED",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "main": "./dist/index.js",
19
+ "module": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js"
25
+ }
26
+ }
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "README.md"
31
+ ],
32
+ "scripts": {
33
+ "build": "tsc -p tsconfig.build.json && node ../../scripts/fix-esm-extensions.mjs dist",
34
+ "dev": "tsc -p tsconfig.build.json --watch",
35
+ "clean": "rm -rf dist tsconfig.build.tsbuildinfo",
36
+ "typecheck": "yarn run -T tsc --noEmit",
37
+ "prepublishOnly": "yarn clean && yarn build"
38
+ },
39
+ "dependencies": {
40
+ "@wirexapp/card-sdk-core": "0.1.0-beta.3"
41
+ }
42
+ }