@gofynd/fdk-store-gql 3.0.74 → 3.0.76

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 (79) hide show
  1. package/github_app_jwt.txt +1 -1
  2. package/lib/graphql/mutations/applyCoupon.handler.d.ts +1 -1
  3. package/lib/graphql/mutations/applyCoupon.handler.js +1 -3
  4. package/lib/graphql/mutations/applyCoupon.handler.js.map +1 -1
  5. package/lib/graphql/mutations/getCartShareLink.handler.d.ts +1 -1
  6. package/lib/graphql/mutations/getCartShareLink.handler.js +1 -3
  7. package/lib/graphql/mutations/getCartShareLink.handler.js.map +1 -1
  8. package/lib/graphql/mutations/index.js +0 -20
  9. package/lib/graphql/mutations/index.js.map +1 -1
  10. package/lib/graphql/mutations/removeCoupon.handler.d.ts +1 -1
  11. package/lib/graphql/mutations/removeCoupon.handler.js +1 -3
  12. package/lib/graphql/mutations/removeCoupon.handler.js.map +1 -1
  13. package/lib/graphql/mutations/updateAddress.handler.d.ts +1 -1
  14. package/lib/graphql/mutations/updateAddress.handler.js +1 -3
  15. package/lib/graphql/mutations/updateAddress.handler.js.map +1 -1
  16. package/lib/graphql/query/applicationContent.handler.d.ts +1 -1
  17. package/lib/graphql/query/applicationContent.handler.js +2 -4
  18. package/lib/graphql/query/applicationContent.handler.js.map +1 -1
  19. package/lib/graphql/query/brands.handler.d.ts +1 -1
  20. package/lib/graphql/query/brands.handler.js +2 -3
  21. package/lib/graphql/query/brands.handler.js.map +1 -1
  22. package/lib/graphql/query/collections.handler.d.ts +1 -1
  23. package/lib/graphql/query/collections.handler.js +1 -3
  24. package/lib/graphql/query/collections.handler.js.map +1 -1
  25. package/lib/graphql/query/coupons.handler.d.ts +1 -1
  26. package/lib/graphql/query/coupons.handler.js +1 -3
  27. package/lib/graphql/query/coupons.handler.js.map +1 -1
  28. package/lib/graphql/query/faqsByCategory.handler.d.ts +1 -1
  29. package/lib/graphql/query/faqsByCategory.handler.js +1 -3
  30. package/lib/graphql/query/faqsByCategory.handler.js.map +1 -1
  31. package/lib/graphql/query/followedListing.handler.d.ts +1 -1
  32. package/lib/graphql/query/followedListing.handler.js +1 -3
  33. package/lib/graphql/query/followedListing.handler.js.map +1 -1
  34. package/lib/graphql/query/index.js +0 -4
  35. package/lib/graphql/query/index.js.map +1 -1
  36. package/lib/graphql/query/order.handler.js +1 -1
  37. package/lib/graphql/query/order.handler.js.map +1 -1
  38. package/lib/helpers/FPI-events.js +35 -430
  39. package/lib/helpers/FPI-events.js.map +1 -1
  40. package/lib/store/index.d.ts +3 -2
  41. package/lib/store/index.js +16 -6
  42. package/lib/store/index.js.map +1 -1
  43. package/package.json +1 -1
  44. package/lib/graphql/mutations/addAddress.handler.d.ts +0 -3
  45. package/lib/graphql/mutations/addAddress.handler.js +0 -7
  46. package/lib/graphql/mutations/addAddress.handler.js.map +0 -1
  47. package/lib/graphql/mutations/createTicket.handler.d.ts +0 -3
  48. package/lib/graphql/mutations/createTicket.handler.js +0 -9
  49. package/lib/graphql/mutations/createTicket.handler.js.map +0 -1
  50. package/lib/graphql/mutations/forgotPassword.handler.d.ts +0 -3
  51. package/lib/graphql/mutations/forgotPassword.handler.js +0 -7
  52. package/lib/graphql/mutations/forgotPassword.handler.js.map +0 -1
  53. package/lib/graphql/mutations/registerWithForm.handler.d.ts +0 -3
  54. package/lib/graphql/mutations/registerWithForm.handler.js +0 -7
  55. package/lib/graphql/mutations/registerWithForm.handler.js.map +0 -1
  56. package/lib/graphql/mutations/removeAddress.handler.d.ts +0 -3
  57. package/lib/graphql/mutations/removeAddress.handler.js +0 -7
  58. package/lib/graphql/mutations/removeAddress.handler.js.map +0 -1
  59. package/lib/graphql/mutations/sendOTPOnEmail.handler.d.ts +0 -3
  60. package/lib/graphql/mutations/sendOTPOnEmail.handler.js +0 -10
  61. package/lib/graphql/mutations/sendOTPOnEmail.handler.js.map +0 -1
  62. package/lib/graphql/mutations/sendOTPOnMobile.handler.d.ts +0 -3
  63. package/lib/graphql/mutations/sendOTPOnMobile.handler.js +0 -10
  64. package/lib/graphql/mutations/sendOTPOnMobile.handler.js.map +0 -1
  65. package/lib/graphql/mutations/sendResetPasswordEmail.handler.d.ts +0 -3
  66. package/lib/graphql/mutations/sendResetPasswordEmail.handler.js +0 -7
  67. package/lib/graphql/mutations/sendResetPasswordEmail.handler.js.map +0 -1
  68. package/lib/graphql/mutations/sendResetPasswordMobile.handler.d.ts +0 -3
  69. package/lib/graphql/mutations/sendResetPasswordMobile.handler.js +0 -7
  70. package/lib/graphql/mutations/sendResetPasswordMobile.handler.js.map +0 -1
  71. package/lib/graphql/mutations/submitCustomForm.handler.d.ts +0 -3
  72. package/lib/graphql/mutations/submitCustomForm.handler.js +0 -7
  73. package/lib/graphql/mutations/submitCustomForm.handler.js.map +0 -1
  74. package/lib/graphql/query/productComparison.handler.d.ts +0 -3
  75. package/lib/graphql/query/productComparison.handler.js +0 -7
  76. package/lib/graphql/query/productComparison.handler.js.map +0 -1
  77. package/lib/graphql/query/promotions.handler.d.ts +0 -3
  78. package/lib/graphql/query/promotions.handler.js +0 -7
  79. package/lib/graphql/query/promotions.handler.js.map +0 -1
@@ -29,65 +29,6 @@ export const FPI_EVENTS = {
29
29
  };
30
30
  },
31
31
  },
32
- USER_REGISTER: {
33
- eventName: "user.register",
34
- payloadCreator: (result, param) => {
35
- var _a, _b;
36
- const formInput = param === null || param === void 0 ? void 0 : param.formRegisterRequestSchemaInput;
37
- return {
38
- email: (result === null || result === void 0 ? void 0 : result.email) || (formInput === null || formInput === void 0 ? void 0 : formInput.email),
39
- phone: {
40
- country_code: (result === null || result === void 0 ? void 0 : result.country_code) || ((_a = formInput === null || formInput === void 0 ? void 0 : formInput.phone) === null || _a === void 0 ? void 0 : _a.country_code),
41
- number: (result === null || result === void 0 ? void 0 : result.mobile) || ((_b = formInput === null || formInput === void 0 ? void 0 : formInput.phone) === null || _b === void 0 ? void 0 : _b.mobile),
42
- },
43
- has_password: (formInput === null || formInput === void 0 ? void 0 : formInput.password) ? true : false,
44
- first_name: formInput === null || formInput === void 0 ? void 0 : formInput.first_name,
45
- last_name: formInput === null || formInput === void 0 ? void 0 : formInput.last_name,
46
- gender: formInput === null || formInput === void 0 ? void 0 : formInput.gender,
47
- };
48
- },
49
- },
50
- USER_PASSWORD_RESET_REQUEST: {
51
- eventName: "user_password_reset.request",
52
- payloadCreator: (result, param) => {
53
- const emailInput = param === null || param === void 0 ? void 0 : param.sendResetPasswordEmailRequestSchemaInput;
54
- const mobileInput = param === null || param === void 0 ? void 0 : param.sendResetPasswordMobileRequestSchemaInput;
55
- // Determine method based on which input is present
56
- const method = emailInput ? 'email' : 'mobile';
57
- return Object.assign(Object.assign({ reset_method: method }, (emailInput ? {
58
- email: emailInput === null || emailInput === void 0 ? void 0 : emailInput.email,
59
- } : {})), (mobileInput ? {
60
- phone: {
61
- country_code: mobileInput === null || mobileInput === void 0 ? void 0 : mobileInput.country_code,
62
- number: mobileInput === null || mobileInput === void 0 ? void 0 : mobileInput.mobile,
63
- },
64
- } : {}));
65
- },
66
- },
67
- USER_PASSWORD_RESET_SUCCESS: {
68
- eventName: "user_password_reset.success",
69
- payloadCreator: (result) => {
70
- var _a;
71
- return {
72
- user_id: (_a = result === null || result === void 0 ? void 0 : result.user) === null || _a === void 0 ? void 0 : _a.id,
73
- };
74
- },
75
- },
76
- USER_RESEND_OTP: {
77
- eventName: "user.resend_otp",
78
- payloadCreator: (result, param) => {
79
- const emailInput = param === null || param === void 0 ? void 0 : param.sendEmailOtpRequestSchemaInput;
80
- const mobileInput = param === null || param === void 0 ? void 0 : param.sendMobileOtpRequestSchemaInput;
81
- return Object.assign(Object.assign({}, (emailInput ? {
82
- email: emailInput === null || emailInput === void 0 ? void 0 : emailInput.email
83
- } : {})), (mobileInput ? {
84
- phone: {
85
- country_code: (result === null || result === void 0 ? void 0 : result.country_code) || (mobileInput === null || mobileInput === void 0 ? void 0 : mobileInput.country_code),
86
- number: (result === null || result === void 0 ? void 0 : result.mobile) || (mobileInput === null || mobileInput === void 0 ? void 0 : mobileInput.mobile),
87
- },
88
- } : {}));
89
- },
90
- },
91
32
  PROFILE_UPDATE: {
92
33
  eventName: "user.update",
93
34
  payloadCreator: (result, param, store, oldStore) => {
@@ -100,126 +41,6 @@ export const FPI_EVENTS = {
100
41
  };
101
42
  },
102
43
  },
103
- ADDRESS_ADD: {
104
- eventName: "address.add",
105
- payloadCreator: (result, param) => {
106
- var _a, _b;
107
- const address2Input = param === null || param === void 0 ? void 0 : param.address2Input;
108
- return {
109
- address_id: result === null || result === void 0 ? void 0 : result.id,
110
- address_type: address2Input === null || address2Input === void 0 ? void 0 : address2Input.address_type,
111
- tags: address2Input === null || address2Input === void 0 ? void 0 : address2Input.tags,
112
- is_active: address2Input === null || address2Input === void 0 ? void 0 : address2Input.is_active,
113
- is_default_address: address2Input === null || address2Input === void 0 ? void 0 : address2Input.is_default_address,
114
- name: address2Input === null || address2Input === void 0 ? void 0 : address2Input.name,
115
- phone: {
116
- country_phone_code: address2Input === null || address2Input === void 0 ? void 0 : address2Input.country_phone_code,
117
- number: address2Input === null || address2Input === void 0 ? void 0 : address2Input.phone,
118
- },
119
- email: address2Input === null || address2Input === void 0 ? void 0 : address2Input.email,
120
- address: address2Input === null || address2Input === void 0 ? void 0 : address2Input.address,
121
- landmark: address2Input === null || address2Input === void 0 ? void 0 : address2Input.landmark,
122
- sector: address2Input === null || address2Input === void 0 ? void 0 : address2Input.sector,
123
- area: address2Input === null || address2Input === void 0 ? void 0 : address2Input.area,
124
- area_code: address2Input === null || address2Input === void 0 ? void 0 : address2Input.area_code,
125
- area_code_slug: address2Input === null || address2Input === void 0 ? void 0 : address2Input.area_code_slug,
126
- city: address2Input === null || address2Input === void 0 ? void 0 : address2Input.city,
127
- state: address2Input === null || address2Input === void 0 ? void 0 : address2Input.state,
128
- state_code: address2Input === null || address2Input === void 0 ? void 0 : address2Input.state_code,
129
- country: address2Input === null || address2Input === void 0 ? void 0 : address2Input.country,
130
- country_code: address2Input === null || address2Input === void 0 ? void 0 : address2Input.country_code,
131
- country_iso_code: address2Input === null || address2Input === void 0 ? void 0 : address2Input.country_iso_code,
132
- geo_location: {
133
- latitude: (_a = address2Input === null || address2Input === void 0 ? void 0 : address2Input.geo_location) === null || _a === void 0 ? void 0 : _a.latitude,
134
- longitude: (_b = address2Input === null || address2Input === void 0 ? void 0 : address2Input.geo_location) === null || _b === void 0 ? void 0 : _b.longitude,
135
- },
136
- google_map_point: address2Input === null || address2Input === void 0 ? void 0 : address2Input.google_map_point,
137
- custom_json: address2Input === null || address2Input === void 0 ? void 0 : address2Input._custom_json,
138
- meta: address2Input === null || address2Input === void 0 ? void 0 : address2Input.meta,
139
- };
140
- },
141
- },
142
- ADDRESS_UPDATE: {
143
- eventName: "address.update",
144
- payloadCreator: (result, param) => {
145
- var _a, _b;
146
- const address2Input = param === null || param === void 0 ? void 0 : param.address2Input;
147
- return {
148
- address_id: result === null || result === void 0 ? void 0 : result.id,
149
- address_type: address2Input === null || address2Input === void 0 ? void 0 : address2Input.address_type,
150
- tags: address2Input === null || address2Input === void 0 ? void 0 : address2Input.tags,
151
- is_active: address2Input === null || address2Input === void 0 ? void 0 : address2Input.is_active,
152
- is_default_address: address2Input === null || address2Input === void 0 ? void 0 : address2Input.is_default_address,
153
- name: address2Input === null || address2Input === void 0 ? void 0 : address2Input.name,
154
- phone: {
155
- country_phone_code: address2Input === null || address2Input === void 0 ? void 0 : address2Input.country_phone_code,
156
- number: address2Input === null || address2Input === void 0 ? void 0 : address2Input.phone,
157
- },
158
- email: address2Input === null || address2Input === void 0 ? void 0 : address2Input.email,
159
- address: address2Input === null || address2Input === void 0 ? void 0 : address2Input.address,
160
- landmark: address2Input === null || address2Input === void 0 ? void 0 : address2Input.landmark,
161
- sector: address2Input === null || address2Input === void 0 ? void 0 : address2Input.sector,
162
- area: address2Input === null || address2Input === void 0 ? void 0 : address2Input.area,
163
- area_code: address2Input === null || address2Input === void 0 ? void 0 : address2Input.area_code,
164
- area_code_slug: address2Input === null || address2Input === void 0 ? void 0 : address2Input.area_code_slug,
165
- city: address2Input === null || address2Input === void 0 ? void 0 : address2Input.city,
166
- state: address2Input === null || address2Input === void 0 ? void 0 : address2Input.state,
167
- state_code: address2Input === null || address2Input === void 0 ? void 0 : address2Input.state_code,
168
- country: address2Input === null || address2Input === void 0 ? void 0 : address2Input.country,
169
- country_code: address2Input === null || address2Input === void 0 ? void 0 : address2Input.country_code,
170
- country_iso_code: address2Input === null || address2Input === void 0 ? void 0 : address2Input.country_iso_code,
171
- geo_location: {
172
- latitude: (_a = address2Input === null || address2Input === void 0 ? void 0 : address2Input.geo_location) === null || _a === void 0 ? void 0 : _a.latitude,
173
- longitude: (_b = address2Input === null || address2Input === void 0 ? void 0 : address2Input.geo_location) === null || _b === void 0 ? void 0 : _b.longitude,
174
- },
175
- google_map_point: address2Input === null || address2Input === void 0 ? void 0 : address2Input.google_map_point,
176
- custom_json: address2Input === null || address2Input === void 0 ? void 0 : address2Input._custom_json,
177
- meta: address2Input === null || address2Input === void 0 ? void 0 : address2Input.meta,
178
- };
179
- },
180
- },
181
- ADDRESS_REMOVE: {
182
- eventName: "address.remove",
183
- payloadCreator: (result, param, store) => {
184
- var _a, _b, _c, _d;
185
- const addressId = (result === null || result === void 0 ? void 0 : result.id) || (param === null || param === void 0 ? void 0 : param.id);
186
- // Find address from store using ID
187
- const addressList = ((_b = (_a = store === null || store === void 0 ? void 0 : store.address) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b.address) || [];
188
- const addressDetails = addressList.find((addr) => (addr === null || addr === void 0 ? void 0 : addr.id) === addressId);
189
- return {
190
- address_id: addressId,
191
- address_type: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.address_type,
192
- tags: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.tags,
193
- is_active: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.is_active,
194
- is_default_address: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.is_default_address,
195
- name: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.name,
196
- phone: {
197
- country_phone_code: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.country_phone_code,
198
- number: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.phone,
199
- },
200
- email: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.email,
201
- address: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.address,
202
- landmark: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.landmark,
203
- sector: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.sector,
204
- area: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.area,
205
- area_code: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.area_code,
206
- area_code_slug: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.area_code_slug,
207
- city: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.city,
208
- state: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.state,
209
- state_code: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.state_code,
210
- country: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.country,
211
- country_code: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.country_code,
212
- country_iso_code: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.country_iso_code,
213
- geo_location: {
214
- latitude: (_c = addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.geo_location) === null || _c === void 0 ? void 0 : _c.latitude,
215
- longitude: (_d = addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.geo_location) === null || _d === void 0 ? void 0 : _d.longitude,
216
- },
217
- google_map_point: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.google_map_point,
218
- custom_json: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails._custom_json,
219
- meta: addressDetails === null || addressDetails === void 0 ? void 0 : addressDetails.meta,
220
- };
221
- },
222
- },
223
44
  PRODUCT_LIST_VIEW: {
224
45
  eventName: "product_list.view",
225
46
  payloadCreator: (result, param, store) => {
@@ -231,24 +52,6 @@ export const FPI_EVENTS = {
231
52
  };
232
53
  },
233
54
  },
234
- COLLECTIONS_VIEW: {
235
- eventName: "collections.view",
236
- payloadCreator: (result) => {
237
- var _a, _b, _c;
238
- const collections = ((_a = result === null || result === void 0 ? void 0 : result.items) === null || _a === void 0 ? void 0 : _a.map((collection, index) => ({
239
- id: collection === null || collection === void 0 ? void 0 : collection.uid,
240
- name: collection === null || collection === void 0 ? void 0 : collection.name,
241
- slug: collection === null || collection === void 0 ? void 0 : collection.slug,
242
- priority: collection === null || collection === void 0 ? void 0 : collection.priority,
243
- position: index + 1,
244
- }))) || [];
245
- return {
246
- collections,
247
- filter_tags: (_b = result === null || result === void 0 ? void 0 : result.filters) === null || _b === void 0 ? void 0 : _b.tags,
248
- filter_types: (_c = result === null || result === void 0 ? void 0 : result.filters) === null || _c === void 0 ? void 0 : _c.type,
249
- };
250
- },
251
- },
252
55
  COLLECTION_LIST_VIEW: {
253
56
  eventName: "collection_list.view",
254
57
  payloadCreator: (result, param, store, oldStore) => {
@@ -258,21 +61,6 @@ export const FPI_EVENTS = {
258
61
  };
259
62
  },
260
63
  },
261
- BRANDS_VIEW: {
262
- eventName: "brands.view",
263
- payloadCreator: (result) => {
264
- var _a;
265
- const brands = ((_a = result === null || result === void 0 ? void 0 : result.items) === null || _a === void 0 ? void 0 : _a.map((brand, index) => ({
266
- id: brand === null || brand === void 0 ? void 0 : brand.uid,
267
- name: brand === null || brand === void 0 ? void 0 : brand.name,
268
- slug: brand === null || brand === void 0 ? void 0 : brand.slug,
269
- position: index + 1,
270
- }))) || [];
271
- return {
272
- brands
273
- };
274
- },
275
- },
276
64
  PRODUCT_LIST_CLICK: {
277
65
  //not getting used
278
66
  eventName: "product_list.click",
@@ -332,34 +120,6 @@ export const FPI_EVENTS = {
332
120
  return store;
333
121
  },
334
122
  },
335
- COMPARE_VIEW: {
336
- eventName: "compare.view",
337
- payloadCreator: (result) => {
338
- var _a;
339
- return {
340
- products_compared: (_a = result === null || result === void 0 ? void 0 : result.items) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
341
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
342
- return ({
343
- product_id: item === null || item === void 0 ? void 0 : item.uid,
344
- position: index + 1,
345
- product_slug: item === null || item === void 0 ? void 0 : item.slug,
346
- product_name: item === null || item === void 0 ? void 0 : item.name,
347
- brand: (_a = item === null || item === void 0 ? void 0 : item.brand) === null || _a === void 0 ? void 0 : _a.name,
348
- marked_price: {
349
- currency: (_c = (_b = item === null || item === void 0 ? void 0 : item.price) === null || _b === void 0 ? void 0 : _b.marked) === null || _c === void 0 ? void 0 : _c.currency_code,
350
- min: (_e = (_d = item === null || item === void 0 ? void 0 : item.price) === null || _d === void 0 ? void 0 : _d.marked) === null || _e === void 0 ? void 0 : _e.min,
351
- max: (_g = (_f = item === null || item === void 0 ? void 0 : item.price) === null || _f === void 0 ? void 0 : _f.marked) === null || _g === void 0 ? void 0 : _g.max,
352
- },
353
- effective_price: {
354
- currency: (_j = (_h = item === null || item === void 0 ? void 0 : item.price) === null || _h === void 0 ? void 0 : _h.effective) === null || _j === void 0 ? void 0 : _j.currency_code,
355
- min: (_l = (_k = item === null || item === void 0 ? void 0 : item.price) === null || _k === void 0 ? void 0 : _k.effective) === null || _l === void 0 ? void 0 : _l.min,
356
- max: (_o = (_m = item === null || item === void 0 ? void 0 : item.price) === null || _m === void 0 ? void 0 : _m.effective) === null || _o === void 0 ? void 0 : _o.max,
357
- },
358
- });
359
- }),
360
- };
361
- },
362
- },
363
123
  ADD_TO_COMPARE: {
364
124
  //not getting used
365
125
  eventName: "compare.add",
@@ -432,35 +192,6 @@ export const FPI_EVENTS = {
432
192
  return { item };
433
193
  },
434
194
  },
435
- VIEW_WISHLIST: {
436
- eventName: "wishlist.view",
437
- payloadCreator: (result, param) => {
438
- var _a;
439
- return {
440
- collection_type: param === null || param === void 0 ? void 0 : param.collectionType,
441
- items: (_a = result === null || result === void 0 ? void 0 : result.items) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
442
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
443
- return ({
444
- product_id: item === null || item === void 0 ? void 0 : item.uid,
445
- position: index + 1,
446
- product_name: item === null || item === void 0 ? void 0 : item.name,
447
- product_slug: item === null || item === void 0 ? void 0 : item.slug,
448
- brand: (_a = item === null || item === void 0 ? void 0 : item.brand) === null || _a === void 0 ? void 0 : _a.name,
449
- marked_price: {
450
- currency: (_c = (_b = item === null || item === void 0 ? void 0 : item.price) === null || _b === void 0 ? void 0 : _b.marked) === null || _c === void 0 ? void 0 : _c.currency_code,
451
- min: (_e = (_d = item === null || item === void 0 ? void 0 : item.price) === null || _d === void 0 ? void 0 : _d.marked) === null || _e === void 0 ? void 0 : _e.min,
452
- max: (_g = (_f = item === null || item === void 0 ? void 0 : item.price) === null || _f === void 0 ? void 0 : _f.marked) === null || _g === void 0 ? void 0 : _g.max,
453
- },
454
- effective_price: {
455
- currency: (_j = (_h = item === null || item === void 0 ? void 0 : item.price) === null || _h === void 0 ? void 0 : _h.effective) === null || _j === void 0 ? void 0 : _j.currency_code,
456
- min: (_l = (_k = item === null || item === void 0 ? void 0 : item.price) === null || _k === void 0 ? void 0 : _k.effective) === null || _l === void 0 ? void 0 : _l.min,
457
- max: (_o = (_m = item === null || item === void 0 ? void 0 : item.price) === null || _m === void 0 ? void 0 : _m.effective) === null || _o === void 0 ? void 0 : _o.max,
458
- },
459
- });
460
- }),
461
- };
462
- },
463
- },
464
195
  VIEW_CART: {
465
196
  eventName: "cart.view",
466
197
  payloadCreator: (result, param, store, oldStore) => {
@@ -674,122 +405,6 @@ export const FPI_EVENTS = {
674
405
  };
675
406
  },
676
407
  },
677
- CART_SHARE: {
678
- eventName: "cart.share",
679
- payloadCreator: (result, param) => {
680
- var _a;
681
- return {
682
- cart_id: (_a = param === null || param === void 0 ? void 0 : param.getShareCartLinkRequestInput) === null || _a === void 0 ? void 0 : _a.id,
683
- share_url: result === null || result === void 0 ? void 0 : result.share_url,
684
- token: result === null || result === void 0 ? void 0 : result.token,
685
- };
686
- },
687
- },
688
- COUPONS_VIEW: {
689
- eventName: "coupons.view",
690
- payloadCreator: (result, param, store) => {
691
- var _a, _b, _c;
692
- const cartDetails = (_a = store === null || store === void 0 ? void 0 : store.cart) === null || _a === void 0 ? void 0 : _a.cart_items;
693
- return {
694
- cart_id: (param === null || param === void 0 ? void 0 : param.id) || (cartDetails === null || cartDetails === void 0 ? void 0 : cartDetails.id),
695
- checkout_mode: (cartDetails === null || cartDetails === void 0 ? void 0 : cartDetails.checkout_mode) || 'self',
696
- buy_now: param === null || param === void 0 ? void 0 : param.buyNow,
697
- restrict_checkout: cartDetails === null || cartDetails === void 0 ? void 0 : cartDetails.restrict_checkout,
698
- currency: (_b = cartDetails === null || cartDetails === void 0 ? void 0 : cartDetails.currency) === null || _b === void 0 ? void 0 : _b.code,
699
- coupons: ((_c = result === null || result === void 0 ? void 0 : result.available_coupon_list) === null || _c === void 0 ? void 0 : _c.map((coupon) => ({
700
- coupon_code: coupon === null || coupon === void 0 ? void 0 : coupon.coupon_code,
701
- coupon_type: coupon === null || coupon === void 0 ? void 0 : coupon.coupon_type,
702
- coupon_amount: coupon === null || coupon === void 0 ? void 0 : coupon.coupon_amount,
703
- coupon_title: coupon === null || coupon === void 0 ? void 0 : coupon.title,
704
- coupon_description: coupon === null || coupon === void 0 ? void 0 : coupon.description,
705
- is_applied: coupon === null || coupon === void 0 ? void 0 : coupon.is_applied,
706
- is_applicable: coupon === null || coupon === void 0 ? void 0 : coupon.is_applicable,
707
- }))) || [],
708
- };
709
- },
710
- },
711
- COUPON_APPLY: {
712
- eventName: "coupon.apply",
713
- payloadCreator: (result) => {
714
- return result;
715
- }
716
- },
717
- COUPON_REMOVE: {
718
- eventName: "coupon.remove",
719
- payloadCreator: (result) => {
720
- return result;
721
- }
722
- },
723
- PROMOTIONS_VIEW: {
724
- eventName: "promotions.view",
725
- payloadCreator: (result, param) => {
726
- var _a;
727
- return {
728
- cart_id: param === null || param === void 0 ? void 0 : param.cartId,
729
- promotions: (_a = result === null || result === void 0 ? void 0 : result.available_promotions) === null || _a === void 0 ? void 0 : _a.map((promotion) => {
730
- var _a;
731
- return ({
732
- id: promotion === null || promotion === void 0 ? void 0 : promotion.id,
733
- promotion_name: promotion === null || promotion === void 0 ? void 0 : promotion.promotion_name,
734
- promotion_type: promotion === null || promotion === void 0 ? void 0 : promotion.promotion_type,
735
- description: promotion === null || promotion === void 0 ? void 0 : promotion.description,
736
- offer_text: promotion === null || promotion === void 0 ? void 0 : promotion.offer_text,
737
- discount_rules: promotion === null || promotion === void 0 ? void 0 : promotion.discount_rules,
738
- free_gift_items: (_a = promotion === null || promotion === void 0 ? void 0 : promotion.free_gift_items) === null || _a === void 0 ? void 0 : _a.map((item) => {
739
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
740
- return ({
741
- item_id: item === null || item === void 0 ? void 0 : item.item_id,
742
- item_name: item === null || item === void 0 ? void 0 : item.item_name,
743
- item_slug: item === null || item === void 0 ? void 0 : item.item_slug,
744
- marked_price: {
745
- min: (_b = (_a = item === null || item === void 0 ? void 0 : item.item_price_details) === null || _a === void 0 ? void 0 : _a.marked) === null || _b === void 0 ? void 0 : _b.min,
746
- max: (_d = (_c = item === null || item === void 0 ? void 0 : item.item_price_details) === null || _c === void 0 ? void 0 : _c.marked) === null || _d === void 0 ? void 0 : _d.max,
747
- },
748
- effective_price: {
749
- min: (_f = (_e = item === null || item === void 0 ? void 0 : item.item_price_details) === null || _e === void 0 ? void 0 : _e.effective) === null || _f === void 0 ? void 0 : _f.min,
750
- max: (_h = (_g = item === null || item === void 0 ? void 0 : item.item_price_details) === null || _g === void 0 ? void 0 : _g.effective) === null || _h === void 0 ? void 0 : _h.max,
751
- },
752
- currency: (_j = item === null || item === void 0 ? void 0 : item.item_price_details) === null || _j === void 0 ? void 0 : _j.currency,
753
- size: item === null || item === void 0 ? void 0 : item.size,
754
- });
755
- }),
756
- });
757
- }),
758
- };
759
- },
760
- },
761
- FAQ_CATEGORIES_VIEW: {
762
- eventName: "faq_categories.view",
763
- payloadCreator: (result) => {
764
- var _a;
765
- return {
766
- faq_categories: (_a = result === null || result === void 0 ? void 0 : result.categories) === null || _a === void 0 ? void 0 : _a.map((category) => ({
767
- id: category === null || category === void 0 ? void 0 : category.id,
768
- slug: category === null || category === void 0 ? void 0 : category.slug,
769
- title: category === null || category === void 0 ? void 0 : category.title,
770
- description: category === null || category === void 0 ? void 0 : category.description,
771
- children: category === null || category === void 0 ? void 0 : category.children,
772
- position: category === null || category === void 0 ? void 0 : category.index,
773
- })),
774
- };
775
- },
776
- },
777
- FAQS_VIEW: {
778
- eventName: "faqs.view",
779
- payloadCreator: (result, param) => {
780
- var _a;
781
- return {
782
- faq_category_slug: param === null || param === void 0 ? void 0 : param.slug,
783
- faqs: (_a = result === null || result === void 0 ? void 0 : result.faqs) === null || _a === void 0 ? void 0 : _a.map((faq, index) => ({
784
- id: faq === null || faq === void 0 ? void 0 : faq.id,
785
- slug: faq === null || faq === void 0 ? void 0 : faq.slug,
786
- question: faq === null || faq === void 0 ? void 0 : faq.question,
787
- answer: faq === null || faq === void 0 ? void 0 : faq.answer,
788
- position: index + 1,
789
- })),
790
- };
791
- },
792
- },
793
408
  ORDER_CHECKEDOUT: {
794
409
  eventName: "order.checkedout",
795
410
  payloadCreator: (result, param, store, oldStore) => {
@@ -879,27 +494,42 @@ export const FPI_EVENTS = {
879
494
  };
880
495
  },
881
496
  },
882
- ORDER_VIEW: {
883
- eventName: "order.view",
884
- payloadCreator: (result, param) => {
885
- var _a;
886
- return {
887
- order_id: param === null || param === void 0 ? void 0 : param.orderId,
888
- shipments: ((_a = result === null || result === void 0 ? void 0 : result.shipments) === null || _a === void 0 ? void 0 : _a.map((shipment) => {
889
- var _a, _b;
890
- return ({
891
- shipment_id: shipment === null || shipment === void 0 ? void 0 : shipment.shipment_id,
892
- current_status: (_a = shipment === null || shipment === void 0 ? void 0 : shipment.shipment_status) === null || _a === void 0 ? void 0 : _a.title,
893
- delivery_mode: shipment === null || shipment === void 0 ? void 0 : shipment.order_type,
894
- expected_delivery_date: shipment === null || shipment === void 0 ? void 0 : shipment.delivery_date,
895
- payment_methods: (_b = shipment === null || shipment === void 0 ? void 0 : shipment.payment_info) === null || _b === void 0 ? void 0 : _b.map((payment) => ({
896
- payment_mode: payment === null || payment === void 0 ? void 0 : payment.payment_mode,
897
- payment_status: payment === null || payment === void 0 ? void 0 : payment.status,
898
- amount: payment === null || payment === void 0 ? void 0 : payment.amount,
899
- })),
497
+ ORDER_PROCESSED: {
498
+ eventName: "order.processed",
499
+ payloadCreator: (result, param, store, oldStore) => {
500
+ var _a, _b, _c, _d, _e, _f, _g, _h;
501
+ try {
502
+ const orderData = result;
503
+ let eventData = {};
504
+ const breakup = {};
505
+ if (orderData.breakup_values) {
506
+ for (let i = 0; i < orderData.breakup_values.length; i++) {
507
+ breakup[orderData.breakup_values[i].name] =
508
+ orderData.breakup_values[i].value;
509
+ }
510
+ }
511
+ eventData.order_id = param === null || param === void 0 ? void 0 : param.orderId;
512
+ eventData.breakup_values_raw = breakup;
513
+ const arrShipments = [];
514
+ const items = [];
515
+ for (let i = 0; i < orderData.shipments.length; i++) {
516
+ arrShipments.push({
517
+ shipment_id: (_a = orderData.shipments[i]) === null || _a === void 0 ? void 0 : _a.shipment_id,
518
+ status: (_c = (_b = orderData.shipments[i]) === null || _b === void 0 ? void 0 : _b.shipment_status) === null || _c === void 0 ? void 0 : _c.title,
519
+ payment_mode: (_e = (_d = orderData.shipments[i]) === null || _d === void 0 ? void 0 : _d.payment) === null || _e === void 0 ? void 0 : _e.mode,
900
520
  });
901
- })) || [],
902
- };
521
+ (_h = (_g = (_f = orderData === null || orderData === void 0 ? void 0 : orderData.shipments) === null || _f === void 0 ? void 0 : _f[i]) === null || _g === void 0 ? void 0 : _g.bags) === null || _h === void 0 ? void 0 : _h.forEach((b) => {
522
+ var _a;
523
+ return items.push(Object.assign(Object.assign({}, ((b === null || b === void 0 ? void 0 : b.item) || {})), { price: (_a = b === null || b === void 0 ? void 0 : b.prices) === null || _a === void 0 ? void 0 : _a.price_effective, quantity: (b === null || b === void 0 ? void 0 : b.quantity) ? b === null || b === void 0 ? void 0 : b.quantity : 1 }));
524
+ });
525
+ }
526
+ eventData.shipments = arrShipments;
527
+ eventData.items = items;
528
+ return eventData;
529
+ }
530
+ catch (err) {
531
+ console.log("Error occurred: ", err);
532
+ }
903
533
  },
904
534
  },
905
535
  ORDER_TRACKING_VIEW: {
@@ -985,31 +615,6 @@ export const FPI_EVENTS = {
985
615
  return store;
986
616
  },
987
617
  },
988
- CONTACT_US_SUBMIT: {
989
- eventName: "contact_us.submit",
990
- payloadCreator: (result, param) => {
991
- var _a, _b, _c, _d, _e, _f, _g;
992
- const ticket = (_a = result === null || result === void 0 ? void 0 : result.ticket) !== null && _a !== void 0 ? _a : result;
993
- return {
994
- form_slug: param === null || param === void 0 ? void 0 : param.slug,
995
- support_ticket: {
996
- ticket_id: ticket === null || ticket === void 0 ? void 0 : ticket._id,
997
- category: {
998
- key: (_b = ticket === null || ticket === void 0 ? void 0 : ticket.category) === null || _b === void 0 ? void 0 : _b.key,
999
- display: (_c = ticket === null || ticket === void 0 ? void 0 : ticket.category) === null || _c === void 0 ? void 0 : _c.display,
1000
- },
1001
- content: {
1002
- title: (_d = ticket === null || ticket === void 0 ? void 0 : ticket.content) === null || _d === void 0 ? void 0 : _d.title,
1003
- description: (_e = ticket === null || ticket === void 0 ? void 0 : ticket.content) === null || _e === void 0 ? void 0 : _e.description,
1004
- },
1005
- context: {
1006
- company_id: (_f = ticket === null || ticket === void 0 ? void 0 : ticket.context) === null || _f === void 0 ? void 0 : _f.company_id,
1007
- application_id: (_g = ticket === null || ticket === void 0 ? void 0 : ticket.context) === null || _g === void 0 ? void 0 : _g.application_id,
1008
- }
1009
- },
1010
- };
1011
- },
1012
- },
1013
618
  };
1014
619
  function handleDynamicEventName(event, eventPayload, params) {
1015
620
  var _a, _b, _c;