@tagadapay/plugin-sdk 2.8.10 → 3.0.1
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 +14 -14
- package/dist/index.js +1 -1
- package/dist/react/hooks/usePluginConfig.d.ts +1 -0
- package/dist/react/hooks/usePluginConfig.js +69 -18
- package/dist/react/providers/TagadaProvider.js +1 -4
- package/dist/v2/core/client.d.ts +18 -0
- package/dist/v2/core/client.js +45 -0
- package/dist/v2/core/config/environment.d.ts +8 -0
- package/dist/v2/core/config/environment.js +18 -0
- package/dist/v2/core/funnelClient.d.ts +84 -0
- package/dist/v2/core/funnelClient.js +252 -0
- package/dist/v2/core/index.d.ts +2 -0
- package/dist/v2/core/index.js +3 -0
- package/dist/v2/core/resources/apiClient.js +1 -1
- package/dist/v2/core/resources/funnel.d.ts +1 -0
- package/dist/v2/core/resources/offers.d.ts +182 -8
- package/dist/v2/core/resources/offers.js +25 -0
- package/dist/v2/core/resources/products.d.ts +5 -0
- package/dist/v2/core/resources/products.js +15 -1
- package/dist/v2/core/types.d.ts +1 -0
- package/dist/v2/core/utils/funnelQueryKeys.d.ts +23 -0
- package/dist/v2/core/utils/funnelQueryKeys.js +23 -0
- package/dist/v2/core/utils/index.d.ts +2 -0
- package/dist/v2/core/utils/index.js +2 -0
- package/dist/v2/core/utils/pluginConfig.js +44 -32
- package/dist/v2/core/utils/sessionStorage.d.ts +20 -0
- package/dist/v2/core/utils/sessionStorage.js +39 -0
- package/dist/v2/index.d.ts +3 -2
- package/dist/v2/index.js +1 -1
- package/dist/v2/react/hooks/__examples__/FunnelContextExample.d.ts +3 -0
- package/dist/v2/react/hooks/__examples__/FunnelContextExample.js +4 -3
- package/dist/v2/react/hooks/useClubOffers.d.ts +2 -2
- package/dist/v2/react/hooks/useFunnel.d.ts +27 -39
- package/dist/v2/react/hooks/useFunnel.js +22 -659
- package/dist/v2/react/hooks/useFunnelLegacy.d.ts +52 -0
- package/dist/v2/react/hooks/useFunnelLegacy.js +733 -0
- package/dist/v2/react/hooks/useOfferQuery.d.ts +109 -0
- package/dist/v2/react/hooks/useOfferQuery.js +483 -0
- package/dist/v2/react/hooks/useOffersQuery.d.ts +9 -75
- package/dist/v2/react/hooks/useProductsQuery.d.ts +1 -0
- package/dist/v2/react/hooks/useProductsQuery.js +10 -6
- package/dist/v2/react/index.d.ts +7 -4
- package/dist/v2/react/index.js +4 -2
- package/dist/v2/react/providers/TagadaProvider.d.ts +40 -2
- package/dist/v2/react/providers/TagadaProvider.js +116 -3
- package/dist/v2/standalone/index.d.ts +20 -0
- package/dist/v2/standalone/index.js +22 -0
- package/dist/v2/vue/index.d.ts +6 -0
- package/dist/v2/vue/index.js +10 -0
- package/package.json +6 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useFunnel Hook (v2) - TanStack Query-based funnel navigation
|
|
3
|
+
*
|
|
4
|
+
* Modern implementation using TanStack Query for state management
|
|
5
|
+
* and the v2 ApiClient for API calls.
|
|
6
|
+
*/
|
|
7
|
+
import { FunnelAction, FunnelNavigationResult, SimpleFunnelContext } from '../../core/resources/funnel';
|
|
8
|
+
export interface UseFunnelOptions {
|
|
9
|
+
funnelId?: string;
|
|
10
|
+
currentStepId?: string;
|
|
11
|
+
onNavigate?: (result: FunnelNavigationResult) => void | boolean;
|
|
12
|
+
onError?: (error: Error) => void;
|
|
13
|
+
autoInitialize?: boolean;
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface UseFunnelResult {
|
|
17
|
+
next: (event: FunnelAction) => Promise<any>;
|
|
18
|
+
goToStep: (stepId: string) => Promise<any>;
|
|
19
|
+
updateContext: (updates: Partial<SimpleFunnelContext>) => Promise<void>;
|
|
20
|
+
currentStep: {
|
|
21
|
+
id: string;
|
|
22
|
+
};
|
|
23
|
+
context: SimpleFunnelContext | null;
|
|
24
|
+
isLoading: boolean;
|
|
25
|
+
isInitialized: boolean;
|
|
26
|
+
isNavigating: boolean;
|
|
27
|
+
initializeSession: (entryStepId?: string) => Promise<void>;
|
|
28
|
+
endSession: () => Promise<void>;
|
|
29
|
+
retryInitialization: () => Promise<void>;
|
|
30
|
+
initializationError: Error | null;
|
|
31
|
+
isSessionLoading: boolean;
|
|
32
|
+
sessionError: Error | null;
|
|
33
|
+
refetch: () => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* React Hook for Funnel Navigation (Plugin SDK v2)
|
|
37
|
+
*
|
|
38
|
+
* Modern funnel navigation using TanStack Query for state management
|
|
39
|
+
* and the v2 ApiClient architecture.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useFunnel(options?: UseFunnelOptions): UseFunnelResult;
|
|
42
|
+
/**
|
|
43
|
+
* Simplified funnel hook for basic step tracking (v2)
|
|
44
|
+
*/
|
|
45
|
+
export declare function useSimpleFunnel(funnelId: string, initialStepId?: string): {
|
|
46
|
+
currentStepId: string;
|
|
47
|
+
next: (event: FunnelAction) => Promise<any>;
|
|
48
|
+
goToStep: (stepId: string) => Promise<any>;
|
|
49
|
+
isLoading: boolean;
|
|
50
|
+
context: SimpleFunnelContext<{}> | null;
|
|
51
|
+
};
|
|
52
|
+
export type { FunnelAction as FunnelEvent, FunnelNavigationAction, FunnelNavigationResult, SimpleFunnelContext } from '../../core/resources/funnel';
|