@envive-ai/react-hooks 0.2.2 → 0.2.3
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/package.json +1 -1
- package/src/application/models/featureGates.ts +18 -20
- package/src/application/models/variantInfo/variantInfo.ts +9 -3
- package/src/atoms/app/index.ts +3 -2
- package/src/atoms/app/variant.ts +27 -89
- package/src/contexts/amplitudeContext/amplitudeContext.tsx +12 -45
- package/src/contexts/featureFlagServiceContext/featureFlagServiceContext.tsx +1 -1
- package/dist/AmplitudeOperations-CNyxbBY6.cjs +0 -0
- package/dist/AmplitudeOperations-Oa2efWtF.js +0 -1
- package/dist/NewOrgConfig-CbqBTHzG.js +0 -10
- package/dist/NewOrgConfig-sLsJcSn8.cjs +0 -15
- package/dist/SystemSettingsContext-BHi2YaQp.cjs +0 -20
- package/dist/SystemSettingsContext-BLRfTbCC.js +0 -13
- package/dist/TrackComponentVisibleEvent-CftWp8QR.js +0 -52
- package/dist/TrackComponentVisibleEvent-Dag8vFhb.cjs +0 -59
- package/dist/amplitudeContext-B73xamNe.d.cts +0 -52
- package/dist/amplitudeContext-BhhYPJSL.d.ts +0 -52
- package/dist/amplitudeContext-CwPtBPhg.js +0 -287
- package/dist/amplitudeContext-DTC6maR0.cjs +0 -309
- package/dist/api-Bc3_julZ.cjs +0 -239
- package/dist/api-D9gmGNAV.js +0 -166
- package/dist/app-CoQ1nC-j.js +0 -132
- package/dist/app-DN72spgQ.cjs +0 -178
- package/dist/application/models/graphql/index.cjs +0 -5
- package/dist/application/models/graphql/index.d.cts +0 -2
- package/dist/application/models/graphql/index.d.ts +0 -2
- package/dist/application/models/graphql/index.js +0 -4
- package/dist/application/models/guards/api/index.cjs +0 -16
- package/dist/application/models/guards/api/index.d.cts +0 -3
- package/dist/application/models/guards/api/index.d.ts +0 -3
- package/dist/application/models/guards/api/index.js +0 -5
- package/dist/application/models/guards/utils.cjs +0 -3
- package/dist/application/models/guards/utils.d.cts +0 -2
- package/dist/application/models/guards/utils.d.ts +0 -2
- package/dist/application/models/guards/utils.js +0 -3
- package/dist/application/models/index.cjs +0 -69
- package/dist/application/models/index.d.cts +0 -12
- package/dist/application/models/index.d.ts +0 -12
- package/dist/application/models/index.js +0 -12
- package/dist/application/models/utilityTypes/index.cjs +0 -1
- package/dist/application/models/utilityTypes/index.d.cts +0 -2
- package/dist/application/models/utilityTypes/index.d.ts +0 -2
- package/dist/application/models/utilityTypes/index.js +0 -3
- package/dist/application/models/variantInfo/index.cjs +0 -1
- package/dist/application/models/variantInfo/index.d.cts +0 -2
- package/dist/application/models/variantInfo/index.d.ts +0 -2
- package/dist/application/models/variantInfo/index.js +0 -3
- package/dist/application/utils/index.cjs +0 -48
- package/dist/application/utils/index.d.cts +0 -263
- package/dist/application/utils/index.d.ts +0 -263
- package/dist/application/utils/index.js +0 -22
- package/dist/atomStore-BuopbV9k.js +0 -32
- package/dist/atomStore-CZKe3itM.cjs +0 -58
- package/dist/atomStore-CdFkEC8s.cjs +0 -0
- package/dist/atomStore-DKlaDbMx.js +0 -1
- package/dist/atoms/app/index.cjs +0 -20
- package/dist/atoms/app/index.d.cts +0 -39
- package/dist/atoms/app/index.d.ts +0 -39
- package/dist/atoms/app/index.js +0 -16
- package/dist/atoms/atomStore/index.cjs +0 -7
- package/dist/atoms/atomStore/index.d.cts +0 -24
- package/dist/atoms/atomStore/index.d.ts +0 -24
- package/dist/atoms/atomStore/index.js +0 -4
- package/dist/atoms/chat/index.cjs +0 -52
- package/dist/atoms/chat/index.d.cts +0 -163
- package/dist/atoms/chat/index.d.ts +0 -163
- package/dist/atoms/chat/index.js +0 -23
- package/dist/atoms/globalSearch/index.cjs +0 -6
- package/dist/atoms/globalSearch/index.d.cts +0 -24
- package/dist/atoms/globalSearch/index.d.ts +0 -24
- package/dist/atoms/globalSearch/index.js +0 -3
- package/dist/atoms/org/index.cjs +0 -19
- package/dist/atoms/org/index.d.cts +0 -59
- package/dist/atoms/org/index.d.ts +0 -59
- package/dist/atoms/org/index.js +0 -6
- package/dist/atoms/search/index.cjs +0 -60
- package/dist/atoms/search/index.d.cts +0 -14
- package/dist/atoms/search/index.d.ts +0 -14
- package/dist/atoms/search/index.js +0 -30
- package/dist/atoms/search/types.cjs +0 -5
- package/dist/atoms/search/types.d.cts +0 -2
- package/dist/atoms/search/types.d.ts +0 -2
- package/dist/atoms/search/types.js +0 -3
- package/dist/atoms/search/utils.cjs +0 -3
- package/dist/atoms/search/utils.d.cts +0 -5
- package/dist/atoms/search/utils.d.ts +0 -5
- package/dist/atoms/search/utils.js +0 -3
- package/dist/cdnContext-ShKWLgKA.cjs +0 -53
- package/dist/cdnContext-pfrZ6lfu.js +0 -38
- package/dist/chat-BubCW1as.cjs +0 -152
- package/dist/chat-CV6MXeID.js +0 -26
- package/dist/chat-DQq8RR5E.js +0 -258
- package/dist/chat-KkJYXdfZ.cjs +0 -394
- package/dist/chatElementDisplayLocation-BwiXrkN7.d.ts +0 -25
- package/dist/chatElementDisplayLocation-DWmfNX_u.d.cts +0 -25
- package/dist/chatSearch-OgBQtu3u.cjs +0 -418
- package/dist/chatSearch-xO4HYEBI.js +0 -295
- package/dist/chatState-CTwPHEJG.cjs +0 -120
- package/dist/chatState-CkMgQSse.js +0 -34
- package/dist/chunk-CUT6urMc.cjs +0 -30
- package/dist/commerce-api-BVy49Qk8.js +0 -311
- package/dist/commerce-api-Pclc9ZBQ.cjs +0 -318
- package/dist/components-B4T3Uzth.js +0 -11
- package/dist/components-Cw9WjA6g.cjs +0 -29
- package/dist/config/locators/components/chat/index.cjs +0 -23
- package/dist/config/locators/components/chat/index.d.cts +0 -2
- package/dist/config/locators/components/chat/index.d.ts +0 -2
- package/dist/config/locators/components/chat/index.js +0 -3
- package/dist/config/locators/components/chat/variants/index.cjs +0 -29
- package/dist/config/locators/components/chat/variants/index.d.cts +0 -16
- package/dist/config/locators/components/chat/variants/index.d.ts +0 -16
- package/dist/config/locators/components/chat/variants/index.js +0 -17
- package/dist/config/locators/components/index.cjs +0 -5
- package/dist/config/locators/components/index.d.cts +0 -2
- package/dist/config/locators/components/index.d.ts +0 -2
- package/dist/config/locators/components/index.js +0 -3
- package/dist/config/locators/components/search/index.cjs +0 -13
- package/dist/config/locators/components/search/index.d.cts +0 -8
- package/dist/config/locators/components/search/index.d.ts +0 -8
- package/dist/config/locators/components/search/index.js +0 -9
- package/dist/config/locators/index.cjs +0 -67
- package/dist/config/locators/index.d.cts +0 -25
- package/dist/config/locators/index.d.ts +0 -25
- package/dist/config/locators/index.js +0 -26
- package/dist/contexts/amplitudeContext/index.cjs +0 -22
- package/dist/contexts/amplitudeContext/index.d.cts +0 -2
- package/dist/contexts/amplitudeContext/index.d.ts +0 -2
- package/dist/contexts/amplitudeContext/index.js +0 -20
- package/dist/contexts/cdnContext/index.cjs +0 -7
- package/dist/contexts/cdnContext/index.d.cts +0 -15
- package/dist/contexts/cdnContext/index.d.ts +0 -15
- package/dist/contexts/cdnContext/index.js +0 -6
- package/dist/contexts/chatContext/index.cjs +0 -331
- package/dist/contexts/chatContext/index.d.cts +0 -15
- package/dist/contexts/chatContext/index.d.ts +0 -15
- package/dist/contexts/chatContext/index.js +0 -324
- package/dist/contexts/enviveConfigContext/index.cjs +0 -7
- package/dist/contexts/enviveConfigContext/index.d.cts +0 -30
- package/dist/contexts/enviveConfigContext/index.d.ts +0 -30
- package/dist/contexts/enviveConfigContext/index.js +0 -6
- package/dist/contexts/enviveCssContext/index.cjs +0 -66
- package/dist/contexts/enviveCssContext/index.d.cts +0 -10
- package/dist/contexts/enviveCssContext/index.d.ts +0 -10
- package/dist/contexts/enviveCssContext/index.js +0 -63
- package/dist/contexts/featureFlagContext/index.cjs +0 -107
- package/dist/contexts/featureFlagContext/index.d.cts +0 -20
- package/dist/contexts/featureFlagContext/index.d.ts +0 -20
- package/dist/contexts/featureFlagContext/index.js +0 -103
- package/dist/contexts/featureFlagServiceContext/index.cjs +0 -6
- package/dist/contexts/featureFlagServiceContext/index.d.cts +0 -5
- package/dist/contexts/featureFlagServiceContext/index.d.ts +0 -5
- package/dist/contexts/featureFlagServiceContext/index.js +0 -5
- package/dist/contexts/graphqlContext/index.cjs +0 -16
- package/dist/contexts/graphqlContext/index.d.cts +0 -14
- package/dist/contexts/graphqlContext/index.d.ts +0 -14
- package/dist/contexts/graphqlContext/index.js +0 -15
- package/dist/contexts/localStorageContext/index.cjs +0 -6
- package/dist/contexts/localStorageContext/index.d.cts +0 -30
- package/dist/contexts/localStorageContext/index.d.ts +0 -30
- package/dist/contexts/localStorageContext/index.js +0 -4
- package/dist/contexts/newOrgConfigContext/index.cjs +0 -20
- package/dist/contexts/newOrgConfigContext/index.d.cts +0 -15
- package/dist/contexts/newOrgConfigContext/index.d.ts +0 -15
- package/dist/contexts/newOrgConfigContext/index.js +0 -19
- package/dist/contexts/searchContext/index.cjs +0 -24
- package/dist/contexts/searchContext/index.d.cts +0 -16
- package/dist/contexts/searchContext/index.d.ts +0 -16
- package/dist/contexts/searchContext/index.js +0 -23
- package/dist/contexts/sessionStorageContext/index.cjs +0 -5
- package/dist/contexts/sessionStorageContext/index.d.cts +0 -15
- package/dist/contexts/sessionStorageContext/index.d.ts +0 -15
- package/dist/contexts/sessionStorageContext/index.js +0 -4
- package/dist/contexts/shopifyUrlContext/index.cjs +0 -5
- package/dist/contexts/shopifyUrlContext/index.d.cts +0 -20
- package/dist/contexts/shopifyUrlContext/index.d.ts +0 -20
- package/dist/contexts/shopifyUrlContext/index.js +0 -4
- package/dist/contexts/systemSettingsContext/index.cjs +0 -8
- package/dist/contexts/systemSettingsContext/index.d.cts +0 -37
- package/dist/contexts/systemSettingsContext/index.d.ts +0 -37
- package/dist/contexts/systemSettingsContext/index.js +0 -6
- package/dist/contexts/types.cjs +0 -7
- package/dist/contexts/types.d.cts +0 -4
- package/dist/contexts/types.d.ts +0 -4
- package/dist/contexts/types.js +0 -3
- package/dist/contexts/userIdentityContext/index.cjs +0 -27
- package/dist/contexts/userIdentityContext/index.d.cts +0 -2
- package/dist/contexts/userIdentityContext/index.d.ts +0 -2
- package/dist/contexts/userIdentityContext/index.js +0 -26
- package/dist/domObserver-B19-69gW.js +0 -285
- package/dist/domObserver-CwieVNgj.cjs +0 -304
- package/dist/enviveConfig-BSfyz_pm.js +0 -62
- package/dist/enviveConfig-D8vcVPWD.cjs +0 -130
- package/dist/enviveConfigContext-C8cCcdKU.cjs +0 -60
- package/dist/enviveConfigContext-CJqpRSKu.js +0 -45
- package/dist/events/index.cjs +0 -4
- package/dist/events/index.d.cts +0 -46
- package/dist/events/index.d.ts +0 -46
- package/dist/events/index.js +0 -3
- package/dist/events-BHJJjPDN.js +0 -78
- package/dist/events-B_fJZf9E.cjs +0 -90
- package/dist/featureFlagServiceContext-CUBoBV2i.cjs +0 -56
- package/dist/featureFlagServiceContext-Cpw8omUr.d.ts +0 -23
- package/dist/featureFlagServiceContext-Cvn6fcdB.d.cts +0 -23
- package/dist/featureFlagServiceContext-Dg8okVk1.js +0 -42
- package/dist/featureGates-Blx10fwB.js +0 -27
- package/dist/featureGates-DcZNrUma.cjs +0 -33
- package/dist/frontendConfig-DnMZfvcA.d.cts +0 -857
- package/dist/frontendConfig-Dqxbqo8G.d.ts +0 -857
- package/dist/globalSearch-B8jHLScz.js +0 -14
- package/dist/globalSearch-JJI1Fijh.cjs +0 -39
- package/dist/graphql-B9HhDXYt.cjs +0 -53
- package/dist/graphql-W7GMIHUu.js +0 -36
- package/dist/graphqlConfig-BWqLgZ6v.cjs +0 -39
- package/dist/graphqlConfig-Dn-hO_SQ.js +0 -14
- package/dist/graphqlContext-8kw4aLRc.js +0 -96
- package/dist/graphqlContext-ChRuFVxO.d.cts +0 -28
- package/dist/graphqlContext-EhYZM1v_.d.ts +0 -28
- package/dist/graphqlContext-Fwc6Upvh.cjs +0 -111
- package/dist/hooks/AmplitudeOperations/index.cjs +0 -22
- package/dist/hooks/AmplitudeOperations/index.d.cts +0 -12
- package/dist/hooks/AmplitudeOperations/index.d.ts +0 -12
- package/dist/hooks/AmplitudeOperations/index.js +0 -22
- package/dist/hooks/AppDetails/index.cjs +0 -19
- package/dist/hooks/AppDetails/index.d.cts +0 -27
- package/dist/hooks/AppDetails/index.d.ts +0 -27
- package/dist/hooks/AppDetails/index.js +0 -19
- package/dist/hooks/BlockBackButton/index.cjs +0 -29
- package/dist/hooks/BlockBackButton/index.d.cts +0 -5
- package/dist/hooks/BlockBackButton/index.d.ts +0 -5
- package/dist/hooks/BlockBackButton/index.js +0 -27
- package/dist/hooks/CdnOperations/index.cjs +0 -24
- package/dist/hooks/CdnOperations/index.d.cts +0 -7
- package/dist/hooks/CdnOperations/index.d.ts +0 -7
- package/dist/hooks/CdnOperations/index.js +0 -22
- package/dist/hooks/ChatToggle/index.cjs +0 -64
- package/dist/hooks/ChatToggle/index.d.cts +0 -12
- package/dist/hooks/ChatToggle/index.d.ts +0 -12
- package/dist/hooks/ChatToggle/index.js +0 -62
- package/dist/hooks/ChatToggleAnalytics/index.cjs +0 -38
- package/dist/hooks/ChatToggleAnalytics/index.d.cts +0 -9
- package/dist/hooks/ChatToggleAnalytics/index.d.ts +0 -9
- package/dist/hooks/ChatToggleAnalytics/index.js +0 -36
- package/dist/hooks/CustomerSupportHandoff/index.cjs +0 -36
- package/dist/hooks/CustomerSupportHandoff/index.d.cts +0 -16
- package/dist/hooks/CustomerSupportHandoff/index.d.ts +0 -16
- package/dist/hooks/CustomerSupportHandoff/index.js +0 -34
- package/dist/hooks/Debounce/index.cjs +0 -3
- package/dist/hooks/Debounce/index.d.cts +0 -5
- package/dist/hooks/Debounce/index.d.ts +0 -5
- package/dist/hooks/Debounce/index.js +0 -3
- package/dist/hooks/ElementObserver/index.cjs +0 -179
- package/dist/hooks/ElementObserver/index.d.cts +0 -29
- package/dist/hooks/ElementObserver/index.d.ts +0 -29
- package/dist/hooks/ElementObserver/index.js +0 -177
- package/dist/hooks/GrabAndScroll/index.cjs +0 -99
- package/dist/hooks/GrabAndScroll/index.d.cts +0 -14
- package/dist/hooks/GrabAndScroll/index.d.ts +0 -14
- package/dist/hooks/GrabAndScroll/index.js +0 -97
- package/dist/hooks/GraphQLConfig/index.cjs +0 -17
- package/dist/hooks/GraphQLConfig/index.d.cts +0 -28
- package/dist/hooks/GraphQLConfig/index.d.ts +0 -28
- package/dist/hooks/GraphQLConfig/index.js +0 -16
- package/dist/hooks/IdentifyUser/index.cjs +0 -60
- package/dist/hooks/IdentifyUser/index.d.cts +0 -10
- package/dist/hooks/IdentifyUser/index.d.ts +0 -10
- package/dist/hooks/IdentifyUser/index.js +0 -58
- package/dist/hooks/ImageResolver/index.cjs +0 -55
- package/dist/hooks/ImageResolver/index.d.cts +0 -7
- package/dist/hooks/ImageResolver/index.d.ts +0 -7
- package/dist/hooks/ImageResolver/index.js +0 -53
- package/dist/hooks/Intersection/index.cjs +0 -3
- package/dist/hooks/Intersection/index.d.cts +0 -7
- package/dist/hooks/Intersection/index.d.ts +0 -7
- package/dist/hooks/Intersection/index.js +0 -3
- package/dist/hooks/IsSmallScreen/index.cjs +0 -22
- package/dist/hooks/IsSmallScreen/index.d.cts +0 -5
- package/dist/hooks/IsSmallScreen/index.d.ts +0 -5
- package/dist/hooks/IsSmallScreen/index.js +0 -20
- package/dist/hooks/LocalStorageOperations/index.cjs +0 -79
- package/dist/hooks/LocalStorageOperations/index.d.cts +0 -17
- package/dist/hooks/LocalStorageOperations/index.d.ts +0 -17
- package/dist/hooks/LocalStorageOperations/index.js +0 -74
- package/dist/hooks/MessageFilter/index.cjs +0 -54
- package/dist/hooks/MessageFilter/index.d.cts +0 -30
- package/dist/hooks/MessageFilter/index.d.ts +0 -30
- package/dist/hooks/MessageFilter/index.js +0 -54
- package/dist/hooks/MessageScrollObserver/index.cjs +0 -36
- package/dist/hooks/MessageScrollObserver/index.d.cts +0 -5
- package/dist/hooks/MessageScrollObserver/index.d.ts +0 -5
- package/dist/hooks/MessageScrollObserver/index.js +0 -34
- package/dist/hooks/NewOrgConfig/index.cjs +0 -20
- package/dist/hooks/NewOrgConfig/index.d.cts +0 -20
- package/dist/hooks/NewOrgConfig/index.d.ts +0 -20
- package/dist/hooks/NewOrgConfig/index.js +0 -20
- package/dist/hooks/Search/index.cjs +0 -326
- package/dist/hooks/Search/index.d.cts +0 -61
- package/dist/hooks/Search/index.d.ts +0 -61
- package/dist/hooks/Search/index.js +0 -323
- package/dist/hooks/SearchOperations/index.cjs +0 -102
- package/dist/hooks/SearchOperations/index.d.cts +0 -22
- package/dist/hooks/SearchOperations/index.d.ts +0 -22
- package/dist/hooks/SearchOperations/index.js +0 -99
- package/dist/hooks/SessionStorageOperations/index.cjs +0 -30
- package/dist/hooks/SessionStorageOperations/index.d.cts +0 -8
- package/dist/hooks/SessionStorageOperations/index.d.ts +0 -8
- package/dist/hooks/SessionStorageOperations/index.js +0 -28
- package/dist/hooks/ShopifyUrlOperations/index.cjs +0 -53
- package/dist/hooks/ShopifyUrlOperations/index.d.cts +0 -23
- package/dist/hooks/ShopifyUrlOperations/index.d.ts +0 -23
- package/dist/hooks/ShopifyUrlOperations/index.js +0 -49
- package/dist/hooks/SnapCalculator/index.cjs +0 -29
- package/dist/hooks/SnapCalculator/index.d.cts +0 -12
- package/dist/hooks/SnapCalculator/index.d.ts +0 -12
- package/dist/hooks/SnapCalculator/index.js +0 -27
- package/dist/hooks/SystemSettingsContext/index.cjs +0 -7
- package/dist/hooks/SystemSettingsContext/index.d.cts +0 -23
- package/dist/hooks/SystemSettingsContext/index.d.ts +0 -23
- package/dist/hooks/SystemSettingsContext/index.js +0 -7
- package/dist/hooks/TrackComponentVisibleEvent/index.cjs +0 -22
- package/dist/hooks/TrackComponentVisibleEvent/index.d.cts +0 -18
- package/dist/hooks/TrackComponentVisibleEvent/index.d.ts +0 -18
- package/dist/hooks/TrackComponentVisibleEvent/index.js +0 -22
- package/dist/hooks/UpdateAnalyticsProps/index.cjs +0 -62
- package/dist/hooks/UpdateAnalyticsProps/index.d.cts +0 -9
- package/dist/hooks/UpdateAnalyticsProps/index.d.ts +0 -9
- package/dist/hooks/UpdateAnalyticsProps/index.js +0 -59
- package/dist/hooks/utils.cjs +0 -8
- package/dist/hooks/utils.d.cts +0 -13
- package/dist/hooks/utils.d.ts +0 -13
- package/dist/hooks/utils.js +0 -3
- package/dist/index-B5qslMv7.d.cts +0 -186
- package/dist/index-BN-3ctk_.d.ts +0 -184
- package/dist/index-BPxqQmpF.d.ts +0 -1
- package/dist/index-Bmub8e38.d.cts +0 -98
- package/dist/index-BoYC9XLW.d.ts +0 -39
- package/dist/index-C12-NmS7.d.cts +0 -25
- package/dist/index-C4_vohah.d.ts +0 -186
- package/dist/index-C6KdON7d.d.ts +0 -25
- package/dist/index-CESxqFso.d.cts +0 -228
- package/dist/index-CK_J3QMY.d.ts +0 -676
- package/dist/index-CVa3DeXJ.d.cts +0 -9
- package/dist/index-C_MIfxF0.d.cts +0 -676
- package/dist/index-CiWEYzXl.d.cts +0 -184
- package/dist/index-DOii3C6b.d.ts +0 -9
- package/dist/index-Dr_c2DDq.d.ts +0 -98
- package/dist/index-DsiilEj-.d.ts +0 -228
- package/dist/index-RcVcRKH7.d.cts +0 -1
- package/dist/index-hdbCEjYy.d.cts +0 -39
- package/dist/interceptors/index.cjs +0 -4
- package/dist/interceptors/index.d.cts +0 -20
- package/dist/interceptors/index.d.ts +0 -20
- package/dist/interceptors/index.js +0 -4
- package/dist/interceptors/types.cjs +0 -1
- package/dist/interceptors/types.d.cts +0 -13
- package/dist/interceptors/types.d.ts +0 -13
- package/dist/interceptors/types.js +0 -3
- package/dist/localStorageContext-Dwgto93_.js +0 -95
- package/dist/localStorageContext-cnMYDllE.cjs +0 -115
- package/dist/logger-Cp7J4YJT.cjs +0 -26
- package/dist/logger-oAgZx2-m.js +0 -20
- package/dist/models-B1P-dSCW.cjs +0 -1537
- package/dist/models-CgvSM2fW.js +0 -1296
- package/dist/newOrgConfigAtom-DxILMn2I.cjs +0 -15
- package/dist/newOrgConfigAtom-sqve6LZU.js +0 -8
- package/dist/newOrgConfigContext-BzIpdpd6.js +0 -53
- package/dist/newOrgConfigContext-CiwteVzM.d.cts +0 -16
- package/dist/newOrgConfigContext-D9PpVqyW.d.ts +0 -16
- package/dist/newOrgConfigContext-wTQVvOaX.cjs +0 -68
- package/dist/nodeSelector-B3bPtEjX.d.cts +0 -31
- package/dist/nodeSelector-D5gjDWZ3.d.ts +0 -31
- package/dist/org-DlAesvQ_.cjs +0 -43
- package/dist/org-vi0njpBh.js +0 -12
- package/dist/orgAnalyticsConfig-BC4_sEmn.js +0 -14
- package/dist/orgAnalyticsConfig-DsGbyFhO.cjs +0 -39
- package/dist/search-0-pfy0cc.js +0 -126
- package/dist/search-BLShhjvR.d.ts +0 -20
- package/dist/search-BQn1pW2M.cjs +0 -205
- package/dist/search-filter-types-BBIjvwJV.d.cts +0 -102
- package/dist/search-filter-types-BlmWOnlA.d.ts +0 -102
- package/dist/search-y-ioX5Mz.d.cts +0 -20
- package/dist/searchContext-5qTU8CbH.js +0 -129
- package/dist/searchContext-DmXo2rpU.cjs +0 -145
- package/dist/searchServiceAdapter-DEv1tTn0.cjs +0 -34
- package/dist/searchServiceAdapter-WyCU55NV.js +0 -16
- package/dist/sessionStorageContext-B-UFXyJR.cjs +0 -66
- package/dist/sessionStorageContext-DnuKi3Gk.js +0 -52
- package/dist/shopifyUrlContext-Lm-Xcut2.cjs +0 -75
- package/dist/shopifyUrlContext-jLW63VLY.js +0 -61
- package/dist/spiffyWidgets-BuS00VaQ.d.cts +0 -20
- package/dist/spiffyWidgets-GILaqHv6.d.ts +0 -20
- package/dist/systemSettingsContext--LcXOVJz.js +0 -39
- package/dist/systemSettingsContext-CafaP6Zh.cjs +0 -60
- package/dist/test-types-EzMFw_U3.d.ts +0 -40
- package/dist/test-types-ThQiO_cc.d.cts +0 -40
- package/dist/types/index.cjs +0 -34
- package/dist/types/index.d.cts +0 -3
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.js +0 -31
- package/dist/types-6siNDmGv.d.ts +0 -10
- package/dist/types-BN2z0HcL.d.ts +0 -51
- package/dist/types-BwNrLPSZ.cjs +0 -106
- package/dist/types-CKMMb_gX.d.cts +0 -51
- package/dist/types-CS0Hrzja.js +0 -30
- package/dist/types-CxObxLKs.cjs +0 -48
- package/dist/types-D3uOF0Oy.js +0 -76
- package/dist/types-D4aa7_7x.d.cts +0 -10
- package/dist/types-DQoXDiso.js +0 -1
- package/dist/types-o3zWarRp.cjs +0 -0
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +0 -15
- package/dist/types.d.ts +0 -15
- package/dist/types.js +0 -1
- package/dist/unsupportedProductExceptions-CKiri_vO.cjs +0 -32
- package/dist/unsupportedProductExceptions-ClxlJ6cU.js +0 -20
- package/dist/urlsParser-BV5yF8sa.cjs +0 -78
- package/dist/urlsParser-DUgV_Qy9.js +0 -42
- package/dist/useAmplitudeOperations-aGOqxc4V.cjs +0 -41
- package/dist/useAmplitudeOperations-wQnkMaDm.js +0 -34
- package/dist/useAppDetails-9WXEc3mg.cjs +0 -38
- package/dist/useAppDetails-mNC2PBqH.js +0 -30
- package/dist/useDebounce-BaIp-A1W.cjs +0 -26
- package/dist/useDebounce-CxPj9WmE.js +0 -19
- package/dist/useGraphQLConfig-CTsRsKd2.js +0 -63
- package/dist/useGraphQLConfig-D7naV2RD.cjs +0 -76
- package/dist/useIntersection-B4J9UhaG.js +0 -21
- package/dist/useIntersection-DKWc5MY6.cjs +0 -28
- package/dist/useMessageInterceptor-C9p9No1n.cjs +0 -33
- package/dist/useMessageInterceptor-tntd2rvB.js +0 -25
- package/dist/userIdentityContext-BWzqWXPI.cjs +0 -125
- package/dist/userIdentityContext-BoNYqrTf.js +0 -109
- package/dist/userIdentityContext-D2oFVFzo.d.cts +0 -20
- package/dist/userIdentityContext-wYRpgkaJ.d.ts +0 -20
- package/dist/utilityTypes-DynzxjK3.js +0 -1
- package/dist/utilityTypes-xb8SjKSV.cjs +0 -0
- package/dist/utils-2SWrJ12w.cjs +0 -29
- package/dist/utils-ARmpTh1O.js +0 -27
- package/dist/utils-B1xLx9S8.d.ts +0 -15
- package/dist/utils-B3x_9JTY.d.cts +0 -15
- package/dist/utils-BSYichA7.d.cts +0 -22
- package/dist/utils-BgMcvG6l.js +0 -606
- package/dist/utils-C8vYQhLV.cjs +0 -130
- package/dist/utils-Cavu4XiM.cjs +0 -33
- package/dist/utils-CqBxIpEV.js +0 -23
- package/dist/utils-D_aOvxMg.cjs +0 -715
- package/dist/utils-FU_r-pTj.d.ts +0 -22
- package/dist/utils-_97oEqyL.js +0 -92
- package/dist/variantInfo-B7IwRpCg.cjs +0 -0
- package/dist/variantInfo-BtOYUGWa.js +0 -1
package/package.json
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
export enum FeatureGates {
|
|
2
|
-
IsClientSessionEnabled =
|
|
3
|
-
IsNewFeatureEnabled =
|
|
2
|
+
IsClientSessionEnabled = 'is_client_session_enabled',
|
|
3
|
+
IsNewFeatureEnabled = 'is_new_feature_enabled',
|
|
4
4
|
// IsFineTunedModel8b is defined here for the sole purpose of correlating events to a specific model in Amplitude
|
|
5
|
-
IsFineTunedModel8b =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
IsChatVariantBEnabled = "is_chat_variant_b_enabled",
|
|
22
|
-
IsUserQueryAlwaysEnabled = "is_user_query_always_enabled",
|
|
5
|
+
IsFineTunedModel8b = 'is_fine_tuned_model_8b',
|
|
6
|
+
IsImageBannerEnabled = 'is_image_banner_enabled',
|
|
7
|
+
IsOrderLookupEnabled = 'is_order_lookup_enabled',
|
|
8
|
+
IsSummarizeReviewsEnabled = 'is_summarize_reviews_enabled',
|
|
9
|
+
IsGlobalSearchEnabled = 'is_global_search_enabled',
|
|
10
|
+
IsImagePromptEnabled = 'is_image_prompt_enabled',
|
|
11
|
+
IsWatermarkEnabled = 'is_watermark_enabled',
|
|
12
|
+
IsInferenceRegion0 = 'is_inference_region_0',
|
|
13
|
+
IsChatVariantEnabled = 'is_chat_variant_enabled',
|
|
14
|
+
IsChatVariantAEnabled = 'is_chat_variant_a_enabled',
|
|
15
|
+
IsChatVariantBEnabled = 'is_chat_variant_b_enabled',
|
|
16
|
+
IsUserQueryAlwaysEnabled = 'is_user_query_always_enabled',
|
|
17
|
+
IsSearchAutocompleteEnabled = 'is_search_autocomplete_enabled',
|
|
18
|
+
IsEmptyDivPLPEnabled = 'is_empty_div_plp_enabled',
|
|
19
|
+
IsRecommendedProductsEnabled = 'is_recommended_products_enabled',
|
|
20
|
+
IsChatScrollPaused = 'is_chat_scroll_paused',
|
|
23
21
|
}
|
|
@@ -2,22 +2,28 @@ import { PLPInfo } from './plpInfo';
|
|
|
2
2
|
import { PageVisitInfo } from './pageVisitInfo';
|
|
3
3
|
import { ProductInfo } from './productInfo';
|
|
4
4
|
|
|
5
|
+
export enum VariantTypeEnum {
|
|
6
|
+
Pdp = 'pdp',
|
|
7
|
+
Plp = 'plp',
|
|
8
|
+
PageVisit = 'page_visit',
|
|
9
|
+
}
|
|
10
|
+
|
|
5
11
|
export type VariantType = 'pdp' | 'plp' | 'page_visit';
|
|
6
12
|
|
|
7
13
|
export type VariantInfo = PDPVariantInfo | PLPVariantInfo | PageVisitVariantInfo;
|
|
8
14
|
|
|
9
15
|
export type PDPVariantInfo = {
|
|
10
16
|
variantId: string;
|
|
11
|
-
variant:
|
|
17
|
+
variant: VariantTypeEnum.Pdp;
|
|
12
18
|
} & ProductInfo;
|
|
13
19
|
|
|
14
20
|
export type PLPVariantInfo = {
|
|
15
21
|
variantId: string;
|
|
16
|
-
variant:
|
|
22
|
+
variant: VariantTypeEnum.Plp;
|
|
17
23
|
url?: string;
|
|
18
24
|
} & PLPInfo;
|
|
19
25
|
|
|
20
26
|
export type PageVisitVariantInfo = {
|
|
21
27
|
variantId: string;
|
|
22
|
-
variant:
|
|
28
|
+
variant: VariantTypeEnum.PageVisit;
|
|
23
29
|
} & PageVisitInfo;
|
package/src/atoms/app/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import { atom } from "jotai";
|
|
6
6
|
import { atomWithStorage } from "jotai/utils";
|
|
7
7
|
import { VariantInfo } from "src/application/models";
|
|
8
|
-
import { UserIdentityContextType } from "src/contexts/userIdentityContext/userIdentityContext";
|
|
8
|
+
import { UserIdentityContextType, useUserIdentity } from "src/contexts/userIdentityContext/userIdentityContext";
|
|
9
9
|
import { variantInfoAtom } from "src/atoms/app/variant";
|
|
10
10
|
import { v4 as uuid } from "uuid";
|
|
11
11
|
import { contextSourceAtom } from "../envive/enviveConfig";
|
|
@@ -32,7 +32,8 @@ export const userIdAtom = atom(
|
|
|
32
32
|
return maybeUserId;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
const { getUserIdOrDefault } = useUserIdentity();
|
|
36
|
+
return getUserIdOrDefault();
|
|
36
37
|
},
|
|
37
38
|
(_, set, value: string | undefined) => {
|
|
38
39
|
set(internalUserIdAtom, value);
|
package/src/atoms/app/variant.ts
CHANGED
|
@@ -1,25 +1,19 @@
|
|
|
1
|
-
import { atomWithStorage } from
|
|
2
|
-
import { atom } from
|
|
3
|
-
import {
|
|
4
|
-
SupportedEventProductCategory,
|
|
5
|
-
SupportedEventResponse,
|
|
6
|
-
PageVisitCategory,
|
|
7
|
-
} from "@spiffy-ai/commerce-api-client";
|
|
1
|
+
import { atomWithStorage } from 'jotai/utils';
|
|
2
|
+
import { atom } from 'jotai';
|
|
3
|
+
import { SupportedEventResponse, PageVisitCategory } from '@spiffy-ai/commerce-api-client';
|
|
8
4
|
import {
|
|
9
5
|
PageVisitVariantInfo,
|
|
10
6
|
PDPVariantInfo,
|
|
11
7
|
PLPVariantInfo,
|
|
12
8
|
VariantInfo,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from
|
|
16
|
-
import { sessionStorageUtil } from "src/atoms/atomStore/atomStore";
|
|
17
|
-
import { enviveConfigAtom } from "src/atoms/envive/enviveConfig";
|
|
9
|
+
VariantTypeEnum,
|
|
10
|
+
} from 'src/application/models';
|
|
11
|
+
import { sessionStorageUtil } from 'src/atoms/atomStore';
|
|
18
12
|
|
|
19
13
|
export interface SupportedEvent
|
|
20
14
|
extends Pick<
|
|
21
15
|
SupportedEventResponse,
|
|
22
|
-
|
|
16
|
+
'supported' | 'ready' | 'category' | 'collections' | 'top_category'
|
|
23
17
|
> {
|
|
24
18
|
numberOfReviews: number | undefined;
|
|
25
19
|
merchant_tags?: string[];
|
|
@@ -92,10 +86,7 @@ export type BackendPageVariantConfig = {
|
|
|
92
86
|
|
|
93
87
|
export interface UrlResolverResponse {
|
|
94
88
|
variant_type: string;
|
|
95
|
-
specific_details:
|
|
96
|
-
| UrlResolvingPDPConfig
|
|
97
|
-
| UrlResolvingPLPConfig
|
|
98
|
-
| UrlResolvingGenericConfig;
|
|
89
|
+
specific_details: UrlResolvingPDPConfig | UrlResolvingPLPConfig | UrlResolvingGenericConfig;
|
|
99
90
|
ready: boolean;
|
|
100
91
|
user_event?: {
|
|
101
92
|
event_id?: string;
|
|
@@ -110,12 +101,12 @@ export interface UrlResolverResponse {
|
|
|
110
101
|
export type UrlResolverCache = Record<string, UrlResolverResponse | undefined>;
|
|
111
102
|
|
|
112
103
|
const internalStorageUrlResolverAtom = atomWithStorage<string | undefined>(
|
|
113
|
-
|
|
104
|
+
'spiffy-url-resolver',
|
|
114
105
|
undefined,
|
|
115
106
|
sessionStorageUtil,
|
|
116
107
|
{
|
|
117
108
|
getOnInit: true,
|
|
118
|
-
}
|
|
109
|
+
},
|
|
119
110
|
);
|
|
120
111
|
|
|
121
112
|
export const urlResolverAtom = atom(
|
|
@@ -126,37 +117,25 @@ export const urlResolverAtom = atom(
|
|
|
126
117
|
}
|
|
127
118
|
return JSON.parse(maybeUrlResolver);
|
|
128
119
|
},
|
|
129
|
-
(
|
|
130
|
-
get,
|
|
131
|
-
set,
|
|
132
|
-
value: { url: string; response: UrlResolverResponse | undefined }
|
|
133
|
-
) => {
|
|
120
|
+
(get, set, value: { url: string; response: UrlResolverResponse | undefined }) => {
|
|
134
121
|
// Get current cache from storage
|
|
135
122
|
const currentCache = get(urlResolverAtom);
|
|
136
123
|
const newCache = { ...currentCache, [value.url]: value.response };
|
|
137
124
|
|
|
138
125
|
set(internalStorageUrlResolverAtom, JSON.stringify(newCache));
|
|
139
|
-
}
|
|
126
|
+
},
|
|
140
127
|
);
|
|
141
128
|
|
|
142
129
|
const internalStorageSupportedEventAtom = atomWithStorage<string | undefined>(
|
|
143
|
-
|
|
130
|
+
'spiffy-supported-event',
|
|
144
131
|
undefined,
|
|
145
132
|
sessionStorageUtil,
|
|
146
133
|
{
|
|
147
134
|
getOnInit: true,
|
|
148
|
-
}
|
|
135
|
+
},
|
|
149
136
|
);
|
|
150
137
|
const internalSupportedEventAtom = atom<SupportedEvent | undefined>(undefined);
|
|
151
138
|
|
|
152
|
-
const featureFlagServiceAtom = atom((get) => {
|
|
153
|
-
const config = get(enviveConfigAtom);
|
|
154
|
-
const featureOverrides = config?.featureOverrides;
|
|
155
|
-
return {
|
|
156
|
-
isFeatureGateEnabled: (gate: string) => featureOverrides?.[gate] || false,
|
|
157
|
-
};
|
|
158
|
-
});
|
|
159
|
-
|
|
160
139
|
export const supportedEventAtom = atom(
|
|
161
140
|
(get): SupportedEvent | undefined => {
|
|
162
141
|
const maybeSupportedEvent = get(internalStorageSupportedEventAtom);
|
|
@@ -168,51 +147,16 @@ export const supportedEventAtom = atom(
|
|
|
168
147
|
// and perform the object validation on "get" there.
|
|
169
148
|
return JSON.parse(maybeSupportedEvent);
|
|
170
149
|
},
|
|
171
|
-
(
|
|
150
|
+
(_, set, value: SupportedEvent | undefined) => {
|
|
172
151
|
if (value == null) {
|
|
173
152
|
set(internalStorageSupportedEventAtom, undefined);
|
|
174
153
|
set(internalSupportedEventAtom, undefined);
|
|
175
154
|
return;
|
|
176
155
|
}
|
|
177
156
|
|
|
178
|
-
const featureFlagService = get(featureFlagServiceAtom);
|
|
179
|
-
const maybeSupportedEvent = get(internalSupportedEventAtom);
|
|
180
|
-
const variantCategory = maybeSupportedEvent?.category;
|
|
181
|
-
const config = get(enviveConfigAtom);
|
|
182
|
-
const orgShortName = config?.orgShortName;
|
|
183
|
-
|
|
184
|
-
// TODO: clean up this logic & the feature gate when we've fully rolled out
|
|
185
|
-
if (
|
|
186
|
-
featureFlagService &&
|
|
187
|
-
!featureFlagService.isFeatureGateEnabled(
|
|
188
|
-
FeatureGates.IsNonShapewearEnabled
|
|
189
|
-
) &&
|
|
190
|
-
variantCategory &&
|
|
191
|
-
variantCategory !== SupportedEventProductCategory.Shapewear &&
|
|
192
|
-
(orgShortName === OrgShortName.Spanx ||
|
|
193
|
-
orgShortName === OrgShortName.SpanxStaging)
|
|
194
|
-
) {
|
|
195
|
-
const modifiedSupportedEvent = {
|
|
196
|
-
supported: false,
|
|
197
|
-
ready: value.ready,
|
|
198
|
-
category: value.category,
|
|
199
|
-
numberOfReviews: value.numberOfReviews,
|
|
200
|
-
collections: value.collections,
|
|
201
|
-
top_category: value.top_category,
|
|
202
|
-
merchant_tags: value.merchant_tags,
|
|
203
|
-
};
|
|
204
|
-
set(internalSupportedEventAtom, modifiedSupportedEvent);
|
|
205
|
-
set(
|
|
206
|
-
internalStorageSupportedEventAtom,
|
|
207
|
-
JSON.stringify(modifiedSupportedEvent)
|
|
208
|
-
);
|
|
209
|
-
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
157
|
set(internalSupportedEventAtom, value);
|
|
214
158
|
set(internalStorageSupportedEventAtom, JSON.stringify(value));
|
|
215
|
-
}
|
|
159
|
+
},
|
|
216
160
|
);
|
|
217
161
|
|
|
218
162
|
const internalVariantIdAtom = atom<string>();
|
|
@@ -222,28 +166,22 @@ const internalProductUrlAtom = atom<string>();
|
|
|
222
166
|
const internalPlpIdAtom = atom<string>();
|
|
223
167
|
const internalUrlAtom = atom<string>();
|
|
224
168
|
const internalPageVisitCategoryAtom = atom<PageVisitCategory>();
|
|
225
|
-
const internalVariantAtom = atom<
|
|
226
|
-
"pdp"
|
|
227
|
-
);
|
|
169
|
+
const internalVariantAtom = atom<'pdp' | 'plp' | 'search' | 'page_visit'>('pdp');
|
|
228
170
|
|
|
229
171
|
export const variantIdAtom = atom((get) => get(internalVariantIdAtom));
|
|
230
172
|
export const productIdAtom = atom((get) => get(internalProductIdAtom));
|
|
231
|
-
export const parentProductIdAtom = atom((get) =>
|
|
232
|
-
get(internalParentProductIdAtom)
|
|
233
|
-
);
|
|
173
|
+
export const parentProductIdAtom = atom((get) => get(internalParentProductIdAtom));
|
|
234
174
|
export const productUrlAtom = atom((get) => get(internalProductUrlAtom));
|
|
235
175
|
export const plpIdAtom = atom((get) => get(internalPlpIdAtom));
|
|
236
176
|
export const urlAtom = atom((get) => get(internalUrlAtom));
|
|
237
|
-
export const pageVisitCategoryAtom = atom((get) =>
|
|
238
|
-
get(internalPageVisitCategoryAtom)
|
|
239
|
-
);
|
|
177
|
+
export const pageVisitCategoryAtom = atom((get) => get(internalPageVisitCategoryAtom));
|
|
240
178
|
export const variantAtom = atom((get) => get(internalVariantAtom));
|
|
241
179
|
export const hasParsedVariantInfoAtom = atom(false);
|
|
242
180
|
|
|
243
181
|
export const variantInfoAtom = atom(
|
|
244
182
|
(get): VariantInfo => {
|
|
245
183
|
const variant = get(variantAtom);
|
|
246
|
-
if (variant ===
|
|
184
|
+
if (variant === VariantTypeEnum.Pdp) {
|
|
247
185
|
return {
|
|
248
186
|
variantId: get(variantIdAtom),
|
|
249
187
|
variant,
|
|
@@ -252,7 +190,7 @@ export const variantInfoAtom = atom(
|
|
|
252
190
|
url: get(urlAtom),
|
|
253
191
|
} as PDPVariantInfo;
|
|
254
192
|
}
|
|
255
|
-
if (variant ===
|
|
193
|
+
if (variant === VariantTypeEnum.Plp) {
|
|
256
194
|
return {
|
|
257
195
|
variantId: get(variantIdAtom),
|
|
258
196
|
variant,
|
|
@@ -260,7 +198,7 @@ export const variantInfoAtom = atom(
|
|
|
260
198
|
url: get(urlAtom),
|
|
261
199
|
} as PLPVariantInfo;
|
|
262
200
|
}
|
|
263
|
-
if (variant ===
|
|
201
|
+
if (variant === VariantTypeEnum.PageVisit) {
|
|
264
202
|
return {
|
|
265
203
|
variantId: get(variantIdAtom),
|
|
266
204
|
variant,
|
|
@@ -268,23 +206,23 @@ export const variantInfoAtom = atom(
|
|
|
268
206
|
pageVisitCategory: get(pageVisitCategoryAtom),
|
|
269
207
|
} as PageVisitVariantInfo;
|
|
270
208
|
}
|
|
271
|
-
throw new Error(
|
|
209
|
+
throw new Error('Invalid variantInfo details');
|
|
272
210
|
},
|
|
273
211
|
(_, set, newVariant: VariantInfo) => {
|
|
274
212
|
set(internalVariantAtom, newVariant.variant);
|
|
275
213
|
set(internalVariantIdAtom, newVariant.variantId);
|
|
276
|
-
if (newVariant.variant ===
|
|
214
|
+
if (newVariant.variant === VariantTypeEnum.Pdp) {
|
|
277
215
|
set(internalProductIdAtom, newVariant.productId);
|
|
278
216
|
set(internalParentProductIdAtom, newVariant.parentProductId);
|
|
279
217
|
set(internalUrlAtom, newVariant.url);
|
|
280
218
|
}
|
|
281
|
-
if (newVariant.variant ===
|
|
219
|
+
if (newVariant.variant === VariantTypeEnum.Plp) {
|
|
282
220
|
set(internalPlpIdAtom, newVariant.plpId);
|
|
283
221
|
set(internalUrlAtom, newVariant.url);
|
|
284
222
|
}
|
|
285
|
-
if (newVariant.variant ===
|
|
223
|
+
if (newVariant.variant === VariantTypeEnum.PageVisit) {
|
|
286
224
|
set(internalUrlAtom, newVariant.url);
|
|
287
225
|
set(internalPageVisitCategoryAtom, newVariant.pageVisitCategory);
|
|
288
226
|
}
|
|
289
|
-
}
|
|
227
|
+
},
|
|
290
228
|
);
|
|
@@ -31,6 +31,10 @@ import type {
|
|
|
31
31
|
ServerZoneType,
|
|
32
32
|
} from "@amplitude/analytics-types";
|
|
33
33
|
import { useEnviveConfig } from "src/contexts/enviveConfigContext/enviveConfigContext";
|
|
34
|
+
import {
|
|
35
|
+
useFeatureFlagService,
|
|
36
|
+
} from "src/contexts/featureFlagServiceContext/featureFlagServiceContext";
|
|
37
|
+
import { useUserIdentity } from "src/contexts/userIdentityContext/userIdentityContext";
|
|
34
38
|
|
|
35
39
|
export enum SpiffyMetricsEventName {
|
|
36
40
|
BundleLoaded = "Bundle Loaded",
|
|
@@ -101,50 +105,7 @@ export const AmplitudeProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
101
105
|
featureGates,
|
|
102
106
|
} = useEnviveConfig();
|
|
103
107
|
|
|
104
|
-
const
|
|
105
|
-
const isFeatureGateEnabled = useCallback(
|
|
106
|
-
(gate: string) => {
|
|
107
|
-
const override = featureOverrides?.[gate];
|
|
108
|
-
if (override !== undefined) {
|
|
109
|
-
return override;
|
|
110
|
-
}
|
|
111
|
-
return (
|
|
112
|
-
featureGates?.some((fg) => fg.name === gate && fg.value) || false
|
|
113
|
-
);
|
|
114
|
-
},
|
|
115
|
-
[featureOverrides, featureGates]
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
const isClientSessionEnabled = useCallback(() => {
|
|
119
|
-
// Assuming this is a feature gate, or needs to be explicitly passed
|
|
120
|
-
return isFeatureGateEnabled(FeatureGates.IsClientSessionEnabled);
|
|
121
|
-
}, [isFeatureGateEnabled]);
|
|
122
|
-
|
|
123
|
-
const getFeatureFlags = useCallback(() => {
|
|
124
|
-
const flags: Record<string, boolean> = {};
|
|
125
|
-
if (featureOverrides) {
|
|
126
|
-
Object.entries(featureOverrides).forEach(([key, value]) => {
|
|
127
|
-
flags[key] = value;
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
if (featureGates) {
|
|
131
|
-
featureGates.forEach((fg) => {
|
|
132
|
-
if (fg.name) {
|
|
133
|
-
flags[fg.name] = Boolean(fg.value);
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
return flags;
|
|
138
|
-
}, [featureOverrides, featureGates]);
|
|
139
|
-
|
|
140
|
-
return {
|
|
141
|
-
isFeatureGateEnabled,
|
|
142
|
-
isClientSessionEnabled,
|
|
143
|
-
getFeatureFlags,
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
const featureFlagService = useFeatureFlagService();
|
|
108
|
+
const { featureFlagService } = useFeatureFlagService();
|
|
148
109
|
|
|
149
110
|
const [amplitudeClient, setAmplitudeClient] = React.useState<
|
|
150
111
|
BrowserClient | undefined
|
|
@@ -154,7 +115,9 @@ export const AmplitudeProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
154
115
|
const [supplementalDefaultProps, setSupplementalDefaultProps] =
|
|
155
116
|
React.useState<Record<string, unknown>>({});
|
|
156
117
|
|
|
157
|
-
const isReady = Boolean(
|
|
118
|
+
const isReady = Boolean(
|
|
119
|
+
userId && featureFlagService && amplitudeApiKey && userId
|
|
120
|
+
);
|
|
158
121
|
|
|
159
122
|
const getDefaultTrackingProps = useCallback((): Record<string, unknown> => {
|
|
160
123
|
const gatesProps = featureGates
|
|
@@ -372,6 +335,7 @@ export const AmplitudeProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
372
335
|
eventGroups,
|
|
373
336
|
alsoSendToGoogleAnalytics = false,
|
|
374
337
|
}: TrackEventParams): Promise<void> => {
|
|
338
|
+
Logger.logDebug("Submitting event", eventName);
|
|
375
339
|
try {
|
|
376
340
|
const decoratedEventName = `[Spiffy] ${eventName}`;
|
|
377
341
|
|
|
@@ -389,6 +353,8 @@ export const AmplitudeProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
389
353
|
});
|
|
390
354
|
const encoder = new TextEncoder();
|
|
391
355
|
const data = encoder.encode(eventData);
|
|
356
|
+
// calculate a hash of the event properties to use as the insert_id so that duplicate events
|
|
357
|
+
// are automatically dropped by Amplitude
|
|
392
358
|
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
|
|
393
359
|
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
394
360
|
const currentInsertId = hashArray
|
|
@@ -416,6 +382,7 @@ export const AmplitudeProvider: React.FC<{ children: React.ReactNode }> = ({
|
|
|
416
382
|
);
|
|
417
383
|
|
|
418
384
|
if (alsoSendToGoogleAnalytics && orgGaConfig) {
|
|
385
|
+
// TODO: Add in windowDataLayerService or context alternative and hook it up here
|
|
419
386
|
Logger.logDebug("[spiffy-ai] GA tracking", decoratedEventName);
|
|
420
387
|
if (window.dataLayer) {
|
|
421
388
|
(window.dataLayer as any[]).push({
|
|
@@ -4,7 +4,7 @@ import { FeatureGates } from "src/application/models/featureGates";
|
|
|
4
4
|
import Logger from "src/application/logging/logger";
|
|
5
5
|
|
|
6
6
|
// This is the class that was previously implicitly used or defined elsewhere
|
|
7
|
-
class FeatureFlagService {
|
|
7
|
+
export class FeatureFlagService {
|
|
8
8
|
private featureGates: OrgConfigFeatureGate[];
|
|
9
9
|
|
|
10
10
|
constructor(featureGates: OrgConfigFeatureGate[]) {
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useNewOrgConfigContext } from "./newOrgConfigContext-BzIpdpd6.js";
|
|
2
|
-
|
|
3
|
-
//#region src/hooks/NewOrgConfig/useNewOrgConfig.ts
|
|
4
|
-
const useNewOrgConfig = () => {
|
|
5
|
-
return useNewOrgConfigContext();
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
export { useNewOrgConfig };
|
|
10
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTmV3T3JnQ29uZmlnLUNicUJUSHpHLmpzIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbIi4uL3NyYy9ob29rcy9OZXdPcmdDb25maWcvdXNlTmV3T3JnQ29uZmlnLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHVzZU5ld09yZ0NvbmZpZ0NvbnRleHQgfSBmcm9tIFwic3JjL2NvbnRleHRzL25ld09yZ0NvbmZpZ0NvbnRleHQvbmV3T3JnQ29uZmlnQ29udGV4dFwiO1xuXG5leHBvcnQgY29uc3QgdXNlTmV3T3JnQ29uZmlnID0gKCkgPT4ge1xuICBjb25zdCBjb25maWcgPSB1c2VOZXdPcmdDb25maWdDb250ZXh0KCk7XG5cbiAgcmV0dXJuIGNvbmZpZztcbn07XG4iXSwibWFwcGluZ3MiOiI7OztBQUVBLE1BQWEsd0JBQXdCO0FBR25DLFFBRmUsd0JBQXdCIn0=
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const require_newOrgConfigContext = require('./newOrgConfigContext-wTQVvOaX.cjs');
|
|
2
|
-
|
|
3
|
-
//#region src/hooks/NewOrgConfig/useNewOrgConfig.ts
|
|
4
|
-
const useNewOrgConfig = () => {
|
|
5
|
-
return require_newOrgConfigContext.useNewOrgConfigContext();
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
//#endregion
|
|
9
|
-
Object.defineProperty(exports, 'useNewOrgConfig', {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () {
|
|
12
|
-
return useNewOrgConfig;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTmV3T3JnQ29uZmlnLXNMc0pjU244LmNqcyIsIm5hbWVzIjpbInVzZU5ld09yZ0NvbmZpZ0NvbnRleHQiXSwic291cmNlcyI6WyIuLi9zcmMvaG9va3MvTmV3T3JnQ29uZmlnL3VzZU5ld09yZ0NvbmZpZy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyB1c2VOZXdPcmdDb25maWdDb250ZXh0IH0gZnJvbSBcInNyYy9jb250ZXh0cy9uZXdPcmdDb25maWdDb250ZXh0L25ld09yZ0NvbmZpZ0NvbnRleHRcIjtcblxuZXhwb3J0IGNvbnN0IHVzZU5ld09yZ0NvbmZpZyA9ICgpID0+IHtcbiAgY29uc3QgY29uZmlnID0gdXNlTmV3T3JnQ29uZmlnQ29udGV4dCgpO1xuXG4gIHJldHVybiBjb25maWc7XG59O1xuIl0sIm1hcHBpbmdzIjoiOzs7QUFFQSxNQUFhLHdCQUF3QjtBQUduQyxRQUZlQSxvREFBd0IifQ==
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_systemSettingsContext = require('./systemSettingsContext-CafaP6Zh.cjs');
|
|
3
|
-
let react = require("react");
|
|
4
|
-
react = require_chunk.__toESM(react);
|
|
5
|
-
|
|
6
|
-
//#region src/hooks/SystemSettingsContext/useSystemSettingsContext.ts
|
|
7
|
-
const useSystemSettingsContext = () => {
|
|
8
|
-
const context = (0, react.useContext)(require_systemSettingsContext.SystemSettingsContext);
|
|
9
|
-
if (!context) throw new Error("useSystemSettingsContext must be used within a SystemSettingsContextProvider");
|
|
10
|
-
return { ...context };
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
//#endregion
|
|
14
|
-
Object.defineProperty(exports, 'useSystemSettingsContext', {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () {
|
|
17
|
-
return useSystemSettingsContext;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU3lzdGVtU2V0dGluZ3NDb250ZXh0LUJIaTJZYVFwLmNqcyIsIm5hbWVzIjpbIlN5c3RlbVNldHRpbmdzQ29udGV4dCJdLCJzb3VyY2VzIjpbIi4uL3NyYy9ob29rcy9TeXN0ZW1TZXR0aW5nc0NvbnRleHQvdXNlU3lzdGVtU2V0dGluZ3NDb250ZXh0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHVzZUNvbnRleHQgfSBmcm9tIFwicmVhY3RcIjtcbmltcG9ydCB7IFN5c3RlbVNldHRpbmdzQ29udGV4dCB9IGZyb20gXCJzcmMvY29udGV4dHMvc3lzdGVtU2V0dGluZ3NDb250ZXh0XCI7XG5cbmV4cG9ydCBjb25zdCB1c2VTeXN0ZW1TZXR0aW5nc0NvbnRleHQgPSAoKSA9PiB7XG4gIGNvbnN0IGNvbnRleHQgPSB1c2VDb250ZXh0KFN5c3RlbVNldHRpbmdzQ29udGV4dCk7XG5cbiAgaWYgKCFjb250ZXh0KSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKFxuICAgICAgXCJ1c2VTeXN0ZW1TZXR0aW5nc0NvbnRleHQgbXVzdCBiZSB1c2VkIHdpdGhpbiBhIFN5c3RlbVNldHRpbmdzQ29udGV4dFByb3ZpZGVyXCJcbiAgICApO1xuICB9XG5cbiAgcmV0dXJuIHsgLi4uY29udGV4dCB9O1xufTtcbiJdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBR0EsTUFBYSxpQ0FBaUM7Q0FDNUMsTUFBTSxnQ0FBcUJBLG9EQUFzQjtBQUVqRCxLQUFJLENBQUMsUUFDSCxPQUFNLElBQUksTUFDUiwrRUFDRDtBQUdILFFBQU8sRUFBRSxHQUFHLFNBQVMifQ==
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SystemSettingsContext } from "./systemSettingsContext--LcXOVJz.js";
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
|
|
4
|
-
//#region src/hooks/SystemSettingsContext/useSystemSettingsContext.ts
|
|
5
|
-
const useSystemSettingsContext = () => {
|
|
6
|
-
const context = useContext(SystemSettingsContext);
|
|
7
|
-
if (!context) throw new Error("useSystemSettingsContext must be used within a SystemSettingsContextProvider");
|
|
8
|
-
return { ...context };
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
export { useSystemSettingsContext };
|
|
13
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU3lzdGVtU2V0dGluZ3NDb250ZXh0LUJMUmZUYkNDLmpzIiwibmFtZXMiOltdLCJzb3VyY2VzIjpbIi4uL3NyYy9ob29rcy9TeXN0ZW1TZXR0aW5nc0NvbnRleHQvdXNlU3lzdGVtU2V0dGluZ3NDb250ZXh0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHVzZUNvbnRleHQgfSBmcm9tIFwicmVhY3RcIjtcbmltcG9ydCB7IFN5c3RlbVNldHRpbmdzQ29udGV4dCB9IGZyb20gXCJzcmMvY29udGV4dHMvc3lzdGVtU2V0dGluZ3NDb250ZXh0XCI7XG5cbmV4cG9ydCBjb25zdCB1c2VTeXN0ZW1TZXR0aW5nc0NvbnRleHQgPSAoKSA9PiB7XG4gIGNvbnN0IGNvbnRleHQgPSB1c2VDb250ZXh0KFN5c3RlbVNldHRpbmdzQ29udGV4dCk7XG5cbiAgaWYgKCFjb250ZXh0KSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKFxuICAgICAgXCJ1c2VTeXN0ZW1TZXR0aW5nc0NvbnRleHQgbXVzdCBiZSB1c2VkIHdpdGhpbiBhIFN5c3RlbVNldHRpbmdzQ29udGV4dFByb3ZpZGVyXCJcbiAgICApO1xuICB9XG5cbiAgcmV0dXJuIHsgLi4uY29udGV4dCB9O1xufTtcbiJdLCJtYXBwaW5ncyI6Ijs7OztBQUdBLE1BQWEsaUNBQWlDO0NBQzVDLE1BQU0sVUFBVSxXQUFXLHNCQUFzQjtBQUVqRCxLQUFJLENBQUMsUUFDSCxPQUFNLElBQUksTUFDUiwrRUFDRDtBQUdILFFBQU8sRUFBRSxHQUFHLFNBQVMifQ==
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { SpiffyMetricsEventName, useAmplitude } from "./amplitudeContext-CwPtBPhg.js";
|
|
2
|
-
import { useIntersection } from "./useIntersection-B4J9UhaG.js";
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
4
|
-
|
|
5
|
-
//#region src/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.ts
|
|
6
|
-
/**
|
|
7
|
-
* Tracks a component and logs an event to Amplitude when the component is visible.
|
|
8
|
-
*
|
|
9
|
-
* @param component - The component to track.
|
|
10
|
-
* @param element - The element to track visibility of.
|
|
11
|
-
* @param eventProps - Additional properties to include with the event.
|
|
12
|
-
* @param eventName - The Amplitude event name to track (defaults to ChatComponentVisible).
|
|
13
|
-
*/
|
|
14
|
-
const useTrackComponentVisibleEvent = (component, element, eventProps, eventName = SpiffyMetricsEventName.ChatComponentVisible) => {
|
|
15
|
-
const isVisible = useIntersection(element, "0px");
|
|
16
|
-
const hasTrackedEvent = useRef(false);
|
|
17
|
-
const { trackEvent } = useAmplitude();
|
|
18
|
-
const componentProps = (() => {
|
|
19
|
-
if (eventName === SpiffyMetricsEventName.ChatComponentVisible) return {
|
|
20
|
-
chat_component: component,
|
|
21
|
-
...eventProps
|
|
22
|
-
};
|
|
23
|
-
if (eventName === SpiffyMetricsEventName.SearchComponentVisible) return {
|
|
24
|
-
search_component: component,
|
|
25
|
-
...eventProps
|
|
26
|
-
};
|
|
27
|
-
return {
|
|
28
|
-
component,
|
|
29
|
-
...eventProps
|
|
30
|
-
};
|
|
31
|
-
})();
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (isVisible && !hasTrackedEvent.current) {
|
|
34
|
-
trackEvent({
|
|
35
|
-
eventName,
|
|
36
|
-
eventProps: componentProps
|
|
37
|
-
});
|
|
38
|
-
hasTrackedEvent.current = true;
|
|
39
|
-
}
|
|
40
|
-
}, [
|
|
41
|
-
isVisible,
|
|
42
|
-
component,
|
|
43
|
-
eventProps,
|
|
44
|
-
eventName,
|
|
45
|
-
componentProps,
|
|
46
|
-
trackEvent
|
|
47
|
-
]);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
//#endregion
|
|
51
|
-
export { useTrackComponentVisibleEvent };
|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UNDO0FBRUosaUJBQWdCO0FBQ2QsTUFBSSxhQUFhLENBQUMsZ0JBQWdCLFNBQVM7QUFDekMsY0FBVztJQUNFO0lBQ1gsWUFBWTtJQUNiLENBQUM7QUFDRixtQkFBZ0IsVUFBVTs7SUFFM0I7RUFBQztFQUFXO0VBQVc7RUFBWTtFQUFXO0VBQWdCO0VBQVcsQ0FBQyJ9
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_amplitudeContext = require('./amplitudeContext-DTC6maR0.cjs');
|
|
3
|
-
const require_useIntersection = require('./useIntersection-DKWc5MY6.cjs');
|
|
4
|
-
let react = require("react");
|
|
5
|
-
react = require_chunk.__toESM(react);
|
|
6
|
-
|
|
7
|
-
//#region src/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.ts
|
|
8
|
-
/**
|
|
9
|
-
* Tracks a component and logs an event to Amplitude when the component is visible.
|
|
10
|
-
*
|
|
11
|
-
* @param component - The component to track.
|
|
12
|
-
* @param element - The element to track visibility of.
|
|
13
|
-
* @param eventProps - Additional properties to include with the event.
|
|
14
|
-
* @param eventName - The Amplitude event name to track (defaults to ChatComponentVisible).
|
|
15
|
-
*/
|
|
16
|
-
const useTrackComponentVisibleEvent = (component, element, eventProps, eventName = require_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible) => {
|
|
17
|
-
const isVisible = require_useIntersection.useIntersection(element, "0px");
|
|
18
|
-
const hasTrackedEvent = (0, react.useRef)(false);
|
|
19
|
-
const { trackEvent } = require_amplitudeContext.useAmplitude();
|
|
20
|
-
const componentProps = (() => {
|
|
21
|
-
if (eventName === require_amplitudeContext.SpiffyMetricsEventName.ChatComponentVisible) return {
|
|
22
|
-
chat_component: component,
|
|
23
|
-
...eventProps
|
|
24
|
-
};
|
|
25
|
-
if (eventName === require_amplitudeContext.SpiffyMetricsEventName.SearchComponentVisible) return {
|
|
26
|
-
search_component: component,
|
|
27
|
-
...eventProps
|
|
28
|
-
};
|
|
29
|
-
return {
|
|
30
|
-
component,
|
|
31
|
-
...eventProps
|
|
32
|
-
};
|
|
33
|
-
})();
|
|
34
|
-
(0, react.useEffect)(() => {
|
|
35
|
-
if (isVisible && !hasTrackedEvent.current) {
|
|
36
|
-
trackEvent({
|
|
37
|
-
eventName,
|
|
38
|
-
eventProps: componentProps
|
|
39
|
-
});
|
|
40
|
-
hasTrackedEvent.current = true;
|
|
41
|
-
}
|
|
42
|
-
}, [
|
|
43
|
-
isVisible,
|
|
44
|
-
component,
|
|
45
|
-
eventProps,
|
|
46
|
-
eventName,
|
|
47
|
-
componentProps,
|
|
48
|
-
trackEvent
|
|
49
|
-
]);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
//#endregion
|
|
53
|
-
Object.defineProperty(exports, 'useTrackComponentVisibleEvent', {
|
|
54
|
-
enumerable: true,
|
|
55
|
-
get: function () {
|
|
56
|
-
return useTrackComponentVisibleEvent;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiVHJhY2tDb21wb25lbnRWaXNpYmxlRXZlbnQtRGFnOHZGaGIuY2pzIiwibmFtZXMiOlsiU3BpZmZ5TWV0cmljc0V2ZW50TmFtZSIsInVzZUludGVyc2VjdGlvbiIsInVzZUFtcGxpdHVkZSJdLCJzb3VyY2VzIjpbIi4uL3NyYy9ob29rcy9UcmFja0NvbXBvbmVudFZpc2libGVFdmVudC91c2VUcmFja0NvbXBvbmVudFZpc2libGVFdmVudC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBSZWZPYmplY3QsIHVzZUVmZmVjdCwgdXNlUmVmIH0gZnJvbSBcInJlYWN0XCI7XG5pbXBvcnQgeyBTcGlmZnlXaWRnZXRzIH0gZnJvbSBcInNyYy9hcHBsaWNhdGlvbi9tb2RlbHMvc3BpZmZ5V2lkZ2V0c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