@tagadapay/plugin-sdk 3.1.5 → 3.1.9
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 +220 -113
- package/dist/external-tracker.js +1225 -558
- package/dist/external-tracker.min.js +2 -2
- package/dist/external-tracker.min.js.map +4 -4
- package/dist/react/hooks/useApplePay.js +25 -36
- package/dist/react/hooks/usePaymentPolling.d.ts +9 -3
- package/dist/react/providers/TagadaProvider.js +5 -5
- package/dist/react/utils/money.d.ts +4 -3
- package/dist/react/utils/money.js +39 -6
- package/dist/react/utils/trackingUtils.js +1 -0
- package/dist/tagada-sdk.js +10142 -0
- package/dist/tagada-sdk.min.js +43 -0
- package/dist/tagada-sdk.min.js.map +7 -0
- package/dist/v2/core/client.js +34 -2
- package/dist/v2/core/config/environment.js +9 -2
- package/dist/v2/core/funnelClient.d.ts +180 -2
- package/dist/v2/core/funnelClient.js +289 -6
- package/dist/v2/core/resources/apiClient.js +1 -1
- package/dist/v2/core/resources/checkout.d.ts +68 -0
- package/dist/v2/core/resources/funnel.d.ts +25 -0
- package/dist/v2/core/resources/payments.d.ts +70 -3
- package/dist/v2/core/resources/payments.js +72 -7
- package/dist/v2/core/utils/index.d.ts +1 -0
- package/dist/v2/core/utils/index.js +2 -0
- package/dist/v2/core/utils/pluginConfig.d.ts +8 -0
- package/dist/v2/core/utils/pluginConfig.js +68 -5
- package/dist/v2/core/utils/previewMode.d.ts +7 -0
- package/dist/v2/core/utils/previewMode.js +72 -14
- package/dist/v2/core/utils/previewModeIndicator.d.ts +19 -0
- package/dist/v2/core/utils/previewModeIndicator.js +414 -0
- package/dist/v2/core/utils/tokenStorage.d.ts +4 -0
- package/dist/v2/core/utils/tokenStorage.js +15 -1
- package/dist/v2/index.d.ts +9 -3
- package/dist/v2/index.js +8 -3
- package/dist/v2/react/components/ApplePayButton.d.ts +22 -123
- package/dist/v2/react/components/ApplePayButton.js +247 -317
- package/dist/v2/react/components/FunnelScriptInjector.d.ts +3 -1
- package/dist/v2/react/components/FunnelScriptInjector.js +255 -162
- package/dist/v2/react/components/GooglePayButton.d.ts +2 -0
- package/dist/v2/react/components/GooglePayButton.js +80 -64
- package/dist/v2/react/components/PreviewModeIndicator.d.ts +46 -0
- package/dist/v2/react/components/PreviewModeIndicator.js +113 -0
- package/dist/v2/react/hooks/useApplePayCheckout.d.ts +16 -0
- package/dist/v2/react/hooks/useApplePayCheckout.js +193 -0
- package/dist/v2/react/hooks/useFunnel.d.ts +48 -6
- package/dist/v2/react/hooks/useFunnel.js +25 -5
- package/dist/v2/react/hooks/useGoogleAutocomplete.d.ts +10 -0
- package/dist/v2/react/hooks/useGoogleAutocomplete.js +48 -0
- package/dist/v2/react/hooks/useGooglePayCheckout.d.ts +21 -0
- package/dist/v2/react/hooks/useGooglePayCheckout.js +198 -0
- package/dist/v2/react/hooks/usePaymentPolling.d.ts +15 -3
- package/dist/v2/react/hooks/usePaymentPolling.js +31 -9
- package/dist/v2/react/hooks/usePaymentQuery.d.ts +34 -2
- package/dist/v2/react/hooks/usePaymentQuery.js +731 -7
- package/dist/v2/react/hooks/usePaymentRetrieve.d.ts +26 -0
- package/dist/v2/react/hooks/usePaymentRetrieve.js +175 -0
- package/dist/v2/react/hooks/usePixelTracking.d.ts +56 -0
- package/dist/v2/react/hooks/usePixelTracking.js +508 -0
- package/dist/v2/react/hooks/useStepConfig.d.ts +64 -0
- package/dist/v2/react/hooks/useStepConfig.js +53 -0
- package/dist/v2/react/index.d.ts +15 -5
- package/dist/v2/react/index.js +8 -2
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.d.ts +1 -0
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.js +41 -13
- package/dist/v2/react/providers/TagadaProvider.js +24 -23
- package/dist/v2/standalone/external-tracker.d.ts +2 -0
- package/dist/v2/standalone/external-tracker.js +6 -3
- package/package.json +112 -112
- package/dist/v2/react/hooks/useApplePay.d.ts +0 -16
- package/dist/v2/react/hooks/useApplePay.js +0 -247
package/dist/v2/index.d.ts
CHANGED
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export * from './core/googleAutocomplete';
|
|
9
9
|
export * from './core/isoData';
|
|
10
|
+
export * from './core/utils/configHotReload';
|
|
10
11
|
export * from './core/utils/currency';
|
|
11
12
|
export * from './core/utils/pluginConfig';
|
|
12
|
-
export * from './core/utils/products';
|
|
13
13
|
export * from './core/utils/previewMode';
|
|
14
|
-
export
|
|
14
|
+
export { injectPreviewModeIndicator, isIndicatorInjected, removePreviewModeIndicator } from './core/utils/previewModeIndicator';
|
|
15
|
+
export * from './core/utils/products';
|
|
16
|
+
export { getAssignedPaymentFlowId, getAssignedScripts, getAssignedStaticResources, getAssignedStepConfig, getLocalFunnelConfig, loadLocalFunnelConfig } from './core/funnelClient';
|
|
17
|
+
export type { LocalFunnelConfig, RuntimeStepConfig } from './core/funnelClient';
|
|
15
18
|
export * from './core/pathRemapping';
|
|
16
19
|
export type { CheckoutData, CheckoutInitParams, CheckoutLineItem, CheckoutSession, CheckoutSessionPreview, Promotion } from './core/resources/checkout';
|
|
17
20
|
export type { Order, OrderLineItem } from './core/utils/order';
|
|
@@ -25,17 +28,20 @@ export type { ToggleOrderBumpResponse, VipOffer, VipPreviewResponse } from './co
|
|
|
25
28
|
export type { StoreConfig } from './core/resources/storeConfig';
|
|
26
29
|
export { FunnelActionType } from './core/resources/funnel';
|
|
27
30
|
export type { BackNavigationActionData, CartUpdatedActionData, DirectNavigationActionData, FormSubmitActionData, FunnelContextUpdateRequest, FunnelContextUpdateResponse, FunnelAction as FunnelEvent, FunnelInitializeRequest, FunnelInitializeResponse, FunnelNavigateRequest, FunnelNavigateResponse, FunnelNavigationAction, FunnelNavigationResult, NextAction, OfferAcceptedActionData, OfferDeclinedActionData, PaymentFailedActionData, PaymentSuccessActionData, SimpleFunnelContext } from './core/resources/funnel';
|
|
28
|
-
export { ApplePayButton, ExpressPaymentMethodsProvider, formatMoney, getAvailableLanguages, GooglePayButton, queryKeys, TagadaProvider, useApiMutation, useApiQuery, useAuth, useCheckout, useCheckoutToken, useClubOffers, useCountryOptions, useCredits, useCurrency, useCustomer, useCustomerInfos, useCustomerOrders, useCustomerSubscriptions, useDiscounts, useExpressPaymentMethods, useFunnel, useFunnelLegacy, useGeoLocation, useGoogleAutocomplete, useInvalidateQuery, useISOData, useLanguageImport, useLogin, useOffer, useOrder, useOrderBump, usePayment, usePluginConfig, usePostPurchases, usePreloadQuery, usePreviewOffer, useProducts, usePromotions, useRegionOptions, useRemappableParams, useShippingRates, useSimpleFunnel, useStoreConfig, useTagadaContext, useThreeds, useThreedsModal, useTranslation, useVipOffers } from './react';
|
|
31
|
+
export { ApplePayButton, ExpressPaymentMethodsProvider, formatMoney, getAvailableLanguages, GooglePayButton, PreviewModeIndicator, queryKeys, TagadaProvider, useApiMutation, useApiQuery, useApplePayCheckout, useAuth, useCheckout, useCheckoutToken, useClubOffers, useCountryOptions, useCredits, useCurrency, useCustomer, useCustomerInfos, useCustomerOrders, useCustomerSubscriptions, useDiscounts, useExpressPaymentMethods, useFunnel, useFunnelLegacy, useGeoLocation, useGoogleAutocomplete, useGooglePayCheckout, useInvalidateQuery, useISOData, useLanguageImport, useLogin, useOffer, useOrder, useOrderBump, usePayment, usePaymentRetrieve, usePixelTracking, usePluginConfig, usePostPurchases, usePreloadQuery, usePreviewOffer, useProducts, usePromotions, useRegionOptions, useRemappableParams, useShippingRates, useSimpleFunnel, useStepConfig, useStoreConfig, useTagadaContext, useThreeds, useThreedsModal, useTranslation, useVipOffers } from './react';
|
|
29
32
|
export type { DebugScript } from './react';
|
|
30
33
|
export type { TranslateFunction, TranslationText, UseTranslationOptions, UseTranslationResult } from './react/hooks/useTranslation';
|
|
31
34
|
export type { FunnelContextValue } from './react/hooks/useFunnel';
|
|
35
|
+
export type { UseApplePayCheckoutOptions } from './react/hooks/useApplePayCheckout';
|
|
32
36
|
export type { ClubOffer, ClubOfferItem, ClubOfferLineItem, ClubOfferSummary, UseClubOffersOptions, UseClubOffersResult } from './react/hooks/useClubOffers';
|
|
33
37
|
export type { UseCreditsOptions, UseCreditsResult } from './react/hooks/useCredits';
|
|
38
|
+
export type { UseGooglePayCheckoutOptions } from './react/hooks/useGooglePayCheckout';
|
|
34
39
|
export type { UseLoginOptions, UseLoginResult } from './react/hooks/useLogin';
|
|
35
40
|
export type { CustomerAddress, CustomerInfos, CustomerOrderSummary, OrderWithRelations, Subscription, SubscriptionsResponse } from './core/resources/customer';
|
|
36
41
|
export type { UseCustomerResult } from './react/hooks/useCustomer';
|
|
37
42
|
export type { UseCustomerInfosOptions, UseCustomerInfosResult } from './react/hooks/useCustomerInfos';
|
|
38
43
|
export type { UseCustomerOrdersOptions, UseCustomerOrdersResult } from './react/hooks/useCustomerOrders';
|
|
39
44
|
export type { UseCustomerSubscriptionsOptions, UseCustomerSubscriptionsResult } from './react/hooks/useCustomerSubscriptions';
|
|
45
|
+
export type { PaymentRetrieveHook as UsePaymentRetrieveResult } from './react/hooks/usePaymentRetrieve';
|
|
40
46
|
export type { UseShippingRatesQueryOptions, UseShippingRatesQueryResult } from './react/hooks/useShippingRatesQuery';
|
|
41
47
|
export type { PreviewOfferSummary, UsePreviewOfferOptions, UsePreviewOfferResult } from './react/hooks/usePreviewOffer';
|
package/dist/v2/index.js
CHANGED
|
@@ -8,13 +8,18 @@
|
|
|
8
8
|
// Core exports (selective to avoid conflicts)
|
|
9
9
|
export * from './core/googleAutocomplete';
|
|
10
10
|
export * from './core/isoData';
|
|
11
|
+
export * from './core/utils/configHotReload';
|
|
11
12
|
export * from './core/utils/currency';
|
|
12
13
|
export * from './core/utils/pluginConfig';
|
|
13
|
-
export * from './core/utils/products';
|
|
14
14
|
export * from './core/utils/previewMode';
|
|
15
|
-
export
|
|
15
|
+
export { injectPreviewModeIndicator, isIndicatorInjected, removePreviewModeIndicator } from './core/utils/previewModeIndicator';
|
|
16
|
+
export * from './core/utils/products';
|
|
17
|
+
// Step config utilities (for reading runtime configuration from HTML)
|
|
18
|
+
export { getAssignedPaymentFlowId, getAssignedScripts, getAssignedStaticResources, getAssignedStepConfig, getLocalFunnelConfig,
|
|
19
|
+
// Local development helpers
|
|
20
|
+
loadLocalFunnelConfig } from './core/funnelClient';
|
|
16
21
|
// Path remapping helpers (framework-agnostic)
|
|
17
22
|
export * from './core/pathRemapping';
|
|
18
23
|
export { FunnelActionType } from './core/resources/funnel';
|
|
19
24
|
// React exports (hooks and components only, types are exported above)
|
|
20
|
-
export { ApplePayButton, ExpressPaymentMethodsProvider, formatMoney, getAvailableLanguages, GooglePayButton, queryKeys, TagadaProvider, useApiMutation, useApiQuery, useAuth, useCheckout, useCheckoutToken, useClubOffers, useCountryOptions, useCredits, useCurrency, useCustomer, useCustomerInfos, useCustomerOrders, useCustomerSubscriptions, useDiscounts, useExpressPaymentMethods, useFunnel, useFunnelLegacy, useGeoLocation, useGoogleAutocomplete, useInvalidateQuery, useISOData, useLanguageImport, useLogin, useOffer, useOrder, useOrderBump, usePayment, usePluginConfig, usePostPurchases, usePreloadQuery, usePreviewOffer, useProducts, usePromotions, useRegionOptions, useRemappableParams, useShippingRates, useSimpleFunnel, useStoreConfig, useTagadaContext, useThreeds, useThreedsModal, useTranslation, useVipOffers } from './react';
|
|
25
|
+
export { ApplePayButton, ExpressPaymentMethodsProvider, formatMoney, getAvailableLanguages, GooglePayButton, PreviewModeIndicator, queryKeys, TagadaProvider, useApiMutation, useApiQuery, useApplePayCheckout, useAuth, useCheckout, useCheckoutToken, useClubOffers, useCountryOptions, useCredits, useCurrency, useCustomer, useCustomerInfos, useCustomerOrders, useCustomerSubscriptions, useDiscounts, useExpressPaymentMethods, useFunnel, useFunnelLegacy, useGeoLocation, useGoogleAutocomplete, useGooglePayCheckout, useInvalidateQuery, useISOData, useLanguageImport, useLogin, useOffer, useOrder, useOrderBump, usePayment, usePaymentRetrieve, usePixelTracking, usePluginConfig, usePostPurchases, usePreloadQuery, usePreviewOffer, useProducts, usePromotions, useRegionOptions, useRemappableParams, useShippingRates, useSimpleFunnel, useStepConfig, useStoreConfig, useTagadaContext, useThreeds, useThreedsModal, useTranslation, useVipOffers } from './react';
|
|
@@ -1,141 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Apple Pay Button Component for v2 Architecture
|
|
3
|
-
*
|
|
3
|
+
* Clean rewrite based on working CMS implementation
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { CheckoutData } from '../../core/resources/checkout';
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
ApplePaySession: typeof ApplePaySession;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
7
12
|
declare class ApplePaySession {
|
|
8
|
-
static canMakePayments(): boolean;
|
|
9
|
-
static canMakePaymentsWithActiveCard(merchantId: string): Promise<boolean>;
|
|
10
13
|
static STATUS_SUCCESS: number;
|
|
11
14
|
static STATUS_FAILURE: number;
|
|
12
|
-
static
|
|
13
|
-
|
|
14
|
-
static STATUS_INVALID_SHIPPING_CONTACT: number;
|
|
15
|
-
static STATUS_PIN_REQUIRED: number;
|
|
16
|
-
static STATUS_PIN_INCORRECT: number;
|
|
17
|
-
static STATUS_PIN_LOCKOUT: number;
|
|
18
|
-
constructor(version: number, paymentRequest: ApplePayPaymentRequest);
|
|
15
|
+
static canMakePayments(): boolean;
|
|
16
|
+
constructor(version: number, request: any);
|
|
19
17
|
begin(): void;
|
|
20
18
|
abort(): void;
|
|
21
19
|
completeMerchantValidation(merchantSession: any): void;
|
|
22
|
-
completePayment(
|
|
23
|
-
completeShippingContactSelection(
|
|
24
|
-
completeShippingMethodSelection(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
oncancel: ((event: Event) => void) | null;
|
|
32
|
-
}
|
|
33
|
-
interface ApplePayPaymentRequest {
|
|
34
|
-
countryCode: string;
|
|
35
|
-
currencyCode: string;
|
|
36
|
-
supportedNetworks: string[];
|
|
37
|
-
merchantCapabilities: string[];
|
|
38
|
-
total: ApplePayLineItem;
|
|
39
|
-
lineItems?: ApplePayLineItem[];
|
|
40
|
-
shippingType?: 'shipping' | 'delivery' | 'storePickup' | 'servicePickup';
|
|
41
|
-
shippingMethods?: ApplePayShippingMethod[];
|
|
42
|
-
requiredBillingContactFields?: string[];
|
|
43
|
-
requiredShippingContactFields?: string[];
|
|
44
|
-
applicationData?: string;
|
|
45
|
-
}
|
|
46
|
-
interface ApplePayLineItem {
|
|
47
|
-
label: string;
|
|
48
|
-
amount: string;
|
|
49
|
-
type?: 'final' | 'pending';
|
|
50
|
-
}
|
|
51
|
-
interface ApplePayShippingMethod {
|
|
52
|
-
label: string;
|
|
53
|
-
amount: string;
|
|
54
|
-
detail?: string;
|
|
55
|
-
identifier: string;
|
|
56
|
-
}
|
|
57
|
-
interface ApplePayPaymentToken {
|
|
58
|
-
paymentData: any;
|
|
59
|
-
paymentMethod: {
|
|
60
|
-
displayName: string;
|
|
61
|
-
network: string;
|
|
62
|
-
type: string;
|
|
63
|
-
paymentPass: any;
|
|
64
|
-
billingContact?: ApplePayPaymentContact;
|
|
65
|
-
};
|
|
66
|
-
transactionIdentifier: string;
|
|
67
|
-
}
|
|
68
|
-
interface ApplePayPaymentContact {
|
|
69
|
-
phoneNumber?: string;
|
|
70
|
-
emailAddress?: string;
|
|
71
|
-
givenName?: string;
|
|
72
|
-
familyName?: string;
|
|
73
|
-
phoneticGivenName?: string;
|
|
74
|
-
phoneticFamilyName?: string;
|
|
75
|
-
addressLines?: string[];
|
|
76
|
-
locality?: string;
|
|
77
|
-
administrativeArea?: string;
|
|
78
|
-
postalCode?: string;
|
|
79
|
-
countryCode?: string;
|
|
80
|
-
}
|
|
81
|
-
interface ApplePayValidateMerchantEvent {
|
|
82
|
-
validationURL: string;
|
|
83
|
-
}
|
|
84
|
-
interface ApplePayPaymentAuthorizedEvent {
|
|
85
|
-
payment: {
|
|
86
|
-
token: ApplePayPaymentToken;
|
|
87
|
-
billingContact?: ApplePayPaymentContact;
|
|
88
|
-
shippingContact?: ApplePayPaymentContact;
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
interface ApplePayShippingContactSelectionEvent {
|
|
92
|
-
shippingContact: ApplePayPaymentContact;
|
|
93
|
-
}
|
|
94
|
-
interface ApplePayShippingMethodSelectionEvent {
|
|
95
|
-
shippingMethod: ApplePayShippingMethod;
|
|
96
|
-
}
|
|
97
|
-
interface ApplePayPaymentMethodSelectionEvent {
|
|
98
|
-
paymentMethod: any;
|
|
99
|
-
}
|
|
100
|
-
interface ApplePayPaymentAuthorizationResult {
|
|
101
|
-
status: number;
|
|
102
|
-
errors?: ApplePayError[];
|
|
103
|
-
}
|
|
104
|
-
interface ApplePayShippingContactUpdate {
|
|
105
|
-
errors?: ApplePayError[];
|
|
106
|
-
newShippingMethods?: ApplePayShippingMethod[];
|
|
107
|
-
newTotal?: ApplePayLineItem;
|
|
108
|
-
newLineItems?: ApplePayLineItem[];
|
|
109
|
-
}
|
|
110
|
-
interface ApplePayShippingMethodUpdate {
|
|
111
|
-
newTotal?: ApplePayLineItem;
|
|
112
|
-
newLineItems?: ApplePayLineItem[];
|
|
113
|
-
}
|
|
114
|
-
interface ApplePayPaymentMethodUpdate {
|
|
115
|
-
newTotal?: ApplePayLineItem;
|
|
116
|
-
newLineItems?: ApplePayLineItem[];
|
|
117
|
-
}
|
|
118
|
-
interface ApplePayError {
|
|
119
|
-
code: string;
|
|
120
|
-
message: string;
|
|
121
|
-
contactField?: string;
|
|
122
|
-
}
|
|
123
|
-
declare global {
|
|
124
|
-
interface Window {
|
|
125
|
-
ApplePaySession: typeof ApplePaySession;
|
|
126
|
-
}
|
|
20
|
+
completePayment(status: number): void;
|
|
21
|
+
completeShippingContactSelection(status: number, shippingMethods: any[], total: any, lineItems: any[]): void;
|
|
22
|
+
completeShippingMethodSelection(status: number, total: any, lineItems: any[]): void;
|
|
23
|
+
onvalidatemerchant: ((event: any) => void) | null;
|
|
24
|
+
onpaymentauthorized: ((event: any) => void) | null;
|
|
25
|
+
onshippingcontactselected: ((event: any) => void) | null;
|
|
26
|
+
onshippingmethodselected: ((event: any) => void) | null;
|
|
27
|
+
oncancel: (() => void) | null;
|
|
28
|
+
onerror: ((event: any) => void) | null;
|
|
127
29
|
}
|
|
128
30
|
export interface ApplePayButtonProps {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
31
|
+
checkout: CheckoutData;
|
|
32
|
+
onSuccess?: (result: {
|
|
33
|
+
payment: any;
|
|
34
|
+
order: any;
|
|
35
|
+
}) => void;
|
|
132
36
|
onError?: (error: string) => void;
|
|
133
37
|
onCancel?: () => void;
|
|
134
|
-
storeName?: string;
|
|
135
|
-
currencyCode?: string;
|
|
136
|
-
variant?: 'default' | 'outline' | 'ghost';
|
|
137
|
-
size?: 'sm' | 'md' | 'lg';
|
|
138
|
-
checkout: CheckoutData;
|
|
139
38
|
}
|
|
140
39
|
export declare const ApplePayButton: React.FC<ApplePayButtonProps>;
|
|
141
40
|
export default ApplePayButton;
|