@wirexapp/card-sdk-core 0.1.0-beta.3 → 0.1.0-beta.4

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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # @wirexapp/card-sdk-core
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
+
3
31
  ## 0.1.0-beta.3
4
32
 
5
33
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -16,8 +16,8 @@ export { PciCollectGroup } from './collectGroup.js';
16
16
  export { PciFrameChannel, PciFrameRequestError } from './frameChannel.js';
17
17
  export type { PciEnvironment, PciFrameDocument, PciSdkConfig } from './frameUrl.js';
18
18
  export { buildFrameUrl, resolveFrameOrigin } from './frameUrl.js';
19
- export type { PciAppearance, PciAppearanceVariables, PciBrandBadgeAppearance, PciCardBrand, PciCollectChangeState, PciCollectFieldInitConfig, PciCollectFieldName, PciCollectInitConfig, PciCollectProfile, PciFrameAuth, PciFrameError, PciFrameStrings, PciFrameToHostMessage, PciHostToFrameMessage, PciInitConfig, PciRevealField, PciRevealInitConfig, PciRevealState, PciRevealStatus, PciTokenizeOctRequest, PciTokenizeOctResult, PciTokenizeRequest, PciTokenizeTopUpRequest, PciTokenizeTopUpResult, PciWalletAvailability, PciWalletButtonAppearance, PciWalletCheckoutInitConfig, PciWalletCheckoutState, PciWalletProbeInitConfig, PciWalletSessionRef, PciWalletTopUpResultDto, } from './protocol.js';
19
+ export type { PciAppearance, PciAppearanceVariables, PciBrandBadgeAppearance, PciCardBrand, PciCollectChangeState, PciCollectFieldInitConfig, PciCollectFieldName, PciCollectInitConfig, PciCollectProfile, PciFrameAuth, PciFrameError, PciFrameStrings, PciFrameToHostMessage, PciHostToFrameMessage, PciInitConfig, PciRevealField, PciRevealInitConfig, PciRevealState, PciRevealStatus, PciTokenizeOctRequest, PciTokenizeOctResult, PciTokenizeRequest, PciTokenizeTopUpRequest, PciTokenizeTopUpResult, PciWalletApplePayConfig, PciWalletAvailability, PciWalletButtonAppearance, PciWalletCheckoutInitConfig, PciWalletCheckoutState, PciWalletGooglePayConfig, PciWalletMoney, PciWalletPaymentTokenDto, PciWalletProbeInitConfig, PciWalletProviderConfig, PciWalletQuote, } from './protocol.js';
20
20
  export { PCI_PROTOCOL_VERSION } from './protocol.js';
21
- export type { PciWalletTopUpElementConfig, PciWalletTopUpResult, PciWalletTopUpSession, } from './walletElement.js';
21
+ export type { PciWalletPaymentToken, PciWalletTopUpElementConfig, } from './walletElement.js';
22
22
  export { PciWalletTopUpElement, probeWalletAvailability } from './walletElement.js';
23
23
  //# sourceMappingURL=index.d.ts.map
@@ -1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EAAE,MAAM,iBAAiB,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAkC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAMlD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAsC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAKlD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -227,6 +227,11 @@ export interface PciRevealInitConfig {
227
227
  * request's result carries `PciWalletAvailability`. */
228
228
  export interface PciWalletProbeInitConfig {
229
229
  mode: 'wallet-probe';
230
+ /** Provider wallet config (from the app config's `topup` block). Optional —
231
+ * the probe is loadable before any quote — but when present its Google Pay
232
+ * values (auth methods, networks) are used verbatim so the availability
233
+ * answer reflects the real tokenization path instead of built-in defaults. */
234
+ config?: PciWalletProviderConfig;
230
235
  }
231
236
  export interface PciWalletAvailability {
232
237
  applePay: boolean;
@@ -247,42 +252,112 @@ export interface PciWalletButtonAppearance {
247
252
  type?: 'plain' | 'pay' | 'buy';
248
253
  };
249
254
  }
255
+ export interface PciWalletMoney {
256
+ amount: string | number;
257
+ currency: string;
258
+ }
259
+ /**
260
+ * Provider wallet config blocks — the `topup.providers.<name>` entry of
261
+ * `GET /api/v1/config`, passed through VERBATIM in the backend's own casing.
262
+ * The frame copies these values into the platform payment requests unchanged
263
+ * (contract rule: a value that is wrong here reaches the provider unchanged,
264
+ * so nothing is normalised, re-cased or hardcoded).
265
+ */
266
+ export interface PciWalletApplePayConfig {
267
+ merchant_name?: string;
268
+ /** ISO-3166-1 alpha-2 — the acquirer's country, not the cardholder's. */
269
+ merchant_country_code?: string;
270
+ /** Apple's values, e.g. `supports3DS`. */
271
+ merchant_capabilities?: string[];
272
+ /** Apple's casing — `visa`, `masterCard`. */
273
+ supported_networks?: string[];
274
+ /** Empty when the acquirer needs none. */
275
+ required_billing_contact_fields?: string[];
276
+ /** `ApplePaySession` version the page constructs. */
277
+ api_version?: number;
278
+ }
279
+ export interface PciWalletGooglePayConfig {
280
+ merchant_id?: string;
281
+ merchant_name?: string;
282
+ merchant_country_code?: string;
283
+ /** Gateway as registered with Google, and the merchant id it knows you by. */
284
+ gateway_name?: string;
285
+ gateway_merchant_id?: string;
286
+ api_version?: number;
287
+ api_version_minor?: number;
288
+ /** Read, never hardcoded — `CRYPTOGRAM_3DS` alone keeps this leg out of 3DS. */
289
+ allowed_auth_methods?: string[];
290
+ /** Google's casing — `VISA`, `MASTERCARD`. */
291
+ allowed_card_networks?: string[];
292
+ allow_credit_cards?: boolean;
293
+ allow_prepaid_cards?: boolean;
294
+ billing_address_required?: boolean;
295
+ /** Read only when `billing_address_required`. */
296
+ billing_address_parameters?: {
297
+ format?: string;
298
+ phone_number_required?: boolean;
299
+ };
300
+ /** Lowest Android WebView major version that reaches the native sheet. */
301
+ min_webview_version?: number;
302
+ }
303
+ /** A provider that doesn't acquire a given method simply omits that key —
304
+ * an absent `apple_pay` is not an error state; it means "don't offer it". */
305
+ export interface PciWalletProviderConfig {
306
+ apple_pay?: PciWalletApplePayConfig;
307
+ google_pay?: PciWalletGooglePayConfig;
308
+ }
250
309
  /**
251
- * Wallet checkout frame init. The host passes ONLY the estimation reference and
252
- * the checkout token (short-lived, estimation-scoped, minted by the estimate
253
- * call) — the frame fetches the estimation view and the wallet config from the
254
- * backend itself. No amounts, no API URLs, nothing in the frame URL.
310
+ * The quote the frame renders and binds the payment sheet to — taken from the
311
+ * host's estimate response (`POST /api/v1/cards/topup/estimate` with a wallet
312
+ * `payment_method`). The backend re-validates the estimation on execute, so
313
+ * the sheet display is UX; the estimation is the priced truth.
314
+ */
315
+ export interface PciWalletQuote {
316
+ estimationId: string;
317
+ /** The fiat leg the sheet charges (estimate `source_amount`/`_currency`). */
318
+ sourceAmount: PciWalletMoney;
319
+ /** "You receive" row — the on-chain leg (`currency` = token symbol). */
320
+ destinationAmount?: PciWalletMoney;
321
+ fee?: PciWalletMoney;
322
+ /** Display-only rate line. */
323
+ rate?: string;
324
+ /** Estimate `expires_at` converted to epoch MILLISECONDS. Drives the
325
+ * countdown + button disable; the server check on execute is the guarantee. */
326
+ expiresAtMs?: number;
327
+ }
328
+ /**
329
+ * Wallet checkout frame init. The host passes the quote (from its estimate
330
+ * call) and the provider's wallet config (from the app config, keyed by the
331
+ * estimate's `provider`) — the frame makes no backend calls of its own except
332
+ * Apple merchant validation. Everything rides postMessage; nothing sensitive
333
+ * is in the frame URL.
255
334
  */
256
335
  export interface PciWalletCheckoutInitConfig {
257
336
  mode: 'wallet-checkout';
258
- estimationId: string;
259
- checkoutToken: string;
337
+ quote: PciWalletQuote;
338
+ config: PciWalletProviderConfig;
260
339
  appearance?: PciAppearance;
261
340
  buttons?: PciWalletButtonAppearance;
262
341
  strings?: PciFrameStrings;
263
342
  }
264
- /** Fresh estimation reference for re-arming a mounted checkout frame
265
- * (e.g. after the previous estimation expired). */
266
- export interface PciWalletSessionRef {
267
- estimationId: string;
268
- checkoutToken: string;
269
- }
270
- export type PciWalletCheckoutState = 'loading' | 'ready' | 'sheet-open' | 'executing';
343
+ export type PciWalletCheckoutState = 'loading' | 'ready' | 'sheet-open';
271
344
  /**
272
- * Terminal outcome of one wallet payment attempt. `threeDsRequired` is the
273
- * designed-in fallback (WALLET-TOPUP-DESIGN.md D6): feed `url` into
274
- * `@wirexapp/card-3ds-web`. A UX signal only — the money-moved truth is the
275
- * partner backend's webhook / status check.
345
+ * One authorized payment sheet's output. `walletPaymentToken` is the encrypted
346
+ * payload straight off the sheet, serialized for the wire — relay it VERBATIM
347
+ * as the execute call's `wallet_payment_token` (never parse, reshape or log
348
+ * it; max 16384 chars server-side). The rest is non-sensitive display
349
+ * metadata. The sheet has already closed successfully when this arrives —
350
+ * sheet success means "tokenized", not "money moved"; the execute response
351
+ * and the status feed own the top-up outcome, and `three_ds_state` is never
352
+ * present on a wallet top-up.
276
353
  */
277
- export type PciWalletTopUpResultDto = {
278
- kind: 'completed' | 'pending' | 'failed';
279
- topupId: string;
280
- status: string;
281
- } | {
282
- kind: 'threeDsRequired';
283
- topupId: string;
284
- url: string;
285
- };
354
+ export interface PciWalletPaymentTokenDto {
355
+ method: 'apple_pay' | 'google_pay';
356
+ walletPaymentToken: string;
357
+ cardNetwork?: string;
358
+ panLast4?: string;
359
+ displayName?: string;
360
+ }
286
361
  export type PciInitConfig = PciCollectInitConfig | PciCollectFieldInitConfig | PciRevealInitConfig | PciWalletProbeInitConfig | PciWalletCheckoutInitConfig;
287
362
  /** Extra non-sensitive data merged into the tokenize call by the frame. */
288
363
  export interface PciTokenizeTopUpRequest {
@@ -346,12 +421,14 @@ export type PciHostToFrameMessage = Envelope & ({
346
421
  requestId: string;
347
422
  payload: PciTokenizeRequest;
348
423
  }
349
- /** Re-arm a mounted wallet checkout frame with a fresh estimation — the
350
- * frame refetches and re-renders; no remount. */
424
+ /** Re-arm a mounted wallet checkout frame with a fresh quote (typically
425
+ * after expiry) — re-renders in place, no remount. `config` rides along
426
+ * because the fresh estimate's `provider` may differ from the last one. */
351
427
  | {
352
428
  type: 'wallet-update';
353
429
  requestId: string;
354
- session: PciWalletSessionRef;
430
+ quote: PciWalletQuote;
431
+ config: PciWalletProviderConfig;
355
432
  });
356
433
  export type PciFrameToHostMessage = Envelope & ({
357
434
  type: 'ready';
@@ -373,27 +450,32 @@ export type PciFrameToHostMessage = Envelope & ({
373
450
  type: 'reveal-copied';
374
451
  field: PciRevealField;
375
452
  }
376
- /** Wallet checkout lifecycle. `sheet-open` = the OS wallet sheet is up;
377
- * `executing` = token obtained, execute call in flight (the host arms its
378
- * watchdog on this). */
453
+ /** Wallet checkout lifecycle. `sheet-open` = the OS wallet sheet is up. */
379
454
  | {
380
455
  type: 'wallet-state';
381
456
  state: PciWalletCheckoutState;
382
457
  }
383
- /** The user dismissed the wallet sheet — no backend call was made. */
458
+ /** The user dismissed the wallet sheet — nothing was tokenized. */
384
459
  | {
385
460
  type: 'wallet-cancelled';
386
461
  }
387
- /** The estimation reached `valid_until`; buttons are disabled until the
388
- * host re-arms via `wallet-update`. */
462
+ /** The sheet opened but no token came out (session/tokenization failure).
463
+ * `reason` is a stable slug, e.g. `merchant_validation_failed`. */
464
+ | {
465
+ type: 'wallet-attempt-failed';
466
+ reason: string;
467
+ }
468
+ /** The quote reached `expiresAtMs`; buttons are disabled until the host
469
+ * re-estimates and re-arms via `wallet-update`. */
389
470
  | {
390
471
  type: 'wallet-estimation-expired';
391
472
  }
392
- /** Terminal outcome of one wallet payment attempt (user-gesture-driven, so
393
- * an event rather than a request/response pair). */
473
+ /** The sheet authorized — the encrypted token is handed to the host, which
474
+ * calls execute (user-gesture-driven, so an event rather than a
475
+ * request/response pair). */
394
476
  | {
395
- type: 'wallet-result';
396
- result: PciWalletTopUpResultDto;
477
+ type: 'wallet-token';
478
+ token: PciWalletPaymentTokenDto;
397
479
  } | {
398
480
  type: 'result';
399
481
  requestId: string;
@@ -1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ACjD;;;0EAG0E;GACxE;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE;AAClD,2EAA2E;GACzE;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,sBAAsB,CAAA;CAAE;AACzD,mEAAmE;GACjE;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE;AAC9B;oEACoE;GAClE;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AACnD;oDACoD;GAClD;IAAE,IAAI,EAAE,2BAA2B,CAAA;CAAE;AACvC;;8BAE8B;GAC5B;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,wBAAwB,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,aAAa,CAAA;CAAE,CACzE,CAAC"}
@@ -1,73 +1,61 @@
1
- import type { PciAppearance, PciFrameStrings, PciWalletAvailability, PciWalletButtonAppearance, PciWalletCheckoutState, PciWalletTopUpResultDto } from './protocol.js';
2
- export interface PciWalletTopUpSession {
3
- /** From the partner backend's estimate call. */
4
- estimationId: string;
5
- /**
6
- * Called at mount/update time so a refreshed estimation can re-arm the
7
- * element. The token is the frame flow's only credential (short-lived,
8
- * estimation-scoped, single successful execute) — it authorizes the frame's
9
- * backend calls: estimation view, wallet config, validate-merchant, execute.
10
- */
11
- getCheckoutToken: () => Promise<string>;
12
- }
13
- export type PciWalletTopUpResult = PciWalletTopUpResultDto;
1
+ import type { PciAppearance, PciFrameStrings, PciWalletAvailability, PciWalletButtonAppearance, PciWalletCheckoutState, PciWalletPaymentTokenDto, PciWalletProviderConfig, PciWalletQuote } from './protocol.js';
2
+ export type PciWalletPaymentToken = PciWalletPaymentTokenDto;
14
3
  export interface PciWalletTopUpElementConfig {
15
- session: PciWalletTopUpSession;
4
+ /** From your estimate call (a wallet `payment_method`, no card id). */
5
+ quote: PciWalletQuote;
6
+ /** The provider block of the app config's `topup` section, selected by the
7
+ * ESTIMATE's `provider` field — passed to the frame verbatim. */
8
+ walletConfig: PciWalletProviderConfig;
16
9
  appearance?: PciAppearance;
17
10
  buttons?: PciWalletButtonAppearance;
18
11
  strings?: PciFrameStrings;
19
- /** Estimation + wallet config loaded, review screen rendered. */
12
+ /** Review screen rendered, buttons live. */
20
13
  onReady?: () => void;
21
14
  onStateChange?: (state: PciWalletCheckoutState) => void;
22
- /** The user dismissed the wallet sheet — no backend call was made. */
15
+ /** The user dismissed the wallet sheet — nothing was tokenized. */
23
16
  onCancel?: () => void;
24
- /** The estimation expired in view. Re-estimate through your backend and call
25
- * `update()` with the fresh estimation — no remount needed. */
17
+ /** The sheet opened but produced no token (e.g. merchant validation
18
+ * failure). `reason` is a stable slug for messaging/analytics. */
19
+ onAttemptFailed?: (reason: string) => void;
20
+ /** The quote expired in view. Re-estimate through your backend and call
21
+ * `update()` with the fresh quote — no remount needed. */
26
22
  onEstimationExpired?: () => void;
27
23
  /**
28
- * Terminal outcome of one payment attempt. A UX signal only — reconcile the
29
- * money-moved truth on your backend (webhook / status API). The
30
- * `threeDsRequired` variant is the designed-in fallback: feed its `url` into
31
- * `@wirexapp/card-3ds-web`.
32
- */
33
- onResult: (result: PciWalletTopUpResult) => void;
34
- /**
35
- * Execute-phase watchdog (ms, default 90_000). If the frame reported
36
- * `executing` and no result arrived in time (lost message, hung request),
37
- * `onResult` fires once with `{ kind: 'pending', status: 'watchdog_timeout' }`
38
- * instead of hanging the user.
24
+ * The payment sheet authorized. Relay `walletPaymentToken` VERBATIM as the
25
+ * execute call's `wallet_payment_token` (never parse, reshape or log it).
26
+ * The sheet has already closed successfully — its success means
27
+ * "tokenized"; the execute response and your status feed own the top-up
28
+ * outcome. `three_ds_state` is never present on a wallet top-up.
39
29
  */
40
- executeTimeoutMs?: number;
30
+ onToken: (token: PciWalletPaymentToken) => void;
41
31
  }
42
32
  /**
43
33
  * The wallet checkout element — review screen + wallet buttons in one
44
- * Wirex-served iframe. `mount()` resolves when the frame has fetched the
45
- * estimation and rendered; payment attempts are user-gesture-driven inside the
46
- * frame and surface through the config callbacks.
34
+ * Wirex-served iframe. `mount()` resolves when the frame has rendered the
35
+ * quote; payment attempts are user-gesture-driven inside the frame and
36
+ * surface through the config callbacks.
47
37
  */
48
38
  export declare class PciWalletTopUpElement {
49
39
  private readonly config;
50
40
  private readonly channel;
51
- private session;
52
- private watchdog;
53
- /** One terminal outcome per payment attempt; re-armed when a new sheet opens. */
41
+ /** One token per payment attempt; re-armed when a new sheet opens. */
54
42
  private attemptSettled;
55
43
  constructor(frameUrl: string, config: PciWalletTopUpElementConfig);
56
44
  mount(container: HTMLElement): Promise<void>;
57
- /** Re-arm a mounted element with a fresh estimation (typically after
58
- * `onEstimationExpired`) — the frame refetches and re-renders in place. */
59
- update(session: PciWalletTopUpSession): Promise<void>;
45
+ /** Re-arm a mounted element with a fresh quote (typically after
46
+ * `onEstimationExpired`) — re-renders in place. Pass `walletConfig` when
47
+ * the fresh estimate's `provider` selects a different config block. */
48
+ update(quote: PciWalletQuote, walletConfig?: PciWalletProviderConfig): Promise<void>;
60
49
  destroy(): void;
61
- private armWatchdog;
62
- private clearWatchdog;
63
- private settle;
64
50
  }
65
51
  /**
66
52
  * Phase-A availability probe: mounts a hidden probe frame that runs
67
53
  * `ApplePaySession.canMakePayments()` / Google Pay `isReadyToPay()`
68
54
  * (cryptogram-only) and reports booleans. No transaction context, no backend
69
- * calls. Callers cache the result per page session — see
70
- * `checkWalletAvailability` in `@wirexapp/card-wallet-topup-web`.
55
+ * calls. Pass the provider's wallet config when you have it (app config's
56
+ * `topup` block, `default_provider` entry) so the Google check mirrors the
57
+ * real tokenization parameters. Callers cache the result per page session —
58
+ * see `checkWalletAvailability` in `@wirexapp/card-wallet-topup-web`.
71
59
  */
72
- export declare const probeWalletAvailability: (frameUrl: string) => Promise<PciWalletAvailability>;
60
+ export declare const probeWalletAvailability: (frameUrl: string, config?: PciWalletProviderConfig) => Promise<PciWalletAvailability>;
73
61
  //# sourceMappingURL=walletElement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"walletElement.d.ts","sourceRoot":"","sources":["../src/walletElement.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,qBAAqB;IACpC,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CACzC;AAED,MAAM,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAE3D,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,qBAAqB,CAAC;IAC/B,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACxD,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;oEACgE;IAChE,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACjD;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID;;;;;GAKG;AACH,qBAAa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,KAAK,IAAI,CAAC;IACxD,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;uEACmE;IACnE,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C;+DAC2D;IAC3D,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC;;;;;;OAMG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACjD;AAED;;;;;GAKG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA8B;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,sEAAsE;IACtE,OAAO,CAAC,cAAc,CAAS;gBAEnB,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,2BAA2B;IA6B3D,KAAK,CAAC,SAAS,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBlD;;4EAEwE;IAClE,MAAM,CAAC,KAAK,EAAE,cAAc,EAAE,YAAY,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1F,OAAO,IAAI,IAAI;CAGhB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,GAClC,UAAU,MAAM,EAChB,SAAS,uBAAuB,KAC/B,OAAO,CAAC,qBAAqB,CAqB/B,CAAC"}
@@ -1,49 +1,50 @@
1
1
  /**
2
2
  * Wallet top-up (Apple Pay / Google Pay) host-side machinery: the checkout
3
3
  * element that mounts the Wirex-hosted wallet frame, and the availability
4
- * probe. Design: docs/WALLET-TOPUP-DESIGN.md.
4
+ * probe. Design: docs/WALLET-TOPUP-DESIGN.md, on the confirmed backend
5
+ * contract ("Wallet Top-Ups Integration").
5
6
  *
6
7
  * Unlike collect/reveal this is not CHD isolation — wallet tokens are
7
- * encrypted, gateway-bound blobs. The frame exists for (a) Apple Pay's origin
8
+ * encrypted, gateway-bound blobs. The frame exists for Apple Pay's origin
8
9
  * binding: the wallet JS must run on a Wirex-registered domain, so partners
9
- * skip Apple onboarding entirely; and (b) amount integrity: the frame fetches
10
- * the estimation from the backend itself, so the review screen shows
11
- * backend-priced amounts the host page cannot spoof.
10
+ * skip Apple onboarding entirely. The frame TOKENIZES AND RETURNS: the sheet's
11
+ * encrypted payload arrives in `onToken`, and the HOST calls the execute
12
+ * endpoint with it (`wallet_payment_token`). There is no 3DS on this path.
12
13
  */
13
14
  import { PciFrameChannel } from './frameChannel.js';
14
- const EXECUTE_WATCHDOG_MS = 90000;
15
15
  /**
16
16
  * The wallet checkout element — review screen + wallet buttons in one
17
- * Wirex-served iframe. `mount()` resolves when the frame has fetched the
18
- * estimation and rendered; payment attempts are user-gesture-driven inside the
19
- * frame and surface through the config callbacks.
17
+ * Wirex-served iframe. `mount()` resolves when the frame has rendered the
18
+ * quote; payment attempts are user-gesture-driven inside the frame and
19
+ * surface through the config callbacks.
20
20
  */
21
21
  export class PciWalletTopUpElement {
22
22
  constructor(frameUrl, config) {
23
- this.watchdog = null;
24
- /** One terminal outcome per payment attempt; re-armed when a new sheet opens. */
23
+ /** One token per payment attempt; re-armed when a new sheet opens. */
25
24
  this.attemptSettled = false;
26
25
  this.config = config;
27
- this.session = config.session;
28
26
  this.channel = new PciFrameChannel(frameUrl, {}, { allowPayment: true });
29
27
  this.channel.onMessage(message => {
30
28
  switch (message.type) {
31
29
  case 'wallet-state':
32
30
  if (message.state === 'sheet-open')
33
31
  this.attemptSettled = false;
34
- if (message.state === 'executing')
35
- this.armWatchdog();
36
32
  this.config.onStateChange?.(message.state);
37
33
  break;
38
34
  case 'wallet-cancelled':
39
- this.clearWatchdog();
40
35
  this.config.onCancel?.();
41
36
  break;
37
+ case 'wallet-attempt-failed':
38
+ this.config.onAttemptFailed?.(message.reason);
39
+ break;
42
40
  case 'wallet-estimation-expired':
43
41
  this.config.onEstimationExpired?.();
44
42
  break;
45
- case 'wallet-result':
46
- this.settle(message.result);
43
+ case 'wallet-token':
44
+ if (this.attemptSettled)
45
+ break;
46
+ this.attemptSettled = true;
47
+ this.config.onToken(message.token);
47
48
  break;
48
49
  default:
49
50
  break;
@@ -56,8 +57,8 @@ export class PciWalletTopUpElement {
56
57
  type: 'init',
57
58
  config: {
58
59
  mode: 'wallet-checkout',
59
- estimationId: this.session.estimationId,
60
- checkoutToken: await this.session.getCheckoutToken(),
60
+ quote: this.config.quote,
61
+ config: this.config.walletConfig,
61
62
  appearance: this.config.appearance,
62
63
  buttons: this.config.buttons,
63
64
  strings: this.config.strings,
@@ -65,50 +66,30 @@ export class PciWalletTopUpElement {
65
66
  });
66
67
  this.config.onReady?.();
67
68
  }
68
- /** Re-arm a mounted element with a fresh estimation (typically after
69
- * `onEstimationExpired`) — the frame refetches and re-renders in place. */
70
- async update(session) {
71
- this.session = session;
69
+ /** Re-arm a mounted element with a fresh quote (typically after
70
+ * `onEstimationExpired`) — re-renders in place. Pass `walletConfig` when
71
+ * the fresh estimate's `provider` selects a different config block. */
72
+ async update(quote, walletConfig) {
72
73
  await this.channel.request({
73
74
  type: 'wallet-update',
74
- session: {
75
- estimationId: session.estimationId,
76
- checkoutToken: await session.getCheckoutToken(),
77
- },
75
+ quote,
76
+ config: walletConfig ?? this.config.walletConfig,
78
77
  });
79
78
  }
80
79
  destroy() {
81
- this.clearWatchdog();
82
80
  this.channel.destroy();
83
81
  }
84
- armWatchdog() {
85
- this.clearWatchdog();
86
- this.watchdog = setTimeout(() => {
87
- this.settle({ kind: 'pending', topupId: '', status: 'watchdog_timeout' });
88
- }, this.config.executeTimeoutMs ?? EXECUTE_WATCHDOG_MS);
89
- }
90
- clearWatchdog() {
91
- if (this.watchdog) {
92
- clearTimeout(this.watchdog);
93
- this.watchdog = null;
94
- }
95
- }
96
- settle(result) {
97
- if (this.attemptSettled)
98
- return;
99
- this.attemptSettled = true;
100
- this.clearWatchdog();
101
- this.config.onResult(result);
102
- }
103
82
  }
104
83
  /**
105
84
  * Phase-A availability probe: mounts a hidden probe frame that runs
106
85
  * `ApplePaySession.canMakePayments()` / Google Pay `isReadyToPay()`
107
86
  * (cryptogram-only) and reports booleans. No transaction context, no backend
108
- * calls. Callers cache the result per page session — see
109
- * `checkWalletAvailability` in `@wirexapp/card-wallet-topup-web`.
87
+ * calls. Pass the provider's wallet config when you have it (app config's
88
+ * `topup` block, `default_provider` entry) so the Google check mirrors the
89
+ * real tokenization parameters. Callers cache the result per page session —
90
+ * see `checkWalletAvailability` in `@wirexapp/card-wallet-topup-web`.
110
91
  */
111
- export const probeWalletAvailability = async (frameUrl) => {
92
+ export const probeWalletAvailability = async (frameUrl, config) => {
112
93
  // Zero-sized but not display:none/visibility:hidden — some wallet
113
94
  // availability checks report unavailable inside hidden documents.
114
95
  const container = document.createElement('div');
@@ -122,7 +103,7 @@ export const probeWalletAvailability = async (frameUrl) => {
122
103
  await channel.mount(container);
123
104
  return await channel.request({
124
105
  type: 'init',
125
- config: { mode: 'wallet-probe' },
106
+ config: { mode: 'wallet-probe', config },
126
107
  });
127
108
  }
128
109
  finally {
@@ -1 +1 @@
1
- {"version":3,"file":"walletElement.js","sourceRoot":"","sources":["../src/walletElement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAqDjD,MAAM,mBAAmB,GAAG,KAAM,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,OAAO,qBAAqB;IAQhC,YAAY,QAAgB,EAAE,MAAmC;QAJzD,aAAQ,GAAyC,IAAI,CAAC;QAC9D,iFAAiF;QACzE,mBAAc,GAAG,KAAK,CAAC;QAG7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QACzE,IAAI,CA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AS,CAAC,CAAC;QAC/B,OAAO,MAAM,OAAO,CAAC,OAAO,CAAwB;YAClD,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE;SACzC,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,OAAO,EAAE,CAAC;QAClB,SAAS,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC;AACH,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirexapp/card-sdk-core",
3
- "version": "0.1.0-beta.3",
3
+ "version": "0.1.0-beta.4",
4
4
  "type": "module",
5
5
  "description": "Shared foundation of the Wirex PCI card SDK: postMessage protocol, frame channel, frame-URL building, collect machinery. CHD-free.",
6
6
  "license": "UNLICENSED",