@tagadapay/plugin-sdk 3.1.25 → 4.0.2
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/dist/external-tracker.js +160 -6
- 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/usePayment.d.ts +7 -0
- package/dist/react/hooks/usePayment.js +1 -0
- 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 +2220 -1428
- package/dist/tagada-react-sdk.min.js +2 -2
- package/dist/tagada-react-sdk.min.js.map +4 -4
- package/dist/tagada-sdk.js +3784 -128
- package/dist/tagada-sdk.min.js +2 -2
- package/dist/tagada-sdk.min.js.map +4 -4
- 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 +42 -0
- package/dist/v2/core/funnelClient.js +30 -0
- package/dist/v2/core/pixelTracker.d.ts +51 -0
- package/dist/v2/core/pixelTracker.js +425 -0
- package/dist/v2/core/resources/checkout.d.ts +45 -1
- package/dist/v2/core/resources/checkout.js +13 -3
- 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/offers.d.ts +1 -1
- package/dist/v2/core/resources/offers.js +3 -1
- package/dist/v2/core/resources/payments.d.ts +19 -1
- package/dist/v2/core/resources/payments.js +8 -0
- package/dist/v2/core/resources/promotionEvents.d.ts +5 -0
- package/dist/v2/core/resources/promotionEvents.js +2 -0
- package/dist/v2/core/resources/promotions.d.ts +6 -1
- package/dist/v2/core/resources/promotions.js +6 -1
- package/dist/v2/core/resources/shippingRates.d.ts +18 -0
- package/dist/v2/core/resources/shippingRates.js +18 -0
- package/dist/v2/core/utils/clickIdResolver.d.ts +79 -0
- package/dist/v2/core/utils/clickIdResolver.js +169 -0
- package/dist/v2/core/utils/index.d.ts +2 -0
- package/dist/v2/core/utils/index.js +4 -0
- package/dist/v2/core/utils/metaEventId.d.ts +14 -0
- package/dist/v2/core/utils/metaEventId.js +16 -0
- package/dist/v2/index.d.ts +7 -0
- package/dist/v2/index.js +10 -0
- package/dist/v2/react/components/ApplePayButton.js +50 -0
- package/dist/v2/react/components/FunnelScriptInjector.js +158 -10
- package/dist/v2/react/components/GooglePayButton.js +39 -1
- package/dist/v2/react/components/StripeExpressButton.d.ts +8 -0
- package/dist/v2/react/components/StripeExpressButton.js +76 -3
- 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/useCheckoutQuery.js +41 -29
- package/dist/v2/react/hooks/useDiscountsQuery.js +4 -0
- package/dist/v2/react/hooks/useFunnel.d.ts +7 -0
- package/dist/v2/react/hooks/useFunnel.js +2 -1
- package/dist/v2/react/hooks/useISOData.js +25 -7
- package/dist/v2/react/hooks/usePaymentPolling.d.ts +1 -1
- package/dist/v2/react/hooks/usePixelTracking.d.ts +10 -5
- package/dist/v2/react/hooks/usePixelTracking.js +32 -374
- package/dist/v2/react/hooks/usePreviewOffer.d.ts +3 -1
- package/dist/v2/react/hooks/usePreviewOffer.js +8 -2
- package/dist/v2/react/hooks/usePromotionsQuery.js +9 -3
- package/dist/v2/react/hooks/useShippingRatesQuery.js +36 -21
- package/dist/v2/react/hooks/useStepConfig.d.ts +9 -0
- package/dist/v2/react/hooks/useStepConfig.js +5 -1
- package/dist/v2/react/index.d.ts +4 -0
- package/dist/v2/react/index.js +8 -0
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.js +12 -4
- package/dist/v2/react/providers/TagadaProvider.js +13 -0
- 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 +11 -1
- package/dist/v2/standalone/index.js +30 -0
- package/dist/v2/standalone/payment-service.d.ts +72 -6
- package/dist/v2/standalone/payment-service.js +285 -65
- package/package.json +2 -1
package/dist/v2/react/index.d.ts
CHANGED
|
@@ -99,6 +99,10 @@ export type { UseStoreConfigQueryOptions as UseStoreConfigOptions, UseStoreConfi
|
|
|
99
99
|
export type { PaymentInstrument, ThreedsChallenge, ThreedsHook, ThreedsOptions, ThreedsProvider, ThreedsSession } from './hooks/useThreeds';
|
|
100
100
|
export type { UseVipOffersQueryOptions as UseVipOffersOptions, UseVipOffersQueryResult as UseVipOffersResult } from './hooks/useVipOffersQuery';
|
|
101
101
|
export { formatMoney } from '../../react/utils/money';
|
|
102
|
+
export { makeMetaEventId } from '../core/utils/metaEventId';
|
|
103
|
+
export type { TrackOptions } from './hooks/usePixelTracking';
|
|
104
|
+
export { resolveClickId, publishTrackingGlobal, CLICK_ID_URL_PARAMS, CLICK_ID_COOKIES, } from '../core/utils/clickIdResolver';
|
|
105
|
+
export type { ResolvedClickId, TagadaTrackingGlobal, ClickIdSource, } from '../core/utils/clickIdResolver';
|
|
102
106
|
export { TagadaError, TagadaApiError, TagadaNetworkError, TagadaAuthError, TagadaValidationError, TagadaCircuitBreakerError, TagadaErrorCode, } from '../core/errors';
|
|
103
107
|
export type { TagadaErrorOptions, TagadaErrorCodeValue } from '../core/errors';
|
|
104
108
|
export type { PaymentMethodName } from '../core/resources/checkout';
|
package/dist/v2/react/index.js
CHANGED
|
@@ -63,5 +63,13 @@ export { FunnelActionType } from '../core/resources/funnel';
|
|
|
63
63
|
export { getEnabledMethods, getExpressMethods, getExpressMethodsByProcessor, findMethod, isMethodEnabled } from '../core/funnelClient';
|
|
64
64
|
// Re-export utilities from main react
|
|
65
65
|
export { formatMoney } from '../../react/utils/money';
|
|
66
|
+
// Meta CAPI / browser pixel deduplication helper.
|
|
67
|
+
// Use this to build a stable `eventId` shared between the browser pixel
|
|
68
|
+
// (`track('Purchase', params, { eventId })`) and the server-side Meta CAPI
|
|
69
|
+
// `ServerEvent.setEventId(...)`. Both sides must agree on the formula.
|
|
70
|
+
export { makeMetaEventId } from '../core/utils/metaEventId';
|
|
71
|
+
// Click-id resolver (ad-tracker integrations: ClickFlare, Voluum, Binom, RedTrack, ClickMagick, …)
|
|
72
|
+
// Lives in core (runtime-agnostic) so the standalone SDK / studio builder can use it too.
|
|
73
|
+
export { resolveClickId, publishTrackingGlobal, CLICK_ID_URL_PARAMS, CLICK_ID_COOKIES, } from '../core/utils/clickIdResolver';
|
|
66
74
|
// Error types
|
|
67
75
|
export { TagadaError, TagadaApiError, TagadaNetworkError, TagadaAuthError, TagadaValidationError, TagadaCircuitBreakerError, TagadaErrorCode, } from '../core/errors';
|
|
@@ -42,10 +42,15 @@ function paymentMethodsFromSetupConfig(config) {
|
|
|
42
42
|
continue;
|
|
43
43
|
}
|
|
44
44
|
// Individual express methods (apple_pay, google_pay, etc.)
|
|
45
|
-
|
|
45
|
+
// Match by: explicit express flag, type, method, provider, or key name
|
|
46
|
+
const resolvedMethod = entry.method || entry.provider || key;
|
|
47
|
+
const isExpressMethod = entry.express
|
|
48
|
+
|| entry.type === 'apple_pay' || entry.type === 'google_pay'
|
|
49
|
+
|| resolvedMethod === 'apple_pay' || resolvedMethod === 'google_pay';
|
|
50
|
+
if (isExpressMethod) {
|
|
46
51
|
methods.push({
|
|
47
52
|
id: key,
|
|
48
|
-
type: entry.type || entry.
|
|
53
|
+
type: entry.type === 'apple_pay' || entry.type === 'google_pay' ? entry.type : resolvedMethod,
|
|
49
54
|
title: entry.label || key,
|
|
50
55
|
iconUrl: entry.logoUrl || '',
|
|
51
56
|
default: false,
|
|
@@ -60,8 +65,11 @@ export const ExpressPaymentMethodsProvider = ({ children, customerId, checkout,
|
|
|
60
65
|
const [availableExpressPaymentMethodIds, setAvailableExpressPaymentMethodIds] = useState([]);
|
|
61
66
|
const [error, setError] = useState(null);
|
|
62
67
|
const checkoutSessionId = checkout?.checkoutSession?.id;
|
|
63
|
-
// If paymentSetupConfig is provided
|
|
64
|
-
|
|
68
|
+
// If paymentSetupConfig is provided AND contains at least one enabled method, derive from it.
|
|
69
|
+
// Missing, empty `{}`, or all-disabled configs fall through to the API fallback.
|
|
70
|
+
const configDerivedMethods = useMemo(() => (paymentSetupConfig && Object.values(paymentSetupConfig).some((v) => v?.enabled === true))
|
|
71
|
+
? paymentMethodsFromSetupConfig(paymentSetupConfig)
|
|
72
|
+
: undefined, [paymentSetupConfig]);
|
|
65
73
|
// Create express payment methods resource client
|
|
66
74
|
const expressPaymentResource = useMemo(() => {
|
|
67
75
|
try {
|
|
@@ -10,6 +10,19 @@ import { convertCurrency, formatMoney, formatMoneyWithoutSymbol, formatSimpleMon
|
|
|
10
10
|
import { TagadaClient } from '../../core/client';
|
|
11
11
|
import { setGlobalApiClient } from '../hooks/useApiQuery';
|
|
12
12
|
import { PixelTrackingProvider } from '../hooks/usePixelTracking';
|
|
13
|
+
import { publishTrackingGlobal } from '../../core/utils/clickIdResolver';
|
|
14
|
+
// Publish window.TagadaPay.tracking eagerly at module-load time so merchant
|
|
15
|
+
// postback scripts injected by <FunnelScriptInjector /> (which run from child
|
|
16
|
+
// useEffects, BEFORE the parent provider's useEffects) can read it. Idempotent
|
|
17
|
+
// — safe if standalone SDK already published.
|
|
18
|
+
if (typeof window !== 'undefined') {
|
|
19
|
+
try {
|
|
20
|
+
publishTrackingGlobal();
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.error('[TagadaProvider] Failed to publish tracking global:', error);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
13
26
|
const FunnelScriptInjector = lazy(() => import('../components/FunnelScriptInjector').then(m => ({ default: m.FunnelScriptInjector })));
|
|
14
27
|
const DebugDrawer = lazy(() => import('../components/DebugDrawer'));
|
|
15
28
|
// Professional, subtle loading component for initialization
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apple Pay Service (Standalone) — re-export shim.
|
|
3
|
+
*
|
|
4
|
+
* The canonical implementation lives in `@tagadapay/core-js` so partner
|
|
5
|
+
* code, the studio, the native checkout, and the plugin-sdk all share a
|
|
6
|
+
* single source of truth for the native Apple Pay primitive (BasisTheory
|
|
7
|
+
* tokenization, no checkout session). This file preserves the historical
|
|
8
|
+
* import path `@tagadapay/plugin-sdk/v2/standalone` so existing consumers
|
|
9
|
+
* (studio-app, vanilla-checkout templates, …) keep working without
|
|
10
|
+
* code changes.
|
|
11
|
+
*/
|
|
12
|
+
export { isApplePayAvailable, startApplePaySession, type ApplePayServiceConfig, type ApplePayPaymentRequest, type ApplePayTokenResult, type ApplePayShippingContact, type ApplePayCallbacks, type ApplePayInlineError, } from '@tagadapay/core-js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apple Pay Service (Standalone) — re-export shim.
|
|
3
|
+
*
|
|
4
|
+
* The canonical implementation lives in `@tagadapay/core-js` so partner
|
|
5
|
+
* code, the studio, the native checkout, and the plugin-sdk all share a
|
|
6
|
+
* single source of truth for the native Apple Pay primitive (BasisTheory
|
|
7
|
+
* tokenization, no checkout session). This file preserves the historical
|
|
8
|
+
* import path `@tagadapay/plugin-sdk/v2/standalone` so existing consumers
|
|
9
|
+
* (studio-app, vanilla-checkout templates, …) keep working without
|
|
10
|
+
* code changes.
|
|
11
|
+
*/
|
|
12
|
+
export { isApplePayAvailable, startApplePaySession, } from '@tagadapay/core-js';
|
|
@@ -36,7 +36,7 @@ export interface TagadaTrackerConfig {
|
|
|
36
36
|
stepName?: string;
|
|
37
37
|
/** Step type (optional — e.g., 'landing', 'offer', 'external') */
|
|
38
38
|
stepType?: string;
|
|
39
|
-
/** API base URL (defaults to https://
|
|
39
|
+
/** API base URL (defaults to https://api.tagada.io) */
|
|
40
40
|
apiBaseUrl?: string;
|
|
41
41
|
/** Enable debug logging */
|
|
42
42
|
debug?: boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Pay Service (Standalone) — re-export shim.
|
|
3
|
+
*
|
|
4
|
+
* The canonical implementation lives in `@tagadapay/core-js`. This file
|
|
5
|
+
* preserves the historical import path `@tagadapay/plugin-sdk/v2/standalone`
|
|
6
|
+
* for downstream consumers (studio-app, vanilla-checkout templates,
|
|
7
|
+
* payment-error-dashboard) — they keep working unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export { isGooglePayAvailable, startGooglePaySession, type GooglePayServiceConfig, type GooglePayPaymentRequest, type GooglePayTokenResult, type GooglePayAddress, type GooglePayCallbacks, } from '@tagadapay/core-js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google Pay Service (Standalone) — re-export shim.
|
|
3
|
+
*
|
|
4
|
+
* The canonical implementation lives in `@tagadapay/core-js`. This file
|
|
5
|
+
* preserves the historical import path `@tagadapay/plugin-sdk/v2/standalone`
|
|
6
|
+
* for downstream consumers (studio-app, vanilla-checkout templates,
|
|
7
|
+
* payment-error-dashboard) — they keep working unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export { isGooglePayAvailable, startGooglePaySession, } from '@tagadapay/core-js';
|
|
@@ -25,12 +25,15 @@ export { TagadaClient, ApiClient, CheckoutResource };
|
|
|
25
25
|
export { ShippingRatesResource } from '../core/resources/shippingRates';
|
|
26
26
|
export { PaymentsResource } from '../core/resources/payments';
|
|
27
27
|
export { OrdersResource } from '../core/resources/orders';
|
|
28
|
+
export { OffersResource } from '../core/resources/offers';
|
|
28
29
|
export { ExpressPaymentMethodsResource } from '../core/resources/expressPaymentMethods';
|
|
29
30
|
export type { PaymentMethod as ExpressPaymentMethod } from '../core/resources/expressPaymentMethods';
|
|
30
31
|
export type { ShippingRate, ShippingRatesResponse, ShippingRatesPreviewParams } from '../core/resources/shippingRates';
|
|
31
|
-
export type { Payment, PaymentResponse, CardPaymentMethod, BasisTheoryInstance, GooglePayToken, ApplePayToken, PaymentInstrumentInput, PaymentInstrumentResponse, PaymentInstrumentCustomerResponse, } from '../core/resources/payments';
|
|
32
|
+
export type { Payment, PaymentResponse, PaymentOptions, CardPaymentMethod, BasisTheoryInstance, GooglePayToken, ApplePayToken, PaymentInstrumentInput, PaymentInstrumentResponse, PaymentInstrumentCustomerResponse, } from '../core/resources/payments';
|
|
32
33
|
export { StoreConfigResource } from '../core/resources/storeConfig';
|
|
33
34
|
export type { StoreConfig } from '../core/resources/storeConfig';
|
|
35
|
+
export { GeoResource } from '../core/resources/geo';
|
|
36
|
+
export type { GeoLocationData } from '../core/resources/geo';
|
|
34
37
|
export { ThreedsResource } from '../core/resources/threeds';
|
|
35
38
|
export { ISODataCore } from '../core/isoData';
|
|
36
39
|
export type { ISOCountry, ISORegion } from '../core/isoData';
|
|
@@ -50,6 +53,11 @@ export { getAssignedStepConfig } from '../core/funnelClient';
|
|
|
50
53
|
export type { RuntimeStepConfig } from '../core/funnelClient';
|
|
51
54
|
export { PaymentService } from './payment-service';
|
|
52
55
|
export type { PaymentServiceConfig, PaymentResult, PaymentCallbacks, CardData, ApmData, } from './payment-service';
|
|
56
|
+
export { isApplePayAvailable, startApplePaySession } from './apple-pay-service';
|
|
57
|
+
export type { ApplePayServiceConfig, ApplePayPaymentRequest, ApplePayTokenResult, ApplePayShippingContact, ApplePayCallbacks, } from './apple-pay-service';
|
|
58
|
+
export { isGooglePayAvailable, startGooglePaySession } from './google-pay-service';
|
|
59
|
+
export type { GooglePayServiceConfig, GooglePayPaymentRequest, GooglePayTokenResult, GooglePayAddress, GooglePayCallbacks, } from './google-pay-service';
|
|
60
|
+
export { formatMoney, getCurrencyInfo, moneyStringOrNumberToMinorUnits, minorUnitsToMajorUnits, } from '../../react/utils/money';
|
|
53
61
|
/**
|
|
54
62
|
* Get BasisTheory public API key based on hostname detection.
|
|
55
63
|
* Delegates to the centralized isProductionBasisTheory() logic.
|
|
@@ -61,3 +69,5 @@ export declare function getBasisTheoryApiKey(): string;
|
|
|
61
69
|
export declare function getBasisTheoryTenantId(): string;
|
|
62
70
|
export { TagadaTracker, TagadaExternalTracker, } from './external-tracker';
|
|
63
71
|
export type { TagadaTrackerConfig, ExternalTrackerSession, NavigateOptions, } from './external-tracker';
|
|
72
|
+
export { resolveClickId, publishTrackingGlobal, CLICK_ID_URL_PARAMS, CLICK_ID_COOKIES, } from '../core/utils/clickIdResolver';
|
|
73
|
+
export type { ResolvedClickId, TagadaTrackingGlobal, ClickIdSource, } from '../core/utils/clickIdResolver';
|
|
@@ -11,6 +11,7 @@ import { ApiClient } from '../core/resources/apiClient';
|
|
|
11
11
|
import { CheckoutResource } from '../core/resources/checkout';
|
|
12
12
|
import { getAssignedStepConfig, getAssignedPaymentFlowId } from '../core/funnelClient';
|
|
13
13
|
import { getBasisTheoryApiKey as _getBtApiKey, getBasisTheoryTenantId as _getBtTenantId } from '../../react/config/payment';
|
|
14
|
+
import { publishTrackingGlobal } from '../core/utils/clickIdResolver';
|
|
14
15
|
/**
|
|
15
16
|
* Parse step config from window variable or meta tag
|
|
16
17
|
*/
|
|
@@ -103,6 +104,16 @@ export function injectStepConfigScripts() {
|
|
|
103
104
|
// Auto-run script injection when SDK loads
|
|
104
105
|
// Uses requestIdleCallback or setTimeout fallback for non-blocking execution
|
|
105
106
|
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
107
|
+
// Publish click_id (URL > cookie) to window.TagadaPay.tracking IMMEDIATELY
|
|
108
|
+
// — synchronously, before any merchant stepConfig.scripts run. This is what
|
|
109
|
+
// ad-tracker postback snippets read, so it must exist before they execute.
|
|
110
|
+
// No DOM dependencies, safe to call right now.
|
|
111
|
+
try {
|
|
112
|
+
publishTrackingGlobal();
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
console.error('[TagadaPay] Failed to publish tracking global:', error);
|
|
116
|
+
}
|
|
106
117
|
const runInjection = () => {
|
|
107
118
|
// Wait for body to be available
|
|
108
119
|
if (document.body) {
|
|
@@ -134,9 +145,12 @@ export { TagadaClient, ApiClient, CheckoutResource };
|
|
|
134
145
|
export { ShippingRatesResource } from '../core/resources/shippingRates';
|
|
135
146
|
export { PaymentsResource } from '../core/resources/payments';
|
|
136
147
|
export { OrdersResource } from '../core/resources/orders';
|
|
148
|
+
export { OffersResource } from '../core/resources/offers';
|
|
137
149
|
export { ExpressPaymentMethodsResource } from '../core/resources/expressPaymentMethods';
|
|
138
150
|
// Re-export Store Config (for standalone resolvers / builders)
|
|
139
151
|
export { StoreConfigResource } from '../core/resources/storeConfig';
|
|
152
|
+
// Re-export Geo Resource (for standalone geolocation / country detection)
|
|
153
|
+
export { GeoResource } from '../core/resources/geo';
|
|
140
154
|
// Re-export 3DS Resource (for standalone resolvers / builders)
|
|
141
155
|
export { ThreedsResource } from '../core/resources/threeds';
|
|
142
156
|
// Re-export ISO Data Core (for standalone address form / resolvers)
|
|
@@ -155,6 +169,15 @@ export { getAssignedPaymentFlowId };
|
|
|
155
169
|
export { getAssignedStepConfig } from '../core/funnelClient';
|
|
156
170
|
// Re-export Payment Service (standalone payment processing — no React)
|
|
157
171
|
export { PaymentService } from './payment-service';
|
|
172
|
+
// Re-export Apple Pay Service (standalone native Apple Pay — no React)
|
|
173
|
+
export { isApplePayAvailable, startApplePaySession } from './apple-pay-service';
|
|
174
|
+
// Re-export Google Pay Service (standalone native Google Pay — no React)
|
|
175
|
+
export { isGooglePayAvailable, startGooglePaySession } from './google-pay-service';
|
|
176
|
+
// Re-export currency helpers (no React dep) so standalone consumers (studio, vanilla
|
|
177
|
+
// checkouts, …) can do backend-minor → major → wallet-minor conversions without bringing
|
|
178
|
+
// in the React entry-point. NEVER hardcode `* 100` in callers — use these helpers, which
|
|
179
|
+
// read the per-currency ISO decimal count.
|
|
180
|
+
export { formatMoney, getCurrencyInfo, moneyStringOrNumberToMinorUnits, minorUnitsToMajorUnits, } from '../../react/utils/money';
|
|
158
181
|
/**
|
|
159
182
|
* Get BasisTheory public API key based on hostname detection.
|
|
160
183
|
* Delegates to the centralized isProductionBasisTheory() logic.
|
|
@@ -174,3 +197,10 @@ export function getBasisTheoryTenantId() {
|
|
|
174
197
|
// Lightweight tracker for external pages not hosted on Tagadapay
|
|
175
198
|
// NOTE: This is also available as a standalone CDN bundle (external-tracker.min.js)
|
|
176
199
|
export { TagadaTracker, TagadaExternalTracker, } from './external-tracker';
|
|
200
|
+
// ============================================================================
|
|
201
|
+
// AD-TRACKER CLICK-ID RESOLVER
|
|
202
|
+
// ============================================================================
|
|
203
|
+
// Pure utility for resolving ClickFlare / Voluum / Binom / RedTrack / etc.
|
|
204
|
+
// click ids from URL params or cookies. Auto-published to
|
|
205
|
+
// `window.TagadaPay.tracking` on SDK load (see eager block above).
|
|
206
|
+
export { resolveClickId, publishTrackingGlobal, CLICK_ID_URL_PARAMS, CLICK_ID_COOKIES, } from '../core/utils/clickIdResolver';
|
|
@@ -51,12 +51,39 @@ export interface PaymentCallbacks {
|
|
|
51
51
|
onSuccess?: (payment: Payment) => void;
|
|
52
52
|
onFailure?: (error: string) => void;
|
|
53
53
|
onRedirectReturn?: (paymentId: string) => void;
|
|
54
|
+
/** Called before a browser redirect, allows caller to await async work (e.g. funnel navigate) */
|
|
55
|
+
onBeforeRedirect?: (payment: Payment, redirectUrl: string) => Promise<void>;
|
|
54
56
|
}
|
|
55
57
|
export interface PollingCallbacks {
|
|
56
58
|
onSuccess: (payment: Payment) => void;
|
|
57
59
|
onFailure: (error: string) => void;
|
|
58
60
|
onRequireAction?: (payment: Payment) => void;
|
|
59
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Outcome of running a requireAction handler. Lets processAndHandle (and
|
|
64
|
+
* polling) decide whether to surface success/redirecting vs failure to the
|
|
65
|
+
* caller, instead of blanket-returning success:true for every action type.
|
|
66
|
+
*/
|
|
67
|
+
type ActionOutcome =
|
|
68
|
+
/** Browser navigated or will navigate (3DS/APM/redirect form). Caller bails. */
|
|
69
|
+
{
|
|
70
|
+
kind: 'redirected';
|
|
71
|
+
}
|
|
72
|
+
/** Action completed in-page with payment in a terminal success state. */
|
|
73
|
+
| {
|
|
74
|
+
kind: 'completed';
|
|
75
|
+
payment: Payment;
|
|
76
|
+
}
|
|
77
|
+
/** Action completed in-page with a definitive failure. */
|
|
78
|
+
| {
|
|
79
|
+
kind: 'failed';
|
|
80
|
+
error: string;
|
|
81
|
+
payment?: Payment;
|
|
82
|
+
}
|
|
83
|
+
/** Action handed off to polling; outcome will arrive via PollingCallbacks. */
|
|
84
|
+
| {
|
|
85
|
+
kind: 'pending';
|
|
86
|
+
};
|
|
60
87
|
export declare class PaymentService {
|
|
61
88
|
private paymentsResource;
|
|
62
89
|
private threedsResource;
|
|
@@ -92,15 +119,23 @@ export declare class PaymentService {
|
|
|
92
119
|
* Shared by processCardPayment, processApplePayPayment, etc.
|
|
93
120
|
*/
|
|
94
121
|
private processAndHandle;
|
|
122
|
+
/**
|
|
123
|
+
* Translate an ActionOutcome into a PaymentResult, or null when the outcome
|
|
124
|
+
* is 'pending' (caller should keep polling instead of resolving).
|
|
125
|
+
*/
|
|
126
|
+
private settleActionOutcome;
|
|
95
127
|
/**
|
|
96
128
|
* After radar / completePaymentAfterAction, handle the resumed payment.
|
|
129
|
+
* Fires callbacks for side effects AND returns an outcome so the caller
|
|
130
|
+
* (handlePaymentAction) can propagate failure into PaymentResult.
|
|
97
131
|
*/
|
|
98
132
|
private handleResumedPayment;
|
|
99
|
-
handlePaymentAction(payment: Payment): Promise<
|
|
133
|
+
handlePaymentAction(payment: Payment): Promise<ActionOutcome>;
|
|
100
134
|
private handleKessPayAuth;
|
|
101
135
|
private handleTrustFlowAuth;
|
|
102
136
|
private handleFinixRadar;
|
|
103
137
|
private handleStripeRadar;
|
|
138
|
+
private handleNgeniusThreeds;
|
|
104
139
|
private handleAirwallexRadar;
|
|
105
140
|
private handleMasterCardAuth;
|
|
106
141
|
private loadScript;
|
|
@@ -126,9 +161,40 @@ export declare class PaymentService {
|
|
|
126
161
|
id: string;
|
|
127
162
|
sessionId: string;
|
|
128
163
|
}>;
|
|
129
|
-
processCardPayment(checkoutSessionId: string, cardData: CardData
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
164
|
+
processCardPayment(checkoutSessionId: string, cardData: CardData, options?: {
|
|
165
|
+
shippingRateId?: string;
|
|
166
|
+
}): Promise<PaymentResult>;
|
|
167
|
+
processApplePayPayment(checkoutSessionId: string, applePayToken: ApplePayToken, options?: {
|
|
168
|
+
shippingRateId?: string;
|
|
169
|
+
}): Promise<PaymentResult>;
|
|
170
|
+
processGooglePayPayment(checkoutSessionId: string, googlePayToken: GooglePayToken, options?: {
|
|
171
|
+
shippingRateId?: string;
|
|
172
|
+
}): Promise<PaymentResult>;
|
|
173
|
+
processPaymentWithInstrument(checkoutSessionId: string, paymentInstrumentId: string, options?: {
|
|
174
|
+
shippingRateId?: string;
|
|
175
|
+
}): Promise<PaymentResult>;
|
|
176
|
+
processApmPayment(checkoutSessionId: string, apmData: ApmData, options?: {
|
|
177
|
+
shippingRateId?: string;
|
|
178
|
+
}): Promise<PaymentResult>;
|
|
179
|
+
/**
|
|
180
|
+
* Stripe Express Checkout Element payment.
|
|
181
|
+
*
|
|
182
|
+
* Mirrors the inline flow from `react/components/StripeExpressButton.onConfirm`:
|
|
183
|
+
* 1. processPaymentDirect with isExpress=true → returns clientSecret
|
|
184
|
+
* 2. stripe.confirmPayment(elements, clientSecret) — must run while wallet sheet is open
|
|
185
|
+
* 3. Poll until webhook marks payment succeeded
|
|
186
|
+
*
|
|
187
|
+
* Used for ECE methods Stripe surfaces in one element: apple_pay, google_pay, link, klarna.
|
|
188
|
+
* The `stripe` and `elements` refs come from Stripe React hooks at the call site.
|
|
189
|
+
*/
|
|
190
|
+
processStripeExpressPayment(checkoutSessionId: string, paymentMethod: string, processorId: string, stripe: {
|
|
191
|
+
confirmPayment: (opts: Record<string, unknown>) => Promise<{
|
|
192
|
+
error?: {
|
|
193
|
+
message?: string;
|
|
194
|
+
};
|
|
195
|
+
}>;
|
|
196
|
+
}, elements: unknown, options?: {
|
|
197
|
+
shippingRateId?: string;
|
|
198
|
+
}): Promise<PaymentResult>;
|
|
134
199
|
}
|
|
200
|
+
export {};
|