@tagadapay/headless-sdk 1.8.0 → 1.12.0
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/README.md +4 -0
- package/dist/core/client.d.ts.map +1 -0
- package/dist/core/client.js +3 -1
- package/dist/core/client.js.map +1 -0
- package/dist/core/errors.d.ts +8 -1
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +3 -2
- package/dist/core/errors.js.map +1 -0
- package/dist/core/helpers/autocomplete.d.ts.map +1 -0
- package/dist/core/helpers/autocomplete.js.map +1 -0
- package/dist/core/helpers/countries.d.ts.map +1 -0
- package/dist/core/helpers/countries.js.map +1 -0
- package/dist/core/helpers/currency.d.ts.map +1 -0
- package/dist/core/helpers/currency.js.map +1 -0
- package/dist/core/helpers/index.d.ts +1 -0
- package/dist/core/helpers/index.d.ts.map +1 -0
- package/dist/core/helpers/index.js +1 -0
- package/dist/core/helpers/index.js.map +1 -0
- package/dist/core/helpers/iso3166.d.ts.map +1 -0
- package/dist/core/helpers/iso3166.js.map +1 -0
- package/dist/core/helpers/walletContact.d.ts +67 -0
- package/dist/core/helpers/walletContact.d.ts.map +1 -0
- package/dist/core/helpers/walletContact.js +71 -0
- package/dist/core/helpers/walletContact.js.map +1 -0
- package/dist/core/http.d.ts.map +1 -0
- package/dist/core/http.js +10 -1
- package/dist/core/http.js.map +1 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/modules/catalog.d.ts.map +1 -0
- package/dist/core/modules/catalog.js.map +1 -0
- package/dist/core/modules/checkout.d.ts.map +1 -0
- package/dist/core/modules/checkout.js.map +1 -0
- package/dist/core/modules/customer.d.ts.map +1 -0
- package/dist/core/modules/customer.js.map +1 -0
- package/dist/core/modules/funnel.d.ts.map +1 -0
- package/dist/core/modules/funnel.js +5 -0
- package/dist/core/modules/funnel.js.map +1 -0
- package/dist/core/modules/offers.d.ts.map +1 -0
- package/dist/core/modules/offers.js.map +1 -0
- package/dist/core/modules/payment.d.ts +91 -1
- package/dist/core/modules/payment.d.ts.map +1 -0
- package/dist/core/modules/payment.js +157 -6
- package/dist/core/modules/payment.js.map +1 -0
- package/dist/core/modules/rx.d.ts.map +1 -0
- package/dist/core/modules/rx.js.map +1 -0
- package/dist/core/types.d.ts +28 -1
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/react/hooks/useCatalog.d.ts.map +1 -0
- package/dist/react/hooks/useCatalog.js.map +1 -0
- package/dist/react/hooks/useCheckout.d.ts.map +1 -0
- package/dist/react/hooks/useCheckout.js.map +1 -0
- package/dist/react/hooks/useCustomer.d.ts.map +1 -0
- package/dist/react/hooks/useCustomer.js.map +1 -0
- package/dist/react/hooks/useGoogleAutocomplete.d.ts.map +1 -0
- package/dist/react/hooks/useGoogleAutocomplete.js.map +1 -0
- package/dist/react/hooks/useISOData.d.ts.map +1 -0
- package/dist/react/hooks/useISOData.js.map +1 -0
- package/dist/react/hooks/useOffers.d.ts.map +1 -0
- package/dist/react/hooks/useOffers.js.map +1 -0
- package/dist/react/hooks/usePayment.d.ts +15 -2
- package/dist/react/hooks/usePayment.d.ts.map +1 -0
- package/dist/react/hooks/usePayment.js.map +1 -0
- package/dist/react/hooks/useRx.d.ts.map +1 -0
- package/dist/react/hooks/useRx.js.map +1 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/internal/redirectGuard.d.ts.map +1 -0
- package/dist/react/internal/redirectGuard.js.map +1 -0
- package/dist/react/provider.d.ts.map +1 -0
- package/dist/react/provider.js.map +1 -0
- package/dist/stripe/StripeExpressButton.d.ts.map +1 -0
- package/dist/stripe/StripeExpressButton.js.map +1 -0
- package/dist/stripe/StripeExpressCheckout.d.ts +12 -1
- package/dist/stripe/StripeExpressCheckout.d.ts.map +1 -0
- package/dist/stripe/StripeExpressCheckout.js +47 -3
- package/dist/stripe/StripeExpressCheckout.js.map +1 -0
- package/dist/stripe/index.d.ts.map +1 -0
- package/dist/stripe/index.js.map +1 -0
- package/dist/stripe/useStripeExpress.d.ts.map +1 -0
- package/dist/stripe/useStripeExpress.js +0 -1
- package/dist/stripe/useStripeExpress.js.map +1 -0
- package/dist/tagada-headless-react.min.js +8 -0
- package/dist/tagada-headless-react.min.js.map +7 -0
- package/dist/tagada-headless.js +2485 -0
- package/dist/tagada-headless.min.js +8 -0
- package/dist/tagada-headless.min.js.map +7 -0
- package/package.json +10 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOffers.js","sourceRoot":"","sources":["../../../src/react/hooks/useOffers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AA4G9D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,SAAS,CAAC,OAA0B;IAClD,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;IACnC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAsB,IAAI,CAAC,CAAC;IAClE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IACnC,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC;IAC7B,MAAM,0BAA0B,GAAG,MAAM,CAAC,KAAK,CAAC,CA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IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC,EACzD,CAAC,MAAM,EAAE,IAAI,CAAC,CACf,CAAC;IAEF,MAAM,wBAAwB,GAAG,WAAW,CAC1C,CAAC,IAA0C,EAAE,EAAE,CAC7C,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC,EAC1D,CAAC,MAAM,EAAE,IAAI,CAAC,CACf,CAAC;IAEF,OAAO;QACL,KAAK;QACL,OAAO;QACP,SAAS;QACT,KAAK;QACL,QAAQ;QACR,UAAU;QACV,YAAY;QACZ,mBAAmB;QACnB,iBAAiB;QACjB,eAAe;QACf,sBAAsB;QACtB,uBAAuB;QACvB,wBAAwB;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PaymentSetupConfig, ExpressMethods, StoreConfig, PayResult, PayOptions, PaymentStatus, ProcessPaymentOptions, ProcessPaymentResult } from '../../core/types.js';
|
|
2
|
+
import type { ApplePayContact, GooglePayContact } from '../../core/helpers/walletContact.js';
|
|
2
3
|
export interface UsePaymentOptions {
|
|
3
4
|
/**
|
|
4
5
|
* Called when a payment succeeds (including after 3DS redirect return).
|
|
@@ -66,15 +67,27 @@ export interface UsePaymentReturn {
|
|
|
66
67
|
tagadaToken: string;
|
|
67
68
|
rawToken: Record<string, unknown>;
|
|
68
69
|
}>;
|
|
69
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* Process Apple Pay. Pass the contacts from `onpaymentauthorized` so the
|
|
72
|
+
* address approved in the wallet sheet reaches the order (#TAG-1989).
|
|
73
|
+
*
|
|
74
|
+
* `merchantRegistrationId` (BYOK / platform-integrator domains) is resolved
|
|
75
|
+
* automatically from the payment setup; pass it only to override.
|
|
76
|
+
*/
|
|
70
77
|
processApplePay: (opts: {
|
|
71
78
|
checkoutSessionId: string;
|
|
72
79
|
applePayToken: unknown;
|
|
80
|
+
billingContact?: ApplePayContact | null;
|
|
81
|
+
shippingContact?: ApplePayContact | null;
|
|
82
|
+
merchantRegistrationId?: string;
|
|
73
83
|
}) => Promise<PayResult>;
|
|
74
|
-
/** Process Google Pay. */
|
|
84
|
+
/** Process Google Pay. Pass the wallet addresses for the same reason. */
|
|
75
85
|
processGooglePay: (opts: {
|
|
76
86
|
checkoutSessionId: string;
|
|
77
87
|
googlePayToken: string;
|
|
88
|
+
billingAddress?: GooglePayContact | null;
|
|
89
|
+
shippingAddress?: GooglePayContact | null;
|
|
90
|
+
email?: string;
|
|
78
91
|
}) => Promise<PayResult>;
|
|
79
92
|
/** Process redirect-based APM (Klarna, iDEAL, etc.). */
|
|
80
93
|
processApm: (opts: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePayment.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/usePayment.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,SAAS,EACT,UAAU,EACV,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAM7F,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,GAAG;QAAE,MAAM,EAAE,WAAW,CAAA;KAAE,KAAK,IAAI,CAAC;IACpF;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,GAAG;QAAE,MAAM,EAAE,QAAQ,CAAA;KAAE,KAAK,IAAI,CAAC;IAChF;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,MAAM,WAAW,gBAAgB;IAC/B,iFAAiF;IACjF,YAAY,EAAE,kBAAkB,GAAG,IAAI,CAA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
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG1E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,gBAAgB;AAChB,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAGzE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAexF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirectGuard.d.ts","sourceRoot":"","sources":["../../../src/react/internal/redirectGuard.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAIzD;AAED,kEAAkE;AAClE,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirectGuard.js","sourceRoot":"","sources":["../../../src/react/internal/redirectGuard.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAU,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,IAAI,mBAAmB,CAAC,GAAG,CAAC,SAAS,CAAC;QAAE,OAAO,KAAK,CAAC;IACrD,mBAAmB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACnC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,gBAAgB;IAC9B,mBAAmB,CAAC,KAAK,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/react/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,cAAc,EAAwB,MAAM,mBAAmB,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAQpE,MAAM,WAAW,2BAA2B;IAC1C,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,OAAO,EACP,WAAW,EACX,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,GACT,EAAE,2BAA2B,8CAa7B;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,IAAI,cAAc,CAMlD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/react/provider.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAkB,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAOzE,M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C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,KAAK,EACL,GAAG,QAAQ,EACZ,EAAE,wBAAwB,8CAe1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StripeExpressButton.js","sourceRoot":"","sources":["../../src/stripe/StripeExpressButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAUzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,SAAS,EACT,KAAK,EACL,GAAG,QAAQ,EACc;IACzB,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAE7D,OAAO,CACL,cACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE;YACL,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;YAC1C,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YAClC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;YACxC,GAAG,KAAK;SACT,GACD,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -19,7 +19,7 @@ type EventHandler<K extends keyof EventMap> = (data: EventMap[K]) => void;
|
|
|
19
19
|
* Session-based Stripe Express Checkout integration.
|
|
20
20
|
*
|
|
21
21
|
* Mounts the Stripe `ExpressCheckoutElement` (Apple Pay, Google Pay, Link,
|
|
22
|
-
*
|
|
22
|
+
* Klarna express) into any DOM container, wired to a Tagada
|
|
23
23
|
* checkout session. Drives the full flow:
|
|
24
24
|
* mount → wallet confirm → backend `payDirect` (`processStripeExpress`)
|
|
25
25
|
* → `stripe.confirmPayment` → poll payment status → emit `success`.
|
|
@@ -70,6 +70,7 @@ export declare class StripeExpressCheckout {
|
|
|
70
70
|
private readonly buttonType;
|
|
71
71
|
private readonly emailRequired;
|
|
72
72
|
private readonly billingAddressRequired;
|
|
73
|
+
private readonly shippingAddressRequired;
|
|
73
74
|
constructor(opts: {
|
|
74
75
|
client: HeadlessClient;
|
|
75
76
|
} & StripeExpressOptions);
|
|
@@ -87,6 +88,16 @@ export declare class StripeExpressCheckout {
|
|
|
87
88
|
* Update the payment amount (e.g. after a cart change).
|
|
88
89
|
*/
|
|
89
90
|
updateAmount(amount: number, currency?: string): void;
|
|
91
|
+
/**
|
|
92
|
+
* Write the wallet-approved contact onto the session before the charge.
|
|
93
|
+
*
|
|
94
|
+
* `billingAddressRequired` defaults to true, so Stripe collects an address on
|
|
95
|
+
* every express purchase; `shippingAddressRequired` adds a delivery address
|
|
96
|
+
* for carts that ship. Whichever arrives is mapped and stored — a contact
|
|
97
|
+
* with no street line or no country maps to `undefined` and leaves the
|
|
98
|
+
* session untouched, so this can never blank an address already entered.
|
|
99
|
+
*/
|
|
100
|
+
private syncWalletContact;
|
|
90
101
|
/**
|
|
91
102
|
* Clean up: unmount the element and release references.
|
|
92
103
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StripeExpressCheckout.d.ts","sourceRoot":"","sources":["../../src/stripe/StripeExpressCheckout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAa,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAcvF,KAAK,QAAQ,GAAG;IACd,KAAK,EAAE;QAAE,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;KAAE,CAAC;IACxE,OAAO,EAAE;QAAE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AQ,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI;IAIvE;;OAEG;IACG,KAAK,CACT,SAAS,EAAE,WAAW,EACtB,IAAI,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GACpE,OAAO,CAAC,IAAI,CAAC;IA6HhB;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAOrD;;;;;;;;OAQG;YACW,iBAAiB;IAsB/B;;OAEG;IACH,OAAO,IAAI,IAAI;IASf,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,mBAAmB;CAS5B"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { stripeContactToAddress } from '../core/helpers/walletContact.js';
|
|
2
|
+
const EXPRESS_METHOD_KEYS = ['apple_pay', 'google_pay', 'link', 'klarna_express'];
|
|
2
3
|
/**
|
|
3
4
|
* Session-based Stripe Express Checkout integration.
|
|
4
5
|
*
|
|
5
6
|
* Mounts the Stripe `ExpressCheckoutElement` (Apple Pay, Google Pay, Link,
|
|
6
|
-
*
|
|
7
|
+
* Klarna express) into any DOM container, wired to a Tagada
|
|
7
8
|
* checkout session. Drives the full flow:
|
|
8
9
|
* mount → wallet confirm → backend `payDirect` (`processStripeExpress`)
|
|
9
10
|
* → `stripe.confirmPayment` → poll payment status → emit `success`.
|
|
@@ -55,6 +56,9 @@ export class StripeExpressCheckout {
|
|
|
55
56
|
this.buttonType = opts.buttonType ?? 'buy';
|
|
56
57
|
this.emailRequired = opts.emailRequired ?? true;
|
|
57
58
|
this.billingAddressRequired = opts.billingAddressRequired ?? true;
|
|
59
|
+
// Opt-in: asking for a delivery address in the sheet changes what the buyer
|
|
60
|
+
// sees, so it stays off until a storefront selling physical goods says yes.
|
|
61
|
+
this.shippingAddressRequired = opts.shippingAddressRequired ?? false;
|
|
58
62
|
}
|
|
59
63
|
on(event, handler) {
|
|
60
64
|
if (!this.listeners[event]) {
|
|
@@ -96,11 +100,11 @@ export class StripeExpressCheckout {
|
|
|
96
100
|
applePay: methodEnabled('apple_pay') ? 'always' : 'never',
|
|
97
101
|
googlePay: methodEnabled('google_pay') ? 'always' : 'never',
|
|
98
102
|
link: methodEnabled('link') ? 'auto' : 'never',
|
|
99
|
-
paypal: methodEnabled('paypal') ? 'auto' : 'never',
|
|
100
103
|
klarna: methodEnabled('klarna_express') ? 'auto' : 'never',
|
|
101
104
|
},
|
|
102
105
|
emailRequired: this.emailRequired,
|
|
103
106
|
billingAddressRequired: this.billingAddressRequired,
|
|
107
|
+
shippingAddressRequired: this.shippingAddressRequired,
|
|
104
108
|
});
|
|
105
109
|
this.expressElement.on('ready', ({ availablePaymentMethods }) => {
|
|
106
110
|
if (availablePaymentMethods) {
|
|
@@ -122,6 +126,19 @@ export class StripeExpressCheckout {
|
|
|
122
126
|
this.isProcessing = false;
|
|
123
127
|
return;
|
|
124
128
|
}
|
|
129
|
+
// The buyer approved an address inside the wallet sheet and this
|
|
130
|
+
// element owns that sheet, so the address is ours to persist — no
|
|
131
|
+
// integrator code required (#TAG-1989). Before this, `billingDetails`
|
|
132
|
+
// arrived on every confirm and was dropped, and the order was created
|
|
133
|
+
// with NULL addresses.
|
|
134
|
+
try {
|
|
135
|
+
await this.syncWalletContact(opts.checkoutSessionId, event);
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
this.emit('error', 'Could not save your address. Please try again.');
|
|
139
|
+
this.isProcessing = false;
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
125
142
|
const payResult = await this.client.payment.processStripeExpress({
|
|
126
143
|
checkoutSessionId: opts.checkoutSessionId,
|
|
127
144
|
processorId: this.processorId,
|
|
@@ -174,6 +191,33 @@ export class StripeExpressCheckout {
|
|
|
174
191
|
update.currency = currency.toLowerCase();
|
|
175
192
|
this.elements.update(update);
|
|
176
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Write the wallet-approved contact onto the session before the charge.
|
|
196
|
+
*
|
|
197
|
+
* `billingAddressRequired` defaults to true, so Stripe collects an address on
|
|
198
|
+
* every express purchase; `shippingAddressRequired` adds a delivery address
|
|
199
|
+
* for carts that ship. Whichever arrives is mapped and stored — a contact
|
|
200
|
+
* with no street line or no country maps to `undefined` and leaves the
|
|
201
|
+
* session untouched, so this can never blank an address already entered.
|
|
202
|
+
*/
|
|
203
|
+
async syncWalletContact(checkoutSessionId, event) {
|
|
204
|
+
const billingAddress = stripeContactToAddress(event.billingDetails);
|
|
205
|
+
const shippingAddress = stripeContactToAddress(event.shippingAddress);
|
|
206
|
+
if (!billingAddress && !shippingAddress)
|
|
207
|
+
return;
|
|
208
|
+
const customer = {};
|
|
209
|
+
const email = event.billingDetails?.email ?? event.shippingAddress?.email;
|
|
210
|
+
const phone = event.billingDetails?.phone ?? event.shippingAddress?.phone;
|
|
211
|
+
if (email)
|
|
212
|
+
customer.email = email;
|
|
213
|
+
if (phone)
|
|
214
|
+
customer.phone = phone;
|
|
215
|
+
await this.client.checkout.updateCustomerAndAddress(checkoutSessionId, {
|
|
216
|
+
customer,
|
|
217
|
+
shippingAddress,
|
|
218
|
+
billingAddress,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
177
221
|
/**
|
|
178
222
|
* Clean up: unmount the element and release references.
|
|
179
223
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StripeExpressCheckout.js","sourceRoot":"","sources":["../../src/stripe/StripeExpressCheckout.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAsB,MAAM,kCAAkC,CAAC;AAW9F,MAAM,mBAAmB,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,gBAAgB,CAAU,CAAC;AAW3F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAC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AAQ,EAAE,IAAiB;QAChE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAE,OAA2B,CAAC,IAAI,CAAC,CAAC,CAAC;IAClF,CAAC;IAEO,mBAAmB,CAAC,SAAoB;QAC9C,OACE,SAAS,CAAC,OAAO,EAAE,iBAAiB,EAAE,QAEvC,EAAE,qBAAqB;YACtB,CAAC,CAAC,CAAE,SAAS,CAAC,OAAO,CAAC,iBAAkB,CAAC,QAAmD;iBACvF,qBAAqB,CAAC,YAAY,CAAC;YACxC,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stripe/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAO7D,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,KAAK,oBAAoB,IAAI,wBAAwB,EACrD,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,GAC5B,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stripe/index.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,kEAAkE;AAClE,iEAAiE;AACjE,oDAAoD;AACpD,oEAAoE;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4B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AsD;IACtD,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,uBAAuB,GAAG,sBAAsB,CAoFtF"}
|
|
@@ -105,7 +105,6 @@ function findStripeExpressMethod(express) {
|
|
|
105
105
|
const allMethods = [
|
|
106
106
|
{ key: 'apple_pay', entry: express.applePay },
|
|
107
107
|
{ key: 'google_pay', entry: express.googlePay },
|
|
108
|
-
{ key: 'paypal', entry: express.paypal },
|
|
109
108
|
{ key: 'link', entry: express.link },
|
|
110
109
|
{ key: 'klarna_express', entry: express.klarna },
|
|
111
110
|
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStripeExpress.js","sourceRoot":"","sources":["../../src/stripe/useStripeExpress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AA2BnE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAA6B;IAC5D,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;IACnC,MAAM,YAAY,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,MAAM,CAA+B,IAAI,CAAC,CAAC;IAE1D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,Q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+1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @tagadapay/headless-sdk v1.12.0
|
|
3
|
+
* Headless checkout, payments, offers, and CRM
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
"use strict";var TagadaHeadlessReactBundle=(()=>{var Xe=Object.create;var ne=Object.defineProperty;var et=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var rt=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty;var F=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var st=(s,e)=>{for(var t in e)ne(s,t,{get:e[t],enumerable:!0})},Te=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of tt(e))!nt.call(s,n)&&n!==t&&ne(s,n,{get:()=>e[n],enumerable:!(r=et(e,n))||r.enumerable});return s};var Ee=(s,e,t)=>(t=s!=null?Xe(rt(s)):{},Te(e||!s||!s.__esModule?ne(t,"default",{value:s,enumerable:!0}):t,s)),it=s=>Te(ne({},"__esModule",{value:!0}),s);var ht={};st(ht,{CurrencyUtils:()=>W,GoogleAutocompleteCore:()=>j,ISODataCore:()=>K,TagadaHeadlessProvider:()=>De,formatMoney:()=>Oe,loadGoogleMapsScript:()=>X,useCatalog:()=>je,useCheckout:()=>qe,useCountryOptions:()=>We,useCustomer:()=>He,useGoogleAutocomplete:()=>Je,useHeadlessClient:()=>q,useISOData:()=>Ie,useOffers:()=>$e,usePayment:()=>Ge,useRegionOptions:()=>Ve,useRx:()=>Ke});var J=F("react");var M=class extends Error{constructor(e,t,r,n){super(e),this.name="TagadaError",this.code=t,this.statusCode=r,this.details=n}},se=class extends M{constructor(e="Authentication failed. Check your API key or checkout token."){super(e,"auth_error",401),this.name="TagadaAuthError"}},ie=class extends M{constructor(e,t=[],r,n){super(e,"validation_error",422,{errors:t,...n}),this.name="TagadaValidationError",this.errors=t,this.appCode=r}},oe=class extends M{constructor(e,t){super(`${e} "${t}" not found.`,"not_found",404),this.name="TagadaNotFoundError"}},ae=class extends M{constructor(e=1e3){super(`Rate limited. Retry after ${e}ms.`,"rate_limit",429),this.name="TagadaRateLimitError",this.retryAfterMs=e}};var Y=class extends M{constructor(e="Network request failed. Check your connection."){super(e,"network_error"),this.name="TagadaNetworkError"}};var Le={production:"https://api.tagada.io",development:"https://api.tagada.dev",local:"http://localhost:3000"},Z=class{constructor(e){this.baseUrl=e.baseUrl.replace(/\/$/,""),this.timeout=e.timeout,this.apiKey=e.apiKey,this.getToken=e.getToken}static resolveBaseUrl(e,t){return t??Le[e]??Le.production}async request(e,t={}){var m;let{method:r="GET",body:n,headers:o={},params:i,token:a,signal:u}=t,c=`${this.baseUrl}${e}`;if(i){let y=new URLSearchParams;for(let[p,v]of Object.entries(i))v!==void 0&&y.set(p,String(v));let g=y.toString();g&&(c+=`?${g}`)}let f={"Content-Type":"application/json",...o},d=a??this.apiKey??((m=this.getToken)==null?void 0:m.call(this));d&&(f["x-cms-token"]=d);let h=new AbortController,l=setTimeout(()=>h.abort(),this.timeout);try{let y=await fetch(c,{method:r,headers:f,body:n!=null?JSON.stringify(n):void 0,signal:u??h.signal});if(clearTimeout(l),y.ok){let g=await y.text();return g?JSON.parse(g):{}}throw await this.handleErrorResponse(y,e),new M("Unexpected error","unknown",y.status)}catch(y){throw clearTimeout(l),y instanceof M?y:y instanceof DOMException&&y.name==="AbortError"?new Y(`Request to ${e} timed out after ${this.timeout}ms.`):new Y(y instanceof Error?y.message:"Network request failed.")}}get(e,t){return this.request(e,{...t,method:"GET"})}post(e,t,r){return this.request(e,{...r,method:"POST",body:t})}patch(e,t,r){return this.request(e,{...r,method:"PATCH",body:t})}put(e,t,r){return this.request(e,{...r,method:"PUT",body:t})}delete(e,t){return this.request(e,{...t,method:"DELETE"})}async handleErrorResponse(e,t){let r={};try{r=await e.json()}catch{}let n=r.data??{},o=r.message??r.error??(typeof n.message=="string"?n.message:void 0)??(typeof r.data=="string"?r.data:void 0)??`Request failed: ${e.status} ${e.statusText} on ${t}`,i=typeof n.code=="string"?n.code:void 0;switch(e.status){case 401:case 403:throw new se(o);case 404:throw new oe(t,"");case 422:{let a=Array.isArray(r.errors)?r.errors:[];throw new ie(o,a,i,r)}case 429:{let a=Number(e.headers.get("Retry-After")??"1")*1e3;throw new ae(a)}default:throw new M(o,"api_error",e.status,r)}}};var ce=class{constructor(e,t,r){this.http=e;this.storeId=t;this.onTokenChange=r}getCurrentSession(){return this._currentSession}async loadSession(e,t,r){var a;t&&(this.sessionToken=t,(a=this.onTokenChange)==null||a.call(this,t));let n={skipAsyncWait:"false"};r!=null&&r.currency&&(n.currency=r.currency);let o=await this.http.get(`/api/v1/checkout-sessions/${e}/v2`,{params:n,token:this.sessionToken}),i=this.normalizeSession(o);return this._currentSession=i,i}async createSession(e){var u;let t=e.items.map(c=>({variantId:c.variantId,priceId:c.priceId,quantity:c.quantity})),r={storeId:this.storeId,lineItems:t};e.returnUrl&&(r.returnUrl=e.returnUrl);let n={};e.currency&&(n.currency=e.currency),e.customerEmail&&(n.email=e.customerEmail,n.firstName=e.customerFirstName,n.lastName=e.customerLastName),Object.keys(n).length>0&&(r.customer=n);let o=await this.http.post("/api/v1/checkout/session/init",r),a=new URL(o.checkoutUrl).searchParams.get("token")??"";return this.sessionToken=a,a&&((u=this.onTokenChange)==null||u.call(this,a)),{checkoutUrl:o.checkoutUrl,checkoutToken:o.checkoutToken,sessionToken:a,customerId:o.customerId}}async createSessionUrl(e){let t=await this.createSession({items:e.items,currency:e.currency,returnUrl:e.returnUrl,customerEmail:e.customerEmail,customerFirstName:e.customerFirstName,customerLastName:e.customerLastName}),r=e.origin??(typeof window<"u"?window.location.origin:""),n=e.checkoutPath??"/checkout",o=new URLSearchParams({checkoutToken:t.checkoutToken,sessionToken:t.sessionToken}),i=`${r}${n}?${o.toString()}`;return{...t,url:i}}static parseTokensFromUrl(e){if(typeof e>"u"&&typeof window>"u")return null;let t=e??window.location.href,r;try{r=new URL(t)}catch{return null}let n=r.searchParams.get("checkoutToken");if(!n)return null;let o=r.searchParams.get("sessionToken")??r.searchParams.get("token")??"";return{checkoutToken:n,sessionToken:o}}async updateCart(e,t){let r=t.map(n=>({variantId:n.variantId,priceId:n.priceId,quantity:n.quantity}));return this.http.post(`/api/v1/checkout-sessions/${e}/line-items`,{lineItems:r},{token:this.sessionToken})}async updateCustomer(e,t){t.email&&(this.customerEmail=t.email),t.firstName&&(this.customerFirstName=t.firstName),t.lastName&&(this.customerLastName=t.lastName),t.phone&&(this.customerPhone=t.phone)}async updateAddress(e,t){let r=this.mapAddress(t.shippingAddress),n=this.mapAddress(t.billingAddress),o=r??n??{},i=n??r,a=!!(t.billingAddress&&t.shippingAddress);await this.http.post(`/api/v1/checkout-sessions/${e}/customer-and-session-info`,{checkoutSessionId:e,customerData:{email:this.customerEmail},shippingAddress:o,billingAddress:i??{},differentBillingAddress:a},{token:this.sessionToken})}async updateCustomerAndAddress(e,t){t.customer.email&&(this.customerEmail=t.customer.email),t.customer.firstName&&(this.customerFirstName=t.customer.firstName),t.customer.lastName&&(this.customerLastName=t.customer.lastName),t.customer.phone&&(this.customerPhone=t.customer.phone);let r=this.mapAddress(t.shippingAddress),n=this.mapAddress(t.billingAddress),o=r??n??{},i=n??r,a=!!(t.billingAddress&&t.shippingAddress);await this.http.post(`/api/v1/checkout-sessions/${e}/customer-and-session-info`,{checkoutSessionId:e,customerData:{email:this.customerEmail},shippingAddress:o,billingAddress:i??{},differentBillingAddress:a},{token:this.sessionToken})}mapAddress(e){if(e)return ot({firstName:e.firstName??this.customerFirstName,lastName:e.lastName??this.customerLastName,phone:e.phone??this.customerPhone,address1:e.line1,address2:e.line2,city:e.city,state:e.state,postal:e.postalCode,country:e.country})}async applyPromoCode(e,t){await this.http.post(`/api/v1/checkout-sessions/${e}/promotions/apply`,{checkoutSessionId:e,code:t},{token:this.sessionToken})}async removePromoCode(e,t){let r=t??"default";await this.http.delete(`/api/v1/checkout-sessions/${e}/promotions/${r}`,{token:this.sessionToken})}async getShippingRates(e){return((await this.http.get(`/api/v1/checkout-sessions/${e}/shipping-rates`,{token:this.sessionToken})).rates??[]).map(r=>this.normalizeShippingRate(r))}normalizeShippingRate(e){return{id:e.id,name:e.name??e.shippingRateName??"",description:e.description??void 0,amount:e.amount??0,currency:e.currency??"USD",estimatedDays:e.estimatedDays??e.estimatedDeliveryTime??void 0}}async selectShippingRate(e,t){await this.http.post(`/api/v1/checkout-sessions/${e}/shipping-rate`,{checkoutSessionId:e,shippingRateId:t},{token:this.sessionToken})}normalizeSession(e){var f;let t=e.checkoutSession,r=t.orderSummaries??[],n=e.summary??t.summary??r[0]??{},o=t.sessionLineItems??[],i=t.customer,a=(f=n.currency??t.selectedPresentmentCurrency)==null?void 0:f.toUpperCase(),u=o.map(d=>{let h=d.price,l=d.variant??(h==null?void 0:h.variant)??{},m=d.product??l.product??{},y=(h==null?void 0:h.currencyOptions)??{},g=(a?y[a]:void 0)??y[Object.keys(y)[0]],p=(g==null?void 0:g.amount)??0;return{id:d.id,variantId:d.variantId,priceId:d.priceId,productName:m.name??"",variantName:l.name??"",quantity:d.quantity??1,unitAmount:p,totalAmount:p*(d.quantity??1),currency:a??"USD",imageUrl:l.imageUrl??m.imageUrl??""}}),c=n.items??[];return{id:t.id,storeId:t.storeId,checkoutToken:t.checkoutToken,currency:a??"USD",items:u,totals:{subtotal:n.subtotalAmount??0,discount:n.totalPromotionAmount??0,shipping:n.shippingCost??0,tax:n.totalTaxAmount??0,total:n.totalAmount??c.reduce((d,h)=>d+(h.amount??0),0),currency:a??"USD"},customer:i?{id:i.id,email:i.email,firstName:i.firstName,lastName:i.lastName,phone:i.phone}:void 0,shippingAddress:this.normalizeAddress(t.shippingAddress),billingAddress:this.normalizeAddress(t.billingAddress),selectedShippingRateId:t.shippingRateId??null,metadata:t.metadata}}normalizeAddress(e){if(!e||typeof e!="object")return;let t=e,r={firstName:t.firstName,lastName:t.lastName,line1:t.line1??t.address1,line2:t.line2??t.address2,city:t.city,state:t.state,postalCode:t.postalCode??t.postal,country:t.country,phone:t.phone};return Object.values(r).some(n=>n!==void 0&&n!=="")?r:void 0}};function ot(s){let e={};for(let[t,r]of Object.entries(s))r!=null&&r!==""&&(e[t]=r);return Object.keys(e).length>0?e:void 0}function ue(s){var t,r;if(!s)return;let e={firstName:s.givenName,lastName:s.familyName,line1:(t=s.addressLines)==null?void 0:t[0],line2:(r=s.addressLines)==null?void 0:r[1],city:s.locality,state:s.administrativeArea,postalCode:s.postalCode,country:s.countryCode,phone:s.phoneNumber};return Ue(e)?e:void 0}function de(s){if(!s)return;let[e,...t]=(s.name??"").trim().split(/\s+/),r={firstName:e||void 0,lastName:t.length?t.join(" "):void 0,line1:s.address1,line2:[s.address2,s.address3].filter(Boolean).join(" ")||void 0,city:s.locality,state:s.administrativeArea,postalCode:s.postalCode,country:s.countryCode,phone:s.phoneNumber};return Ue(r)?r:void 0}function Ue(s){var e,t;return!!((e=s.line1)!=null&&e.trim()&&((t=s.country)!=null&&t.trim()))}var le=class{constructor(e,t,r,n){this.http=e;this.storeId=t;this.environment=r;this.checkout=n;this.lastPaymentSetup=null}async getPaymentSetup(e,t){if(t!=null&&t.paymentSetupConfig)return this.lastPaymentSetup=t.paymentSetupConfig,t.paymentSetupConfig;let r=this.readInjectedStepConfig();if(r)return this.lastPaymentSetup=r,r;let n=await this.http.get("/api/v1/payment-methods",{params:{checkoutSessionId:e}}),o={};for(let i of n.methods??[]){let a=i.provider?`${i.method}:${i.provider}`:i.method;o[a]=i}return this.lastPaymentSetup=o,o}async getExpressMethods(e,t){var o,i,a,u,c,f,d,h;let r=await this.getPaymentSetup(e,t),n={};for(let[l,m]of Object.entries(r)){if(!m.enabled)continue;if(l.startsWith("express_checkout:")&&m.methods){let p={available:!0,processorId:m.processorId,publishableKey:m.publishableKey,metadata:m.metadata};if((o=m.methods.apple_pay)!=null&&o.enabled){let v=typeof window<"u"&&"ApplePaySession"in window&&((a=(i=window.ApplePaySession)==null?void 0:i.canMakePayments)==null?void 0:a.call(i));n.applePay={...p,type:"apple_pay",available:!!v}}(u=m.methods.google_pay)!=null&&u.enabled&&(n.googlePay={...p,type:"google_pay"}),(c=m.methods.link)!=null&&c.enabled&&(n.link={...p,type:"link"}),(f=m.methods.klarna_express)!=null&&f.enabled&&(n.klarna={...p,type:"klarna_express"});continue}if(!m.express)continue;let y=m.method,g={type:y,available:!0,processorId:m.processorId,publishableKey:m.publishableKey,metadata:m.metadata};if(y==="apple_pay"||m.type==="apple_pay"){let p=typeof window<"u"&&"ApplePaySession"in window&&((h=(d=window.ApplePaySession)==null?void 0:d.canMakePayments)==null?void 0:h.call(d));n.applePay={...g,available:!!p}}else y==="google_pay"||m.type==="google_pay"?n.googlePay=g:y==="paypal"?n.paypal=g:y==="klarna"||y==="klarna_express"?n.klarna=g:y==="link"&&(n.link=g)}return n}async getStoreConfig(){let e=await this.http.get("/api/v1/checkout/config",{params:{storeId:this.storeId}});return e.config??e}async getEnabledMethods(e,t){let r=await this.getPaymentSetup(e,t);return Object.entries(r).filter(([,n])=>n.enabled).map(([n])=>n)}async tokenizeCard(e){let t=await this.loadCoreJs(),r=new t.Tokenizer({environment:this.environment});await r.initialize();let n={cardNumber:e.cardNumber,expiryDate:e.expiryDate,cvc:e.cvc};e.cardholderName&&(n.cardholderName=e.cardholderName);let o=await r.tokenizeCardRaw(n);return{tagadaToken:t.createTagadaToken(o,r.getProvider().getProviderName()),rawToken:o}}async createInstrument(e){return this.http.post("/api/v1/payment/create-instrument-from-token",{tagadaToken:e.tagadaToken})}async create3dsSession(e){return this.http.post("/api/public/v1/threeds/create-session",{provider:e.provider??"basis_theory",storeId:this.storeId,paymentInstrumentId:e.paymentInstrumentId,sessionData:e.sessionData})}async pay(e){return e.tagadaToken&&!e.paymentInstrumentId?this.http.post("/api/v1/payment/pay-with-token",{tagadaToken:e.tagadaToken,checkoutSessionId:e.checkoutSessionId,returnUrl:e.returnUrl,paymentFlowId:e.paymentFlowId,processorId:e.processorId,paymentMethod:e.paymentMethod,isExpress:e.isExpress,metadata:e.metadata}):this.http.post("/api/public/v1/checkout/pay-v2",{checkoutSessionId:e.checkoutSessionId,paymentInstrumentId:e.paymentInstrumentId,storeId:this.storeId,paymentFlowId:e.paymentFlowId,threedsSessionId:e.threedsSessionId,processorId:e.processorId,paymentMethod:e.paymentMethod,isExpress:e.isExpress,metadata:e.metadata,returnUrl:e.returnUrl})}async payDirect(e){return this.http.post("/api/public/v1/checkout/pay-v2",{checkoutSessionId:e.checkoutSessionId,paymentInstrumentId:e.paymentInstrumentId??"",storeId:this.storeId,paymentFlowId:e.paymentFlowId,processorId:e.processorId,paymentMethod:e.paymentMethod,isExpress:e.isExpress,threedsSessionId:e.threedsSessionId,returnUrl:e.returnUrl})}async syncWalletContact(e,t){let{shippingAddress:r,billingAddress:n}=t;if(!r&&!n)return;if(!this.checkout)throw new Error("PaymentModule cannot persist the wallet contact: no CheckoutModule was provided. Build the SDK through createTagadaClient() rather than constructing PaymentModule directly.");let o={};t.email&&(o.email=t.email),t.phone&&(o.phone=t.phone),t.firstName&&(o.firstName=t.firstName),t.lastName&&(o.lastName=t.lastName),await this.checkout.updateCustomerAndAddress(e,{customer:o,shippingAddress:r,billingAddress:n})}async processApplePay(e){var a,u,c,f,d,h,l,m,y;await this.syncWalletContact(e.checkoutSessionId,{shippingAddress:ue(e.shippingContact),billingAddress:ue(e.billingContact),email:((a=e.shippingContact)==null?void 0:a.emailAddress)??((u=e.billingContact)==null?void 0:u.emailAddress),phone:((c=e.shippingContact)==null?void 0:c.phoneNumber)??((f=e.billingContact)==null?void 0:f.phoneNumber),firstName:((d=e.shippingContact)==null?void 0:d.givenName)??((h=e.billingContact)==null?void 0:h.givenName),lastName:((l=e.shippingContact)==null?void 0:l.familyName)??((m=e.billingContact)==null?void 0:m.familyName)});let t=e.merchantRegistrationId??((y=await this.resolveApplePayRegistration(e.checkoutSessionId))==null?void 0:y.merchantRegistrationId),r=await this.loadCoreJs(),n=new r.Tokenizer({environment:this.environment});await n.initialize();let o=await n.tokenizeApplePay(e.applePayToken,t),i=btoa(JSON.stringify(r.createTagadaDigitalWalletToken(o,"apple_pay")));return this.pay({checkoutSessionId:e.checkoutSessionId,tagadaToken:i,paymentFlowId:e.paymentFlowId,processorId:e.processorId,paymentMethod:"apple_pay",isExpress:!0})}async resolveApplePayRegistration(e){if(typeof window>"u")return null;let t=window.location.hostname.toLowerCase().split(":")[0];t.startsWith("www.")&&(t=t.slice(4));let r=o=>{var i;for(let a of Object.values(o??{})){let u=(i=a==null?void 0:a.metadata)==null?void 0:i.applePayByok;if(!u||typeof u!="object")continue;let c=u[t];if(c!=null&&c.merchantRegistrationId)return{merchantRegistrationId:c.merchantRegistrationId,displayName:c.displayName}}return null},n=r(this.readInjectedStepConfig())??r(this.lastPaymentSetup);if(n)return n;if(this.lastPaymentSetup||this.readInjectedStepConfig()||!e)return null;try{return r(await this.getPaymentSetup(e))}catch{return null}}async processGooglePay(e){var i,a,u,c;await this.syncWalletContact(e.checkoutSessionId,{shippingAddress:de(e.shippingAddress),billingAddress:de(e.billingAddress),email:e.email??((i=e.shippingAddress)==null?void 0:i.emailAddress)??((a=e.billingAddress)==null?void 0:a.emailAddress),phone:((u=e.shippingAddress)==null?void 0:u.phoneNumber)??((c=e.billingAddress)==null?void 0:c.phoneNumber)});let t=await this.loadCoreJs(),r=new t.Tokenizer({environment:this.environment});await r.initialize();let n=await r.tokenizeGooglePay(e.googlePayToken),o=btoa(JSON.stringify(t.createTagadaDigitalWalletToken(n,"google_pay")));return this.pay({checkoutSessionId:e.checkoutSessionId,tagadaToken:o,paymentFlowId:e.paymentFlowId,processorId:e.processorId,paymentMethod:"google_pay",isExpress:!0})}async processApm(e){return this.payDirect({checkoutSessionId:e.checkoutSessionId,paymentMethod:e.paymentMethod,processorId:e.processorId,paymentFlowId:e.paymentFlowId})}async processStripeExpress(e){return this.payDirect({checkoutSessionId:e.checkoutSessionId,processorId:e.processorId,paymentMethod:e.paymentMethod,isExpress:!0})}async processPayment(e){!e.returnUrl&&typeof window<"u"&&(e={...e,returnUrl:window.location.href});let t=await this.pay(e);return this.finalize(t,{returnUrl:e.returnUrl})}async finalize(e,t){var o,i;let r=e.payment,n=(t==null?void 0:t.returnUrl)??(typeof window<"u"?window.location.href:void 0);return r.status==="succeeded"?{status:"succeeded",payment:r,order:e.order}:r.status==="failed"||r.status==="declined"?{status:"failed",error:((o=r.requireActionData)==null?void 0:o.message)||((i=r.requireActionData)==null?void 0:i.errorCode)||`Payment ${r.status}`,payment:r}:r.requireAction&&r.requireAction!=="none"&&r.requireActionData?this.handlePaymentAction(r,{returnUrl:n}):this.pollUntilDone(r.id)}async resumeAfterRedirect(e){return this.pollUntilDone(e)}async maybeResumeFromUrl(e){if(typeof window>"u"&&!(e!=null&&e.url))return null;let t=(e==null?void 0:e.url)??window.location.href,r;try{r=new URL(t)}catch{return null}let n=r.searchParams.get("paymentAction"),o=r.searchParams.get("paymentActionStatus"),i=r.searchParams.get("paymentId");if(n!=="requireAction"||o!=="completed"||!i)return null;let a=await this.resumeAfterRedirect(i);if((e==null?void 0:e.cleanUrl)!==!1&&typeof window<"u"&&!(e!=null&&e.url)){let u=new URLSearchParams(window.location.search);["paymentAction","paymentActionStatus","paymentId","payment_intent","payment_intent_client_secret","source_type","redirect_status","sessionId"].forEach(f=>u.delete(f));let c=u.toString();try{window.history.replaceState({},document.title,window.location.pathname+(c?"?"+c:""))}catch{}}return a}async getPaymentStatus(e){return this.http.get(`/api/v1/payments/${e}`)}async pollPaymentStatus(e,t){let r=(t==null?void 0:t.intervalMs)??1500,n=(t==null?void 0:t.timeoutMs)??6e4,o=Date.now();for(;Date.now()-o<n;){let i=await this.getPaymentStatus(e);if(i.status==="succeeded"||i.status==="failed"||i.status==="declined")return i;await new Promise(a=>setTimeout(a,r))}throw new Error(`Payment ${e} did not reach terminal status within ${n}ms.`)}async completeAfter3ds(e){return this.http.post("/api/v1/payments/complete-after-3ds",{paymentId:e})}async markActionProcessed(e){try{await this.http.post("/api/v1/payments/require-action/processed",{paymentId:e})}catch{}}async handlePaymentAction(e,t){let r=e.requireActionData;switch(await this.markActionProcessed(e.id),r.type){case"threeds_auth":return this.handleThreedsAuth(e,t);case"processor_auth":case"redirect_to_payment":return this.extractRedirect(e,r);case"redirect":return this.extractRedirect(e,r);case"error":return{status:"failed",error:r.message||r.errorCode||"Payment failed",payment:e};default:return this.extractRedirect(e,r)}}extractRedirect(e,t){var o,i;let r=(o=t.metadata)==null?void 0:o.redirect,n=(r==null?void 0:r.redirectUrl)||t.redirectUrl;return n?{status:"requires_redirect",redirectUrl:n,method:((i=r==null?void 0:r.method)==null?void 0:i.toUpperCase())||"GET",postData:r==null?void 0:r.data,paymentId:e.id}:{status:"failed",error:`Payment requires action (${t.type}) but no redirect URL was provided`,payment:e}}async handleThreedsAuth(e,t){var o,i;let r=(i=(o=e.requireActionData)==null?void 0:o.metadata)==null?void 0:i.threedsSession;if(!(r!=null&&r.externalSessionId))return this.extractRedirect(e,e.requireActionData);let n;try{n=await import("@tagadapay/core-js")}catch{return r.acsChallengeUrl?{status:"requires_redirect",redirectUrl:r.acsChallengeUrl,paymentId:e.id}:this.extractRedirect(e,e.requireActionData)}try{let a=new n.ThreedsManager({provider:"basis_theory"});return await a.initialize({apiKey:void 0}),await a.startChallenge({sessionId:r.externalSessionId,acsChallengeUrl:r.acsChallengeUrl,acsTransactionId:r.acsTransID,threeDSVersion:r.messageVersion}),await this.completeAfter3ds(e.id),this.pollUntilDone(e.id)}catch{return r.acsChallengeUrl?{status:"requires_redirect",redirectUrl:r.acsChallengeUrl,paymentId:e.id}:{status:"failed",error:"3D Secure authentication failed",payment:e}}}async pollUntilDone(e,t){let r=(t==null?void 0:t.intervalMs)??1500,n=(t==null?void 0:t.timeoutMs)??6e4,o=Date.now(),i=0;for(;Date.now()-o<n;){let a;try{a=await this.getPaymentStatus(e),i=0}catch{if(i++,i>=3)return{status:"failed",error:"Payment verification failed due to network errors"};await new Promise(u=>setTimeout(u,r));continue}if(a.status==="succeeded"||a.status==="pending"&&a.subStatus==="authorized")return{status:"succeeded",payment:a,order:a.order};if(a.status==="failed"||a.status==="declined")return{status:"failed",error:a.status,payment:a};if(a.requireAction&&a.requireAction!=="none"&&a.requireActionData&&!a.requireActionData.processed)return this.handlePaymentAction(a,{});await new Promise(u=>setTimeout(u,r))}return{status:"pending",paymentId:e}}readInjectedStepConfig(){if(typeof window>"u")return null;let e=window.__TGD_STEP_CONFIG__;if(!e)return null;try{let t=typeof e=="string"?JSON.parse(e):e;return(t==null?void 0:t.paymentSetupConfig)??null}catch{return null}}async loadCoreJs(){try{return await import("@tagadapay/core-js")}catch{throw new Error("This method requires @tagadapay/core-js. Install it: npm install @tagadapay/core-js")}}};var me=class{constructor(e,t,r){this.http=e;this.storeId=t;this.payment=r}async getOffer(e){return this.http.get(`/api/v1/offers/${e}`)}async listOffers(e){var o;let t=`/api/v1/stores/${this.storeId}/offers`,r=[];if(e!=null&&e.type&&r.push(`type=${encodeURIComponent(e.type)}`),(o=e==null?void 0:e.ids)!=null&&o.length)for(let i of e.ids)r.push(`ids=${encodeURIComponent(i)}`);return r.length&&(t+=`?${r.join("&")}`),(await this.http.get(t)).offers??[]}async previewOffer(e){return this.http.post(`/api/v1/offers/${e.offerId}/preview`,{offerId:e.offerId,currency:e.currency??"",lineItems:e.lineItems})}async payPreviewedOffer(e){return this.http.post(`/api/v1/offers/${e.offerId}/pay-preview`,{offerId:e.offerId,currency:e.currency??"",lineItems:e.lineItems,returnUrl:e.returnUrl??(typeof window<"u"?window.location.href:""),mainOrderId:e.mainOrderId,paymentInstrumentId:e.paymentInstrumentId})}async processOfferPayment(e){if(!this.payment)throw new Error("OffersModule: no PaymentModule injected. Use createHeadlessClient() instead of constructing OffersModule directly.");let t=e.returnUrl??(typeof window<"u"?window.location.href:void 0),r=await this.payPreviewedOffer({...e,returnUrl:t});return this.payment.finalize({payment:r.payment,order:r.order},{returnUrl:t})}async toggleOrderBump(e){return this.http.post(`/api/v1/checkout-sessions/${e.checkoutSessionId}/toggle-order-bump`,{orderBumpOfferId:e.orderBumpOfferId,selected:e.selected})}async listPostPurchaseOffers(e){let t=await this.http.get(`/api/v1/post-purchase/${e}/offers`);return Array.isArray(t)?t:[]}async acceptPostPurchaseOffer(e){return this.http.post(`/api/v1/orders/${e.orderId}/post-purchase-offers/${e.offerId}/accept`,{items:e.items??[]})}async declinePostPurchaseOffer(e){return this.http.post(`/api/v1/orders/${e.orderId}/post-purchase-offers/${e.offerId}/decline`)}};var pe=class{constructor(e,t){this.http=e;this.storeId=t}async getProfile(e){return(await this.http.get(`/api/v1/customers/${e}`,{params:{storeId:this.storeId}})).customer}async getByEmail(e){try{return(await this.http.get("/api/v1/customers/by-email",{params:{email:e,storeId:this.storeId}})).customer}catch{return null}}async updateProfile(e,t){return(await this.http.patch(`/api/v1/customers/${e}`,{storeId:this.storeId,...t})).customer}async getOrders(e,t){return this.http.get(`/api/v1/customers/${e}/orders`,{params:{storeId:this.storeId,limit:t==null?void 0:t.limit,offset:t==null?void 0:t.offset}})}async getOrder(e){return(await this.http.get(`/api/v1/orders/${e}`,{params:{storeId:this.storeId}})).order}async getSubscriptions(e){return(await this.http.get(`/api/v1/customers/${e}/subscriptions`,{params:{storeId:this.storeId}})).subscriptions}async getSubscription(e){return(await this.http.get(`/api/v1/subscriptions/${e}`,{params:{storeId:this.storeId}})).subscription}};var ge=class{constructor(e,t){this.http=e;this.storeId=t}async getProducts(e){var n,o;let t={storeId:this.storeId,includeVariants:!0,includePrices:!0};return(n=e==null?void 0:e.productIds)!=null&&n.length&&(t.productIds=e.productIds),(o=e==null?void 0:e.variantIds)!=null&&o.length&&(t.variantIds=e.variantIds),(await this.http.post("/api/v1/products",t)).items??[]}async getProduct(e){return(await this.getProducts({productIds:[e]}))[0]??null}};var fe=class{constructor(e,t,r,n){this.http=e;this.storeId=t;this.checkout=r;this.accountId=n}async navigate(e){var a;let t=this.checkout.getCurrentSession();if(!t)throw new M("No checkout session loaded. Call sdk.checkout.loadSession(...) before sdk.funnel.navigate(...).","no_cart_loaded");let r=e.accountId??this.accountId;if(!r)throw new M("accountId is required for funnel.navigate(). Set it on createHeadlessClient({ accountId }) or pass it per call.","missing_account_id");let n=e.currentUrl??(typeof globalThis<"u"?(a=globalThis.location)==null?void 0:a.href:void 0);await this.ensureCmsSession(t,r,e);let o=await this.initializeFunnel({funnelId:e.funnelId,stepId:e.stepId,accountId:r,currentUrl:n});return{url:await this.runNavigate({funnelSessionId:o,stepId:e.stepId,session:t,input:e,currentUrl:n}),funnelSessionId:o}}async ensureCmsSession(e,t,r){var i,a,u;if(this._cmsToken&&this._cmsSessionId&&this._cmsCustomerId)return;let n=await this.http.post("/api/v1/cms/session/anonymous",{storeId:this.storeId,role:"anonymous",draft:!1});this._cmsToken=n.token,this._cmsSessionId=n.sessionId;let o=await this.http.post("/api/v1/cms/session/v2/init",{storeId:this.storeId,accountId:t,customerId:"anon_placeholder",browserLocale:((i=r.customer)==null?void 0:i.locale)??at(),userAgent:ct(),queryCurrency:((a=r.customer)==null?void 0:a.currency)??e.currency,queryLocale:(u=r.customer)==null?void 0:u.locale},{token:this._cmsToken});this._cmsCustomerId=o.customer.id}async initializeFunnel(e){return(await this.http.post("/api/v1/funnel/initialize",{cmsSession:{customerId:this._cmsCustomerId,sessionId:this._cmsSessionId,storeId:this.storeId,accountId:e.accountId},funnelId:e.funnelId,entryStepId:e.stepId,funnelStepId:e.stepId,currentUrl:e.currentUrl,draft:!1},{token:this._cmsToken})).context.sessionId}async runNavigate(e){var d,h,l,m;let{funnelSessionId:t,stepId:r,session:n,input:o,currentUrl:i}=e,a=n.items.map(y=>({variantId:y.variantId,priceId:y.priceId,quantity:y.quantity})),u=o.discountCodes??(n.promotionCode?[n.promotionCode]:void 0),c={email:((d=o.customer)==null?void 0:d.email)??((h=n.customer)==null?void 0:h.email),currency:((l=o.customer)==null?void 0:l.currency)??n.currency,locale:(m=o.customer)==null?void 0:m.locale};return(await this.http.post("/api/v1/funnel/navigate",{sessionId:t,currentUrl:i,funnelStepId:r,fireAndForget:!1,event:{type:"INIT_CHECKOUT",data:{checkoutInit:{cartToken:n.id,lineItems:a,customer:c,returnUrl:o.returnUrl,storeId:this.storeId,metadata:o.metadata,discountCodes:u,externalShipping:o.externalShipping}}}},{token:this._cmsToken})).result.url}};function at(){return typeof navigator<"u"&&navigator.language?navigator.language:"en-US"}function ct(){return typeof navigator<"u"&&navigator.userAgent?navigator.userAgent:"tagadapay-headless-sdk"}var ye=class{constructor(e){this.http=e}async isRequiredForProduct(e,t){return this.http.get("/api/public/v1/rx/required-for-product",{params:{productId:e,clinicalNetworkId:t==null?void 0:t.clinicalNetworkId}})}async getCasesForOrder(e){return this.http.post("/api/public/v1/rx/cases/lookup",e)}async submitCase(e){return this.http.post("/api/public/v1/rx/cases/submit",e)}async getQuestionsForProduct(e){return this.http.get("/api/public/v1/rx/questions-for-product",{params:{productId:e}})}};var ke=class{constructor(e){let t=e.environment??"production",r=Z.resolveBaseUrl(t,e.baseUrl);this.config={...e,environment:t,baseUrl:r,timeout:e.timeout??3e4},this.http=new Z({baseUrl:r,timeout:this.config.timeout,apiKey:e.apiKey,getToken:()=>this._sessionToken});let n=o=>{this._sessionToken=o};this.checkout=new ce(this.http,this.config.storeId,n),this.payment=new le(this.http,this.config.storeId,t,this.checkout),this.offers=new me(this.http,this.config.storeId,this.payment),this.customer=new pe(this.http,this.config.storeId),this.catalog=new ge(this.http,this.config.storeId),this.funnel=new fe(this.http,this.config.storeId,this.checkout,this.config.accountId),this.rx=new ye(this.http)}setSessionToken(e){this._sessionToken=e}};function Ne(s){return new ke(s)}var Me=F("react/jsx-runtime"),_e=(0,J.createContext)(null);function De({storeId:s,environment:e,apiKey:t,baseUrl:r,config:n,children:o}){let i=(0,J.useMemo)(()=>Ne(n??{storeId:s,environment:e,apiKey:t,baseUrl:r}),[s,e,t,r,n]),a=(0,J.useMemo)(()=>({client:i}),[i]);return(0,Me.jsx)(_e.Provider,{value:a,children:o})}function q(){let s=(0,J.useContext)(_e);if(!s)throw new Error("useHeadlessClient must be used within <TagadaHeadlessProvider>");return s.client}var E=F("react");function qe(s,e){let t=q(),[r,n]=(0,E.useState)(null),[o,i]=(0,E.useState)(!1),[a,u]=(0,E.useState)(null),c=(0,E.useCallback)(async()=>{if(s){i(!0),u(null);try{let I=await t.checkout.loadSession(s,e);n(I)}catch(I){u(I instanceof Error?I:new Error(String(I)))}finally{i(!1)}}},[t,s,e]);(0,E.useEffect)(()=>{c()},[c]);let f=(0,E.useCallback)(async I=>{i(!0),u(null);try{let P=await t.checkout.createSession(I),x=new URL(window.location.href);x.searchParams.set("checkoutToken",P.checkoutToken),x.searchParams.set("token",P.sessionToken),window.history.replaceState({},"",x.toString());let S=await t.checkout.loadSession(P.checkoutToken,P.sessionToken);n(S)}catch(P){u(P instanceof Error?P:new Error(String(P)))}finally{i(!1)}},[t]),d=(0,E.useCallback)(async I=>{if(r){i(!0);try{await t.checkout.updateCart(r.id,I),await c()}catch(P){u(P instanceof Error?P:new Error(String(P)))}finally{i(!1)}}},[t,r,c]),h=(0,E.useCallback)(async I=>{r&&await t.checkout.updateCustomer(r.id,I)},[t,r]),l=(0,E.useCallback)(async I=>{if(r){i(!0);try{await t.checkout.updateAddress(r.id,I),await c()}catch(P){u(P instanceof Error?P:new Error(String(P)))}finally{i(!1)}}},[t,r,c]),m=(0,E.useCallback)(async I=>{if(r){i(!0);try{await t.checkout.updateCustomerAndAddress(r.id,I),await c()}catch(P){u(P instanceof Error?P:new Error(String(P)))}finally{i(!1)}}},[t,r,c]),y=(0,E.useCallback)(async I=>{if(r){i(!0);try{await t.checkout.applyPromoCode(r.id,I),await c()}catch(P){u(P instanceof Error?P:new Error(String(P)))}finally{i(!1)}}},[t,r,c]),g=(0,E.useCallback)(async I=>{if(r){i(!0);try{await t.checkout.removePromoCode(r.id,I),await c()}catch(P){u(P instanceof Error?P:new Error(String(P)))}finally{i(!1)}}},[t,r,c]),p=(0,E.useCallback)(async()=>r?t.checkout.getShippingRates(r.id):[],[t,r]),v=(0,E.useCallback)(async I=>{if(r){i(!0);try{await t.checkout.selectShippingRate(r.id,I),await c()}catch(P){u(P instanceof Error?P:new Error(String(P)))}finally{i(!1)}}},[t,r,c]);return{session:r,isLoading:o,error:a,refresh:c,createSession:f,updateCart:d,updateCustomer:h,updateAddress:l,updateCustomerAndAddress:m,applyPromo:y,removePromo:g,getShippingRates:p,selectShippingRate:v}}var b=F("react");var Fe=new Set;function he(s){return Fe.has(s)?!1:(Fe.add(s),!0)}function Ge(s){let e=q(),[t,r]=(0,b.useState)(null),[n,o]=(0,b.useState)(null),[i,a]=(0,b.useState)(null),[u,c]=(0,b.useState)(!1),[f,d]=(0,b.useState)(null),[h,l]=(0,b.useState)(null),m=(0,b.useRef)(!1),y=(0,b.useRef)(!1),g=(0,b.useRef)(s);g.current=s,(0,b.useEffect)(()=>{if(typeof window>"u"||y.current)return;let R=new URLSearchParams(window.location.search),w=R.get("paymentAction"),C=R.get("paymentActionStatus"),U=R.get("paymentId");if(w!=="requireAction"||C!=="completed"||!U||(y.current=!0,!he(U)))return;c(!0),l(null),(async()=>{var k,A,H,V;try{let _=await e.payment.resumeAfterRedirect(U),Se=new URLSearchParams(window.location.search);["paymentAction","paymentActionStatus","paymentId","payment_intent","payment_intent_client_secret","source_type","redirect_status"].forEach(Ze=>Se.delete(Ze));let Ye=Se.toString()?`${window.location.pathname}?${Se.toString()}`:window.location.pathname;window.history.replaceState({},document.title,Ye),_.status==="succeeded"?(A=(k=g.current)==null?void 0:k.onPaymentSuccess)==null||A.call(k,_):_.status==="failed"&&(l(new Error(_.error)),(V=(H=g.current)==null?void 0:H.onPaymentFailed)==null||V.call(H,_))}catch(_){l(_ instanceof Error?_:new Error(String(_)))}finally{c(!1)}})()},[e]);let p=(0,b.useCallback)(async(R,w)=>{var U;if(m.current)return;m.current=!0;let C=w!=null&&w.paymentSetupConfig?{paymentSetupConfig:w.paymentSetupConfig}:(U=g.current)!=null&&U.paymentSetupConfig?{paymentSetupConfig:g.current.paymentSetupConfig}:void 0;try{let[N,k,A]=await Promise.all([e.payment.getPaymentSetup(R,C),e.payment.getExpressMethods(R,C),e.payment.getStoreConfig()]);r(N),o(k),a(A)}catch(N){m.current=!1,l(N instanceof Error?N:new Error(String(N)))}},[e]),v=(0,b.useCallback)(async R=>{var w,C,U,N;c(!0),l(null);try{let k=await e.payment.processPayment(R);if(k.status==="requires_redirect"){if(k.method==="POST"&&k.postData){let A=document.createElement("form");A.method="POST",A.action=k.redirectUrl;for(let[H,V]of Object.entries(k.postData)){let _=document.createElement("input");_.type="hidden",_.name=H,_.value=V,A.appendChild(_)}document.body.appendChild(A),A.submit()}else window.location.href=k.redirectUrl;return k}return k.status==="succeeded"?(C=(w=g.current)==null?void 0:w.onPaymentSuccess)==null||C.call(w,k):k.status==="failed"&&(l(new Error(k.error)),(N=(U=g.current)==null?void 0:U.onPaymentFailed)==null||N.call(U,k)),k}catch(k){let A=k instanceof Error?k:new Error(String(k));return l(A),{status:"failed",error:A.message}}finally{c(!1)}},[e]),I=(0,b.useCallback)(R=>async()=>{c(!0),l(null);try{return await R()}catch(w){let C=w instanceof Error?w:new Error(String(w));throw l(C),C}finally{c(!1)}},[]),P=(0,b.useCallback)(async R=>{c(!0),l(null);try{let w=await e.payment.pay(R);return d(w),w}catch(w){let C=w instanceof Error?w:new Error(String(w));throw l(C),C}finally{c(!1)}},[e]),x=(0,b.useCallback)(R=>e.payment.tokenizeCard(R),[e]),S=(0,b.useCallback)(async R=>{let C=await I(()=>e.payment.processApplePay(R))();return d(C),C},[e,I]),T=(0,b.useCallback)(async R=>{let C=await I(()=>e.payment.processGooglePay(R))();return d(C),C},[e,I]),B=(0,b.useCallback)(async R=>{let C=await I(()=>e.payment.processApm(R))();return d(C),C},[e,I]),$=(0,b.useCallback)(R=>e.payment.pollPaymentStatus(R),[e]);return{paymentSetup:t,expressMethods:n,storeConfig:i,isProcessing:u,result:f,error:h,loadPaymentSetup:p,processPayment:v,pay:P,tokenizeCard:x,processApplePay:S,processGooglePay:T,processApm:B,pollStatus:$}}var O=F("react");function $e(s){let e=q(),[t,r]=(0,O.useState)(null),[n,o]=(0,O.useState)(null),[i,a]=(0,O.useState)(!1),[u,c]=(0,O.useState)(null),f=(0,O.useRef)(s);f.current=s;let d=(0,O.useRef)(!1);(0,O.useEffect)(()=>{var w;if(typeof window>"u"||(w=f.current)!=null&&w.disableAutoResume||d.current)return;let S=new URLSearchParams(window.location.search),T=S.get("paymentAction"),B=S.get("paymentActionStatus"),$=S.get("paymentId");if(T!=="requireAction"||B!=="completed"||!$||(d.current=!0,!he($)))return;a(!0),c(null),(async()=>{var C,U,N,k;try{let A=await e.payment.resumeAfterRedirect($),H=new URLSearchParams(window.location.search);["paymentAction","paymentActionStatus","paymentId","payment_intent","payment_intent_client_secret","source_type","redirect_status"].forEach(_=>H.delete(_));let V=H.toString()?`${window.location.pathname}?${H.toString()}`:window.location.pathname;window.history.replaceState({},document.title,V),A.status==="succeeded"?(U=(C=f.current)==null?void 0:C.onOfferAccepted)==null||U.call(C,A):A.status==="failed"&&(c(new Error(A.error)),(k=(N=f.current)==null?void 0:N.onOfferDeclined)==null||k.call(N,A))}catch(A){c(A instanceof Error?A:new Error(String(A)))}finally{a(!1)}})()},[e]);let h=(0,O.useCallback)(async S=>{a(!0),c(null);try{return await S()}catch(T){let B=T instanceof Error?T:new Error(String(T));throw c(B),B}finally{a(!1)}},[]),l=(0,O.useCallback)(S=>h(async()=>{let T=await e.offers.getOffer(S);return r(T),T}),[e,h]),m=(0,O.useCallback)(S=>e.offers.listOffers(S),[e]),y=(0,O.useCallback)(S=>h(async()=>{let T=await e.offers.previewOffer(S);return o(T),T}),[e,h]),g=(0,O.useCallback)(S=>h(()=>e.offers.payPreviewedOffer(S)),[e,h]),p=(0,O.useCallback)(async S=>{var T,B,$,R;a(!0),c(null);try{let w=await e.offers.processOfferPayment(S);if(w.status==="requires_redirect"){if(w.method==="POST"&&w.postData){let C=document.createElement("form");C.method="POST",C.action=w.redirectUrl;for(let[U,N]of Object.entries(w.postData)){let k=document.createElement("input");k.type="hidden",k.name=U,k.value=N,C.appendChild(k)}document.body.appendChild(C),C.submit()}else window.location.href=w.redirectUrl;return w}return w.status==="succeeded"?(B=(T=f.current)==null?void 0:T.onOfferAccepted)==null||B.call(T,w):w.status==="failed"&&(c(new Error(w.error)),(R=($=f.current)==null?void 0:$.onOfferDeclined)==null||R.call($,w)),w}catch(w){let C=w instanceof Error?w:new Error(String(w));return c(C),{status:"failed",error:C.message}}finally{a(!1)}},[e]),v=(0,O.useCallback)(S=>e.offers.toggleOrderBump(S),[e]),I=(0,O.useCallback)(S=>e.offers.listPostPurchaseOffers(S),[e]),P=(0,O.useCallback)(S=>h(()=>e.offers.acceptPostPurchaseOffer(S)),[e,h]),x=(0,O.useCallback)(S=>h(()=>e.offers.declinePostPurchaseOffer(S)),[e,h]);return{offer:t,preview:n,isLoading:i,error:u,getOffer:l,listOffers:m,previewOffer:y,processOfferPayment:p,payPreviewedOffer:g,toggleOrderBump:v,listPostPurchaseOffers:I,acceptPostPurchaseOffer:P,declinePostPurchaseOffer:x}}var G=F("react");function He(s){let e=q(),[t,r]=(0,G.useState)(null),[n,o]=(0,G.useState)([]),[i,a]=(0,G.useState)([]),[u,c]=(0,G.useState)(!1),[f,d]=(0,G.useState)(null),h=(0,G.useCallback)(async g=>{c(!0),d(null);try{let p=await e.customer.getProfile(g);r(p)}catch(p){d(p instanceof Error?p:new Error(String(p)))}finally{c(!1)}},[e]),l=(0,G.useCallback)(async g=>{try{let p=await e.customer.getOrders(g);o(p.orders)}catch(p){d(p instanceof Error?p:new Error(String(p)))}},[e]),m=(0,G.useCallback)(async g=>{try{let p=await e.customer.getSubscriptions(g);a(p)}catch(p){d(p instanceof Error?p:new Error(String(p)))}},[e]),y=(0,G.useCallback)(async(g,p)=>{try{let v=await e.customer.updateProfile(g,p);r(v)}catch(v){d(v instanceof Error?v:new Error(String(v)))}},[e]);return(0,G.useEffect)(()=>{s&&h(s)},[s,h]),{customer:t,orders:n,subscriptions:i,isLoading:u,error:f,loadCustomer:h,loadOrders:l,loadSubscriptions:m,updateProfile:y}}var Q=F("react");function je(){let s=q(),[e,t]=(0,Q.useState)([]),[r,n]=(0,Q.useState)(!1),[o,i]=(0,Q.useState)(null),a=(0,Q.useCallback)(async c=>{n(!0),i(null);try{let f=await s.catalog.getProducts(c);return t(f),f}catch(f){let d=f instanceof Error?f:new Error(String(f));throw i(d),d}finally{n(!1)}},[s]),u=(0,Q.useCallback)(async c=>{n(!0),i(null);try{return await s.catalog.getProduct(c)}catch(f){let d=f instanceof Error?f:new Error(String(f));throw i(d),d}finally{n(!1)}},[s]);return{products:e,isLoading:r,error:o,loadProducts:a,loadProduct:u}}var D=F("react");var ut=new Set(["approved","shipped","delivered","declined","cancelled","error"]);function Ke(){let s=q(),[e,t]=(0,D.useState)([]),[r,n]=(0,D.useState)(null),[o,i]=(0,D.useState)(!1),[a,u]=(0,D.useState)(null),c=(0,D.useRef)(null);(0,D.useEffect)(()=>()=>{c.current&&clearInterval(c.current)},[]);let f=(0,D.useCallback)(async(y,g)=>{i(!0),u(null);try{return await s.rx.isRequiredForProduct(y,g)}catch(p){let v=p instanceof Error?p:new Error(String(p));throw u(v),v}finally{i(!1)}},[s]),d=(0,D.useCallback)(async y=>{i(!0),u(null);try{return await s.rx.getQuestionsForProduct(y)}catch(g){let p=g instanceof Error?g:new Error(String(g));throw u(p),p}finally{i(!1)}},[s]),h=(0,D.useCallback)(async y=>{i(!0),u(null);try{let g=await s.rx.submitCase(y);return n(g),g}catch(g){let p=g instanceof Error?g:new Error(String(g));throw u(p),p}finally{i(!1)}},[s]),l=(0,D.useCallback)(async y=>{i(!0),u(null);try{let g=await s.rx.getCasesForOrder(y);return t(g.cases),g.cases}catch(g){let p=g instanceof Error?g:new Error(String(g));throw u(p),p}finally{i(!1)}},[s]),m=(0,D.useCallback)(({orderId:y,checkoutToken:g},p)=>{c.current&&clearInterval(c.current);let v=(p==null?void 0:p.intervalMs)??5e3,I=async()=>{var P;try{let x=await s.rx.getCasesForOrder({orderId:y,checkoutToken:g});t(x.cases),(P=p==null?void 0:p.onUpdate)==null||P.call(p,x.cases),x.cases.length>0&&x.cases.every(S=>ut.has(S.status))&&(c.current&&clearInterval(c.current),c.current=null)}catch(x){let S=x instanceof Error?x:new Error(String(x));u(S)}};return I(),c.current=setInterval(I,v),()=>{c.current&&clearInterval(c.current),c.current=null}},[s]);return{cases:e,lastSubmission:r,isLoading:o,error:a,isRequiredForProduct:f,getQuestionsForProduct:d,submitCase:h,fetchCasesForOrder:l,pollOrder:m}}var L=F("react");var Be=!1,ze=!1,Pe=[];function Re(){ze=!0;for(let s of Pe)s();Pe.length=0}function X(s,e={}){var t,r;return ze||(r=(t=window.google)==null?void 0:t.maps)!=null&&r.places?(Re(),Promise.resolve()):Be?new Promise(n=>Pe.push(n)):(Be=!0,new Promise((n,o)=>{if(Pe.push(n),document.querySelector('script[src*="maps.googleapis.com"]')){let c=()=>{var f,d;(d=(f=window.google)==null?void 0:f.maps)!=null&&d.places?Re():setTimeout(c,100)};c();return}let a=new URLSearchParams({key:s,libraries:"places",v:e.version??"weekly"});e.language&&a.set("language",e.language),e.region&&a.set("region",e.region);let u=document.createElement("script");u.src=`https://maps.googleapis.com/maps/api/js?${a}`,u.async=!0,u.defer=!0,u.onload=()=>Re(),u.onerror=()=>o(new Error("Failed to load Google Maps script")),document.head.appendChild(u)}))}var j=class s{static async searchPlaces(e,t={}){var n,o;if(!((o=(n=window.google)==null?void 0:n.maps)!=null&&o.places)||!e.trim())return[];let r=new window.google.maps.places.AutocompleteService;return new Promise(i=>{r.getPlacePredictions({input:e,types:t.types??["address"],componentRestrictions:t.componentRestrictions},(a,u)=>{var c,f,d;i(u===((d=(f=(c=window.google)==null?void 0:c.maps)==null?void 0:f.places)==null?void 0:d.PlacesServiceStatus.OK)&&a?a:[])})})}static async getPlaceDetails(e){var r,n;if(!((n=(r=window.google)==null?void 0:r.maps)!=null&&n.places))return null;let t=new window.google.maps.places.PlacesService(document.createElement("div"));return new Promise(o=>{t.getDetails({placeId:e,fields:["place_id","formatted_address","address_components","geometry"]},(i,a)=>{var u,c,f;o(a===((f=(c=(u=window.google)==null?void 0:u.maps)==null?void 0:c.places)==null?void 0:f.PlacesServiceStatus.OK)&&i?i:null)})})}static extractAddressComponents(e){let t={subpremise:"",streetNumber:"",route:"",locality:"",administrativeAreaLevel1:"",administrativeAreaLevel1Long:"",administrativeAreaLevel2:"",administrativeAreaLevel2Long:"",country:"",postalCode:"",fullStreetAddress:""},r="",n="",o="",i="",a="",u="",c="",f="";for(let l of e.address_components??[]){let m=l.types;m.includes("subpremise")&&(t.subpremise=l.long_name),m.includes("street_number")&&(t.streetNumber=l.long_name),m.includes("premise")&&(r=l.long_name),m.includes("route")&&(t.route=l.long_name),m.includes("neighborhood")&&(n=l.long_name),m.includes("sublocality_level_5")&&(o=l.long_name),m.includes("sublocality_level_4")&&(i=l.long_name),m.includes("sublocality_level_3")&&(a=l.long_name),m.includes("sublocality_level_2")&&(u=l.long_name),m.includes("sublocality_level_1")&&(c=l.long_name),m.includes("locality")&&(t.locality=l.long_name),m.includes("postal_town")&&(f=l.long_name),m.includes("administrative_area_level_2")&&(t.administrativeAreaLevel2=l.short_name,t.administrativeAreaLevel2Long=l.long_name),m.includes("administrative_area_level_1")&&(t.administrativeAreaLevel1=l.short_name,t.administrativeAreaLevel1Long=l.long_name),m.includes("country")&&(t.country=l.short_name),m.includes("postal_code")&&(t.postalCode=l.long_name)}t.locality||(t.locality=f||u||c||""),!t.administrativeAreaLevel1&&t.administrativeAreaLevel2&&(t.administrativeAreaLevel1=t.administrativeAreaLevel2Long||t.administrativeAreaLevel2,t.administrativeAreaLevel1Long=t.administrativeAreaLevel2Long);let d=t.streetNumber||r,h=t.route||o||i||a||n;if(t.subpremise&&d&&h)t.fullStreetAddress=`${t.subpremise}/${d} ${h}`;else if(d&&h)if(r&&i&&a){let l=`${a}-${i}-${r}`;u&&(l=`${l} ${u}`),t.fullStreetAddress=l}else t.fullStreetAddress=`${d} ${h}`;else h?t.fullStreetAddress=h:d&&(t.fullStreetAddress=d);return t.fullStreetAddress=t.fullStreetAddress.trim(),t}static extractFormattedAddress(e){let t=s.extractAddressComponents(e);return{address1:t.fullStreetAddress,city:t.locality,country:t.country,state:t.administrativeAreaLevel1,postal:t.postalCode}}};function Je(s){let{apiKey:e,language:t,region:r,version:n,defer:o=!1}=s,[i,a]=(0,L.useState)([]),[u,c]=(0,L.useState)(!1),[f,d]=(0,L.useState)(!1),h=(0,L.useRef)(null),l=(0,L.useRef)(null),m=(0,L.useCallback)(()=>{X(e,{language:t,region:r,version:n}).then(()=>d(!0))},[e,t,r,n]);(0,L.useEffect)(()=>{!e||o||m()},[e,o,m]),(0,L.useEffect)(()=>{if(f&&l.current){let{input:P,country:x}=l.current;l.current=null,y(P,x)}},[f]);let y=(0,L.useCallback)((P,x)=>{if(!f){o&&(l.current={input:P,country:x},m());return}if(P.length<3){a([]);return}h.current&&clearTimeout(h.current),h.current=setTimeout(async()=>{c(!0);let S=await j.searchPlaces(P,{componentRestrictions:x?{country:x.toLowerCase()}:void 0});a(S),c(!1)},300)},[f,o,m]),g=(0,L.useCallback)(P=>j.getPlaceDetails(P),[]),p=(0,L.useCallback)(P=>j.extractAddressComponents(P),[]),v=(0,L.useCallback)(P=>j.extractFormattedAddress(P),[]),I=(0,L.useCallback)(()=>a([]),[]);return{predictions:i,isLoading:u,isScriptLoaded:f,searchPlaces:y,getPlaceDetails:g,extractAddressComponents:p,extractFormattedAddress:v,clearPredictions:I}}var z=F("react");var Qe="https://cvwnizdbugpz6jwk.public.blob.vercel-storage.com/geodata/v1",be=["en","ru","de","da","fr","es","zh","hi","pt","ja","ar","it","he"],ee=new Map,we=new Map,ve=new Map,Ae=new Map;async function dt(s){let e=ee.get(s);if(e)return e;let t=ve.get(s);return t||(t=(async()=>{let r=`${Qe}/${s}/countries.json`,n=await fetch(r);if(!n.ok)throw new Error(`Geodata fetch failed: ${r} (${n.status})`);let o=await n.json();return ee.set(s,o),ve.delete(s),o})(),ve.set(s,t),t)}async function lt(s){let e=we.get(s);if(e)return e;let t=Ae.get(s);return t||(t=(async()=>{let r=`${Qe}/${s}/regions.json`,n=await fetch(r);if(!n.ok)throw new Error(`Geodata fetch failed: ${r} (${n.status})`);let o=await n.json();return we.set(s,o),Ae.delete(s),o})(),Ae.set(s,t),t)}function mt(s){return ee.get(s)||ee.get("en")||{}}function pt(s){return we.get(s)||we.get("en")||{}}async function te(s="en"){await Promise.all([dt(s),lt(s)])}var Ce=(s="en")=>{let e=mt(s);return Object.entries(e).map(([t,r])=>({code:t,name:r.n,iso3:r.i3,numeric:r.nu})).sort((t,r)=>t.name.localeCompare(r.name))},xe=(s,e="en")=>{let r=pt(e)[s];return r?r.map(([n,o])=>({code:n,name:o,countryCode:s})).sort((n,o)=>n.name.localeCompare(o.name)):[]};function re(s){return ee.has(s)}var K=class s{static ensureLoaded(e="en"){return te(e)}static getCountries(e="en"){let t=Ce(e),r={};for(let n of t)r[n.code]={iso:n.code,iso3:n.iso3??"",numeric:n.numeric??0,name:n.name};return r}static getCountryOptions(e="en"){return Ce(e).map(t=>({value:t.code,label:t.name}))}static getRegions(e,t="en"){return xe(e,t).map(r=>({iso:r.code,name:r.name}))}static getRegionOptions(e,t="en"){return s.getRegions(e,t).map(r=>({value:r.iso,label:r.name}))}static findRegion(e,t,r="en"){return s.getRegions(e,r).find(n=>n.iso===t)??null}static mapGoogleToISO(e,t,r,n="en"){let o=s.getRegions(r,n);if(o.length===0)return null;let i=o.find(a=>a.iso===e);return i||(i=o.find(a=>a.name.toLowerCase()===e.toLowerCase()),i)||(i=o.find(a=>a.name.toLowerCase()===t.toLowerCase()),i)?i:(i=o.find(a=>a.name.toLowerCase().includes(t.toLowerCase())||t.toLowerCase().includes(a.name.toLowerCase())),i??null)}static isLanguageLoaded(e){return re(e)}static getAvailableLanguages(){return be}};function Ie(s="en"){let[e,t]=(0,z.useState)(re(s));return(0,z.useEffect)(()=>{let r=!1;return te(s).then(()=>{r||t(!0)}).catch(n=>console.error("[headless-sdk] Failed to load geodata:",n)),()=>{r=!0}},[s]),(0,z.useMemo)(()=>e?{countries:K.getCountries(s),getRegions:r=>K.getRegions(r,s),findRegion:(r,n)=>K.findRegion(r,n,s),mapGoogleToISO:(r,n,o)=>K.mapGoogleToISO(r,n,o,s),isLoaded:!0}:{countries:{},getRegions:()=>[],findRegion:()=>null,mapGoogleToISO:()=>null,isLoaded:!1},[s,e])}function We(s="en"){let{countries:e,isLoaded:t}=Ie(s);return(0,z.useMemo)(()=>t?Object.values(e).map(r=>({value:r.iso,label:r.name})).sort((r,n)=>r.label.localeCompare(n.label)):[],[e,t])}function Ve(s,e="en"){let{getRegions:t,isLoaded:r}=Ie(e);return(0,z.useMemo)(()=>!r||!s?[]:t(s).map(n=>({value:n.iso,label:n.name})).sort((n,o)=>n.label.localeCompare(o.label)),[s,t,r])}var gt={USD:"$",EUR:"\u20AC",GBP:"\xA3",JPY:"\xA5",CAD:"C$",AUD:"A$",CHF:"CHF",CNY:"\xA5",SEK:"kr",NOK:"kr",DKK:"kr",PLN:"z\u0142",CZK:"K\u010D",HUF:"Ft",RON:"lei",BGN:"\u043B\u0432",HRK:"kn",RUB:"\u20BD",UAH:"\u20B4",TRY:"\u20BA",BRL:"R$",MXN:"$",ZAR:"R",INR:"\u20B9",KRW:"\u20A9",THB:"\u0E3F",VND:"\u20AB",IDR:"Rp",MYR:"RM",SGD:"S$",PHP:"\u20B1",TWD:"NT$",HKD:"HK$",ILS:"\u20AA",AED:"\u062F.\u0625",SAR:"\u0631.\u0633",QAR:"\u0631.\u0642",KWD:"\u062F.\u0643",BHD:"\u062F.\u0628",OMR:"\u0631.\u0639.",EGP:"\xA3",NGN:"\u20A6",KES:"KSh",GHS:"\u20B5",COP:"$",ARS:"$",CLP:"$",PEN:"S/",CRC:"\u20A1",DOP:"RD$",JMD:"J$",BOB:"Bs",PYG:"\u20B2",GTQ:"Q",NIO:"C$",PAB:"B/.",PKR:"\u20A8",BDT:"\u09F3",LKR:"\u20A8",NPR:"\u20A8",GEL:"\u20BE",AMD:"\u058F",AZN:"\u20BC",KZT:"\u20B8"},ft={USD:"US Dollar",EUR:"Euro",GBP:"British Pound",JPY:"Japanese Yen",CAD:"Canadian Dollar",AUD:"Australian Dollar",CHF:"Swiss Franc",CNY:"Chinese Yuan",SEK:"Swedish Krona",NOK:"Norwegian Krone",DKK:"Danish Krone",PLN:"Polish Zloty",CZK:"Czech Koruna",HUF:"Hungarian Forint",BRL:"Brazilian Real",MXN:"Mexican Peso",INR:"Indian Rupee",KRW:"South Korean Won",THB:"Thai Baht",SGD:"Singapore Dollar",HKD:"Hong Kong Dollar",TWD:"Taiwan Dollar",ILS:"Israeli Shekel",AED:"UAE Dirham",SAR:"Saudi Riyal",ZAR:"South African Rand",TRY:"Turkish Lira",RUB:"Russian Ruble",NGN:"Nigerian Naira"},yt=new Set(["JPY","KRW","VND","IDR","LAK","KHR","MMK","PYG"]),W=class s{static getSymbol(e){return gt[e]??e}static getName(e){return ft[e]??e}static getDecimalPlaces(e){return yt.has(e)?0:2}static getCurrency(e){return{code:e,symbol:s.getSymbol(e),name:s.getName(e),decimalPlaces:s.getDecimalPlaces(e)}}};function Oe(s,e="USD",t="en-US"){let r=W.getDecimalPlaces(e),n=s/(r===0?100:Math.pow(10,r));try{return new Intl.NumberFormat(t,{style:"currency",currency:e,minimumFractionDigits:r,maximumFractionDigits:r}).format(n)}catch{return`${W.getSymbol(e)}${n.toFixed(r)}`}}return it(ht);})();
|
|
7
|
+
if(typeof window!=="undefined"&&TagadaHeadlessReactBundle){ window.TagadaHeadlessReact=TagadaHeadlessReactBundle;}
|
|
8
|
+
//# sourceMappingURL=tagada-headless-react.min.js.map
|