@tagadapay/plugin-sdk 2.8.2 → 2.8.4

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.
@@ -3,34 +3,43 @@
3
3
  */
4
4
  import { ApiClient } from './apiClient';
5
5
  /**
6
- * Funnel event types enum
6
+ * Funnel action types enum
7
7
  *
8
8
  * Special types:
9
9
  * - DIRECT_NAVIGATION: Bypasses step conditions, navigates directly to targetStepId
10
10
  * - BACK_NAVIGATION: Similar to direct_navigation, used for backward navigation
11
11
  *
12
12
  * Common types (for logging/tracking):
13
- * - Any string value is accepted, but these are commonly used examples
13
+ * - These are commonly used action types that align with funnel orchestrator conditions
14
+ * - Navigation logic is based on step conditions.from, action types are primarily for analytics
14
15
  */
15
16
  export declare enum FunnelActionType {
16
17
  DIRECT_NAVIGATION = "direct_navigation",
17
18
  BACK_NAVIGATION = "back_navigation",
19
+ CONTINUE_CLICKED = "continue_clicked",
20
+ BUTTON_CLICK = "button_click",
21
+ FORM_SUBMIT = "form_submit",
18
22
  PAYMENT_SUCCESS = "payment_success",
23
+ PAYMENT_FAILED = "payment_failed",
24
+ OFFER_ACCEPTED = "offer_accepted",
25
+ OFFER_DECLINED = "offer_declined",
26
+ CART_UPDATED = "cart_updated",
27
+ CART_ITEM_ADDED = "cart_item_added",
19
28
  CUSTOM = "custom"
20
29
  }
21
30
  /**
22
- * Data structures for specific event types
31
+ * Data structures for specific action types
23
32
  */
24
- export type NextEvent<T> = T & {
33
+ export type NextAction<T> = T & {
25
34
  [key: string]: any;
26
35
  };
27
- export interface DirectNavigationEventData {
36
+ export interface DirectNavigationActionData {
28
37
  targetStepId: string;
29
38
  }
30
- export interface BackNavigationEventData {
39
+ export interface BackNavigationActionData {
31
40
  targetStepId: string;
32
41
  }
33
- export interface PaymentSuccessEventData {
42
+ export interface PaymentSuccessActionData {
34
43
  payment: {
35
44
  id: string;
36
45
  status: string;
@@ -46,12 +55,53 @@ export interface PaymentSuccessEventData {
46
55
  };
47
56
  [key: string]: any;
48
57
  }
58
+ export interface PaymentFailedActionData {
59
+ payment: {
60
+ id: string;
61
+ status: string;
62
+ error?: string;
63
+ [key: string]: any;
64
+ };
65
+ [key: string]: any;
66
+ }
67
+ export interface OfferAcceptedActionData {
68
+ offer: {
69
+ accepted: boolean;
70
+ offerId?: string;
71
+ [key: string]: any;
72
+ };
73
+ [key: string]: any;
74
+ }
75
+ export interface OfferDeclinedActionData {
76
+ offer: {
77
+ declined: boolean;
78
+ offerId?: string;
79
+ [key: string]: any;
80
+ };
81
+ [key: string]: any;
82
+ }
83
+ export interface CartUpdatedActionData {
84
+ cart: {
85
+ hasSpecificItem?: boolean;
86
+ itemIds?: string[];
87
+ variantIds?: string[];
88
+ total?: number;
89
+ [key: string]: any;
90
+ };
91
+ [key: string]: any;
92
+ }
93
+ export interface FormSubmitActionData {
94
+ form?: {
95
+ [key: string]: any;
96
+ };
97
+ [key: string]: any;
98
+ }
49
99
  /**
50
- * Base properties shared by all FunnelEvent types
100
+ * Base properties shared by all FunnelAction types
51
101
  */
52
- interface BaseFunnelEvent {
102
+ interface BaseFunnelAction {
53
103
  /**
54
- * Event timestamp (ISO string format)
104
+ * Action timestamp (ISO string format)
55
105
  */
56
106
  timestamp?: string;
57
107
  /**
@@ -62,20 +112,44 @@ interface BaseFunnelEvent {
62
112
  currentUrl?: string;
63
113
  }
64
114
  /**
65
- * Discriminated union for FunnelEvent based on event type
115
+ * Discriminated union for FunnelAction based on action type
66
116
  */
67
- export type FunnelAction = BaseFunnelEvent & (({
117
+ export type FunnelAction = BaseFunnelAction & (({
68
118
  type: FunnelActionType.DIRECT_NAVIGATION;
69
- data: NextEvent<DirectNavigationEventData>;
119
+ data: NextAction<DirectNavigationActionData>;
70
120
  }) | ({
71
121
  type: FunnelActionType.BACK_NAVIGATION;
72
- data: NextEvent<BackNavigationEventData>;
122
+ data: NextAction<BackNavigationActionData>;
123
+ }) | ({
124
+ type: FunnelActionType.CONTINUE_CLICKED;
125
+ data?: NextAction<any>;
126
+ }) | ({
127
+ type: FunnelActionType.BUTTON_CLICK;
128
+ data?: NextAction<any>;
129
+ }) | ({
130
+ type: FunnelActionType.FORM_SUBMIT;
131
+ data?: NextAction<FormSubmitActionData>;
73
132
  }) | ({
74
133
  type: FunnelActionType.PAYMENT_SUCCESS;
75
- data: NextEvent<PaymentSuccessEventData>;
134
+ data: NextAction<PaymentSuccessActionData>;
135
+ }) | ({
136
+ type: FunnelActionType.PAYMENT_FAILED;
137
+ data?: NextAction<PaymentFailedActionData>;
138
+ }) | ({
139
+ type: FunnelActionType.OFFER_ACCEPTED;
140
+ data?: NextAction<OfferAcceptedActionData>;
141
+ }) | ({
142
+ type: FunnelActionType.OFFER_DECLINED;
143
+ data?: NextAction<OfferDeclinedActionData>;
144
+ }) | ({
145
+ type: FunnelActionType.CART_UPDATED;
146
+ data?: NextAction<CartUpdatedActionData>;
147
+ }) | ({
148
+ type: FunnelActionType.CART_ITEM_ADDED;
149
+ data?: NextAction<CartUpdatedActionData>;
76
150
  }) | ({
77
151
  type: FunnelActionType.CUSTOM;
78
- data?: NextEvent<any>;
152
+ data?: NextAction<any>;
79
153
  }));
80
154
  export interface FunnelNavigationAction {
81
155
  type: 'redirect' | 'replace' | 'push' | 'external' | 'none';
@@ -2,21 +2,35 @@
2
2
  * Funnel Resource - API client for funnel navigation and session management
3
3
  */
4
4
  /**
5
- * Funnel event types enum
5
+ * Funnel action types enum
6
6
  *
7
7
  * Special types:
8
8
  * - DIRECT_NAVIGATION: Bypasses step conditions, navigates directly to targetStepId
9
9
  * - BACK_NAVIGATION: Similar to direct_navigation, used for backward navigation
10
10
  *
11
11
  * Common types (for logging/tracking):
12
- * - Any string value is accepted, but these are commonly used examples
12
+ * - These are commonly used action types that align with funnel orchestrator conditions
13
+ * - Navigation logic is based on step conditions.from, action types are primarily for analytics
13
14
  */
14
15
  export var FunnelActionType;
15
16
  (function (FunnelActionType) {
16
- // Special navigation types
17
+ // Special navigation types (bypass step conditions)
17
18
  FunnelActionType["DIRECT_NAVIGATION"] = "direct_navigation";
18
19
  FunnelActionType["BACK_NAVIGATION"] = "back_navigation";
20
+ // User interaction types
21
+ FunnelActionType["CONTINUE_CLICKED"] = "continue_clicked";
22
+ FunnelActionType["BUTTON_CLICK"] = "button_click";
23
+ FunnelActionType["FORM_SUBMIT"] = "form_submit";
24
+ // Payment actions
19
25
  FunnelActionType["PAYMENT_SUCCESS"] = "payment_success";
26
+ FunnelActionType["PAYMENT_FAILED"] = "payment_failed";
27
+ // Offer actions
28
+ FunnelActionType["OFFER_ACCEPTED"] = "offer_accepted";
29
+ FunnelActionType["OFFER_DECLINED"] = "offer_declined";
30
+ // Cart actions
31
+ FunnelActionType["CART_UPDATED"] = "cart_updated";
32
+ FunnelActionType["CART_ITEM_ADDED"] = "cart_item_added";
33
+ // Generic/custom actions
20
34
  FunnelActionType["CUSTOM"] = "custom";
21
35
  })(FunnelActionType || (FunnelActionType = {}));
22
36
  export class FunnelResource {
@@ -22,7 +22,7 @@ export type { ApplyDiscountResponse, Discount, DiscountCodeValidation, RemoveDis
22
22
  export type { ToggleOrderBumpResponse, VipOffer, VipPreviewResponse } from './core/resources/vipOffers';
23
23
  export type { StoreConfig } from './core/resources/storeConfig';
24
24
  export { FunnelActionType } from './core/resources/funnel';
25
- export type { BackNavigationEventData, DirectNavigationEventData, FunnelContextUpdateRequest, FunnelContextUpdateResponse, FunnelAction as FunnelEvent, FunnelInitializeRequest, FunnelInitializeResponse, FunnelNavigateRequest, FunnelNavigateResponse, FunnelNavigationAction, FunnelNavigationResult, NextEvent, PaymentSuccessEventData, SimpleFunnelContext } from './core/resources/funnel';
25
+ 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';
26
26
  export { ApplePayButton, ExpressPaymentMethodsProvider, formatMoney, getAvailableLanguages, GooglePayButton, queryKeys, TagadaProvider, useApiMutation, useApiQuery, useAuth, useCheckout, useCheckoutToken, useClubOffers, useCountryOptions, useCurrency, useCustomer, useCustomerInfos, useCustomerOrders, useCustomerSubscriptions, useDiscounts, useExpressPaymentMethods, useFunnel, useGeoLocation, useGoogleAutocomplete, useInvalidateQuery, useISOData, useLanguageImport, useLogin, useOffers, useOrder, useOrderBump, usePayment, usePluginConfig, usePostPurchases, usePreloadQuery, useProducts, usePromotions, useRegionOptions, useRemappableParams, useShippingRates, useSimpleFunnel, useStoreConfig, useTagadaContext, useThreeds, useThreedsModal, useTranslation, useVipOffers } from './react';
27
27
  export type { TranslateFunction, TranslationText, UseTranslationOptions, UseTranslationResult } from './react/hooks/useTranslation';
28
28
  export type { ClubOffer, ClubOfferItem, ClubOfferLineItem, ClubOfferSummary, UseClubOffersOptions, UseClubOffersResult } from './react/hooks/useClubOffers';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tagadapay/plugin-sdk",
3
- "version": "2.8.2",
3
+ "version": "2.8.4",
4
4
  "description": "Modern React SDK for building Tagada Pay plugins",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",