@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.
Files changed (116) hide show
  1. package/README.md +1129 -1129
  2. package/build-cdn.js +231 -228
  3. package/dist/data/iso3166.d.ts +23 -33
  4. package/dist/data/iso3166.js +134 -198
  5. package/dist/data/languages.d.ts +5 -64
  6. package/dist/data/languages.js +23 -143
  7. package/dist/external-tracker.js +968 -102
  8. package/dist/external-tracker.min.js +2 -2
  9. package/dist/external-tracker.min.js.map +4 -4
  10. package/dist/react/hooks/useISOData.js +1 -1
  11. package/dist/react/hooks/usePaymentPolling.d.ts +3 -3
  12. package/dist/react/hooks/useShippingRates.d.ts +6 -0
  13. package/dist/react/hooks/useShippingRates.js +38 -0
  14. package/dist/react/providers/TagadaProvider.js +5 -5
  15. package/dist/react/services/apiService.d.ts +21 -0
  16. package/dist/react/services/apiService.js +10 -0
  17. package/dist/tagada-sdk.js +2079 -179
  18. package/dist/tagada-sdk.min.js +4 -2
  19. package/dist/tagada-sdk.min.js.map +4 -4
  20. package/dist/v2/core/client.d.ts +4 -2
  21. package/dist/v2/core/client.js +4 -3
  22. package/dist/v2/core/errors.d.ts +75 -0
  23. package/dist/v2/core/errors.js +104 -0
  24. package/dist/v2/core/funnelClient.d.ts +16 -15
  25. package/dist/v2/core/funnelClient.js +1 -1
  26. package/dist/v2/core/index.d.ts +1 -0
  27. package/dist/v2/core/index.js +2 -0
  28. package/dist/v2/core/pixelMapping.d.ts +49 -0
  29. package/dist/v2/core/pixelMapping.js +325 -0
  30. package/dist/v2/core/resources/apiClient.d.ts +2 -0
  31. package/dist/v2/core/resources/apiClient.js +52 -9
  32. package/dist/v2/core/resources/checkout.d.ts +89 -30
  33. package/dist/v2/core/resources/checkout.js +8 -0
  34. package/dist/v2/core/resources/customer.d.ts +20 -19
  35. package/dist/v2/core/resources/funnel.d.ts +17 -17
  36. package/dist/v2/core/resources/payments.d.ts +84 -13
  37. package/dist/v2/core/resources/payments.js +26 -9
  38. package/dist/v2/core/resources/shippingRates.d.ts +15 -0
  39. package/dist/v2/core/resources/shippingRates.js +11 -0
  40. package/dist/v2/core/types.d.ts +50 -12
  41. package/dist/v2/core/types.js +0 -3
  42. package/dist/v2/core/utils/checkout.d.ts +2 -2
  43. package/dist/v2/core/utils/checkout.js +7 -2
  44. package/dist/v2/core/utils/order.d.ts +11 -9
  45. package/dist/v2/core/utils/previewModeIndicator.js +101 -101
  46. package/dist/v2/index.d.ts +4 -2
  47. package/dist/v2/index.js +1 -1
  48. package/dist/v2/react/components/ApplePayButton.js +13 -4
  49. package/dist/v2/react/components/FunnelScriptInjector.js +51 -30
  50. package/dist/v2/react/components/WhopCheckout.d.ts +24 -0
  51. package/dist/v2/react/components/WhopCheckout.js +231 -0
  52. package/dist/v2/react/hooks/__examples__/FunnelContextExample.js +1 -1
  53. package/dist/v2/react/hooks/payment-actions/useAirwallexRadarAction.d.ts +14 -0
  54. package/dist/v2/react/hooks/payment-actions/useAirwallexRadarAction.js +181 -0
  55. package/dist/v2/react/hooks/payment-actions/useErrorAction.d.ts +9 -0
  56. package/dist/v2/react/hooks/payment-actions/useErrorAction.js +21 -0
  57. package/dist/v2/react/hooks/payment-actions/useFinixRadarAction.d.ts +14 -0
  58. package/dist/v2/react/hooks/payment-actions/useFinixRadarAction.js +187 -0
  59. package/dist/v2/react/hooks/payment-actions/useKessPayAction.d.ts +11 -0
  60. package/dist/v2/react/hooks/payment-actions/useKessPayAction.js +91 -0
  61. package/dist/v2/react/hooks/payment-actions/useMasterCardAction.d.ts +24 -0
  62. package/dist/v2/react/hooks/payment-actions/useMasterCardAction.js +221 -0
  63. package/dist/v2/react/hooks/payment-actions/usePaymentActionHandler.d.ts +15 -0
  64. package/dist/v2/react/hooks/payment-actions/usePaymentActionHandler.js +142 -0
  65. package/dist/v2/react/hooks/payment-actions/useProcessorAuthAction.d.ts +3 -0
  66. package/dist/v2/react/hooks/payment-actions/useProcessorAuthAction.js +13 -0
  67. package/dist/v2/react/hooks/payment-actions/useRedirectAction.d.ts +10 -0
  68. package/dist/v2/react/hooks/payment-actions/useRedirectAction.js +35 -0
  69. package/dist/v2/react/hooks/payment-actions/useStripeRadarAction.d.ts +14 -0
  70. package/dist/v2/react/hooks/payment-actions/useStripeRadarAction.js +192 -0
  71. package/dist/v2/react/hooks/payment-actions/useThreedsAuthAction.d.ts +14 -0
  72. package/dist/v2/react/hooks/payment-actions/useThreedsAuthAction.js +81 -0
  73. package/dist/v2/react/hooks/payment-actions/useTrustFlowAction.d.ts +11 -0
  74. package/dist/v2/react/hooks/payment-actions/useTrustFlowAction.js +84 -0
  75. package/dist/v2/react/hooks/payment-processing/usePaymentInstruments.d.ts +14 -0
  76. package/dist/v2/react/hooks/payment-processing/usePaymentInstruments.js +36 -0
  77. package/dist/v2/react/hooks/payment-processing/usePaymentProcessors.d.ts +31 -0
  78. package/dist/v2/react/hooks/payment-processing/usePaymentProcessors.js +212 -0
  79. package/dist/v2/react/hooks/payment-redirect/useAirwallex3dsReturn.d.ts +14 -0
  80. package/dist/v2/react/hooks/payment-redirect/useAirwallex3dsReturn.js +207 -0
  81. package/dist/v2/react/hooks/payment-redirect/useGenericPaymentReturn.d.ts +12 -0
  82. package/dist/v2/react/hooks/payment-redirect/useGenericPaymentReturn.js +101 -0
  83. package/dist/v2/react/hooks/useCheckoutQuery.d.ts +6 -0
  84. package/dist/v2/react/hooks/useCheckoutQuery.js +45 -0
  85. package/dist/v2/react/hooks/useFunnel.d.ts +1 -2
  86. package/dist/v2/react/hooks/useGeoLocation.d.ts +2 -1
  87. package/dist/v2/react/hooks/useGeoLocation.js +4 -2
  88. package/dist/v2/react/hooks/useGoogleAutocomplete.js +82 -33
  89. package/dist/v2/react/hooks/useISOData.js +1 -1
  90. package/dist/v2/react/hooks/usePaymentPolling.d.ts +3 -3
  91. package/dist/v2/react/hooks/usePaymentQuery.d.ts +18 -5
  92. package/dist/v2/react/hooks/usePaymentQuery.js +63 -1015
  93. package/dist/v2/react/hooks/usePaymentRetrieve.d.ts +3 -2
  94. package/dist/v2/react/hooks/usePaymentRetrieve.js +3 -1
  95. package/dist/v2/react/hooks/usePixelTracking.d.ts +5 -43
  96. package/dist/v2/react/hooks/usePixelTracking.js +213 -407
  97. package/dist/v2/react/hooks/useShippingRatesQuery.d.ts +6 -0
  98. package/dist/v2/react/hooks/useShippingRatesQuery.js +47 -4
  99. package/dist/v2/react/hooks/useStepConfig.d.ts +2 -8
  100. package/dist/v2/react/hooks/useStepConfig.js +1 -1
  101. package/dist/v2/react/hooks/useWhopPaymentPolling.d.ts +30 -0
  102. package/dist/v2/react/hooks/useWhopPaymentPolling.js +61 -0
  103. package/dist/v2/react/index.d.ts +7 -0
  104. package/dist/v2/react/index.js +4 -0
  105. package/dist/v2/react/providers/ExpressPaymentMethodsProvider.d.ts +2 -1
  106. package/dist/v2/react/providers/ExpressPaymentMethodsProvider.js +3 -1
  107. package/dist/v2/react/providers/TagadaProvider.js +76 -7
  108. package/dist/v2/standalone/external-tracker.d.ts +52 -46
  109. package/dist/v2/standalone/external-tracker.js +205 -98
  110. package/dist/v2/standalone/index.d.ts +22 -0
  111. package/dist/v2/standalone/index.js +125 -0
  112. package/package.json +112 -112
  113. package/dist/react/utils/__tests__/urlUtils.test.d.ts +0 -1
  114. package/dist/react/utils/__tests__/urlUtils.test.js +0 -189
  115. package/dist/v2/core/__tests__/pathRemapping.test.d.ts +0 -11
  116. package/dist/v2/core/__tests__/pathRemapping.test.js +0 -776
@@ -3,6 +3,7 @@
3
3
  * Handles payment status retrieval after external redirects
4
4
  * This is useful for processors that require server-side status checks (e.g., some 3DS flows)
5
5
  */
6
+ import { TagadaError } from '../../core/errors';
6
7
  export interface RetrieveResult {
7
8
  retrieveResult?: {
8
9
  status?: string;
@@ -15,12 +16,12 @@ export interface RetrieveResult {
15
16
  transactionId?: string;
16
17
  message?: string;
17
18
  success?: boolean;
18
- error?: any;
19
+ error?: string;
19
20
  }
20
21
  export interface PaymentRetrieveHook {
21
22
  startRetrievePolling: (paymentId: string) => Promise<void>;
22
23
  isLoading: boolean;
23
- error: string | null;
24
+ error: TagadaError | null;
24
25
  isPolling: boolean;
25
26
  }
26
27
  export declare function usePaymentRetrieve(): PaymentRetrieveHook;
@@ -7,6 +7,7 @@ import { useState, useCallback, useRef, useEffect, useMemo } from 'react';
7
7
  import { PaymentsResource } from '../../core/resources/payments';
8
8
  import { usePaymentPolling } from './usePaymentPolling';
9
9
  import { getGlobalApiClient } from './useApiQuery';
10
+ import { TagadaError, TagadaErrorCode } from '../../core/errors';
10
11
  export function usePaymentRetrieve() {
11
12
  const [isLoading, setIsLoading] = useState(false);
12
13
  const [error, setError] = useState(null);
@@ -166,10 +167,11 @@ export function usePaymentRetrieve() {
166
167
  void startRetrievePolling(paymentIdFromUrl);
167
168
  }
168
169
  }, [startRetrievePolling]);
170
+ const tagadaError = useMemo(() => error ? new TagadaError(error, { code: TagadaErrorCode.PAYMENT_FAILED }) : null, [error]);
169
171
  return {
170
172
  startRetrievePolling,
171
173
  isLoading,
172
- error,
174
+ error: tagadaError,
173
175
  isPolling: isPollingRef.current,
174
176
  };
175
177
  }
@@ -2,55 +2,17 @@
2
2
  * usePixelTracking Hook & Provider
3
3
  *
4
4
  * SDK-level pixel tracking based on runtime stepConfig.pixels injected
5
- * by the CRM. This mirrors the CMS pixel context pattern but uses the
6
- * funnel step configuration as the source of truth instead of store
7
- * integrations.
5
+ * by the CRM. Uses core/pixelMapping for event mapping and gating,
6
+ * keeping browser-specific init/fire logic here.
8
7
  */
9
8
  import React from 'react';
10
- export type StandardPixelEvent = 'PageView' | 'ViewContent' | 'AddToCart' | 'InitiateCheckout' | 'AddPaymentInfo' | 'Purchase' | 'Lead' | 'CompleteRegistration' | 'Conversion';
9
+ import { type StandardPixelEvent } from '../../core/pixelMapping';
10
+ export type { StandardPixelEvent } from '../../core/pixelMapping';
11
11
  export interface PixelTrackingContextValue {
12
- track: (eventName: StandardPixelEvent, parameters?: Record<string, any>) => void;
12
+ track: (eventName: StandardPixelEvent, parameters?: Record<string, unknown>) => void;
13
13
  pixelsInitialized: boolean;
14
14
  }
15
- /**
16
- * Provider that initializes pixels based on stepConfig.pixels
17
- * and exposes a simple track(event, params) API.
18
- */
19
15
  export declare function PixelTrackingProvider({ children }: {
20
16
  children: React.ReactNode;
21
17
  }): import("react/jsx-runtime").JSX.Element;
22
- /**
23
- * Hook to access SDK pixel tracking.
24
- * Must be used within TagadaProvider (which wraps PixelTrackingProvider).
25
- */
26
18
  export declare function usePixelTracking(): PixelTrackingContextValue;
27
- declare global {
28
- interface FacebookPixelFunction {
29
- (...args: unknown[]): void;
30
- callMethod?: (...args: unknown[]) => void;
31
- queue?: unknown[];
32
- loaded?: boolean;
33
- version?: string;
34
- }
35
- interface TikTokPixelFunction {
36
- (...args: unknown[]): void;
37
- methods?: string[];
38
- setAndDefer?: (target: TikTokPixelFunction, method: string) => void;
39
- load?: (pixelId: string) => void;
40
- page?: () => void;
41
- track?: (eventName: string, params: Record<string, unknown>) => void;
42
- queue?: unknown[];
43
- }
44
- interface SnapchatPixelFunction {
45
- (...args: unknown[]): void;
46
- handleRequest?: (...args: unknown[]) => void;
47
- queue?: unknown[];
48
- }
49
- interface Window {
50
- fbq?: FacebookPixelFunction;
51
- _fbq?: FacebookPixelFunction;
52
- ttq?: TikTokPixelFunction;
53
- snaptr?: SnapchatPixelFunction;
54
- dataLayer?: any[];
55
- }
56
- }