@envive-ai/react-hooks 0.2.6-alpha → 0.2.6-alpha-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AmplitudeOperations-zFjk1Mkm.js → AmplitudeOperations-C3i2q2Bn.js} +2 -2
- package/dist/{AmplitudeOperations-CDe6oRn4.cjs → AmplitudeOperations-DcuLn1Zk.cjs} +2 -2
- package/dist/{NewOrgConfig-ChNJ3ZtC.js → NewOrgConfig-BtvujFC8.js} +2 -2
- package/dist/{NewOrgConfig-KHz61ikr.cjs → NewOrgConfig-CHt7Xg4t.cjs} +2 -2
- package/dist/{TrackComponentVisibleEvent-f8ahqV1g.js → TrackComponentVisibleEvent-Be7wfXXY.js} +3 -3
- package/dist/{TrackComponentVisibleEvent-uEzgBXb9.cjs → TrackComponentVisibleEvent-KUihr_y4.cjs} +3 -3
- package/dist/{api-1-73JxnF.js → api-D4HaU2Gf.js} +3 -3
- package/dist/{api-ZNG6wObS.cjs → api-D4Xoibs9.cjs} +3 -3
- package/dist/application/models/graphql/index.cjs +1 -1
- package/dist/application/models/graphql/index.js +1 -1
- package/dist/application/models/guards/api/index.cjs +3 -3
- 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.js +1 -1
- package/dist/application/models/index.cjs +6 -6
- package/dist/application/models/index.js +6 -6
- package/dist/application/utils/index.cjs +17 -17
- package/dist/application/utils/index.d.cts +1 -1
- package/dist/application/utils/index.d.ts +2 -2
- package/dist/application/utils/index.js +17 -17
- package/dist/{atomStore-DAQvNPkh.js → atomStore-BuopbV9k.js} +1 -1
- package/dist/{atomStore-DD9g7Zw2.cjs → atomStore-CZKe3itM.cjs} +1 -1
- package/dist/atoms/app/index.cjs +17 -17
- package/dist/atoms/app/index.d.cts +7 -7
- package/dist/atoms/app/index.d.ts +6 -6
- package/dist/atoms/app/index.js +17 -17
- package/dist/atoms/atomStore/index.cjs +1 -1
- package/dist/atoms/atomStore/index.js +1 -1
- package/dist/atoms/chat/index.cjs +19 -19
- package/dist/atoms/chat/index.d.cts +32 -32
- package/dist/atoms/chat/index.d.ts +32 -32
- package/dist/atoms/chat/index.js +19 -19
- 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 +2 -2
- package/dist/atoms/org/index.d.cts +16 -16
- package/dist/atoms/org/index.d.ts +16 -16
- package/dist/atoms/org/index.js +2 -2
- package/dist/atoms/search/index.cjs +6 -6
- package/dist/atoms/search/index.d.cts +15 -15
- package/dist/atoms/search/index.d.ts +14 -14
- package/dist/atoms/search/index.js +6 -6
- package/dist/atoms/search/utils.cjs +1 -1
- package/dist/atoms/search/utils.js +1 -1
- package/dist/{cdnContext-DT6J5nCw.js → cdnContext-B2-NiEiW.js} +2 -2
- package/dist/{cdnContext-BLNiW2HT.cjs → cdnContext-CdhppNeT.cjs} +2 -2
- package/dist/{chat-C0cgfkL8.js → chat-C9KdnT5V.js} +7 -7
- package/dist/{chat-DULmjtx1.cjs → chat-bImNRcnQ.cjs} +7 -7
- package/dist/{chatState-BrSfXIV4.cjs → chatState-DqWSgmjC.cjs} +3 -3
- package/dist/{chatState-Cn8JGAlH.js → chatState-DxG0t4fK.js} +3 -3
- package/dist/contexts/amplitudeContext/index.cjs +17 -17
- package/dist/contexts/amplitudeContext/index.js +17 -17
- package/dist/contexts/cdnContext/index.cjs +4 -4
- package/dist/contexts/cdnContext/index.d.cts +1 -1
- package/dist/contexts/cdnContext/index.js +4 -4
- package/dist/contexts/enviveConfigContext/index.cjs +4 -4
- package/dist/contexts/enviveConfigContext/index.d.cts +1 -1
- package/dist/contexts/enviveConfigContext/index.js +4 -4
- package/dist/contexts/enviveCssContext/index.cjs +14 -14
- package/dist/contexts/enviveCssContext/index.js +14 -14
- package/dist/contexts/featureFlagContext/index.cjs +5 -5
- package/dist/contexts/featureFlagContext/index.js +5 -5
- package/dist/contexts/featureFlagServiceContext/index.cjs +4 -4
- package/dist/contexts/featureFlagServiceContext/index.js +4 -4
- package/dist/contexts/graphqlContext/index.cjs +8 -8
- package/dist/contexts/graphqlContext/index.js +8 -8
- package/dist/contexts/localStorageContext/index.cjs +3 -3
- package/dist/contexts/localStorageContext/index.js +3 -3
- package/dist/contexts/newOrgConfigContext/index.cjs +13 -13
- package/dist/contexts/newOrgConfigContext/index.d.cts +1 -1
- package/dist/contexts/newOrgConfigContext/index.js +13 -13
- package/dist/contexts/searchContext/index.cjs +22 -22
- package/dist/contexts/searchContext/index.js +22 -22
- package/dist/contexts/sessionStorageContext/index.cjs +2 -2
- package/dist/contexts/sessionStorageContext/index.js +2 -2
- package/dist/contexts/systemSettingsContext/index.cjs +4 -4
- package/dist/contexts/systemSettingsContext/index.js +4 -4
- package/dist/contexts/userIdentityContext/index.cjs +17 -17
- package/dist/contexts/userIdentityContext/index.js +17 -17
- package/dist/{dist-BZX_Mgfn.cjs → dist-B7BErEyV.cjs} +1 -1
- package/dist/{dist-CIM4YRqp.js → dist-CtkINi1R.js} +1 -1
- package/dist/{domObserver-DKcas6tl.js → domObserver-B19-69gW.js} +1 -1
- package/dist/{domObserver-Do6RAJdf.cjs → domObserver-CwieVNgj.cjs} +1 -1
- package/dist/{enviveConfig-DrvYlCYG.js → enviveConfig-Be2kZE7j.js} +3 -3
- package/dist/{enviveConfig-DaotBKMS.cjs → enviveConfig-u50Rpz-G.cjs} +3 -3
- package/dist/{enviveConfigContext-BCnzgk4M.js → enviveConfigContext-1oiQuocd.js} +3 -3
- package/dist/{enviveConfigContext--89ejDs5.cjs → enviveConfigContext-kQfHEGdJ.cjs} +3 -3
- package/dist/exceptions/index.cjs +1 -1
- package/dist/exceptions/index.js +1 -1
- package/dist/{exceptions-BiSWJEl2.cjs → exceptions-BjDgLzGi.cjs} +1 -1
- package/dist/{exceptions-DSv0ZaH0.js → exceptions-CUGY31Ua.js} +1 -1
- package/dist/{featureFlagServiceContext-DpdlcjNb.js → featureFlagServiceContext-CPsygiHO.js} +3 -3
- package/dist/{featureFlagServiceContext-BztKnBPk.cjs → featureFlagServiceContext-pPneufeB.cjs} +3 -3
- package/dist/{globalSearch-nmrfGLOn.js → globalSearch-B_v9qfCT.js} +1 -1
- package/dist/{globalSearch-Cpc8egsM.cjs → globalSearch-OiF96VLG.cjs} +1 -1
- package/dist/{graphql-CWNkUHFV.js → graphql-CvAHWmel.js} +1 -1
- package/dist/{graphql-DT-H-lta.cjs → graphql-JaGqsToc.cjs} +1 -1
- package/dist/{graphqlContext-CWulFxxC.js → graphqlContext-BuXJ5DiW.js} +5 -5
- package/dist/{graphqlContext-B181y-sa.cjs → graphqlContext-CU7NIJo7.cjs} +5 -5
- package/dist/hooks/AmplitudeOperations/index.cjs +18 -18
- package/dist/hooks/AmplitudeOperations/index.d.cts +1 -1
- package/dist/hooks/AmplitudeOperations/index.js +18 -18
- package/dist/hooks/AppDetails/index.cjs +20 -20
- package/dist/hooks/AppDetails/index.d.cts +1 -1
- package/dist/hooks/AppDetails/index.js +20 -20
- package/dist/hooks/CdnOperations/index.cjs +4 -4
- package/dist/hooks/CdnOperations/index.d.cts +1 -1
- package/dist/hooks/CdnOperations/index.js +4 -4
- package/dist/hooks/ChatToggle/index.cjs +19 -19
- package/dist/hooks/ChatToggle/index.js +19 -19
- package/dist/hooks/ChatToggleAnalytics/index.cjs +19 -19
- package/dist/hooks/ChatToggleAnalytics/index.js +19 -19
- package/dist/hooks/CustomerSupportHandoff/index.cjs +1 -1
- package/dist/hooks/CustomerSupportHandoff/index.js +1 -1
- package/dist/hooks/ElementObserver/index.cjs +1 -1
- package/dist/hooks/ElementObserver/index.js +1 -1
- package/dist/hooks/GraphQLConfig/index.cjs +9 -9
- package/dist/hooks/GraphQLConfig/index.js +9 -9
- package/dist/hooks/IdentifyUser/index.cjs +17 -17
- package/dist/hooks/IdentifyUser/index.js +17 -17
- package/dist/hooks/ImageResolver/index.cjs +3 -3
- package/dist/hooks/ImageResolver/index.js +3 -3
- package/dist/hooks/LocalStorageOperations/index.cjs +3 -3
- package/dist/hooks/LocalStorageOperations/index.js +3 -3
- package/dist/hooks/MessageFilter/index.cjs +1 -1
- package/dist/hooks/MessageFilter/index.js +1 -1
- package/dist/hooks/NewOrgConfig/index.cjs +14 -14
- package/dist/hooks/NewOrgConfig/index.d.cts +2 -2
- package/dist/hooks/NewOrgConfig/index.d.ts +2 -2
- package/dist/hooks/NewOrgConfig/index.js +14 -14
- package/dist/hooks/Search/index.cjs +31 -31
- package/dist/hooks/Search/index.js +31 -31
- package/dist/hooks/SearchOperations/index.cjs +22 -22
- package/dist/hooks/SearchOperations/index.js +22 -22
- package/dist/hooks/SessionStorageOperations/index.cjs +2 -2
- package/dist/hooks/SessionStorageOperations/index.js +2 -2
- package/dist/hooks/ShopifyUrlOperations/index.d.cts +2 -2
- package/dist/hooks/ShopifyUrlOperations/index.d.ts +2 -2
- package/dist/hooks/SystemSettingsContext/index.cjs +4 -4
- package/dist/hooks/SystemSettingsContext/index.d.cts +3 -3
- package/dist/hooks/SystemSettingsContext/index.d.ts +4 -4
- package/dist/hooks/SystemSettingsContext/index.js +4 -4
- package/dist/hooks/TrackComponentVisibleEvent/index.cjs +18 -18
- package/dist/hooks/TrackComponentVisibleEvent/index.js +18 -18
- package/dist/hooks/UpdateAnalyticsProps/index.cjs +17 -17
- package/dist/hooks/UpdateAnalyticsProps/index.js +17 -17
- package/dist/index-B4cSHxVN.d.ts +1 -1
- package/dist/index-Dzv6WwSZ.d.ts +1 -1
- package/dist/interceptors/index.cjs +1 -1
- package/dist/interceptors/index.js +1 -1
- package/dist/{localStorageContext-DbWl7Row.cjs → localStorageContext-Bb2b_3ue.cjs} +3 -3
- package/dist/{localStorageContext-DSpmlfyr.js → localStorageContext-D2uXKahw.js} +3 -3
- package/dist/{logger-DCs3_11o.js → logger-BMVdhQOV.js} +1 -1
- package/dist/{logger-BF6iGSVd.cjs → logger-BqHq67zN.cjs} +1 -1
- package/dist/{models-DEJUuKYQ.js → models-DmsMlaHT.js} +5 -5
- package/dist/{models-158fyHt9.cjs → models-wh2gh_Qz.cjs} +5 -5
- package/dist/{newOrgConfigAtom-BuQE_zPK.js → newOrgConfigAtom-Dsk0fJNR.js} +1 -1
- package/dist/{newOrgConfigAtom-rrYHmp1b.cjs → newOrgConfigAtom-hs5A1pbZ.cjs} +1 -1
- package/dist/{newOrgConfigContext-C0LzIRJ7.js → newOrgConfigContext-DPUxIF2G.js} +5 -5
- package/dist/{newOrgConfigContext-BVrzYatq.cjs → newOrgConfigContext-lw85mMS-.cjs} +5 -5
- package/dist/nodeSelector-Cj-Xl1LP.d.cts +1 -1
- package/dist/{org-CVjyv-gv.cjs → org-C2kLSSe9.cjs} +1 -1
- package/dist/{org-Ct9Vjv1J.js → org-CIczyLRP.js} +1 -1
- package/dist/{search-DLHzcbfP.js → search-BzXoTgRx.js} +5 -5
- package/dist/{search-C0TAcTeY.cjs → search-D1cU29CV.cjs} +5 -5
- package/dist/{searchContext-Dmtue5QO.js → searchContext-C8DpjnqD.js} +7 -7
- package/dist/{searchContext-l_23fiuP.cjs → searchContext-R_XuFzYe.cjs} +7 -7
- package/dist/{searchServiceAdapter-B0h7psvh.js → searchServiceAdapter-CKc7UXKi.js} +1 -1
- package/dist/{searchServiceAdapter-BclWy4fE.cjs → searchServiceAdapter-pROGm3Rf.cjs} +1 -1
- package/dist/{sessionStorageContext-BOyr7mIM.cjs → sessionStorageContext-ByaTsDUC.cjs} +2 -2
- package/dist/{sessionStorageContext-ClXN9eX4.js → sessionStorageContext-DKE97oMv.js} +2 -2
- package/dist/{systemSettingsContext-CksCdpiU.js → systemSettingsContext-B-FZ8UAg.js} +2 -2
- package/dist/{systemSettingsContext-Cb5kczBD.cjs → systemSettingsContext-J1sny8W8.cjs} +2 -2
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +1 -1
- package/dist/{types-18QXD2rd.cjs → types-1iJ_FnQQ.cjs} +1 -1
- package/dist/{types-DQC1pHqD.js → types-D5du68Vp.js} +1 -1
- package/dist/{useAppDetails-BJFRSYbI.js → useAppDetails-BtK9ZZJs.js} +4 -4
- package/dist/{useAppDetails-Czn-5FzP.cjs → useAppDetails-Bw2jJ39H.cjs} +4 -4
- package/dist/{useGraphQLConfig-BEtX5pDM.cjs → useGraphQLConfig-Dc8h2yyN.cjs} +2 -2
- package/dist/{useGraphQLConfig-Dkcrz1YL.js → useGraphQLConfig-DuLB3tdv.js} +2 -2
- package/dist/{utils-CEKzBcN2.js → utils-B1LVzQYK.js} +1 -1
- package/dist/{utils-CqVRbvfN.cjs → utils-BivlGkeU.cjs} +1 -1
- package/dist/{utils-DQhbbAnt.js → utils-CExht7Uj.js} +1 -1
- package/dist/{utils-CsMbZmRw.cjs → utils-CiJLDPjY.cjs} +1 -1
- package/dist/{utils-CPvqOk0g.cjs → utils-DqNhRm2b.cjs} +14 -14
- package/dist/{utils-N47VsL9W.js → utils-IogJwDB9.js} +13 -13
- package/package.json +1 -1
- package/dist/src/application/commerce-api.js +0 -406
- package/dist/src/application/logging/logger.js +0 -16
- package/dist/src/application/models/graphql/index.js +0 -3
- package/dist/src/application/models/graphql/queries/getMerchantColorsQuery.js +0 -13
- package/dist/src/application/models/graphql/queries/getMerchantFrontendConfigQuery.js +0 -13
- package/dist/src/application/models/graphql/queries/getMerchantOrgIdQuery.js +0 -10
- package/dist/src/application/models/guards/api/index.js +0 -12
- package/dist/src/application/models/guards/api/isApiFormResponse.js +0 -59
- package/dist/src/application/models/guards/api/isApiFormSubmittedResponseAttributes.js +0 -22
- package/dist/src/application/models/guards/api/isApiOrderResponseAttributes.js +0 -91
- package/dist/src/application/models/guards/api/isApiOrgConfigResults.js +0 -188
- package/dist/src/application/models/guards/api/isApiOrganizationConfig.js +0 -115
- package/dist/src/application/models/guards/api/isApiPDPEventAttributes.js +0 -16
- package/dist/src/application/models/guards/api/isApiPLPEventAttributes.js +0 -26
- package/dist/src/application/models/guards/api/isApiPageResponseAttributes.js +0 -15
- package/dist/src/application/models/guards/api/isApiProductResponseAttributes.js +0 -65
- package/dist/src/application/models/guards/api/isApiProductSearchAttributes.js +0 -15
- package/dist/src/application/models/guards/api/isApiProductSearchFilterAttributes.js +0 -10
- package/dist/src/application/models/guards/api/isApiQueryTypedEventAttributes.js +0 -4
- package/dist/src/application/models/guards/api/isApiResponse.js +0 -33
- package/dist/src/application/models/guards/api/isApiReviewResponseAttributes.js +0 -22
- package/dist/src/application/models/guards/api/isApiReviewRichInformation.js +0 -23
- package/dist/src/application/models/guards/api/isApiSearchEventAttributes.js +0 -20
- package/dist/src/application/models/guards/api/isApiSuggestion.js +0 -24
- package/dist/src/application/models/guards/api/isApiSuggestionClickedEventAttributes.js +0 -4
- package/dist/src/application/models/guards/api/isApiTextResponseAttributes.js +0 -4
- package/dist/src/application/models/guards/api/isApiUserEvent.js +0 -18
- package/dist/src/application/models/guards/graphQL/isGraphQLColorsConfig.js +0 -41
- package/dist/src/application/models/guards/isBaseEcommerceEvent.js +0 -14
- package/dist/src/application/models/guards/isGA4EcommerceEvent.js +0 -14
- package/dist/src/application/models/guards/isLegacyUAEcommerceEvent.js +0 -14
- package/dist/src/application/models/guards/isMobilePLPChatPlacementParameter.js +0 -4
- package/dist/src/application/models/guards/isSpanxTakeAQuizCtaParameter.js +0 -1
- package/dist/src/application/models/guards/isVariantInfo.js +0 -28
- package/dist/src/application/models/guards/utils.js +0 -34
- package/dist/src/application/models/index.js +0 -34
- package/dist/src/application/models/utils/snakeToCamelTransformer.js +0 -71
- package/dist/src/application/models/utils/stringToFulfillmentDisplayStatusEnumValue.js +0 -65
- package/dist/src/application/models/validators/validateGraphQLColorsConfig.js +0 -9
- package/dist/src/application/models/validators/validateGraphQLFrontendConfig.js +0 -420
- package/dist/src/application/models/validators/validateGraphQLOrgId.js +0 -6
- package/dist/src/application/models/validators/validateMobilePLPChatPlacementParameter.js +0 -9
- package/dist/src/application/models/validators/validateOrgConfigResults.js +0 -44
- package/dist/src/application/models/validators/validateOrganizationConfig.js +0 -34
- package/dist/src/application/models/validators/validateResponse.js +0 -173
- package/dist/src/application/models/validators/validateSuggestion.js +0 -13
- package/dist/src/application/models/validators/validateUserEvent.js +0 -91
- package/dist/src/application/utils/analyticsUtils.js +0 -94
- package/dist/src/application/utils/coreContextToApiContext.js +0 -8
- package/dist/src/application/utils/coreUserEventToApiUserEvent.js +0 -90
- package/dist/src/application/utils/divideArray.js +0 -7
- package/dist/src/application/utils/domObserver.js +0 -85
- package/dist/src/application/utils/elementObserver.js +0 -186
- package/dist/src/application/utils/imageFilter.js +0 -11
- package/dist/src/application/utils/index.js +0 -21
- package/dist/src/application/utils/merchantUtils.js +0 -15
- package/dist/src/application/utils/messageFromFormSubmittedEvent.js +0 -19
- package/dist/src/application/utils/messageFromQueryEvent.js +0 -35
- package/dist/src/application/utils/messageFromResponse.js +0 -123
- package/dist/src/application/utils/messageFromSuggestionEvent.js +0 -27
- package/dist/src/application/utils/mouseEventTypes.js +0 -1
- package/dist/src/application/utils/mutationHelper.js +0 -33
- package/dist/src/application/utils/nextMessageRequestToApiRequest.js +0 -29
- package/dist/src/application/utils/nodeSelector.js +0 -101
- package/dist/src/application/utils/overrides.js +0 -144
- package/dist/src/application/utils/stringUtils.js +0 -47
- package/dist/src/application/utils/supportedEventRequestToApiRequest.js +0 -7
- package/dist/src/application/utils/urlsParser.js +0 -33
- package/dist/src/application/utils/validation.js +0 -5
- package/dist/src/atoms/amplitude/amplitudeTrackEventAtom.js +0 -4
- package/dist/src/atoms/app/index.js +0 -23
- package/dist/src/atoms/app/variant.js +0 -102
- package/dist/src/atoms/atomStore/atomStore.js +0 -28
- package/dist/src/atoms/atomStore/index.js +0 -1
- package/dist/src/atoms/chat/chatState.js +0 -33
- package/dist/src/atoms/chat/form.js +0 -16
- package/dist/src/atoms/chat/index.js +0 -23
- package/dist/src/atoms/chat/lastMessage.js +0 -10
- package/dist/src/atoms/chat/messageQueue.js +0 -68
- package/dist/src/atoms/chat/performanceMetrics.js +0 -70
- package/dist/src/atoms/chat/renderedWidgetRefs.js +0 -24
- package/dist/src/atoms/chat/replies.js +0 -43
- package/dist/src/atoms/chat/suggestions.js +0 -29
- package/dist/src/atoms/envive/enviveConfig.js +0 -67
- package/dist/src/atoms/globalSearch/globalSearch.js +0 -8
- package/dist/src/atoms/globalSearch/index.js +0 -1
- package/dist/src/atoms/org/customerService.js +0 -6
- package/dist/src/atoms/org/graphqlConfig.js +0 -8
- package/dist/src/atoms/org/index.js +0 -4
- package/dist/src/atoms/org/newOrgConfigAtom.js +0 -2
- package/dist/src/atoms/org/orgAnalyticsConfig.js +0 -8
- package/dist/src/atoms/search/index.js +0 -1
- package/dist/src/atoms/search/productFilters.js +0 -163
- package/dist/src/atoms/search/productRetrievalAPI.js +0 -50
- package/dist/src/atoms/search/productRetrievalAdapter.js +0 -14
- package/dist/src/atoms/search/productSorter.js +0 -13
- package/dist/src/atoms/search/searchAPI.js +0 -140
- package/dist/src/atoms/search/searchServiceAdapter.js +0 -14
- package/dist/src/atoms/search/utils.js +0 -15
- package/dist/src/config/index.js +0 -1
- package/dist/src/config/locators/components/chat/entrypoints.js +0 -10
- package/dist/src/config/locators/components/chat/index.js +0 -21
- package/dist/src/config/locators/components/chat/preview.js +0 -11
- package/dist/src/config/locators/components/chat/variants/index.js +0 -12
- package/dist/src/config/locators/components/common/buttons.js +0 -6
- package/dist/src/config/locators/components/common/cards.js +0 -17
- package/dist/src/config/locators/components/common/index.js +0 -4
- package/dist/src/config/locators/components/common/links.js +0 -1
- package/dist/src/config/locators/components/common/tables.js +0 -1
- package/dist/src/config/locators/components/floating-button.js +0 -2
- package/dist/src/config/locators/components/index.js +0 -3
- package/dist/src/config/locators/components/report-issue.js +0 -13
- package/dist/src/config/locators/components/search/index.js +0 -5
- package/dist/src/config/locators/components/shadow-dom.js +0 -1
- package/dist/src/config/locators/embedded.js +0 -20
- package/dist/src/config/locators/index.js +0 -4
- package/dist/src/contexts/amplitudeContext/amplitudeContext.js +0 -292
- package/dist/src/contexts/amplitudeContext/index.js +0 -1
- package/dist/src/contexts/cdnContext/cdnContext.js +0 -28
- package/dist/src/contexts/cdnContext/index.js +0 -1
- package/dist/src/contexts/enviveConfigContext/enviveConfigContext.js +0 -37
- package/dist/src/contexts/enviveConfigContext/index.js +0 -1
- package/dist/src/contexts/enviveCssContext/enviveCssContext.js +0 -31
- package/dist/src/contexts/enviveCssContext/index.js +0 -1
- package/dist/src/contexts/featureFlagContext/featureFlagContext.js +0 -109
- package/dist/src/contexts/featureFlagContext/index.js +0 -1
- package/dist/src/contexts/featureFlagServiceContext/featureFlagServiceContext.js +0 -47
- package/dist/src/contexts/featureFlagServiceContext/index.js +0 -1
- package/dist/src/contexts/graphqlContext/graphqlContext.js +0 -87
- package/dist/src/contexts/graphqlContext/index.js +0 -1
- package/dist/src/contexts/localStorageContext/index.js +0 -1
- package/dist/src/contexts/localStorageContext/localStorageContext.js +0 -95
- package/dist/src/contexts/newOrgConfigContext/index.js +0 -1
- package/dist/src/contexts/newOrgConfigContext/newOrgConfigContext.js +0 -33
- package/dist/src/contexts/searchContext/index.js +0 -1
- package/dist/src/contexts/searchContext/searchContext.js +0 -131
- package/dist/src/contexts/sessionStorageContext/index.js +0 -1
- package/dist/src/contexts/sessionStorageContext/sessionStorageContext.js +0 -43
- package/dist/src/contexts/shopifyUrlContext/index.js +0 -1
- package/dist/src/contexts/shopifyUrlContext/shopifyUrlContext.js +0 -62
- package/dist/src/contexts/systemSettingsContext/index.js +0 -1
- package/dist/src/contexts/systemSettingsContext/systemSettingsContext.js +0 -29
- package/dist/src/contexts/userIdentityContext/index.js +0 -1
- package/dist/src/contexts/userIdentityContext/userIdentityContext.js +0 -118
- package/dist/src/events/index.js +0 -51
- package/dist/src/events/registerAnalyticsListeners.js +0 -32
- package/dist/src/exceptions/index.js +0 -2
- package/dist/src/exceptions/sessionExceptions.js +0 -6
- package/dist/src/exceptions/unsupportedProductExceptions.js +0 -6
- package/dist/src/hooks/AmplitudeOperations/index.js +0 -1
- package/dist/src/hooks/AmplitudeOperations/useAmplitudeOperations.js +0 -24
- package/dist/src/hooks/AppDetails/index.js +0 -1
- package/dist/src/hooks/AppDetails/useAppDetails.js +0 -26
- package/dist/src/hooks/BlockBackButton/index.js +0 -1
- package/dist/src/hooks/BlockBackButton/useBlockBackButton.js +0 -23
- package/dist/src/hooks/CdnOperations/index.js +0 -1
- package/dist/src/hooks/CdnOperations/useCdnOperations.js +0 -13
- package/dist/src/hooks/ChatToggle/index.js +0 -1
- package/dist/src/hooks/ChatToggle/useChatToggle.js +0 -50
- package/dist/src/hooks/ChatToggleAnalytics/index.js +0 -1
- package/dist/src/hooks/ChatToggleAnalytics/useChatToggleAnalytics.js +0 -11
- package/dist/src/hooks/CustomerSupportHandoff/index.js +0 -1
- package/dist/src/hooks/CustomerSupportHandoff/useCustomerSupportHandoff.js +0 -32
- package/dist/src/hooks/Debounce/index.js +0 -1
- package/dist/src/hooks/Debounce/useDebounce.js +0 -13
- package/dist/src/hooks/ElementObserver/index.js +0 -1
- package/dist/src/hooks/ElementObserver/useElementObserver.js +0 -208
- package/dist/src/hooks/GrabAndScroll/index.js +0 -1
- package/dist/src/hooks/GrabAndScroll/useGrabAndScroll.js +0 -105
- package/dist/src/hooks/GraphQLConfig/index.js +0 -1
- package/dist/src/hooks/GraphQLConfig/useGraphQLConfig.js +0 -54
- package/dist/src/hooks/IdentifyUser/index.js +0 -1
- package/dist/src/hooks/IdentifyUser/useIdentifyUser.js +0 -28
- package/dist/src/hooks/ImageResolver/index.js +0 -1
- package/dist/src/hooks/ImageResolver/useImageResolver.js +0 -45
- package/dist/src/hooks/Intersection/index.js +0 -1
- package/dist/src/hooks/Intersection/useIntersection.js +0 -20
- package/dist/src/hooks/IsSmallScreen/index.js +0 -1
- package/dist/src/hooks/IsSmallScreen/useIsSmallScreen.js +0 -16
- package/dist/src/hooks/LocalStorageOperations/index.js +0 -1
- package/dist/src/hooks/LocalStorageOperations/useLocalStorageOperations.js +0 -64
- package/dist/src/hooks/MessageFilter/index.js +0 -1
- package/dist/src/hooks/MessageFilter/useMessageFilter.js +0 -37
- package/dist/src/hooks/MessageScrollObserver/index.js +0 -1
- package/dist/src/hooks/MessageScrollObserver/useMessageScrollObserver.js +0 -35
- package/dist/src/hooks/NewOrgConfig/index.js +0 -1
- package/dist/src/hooks/NewOrgConfig/useNewOrgConfig.js +0 -5
- package/dist/src/hooks/Search/index.js +0 -1
- package/dist/src/hooks/Search/useRecommendedProducts.js +0 -35
- package/dist/src/hooks/Search/useSearch.js +0 -224
- package/dist/src/hooks/Search/useSearchInput.js +0 -183
- package/dist/src/hooks/SearchOperations/index.js +0 -1
- package/dist/src/hooks/SearchOperations/useSearchOperations.js +0 -78
- package/dist/src/hooks/SessionStorageOperations/index.js +0 -1
- package/dist/src/hooks/SessionStorageOperations/useSessionStorageOperations.js +0 -20
- package/dist/src/hooks/ShopifyUrlOperations/index.js +0 -1
- package/dist/src/hooks/ShopifyUrlOperations/useShopifyUrlOperations.js +0 -34
- package/dist/src/hooks/SnapCalculator/index.js +0 -1
- package/dist/src/hooks/SnapCalculator/useSnapCalculator.js +0 -22
- package/dist/src/hooks/SystemSettingsContext/index.js +0 -1
- package/dist/src/hooks/SystemSettingsContext/useSystemSettingsContext.js +0 -9
- package/dist/src/hooks/TrackComponentVisibleEvent/index.js +0 -1
- package/dist/src/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.js +0 -45
- package/dist/src/hooks/UpdateAnalyticsProps/index.js +0 -1
- package/dist/src/hooks/UpdateAnalyticsProps/useUpdateAnalyticsProps.js +0 -43
- package/dist/src/hooks/utils.js +0 -116
- package/dist/src/interceptors/index.js +0 -1
- package/dist/src/interceptors/useMessageInterceptor.js +0 -24
- package/dist/src/types/ApiResponse.js +0 -1
- package/dist/src/types/FilterAttribute.js +0 -3
- package/dist/src/types/Message.js +0 -24
- package/dist/src/types/Suggestion.js +0 -3
- package/dist/src/types/index.js +0 -4
- package/dist/src/util/colorVar.js +0 -3
- package/dist/src/util/configVersion.js +0 -4
- package/dist/src/util/domInsertion.js +0 -16
- /package/dist/{featureFlagServiceContext-bI7ZLz4r.js → featureFlagServiceContext-CbUOAw5l.js} +0 -0
- /package/dist/{featureFlagServiceContext-B4ash4vz.cjs → featureFlagServiceContext-DSo2brno.cjs} +0 -0
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useCallback, useContext, useMemo, useState, useEffect } from 'react';
|
|
3
|
-
import UAParser from 'ua-parser-js';
|
|
4
|
-
import Logger from '../../application/logging/logger';
|
|
5
|
-
import CommerceApiClient from '../../application/commerce-api';
|
|
6
|
-
import { useLocalStorage } from '../localStorageContext';
|
|
7
|
-
import { v4 as uuid } from 'uuid';
|
|
8
|
-
// Helper function from the original service
|
|
9
|
-
const getUserAgentDetails = () => {
|
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
11
|
-
const uaParser = new UAParser();
|
|
12
|
-
const result = uaParser.getResult();
|
|
13
|
-
return {
|
|
14
|
-
os: (_a = result === null || result === void 0 ? void 0 : result.os) === null || _a === void 0 ? void 0 : _a.name,
|
|
15
|
-
osVersion: (_b = result === null || result === void 0 ? void 0 : result.os) === null || _b === void 0 ? void 0 : _b.version,
|
|
16
|
-
deviceBrand: (_c = result === null || result === void 0 ? void 0 : result.device) === null || _c === void 0 ? void 0 : _c.vendor,
|
|
17
|
-
deviceManufacturer: (_d = result === null || result === void 0 ? void 0 : result.device) === null || _d === void 0 ? void 0 : _d.vendor,
|
|
18
|
-
deviceModel: (_e = result === null || result === void 0 ? void 0 : result.device) === null || _e === void 0 ? void 0 : _e.model,
|
|
19
|
-
browser: (_f = result === null || result === void 0 ? void 0 : result.browser) === null || _f === void 0 ? void 0 : _f.name,
|
|
20
|
-
browserVersion: (_g = result === null || result === void 0 ? void 0 : result.browser) === null || _g === void 0 ? void 0 : _g.version,
|
|
21
|
-
userAgent: result === null || result === void 0 ? void 0 : result.ua,
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
const UserIdentityContext = createContext(undefined);
|
|
25
|
-
export const UserIdentityProvider = ({ children }) => {
|
|
26
|
-
const { getItem, setItem, isAvailable: localStorageIsReady } = useLocalStorage();
|
|
27
|
-
const [isReady, setIsReady] = useState(false);
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
// Assuming CommerceApiClient and other dependencies are ready if localStorage is.
|
|
30
|
-
// In a more complex scenario, you might have more checks here.
|
|
31
|
-
setIsReady(localStorageIsReady);
|
|
32
|
-
}, [localStorageIsReady]);
|
|
33
|
-
const USER_ID_OVERRIDE_KEY = 'v1-spiffy-user-id-override';
|
|
34
|
-
const USER_ID_DEFAULT_KEY = 'v1-spiffy-user-id-default';
|
|
35
|
-
const getUserIdOverrideFromLocalStorage = useCallback(() => { var _a; return (_a = getItem(USER_ID_OVERRIDE_KEY)) !== null && _a !== void 0 ? _a : undefined; }, [getItem]);
|
|
36
|
-
const getUserIdDefaultFromLocalStorage = useCallback(() => { var _a; return (_a = getItem(USER_ID_DEFAULT_KEY)) !== null && _a !== void 0 ? _a : undefined; }, [getItem]);
|
|
37
|
-
const setUserIdDefaultInLocalStorage = useCallback((userId) => {
|
|
38
|
-
Logger.logInfo(`setUserIdDefaultInLocalStorage - Setting user_id=${userId}`);
|
|
39
|
-
setItem(USER_ID_DEFAULT_KEY, userId);
|
|
40
|
-
// window.dispatchEvent is handled by useLocalStorage now
|
|
41
|
-
return userId;
|
|
42
|
-
}, [setItem, USER_ID_DEFAULT_KEY]);
|
|
43
|
-
const setUserIdOverrideInLocalStorage = useCallback((userId) => {
|
|
44
|
-
Logger.logInfo(`setUserIdOverrideInLocalStorage - Setting user_id=${userId}`);
|
|
45
|
-
setItem(USER_ID_OVERRIDE_KEY, userId);
|
|
46
|
-
// window.dispatchEvent is handled by useLocalStorage now
|
|
47
|
-
return userId;
|
|
48
|
-
}, [setItem, USER_ID_OVERRIDE_KEY]);
|
|
49
|
-
const clearUserIdOverrideInLocalStorage = useCallback(() => {
|
|
50
|
-
Logger.logInfo(`clearUserIdOverrideInLocalStorage - Clearing user_id`);
|
|
51
|
-
// LocalStorageService.getLocalStorage()?.removeItem(USER_ID_OVERRIDE_KEY);
|
|
52
|
-
// window.dispatchEvent is handled by useLocalStorage now
|
|
53
|
-
setItem(USER_ID_OVERRIDE_KEY, ''); // Set to empty string to clear
|
|
54
|
-
}, [setItem, USER_ID_OVERRIDE_KEY]);
|
|
55
|
-
const getUserIdOrDefault = useCallback(() => {
|
|
56
|
-
const userIdOverride = getUserIdOverrideFromLocalStorage();
|
|
57
|
-
if (userIdOverride) {
|
|
58
|
-
return userIdOverride;
|
|
59
|
-
}
|
|
60
|
-
const defaultUserId = getUserIdDefaultFromLocalStorage();
|
|
61
|
-
if (defaultUserId) {
|
|
62
|
-
return defaultUserId;
|
|
63
|
-
}
|
|
64
|
-
return setUserIdDefaultInLocalStorage(`spiffy-user-id-${uuid()}`);
|
|
65
|
-
}, [
|
|
66
|
-
getUserIdOverrideFromLocalStorage,
|
|
67
|
-
getUserIdDefaultFromLocalStorage,
|
|
68
|
-
setUserIdDefaultInLocalStorage,
|
|
69
|
-
]);
|
|
70
|
-
const identifyUser = useCallback(async () => {
|
|
71
|
-
if (!isReady) {
|
|
72
|
-
Logger.logWarn('[UserIdentityContext] Context not ready, skipping identifyUser', undefined);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
try {
|
|
76
|
-
// Temporarily commented out until WindowDataLayerService is resolved
|
|
77
|
-
// const cdpUserId = WindowDataLayerService.getGoogleAnalyticsClientId();
|
|
78
|
-
const cdpUserId = 'UNKNOWN_CDP_USER_ID'; // Placeholder
|
|
79
|
-
const userId = getUserIdOrDefault();
|
|
80
|
-
const userAgentDetails = getUserAgentDetails();
|
|
81
|
-
if (!cdpUserId) {
|
|
82
|
-
Logger.logWarn('[spiffy-ai] No GA Client ID found, skipping identifyUser', undefined);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
await CommerceApiClient.identifyUser(userId, cdpUserId, userAgentDetails);
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
Logger.logError('[spiffy-ai] Error identifying user', error);
|
|
89
|
-
}
|
|
90
|
-
}, [isReady, getUserIdOrDefault]);
|
|
91
|
-
const value = useMemo(() => ({
|
|
92
|
-
identifyUser,
|
|
93
|
-
getUserIdOrDefault,
|
|
94
|
-
getUserIdOverrideFromLocalStorage,
|
|
95
|
-
getUserIdDefaultFromLocalStorage,
|
|
96
|
-
setUserIdDefaultInLocalStorage,
|
|
97
|
-
setUserIdOverrideInLocalStorage,
|
|
98
|
-
clearUserIdOverrideInLocalStorage,
|
|
99
|
-
isReady,
|
|
100
|
-
}), [
|
|
101
|
-
identifyUser,
|
|
102
|
-
getUserIdOrDefault,
|
|
103
|
-
getUserIdOverrideFromLocalStorage,
|
|
104
|
-
getUserIdDefaultFromLocalStorage,
|
|
105
|
-
setUserIdDefaultInLocalStorage,
|
|
106
|
-
setUserIdOverrideInLocalStorage,
|
|
107
|
-
clearUserIdOverrideInLocalStorage,
|
|
108
|
-
isReady,
|
|
109
|
-
]);
|
|
110
|
-
return _jsx(UserIdentityContext.Provider, { value: value, children: children });
|
|
111
|
-
};
|
|
112
|
-
export const useUserIdentity = () => {
|
|
113
|
-
const context = useContext(UserIdentityContext);
|
|
114
|
-
if (!context) {
|
|
115
|
-
throw new Error('useUserIdentity must be used within a UserIdentityProvider');
|
|
116
|
-
}
|
|
117
|
-
return context;
|
|
118
|
-
};
|
package/dist/src/events/index.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
/**
|
|
3
|
-
* A singleton class for dispatching Spiffy events to the document object.
|
|
4
|
-
* Provides functionality for adding default event data, managing listeners,
|
|
5
|
-
* and dispatching events.
|
|
6
|
-
*
|
|
7
|
-
* TODO: could add observability to the listeners, would need to track listeners
|
|
8
|
-
* internally.
|
|
9
|
-
*/
|
|
10
|
-
export class EventsDispatcher {
|
|
11
|
-
/**
|
|
12
|
-
* Adds event data to the eventData object, which is included by default for
|
|
13
|
-
* every event dispatched. E.g. could add in userId, variantInfo, etc. But
|
|
14
|
-
* make sure it is JSON serializable.
|
|
15
|
-
*/
|
|
16
|
-
static addEventData(data) {
|
|
17
|
-
this.eventData = { ...this.eventData, ...data };
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Dispatches an event with the given name and detail. If includeDefault is
|
|
21
|
-
* false, the default event data is excluded.
|
|
22
|
-
* @param eventName - the name of the event to dispatch, should be all caps
|
|
23
|
-
* and start with SPIFFY_, e.g. "SPIFFY_FLOATING_CONTAINER_CREATED"
|
|
24
|
-
* @param detail - optional parameter to include extra event data
|
|
25
|
-
* @param includeDefault - optional parameter to exclude the default event
|
|
26
|
-
* data
|
|
27
|
-
*/
|
|
28
|
-
static dispatch(eventName, detail, includeDefault) {
|
|
29
|
-
if (detail === undefined) {
|
|
30
|
-
detail = {};
|
|
31
|
-
}
|
|
32
|
-
if (includeDefault === undefined) {
|
|
33
|
-
includeDefault = true;
|
|
34
|
-
}
|
|
35
|
-
const eventData = includeDefault ? { ...this.eventData, ...detail } : detail;
|
|
36
|
-
const event = new CustomEvent(eventName, {
|
|
37
|
-
detail: eventData,
|
|
38
|
-
bubbles: true,
|
|
39
|
-
composed: true,
|
|
40
|
-
cancelable: false,
|
|
41
|
-
});
|
|
42
|
-
window.dispatchEvent(event);
|
|
43
|
-
}
|
|
44
|
-
static addListener(eventName, listener) {
|
|
45
|
-
window.addEventListener(eventName, listener, { once: false, passive: false, capture: false });
|
|
46
|
-
}
|
|
47
|
-
static removeListener(eventName, listener) {
|
|
48
|
-
window.removeEventListener(eventName, listener);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
EventsDispatcher.eventData = {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { getAtomStore } from 'src/atoms/atomStore/atomStore';
|
|
2
|
-
import { pageLoadOffsetTimeAtom, performanceMetricsAtom, resetPerformanceMetricsAtom, } from 'src/atoms/chat';
|
|
3
|
-
import { useAmplitudeTracking } from 'src/hooks/AmplitudeOperations/useAmplitudeOperations';
|
|
4
|
-
import { useEffect } from 'react';
|
|
5
|
-
import { SpiffyMetricsEventName } from '@envive-ai/types';
|
|
6
|
-
export const useRegisterAnalyticsListeners = () => {
|
|
7
|
-
const { track } = useAmplitudeTracking();
|
|
8
|
-
const atomStore = getAtomStore();
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const performanceMetrics = atomStore.get(performanceMetricsAtom);
|
|
11
|
-
const pageLoadOffsetTime = atomStore.get(pageLoadOffsetTimeAtom);
|
|
12
|
-
const handleVisibilityChange = () => {
|
|
13
|
-
if (document.visibilityState === 'hidden' && performanceMetrics.size > 0) {
|
|
14
|
-
const perfMetricsProperties = Object.fromEntries(Array.from(performanceMetrics.entries()).map(([key, value]) => [
|
|
15
|
-
`performanceMetrics.${key}`,
|
|
16
|
-
value,
|
|
17
|
-
]));
|
|
18
|
-
track(SpiffyMetricsEventName.PerformanceMetrics, {
|
|
19
|
-
...perfMetricsProperties,
|
|
20
|
-
'performance_metrics.page_load_offset_ms': pageLoadOffsetTime,
|
|
21
|
-
});
|
|
22
|
-
resetPerformanceMetricsAtom();
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
// do not use anything other than visibilitychange to detect when a page or
|
|
26
|
-
// session has ended as other events may not fire in all browsers/devices
|
|
27
|
-
window.addEventListener('visibilitychange', handleVisibilityChange);
|
|
28
|
-
return () => {
|
|
29
|
-
window.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
30
|
-
};
|
|
31
|
-
}, [track]);
|
|
32
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useAmplitudeOperations";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback } from 'react';
|
|
2
|
-
import { useAmplitude } from 'src/contexts/amplitudeContext/amplitudeContext';
|
|
3
|
-
export const useAmplitudeTracking = () => {
|
|
4
|
-
const { trackEvent, isReady } = useAmplitude();
|
|
5
|
-
const [loading, setLoading] = useState(false);
|
|
6
|
-
const [error, setError] = useState(null);
|
|
7
|
-
const track = useCallback(async (eventName, eventProps) => {
|
|
8
|
-
if (!isReady)
|
|
9
|
-
return;
|
|
10
|
-
setLoading(true);
|
|
11
|
-
setError(null);
|
|
12
|
-
try {
|
|
13
|
-
await trackEvent({ eventName, eventProps });
|
|
14
|
-
}
|
|
15
|
-
catch (err) {
|
|
16
|
-
setError(err instanceof Error ? err : new Error('Tracking failed'));
|
|
17
|
-
throw err;
|
|
18
|
-
}
|
|
19
|
-
finally {
|
|
20
|
-
setLoading(false);
|
|
21
|
-
}
|
|
22
|
-
}, [trackEvent, isReady]);
|
|
23
|
-
return { track, loading, error, isReady };
|
|
24
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useAppDetails";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useAtomValue } from 'jotai';
|
|
2
|
-
import { ContextEnvEnum, ContextSourceEnum } from '@spiffy-ai/commerce-api-client';
|
|
3
|
-
import { variantInfoAtom } from 'src/atoms/app/variant';
|
|
4
|
-
import { contextSourceAtom, envAtom as enviveEnvAtom, orgShortNameAtom as enviveOrgShortNameAtom, } from 'src/atoms/envive/enviveConfig';
|
|
5
|
-
import { chatIdAtom, userIdAtom } from 'src/atoms/app/index';
|
|
6
|
-
import { useOrgId } from 'src/hooks/GraphQLConfig/useGraphQLConfig';
|
|
7
|
-
export const useAppDetails = () => {
|
|
8
|
-
var _a, _b, _c;
|
|
9
|
-
const { orgId: fetchedOrgId } = useOrgId(); // Get orgId from useOrgId hook
|
|
10
|
-
const orgId = fetchedOrgId !== null && fetchedOrgId !== void 0 ? fetchedOrgId : ''; // Provide a default empty string if undefined
|
|
11
|
-
const orgShortName = (_a = useAtomValue(enviveOrgShortNameAtom)) !== null && _a !== void 0 ? _a : 'spiffy-ai';
|
|
12
|
-
const chatId = useAtomValue(chatIdAtom);
|
|
13
|
-
const userId = useAtomValue(userIdAtom);
|
|
14
|
-
const source = (_b = useAtomValue(contextSourceAtom)) !== null && _b !== void 0 ? _b : ContextSourceEnum.App;
|
|
15
|
-
const env = (_c = useAtomValue(enviveEnvAtom)) !== null && _c !== void 0 ? _c : ContextEnvEnum.Dev; // Cast to ContextEnvEnum
|
|
16
|
-
const variantInfo = useAtomValue(variantInfoAtom);
|
|
17
|
-
return {
|
|
18
|
-
orgId,
|
|
19
|
-
orgShortName,
|
|
20
|
-
chatId,
|
|
21
|
-
userId,
|
|
22
|
-
source,
|
|
23
|
-
env,
|
|
24
|
-
variantInfo,
|
|
25
|
-
};
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useBlockBackButton";
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
export const useBlockBackButton = (enabled, callback) => {
|
|
3
|
-
useEffect(() => {
|
|
4
|
-
if (enabled && window) {
|
|
5
|
-
if (window.history.scrollRestoration) {
|
|
6
|
-
window.history.scrollRestoration = "manual";
|
|
7
|
-
}
|
|
8
|
-
window.history.pushState(null, document.title, window.location.href);
|
|
9
|
-
window.onpopstate = (e) => {
|
|
10
|
-
e.preventDefault();
|
|
11
|
-
window.history.pushState(null, document.title, window.location.href);
|
|
12
|
-
callback === null || callback === void 0 ? void 0 : callback();
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
return () => {
|
|
16
|
-
if (enabled && window) {
|
|
17
|
-
window.history.back();
|
|
18
|
-
window.onpopstate = null;
|
|
19
|
-
window.history.scrollRestoration = "auto";
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}, [enabled]);
|
|
23
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useCdnOperations";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useCdn } from "../../contexts/cdnContext";
|
|
2
|
-
export const useCdnUrl = () => {
|
|
3
|
-
const { cdnUrl } = useCdn();
|
|
4
|
-
return cdnUrl;
|
|
5
|
-
};
|
|
6
|
-
export const useCdnBasePath = () => {
|
|
7
|
-
const { getCdnBasePath } = useCdn();
|
|
8
|
-
return getCdnBasePath();
|
|
9
|
-
};
|
|
10
|
-
export const useAssetUrl = (assetName, orgShortName) => {
|
|
11
|
-
const { getAssetURL } = useCdn();
|
|
12
|
-
return getAssetURL(assetName, orgShortName);
|
|
13
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useChatToggle";
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { SpiffyMetricsEventName } from '@envive-ai/types';
|
|
2
|
-
import { useAtomValue, useSetAtom } from 'jotai';
|
|
3
|
-
import { chatAtom, chatOnToggleAtom } from 'src/atoms/chat';
|
|
4
|
-
import { useAmplitude } from 'src/contexts/amplitudeContext/amplitudeContext';
|
|
5
|
-
export const useChatToggle = () => {
|
|
6
|
-
const onToggle = useSetAtom(chatOnToggleAtom);
|
|
7
|
-
const { isOpen } = useAtomValue(chatAtom);
|
|
8
|
-
const { trackEvent } = useAmplitude();
|
|
9
|
-
const toggle = (triggerLocation, triggerId) => {
|
|
10
|
-
if (!isOpen) {
|
|
11
|
-
trackEvent({
|
|
12
|
-
eventName: SpiffyMetricsEventName.ChatComponentExpanded,
|
|
13
|
-
eventProps: {
|
|
14
|
-
message_metadata: {
|
|
15
|
-
trigger_location: triggerLocation,
|
|
16
|
-
trigger_id: triggerId,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
trackEvent({
|
|
23
|
-
eventName: SpiffyMetricsEventName.ChatComponentCollapsed,
|
|
24
|
-
eventProps: {
|
|
25
|
-
message_metadata: {
|
|
26
|
-
trigger_location: triggerLocation,
|
|
27
|
-
trigger_id: triggerId,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
onToggle();
|
|
33
|
-
};
|
|
34
|
-
const openChat = (triggerLocation, triggerId) => {
|
|
35
|
-
if (!isOpen) {
|
|
36
|
-
toggle(triggerLocation, triggerId);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const closeChat = (triggerLocation, triggerId) => {
|
|
40
|
-
if (isOpen) {
|
|
41
|
-
toggle(triggerLocation, triggerId);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
return {
|
|
45
|
-
toggle,
|
|
46
|
-
isOpen,
|
|
47
|
-
openChat,
|
|
48
|
-
closeChat,
|
|
49
|
-
};
|
|
50
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useChatToggleAnalytics";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useSetAtom } from 'jotai';
|
|
2
|
-
import { chatOnToggleAtom } from 'src/atoms/chat/chatState';
|
|
3
|
-
import { useAmplitudeTracking } from '../AmplitudeOperations';
|
|
4
|
-
export const useChatToggleAnalytics = () => {
|
|
5
|
-
const setChatOnToggle = useSetAtom(chatOnToggleAtom);
|
|
6
|
-
const { track } = useAmplitudeTracking();
|
|
7
|
-
const toggleChat = (triggerLocation) => {
|
|
8
|
-
setChatOnToggle(triggerLocation, track);
|
|
9
|
-
};
|
|
10
|
-
return { toggleChat };
|
|
11
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useCustomerSupportHandoff";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import Logger from '../../application/logging/logger';
|
|
2
|
-
import { useCallback } from 'react';
|
|
3
|
-
/**
|
|
4
|
-
* Hook to call the `click` method of the merchant's customer support chat widget.
|
|
5
|
-
*
|
|
6
|
-
* @param onSwitchToAgent a function to override the function returned by the hook. This is mainly to
|
|
7
|
-
* preserve backward compatibility for merchants not using Kustomer and will be removed when all
|
|
8
|
-
* CS integrations are handled.
|
|
9
|
-
*
|
|
10
|
-
* @returns a function that searches for the customer support chat widget and calls the `click` method.
|
|
11
|
-
*/
|
|
12
|
-
export const useCustomerSupportHandoff = (onSwitchToAgent) => {
|
|
13
|
-
// TODO handle Gorgias
|
|
14
|
-
const onKustomerSwitch = useCallback(() => {
|
|
15
|
-
var _a, _b;
|
|
16
|
-
const kustomerElement = document.getElementById('kustomer-ui-sdk-iframe');
|
|
17
|
-
if (kustomerElement == null || !(kustomerElement instanceof HTMLIFrameElement)) {
|
|
18
|
-
Logger.logError('[spiffy-ai] Kustomer iFrame element not found', undefined);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const kustomerButton = (_b = (_a = kustomerElement.contentWindow) === null || _a === void 0 ? void 0 : _a.document) === null || _b === void 0 ? void 0 : _b.getElementById('rootChatIcon');
|
|
22
|
-
if (kustomerButton == null) {
|
|
23
|
-
Logger.logError('[spiffy-ai] Kustomer button not found', undefined);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
kustomerButton.click();
|
|
27
|
-
}, []);
|
|
28
|
-
if (onSwitchToAgent != null) {
|
|
29
|
-
return { onSwitch: onSwitchToAgent };
|
|
30
|
-
}
|
|
31
|
-
return { onSwitch: onKustomerSwitch };
|
|
32
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useDebounce";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
export function useDebounce(value, delay) {
|
|
3
|
-
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
const handler = setTimeout(() => {
|
|
6
|
-
setDebouncedValue(value);
|
|
7
|
-
}, delay);
|
|
8
|
-
return () => {
|
|
9
|
-
clearTimeout(handler);
|
|
10
|
-
};
|
|
11
|
-
}, [value, delay]);
|
|
12
|
-
return debouncedValue;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useElementObserver";
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { DOMObserver } from 'src/application/utils/domObserver';
|
|
3
|
-
/*
|
|
4
|
-
>>>>
|
|
5
|
-
<task_progress>
|
|
6
|
-
- [ ] Identify all exported types across the codebase.
|
|
7
|
-
- [x] Create individual type files in `/types` for each type.
|
|
8
|
-
- [x] Move `ElementObserverUtility` to `src/types/ElementObserverUtility.ts`.
|
|
9
|
-
- [ ] Update `src/hooks/ElementObserver/useElementObserver.ts` to import and use the new type.
|
|
10
|
-
- [ ] Update `/types/index.ts` by adding export for `./ElementObserverUtility`.
|
|
11
|
-
</task_progress>
|
|
12
|
-
* This hook enables the connection between a `MutationObserver` and a React.js component.
|
|
13
|
-
* It abstracts all the necessary validations and implementations to modify HTML elements,
|
|
14
|
-
* monitor their changes, and interact with them. The only required input is the element's selector.
|
|
15
|
-
*
|
|
16
|
-
* How to use it:
|
|
17
|
-
*
|
|
18
|
-
* Let's assume we want to interact with the following element:
|
|
19
|
-
* `<div id="awesome-content"><content /></div>`
|
|
20
|
-
*
|
|
21
|
-
* To hook into that element, simply do the following:
|
|
22
|
-
* `const element = useElementObserver(SelectorFactory.id("awesome-content"))`
|
|
23
|
-
*
|
|
24
|
-
* With the `ElementObserver` instance in hand, we can interact with the HTML element without having
|
|
25
|
-
* to manage its presence in the DOM. The `onAdd` and `onRemove` functions can be used to determine
|
|
26
|
-
* whether the element is present in the DOM or not, and to ensure interaction occurs only when necessary.
|
|
27
|
-
*
|
|
28
|
-
* @param selector
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
export const useElementObserver = (selector) => {
|
|
32
|
-
const INITIAL_RENDER_STATE = true;
|
|
33
|
-
const eoRef = useRef(DOMObserver.add(selector));
|
|
34
|
-
const [renderBlocked, setRenderBlocked] = useState(INITIAL_RENDER_STATE);
|
|
35
|
-
/**
|
|
36
|
-
* Fired every time the HTML element changes.
|
|
37
|
-
*
|
|
38
|
-
* @param fn
|
|
39
|
-
*/
|
|
40
|
-
const onChange = (fn) => {
|
|
41
|
-
var _a;
|
|
42
|
-
(_a = eoRef.current) === null || _a === void 0 ? void 0 : _a.registerOnChange(fn);
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Fired when the HTML element is added to the DOM.
|
|
46
|
-
*
|
|
47
|
-
* @param fn
|
|
48
|
-
*/
|
|
49
|
-
const onAdd = (fn) => {
|
|
50
|
-
var _a;
|
|
51
|
-
(_a = eoRef.current) === null || _a === void 0 ? void 0 : _a.registerOnAdd(fn);
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Fired when the HTML element is removed from the DOM.
|
|
55
|
-
*
|
|
56
|
-
* @param fn
|
|
57
|
-
*/
|
|
58
|
-
const onRemove = (fn) => {
|
|
59
|
-
var _a;
|
|
60
|
-
(_a = eoRef.current) === null || _a === void 0 ? void 0 : _a.registerOnRemove(fn);
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Fired when the class of the HTML element changes.
|
|
64
|
-
*
|
|
65
|
-
* @param fn
|
|
66
|
-
*/
|
|
67
|
-
const onClassChange = (fn) => {
|
|
68
|
-
var _a;
|
|
69
|
-
(_a = eoRef.current) === null || _a === void 0 ? void 0 : _a.registerOnclassChange(fn);
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Fired when a class is added to the HTML element.
|
|
73
|
-
*
|
|
74
|
-
* @param className
|
|
75
|
-
* @param fn
|
|
76
|
-
*/
|
|
77
|
-
const onClassAdded = (className, fn) => {
|
|
78
|
-
var _a;
|
|
79
|
-
(_a = eoRef.current) === null || _a === void 0 ? void 0 : _a.registerOnClassAdded(className, fn);
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* Fired when a class is removed from the HTML element.
|
|
83
|
-
*
|
|
84
|
-
* @param className
|
|
85
|
-
* @param fn
|
|
86
|
-
*/
|
|
87
|
-
const onClassRemoved = (className, fn) => {
|
|
88
|
-
var _a;
|
|
89
|
-
(_a = eoRef.current) === null || _a === void 0 ? void 0 : _a.registerOnClassRemoved(className, fn);
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Fired when a child element is added to the HTML element.
|
|
93
|
-
*
|
|
94
|
-
* @param fn
|
|
95
|
-
*/
|
|
96
|
-
const onAddChild = (fn) => {
|
|
97
|
-
var _a;
|
|
98
|
-
(_a = eoRef.current) === null || _a === void 0 ? void 0 : _a.registerOnAddChild(fn);
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Fired when a child element is removed from the HTML element.
|
|
102
|
-
*
|
|
103
|
-
* @param fn
|
|
104
|
-
*/
|
|
105
|
-
const onRemoveChild = (fn) => {
|
|
106
|
-
var _a;
|
|
107
|
-
(_a = eoRef.current) === null || _a === void 0 ? void 0 : _a.registerOnRemoveChild(fn);
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Allows hooking event listeners to the HTML element, such as `focus`, `blur`, etc.
|
|
111
|
-
*
|
|
112
|
-
* @param event
|
|
113
|
-
* @param fn
|
|
114
|
-
*/
|
|
115
|
-
const onEvent = (event, fn) => {
|
|
116
|
-
eoRef.current.registerEvent(event, fn);
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Useful when rendering a React.js component inside the HTML element.
|
|
120
|
-
*
|
|
121
|
-
* @param fn
|
|
122
|
-
* @returns
|
|
123
|
-
*/
|
|
124
|
-
const render = (fn) => !renderBlocked ? eoRef.current.render(fn) : undefined;
|
|
125
|
-
/**
|
|
126
|
-
* Checks if the element exists in the DOM.
|
|
127
|
-
*
|
|
128
|
-
* @returns
|
|
129
|
-
*/
|
|
130
|
-
const exists = () => !!eoRef.current.getNode();
|
|
131
|
-
/**
|
|
132
|
-
* Checks if rendering is unblocked.
|
|
133
|
-
*
|
|
134
|
-
* @returns
|
|
135
|
-
*/
|
|
136
|
-
const isRendered = () => !renderBlocked;
|
|
137
|
-
/**
|
|
138
|
-
* Triggers an event for the HTML element.
|
|
139
|
-
*
|
|
140
|
-
* @param event
|
|
141
|
-
*/
|
|
142
|
-
const fire = (event) => {
|
|
143
|
-
eoRef.current.fire(event);
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Shows the HTML element.
|
|
147
|
-
*
|
|
148
|
-
* @returns
|
|
149
|
-
*/
|
|
150
|
-
const show = () => eoRef.current.show();
|
|
151
|
-
/**
|
|
152
|
-
* Hides the HTML element.
|
|
153
|
-
*
|
|
154
|
-
* @returns
|
|
155
|
-
*/
|
|
156
|
-
const hide = () => eoRef.current.hide();
|
|
157
|
-
/**
|
|
158
|
-
* Blocks the rendering of elements.
|
|
159
|
-
*
|
|
160
|
-
* @returns
|
|
161
|
-
*/
|
|
162
|
-
const blockRendering = () => setRenderBlocked(true);
|
|
163
|
-
/**
|
|
164
|
-
* Unblocks the rendering of elements.
|
|
165
|
-
*
|
|
166
|
-
* @returns
|
|
167
|
-
*/
|
|
168
|
-
const unblockRendering = () => setRenderBlocked(false);
|
|
169
|
-
/**
|
|
170
|
-
* Applies CSS styles to the HTML element.
|
|
171
|
-
*
|
|
172
|
-
* @param styles
|
|
173
|
-
*/
|
|
174
|
-
const applyStyle = (styles) => {
|
|
175
|
-
var _a;
|
|
176
|
-
const node = (_a = eoRef === null || eoRef === void 0 ? void 0 : eoRef.current) === null || _a === void 0 ? void 0 : _a.getNode();
|
|
177
|
-
if (node) {
|
|
178
|
-
Object.assign(node.style, styles);
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
useEffect(() => {
|
|
182
|
-
eoRef.current.init();
|
|
183
|
-
eoRef.current.registerOnReset(() => setRenderBlocked(INITIAL_RENDER_STATE));
|
|
184
|
-
DOMObserver.observe();
|
|
185
|
-
return () => DOMObserver.remove(selector);
|
|
186
|
-
}, [selector.getPattern()]);
|
|
187
|
-
return {
|
|
188
|
-
targetNode: eoRef.current.getNode(),
|
|
189
|
-
onChange,
|
|
190
|
-
onAdd,
|
|
191
|
-
onRemove,
|
|
192
|
-
onClassChange,
|
|
193
|
-
onClassAdded,
|
|
194
|
-
onClassRemoved,
|
|
195
|
-
onAddChild,
|
|
196
|
-
onRemoveChild,
|
|
197
|
-
onEvent,
|
|
198
|
-
blockRendering,
|
|
199
|
-
unblockRendering,
|
|
200
|
-
exists,
|
|
201
|
-
isRendered,
|
|
202
|
-
render,
|
|
203
|
-
fire,
|
|
204
|
-
show,
|
|
205
|
-
hide,
|
|
206
|
-
applyStyle,
|
|
207
|
-
};
|
|
208
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useGrabAndScroll";
|