@envive-ai/react-hooks 0.2.5 → 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-B98Y9tMb.js → NewOrgConfig-ChNJ3ZtC.js} +2 -2
- package/dist/{NewOrgConfig-ZbBKiByQ.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 +19 -19
- package/dist/application/utils/index.d.cts +14 -63
- package/dist/application/utils/index.d.ts +16 -65
- package/dist/application/utils/index.js +19 -19
- package/dist/{atomStore-DXTVqiKc.js → atomStore-DAQvNPkh.js} +1 -1
- package/dist/{atomStore-DNji91Im.cjs → atomStore-DD9g7Zw2.cjs} +1 -1
- package/dist/atoms/app/index.cjs +19 -19
- package/dist/atoms/app/index.d.cts +9 -20
- package/dist/atoms/app/index.d.ts +8 -19
- package/dist/atoms/app/index.js +19 -19
- package/dist/atoms/atomStore/index.cjs +1 -1
- package/dist/atoms/atomStore/index.js +1 -1
- package/dist/atoms/chat/index.cjs +21 -21
- package/dist/atoms/chat/index.d.cts +37 -45
- package/dist/atoms/chat/index.d.ts +35 -43
- package/dist/atoms/chat/index.js +21 -21
- package/dist/atoms/globalSearch/index.cjs +1 -1
- package/dist/atoms/globalSearch/index.d.cts +1 -1
- package/dist/atoms/globalSearch/index.d.ts +5 -5
- 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 +7 -47
- package/dist/atoms/search/index.d.cts +76 -14
- package/dist/atoms/search/index.d.ts +76 -14
- package/dist/atoms/search/index.js +7 -29
- package/dist/atoms/search/utils.cjs +1 -1
- package/dist/atoms/search/utils.d.cts +1 -1
- package/dist/atoms/search/utils.d.ts +1 -1
- package/dist/atoms/search/utils.js +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-DULmjtx1.cjs +330 -0
- package/dist/chatState-BrSfXIV4.cjs +120 -0
- package/dist/chatState-Cn8JGAlH.js +34 -0
- package/dist/config/index.d.cts +4 -4
- package/dist/config/index.d.ts +4 -4
- 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/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.d.cts +1 -1
- package/dist/config/locators/components/common/index.d.ts +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/search/index.d.cts +1 -1
- package/dist/config/locators/components/search/index.d.ts +1 -1
- package/dist/config/locators/index.d.cts +4 -4
- package/dist/config/locators/index.d.ts +4 -4
- package/dist/contexts/amplitudeContext/index.cjs +19 -19
- package/dist/contexts/amplitudeContext/index.d.cts +1 -1
- package/dist/contexts/amplitudeContext/index.d.ts +1 -1
- package/dist/contexts/amplitudeContext/index.js +19 -19
- 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 +24 -24
- package/dist/contexts/searchContext/index.d.cts +2 -7
- package/dist/contexts/searchContext/index.d.ts +2 -7
- package/dist/contexts/searchContext/index.js +24 -24
- 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 +6 -16
- package/dist/contexts/systemSettingsContext/index.d.ts +4 -14
- package/dist/contexts/systemSettingsContext/index.js +4 -4
- package/dist/contexts/userIdentityContext/index.cjs +19 -19
- package/dist/contexts/userIdentityContext/index.d.cts +11 -2
- package/dist/contexts/userIdentityContext/index.d.ts +11 -2
- package/dist/contexts/userIdentityContext/index.js +19 -19
- package/dist/dist-BZX_Mgfn.cjs +6019 -0
- package/dist/dist-CIM4YRqp.js +5923 -0
- package/dist/domObserver-DKcas6tl.js +285 -0
- package/dist/{domObserver-v9ODTyfT.js → domObserver-Do6RAJdf.cjs} +23 -4
- 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-FBk2epe8.cjs → globalSearch-Cpc8egsM.cjs} +1 -1
- package/dist/{globalSearch-Ccxq8hNF.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 +21 -22
- package/dist/hooks/AmplitudeOperations/index.d.cts +2 -2
- package/dist/hooks/AmplitudeOperations/index.d.ts +2 -2
- package/dist/hooks/AmplitudeOperations/index.js +20 -21
- package/dist/hooks/AppDetails/index.cjs +22 -22
- package/dist/hooks/AppDetails/index.d.cts +3 -23
- package/dist/hooks/AppDetails/index.d.ts +3 -23
- package/dist/hooks/AppDetails/index.js +22 -22
- package/dist/hooks/CdnOperations/index.cjs +4 -4
- package/dist/hooks/CdnOperations/index.js +4 -4
- package/dist/hooks/ChatToggle/index.cjs +24 -24
- package/dist/hooks/ChatToggle/index.d.cts +2 -2
- package/dist/hooks/ChatToggle/index.d.ts +2 -2
- package/dist/hooks/ChatToggle/index.js +22 -22
- package/dist/hooks/ChatToggleAnalytics/index.cjs +23 -24
- package/dist/hooks/ChatToggleAnalytics/index.d.cts +2 -2
- package/dist/hooks/ChatToggleAnalytics/index.d.ts +2 -2
- package/dist/hooks/ChatToggleAnalytics/index.js +22 -23
- 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 +4 -6
- package/dist/hooks/ElementObserver/index.d.cts +4 -25
- package/dist/hooks/ElementObserver/index.d.ts +4 -25
- package/dist/hooks/ElementObserver/index.js +4 -6
- package/dist/hooks/GrabAndScroll/index.cjs +1 -1
- package/dist/hooks/GrabAndScroll/index.d.cts +2 -2
- 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 +19 -19
- package/dist/hooks/IdentifyUser/index.js +19 -19
- 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 +332 -167
- package/dist/hooks/Search/index.d.cts +3 -57
- package/dist/hooks/Search/index.d.ts +3 -57
- package/dist/hooks/Search/index.js +320 -156
- package/dist/hooks/SearchOperations/index.cjs +25 -25
- package/dist/hooks/SearchOperations/index.d.cts +2 -3
- package/dist/hooks/SearchOperations/index.d.ts +2 -3
- package/dist/hooks/SearchOperations/index.js +25 -25
- 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 +21 -21
- package/dist/hooks/TrackComponentVisibleEvent/index.d.cts +2 -3
- package/dist/hooks/TrackComponentVisibleEvent/index.d.ts +2 -3
- package/dist/hooks/TrackComponentVisibleEvent/index.js +21 -21
- package/dist/hooks/UpdateAnalyticsProps/index.cjs +21 -21
- package/dist/hooks/UpdateAnalyticsProps/index.js +20 -20
- package/dist/hooks/utils.d.cts +20 -13
- package/dist/hooks/utils.d.ts +20 -13
- package/dist/{index-LTdMHOxj.d.ts → index-B4cSHxVN.d.ts} +1 -1
- 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-DBqgBV9N.d.ts → index-CYGpI6hE.d.ts} +1 -1
- package/dist/{index-9NE86em3.d.cts → index-ClVBVK15.d.cts} +1 -1
- package/dist/{index-nDWHlouq.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-FQjyuD3D.d.cts → index-ca7Qn8o0.d.cts} +1 -1
- package/dist/{index-DHgVW8ey.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/{logger-TBIl4uIH.cjs → logger-BF6iGSVd.cjs} +1 -1
- package/dist/{logger-W3lqg-4b.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-A4BEeHMf.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-BJRFGG0f.js → useIntersection-BWiHkpKL.js} +1 -1
- package/dist/{useIntersection-CYRvxtRN.cjs → useIntersection-DZHz44BY.cjs} +1 -1
- package/dist/{utils-DIvMgPe8.js → utils-CEKzBcN2.js} +1 -1
- package/dist/utils-CPvqOk0g.cjs +1546 -0
- package/dist/{utils-Buo4KU5l.cjs → utils-CqVRbvfN.cjs} +1 -1
- package/dist/{utils-CDw74BCO.cjs → utils-CsMbZmRw.cjs} +1 -1
- package/dist/{utils-BRNaQkCK.js → utils-DQhbbAnt.js} +1 -1
- package/dist/utils-D_kATUj6.js +1 -1
- package/dist/utils-N47VsL9W.js +1364 -0
- package/dist/utils-hYTjy7hJ.cjs +1 -1
- package/dist/{utils-DyTiotQz.d.ts → utils-wWki3L1d.d.ts} +1 -1
- package/package.json +7 -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/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-CO5c1L62.cjs +0 -20
- package/dist/SystemSettingsContext-CXmUlH8i.js +0 -13
- package/dist/TrackComponentVisibleEvent-B0WO3ArV.js +0 -52
- package/dist/TrackComponentVisibleEvent-LRE9MYzL.cjs +0 -59
- package/dist/amplitudeContext-B73xamNe.d.cts +0 -52
- package/dist/amplitudeContext-DXnJi0V1.d.ts +0 -52
- package/dist/api-BWSsazAG.js +0 -166
- package/dist/api-DeW6rHj3.cjs +0 -239
- 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-CH_-ssYa.js +0 -38
- package/dist/cdnContext-D7kHxOzE.cjs +0 -53
- package/dist/chat-CqPuT9_V.cjs +0 -393
- package/dist/chat-DH70QqJp.js +0 -257
- package/dist/chatElementDisplayLocation-BoE6DEdv.d.ts +0 -25
- package/dist/chatElementDisplayLocation-DWmfNX_u.d.cts +0 -25
- package/dist/chatSearch-BQCZI8MJ.cjs +0 -418
- package/dist/chatSearch-D8xCWU8m.js +0 -295
- package/dist/chatState-CcFtSqJT.cjs +0 -120
- package/dist/chatState-DKnNHmwe.js +0 -34
- 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/domObserver-Bqf3ooj8.cjs +0 -304
- package/dist/enviveConfig-DZBohDpc.js +0 -62
- package/dist/enviveConfig-Dv9-esGV.cjs +0 -130
- package/dist/enviveConfigContext-D2OELZDR.cjs +0 -60
- package/dist/enviveConfigContext-DrDjCems.js +0 -45
- package/dist/events-DYY4l817.cjs +0 -90
- package/dist/events-DyUix-Bn.js +0 -78
- package/dist/featureFlagServiceContext-CJyYItqu.cjs +0 -62
- package/dist/featureFlagServiceContext-C_2m4wPL.d.ts +0 -23
- package/dist/featureFlagServiceContext-CiKWV306.d.cts +0 -23
- package/dist/featureFlagServiceContext-FBM6DdMJ.js +0 -42
- package/dist/featureGates-KEwAL8p_.js +0 -26
- package/dist/featureGates-qU_ulhpC.cjs +0 -32
- package/dist/frontendConfig-CymUbclV.d.ts +0 -856
- package/dist/frontendConfig-tVg0hsWZ.d.cts +0 -856
- package/dist/graphql-3PxNRFOc.js +0 -36
- package/dist/graphql-DGYfelZp.cjs +0 -53
- package/dist/graphqlConfig-GHZ1UgCw.cjs +0 -73
- package/dist/graphqlConfig-mDg6J44N.js +0 -24
- package/dist/graphqlContext-BZPEAFSR.cjs +0 -111
- package/dist/graphqlContext-Bf3E-V2T.d.cts +0 -28
- package/dist/graphqlContext-CQikpV_I.d.ts +0 -28
- package/dist/graphqlContext-eaZPxgRE.js +0 -96
- package/dist/index-BVf069X-.d.ts +0 -184
- package/dist/index-B_KJB5L_.d.cts +0 -186
- package/dist/index-BkLv_fCu.d.ts +0 -186
- package/dist/index-Bmub8e38.d.cts +0 -98
- package/dist/index-C0eAp5f5.d.ts +0 -98
- package/dist/index-CESxqFso.d.cts +0 -228
- package/dist/index-CG3P8xE1.d.cts +0 -676
- package/dist/index-CJc7_j_v.d.ts +0 -44
- package/dist/index-CiWEYzXl.d.cts +0 -184
- package/dist/index-Cyq5HiC0.d.cts +0 -44
- package/dist/index-DL2ODEnw.d.ts +0 -1
- package/dist/index-DgjDuQl4.d.ts +0 -676
- package/dist/index-RcVcRKH7.d.cts +0 -1
- package/dist/index-vP8BKdxl.d.ts +0 -228
- 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-BPZ82q-G.js +0 -95
- package/dist/localStorageContext-NRP-CdmF.cjs +0 -115
- package/dist/models-D-4db7XW.cjs +0 -1537
- package/dist/models-c86hYW-F.js +0 -1296
- package/dist/newOrgConfigAtom-OzAyrPS8.js +0 -8
- package/dist/newOrgConfigContext-DOdUxlOE.d.cts +0 -16
- package/dist/newOrgConfigContext-DX9iqIIK.cjs +0 -68
- package/dist/newOrgConfigContext-aqN8Tu79.js +0 -53
- package/dist/newOrgConfigContext-jphS5d4K.d.ts +0 -16
- package/dist/nodeSelector-B3bPtEjX.d.cts +0 -31
- package/dist/nodeSelector-Dcn3_NrZ.d.ts +0 -31
- package/dist/org-Bq2KsJSp.cjs +0 -43
- package/dist/org-gtWmGw4K.js +0 -12
- package/dist/search-BQPMtze5.cjs +0 -205
- package/dist/search-CIrqYYMI.d.ts +0 -20
- package/dist/search-PXzaYtZj.js +0 -126
- package/dist/search-filter-types-BhK20ts3.d.ts +0 -102
- package/dist/search-filter-types-BxaNSLs_.d.cts +0 -102
- package/dist/search-y-ioX5Mz.d.cts +0 -20
- package/dist/searchContext-CmsLR6Ka.cjs +0 -145
- package/dist/searchContext-NPfqMf6b.js +0 -129
- package/dist/searchServiceAdapter-BczodJGV.cjs +0 -34
- package/dist/searchServiceAdapter-BuEHFG5t.js +0 -16
- package/dist/sessionStorageContext-C1u04nAK.js +0 -52
- package/dist/sessionStorageContext-Cy8xc9-3.cjs +0 -66
- package/dist/shopifyUrlContext-CUyq3f27.cjs +0 -75
- package/dist/shopifyUrlContext-DTLlqlMj.js +0 -61
- package/dist/spiffyWidgets-BnkP5kXf.d.ts +0 -20
- package/dist/spiffyWidgets-BuS00VaQ.d.cts +0 -20
- package/dist/systemSettingsContext-Ba-wi2NZ.cjs +0 -60
- package/dist/systemSettingsContext-DumUaV0m.js +0 -39
- package/dist/test-types-DbrKQIqB.d.ts +0 -40
- package/dist/test-types-ThQiO_cc.d.cts +0 -40
- package/dist/types-BWzwd0Qc.js +0 -30
- package/dist/types-CEx2uKKS.d.ts +0 -51
- package/dist/types-CKMMb_gX.d.cts +0 -51
- package/dist/types-CKPddlfS.cjs +0 -0
- package/dist/types-CtUb63bt.js +0 -76
- package/dist/types-Cz8CaPUQ.cjs +0 -48
- package/dist/types-Dc6hx6ei.js +0 -1
- package/dist/types-Mwm0bS2l.d.ts +0 -10
- package/dist/types-UUvB6h05.cjs +0 -106
- package/dist/types-zQGBI-Yo.d.cts +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-COzMdJaX.cjs +0 -78
- package/dist/urlsParser-DxjoLj98.js +0 -42
- package/dist/useAmplitudeOperations-Cv0fi3uj.cjs +0 -41
- package/dist/useAmplitudeOperations-Ti6phPPq.js +0 -34
- package/dist/useAppDetails-BgqbPlfR.cjs +0 -38
- package/dist/useAppDetails-DnKGYtCd.js +0 -30
- package/dist/useDebounce-BV7B-Jz3.js +0 -19
- package/dist/useDebounce-vU5iW5sa.cjs +0 -26
- package/dist/useGraphQLConfig-BizpCw23.cjs +0 -76
- package/dist/useGraphQLConfig-DFWl9Z89.js +0 -63
- package/dist/useMessageInterceptor-BjGP_uXm.js +0 -25
- package/dist/useMessageInterceptor-arAqUq1Q.cjs +0 -33
- package/dist/userIdentityContext-BvsEnQVX.d.ts +0 -20
- package/dist/userIdentityContext-D2oFVFzo.d.cts +0 -20
- package/dist/utilityTypes-B2KuRn37.js +0 -1
- package/dist/utilityTypes-BGbL2WTP.cjs +0 -0
- package/dist/utils-B7PAzB_M.d.cts +0 -22
- package/dist/utils-CLGXsOwE.cjs +0 -1591
- package/dist/utils-CrQ0h9tc.d.ts +0 -22
- package/dist/utils-jYtD3hmA.js +0 -1385
- package/dist/variantInfo-BfKlkaWU.js +0 -11
- package/dist/variantInfo-DpLn4nHz.cjs +0 -17
- 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-BEGeYKG5.cjs → featureFlagServiceContext-B4ash4vz.cjs} +0 -0
- /package/dist/{AmplitudeOperations-CWI4yjZ4.js → featureFlagServiceContext-bI7ZLz4r.js} +0 -0
- /package/src/{types/exceptions → exceptions}/sessionExceptions.ts +0 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
function isPlainObject(x) {
|
|
2
|
+
return (!!x &&
|
|
3
|
+
typeof x === 'object' &&
|
|
4
|
+
!Array.isArray(x) &&
|
|
5
|
+
!(x instanceof Date) &&
|
|
6
|
+
!(x instanceof RegExp));
|
|
7
|
+
}
|
|
8
|
+
function isReplace(x) {
|
|
9
|
+
return !!x && typeof x === 'object' && '$replace' in x;
|
|
10
|
+
}
|
|
11
|
+
function isDelete(x) {
|
|
12
|
+
return !!x && typeof x === 'object' && x.$delete === true;
|
|
13
|
+
}
|
|
14
|
+
function isPrimitiveValue(x) {
|
|
15
|
+
const t = typeof x;
|
|
16
|
+
return (x === null ||
|
|
17
|
+
t === 'string' ||
|
|
18
|
+
t === 'number' ||
|
|
19
|
+
t === 'boolean' ||
|
|
20
|
+
t === 'bigint' ||
|
|
21
|
+
t === 'symbol' ||
|
|
22
|
+
t === 'undefined');
|
|
23
|
+
}
|
|
24
|
+
function isArrayOfPrimitives(arr) {
|
|
25
|
+
if (arr.length === 0)
|
|
26
|
+
return false; // ambiguous, default to merge-by-index on empty
|
|
27
|
+
// If every defined element is primitive, treat as primitives
|
|
28
|
+
for (let i = 0; i < arr.length; i += 1) {
|
|
29
|
+
const v = arr[i];
|
|
30
|
+
if (v !== undefined && !isPrimitiveValue(v))
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
function mergeAny(baseAny, patchAny, opts) {
|
|
36
|
+
var _a;
|
|
37
|
+
if (isReplace(patchAny))
|
|
38
|
+
return patchAny.$replace;
|
|
39
|
+
if (isDelete(patchAny))
|
|
40
|
+
return undefined; // caller deletes the key
|
|
41
|
+
if (Array.isArray(baseAny)) {
|
|
42
|
+
if (Array.isArray(patchAny)) {
|
|
43
|
+
const baseArr = baseAny;
|
|
44
|
+
const patchArr = patchAny;
|
|
45
|
+
const shouldReplace = opts.arrayStrategy === 'replace' ||
|
|
46
|
+
isArrayOfPrimitives(baseArr) ||
|
|
47
|
+
isArrayOfPrimitives(patchArr);
|
|
48
|
+
if (shouldReplace)
|
|
49
|
+
return patchAny;
|
|
50
|
+
const out = baseArr.slice();
|
|
51
|
+
const max = Math.max(out.length, patchArr.length);
|
|
52
|
+
for (let i = 0; i < max; i += 1) {
|
|
53
|
+
const pVal = patchArr[i];
|
|
54
|
+
if (pVal !== undefined) {
|
|
55
|
+
out[i] = mergeAny(out[i], pVal, opts);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
return baseAny;
|
|
61
|
+
}
|
|
62
|
+
if (isPlainObject(baseAny) && isPlainObject(patchAny)) {
|
|
63
|
+
const baseObj = baseAny;
|
|
64
|
+
const patchObj = patchAny;
|
|
65
|
+
const out = { ...baseObj };
|
|
66
|
+
for (const key of Object.keys(patchObj)) {
|
|
67
|
+
const pVal = patchObj[key];
|
|
68
|
+
if (pVal === undefined) {
|
|
69
|
+
// leave as-is
|
|
70
|
+
}
|
|
71
|
+
else if (opts.nullDeletes && pVal === null) {
|
|
72
|
+
delete out[key];
|
|
73
|
+
}
|
|
74
|
+
else if (isReplace(pVal)) {
|
|
75
|
+
out[key] = pVal.$replace;
|
|
76
|
+
}
|
|
77
|
+
else if (isDelete(pVal)) {
|
|
78
|
+
delete out[key];
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
out[key] = mergeAny(baseObj === null || baseObj === void 0 ? void 0 : baseObj[key], pVal, opts);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
return (_a = patchAny) !== null && _a !== void 0 ? _a : baseAny;
|
|
87
|
+
}
|
|
88
|
+
export function applyOverrides(base, patch, opts = {}) {
|
|
89
|
+
var _a;
|
|
90
|
+
const { arrayStrategy = 'mergeByIndex', nullDeletes = false } = opts;
|
|
91
|
+
// Handle whole-node control operators on patch itself
|
|
92
|
+
if (isReplace(patch))
|
|
93
|
+
return patch.$replace;
|
|
94
|
+
if (isDelete(patch))
|
|
95
|
+
return undefined;
|
|
96
|
+
// Arrays
|
|
97
|
+
if (Array.isArray(base)) {
|
|
98
|
+
if (isReplace(patch))
|
|
99
|
+
return patch.$replace;
|
|
100
|
+
if (Array.isArray(patch)) {
|
|
101
|
+
if (arrayStrategy === 'replace')
|
|
102
|
+
return patch;
|
|
103
|
+
// merge by index
|
|
104
|
+
const out = base.slice();
|
|
105
|
+
const max = Math.max(out.length, patch.length);
|
|
106
|
+
for (let i = 0; i < max; i += 1) {
|
|
107
|
+
const pVal = patch[i];
|
|
108
|
+
if (pVal !== undefined) {
|
|
109
|
+
out[i] = mergeAny(out[i], pVal, opts);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return out;
|
|
113
|
+
}
|
|
114
|
+
// invalid patch type for an array → ignore and return base
|
|
115
|
+
return base;
|
|
116
|
+
}
|
|
117
|
+
// Plain objects
|
|
118
|
+
if (isPlainObject(base) && isPlainObject(patch)) {
|
|
119
|
+
const out = { ...base };
|
|
120
|
+
const patchObj = patch;
|
|
121
|
+
for (const key of Object.keys(patchObj)) {
|
|
122
|
+
const pVal = patchObj[key];
|
|
123
|
+
if (pVal === undefined) {
|
|
124
|
+
// leave existing value
|
|
125
|
+
}
|
|
126
|
+
else if (nullDeletes && pVal === null) {
|
|
127
|
+
delete out[key];
|
|
128
|
+
}
|
|
129
|
+
else if (isReplace(pVal)) {
|
|
130
|
+
out[key] = pVal.$replace;
|
|
131
|
+
}
|
|
132
|
+
else if (isDelete(pVal)) {
|
|
133
|
+
delete out[key];
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
const bVal = base[key];
|
|
137
|
+
out[key] = mergeAny(bVal, pVal, opts);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return out;
|
|
141
|
+
}
|
|
142
|
+
// For primitives or when patch is primitive, patch wins if defined
|
|
143
|
+
return ((_a = patch) !== null && _a !== void 0 ? _a : base);
|
|
144
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
class StringUtils {
|
|
2
|
+
static isNullOrEmpty(value) {
|
|
3
|
+
const valueTrimmed = value === null || value === void 0 ? void 0 : value.trim();
|
|
4
|
+
return value === undefined || valueTrimmed === '';
|
|
5
|
+
}
|
|
6
|
+
static trimToNull(value) {
|
|
7
|
+
const valueTrimmed = value === null || value === void 0 ? void 0 : value.trim();
|
|
8
|
+
return StringUtils.isNullOrEmpty(valueTrimmed) ? undefined : valueTrimmed;
|
|
9
|
+
}
|
|
10
|
+
static capitalize(type) {
|
|
11
|
+
if (type === undefined) {
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
14
|
+
return type.charAt(0).toUpperCase() + type.substring(1);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Finds the first pattern in an array that matches a given URL.
|
|
18
|
+
* Patterns can include a single wildcard '*' which matches any sequence of characters.
|
|
19
|
+
*
|
|
20
|
+
* @param patterns
|
|
21
|
+
* @param urlToTest
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
static findMatchingPattern(patterns, urlToTest) {
|
|
25
|
+
if (!urlToTest) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
for (const pattern of patterns) {
|
|
29
|
+
// Test only if a pathname is present.
|
|
30
|
+
if (urlToTest.pathname !== '/') {
|
|
31
|
+
// Escape special regex characters in the pattern
|
|
32
|
+
// This ensures that characters like '.', '+', '?', '(', etc., in the pattern are treated literally.
|
|
33
|
+
const escapedPattern = pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&');
|
|
34
|
+
// Replace the wildcard '*' with its regex equivalent '.*' (matches any character zero or more times)
|
|
35
|
+
const regexPattern = escapedPattern.replace(/\*/g, '.*');
|
|
36
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
37
|
+
if (regex.test(urlToTest.pathname)) {
|
|
38
|
+
return pattern;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else if (pattern.startsWith(urlToTest.hostname)) {
|
|
42
|
+
return pattern;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export { StringUtils };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { coreUserEventToApiUserEvent } from './coreUserEventToApiUserEvent';
|
|
2
|
+
import { coreContextToApiContext } from './coreContextToApiContext';
|
|
3
|
+
export const coreSupportedEventRequestToApiRequest = (coreSupportedEventRequest) => ({
|
|
4
|
+
id: coreSupportedEventRequest.id,
|
|
5
|
+
user_event: coreUserEventToApiUserEvent(coreSupportedEventRequest.userEvent),
|
|
6
|
+
context: coreContextToApiContext(coreSupportedEventRequest.context),
|
|
7
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const parseHref = (href) => {
|
|
2
|
+
try {
|
|
3
|
+
const url = new URL(href);
|
|
4
|
+
const urlSearchParams = new URLSearchParams(url.search);
|
|
5
|
+
return { url, urlSearchParams };
|
|
6
|
+
}
|
|
7
|
+
catch (e) {
|
|
8
|
+
return { url: undefined, urlSearchParams: undefined };
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export const createUrlWithQueryParams = (url, queryParams) => {
|
|
12
|
+
const urlObj = new URL(url, window.location.href);
|
|
13
|
+
Object.entries(queryParams).forEach(([value, key]) => urlObj.searchParams.append(value, key));
|
|
14
|
+
return urlObj.href;
|
|
15
|
+
};
|
|
16
|
+
export const getQueryParam = (key) => {
|
|
17
|
+
const urlObj = new URL(window.location.href);
|
|
18
|
+
return urlObj.searchParams.get(key);
|
|
19
|
+
};
|
|
20
|
+
export const buildSearchHash = (message) => `#evs=true&s=${message.id}&q=${message.metadata.generatedQuery}`;
|
|
21
|
+
export const buildSearchStartHash = (query) => `#evs=true&q=${query}`;
|
|
22
|
+
// Basic parser for the search hash
|
|
23
|
+
export const parseSearchHash = (hash) => {
|
|
24
|
+
if (!hash.startsWith('#evs=true')) {
|
|
25
|
+
return { id: null, query: null };
|
|
26
|
+
}
|
|
27
|
+
const params = Object.fromEntries(hash.split('&').map((param) => param.split('=')));
|
|
28
|
+
return {
|
|
29
|
+
id: params.s ? decodeURIComponent(params.s) : null,
|
|
30
|
+
query: params.q ? decodeURIComponent(params.q) : null,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
window.history.pushState(null, '');
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// This email validates that there are one or more characters before the `@` symbol,
|
|
2
|
+
// one or more characters between the `@` symbol and the `.` symbol,
|
|
3
|
+
// and one or more characters after the `.` symbol
|
|
4
|
+
// It does NOT validate all possible email formats, but it is a decent place to start.
|
|
5
|
+
export const validateEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ContextSourceEnum } from '@spiffy-ai/commerce-api-client';
|
|
2
|
+
import { atom } from 'jotai';
|
|
3
|
+
import { atomWithStorage } from 'jotai/utils';
|
|
4
|
+
import { useUserIdentity } from 'src/contexts/userIdentityContext/userIdentityContext';
|
|
5
|
+
import { v4 as uuid } from 'uuid';
|
|
6
|
+
import { contextSourceAtom } from '../envive/enviveConfig';
|
|
7
|
+
export { variantInfoAtom } from './variant';
|
|
8
|
+
const internalUserIdAtom = atom(undefined);
|
|
9
|
+
export const userIdAtom = atom((get) => {
|
|
10
|
+
const maybeUserId = get(internalUserIdAtom);
|
|
11
|
+
if (maybeUserId) {
|
|
12
|
+
return maybeUserId;
|
|
13
|
+
}
|
|
14
|
+
const { getUserIdOrDefault } = useUserIdentity();
|
|
15
|
+
return getUserIdOrDefault();
|
|
16
|
+
}, (_, set, value) => {
|
|
17
|
+
set(internalUserIdAtom, value);
|
|
18
|
+
});
|
|
19
|
+
export const userIdentityAtom = atom(undefined);
|
|
20
|
+
export const appSourceAtom = atom((get) => { var _a; return (_a = get(contextSourceAtom)) !== null && _a !== void 0 ? _a : ContextSourceEnum.App; });
|
|
21
|
+
export const chatIdAtom = atomWithStorage('v1-spiffy-chat-session-id', uuid(), undefined, {
|
|
22
|
+
getOnInit: true,
|
|
23
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { atomWithStorage } from 'jotai/utils';
|
|
2
|
+
import { atom } from 'jotai';
|
|
3
|
+
import { VariantTypeEnum, } from '@envive-ai/types';
|
|
4
|
+
import { sessionStorageUtil } from 'src/atoms/atomStore';
|
|
5
|
+
const internalStorageUrlResolverAtom = atomWithStorage('spiffy-url-resolver', undefined, sessionStorageUtil, {
|
|
6
|
+
getOnInit: true,
|
|
7
|
+
});
|
|
8
|
+
export const urlResolverAtom = atom((get) => {
|
|
9
|
+
const maybeUrlResolver = get(internalStorageUrlResolverAtom);
|
|
10
|
+
if (maybeUrlResolver == null) {
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
return JSON.parse(maybeUrlResolver);
|
|
14
|
+
}, (get, set, value) => {
|
|
15
|
+
// Get current cache from storage
|
|
16
|
+
const currentCache = get(urlResolverAtom);
|
|
17
|
+
const newCache = { ...currentCache, [value.url]: value.response };
|
|
18
|
+
set(internalStorageUrlResolverAtom, JSON.stringify(newCache));
|
|
19
|
+
});
|
|
20
|
+
const internalStorageSupportedEventAtom = atomWithStorage('spiffy-supported-event', undefined, sessionStorageUtil, {
|
|
21
|
+
getOnInit: true,
|
|
22
|
+
});
|
|
23
|
+
const internalSupportedEventAtom = atom(undefined);
|
|
24
|
+
export const supportedEventAtom = atom((get) => {
|
|
25
|
+
const maybeSupportedEvent = get(internalStorageSupportedEventAtom);
|
|
26
|
+
if (maybeSupportedEvent == null) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
// TODO this is an unvalidated parse. It may be better to implement a custom storage util
|
|
30
|
+
// and perform the object validation on "get" there.
|
|
31
|
+
return JSON.parse(maybeSupportedEvent);
|
|
32
|
+
}, (_, set, value) => {
|
|
33
|
+
if (value == null) {
|
|
34
|
+
set(internalStorageSupportedEventAtom, undefined);
|
|
35
|
+
set(internalSupportedEventAtom, undefined);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
set(internalSupportedEventAtom, value);
|
|
39
|
+
set(internalStorageSupportedEventAtom, JSON.stringify(value));
|
|
40
|
+
});
|
|
41
|
+
const internalVariantIdAtom = atom();
|
|
42
|
+
const internalProductIdAtom = atom();
|
|
43
|
+
const internalParentProductIdAtom = atom();
|
|
44
|
+
const internalProductUrlAtom = atom();
|
|
45
|
+
const internalPlpIdAtom = atom();
|
|
46
|
+
const internalUrlAtom = atom();
|
|
47
|
+
const internalPageVisitCategoryAtom = atom();
|
|
48
|
+
const internalVariantAtom = atom('pdp');
|
|
49
|
+
export const variantIdAtom = atom((get) => get(internalVariantIdAtom));
|
|
50
|
+
export const productIdAtom = atom((get) => get(internalProductIdAtom));
|
|
51
|
+
export const parentProductIdAtom = atom((get) => get(internalParentProductIdAtom));
|
|
52
|
+
export const productUrlAtom = atom((get) => get(internalProductUrlAtom));
|
|
53
|
+
export const plpIdAtom = atom((get) => get(internalPlpIdAtom));
|
|
54
|
+
export const urlAtom = atom((get) => get(internalUrlAtom));
|
|
55
|
+
export const pageVisitCategoryAtom = atom((get) => get(internalPageVisitCategoryAtom));
|
|
56
|
+
export const variantAtom = atom((get) => get(internalVariantAtom));
|
|
57
|
+
export const hasParsedVariantInfoAtom = atom(false);
|
|
58
|
+
export const variantInfoAtom = atom((get) => {
|
|
59
|
+
const variant = get(variantAtom);
|
|
60
|
+
if (variant === VariantTypeEnum.Pdp) {
|
|
61
|
+
return {
|
|
62
|
+
variantId: get(variantIdAtom),
|
|
63
|
+
variant,
|
|
64
|
+
productId: get(productIdAtom),
|
|
65
|
+
parentProductId: get(parentProductIdAtom),
|
|
66
|
+
url: get(urlAtom),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (variant === VariantTypeEnum.Plp) {
|
|
70
|
+
return {
|
|
71
|
+
variantId: get(variantIdAtom),
|
|
72
|
+
variant,
|
|
73
|
+
plpId: get(plpIdAtom),
|
|
74
|
+
url: get(urlAtom),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (variant === VariantTypeEnum.PageVisit) {
|
|
78
|
+
return {
|
|
79
|
+
variantId: get(variantIdAtom),
|
|
80
|
+
variant,
|
|
81
|
+
url: get(urlAtom),
|
|
82
|
+
pageVisitCategory: get(pageVisitCategoryAtom),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
throw new Error('Invalid variantInfo details');
|
|
86
|
+
}, (_, set, newVariant) => {
|
|
87
|
+
set(internalVariantAtom, newVariant.variant);
|
|
88
|
+
set(internalVariantIdAtom, newVariant.variantId);
|
|
89
|
+
if (newVariant.variant === VariantTypeEnum.Pdp) {
|
|
90
|
+
set(internalProductIdAtom, newVariant.productId);
|
|
91
|
+
set(internalParentProductIdAtom, newVariant.parentProductId);
|
|
92
|
+
set(internalUrlAtom, newVariant.url);
|
|
93
|
+
}
|
|
94
|
+
if (newVariant.variant === VariantTypeEnum.Plp) {
|
|
95
|
+
set(internalPlpIdAtom, newVariant.plpId);
|
|
96
|
+
set(internalUrlAtom, newVariant.url);
|
|
97
|
+
}
|
|
98
|
+
if (newVariant.variant === VariantTypeEnum.PageVisit) {
|
|
99
|
+
set(internalUrlAtom, newVariant.url);
|
|
100
|
+
set(internalPageVisitCategoryAtom, newVariant.pageVisitCategory);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getDefaultStore } from 'jotai';
|
|
2
|
+
import { createJSONStorage } from 'jotai/utils';
|
|
3
|
+
let atomStore = null;
|
|
4
|
+
export const getAtomStore = () => {
|
|
5
|
+
if (!atomStore) {
|
|
6
|
+
atomStore = getDefaultStore();
|
|
7
|
+
}
|
|
8
|
+
return atomStore;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*
|
|
13
|
+
* Sets the global atom store to be the provided store.
|
|
14
|
+
*
|
|
15
|
+
* @param store - The store to set the global atom store to.
|
|
16
|
+
*/
|
|
17
|
+
export const setAtomStoreForTesting = (store) => {
|
|
18
|
+
atomStore = store;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*
|
|
23
|
+
* Resets the global atom store to null
|
|
24
|
+
*/
|
|
25
|
+
export const resetAtomStore = () => {
|
|
26
|
+
atomStore = null;
|
|
27
|
+
};
|
|
28
|
+
export const sessionStorageUtil = createJSONStorage(() => sessionStorage);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./atomStore";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { UserEventCategory } from '@spiffy-ai/commerce-api-client/dist/models/UserEventCategory';
|
|
2
|
+
import { atom } from 'jotai';
|
|
3
|
+
import { SpiffyMetricsEventName } from 'src/contexts/amplitudeContext/amplitudeContext';
|
|
4
|
+
import { SpiffyEventName, } from '@envive-ai/types';
|
|
5
|
+
export const userHasRepliedAtom = atom(false);
|
|
6
|
+
export const replyEventCategoryAtom = atom(UserEventCategory.AppLoaded);
|
|
7
|
+
export const userQueryAtom = atom();
|
|
8
|
+
export const suggestionAtom = atom(undefined);
|
|
9
|
+
export const askQuestionBtnClickedAtom = atom(false);
|
|
10
|
+
export const messagesAtom = atom([]);
|
|
11
|
+
export const userEventsAtom = atom([]);
|
|
12
|
+
export const suggestionsAtom = atom([]);
|
|
13
|
+
export const suggestionsLoadingAtom = atom(false);
|
|
14
|
+
export const responseStreamingAtom = atom(false);
|
|
15
|
+
export const chatIsOpenAtom = atom(false);
|
|
16
|
+
export const requestFailureAtom = atom(false);
|
|
17
|
+
export const formSubmitAtom = atom();
|
|
18
|
+
export const chatOnToggleAtom = atom(null, (get, set, triggerLocation, track) => {
|
|
19
|
+
const isOpen = get(chatIsOpenAtom);
|
|
20
|
+
set(chatIsOpenAtom, !isOpen);
|
|
21
|
+
if (!isOpen) {
|
|
22
|
+
window.dispatchEvent(new CustomEvent(SpiffyEventName.WidgetOpen));
|
|
23
|
+
track === null || track === void 0 ? void 0 : track(SpiffyMetricsEventName.ChatComponentExpanded, {
|
|
24
|
+
message_metadata: {
|
|
25
|
+
trigger_location: triggerLocation,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
window.dispatchEvent(new CustomEvent(SpiffyEventName.WidgetClose));
|
|
31
|
+
track === null || track === void 0 ? void 0 : track(SpiffyMetricsEventName.ChatComponentCollapsed);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { UserEventCategory } from '@spiffy-ai/commerce-api-client';
|
|
2
|
+
import { atom } from 'jotai';
|
|
3
|
+
import { v4 as uuid } from 'uuid';
|
|
4
|
+
import { formSubmitAtom, replyEventCategoryAtom } from 'src/atoms/chat';
|
|
5
|
+
import { queueUserEventAtom } from 'src/atoms/chat/messageQueue';
|
|
6
|
+
export const handleFormSubmittedAtom = atom(null, (_, set, form) => {
|
|
7
|
+
set(replyEventCategoryAtom, UserEventCategory.FormSubmitted);
|
|
8
|
+
set(formSubmitAtom, form);
|
|
9
|
+
const formUserEvent = {
|
|
10
|
+
eventId: uuid(),
|
|
11
|
+
category: UserEventCategory.FormSubmitted,
|
|
12
|
+
createdAt: new Date().toISOString(),
|
|
13
|
+
attributes: form,
|
|
14
|
+
};
|
|
15
|
+
set(queueUserEventAtom, formUserEvent);
|
|
16
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { atom } from 'jotai';
|
|
2
|
+
import { responseStreamingAtom, suggestionsLoadingAtom, messagesAtom, userQueryAtom, replyEventCategoryAtom, userHasRepliedAtom, askQuestionBtnClickedAtom, suggestionsAtom, chatIsOpenAtom, chatOnToggleAtom, userEventsAtom, suggestionAtom, } from './chatState';
|
|
3
|
+
export * from './chatState';
|
|
4
|
+
export * from './replies';
|
|
5
|
+
export * from './performanceMetrics';
|
|
6
|
+
export * from './form';
|
|
7
|
+
export * from './suggestions';
|
|
8
|
+
export * from './lastMessage';
|
|
9
|
+
export * from './renderedWidgetRefs';
|
|
10
|
+
export const chatAtom = atom((get) => ({
|
|
11
|
+
userHasReplied: get(userHasRepliedAtom),
|
|
12
|
+
replyEventCategory: get(replyEventCategoryAtom),
|
|
13
|
+
userQuery: get(userQueryAtom),
|
|
14
|
+
suggestion: get(suggestionAtom),
|
|
15
|
+
askQuestionBtnClicked: get(askQuestionBtnClickedAtom),
|
|
16
|
+
messages: get(messagesAtom),
|
|
17
|
+
userEvents: get(userEventsAtom),
|
|
18
|
+
suggestions: get(suggestionsAtom),
|
|
19
|
+
suggestionsLoading: get(suggestionsLoadingAtom),
|
|
20
|
+
responseStreaming: get(responseStreamingAtom),
|
|
21
|
+
isOpen: get(chatIsOpenAtom),
|
|
22
|
+
onToggle: get(chatOnToggleAtom),
|
|
23
|
+
}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { atom } from 'jotai';
|
|
2
|
+
import { messagesAtom, userHasRepliedAtom } from 'src/atoms/chat';
|
|
3
|
+
export const lastAssistantMessageAtom = atom((get) => {
|
|
4
|
+
const messages = get(messagesAtom);
|
|
5
|
+
const userHasReplied = get(userHasRepliedAtom);
|
|
6
|
+
if (messages.length > 0 && !userHasReplied) {
|
|
7
|
+
return messages[messages.length - 1];
|
|
8
|
+
}
|
|
9
|
+
return null;
|
|
10
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { atom } from 'jotai';
|
|
2
|
+
import { v4 as uuid } from 'uuid';
|
|
3
|
+
import { getAtomStore } from 'src/atoms/atomStore/atomStore';
|
|
4
|
+
import { userIdAtom, chatIdAtom } from 'src/atoms/app';
|
|
5
|
+
import { orgShortNameAtom, contextSourceAtom, envAtom } from 'src/atoms/envive/enviveConfig';
|
|
6
|
+
import { orgIdAtom, featureFlagServiceAtom } from 'src/atoms/org/graphqlConfig';
|
|
7
|
+
const internalUserEventQueueAtom = atom([]);
|
|
8
|
+
export const userEventQueueAtom = atom((get) => {
|
|
9
|
+
const queue = get(internalUserEventQueueAtom);
|
|
10
|
+
return queue === undefined ? [] : queue.filter((v) => v !== undefined);
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* This atom is used to queue a new message for processing on `next_responses`
|
|
14
|
+
* It receives a single `userEvent` that is added to the processing queue.
|
|
15
|
+
* If the event has the same eventId as an existing message in the queue the NEW
|
|
16
|
+
* event is ignored
|
|
17
|
+
*/
|
|
18
|
+
export const queueUserEventAtom = atom(null, (get, set, userEvent) => {
|
|
19
|
+
if (userEvent === undefined) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
set(internalUserEventQueueAtom, [...get(internalUserEventQueueAtom), userEvent]);
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* This atom exposes a function to reset the entire queue. All messages in the queue will be purged
|
|
26
|
+
*/
|
|
27
|
+
export const clearUserEventAtom = atom(null, (_, set) => {
|
|
28
|
+
set(internalUserEventQueueAtom, []);
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* This atom is used to mark events as processed and remove them from the queue
|
|
32
|
+
* It accepts a list of eventId values and will remove all events with those eventIds from the queue.
|
|
33
|
+
*/
|
|
34
|
+
export const processUserEventAtom = atom(null, (get, set, eventIds) => {
|
|
35
|
+
const curr = get(internalUserEventQueueAtom);
|
|
36
|
+
const remaining = curr === null || curr === void 0 ? void 0 : curr.filter((event) => !eventIds.includes(event.eventId));
|
|
37
|
+
set(internalUserEventQueueAtom, remaining);
|
|
38
|
+
});
|
|
39
|
+
export const userQueueEventCountAtom = atom((get) => get(userEventQueueAtom).length);
|
|
40
|
+
import { ContextSourceEnum, ContextEnvEnum } from '@spiffy-ai/commerce-api-client'; // Import necessary enums
|
|
41
|
+
// import type { Context } from "@spiffy-ai/commerce-api-client/dist/models/Context"; // Import Context type
|
|
42
|
+
export const createResponsePayload = ({ userEvents, generationParams, }) => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const atomStore = getAtomStore();
|
|
45
|
+
const orgShortName = atomStore.get(orgShortNameAtom);
|
|
46
|
+
const orgId = atomStore.get(orgIdAtom);
|
|
47
|
+
const userId = atomStore.get(userIdAtom);
|
|
48
|
+
const chatId = atomStore.get(chatIdAtom);
|
|
49
|
+
const source = atomStore.get(contextSourceAtom);
|
|
50
|
+
const env = atomStore.get(envAtom);
|
|
51
|
+
const featureFlagService = atomStore.get(featureFlagServiceAtom);
|
|
52
|
+
const context = {
|
|
53
|
+
userId: userId !== null && userId !== void 0 ? userId : '',
|
|
54
|
+
org_id: orgId !== null && orgId !== void 0 ? orgId : '',
|
|
55
|
+
org_short_name: orgShortName !== null && orgShortName !== void 0 ? orgShortName : '',
|
|
56
|
+
chat_id: chatId !== null && chatId !== void 0 ? chatId : '',
|
|
57
|
+
source: source !== null && source !== void 0 ? source : ContextSourceEnum.App,
|
|
58
|
+
env: (_a = env) !== null && _a !== void 0 ? _a : ContextEnvEnum.Dev,
|
|
59
|
+
};
|
|
60
|
+
const featureFlags = ((_b = featureFlagService === null || featureFlagService === void 0 ? void 0 : featureFlagService.featureFlagService) === null || _b === void 0 ? void 0 : _b.getFeatureFlags()) || {};
|
|
61
|
+
return {
|
|
62
|
+
id: uuid(),
|
|
63
|
+
context,
|
|
64
|
+
userEvents,
|
|
65
|
+
featureFlags: Object.fromEntries(Object.entries(featureFlags).filter(([, isEnabled]) => isEnabled)), // Convert back to Record<string, boolean>
|
|
66
|
+
generationParams,
|
|
67
|
+
};
|
|
68
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var _a, _b;
|
|
2
|
+
import { atom } from "jotai";
|
|
3
|
+
import { atomWithStorage } from "jotai/utils";
|
|
4
|
+
import Logger from "src/application/logging/logger";
|
|
5
|
+
import { getAtomStore, sessionStorageUtil, } from "src/atoms/atomStore/atomStore";
|
|
6
|
+
export const APP_INITIAL_START_TIME_KEY = "spiffy-app-initial-start-time";
|
|
7
|
+
export const PAGE_LOAD_OFFSET_TIME_KEY = "spiffy-page-load-offset-time";
|
|
8
|
+
/**
|
|
9
|
+
* The different performance metrics that can be logged. All times are relative to the
|
|
10
|
+
* initial start time of the app and are stored in milliseconds.
|
|
11
|
+
*/
|
|
12
|
+
export var PerfMetricsEvents;
|
|
13
|
+
(function (PerfMetricsEvents) {
|
|
14
|
+
PerfMetricsEvents["PageLoadOffset"] = "page_load_offset_ms";
|
|
15
|
+
PerfMetricsEvents["MainBundleLoaded"] = "main_bundle_loaded_ms";
|
|
16
|
+
PerfMetricsEvents["OrgConfigLoadStarted"] = "org_config_load_started_ms";
|
|
17
|
+
PerfMetricsEvents["OrgConfigLoadEnded"] = "org_config_load_ended_ms";
|
|
18
|
+
PerfMetricsEvents["FirstResponseStarted"] = "first_response_started_ms";
|
|
19
|
+
PerfMetricsEvents["FirstResponseCompleted"] = "first_response_completed_ms";
|
|
20
|
+
PerfMetricsEvents["FirstSuggestionsStarted"] = "first_suggestions_started_ms";
|
|
21
|
+
PerfMetricsEvents["FirstSuggestionsCompleted"] = "first_suggestions_completed_ms";
|
|
22
|
+
PerfMetricsEvents["EmbeddedWidgetRendered"] = "embedded_widget_rendered_ms";
|
|
23
|
+
PerfMetricsEvents["FloatingButtonRendered"] = "floating_button_rendered_ms";
|
|
24
|
+
PerfMetricsEvents["TopSuggestionsBarRendered"] = "top_suggestions_bar_rendered_ms";
|
|
25
|
+
PerfMetricsEvents["BottomSuggestionsBarRendered"] = "bottom_suggestions_bar_rendered_ms";
|
|
26
|
+
PerfMetricsEvents["SearchPromptRendered"] = "search_prompt_rendered_ms";
|
|
27
|
+
})(PerfMetricsEvents || (PerfMetricsEvents = {}));
|
|
28
|
+
const internalPerfMetricsAtom = atom(new Map());
|
|
29
|
+
export const appInitialStartTimeMsAtom = atomWithStorage(APP_INITIAL_START_TIME_KEY, (_a = sessionStorage.getItem(APP_INITIAL_START_TIME_KEY)) !== null && _a !== void 0 ? _a : undefined, sessionStorageUtil, {
|
|
30
|
+
getOnInit: true,
|
|
31
|
+
});
|
|
32
|
+
export const pageLoadOffsetTimeAtom = atomWithStorage(PAGE_LOAD_OFFSET_TIME_KEY, (_b = sessionStorage.getItem(PAGE_LOAD_OFFSET_TIME_KEY)) !== null && _b !== void 0 ? _b : undefined, sessionStorageUtil, {
|
|
33
|
+
getOnInit: true,
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Resets the performance metrics atom to an empty map. This should be called after the performance
|
|
37
|
+
* metrics have been reported to amplitude. On SPA, it ensures that we can still capture metrics as
|
|
38
|
+
* the user navigates around the app (although there is more work to be done to fully enable this).
|
|
39
|
+
* On non-SPA, it ensures that previously captured metrics are not reported again.
|
|
40
|
+
*/
|
|
41
|
+
export const resetPerformanceMetricsAtom = () => {
|
|
42
|
+
const atomStore = getAtomStore();
|
|
43
|
+
atomStore.set(internalPerfMetricsAtom, new Map());
|
|
44
|
+
};
|
|
45
|
+
export const performanceMetricsAtom = atom((get) => get(internalPerfMetricsAtom));
|
|
46
|
+
export const hasReportedPerformanceMetricsAtom = atom(false);
|
|
47
|
+
/**
|
|
48
|
+
* Logs a performance metric by capturing the delta between the initial app start time
|
|
49
|
+
* and the current time. If the metric has already been logged, it will not be logged again.
|
|
50
|
+
*
|
|
51
|
+
* @param value The performance metric name to log.
|
|
52
|
+
*/
|
|
53
|
+
export const logPerfMetricAtom = atom(null, (get, set, value) => {
|
|
54
|
+
const initialTimeStorageValue = get(appInitialStartTimeMsAtom);
|
|
55
|
+
const initialTimeMs = initialTimeStorageValue
|
|
56
|
+
? parseInt(initialTimeStorageValue, 10)
|
|
57
|
+
: undefined;
|
|
58
|
+
if (initialTimeMs == null) {
|
|
59
|
+
Logger.logWarn(`[spiffy-ai] No initial app start time found. Skipping...`, undefined);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const currentPerfMetrics = get(internalPerfMetricsAtom);
|
|
63
|
+
if (currentPerfMetrics.has(value)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const currentTimeMs = Date.now();
|
|
67
|
+
const deltaMs = currentTimeMs - initialTimeMs;
|
|
68
|
+
currentPerfMetrics.set(value, deltaMs);
|
|
69
|
+
set(internalPerfMetricsAtom, currentPerfMetrics);
|
|
70
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { atom } from "jotai";
|
|
2
|
+
import { getAtomStore } from "src/atoms/atomStore/atomStore";
|
|
3
|
+
const internalWidgetArrayAtom = atom([]);
|
|
4
|
+
export const widgetArrayAtom = atom((get) => get(internalWidgetArrayAtom));
|
|
5
|
+
/**
|
|
6
|
+
* This function call is used to create a list of the Spiffy widgets
|
|
7
|
+
* that are rendering on the page.
|
|
8
|
+
*
|
|
9
|
+
* It is used by the FloatingButton widget to slide out of view when it
|
|
10
|
+
* overlaps with another Spiffy widget.
|
|
11
|
+
*
|
|
12
|
+
* The spiffy widgets should be added to the this array for the floating button
|
|
13
|
+
* to know about them.
|
|
14
|
+
*
|
|
15
|
+
* Today the "SuggestionBar" widget is not added, but the other widgets are.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export const addWidget = (ref, idx) => {
|
|
19
|
+
const atomStore = getAtomStore();
|
|
20
|
+
const val = atomStore.get(internalWidgetArrayAtom);
|
|
21
|
+
const insertIdx = idx !== null && idx !== void 0 ? idx : val.length;
|
|
22
|
+
val[insertIdx] = ref;
|
|
23
|
+
atomStore.set(internalWidgetArrayAtom, val);
|
|
24
|
+
};
|