@tagadapay/headless-sdk 1.20.0 → 1.20.1
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 +29 -0
- package/dist/core/helpers/cryptoOnchain.d.ts +83 -0
- package/dist/core/helpers/cryptoOnchain.d.ts.map +1 -0
- package/dist/core/helpers/cryptoOnchain.js +247 -0
- package/dist/core/helpers/cryptoOnchain.js.map +1 -0
- package/dist/core/helpers/oceanpayment.d.ts +33 -0
- package/dist/core/helpers/oceanpayment.d.ts.map +1 -0
- package/dist/core/helpers/oceanpayment.js +111 -0
- package/dist/core/helpers/oceanpayment.js.map +1 -0
- package/dist/core/http.d.ts.map +1 -1
- package/dist/core/http.js +3 -0
- package/dist/core/http.js.map +1 -1
- package/dist/core/index.d.ts +3 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/modules/payment.d.ts +61 -1
- package/dist/core/modules/payment.d.ts.map +1 -1
- package/dist/core/modules/payment.js +244 -2
- package/dist/core/modules/payment.js.map +1 -1
- package/dist/core/modules/portal/types.d.ts +2 -0
- package/dist/core/modules/portal/types.d.ts.map +1 -1
- package/dist/core/types.d.ts +159 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/version.d.ts +1 -1
- package/dist/core/version.js +1 -1
- package/dist/pixels/pixelMapping.d.ts.map +1 -1
- package/dist/pixels/pixelMapping.js +9 -1
- package/dist/pixels/pixelMapping.js.map +1 -1
- package/dist/react/hooks/useCryptoOnchainPayment.d.ts +40 -0
- package/dist/react/hooks/useCryptoOnchainPayment.d.ts.map +1 -0
- package/dist/react/hooks/useCryptoOnchainPayment.js +77 -0
- package/dist/react/hooks/useCryptoOnchainPayment.js.map +1 -0
- package/dist/react/hooks/usePayment.d.ts.map +1 -1
- package/dist/react/hooks/usePayment.js +3 -0
- package/dist/react/hooks/usePayment.js.map +1 -1
- package/dist/react/index.d.ts +4 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +2 -0
- package/dist/react/index.js.map +1 -1
- package/dist/tagada-headless-commerce.min.js +1 -1
- package/dist/tagada-headless-react.min.js +2 -2
- package/dist/tagada-headless-react.min.js.map +4 -4
- package/dist/tagada-headless.js +561 -9
- package/dist/tagada-headless.min.js +2 -2
- package/dist/tagada-headless.min.js.map +4 -4
- package/dist/tagada-pixels.min.js +2 -2
- package/dist/tagada-pixels.min.js.map +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,35 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); the
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.20.1] — 2026-10-22
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Every request carries `X-Tagada-SDK: headless-sdk/<version>`, so the platform can tell which SDK version a store runs. No contract change.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- `payment.mountOceanPayment({ checkoutSessionId, container, mode?, returnUrl?, locale?, signal? })`: pay a
|
|
19
|
+
checkout session with the merchant's own Ocean Payment account, the way the hosted checkout does. With
|
|
20
|
+
Ocean's public key on the integration, Ocean's card fields render in `container`; otherwise, or with
|
|
21
|
+
`mode: 'redirect'`, `pay()` sends the shopper to Ocean's page and back to `returnUrl` (default: the
|
|
22
|
+
current page). `payment.getOceanPaymentConfig(checkoutSessionId)` tells which of the two the store runs.
|
|
23
|
+
- `maybeResumeFromUrl()` and `usePayment()` resume an Ocean card payment after 3-D Secure, which returns
|
|
24
|
+
the shopper to the page with nothing in the URL.
|
|
25
|
+
- On-chain crypto (`crypto_onchain`), paid from your own page with no redirect:
|
|
26
|
+
`payment.getCryptoOnchainOptions(checkoutSessionId)` (networks and coins),
|
|
27
|
+
`payment.createCryptoOnchainPayment({ checkoutSessionId, chainId, asset })` (deposit address, exact amount,
|
|
28
|
+
wallet URI for the QR code; call again for another coin or an expired quote) and
|
|
29
|
+
`payment.getCryptoOnchainStatus({ checkoutSessionId, cryptoOnchainPaymentId })`. `payment.createCryptoOnchainCheckout()`
|
|
30
|
+
runs the whole flow (default network and coin, status polling, quote countdown, `onPaid` once confirmed) and
|
|
31
|
+
`useCryptoOnchainPayment()` is its React hook. Never send `crypto_onchain` to `pay()` / `processApm()`: the API
|
|
32
|
+
refuses it with `422 CRYPTO_ONCHAIN_INLINE_ONLY`.
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- Polling a payment (`processPayment()`, `resumeAfterRedirect()`, `pollPaymentStatus()`) stops at once on
|
|
37
|
+
`rejected` and `error` instead of waiting the full timeout and returning `pending`.
|
|
38
|
+
|
|
10
39
|
## [1.20.0] — 2026-10-16
|
|
11
40
|
|
|
12
41
|
### Added
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* On-chain crypto (`crypto_onchain`): the pure rules of the inline payment and the
|
|
3
|
+
* `CryptoOnchainCheckout` flow. Same behaviour as the hosted (Studio) checkout's crypto panel:
|
|
4
|
+
* default network and coin, status phases, quote countdown, polling until paid.
|
|
5
|
+
*/
|
|
6
|
+
import type { CryptoOnchainCheckoutOptions, CryptoOnchainCheckoutState, CryptoOnchainNetwork, CryptoOnchainOptionsResult, CryptoOnchainPaymentResult, CryptoOnchainPhase, CryptoOnchainSelection, CryptoOnchainStatus, CryptoOnchainStatusResult } from '../types.js';
|
|
7
|
+
/** `paymentSetupConfig` key and payment method name of on-chain crypto. */
|
|
8
|
+
export declare const CRYPTO_ONCHAIN_PAYMENT_METHOD = "crypto_onchain";
|
|
9
|
+
/** How often the checkout polls the status, in milliseconds. */
|
|
10
|
+
export declare const CRYPTO_ONCHAIN_STATUS_POLL_MS = 5000;
|
|
11
|
+
/** Phases after which polling stops. */
|
|
12
|
+
export declare const CRYPTO_ONCHAIN_FINAL_PHASES: readonly CryptoOnchainPhase[];
|
|
13
|
+
/** True for `crypto_onchain` in any spelling a checkout uses (`crypto-onchain`, `crypto_onchain:int_…`). */
|
|
14
|
+
export declare function isCryptoOnchainMethod(method: string | null | undefined): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The default pick: the first mainnet network (testnets only when nothing else is offered) and its
|
|
17
|
+
* first stablecoin, else its first coin. Null when no network offers a coin.
|
|
18
|
+
*/
|
|
19
|
+
export declare function defaultCryptoOnchainSelection(networks: CryptoOnchainNetwork[]): CryptoOnchainSelection | null;
|
|
20
|
+
/** Switching network keeps the coin when the new network offers it, else takes its default coin. */
|
|
21
|
+
export declare function selectCryptoOnchainNetwork(networks: CryptoOnchainNetwork[], chainId: number, currentAsset: string): CryptoOnchainSelection;
|
|
22
|
+
/** The phase of the latest status (or of the payment as created, before the first poll). */
|
|
23
|
+
export declare function cryptoOnchainPhase(status: Pick<CryptoOnchainStatus, 'status' | 'paid' | 'expired'> | null): CryptoOnchainPhase;
|
|
24
|
+
/** Whole seconds until `expiresAt`, never negative; 0 for a missing or unparsable date. */
|
|
25
|
+
export declare function cryptoOnchainSecondsLeft(expiresAt: string | null, nowMs: number): number;
|
|
26
|
+
/** `m:ss` under an hour, `h:mm:ss` above. */
|
|
27
|
+
export declare function formatCryptoOnchainCountdown(seconds: number): string;
|
|
28
|
+
/** The three calls the flow needs; `PaymentModule` provides them. */
|
|
29
|
+
export interface CryptoOnchainApi {
|
|
30
|
+
getCryptoOnchainOptions(checkoutSessionId: string): Promise<CryptoOnchainOptionsResult>;
|
|
31
|
+
createCryptoOnchainPayment(opts: {
|
|
32
|
+
checkoutSessionId: string;
|
|
33
|
+
chainId: number;
|
|
34
|
+
asset: string;
|
|
35
|
+
}): Promise<CryptoOnchainPaymentResult>;
|
|
36
|
+
getCryptoOnchainStatus(opts: {
|
|
37
|
+
checkoutSessionId: string;
|
|
38
|
+
cryptoOnchainPaymentId: string;
|
|
39
|
+
}): Promise<CryptoOnchainStatusResult>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The inline crypto payment of one checkout session: load the networks and coins, keep the pick,
|
|
43
|
+
* create (or re-quote) the payment, poll it until crypto-api confirms it and call `onPaid` once.
|
|
44
|
+
* Create it with `tagada.payment.createCryptoOnchainCheckout()`.
|
|
45
|
+
*/
|
|
46
|
+
export declare class CryptoOnchainCheckout {
|
|
47
|
+
private readonly api;
|
|
48
|
+
private readonly options;
|
|
49
|
+
private state;
|
|
50
|
+
private readonly listeners;
|
|
51
|
+
private pollTimer;
|
|
52
|
+
private stopped;
|
|
53
|
+
private paidNotified;
|
|
54
|
+
constructor(api: CryptoOnchainApi, options: CryptoOnchainCheckoutOptions);
|
|
55
|
+
getState(): CryptoOnchainCheckoutState;
|
|
56
|
+
/** Listens to every state change; returns the unsubscribe function. */
|
|
57
|
+
subscribe(listener: (state: CryptoOnchainCheckoutState) => void): () => void;
|
|
58
|
+
/** What to show: the polled phase, or `expired` once an unpaid quote ran out (renew with `pay()`). */
|
|
59
|
+
getPhase(nowMs?: number): CryptoOnchainPhase;
|
|
60
|
+
/** Whole seconds left on the current quote. */
|
|
61
|
+
getSecondsLeft(nowMs?: number): number;
|
|
62
|
+
/** Loads the networks and coins and picks the default network and coin. */
|
|
63
|
+
loadOptions(): Promise<CryptoOnchainCheckoutState>;
|
|
64
|
+
/** Changes the pick. A new network keeps the coin when it offers it, else takes its default coin. */
|
|
65
|
+
select(next: {
|
|
66
|
+
chainId?: number;
|
|
67
|
+
asset?: string;
|
|
68
|
+
}): void;
|
|
69
|
+
/**
|
|
70
|
+
* Creates the payment for the pick (or `selection`), or re-quotes it: another coin, or a quote
|
|
71
|
+
* that expired. Save the customer and address on the session first. Starts polling.
|
|
72
|
+
*/
|
|
73
|
+
pay(selection?: CryptoOnchainSelection): Promise<CryptoOnchainPaymentResult>;
|
|
74
|
+
/** Polls the status once now (the timer keeps polling until the payment is final). */
|
|
75
|
+
refreshStatus(): Promise<CryptoOnchainStatus | null>;
|
|
76
|
+
/** Polls again after `stop()`, while a payment is open (the customer came back to crypto). */
|
|
77
|
+
resume(): void;
|
|
78
|
+
/** Stops polling (unmount, or the customer chose another payment method). */
|
|
79
|
+
stop(): void;
|
|
80
|
+
private schedulePoll;
|
|
81
|
+
private setState;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=cryptoOnchain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cryptoOnchain.d.ts","sourceRoot":"","sources":["../../../src/core/helpers/cryptoOnchain.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACV,4BAA4B,EAC5B,0BAA0B,EAC1B,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,aAAa,CAAC;AAErB,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B,mBAAmB,CAAC;AAE9D,gEAAgE;AAChE,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD,wCAAwC;AACxC,eAAO,MAAM,2BAA2B,EAAE,SAAS,kBAAkB,EAA+C,CAAC;AAErH,4GAA4G;AAC5G,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAGhF;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,sBAAsB,GAAG,IAAI,CAM7G;AAED,oGAAoG;AACpG,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,oBAAoB,EAAE,EAChC,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,sBAAsB,CAKxB;AAED,4FAA4F;AAC5F,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,IAAI,CAAC,mBAAmB,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC,GAAG,IAAI,GACtE,kBAAkB,CAgBpB;AAED,2FAA2F;AAC3F,w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ACrE,WAAW,IAAI,OAAO,CAAC,0BAA0B,CAAC;IAoBxD,qGAAqG;IACrG,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IASxD;;;OAGG;IACG,GAAG,CAAC,SAAS,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,0BAA0B,CAAC;IA2BlF,sFAAsF;IAChF,aAAa,IAAI,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAkC1D,8FAA8F;IAC9F,MAAM,IAAI,IAAI;IAMd,6EAA6E;IAC7E,IAAI,IAAI,IAAI;IAMZ,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,QAAQ;CAKjB"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/** `paymentSetupConfig` key and payment method name of on-chain crypto. */
|
|
2
|
+
export const CRYPTO_ONCHAIN_PAYMENT_METHOD = 'crypto_onchain';
|
|
3
|
+
/** How often the checkout polls the status, in milliseconds. */
|
|
4
|
+
export const CRYPTO_ONCHAIN_STATUS_POLL_MS = 5000;
|
|
5
|
+
/** Phases after which polling stops. */
|
|
6
|
+
export const CRYPTO_ONCHAIN_FINAL_PHASES = ['paid', 'underpaid', 'failed', 'expired'];
|
|
7
|
+
/** True for `crypto_onchain` in any spelling a checkout uses (`crypto-onchain`, `crypto_onchain:int_…`). */
|
|
8
|
+
export function isCryptoOnchainMethod(method) {
|
|
9
|
+
if (!method)
|
|
10
|
+
return false;
|
|
11
|
+
return method.trim().toLowerCase().replace(/-/g, '_').split(':')[0] === CRYPTO_ONCHAIN_PAYMENT_METHOD;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The default pick: the first mainnet network (testnets only when nothing else is offered) and its
|
|
15
|
+
* first stablecoin, else its first coin. Null when no network offers a coin.
|
|
16
|
+
*/
|
|
17
|
+
export function defaultCryptoOnchainSelection(networks) {
|
|
18
|
+
const usable = networks.filter((network) => network.assets.length > 0);
|
|
19
|
+
const network = usable.find((candidate) => !candidate.testnet) ?? usable[0];
|
|
20
|
+
if (!network)
|
|
21
|
+
return null;
|
|
22
|
+
const asset = network.assets.find((candidate) => candidate.stable) ?? network.assets[0];
|
|
23
|
+
return { chainId: network.chainId, asset: asset.symbol };
|
|
24
|
+
}
|
|
25
|
+
/** Switching network keeps the coin when the new network offers it, else takes its default coin. */
|
|
26
|
+
export function selectCryptoOnchainNetwork(networks, chainId, currentAsset) {
|
|
27
|
+
const assets = networks.find((network) => network.chainId === chainId)?.assets ?? [];
|
|
28
|
+
const keep = assets.find((asset) => asset.symbol === currentAsset);
|
|
29
|
+
const fallback = assets.find((asset) => asset.stable) ?? assets[0];
|
|
30
|
+
return { chainId, asset: (keep ?? fallback)?.symbol ?? currentAsset };
|
|
31
|
+
}
|
|
32
|
+
/** The phase of the latest status (or of the payment as created, before the first poll). */
|
|
33
|
+
export function cryptoOnchainPhase(status) {
|
|
34
|
+
if (!status)
|
|
35
|
+
return 'waiting';
|
|
36
|
+
if (status.paid)
|
|
37
|
+
return 'paid';
|
|
38
|
+
switch (status.status) {
|
|
39
|
+
case 'detected':
|
|
40
|
+
case 'overpaid':
|
|
41
|
+
return 'confirming';
|
|
42
|
+
case 'underpaid':
|
|
43
|
+
return 'underpaid';
|
|
44
|
+
case 'failed':
|
|
45
|
+
return 'failed';
|
|
46
|
+
case 'expired':
|
|
47
|
+
return 'expired';
|
|
48
|
+
default:
|
|
49
|
+
return status.expired ? 'expired' : 'waiting';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** Whole seconds until `expiresAt`, never negative; 0 for a missing or unparsable date. */
|
|
53
|
+
export function cryptoOnchainSecondsLeft(expiresAt, nowMs) {
|
|
54
|
+
if (!expiresAt)
|
|
55
|
+
return 0;
|
|
56
|
+
const end = Date.parse(expiresAt);
|
|
57
|
+
if (Number.isNaN(end))
|
|
58
|
+
return 0;
|
|
59
|
+
return Math.max(0, Math.floor((end - nowMs) / 1000));
|
|
60
|
+
}
|
|
61
|
+
/** `m:ss` under an hour, `h:mm:ss` above. */
|
|
62
|
+
export function formatCryptoOnchainCountdown(seconds) {
|
|
63
|
+
const s = Math.max(0, Math.floor(seconds));
|
|
64
|
+
const h = Math.floor(s / 3600);
|
|
65
|
+
const m = Math.floor((s % 3600) / 60);
|
|
66
|
+
const sec = String(s % 60).padStart(2, '0');
|
|
67
|
+
return h > 0 ? `${h}:${String(m).padStart(2, '0')}:${sec}` : `${m}:${sec}`;
|
|
68
|
+
}
|
|
69
|
+
const UNAVAILABLE = 'Crypto payments are not available right now. Choose another payment method.';
|
|
70
|
+
/**
|
|
71
|
+
* The inline crypto payment of one checkout session: load the networks and coins, keep the pick,
|
|
72
|
+
* create (or re-quote) the payment, poll it until crypto-api confirms it and call `onPaid` once.
|
|
73
|
+
* Create it with `tagada.payment.createCryptoOnchainCheckout()`.
|
|
74
|
+
*/
|
|
75
|
+
export class CryptoOnchainCheckout {
|
|
76
|
+
constructor(api, options) {
|
|
77
|
+
this.api = api;
|
|
78
|
+
this.options = options;
|
|
79
|
+
this.state = {
|
|
80
|
+
options: 'idle',
|
|
81
|
+
networks: [],
|
|
82
|
+
selection: null,
|
|
83
|
+
payment: null,
|
|
84
|
+
paymentStatus: null,
|
|
85
|
+
isCreating: false,
|
|
86
|
+
error: null,
|
|
87
|
+
};
|
|
88
|
+
this.listeners = new Set();
|
|
89
|
+
this.pollTimer = null;
|
|
90
|
+
this.stopped = false;
|
|
91
|
+
this.paidNotified = false;
|
|
92
|
+
this.subscribe = this.subscribe.bind(this);
|
|
93
|
+
this.getState = this.getState.bind(this);
|
|
94
|
+
}
|
|
95
|
+
getState() {
|
|
96
|
+
return this.state;
|
|
97
|
+
}
|
|
98
|
+
/** Listens to every state change; returns the unsubscribe function. */
|
|
99
|
+
subscribe(listener) {
|
|
100
|
+
this.listeners.add(listener);
|
|
101
|
+
return () => {
|
|
102
|
+
this.listeners.delete(listener);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/** What to show: the polled phase, or `expired` once an unpaid quote ran out (renew with `pay()`). */
|
|
106
|
+
getPhase(nowMs = Date.now()) {
|
|
107
|
+
const { payment, paymentStatus } = this.state;
|
|
108
|
+
const phase = cryptoOnchainPhase(paymentStatus ?? (payment ? { status: payment.status, paid: false, expired: false } : null));
|
|
109
|
+
const quoteOver = payment !== null && phase === 'waiting' && cryptoOnchainSecondsLeft(payment.expiresAt, nowMs) === 0;
|
|
110
|
+
return quoteOver ? 'expired' : phase;
|
|
111
|
+
}
|
|
112
|
+
/** Whole seconds left on the current quote. */
|
|
113
|
+
getSecondsLeft(nowMs = Date.now()) {
|
|
114
|
+
return cryptoOnchainSecondsLeft(this.state.payment?.expiresAt ?? null, nowMs);
|
|
115
|
+
}
|
|
116
|
+
/** Loads the networks and coins and picks the default network and coin. */
|
|
117
|
+
async loadOptions() {
|
|
118
|
+
this.setState({ options: 'loading', error: null });
|
|
119
|
+
try {
|
|
120
|
+
const result = await this.api.getCryptoOnchainOptions(this.options.checkoutSessionId);
|
|
121
|
+
if (!result.ok) {
|
|
122
|
+
this.setState({ options: 'unavailable', networks: [], selection: null, error: result.message || UNAVAILABLE });
|
|
123
|
+
return this.state;
|
|
124
|
+
}
|
|
125
|
+
const selection = this.state.selection ?? defaultCryptoOnchainSelection(result.networks);
|
|
126
|
+
this.setState(selection
|
|
127
|
+
? { options: 'ready', networks: result.networks, selection }
|
|
128
|
+
: { options: 'unavailable', networks: result.networks, selection: null, error: UNAVAILABLE });
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
this.setState({ options: 'unavailable', error: messageOf(error) });
|
|
132
|
+
}
|
|
133
|
+
return this.state;
|
|
134
|
+
}
|
|
135
|
+
/** Changes the pick. A new network keeps the coin when it offers it, else takes its default coin. */
|
|
136
|
+
select(next) {
|
|
137
|
+
const current = this.state.selection;
|
|
138
|
+
if (next.chainId !== undefined && next.chainId !== current?.chainId) {
|
|
139
|
+
this.setState({ selection: selectCryptoOnchainNetwork(this.state.networks, next.chainId, next.asset ?? current?.asset ?? '') });
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (next.asset !== undefined && current)
|
|
143
|
+
this.setState({ selection: { ...current, asset: next.asset } });
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Creates the payment for the pick (or `selection`), or re-quotes it: another coin, or a quote
|
|
147
|
+
* that expired. Save the customer and address on the session first. Starts polling.
|
|
148
|
+
*/
|
|
149
|
+
async pay(selection) {
|
|
150
|
+
const target = selection ?? this.state.selection;
|
|
151
|
+
if (!target)
|
|
152
|
+
return { ok: false, code: 'ASSET_NOT_AVAILABLE', message: 'Choose a network and a coin' };
|
|
153
|
+
if (this.state.isCreating)
|
|
154
|
+
return { ok: false, code: 'CHECKOUT_FAILED', message: 'A payment is already being created' };
|
|
155
|
+
this.setState({ isCreating: true, error: null, selection: target });
|
|
156
|
+
try {
|
|
157
|
+
const result = await this.api.createCryptoOnchainPayment({
|
|
158
|
+
checkoutSessionId: this.options.checkoutSessionId,
|
|
159
|
+
chainId: target.chainId,
|
|
160
|
+
asset: target.asset,
|
|
161
|
+
});
|
|
162
|
+
if (!result.ok) {
|
|
163
|
+
this.setState({ isCreating: false, error: result.message });
|
|
164
|
+
return result;
|
|
165
|
+
}
|
|
166
|
+
this.stopped = false;
|
|
167
|
+
this.setState({ isCreating: false, payment: result.payment, paymentStatus: null });
|
|
168
|
+
this.schedulePoll();
|
|
169
|
+
return result;
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
const message = messageOf(error);
|
|
173
|
+
this.setState({ isCreating: false, error: message });
|
|
174
|
+
return { ok: false, code: 'CHECKOUT_FAILED', message };
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/** Polls the status once now (the timer keeps polling until the payment is final). */
|
|
178
|
+
async refreshStatus() {
|
|
179
|
+
const payment = this.state.payment;
|
|
180
|
+
if (!payment)
|
|
181
|
+
return null;
|
|
182
|
+
try {
|
|
183
|
+
const result = await this.api.getCryptoOnchainStatus({
|
|
184
|
+
checkoutSessionId: this.options.checkoutSessionId,
|
|
185
|
+
cryptoOnchainPaymentId: payment.cryptoOnchainPaymentId,
|
|
186
|
+
});
|
|
187
|
+
// A newer quote replaced this payment while the call was in flight.
|
|
188
|
+
if (!result.ok || this.state.payment?.cryptoOnchainPaymentId !== payment.cryptoOnchainPaymentId)
|
|
189
|
+
return null;
|
|
190
|
+
const status = {
|
|
191
|
+
status: result.status,
|
|
192
|
+
paymentId: result.paymentId,
|
|
193
|
+
orderId: result.orderId,
|
|
194
|
+
confirmations: result.confirmations,
|
|
195
|
+
requiredConfirmations: result.requiredConfirmations,
|
|
196
|
+
txHash: result.txHash,
|
|
197
|
+
explorerTxUrl: result.explorerTxUrl,
|
|
198
|
+
paid: result.paid,
|
|
199
|
+
expired: result.expired,
|
|
200
|
+
redirectUrl: result.redirectUrl,
|
|
201
|
+
};
|
|
202
|
+
this.setState({ paymentStatus: status });
|
|
203
|
+
if (status.paid && !this.paidNotified) {
|
|
204
|
+
this.paidNotified = true;
|
|
205
|
+
this.options.onPaid?.(status);
|
|
206
|
+
}
|
|
207
|
+
return status;
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
// The next tick retries; the payment still settles server side.
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/** Polls again after `stop()`, while a payment is open (the customer came back to crypto). */
|
|
215
|
+
resume() {
|
|
216
|
+
if (!this.state.payment || CRYPTO_ONCHAIN_FINAL_PHASES.includes(this.getPhase()))
|
|
217
|
+
return;
|
|
218
|
+
this.stopped = false;
|
|
219
|
+
this.schedulePoll();
|
|
220
|
+
}
|
|
221
|
+
/** Stops polling (unmount, or the customer chose another payment method). */
|
|
222
|
+
stop() {
|
|
223
|
+
this.stopped = true;
|
|
224
|
+
if (this.pollTimer)
|
|
225
|
+
clearTimeout(this.pollTimer);
|
|
226
|
+
this.pollTimer = null;
|
|
227
|
+
}
|
|
228
|
+
schedulePoll() {
|
|
229
|
+
if (this.pollTimer)
|
|
230
|
+
clearTimeout(this.pollTimer);
|
|
231
|
+
this.pollTimer = setTimeout(async () => {
|
|
232
|
+
this.pollTimer = null;
|
|
233
|
+
await this.refreshStatus();
|
|
234
|
+
if (!this.stopped && !CRYPTO_ONCHAIN_FINAL_PHASES.includes(this.getPhase()))
|
|
235
|
+
this.schedulePoll();
|
|
236
|
+
}, this.options.pollIntervalMs ?? CRYPTO_ONCHAIN_STATUS_POLL_MS);
|
|
237
|
+
}
|
|
238
|
+
setState(patch) {
|
|
239
|
+
this.state = { ...this.state, ...patch };
|
|
240
|
+
this.options.onChange?.(this.state);
|
|
241
|
+
this.listeners.forEach((listener) => listener(this.state));
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function messageOf(error) {
|
|
245
|
+
return error instanceof Error && error.message ? error.message : UNAVAILABLE;
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=cryptoOnchain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cryptoOnchain.js","sourceRoot":"","sources":["../../../src/core/helpers/cryptoOnchain.ts"],"names":[],"mappings":"AAiBA,2EAA2E;AAC3E,MAAM,CAAC,MAAM,6BAA6B,GAAG,gBAAgB,CAAC;AAE9D,gEAAgE;AAChE,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAElD,wCAAwC;AACxC,MAAM,CAAC,MAAM,2BAA2B,GAAkC,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAErH,4GAA4G;AAC5G,MAAM,UAAU,qBAAqB,CAAC,MAAiC;IACrE,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC1B,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,G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CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,2BAA2B,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAAE,IAAI,CAAC,YAAY,EAAE,CAAC;QACnG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,IAAI,6BAA6B,CAAC,CAAC;IACnE,CAAC;IAEO,QAAQ,CAAC,KAA0C;QACzD,IAAI,CAAC,KAAK,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC;QACzC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D,CAAC;CACF;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser plumbing for Ocean Payment's inline card form (Oceanpayment
|
|
3
|
+
* Embedded SDK). Mirrors the hosted checkout's OceanPaymentPanel
|
|
4
|
+
* (apps/studio-app/.../PaymentMethodSelector/TakeoverPanels.tsx).
|
|
5
|
+
*/
|
|
6
|
+
export interface OceanpaymentGlobal {
|
|
7
|
+
init: (sandbox: boolean, cssUrl: string, language: string, configuration: Record<string, unknown>) => void;
|
|
8
|
+
checkout: (data: Record<string, string>) => void;
|
|
9
|
+
}
|
|
10
|
+
export type OceanWindow = Window & {
|
|
11
|
+
Oceanpayment?: OceanpaymentGlobal;
|
|
12
|
+
/** Ocean's SDK calls this global — the name is fixed by the SDK. */
|
|
13
|
+
oceanpaymentCallBack?: (data: unknown) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const OCEAN_SDK_URL = "https://secure.oceanpayment.com/pages/js/oceanpayment.js";
|
|
16
|
+
/** Fixed by Ocean's SDK, which looks the container up by this id. */
|
|
17
|
+
export declare const OCEAN_CONTAINER_ID = "oceanpayment-element";
|
|
18
|
+
/** Ocean's iframe answers every checkout(); this only guards a lost message. */
|
|
19
|
+
export declare const OCEAN_CALLBACK_TIMEOUT_MS = 120000;
|
|
20
|
+
export declare function oceanLanguage(locale: string | undefined): string;
|
|
21
|
+
/**
|
|
22
|
+
* Load Ocean's SDK once per page: a second copy would deliver every result
|
|
23
|
+
* twice. A failed or stalled load is forgotten, so the next mount retries.
|
|
24
|
+
*/
|
|
25
|
+
export declare function loadOceanSdk(): Promise<OceanpaymentGlobal>;
|
|
26
|
+
export declare function parkOceanPayment(paymentId: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Back from Ocean's 3-D Secure page: turn the parked payment into the
|
|
29
|
+
* `paymentAction` / `paymentActionStatus` / `paymentId` markers that
|
|
30
|
+
* `maybeResumeFromUrl()` and `usePayment()` already resume from.
|
|
31
|
+
*/
|
|
32
|
+
export declare function restoreOceanPaymentReturn(): void;
|
|
33
|
+
//# sourceMappingURL=oceanpayment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oceanpayment.d.ts","sourceRoot":"","sources":["../../../src/core/helpers/oceanpayment.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAC3G,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;CAClD;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IACjC,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,oEAAoE;IACpE,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,aAAa,6DAA6D,CAAC;AACxF,qEAAqE;AACrE,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AACzD,gFAAgF;AAChF,eAAO,MAAM,yBAAyB,SAAU,CAAC;AASjD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAIhE;AAKD;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAwB1D;AAWD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAMxD;AAeD;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAchD"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser plumbing for Ocean Payment's inline card form (Oceanpayment
|
|
3
|
+
* Embedded SDK). Mirrors the hosted checkout's OceanPaymentPanel
|
|
4
|
+
* (apps/studio-app/.../PaymentMethodSelector/TakeoverPanels.tsx).
|
|
5
|
+
*/
|
|
6
|
+
export const OCEAN_SDK_URL = 'https://secure.oceanpayment.com/pages/js/oceanpayment.js';
|
|
7
|
+
/** Fixed by Ocean's SDK, which looks the container up by this id. */
|
|
8
|
+
export const OCEAN_CONTAINER_ID = 'oceanpayment-element';
|
|
9
|
+
/** Ocean's iframe answers every checkout(); this only guards a lost message. */
|
|
10
|
+
export const OCEAN_CALLBACK_TIMEOUT_MS = 120000;
|
|
11
|
+
/**
|
|
12
|
+
* Ocean builds its card fields server-side from `?language=`. An unknown code
|
|
13
|
+
* falls back to English, and `fi` comes back in Polish, so Finnish shoppers
|
|
14
|
+
* get English.
|
|
15
|
+
*/
|
|
16
|
+
const OCEAN_LANGUAGE_OVERRIDES = { fi: 'en' };
|
|
17
|
+
export function oceanLanguage(locale) {
|
|
18
|
+
const primary = locale?.split(/[-_]/)[0]?.toLowerCase();
|
|
19
|
+
if (!primary)
|
|
20
|
+
return 'en';
|
|
21
|
+
return OCEAN_LANGUAGE_OVERRIDES[primary] ?? primary;
|
|
22
|
+
}
|
|
23
|
+
const OCEAN_SDK_LOAD_TIMEOUT_MS = 30000;
|
|
24
|
+
let oceanSdkLoading = null;
|
|
25
|
+
/**
|
|
26
|
+
* Load Ocean's SDK once per page: a second copy would deliver every result
|
|
27
|
+
* twice. A failed or stalled load is forgotten, so the next mount retries.
|
|
28
|
+
*/
|
|
29
|
+
export function loadOceanSdk() {
|
|
30
|
+
const w = window;
|
|
31
|
+
if (w.Oceanpayment)
|
|
32
|
+
return Promise.resolve(w.Oceanpayment);
|
|
33
|
+
if (oceanSdkLoading)
|
|
34
|
+
return oceanSdkLoading;
|
|
35
|
+
oceanSdkLoading = new Promise((resolve, reject) => {
|
|
36
|
+
const script = document.createElement('script');
|
|
37
|
+
const fail = (message) => {
|
|
38
|
+
clearTimeout(timer);
|
|
39
|
+
script.remove();
|
|
40
|
+
oceanSdkLoading = null;
|
|
41
|
+
reject(new Error(message));
|
|
42
|
+
};
|
|
43
|
+
const timer = setTimeout(() => fail('The Ocean Payment card form took too long to load'), OCEAN_SDK_LOAD_TIMEOUT_MS);
|
|
44
|
+
script.addEventListener('load', () => {
|
|
45
|
+
if (!w.Oceanpayment)
|
|
46
|
+
return fail('Ocean Payment script loaded without window.Oceanpayment');
|
|
47
|
+
clearTimeout(timer);
|
|
48
|
+
resolve(w.Oceanpayment);
|
|
49
|
+
});
|
|
50
|
+
script.addEventListener('error', () => fail('Failed to load the Ocean Payment card form'));
|
|
51
|
+
script.src = OCEAN_SDK_URL;
|
|
52
|
+
document.head.appendChild(script);
|
|
53
|
+
});
|
|
54
|
+
return oceanSdkLoading;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Ocean's inline card form leaves the page only for 3-D Secure, and Ocean
|
|
58
|
+
* returns the shopper to the exact page URL the form was opened on — without
|
|
59
|
+
* any payment reference in it. The payment id is parked in sessionStorage
|
|
60
|
+
* before leaving; a stale entry (abandoned 3DS) is ignored after 30 minutes.
|
|
61
|
+
*/
|
|
62
|
+
const OCEAN_PENDING_KEY = 'tgd:headless:oceanpayment:pending';
|
|
63
|
+
const OCEAN_PENDING_TTL_MS = 30 * 60 * 1000;
|
|
64
|
+
export function parkOceanPayment(paymentId) {
|
|
65
|
+
try {
|
|
66
|
+
sessionStorage.setItem(OCEAN_PENDING_KEY, JSON.stringify({ paymentId, at: Date.now() }));
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// Storage unavailable — Ocean's webhook still settles the order.
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function takeParkedOceanPayment() {
|
|
73
|
+
try {
|
|
74
|
+
const raw = sessionStorage.getItem(OCEAN_PENDING_KEY);
|
|
75
|
+
if (!raw)
|
|
76
|
+
return undefined;
|
|
77
|
+
sessionStorage.removeItem(OCEAN_PENDING_KEY);
|
|
78
|
+
const { paymentId, at } = JSON.parse(raw);
|
|
79
|
+
if (!paymentId || !at || Date.now() - at > OCEAN_PENDING_TTL_MS)
|
|
80
|
+
return undefined;
|
|
81
|
+
return paymentId;
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Back from Ocean's 3-D Secure page: turn the parked payment into the
|
|
89
|
+
* `paymentAction` / `paymentActionStatus` / `paymentId` markers that
|
|
90
|
+
* `maybeResumeFromUrl()` and `usePayment()` already resume from.
|
|
91
|
+
*/
|
|
92
|
+
export function restoreOceanPaymentReturn() {
|
|
93
|
+
if (typeof window === 'undefined')
|
|
94
|
+
return;
|
|
95
|
+
const paymentId = takeParkedOceanPayment();
|
|
96
|
+
if (!paymentId)
|
|
97
|
+
return;
|
|
98
|
+
try {
|
|
99
|
+
const url = new URL(window.location.href);
|
|
100
|
+
if (url.searchParams.get('paymentId'))
|
|
101
|
+
return;
|
|
102
|
+
url.searchParams.set('paymentId', paymentId);
|
|
103
|
+
url.searchParams.set('paymentAction', 'requireAction');
|
|
104
|
+
url.searchParams.set('paymentActionStatus', 'completed');
|
|
105
|
+
window.history.replaceState(window.history.state, '', url.toString());
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// Best-effort: Ocean's webhook still settles the order.
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=oceanpayment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oceanpayment.js","sourceRoot":"","sources":["../../../src/core/helpers/oceanpayment.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,MAAM,CAAC,MAAM,aAAa,GAAG,0DAA0D,CAAC;AACxF,qEAAqE;AACrE,MAAM,CAAC,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;AACzD,gFAAgF;AAChF,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAO,CAAC;AAEjD;;;;GAIG;AACH,MAAM,wBAAwB,GAA2B,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AAEtE,MAAM,UAAU,aAAa,CAAC,MAA0B;IACtD,MAAM,OAAO,GAAG,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;IACxD,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,OAAO,wBAAwB,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC;AACtD,CAAC;AAED,MAAM,yBAAyB,GAAG,KAAM,CAAC;AACzC,IAAI,eAAe,GAAuC,IAAI,CAAC;AAE/D;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,CAAC,GAAG,MAAqB,CAAC;IAChC,IAAI,CAAC,CAAC,YAAY;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC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AC;QACvD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;QACzD,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IACxE,CAAC;IAAC,MAAM,CAAC;QACP,wDAAwD;IAC1D,CAAC;AACH,CAAC"}
|
package/dist/core/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/core/http.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/core/http.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAQlE,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED;;;GAGG;AACH,qBAAa,UAAU;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,CAA2B;IAC5C,OAAO,CAAC,QAAQ,CAAC,CAAkB;gBAEvB,MAAM,EAAE,gBAAgB;IAQpC,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAIpE,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,CAAC,CAAC;IA0DtF,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAIxE,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAIzF,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1F,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAIxF,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;YAI7D,mBAAmB;CA6ClC"}
|
package/dist/core/http.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TagadaError, TagadaAuthError, TagadaValidationError, TagadaNotFoundError, TagadaRateLimitError, TagadaNetworkError, } from './errors.js';
|
|
2
|
+
import { SDK_VERSION } from './version.js';
|
|
2
3
|
const BASE_URLS = {
|
|
3
4
|
production: 'https://api.tagada.io',
|
|
4
5
|
development: 'https://api.tagada.dev',
|
|
@@ -34,6 +35,8 @@ export class HttpClient {
|
|
|
34
35
|
}
|
|
35
36
|
const reqHeaders = {
|
|
36
37
|
'Content-Type': 'application/json',
|
|
38
|
+
// Which SDK and version sent the call: the Payments API readiness check counts them per store.
|
|
39
|
+
'X-Tagada-SDK': `headless-sdk/${SDK_VERSION}`,
|
|
37
40
|
...headers,
|
|
38
41
|
};
|
|
39
42
|
const authToken = token ?? this.apiKey ?? this.getToken?.();
|
package/dist/core/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/core/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/core/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,MAAM,SAAS,GAAgC;IAC7C,UAAU,EAAE,uBAAuB;IACnC,WAAW,EAAE,wBAAwB;IACrC,KAAK,EAAE,uBAAuB;CAC/B,CAAC;AAUF;;;GAGG;AACH,MAAM,OAAO,UAAU;IAOrB,YAAY,MAAwB;QAClC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,cAAc,CAAC,WAAwB,EAAE,QAAiB;QAC/D,OAAO,QAAQ,IAAI,SAAS,CAAC,WAAW,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC;IACpE,CAAC;IAED,KAAK,CAAC,OAAO,CAAc,IAAY,EAAE,UAA8B,EAAE;QACvE,MAAM,EAAE,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W,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;CACF;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAgC,CAAC;IAChF,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzC,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1C,OAAO,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAE,MAAkC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -13,10 +13,12 @@ export { TrackModule } from './modules/track.js';
|
|
|
13
13
|
export type { StepData, EventData, TrackIdentity, TrackHealth } from './modules/track.js';
|
|
14
14
|
export type { RxCaseStatus, RxRequiredForProduct, RxStorefrontPatient, RxIntakeAnswer, RxClinicalQuestion, RxClinicalQuestionRule, RxQuestionAnswers, RxIntakeContext, RxIntakeIssue, RxValidateIntakeInput, RxQuestionsForProduct, RxSubmitCaseInput, RxSubmitCaseResult, RxCaseSummary, RxIntakeContextResult, RxIntakeContextPatient, RxActivationStatus, RxActivationStepKey, RxActivationMissingItem, } from './modules/rx.js';
|
|
15
15
|
export { HttpClient } from './http.js';
|
|
16
|
+
export { CryptoOnchainCheckout, CRYPTO_ONCHAIN_PAYMENT_METHOD, CRYPTO_ONCHAIN_STATUS_POLL_MS, CRYPTO_ONCHAIN_FINAL_PHASES, isCryptoOnchainMethod, defaultCryptoOnchainSelection, selectCryptoOnchainNetwork, cryptoOnchainPhase, cryptoOnchainSecondsLeft, formatCryptoOnchainCountdown, } from './helpers/cryptoOnchain.js';
|
|
17
|
+
export type { CryptoOnchainApi } from './helpers/cryptoOnchain.js';
|
|
16
18
|
export { TagadaError, TagadaAuthError, TagadaValidationError, TagadaNotFoundError, TagadaRateLimitError, TagadaPaymentError, TagadaNetworkError, } from './errors.js';
|
|
17
19
|
export { GoogleAutocompleteCore, loadGoogleMapsScript, ISODataCore, AVAILABLE_LANGUAGES, CurrencyUtils, formatMoney, ensureGeoDataLoaded, getCountries, getStatesForCountry, isLanguageLoaded, } from './helpers/index.js';
|
|
18
20
|
export type { GooglePrediction, GooglePlaceDetails, ExtractedAddress, FormattedAddress, SupportedLanguage, ISOCountry, ISORegion, Country, State, Currency, } from './helpers/index.js';
|
|
19
|
-
export type { Environment, HeadlessConfig, HttpRequestOptions, LineItem, CreateCheckoutSessionOptions, CheckoutCustomerMetadata, CheckoutSession, CheckoutLineItem, CheckoutTotals, CheckoutCustomer, Address, ShippingRate, PaymentMethodConfig, PaymentSetupConfig, ExpressMethod, ExpressMethods, StoreConfig, PayResult, PayOptions, PayDirectOptions, ProcessPaymentOptions, ProcessPaymentResult, CreateInstrumentOptions, PaymentInstrument, ThreedsSession, PaymentStatus, Offer, OfferLineItem, OfferPreview, OfferPreviewItem, OfferPayResult, Customer, Order, OrderItem, Subscription, CatalogProduct, CatalogVariant, CatalogPrice, CurrencyOption, FunnelNavigateInput, FunnelNavigateResult, } from './types.js';
|
|
21
|
+
export type { Environment, HeadlessConfig, HttpRequestOptions, LineItem, CreateCheckoutSessionOptions, CheckoutCustomerMetadata, CheckoutSession, CheckoutLineItem, CheckoutTotals, CheckoutCustomer, Address, ShippingRate, PaymentMethodConfig, PaymentSetupConfig, ExpressMethod, ExpressMethods, StoreConfig, PayResult, PayOptions, PayDirectOptions, ProcessPaymentOptions, ProcessPaymentResult, OceanPaymentConfig, MountOceanPaymentOptions, OceanPaymentForm, CryptoOnchainAsset, CryptoOnchainNetwork, CryptoOnchainPayment, CryptoOnchainStatus, CryptoOnchainOptionsFailureCode, CryptoOnchainPaymentFailureCode, CryptoOnchainStatusFailureCode, CryptoOnchainFailure, CryptoOnchainOptionsResult, CryptoOnchainPaymentResult, CryptoOnchainStatusResult, CryptoOnchainPhase, CryptoOnchainSelection, CryptoOnchainCheckoutState, CryptoOnchainCheckoutOptions, CreateInstrumentOptions, PaymentInstrument, ThreedsSession, PaymentStatus, Offer, OfferLineItem, OfferPreview, OfferPreviewItem, OfferPayResult, Customer, Order, OrderItem, Subscription, CatalogProduct, CatalogVariant, CatalogPrice, CurrencyOption, FunnelNavigateInput, FunnelNavigateResult, } from './types.js';
|
|
20
22
|
export { ExperimentsModule } from './modules/experiments.js';
|
|
21
23
|
export type { TgdBootstrap, TgdIds } from '../tgd/contract/index.js';
|
|
22
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,KAAK,WAAW,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CA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