@envive-ai/react-hooks 0.2.6-alpha → 0.2.6-alpha-2

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 (408) hide show
  1. package/dist/{AmplitudeOperations-zFjk1Mkm.js → AmplitudeOperations-C3i2q2Bn.js} +2 -2
  2. package/dist/{AmplitudeOperations-CDe6oRn4.cjs → AmplitudeOperations-DcuLn1Zk.cjs} +2 -2
  3. package/dist/{NewOrgConfig-ChNJ3ZtC.js → NewOrgConfig-BtvujFC8.js} +2 -2
  4. package/dist/{NewOrgConfig-KHz61ikr.cjs → NewOrgConfig-CHt7Xg4t.cjs} +2 -2
  5. package/dist/{TrackComponentVisibleEvent-f8ahqV1g.js → TrackComponentVisibleEvent-Be7wfXXY.js} +3 -3
  6. package/dist/{TrackComponentVisibleEvent-uEzgBXb9.cjs → TrackComponentVisibleEvent-KUihr_y4.cjs} +3 -3
  7. package/dist/{api-1-73JxnF.js → api-D4HaU2Gf.js} +3 -3
  8. package/dist/{api-ZNG6wObS.cjs → api-D4Xoibs9.cjs} +3 -3
  9. package/dist/application/models/graphql/index.cjs +1 -1
  10. package/dist/application/models/graphql/index.js +1 -1
  11. package/dist/application/models/guards/api/index.cjs +3 -3
  12. package/dist/application/models/guards/api/index.js +3 -3
  13. package/dist/application/models/guards/utils.cjs +1 -1
  14. package/dist/application/models/guards/utils.js +1 -1
  15. package/dist/application/models/index.cjs +6 -6
  16. package/dist/application/models/index.js +6 -6
  17. package/dist/application/utils/index.cjs +17 -17
  18. package/dist/application/utils/index.d.cts +1 -1
  19. package/dist/application/utils/index.d.ts +2 -2
  20. package/dist/application/utils/index.js +17 -17
  21. package/dist/{atomStore-DAQvNPkh.js → atomStore-BuopbV9k.js} +1 -1
  22. package/dist/{atomStore-DD9g7Zw2.cjs → atomStore-CZKe3itM.cjs} +1 -1
  23. package/dist/atoms/app/index.cjs +17 -17
  24. package/dist/atoms/app/index.d.cts +7 -7
  25. package/dist/atoms/app/index.d.ts +6 -6
  26. package/dist/atoms/app/index.js +17 -17
  27. package/dist/atoms/atomStore/index.cjs +1 -1
  28. package/dist/atoms/atomStore/index.js +1 -1
  29. package/dist/atoms/chat/index.cjs +19 -19
  30. package/dist/atoms/chat/index.d.cts +32 -32
  31. package/dist/atoms/chat/index.d.ts +32 -32
  32. package/dist/atoms/chat/index.js +19 -19
  33. package/dist/atoms/globalSearch/index.cjs +1 -1
  34. package/dist/atoms/globalSearch/index.d.cts +6 -6
  35. package/dist/atoms/globalSearch/index.d.ts +6 -6
  36. package/dist/atoms/globalSearch/index.js +1 -1
  37. package/dist/atoms/org/index.cjs +2 -2
  38. package/dist/atoms/org/index.d.cts +16 -16
  39. package/dist/atoms/org/index.d.ts +16 -16
  40. package/dist/atoms/org/index.js +2 -2
  41. package/dist/atoms/search/index.cjs +6 -6
  42. package/dist/atoms/search/index.d.cts +15 -15
  43. package/dist/atoms/search/index.d.ts +14 -14
  44. package/dist/atoms/search/index.js +6 -6
  45. package/dist/atoms/search/utils.cjs +1 -1
  46. package/dist/atoms/search/utils.js +1 -1
  47. package/dist/{cdnContext-DT6J5nCw.js → cdnContext-B2-NiEiW.js} +2 -2
  48. package/dist/{cdnContext-BLNiW2HT.cjs → cdnContext-CdhppNeT.cjs} +2 -2
  49. package/dist/{chat-C0cgfkL8.js → chat-C9KdnT5V.js} +7 -7
  50. package/dist/{chat-DULmjtx1.cjs → chat-bImNRcnQ.cjs} +7 -7
  51. package/dist/{chatState-BrSfXIV4.cjs → chatState-DqWSgmjC.cjs} +3 -3
  52. package/dist/{chatState-Cn8JGAlH.js → chatState-DxG0t4fK.js} +3 -3
  53. package/dist/contexts/amplitudeContext/index.cjs +17 -17
  54. package/dist/contexts/amplitudeContext/index.js +17 -17
  55. package/dist/contexts/cdnContext/index.cjs +4 -4
  56. package/dist/contexts/cdnContext/index.d.cts +1 -1
  57. package/dist/contexts/cdnContext/index.js +4 -4
  58. package/dist/contexts/enviveConfigContext/index.cjs +4 -4
  59. package/dist/contexts/enviveConfigContext/index.d.cts +1 -1
  60. package/dist/contexts/enviveConfigContext/index.js +4 -4
  61. package/dist/contexts/enviveCssContext/index.cjs +14 -14
  62. package/dist/contexts/enviveCssContext/index.js +14 -14
  63. package/dist/contexts/featureFlagContext/index.cjs +5 -5
  64. package/dist/contexts/featureFlagContext/index.js +5 -5
  65. package/dist/contexts/featureFlagServiceContext/index.cjs +4 -4
  66. package/dist/contexts/featureFlagServiceContext/index.js +4 -4
  67. package/dist/contexts/graphqlContext/index.cjs +8 -8
  68. package/dist/contexts/graphqlContext/index.js +8 -8
  69. package/dist/contexts/localStorageContext/index.cjs +3 -3
  70. package/dist/contexts/localStorageContext/index.js +3 -3
  71. package/dist/contexts/newOrgConfigContext/index.cjs +13 -13
  72. package/dist/contexts/newOrgConfigContext/index.d.cts +1 -1
  73. package/dist/contexts/newOrgConfigContext/index.js +13 -13
  74. package/dist/contexts/searchContext/index.cjs +22 -22
  75. package/dist/contexts/searchContext/index.js +22 -22
  76. package/dist/contexts/sessionStorageContext/index.cjs +2 -2
  77. package/dist/contexts/sessionStorageContext/index.js +2 -2
  78. package/dist/contexts/systemSettingsContext/index.cjs +4 -4
  79. package/dist/contexts/systemSettingsContext/index.js +4 -4
  80. package/dist/contexts/userIdentityContext/index.cjs +17 -17
  81. package/dist/contexts/userIdentityContext/index.js +17 -17
  82. package/dist/{dist-BZX_Mgfn.cjs → dist-B7BErEyV.cjs} +1 -1
  83. package/dist/{dist-CIM4YRqp.js → dist-CtkINi1R.js} +1 -1
  84. package/dist/{domObserver-DKcas6tl.js → domObserver-B19-69gW.js} +1 -1
  85. package/dist/{domObserver-Do6RAJdf.cjs → domObserver-CwieVNgj.cjs} +1 -1
  86. package/dist/{enviveConfig-DrvYlCYG.js → enviveConfig-Be2kZE7j.js} +3 -3
  87. package/dist/{enviveConfig-DaotBKMS.cjs → enviveConfig-u50Rpz-G.cjs} +3 -3
  88. package/dist/{enviveConfigContext-BCnzgk4M.js → enviveConfigContext-1oiQuocd.js} +3 -3
  89. package/dist/{enviveConfigContext--89ejDs5.cjs → enviveConfigContext-kQfHEGdJ.cjs} +3 -3
  90. package/dist/exceptions/index.cjs +1 -1
  91. package/dist/exceptions/index.js +1 -1
  92. package/dist/{exceptions-BiSWJEl2.cjs → exceptions-BjDgLzGi.cjs} +1 -1
  93. package/dist/{exceptions-DSv0ZaH0.js → exceptions-CUGY31Ua.js} +1 -1
  94. package/dist/{featureFlagServiceContext-DpdlcjNb.js → featureFlagServiceContext-CPsygiHO.js} +3 -3
  95. package/dist/{featureFlagServiceContext-BztKnBPk.cjs → featureFlagServiceContext-pPneufeB.cjs} +3 -3
  96. package/dist/{globalSearch-nmrfGLOn.js → globalSearch-B_v9qfCT.js} +1 -1
  97. package/dist/{globalSearch-Cpc8egsM.cjs → globalSearch-OiF96VLG.cjs} +1 -1
  98. package/dist/{graphql-CWNkUHFV.js → graphql-CvAHWmel.js} +1 -1
  99. package/dist/{graphql-DT-H-lta.cjs → graphql-JaGqsToc.cjs} +1 -1
  100. package/dist/{graphqlContext-CWulFxxC.js → graphqlContext-BuXJ5DiW.js} +5 -5
  101. package/dist/{graphqlContext-B181y-sa.cjs → graphqlContext-CU7NIJo7.cjs} +5 -5
  102. package/dist/hooks/AmplitudeOperations/index.cjs +18 -18
  103. package/dist/hooks/AmplitudeOperations/index.d.cts +1 -1
  104. package/dist/hooks/AmplitudeOperations/index.js +18 -18
  105. package/dist/hooks/AppDetails/index.cjs +20 -20
  106. package/dist/hooks/AppDetails/index.d.cts +1 -1
  107. package/dist/hooks/AppDetails/index.js +20 -20
  108. package/dist/hooks/CdnOperations/index.cjs +4 -4
  109. package/dist/hooks/CdnOperations/index.d.cts +1 -1
  110. package/dist/hooks/CdnOperations/index.js +4 -4
  111. package/dist/hooks/ChatToggle/index.cjs +19 -19
  112. package/dist/hooks/ChatToggle/index.js +19 -19
  113. package/dist/hooks/ChatToggleAnalytics/index.cjs +19 -19
  114. package/dist/hooks/ChatToggleAnalytics/index.js +19 -19
  115. package/dist/hooks/CustomerSupportHandoff/index.cjs +1 -1
  116. package/dist/hooks/CustomerSupportHandoff/index.js +1 -1
  117. package/dist/hooks/ElementObserver/index.cjs +1 -1
  118. package/dist/hooks/ElementObserver/index.js +1 -1
  119. package/dist/hooks/GraphQLConfig/index.cjs +9 -9
  120. package/dist/hooks/GraphQLConfig/index.js +9 -9
  121. package/dist/hooks/IdentifyUser/index.cjs +17 -17
  122. package/dist/hooks/IdentifyUser/index.js +17 -17
  123. package/dist/hooks/ImageResolver/index.cjs +3 -3
  124. package/dist/hooks/ImageResolver/index.js +3 -3
  125. package/dist/hooks/LocalStorageOperations/index.cjs +3 -3
  126. package/dist/hooks/LocalStorageOperations/index.js +3 -3
  127. package/dist/hooks/MessageFilter/index.cjs +1 -1
  128. package/dist/hooks/MessageFilter/index.js +1 -1
  129. package/dist/hooks/NewOrgConfig/index.cjs +14 -14
  130. package/dist/hooks/NewOrgConfig/index.d.cts +2 -2
  131. package/dist/hooks/NewOrgConfig/index.d.ts +2 -2
  132. package/dist/hooks/NewOrgConfig/index.js +14 -14
  133. package/dist/hooks/Search/index.cjs +31 -31
  134. package/dist/hooks/Search/index.js +31 -31
  135. package/dist/hooks/SearchOperations/index.cjs +22 -22
  136. package/dist/hooks/SearchOperations/index.js +22 -22
  137. package/dist/hooks/SessionStorageOperations/index.cjs +2 -2
  138. package/dist/hooks/SessionStorageOperations/index.js +2 -2
  139. package/dist/hooks/ShopifyUrlOperations/index.d.cts +2 -2
  140. package/dist/hooks/ShopifyUrlOperations/index.d.ts +2 -2
  141. package/dist/hooks/SystemSettingsContext/index.cjs +4 -4
  142. package/dist/hooks/SystemSettingsContext/index.d.cts +3 -3
  143. package/dist/hooks/SystemSettingsContext/index.d.ts +4 -4
  144. package/dist/hooks/SystemSettingsContext/index.js +4 -4
  145. package/dist/hooks/TrackComponentVisibleEvent/index.cjs +18 -18
  146. package/dist/hooks/TrackComponentVisibleEvent/index.js +18 -18
  147. package/dist/hooks/UpdateAnalyticsProps/index.cjs +17 -17
  148. package/dist/hooks/UpdateAnalyticsProps/index.js +17 -17
  149. package/dist/index-B4cSHxVN.d.ts +1 -1
  150. package/dist/index-Dzv6WwSZ.d.ts +1 -1
  151. package/dist/interceptors/index.cjs +1 -1
  152. package/dist/interceptors/index.js +1 -1
  153. package/dist/{localStorageContext-DbWl7Row.cjs → localStorageContext-Bb2b_3ue.cjs} +3 -3
  154. package/dist/{localStorageContext-DSpmlfyr.js → localStorageContext-D2uXKahw.js} +3 -3
  155. package/dist/{logger-DCs3_11o.js → logger-BMVdhQOV.js} +1 -1
  156. package/dist/{logger-BF6iGSVd.cjs → logger-BqHq67zN.cjs} +1 -1
  157. package/dist/{models-DEJUuKYQ.js → models-DmsMlaHT.js} +5 -5
  158. package/dist/{models-158fyHt9.cjs → models-wh2gh_Qz.cjs} +5 -5
  159. package/dist/{newOrgConfigAtom-BuQE_zPK.js → newOrgConfigAtom-Dsk0fJNR.js} +1 -1
  160. package/dist/{newOrgConfigAtom-rrYHmp1b.cjs → newOrgConfigAtom-hs5A1pbZ.cjs} +1 -1
  161. package/dist/{newOrgConfigContext-C0LzIRJ7.js → newOrgConfigContext-DPUxIF2G.js} +5 -5
  162. package/dist/{newOrgConfigContext-BVrzYatq.cjs → newOrgConfigContext-lw85mMS-.cjs} +5 -5
  163. package/dist/nodeSelector-Cj-Xl1LP.d.cts +1 -1
  164. package/dist/{org-CVjyv-gv.cjs → org-C2kLSSe9.cjs} +1 -1
  165. package/dist/{org-Ct9Vjv1J.js → org-CIczyLRP.js} +1 -1
  166. package/dist/{search-DLHzcbfP.js → search-BzXoTgRx.js} +5 -5
  167. package/dist/{search-C0TAcTeY.cjs → search-D1cU29CV.cjs} +5 -5
  168. package/dist/{searchContext-Dmtue5QO.js → searchContext-C8DpjnqD.js} +7 -7
  169. package/dist/{searchContext-l_23fiuP.cjs → searchContext-R_XuFzYe.cjs} +7 -7
  170. package/dist/{searchServiceAdapter-B0h7psvh.js → searchServiceAdapter-CKc7UXKi.js} +1 -1
  171. package/dist/{searchServiceAdapter-BclWy4fE.cjs → searchServiceAdapter-pROGm3Rf.cjs} +1 -1
  172. package/dist/{sessionStorageContext-BOyr7mIM.cjs → sessionStorageContext-ByaTsDUC.cjs} +2 -2
  173. package/dist/{sessionStorageContext-ClXN9eX4.js → sessionStorageContext-DKE97oMv.js} +2 -2
  174. package/dist/{systemSettingsContext-CksCdpiU.js → systemSettingsContext-B-FZ8UAg.js} +2 -2
  175. package/dist/{systemSettingsContext-Cb5kczBD.cjs → systemSettingsContext-J1sny8W8.cjs} +2 -2
  176. package/dist/types/index.cjs +1 -1
  177. package/dist/types/index.js +1 -1
  178. package/dist/{types-18QXD2rd.cjs → types-1iJ_FnQQ.cjs} +1 -1
  179. package/dist/{types-DQC1pHqD.js → types-D5du68Vp.js} +1 -1
  180. package/dist/{useAppDetails-BJFRSYbI.js → useAppDetails-BtK9ZZJs.js} +4 -4
  181. package/dist/{useAppDetails-Czn-5FzP.cjs → useAppDetails-Bw2jJ39H.cjs} +4 -4
  182. package/dist/{useGraphQLConfig-BEtX5pDM.cjs → useGraphQLConfig-Dc8h2yyN.cjs} +2 -2
  183. package/dist/{useGraphQLConfig-Dkcrz1YL.js → useGraphQLConfig-DuLB3tdv.js} +2 -2
  184. package/dist/{utils-CEKzBcN2.js → utils-B1LVzQYK.js} +1 -1
  185. package/dist/{utils-CqVRbvfN.cjs → utils-BivlGkeU.cjs} +1 -1
  186. package/dist/{utils-DQhbbAnt.js → utils-CExht7Uj.js} +1 -1
  187. package/dist/{utils-CsMbZmRw.cjs → utils-CiJLDPjY.cjs} +1 -1
  188. package/dist/{utils-CPvqOk0g.cjs → utils-DqNhRm2b.cjs} +14 -14
  189. package/dist/{utils-N47VsL9W.js → utils-IogJwDB9.js} +13 -13
  190. package/package.json +1 -1
  191. package/dist/src/application/commerce-api.js +0 -406
  192. package/dist/src/application/logging/logger.js +0 -16
  193. package/dist/src/application/models/graphql/index.js +0 -3
  194. package/dist/src/application/models/graphql/queries/getMerchantColorsQuery.js +0 -13
  195. package/dist/src/application/models/graphql/queries/getMerchantFrontendConfigQuery.js +0 -13
  196. package/dist/src/application/models/graphql/queries/getMerchantOrgIdQuery.js +0 -10
  197. package/dist/src/application/models/guards/api/index.js +0 -12
  198. package/dist/src/application/models/guards/api/isApiFormResponse.js +0 -59
  199. package/dist/src/application/models/guards/api/isApiFormSubmittedResponseAttributes.js +0 -22
  200. package/dist/src/application/models/guards/api/isApiOrderResponseAttributes.js +0 -91
  201. package/dist/src/application/models/guards/api/isApiOrgConfigResults.js +0 -188
  202. package/dist/src/application/models/guards/api/isApiOrganizationConfig.js +0 -115
  203. package/dist/src/application/models/guards/api/isApiPDPEventAttributes.js +0 -16
  204. package/dist/src/application/models/guards/api/isApiPLPEventAttributes.js +0 -26
  205. package/dist/src/application/models/guards/api/isApiPageResponseAttributes.js +0 -15
  206. package/dist/src/application/models/guards/api/isApiProductResponseAttributes.js +0 -65
  207. package/dist/src/application/models/guards/api/isApiProductSearchAttributes.js +0 -15
  208. package/dist/src/application/models/guards/api/isApiProductSearchFilterAttributes.js +0 -10
  209. package/dist/src/application/models/guards/api/isApiQueryTypedEventAttributes.js +0 -4
  210. package/dist/src/application/models/guards/api/isApiResponse.js +0 -33
  211. package/dist/src/application/models/guards/api/isApiReviewResponseAttributes.js +0 -22
  212. package/dist/src/application/models/guards/api/isApiReviewRichInformation.js +0 -23
  213. package/dist/src/application/models/guards/api/isApiSearchEventAttributes.js +0 -20
  214. package/dist/src/application/models/guards/api/isApiSuggestion.js +0 -24
  215. package/dist/src/application/models/guards/api/isApiSuggestionClickedEventAttributes.js +0 -4
  216. package/dist/src/application/models/guards/api/isApiTextResponseAttributes.js +0 -4
  217. package/dist/src/application/models/guards/api/isApiUserEvent.js +0 -18
  218. package/dist/src/application/models/guards/graphQL/isGraphQLColorsConfig.js +0 -41
  219. package/dist/src/application/models/guards/isBaseEcommerceEvent.js +0 -14
  220. package/dist/src/application/models/guards/isGA4EcommerceEvent.js +0 -14
  221. package/dist/src/application/models/guards/isLegacyUAEcommerceEvent.js +0 -14
  222. package/dist/src/application/models/guards/isMobilePLPChatPlacementParameter.js +0 -4
  223. package/dist/src/application/models/guards/isSpanxTakeAQuizCtaParameter.js +0 -1
  224. package/dist/src/application/models/guards/isVariantInfo.js +0 -28
  225. package/dist/src/application/models/guards/utils.js +0 -34
  226. package/dist/src/application/models/index.js +0 -34
  227. package/dist/src/application/models/utils/snakeToCamelTransformer.js +0 -71
  228. package/dist/src/application/models/utils/stringToFulfillmentDisplayStatusEnumValue.js +0 -65
  229. package/dist/src/application/models/validators/validateGraphQLColorsConfig.js +0 -9
  230. package/dist/src/application/models/validators/validateGraphQLFrontendConfig.js +0 -420
  231. package/dist/src/application/models/validators/validateGraphQLOrgId.js +0 -6
  232. package/dist/src/application/models/validators/validateMobilePLPChatPlacementParameter.js +0 -9
  233. package/dist/src/application/models/validators/validateOrgConfigResults.js +0 -44
  234. package/dist/src/application/models/validators/validateOrganizationConfig.js +0 -34
  235. package/dist/src/application/models/validators/validateResponse.js +0 -173
  236. package/dist/src/application/models/validators/validateSuggestion.js +0 -13
  237. package/dist/src/application/models/validators/validateUserEvent.js +0 -91
  238. package/dist/src/application/utils/analyticsUtils.js +0 -94
  239. package/dist/src/application/utils/coreContextToApiContext.js +0 -8
  240. package/dist/src/application/utils/coreUserEventToApiUserEvent.js +0 -90
  241. package/dist/src/application/utils/divideArray.js +0 -7
  242. package/dist/src/application/utils/domObserver.js +0 -85
  243. package/dist/src/application/utils/elementObserver.js +0 -186
  244. package/dist/src/application/utils/imageFilter.js +0 -11
  245. package/dist/src/application/utils/index.js +0 -21
  246. package/dist/src/application/utils/merchantUtils.js +0 -15
  247. package/dist/src/application/utils/messageFromFormSubmittedEvent.js +0 -19
  248. package/dist/src/application/utils/messageFromQueryEvent.js +0 -35
  249. package/dist/src/application/utils/messageFromResponse.js +0 -123
  250. package/dist/src/application/utils/messageFromSuggestionEvent.js +0 -27
  251. package/dist/src/application/utils/mouseEventTypes.js +0 -1
  252. package/dist/src/application/utils/mutationHelper.js +0 -33
  253. package/dist/src/application/utils/nextMessageRequestToApiRequest.js +0 -29
  254. package/dist/src/application/utils/nodeSelector.js +0 -101
  255. package/dist/src/application/utils/overrides.js +0 -144
  256. package/dist/src/application/utils/stringUtils.js +0 -47
  257. package/dist/src/application/utils/supportedEventRequestToApiRequest.js +0 -7
  258. package/dist/src/application/utils/urlsParser.js +0 -33
  259. package/dist/src/application/utils/validation.js +0 -5
  260. package/dist/src/atoms/amplitude/amplitudeTrackEventAtom.js +0 -4
  261. package/dist/src/atoms/app/index.js +0 -23
  262. package/dist/src/atoms/app/variant.js +0 -102
  263. package/dist/src/atoms/atomStore/atomStore.js +0 -28
  264. package/dist/src/atoms/atomStore/index.js +0 -1
  265. package/dist/src/atoms/chat/chatState.js +0 -33
  266. package/dist/src/atoms/chat/form.js +0 -16
  267. package/dist/src/atoms/chat/index.js +0 -23
  268. package/dist/src/atoms/chat/lastMessage.js +0 -10
  269. package/dist/src/atoms/chat/messageQueue.js +0 -68
  270. package/dist/src/atoms/chat/performanceMetrics.js +0 -70
  271. package/dist/src/atoms/chat/renderedWidgetRefs.js +0 -24
  272. package/dist/src/atoms/chat/replies.js +0 -43
  273. package/dist/src/atoms/chat/suggestions.js +0 -29
  274. package/dist/src/atoms/envive/enviveConfig.js +0 -67
  275. package/dist/src/atoms/globalSearch/globalSearch.js +0 -8
  276. package/dist/src/atoms/globalSearch/index.js +0 -1
  277. package/dist/src/atoms/org/customerService.js +0 -6
  278. package/dist/src/atoms/org/graphqlConfig.js +0 -8
  279. package/dist/src/atoms/org/index.js +0 -4
  280. package/dist/src/atoms/org/newOrgConfigAtom.js +0 -2
  281. package/dist/src/atoms/org/orgAnalyticsConfig.js +0 -8
  282. package/dist/src/atoms/search/index.js +0 -1
  283. package/dist/src/atoms/search/productFilters.js +0 -163
  284. package/dist/src/atoms/search/productRetrievalAPI.js +0 -50
  285. package/dist/src/atoms/search/productRetrievalAdapter.js +0 -14
  286. package/dist/src/atoms/search/productSorter.js +0 -13
  287. package/dist/src/atoms/search/searchAPI.js +0 -140
  288. package/dist/src/atoms/search/searchServiceAdapter.js +0 -14
  289. package/dist/src/atoms/search/utils.js +0 -15
  290. package/dist/src/config/index.js +0 -1
  291. package/dist/src/config/locators/components/chat/entrypoints.js +0 -10
  292. package/dist/src/config/locators/components/chat/index.js +0 -21
  293. package/dist/src/config/locators/components/chat/preview.js +0 -11
  294. package/dist/src/config/locators/components/chat/variants/index.js +0 -12
  295. package/dist/src/config/locators/components/common/buttons.js +0 -6
  296. package/dist/src/config/locators/components/common/cards.js +0 -17
  297. package/dist/src/config/locators/components/common/index.js +0 -4
  298. package/dist/src/config/locators/components/common/links.js +0 -1
  299. package/dist/src/config/locators/components/common/tables.js +0 -1
  300. package/dist/src/config/locators/components/floating-button.js +0 -2
  301. package/dist/src/config/locators/components/index.js +0 -3
  302. package/dist/src/config/locators/components/report-issue.js +0 -13
  303. package/dist/src/config/locators/components/search/index.js +0 -5
  304. package/dist/src/config/locators/components/shadow-dom.js +0 -1
  305. package/dist/src/config/locators/embedded.js +0 -20
  306. package/dist/src/config/locators/index.js +0 -4
  307. package/dist/src/contexts/amplitudeContext/amplitudeContext.js +0 -292
  308. package/dist/src/contexts/amplitudeContext/index.js +0 -1
  309. package/dist/src/contexts/cdnContext/cdnContext.js +0 -28
  310. package/dist/src/contexts/cdnContext/index.js +0 -1
  311. package/dist/src/contexts/enviveConfigContext/enviveConfigContext.js +0 -37
  312. package/dist/src/contexts/enviveConfigContext/index.js +0 -1
  313. package/dist/src/contexts/enviveCssContext/enviveCssContext.js +0 -31
  314. package/dist/src/contexts/enviveCssContext/index.js +0 -1
  315. package/dist/src/contexts/featureFlagContext/featureFlagContext.js +0 -109
  316. package/dist/src/contexts/featureFlagContext/index.js +0 -1
  317. package/dist/src/contexts/featureFlagServiceContext/featureFlagServiceContext.js +0 -47
  318. package/dist/src/contexts/featureFlagServiceContext/index.js +0 -1
  319. package/dist/src/contexts/graphqlContext/graphqlContext.js +0 -87
  320. package/dist/src/contexts/graphqlContext/index.js +0 -1
  321. package/dist/src/contexts/localStorageContext/index.js +0 -1
  322. package/dist/src/contexts/localStorageContext/localStorageContext.js +0 -95
  323. package/dist/src/contexts/newOrgConfigContext/index.js +0 -1
  324. package/dist/src/contexts/newOrgConfigContext/newOrgConfigContext.js +0 -33
  325. package/dist/src/contexts/searchContext/index.js +0 -1
  326. package/dist/src/contexts/searchContext/searchContext.js +0 -131
  327. package/dist/src/contexts/sessionStorageContext/index.js +0 -1
  328. package/dist/src/contexts/sessionStorageContext/sessionStorageContext.js +0 -43
  329. package/dist/src/contexts/shopifyUrlContext/index.js +0 -1
  330. package/dist/src/contexts/shopifyUrlContext/shopifyUrlContext.js +0 -62
  331. package/dist/src/contexts/systemSettingsContext/index.js +0 -1
  332. package/dist/src/contexts/systemSettingsContext/systemSettingsContext.js +0 -29
  333. package/dist/src/contexts/userIdentityContext/index.js +0 -1
  334. package/dist/src/contexts/userIdentityContext/userIdentityContext.js +0 -118
  335. package/dist/src/events/index.js +0 -51
  336. package/dist/src/events/registerAnalyticsListeners.js +0 -32
  337. package/dist/src/exceptions/index.js +0 -2
  338. package/dist/src/exceptions/sessionExceptions.js +0 -6
  339. package/dist/src/exceptions/unsupportedProductExceptions.js +0 -6
  340. package/dist/src/hooks/AmplitudeOperations/index.js +0 -1
  341. package/dist/src/hooks/AmplitudeOperations/useAmplitudeOperations.js +0 -24
  342. package/dist/src/hooks/AppDetails/index.js +0 -1
  343. package/dist/src/hooks/AppDetails/useAppDetails.js +0 -26
  344. package/dist/src/hooks/BlockBackButton/index.js +0 -1
  345. package/dist/src/hooks/BlockBackButton/useBlockBackButton.js +0 -23
  346. package/dist/src/hooks/CdnOperations/index.js +0 -1
  347. package/dist/src/hooks/CdnOperations/useCdnOperations.js +0 -13
  348. package/dist/src/hooks/ChatToggle/index.js +0 -1
  349. package/dist/src/hooks/ChatToggle/useChatToggle.js +0 -50
  350. package/dist/src/hooks/ChatToggleAnalytics/index.js +0 -1
  351. package/dist/src/hooks/ChatToggleAnalytics/useChatToggleAnalytics.js +0 -11
  352. package/dist/src/hooks/CustomerSupportHandoff/index.js +0 -1
  353. package/dist/src/hooks/CustomerSupportHandoff/useCustomerSupportHandoff.js +0 -32
  354. package/dist/src/hooks/Debounce/index.js +0 -1
  355. package/dist/src/hooks/Debounce/useDebounce.js +0 -13
  356. package/dist/src/hooks/ElementObserver/index.js +0 -1
  357. package/dist/src/hooks/ElementObserver/useElementObserver.js +0 -208
  358. package/dist/src/hooks/GrabAndScroll/index.js +0 -1
  359. package/dist/src/hooks/GrabAndScroll/useGrabAndScroll.js +0 -105
  360. package/dist/src/hooks/GraphQLConfig/index.js +0 -1
  361. package/dist/src/hooks/GraphQLConfig/useGraphQLConfig.js +0 -54
  362. package/dist/src/hooks/IdentifyUser/index.js +0 -1
  363. package/dist/src/hooks/IdentifyUser/useIdentifyUser.js +0 -28
  364. package/dist/src/hooks/ImageResolver/index.js +0 -1
  365. package/dist/src/hooks/ImageResolver/useImageResolver.js +0 -45
  366. package/dist/src/hooks/Intersection/index.js +0 -1
  367. package/dist/src/hooks/Intersection/useIntersection.js +0 -20
  368. package/dist/src/hooks/IsSmallScreen/index.js +0 -1
  369. package/dist/src/hooks/IsSmallScreen/useIsSmallScreen.js +0 -16
  370. package/dist/src/hooks/LocalStorageOperations/index.js +0 -1
  371. package/dist/src/hooks/LocalStorageOperations/useLocalStorageOperations.js +0 -64
  372. package/dist/src/hooks/MessageFilter/index.js +0 -1
  373. package/dist/src/hooks/MessageFilter/useMessageFilter.js +0 -37
  374. package/dist/src/hooks/MessageScrollObserver/index.js +0 -1
  375. package/dist/src/hooks/MessageScrollObserver/useMessageScrollObserver.js +0 -35
  376. package/dist/src/hooks/NewOrgConfig/index.js +0 -1
  377. package/dist/src/hooks/NewOrgConfig/useNewOrgConfig.js +0 -5
  378. package/dist/src/hooks/Search/index.js +0 -1
  379. package/dist/src/hooks/Search/useRecommendedProducts.js +0 -35
  380. package/dist/src/hooks/Search/useSearch.js +0 -224
  381. package/dist/src/hooks/Search/useSearchInput.js +0 -183
  382. package/dist/src/hooks/SearchOperations/index.js +0 -1
  383. package/dist/src/hooks/SearchOperations/useSearchOperations.js +0 -78
  384. package/dist/src/hooks/SessionStorageOperations/index.js +0 -1
  385. package/dist/src/hooks/SessionStorageOperations/useSessionStorageOperations.js +0 -20
  386. package/dist/src/hooks/ShopifyUrlOperations/index.js +0 -1
  387. package/dist/src/hooks/ShopifyUrlOperations/useShopifyUrlOperations.js +0 -34
  388. package/dist/src/hooks/SnapCalculator/index.js +0 -1
  389. package/dist/src/hooks/SnapCalculator/useSnapCalculator.js +0 -22
  390. package/dist/src/hooks/SystemSettingsContext/index.js +0 -1
  391. package/dist/src/hooks/SystemSettingsContext/useSystemSettingsContext.js +0 -9
  392. package/dist/src/hooks/TrackComponentVisibleEvent/index.js +0 -1
  393. package/dist/src/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.js +0 -45
  394. package/dist/src/hooks/UpdateAnalyticsProps/index.js +0 -1
  395. package/dist/src/hooks/UpdateAnalyticsProps/useUpdateAnalyticsProps.js +0 -43
  396. package/dist/src/hooks/utils.js +0 -116
  397. package/dist/src/interceptors/index.js +0 -1
  398. package/dist/src/interceptors/useMessageInterceptor.js +0 -24
  399. package/dist/src/types/ApiResponse.js +0 -1
  400. package/dist/src/types/FilterAttribute.js +0 -3
  401. package/dist/src/types/Message.js +0 -24
  402. package/dist/src/types/Suggestion.js +0 -3
  403. package/dist/src/types/index.js +0 -4
  404. package/dist/src/util/colorVar.js +0 -3
  405. package/dist/src/util/configVersion.js +0 -4
  406. package/dist/src/util/domInsertion.js +0 -16
  407. /package/dist/{featureFlagServiceContext-bI7ZLz4r.js → featureFlagServiceContext-CbUOAw5l.js} +0 -0
  408. /package/dist/{featureFlagServiceContext-B4ash4vz.cjs → featureFlagServiceContext-DSo2brno.cjs} +0 -0
@@ -1,420 +0,0 @@
1
- import { DOMInsertionType, GridInsertionType, PageVariantTestType, } from '@envive-ai/types';
2
- import Logger from 'src/application/logging/logger';
3
- import { transformSnakeToCamel } from '../utils/snakeToCamelTransformer';
4
- // Helper function to validate and transform PageVariantQueryData to PageVariantConfig
5
- export const validateAndTransformPageVariants = (config) => {
6
- const transformed = transformSnakeToCamel(config);
7
- const { variantChecks, widgetMounting, ...rest } = transformed;
8
- // Convert variantChecks to variantTests with testType normalization
9
- const variantTests = Array.isArray(variantChecks)
10
- ? variantChecks.map(({ checkType, ...restCheck }) => ({
11
- ...restCheck,
12
- testType: checkType,
13
- }))
14
- : [];
15
- // Normalize widgetMounting: checks -> tests, checkType -> testType
16
- const normalizedWidgetMounting = Array.isArray(widgetMounting)
17
- ? widgetMounting.map(({ mountingPointWidgets, ...restMounting }) => ({
18
- ...restMounting,
19
- ...(Array.isArray(mountingPointWidgets)
20
- ? {
21
- mountingPointWidgets: mountingPointWidgets.map(({ checks, ...restWidget }) => ({
22
- ...restWidget,
23
- tests: Array.isArray(checks)
24
- ? checks.map(({ checkType, ...restCheck }) => ({
25
- ...restCheck,
26
- testType: checkType,
27
- }))
28
- : [],
29
- })),
30
- }
31
- : {}),
32
- }))
33
- : [];
34
- const normalizedConfig = {
35
- ...rest,
36
- ...(variantTests ? { variantTests } : {}),
37
- ...(normalizedWidgetMounting ? { widgetMounting: normalizedWidgetMounting } : {}),
38
- };
39
- const variantId = normalizedConfig.variantId;
40
- const variantType = normalizedConfig.variantType;
41
- if (typeof variantId !== 'string' || !variantId) {
42
- throw new Error(`Missing or invalid variantId for pageVariant`);
43
- }
44
- if (typeof variantType !== 'string' || !variantType) {
45
- throw new Error(`Missing or invalid variantType for pageVariant '${variantId}'`);
46
- }
47
- if (!Array.isArray(variantTests)) {
48
- throw new Error(`Missing or invalid variantTests for pageVariant '${variantId}'. Must be an array`);
49
- }
50
- for (const test of variantTests) {
51
- if (!test.testType || typeof test.testType !== 'string') {
52
- throw new Error(`Invalid variantTest.testType for pageVariant '${variantId}'`);
53
- }
54
- if (!Object.values(PageVariantTestType).includes(test.testType)) {
55
- throw new Error(`Invalid testType '${test.testType}' for pageVariant '${variantId}'. Valid types: ${Object.values(PageVariantTestType).join(', ')}`);
56
- }
57
- }
58
- if (!Array.isArray(normalizedWidgetMounting)) {
59
- throw new Error(`Missing or invalid widgetMounting for pageVariant '${variantId}'. Must be an array`);
60
- }
61
- for (const mounting of normalizedWidgetMounting) {
62
- if (typeof mounting.mountingConfigId !== 'string' || !mounting.mountingConfigId) {
63
- throw new Error(`Invalid mountingConfigId in widgetMounting for pageVariant '${variantId}'`);
64
- }
65
- if (mounting.widgetConfigId && typeof mounting.widgetConfigId !== 'string') {
66
- throw new Error(`Invalid widgetConfigId in widgetMounting for pageVariant '${variantId}'`);
67
- }
68
- if (mounting.mountingPointWidgets) {
69
- for (const widget of mounting.mountingPointWidgets) {
70
- if (typeof widget.widgetConfigId !== 'string' || !widget.widgetConfigId) {
71
- throw new Error(`Invalid widgetConfigId in mountingPointWidgets for pageVariant '${variantId}'`);
72
- }
73
- if (!Array.isArray(widget.tests)) {
74
- throw new Error(`Invalid or missing tests in mountingPointWidgets for pageVariant '${variantId}'`);
75
- }
76
- }
77
- }
78
- }
79
- if (variantType === 'plp') {
80
- if (typeof normalizedConfig.plpIdExtractor !== 'string' || !normalizedConfig.plpIdExtractor) {
81
- throw new Error(`Missing or invalid plpIdExtractor for PLP pageVariant '${variantId}'`);
82
- }
83
- }
84
- if (variantType === 'pdp') {
85
- if (typeof normalizedConfig.productIdExtractor !== 'string' ||
86
- !normalizedConfig.productIdExtractor) {
87
- throw new Error(`Missing or invalid productIdExtractor for PDP pageVariant '${variantId}'`);
88
- }
89
- if (normalizedConfig.parentProductIdExtractor &&
90
- typeof normalizedConfig.parentProductIdExtractor !== 'string') {
91
- throw new Error(`Invalid parentProductIdExtractor for PDP pageVariant '${variantId}'. Must be string if provided`);
92
- }
93
- }
94
- return normalizedConfig;
95
- };
96
- // Helper function to validate and transform MountingConfigQueryData to WidgetMountingConfig
97
- export const validateAndTransformMountingConfig = (config, configKey) => {
98
- // RENAMING LOGIC: Convert backend "Check" terminology to frontend "Test" terminology
99
- const normalizedConfig = { ...config };
100
- // Convert checkId to testId for frontend compatibility (data is already camelCase)
101
- if (normalizedConfig.checkId && !normalizedConfig.testId) {
102
- normalizedConfig.testId = normalizedConfig.checkId;
103
- delete normalizedConfig.checkId;
104
- }
105
- // Required fields - these must be present and valid
106
- if (typeof normalizedConfig.mountingConfigId !== 'string' || !normalizedConfig.mountingConfigId) {
107
- throw new Error(`Missing or invalid mountingConfigId for config '${configKey}'`);
108
- }
109
- if (typeof normalizedConfig.containerId !== 'string' || !normalizedConfig.containerId) {
110
- throw new Error(`Missing or invalid containerId for config '${configKey}'`);
111
- }
112
- if (typeof normalizedConfig.testId !== 'string' || !normalizedConfig.testId) {
113
- throw new Error(`Missing or invalid testId for config '${configKey}'`);
114
- }
115
- // Required insertionPoint
116
- if (!normalizedConfig.insertionPoint ||
117
- typeof normalizedConfig.insertionPoint !== 'object' ||
118
- Array.isArray(normalizedConfig.insertionPoint)) {
119
- throw new Error(`Missing or invalid insertionPoint for config '${configKey}'`);
120
- }
121
- const insertionPoint = normalizedConfig.insertionPoint;
122
- // Validate insertionPoint required fields
123
- if (typeof insertionPoint.selector !== 'string' || !insertionPoint.selector) {
124
- throw new Error(`Missing or invalid insertionPoint.selector for config '${configKey}'`);
125
- }
126
- if (typeof insertionPoint.insertionType !== 'string' || !insertionPoint.insertionType) {
127
- throw new Error(`Missing or invalid insertionPoint.insertionType for config '${configKey}'`);
128
- }
129
- // Validate insertionType is a valid DOMInsertionType
130
- if (!Object.values(DOMInsertionType).includes(insertionPoint.insertionType)) {
131
- throw new Error(`Invalid insertionPoint.insertionType '${insertionPoint.insertionType}' for config '${configKey}'. Valid types: ${Object.values(DOMInsertionType).join(', ')}`);
132
- }
133
- // Validate optional insertionPoint fields
134
- if (insertionPoint.selectionIndex != null && typeof insertionPoint.selectionIndex !== 'number') {
135
- throw new Error(`Invalid insertionPoint.selectionIndex for config '${configKey}'. Must be a number or null/undefined`);
136
- }
137
- // Validate optional parentInsertionPoint if present
138
- let parentInsertionPoint;
139
- if (normalizedConfig.parentInsertionPoint) {
140
- if (typeof normalizedConfig.parentInsertionPoint !== 'object' ||
141
- Array.isArray(normalizedConfig.parentInsertionPoint)) {
142
- throw new Error(`Invalid parentInsertionPoint for config '${configKey}'. Must be an object`);
143
- }
144
- const parentPoint = normalizedConfig.parentInsertionPoint;
145
- if (typeof parentPoint.selector !== 'string' || !parentPoint.selector) {
146
- throw new Error(`Missing or invalid parentInsertionPoint.selector for config '${configKey}'`);
147
- }
148
- if (typeof parentPoint.insertionType !== 'string' || !parentPoint.insertionType) {
149
- throw new Error(`Missing or invalid parentInsertionPoint.insertionType for config '${configKey}'`);
150
- }
151
- if (!Object.values(DOMInsertionType).includes(parentPoint.insertionType)) {
152
- throw new Error(`Invalid parentInsertionPoint.insertionType '${parentPoint.insertionType}' for config '${configKey}'. Valid types: ${Object.values(DOMInsertionType).join(', ')}`);
153
- }
154
- if (parentPoint.selectionIndex != null && typeof parentPoint.selectionIndex !== 'number') {
155
- throw new Error(`Invalid parentInsertionPoint.selectionIndex for config '${configKey}'. Must be a number or null/undefined`);
156
- }
157
- parentInsertionPoint = {
158
- selector: parentPoint.selector,
159
- insertionType: parentPoint.insertionType,
160
- selectionIndex: parentPoint.selectionIndex,
161
- };
162
- }
163
- // Validate optional wrappingElement if present
164
- let wrappingElement;
165
- if (normalizedConfig.wrappingElement) {
166
- if (typeof normalizedConfig.wrappingElement !== 'object' ||
167
- Array.isArray(normalizedConfig.wrappingElement)) {
168
- throw new Error(`Invalid wrappingElement for config '${configKey}'. Must be an object`);
169
- }
170
- const wrapping = normalizedConfig.wrappingElement;
171
- if (typeof wrapping.className !== 'string' || !wrapping.className) {
172
- throw new Error(`Missing or invalid wrappingElement.className for config '${configKey}'`);
173
- }
174
- if (typeof wrapping.element !== 'string' || !wrapping.element) {
175
- throw new Error(`Missing or invalid wrappingElement.element for config '${configKey}'`);
176
- }
177
- if (typeof wrapping.insertionType !== 'string' || !wrapping.insertionType) {
178
- throw new Error(`Missing or invalid wrappingElement.insertionType for config '${configKey}'`);
179
- }
180
- if (!Object.values(DOMInsertionType).includes(wrapping.insertionType)) {
181
- throw new Error(`Invalid wrappingElement.insertionType '${wrapping.insertionType}' for config '${configKey}'. Valid types: ${Object.values(DOMInsertionType).join(', ')}`);
182
- }
183
- wrappingElement = {
184
- className: wrapping.className,
185
- element: wrapping.element,
186
- insertionType: wrapping.insertionType,
187
- };
188
- }
189
- // Validate optional fields
190
- if (normalizedConfig.divCheckSelector != null &&
191
- typeof normalizedConfig.divCheckSelector !== 'string') {
192
- throw new Error(`Invalid divCheckSelector for config '${configKey}'. Must be a string or null/undefined`);
193
- }
194
- if (normalizedConfig.className != null && typeof normalizedConfig.className !== 'string') {
195
- throw new Error(`Invalid className for config '${configKey}'. Must be a string or null/undefined`);
196
- }
197
- if (normalizedConfig.suppressionSelector != null &&
198
- typeof normalizedConfig.suppressionSelector !== 'string') {
199
- throw new Error(`Invalid suppressionSelector for config '${configKey}'. Must be a string or null/undefined`);
200
- }
201
- if (normalizedConfig.dataAttributes != null &&
202
- (typeof normalizedConfig.dataAttributes !== 'object' ||
203
- Array.isArray(normalizedConfig.dataAttributes))) {
204
- throw new Error(`Invalid dataAttributes for config '${configKey}'. Must be an object or null/undefined`);
205
- }
206
- if (normalizedConfig.style != null &&
207
- (typeof normalizedConfig.style !== 'object' || Array.isArray(normalizedConfig.style))) {
208
- throw new Error(`Invalid style for config '${configKey}'. Must be an object or null/undefined`);
209
- }
210
- // Validate gridInsertionType if present
211
- let gridInsertionType;
212
- if (normalizedConfig.gridInsertionType) {
213
- if (typeof normalizedConfig.gridInsertionType !== 'string' ||
214
- !normalizedConfig.gridInsertionType) {
215
- throw new Error(`Invalid gridInsertionType for config '${configKey}'. Must be a string`);
216
- }
217
- if (!Object.values(GridInsertionType).includes(normalizedConfig.gridInsertionType)) {
218
- throw new Error(`Invalid gridInsertionType '${normalizedConfig.gridInsertionType}' for config '${configKey}'. Valid types: ${Object.values(GridInsertionType).join(', ')}`);
219
- }
220
- gridInsertionType = normalizedConfig.gridInsertionType;
221
- }
222
- // Build the return object, only including optional fields if they have values
223
- const result = {
224
- mountingConfigId: normalizedConfig.mountingConfigId,
225
- containerId: normalizedConfig.containerId,
226
- testId: normalizedConfig.testId,
227
- insertionPoint: {
228
- selector: insertionPoint.selector,
229
- insertionType: insertionPoint.insertionType,
230
- ...(insertionPoint.selectionIndex != null && {
231
- selectionIndex: insertionPoint.selectionIndex,
232
- }),
233
- },
234
- };
235
- // Only add optional fields if they have values
236
- if (parentInsertionPoint) {
237
- result.parentInsertionPoint = parentInsertionPoint;
238
- }
239
- if (gridInsertionType) {
240
- result.gridInsertionType = gridInsertionType;
241
- }
242
- if (wrappingElement) {
243
- result.wrappingElement = wrappingElement;
244
- }
245
- if (normalizedConfig.divCheckSelector) {
246
- result.divCheckSelector = normalizedConfig.divCheckSelector;
247
- }
248
- if (normalizedConfig.className) {
249
- result.className = normalizedConfig.className;
250
- }
251
- if (normalizedConfig.suppressionSelector) {
252
- result.suppressionSelector = normalizedConfig.suppressionSelector;
253
- }
254
- if (normalizedConfig.dataAttributes) {
255
- result.dataAttributes = normalizedConfig.dataAttributes;
256
- }
257
- if (normalizedConfig.style) {
258
- result.style = normalizedConfig.style;
259
- }
260
- return result;
261
- };
262
- // Helper function to validate and transform WidgetConfigQueryData to WidgetConfig
263
- export const validateAndTransformWidgetConfig = (config, configKey) => {
264
- const normalizedConfig = transformSnakeToCamel(config);
265
- if (typeof normalizedConfig.widgetConfigId !== 'string' || !normalizedConfig.widgetConfigId) {
266
- throw new Error(`Missing or invalid widgetConfigId for widget config '${configKey}'`);
267
- }
268
- if (typeof normalizedConfig.type !== 'string' || !normalizedConfig.type) {
269
- throw new Error(`Missing or invalid type for widget config '${configKey}'`);
270
- }
271
- if (normalizedConfig.contentId != null && typeof normalizedConfig.contentId !== 'string') {
272
- throw new Error(`Invalid contentId for widget config '${configKey}'. Must be a string or null/undefined`);
273
- }
274
- // Note: Widget configs are complex unions with type-specific properties.
275
- // Return the normalized config as WidgetConfig
276
- // Use intermediate 'unknown' cast for complex union types
277
- return normalizedConfig;
278
- };
279
- export const validateGraphQLFrontendConfig = (data) => {
280
- if (data === null || data === undefined) {
281
- return undefined;
282
- }
283
- if (typeof data !== 'object' || Array.isArray(data)) {
284
- Logger.logWarn('Invalid GraphQL frontend config data: not an object', undefined, { data });
285
- return undefined;
286
- }
287
- const obj = data;
288
- // Validate merchant_override_css if present
289
- if ('merchant_override_css' in obj &&
290
- typeof obj.merchant_override_css !== 'string' &&
291
- obj.merchant_override_css !== null) {
292
- Logger.logWarn('Invalid GraphQL frontend config data: merchant_override_css must be a string or null', undefined, { data });
293
- return undefined;
294
- }
295
- // Validate page_variants if present
296
- if ('page_variants' in obj) {
297
- if (obj.page_variants !== undefined &&
298
- obj.page_variants !== null &&
299
- !Array.isArray(obj.page_variants)) {
300
- Logger.logWarn('Invalid GraphQL frontend config data: page_variants must be an array or null/undefined', undefined, { data });
301
- return undefined;
302
- }
303
- }
304
- // Validate mounting_configs if present
305
- if ('mounting_configs' in obj) {
306
- if (obj.mounting_configs !== undefined &&
307
- obj.mounting_configs !== null &&
308
- !Array.isArray(obj.mounting_configs)) {
309
- Logger.logWarn('Invalid GraphQL frontend config data: mounting_configs must be an array or null/undefined', undefined, { data });
310
- return undefined;
311
- }
312
- }
313
- // Validate widget_configs if present
314
- if ('widget_configs' in obj) {
315
- if (obj.widget_configs !== undefined &&
316
- obj.widget_configs !== null &&
317
- !Array.isArray(obj.widget_configs)) {
318
- Logger.logWarn('Invalid GraphQL frontend config data: widget_configs must be an array or null/undefined', undefined, { data });
319
- return undefined;
320
- }
321
- }
322
- // Validate ui_configs if present
323
- if ('ui_configs' in obj && typeof obj.ui_configs !== 'object' && obj.ui_configs !== null) {
324
- Logger.logWarn('Invalid GraphQL frontend config data: ui_configs must be an object or null/undefined', undefined, { data });
325
- return undefined;
326
- }
327
- try {
328
- // Transform the data to camelCase
329
- const transformedData = transformSnakeToCamel(obj);
330
- // Convert page_variants from array to validated array if present
331
- if (transformedData.pageVariants && Array.isArray(transformedData.pageVariants)) {
332
- const pageVariantsArray = transformedData.pageVariants;
333
- const validatedPageVariants = [];
334
- for (const variant of pageVariantsArray) {
335
- if (variant && typeof variant === 'object' && typeof variant.variantId === 'string') {
336
- try {
337
- const validatedVariant = validateAndTransformPageVariants(variant);
338
- validatedPageVariants.push(validatedVariant);
339
- }
340
- catch (error) {
341
- Logger.logWarn('Invalid page variant, skipping', error, {
342
- variantId: variant.variantId,
343
- variant,
344
- });
345
- // Continue processing other variants
346
- }
347
- }
348
- else {
349
- Logger.logWarn('Invalid page variant structure, skipping', undefined, { variant });
350
- }
351
- }
352
- transformedData.pageVariants = validatedPageVariants;
353
- }
354
- // Convert mounting_configs from array to Record if present
355
- if (transformedData.mountingConfigs && Array.isArray(transformedData.mountingConfigs)) {
356
- const mountingConfigsArray = transformedData.mountingConfigs;
357
- const mountingConfigsRecord = {};
358
- for (const item of mountingConfigsArray) {
359
- if (item &&
360
- typeof item.key === 'string' &&
361
- item.config &&
362
- typeof item.config === 'object') {
363
- try {
364
- // Validate and transform the config structure
365
- const config = item.config;
366
- const validatedConfig = validateAndTransformMountingConfig(config, item.key);
367
- mountingConfigsRecord[item.key] = validatedConfig;
368
- }
369
- catch (error) {
370
- Logger.logWarn('Invalid mounting config, skipping', error, {
371
- configKey: item.key,
372
- config: item.config,
373
- });
374
- // Continue processing other configs
375
- }
376
- }
377
- else {
378
- Logger.logWarn('Invalid mounting config item structure, skipping', undefined, { item });
379
- }
380
- }
381
- transformedData.mountingConfigs = mountingConfigsRecord;
382
- }
383
- // Convert widget_configs from array to Record if present
384
- if (transformedData.widgetConfigs && Array.isArray(transformedData.widgetConfigs)) {
385
- const widgetConfigsArray = transformedData.widgetConfigs;
386
- const widgetConfigsRecord = {};
387
- for (const item of widgetConfigsArray) {
388
- if (item &&
389
- typeof item.key === 'string' &&
390
- item.config &&
391
- typeof item.config === 'object') {
392
- try {
393
- // Validate and transform widget config using the dedicated validation function
394
- const config = item.config;
395
- const validatedConfig = validateAndTransformWidgetConfig(config, item.key);
396
- widgetConfigsRecord[item.key] = validatedConfig;
397
- }
398
- catch (error) {
399
- Logger.logWarn('Invalid widget config, skipping', error, {
400
- configKey: item.key,
401
- config: item.config,
402
- });
403
- // Continue processing other configs
404
- }
405
- }
406
- else {
407
- Logger.logWarn('Invalid widget config item structure, skipping', undefined, { item });
408
- }
409
- }
410
- transformedData.widgetConfigs = widgetConfigsRecord;
411
- }
412
- return transformedData;
413
- }
414
- catch (error) {
415
- Logger.logWarn('Failed to validate and transform GraphQL frontend config data', error, {
416
- data,
417
- });
418
- return undefined;
419
- }
420
- };
@@ -1,6 +0,0 @@
1
- export const validateGraphQLOrgId = (data) => {
2
- if (typeof data !== 'string' || data === '') {
3
- return undefined;
4
- }
5
- return data;
6
- };
@@ -1,9 +0,0 @@
1
- import { isMobilePLPChatPlacementParameter } from '../guards/isMobilePLPChatPlacementParameter';
2
- export const validateMobilePLPChatPlacementParameter = (value) => {
3
- if (!isMobilePLPChatPlacementParameter(value)) {
4
- return undefined;
5
- }
6
- return {
7
- row_index: value.row_index,
8
- };
9
- };
@@ -1,44 +0,0 @@
1
- import { isApiOrgConfigResults } from "../guards/api/isApiOrgConfigResults";
2
- import { validateOrganizationConfig } from "./validateOrganizationConfig";
3
- /**
4
- *
5
- * @param data
6
- * @returns
7
- */
8
- export const validateOrgConfigResults = (data) => {
9
- var _a, _b;
10
- if (!isApiOrgConfigResults(data)) {
11
- return undefined;
12
- }
13
- return {
14
- configs: data.configs
15
- .map((config) => validateOrganizationConfig(config))
16
- .filter((config) => config != null),
17
- experiments: data.experiments.map((experiment) => ({
18
- group: experiment.group,
19
- groupName: experiment.group_name,
20
- name: experiment.name,
21
- ruleId: experiment.rule_id,
22
- // TODO this needs to be strongly typed but we're not running any experiments at the moment
23
- value: experiment.value,
24
- })),
25
- gates: data.gates.map((gate) => ({
26
- groupName: gate.group_name,
27
- name: gate.name,
28
- ruleId: gate.rule_id,
29
- value: gate.value,
30
- })),
31
- org: {
32
- org: {
33
- id: data.org.org.id,
34
- displayName: data.org.org.display_name,
35
- domain: data.org.org.domain,
36
- shortName: data.org.org.short_name,
37
- status: data.org.org.status,
38
- createdAt: (_a = data.org.org.created_at) === null || _a === void 0 ? void 0 : _a.toISOString(),
39
- updatedAt: (_b = data.org.org.updated_at) === null || _b === void 0 ? void 0 : _b.toISOString(),
40
- },
41
- settings: {},
42
- },
43
- };
44
- };
@@ -1,34 +0,0 @@
1
- import { isApiOrganizationConfig } from "../guards/api/isApiOrganizationConfig.js";
2
- export const validateOrganizationConfig = (data) => {
3
- if (!isApiOrganizationConfig(data)) {
4
- return undefined;
5
- }
6
- return {
7
- id: data.id,
8
- createdAt: data.createdAt,
9
- namespace: data.namespace,
10
- organizationId: data.organizationId,
11
- isLatest: data.isLatest,
12
- version: data.version,
13
- updatedAt: data.updatedAt,
14
- config: {
15
- amplitude: data.config.amplitude
16
- ? {
17
- sessionReplayEnabled: data.config.amplitude.session_replay_enabled,
18
- sessionReplaySampleRate: data.config.amplitude.session_replay_sample_rate,
19
- trackingEnabled: data.config.amplitude.tracking_enabled,
20
- }
21
- : undefined,
22
- customerService: data.config.customer_service
23
- ? {
24
- provider: data.config.customer_service.provider,
25
- }
26
- : undefined,
27
- googleAnalytics: data.config.google_analytics
28
- ? {
29
- measurementId: data.config.google_analytics.measurement_id,
30
- }
31
- : undefined,
32
- },
33
- };
34
- };