@tagadapay/plugin-sdk 3.1.12 → 3.1.24
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/build-cdn.js +397 -11
- package/dist/data/iso3166.d.ts +23 -33
- package/dist/data/iso3166.js +134 -198
- package/dist/data/languages.d.ts +5 -64
- package/dist/data/languages.js +23 -143
- package/dist/external-tracker.js +623 -3426
- package/dist/external-tracker.min.js +2 -25
- package/dist/external-tracker.min.js.map +4 -4
- package/dist/react/config/payment.d.ts +14 -4
- package/dist/react/config/payment.js +47 -9
- package/dist/react/hooks/useCheckout.d.ts +3 -0
- package/dist/react/hooks/useCheckout.js +4 -1
- package/dist/react/hooks/useISOData.js +1 -1
- package/dist/react/hooks/usePaymentPolling.d.ts +3 -3
- package/dist/react/hooks/usePluginConfig.js +9 -10
- package/dist/react/providers/TagadaProvider.js +1 -1
- package/dist/tagada-react-sdk-minimal.min.js +36 -0
- package/dist/tagada-react-sdk-minimal.min.js.map +7 -0
- package/dist/tagada-react-sdk.js +37821 -0
- package/dist/tagada-react-sdk.min.js +78 -0
- package/dist/tagada-react-sdk.min.js.map +7 -0
- package/dist/tagada-sdk.js +16044 -0
- package/dist/tagada-sdk.min.js +32 -0
- package/dist/tagada-sdk.min.js.map +7 -0
- package/dist/v2/cdn-react-minimal.d.ts +23 -0
- package/dist/v2/cdn-react-minimal.js +26 -0
- package/dist/v2/core/client.d.ts +4 -2
- package/dist/v2/core/client.js +5 -4
- package/dist/v2/core/config/environment.js +2 -1
- package/dist/v2/core/errors.d.ts +75 -0
- package/dist/v2/core/errors.js +104 -0
- package/dist/v2/core/funnelClient.d.ts +100 -10
- package/dist/v2/core/funnelClient.js +121 -27
- package/dist/v2/core/isoData.d.ts +4 -4
- package/dist/v2/core/isoData.js +7 -7
- package/dist/v2/core/pixelMapping.d.ts +49 -0
- package/dist/v2/core/pixelMapping.js +363 -0
- package/dist/v2/core/resources/apiClient.d.ts +2 -0
- package/dist/v2/core/resources/apiClient.js +52 -9
- package/dist/v2/core/resources/checkout.d.ts +99 -30
- package/dist/v2/core/resources/checkout.js +14 -0
- package/dist/v2/core/resources/customer.d.ts +20 -19
- package/dist/v2/core/resources/expressPaymentMethods.d.ts +1 -0
- package/dist/v2/core/resources/funnel.d.ts +17 -17
- package/dist/v2/core/resources/payments.d.ts +89 -13
- package/dist/v2/core/resources/payments.js +27 -9
- package/dist/v2/core/resources/postPurchases.d.ts +17 -0
- package/dist/v2/core/resources/postPurchases.js +20 -0
- package/dist/v2/core/types.d.ts +50 -12
- package/dist/v2/core/types.js +0 -3
- package/dist/v2/core/utils/checkout.d.ts +2 -2
- package/dist/v2/core/utils/checkout.js +7 -2
- package/dist/v2/core/utils/currency.d.ts +14 -0
- package/dist/v2/core/utils/currency.js +40 -0
- package/dist/v2/core/utils/deviceInfo.d.ts +0 -10
- package/dist/v2/core/utils/deviceInfo.js +152 -76
- package/dist/v2/core/utils/index.d.ts +1 -0
- package/dist/v2/core/utils/index.js +2 -0
- package/dist/v2/core/utils/order.d.ts +13 -9
- package/dist/v2/core/utils/pluginConfig.d.ts +8 -0
- package/dist/v2/core/utils/pluginConfig.js +36 -12
- package/dist/v2/index.d.ts +6 -3
- package/dist/v2/index.js +4 -2
- package/dist/v2/react/components/FunnelScriptInjector.js +166 -77
- package/dist/v2/react/components/StripeExpressButton.d.ts +13 -0
- package/dist/v2/react/components/StripeExpressButton.js +171 -0
- package/dist/v2/react/components/WhopCheckout.d.ts +24 -0
- package/dist/v2/react/components/WhopCheckout.js +237 -0
- package/dist/v2/react/hooks/__examples__/FunnelContextExample.js +1 -1
- package/dist/v2/react/hooks/payment-actions/useAirwallexRadarAction.d.ts +14 -0
- package/dist/v2/react/hooks/payment-actions/useAirwallexRadarAction.js +181 -0
- package/dist/v2/react/hooks/payment-actions/useErrorAction.d.ts +9 -0
- package/dist/v2/react/hooks/payment-actions/useErrorAction.js +21 -0
- package/dist/v2/react/hooks/payment-actions/useFinixRadarAction.d.ts +14 -0
- package/dist/v2/react/hooks/payment-actions/useFinixRadarAction.js +187 -0
- package/dist/v2/react/hooks/payment-actions/useKessPayAction.d.ts +11 -0
- package/dist/v2/react/hooks/payment-actions/useKessPayAction.js +91 -0
- package/dist/v2/react/hooks/payment-actions/useMasterCardAction.d.ts +24 -0
- package/dist/v2/react/hooks/payment-actions/useMasterCardAction.js +221 -0
- package/dist/v2/react/hooks/payment-actions/usePaymentActionHandler.d.ts +15 -0
- package/dist/v2/react/hooks/payment-actions/usePaymentActionHandler.js +142 -0
- package/dist/v2/react/hooks/payment-actions/useProcessorAuthAction.d.ts +3 -0
- package/dist/v2/react/hooks/payment-actions/useProcessorAuthAction.js +31 -0
- package/dist/v2/react/hooks/payment-actions/useRedirectAction.d.ts +10 -0
- package/dist/v2/react/hooks/payment-actions/useRedirectAction.js +35 -0
- package/dist/v2/react/hooks/payment-actions/useStripeRadarAction.d.ts +14 -0
- package/dist/v2/react/hooks/payment-actions/useStripeRadarAction.js +192 -0
- package/dist/v2/react/hooks/payment-actions/useThreedsAuthAction.d.ts +14 -0
- package/dist/v2/react/hooks/payment-actions/useThreedsAuthAction.js +81 -0
- package/dist/v2/react/hooks/payment-actions/useTrustFlowAction.d.ts +11 -0
- package/dist/v2/react/hooks/payment-actions/useTrustFlowAction.js +84 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentInstruments.d.ts +14 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentInstruments.js +36 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentProcessors.d.ts +31 -0
- package/dist/v2/react/hooks/payment-processing/usePaymentProcessors.js +212 -0
- package/dist/v2/react/hooks/payment-redirect/useAirwallex3dsReturn.d.ts +14 -0
- package/dist/v2/react/hooks/payment-redirect/useAirwallex3dsReturn.js +207 -0
- package/dist/v2/react/hooks/payment-redirect/useGenericPaymentReturn.d.ts +12 -0
- package/dist/v2/react/hooks/payment-redirect/useGenericPaymentReturn.js +101 -0
- package/dist/v2/react/hooks/useApplePayCheckout.js +8 -8
- package/dist/v2/react/hooks/useCheckoutQuery.d.ts +16 -0
- package/dist/v2/react/hooks/useCheckoutQuery.js +63 -10
- package/dist/v2/react/hooks/useFunnel.d.ts +15 -4
- package/dist/v2/react/hooks/useFunnel.js +8 -4
- package/dist/v2/react/hooks/useGeoLocation.d.ts +2 -1
- package/dist/v2/react/hooks/useGeoLocation.js +4 -2
- package/dist/v2/react/hooks/useGoogleAutocomplete.d.ts +2 -0
- package/dist/v2/react/hooks/useGoogleAutocomplete.js +29 -15
- package/dist/v2/react/hooks/useISOData.d.ts +2 -5
- package/dist/v2/react/hooks/useISOData.js +26 -27
- package/dist/v2/react/hooks/usePaymentPolling.d.ts +3 -3
- package/dist/v2/react/hooks/usePaymentQuery.d.ts +18 -5
- package/dist/v2/react/hooks/usePaymentQuery.js +63 -1015
- package/dist/v2/react/hooks/usePaymentRetrieve.d.ts +3 -2
- package/dist/v2/react/hooks/usePaymentRetrieve.js +3 -1
- package/dist/v2/react/hooks/usePixelTracking.d.ts +5 -48
- package/dist/v2/react/hooks/usePixelTracking.js +283 -504
- package/dist/v2/react/hooks/usePostPurchasesQuery.js +34 -2
- package/dist/v2/react/hooks/useRemappableParams.d.ts +2 -6
- package/dist/v2/react/hooks/useRemappableParams.js +23 -23
- package/dist/v2/react/hooks/useSetPaymentMethod.d.ts +16 -0
- package/dist/v2/react/hooks/useSetPaymentMethod.js +33 -0
- package/dist/v2/react/hooks/useShippingRatesQuery.js +13 -5
- package/dist/v2/react/hooks/useStepConfig.d.ts +23 -6
- package/dist/v2/react/hooks/useStepConfig.js +14 -7
- package/dist/v2/react/hooks/useTranslation.js +23 -8
- package/dist/v2/react/hooks/useWhopPaymentPolling.d.ts +30 -0
- package/dist/v2/react/hooks/useWhopPaymentPolling.js +61 -0
- package/dist/v2/react/index.d.ts +15 -1
- package/dist/v2/react/index.js +7 -0
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.d.ts +3 -1
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.js +12 -2
- package/dist/v2/react/providers/TagadaProvider.js +74 -5
- package/dist/v2/standalone/external-tracker.d.ts +52 -46
- package/dist/v2/standalone/external-tracker.js +205 -98
- package/dist/v2/standalone/index.d.ts +40 -0
- package/dist/v2/standalone/index.js +148 -1
- package/dist/v2/standalone/payment-service.d.ts +134 -0
- package/dist/v2/standalone/payment-service.js +928 -0
- package/package.json +6 -4
- package/dist/react/utils/__tests__/urlUtils.test.d.ts +0 -1
- package/dist/react/utils/__tests__/urlUtils.test.js +0 -189
- package/dist/v2/core/__tests__/pathRemapping.test.d.ts +0 -11
- package/dist/v2/core/__tests__/pathRemapping.test.js +0 -776
|
@@ -17,13 +17,23 @@ export declare const PAYMENT_CONFIGS: Record<string, PaymentConfig>;
|
|
|
17
17
|
*/
|
|
18
18
|
export declare function getPaymentConfig(environment?: string): PaymentConfig;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Determine if the current hostname should use production BasisTheory.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* BT key selection is based ONLY on hostname — never on tagadaClientEnv overrides.
|
|
23
|
+
* tagadaClientEnv controls which API server the SDK talks to, but BasisTheory
|
|
24
|
+
* tokens must always match the backend's BT tenant.
|
|
25
|
+
*
|
|
26
|
+
* Production BT: *.tagadapay.com, custom domains (e.g. checkout.myboost.club)
|
|
27
|
+
* Test BT: *.tagadapay.dev, app-dev.tagadapay.com, localhost, vercel.app, etc.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isProductionBasisTheory(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Get BasisTheory API key based on hostname detection.
|
|
32
|
+
* Not affected by tagadaClientEnv overrides.
|
|
24
33
|
*/
|
|
25
34
|
export declare function getBasisTheoryApiKey(): string;
|
|
26
35
|
/**
|
|
27
|
-
* Get BasisTheory tenant ID based on
|
|
36
|
+
* Get BasisTheory tenant ID based on hostname detection.
|
|
37
|
+
* Not affected by tagadaClientEnv overrides.
|
|
28
38
|
*/
|
|
29
39
|
export declare function getBasisTheoryTenantId(): string;
|
|
@@ -42,24 +42,62 @@ export const PAYMENT_CONFIGS = {
|
|
|
42
42
|
export function getPaymentConfig(environment = 'local') {
|
|
43
43
|
return PAYMENT_CONFIGS[environment] || PAYMENT_CONFIGS.default || PAYMENT_CONFIGS.local;
|
|
44
44
|
}
|
|
45
|
-
import { detectEnvironment } from '../../v2/core/config/environment';
|
|
46
45
|
import { getBasisTheoryKeys } from '../../config/basisTheory';
|
|
47
46
|
/**
|
|
48
|
-
*
|
|
47
|
+
* Determine if the current hostname should use production BasisTheory.
|
|
49
48
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
49
|
+
* BT key selection is based ONLY on hostname — never on tagadaClientEnv overrides.
|
|
50
|
+
* tagadaClientEnv controls which API server the SDK talks to, but BasisTheory
|
|
51
|
+
* tokens must always match the backend's BT tenant.
|
|
52
|
+
*
|
|
53
|
+
* Production BT: *.tagadapay.com, custom domains (e.g. checkout.myboost.club)
|
|
54
|
+
* Test BT: *.tagadapay.dev, app-dev.tagadapay.com, localhost, vercel.app, etc.
|
|
55
|
+
*/
|
|
56
|
+
export function isProductionBasisTheory() {
|
|
57
|
+
if (typeof window === 'undefined')
|
|
58
|
+
return false;
|
|
59
|
+
const hostname = window.location.hostname;
|
|
60
|
+
// Dev backend under tagadapay.com — uses test BT
|
|
61
|
+
if (hostname.includes('app-dev.tagadapay.com') || hostname.includes('cdn-dev.tagadapay.com')) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
// Production and preprod share the same production BT tenant
|
|
65
|
+
if (hostname.includes('tagadapay.com'))
|
|
66
|
+
return true;
|
|
67
|
+
// Dev/staging domains use test BT
|
|
68
|
+
if (hostname.includes('tagadapay.dev'))
|
|
69
|
+
return false;
|
|
70
|
+
// Local development — test BT
|
|
71
|
+
if (hostname === 'localhost' ||
|
|
72
|
+
hostname.startsWith('127.') ||
|
|
73
|
+
hostname.startsWith('192.168.') ||
|
|
74
|
+
hostname.startsWith('10.') ||
|
|
75
|
+
hostname.includes('.local') ||
|
|
76
|
+
hostname === '' ||
|
|
77
|
+
hostname === '0.0.0.0' ||
|
|
78
|
+
hostname.includes('ngrok') ||
|
|
79
|
+
hostname.includes('.loclx.io') ||
|
|
80
|
+
hostname.includes('vercel.app') ||
|
|
81
|
+
hostname.includes('netlify.app')) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
// Custom checkout domains (e.g. checkout.myboost.club) use production BT
|
|
85
|
+
// to match the production backend's BT tenant
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get BasisTheory API key based on hostname detection.
|
|
90
|
+
* Not affected by tagadaClientEnv overrides.
|
|
52
91
|
*/
|
|
53
92
|
export function getBasisTheoryApiKey() {
|
|
54
|
-
const
|
|
55
|
-
const keys = getBasisTheoryKeys(isProduction);
|
|
93
|
+
const keys = getBasisTheoryKeys(isProductionBasisTheory());
|
|
56
94
|
return keys.apiKey;
|
|
57
95
|
}
|
|
58
96
|
/**
|
|
59
|
-
* Get BasisTheory tenant ID based on
|
|
97
|
+
* Get BasisTheory tenant ID based on hostname detection.
|
|
98
|
+
* Not affected by tagadaClientEnv overrides.
|
|
60
99
|
*/
|
|
61
100
|
export function getBasisTheoryTenantId() {
|
|
62
|
-
const
|
|
63
|
-
const keys = getBasisTheoryKeys(isProduction);
|
|
101
|
+
const keys = getBasisTheoryKeys(isProductionBasisTheory());
|
|
64
102
|
return keys.tenantId;
|
|
65
103
|
}
|
|
@@ -19,6 +19,7 @@ export interface CheckoutInitParams {
|
|
|
19
19
|
currency?: string;
|
|
20
20
|
locale?: string;
|
|
21
21
|
};
|
|
22
|
+
enabledOrderBumpOfferIds?: string[];
|
|
22
23
|
}
|
|
23
24
|
export interface CheckoutSession {
|
|
24
25
|
id: string;
|
|
@@ -173,6 +174,7 @@ export interface CheckoutSessionPreviewItem {
|
|
|
173
174
|
totalBillingCycles?: number;
|
|
174
175
|
unitAmountAfterFirstCycle?: number;
|
|
175
176
|
subscriptionSettings?: any;
|
|
177
|
+
properties?: Record<string, unknown>;
|
|
176
178
|
orderLineItemProduct: {
|
|
177
179
|
name: string | null;
|
|
178
180
|
} | null;
|
|
@@ -215,6 +217,7 @@ export interface CheckoutSummaryItem {
|
|
|
215
217
|
intervalCount?: number;
|
|
216
218
|
totalBillingCycles?: number;
|
|
217
219
|
unitAmountAfterFirstCycle?: number;
|
|
220
|
+
properties?: Record<string, unknown>;
|
|
218
221
|
orderLineItemProduct: {
|
|
219
222
|
name: string;
|
|
220
223
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { getAssignedOrderBumpOfferIds } from '../../v2/core/funnelClient';
|
|
2
3
|
import { useCurrency } from '../hooks/useCurrency';
|
|
3
4
|
import { useTagadaContext } from '../providers/TagadaProvider';
|
|
4
5
|
import { collectTrackingData } from '../utils/trackingUtils';
|
|
@@ -86,15 +87,17 @@ export function useCheckout(options = {}) {
|
|
|
86
87
|
localStorage: trackingData.localStorageData,
|
|
87
88
|
cookies: trackingData.trackingCookiesData,
|
|
88
89
|
};
|
|
90
|
+
const enabledOrderBumpOfferIds = params.enabledOrderBumpOfferIds ?? getAssignedOrderBumpOfferIds();
|
|
89
91
|
const requestBody = {
|
|
90
92
|
...params,
|
|
91
|
-
storeId: params.storeId || storeId,
|
|
93
|
+
storeId: params.storeId || storeId,
|
|
92
94
|
returnUrl: params.returnUrl || window.location.origin,
|
|
93
95
|
customer: {
|
|
94
96
|
...params.customer,
|
|
95
97
|
currency: params.customer?.currency || currentCurrency,
|
|
96
98
|
},
|
|
97
99
|
customerMetadata: enhancedCustomerMetadata,
|
|
100
|
+
...(enabledOrderBumpOfferIds && { enabledOrderBumpOfferIds }),
|
|
98
101
|
};
|
|
99
102
|
const response = await apiService.fetch('/api/v1/checkout/session/init', {
|
|
100
103
|
method: 'POST',
|
|
@@ -105,7 +105,7 @@ export function useISOData(language = 'en', autoImport = true, disputeSetting =
|
|
|
105
105
|
*/
|
|
106
106
|
export function getAvailableLanguages() {
|
|
107
107
|
// Return all available languages (not just registered ones)
|
|
108
|
-
return ['en', 'ru', 'de', 'fr', 'es', 'zh', 'hi', 'pt', 'ja', 'ar', 'it', 'he'];
|
|
108
|
+
return ['en', 'ru', 'de', 'da', 'fr', 'es', 'zh', 'hi', 'pt', 'ja', 'ar', 'it', 'he'];
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
* Hook to manually import and register a language
|
|
@@ -2,14 +2,14 @@ export interface Payment {
|
|
|
2
2
|
id: string;
|
|
3
3
|
status: string;
|
|
4
4
|
subStatus: string;
|
|
5
|
-
requireAction: 'none' | 'redirect' | 'error' | 'radar';
|
|
5
|
+
requireAction: 'none' | 'redirect' | 'redirect_to_payment' | 'error' | 'radar';
|
|
6
6
|
requireActionData?: {
|
|
7
|
-
type: 'redirect' | 'threeds_auth' | 'processor_auth' | 'error' | 'stripe_radar' | 'finix_radar';
|
|
7
|
+
type: 'redirect' | 'redirect_to_payment' | 'threeds_auth' | 'processor_auth' | 'error' | 'stripe_radar' | 'finix_radar';
|
|
8
8
|
url?: string;
|
|
9
9
|
processed: boolean;
|
|
10
10
|
processorId?: string;
|
|
11
11
|
metadata?: {
|
|
12
|
-
type: 'redirect' | 'stripe_radar' | 'finix_radar';
|
|
12
|
+
type: 'redirect' | 'redirect_to_payment' | 'stripe_radar' | 'finix_radar';
|
|
13
13
|
redirect?: {
|
|
14
14
|
redirectUrl: string;
|
|
15
15
|
returnUrl: string;
|
|
@@ -110,18 +110,17 @@ const loadProductionConfig = async () => {
|
|
|
110
110
|
const storeId = document.querySelector('meta[name="x-plugin-store-id"]')?.getAttribute('content') || undefined;
|
|
111
111
|
const accountId = document.querySelector('meta[name="x-plugin-account-id"]')?.getAttribute('content') || undefined;
|
|
112
112
|
const basePath = document.querySelector('meta[name="x-plugin-base-path"]')?.getAttribute('content') || '/';
|
|
113
|
-
// Get deployment config from meta tags
|
|
114
113
|
let config = {};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const encodedConfig = configMeta?.getAttribute('content');
|
|
118
|
-
if (encodedConfig) {
|
|
119
|
-
const decodedConfig = decodeURIComponent(encodedConfig);
|
|
120
|
-
config = JSON.parse(decodedConfig);
|
|
121
|
-
}
|
|
114
|
+
if (typeof window !== 'undefined' && window.__TAGADA_PLUGIN_CONFIG__) {
|
|
115
|
+
config = window.__TAGADA_PLUGIN_CONFIG__;
|
|
122
116
|
}
|
|
123
|
-
|
|
124
|
-
|
|
117
|
+
else {
|
|
118
|
+
try {
|
|
119
|
+
const encoded = document.querySelector('meta[name="x-plugin-config"]')?.getAttribute('content');
|
|
120
|
+
if (encoded)
|
|
121
|
+
config = JSON.parse(decodeURIComponent(encoded));
|
|
122
|
+
}
|
|
123
|
+
catch { /* fallback for old deployments */ }
|
|
125
124
|
}
|
|
126
125
|
console.log('🚀 Plugin config loaded from meta tags (no HEAD request needed):', {
|
|
127
126
|
storeId,
|
|
@@ -221,7 +221,7 @@ rawPluginConfig, }) {
|
|
|
221
221
|
}
|
|
222
222
|
setIsLoading(true);
|
|
223
223
|
try {
|
|
224
|
-
const deviceInfo = collectDeviceInfo();
|
|
224
|
+
const deviceInfo = await collectDeviceInfo();
|
|
225
225
|
const urlParams = getUrlParams();
|
|
226
226
|
const browserLocale = getBrowserLocale();
|
|
227
227
|
const sessionInitData = {
|