@envive-ai/react-hooks 0.2.4 → 0.2.6-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AmplitudeOperations-CDe6oRn4.cjs +41 -0
- package/dist/AmplitudeOperations-zFjk1Mkm.js +34 -0
- package/dist/{NewOrgConfig-xNlcpcF_.js → NewOrgConfig-ChNJ3ZtC.js} +2 -2
- package/dist/{NewOrgConfig-B_1A1d9q.cjs → NewOrgConfig-KHz61ikr.cjs} +2 -2
- package/dist/TrackComponentVisibleEvent-f8ahqV1g.js +53 -0
- package/dist/TrackComponentVisibleEvent-uEzgBXb9.cjs +60 -0
- package/dist/amplitudeContext-CRFxGj_x.d.ts +52 -0
- package/dist/amplitudeContext-ZkerrMUa.d.cts +52 -0
- package/dist/api-1-73JxnF.js +166 -0
- package/dist/api-ZNG6wObS.cjs +239 -0
- package/dist/application/models/graphql/index.cjs +3 -3
- package/dist/application/models/graphql/index.d.cts +2 -2
- package/dist/application/models/graphql/index.d.ts +2 -2
- package/dist/application/models/graphql/index.js +2 -3
- package/dist/application/models/guards/api/index.cjs +3 -3
- package/dist/application/models/guards/api/index.d.cts +2 -2
- package/dist/application/models/guards/api/index.d.ts +2 -2
- package/dist/application/models/guards/api/index.js +3 -3
- package/dist/application/models/guards/utils.cjs +1 -1
- package/dist/application/models/guards/utils.d.ts +1 -1
- package/dist/application/models/guards/utils.js +1 -1
- package/dist/application/models/index.cjs +7 -23
- package/dist/application/models/index.d.cts +167 -11
- package/dist/application/models/index.d.ts +168 -12
- package/dist/application/models/index.js +7 -11
- package/dist/application/utils/index.cjs +18 -18
- package/dist/application/utils/index.d.cts +16 -65
- package/dist/application/utils/index.d.ts +14 -63
- package/dist/application/utils/index.js +18 -18
- package/dist/{atomStore-BLYJ2ZoQ.js → atomStore-DAQvNPkh.js} +1 -1
- package/dist/{atomStore-8ppNkJ_n.cjs → atomStore-DD9g7Zw2.cjs} +1 -1
- package/dist/atoms/app/index.cjs +18 -18
- package/dist/atoms/app/index.d.cts +9 -20
- package/dist/atoms/app/index.d.ts +8 -19
- package/dist/atoms/app/index.js +18 -18
- package/dist/atoms/atomStore/index.cjs +1 -1
- package/dist/atoms/atomStore/index.js +1 -1
- package/dist/atoms/chat/index.cjs +20 -20
- package/dist/atoms/chat/index.d.cts +37 -45
- package/dist/atoms/chat/index.d.ts +35 -43
- package/dist/atoms/chat/index.js +20 -20
- package/dist/atoms/globalSearch/index.cjs +1 -1
- package/dist/atoms/globalSearch/index.d.cts +6 -6
- package/dist/atoms/globalSearch/index.d.ts +6 -6
- package/dist/atoms/globalSearch/index.js +1 -1
- package/dist/atoms/org/index.cjs +10 -11
- package/dist/atoms/org/index.d.cts +19 -31
- package/dist/atoms/org/index.d.ts +19 -31
- package/dist/atoms/org/index.js +2 -3
- package/dist/atoms/search/index.cjs +6 -46
- package/dist/atoms/search/index.d.cts +76 -14
- package/dist/atoms/search/index.d.ts +76 -14
- package/dist/atoms/search/index.js +6 -28
- package/dist/atoms/search/utils.d.cts +1 -1
- package/dist/atoms/search/utils.d.ts +1 -1
- package/dist/cdnContext-BLNiW2HT.cjs +53 -0
- package/dist/cdnContext-DT6J5nCw.js +38 -0
- package/dist/chat-C0cgfkL8.js +230 -0
- package/dist/{chat-pXCsesuS.js → chat-ClvJ9xEj.js} +1 -1
- package/dist/{chat-sCX7aTrz.cjs → chat-DCGriB7h.cjs} +1 -1
- package/dist/chat-DULmjtx1.cjs +330 -0
- package/dist/chatState-BrSfXIV4.cjs +120 -0
- package/dist/chatState-Cn8JGAlH.js +34 -0
- package/dist/{common-4xhjcUbt.cjs → common-DQPvV_S_.cjs} +1 -1
- package/dist/{common-DhKoZ6jN.js → common-c_4eX0qn.js} +1 -1
- package/dist/{components-BUisjl4v.js → components-CDpaMUjK.js} +1 -1
- package/dist/{components-DVaYBroL.cjs → components-DKwVHIjq.cjs} +1 -1
- package/dist/config/index.cjs +71 -0
- package/dist/config/index.d.cts +5 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.js +6 -0
- package/dist/config/locators/components/chat/index.cjs +1 -1
- package/dist/config/locators/components/chat/index.d.cts +1 -1
- package/dist/config/locators/components/chat/index.d.ts +1 -1
- package/dist/config/locators/components/chat/index.js +1 -1
- package/dist/config/locators/components/chat/variants/index.d.cts +1 -1
- package/dist/config/locators/components/chat/variants/index.d.ts +1 -1
- package/dist/config/locators/components/common/index.cjs +1 -1
- package/dist/config/locators/components/common/index.d.cts +1 -1
- package/dist/config/locators/components/common/index.d.ts +1 -1
- package/dist/config/locators/components/common/index.js +1 -1
- package/dist/config/locators/components/index.cjs +1 -1
- package/dist/config/locators/components/index.d.cts +1 -1
- package/dist/config/locators/components/index.d.ts +1 -1
- package/dist/config/locators/components/index.js +1 -1
- package/dist/config/locators/components/search/index.d.cts +1 -1
- package/dist/config/locators/components/search/index.d.ts +1 -1
- package/dist/config/locators/index.cjs +23 -44
- package/dist/config/locators/index.d.cts +5 -26
- package/dist/config/locators/index.d.ts +5 -26
- package/dist/config/locators/index.js +5 -26
- package/dist/contexts/amplitudeContext/index.cjs +18 -18
- package/dist/contexts/amplitudeContext/index.d.cts +1 -1
- package/dist/contexts/amplitudeContext/index.d.ts +1 -1
- package/dist/contexts/amplitudeContext/index.js +18 -18
- package/dist/contexts/cdnContext/index.cjs +4 -4
- package/dist/contexts/cdnContext/index.d.cts +2 -6
- package/dist/contexts/cdnContext/index.d.ts +2 -6
- package/dist/contexts/cdnContext/index.js +4 -4
- package/dist/contexts/enviveConfigContext/index.cjs +4 -4
- package/dist/contexts/enviveConfigContext/index.d.cts +3 -24
- package/dist/contexts/enviveConfigContext/index.d.ts +3 -24
- package/dist/contexts/enviveConfigContext/index.js +4 -4
- package/dist/contexts/enviveCssContext/index.cjs +15 -19
- package/dist/contexts/enviveCssContext/index.d.cts +3 -5
- package/dist/contexts/enviveCssContext/index.d.ts +3 -5
- package/dist/contexts/enviveCssContext/index.js +15 -19
- package/dist/contexts/featureFlagContext/index.cjs +9 -10
- package/dist/contexts/featureFlagContext/index.d.cts +3 -11
- package/dist/contexts/featureFlagContext/index.d.ts +3 -11
- package/dist/contexts/featureFlagContext/index.js +6 -7
- package/dist/contexts/featureFlagServiceContext/index.cjs +4 -3
- package/dist/contexts/featureFlagServiceContext/index.d.cts +1 -4
- package/dist/contexts/featureFlagServiceContext/index.d.ts +1 -4
- package/dist/contexts/featureFlagServiceContext/index.js +4 -3
- package/dist/contexts/graphqlContext/index.cjs +8 -13
- package/dist/contexts/graphqlContext/index.d.cts +11 -14
- package/dist/contexts/graphqlContext/index.d.ts +11 -14
- package/dist/contexts/graphqlContext/index.js +8 -13
- package/dist/contexts/localStorageContext/index.cjs +3 -3
- package/dist/contexts/localStorageContext/index.d.cts +3 -22
- package/dist/contexts/localStorageContext/index.d.ts +3 -22
- package/dist/contexts/localStorageContext/index.js +4 -3
- package/dist/contexts/newOrgConfigContext/index.cjs +13 -17
- package/dist/contexts/newOrgConfigContext/index.d.cts +12 -15
- package/dist/contexts/newOrgConfigContext/index.d.ts +12 -15
- package/dist/contexts/newOrgConfigContext/index.js +13 -17
- package/dist/contexts/searchContext/index.cjs +23 -23
- package/dist/contexts/searchContext/index.d.cts +2 -7
- package/dist/contexts/searchContext/index.d.ts +2 -7
- package/dist/contexts/searchContext/index.js +23 -23
- package/dist/contexts/sessionStorageContext/index.cjs +2 -2
- package/dist/contexts/sessionStorageContext/index.d.cts +2 -6
- package/dist/contexts/sessionStorageContext/index.d.ts +2 -6
- package/dist/contexts/sessionStorageContext/index.js +2 -2
- package/dist/contexts/shopifyUrlContext/index.cjs +2 -2
- package/dist/contexts/shopifyUrlContext/index.d.cts +2 -11
- package/dist/contexts/shopifyUrlContext/index.d.ts +2 -11
- package/dist/contexts/shopifyUrlContext/index.js +2 -2
- package/dist/contexts/systemSettingsContext/index.cjs +4 -4
- package/dist/contexts/systemSettingsContext/index.d.cts +4 -14
- package/dist/contexts/systemSettingsContext/index.d.ts +4 -14
- package/dist/contexts/systemSettingsContext/index.js +4 -4
- package/dist/contexts/userIdentityContext/index.cjs +18 -18
- package/dist/contexts/userIdentityContext/index.d.cts +11 -2
- package/dist/contexts/userIdentityContext/index.d.ts +11 -2
- package/dist/contexts/userIdentityContext/index.js +18 -18
- package/dist/dist-BZX_Mgfn.cjs +6019 -0
- package/dist/dist-CIM4YRqp.js +5923 -0
- package/dist/domObserver-DKcas6tl.js +1 -1
- package/dist/domObserver-Do6RAJdf.cjs +1 -1
- package/dist/enviveConfig-DaotBKMS.cjs +130 -0
- package/dist/enviveConfig-DrvYlCYG.js +62 -0
- package/dist/enviveConfigContext--89ejDs5.cjs +60 -0
- package/dist/enviveConfigContext-BCnzgk4M.js +45 -0
- package/dist/events/index.cjs +2 -3
- package/dist/events/index.d.cts +2 -15
- package/dist/events/index.d.ts +2 -15
- package/dist/events/index.js +2 -2
- package/dist/events-CgFGtanE.cjs +69 -0
- package/dist/events-WOOrnUAx.js +63 -0
- package/dist/exceptions/index.cjs +4 -0
- package/dist/exceptions/index.d.cts +12 -0
- package/dist/exceptions/index.d.ts +12 -0
- package/dist/exceptions/index.js +3 -0
- package/dist/exceptions-BiSWJEl2.cjs +32 -0
- package/dist/exceptions-DSv0ZaH0.js +20 -0
- package/dist/featureFlagServiceContext-B7je7VZV.d.cts +24 -0
- package/dist/featureFlagServiceContext-BztKnBPk.cjs +66 -0
- package/dist/featureFlagServiceContext-DpdlcjNb.js +46 -0
- package/dist/featureFlagServiceContext-ahy3jou0.d.ts +24 -0
- package/dist/{globalSearch-OiF96VLG.cjs → globalSearch-Cpc8egsM.cjs} +1 -1
- package/dist/{globalSearch-B_v9qfCT.js → globalSearch-nmrfGLOn.js} +1 -1
- package/dist/graphql-CWNkUHFV.js +46 -0
- package/dist/graphql-DT-H-lta.cjs +70 -0
- package/dist/graphqlContext-B181y-sa.cjs +111 -0
- package/dist/graphqlContext-CWulFxxC.js +96 -0
- package/dist/hooks/AmplitudeOperations/index.cjs +20 -21
- package/dist/hooks/AmplitudeOperations/index.d.cts +2 -2
- package/dist/hooks/AmplitudeOperations/index.d.ts +2 -2
- package/dist/hooks/AmplitudeOperations/index.js +19 -20
- package/dist/hooks/AppDetails/index.cjs +21 -21
- package/dist/hooks/AppDetails/index.d.cts +3 -23
- package/dist/hooks/AppDetails/index.d.ts +3 -23
- package/dist/hooks/AppDetails/index.js +21 -21
- package/dist/hooks/CdnOperations/index.cjs +4 -4
- package/dist/hooks/CdnOperations/index.js +4 -4
- package/dist/hooks/ChatToggle/index.cjs +23 -23
- package/dist/hooks/ChatToggle/index.d.cts +2 -2
- package/dist/hooks/ChatToggle/index.d.ts +2 -2
- package/dist/hooks/ChatToggle/index.js +21 -21
- package/dist/hooks/ChatToggleAnalytics/index.cjs +22 -23
- package/dist/hooks/ChatToggleAnalytics/index.d.cts +2 -2
- package/dist/hooks/ChatToggleAnalytics/index.d.ts +2 -2
- package/dist/hooks/ChatToggleAnalytics/index.js +21 -22
- package/dist/hooks/CustomerSupportHandoff/index.cjs +2 -2
- package/dist/hooks/CustomerSupportHandoff/index.js +2 -2
- package/dist/hooks/Debounce/index.cjs +20 -2
- package/dist/hooks/Debounce/index.js +18 -2
- package/dist/hooks/ElementObserver/index.cjs +3 -5
- package/dist/hooks/ElementObserver/index.d.cts +4 -25
- package/dist/hooks/ElementObserver/index.d.ts +4 -25
- package/dist/hooks/ElementObserver/index.js +3 -5
- package/dist/hooks/GrabAndScroll/index.cjs +1 -1
- package/dist/hooks/GrabAndScroll/index.js +1 -1
- package/dist/hooks/GraphQLConfig/index.cjs +9 -14
- package/dist/hooks/GraphQLConfig/index.d.cts +2 -13
- package/dist/hooks/GraphQLConfig/index.d.ts +2 -13
- package/dist/hooks/GraphQLConfig/index.js +9 -14
- package/dist/hooks/IdentifyUser/index.cjs +18 -18
- package/dist/hooks/IdentifyUser/index.js +18 -18
- package/dist/hooks/ImageResolver/index.cjs +20 -29
- package/dist/hooks/ImageResolver/index.js +20 -29
- package/dist/hooks/Intersection/index.cjs +1 -1
- package/dist/hooks/Intersection/index.js +1 -1
- package/dist/hooks/LocalStorageOperations/index.cjs +8 -7
- package/dist/hooks/LocalStorageOperations/index.js +4 -3
- package/dist/hooks/MessageFilter/index.cjs +3 -12
- package/dist/hooks/MessageFilter/index.d.cts +2 -17
- package/dist/hooks/MessageFilter/index.d.ts +2 -17
- package/dist/hooks/MessageFilter/index.js +2 -11
- package/dist/hooks/NewOrgConfig/index.cjs +14 -18
- package/dist/hooks/NewOrgConfig/index.d.cts +3 -16
- package/dist/hooks/NewOrgConfig/index.d.ts +3 -16
- package/dist/hooks/NewOrgConfig/index.js +14 -18
- package/dist/hooks/Search/index.cjs +331 -166
- package/dist/hooks/Search/index.d.cts +3 -57
- package/dist/hooks/Search/index.d.ts +3 -57
- package/dist/hooks/Search/index.js +319 -155
- package/dist/hooks/SearchOperations/index.cjs +24 -24
- package/dist/hooks/SearchOperations/index.d.cts +2 -3
- package/dist/hooks/SearchOperations/index.d.ts +2 -3
- package/dist/hooks/SearchOperations/index.js +24 -24
- package/dist/hooks/SessionStorageOperations/index.cjs +2 -2
- package/dist/hooks/SessionStorageOperations/index.js +2 -2
- package/dist/hooks/ShopifyUrlOperations/index.cjs +3 -3
- package/dist/hooks/ShopifyUrlOperations/index.d.cts +3 -5
- package/dist/hooks/ShopifyUrlOperations/index.d.ts +3 -5
- package/dist/hooks/ShopifyUrlOperations/index.js +3 -3
- package/dist/hooks/SnapCalculator/index.cjs +1 -1
- package/dist/hooks/SnapCalculator/index.d.cts +4 -3
- package/dist/hooks/SnapCalculator/index.d.ts +4 -3
- package/dist/hooks/SnapCalculator/index.js +1 -1
- package/dist/hooks/SystemSettingsContext/index.cjs +17 -6
- package/dist/hooks/SystemSettingsContext/index.d.cts +5 -15
- package/dist/hooks/SystemSettingsContext/index.d.ts +5 -15
- package/dist/hooks/SystemSettingsContext/index.js +15 -6
- package/dist/hooks/TrackComponentVisibleEvent/index.cjs +20 -20
- package/dist/hooks/TrackComponentVisibleEvent/index.d.cts +2 -3
- package/dist/hooks/TrackComponentVisibleEvent/index.d.ts +2 -3
- package/dist/hooks/TrackComponentVisibleEvent/index.js +20 -20
- package/dist/hooks/UpdateAnalyticsProps/index.cjs +20 -20
- package/dist/hooks/UpdateAnalyticsProps/index.js +19 -19
- package/dist/hooks/utils.cjs +1 -1
- package/dist/hooks/utils.d.cts +20 -13
- package/dist/hooks/utils.d.ts +20 -13
- package/dist/hooks/utils.js +1 -1
- package/dist/index-B4cSHxVN.d.ts +22 -0
- package/dist/{index-DzbkQtaK.d.cts → index-BQpWG3Jm.d.cts} +1 -1
- package/dist/index-BVZbvpx_.d.cts +11 -0
- package/dist/index-CEmUfoZa.d.ts +42 -0
- package/dist/index-CMZcE7pk.d.cts +224 -0
- package/dist/{index-DzzKdrcZ.d.ts → index-CYGpI6hE.d.ts} +1 -1
- package/dist/{index-9NE86em3.d.cts → index-ClVBVK15.d.cts} +1 -1
- package/dist/{index-Dy22w7kg.d.ts → index-Clf4wYaJ.d.ts} +1 -1
- package/dist/index-DeQte6mb.d.ts +11 -0
- package/dist/index-Dzv6WwSZ.d.ts +224 -0
- package/dist/index-ca7Qn8o0.d.cts +22 -0
- package/dist/{index-C1nwLU6Q.d.ts → index-dngXrfnT.d.ts} +1 -1
- package/dist/index-qOBU4GEh.d.cts +42 -0
- package/dist/{index-Da1s8h5C.d.cts → index-w64il54a.d.cts} +1 -1
- package/dist/interceptors/index.cjs +28 -3
- package/dist/interceptors/index.d.cts +4 -15
- package/dist/interceptors/index.d.ts +4 -15
- package/dist/interceptors/index.js +25 -3
- package/dist/localStorageContext-DSpmlfyr.js +90 -0
- package/dist/localStorageContext-DbWl7Row.cjs +104 -0
- package/dist/locators-BMQGmGLq.js +23 -0
- package/dist/locators-DxYdak1F.cjs +131 -0
- package/dist/{logger-Cp7J4YJT.cjs → logger-BF6iGSVd.cjs} +1 -1
- package/dist/{logger-oAgZx2-m.js → logger-DCs3_11o.js} +1 -1
- package/dist/models-158fyHt9.cjs +1305 -0
- package/dist/models-DEJUuKYQ.js +1118 -0
- package/dist/newOrgConfigAtom-BuQE_zPK.js +8 -0
- package/dist/{newOrgConfigAtom-B9FW3fDc.cjs → newOrgConfigAtom-rrYHmp1b.cjs} +1 -1
- package/dist/newOrgConfigContext-BVrzYatq.cjs +68 -0
- package/dist/newOrgConfigContext-C0LzIRJ7.js +53 -0
- package/dist/nodeSelector-CbWcUbuc.d.ts +28 -0
- package/dist/nodeSelector-Cj-Xl1LP.d.cts +28 -0
- package/dist/org-CVjyv-gv.cjs +111 -0
- package/dist/org-Ct9Vjv1J.js +32 -0
- package/dist/search-C0TAcTeY.cjs +312 -0
- package/dist/search-DLHzcbfP.js +233 -0
- package/dist/searchContext-Dmtue5QO.js +129 -0
- package/dist/searchContext-l_23fiuP.cjs +145 -0
- package/dist/searchServiceAdapter-B0h7psvh.js +16 -0
- package/dist/searchServiceAdapter-BclWy4fE.cjs +34 -0
- package/dist/sessionStorageContext-BOyr7mIM.cjs +66 -0
- package/dist/sessionStorageContext-ClXN9eX4.js +52 -0
- package/dist/shopifyUrlContext-G9eqIcsL.cjs +75 -0
- package/dist/shopifyUrlContext-WAm0pnPh.js +61 -0
- package/dist/src/application/commerce-api.js +406 -0
- package/dist/src/application/logging/logger.js +16 -0
- package/dist/src/application/models/graphql/index.js +3 -0
- package/dist/src/application/models/graphql/queries/getMerchantColorsQuery.js +13 -0
- package/dist/src/application/models/graphql/queries/getMerchantFrontendConfigQuery.js +13 -0
- package/dist/src/application/models/graphql/queries/getMerchantOrgIdQuery.js +10 -0
- package/dist/src/application/models/guards/api/index.js +12 -0
- package/dist/src/application/models/guards/api/isApiFormResponse.js +59 -0
- package/dist/src/application/models/guards/api/isApiFormSubmittedResponseAttributes.js +22 -0
- package/dist/src/application/models/guards/api/isApiOrderResponseAttributes.js +91 -0
- package/dist/src/application/models/guards/api/isApiOrgConfigResults.js +188 -0
- package/dist/src/application/models/guards/api/isApiOrganizationConfig.js +115 -0
- package/dist/src/application/models/guards/api/isApiPDPEventAttributes.js +16 -0
- package/dist/src/application/models/guards/api/isApiPLPEventAttributes.js +26 -0
- package/dist/src/application/models/guards/api/isApiPageResponseAttributes.js +15 -0
- package/dist/src/application/models/guards/api/isApiProductResponseAttributes.js +65 -0
- package/dist/src/application/models/guards/api/isApiProductSearchAttributes.js +15 -0
- package/dist/src/application/models/guards/api/isApiProductSearchFilterAttributes.js +10 -0
- package/dist/src/application/models/guards/api/isApiQueryTypedEventAttributes.js +4 -0
- package/dist/src/application/models/guards/api/isApiResponse.js +33 -0
- package/dist/src/application/models/guards/api/isApiReviewResponseAttributes.js +22 -0
- package/dist/src/application/models/guards/api/isApiReviewRichInformation.js +23 -0
- package/dist/src/application/models/guards/api/isApiSearchEventAttributes.js +20 -0
- package/dist/src/application/models/guards/api/isApiSuggestion.js +24 -0
- package/dist/src/application/models/guards/api/isApiSuggestionClickedEventAttributes.js +4 -0
- package/dist/src/application/models/guards/api/isApiTextResponseAttributes.js +4 -0
- package/dist/src/application/models/guards/api/isApiUserEvent.js +18 -0
- package/dist/src/application/models/guards/graphQL/isGraphQLColorsConfig.js +41 -0
- package/dist/src/application/models/guards/isBaseEcommerceEvent.js +14 -0
- package/dist/src/application/models/guards/isGA4EcommerceEvent.js +14 -0
- package/dist/src/application/models/guards/isLegacyUAEcommerceEvent.js +14 -0
- package/dist/src/application/models/guards/isMobilePLPChatPlacementParameter.js +4 -0
- package/dist/src/application/models/guards/isSpanxTakeAQuizCtaParameter.js +1 -0
- package/dist/src/application/models/guards/isVariantInfo.js +28 -0
- package/dist/src/application/models/guards/utils.js +34 -0
- package/dist/src/application/models/index.js +34 -0
- package/dist/src/application/models/utils/snakeToCamelTransformer.js +71 -0
- package/dist/src/application/models/utils/stringToFulfillmentDisplayStatusEnumValue.js +65 -0
- package/dist/src/application/models/validators/validateGraphQLColorsConfig.js +9 -0
- package/dist/src/application/models/validators/validateGraphQLFrontendConfig.js +420 -0
- package/dist/src/application/models/validators/validateGraphQLOrgId.js +6 -0
- package/dist/src/application/models/validators/validateMobilePLPChatPlacementParameter.js +9 -0
- package/dist/src/application/models/validators/validateOrgConfigResults.js +44 -0
- package/dist/src/application/models/validators/validateOrganizationConfig.js +34 -0
- package/dist/src/application/models/validators/validateResponse.js +173 -0
- package/dist/src/application/models/validators/validateSuggestion.js +13 -0
- package/dist/src/application/models/validators/validateUserEvent.js +91 -0
- package/dist/src/application/utils/analyticsUtils.js +94 -0
- package/dist/src/application/utils/coreContextToApiContext.js +8 -0
- package/dist/src/application/utils/coreUserEventToApiUserEvent.js +90 -0
- package/dist/src/application/utils/divideArray.js +7 -0
- package/dist/src/application/utils/domObserver.js +85 -0
- package/dist/src/application/utils/elementObserver.js +186 -0
- package/dist/src/application/utils/imageFilter.js +11 -0
- package/dist/src/application/utils/index.js +21 -0
- package/dist/src/application/utils/merchantUtils.js +15 -0
- package/dist/src/application/utils/messageFromFormSubmittedEvent.js +19 -0
- package/dist/src/application/utils/messageFromQueryEvent.js +35 -0
- package/dist/src/application/utils/messageFromResponse.js +123 -0
- package/dist/src/application/utils/messageFromSuggestionEvent.js +27 -0
- package/dist/src/application/utils/mouseEventTypes.js +1 -0
- package/dist/src/application/utils/mutationHelper.js +33 -0
- package/dist/src/application/utils/nextMessageRequestToApiRequest.js +29 -0
- package/dist/src/application/utils/nodeSelector.js +101 -0
- package/dist/src/application/utils/overrides.js +144 -0
- package/dist/src/application/utils/stringUtils.js +47 -0
- package/dist/src/application/utils/supportedEventRequestToApiRequest.js +7 -0
- package/dist/src/application/utils/urlsParser.js +33 -0
- package/dist/src/application/utils/validation.js +5 -0
- package/dist/src/atoms/amplitude/amplitudeTrackEventAtom.js +4 -0
- package/dist/src/atoms/app/index.js +23 -0
- package/dist/src/atoms/app/variant.js +102 -0
- package/dist/src/atoms/atomStore/atomStore.js +28 -0
- package/dist/src/atoms/atomStore/index.js +1 -0
- package/dist/src/atoms/chat/chatState.js +33 -0
- package/dist/src/atoms/chat/form.js +16 -0
- package/dist/src/atoms/chat/index.js +23 -0
- package/dist/src/atoms/chat/lastMessage.js +10 -0
- package/dist/src/atoms/chat/messageQueue.js +68 -0
- package/dist/src/atoms/chat/performanceMetrics.js +70 -0
- package/dist/src/atoms/chat/renderedWidgetRefs.js +24 -0
- package/dist/src/atoms/chat/replies.js +43 -0
- package/dist/src/atoms/chat/suggestions.js +29 -0
- package/dist/src/atoms/envive/enviveConfig.js +67 -0
- package/dist/src/atoms/globalSearch/globalSearch.js +8 -0
- package/dist/src/atoms/globalSearch/index.js +1 -0
- package/dist/src/atoms/org/customerService.js +6 -0
- package/dist/src/atoms/org/graphqlConfig.js +8 -0
- package/dist/src/atoms/org/index.js +4 -0
- package/dist/src/atoms/org/newOrgConfigAtom.js +2 -0
- package/dist/src/atoms/org/orgAnalyticsConfig.js +8 -0
- package/dist/src/atoms/search/index.js +1 -0
- package/dist/src/atoms/search/productFilters.js +163 -0
- package/dist/src/atoms/search/productRetrievalAPI.js +50 -0
- package/dist/src/atoms/search/productRetrievalAdapter.js +14 -0
- package/dist/src/atoms/search/productSorter.js +13 -0
- package/dist/src/atoms/search/searchAPI.js +140 -0
- package/dist/src/atoms/search/searchServiceAdapter.js +14 -0
- package/dist/src/atoms/search/utils.js +15 -0
- package/dist/src/config/index.js +1 -0
- package/dist/src/config/locators/components/chat/entrypoints.js +10 -0
- package/dist/src/config/locators/components/chat/index.js +21 -0
- package/dist/src/config/locators/components/chat/preview.js +11 -0
- package/dist/src/config/locators/components/chat/variants/index.js +12 -0
- package/dist/src/config/locators/components/common/buttons.js +6 -0
- package/dist/src/config/locators/components/common/cards.js +17 -0
- package/dist/src/config/locators/components/common/index.js +4 -0
- package/dist/src/config/locators/components/common/links.js +1 -0
- package/dist/src/config/locators/components/common/tables.js +1 -0
- package/dist/src/config/locators/components/floating-button.js +2 -0
- package/dist/src/config/locators/components/index.js +3 -0
- package/dist/src/config/locators/components/report-issue.js +13 -0
- package/dist/src/config/locators/components/search/index.js +5 -0
- package/dist/src/config/locators/components/shadow-dom.js +1 -0
- package/dist/src/config/locators/embedded.js +20 -0
- package/dist/src/config/locators/index.js +4 -0
- package/dist/src/contexts/amplitudeContext/amplitudeContext.js +292 -0
- package/dist/src/contexts/amplitudeContext/index.js +1 -0
- package/dist/src/contexts/cdnContext/cdnContext.js +28 -0
- package/dist/src/contexts/cdnContext/index.js +1 -0
- package/dist/src/contexts/enviveConfigContext/enviveConfigContext.js +37 -0
- package/dist/src/contexts/enviveConfigContext/index.js +1 -0
- package/dist/src/contexts/enviveCssContext/enviveCssContext.js +31 -0
- package/dist/src/contexts/enviveCssContext/index.js +1 -0
- package/dist/src/contexts/featureFlagContext/featureFlagContext.js +109 -0
- package/dist/src/contexts/featureFlagContext/index.js +1 -0
- package/dist/src/contexts/featureFlagServiceContext/featureFlagServiceContext.js +47 -0
- package/dist/src/contexts/featureFlagServiceContext/index.js +1 -0
- package/dist/src/contexts/graphqlContext/graphqlContext.js +87 -0
- package/dist/src/contexts/graphqlContext/index.js +1 -0
- package/dist/src/contexts/localStorageContext/index.js +1 -0
- package/dist/src/contexts/localStorageContext/localStorageContext.js +95 -0
- package/dist/src/contexts/newOrgConfigContext/index.js +1 -0
- package/dist/src/contexts/newOrgConfigContext/newOrgConfigContext.js +33 -0
- package/dist/src/contexts/searchContext/index.js +1 -0
- package/dist/src/contexts/searchContext/searchContext.js +131 -0
- package/dist/src/contexts/sessionStorageContext/index.js +1 -0
- package/dist/src/contexts/sessionStorageContext/sessionStorageContext.js +43 -0
- package/dist/src/contexts/shopifyUrlContext/index.js +1 -0
- package/dist/src/contexts/shopifyUrlContext/shopifyUrlContext.js +62 -0
- package/dist/src/contexts/systemSettingsContext/index.js +1 -0
- package/dist/src/contexts/systemSettingsContext/systemSettingsContext.js +29 -0
- package/dist/src/contexts/userIdentityContext/index.js +1 -0
- package/dist/src/contexts/userIdentityContext/userIdentityContext.js +118 -0
- package/dist/src/events/index.js +51 -0
- package/dist/src/events/registerAnalyticsListeners.js +32 -0
- package/dist/src/exceptions/index.js +2 -0
- package/dist/src/exceptions/sessionExceptions.js +6 -0
- package/dist/src/exceptions/unsupportedProductExceptions.js +6 -0
- package/dist/src/hooks/AmplitudeOperations/index.js +1 -0
- package/dist/src/hooks/AmplitudeOperations/useAmplitudeOperations.js +24 -0
- package/dist/src/hooks/AppDetails/index.js +1 -0
- package/dist/src/hooks/AppDetails/useAppDetails.js +26 -0
- package/dist/src/hooks/BlockBackButton/index.js +1 -0
- package/dist/src/hooks/BlockBackButton/useBlockBackButton.js +23 -0
- package/dist/src/hooks/CdnOperations/index.js +1 -0
- package/dist/src/hooks/CdnOperations/useCdnOperations.js +13 -0
- package/dist/src/hooks/ChatToggle/index.js +1 -0
- package/dist/src/hooks/ChatToggle/useChatToggle.js +50 -0
- package/dist/src/hooks/ChatToggleAnalytics/index.js +1 -0
- package/dist/src/hooks/ChatToggleAnalytics/useChatToggleAnalytics.js +11 -0
- package/dist/src/hooks/CustomerSupportHandoff/index.js +1 -0
- package/dist/src/hooks/CustomerSupportHandoff/useCustomerSupportHandoff.js +32 -0
- package/dist/src/hooks/Debounce/index.js +1 -0
- package/dist/src/hooks/Debounce/useDebounce.js +13 -0
- package/dist/src/hooks/ElementObserver/index.js +1 -0
- package/dist/src/hooks/ElementObserver/useElementObserver.js +208 -0
- package/dist/src/hooks/GrabAndScroll/index.js +1 -0
- package/dist/src/hooks/GrabAndScroll/useGrabAndScroll.js +105 -0
- package/dist/src/hooks/GraphQLConfig/index.js +1 -0
- package/dist/src/hooks/GraphQLConfig/useGraphQLConfig.js +54 -0
- package/dist/src/hooks/IdentifyUser/index.js +1 -0
- package/dist/src/hooks/IdentifyUser/useIdentifyUser.js +28 -0
- package/dist/src/hooks/ImageResolver/index.js +1 -0
- package/dist/src/hooks/ImageResolver/useImageResolver.js +45 -0
- package/dist/src/hooks/Intersection/index.js +1 -0
- package/dist/src/hooks/Intersection/useIntersection.js +20 -0
- package/dist/src/hooks/IsSmallScreen/index.js +1 -0
- package/dist/src/hooks/IsSmallScreen/useIsSmallScreen.js +16 -0
- package/dist/src/hooks/LocalStorageOperations/index.js +1 -0
- package/dist/src/hooks/LocalStorageOperations/useLocalStorageOperations.js +64 -0
- package/dist/src/hooks/MessageFilter/index.js +1 -0
- package/dist/src/hooks/MessageFilter/useMessageFilter.js +37 -0
- package/dist/src/hooks/MessageScrollObserver/index.js +1 -0
- package/dist/src/hooks/MessageScrollObserver/useMessageScrollObserver.js +35 -0
- package/dist/src/hooks/NewOrgConfig/index.js +1 -0
- package/dist/src/hooks/NewOrgConfig/useNewOrgConfig.js +5 -0
- package/dist/src/hooks/Search/index.js +1 -0
- package/dist/src/hooks/Search/useRecommendedProducts.js +35 -0
- package/dist/src/hooks/Search/useSearch.js +224 -0
- package/dist/src/hooks/Search/useSearchInput.js +183 -0
- package/dist/src/hooks/SearchOperations/index.js +1 -0
- package/dist/src/hooks/SearchOperations/useSearchOperations.js +78 -0
- package/dist/src/hooks/SessionStorageOperations/index.js +1 -0
- package/dist/src/hooks/SessionStorageOperations/useSessionStorageOperations.js +20 -0
- package/dist/src/hooks/ShopifyUrlOperations/index.js +1 -0
- package/dist/src/hooks/ShopifyUrlOperations/useShopifyUrlOperations.js +34 -0
- package/dist/src/hooks/SnapCalculator/index.js +1 -0
- package/dist/src/hooks/SnapCalculator/useSnapCalculator.js +22 -0
- package/dist/src/hooks/SystemSettingsContext/index.js +1 -0
- package/dist/src/hooks/SystemSettingsContext/useSystemSettingsContext.js +9 -0
- package/dist/src/hooks/TrackComponentVisibleEvent/index.js +1 -0
- package/dist/src/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.js +45 -0
- package/dist/src/hooks/UpdateAnalyticsProps/index.js +1 -0
- package/dist/src/hooks/UpdateAnalyticsProps/useUpdateAnalyticsProps.js +43 -0
- package/dist/src/hooks/utils.js +116 -0
- package/dist/src/interceptors/index.js +1 -0
- package/dist/src/interceptors/useMessageInterceptor.js +24 -0
- package/dist/src/types/ApiResponse.js +1 -0
- package/dist/src/types/FilterAttribute.js +3 -0
- package/dist/src/types/Message.js +24 -0
- package/dist/src/types/Suggestion.js +3 -0
- package/dist/src/types/index.js +4 -0
- package/dist/src/util/colorVar.js +3 -0
- package/dist/src/util/configVersion.js +4 -0
- package/dist/src/util/domInsertion.js +16 -0
- package/dist/systemSettingsContext-Cb5kczBD.cjs +60 -0
- package/dist/systemSettingsContext-CksCdpiU.js +39 -0
- package/dist/types/index.cjs +3 -33
- package/dist/types/index.d.cts +2 -3
- package/dist/types/index.d.ts +2 -3
- package/dist/types/index.js +2 -30
- package/dist/types-18QXD2rd.cjs +39 -0
- package/dist/types-DQC1pHqD.js +27 -0
- package/dist/urlsParser-C-Vzs--G.cjs +78 -0
- package/dist/urlsParser-G7Ocwg0M.js +42 -0
- package/dist/useAppDetails-BJFRSYbI.js +30 -0
- package/dist/useAppDetails-Czn-5FzP.cjs +38 -0
- package/dist/useGraphQLConfig-BEtX5pDM.cjs +76 -0
- package/dist/useGraphQLConfig-Dkcrz1YL.js +63 -0
- package/dist/{useIntersection-UEO0Cezc.js → useIntersection-BWiHkpKL.js} +1 -1
- package/dist/{useIntersection-rV0Q8mBH.cjs → useIntersection-DZHz44BY.cjs} +1 -1
- package/dist/{utils-ARmpTh1O.js → utils-CEKzBcN2.js} +1 -1
- package/dist/utils-CPvqOk0g.cjs +1546 -0
- package/dist/{utils-Cavu4XiM.cjs → utils-CsMbZmRw.cjs} +1 -1
- package/dist/utils-D_kATUj6.js +92 -0
- package/dist/utils-N47VsL9W.js +1364 -0
- package/dist/utils-hYTjy7hJ.cjs +130 -0
- package/dist/{utils-BLe5oreh.d.ts → utils-wWki3L1d.d.ts} +1 -1
- package/package.json +15 -25
- package/src/application/commerce-api.ts +38 -37
- package/src/application/models/graphql/index.ts +1 -0
- package/src/application/models/graphql/queries/getMerchantColorsQuery.ts +1 -23
- package/src/application/models/graphql/queries/getMerchantFrontendConfigQuery.ts +1 -89
- package/src/application/models/guards/api/isApiFormResponse.ts +4 -4
- package/src/application/models/guards/api/isApiFormSubmittedResponseAttributes.ts +2 -2
- package/src/application/models/guards/api/isApiOrderResponseAttributes.ts +2 -20
- package/src/application/models/guards/api/isApiOrgConfigResults.ts +3 -9
- package/src/application/models/guards/api/isApiOrganizationConfig.ts +8 -32
- package/src/application/models/guards/api/isApiPDPEventAttributes.ts +8 -5
- package/src/application/models/guards/api/isApiPLPEventAttributes.ts +14 -10
- package/src/application/models/guards/api/isApiPageResponseAttributes.ts +1 -1
- package/src/application/models/guards/api/isApiProductResponseAttributes.ts +2 -4
- package/src/application/models/guards/api/isApiProductSearchAttributes.ts +9 -6
- package/src/application/models/guards/api/isApiProductSearchFilterAttributes.ts +7 -4
- package/src/application/models/guards/api/isApiQueryTypedEventAttributes.ts +8 -3
- package/src/application/models/guards/api/isApiResponse.ts +22 -15
- package/src/application/models/guards/api/isApiReviewResponseAttributes.ts +1 -1
- package/src/application/models/guards/api/isApiReviewRichInformation.ts +1 -1
- package/src/application/models/guards/api/isApiTextResponseAttributes.ts +1 -1
- package/src/application/models/guards/graphQL/isGraphQLColorsConfig.ts +1 -1
- package/src/application/models/guards/isBaseEcommerceEvent.ts +1 -2
- package/src/application/models/guards/isGA4EcommerceEvent.ts +1 -1
- package/src/application/models/guards/isLegacyUAEcommerceEvent.ts +1 -1
- package/src/application/models/guards/isMobilePLPChatPlacementParameter.ts +1 -3
- package/src/application/models/guards/isSpanxTakeAQuizCtaParameter.ts +5 -3
- package/src/application/models/guards/isVariantInfo.ts +6 -1
- package/src/application/models/index.ts +30 -95
- package/src/application/models/utils/snakeToCamelTransformer.ts +8 -8
- package/src/application/models/validators/validateGraphQLColorsConfig.ts +6 -2
- package/src/application/models/validators/validateGraphQLFrontendConfig.ts +6 -6
- package/src/application/models/validators/validateMobilePLPChatPlacementParameter.ts +5 -3
- package/src/application/models/validators/validateOrgConfigResults.ts +6 -5
- package/src/application/models/validators/validateOrganizationConfig.ts +11 -8
- package/src/application/models/validators/validateResponse.ts +66 -44
- package/src/application/models/validators/validateSuggestion.ts +1 -1
- package/src/application/models/validators/validateUserEvent.ts +23 -12
- package/src/application/utils/analyticsUtils.ts +16 -38
- package/src/application/utils/coreContextToApiContext.ts +3 -1
- package/src/application/utils/coreUserEventToApiUserEvent.ts +2 -2
- package/src/application/utils/elementObserver.ts +1 -1
- package/src/application/utils/imageFilter.ts +5 -2
- package/src/application/utils/index.ts +20 -21
- package/src/application/utils/messageFromFormSubmittedEvent.ts +1 -1
- package/src/application/utils/messageFromQueryEvent.ts +1 -1
- package/src/application/utils/messageFromResponse.ts +14 -10
- package/src/application/utils/messageFromSuggestionEvent.ts +6 -4
- package/src/application/utils/mouseEventTypes.ts +1 -1
- package/src/application/utils/nextMessageRequestToApiRequest.ts +1 -1
- package/src/application/utils/overrides.ts +1 -49
- package/src/application/utils/supportedEventRequestToApiRequest.ts +3 -1
- package/src/application/utils/urlsParser.ts +1 -7
- package/src/atoms/app/index.ts +15 -25
- package/src/atoms/app/variant.ts +1 -1
- package/src/atoms/chat/chatState.ts +9 -14
- package/src/atoms/chat/form.ts +1 -1
- package/src/atoms/chat/messageQueue.ts +25 -50
- package/src/atoms/chat/replies.ts +40 -43
- package/src/atoms/chat/suggestions.ts +34 -29
- package/src/atoms/envive/enviveConfig.ts +14 -20
- package/src/atoms/org/customerService.ts +4 -8
- package/src/atoms/org/graphqlConfig.ts +7 -15
- package/src/atoms/org/index.ts +4 -6
- package/src/atoms/org/newOrgConfigAtom.ts +2 -2
- package/src/atoms/org/orgAnalyticsConfig.ts +1 -1
- package/src/atoms/search/index.ts +0 -1
- package/src/atoms/search/productFilters.ts +72 -52
- package/src/atoms/search/productRetrievalAPI.ts +72 -0
- package/src/atoms/search/productRetrievalAdapter.ts +28 -0
- package/src/atoms/search/productSorter.ts +2 -2
- package/src/atoms/search/searchAPI.ts +42 -60
- package/src/atoms/search/searchServiceAdapter.ts +1 -1
- package/src/config/index.ts +1 -0
- package/src/contexts/amplitudeContext/amplitudeContext.tsx +104 -143
- package/src/contexts/cdnContext/cdnContext.tsx +9 -16
- package/src/contexts/enviveConfigContext/enviveConfigContext.tsx +6 -27
- package/src/contexts/enviveCssContext/enviveCssContext.tsx +5 -12
- package/src/contexts/featureFlagContext/featureFlagContext.tsx +27 -48
- package/src/contexts/featureFlagServiceContext/featureFlagServiceContext.tsx +11 -3
- package/src/contexts/graphqlContext/graphqlContext.tsx +40 -95
- package/src/contexts/localStorageContext/localStorageContext.tsx +26 -60
- package/src/contexts/newOrgConfigContext/newOrgConfigContext.tsx +10 -22
- package/src/contexts/searchContext/searchContext.tsx +29 -49
- package/src/contexts/sessionStorageContext/sessionStorageContext.tsx +12 -33
- package/src/contexts/shopifyUrlContext/shopifyUrlContext.tsx +20 -37
- package/src/contexts/systemSettingsContext/systemSettingsContext.tsx +8 -21
- package/src/contexts/userIdentityContext/userIdentityContext.tsx +33 -77
- package/src/events/index.ts +8 -5
- package/src/events/registerAnalyticsListeners.ts +10 -13
- package/src/exceptions/index.ts +2 -0
- package/src/{types/exceptions → exceptions}/unsupportedProductExceptions.ts +2 -2
- package/src/global.d.ts +8 -0
- package/src/hooks/AmplitudeOperations/useAmplitudeOperations.ts +6 -11
- package/src/hooks/AppDetails/useAppDetails.ts +10 -24
- package/src/hooks/ChatToggle/useChatToggle.ts +7 -19
- package/src/hooks/ChatToggleAnalytics/useChatToggleAnalytics.ts +4 -4
- package/src/hooks/CustomerSupportHandoff/useCustomerSupportHandoff.ts +1 -1
- package/src/hooks/ElementObserver/useElementObserver.ts +14 -32
- package/src/hooks/GrabAndScroll/useGrabAndScroll.ts +125 -124
- package/src/hooks/GraphQLConfig/useGraphQLConfig.ts +5 -7
- package/src/hooks/ImageResolver/useImageResolver.ts +24 -31
- package/src/hooks/LocalStorageOperations/useLocalStorageOperations.ts +12 -19
- package/src/hooks/MessageFilter/useMessageFilter.ts +1 -7
- package/src/hooks/Search/useRecommendedProducts.ts +50 -0
- package/src/hooks/Search/useSearch.tsx +80 -210
- package/src/hooks/Search/useSearchInput.ts +227 -0
- package/src/hooks/SearchOperations/useSearchOperations.ts +8 -12
- package/src/hooks/ShopifyUrlOperations/useShopifyUrlOperations.ts +8 -14
- package/src/hooks/SnapCalculator/useSnapCalculator.ts +1 -2
- package/src/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.ts +8 -11
- package/src/hooks/UpdateAnalyticsProps/useUpdateAnalyticsProps.ts +11 -25
- package/src/hooks/utils.ts +19 -29
- package/src/interceptors/index.ts +1 -2
- package/src/interceptors/useMessageInterceptor.ts +10 -6
- package/src/{application/models/api/response.ts → types/ApiResponse.ts} +35 -29
- package/src/types/FilterAttribute.ts +35 -0
- package/src/{application/models/message.ts → types/Message.ts} +38 -34
- package/src/types/Suggestion.ts +6 -0
- package/src/types/index.ts +4 -4
- package/src/util/colorVar.ts +4 -0
- package/src/util/configVersion.ts +4 -0
- package/src/util/domInsertion.ts +17 -0
- package/dist/SystemSettingsContext-CCuS3kWH.js +0 -13
- package/dist/SystemSettingsContext-Dh_35fES.cjs +0 -20
- package/dist/TrackComponentVisibleEvent-B828giM-.js +0 -52
- package/dist/TrackComponentVisibleEvent-DsTIH7Yt.cjs +0 -59
- package/dist/amplitudeContext-B73xamNe.d.cts +0 -52
- package/dist/amplitudeContext-BfRDG5CX.d.ts +0 -52
- package/dist/api-Bc3_julZ.cjs +0 -239
- package/dist/api-D9gmGNAV.js +0 -166
- package/dist/application/models/utilityTypes/index.cjs +0 -1
- package/dist/application/models/utilityTypes/index.d.cts +0 -2
- package/dist/application/models/utilityTypes/index.d.ts +0 -2
- package/dist/application/models/utilityTypes/index.js +0 -3
- package/dist/application/models/variantInfo/index.cjs +0 -3
- package/dist/application/models/variantInfo/index.d.cts +0 -2
- package/dist/application/models/variantInfo/index.d.ts +0 -2
- package/dist/application/models/variantInfo/index.js +0 -3
- package/dist/atoms/search/types.cjs +0 -5
- package/dist/atoms/search/types.d.cts +0 -2
- package/dist/atoms/search/types.d.ts +0 -2
- package/dist/atoms/search/types.js +0 -3
- package/dist/cdnContext-BlRI74F-.cjs +0 -53
- package/dist/cdnContext-D26C8Y4H.js +0 -38
- package/dist/chat-2NGrmU_Z.cjs +0 -393
- package/dist/chat-Bg3wEfNd.js +0 -257
- package/dist/chatElementDisplayLocation-D6oLuQS4.d.ts +0 -25
- package/dist/chatElementDisplayLocation-DWmfNX_u.d.cts +0 -25
- package/dist/chatSearch-B4dsxGth.cjs +0 -418
- package/dist/chatSearch-Cvc_eBFV.js +0 -295
- package/dist/chatState-2bMtvPgG.js +0 -34
- package/dist/chatState-fP1r34CN.cjs +0 -120
- package/dist/contexts/chatContext/index.cjs +0 -326
- package/dist/contexts/chatContext/index.d.cts +0 -15
- package/dist/contexts/chatContext/index.d.ts +0 -15
- package/dist/contexts/chatContext/index.js +0 -319
- package/dist/contexts/types.cjs +0 -7
- package/dist/contexts/types.d.cts +0 -4
- package/dist/contexts/types.d.ts +0 -4
- package/dist/contexts/types.js +0 -3
- package/dist/enviveConfig-BSfyz_pm.js +0 -62
- package/dist/enviveConfig-D8vcVPWD.cjs +0 -130
- package/dist/enviveConfigContext-C8cCcdKU.cjs +0 -60
- package/dist/enviveConfigContext-CJqpRSKu.js +0 -45
- package/dist/events-BHJJjPDN.js +0 -78
- package/dist/events-B_fJZf9E.cjs +0 -90
- package/dist/featureFlagServiceContext-C2Yj-Uyh.d.ts +0 -23
- package/dist/featureFlagServiceContext-CiKWV306.d.cts +0 -23
- package/dist/featureFlagServiceContext-DFb-uLHN.cjs +0 -62
- package/dist/featureFlagServiceContext-Dd_Hbq6e.js +0 -42
- package/dist/featureGates-BdvOVv8N.cjs +0 -32
- package/dist/featureGates-DhoJq4io.js +0 -26
- package/dist/frontendConfig-CbyjUXZW.d.ts +0 -856
- package/dist/frontendConfig-tVg0hsWZ.d.cts +0 -856
- package/dist/graphql-B9HhDXYt.cjs +0 -53
- package/dist/graphql-W7GMIHUu.js +0 -36
- package/dist/graphqlConfig-DZHeFKDY.cjs +0 -73
- package/dist/graphqlConfig-Xk--JbPl.js +0 -24
- package/dist/graphqlContext-BotK7KCg.d.ts +0 -28
- package/dist/graphqlContext-CMav2igl.d.cts +0 -28
- package/dist/graphqlContext-CSVwhCnP.js +0 -96
- package/dist/graphqlContext-aaOOb79d.cjs +0 -111
- package/dist/index-7VOYQNo5.d.ts +0 -184
- package/dist/index-Bmub8e38.d.cts +0 -98
- package/dist/index-CESxqFso.d.cts +0 -228
- package/dist/index-CG3P8xE1.d.cts +0 -676
- package/dist/index-CalyvQj_.d.ts +0 -1
- package/dist/index-CiWEYzXl.d.cts +0 -184
- package/dist/index-Cyq5HiC0.d.cts +0 -44
- package/dist/index-D9SzePCE.d.cts +0 -186
- package/dist/index-DDZmV951.d.ts +0 -186
- package/dist/index-L7SEpDLz.d.ts +0 -228
- package/dist/index-RcVcRKH7.d.cts +0 -1
- package/dist/index-YrhxAGtH.d.ts +0 -676
- package/dist/index-exSzn3SP.d.ts +0 -44
- package/dist/index-hebsV7fc.d.ts +0 -98
- package/dist/interceptors/types.cjs +0 -1
- package/dist/interceptors/types.d.cts +0 -13
- package/dist/interceptors/types.d.ts +0 -13
- package/dist/interceptors/types.js +0 -3
- package/dist/localStorageContext-Dwgto93_.js +0 -95
- package/dist/localStorageContext-cnMYDllE.cjs +0 -115
- package/dist/models-B1P-dSCW.cjs +0 -1537
- package/dist/models-CgvSM2fW.js +0 -1296
- package/dist/newOrgConfigAtom-CMeY5c6t.js +0 -8
- package/dist/newOrgConfigContext-1uwWWCPa.js +0 -53
- package/dist/newOrgConfigContext-B0v1q3dk.cjs +0 -68
- package/dist/newOrgConfigContext-C8wBmK3q.d.cts +0 -16
- package/dist/newOrgConfigContext-D180PO0t.d.ts +0 -16
- package/dist/nodeSelector-B3bPtEjX.d.cts +0 -31
- package/dist/nodeSelector-DQicm08Y.d.ts +0 -31
- package/dist/org-DU3Wck0R.cjs +0 -43
- package/dist/org-DptftvB6.js +0 -12
- package/dist/search-BtYKpiNB.js +0 -126
- package/dist/search-DYVQuYti.d.ts +0 -20
- package/dist/search-Du6HZpO6.cjs +0 -205
- package/dist/search-filter-types-B5xcaEit.d.ts +0 -102
- package/dist/search-filter-types-DZPTzUK9.d.cts +0 -102
- package/dist/search-y-ioX5Mz.d.cts +0 -20
- package/dist/searchContext-BK43ArCs.cjs +0 -145
- package/dist/searchContext-JjZZhDCe.js +0 -129
- package/dist/searchServiceAdapter-BSPZOg1r.js +0 -16
- package/dist/searchServiceAdapter-DrjFCiw8.cjs +0 -34
- package/dist/sessionStorageContext-BQY9r8zz.js +0 -52
- package/dist/sessionStorageContext-R2yUAkd9.cjs +0 -66
- package/dist/shopifyUrlContext-Bon8_SUJ.js +0 -61
- package/dist/shopifyUrlContext-DUdw1xUH.cjs +0 -75
- package/dist/spiffyWidgets-BuS00VaQ.d.cts +0 -20
- package/dist/spiffyWidgets-DZqG5plz.d.ts +0 -20
- package/dist/systemSettingsContext-BjbhIz6y.js +0 -39
- package/dist/systemSettingsContext-Dv9EmjmZ.cjs +0 -60
- package/dist/test-types-Dl5puRHC.d.ts +0 -40
- package/dist/test-types-ThQiO_cc.d.cts +0 -40
- package/dist/types-BwNrLPSZ.cjs +0 -106
- package/dist/types-CKMMb_gX.d.cts +0 -51
- package/dist/types-Csgpt7EV.d.ts +0 -51
- package/dist/types-D3uOF0Oy.js +0 -76
- package/dist/types-DIk0FLwd.js +0 -30
- package/dist/types-DNLkuGWZ.cjs +0 -48
- package/dist/types-DSW9XODe.d.cts +0 -10
- package/dist/types-DtTnp0o0.js +0 -1
- package/dist/types-a8gm_IaQ.cjs +0 -0
- package/dist/types-oSg-AkO5.d.ts +0 -10
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +0 -15
- package/dist/types.d.ts +0 -15
- package/dist/types.js +0 -1
- package/dist/urlsParser-BV5yF8sa.cjs +0 -78
- package/dist/urlsParser-DUgV_Qy9.js +0 -42
- package/dist/useAmplitudeOperations-C9o_wDU6.cjs +0 -41
- package/dist/useAmplitudeOperations-COq3L1no.js +0 -34
- package/dist/useAppDetails-C4GTLEIR.cjs +0 -38
- package/dist/useAppDetails-CEksA88Q.js +0 -30
- package/dist/useDebounce--rPGMuE7.js +0 -19
- package/dist/useDebounce-DECHWSTn.cjs +0 -26
- package/dist/useGraphQLConfig-DQoMmpNM.js +0 -63
- package/dist/useGraphQLConfig-DzH1nVBh.cjs +0 -76
- package/dist/useMessageInterceptor-CstX10ih.cjs +0 -33
- package/dist/useMessageInterceptor-D5oAekXn.js +0 -25
- package/dist/userIdentityContext-8kfKQRFx.d.ts +0 -20
- package/dist/userIdentityContext-D2oFVFzo.d.cts +0 -20
- package/dist/utilityTypes-DynzxjK3.js +0 -1
- package/dist/utilityTypes-xb8SjKSV.cjs +0 -0
- package/dist/utils-B8rATLoc.d.ts +0 -22
- package/dist/utils-Bcz5kAgP.js +0 -92
- package/dist/utils-CMqFfqZx.cjs +0 -130
- package/dist/utils-EDgzCG3Q.d.cts +0 -22
- package/dist/utils-V1YTUQng.js +0 -1385
- package/dist/utils-VI19AC8S.cjs +0 -1591
- package/dist/variantInfo-BRmDpamJ.cjs +0 -17
- package/dist/variantInfo-BwBBEWSA.js +0 -11
- package/src/application/models/api/context.ts +0 -4
- package/src/application/models/api/generationParams.ts +0 -4
- package/src/application/models/api/nextMessageRequest.ts +0 -11
- package/src/application/models/api/orgAnalyticsConfig.ts +0 -19
- package/src/application/models/api/orgConfigResults.ts +0 -44
- package/src/application/models/api/organizationConfig.ts +0 -12
- package/src/application/models/api/responseGenerics.ts +0 -67
- package/src/application/models/api/search.ts +0 -26
- package/src/application/models/api/suggestion.ts +0 -4
- package/src/application/models/api/supportedEventRequest.ts +0 -8
- package/src/application/models/api/userEvent.ts +0 -101
- package/src/application/models/cachedValue.ts +0 -8
- package/src/application/models/chatElementDisplayLocation.ts +0 -22
- package/src/application/models/clientDetails.ts +0 -18
- package/src/application/models/colorsConfig.ts +0 -28
- package/src/application/models/conversationalSearchIds.ts +0 -5
- package/src/application/models/dataLayer.ts +0 -45
- package/src/application/models/events.ts +0 -5
- package/src/application/models/featureGates.ts +0 -21
- package/src/application/models/frontendConfig.ts +0 -14
- package/src/application/models/googleAnalyticsEvents.ts +0 -8
- package/src/application/models/localStorageEventListener.ts +0 -4
- package/src/application/models/mobilePLPChatPlacementParameter.ts +0 -3
- package/src/application/models/orgsEnum.ts +0 -36
- package/src/application/models/productExperiment.ts +0 -5
- package/src/application/models/spanxTakeAQuizCtaParameter.ts +0 -4
- package/src/application/models/spiffyWidgets.ts +0 -16
- package/src/application/models/utilityTypes/camelCase.ts +0 -87
- package/src/application/models/utilityTypes/camelCasedPropertiesDeep.ts +0 -80
- package/src/application/models/utilityTypes/delimiterCase.ts +0 -121
- package/src/application/models/utilityTypes/delimiterCasedPropertiesDeep.ts +0 -98
- package/src/application/models/utilityTypes/index.ts +0 -1
- package/src/application/models/utilityTypes/internal.ts +0 -93
- package/src/application/models/utilityTypes/primitive.ts +0 -8
- package/src/application/models/utilityTypes/snakeCasedPropertiesDeep.ts +0 -49
- package/src/application/models/utilityTypes/splitWords.ts +0 -76
- package/src/application/models/utilityTypes/trim.ts +0 -28
- package/src/application/models/utilityTypes/unknownArray.ts +0 -25
- package/src/application/models/variantInfo/index.ts +0 -1
- package/src/application/models/variantInfo/pageVisitInfo.ts +0 -6
- package/src/application/models/variantInfo/plpInfo.ts +0 -3
- package/src/application/models/variantInfo/productInfo.ts +0 -5
- package/src/application/models/variantInfo/variantInfo.ts +0 -29
- package/src/application/utils/__tests__/divideArrays.test.ts +0 -14
- package/src/application/utils/cdnUtils.ts +0 -11
- package/src/atoms/search/chatSearch.ts +0 -317
- package/src/atoms/search/types.ts +0 -55
- package/src/config/divIds.ts +0 -27
- package/src/config/socialProofClasses.ts +0 -17
- package/src/contexts/chatContext/chatContext.tsx +0 -509
- package/src/contexts/chatContext/index.ts +0 -1
- package/src/contexts/types.ts +0 -1066
- package/src/events/event-types.ts +0 -11
- package/src/interceptors/types.ts +0 -6
- package/src/merchants/domInsertion.ts +0 -30
- package/src/merchants/gridInsertion.ts +0 -19
- package/src/types/config-versions.ts +0 -6
- package/src/types/customerService.ts +0 -31
- package/src/types/custservice-types.ts +0 -28
- package/src/types/search-filter-types.ts +0 -111
- package/src/types/suggestionBarV2-types.ts +0 -4
- package/src/types/test-types.ts +0 -3
- package/src/types.ts +0 -11
- /package/dist/{AmplitudeOperations-CEwp7tPJ.cjs → featureFlagServiceContext-B4ash4vz.cjs} +0 -0
- /package/dist/{AmplitudeOperations-uF2zIi_1.js → featureFlagServiceContext-bI7ZLz4r.js} +0 -0
- /package/src/{types/exceptions → exceptions}/sessionExceptions.ts +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { atom } from 'jotai';
|
|
2
|
+
import { MessageType } 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 { SpiffyMetricsEventName } from 'src/contexts/amplitudeContext/amplitudeContext';
|
|
7
|
+
import { amplitudeTrackEventAtom } from 'src/atoms/amplitude/amplitudeTrackEventAtom';
|
|
8
|
+
export const handleReplyAtom = atom(null, (get, set, { message, userTyped }) => {
|
|
9
|
+
var _a;
|
|
10
|
+
if (message.type !== MessageType.QueryTyped) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const trackEvent = get(amplitudeTrackEventAtom);
|
|
14
|
+
const queryTyped = message.metadata.content;
|
|
15
|
+
set(replyEventCategoryAtom, UserEventCategory.QueryTyped);
|
|
16
|
+
set(userQueryAtom, queryTyped);
|
|
17
|
+
set(messagesAtom, [...get(messagesAtom), [message]]);
|
|
18
|
+
set(userHasRepliedAtom, true);
|
|
19
|
+
set(queueUserEventAtom, {
|
|
20
|
+
eventId: message.id,
|
|
21
|
+
createdAt: message.createdAt,
|
|
22
|
+
category: UserEventCategory.QueryTyped,
|
|
23
|
+
attributes: {
|
|
24
|
+
query: queryTyped,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
if (trackEvent) {
|
|
28
|
+
trackEvent({
|
|
29
|
+
eventName: SpiffyMetricsEventName.ChatUserMessageInput,
|
|
30
|
+
eventProps: {
|
|
31
|
+
message_id: message.id,
|
|
32
|
+
message_role: message.role,
|
|
33
|
+
message_type: message.type,
|
|
34
|
+
message_metadata: {
|
|
35
|
+
content: (_a = message === null || message === void 0 ? void 0 : message.metadata) === null || _a === void 0 ? void 0 : _a.content, // Removed amplitudeSafeString
|
|
36
|
+
created_at: message.createdAt,
|
|
37
|
+
user_typed: userTyped,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
alsoSendToGoogleAnalytics: true,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
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);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./globalSearch";
|
|
@@ -0,0 +1,6 @@
|
|
|
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();
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
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; });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './searchAPI';
|
|
@@ -0,0 +1,163 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './locators';
|
|
@@ -0,0 +1,10 @@
|
|
|
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';
|
|
@@ -0,0 +1,21 @@
|
|
|
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';
|