@envive-ai/react-hooks 0.2.6-alpha.12 → 0.2.6
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/{NewOrgConfig-BfbTlFg1.js → NewOrgConfig-BfrGpiGk.js} +2 -2
- package/dist/{NewOrgConfig-DJm6_abA.cjs → NewOrgConfig-BxSuoP9C.cjs} +2 -2
- package/dist/{SystemSettingsContext-BbTKNBvJ.js → SystemSettingsContext-B8X_Dvw2.js} +2 -2
- package/dist/{SystemSettingsContext-6ZHzQkCE.cjs → SystemSettingsContext-Bkoiobdv.cjs} +2 -2
- package/dist/{TrackComponentVisibleEvent-BRC2FTp-.cjs → TrackComponentVisibleEvent-DMuX-byo.cjs} +7 -7
- package/dist/{TrackComponentVisibleEvent-BJgNOypY.js → TrackComponentVisibleEvent-DwfGqNTx.js} +3 -3
- package/dist/{amplitudeContext-CZUzMXHl.d.ts → amplitudeContext-CiO9T9c-.d.ts} +1 -1
- package/dist/amplitudeContext-DOqL2Vn8.js +264 -0
- package/dist/amplitudeContext-ZTQMvVTV.cjs +286 -0
- package/dist/{api-DeW6rHj3.cjs → api-BvygKEiX.cjs} +3 -3
- package/dist/{api-BWSsazAG.js → api-bHEYmSiT.js} +3 -3
- package/dist/app-Aqkm_SlS.js +110 -0
- package/dist/app-BQw_-JGl.cjs +156 -0
- package/dist/application/models/graphql/index.cjs +2 -2
- package/dist/application/models/graphql/index.d.ts +1 -1
- package/dist/application/models/graphql/index.js +2 -2
- package/dist/application/models/guards/api/index.cjs +3 -3
- 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 +8 -8
- package/dist/application/models/index.d.cts +2 -2
- package/dist/application/models/index.d.ts +11 -11
- package/dist/application/models/index.js +8 -8
- package/dist/application/models/utilityTypes/index.d.ts +1 -1
- package/dist/application/models/variantInfo/index.d.ts +1 -1
- package/dist/application/utils/index.cjs +18 -16
- package/dist/application/utils/index.d.cts +4 -4
- package/dist/application/utils/index.d.ts +13 -13
- package/dist/application/utils/index.js +18 -16
- package/dist/{atomStore-DNji91Im.cjs → atomStore-CmZbgQHc.cjs} +1 -1
- package/dist/{atomStore-DXTVqiKc.js → atomStore-DEcDhiLp.js} +1 -1
- package/dist/atoms/app/index.cjs +17 -22
- package/dist/atoms/app/index.d.cts +2 -2
- package/dist/atoms/app/index.d.ts +19 -19
- package/dist/atoms/app/index.js +12 -17
- package/dist/atoms/atomStore/index.cjs +1 -1
- package/dist/atoms/atomStore/index.js +1 -1
- package/dist/atoms/chat/index.cjs +19 -18
- package/dist/atoms/chat/index.d.cts +28 -28
- package/dist/atoms/chat/index.d.ts +38 -38
- package/dist/atoms/chat/index.js +19 -18
- package/dist/atoms/globalSearch/index.cjs +1 -2
- package/dist/atoms/globalSearch/index.d.cts +5 -5
- package/dist/atoms/globalSearch/index.d.ts +6 -6
- package/dist/atoms/globalSearch/index.js +1 -2
- package/dist/atoms/org/index.cjs +8 -7
- package/dist/atoms/org/index.d.cts +19 -19
- package/dist/atoms/org/index.d.ts +29 -29
- package/dist/atoms/org/index.js +4 -3
- package/dist/atoms/search/index.cjs +26 -25
- package/dist/atoms/search/index.d.cts +3 -3
- package/dist/atoms/search/index.d.ts +13 -13
- package/dist/atoms/search/index.js +26 -25
- package/dist/atoms/search/types.cjs +1 -1
- package/dist/atoms/search/types.d.ts +1 -1
- package/dist/atoms/search/types.js +1 -1
- package/dist/atoms/search/utils.cjs +1 -1
- package/dist/atoms/search/utils.d.ts +1 -1
- package/dist/atoms/search/utils.js +1 -1
- package/dist/{cdnContext-DOSIofl8.cjs → cdnContext-Cd0Kvt6g.cjs} +2 -2
- package/dist/{cdnContext-CEGBVVBU.js → cdnContext-D8pHA9gh.js} +2 -2
- package/dist/{chat-DCGriB7h.cjs → chat-CJ9D8n7g.cjs} +1 -1
- package/dist/{chat-CqPuT9_V.cjs → chat-DwNALtox.cjs} +12 -11
- package/dist/{chat-ClvJ9xEj.js → chat-EJbfGWRr.js} +1 -1
- package/dist/{chat-DH70QqJp.js → chat-U1IgKNij.js} +9 -8
- package/dist/{chatElementDisplayLocation-CpgV2wR1.d.ts → chatElementDisplayLocation-DbmdwAff.d.ts} +1 -1
- package/dist/{chatSearch-C7Y-hb-6.js → chatSearch-Bb2SMr9X.js} +7 -7
- package/dist/{chatSearch-DLV4BUGA.cjs → chatSearch-DtE2cUQw.cjs} +7 -7
- package/dist/{chatState-CcFtSqJT.cjs → chatState-B3Dyrd9M.cjs} +5 -5
- package/dist/{chatState-DKnNHmwe.js → chatState-BXBN-12W.js} +3 -3
- package/dist/commerce-api-DXbnMNT8.js +311 -0
- package/dist/commerce-api-Dx02FCQ7.cjs +318 -0
- package/dist/{common-DQPvV_S_.cjs → common-CuwWqIJ1.cjs} +1 -1
- package/dist/{common-c_4eX0qn.js → common-Df2bwzd2.js} +1 -1
- package/dist/{components-DKwVHIjq.cjs → components-BCfFLf9X.cjs} +1 -1
- package/dist/{components-CDpaMUjK.js → components-QGCWJ26c.js} +1 -1
- package/dist/config/index.cjs +4 -4
- package/dist/config/index.d.ts +4 -4
- package/dist/config/index.js +4 -4
- package/dist/config/locators/components/chat/index.cjs +1 -1
- package/dist/config/locators/components/chat/index.d.ts +1 -1
- package/dist/config/locators/components/chat/index.js +1 -1
- package/dist/config/locators/components/common/index.cjs +1 -1
- package/dist/config/locators/components/common/index.d.ts +1 -1
- package/dist/config/locators/components/common/index.js +1 -1
- package/dist/config/locators/components/index.cjs +1 -1
- package/dist/config/locators/components/index.d.ts +1 -1
- package/dist/config/locators/components/index.js +1 -1
- package/dist/config/locators/components/search/index.d.ts +1 -1
- package/dist/config/locators/index.cjs +4 -4
- package/dist/config/locators/index.d.ts +4 -4
- package/dist/config/locators/index.js +4 -4
- package/dist/contexts/amplitudeContext/index.cjs +19 -19
- package/dist/contexts/amplitudeContext/index.d.ts +1 -1
- package/dist/contexts/amplitudeContext/index.js +16 -16
- package/dist/contexts/cdnContext/index.cjs +4 -4
- package/dist/contexts/cdnContext/index.js +4 -4
- package/dist/contexts/chatContext/index.cjs +42 -37
- package/dist/contexts/chatContext/index.d.cts +4 -4
- package/dist/contexts/chatContext/index.d.ts +4 -4
- package/dist/contexts/chatContext/index.js +32 -27
- package/dist/contexts/enviveConfigContext/index.cjs +4 -4
- package/dist/contexts/enviveConfigContext/index.d.cts +1 -1
- package/dist/contexts/enviveConfigContext/index.d.ts +3 -3
- package/dist/contexts/enviveConfigContext/index.js +4 -4
- package/dist/contexts/enviveCssContext/index.cjs +16 -16
- package/dist/contexts/enviveCssContext/index.js +16 -16
- package/dist/contexts/featureFlagContext/index.cjs +6 -6
- package/dist/contexts/featureFlagContext/index.d.cts +1 -1
- package/dist/contexts/featureFlagContext/index.d.ts +3 -3
- package/dist/contexts/featureFlagContext/index.js +6 -6
- package/dist/contexts/featureFlagServiceContext/index.cjs +3 -3
- package/dist/contexts/featureFlagServiceContext/index.d.cts +2 -2
- package/dist/contexts/featureFlagServiceContext/index.d.ts +4 -4
- package/dist/contexts/featureFlagServiceContext/index.js +3 -3
- package/dist/contexts/graphqlContext/index.cjs +11 -11
- package/dist/contexts/graphqlContext/index.d.cts +3 -3
- package/dist/contexts/graphqlContext/index.d.ts +13 -13
- package/dist/contexts/graphqlContext/index.js +11 -11
- package/dist/contexts/localStorageContext/index.cjs +2 -2
- package/dist/contexts/localStorageContext/index.js +2 -2
- package/dist/contexts/newOrgConfigContext/index.cjs +15 -15
- package/dist/contexts/newOrgConfigContext/index.d.cts +4 -4
- package/dist/contexts/newOrgConfigContext/index.d.ts +14 -14
- package/dist/contexts/newOrgConfigContext/index.js +15 -15
- package/dist/contexts/searchContext/index.cjs +19 -22
- package/dist/contexts/searchContext/index.d.ts +2 -2
- package/dist/contexts/searchContext/index.js +19 -22
- package/dist/contexts/sessionStorageContext/index.cjs +2 -2
- package/dist/contexts/sessionStorageContext/index.js +2 -2
- package/dist/contexts/shopifyUrlContext/index.cjs +2 -2
- package/dist/contexts/shopifyUrlContext/index.d.cts +1 -1
- package/dist/contexts/shopifyUrlContext/index.d.ts +3 -3
- package/dist/contexts/shopifyUrlContext/index.js +2 -2
- package/dist/contexts/systemSettingsContext/index.cjs +4 -4
- package/dist/contexts/systemSettingsContext/index.d.cts +6 -6
- package/dist/contexts/systemSettingsContext/index.d.ts +15 -15
- package/dist/contexts/systemSettingsContext/index.js +4 -4
- package/dist/contexts/types.cjs +1 -1
- package/dist/contexts/types.d.cts +1 -1
- package/dist/contexts/types.d.ts +3 -3
- package/dist/contexts/types.js +1 -1
- package/dist/contexts/userIdentityContext/index.cjs +24 -18
- package/dist/contexts/userIdentityContext/index.d.ts +1 -1
- package/dist/contexts/userIdentityContext/index.js +22 -16
- package/dist/{domObserver-Bqf3ooj8.cjs → domObserver-COKvTfZV.cjs} +1 -1
- package/dist/{domObserver-v9ODTyfT.js → domObserver-DEiUh0qg.js} +1 -1
- package/dist/{enviveConfig-Dv9-esGV.cjs → enviveConfig-B42OJ8bK.cjs} +3 -3
- package/dist/{enviveConfig-DZBohDpc.js → enviveConfig-BlIkxiAF.js} +3 -3
- package/dist/{enviveConfigContext-DrDjCems.js → enviveConfigContext-1_EivtCa.js} +3 -3
- package/dist/{enviveConfigContext-D2OELZDR.cjs → enviveConfigContext-Y1ahEAMe.cjs} +3 -3
- package/dist/{featureFlagServiceContext-V0J-69ty.d.ts → featureFlagServiceContext-C5U0bshi.d.ts} +2 -2
- package/dist/{featureFlagServiceContext-FBM6DdMJ.js → featureFlagServiceContext-CAPrb4e_.js} +3 -3
- package/dist/{featureFlagServiceContext-Be_LUbFf.d.cts → featureFlagServiceContext-CiKWV306.d.cts} +2 -2
- package/dist/{featureFlagServiceContext-CJyYItqu.cjs → featureFlagServiceContext-D3Ge8GH5.cjs} +3 -3
- package/dist/{featureGates-qU_ulhpC.cjs → featureGates-Bt_Y3kZ7.cjs} +1 -1
- package/dist/{featureGates-KEwAL8p_.js → featureGates-D4Me_IZH.js} +1 -1
- package/dist/frontendConfig-BiD1-j48.d.ts +856 -0
- package/dist/frontendConfig-tVg0hsWZ.d.cts +856 -0
- package/dist/{globalSearch-FBk2epe8.cjs → globalSearch-BOG3wmck.cjs} +1 -1
- package/dist/{globalSearch-Ccxq8hNF.js → globalSearch-BQEX-2Ml.js} +1 -1
- package/dist/{graphql-3PxNRFOc.js → graphql-OkhsP4ir.js} +2 -2
- package/dist/{graphql-DGYfelZp.cjs → graphql-l4dQrsA6.cjs} +2 -2
- package/dist/graphqlConfig-BnfE0ql5.cjs +39 -0
- package/dist/graphqlConfig-CZGjJ8hP.js +14 -0
- package/dist/{graphqlContext-D67VEQg3.d.cts → graphqlContext-Bf3E-V2T.d.cts} +2 -2
- package/dist/{graphqlContext-BQA6gnpH.d.ts → graphqlContext-CDeKzb46.d.ts} +3 -3
- package/dist/{graphqlContext-W0cZNBf1.cjs → graphqlContext-CpwAvnro.cjs} +5 -5
- package/dist/{graphqlContext-Ci5GRAdH.js → graphqlContext-dyWNSWNv.js} +5 -5
- package/dist/hooks/AmplitudeOperations/index.cjs +18 -18
- package/dist/hooks/AmplitudeOperations/index.d.ts +1 -1
- package/dist/hooks/AmplitudeOperations/index.js +18 -18
- package/dist/hooks/AppDetails/index.cjs +15 -20
- package/dist/hooks/AppDetails/index.d.cts +2 -2
- package/dist/hooks/AppDetails/index.d.ts +11 -11
- package/dist/hooks/AppDetails/index.js +15 -20
- package/dist/hooks/CdnOperations/index.cjs +4 -4
- package/dist/hooks/CdnOperations/index.js +4 -4
- package/dist/hooks/ChatToggle/index.cjs +23 -22
- package/dist/hooks/ChatToggle/index.d.ts +1 -1
- package/dist/hooks/ChatToggle/index.js +20 -19
- package/dist/hooks/ChatToggleAnalytics/index.cjs +19 -19
- package/dist/hooks/ChatToggleAnalytics/index.d.ts +1 -1
- 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/Debounce/index.cjs +1 -1
- package/dist/hooks/Debounce/index.js +1 -1
- package/dist/hooks/ElementObserver/index.cjs +1 -1
- package/dist/hooks/ElementObserver/index.d.ts +1 -1
- package/dist/hooks/ElementObserver/index.js +1 -1
- package/dist/hooks/GrabAndScroll/index.d.cts +2 -2
- package/dist/hooks/GraphQLConfig/index.cjs +12 -12
- package/dist/hooks/GraphQLConfig/index.d.cts +3 -3
- package/dist/hooks/GraphQLConfig/index.d.ts +12 -12
- package/dist/hooks/GraphQLConfig/index.js +12 -12
- package/dist/hooks/IdentifyUser/index.cjs +24 -18
- package/dist/hooks/IdentifyUser/index.js +23 -17
- package/dist/hooks/ImageResolver/index.cjs +10 -10
- package/dist/hooks/ImageResolver/index.js +10 -10
- package/dist/hooks/Intersection/index.cjs +1 -1
- package/dist/hooks/Intersection/index.js +1 -1
- package/dist/hooks/LocalStorageOperations/index.cjs +2 -2
- package/dist/hooks/LocalStorageOperations/index.js +2 -2
- package/dist/hooks/MessageFilter/index.cjs +8 -8
- package/dist/hooks/MessageFilter/index.d.cts +2 -2
- package/dist/hooks/MessageFilter/index.d.ts +11 -11
- package/dist/hooks/MessageFilter/index.js +8 -8
- package/dist/hooks/NewOrgConfig/index.cjs +16 -16
- package/dist/hooks/NewOrgConfig/index.d.cts +4 -4
- package/dist/hooks/NewOrgConfig/index.d.ts +14 -14
- package/dist/hooks/NewOrgConfig/index.js +16 -16
- package/dist/hooks/Search/index.cjs +46 -45
- package/dist/hooks/Search/index.d.cts +4 -4
- package/dist/hooks/Search/index.d.ts +15 -15
- package/dist/hooks/Search/index.js +38 -37
- package/dist/hooks/SearchOperations/index.cjs +20 -23
- package/dist/hooks/SearchOperations/index.d.ts +2 -2
- package/dist/hooks/SearchOperations/index.js +20 -23
- package/dist/hooks/SessionStorageOperations/index.cjs +2 -2
- package/dist/hooks/SessionStorageOperations/index.js +2 -2
- package/dist/hooks/ShopifyUrlOperations/index.cjs +2 -2
- package/dist/hooks/ShopifyUrlOperations/index.d.cts +3 -3
- package/dist/hooks/ShopifyUrlOperations/index.d.ts +5 -5
- package/dist/hooks/ShopifyUrlOperations/index.js +2 -2
- package/dist/hooks/SystemSettingsContext/index.cjs +5 -5
- package/dist/hooks/SystemSettingsContext/index.d.cts +4 -4
- package/dist/hooks/SystemSettingsContext/index.d.ts +13 -13
- package/dist/hooks/SystemSettingsContext/index.js +5 -5
- package/dist/hooks/TrackComponentVisibleEvent/index.cjs +18 -18
- package/dist/hooks/TrackComponentVisibleEvent/index.d.ts +2 -2
- package/dist/hooks/TrackComponentVisibleEvent/index.js +18 -18
- package/dist/hooks/UpdateAnalyticsProps/index.cjs +21 -21
- package/dist/hooks/UpdateAnalyticsProps/index.js +16 -16
- package/dist/hooks/utils.d.cts +3 -3
- package/dist/hooks/utils.d.ts +12 -12
- package/dist/{index-DazMsEy_.d.ts → index--uHjE7L8.d.ts} +1 -1
- package/dist/{index-BeYfyZ6k.d.ts → index-B6xpW8RG.d.ts} +1 -1
- package/dist/{index-DLURqmo8.d.cts → index-Bq39XSmY.d.cts} +31 -31
- package/dist/{index-O33GSSRr.d.cts → index-CG3P8xE1.d.cts} +2 -2
- package/dist/{index-CCa4tZuO.d.ts → index-Cx9e-fRi.d.ts} +2 -2
- package/dist/{index-bjMvkcBF.d.ts → index-D2VaMPA3.d.ts} +1 -1
- package/dist/{index-xHVrsrbz.d.ts → index-D31m6bPU.d.ts} +1 -1
- package/dist/{index-h809JLbL.d.ts → index-DSRs6N6J.d.ts} +1 -1
- package/dist/{index-Dfwnna1j.d.ts → index-Dxpscrvz.d.ts} +1 -1
- package/dist/{index-DJTrxIFJ.d.ts → index-VwfWqyR_.d.ts} +1 -1
- package/dist/{index-D4c-port.d.ts → index-fUsw_Mea.d.ts} +6 -6
- package/dist/{index-BlRatkrH.d.ts → index-wFHfdr6p.d.ts} +34 -34
- package/dist/interceptors/index.d.cts +2 -2
- package/dist/interceptors/index.d.ts +12 -12
- package/dist/interceptors/types.d.cts +2 -2
- package/dist/interceptors/types.d.ts +12 -12
- package/dist/{localStorageContext-NRP-CdmF.cjs → localStorageContext-C5giszHn.cjs} +2 -2
- package/dist/{localStorageContext-BPZ82q-G.js → localStorageContext-DAOJ4be4.js} +2 -2
- package/dist/{locators-BMQGmGLq.js → locators-C2fWd-74.js} +1 -1
- package/dist/{locators-DxYdak1F.cjs → locators-Cx3q6Z_h.cjs} +1 -1
- package/dist/{logger-TBIl4uIH.cjs → logger-0D_8Ip2L.cjs} +1 -1
- package/dist/{logger-W3lqg-4b.js → logger-Co0IA3k5.js} +1 -1
- package/dist/{models-D-4db7XW.cjs → models-CkJ-wg9Q.cjs} +5 -5
- package/dist/{models-c86hYW-F.js → models-UHOY0ak5.js} +5 -5
- package/dist/{newOrgConfigAtom-DxILMn2I.cjs → newOrgConfigAtom-CPA6Gp6n.cjs} +1 -1
- package/dist/{newOrgConfigAtom-sqve6LZU.js → newOrgConfigAtom-DEUj6H-p.js} +1 -1
- package/dist/{newOrgConfigContext-DQiuf8nd.js → newOrgConfigContext-6mlrvr1w.js} +5 -5
- package/dist/{newOrgConfigContext-Cl4H9c3q.cjs → newOrgConfigContext-BMvcqPzD.cjs} +5 -5
- package/dist/{newOrgConfigContext-CS8IA5Eg.d.ts → newOrgConfigContext-BVyJExeW.d.ts} +2 -2
- package/dist/{newOrgConfigContext-5Bw7RwT-.d.cts → newOrgConfigContext-DOdUxlOE.d.cts} +2 -2
- package/dist/{nodeSelector-BiCDowlK.d.ts → nodeSelector-DYhDUi7v.d.ts} +1 -1
- package/dist/{org-DlAesvQ_.cjs → org-B_cWn2bt.cjs} +1 -1
- package/dist/{org-vi0njpBh.js → org-h32_LSEb.js} +1 -1
- package/dist/orgAnalyticsConfig-Bm23fw4s.cjs +39 -0
- package/dist/orgAnalyticsConfig-CpBmga08.js +14 -0
- package/dist/{search-1NQLQD9d.d.ts → search-B1OtJe8Z.d.ts} +2 -2
- package/dist/{search-CXXslzAO.cjs → search-D-UfTjB7.cjs} +5 -5
- package/dist/{search-filter-types-DPgeG8FS.d.ts → search-filter-types-OI9zH3E_.d.ts} +1 -1
- package/dist/{search-DBSMrXWv.js → search-yawhMv22.js} +5 -5
- package/dist/{searchContext-DXW6xvXv.cjs → searchContext-CFuwIIW-.cjs} +9 -9
- package/dist/{searchContext-mvwUJncR.js → searchContext-CiqOqTJL.js} +7 -7
- package/dist/{searchServiceAdapter-DEv1tTn0.cjs → searchServiceAdapter-BGlvoZFE.cjs} +1 -1
- package/dist/{searchServiceAdapter-WyCU55NV.js → searchServiceAdapter-Db6jEcJs.js} +1 -1
- package/dist/{sessionStorageContext-1Ks_d4Z0.cjs → sessionStorageContext-BmCW091C.cjs} +2 -2
- package/dist/{sessionStorageContext-CDcl7NVl.js → sessionStorageContext-CNxkqJi1.js} +2 -2
- package/dist/{shopifyUrlContext-CejRZfj7.js → shopifyUrlContext-BXbI0PIG.js} +2 -2
- package/dist/{shopifyUrlContext-lnHoAOEf.cjs → shopifyUrlContext-aZMwCfbJ.cjs} +2 -2
- package/dist/{spiffyWidgets-B1uc84_g.d.ts → spiffyWidgets-CvEJIuJx.d.ts} +1 -1
- package/dist/{systemSettingsContext-B0Kyq7nA.cjs → systemSettingsContext-SozpUezn.cjs} +2 -2
- package/dist/{systemSettingsContext-CVUxEcsU.js → systemSettingsContext-kz6yyiFF.js} +2 -2
- package/dist/{test-types-y6kp-tiw.d.ts → test-types-DRhqHXw-.d.ts} +1 -1
- package/dist/types/index.cjs +1 -16
- package/dist/types/index.d.cts +1 -15
- package/dist/types/index.d.ts +3 -17
- package/dist/types/index.js +2 -16
- package/dist/{types-CxObxLKs.cjs → types-BuvXXGxE.cjs} +1 -1
- package/dist/types-BwNrLPSZ.cjs +106 -0
- package/dist/types-D3uOF0Oy.js +76 -0
- package/dist/{types-CS0Hrzja.js → types-DXnG1tV0.js} +1 -1
- package/dist/{types-BCz-hOvv.d.ts → types-DZPuBnHe.d.ts} +1 -1
- package/dist/{types-Db5Eux6K.d.ts → types-r0Z6CwyF.d.ts} +2 -2
- package/dist/types.d.cts +2 -21
- package/dist/types.d.ts +4 -23
- package/dist/unsupportedProductExceptions-B4f9aLjr.cjs +32 -0
- package/dist/unsupportedProductExceptions-DlmraJm8.js +20 -0
- package/dist/{urlsParser-DxjoLj98.js → urlsParser-DLCzibqU.js} +1 -1
- package/dist/{urlsParser-COzMdJaX.cjs → urlsParser-DhcEZLc_.cjs} +1 -1
- package/dist/{useAmplitudeOperations-jqa7K9dH.cjs → useAmplitudeOperations-D0nvIYlt.cjs} +3 -3
- package/dist/{useAmplitudeOperations-DYs1h8a_.js → useAmplitudeOperations-Dhks3PgF.js} +2 -2
- package/dist/{useAppDetails-C71k0brz.cjs → useAppDetails-B9sGmpJ3.cjs} +7 -7
- package/dist/{useAppDetails-BRUqZEyt.js → useAppDetails-qyaQIbWE.js} +4 -4
- package/dist/{useDebounce-DZ8Cgiwc.cjs → useDebounce-BZDtUAQ8.cjs} +1 -1
- package/dist/{useDebounce-v9cezyjn.js → useDebounce-ueblXZI-.js} +1 -1
- package/dist/{useGraphQLConfig-5VwS9Q_Z.js → useGraphQLConfig-BccQUaeW.js} +2 -2
- package/dist/{useGraphQLConfig-Cj26_J9I.cjs → useGraphQLConfig-CgKEfVYc.cjs} +2 -2
- package/dist/{useIntersection-Cncgxdmy.js → useIntersection-CZSEBUbv.js} +1 -1
- package/dist/{useIntersection-m4PEpvG7.cjs → useIntersection-DSDREfj6.cjs} +1 -1
- package/dist/{userIdentityContext-BVODeTlN.d.ts → userIdentityContext-BKLedN4R.d.ts} +1 -1
- package/dist/userIdentityContext-Cb6lLv6t.cjs +132 -0
- package/dist/userIdentityContext-O_DHHPTN.js +115 -0
- package/dist/{utils-Covisryh.d.ts → utils-B1v0iXs3.d.ts} +4 -4
- package/dist/{utils-BxPPugeP.d.cts → utils-B7PAzB_M.d.cts} +2 -2
- package/dist/{utils-DpneNSJf.d.ts → utils-BhyZiDrE.d.ts} +1 -1
- package/dist/{utils-DIvMgPe8.js → utils-C4ci_t0-.js} +1 -1
- package/dist/{utils-CDw74BCO.cjs → utils-C6imnLBo.cjs} +1 -1
- package/dist/utils-Cazq8Q3q.cjs +715 -0
- package/dist/{utils-2SWrJ12w.cjs → utils-CvLmSsUj.cjs} +1 -1
- package/dist/{utils-CqBxIpEV.js → utils-D82gfbgU.js} +1 -1
- package/dist/utils-DFPt3FSw.js +606 -0
- package/package.json +14 -13
- package/src/application/utils/__tests__/divideArrays.test.ts +12 -13
- package/src/atoms/app/index.ts +1 -2
- package/src/contexts/enviveConfigContext/__tests__/enviveConfigContext.test.tsx +411 -0
- package/src/contexts/types.ts +13 -14
- package/src/contexts/userIdentityContext/__tests__/userIdentityContext.test.tsx +663 -0
- package/src/contexts/userIdentityContext/userIdentityContext.tsx +6 -0
- package/src/hooks/Search/useSearch.tsx +2 -2
- package/src/types/index.ts +0 -1
- package/src/types.ts +0 -14
- package/dist/frontendConfig-CeWhVevA.d.ts +0 -857
- package/dist/frontendConfig-OWWJmuPc.d.cts +0 -857
- package/dist/globalSearch-B9DRBxSM.cjs +0 -0
- package/dist/globalSearch-BpGfkuXz.js +0 -1
- package/dist/graphqlConfig-GHZ1UgCw.cjs +0 -73
- package/dist/graphqlConfig-mDg6J44N.js +0 -24
- package/dist/hooks/FloatingButtonVisibility/index.cjs +0 -73
- package/dist/hooks/FloatingButtonVisibility/index.d.cts +0 -7
- package/dist/hooks/FloatingButtonVisibility/index.d.ts +0 -7
- package/dist/hooks/FloatingButtonVisibility/index.js +0 -69
- package/dist/hooks/LastInteraction/index.cjs +0 -34
- package/dist/hooks/LastInteraction/index.d.cts +0 -17
- package/dist/hooks/LastInteraction/index.d.ts +0 -17
- package/dist/hooks/LastInteraction/index.js +0 -32
- package/dist/types-CtUb63bt.js +0 -76
- package/dist/types-UUvB6h05.cjs +0 -106
- package/dist/utils-CLGXsOwE.cjs +0 -1591
- package/dist/utils-jYtD3hmA.js +0 -1385
- package/src/hooks/FloatingButtonVisibility/index.ts +0 -1
- package/src/hooks/FloatingButtonVisibility/useFloatingButtonVisibility.ts +0 -99
- package/src/hooks/LastInteraction/index.ts +0 -1
- package/src/hooks/LastInteraction/useLastInteraction.ts +0 -42
- package/src/types/floatingbuttonoverrides-types.ts +0 -10
- /package/dist/{AmplitudeOperations-ni7wVevx.js → AmplitudeOperations-ChZWcSsc.js} +0 -0
- /package/dist/{AmplitudeOperations-DxQnurSG.cjs → AmplitudeOperations-JggIc1zD.cjs} +0 -0
- /package/dist/{index-CgAfoNpB.d.ts → index-mHc9_XC3.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envive-ai/react-hooks",
|
|
3
|
-
"version": "0.2.6
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "React hooks for connecting to Envive AI services.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -31,7 +31,10 @@
|
|
|
31
31
|
"build:watch": "tsdown --watch",
|
|
32
32
|
"prepublish": "npm run build",
|
|
33
33
|
"typecheck": "tsc",
|
|
34
|
-
"prepare-version": "node scripts/prepare-version.js"
|
|
34
|
+
"prepare-version": "node scripts/prepare-version.js",
|
|
35
|
+
"test": "vitest",
|
|
36
|
+
"test:run": "vitest run",
|
|
37
|
+
"test:watch": "vitest --watch"
|
|
35
38
|
},
|
|
36
39
|
"dependencies": {
|
|
37
40
|
"@amplitude/analytics-browser": "^2.23.7",
|
|
@@ -43,16 +46,22 @@
|
|
|
43
46
|
"uuid": "^13.0.0"
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
49
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
50
|
+
"@testing-library/react": "^16.3.0",
|
|
51
|
+
"@testing-library/user-event": "^14.6.1",
|
|
46
52
|
"@types/jest": "^30.0.0",
|
|
47
53
|
"@types/node": "^20.11.30",
|
|
48
54
|
"@types/react": "^18.2.66",
|
|
49
55
|
"@types/react-dom": "^18.2.22",
|
|
50
56
|
"@types/ua-parser-js": "^0.7.39",
|
|
57
|
+
"@vitejs/plugin-react": "^5.1.0",
|
|
58
|
+
"jsdom": "^27.1.0",
|
|
59
|
+
"patch-package": "^8.0.1",
|
|
51
60
|
"tsdown": "^0.14.2",
|
|
52
|
-
"typescript": "~5.8.3"
|
|
61
|
+
"typescript": "~5.8.3",
|
|
62
|
+
"vitest": "^4.0.8"
|
|
53
63
|
},
|
|
54
64
|
"peerDependencies": {
|
|
55
|
-
"framer-motion": ">=12.23.24",
|
|
56
65
|
"react": "^18.3.1",
|
|
57
66
|
"react-dom": "^18.3.1"
|
|
58
67
|
},
|
|
@@ -250,10 +259,6 @@
|
|
|
250
259
|
"import": "./dist/hooks/ElementObserver/index.js",
|
|
251
260
|
"require": "./dist/hooks/ElementObserver/index.cjs"
|
|
252
261
|
},
|
|
253
|
-
"./hooks/FloatingButtonVisibility": {
|
|
254
|
-
"import": "./dist/hooks/FloatingButtonVisibility/index.js",
|
|
255
|
-
"require": "./dist/hooks/FloatingButtonVisibility/index.cjs"
|
|
256
|
-
},
|
|
257
262
|
"./hooks/GrabAndScroll": {
|
|
258
263
|
"import": "./dist/hooks/GrabAndScroll/index.js",
|
|
259
264
|
"require": "./dist/hooks/GrabAndScroll/index.cjs"
|
|
@@ -278,10 +283,6 @@
|
|
|
278
283
|
"import": "./dist/hooks/IsSmallScreen/index.js",
|
|
279
284
|
"require": "./dist/hooks/IsSmallScreen/index.cjs"
|
|
280
285
|
},
|
|
281
|
-
"./hooks/LastInteraction": {
|
|
282
|
-
"import": "./dist/hooks/LastInteraction/index.js",
|
|
283
|
-
"require": "./dist/hooks/LastInteraction/index.cjs"
|
|
284
|
-
},
|
|
285
286
|
"./hooks/LocalStorageOperations": {
|
|
286
287
|
"import": "./dist/hooks/LocalStorageOperations/index.js",
|
|
287
288
|
"require": "./dist/hooks/LocalStorageOperations/index.cjs"
|
|
@@ -445,4 +446,4 @@
|
|
|
445
446
|
"./package.json": "./package.json"
|
|
446
447
|
}
|
|
447
448
|
}
|
|
448
|
-
}
|
|
449
|
+
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
// import { divideArray } from '../divideArray';
|
|
1
|
+
import { divideArray } from '../divideArray';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
describe('divideArray', () => {
|
|
4
|
+
it('should divide an array into 3 rows', () => {
|
|
5
|
+
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
6
|
+
const rows = divideArray(array, 3);
|
|
7
|
+
expect(rows).toEqual([
|
|
8
|
+
[1, 4, 7, 10],
|
|
9
|
+
[2, 5, 8],
|
|
10
|
+
[3, 6, 9],
|
|
11
|
+
]);
|
|
12
|
+
});
|
|
13
|
+
});
|
package/src/atoms/app/index.ts
CHANGED
|
@@ -32,8 +32,7 @@ export const userIdAtom = atom(
|
|
|
32
32
|
return maybeUserId;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
return getUserIdOrDefault();
|
|
35
|
+
throw new Error('userIdAtom is not set. Ensure that all use of userIdAtom is under UserIdentityProvider');
|
|
37
36
|
},
|
|
38
37
|
(_, set, value: string | undefined) => {
|
|
39
38
|
set(internalUserIdAtom, value);
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render, screen, waitFor } from "@testing-library/react";
|
|
3
|
+
import { Provider } from "jotai";
|
|
4
|
+
import { useAtomValue } from "jotai";
|
|
5
|
+
import { EnviveConfigProvider, useEnviveConfig } from "../enviveConfigContext";
|
|
6
|
+
import { enviveConfigAtom } from "src/atoms/envive/enviveConfig";
|
|
7
|
+
import Logger from "src/application/logging/logger";
|
|
8
|
+
|
|
9
|
+
// Mock the Logger to avoid console output in tests
|
|
10
|
+
vi.spyOn(Logger, "logDebug").mockImplementation(() => {});
|
|
11
|
+
|
|
12
|
+
// Mock component that uses the useEnviveConfig hook
|
|
13
|
+
const MockComponent: React.FC = () => {
|
|
14
|
+
const config = useEnviveConfig();
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div data-testid="mock-component">
|
|
18
|
+
<div data-testid="amplitude-api-key">{config?.amplitudeApiKey || "not-set"}</div>
|
|
19
|
+
<div data-testid="base-url">{config?.baseUrl || "not-set"}</div>
|
|
20
|
+
<div data-testid="org-short-name">{config?.orgShortName || "not-set"}</div>
|
|
21
|
+
<div data-testid="identifying-prefix">{config?.identifyingPrefix || "not-set"}</div>
|
|
22
|
+
<div data-testid="env">{config?.env || "not-set"}</div>
|
|
23
|
+
<div data-testid="cdn-url">{config?.cdnUrl || "not-set"}</div>
|
|
24
|
+
<div data-testid="data-residency">{config?.dataResidency || "not-set"}</div>
|
|
25
|
+
<div data-testid="react-app-name">{config?.reactAppName || "not-set"}</div>
|
|
26
|
+
<div data-testid="context-source">{config?.contextSource || "not-set"}</div>
|
|
27
|
+
<div data-testid="org-level-api-key">{config?.orgLevelApiKey || "not-set"}</div>
|
|
28
|
+
<div data-testid="public-key">{config?.publicKey || "not-set"}</div>
|
|
29
|
+
<div data-testid="show">{config?.show?.toString() || "not-set"}</div>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Component that directly reads from the atom to verify it's set
|
|
35
|
+
const AtomReaderComponent: React.FC = () => {
|
|
36
|
+
const config = useAtomValue(enviveConfigAtom);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div data-testid="atom-reader">
|
|
40
|
+
<div data-testid="atom-amplitude-api-key">
|
|
41
|
+
{config?.amplitudeApiKey || "not-set"}
|
|
42
|
+
</div>
|
|
43
|
+
<div data-testid="atom-identifying-prefix">
|
|
44
|
+
{config?.identifyingPrefix || "not-set"}
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
describe("EnviveConfigProvider", () => {
|
|
51
|
+
beforeEach(() => {
|
|
52
|
+
vi.clearAllMocks();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe("Provider Integration with Jotai Store", () => {
|
|
56
|
+
it("should set the enviveConfigAtom when provider is mounted", async () => {
|
|
57
|
+
const testConfig = {
|
|
58
|
+
amplitudeApiKey: "test-amplitude-key",
|
|
59
|
+
baseUrl: "https://test-api.example.com",
|
|
60
|
+
orgShortName: "test-org",
|
|
61
|
+
identifyingPrefix: "test-prefix",
|
|
62
|
+
env: "test",
|
|
63
|
+
cdnUrl: "https://test-cdn.example.com",
|
|
64
|
+
dataResidency: "us",
|
|
65
|
+
reactAppName: "test-app",
|
|
66
|
+
contextSource: "test-source",
|
|
67
|
+
orgLevelApiKey: "test-org-key",
|
|
68
|
+
publicKey: "test-public-key",
|
|
69
|
+
show: true,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
render(
|
|
73
|
+
<Provider>
|
|
74
|
+
<EnviveConfigProvider
|
|
75
|
+
amplitudeApiKey={testConfig.amplitudeApiKey}
|
|
76
|
+
baseUrl={testConfig.baseUrl}
|
|
77
|
+
orgShortName={testConfig.orgShortName}
|
|
78
|
+
identifyingPrefix={testConfig.identifyingPrefix}
|
|
79
|
+
env={testConfig.env}
|
|
80
|
+
cdnUrl={testConfig.cdnUrl}
|
|
81
|
+
dataResidency={testConfig.dataResidency}
|
|
82
|
+
reactAppName={testConfig.reactAppName}
|
|
83
|
+
contextSource={testConfig.contextSource}
|
|
84
|
+
orgLevelApiKey={testConfig.orgLevelApiKey}
|
|
85
|
+
publicKey={testConfig.publicKey}
|
|
86
|
+
show={testConfig.show}
|
|
87
|
+
>
|
|
88
|
+
<AtomReaderComponent />
|
|
89
|
+
</EnviveConfigProvider>
|
|
90
|
+
</Provider>
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
// Wait for the atom to be set (useEffect runs after render)
|
|
94
|
+
await waitFor(() => {
|
|
95
|
+
expect(screen.getByTestId("atom-amplitude-api-key")).toHaveTextContent(
|
|
96
|
+
testConfig.amplitudeApiKey
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
expect(screen.getByTestId("atom-identifying-prefix")).toHaveTextContent(
|
|
101
|
+
testConfig.identifyingPrefix
|
|
102
|
+
);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it("should update the atom when provider props change", async () => {
|
|
106
|
+
const initialConfig = {
|
|
107
|
+
amplitudeApiKey: "initial-key",
|
|
108
|
+
identifyingPrefix: "initial-prefix",
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const { rerender } = render(
|
|
112
|
+
<Provider>
|
|
113
|
+
<EnviveConfigProvider
|
|
114
|
+
amplitudeApiKey={initialConfig.amplitudeApiKey}
|
|
115
|
+
identifyingPrefix={initialConfig.identifyingPrefix}
|
|
116
|
+
>
|
|
117
|
+
<AtomReaderComponent />
|
|
118
|
+
</EnviveConfigProvider>
|
|
119
|
+
</Provider>
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
await waitFor(() => {
|
|
123
|
+
expect(screen.getByTestId("atom-amplitude-api-key")).toHaveTextContent(
|
|
124
|
+
initialConfig.amplitudeApiKey
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const updatedConfig = {
|
|
129
|
+
amplitudeApiKey: "updated-key",
|
|
130
|
+
identifyingPrefix: "updated-prefix",
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
rerender(
|
|
134
|
+
<Provider>
|
|
135
|
+
<EnviveConfigProvider
|
|
136
|
+
amplitudeApiKey={updatedConfig.amplitudeApiKey}
|
|
137
|
+
identifyingPrefix={updatedConfig.identifyingPrefix}
|
|
138
|
+
>
|
|
139
|
+
<AtomReaderComponent />
|
|
140
|
+
</EnviveConfigProvider>
|
|
141
|
+
</Provider>
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
await waitFor(() => {
|
|
145
|
+
expect(screen.getByTestId("atom-amplitude-api-key")).toHaveTextContent(
|
|
146
|
+
updatedConfig.amplitudeApiKey
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
expect(screen.getByTestId("atom-identifying-prefix")).toHaveTextContent(
|
|
151
|
+
updatedConfig.identifyingPrefix
|
|
152
|
+
);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
describe("useEnviveConfig Hook Integration", () => {
|
|
157
|
+
it("should allow components to access config via useEnviveConfig hook", async () => {
|
|
158
|
+
const testConfig = {
|
|
159
|
+
amplitudeApiKey: "hook-test-key",
|
|
160
|
+
baseUrl: "https://hook-test-api.example.com",
|
|
161
|
+
orgShortName: "hook-test-org",
|
|
162
|
+
identifyingPrefix: "hook-prefix",
|
|
163
|
+
env: "production",
|
|
164
|
+
cdnUrl: "https://hook-test-cdn.example.com",
|
|
165
|
+
dataResidency: "eu",
|
|
166
|
+
reactAppName: "hook-test-app",
|
|
167
|
+
contextSource: "hook-source",
|
|
168
|
+
orgLevelApiKey: "hook-org-key",
|
|
169
|
+
publicKey: "hook-public-key",
|
|
170
|
+
show: false,
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
render(
|
|
174
|
+
<Provider>
|
|
175
|
+
<EnviveConfigProvider
|
|
176
|
+
amplitudeApiKey={testConfig.amplitudeApiKey}
|
|
177
|
+
baseUrl={testConfig.baseUrl}
|
|
178
|
+
orgShortName={testConfig.orgShortName}
|
|
179
|
+
identifyingPrefix={testConfig.identifyingPrefix}
|
|
180
|
+
env={testConfig.env}
|
|
181
|
+
cdnUrl={testConfig.cdnUrl}
|
|
182
|
+
dataResidency={testConfig.dataResidency}
|
|
183
|
+
reactAppName={testConfig.reactAppName}
|
|
184
|
+
contextSource={testConfig.contextSource}
|
|
185
|
+
orgLevelApiKey={testConfig.orgLevelApiKey}
|
|
186
|
+
publicKey={testConfig.publicKey}
|
|
187
|
+
show={testConfig.show}
|
|
188
|
+
>
|
|
189
|
+
<MockComponent />
|
|
190
|
+
</EnviveConfigProvider>
|
|
191
|
+
</Provider>
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
// Wait for the config to be available
|
|
195
|
+
await waitFor(() => {
|
|
196
|
+
expect(screen.getByTestId("amplitude-api-key")).toHaveTextContent(
|
|
197
|
+
testConfig.amplitudeApiKey
|
|
198
|
+
);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// Verify all config values are accessible via the hook
|
|
202
|
+
expect(screen.getByTestId("amplitude-api-key")).toHaveTextContent(
|
|
203
|
+
testConfig.amplitudeApiKey
|
|
204
|
+
);
|
|
205
|
+
expect(screen.getByTestId("base-url")).toHaveTextContent(
|
|
206
|
+
testConfig.baseUrl
|
|
207
|
+
);
|
|
208
|
+
expect(screen.getByTestId("org-short-name")).toHaveTextContent(
|
|
209
|
+
testConfig.orgShortName
|
|
210
|
+
);
|
|
211
|
+
expect(screen.getByTestId("identifying-prefix")).toHaveTextContent(
|
|
212
|
+
testConfig.identifyingPrefix
|
|
213
|
+
);
|
|
214
|
+
expect(screen.getByTestId("env")).toHaveTextContent(testConfig.env);
|
|
215
|
+
expect(screen.getByTestId("cdn-url")).toHaveTextContent(
|
|
216
|
+
testConfig.cdnUrl
|
|
217
|
+
);
|
|
218
|
+
expect(screen.getByTestId("data-residency")).toHaveTextContent(
|
|
219
|
+
testConfig.dataResidency
|
|
220
|
+
);
|
|
221
|
+
expect(screen.getByTestId("react-app-name")).toHaveTextContent(
|
|
222
|
+
testConfig.reactAppName
|
|
223
|
+
);
|
|
224
|
+
expect(screen.getByTestId("context-source")).toHaveTextContent(
|
|
225
|
+
testConfig.contextSource
|
|
226
|
+
);
|
|
227
|
+
expect(screen.getByTestId("org-level-api-key")).toHaveTextContent(
|
|
228
|
+
testConfig.orgLevelApiKey
|
|
229
|
+
);
|
|
230
|
+
expect(screen.getByTestId("public-key")).toHaveTextContent(
|
|
231
|
+
testConfig.publicKey
|
|
232
|
+
);
|
|
233
|
+
expect(screen.getByTestId("show")).toHaveTextContent(
|
|
234
|
+
testConfig.show.toString()
|
|
235
|
+
);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it("should return empty object when config is not set", () => {
|
|
239
|
+
// Component that uses the hook without provider
|
|
240
|
+
const UnwrappedComponent: React.FC = () => {
|
|
241
|
+
const config = useEnviveConfig();
|
|
242
|
+
return (
|
|
243
|
+
<div data-testid="unwrapped">
|
|
244
|
+
{config && Object.keys(config).length === 0 ? "empty" : "not-empty"}
|
|
245
|
+
</div>
|
|
246
|
+
);
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
render(
|
|
250
|
+
<Provider>
|
|
251
|
+
<UnwrappedComponent />
|
|
252
|
+
</Provider>
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
// The hook should return an empty object when config is not set
|
|
256
|
+
expect(screen.getByTestId("unwrapped")).toHaveTextContent("empty");
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it("should handle optional props correctly", async () => {
|
|
260
|
+
const minimalConfig = {
|
|
261
|
+
identifyingPrefix: "minimal-prefix",
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
render(
|
|
265
|
+
<Provider>
|
|
266
|
+
<EnviveConfigProvider identifyingPrefix={minimalConfig.identifyingPrefix}>
|
|
267
|
+
<MockComponent />
|
|
268
|
+
</EnviveConfigProvider>
|
|
269
|
+
</Provider>
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
await waitFor(() => {
|
|
273
|
+
expect(screen.getByTestId("identifying-prefix")).toHaveTextContent(
|
|
274
|
+
minimalConfig.identifyingPrefix
|
|
275
|
+
);
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// Optional props should show "not-set" when not provided
|
|
279
|
+
expect(screen.getByTestId("amplitude-api-key")).toHaveTextContent("not-set");
|
|
280
|
+
expect(screen.getByTestId("base-url")).toHaveTextContent("not-set");
|
|
281
|
+
expect(screen.getByTestId("org-short-name")).toHaveTextContent("not-set");
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
it("should handle featureOverrides and featureGates", async () => {
|
|
285
|
+
const featureOverrides = {
|
|
286
|
+
feature1: true,
|
|
287
|
+
feature2: false,
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
const featureGates = [
|
|
291
|
+
{
|
|
292
|
+
featureName: "testFeature",
|
|
293
|
+
enabled: true,
|
|
294
|
+
},
|
|
295
|
+
] as any[];
|
|
296
|
+
|
|
297
|
+
const FeatureConfigComponent: React.FC = () => {
|
|
298
|
+
const config = useEnviveConfig();
|
|
299
|
+
return (
|
|
300
|
+
<div data-testid="feature-config">
|
|
301
|
+
<div data-testid="feature-overrides">
|
|
302
|
+
{JSON.stringify(config?.featureOverrides || {})}
|
|
303
|
+
</div>
|
|
304
|
+
<div data-testid="feature-gates">
|
|
305
|
+
{JSON.stringify(config?.featureGates || [])}
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
);
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
render(
|
|
312
|
+
<Provider>
|
|
313
|
+
<EnviveConfigProvider
|
|
314
|
+
identifyingPrefix="test"
|
|
315
|
+
featureOverrides={featureOverrides}
|
|
316
|
+
featureGates={featureGates}
|
|
317
|
+
>
|
|
318
|
+
<FeatureConfigComponent />
|
|
319
|
+
</EnviveConfigProvider>
|
|
320
|
+
</Provider>
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
await waitFor(() => {
|
|
324
|
+
expect(screen.getByTestId("feature-overrides")).toHaveTextContent(
|
|
325
|
+
JSON.stringify(featureOverrides)
|
|
326
|
+
);
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
expect(screen.getByTestId("feature-gates")).toHaveTextContent(
|
|
330
|
+
JSON.stringify(featureGates)
|
|
331
|
+
);
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
describe("Provider Context Integration", () => {
|
|
336
|
+
it("should provide config through React Context", async () => {
|
|
337
|
+
const testConfig = {
|
|
338
|
+
identifyingPrefix: "context-prefix",
|
|
339
|
+
orgShortName: "context-org",
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
render(
|
|
343
|
+
<Provider>
|
|
344
|
+
<EnviveConfigProvider
|
|
345
|
+
identifyingPrefix={testConfig.identifyingPrefix}
|
|
346
|
+
orgShortName={testConfig.orgShortName}
|
|
347
|
+
>
|
|
348
|
+
<MockComponent />
|
|
349
|
+
</EnviveConfigProvider>
|
|
350
|
+
</Provider>
|
|
351
|
+
);
|
|
352
|
+
|
|
353
|
+
await waitFor(() => {
|
|
354
|
+
expect(screen.getByTestId("identifying-prefix")).toHaveTextContent(
|
|
355
|
+
testConfig.identifyingPrefix
|
|
356
|
+
);
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
expect(screen.getByTestId("org-short-name")).toHaveTextContent(
|
|
360
|
+
testConfig.orgShortName
|
|
361
|
+
);
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
it("should not render children when config is falsy", () => {
|
|
365
|
+
const TestChild: React.FC = () => <div data-testid="child">Child</div>;
|
|
366
|
+
|
|
367
|
+
// This shouldn't happen in practice, but testing the conditional render
|
|
368
|
+
const { container } = render(
|
|
369
|
+
<Provider>
|
|
370
|
+
<EnviveConfigProvider identifyingPrefix="" show={false}>
|
|
371
|
+
<TestChild />
|
|
372
|
+
</EnviveConfigProvider>
|
|
373
|
+
</Provider>
|
|
374
|
+
);
|
|
375
|
+
|
|
376
|
+
// Children should still render even if some props are falsy
|
|
377
|
+
// The condition `config ? children : null` checks if config object exists, not individual props
|
|
378
|
+
expect(screen.getByTestId("child")).toBeInTheDocument();
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
describe("Logger Integration", () => {
|
|
383
|
+
it("should log debug message when setting config", async () => {
|
|
384
|
+
const logSpy = vi.spyOn(Logger, "logDebug");
|
|
385
|
+
|
|
386
|
+
render(
|
|
387
|
+
<Provider>
|
|
388
|
+
<EnviveConfigProvider
|
|
389
|
+
identifyingPrefix="test"
|
|
390
|
+
amplitudeApiKey="test-key"
|
|
391
|
+
>
|
|
392
|
+
<div>Test</div>
|
|
393
|
+
</EnviveConfigProvider>
|
|
394
|
+
</Provider>
|
|
395
|
+
);
|
|
396
|
+
|
|
397
|
+
await waitFor(() => {
|
|
398
|
+
expect(logSpy).toHaveBeenCalledWith(
|
|
399
|
+
"EnviveConfigProvider: Setting EnviveConfig",
|
|
400
|
+
expect.objectContaining({
|
|
401
|
+
identifyingPrefix: "test",
|
|
402
|
+
amplitudeApiKey: "test-key",
|
|
403
|
+
})
|
|
404
|
+
);
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
logSpy.mockRestore();
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
|
package/src/contexts/types.ts
CHANGED
|
@@ -43,7 +43,6 @@ type FloatingEntryPointConfig = {
|
|
|
43
43
|
iconFillColor?: string;
|
|
44
44
|
height?: number;
|
|
45
45
|
fontSize?: number;
|
|
46
|
-
expandable?: boolean;
|
|
47
46
|
};
|
|
48
47
|
|
|
49
48
|
type WelcomeSectionVariant = "standard" | "outlined";
|
|
@@ -96,10 +95,10 @@ interface ChatPreviewFooterConfig {
|
|
|
96
95
|
suggestionButtonVariant?: "dark" | "light" | "outlined";
|
|
97
96
|
suggestionsBackground?: string; // used by: carbahn
|
|
98
97
|
replyButtonIcon?:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
| "send"
|
|
99
|
+
| "magnifyingGlass"
|
|
100
|
+
| "thinMagnifyingGlass"
|
|
101
|
+
| "searchIcon";
|
|
103
102
|
replyButtonText?: string;
|
|
104
103
|
replyInputHasShadow?: boolean; // used by: spanx
|
|
105
104
|
replyInputHasBorder?: boolean; // used by: spanx
|
|
@@ -790,30 +789,30 @@ interface BaseChatPreviewConfig {
|
|
|
790
789
|
// Specific chat preview widget configurations
|
|
791
790
|
interface ChatPreviewPostInteractionWidgetConfig
|
|
792
791
|
extends BaseWidgetConfig<WidgetType.ChatPreviewPostInteraction>,
|
|
793
|
-
|
|
792
|
+
BaseChatPreviewConfig {
|
|
794
793
|
chatPreviewVariant: ChatPreviewVariant;
|
|
795
794
|
addSeparators?: boolean;
|
|
796
795
|
}
|
|
797
796
|
|
|
798
797
|
interface ChatPreviewIsLoadingWidgetConfig
|
|
799
798
|
extends BaseWidgetConfig<WidgetType.ChatPreviewIsLoading>,
|
|
800
|
-
|
|
799
|
+
BaseChatPreviewConfig {}
|
|
801
800
|
|
|
802
801
|
interface ChatPreviewProductComparisonWidgetConfig
|
|
803
802
|
extends BaseWidgetConfig<WidgetType.ChatPreviewProductComparison>,
|
|
804
|
-
|
|
803
|
+
BaseChatPreviewConfig {
|
|
805
804
|
useLargeProductComparison?: boolean;
|
|
806
805
|
}
|
|
807
806
|
|
|
808
807
|
interface ChatPreviewV2WidgetConfig
|
|
809
808
|
extends BaseWidgetConfig<WidgetType.ChatPreviewV2>,
|
|
810
|
-
|
|
809
|
+
BaseChatPreviewConfig {
|
|
811
810
|
animatedTextConfig: ChatPreviewAnimatedTextConfig;
|
|
812
811
|
}
|
|
813
812
|
|
|
814
813
|
interface SocialProofV2WidgetConfig
|
|
815
814
|
extends BaseWidgetConfig<WidgetType.SocialProofV2>,
|
|
816
|
-
|
|
815
|
+
BaseChatPreviewConfig {
|
|
817
816
|
customerQuery?: string; // Default: 'asked which products are the best'
|
|
818
817
|
imageConfig: SocialProofImageConfig;
|
|
819
818
|
}
|
|
@@ -892,10 +891,10 @@ export interface UserQueryOptions {
|
|
|
892
891
|
footerVariant?: "standard";
|
|
893
892
|
replyButtonText?: string;
|
|
894
893
|
replyButtonIcon?:
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
894
|
+
| "magnifyingGlass"
|
|
895
|
+
| "send"
|
|
896
|
+
| "thinMagnifyingGlass"
|
|
897
|
+
| "ai-search";
|
|
899
898
|
}
|
|
900
899
|
|
|
901
900
|
type SearchPromptVariant = "primary";
|