@tagadapay/plugin-sdk 3.1.11 → 3.1.22
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 +231 -228
- 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 +968 -102
- package/dist/external-tracker.min.js +2 -2
- package/dist/external-tracker.min.js.map +4 -4
- package/dist/react/hooks/useISOData.js +1 -1
- package/dist/react/hooks/usePaymentPolling.d.ts +3 -3
- package/dist/react/hooks/useShippingRates.d.ts +6 -0
- package/dist/react/hooks/useShippingRates.js +38 -0
- package/dist/react/providers/TagadaProvider.js +5 -5
- package/dist/react/services/apiService.d.ts +21 -0
- package/dist/react/services/apiService.js +10 -0
- package/dist/tagada-sdk.js +2079 -179
- package/dist/tagada-sdk.min.js +4 -2
- package/dist/tagada-sdk.min.js.map +4 -4
- package/dist/v2/core/client.d.ts +4 -2
- package/dist/v2/core/client.js +4 -3
- package/dist/v2/core/errors.d.ts +75 -0
- package/dist/v2/core/errors.js +104 -0
- package/dist/v2/core/funnelClient.d.ts +16 -15
- package/dist/v2/core/funnelClient.js +1 -1
- package/dist/v2/core/index.d.ts +1 -0
- package/dist/v2/core/index.js +2 -0
- package/dist/v2/core/pixelMapping.d.ts +49 -0
- package/dist/v2/core/pixelMapping.js +325 -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 +89 -30
- package/dist/v2/core/resources/checkout.js +8 -0
- package/dist/v2/core/resources/customer.d.ts +20 -19
- package/dist/v2/core/resources/funnel.d.ts +17 -17
- package/dist/v2/core/resources/payments.d.ts +84 -13
- package/dist/v2/core/resources/payments.js +26 -9
- package/dist/v2/core/resources/shippingRates.d.ts +15 -0
- package/dist/v2/core/resources/shippingRates.js +11 -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/order.d.ts +11 -9
- package/dist/v2/core/utils/previewModeIndicator.js +101 -101
- package/dist/v2/index.d.ts +4 -2
- package/dist/v2/index.js +1 -1
- package/dist/v2/react/components/ApplePayButton.js +13 -4
- package/dist/v2/react/components/FunnelScriptInjector.js +51 -30
- package/dist/v2/react/components/WhopCheckout.d.ts +24 -0
- package/dist/v2/react/components/WhopCheckout.js +231 -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 +13 -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/useCheckoutQuery.d.ts +6 -0
- package/dist/v2/react/hooks/useCheckoutQuery.js +45 -0
- package/dist/v2/react/hooks/useFunnel.d.ts +1 -2
- 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.js +82 -33
- package/dist/v2/react/hooks/useISOData.js +1 -1
- 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 -43
- package/dist/v2/react/hooks/usePixelTracking.js +213 -407
- package/dist/v2/react/hooks/useShippingRatesQuery.d.ts +6 -0
- package/dist/v2/react/hooks/useShippingRatesQuery.js +47 -4
- package/dist/v2/react/hooks/useStepConfig.d.ts +2 -8
- package/dist/v2/react/hooks/useStepConfig.js +1 -1
- 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 +7 -0
- package/dist/v2/react/index.js +4 -0
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.d.ts +2 -1
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.js +3 -1
- package/dist/v2/react/providers/TagadaProvider.js +76 -7
- 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 +22 -0
- package/dist/v2/standalone/index.js +125 -0
- package/package.json +112 -112
- 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
|
@@ -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;
|
|
@@ -27,5 +27,11 @@ export interface UseShippingRatesResult {
|
|
|
27
27
|
error: Error | null;
|
|
28
28
|
clearError: () => void;
|
|
29
29
|
refetch: () => Promise<void>;
|
|
30
|
+
/** Preview shipping rates for a country without updating session */
|
|
31
|
+
previewRates: (countryCode: string, stateCode?: string) => Promise<ShippingRate[]>;
|
|
32
|
+
/** Rates from the last previewRates call */
|
|
33
|
+
previewedRates: ShippingRate[] | undefined;
|
|
34
|
+
/** Loading state for previewRates */
|
|
35
|
+
isPreviewLoading: boolean;
|
|
30
36
|
}
|
|
31
37
|
export declare const useShippingRates: ({ onSuccess, checkout }?: UseShippingRatesOptions) => UseShippingRatesResult;
|
|
@@ -39,6 +39,9 @@ export const useShippingRates = ({ onSuccess, checkout } = {}) => {
|
|
|
39
39
|
const previousSessionIdRef = useRef(undefined);
|
|
40
40
|
const isFetchingRef = useRef(false);
|
|
41
41
|
const hasSyncedSelectionFromCheckoutRef = useRef(false);
|
|
42
|
+
// Preview rates state
|
|
43
|
+
const [previewedRates, setPreviewedRates] = useState();
|
|
44
|
+
const [isPreviewLoading, setIsPreviewLoading] = useState(false);
|
|
42
45
|
const sessionId = checkout?.checkoutSession.id;
|
|
43
46
|
// Track mounted state
|
|
44
47
|
useEffect(() => {
|
|
@@ -87,6 +90,38 @@ export const useShippingRates = ({ onSuccess, checkout } = {}) => {
|
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
}, [sessionId, apiService]);
|
|
93
|
+
// Preview shipping rates for a country without updating session
|
|
94
|
+
const previewRates = useCallback(async (countryCode, stateCode) => {
|
|
95
|
+
if (!sessionId || !apiService)
|
|
96
|
+
return [];
|
|
97
|
+
try {
|
|
98
|
+
setIsPreviewLoading(true);
|
|
99
|
+
const queryParams = new URLSearchParams({ countryCode });
|
|
100
|
+
if (stateCode)
|
|
101
|
+
queryParams.set('stateCode', stateCode);
|
|
102
|
+
const response = await apiService.fetch(`/api/v1/checkout-sessions/${sessionId}/shipping-rates/preview?${queryParams}`, { method: 'GET' });
|
|
103
|
+
const sortedRates = response.rates.slice().sort((a, b) => {
|
|
104
|
+
if (a.isFree && !b.isFree)
|
|
105
|
+
return -1;
|
|
106
|
+
if (!a.isFree && b.isFree)
|
|
107
|
+
return 1;
|
|
108
|
+
return (a.amount ?? 0) - (b.amount ?? 0);
|
|
109
|
+
});
|
|
110
|
+
if (isMountedRef.current) {
|
|
111
|
+
setPreviewedRates(sortedRates);
|
|
112
|
+
}
|
|
113
|
+
return sortedRates;
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
console.error('Error previewing shipping rates:', err);
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
if (isMountedRef.current) {
|
|
121
|
+
setIsPreviewLoading(false);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}, [sessionId, apiService]);
|
|
90
125
|
useEffect(() => {
|
|
91
126
|
if (sessionId && isMountedRef.current && sessionId !== previousSessionIdRef.current) {
|
|
92
127
|
previousSessionIdRef.current = sessionId;
|
|
@@ -196,5 +231,8 @@ export const useShippingRates = ({ onSuccess, checkout } = {}) => {
|
|
|
196
231
|
error,
|
|
197
232
|
clearError,
|
|
198
233
|
refetch,
|
|
234
|
+
previewRates,
|
|
235
|
+
previewedRates,
|
|
236
|
+
isPreviewLoading,
|
|
199
237
|
};
|
|
200
238
|
};
|
|
@@ -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
|
|
@@ -146,6 +146,27 @@ export declare class ApiService {
|
|
|
146
146
|
shippingCountryChanged: boolean;
|
|
147
147
|
billingCountryChanged: boolean;
|
|
148
148
|
}>;
|
|
149
|
+
/**
|
|
150
|
+
* Update shipping address only (no email required)
|
|
151
|
+
* Useful for fetching shipping rates before email is entered
|
|
152
|
+
*/
|
|
153
|
+
updateShippingAddressOnly(checkoutSessionId: string, shippingAddress: {
|
|
154
|
+
firstName?: string;
|
|
155
|
+
lastName?: string;
|
|
156
|
+
address1?: string;
|
|
157
|
+
city?: string;
|
|
158
|
+
country: string;
|
|
159
|
+
state?: string;
|
|
160
|
+
postal?: string;
|
|
161
|
+
phone?: string;
|
|
162
|
+
}): Promise<{
|
|
163
|
+
success: boolean;
|
|
164
|
+
countryChanged: boolean;
|
|
165
|
+
errors?: Record<string, {
|
|
166
|
+
message: string;
|
|
167
|
+
type: string;
|
|
168
|
+
}>;
|
|
169
|
+
}>;
|
|
149
170
|
/**
|
|
150
171
|
* Clear the authentication token
|
|
151
172
|
*/
|
|
@@ -166,6 +166,16 @@ export class ApiService {
|
|
|
166
166
|
body: data,
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Update shipping address only (no email required)
|
|
171
|
+
* Useful for fetching shipping rates before email is entered
|
|
172
|
+
*/
|
|
173
|
+
async updateShippingAddressOnly(checkoutSessionId, shippingAddress) {
|
|
174
|
+
return this.fetch(`/api/v1/checkout-sessions/${checkoutSessionId}/shipping-address`, {
|
|
175
|
+
method: 'POST',
|
|
176
|
+
body: { shippingAddress },
|
|
177
|
+
});
|
|
178
|
+
}
|
|
169
179
|
/**
|
|
170
180
|
* Clear the authentication token
|
|
171
181
|
*/
|