@wirexapp/card-wallet-topup-web 0.1.0-beta.3 → 0.1.0-beta.5
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 +33 -0
- package/README.md +15 -11
- package/dist/index.d.ts +30 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -14
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @wirexapp/card-wallet-topup-web
|
|
2
2
|
|
|
3
|
+
## 0.1.0-beta.4
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0a24437: Wallet top-up reworked to the confirmed backend contract ("Wallet Top-Ups
|
|
8
|
+
Integration"): the checkout frame now TOKENIZES AND RETURNS instead of
|
|
9
|
+
executing. Breaking within the beta line for the wallet surface only
|
|
10
|
+
(collect/reveal/3ds untouched):
|
|
11
|
+
|
|
12
|
+
- `createWalletTopUpForm` / `<WalletTopUpForm />` take `{ quote, walletConfig }`
|
|
13
|
+
(the host's estimate response + the app config's `topup` provider block,
|
|
14
|
+
passed verbatim) instead of `{ session: { estimationId, getCheckoutToken } }`
|
|
15
|
+
— `checkout_token` does not exist in the confirmed contract.
|
|
16
|
+
- The payment sheet's encrypted payload arrives in `onToken` (replaces
|
|
17
|
+
`onResult`); relay it verbatim as the execute call's `wallet_payment_token`.
|
|
18
|
+
The execute watchdog is gone (the host owns execute), and the
|
|
19
|
+
`threeDsRequired` result is removed — `three_ds_state` is never present on a
|
|
20
|
+
wallet top-up.
|
|
21
|
+
- New `onAttemptFailed(reason)` callback for sheet attempts that produce no
|
|
22
|
+
token (e.g. merchant validation failure).
|
|
23
|
+
- `checkWalletAvailability` / `useWalletAvailability` accept the provider
|
|
24
|
+
config so the Google readiness check uses the backend's
|
|
25
|
+
`allowed_auth_methods` / networks verbatim instead of built-in defaults.
|
|
26
|
+
- Frames: the checkout document no longer calls estimation-view/config/execute
|
|
27
|
+
endpoints (its only backend call is Apple merchant validation); the dev mock
|
|
28
|
+
API now mirrors the real contract shapes (`/api/v1/cards/topup/estimate`,
|
|
29
|
+
`/execute`, `/api/v1/config` `topup` block).
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [0a24437]
|
|
34
|
+
- @wirexapp/card-sdk-core@0.1.0-beta.4
|
|
35
|
+
|
|
3
36
|
## 0.1.0-beta.3
|
|
4
37
|
|
|
5
38
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
# @wirexapp/card-wallet-topup-web
|
|
2
2
|
|
|
3
3
|
Top up via Apple Pay / Google Pay inside a Wirex-served checkout frame: the
|
|
4
|
-
frame renders the transaction review
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
frame renders the transaction review from your quote and the wallet buttons
|
|
5
|
+
under Wirex's single merchant identity, so partners need no Apple/Google
|
|
6
|
+
onboarding of their own. The frame tokenizes and returns — the payment sheet's
|
|
7
|
+
encrypted payload comes back to your page, and your app calls the execute
|
|
8
|
+
endpoint with it (`wallet_payment_token`, relayed verbatim). There is no 3DS
|
|
9
|
+
on the wallet path.
|
|
8
10
|
|
|
9
|
-
- `checkWalletAvailability(sdk)` — Phase-A probe (hidden frame,
|
|
10
|
-
page session): `{ applePay, googlePay }` as the real tokenization
|
|
11
|
-
would answer, per browser/context.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
- `checkWalletAvailability(sdk, { config })` — Phase-A probe (hidden frame,
|
|
12
|
+
cached per page session): `{ applePay, googlePay }` as the real tokenization
|
|
13
|
+
path would answer, per browser/context. Pass the app config's `topup`
|
|
14
|
+
provider block so the Google check mirrors the real parameters.
|
|
15
|
+
- `createWalletTopUpForm(sdk, { quote, walletConfig, onToken, ... })` — mount /
|
|
16
|
+
update / destroy the checkout frame; the sheet's token arrives in `onToken`,
|
|
17
|
+
quote expiry in `onEstimationExpired` (re-estimate and `update()`).
|
|
15
18
|
|
|
16
19
|
Availability rule: render a wallet entry point only where the probe says it
|
|
17
|
-
can tokenize (Safari → Apple Pay, Android Chrome → Google Pay)
|
|
20
|
+
can tokenize (Safari → Apple Pay, Android Chrome → Google Pay), and only when
|
|
21
|
+
the `WalletTopup` capability is Active.
|
|
18
22
|
|
|
19
23
|
React bindings: `useWalletAvailability()` + `<WalletTopUpForm />` in
|
|
20
24
|
`@wirexapp/card-react`. Full partner docs: `partner-docs/` in the repo
|
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
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
|
|
3
|
+
* a Wirex-served checkout iframe. Design: docs/WALLET-TOPUP-DESIGN.md, on the
|
|
4
|
+
* confirmed backend contract ("Wallet Top-Ups Integration").
|
|
4
5
|
*
|
|
5
|
-
* The flow (
|
|
6
|
-
* 1.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* The flow (host's view):
|
|
7
|
+
* 1. Read the app config's `topup` block (providers keyed by name) and the
|
|
8
|
+
* `WalletTopup` capability; `checkWalletAvailability()` (once per session,
|
|
9
|
+
* before showing the row) answers whether THIS device can tokenize.
|
|
10
|
+
* 2. Estimate with a wallet `payment_method` (no card id) — the response owns
|
|
11
|
+
* the instrument and names the `provider` whose config block applies.
|
|
9
12
|
* 3. `createWalletTopUpForm(...).mount(container)` — the frame renders the
|
|
10
|
-
* review screen
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `@wirexapp/card-3ds-web`.
|
|
13
|
+
* review screen from your quote and the wallet buttons under Wirex's
|
|
14
|
+
* merchant identity. No Apple/Google registration, no certificates.
|
|
15
|
+
* 4. The payment sheet's encrypted payload arrives in `onToken` — relay it
|
|
16
|
+
* VERBATIM as the execute call's `wallet_payment_token`. No 3DS ever
|
|
17
|
+
* happens on this path; reconcile the money-moved truth on your backend.
|
|
16
18
|
*/
|
|
17
|
-
import { PciWalletTopUpElement, type PciSdkConfig, type PciWalletAvailability, type PciWalletTopUpElementConfig } from '@wirexapp/card-sdk-core';
|
|
19
|
+
import { PciWalletTopUpElement, type PciSdkConfig, type PciWalletAvailability, type PciWalletProviderConfig, type PciWalletTopUpElementConfig, type PciWalletTopUpPopup, type PciWalletTopUpPopupConfig } from '@wirexapp/card-sdk-core';
|
|
18
20
|
/** Config of the combined (review + buttons) wallet checkout element. */
|
|
19
21
|
export type WalletTopUpFormConfig = PciWalletTopUpElementConfig;
|
|
20
22
|
export type WalletTopUpForm = PciWalletTopUpElement;
|
|
23
|
+
export interface CheckWalletAvailabilityOptions {
|
|
24
|
+
force?: boolean;
|
|
25
|
+
/** The app config's `topup` provider block (`default_provider` entry —
|
|
26
|
+
* before a quote exists there is nothing to echo). When present its Google
|
|
27
|
+
* Pay values drive the readiness check verbatim. */
|
|
28
|
+
config?: PciWalletProviderConfig;
|
|
29
|
+
}
|
|
21
30
|
/**
|
|
22
31
|
* Phase-A availability check. Run it before showing the wallet row at all —
|
|
23
32
|
* `false` means hide the row (`googlePay: false` on desktop/non-Chrome is
|
|
24
33
|
* expected: the cryptogram-only policy has no eligible cards there).
|
|
25
34
|
*/
|
|
26
|
-
export declare const checkWalletAvailability: (sdk: PciSdkConfig, options?:
|
|
27
|
-
force?: boolean;
|
|
28
|
-
}) => Promise<PciWalletAvailability>;
|
|
35
|
+
export declare const checkWalletAvailability: (sdk: PciSdkConfig, options?: CheckWalletAvailabilityOptions) => Promise<PciWalletAvailability>;
|
|
29
36
|
/** Combined variant: review screen + wallet buttons in one Wirex-served frame. */
|
|
30
37
|
export declare const createWalletTopUpForm: (sdk: PciSdkConfig, config: WalletTopUpFormConfig) => WalletTopUpForm;
|
|
31
38
|
export type * from '@wirexapp/card-sdk-core';
|
|
32
39
|
export { PciFrameRequestError } from '@wirexapp/card-sdk-core';
|
|
40
|
+
/** Mode B: the wallet checkout opened TOP-LEVEL in a popup on the frames
|
|
41
|
+
* domain. Apple binds merchant sessions to the top-level page's domain — in
|
|
42
|
+
* a popup that is the frames origin itself (already Apple-verified), so
|
|
43
|
+
* hosts need NO Apple domain registration or association file in this mode.
|
|
44
|
+
* MUST be called synchronously from a click handler (popup blockers). The
|
|
45
|
+
* encrypted token still arrives in `onToken`; the host still executes. */
|
|
46
|
+
export declare const openWalletCheckoutPopup: (sdk: PciSdkConfig, config: PciWalletTopUpPopupConfig) => PciWalletTopUpPopup;
|
|
47
|
+
export type { PciWalletTopUpPopup as WalletTopUpPopup, PciWalletTopUpPopupConfig as WalletTopUpPopupConfig };
|
|
33
48
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAIL,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC/B,MAAM,yBAAyB,CAAC;AAEjC,yEAAyE;AACzE,MAAM,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAChE,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAC;AASpD,MAAM,WAAW,8BAA8B;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;yDAEqD;IACrD,MAAM,CAAC,EAAE,uBAAuB,CAAC;CAClC;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,KAAK,YAAY,EACjB,UAAU,8BAA8B,KACvC,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;AAE/D;;;;;2EAK2E;AAC3E,eAAO,MAAM,uBAAuB,GAClC,KAAK,YAAY,EACjB,QAAQ,yBAAyB,KAChC,mBAA0F,CAAC;AAE9F,YAAY,EAAE,mBAAmB,IAAI,gBAAgB,EAAE,yBAAyB,IAAI,sBAAsB,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
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
|
|
3
|
+
* a Wirex-served checkout iframe. Design: docs/WALLET-TOPUP-DESIGN.md, on the
|
|
4
|
+
* confirmed backend contract ("Wallet Top-Ups Integration").
|
|
4
5
|
*
|
|
5
|
-
* The flow (
|
|
6
|
-
* 1.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* The flow (host's view):
|
|
7
|
+
* 1. Read the app config's `topup` block (providers keyed by name) and the
|
|
8
|
+
* `WalletTopup` capability; `checkWalletAvailability()` (once per session,
|
|
9
|
+
* before showing the row) answers whether THIS device can tokenize.
|
|
10
|
+
* 2. Estimate with a wallet `payment_method` (no card id) — the response owns
|
|
11
|
+
* the instrument and names the `provider` whose config block applies.
|
|
9
12
|
* 3. `createWalletTopUpForm(...).mount(container)` — the frame renders the
|
|
10
|
-
* review screen
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `@wirexapp/card-3ds-web`.
|
|
13
|
+
* review screen from your quote and the wallet buttons under Wirex's
|
|
14
|
+
* merchant identity. No Apple/Google registration, no certificates.
|
|
15
|
+
* 4. The payment sheet's encrypted payload arrives in `onToken` — relay it
|
|
16
|
+
* VERBATIM as the execute call's `wallet_payment_token`. No 3DS ever
|
|
17
|
+
* happens on this path; reconcile the money-moved truth on your backend.
|
|
16
18
|
*/
|
|
17
|
-
import { buildFrameUrl, probeWalletAvailability, PciWalletTopUpElement, } from '@wirexapp/card-sdk-core';
|
|
19
|
+
import { buildFrameUrl, openWalletTopUpPopup, probeWalletAvailability, PciWalletTopUpElement, } from '@wirexapp/card-sdk-core';
|
|
18
20
|
/** One probe per frame URL (environment + client) per page session — the
|
|
19
21
|
* checks take no transaction context, so the result cannot go stale within a
|
|
20
|
-
* session.
|
|
22
|
+
* session. The provider config is assumed stable per session (it comes from
|
|
23
|
+
* the app config), so it does not partition the cache. Failed probes are not
|
|
24
|
+
* cached. */
|
|
21
25
|
const availabilityCache = new Map();
|
|
22
26
|
/**
|
|
23
27
|
* Phase-A availability check. Run it before showing the wallet row at all —
|
|
@@ -31,7 +35,7 @@ export const checkWalletAvailability = (sdk, options) => {
|
|
|
31
35
|
if (cached)
|
|
32
36
|
return cached;
|
|
33
37
|
}
|
|
34
|
-
const probe = probeWalletAvailability(frameUrl).catch((error) => {
|
|
38
|
+
const probe = probeWalletAvailability(frameUrl, options?.config).catch((error) => {
|
|
35
39
|
availabilityCache.delete(frameUrl);
|
|
36
40
|
throw error;
|
|
37
41
|
});
|
|
@@ -43,4 +47,11 @@ export const createWalletTopUpForm = (sdk, config) => new PciWalletTopUpElement(
|
|
|
43
47
|
// Value re-export so `error instanceof PciFrameRequestError` works when
|
|
44
48
|
// imported from this package.
|
|
45
49
|
export { PciFrameRequestError } from '@wirexapp/card-sdk-core';
|
|
50
|
+
/** Mode B: the wallet checkout opened TOP-LEVEL in a popup on the frames
|
|
51
|
+
* domain. Apple binds merchant sessions to the top-level page's domain — in
|
|
52
|
+
* a popup that is the frames origin itself (already Apple-verified), so
|
|
53
|
+
* hosts need NO Apple domain registration or association file in this mode.
|
|
54
|
+
* MUST be called synchronously from a click handler (popup blockers). The
|
|
55
|
+
* encrypted token still arrives in `onToken`; the host still executes. */
|
|
56
|
+
export const openWalletCheckoutPopup = (sdk, config) => openWalletTopUpPopup(buildFrameUrl(sdk, 'wallet-checkout'), config);
|
|
46
57
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,GAOtB,MAAM,yBAAyB,CAAC;AAMjC;;;;cAIc;AACd,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAA0C,CAAC;AAU5E;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,GAAiB,EACjB,OAAwC,EACR,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,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACxF,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;AAE/D;;;;;2EAK2E;AAC3E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,GAAiB,EACjB,MAAiC,EACZ,EAAE,CAAC,oBAAoB,CAAC,aAAa,CAAC,GAAG,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirexapp/card-wallet-topup-web",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.5",
|
|
4
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
|
|
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 payment sheet's encrypted token is returned to the host, which executes the top-up. No wallet onboarding on the partner side.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"module": "./dist/index.js",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"prepublishOnly": "yarn clean && yarn build"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@wirexapp/card-sdk-core": "0.1.0-beta.
|
|
40
|
+
"@wirexapp/card-sdk-core": "0.1.0-beta.5"
|
|
41
41
|
}
|
|
42
42
|
}
|