@envive-ai/react-hooks 0.2.6-alpha-7 → 0.2.6-alpha-9

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 (412) hide show
  1. package/dist/{AmplitudeOperations-DjqOM3uE.js → AmplitudeOperations-D2r56Ptr.js} +2 -2
  2. package/dist/{AmplitudeOperations-DbUiR0N_.cjs → AmplitudeOperations-SkndCrhj.cjs} +2 -2
  3. package/dist/{NewOrgConfig-C_1T1iOt.js → NewOrgConfig-C9aQqGsb.js} +2 -2
  4. package/dist/{NewOrgConfig-D2Kvqa1z.cjs → NewOrgConfig-CHkHRqHx.cjs} +2 -2
  5. package/dist/{TrackComponentVisibleEvent-BxOhr9Da.js → TrackComponentVisibleEvent-BIGvzk4f.js} +2 -2
  6. package/dist/{TrackComponentVisibleEvent-CDbecFPM.cjs → TrackComponentVisibleEvent-DjZUt7LR.cjs} +2 -2
  7. package/dist/amplitudeContext-B3DsV6IO.cjs +248 -0
  8. package/dist/amplitudeContext-S3JYCxr4.js +232 -0
  9. package/dist/{app-Bs2KxG_8.js → app-BT3g-mDp.js} +5 -5
  10. package/dist/{app-DSnDDqcW.cjs → app-DxwdFQlv.cjs} +5 -5
  11. package/dist/application/utils/index.cjs +4 -4
  12. package/dist/application/utils/index.d.cts +2 -2
  13. package/dist/application/utils/index.js +4 -4
  14. package/dist/{atomStore-CfzCqWB9.js → atomStore-BuopbV9k.js} +1 -1
  15. package/dist/{atomStore-BQVO5haU.cjs → atomStore-CZKe3itM.cjs} +1 -1
  16. package/dist/atoms/app/index.cjs +9 -9
  17. package/dist/atoms/app/index.d.cts +7 -7
  18. package/dist/atoms/app/index.d.ts +7 -7
  19. package/dist/atoms/app/index.js +9 -9
  20. package/dist/atoms/atomStore/index.cjs +1 -1
  21. package/dist/atoms/atomStore/index.d.ts +1 -1
  22. package/dist/atoms/atomStore/index.js +1 -1
  23. package/dist/atoms/chat/index.cjs +10 -10
  24. package/dist/atoms/chat/index.d.cts +32 -32
  25. package/dist/atoms/chat/index.d.ts +32 -32
  26. package/dist/atoms/chat/index.js +10 -10
  27. package/dist/atoms/globalSearch/index.d.cts +6 -6
  28. package/dist/atoms/globalSearch/index.d.ts +6 -6
  29. package/dist/atoms/org/index.cjs +2 -2
  30. package/dist/atoms/org/index.d.cts +15 -15
  31. package/dist/atoms/org/index.d.ts +16 -16
  32. package/dist/atoms/org/index.js +2 -2
  33. package/dist/atoms/search/index.cjs +3 -3
  34. package/dist/atoms/search/index.d.cts +15 -15
  35. package/dist/atoms/search/index.d.ts +14 -14
  36. package/dist/atoms/search/index.js +3 -3
  37. package/dist/atoms/search/utils.d.cts +1 -1
  38. package/dist/cdnContext-i5iYA8ig.cjs +53 -0
  39. package/dist/cdnContext-td-gAam0.js +38 -0
  40. package/dist/{chat-EJbfGWRr.js → chat-ClvJ9xEj.js} +1 -1
  41. package/dist/{chat-CJ9D8n7g.cjs → chat-DCGriB7h.cjs} +1 -1
  42. package/dist/{chat-C5afTKUY.js → chat-ZaY3KY-R.js} +3 -3
  43. package/dist/{chat-CCjM6fS_.cjs → chat-rhEjVfrd.cjs} +3 -3
  44. package/dist/{common-CuwWqIJ1.cjs → common-DQPvV_S_.cjs} +1 -1
  45. package/dist/{common-Df2bwzd2.js → common-c_4eX0qn.js} +1 -1
  46. package/dist/{components-QGCWJ26c.js → components-CDpaMUjK.js} +1 -1
  47. package/dist/{components-BCfFLf9X.cjs → components-DKwVHIjq.cjs} +1 -1
  48. package/dist/config/index.cjs +4 -4
  49. package/dist/config/index.js +4 -4
  50. package/dist/config/locators/components/chat/index.cjs +1 -1
  51. package/dist/config/locators/components/chat/index.js +1 -1
  52. package/dist/config/locators/components/common/index.cjs +1 -1
  53. package/dist/config/locators/components/common/index.js +1 -1
  54. package/dist/config/locators/components/index.cjs +1 -1
  55. package/dist/config/locators/components/index.js +1 -1
  56. package/dist/config/locators/index.cjs +4 -4
  57. package/dist/config/locators/index.js +4 -4
  58. package/dist/contexts/amplitudeContext/index.cjs +12 -12
  59. package/dist/contexts/amplitudeContext/index.d.cts +1 -1
  60. package/dist/contexts/amplitudeContext/index.js +12 -12
  61. package/dist/contexts/cdnContext/index.cjs +2 -2
  62. package/dist/contexts/cdnContext/index.d.cts +1 -1
  63. package/dist/contexts/cdnContext/index.d.ts +1 -1
  64. package/dist/contexts/cdnContext/index.js +2 -2
  65. package/dist/contexts/enviveConfigContext/index.cjs +2 -2
  66. package/dist/contexts/enviveConfigContext/index.d.cts +1 -1
  67. package/dist/contexts/enviveConfigContext/index.js +2 -2
  68. package/dist/contexts/enviveCssContext/index.cjs +6 -6
  69. package/dist/contexts/enviveCssContext/index.js +6 -6
  70. package/dist/contexts/featureFlagContext/index.cjs +2 -2
  71. package/dist/contexts/featureFlagContext/index.js +2 -2
  72. package/dist/contexts/graphqlContext/index.cjs +2 -2
  73. package/dist/contexts/graphqlContext/index.js +2 -2
  74. package/dist/contexts/localStorageContext/index.d.cts +1 -1
  75. package/dist/contexts/newOrgConfigContext/index.cjs +5 -5
  76. package/dist/contexts/newOrgConfigContext/index.js +5 -5
  77. package/dist/contexts/searchContext/index.cjs +14 -14
  78. package/dist/contexts/searchContext/index.js +14 -14
  79. package/dist/contexts/shopifyUrlContext/index.cjs +2 -2
  80. package/dist/contexts/shopifyUrlContext/index.d.cts +1 -1
  81. package/dist/contexts/shopifyUrlContext/index.js +2 -2
  82. package/dist/contexts/systemSettingsContext/index.cjs +2 -2
  83. package/dist/contexts/systemSettingsContext/index.d.cts +1 -1
  84. package/dist/contexts/systemSettingsContext/index.d.ts +2 -2
  85. package/dist/contexts/systemSettingsContext/index.js +2 -2
  86. package/dist/contexts/userIdentityContext/index.cjs +9 -9
  87. package/dist/contexts/userIdentityContext/index.js +9 -9
  88. package/dist/{domObserver-DNeeSh1F.js → domObserver-CVhsCSkS.js} +1 -1
  89. package/dist/{domObserver-C2oQO8vi.cjs → domObserver-LCBj1xw4.cjs} +1 -1
  90. package/dist/{enviveConfig-Dp80h9yu.cjs → enviveConfig-CQ_8mT-g.cjs} +1 -1
  91. package/dist/{enviveConfig-Ciq4ASoV.js → enviveConfig-Cwlp7-Qz.js} +1 -1
  92. package/dist/{enviveConfigContext-CCjJUmwp.js → enviveConfigContext-BZbGEgOW.js} +2 -2
  93. package/dist/{enviveConfigContext-DoYP8KSw.cjs → enviveConfigContext-BinpxTCy.cjs} +2 -2
  94. package/dist/events/index.cjs +1 -1
  95. package/dist/events/index.js +1 -1
  96. package/dist/{events-DBin1Z7o.cjs → events-CgFGtanE.cjs} +1 -1
  97. package/dist/{events-CXiS1aTc.js → events-WOOrnUAx.js} +1 -1
  98. package/dist/exceptions/index.d.ts +1 -1
  99. package/dist/{graphqlContext-ChXlE8Ul.cjs → graphqlContext-B8wuRZcp.cjs} +2 -2
  100. package/dist/{graphqlContext-0cg9fEUw.js → graphqlContext-CpHMbKoX.js} +2 -2
  101. package/dist/hooks/AmplitudeOperations/index.cjs +13 -13
  102. package/dist/hooks/AmplitudeOperations/index.d.cts +1 -1
  103. package/dist/hooks/AmplitudeOperations/index.js +13 -13
  104. package/dist/hooks/AppDetails/index.cjs +12 -12
  105. package/dist/hooks/AppDetails/index.d.cts +1 -1
  106. package/dist/hooks/AppDetails/index.js +12 -12
  107. package/dist/hooks/BlockBackButton/index.d.cts +1 -1
  108. package/dist/hooks/CdnOperations/index.cjs +2 -2
  109. package/dist/hooks/CdnOperations/index.d.ts +1 -1
  110. package/dist/hooks/CdnOperations/index.js +2 -2
  111. package/dist/hooks/ChatToggle/index.cjs +13 -13
  112. package/dist/hooks/ChatToggle/index.d.cts +1 -1
  113. package/dist/hooks/ChatToggle/index.js +13 -13
  114. package/dist/hooks/ChatToggleAnalytics/index.cjs +13 -13
  115. package/dist/hooks/ChatToggleAnalytics/index.d.cts +1 -1
  116. package/dist/hooks/ChatToggleAnalytics/index.js +13 -13
  117. package/dist/hooks/Debounce/index.d.cts +1 -1
  118. package/dist/hooks/ElementObserver/index.cjs +1 -1
  119. package/dist/hooks/ElementObserver/index.js +1 -1
  120. package/dist/hooks/GrabAndScroll/index.d.cts +2 -2
  121. package/dist/hooks/GraphQLConfig/index.cjs +3 -3
  122. package/dist/hooks/GraphQLConfig/index.d.cts +1 -1
  123. package/dist/hooks/GraphQLConfig/index.js +3 -3
  124. package/dist/hooks/IdentifyUser/index.cjs +9 -9
  125. package/dist/hooks/IdentifyUser/index.d.cts +1 -1
  126. package/dist/hooks/IdentifyUser/index.js +9 -9
  127. package/dist/hooks/ImageResolver/index.cjs +1 -1
  128. package/dist/hooks/ImageResolver/index.d.cts +1 -1
  129. package/dist/hooks/ImageResolver/index.js +1 -1
  130. package/dist/hooks/LocalStorageOperations/index.d.cts +1 -1
  131. package/dist/hooks/MessageFilter/index.d.cts +1 -1
  132. package/dist/hooks/MessageScrollObserver/index.d.cts +1 -1
  133. package/dist/hooks/NewOrgConfig/index.cjs +6 -6
  134. package/dist/hooks/NewOrgConfig/index.d.cts +2 -2
  135. package/dist/hooks/NewOrgConfig/index.d.ts +2 -2
  136. package/dist/hooks/NewOrgConfig/index.js +6 -6
  137. package/dist/hooks/Search/index.cjs +15 -15
  138. package/dist/hooks/Search/index.js +15 -15
  139. package/dist/hooks/SearchOperations/index.cjs +14 -14
  140. package/dist/hooks/SearchOperations/index.js +14 -14
  141. package/dist/hooks/ShopifyUrlOperations/index.cjs +2 -2
  142. package/dist/hooks/ShopifyUrlOperations/index.js +2 -2
  143. package/dist/hooks/SystemSettingsContext/index.cjs +2 -2
  144. package/dist/hooks/SystemSettingsContext/index.d.cts +3 -3
  145. package/dist/hooks/SystemSettingsContext/index.d.ts +4 -4
  146. package/dist/hooks/SystemSettingsContext/index.js +2 -2
  147. package/dist/hooks/TrackComponentVisibleEvent/index.cjs +13 -13
  148. package/dist/hooks/TrackComponentVisibleEvent/index.js +13 -13
  149. package/dist/hooks/UpdateAnalyticsProps/index.cjs +12 -12
  150. package/dist/hooks/UpdateAnalyticsProps/index.js +12 -12
  151. package/dist/hooks/utils.cjs +1 -1
  152. package/dist/hooks/utils.d.cts +1 -1
  153. package/dist/hooks/utils.js +1 -1
  154. package/dist/index-CMZcE7pk.d.cts +1 -1
  155. package/dist/index-ChiZg0yw.d.cts +1 -1
  156. package/dist/index-CsmO1rDH.d.ts +1 -1
  157. package/dist/index-DtzPIcQp.d.ts +1 -1
  158. package/dist/index-bEjLKG_Q.d.ts +1 -1
  159. package/dist/index-mv7KvWDq.d.ts +1 -1
  160. package/dist/{locators-C2fWd-74.js → locators-BMQGmGLq.js} +1 -1
  161. package/dist/{locators-Cx3q6Z_h.cjs → locators-DxYdak1F.cjs} +1 -1
  162. package/dist/{newOrgConfigAtom-BuQE_zPK.js → newOrgConfigAtom-C8h3w_Ji.js} +1 -1
  163. package/dist/{newOrgConfigAtom-rrYHmp1b.cjs → newOrgConfigAtom-CDttTiuu.cjs} +1 -1
  164. package/dist/{newOrgConfigContext-d3RHl430.cjs → newOrgConfigContext-Brsggue9.cjs} +4 -4
  165. package/dist/{newOrgConfigContext-D-gU5ppl.js → newOrgConfigContext-Dt_W-wlK.js} +4 -4
  166. package/dist/{org-CIFgIcO4.cjs → org-BNs_maoW.cjs} +1 -1
  167. package/dist/{org-15F128Ah.js → org-CScQqL4k.js} +1 -1
  168. package/dist/{search-Ch6LKNh4.cjs → search-CWkDtqQV.cjs} +2 -2
  169. package/dist/{search--80x6CfL.js → search-OWKKaQQj.js} +2 -2
  170. package/dist/{searchContext-BkPoTq1o.js → searchContext-B-rEZixl.js} +4 -4
  171. package/dist/{searchContext-B0qEUoKb.cjs → searchContext-JCUBg-lA.cjs} +4 -4
  172. package/dist/{shopifyUrlContext-Bw1kAZ2P.cjs → shopifyUrlContext-COc1eDR_.cjs} +2 -2
  173. package/dist/{shopifyUrlContext-DnJiUmMA.js → shopifyUrlContext-CToAt_98.js} +2 -2
  174. package/dist/{systemSettingsContext-DPdDfVhj.js → systemSettingsContext-D9iNGz5v.js} +2 -2
  175. package/dist/{systemSettingsContext-068vQuP2.cjs → systemSettingsContext-DdV7Yte8.cjs} +2 -2
  176. package/dist/types/index.cjs +1 -1
  177. package/dist/types/index.js +1 -1
  178. package/dist/{types-B8HZYWV3.cjs → types-1iJ_FnQQ.cjs} +1 -1
  179. package/dist/{types-y3mhxOUA.js → types-D5du68Vp.js} +1 -1
  180. package/dist/{urlsParser-bb8ciRFg.cjs → urlsParser-Dax4iVNC.cjs} +1 -1
  181. package/dist/{urlsParser-v_1DKvyf.js → urlsParser-NAp2LwWP.js} +1 -1
  182. package/dist/{useAppDetails-eP2hBuid.cjs → useAppDetails-D3T6kJY_.cjs} +4 -4
  183. package/dist/{useAppDetails-BPXln8UE.js → useAppDetails-xPVs6fW7.js} +4 -4
  184. package/dist/{useGraphQLConfig-v9veUbvJ.cjs → useGraphQLConfig-B1DaVvFx.cjs} +2 -2
  185. package/dist/{useGraphQLConfig-Btszi6cG.js → useGraphQLConfig-BtPxjtxw.js} +2 -2
  186. package/dist/{utils-D_nGHczN.js → utils-BZT_oZ3n.js} +1 -1
  187. package/dist/{utils-SjlIHajO.cjs → utils-D3MjNkd3.cjs} +2 -2
  188. package/dist/{utils-CWzuvlOR.js → utils-DMwh3QbT.js} +2 -2
  189. package/dist/{utils-CJk5iwQI.cjs → utils-qtHPLFby.cjs} +1 -1
  190. package/package.json +1 -1
  191. package/src/contexts/amplitudeContext/amplitudeContext.tsx +11 -3
  192. package/src/contexts/cdnContext/cdnContext.tsx +11 -9
  193. package/dist/amplitudeContext-BWmXliMI.cjs +0 -243
  194. package/dist/amplitudeContext-BjMlg5RV.js +0 -227
  195. package/dist/cdnContext-CJ2BNLAD.js +0 -38
  196. package/dist/cdnContext-lkC-AE6A.cjs +0 -53
  197. package/dist/src/application/commerce-api.js +0 -408
  198. package/dist/src/application/logging/logger.js +0 -16
  199. package/dist/src/application/models/graphql/index.js +0 -3
  200. package/dist/src/application/models/graphql/queries/getMerchantColorsQuery.js +0 -13
  201. package/dist/src/application/models/graphql/queries/getMerchantFrontendConfigQuery.js +0 -13
  202. package/dist/src/application/models/graphql/queries/getMerchantOrgIdQuery.js +0 -10
  203. package/dist/src/application/models/guards/api/index.js +0 -12
  204. package/dist/src/application/models/guards/api/isApiFormResponse.js +0 -59
  205. package/dist/src/application/models/guards/api/isApiFormSubmittedResponseAttributes.js +0 -22
  206. package/dist/src/application/models/guards/api/isApiOrderResponseAttributes.js +0 -91
  207. package/dist/src/application/models/guards/api/isApiOrgConfigResults.js +0 -188
  208. package/dist/src/application/models/guards/api/isApiOrganizationConfig.js +0 -115
  209. package/dist/src/application/models/guards/api/isApiPDPEventAttributes.js +0 -16
  210. package/dist/src/application/models/guards/api/isApiPLPEventAttributes.js +0 -26
  211. package/dist/src/application/models/guards/api/isApiPageResponseAttributes.js +0 -15
  212. package/dist/src/application/models/guards/api/isApiProductResponseAttributes.js +0 -65
  213. package/dist/src/application/models/guards/api/isApiProductSearchAttributes.js +0 -15
  214. package/dist/src/application/models/guards/api/isApiProductSearchFilterAttributes.js +0 -10
  215. package/dist/src/application/models/guards/api/isApiQueryTypedEventAttributes.js +0 -4
  216. package/dist/src/application/models/guards/api/isApiResponse.js +0 -33
  217. package/dist/src/application/models/guards/api/isApiReviewResponseAttributes.js +0 -22
  218. package/dist/src/application/models/guards/api/isApiReviewRichInformation.js +0 -23
  219. package/dist/src/application/models/guards/api/isApiSearchEventAttributes.js +0 -20
  220. package/dist/src/application/models/guards/api/isApiSuggestion.js +0 -24
  221. package/dist/src/application/models/guards/api/isApiSuggestionClickedEventAttributes.js +0 -4
  222. package/dist/src/application/models/guards/api/isApiTextResponseAttributes.js +0 -4
  223. package/dist/src/application/models/guards/api/isApiUserEvent.js +0 -18
  224. package/dist/src/application/models/guards/graphQL/isGraphQLColorsConfig.js +0 -41
  225. package/dist/src/application/models/guards/isBaseEcommerceEvent.js +0 -14
  226. package/dist/src/application/models/guards/isGA4EcommerceEvent.js +0 -14
  227. package/dist/src/application/models/guards/isLegacyUAEcommerceEvent.js +0 -14
  228. package/dist/src/application/models/guards/isMobilePLPChatPlacementParameter.js +0 -4
  229. package/dist/src/application/models/guards/isSpanxTakeAQuizCtaParameter.js +0 -1
  230. package/dist/src/application/models/guards/isVariantInfo.js +0 -28
  231. package/dist/src/application/models/guards/utils.js +0 -34
  232. package/dist/src/application/models/index.js +0 -34
  233. package/dist/src/application/models/utils/snakeToCamelTransformer.js +0 -71
  234. package/dist/src/application/models/utils/stringToFulfillmentDisplayStatusEnumValue.js +0 -65
  235. package/dist/src/application/models/validators/validateGraphQLColorsConfig.js +0 -9
  236. package/dist/src/application/models/validators/validateGraphQLFrontendConfig.js +0 -420
  237. package/dist/src/application/models/validators/validateGraphQLOrgId.js +0 -6
  238. package/dist/src/application/models/validators/validateMobilePLPChatPlacementParameter.js +0 -9
  239. package/dist/src/application/models/validators/validateOrgConfigResults.js +0 -44
  240. package/dist/src/application/models/validators/validateOrganizationConfig.js +0 -34
  241. package/dist/src/application/models/validators/validateResponse.js +0 -173
  242. package/dist/src/application/models/validators/validateSuggestion.js +0 -13
  243. package/dist/src/application/models/validators/validateUserEvent.js +0 -91
  244. package/dist/src/application/utils/analyticsUtils.js +0 -95
  245. package/dist/src/application/utils/coreContextToApiContext.js +0 -8
  246. package/dist/src/application/utils/coreUserEventToApiUserEvent.js +0 -90
  247. package/dist/src/application/utils/divideArray.js +0 -7
  248. package/dist/src/application/utils/domObserver.js +0 -85
  249. package/dist/src/application/utils/elementObserver.js +0 -186
  250. package/dist/src/application/utils/imageFilter.js +0 -11
  251. package/dist/src/application/utils/index.js +0 -21
  252. package/dist/src/application/utils/merchantUtils.js +0 -15
  253. package/dist/src/application/utils/messageFromFormSubmittedEvent.js +0 -19
  254. package/dist/src/application/utils/messageFromQueryEvent.js +0 -35
  255. package/dist/src/application/utils/messageFromResponse.js +0 -123
  256. package/dist/src/application/utils/messageFromSuggestionEvent.js +0 -27
  257. package/dist/src/application/utils/mouseEventTypes.js +0 -1
  258. package/dist/src/application/utils/mutationHelper.js +0 -33
  259. package/dist/src/application/utils/nextMessageRequestToApiRequest.js +0 -29
  260. package/dist/src/application/utils/nodeSelector.js +0 -101
  261. package/dist/src/application/utils/overrides.js +0 -144
  262. package/dist/src/application/utils/stringUtils.js +0 -47
  263. package/dist/src/application/utils/supportedEventRequestToApiRequest.js +0 -7
  264. package/dist/src/application/utils/urlsParser.js +0 -33
  265. package/dist/src/application/utils/validation.js +0 -5
  266. package/dist/src/atoms/amplitude/amplitudeTrackEventAtom.js +0 -4
  267. package/dist/src/atoms/app/index.js +0 -23
  268. package/dist/src/atoms/app/variant.js +0 -102
  269. package/dist/src/atoms/atomStore/atomStore.js +0 -28
  270. package/dist/src/atoms/atomStore/index.js +0 -1
  271. package/dist/src/atoms/chat/chatState.js +0 -32
  272. package/dist/src/atoms/chat/form.js +0 -16
  273. package/dist/src/atoms/chat/index.js +0 -23
  274. package/dist/src/atoms/chat/lastMessage.js +0 -10
  275. package/dist/src/atoms/chat/messageQueue.js +0 -68
  276. package/dist/src/atoms/chat/performanceMetrics.js +0 -70
  277. package/dist/src/atoms/chat/renderedWidgetRefs.js +0 -24
  278. package/dist/src/atoms/chat/replies.js +0 -42
  279. package/dist/src/atoms/chat/suggestions.js +0 -29
  280. package/dist/src/atoms/envive/enviveConfig.js +0 -67
  281. package/dist/src/atoms/globalSearch/globalSearch.js +0 -8
  282. package/dist/src/atoms/globalSearch/index.js +0 -1
  283. package/dist/src/atoms/org/customerService.js +0 -6
  284. package/dist/src/atoms/org/graphqlConfig.js +0 -8
  285. package/dist/src/atoms/org/index.js +0 -4
  286. package/dist/src/atoms/org/newOrgConfigAtom.js +0 -2
  287. package/dist/src/atoms/org/orgAnalyticsConfig.js +0 -8
  288. package/dist/src/atoms/search/index.js +0 -1
  289. package/dist/src/atoms/search/productFilters.js +0 -163
  290. package/dist/src/atoms/search/productRetrievalAPI.js +0 -50
  291. package/dist/src/atoms/search/productRetrievalAdapter.js +0 -14
  292. package/dist/src/atoms/search/productSorter.js +0 -13
  293. package/dist/src/atoms/search/searchAPI.js +0 -140
  294. package/dist/src/atoms/search/searchServiceAdapter.js +0 -14
  295. package/dist/src/atoms/search/utils.js +0 -15
  296. package/dist/src/config/index.js +0 -1
  297. package/dist/src/config/locators/components/chat/entrypoints.js +0 -10
  298. package/dist/src/config/locators/components/chat/index.js +0 -21
  299. package/dist/src/config/locators/components/chat/preview.js +0 -11
  300. package/dist/src/config/locators/components/chat/variants/index.js +0 -12
  301. package/dist/src/config/locators/components/common/buttons.js +0 -6
  302. package/dist/src/config/locators/components/common/cards.js +0 -17
  303. package/dist/src/config/locators/components/common/index.js +0 -4
  304. package/dist/src/config/locators/components/common/links.js +0 -1
  305. package/dist/src/config/locators/components/common/tables.js +0 -1
  306. package/dist/src/config/locators/components/floating-button.js +0 -2
  307. package/dist/src/config/locators/components/index.js +0 -3
  308. package/dist/src/config/locators/components/report-issue.js +0 -13
  309. package/dist/src/config/locators/components/search/index.js +0 -5
  310. package/dist/src/config/locators/components/shadow-dom.js +0 -1
  311. package/dist/src/config/locators/embedded.js +0 -20
  312. package/dist/src/config/locators/index.js +0 -4
  313. package/dist/src/contexts/amplitudeContext/amplitudeContext.js +0 -271
  314. package/dist/src/contexts/amplitudeContext/index.js +0 -1
  315. package/dist/src/contexts/cdnContext/cdnContext.js +0 -28
  316. package/dist/src/contexts/cdnContext/index.js +0 -1
  317. package/dist/src/contexts/enviveConfigContext/enviveConfigContext.js +0 -37
  318. package/dist/src/contexts/enviveConfigContext/index.js +0 -1
  319. package/dist/src/contexts/enviveCssContext/enviveCssContext.js +0 -31
  320. package/dist/src/contexts/enviveCssContext/index.js +0 -1
  321. package/dist/src/contexts/featureFlagContext/featureFlagContext.js +0 -109
  322. package/dist/src/contexts/featureFlagContext/index.js +0 -1
  323. package/dist/src/contexts/featureFlagServiceContext/featureFlagServiceContext.js +0 -47
  324. package/dist/src/contexts/featureFlagServiceContext/index.js +0 -1
  325. package/dist/src/contexts/graphqlContext/graphqlContext.js +0 -87
  326. package/dist/src/contexts/graphqlContext/index.js +0 -1
  327. package/dist/src/contexts/localStorageContext/index.js +0 -1
  328. package/dist/src/contexts/localStorageContext/localStorageContext.js +0 -95
  329. package/dist/src/contexts/newOrgConfigContext/index.js +0 -1
  330. package/dist/src/contexts/newOrgConfigContext/newOrgConfigContext.js +0 -33
  331. package/dist/src/contexts/searchContext/index.js +0 -1
  332. package/dist/src/contexts/searchContext/searchContext.js +0 -131
  333. package/dist/src/contexts/sessionStorageContext/index.js +0 -1
  334. package/dist/src/contexts/sessionStorageContext/sessionStorageContext.js +0 -43
  335. package/dist/src/contexts/shopifyUrlContext/index.js +0 -1
  336. package/dist/src/contexts/shopifyUrlContext/shopifyUrlContext.js +0 -62
  337. package/dist/src/contexts/systemSettingsContext/index.js +0 -1
  338. package/dist/src/contexts/systemSettingsContext/systemSettingsContext.js +0 -29
  339. package/dist/src/contexts/userIdentityContext/index.js +0 -1
  340. package/dist/src/contexts/userIdentityContext/userIdentityContext.js +0 -118
  341. package/dist/src/events/index.js +0 -51
  342. package/dist/src/events/registerAnalyticsListeners.js +0 -32
  343. package/dist/src/exceptions/index.js +0 -2
  344. package/dist/src/exceptions/sessionExceptions.js +0 -6
  345. package/dist/src/exceptions/unsupportedProductExceptions.js +0 -6
  346. package/dist/src/hooks/AmplitudeOperations/index.js +0 -1
  347. package/dist/src/hooks/AmplitudeOperations/useAmplitudeOperations.js +0 -24
  348. package/dist/src/hooks/AppDetails/index.js +0 -1
  349. package/dist/src/hooks/AppDetails/useAppDetails.js +0 -26
  350. package/dist/src/hooks/BlockBackButton/index.js +0 -1
  351. package/dist/src/hooks/BlockBackButton/useBlockBackButton.js +0 -23
  352. package/dist/src/hooks/CdnOperations/index.js +0 -1
  353. package/dist/src/hooks/CdnOperations/useCdnOperations.js +0 -13
  354. package/dist/src/hooks/ChatToggle/index.js +0 -1
  355. package/dist/src/hooks/ChatToggle/useChatToggle.js +0 -50
  356. package/dist/src/hooks/ChatToggleAnalytics/index.js +0 -1
  357. package/dist/src/hooks/ChatToggleAnalytics/useChatToggleAnalytics.js +0 -11
  358. package/dist/src/hooks/CustomerSupportHandoff/index.js +0 -1
  359. package/dist/src/hooks/CustomerSupportHandoff/useCustomerSupportHandoff.js +0 -32
  360. package/dist/src/hooks/Debounce/index.js +0 -1
  361. package/dist/src/hooks/Debounce/useDebounce.js +0 -13
  362. package/dist/src/hooks/ElementObserver/index.js +0 -1
  363. package/dist/src/hooks/ElementObserver/useElementObserver.js +0 -208
  364. package/dist/src/hooks/GrabAndScroll/index.js +0 -1
  365. package/dist/src/hooks/GrabAndScroll/useGrabAndScroll.js +0 -105
  366. package/dist/src/hooks/GraphQLConfig/index.js +0 -1
  367. package/dist/src/hooks/GraphQLConfig/useGraphQLConfig.js +0 -54
  368. package/dist/src/hooks/IdentifyUser/index.js +0 -1
  369. package/dist/src/hooks/IdentifyUser/useIdentifyUser.js +0 -28
  370. package/dist/src/hooks/ImageResolver/index.js +0 -1
  371. package/dist/src/hooks/ImageResolver/useImageResolver.js +0 -45
  372. package/dist/src/hooks/Intersection/index.js +0 -1
  373. package/dist/src/hooks/Intersection/useIntersection.js +0 -20
  374. package/dist/src/hooks/IsSmallScreen/index.js +0 -1
  375. package/dist/src/hooks/IsSmallScreen/useIsSmallScreen.js +0 -16
  376. package/dist/src/hooks/LocalStorageOperations/index.js +0 -1
  377. package/dist/src/hooks/LocalStorageOperations/useLocalStorageOperations.js +0 -64
  378. package/dist/src/hooks/MessageFilter/index.js +0 -1
  379. package/dist/src/hooks/MessageFilter/useMessageFilter.js +0 -37
  380. package/dist/src/hooks/MessageScrollObserver/index.js +0 -1
  381. package/dist/src/hooks/MessageScrollObserver/useMessageScrollObserver.js +0 -35
  382. package/dist/src/hooks/NewOrgConfig/index.js +0 -1
  383. package/dist/src/hooks/NewOrgConfig/useNewOrgConfig.js +0 -5
  384. package/dist/src/hooks/Search/index.js +0 -1
  385. package/dist/src/hooks/Search/useRecommendedProducts.js +0 -35
  386. package/dist/src/hooks/Search/useSearch.js +0 -224
  387. package/dist/src/hooks/Search/useSearchInput.js +0 -192
  388. package/dist/src/hooks/SearchOperations/index.js +0 -1
  389. package/dist/src/hooks/SearchOperations/useSearchOperations.js +0 -78
  390. package/dist/src/hooks/SessionStorageOperations/index.js +0 -1
  391. package/dist/src/hooks/SessionStorageOperations/useSessionStorageOperations.js +0 -20
  392. package/dist/src/hooks/ShopifyUrlOperations/index.js +0 -1
  393. package/dist/src/hooks/ShopifyUrlOperations/useShopifyUrlOperations.js +0 -34
  394. package/dist/src/hooks/SnapCalculator/index.js +0 -1
  395. package/dist/src/hooks/SnapCalculator/useSnapCalculator.js +0 -22
  396. package/dist/src/hooks/SystemSettingsContext/index.js +0 -1
  397. package/dist/src/hooks/SystemSettingsContext/useSystemSettingsContext.js +0 -9
  398. package/dist/src/hooks/TrackComponentVisibleEvent/index.js +0 -1
  399. package/dist/src/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.js +0 -45
  400. package/dist/src/hooks/UpdateAnalyticsProps/index.js +0 -1
  401. package/dist/src/hooks/UpdateAnalyticsProps/useUpdateAnalyticsProps.js +0 -43
  402. package/dist/src/hooks/utils.js +0 -116
  403. package/dist/src/interceptors/index.js +0 -1
  404. package/dist/src/interceptors/useMessageInterceptor.js +0 -24
  405. package/dist/src/types/ApiResponse.js +0 -1
  406. package/dist/src/types/FilterAttribute.js +0 -3
  407. package/dist/src/types/Message.js +0 -24
  408. package/dist/src/types/Suggestion.js +0 -3
  409. package/dist/src/types/index.js +0 -4
  410. package/dist/src/util/colorVar.js +0 -3
  411. package/dist/src/util/configVersion.js +0 -4
  412. package/dist/src/util/domInsertion.js +0 -16
@@ -1,42 +0,0 @@
1
- import { atom } from "jotai";
2
- import { MessageType, SpiffyMetricsEventName } from "@envive-ai/types";
3
- import { userHasRepliedAtom, messagesAtom, userQueryAtom, replyEventCategoryAtom, } from "src/atoms/chat";
4
- import { UserEventCategory } from "@spiffy-ai/commerce-api-client";
5
- import { queueUserEventAtom } from "./messageQueue";
6
- import { amplitudeTrackEventAtom } from "src/atoms/amplitude/amplitudeTrackEventAtom";
7
- export const handleReplyAtom = atom(null, (get, set, { message, userTyped }) => {
8
- var _a;
9
- if (message.type !== MessageType.QueryTyped) {
10
- return;
11
- }
12
- const trackEvent = get(amplitudeTrackEventAtom);
13
- const queryTyped = message.metadata.content;
14
- set(replyEventCategoryAtom, UserEventCategory.QueryTyped);
15
- set(userQueryAtom, queryTyped);
16
- set(messagesAtom, [...get(messagesAtom), [message]]);
17
- set(userHasRepliedAtom, true);
18
- set(queueUserEventAtom, {
19
- eventId: message.id,
20
- createdAt: message.createdAt,
21
- category: UserEventCategory.QueryTyped,
22
- attributes: {
23
- query: queryTyped,
24
- },
25
- });
26
- if (trackEvent) {
27
- trackEvent({
28
- eventName: SpiffyMetricsEventName.ChatUserMessageInput,
29
- eventProps: {
30
- message_id: message.id,
31
- message_role: message.role,
32
- message_type: message.type,
33
- message_metadata: {
34
- content: (_a = message === null || message === void 0 ? void 0 : message.metadata) === null || _a === void 0 ? void 0 : _a.content, // Removed amplitudeSafeString
35
- created_at: message.createdAt,
36
- user_typed: userTyped,
37
- },
38
- },
39
- alsoSendToGoogleAnalytics: true,
40
- });
41
- }
42
- });
@@ -1,29 +0,0 @@
1
- import { atom } from "jotai";
2
- import { MessageRole, MessageType } from "src/types";
3
- import { messagesAtom, replyEventCategoryAtom, suggestionAtom, userHasRepliedAtom, } from "src/atoms/chat";
4
- import { UserEventCategory } from "@spiffy-ai/commerce-api-client";
5
- import { queueUserEventAtom } from "./messageQueue";
6
- export const handleSuggestionAtom = atom(null, (get, set, suggestion) => {
7
- const newMessage = {
8
- id: suggestion.id,
9
- role: MessageRole.User,
10
- type: MessageType.SuggestionClicked,
11
- createdAt: new Date().toISOString(),
12
- metadata: {
13
- suggestionId: suggestion.id,
14
- suggestionContent: suggestion.content,
15
- },
16
- };
17
- set(replyEventCategoryAtom, UserEventCategory.SuggestionClicked);
18
- set(suggestionAtom, suggestion);
19
- set(messagesAtom, [...get(messagesAtom), [newMessage]]);
20
- set(userHasRepliedAtom, true);
21
- set(queueUserEventAtom, {
22
- eventId: suggestion.id,
23
- category: UserEventCategory.SuggestionClicked,
24
- createdAt: newMessage.createdAt,
25
- attributes: {
26
- suggestionId: suggestion.id,
27
- },
28
- });
29
- });
@@ -1,67 +0,0 @@
1
- import Logger from 'src/application/logging/logger';
2
- import { atom } from 'jotai';
3
- import { ContextSourceEnum } from '@spiffy-ai/commerce-api-client';
4
- import { LocalStorageKeys } from '@envive-ai/types';
5
- const internalEnviveConfigAtom = atom(undefined);
6
- export const enviveConfigAtom = atom((get) => {
7
- const config = get(internalEnviveConfigAtom);
8
- Logger.logDebug('enviveConfig.ts: Accessing internalEnviveConfigAtom', config);
9
- return config; // Return undefined if not set instead of throwing
10
- }, (_, set, value) => {
11
- set(internalEnviveConfigAtom, value);
12
- });
13
- export const amplitudeApiKeyAtom = atom((get) => {
14
- const config = get(enviveConfigAtom);
15
- return config === null || config === void 0 ? void 0 : config.amplitudeApiKey;
16
- });
17
- export const dataResidencyAtom = atom((get) => {
18
- const config = get(enviveConfigAtom);
19
- return config === null || config === void 0 ? void 0 : config.dataResidency;
20
- });
21
- export const envAtom = atom((get) => {
22
- const config = get(enviveConfigAtom);
23
- return config === null || config === void 0 ? void 0 : config.env;
24
- });
25
- export const baseUrlAtom = atom((get) => {
26
- const config = get(enviveConfigAtom);
27
- return (config === null || config === void 0 ? void 0 : config.baseUrl) || 'https://commerce-api.dev.spiffy.ai';
28
- });
29
- export const reactAppNameAtom = atom((get) => {
30
- const config = get(enviveConfigAtom);
31
- return config === null || config === void 0 ? void 0 : config.reactAppName;
32
- });
33
- export const cdnUrlAtom = atom((get) => {
34
- const config = get(enviveConfigAtom);
35
- return config === null || config === void 0 ? void 0 : config.cdnUrl;
36
- });
37
- export const contextSourceAtom = atom((get) => {
38
- const config = get(enviveConfigAtom);
39
- if (config === null || config === void 0 ? void 0 : config.contextSource) {
40
- return config.contextSource;
41
- }
42
- const spiffyOnFeatureFlagSet = window.localStorage.getItem(LocalStorageKeys.SpiffyOnOverride);
43
- if (spiffyOnFeatureFlagSet === 'true') {
44
- return ContextSourceEnum.Playground;
45
- }
46
- return ContextSourceEnum.App;
47
- });
48
- export const orgLevelApiKeyAtom = atom((get) => {
49
- const config = get(enviveConfigAtom);
50
- Logger.logDebug('enviveConfig.ts: Accessing orgLevelApiKey', config);
51
- return config === null || config === void 0 ? void 0 : config.orgLevelApiKey;
52
- });
53
- export const orgShortNameAtom = atom((get) => {
54
- const config = get(enviveConfigAtom);
55
- Logger.logDebug('enviveConfig.ts: Accessing orgShortName', config);
56
- return config === null || config === void 0 ? void 0 : config.orgShortName;
57
- });
58
- export const identifyingPrefixAtom = atom((get) => {
59
- const config = get(enviveConfigAtom);
60
- Logger.logDebug('enviveConfig.ts: Accessing identifyingPrefix', config);
61
- return (config === null || config === void 0 ? void 0 : config.identifyingPrefix) || 'spiffy';
62
- });
63
- export const publicKeyAtom = atom((get) => {
64
- const config = get(enviveConfigAtom);
65
- Logger.logDebug('enviveConfig.ts: Accessing publicKey', config);
66
- return config === null || config === void 0 ? void 0 : config.publicKey;
67
- });
@@ -1,8 +0,0 @@
1
- import { atom } from 'jotai';
2
- export const autocompleteStateAtom = atom({
3
- results: [],
4
- isLoading: false,
5
- });
6
- export const isFilterOpenAtom = atom(false);
7
- export const isGlobalSearchOpenAtom = atom(false);
8
- export const isSearchResultsOpenAtom = atom(false);
@@ -1 +0,0 @@
1
- export * from "./globalSearch";
@@ -1,6 +0,0 @@
1
- import { atom } from 'jotai';
2
- export const isBusinessHoursAtom = atom(true);
3
- export const isCustomerServiceOpenAtom = atom(false);
4
- export const customerServiceResponseAtom = atom();
5
- export const customerServiceChatStateAtom = atom();
6
- export const customerServiceAttachment = atom();
@@ -1,8 +0,0 @@
1
- import { atom } from 'jotai';
2
- export const internalGraphQLColorsConfigAtom = atom(undefined);
3
- const internalGraphQLFrontendConfigAtom = atom(undefined);
4
- export const orgIdAtom = atom(undefined); // New atom for orgId
5
- export const featureFlagServiceAtom = atom(undefined); // New atom for FeatureFlagService
6
- export const frontendConfigAtom = atom((get) => get(internalGraphQLFrontendConfigAtom), (_, set, value) => {
7
- set(internalGraphQLFrontendConfigAtom, value);
8
- });
@@ -1,4 +0,0 @@
1
- export * from './customerService';
2
- export * from './graphqlConfig';
3
- export * from './orgAnalyticsConfig';
4
- export * from './newOrgConfigAtom';
@@ -1,2 +0,0 @@
1
- import { atom } from 'jotai';
2
- export const newOrgConfigAtom = atom(null);
@@ -1,8 +0,0 @@
1
- import { atom } from 'jotai';
2
- const internalOrgAnalyticsConfigAtom = atom(undefined);
3
- export const orgAnalyticsConfigAtom = atom((get) => get(internalOrgAnalyticsConfigAtom), (_, set, value) => {
4
- set(internalOrgAnalyticsConfigAtom, value);
5
- });
6
- export const orgAnalyticsAmplitudeConfigAtom = atom((get) => { var _a; return (_a = get(orgAnalyticsConfigAtom)) === null || _a === void 0 ? void 0 : _a.amplitude; });
7
- export const orgAnalyticsCustomerServiceConfigAtom = atom((get) => { var _a; return (_a = get(orgAnalyticsConfigAtom)) === null || _a === void 0 ? void 0 : _a.customerService; });
8
- export const orgAnalyticsGoogleAnalyticsConfigAtom = atom((get) => { var _a; return (_a = get(orgAnalyticsConfigAtom)) === null || _a === void 0 ? void 0 : _a.googleAnalytics; });
@@ -1 +0,0 @@
1
- export * from './searchAPI';
@@ -1,163 +0,0 @@
1
- import { formatFilterDisplayName } from "./utils";
2
- const getPriceBucket = (price, bucketSize) => {
3
- const bucket = Math.floor(price / bucketSize);
4
- return bucket * bucketSize;
5
- };
6
- const isStringArray = (value) => {
7
- if (!Array.isArray(value)) {
8
- return false;
9
- }
10
- return value.every((item) => typeof item === "string");
11
- };
12
- const sortFilter = (filterConfig) => {
13
- if (filterConfig.type === "price") {
14
- return (a, b) => Number(a.filterItemId) - Number(b.filterItemId);
15
- }
16
- if (filterConfig.type === "dynamic") {
17
- if (filterConfig.sorting.type === "alphabetic") {
18
- return (a, b) => a.displayName.localeCompare(b.displayName);
19
- }
20
- // Sort by the number of products, if they match, sort by alphabetical
21
- if (filterConfig.sorting.type === "productCount") {
22
- return (a, b) => a.productCount === b.productCount
23
- ? a.displayName.localeCompare(b.displayName)
24
- : b.productCount - a.productCount;
25
- }
26
- if (filterConfig.sorting.type === "custom") {
27
- const sortedKeys = filterConfig.sorting.map;
28
- return (a, b) => {
29
- if (sortedKeys[a.displayName] && sortedKeys[b.displayName]) {
30
- // If both are in the sortedKeys, sort by the index
31
- return sortedKeys[a.displayName] - sortedKeys[b.displayName];
32
- }
33
- // If only 'a' is in the sortedKeys, put it before the other
34
- if (sortedKeys[a.displayName]) {
35
- return -1;
36
- }
37
- // If only 'b' is in the sortedKeys, put it before the other
38
- if (sortedKeys[b.displayName]) {
39
- return 1;
40
- }
41
- // If neither are in the sortedKeys, sort by productCount
42
- return b.productCount - a.productCount;
43
- };
44
- }
45
- }
46
- throw new Error("Invaalid search filter configuration");
47
- };
48
- export class ProductFilters {
49
- static getFiltersForProducts(products, filterConfigs, selectedFilterOptions) {
50
- if (!products || products.length === 0) {
51
- return [];
52
- }
53
- const filters = filterConfigs.map((filterConfig) => products.reduce((acc, product) => {
54
- var _a, _b, _c, _d, _e;
55
- // Price has special handling for the filters
56
- if (filterConfig.type === "price") {
57
- const priceBucket = getPriceBucket((_b = (_a = product.salePrice) !== null && _a !== void 0 ? _a : product.originalPrice) !== null && _b !== void 0 ? _b : 0, filterConfig.bucketSize);
58
- const current = (_c = acc.map[priceBucket]) !== null && _c !== void 0 ? _c : {
59
- filterItemId: priceBucket,
60
- displayName: `$${priceBucket}-$${priceBucket + filterConfig.bucketSize}`,
61
- productCount: 0,
62
- };
63
- acc.map[priceBucket] = {
64
- ...current,
65
- productCount: current.productCount + 1,
66
- };
67
- return acc;
68
- }
69
- // Assume that the "attribute" is an array of values
70
- const attributeValues = (_e = (product.filters && ((_d = product.filters) === null || _d === void 0 ? void 0 : _d[filterConfig.attribute]))) !== null && _e !== void 0 ? _e : [];
71
- if (isStringArray(attributeValues)) {
72
- attributeValues.forEach((val) => {
73
- var _a;
74
- const normalizedVal = val.toLowerCase();
75
- const current = (_a = acc.map[normalizedVal]) !== null && _a !== void 0 ? _a : {
76
- filterItemId: normalizedVal,
77
- displayName: formatFilterDisplayName(val), // Keep original case for display
78
- productCount: 0,
79
- };
80
- acc.map[normalizedVal] = {
81
- ...current,
82
- productCount: current.productCount + 1,
83
- };
84
- });
85
- }
86
- return acc;
87
- }, {
88
- filterConfig,
89
- map: {},
90
- }));
91
- const transformedFilters = filters.map(({ filterConfig, map }) => ({
92
- filterId: filterConfig.filterId,
93
- displayName: filterConfig.displayName,
94
- items: Object.values(map)
95
- .map((filter) => {
96
- var _a;
97
- return ({
98
- filterItemId: filter.filterItemId,
99
- displayName: filter.displayName,
100
- productCount: filter.productCount,
101
- isSelected: (_a = selectedFilterOptions.some((option) => option.id ===
102
- `${filterConfig.filterId}:${filter.filterItemId}`)) !== null && _a !== void 0 ? _a : false,
103
- });
104
- })
105
- .sort(sortFilter(filterConfig)),
106
- }));
107
- return [...transformedFilters];
108
- }
109
- static filterProducts(products, filterConfigs, selectedFilterOptions, additiveDynamicFilters = false // Set this to true to restore the original behavior where stacking filters has OR logic.
110
- ) {
111
- const selectedFilters = filterConfigs
112
- .map((filterConfig) => ({
113
- filterConfig,
114
- hasSelectedOptions: selectedFilterOptions.some((option) => option.filterId === filterConfig.filterId),
115
- }))
116
- .filter(({ hasSelectedOptions }) => hasSelectedOptions);
117
- return selectedFilterOptions.length === 0
118
- ? products
119
- : products.filter((product) => selectedFilters.reduce((acc, selectedFilter) => {
120
- var _a, _b, _c;
121
- // Finding one false removes the product
122
- if (!acc) {
123
- return acc;
124
- }
125
- // Price is special
126
- if (selectedFilter.filterConfig.type === "price") {
127
- const priceBucket = getPriceBucket((_b = (_a = product.salePrice) !== null && _a !== void 0 ? _a : product.originalPrice) !== null && _b !== void 0 ? _b : 0, selectedFilter.filterConfig.bucketSize);
128
- const matchesPriceFilter = selectedFilterOptions.some((option) => option.id === `price:${priceBucket}`);
129
- if (!matchesPriceFilter) {
130
- return false;
131
- }
132
- }
133
- if (selectedFilter.filterConfig.type === "dynamic") {
134
- // dynamic is misleading here. Its not just dynamic filters, but static filters because the config counts static filters as type: dynamic.
135
- const { filterId, attribute } = selectedFilter.filterConfig;
136
- const attributeValues = (_c = product.filters) === null || _c === void 0 ? void 0 : _c[attribute];
137
- if (!isStringArray(attributeValues)) {
138
- return false;
139
- }
140
- const isDynamicFilter = selectedFilter.filterConfig.attribute === "dynamic"; // True dynamic filters (the ones that appear beneath the search input)
141
- const isSubtractiveLogic = isDynamicFilter && !additiveDynamicFilters;
142
- if (isSubtractiveLogic) {
143
- // AND logic for subtractive dynamic filters and between static filter categories
144
- const selectedOptionsForThisFilter = selectedFilterOptions
145
- .filter((option) => option.filterId === filterId)
146
- .map((option) => option.filterItemId.toLowerCase());
147
- const hasAllSelectedValues = selectedOptionsForThisFilter.every((selectedValue) => attributeValues.some((val) => val.toLowerCase() === selectedValue));
148
- if (!hasAllSelectedValues) {
149
- return false;
150
- }
151
- }
152
- else {
153
- // OR logic for static filters in the sidebar within a category.
154
- const matches = attributeValues.some((val) => selectedFilterOptions.some((option) => option.id === `${filterId}:${val.toLowerCase()}`));
155
- if (!matches) {
156
- return false;
157
- }
158
- }
159
- }
160
- return true;
161
- }, true));
162
- }
163
- }
@@ -1,50 +0,0 @@
1
- import { atom } from "jotai";
2
- import { getProductRetrievalFunction } from "./productRetrievalAdapter";
3
- export const productRetrievalAtom = atom({
4
- data: null,
5
- loading: false,
6
- error: null,
7
- lastProductIds: null,
8
- });
9
- export const performProductRetrievalAtom = atom(null, async (get, set, params) => {
10
- const currentState = get(productRetrievalAtom);
11
- if (currentState.loading) {
12
- return; // Prevent concurrent retrievals
13
- }
14
- set(productRetrievalAtom, {
15
- data: null,
16
- loading: true,
17
- error: null,
18
- lastProductIds: params.productIds,
19
- });
20
- try {
21
- const retrieveProducts = getProductRetrievalFunction();
22
- const result = await retrieveProducts(params);
23
- set(productRetrievalAtom, {
24
- data: result,
25
- loading: false,
26
- error: null,
27
- lastProductIds: params.productIds,
28
- });
29
- }
30
- catch (error) {
31
- const errorMessage = error instanceof Error ? error.message : "An unknown error occurred";
32
- set(productRetrievalAtom, {
33
- data: null,
34
- loading: false,
35
- error: errorMessage,
36
- lastProductIds: params.productIds,
37
- });
38
- }
39
- });
40
- // Get just the products array (already normalized by service)
41
- export const retrievedProductsAtom = atom((get) => {
42
- const retrievalData = get(productRetrievalAtom).data;
43
- return (retrievalData === null || retrievalData === void 0 ? void 0 : retrievalData.products) || [];
44
- });
45
- export const productRetrievalLoadingAtom = atom((get) => {
46
- return get(productRetrievalAtom).loading;
47
- });
48
- export const productRetrievalErrorAtom = atom((get) => {
49
- return get(productRetrievalAtom).error;
50
- });
@@ -1,14 +0,0 @@
1
- // This will be set by the ProductRetrievalProvider when it initializes
2
- let productRetrievalFunction = null;
3
- export const setProductRetrievalFunction = (fn) => {
4
- productRetrievalFunction = fn;
5
- };
6
- export const getProductRetrievalFunction = () => {
7
- if (!productRetrievalFunction) {
8
- throw new Error("Product retrieval function not initialized. Make sure ProductRetrievalProvider is mounted.");
9
- }
10
- return productRetrievalFunction;
11
- };
12
- export const clearProductRetrievalFunction = () => {
13
- productRetrievalFunction = null;
14
- };
@@ -1,13 +0,0 @@
1
- import { ProductSorting } from '@envive-ai/types';
2
- export class ProductSorter {
3
- static sort(products, sorting) {
4
- switch (sorting) {
5
- case ProductSorting.PRICE_ASC:
6
- return [...products].sort((p1, p2) => { var _a, _b, _c, _d; return ((_b = (_a = p1.salePrice) !== null && _a !== void 0 ? _a : p1.originalPrice) !== null && _b !== void 0 ? _b : 0) - ((_d = (_c = p2.salePrice) !== null && _c !== void 0 ? _c : p2.originalPrice) !== null && _d !== void 0 ? _d : 0); });
7
- case ProductSorting.PRICE_DESC:
8
- return [...products].sort((p1, p2) => { var _a, _b, _c, _d; return ((_b = (_a = p2.salePrice) !== null && _a !== void 0 ? _a : p2.originalPrice) !== null && _b !== void 0 ? _b : 0) - ((_d = (_c = p1.salePrice) !== null && _c !== void 0 ? _c : p1.originalPrice) !== null && _d !== void 0 ? _d : 0); });
9
- default:
10
- return products;
11
- }
12
- }
13
- }
@@ -1,140 +0,0 @@
1
- import { atom } from 'jotai';
2
- import { ProductSorting } from '@envive-ai/types';
3
- import { ProductFilters } from './productFilters';
4
- import { ProductSorter } from './productSorter';
5
- import { newOrgConfigAtom } from '../org';
6
- import { getSearchServiceFunction } from './searchServiceAdapter';
7
- export const searchAtom = atom({
8
- data: null,
9
- loading: false,
10
- error: null,
11
- lastQuery: null,
12
- });
13
- export const searchProductSortingAtom = atom(ProductSorting.FEATURED);
14
- export const searchSelectedFiltersAtom = atom([]);
15
- export const createFilterOption = (filterId, filterItemId, displayName) => ({
16
- id: `${filterId}:${filterItemId}`,
17
- displayName,
18
- filterId,
19
- filterItemId,
20
- });
21
- const internalSearchParamsAtom = atom({
22
- id: null,
23
- query: null,
24
- });
25
- export const searchParamsAtom = atom((get) => get(internalSearchParamsAtom), (_, set, value) => {
26
- set(internalSearchParamsAtom, value);
27
- });
28
- export const internalSearchSystemStateAtom = atom(false);
29
- export const searchSystemAtom = atom((get) => get(internalSearchSystemStateAtom), (get, set, value) => {
30
- if (value === get(internalSearchSystemStateAtom)) {
31
- return;
32
- }
33
- const stateChangeHandler = () => {
34
- const params = new URLSearchParams(window.location.search);
35
- if (params.get('es') === 'true') {
36
- const id = params.get('esi');
37
- const query = params.get('esq');
38
- set(searchParamsAtom, { id, query });
39
- }
40
- else {
41
- set(searchParamsAtom, { id: null, query: null });
42
- }
43
- };
44
- if (value) {
45
- set(internalSearchSystemStateAtom, true);
46
- window.addEventListener('popstate', stateChangeHandler);
47
- // Also trigger the hash change handler to set the initial state
48
- stateChangeHandler();
49
- }
50
- else {
51
- set(internalSearchSystemStateAtom, false);
52
- window.removeEventListener('popstate', stateChangeHandler);
53
- }
54
- });
55
- export const filteredSearchProductsAtom = atom((get) => {
56
- var _a, _b;
57
- const searchData = get(searchAtom).data;
58
- const sorting = get(searchProductSortingAtom);
59
- const selectedFilters = get(searchSelectedFiltersAtom);
60
- const newOrgConfig = get(newOrgConfigAtom);
61
- if (!(searchData === null || searchData === void 0 ? void 0 : searchData.products) || !((_b = (_a = newOrgConfig === null || newOrgConfig === void 0 ? void 0 : newOrgConfig.frontendConfig) === null || _a === void 0 ? void 0 : _a.uiConfigs) === null || _b === void 0 ? void 0 : _b.searchConfig))
62
- return [];
63
- const filteredProducts = ProductFilters.filterProducts(searchData.products, newOrgConfig.frontendConfig.uiConfigs.searchConfig.searchFilterConfig, selectedFilters, newOrgConfig.frontendConfig.uiConfigs.searchConfig.additiveDynamicFilters);
64
- return ProductSorter.sort(filteredProducts, sorting);
65
- });
66
- export const searchFiltersAtom = atom((get) => {
67
- var _a, _b;
68
- const searchData = get(searchAtom).data;
69
- const selectedFilters = get(searchSelectedFiltersAtom);
70
- const newOrgConfig = get(newOrgConfigAtom);
71
- if (!(searchData === null || searchData === void 0 ? void 0 : searchData.products) || !((_b = (_a = newOrgConfig === null || newOrgConfig === void 0 ? void 0 : newOrgConfig.frontendConfig) === null || _a === void 0 ? void 0 : _a.uiConfigs) === null || _b === void 0 ? void 0 : _b.searchConfig))
72
- return [];
73
- return ProductFilters.getFiltersForProducts(searchData.products, newOrgConfig.frontendConfig.uiConfigs.searchConfig.searchFilterConfig, selectedFilters);
74
- });
75
- export const addSearchFilterAtom = atom(null, (get, set, filter) => {
76
- const current = get(searchSelectedFiltersAtom);
77
- if (!current.some((f) => f.id === filter.id)) {
78
- set(searchSelectedFiltersAtom, [...current, filter]);
79
- }
80
- });
81
- export const removeSearchFilterAtom = atom(null, (get, set, filterId) => {
82
- const current = get(searchSelectedFiltersAtom);
83
- set(searchSelectedFiltersAtom, current.filter((f) => f.id !== filterId));
84
- });
85
- export const clearSearchFiltersAtom = atom(null, (_, set) => {
86
- set(searchSelectedFiltersAtom, []);
87
- });
88
- export const performSearchAtom = atom(null, async (get, set, params, allowRedirect = false) => {
89
- var _a, _b, _c;
90
- const currentState = get(searchAtom);
91
- const newOrgConfig = get(newOrgConfigAtom);
92
- const redirectSearchResultsUrl = (_c = (_b = (_a = newOrgConfig === null || newOrgConfig === void 0 ? void 0 : newOrgConfig.frontendConfig) === null || _a === void 0 ? void 0 : _a.uiConfigs) === null || _b === void 0 ? void 0 : _b.searchConfig) === null || _c === void 0 ? void 0 : _c.redirectSearchResultsUrl;
93
- if (allowRedirect && redirectSearchResultsUrl) {
94
- const redirectUrl = new URL(redirectSearchResultsUrl);
95
- redirectUrl.searchParams.set('es', 'true');
96
- redirectUrl.searchParams.set('esq', params.query);
97
- window.location.href = redirectUrl.toString();
98
- }
99
- else {
100
- // Update URL and manually trigger state change (since pushState doesn't trigger popstate)
101
- const url = new URL(window.location.href);
102
- url.searchParams.set('es', 'true');
103
- url.searchParams.set('esq', params.query);
104
- window.history.pushState({}, '', url);
105
- // Manually trigger page variant re-evaluation by dispatching a popstate event
106
- // This ensures the page variant system detects the URL change and mounts search results
107
- window.dispatchEvent(new PopStateEvent('popstate', { state: {} }));
108
- }
109
- // Manually trigger page variant re-evaluation by dispatching a popstate event
110
- // This ensures the page variant system detects the URL change and mounts search results
111
- window.dispatchEvent(new PopStateEvent('popstate', { state: {} }));
112
- if (currentState.loading) {
113
- return; // Prevent concurrent searches
114
- }
115
- set(searchAtom, {
116
- data: null,
117
- loading: true,
118
- error: null,
119
- lastQuery: params.query,
120
- });
121
- try {
122
- const searchServiceFunction = getSearchServiceFunction();
123
- const result = await searchServiceFunction(params);
124
- set(searchAtom, {
125
- data: result,
126
- loading: false,
127
- error: null,
128
- lastQuery: params.query,
129
- });
130
- }
131
- catch (error) {
132
- const errorMessage = error instanceof Error ? error.message : 'An unknown error occurred';
133
- set(searchAtom, {
134
- data: null,
135
- loading: false,
136
- error: errorMessage,
137
- lastQuery: params.query,
138
- });
139
- }
140
- });
@@ -1,14 +0,0 @@
1
- // This will be set by the SearchProvider when it initializes
2
- let searchServiceFunction = null;
3
- export const setSearchServiceFunction = (fn) => {
4
- searchServiceFunction = fn;
5
- };
6
- export const getSearchServiceFunction = () => {
7
- if (!searchServiceFunction) {
8
- throw new Error("Search service function not initialized. Make sure SearchProvider is mounted.");
9
- }
10
- return searchServiceFunction;
11
- };
12
- export const clearSearchServiceFunction = () => {
13
- searchServiceFunction = null;
14
- };
@@ -1,15 +0,0 @@
1
- export const formatFilterDisplayName = (displayName) => {
2
- const sizes = ['xxxs', 'xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl', 'xxxl', 'xxxxl'];
3
- const processedWords = displayName
4
- .toLowerCase()
5
- .split(' ')
6
- .map((word) => {
7
- if (sizes.includes(word)) {
8
- return word.toUpperCase();
9
- }
10
- return word.charAt(0).toUpperCase() + word.slice(1);
11
- });
12
- const titleCasedName = processedWords.join(' ');
13
- // Final replacements for special cases
14
- return titleCasedName.replace(/Iphone/g, 'iPhone');
15
- };
@@ -1 +0,0 @@
1
- export * from './locators';
@@ -1,10 +0,0 @@
1
- export const SOCIAL_PROOF_CUSTOMER_COUNT_MESSAGE_TESTID = 'spiffy-social-proof-customer-count-message';
2
- export const SOCIAL_PROOF_CUSTOMER_COUNT_BUTTON_TESTID = 'spiffy-social-proof-customer-count-button';
3
- export const SOCIAL_PROOF_PDP_CONTENTS_TESTID = 'spiffy-social-proof-pdp-contents';
4
- export const SOCIAL_PROOF_PLP_CONTENTS_TESTID = 'spiffy-social-proof-plp-contents';
5
- export const SOCIAL_PROOF_SUGGESTION_FOOTER_TESTID = 'spiffy-social-proof-suggestion-footer';
6
- export const SOCIAL_PROOF_WIDGET_TESTID = 'spiffy-social-proof-widget';
7
- export const SOCIAL_PROOF_WIDGET_HEADER_TESTID = 'spiffy-social-proof-widget-header';
8
- // used in spanx config
9
- export const TOP_IMAGE_BANNER_PLP_TESTID = 'spiffy-top-image-banner-plp';
10
- export const BOTTOM_IMAGE_BANNER_PLP_TESTID = 'spiffy-bottom-image-banner-plp';
@@ -1,21 +0,0 @@
1
- // Test ids for components rendered inside the chat modal, and the chat modal
2
- export const CHAT_CONTAINER_ID = '#spiffy-modal-container';
3
- export const CHAT_HEADER_CONTAINER_TESTID = 'spiffy-chat-header-container';
4
- export const CHAT_HEADER_CLOSE_BUTTON_TESTID = 'spiffy-chat-header-close-button';
5
- export const CHAT_MESSAGE_CONTAINER_TESTID = 'spiffy-chat-message-container';
6
- export const CHAT_MESSAGE_DIVIDER_TESTID = 'spiffy-chat-message-divider';
7
- export const CHAT_MODAL_TESTID = 'spiffy-modal-shadow-dom-container';
8
- export const CHAT_REPLY_INPUT_TESTID = 'spiffy-chat-reply-input';
9
- export const CHAT_REPLY_INPUT_SEND_BUTTON_TESTID = 'spiffy-chat-reply-input-send-button';
10
- export const CHAT_VIEW_PREVIOUS_MESSAGES_TESTID = 'spiffy-chat-view-previous-messages';
11
- export const DYNAMIC_CAROUSEL_TESTID = 'dynamic-carousel';
12
- export const IMAGE_STACK_TESTID = 'spiffy-product-comparison-image-stack';
13
- export const IMAGE_STACK_FIRST_IMAGE_TESTID = 'spiffy-product-comparison-image-stack-first-image';
14
- export const IMAGE_STACK_SECOND_IMAGE_TESTID = 'spiffy-product-comparison-image-stack-second-image';
15
- export const LOADING_MESSAGE_CONTAINER_TESTID = 'spiffy-messages-loading-container';
16
- export const MOBILE_CHAT_HEADER_TESTID = 'spiffy-mobile-chat-header';
17
- export const SCROLLABLE_SUGGESTIONS_TESTID = 'spiffy-scrollable-suggestions';
18
- export const SUGGESTION_BAR_TESTID = 'spiffy-suggestion-bar';
19
- export const SUGGESTION_BAR_BUTTON_TESTID = 'spiffy-suggestion-bar-button';
20
- export const TAG_TESTID = 'spiffy-tag';
21
- export const ANIMATED_MESSAGES_TESTID = 'spiffy-animated-messages';