@tagadapay/plugin-sdk 3.1.24 → 4.0.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 +1129 -1129
- package/build-cdn.js +499 -499
- package/dist/external-tracker.js +247 -2875
- package/dist/external-tracker.min.js +2 -2
- package/dist/external-tracker.min.js.map +4 -4
- package/dist/react/config/payment.d.ts +2 -2
- package/dist/react/config/payment.js +5 -5
- package/dist/react/hooks/useCheckout.js +7 -2
- package/dist/react/hooks/usePayment.d.ts +7 -0
- package/dist/react/hooks/usePayment.js +1 -0
- package/dist/react/providers/TagadaProvider.js +5 -5
- package/dist/tagada-react-sdk-minimal.min.js +2 -2
- package/dist/tagada-react-sdk-minimal.min.js.map +4 -4
- package/dist/tagada-react-sdk.js +1680 -1172
- package/dist/tagada-react-sdk.min.js +2 -2
- package/dist/tagada-react-sdk.min.js.map +4 -4
- package/dist/tagada-sdk.js +1701 -3410
- package/dist/tagada-sdk.min.js +2 -2
- package/dist/tagada-sdk.min.js.map +4 -4
- package/dist/v2/core/client.js +1 -0
- package/dist/v2/core/config/environment.d.ts +3 -3
- package/dist/v2/core/config/environment.js +7 -7
- package/dist/v2/core/funnelClient.d.ts +10 -0
- package/dist/v2/core/funnelClient.js +1 -1
- package/dist/v2/core/resources/apiClient.d.ts +18 -14
- package/dist/v2/core/resources/apiClient.js +151 -109
- package/dist/v2/core/resources/checkout.d.ts +1 -1
- package/dist/v2/core/resources/funnel.d.ts +1 -1
- package/dist/v2/core/resources/geo.d.ts +50 -0
- package/dist/v2/core/resources/geo.js +35 -0
- package/dist/v2/core/resources/index.d.ts +1 -1
- package/dist/v2/core/resources/index.js +1 -1
- package/dist/v2/core/resources/offers.js +4 -4
- package/dist/v2/core/resources/payments.d.ts +20 -1
- package/dist/v2/core/resources/payments.js +8 -0
- package/dist/v2/core/utils/currency.d.ts +3 -0
- package/dist/v2/core/utils/currency.js +40 -2
- package/dist/v2/core/utils/deviceInfo.d.ts +1 -0
- package/dist/v2/core/utils/deviceInfo.js +1 -0
- package/dist/v2/core/utils/previewMode.js +12 -0
- package/dist/v2/core/utils/previewModeIndicator.js +101 -101
- package/dist/v2/react/components/ApplePayButton.js +39 -16
- package/dist/v2/react/components/FunnelScriptInjector.js +167 -19
- package/dist/v2/react/components/StripeExpressButton.d.ts +8 -0
- package/dist/v2/react/components/StripeExpressButton.js +23 -3
- package/dist/v2/react/hooks/payment-actions/useAirwallexRadarAction.js +1 -0
- package/dist/v2/react/hooks/payment-actions/useNgeniusThreedsAction.d.ts +15 -0
- package/dist/v2/react/hooks/payment-actions/useNgeniusThreedsAction.js +166 -0
- package/dist/v2/react/hooks/payment-actions/usePaymentActionHandler.js +12 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentProcessors.js +1 -0
- package/dist/v2/react/hooks/useApiQuery.d.ts +1 -1
- package/dist/v2/react/hooks/useApiQuery.js +1 -1
- package/dist/v2/react/hooks/useCheckoutQuery.js +6 -2
- package/dist/v2/react/hooks/useISOData.js +25 -7
- package/dist/v2/react/hooks/usePaymentPolling.d.ts +1 -1
- package/dist/v2/react/hooks/usePreviewOffer.js +1 -1
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.d.ts +7 -0
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.js +105 -9
- package/dist/v2/react/providers/TagadaProvider.js +6 -6
- package/dist/v2/standalone/apple-pay-service.d.ts +12 -0
- package/dist/v2/standalone/apple-pay-service.js +12 -0
- package/dist/v2/standalone/external-tracker.d.ts +1 -1
- package/dist/v2/standalone/google-pay-service.d.ts +9 -0
- package/dist/v2/standalone/google-pay-service.js +9 -0
- package/dist/v2/standalone/index.d.ts +8 -1
- package/dist/v2/standalone/index.js +7 -0
- package/dist/v2/standalone/payment-service.d.ts +18 -5
- package/dist/v2/standalone/payment-service.js +63 -9
- package/package.json +115 -114
|
@@ -23,8 +23,8 @@ export declare function getPaymentConfig(environment?: string): PaymentConfig;
|
|
|
23
23
|
* tagadaClientEnv controls which API server the SDK talks to, but BasisTheory
|
|
24
24
|
* tokens must always match the backend's BT tenant.
|
|
25
25
|
*
|
|
26
|
-
* Production BT: *.tagadapay.com, custom domains (e.g. checkout.myboost.club)
|
|
27
|
-
* Test BT: *.
|
|
26
|
+
* Production BT: *.tagada.io, *.tagadapay.com, custom domains (e.g. checkout.myboost.club)
|
|
27
|
+
* Test BT: *.tagada.dev, *.tagadapay.dev, localhost, vercel.app, etc.
|
|
28
28
|
*/
|
|
29
29
|
export declare function isProductionBasisTheory(): boolean;
|
|
30
30
|
/**
|
|
@@ -50,22 +50,22 @@ import { getBasisTheoryKeys } from '../../config/basisTheory';
|
|
|
50
50
|
* tagadaClientEnv controls which API server the SDK talks to, but BasisTheory
|
|
51
51
|
* tokens must always match the backend's BT tenant.
|
|
52
52
|
*
|
|
53
|
-
* Production BT: *.tagadapay.com, custom domains (e.g. checkout.myboost.club)
|
|
54
|
-
* Test BT: *.
|
|
53
|
+
* Production BT: *.tagada.io, *.tagadapay.com, custom domains (e.g. checkout.myboost.club)
|
|
54
|
+
* Test BT: *.tagada.dev, *.tagadapay.dev, localhost, vercel.app, etc.
|
|
55
55
|
*/
|
|
56
56
|
export function isProductionBasisTheory() {
|
|
57
57
|
if (typeof window === 'undefined')
|
|
58
58
|
return false;
|
|
59
59
|
const hostname = window.location.hostname;
|
|
60
|
-
// Dev backend
|
|
60
|
+
// Dev backend — uses test BT
|
|
61
61
|
if (hostname.includes('app-dev.tagadapay.com') || hostname.includes('cdn-dev.tagadapay.com')) {
|
|
62
62
|
return false;
|
|
63
63
|
}
|
|
64
64
|
// Production and preprod share the same production BT tenant
|
|
65
|
-
if (hostname.includes('tagadapay.com'))
|
|
65
|
+
if (hostname.includes('tagada.io') || hostname.includes('tagadapay.com'))
|
|
66
66
|
return true;
|
|
67
67
|
// Dev/staging domains use test BT
|
|
68
|
-
if (hostname.includes('tagadapay.dev'))
|
|
68
|
+
if (hostname.includes('tagada.dev') || hostname.includes('tagadapay.dev'))
|
|
69
69
|
return false;
|
|
70
70
|
// Local development — test BT
|
|
71
71
|
if (hostname === 'localhost' ||
|
|
@@ -151,9 +151,14 @@ export function useCheckout(options = {}) {
|
|
|
151
151
|
setIsLoading(true);
|
|
152
152
|
setError(null);
|
|
153
153
|
try {
|
|
154
|
+
// Only send currency when explicitly set via URL param or persisted storage.
|
|
155
|
+
// Otherwise let the backend use the session's own selectedPresentmentCurrency.
|
|
156
|
+
const urlCurrency = new URLSearchParams(window.location.search).get('currency');
|
|
157
|
+
const storedCurrency = localStorage.getItem('tgd_currency');
|
|
158
|
+
const explicitCurrency = urlCurrency?.toUpperCase() || storedCurrency?.toUpperCase() || undefined;
|
|
154
159
|
const queryParams = new URLSearchParams();
|
|
155
|
-
if (
|
|
156
|
-
queryParams.set('currency',
|
|
160
|
+
if (explicitCurrency) {
|
|
161
|
+
queryParams.set('currency', explicitCurrency);
|
|
157
162
|
}
|
|
158
163
|
const url = `/api/v1/checkout-sessions/${checkoutToken}/v2${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
159
164
|
const response = await apiService.fetch(url, {
|
|
@@ -33,6 +33,13 @@ export interface PaymentOptions {
|
|
|
33
33
|
threedsProvider?: ThreedsProvider;
|
|
34
34
|
initiatedBy?: 'customer' | 'merchant';
|
|
35
35
|
source?: 'upsell' | 'checkout' | 'offer' | 'missing_club' | 'forced';
|
|
36
|
+
/**
|
|
37
|
+
* Shipping rate selected by the customer. Forwarded on the payment
|
|
38
|
+
* request so the order is created with the right shipping method
|
|
39
|
+
* even if the session's stored rate hasn't fully round-tripped or
|
|
40
|
+
* got cleared (race conditions).
|
|
41
|
+
*/
|
|
42
|
+
shippingRateId?: string;
|
|
36
43
|
onSuccess?: (payment: Payment) => void;
|
|
37
44
|
onFailure?: (error: string) => void;
|
|
38
45
|
onRequireAction?: (payment: Payment) => void;
|
|
@@ -217,6 +217,7 @@ export function usePayment() {
|
|
|
217
217
|
...(threedsSessionId && { threedsSessionId }),
|
|
218
218
|
...(options.initiatedBy && { initiatedBy: options.initiatedBy }),
|
|
219
219
|
...(options.source && { source: options.source }),
|
|
220
|
+
...(options.shippingRateId && { shippingRateId: options.shippingRateId }),
|
|
220
221
|
},
|
|
221
222
|
});
|
|
222
223
|
console.log('Payment response:', response);
|
|
@@ -38,11 +38,11 @@ const InitializationLoader = () => (_jsxs("div", { style: {
|
|
|
38
38
|
borderTop: '1.5px solid #9ca3af',
|
|
39
39
|
borderRadius: '50%',
|
|
40
40
|
animation: 'tagada-spin 1s linear infinite',
|
|
41
|
-
} }), _jsx("span", { children: "Loading..." }), _jsx("style", { children: `
|
|
42
|
-
@keyframes tagada-spin {
|
|
43
|
-
0% { transform: rotate(0deg); }
|
|
44
|
-
100% { transform: rotate(360deg); }
|
|
45
|
-
}
|
|
41
|
+
} }), _jsx("span", { children: "Loading..." }), _jsx("style", { children: `
|
|
42
|
+
@keyframes tagada-spin {
|
|
43
|
+
0% { transform: rotate(0deg); }
|
|
44
|
+
100% { transform: rotate(360deg); }
|
|
45
|
+
}
|
|
46
46
|
` })] }));
|
|
47
47
|
const TagadaContext = createContext(null);
|
|
48
48
|
export function TagadaProvider({ children, environment, customApiConfig, debugMode, // Remove default, will be set based on environment
|