@envive-ai/react-hooks 0.2.6-alpha-5 → 0.2.6-alpha-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AmplitudeOperations-CNFlPr53.cjs → AmplitudeOperations-DbUiR0N_.cjs} +3 -3
- package/dist/{AmplitudeOperations-cmAprPCA.js → AmplitudeOperations-DjqOM3uE.js} +2 -2
- package/dist/{NewOrgConfig-Bicbf8I7.js → NewOrgConfig-C_1T1iOt.js} +2 -2
- package/dist/{NewOrgConfig-6dFyYjJG.cjs → NewOrgConfig-D2Kvqa1z.cjs} +2 -2
- package/dist/{TrackComponentVisibleEvent-BebTjNtS.js → TrackComponentVisibleEvent-BxOhr9Da.js} +4 -4
- package/dist/{TrackComponentVisibleEvent-COwxsJRE.cjs → TrackComponentVisibleEvent-CDbecFPM.cjs} +5 -5
- package/dist/amplitudeContext-BWmXliMI.cjs +243 -0
- package/dist/amplitudeContext-BjMlg5RV.js +227 -0
- package/dist/amplitudeTrackEventAtom-D66l5oFp.js +8 -0
- package/dist/amplitudeTrackEventAtom-f22P2U0u.cjs +15 -0
- package/dist/app-Bs2KxG_8.js +515 -0
- package/dist/app-DSnDDqcW.cjs +570 -0
- package/dist/application/models/graphql/index.d.ts +1 -1
- package/dist/application/models/guards/api/index.d.ts +2 -2
- package/dist/application/models/guards/utils.d.ts +1 -1
- package/dist/application/models/index.cjs +2 -2
- package/dist/application/models/index.d.ts +4 -4
- package/dist/application/models/index.js +2 -2
- package/dist/application/utils/index.cjs +5 -14
- package/dist/application/utils/index.d.cts +7 -8
- package/dist/application/utils/index.d.ts +8 -9
- package/dist/application/utils/index.js +5 -14
- package/dist/{atomStore-CZKe3itM.cjs → atomStore-BQVO5haU.cjs} +1 -1
- package/dist/{atomStore-BuopbV9k.js → atomStore-CfzCqWB9.js} +1 -1
- package/dist/atoms/app/index.cjs +17 -19
- package/dist/atoms/app/index.d.cts +7 -7
- package/dist/atoms/app/index.d.ts +7 -7
- package/dist/atoms/app/index.js +12 -14
- package/dist/atoms/atomStore/index.cjs +1 -1
- package/dist/atoms/atomStore/index.d.ts +1 -1
- package/dist/atoms/atomStore/index.js +1 -1
- package/dist/atoms/chat/index.cjs +15 -17
- package/dist/atoms/chat/index.d.cts +33 -34
- package/dist/atoms/chat/index.d.ts +34 -35
- package/dist/atoms/chat/index.js +15 -17
- package/dist/atoms/globalSearch/index.cjs +1 -1
- package/dist/atoms/globalSearch/index.d.cts +6 -6
- package/dist/atoms/globalSearch/index.d.ts +6 -6
- package/dist/atoms/globalSearch/index.js +1 -1
- package/dist/atoms/org/index.cjs +2 -2
- package/dist/atoms/org/index.d.cts +17 -17
- package/dist/atoms/org/index.d.ts +17 -17
- package/dist/atoms/org/index.js +2 -2
- package/dist/atoms/search/index.cjs +6 -6
- package/dist/atoms/search/index.d.cts +15 -15
- package/dist/atoms/search/index.d.ts +14 -14
- package/dist/atoms/search/index.js +6 -6
- package/dist/atoms/search/utils.cjs +1 -1
- package/dist/atoms/search/utils.d.cts +1 -1
- package/dist/atoms/search/utils.d.ts +1 -1
- package/dist/atoms/search/utils.js +1 -1
- package/dist/{cdnContext-CuZwc-PI.js → cdnContext-CJ2BNLAD.js} +2 -2
- package/dist/{cdnContext-ClAEcKhO.cjs → cdnContext-lkC-AE6A.cjs} +2 -2
- package/dist/chat-C5afTKUY.js +226 -0
- package/dist/{chat-BJL3nXR7.cjs → chat-CCjM6fS_.cjs} +6 -7
- package/dist/{chat-DCGriB7h.cjs → chat-CJ9D8n7g.cjs} +1 -1
- package/dist/{chat-ClvJ9xEj.js → chat-EJbfGWRr.js} +1 -1
- package/dist/chatState-BbI93m6r.js +33 -0
- package/dist/chatState-DlJpHAsW.cjs +119 -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.cts +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.cts +1 -1
- package/dist/config/locators/components/chat/index.d.ts +1 -1
- package/dist/config/locators/components/chat/index.js +1 -1
- package/dist/config/locators/components/common/index.cjs +1 -1
- package/dist/config/locators/components/common/index.d.cts +1 -1
- package/dist/config/locators/components/common/index.d.ts +1 -1
- package/dist/config/locators/components/common/index.js +1 -1
- package/dist/config/locators/components/index.cjs +1 -1
- package/dist/config/locators/components/index.d.cts +1 -1
- package/dist/config/locators/components/index.d.ts +1 -1
- package/dist/config/locators/components/index.js +1 -1
- package/dist/config/locators/index.cjs +4 -4
- package/dist/config/locators/index.d.cts +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 +18 -17
- package/dist/contexts/amplitudeContext/index.d.cts +11 -2
- package/dist/contexts/amplitudeContext/index.d.ts +11 -2
- package/dist/contexts/amplitudeContext/index.js +17 -15
- package/dist/contexts/cdnContext/index.cjs +3 -3
- package/dist/contexts/cdnContext/index.d.cts +1 -1
- package/dist/contexts/cdnContext/index.js +3 -3
- package/dist/contexts/enviveConfigContext/index.cjs +3 -3
- package/dist/contexts/enviveConfigContext/index.d.cts +1 -1
- package/dist/contexts/enviveConfigContext/index.js +3 -3
- package/dist/contexts/enviveCssContext/index.cjs +10 -10
- package/dist/contexts/enviveCssContext/index.js +10 -10
- package/dist/contexts/featureFlagContext/index.cjs +4 -4
- package/dist/contexts/featureFlagContext/index.js +4 -4
- package/dist/contexts/featureFlagServiceContext/index.cjs +3 -3
- package/dist/contexts/featureFlagServiceContext/index.d.cts +1 -1
- package/dist/contexts/featureFlagServiceContext/index.d.ts +1 -1
- package/dist/contexts/featureFlagServiceContext/index.js +3 -3
- package/dist/contexts/graphqlContext/index.cjs +4 -4
- package/dist/contexts/graphqlContext/index.js +4 -4
- package/dist/contexts/localStorageContext/index.cjs +2 -2
- package/dist/contexts/localStorageContext/index.d.cts +1 -1
- package/dist/contexts/localStorageContext/index.js +2 -2
- package/dist/contexts/newOrgConfigContext/index.cjs +9 -9
- package/dist/contexts/newOrgConfigContext/index.js +9 -9
- package/dist/contexts/searchContext/index.cjs +18 -19
- package/dist/contexts/searchContext/index.js +18 -19
- package/dist/contexts/sessionStorageContext/index.cjs +1 -1
- package/dist/contexts/sessionStorageContext/index.js +1 -1
- package/dist/contexts/shopifyUrlContext/index.cjs +2 -2
- package/dist/contexts/shopifyUrlContext/index.d.cts +1 -1
- package/dist/contexts/shopifyUrlContext/index.js +2 -2
- package/dist/contexts/systemSettingsContext/index.cjs +3 -3
- package/dist/contexts/systemSettingsContext/index.d.cts +2 -2
- package/dist/contexts/systemSettingsContext/index.js +3 -3
- package/dist/contexts/userIdentityContext/index.cjs +14 -16
- package/dist/contexts/userIdentityContext/index.js +12 -14
- package/dist/{dist-CIM4YRqp.js → dist-C38adNK1.js} +1 -1
- package/dist/{dist-BZX_Mgfn.cjs → dist-VxRI6eQv.cjs} +1 -1
- package/dist/{domObserver-CwieVNgj.cjs → domObserver-C2oQO8vi.cjs} +1 -1
- package/dist/{domObserver-B19-69gW.js → domObserver-DNeeSh1F.js} +1 -1
- package/dist/{enviveConfig-CBnoutoK.js → enviveConfig-Ciq4ASoV.js} +2 -2
- package/dist/{enviveConfig-BwIaVAAm.cjs → enviveConfig-Dp80h9yu.cjs} +2 -2
- package/dist/{enviveConfigContext-B4nejwV9.js → enviveConfigContext-CCjJUmwp.js} +2 -2
- package/dist/{enviveConfigContext-DgewMgYS.cjs → enviveConfigContext-DoYP8KSw.cjs} +2 -2
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.js +1 -1
- package/dist/{events-BHBRLPWS.js → events-CXiS1aTc.js} +1 -1
- package/dist/{events-C8LA-0Tp.cjs → events-DBin1Z7o.cjs} +1 -1
- package/dist/exceptions/index.cjs +1 -1
- package/dist/exceptions/index.d.ts +1 -1
- package/dist/exceptions/index.js +1 -1
- package/dist/{exceptions-BBXmiU8P.cjs → exceptions-BjDgLzGi.cjs} +1 -1
- package/dist/{exceptions--fSXOzkB.js → exceptions-CUGY31Ua.js} +1 -1
- package/dist/{featureFlagServiceContext-B7je7VZV.d.cts → featureFlagServiceContext-ClnlCJV5.d.cts} +1 -1
- package/dist/{featureFlagServiceContext-CZj3qPX7.js → featureFlagServiceContext-Cvp7NlpC.js} +2 -2
- package/dist/{featureFlagServiceContext-DiYIv0jI.d.ts → featureFlagServiceContext-CyPGEe2d.d.ts} +1 -1
- package/dist/{featureFlagServiceContext-BkamHViU.cjs → featureFlagServiceContext-DHtkQAtq.cjs} +2 -2
- package/dist/{globalSearch-C94-vEVh.cjs → globalSearch-Cpc8egsM.cjs} +1 -1
- package/dist/{globalSearch-Dlbnfasm.js → globalSearch-nmrfGLOn.js} +1 -1
- package/dist/{graphqlContext-Capum8x6.js → graphqlContext-0cg9fEUw.js} +3 -3
- package/dist/{graphqlContext-C3HXFiHx.cjs → graphqlContext-ChXlE8Ul.cjs} +3 -3
- package/dist/hooks/AmplitudeOperations/index.cjs +17 -15
- package/dist/hooks/AmplitudeOperations/index.d.cts +1 -1
- package/dist/hooks/AmplitudeOperations/index.js +17 -15
- package/dist/hooks/AppDetails/index.cjs +15 -17
- package/dist/hooks/AppDetails/index.js +15 -17
- package/dist/hooks/BlockBackButton/index.d.cts +1 -1
- package/dist/hooks/CdnOperations/index.cjs +3 -3
- package/dist/hooks/CdnOperations/index.d.cts +1 -1
- package/dist/hooks/CdnOperations/index.d.ts +1 -1
- package/dist/hooks/CdnOperations/index.js +3 -3
- package/dist/hooks/ChatToggle/index.cjs +21 -19
- package/dist/hooks/ChatToggle/index.d.cts +1 -1
- package/dist/hooks/ChatToggle/index.js +20 -18
- package/dist/hooks/ChatToggleAnalytics/index.cjs +19 -17
- package/dist/hooks/ChatToggleAnalytics/index.d.cts +1 -1
- package/dist/hooks/ChatToggleAnalytics/index.js +19 -17
- package/dist/hooks/Debounce/index.d.cts +1 -1
- package/dist/hooks/ElementObserver/index.cjs +1 -1
- package/dist/hooks/ElementObserver/index.d.cts +1 -1
- package/dist/hooks/ElementObserver/index.d.ts +1 -1
- package/dist/hooks/ElementObserver/index.js +1 -1
- package/dist/hooks/GraphQLConfig/index.cjs +5 -5
- package/dist/hooks/GraphQLConfig/index.d.cts +1 -1
- package/dist/hooks/GraphQLConfig/index.js +5 -5
- package/dist/hooks/IdentifyUser/index.cjs +14 -16
- package/dist/hooks/IdentifyUser/index.d.cts +1 -1
- package/dist/hooks/IdentifyUser/index.js +13 -15
- package/dist/hooks/ImageResolver/index.cjs +2 -2
- package/dist/hooks/ImageResolver/index.d.cts +1 -1
- package/dist/hooks/ImageResolver/index.js +2 -2
- package/dist/hooks/Intersection/index.cjs +1 -1
- package/dist/hooks/Intersection/index.js +1 -1
- package/dist/hooks/IsSmallScreen/index.d.cts +1 -1
- package/dist/hooks/LocalStorageOperations/index.cjs +2 -2
- package/dist/hooks/LocalStorageOperations/index.d.cts +1 -1
- package/dist/hooks/LocalStorageOperations/index.js +2 -2
- package/dist/hooks/MessageFilter/index.cjs +1 -1
- package/dist/hooks/MessageFilter/index.d.cts +1 -1
- package/dist/hooks/MessageFilter/index.js +1 -1
- package/dist/hooks/MessageScrollObserver/index.d.cts +1 -1
- package/dist/hooks/NewOrgConfig/index.cjs +10 -10
- package/dist/hooks/NewOrgConfig/index.d.cts +2 -2
- package/dist/hooks/NewOrgConfig/index.d.ts +2 -2
- package/dist/hooks/NewOrgConfig/index.js +10 -10
- package/dist/hooks/Search/index.cjs +25 -23
- package/dist/hooks/Search/index.js +25 -23
- package/dist/hooks/SearchOperations/index.cjs +19 -20
- package/dist/hooks/SearchOperations/index.js +19 -20
- package/dist/hooks/SessionStorageOperations/index.cjs +1 -1
- package/dist/hooks/SessionStorageOperations/index.js +1 -1
- package/dist/hooks/ShopifyUrlOperations/index.cjs +2 -2
- package/dist/hooks/ShopifyUrlOperations/index.d.cts +2 -2
- package/dist/hooks/ShopifyUrlOperations/index.d.ts +2 -2
- package/dist/hooks/ShopifyUrlOperations/index.js +2 -2
- package/dist/hooks/SystemSettingsContext/index.cjs +3 -3
- package/dist/hooks/SystemSettingsContext/index.d.cts +4 -4
- package/dist/hooks/SystemSettingsContext/index.d.ts +4 -4
- package/dist/hooks/SystemSettingsContext/index.js +3 -3
- package/dist/hooks/TrackComponentVisibleEvent/index.cjs +18 -16
- package/dist/hooks/TrackComponentVisibleEvent/index.js +18 -16
- package/dist/hooks/UpdateAnalyticsProps/index.cjs +20 -18
- package/dist/hooks/UpdateAnalyticsProps/index.js +17 -15
- package/dist/hooks/utils.cjs +1 -1
- package/dist/hooks/utils.d.cts +1 -1
- package/dist/hooks/utils.js +1 -1
- package/dist/{index-CAhGZxMI.d.ts → index-5li6ZMDu.d.ts} +1 -1
- package/dist/{index-ca7Qn8o0.d.cts → index-BbqT4BQv.d.cts} +1 -1
- package/dist/{index-w64il54a.d.cts → index-CAJq_8bO.d.cts} +1 -1
- package/dist/index-CMZcE7pk.d.cts +1 -1
- package/dist/{index-BQpWG3Jm.d.cts → index-ChiZg0yw.d.cts} +1 -1
- package/dist/{index-DNccxbJi.d.ts → index-CsmO1rDH.d.ts} +1 -1
- package/dist/{index-Dgu085Lu.d.ts → index-CuihhoIF.d.ts} +2 -2
- package/dist/{index-BR1G8yyg.d.ts → index-DtzPIcQp.d.ts} +1 -1
- package/dist/{index-ZQMda2Iu.d.ts → index-bEjLKG_Q.d.ts} +1 -1
- package/dist/{index-DiIHuPq2.d.ts → index-jFQefHda.d.ts} +1 -1
- package/dist/{index-BO-ZLYtR.d.ts → index-mv7KvWDq.d.ts} +1 -1
- package/dist/{index-ClVBVK15.d.cts → index-npqPeJ1g.d.cts} +1 -1
- package/dist/interceptors/index.cjs +1 -1
- package/dist/interceptors/index.d.cts +1 -1
- package/dist/interceptors/index.d.ts +1 -1
- package/dist/interceptors/index.js +1 -1
- package/dist/{localStorageContext-p_4U0RPI.js → localStorageContext-BFwvuEcf.js} +2 -2
- package/dist/{localStorageContext-CPrkpt8i.cjs → localStorageContext-CWc5xJ6U.cjs} +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/{models-L2w8FYCa.js → models-Cw0QcbQv.js} +2 -2
- package/dist/{models-OyYkll03.cjs → models-Dl0_Ujgj.cjs} +2 -2
- package/dist/{newOrgConfigAtom-Dsk0fJNR.js → newOrgConfigAtom-BuQE_zPK.js} +1 -1
- package/dist/{newOrgConfigAtom-hs5A1pbZ.cjs → newOrgConfigAtom-rrYHmp1b.cjs} +1 -1
- package/dist/{newOrgConfigContext-BuqDUkPz.js → newOrgConfigContext-D-gU5ppl.js} +5 -5
- package/dist/{newOrgConfigContext-N4CQzvlH.cjs → newOrgConfigContext-d3RHl430.cjs} +5 -5
- package/dist/{nodeSelector-0gJ8Xayf.d.ts → nodeSelector-BAKg1h_y.d.ts} +1 -1
- package/dist/{nodeSelector-Cj-Xl1LP.d.cts → nodeSelector-BYEAyrsj.d.cts} +1 -1
- package/dist/org-15F128Ah.js +32 -0
- package/dist/org-CIFgIcO4.cjs +111 -0
- package/dist/{search-C_N_oRVZ.js → search--80x6CfL.js} +5 -5
- package/dist/{search-8bPfo07V.cjs → search-Ch6LKNh4.cjs} +5 -5
- package/dist/{searchContext-DdJbpDsU.cjs → searchContext-B0qEUoKb.cjs} +6 -6
- package/dist/{searchContext-BohH5i8s.js → searchContext-BkPoTq1o.js} +6 -6
- package/dist/{searchServiceAdapter-BSPZOg1r.js → searchServiceAdapter-B0h7psvh.js} +1 -1
- package/dist/{searchServiceAdapter-DrjFCiw8.cjs → searchServiceAdapter-BclWy4fE.cjs} +1 -1
- package/dist/{sessionStorageContext-CH37Dkb-.cjs → sessionStorageContext-BuWrJQwc.cjs} +1 -1
- package/dist/{sessionStorageContext-CqrutoVq.js → sessionStorageContext-DvFHbk81.js} +1 -1
- package/dist/{shopifyUrlContext-Ba6MQdNV.cjs → shopifyUrlContext-Bw1kAZ2P.cjs} +2 -2
- package/dist/{shopifyUrlContext-BI3fVtA5.js → shopifyUrlContext-DnJiUmMA.js} +2 -2
- package/dist/src/application/commerce-api.js +408 -0
- package/dist/src/application/logging/logger.js +16 -0
- package/dist/src/application/models/graphql/index.js +3 -0
- package/dist/src/application/models/graphql/queries/getMerchantColorsQuery.js +13 -0
- package/dist/src/application/models/graphql/queries/getMerchantFrontendConfigQuery.js +13 -0
- package/dist/src/application/models/graphql/queries/getMerchantOrgIdQuery.js +10 -0
- package/dist/src/application/models/guards/api/index.js +12 -0
- package/dist/src/application/models/guards/api/isApiFormResponse.js +59 -0
- package/dist/src/application/models/guards/api/isApiFormSubmittedResponseAttributes.js +22 -0
- package/dist/src/application/models/guards/api/isApiOrderResponseAttributes.js +91 -0
- package/dist/src/application/models/guards/api/isApiOrgConfigResults.js +188 -0
- package/dist/src/application/models/guards/api/isApiOrganizationConfig.js +115 -0
- package/dist/src/application/models/guards/api/isApiPDPEventAttributes.js +16 -0
- package/dist/src/application/models/guards/api/isApiPLPEventAttributes.js +26 -0
- package/dist/src/application/models/guards/api/isApiPageResponseAttributes.js +15 -0
- package/dist/src/application/models/guards/api/isApiProductResponseAttributes.js +65 -0
- package/dist/src/application/models/guards/api/isApiProductSearchAttributes.js +15 -0
- package/dist/src/application/models/guards/api/isApiProductSearchFilterAttributes.js +10 -0
- package/dist/src/application/models/guards/api/isApiQueryTypedEventAttributes.js +4 -0
- package/dist/src/application/models/guards/api/isApiResponse.js +33 -0
- package/dist/src/application/models/guards/api/isApiReviewResponseAttributes.js +22 -0
- package/dist/src/application/models/guards/api/isApiReviewRichInformation.js +23 -0
- package/dist/src/application/models/guards/api/isApiSearchEventAttributes.js +20 -0
- package/dist/src/application/models/guards/api/isApiSuggestion.js +24 -0
- package/dist/src/application/models/guards/api/isApiSuggestionClickedEventAttributes.js +4 -0
- package/dist/src/application/models/guards/api/isApiTextResponseAttributes.js +4 -0
- package/dist/src/application/models/guards/api/isApiUserEvent.js +18 -0
- package/dist/src/application/models/guards/graphQL/isGraphQLColorsConfig.js +41 -0
- package/dist/src/application/models/guards/isBaseEcommerceEvent.js +14 -0
- package/dist/src/application/models/guards/isGA4EcommerceEvent.js +14 -0
- package/dist/src/application/models/guards/isLegacyUAEcommerceEvent.js +14 -0
- package/dist/src/application/models/guards/isMobilePLPChatPlacementParameter.js +4 -0
- package/dist/src/application/models/guards/isSpanxTakeAQuizCtaParameter.js +1 -0
- package/dist/src/application/models/guards/isVariantInfo.js +28 -0
- package/dist/src/application/models/guards/utils.js +34 -0
- package/dist/src/application/models/index.js +34 -0
- package/dist/src/application/models/utils/snakeToCamelTransformer.js +71 -0
- package/dist/src/application/models/utils/stringToFulfillmentDisplayStatusEnumValue.js +65 -0
- package/dist/src/application/models/validators/validateGraphQLColorsConfig.js +9 -0
- package/dist/src/application/models/validators/validateGraphQLFrontendConfig.js +420 -0
- package/dist/src/application/models/validators/validateGraphQLOrgId.js +6 -0
- package/dist/src/application/models/validators/validateMobilePLPChatPlacementParameter.js +9 -0
- package/dist/src/application/models/validators/validateOrgConfigResults.js +44 -0
- package/dist/src/application/models/validators/validateOrganizationConfig.js +34 -0
- package/dist/src/application/models/validators/validateResponse.js +173 -0
- package/dist/src/application/models/validators/validateSuggestion.js +13 -0
- package/dist/src/application/models/validators/validateUserEvent.js +91 -0
- package/dist/src/application/utils/analyticsUtils.js +95 -0
- package/dist/src/application/utils/coreContextToApiContext.js +8 -0
- package/dist/src/application/utils/coreUserEventToApiUserEvent.js +90 -0
- package/dist/src/application/utils/divideArray.js +7 -0
- package/dist/src/application/utils/domObserver.js +85 -0
- package/dist/src/application/utils/elementObserver.js +186 -0
- package/dist/src/application/utils/imageFilter.js +11 -0
- package/dist/src/application/utils/index.js +21 -0
- package/dist/src/application/utils/merchantUtils.js +15 -0
- package/dist/src/application/utils/messageFromFormSubmittedEvent.js +19 -0
- package/dist/src/application/utils/messageFromQueryEvent.js +35 -0
- package/dist/src/application/utils/messageFromResponse.js +123 -0
- package/dist/src/application/utils/messageFromSuggestionEvent.js +27 -0
- package/dist/src/application/utils/mouseEventTypes.js +1 -0
- package/dist/src/application/utils/mutationHelper.js +33 -0
- package/dist/src/application/utils/nextMessageRequestToApiRequest.js +29 -0
- package/dist/src/application/utils/nodeSelector.js +101 -0
- package/dist/src/application/utils/overrides.js +144 -0
- package/dist/src/application/utils/stringUtils.js +47 -0
- package/dist/src/application/utils/supportedEventRequestToApiRequest.js +7 -0
- package/dist/src/application/utils/urlsParser.js +33 -0
- package/dist/src/application/utils/validation.js +5 -0
- package/dist/src/atoms/amplitude/amplitudeTrackEventAtom.js +4 -0
- package/dist/src/atoms/app/index.js +23 -0
- package/dist/src/atoms/app/variant.js +102 -0
- package/dist/src/atoms/atomStore/atomStore.js +28 -0
- package/dist/src/atoms/atomStore/index.js +1 -0
- package/dist/src/atoms/chat/chatState.js +32 -0
- package/dist/src/atoms/chat/form.js +16 -0
- package/dist/src/atoms/chat/index.js +23 -0
- package/dist/src/atoms/chat/lastMessage.js +10 -0
- package/dist/src/atoms/chat/messageQueue.js +68 -0
- package/dist/src/atoms/chat/performanceMetrics.js +70 -0
- package/dist/src/atoms/chat/renderedWidgetRefs.js +24 -0
- package/dist/src/atoms/chat/replies.js +42 -0
- package/dist/src/atoms/chat/suggestions.js +29 -0
- package/dist/src/atoms/envive/enviveConfig.js +67 -0
- package/dist/src/atoms/globalSearch/globalSearch.js +8 -0
- package/dist/src/atoms/globalSearch/index.js +1 -0
- package/dist/src/atoms/org/customerService.js +6 -0
- package/dist/src/atoms/org/graphqlConfig.js +8 -0
- package/dist/src/atoms/org/index.js +4 -0
- package/dist/src/atoms/org/newOrgConfigAtom.js +2 -0
- package/dist/src/atoms/org/orgAnalyticsConfig.js +8 -0
- package/dist/src/atoms/search/index.js +1 -0
- package/dist/src/atoms/search/productFilters.js +163 -0
- package/dist/src/atoms/search/productRetrievalAPI.js +50 -0
- package/dist/src/atoms/search/productRetrievalAdapter.js +14 -0
- package/dist/src/atoms/search/productSorter.js +13 -0
- package/dist/src/atoms/search/searchAPI.js +140 -0
- package/dist/src/atoms/search/searchServiceAdapter.js +14 -0
- package/dist/src/atoms/search/utils.js +15 -0
- package/dist/src/config/index.js +1 -0
- package/dist/src/config/locators/components/chat/entrypoints.js +10 -0
- package/dist/src/config/locators/components/chat/index.js +21 -0
- package/dist/src/config/locators/components/chat/preview.js +11 -0
- package/dist/src/config/locators/components/chat/variants/index.js +12 -0
- package/dist/src/config/locators/components/common/buttons.js +6 -0
- package/dist/src/config/locators/components/common/cards.js +17 -0
- package/dist/src/config/locators/components/common/index.js +4 -0
- package/dist/src/config/locators/components/common/links.js +1 -0
- package/dist/src/config/locators/components/common/tables.js +1 -0
- package/dist/src/config/locators/components/floating-button.js +2 -0
- package/dist/src/config/locators/components/index.js +3 -0
- package/dist/src/config/locators/components/report-issue.js +13 -0
- package/dist/src/config/locators/components/search/index.js +5 -0
- package/dist/src/config/locators/components/shadow-dom.js +1 -0
- package/dist/src/config/locators/embedded.js +20 -0
- package/dist/src/config/locators/index.js +4 -0
- package/dist/src/contexts/amplitudeContext/amplitudeContext.js +271 -0
- package/dist/src/contexts/amplitudeContext/index.js +1 -0
- package/dist/src/contexts/cdnContext/cdnContext.js +28 -0
- package/dist/src/contexts/cdnContext/index.js +1 -0
- package/dist/src/contexts/enviveConfigContext/enviveConfigContext.js +37 -0
- package/dist/src/contexts/enviveConfigContext/index.js +1 -0
- package/dist/src/contexts/enviveCssContext/enviveCssContext.js +31 -0
- package/dist/src/contexts/enviveCssContext/index.js +1 -0
- package/dist/src/contexts/featureFlagContext/featureFlagContext.js +109 -0
- package/dist/src/contexts/featureFlagContext/index.js +1 -0
- package/dist/src/contexts/featureFlagServiceContext/featureFlagServiceContext.js +47 -0
- package/dist/src/contexts/featureFlagServiceContext/index.js +1 -0
- package/dist/src/contexts/graphqlContext/graphqlContext.js +87 -0
- package/dist/src/contexts/graphqlContext/index.js +1 -0
- package/dist/src/contexts/localStorageContext/index.js +1 -0
- package/dist/src/contexts/localStorageContext/localStorageContext.js +95 -0
- package/dist/src/contexts/newOrgConfigContext/index.js +1 -0
- package/dist/src/contexts/newOrgConfigContext/newOrgConfigContext.js +33 -0
- package/dist/src/contexts/searchContext/index.js +1 -0
- package/dist/src/contexts/searchContext/searchContext.js +131 -0
- package/dist/src/contexts/sessionStorageContext/index.js +1 -0
- package/dist/src/contexts/sessionStorageContext/sessionStorageContext.js +43 -0
- package/dist/src/contexts/shopifyUrlContext/index.js +1 -0
- package/dist/src/contexts/shopifyUrlContext/shopifyUrlContext.js +62 -0
- package/dist/src/contexts/systemSettingsContext/index.js +1 -0
- package/dist/src/contexts/systemSettingsContext/systemSettingsContext.js +29 -0
- package/dist/src/contexts/userIdentityContext/index.js +1 -0
- package/dist/src/contexts/userIdentityContext/userIdentityContext.js +118 -0
- package/dist/src/events/index.js +51 -0
- package/dist/src/events/registerAnalyticsListeners.js +32 -0
- package/dist/src/exceptions/index.js +2 -0
- package/dist/src/exceptions/sessionExceptions.js +6 -0
- package/dist/src/exceptions/unsupportedProductExceptions.js +6 -0
- package/dist/src/hooks/AmplitudeOperations/index.js +1 -0
- package/dist/src/hooks/AmplitudeOperations/useAmplitudeOperations.js +24 -0
- package/dist/src/hooks/AppDetails/index.js +1 -0
- package/dist/src/hooks/AppDetails/useAppDetails.js +26 -0
- package/dist/src/hooks/BlockBackButton/index.js +1 -0
- package/dist/src/hooks/BlockBackButton/useBlockBackButton.js +23 -0
- package/dist/src/hooks/CdnOperations/index.js +1 -0
- package/dist/src/hooks/CdnOperations/useCdnOperations.js +13 -0
- package/dist/src/hooks/ChatToggle/index.js +1 -0
- package/dist/src/hooks/ChatToggle/useChatToggle.js +50 -0
- package/dist/src/hooks/ChatToggleAnalytics/index.js +1 -0
- package/dist/src/hooks/ChatToggleAnalytics/useChatToggleAnalytics.js +11 -0
- package/dist/src/hooks/CustomerSupportHandoff/index.js +1 -0
- package/dist/src/hooks/CustomerSupportHandoff/useCustomerSupportHandoff.js +32 -0
- package/dist/src/hooks/Debounce/index.js +1 -0
- package/dist/src/hooks/Debounce/useDebounce.js +13 -0
- package/dist/src/hooks/ElementObserver/index.js +1 -0
- package/dist/src/hooks/ElementObserver/useElementObserver.js +208 -0
- package/dist/src/hooks/GrabAndScroll/index.js +1 -0
- package/dist/src/hooks/GrabAndScroll/useGrabAndScroll.js +105 -0
- package/dist/src/hooks/GraphQLConfig/index.js +1 -0
- package/dist/src/hooks/GraphQLConfig/useGraphQLConfig.js +54 -0
- package/dist/src/hooks/IdentifyUser/index.js +1 -0
- package/dist/src/hooks/IdentifyUser/useIdentifyUser.js +28 -0
- package/dist/src/hooks/ImageResolver/index.js +1 -0
- package/dist/src/hooks/ImageResolver/useImageResolver.js +45 -0
- package/dist/src/hooks/Intersection/index.js +1 -0
- package/dist/src/hooks/Intersection/useIntersection.js +20 -0
- package/dist/src/hooks/IsSmallScreen/index.js +1 -0
- package/dist/src/hooks/IsSmallScreen/useIsSmallScreen.js +16 -0
- package/dist/src/hooks/LocalStorageOperations/index.js +1 -0
- package/dist/src/hooks/LocalStorageOperations/useLocalStorageOperations.js +64 -0
- package/dist/src/hooks/MessageFilter/index.js +1 -0
- package/dist/src/hooks/MessageFilter/useMessageFilter.js +37 -0
- package/dist/src/hooks/MessageScrollObserver/index.js +1 -0
- package/dist/src/hooks/MessageScrollObserver/useMessageScrollObserver.js +35 -0
- package/dist/src/hooks/NewOrgConfig/index.js +1 -0
- package/dist/src/hooks/NewOrgConfig/useNewOrgConfig.js +5 -0
- package/dist/src/hooks/Search/index.js +1 -0
- package/dist/src/hooks/Search/useRecommendedProducts.js +35 -0
- package/dist/src/hooks/Search/useSearch.js +224 -0
- package/dist/src/hooks/Search/useSearchInput.js +192 -0
- package/dist/src/hooks/SearchOperations/index.js +1 -0
- package/dist/src/hooks/SearchOperations/useSearchOperations.js +78 -0
- package/dist/src/hooks/SessionStorageOperations/index.js +1 -0
- package/dist/src/hooks/SessionStorageOperations/useSessionStorageOperations.js +20 -0
- package/dist/src/hooks/ShopifyUrlOperations/index.js +1 -0
- package/dist/src/hooks/ShopifyUrlOperations/useShopifyUrlOperations.js +34 -0
- package/dist/src/hooks/SnapCalculator/index.js +1 -0
- package/dist/src/hooks/SnapCalculator/useSnapCalculator.js +22 -0
- package/dist/src/hooks/SystemSettingsContext/index.js +1 -0
- package/dist/src/hooks/SystemSettingsContext/useSystemSettingsContext.js +9 -0
- package/dist/src/hooks/TrackComponentVisibleEvent/index.js +1 -0
- package/dist/src/hooks/TrackComponentVisibleEvent/useTrackComponentVisibleEvent.js +45 -0
- package/dist/src/hooks/UpdateAnalyticsProps/index.js +1 -0
- package/dist/src/hooks/UpdateAnalyticsProps/useUpdateAnalyticsProps.js +43 -0
- package/dist/src/hooks/utils.js +116 -0
- package/dist/src/interceptors/index.js +1 -0
- package/dist/src/interceptors/useMessageInterceptor.js +24 -0
- package/dist/src/types/ApiResponse.js +1 -0
- package/dist/src/types/FilterAttribute.js +3 -0
- package/dist/src/types/Message.js +24 -0
- package/dist/src/types/Suggestion.js +3 -0
- package/dist/src/types/index.js +4 -0
- package/dist/src/util/colorVar.js +3 -0
- package/dist/src/util/configVersion.js +4 -0
- package/dist/src/util/domInsertion.js +16 -0
- package/dist/{systemSettingsContext-CYce8iqH.cjs → systemSettingsContext-068vQuP2.cjs} +2 -2
- package/dist/{systemSettingsContext-D9BZ9EwQ.js → systemSettingsContext-DPdDfVhj.js} +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/{urlsParser-C-Vzs--G.cjs → urlsParser-bb8ciRFg.cjs} +1 -1
- package/dist/{urlsParser-G7Ocwg0M.js → urlsParser-v_1DKvyf.js} +1 -1
- package/dist/{useAppDetails-CSpw8teP.js → useAppDetails-BPXln8UE.js} +4 -4
- package/dist/{useAppDetails-DNG_-DI9.cjs → useAppDetails-eP2hBuid.cjs} +7 -7
- package/dist/{useGraphQLConfig-D1REGfFB.js → useGraphQLConfig-Btszi6cG.js} +2 -2
- package/dist/{useGraphQLConfig-CKtaLlQ-.cjs → useGraphQLConfig-v9veUbvJ.cjs} +2 -2
- package/dist/{useIntersection-BQMfiS4x.cjs → useIntersection-BcBCa890.cjs} +1 -1
- package/dist/{useIntersection-D-ol9eH8.js → useIntersection-BkMkuJcZ.js} +1 -1
- package/dist/{utils-sosM0bEk.d.ts → utils-BitIIghf.d.ts} +1 -1
- package/dist/{utils-hYTjy7hJ.cjs → utils-CJk5iwQI.cjs} +1 -1
- package/dist/utils-CWzuvlOR.js +607 -0
- package/dist/{utils-BBICrPjW.cjs → utils-CqVRbvfN.cjs} +1 -1
- package/dist/{utils-w4-xONRA.js → utils-DQhbbAnt.js} +1 -1
- package/dist/{utils-D_kATUj6.js → utils-D_nGHczN.js} +1 -1
- package/dist/utils-SjlIHajO.cjs +716 -0
- package/package.json +1 -1
- package/src/application/commerce-api.ts +2 -0
- package/src/application/utils/analyticsUtils.ts +31 -16
- package/src/atoms/amplitude/amplitudeTrackEventAtom.ts +1 -1
- package/src/atoms/chat/chatState.ts +12 -7
- package/src/atoms/chat/replies.ts +42 -40
- package/src/contexts/amplitudeContext/amplitudeContext.tsx +116 -130
- package/dist/amplitudeContext-CMTvCsJC.d.ts +0 -52
- package/dist/amplitudeContext-ZkerrMUa.d.cts +0 -52
- package/dist/amplitudeTrackEventAtom-D9vs8dpE.cjs +0 -15
- package/dist/amplitudeTrackEventAtom-iEIu11Om.js +0 -8
- package/dist/chat-ChCtIEwh.js +0 -227
- package/dist/chatState-BYB77nbx.cjs +0 -120
- package/dist/chatState-CzH7APPP.js +0 -34
- package/dist/org-C2kLSSe9.cjs +0 -111
- package/dist/org-CIczyLRP.js +0 -32
- package/dist/utils-DGpMn2pp.js +0 -1364
- package/dist/utils-DqxtxrFe.cjs +0 -1546
- /package/dist/{featureFlagServiceContext-DgoR6euC.js → featureFlagServiceContext-CISyb90N.js} +0 -0
- /package/dist/{featureFlagServiceContext-b-rYgf0u.cjs → featureFlagServiceContext-Csgo-MUv.cjs} +0 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { OrganizationStatusEnum, } from '@spiffy-ai/commerce-api-client';
|
|
2
|
+
import { isApiOrganizationConfig } from './isApiOrganizationConfig';
|
|
3
|
+
import Logger from 'src/application/logging/logger';
|
|
4
|
+
const isApiOrgConfigExperiment = (data) => {
|
|
5
|
+
if (data == null || typeof data !== 'object') {
|
|
6
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigExperiment: data is not an object', undefined, {
|
|
7
|
+
data,
|
|
8
|
+
});
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
if ('group' in data && typeof data.group !== 'string' && data.group !== undefined) {
|
|
12
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigExperiment: group is not a string or undefined', undefined, {
|
|
13
|
+
data,
|
|
14
|
+
});
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
if ('group_name' in data &&
|
|
18
|
+
typeof data.group_name !== 'string' &&
|
|
19
|
+
data.group_name !== undefined) {
|
|
20
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigExperiment: group_name is not a string', undefined, {
|
|
21
|
+
data,
|
|
22
|
+
});
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
if ('name' in data && typeof data.name !== 'string' && data.name !== undefined) {
|
|
26
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigExperiment: name is not a string', undefined, {
|
|
27
|
+
data,
|
|
28
|
+
});
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
if ('rule_id' in data && typeof data.rule_id !== 'string' && data.rule_id !== undefined) {
|
|
32
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigExperiment: rule_id is not a string', undefined, {
|
|
33
|
+
data,
|
|
34
|
+
});
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if ('value' in data && typeof data.value !== 'object' && data.value !== undefined) {
|
|
38
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigExperiment: value is not an object', undefined, {
|
|
39
|
+
data,
|
|
40
|
+
});
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
};
|
|
45
|
+
const isApiOrgConfigFeatureGate = (data) => {
|
|
46
|
+
if (data == null || typeof data !== 'object') {
|
|
47
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigFeatureGate: data is not an object', undefined, {
|
|
48
|
+
data,
|
|
49
|
+
});
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
if ('name' in data && typeof data.name !== 'string' && data.name !== undefined) {
|
|
53
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigFeatureGate: name is not a string', undefined, {
|
|
54
|
+
data,
|
|
55
|
+
});
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if ('rule_id' in data && typeof data.rule_id !== 'string' && data.rule_id !== undefined) {
|
|
59
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigFeatureGate: rule_id is not a string', undefined, {
|
|
60
|
+
data,
|
|
61
|
+
});
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if ('value' in data && typeof data.value !== 'boolean' && data.value !== undefined) {
|
|
65
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigFeatureGate: value is not a boolean', undefined, {
|
|
66
|
+
data,
|
|
67
|
+
});
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
return true;
|
|
71
|
+
};
|
|
72
|
+
const isApiOrganization = (data) => {
|
|
73
|
+
if (data == null || typeof data !== 'object') {
|
|
74
|
+
Logger.logDebug('[spiffy-ai] isApiOrganization: data is not an object', undefined, {
|
|
75
|
+
data,
|
|
76
|
+
});
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
if (!('id' in data) || typeof data.id !== 'string') {
|
|
80
|
+
Logger.logDebug('[spiffy-ai] isApiOrganization: id is not a string', undefined, {
|
|
81
|
+
data,
|
|
82
|
+
});
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
if (!('display_name' in data) || typeof data.display_name !== 'string') {
|
|
86
|
+
Logger.logDebug('[spiffy-ai] isApiOrganization: display_name is not a string', undefined, {
|
|
87
|
+
data,
|
|
88
|
+
});
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
if (!('domain' in data) || typeof data.domain !== 'string') {
|
|
92
|
+
Logger.logDebug('[spiffy-ai] isApiOrganization: domain is not a string', undefined, {
|
|
93
|
+
data,
|
|
94
|
+
});
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
if (!('short_name' in data) || typeof data.short_name !== 'string') {
|
|
98
|
+
Logger.logDebug('[spiffy-ai] isApiOrganization: short_name is not a string', undefined, {
|
|
99
|
+
data,
|
|
100
|
+
});
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
if (!('status' in data) ||
|
|
104
|
+
!Object.values(OrganizationStatusEnum).includes(data.status)) {
|
|
105
|
+
Logger.logDebug('[spiffy-ai] isApiOrganization: status is not a valid OrganizationStatusEnum value', undefined, {
|
|
106
|
+
data,
|
|
107
|
+
});
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
if ('created_at' in data &&
|
|
111
|
+
!(data.created_at instanceof Date) &&
|
|
112
|
+
typeof data.created_at !== 'string' &&
|
|
113
|
+
data.created_at !== undefined) {
|
|
114
|
+
Logger.logDebug('[spiffy-ai] isApiOrganization: created_at is not a Date', undefined, {
|
|
115
|
+
data,
|
|
116
|
+
});
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
if ('updated_at' in data &&
|
|
120
|
+
!(data.updated_at instanceof Date) &&
|
|
121
|
+
typeof data.updated_at !== 'string' &&
|
|
122
|
+
data.updated_at !== undefined) {
|
|
123
|
+
Logger.logDebug('[spiffy-ai] isApiOrganization: updated_at is not a Date', undefined, {
|
|
124
|
+
data,
|
|
125
|
+
});
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
};
|
|
130
|
+
const isApiOrgConfigOrganizationSettings = (data) => {
|
|
131
|
+
if (data == null || typeof data !== 'object') {
|
|
132
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigOrganizationSettings: data is not an object', undefined, {
|
|
133
|
+
data,
|
|
134
|
+
});
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
if (!('org' in data) || !isApiOrganization(data.org)) {
|
|
138
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigOrganizationSettings: org is not an object', undefined, {
|
|
139
|
+
data,
|
|
140
|
+
});
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
// skip validation for 'settings' for now
|
|
144
|
+
return true;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
*
|
|
148
|
+
* @param data
|
|
149
|
+
* @returns
|
|
150
|
+
*/
|
|
151
|
+
export const isApiOrgConfigResults = (data) => {
|
|
152
|
+
if (data == null || typeof data !== 'object') {
|
|
153
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigResults: data is not an object', undefined, {
|
|
154
|
+
data,
|
|
155
|
+
});
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
if (!('configs' in data) ||
|
|
159
|
+
!Array.isArray(data.configs) ||
|
|
160
|
+
!data.configs.every((config) => isApiOrganizationConfig(config))) {
|
|
161
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigResults: configs is not an array', undefined, {
|
|
162
|
+
data,
|
|
163
|
+
});
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
if ('experiments' in data &&
|
|
167
|
+
data.experiments !== undefined &&
|
|
168
|
+
(!Array.isArray(data.experiments) ||
|
|
169
|
+
!data.experiments.every((exp) => isApiOrgConfigExperiment(exp)))) {
|
|
170
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigResults: experiments is not an array or contains invalid items', undefined, {
|
|
171
|
+
data,
|
|
172
|
+
});
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
if (!('gates' in data) ||
|
|
176
|
+
!Array.isArray(data.gates) ||
|
|
177
|
+
!data.gates.every((gate) => isApiOrgConfigFeatureGate(gate))) {
|
|
178
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigResults: gates is not an array or contains invalid items', undefined, {
|
|
179
|
+
data,
|
|
180
|
+
});
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
if (!('org' in data) || !isApiOrgConfigOrganizationSettings(data.org)) {
|
|
184
|
+
Logger.logDebug('[spiffy-ai] isApiOrgConfigResults: org is not an object or has invalid fields', undefined, { data });
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
return true;
|
|
188
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import Logger from 'src/application/logging/logger';
|
|
2
|
+
const isApiOrgAnalyticsConfigAmplitude = (data) => {
|
|
3
|
+
if (data == null || typeof data !== 'object') {
|
|
4
|
+
Logger.logDebug('[spiffy-ai] isApiOrgAnalyticsConfigAmplitude: data is not an object', data);
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
if (!('session_replay_enabled' in data) || typeof data.session_replay_enabled !== 'boolean') {
|
|
8
|
+
Logger.logDebug('[spiffy-ai] isApiOrgAnalyticsConfigAmplitude: session_replay_enabled is not a boolean', data);
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
if (!('session_replay_sample_rate' in data) ||
|
|
12
|
+
typeof data.session_replay_sample_rate !== 'number') {
|
|
13
|
+
Logger.logDebug('[spiffy-ai] isApiOrgAnalyticsConfigAmplitude: session_replay_sample_rate is not a number', data);
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
if (!('tracking_enabled' in data) || typeof data.tracking_enabled !== 'boolean') {
|
|
17
|
+
Logger.logDebug('[spiffy-ai] isApiOrgAnalyticsConfigAmplitude: tracking_enabled is not a boolean', data);
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return true;
|
|
21
|
+
};
|
|
22
|
+
const isApiOrgAnalyticsConfigCustomerService = (data) => {
|
|
23
|
+
if (data == null || typeof data !== 'object') {
|
|
24
|
+
Logger.logDebug('[spiffy-ai] isApiOrgAnalyticsConfigCustomerService: data is not an object', data);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (!('provider' in data) || typeof data.provider !== 'string') {
|
|
28
|
+
Logger.logDebug('[spiffy-ai] isApiOrgAnalyticsConfigCustomerService: provider is not a string', data);
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
};
|
|
33
|
+
const isApiOrgAnalyticsConfigGoogleAnalytics = (data) => {
|
|
34
|
+
if (data == null || typeof data !== 'object') {
|
|
35
|
+
Logger.logDebug('[spiffy-ai] isApiOrgAnalyticsConfigGoogleAnalytics: data is not an object', data);
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
if (!('measurement_id' in data) || typeof data.measurement_id !== 'string') {
|
|
39
|
+
Logger.logDebug('[spiffy-ai] isApiOrgAnalyticsConfigGoogleAnalytics: measurement_id is not a string', data);
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @param data
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
const isApiOrgAnalyticsConfig = (data) => {
|
|
50
|
+
if (data == null || typeof data !== 'object') {
|
|
51
|
+
Logger.logDebug('[spiffy-ai] isOrgAnalyticsConfig: data is not an object', data);
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
if ('amplitude' in data && !isApiOrgAnalyticsConfigAmplitude(data.amplitude)) {
|
|
55
|
+
Logger.logDebug('[spiffy-ai] isOrgAnalyticsConfig: amplitude is not an object', data);
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if ('customer_service' in data &&
|
|
59
|
+
!isApiOrgAnalyticsConfigCustomerService(data.customer_service)) {
|
|
60
|
+
Logger.logDebug('[spiffy-ai] isOrgAnalyticsConfig: customer_service is not an object', data);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
if ('google_analytics' in data &&
|
|
64
|
+
!isApiOrgAnalyticsConfigGoogleAnalytics(data.google_analytics)) {
|
|
65
|
+
Logger.logDebug('[spiffy-ai] isOrgAnalyticsConfig: google_analytics is not an object', data);
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @param data
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
75
|
+
export const isApiOrganizationConfig = (data) => {
|
|
76
|
+
if (data == null || typeof data !== 'object') {
|
|
77
|
+
Logger.logDebug('[spiffy-ai] isOrgConfig: data is not an object', data);
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
if (!('created_at' in data)) {
|
|
81
|
+
Logger.logDebug('[spiffy-ai] isOrgConfig: created_at is not defined', data);
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (!('namespace' in data) || typeof data.namespace !== 'string') {
|
|
85
|
+
Logger.logDebug('[spiffy-ai] isOrgConfig: namespace is not a string', data);
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
if (!('is_latest' in data) || typeof data.is_latest !== 'boolean') {
|
|
89
|
+
Logger.logDebug('[spiffy-ai] isOrgConfig: is_latest is not a boolean', data);
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
if (!('version' in data) || typeof data.version !== 'string') {
|
|
93
|
+
Logger.logDebug('[spiffy-ai] isOrgConfig: version is not a string', data);
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
if (!('updated_at' in data)) {
|
|
97
|
+
Logger.logDebug('[spiffy-ai] isOrgConfig: updated_at is not defined', data);
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
if (!('config' in data) ||
|
|
101
|
+
typeof data.config !== 'object' ||
|
|
102
|
+
!isApiOrgAnalyticsConfig(data.config)) {
|
|
103
|
+
Logger.logDebug('[spiffy-ai] isOrgConfig: config is not an object', data);
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
if ('organization_id' in data && typeof data.organization_id !== 'string') {
|
|
107
|
+
Logger.logDebug('[spiffy-ai] isOrgConfig: organization_id is not a string', data);
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
if ('id' in data && typeof data.id !== 'string') {
|
|
111
|
+
Logger.logDebug('[spiffy-ai] isOrgConfig: id is not a string', data);
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
return true;
|
|
115
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const isApiPDPAttributes = (data) => {
|
|
2
|
+
if (data == null || typeof data !== "object") {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
if (!("product_id" in data) || typeof data.product_id !== "string") {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
if ("parent_product_id" in data &&
|
|
9
|
+
typeof data.parent_product_id !== "string") {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
if ("url" in data && data.url != null && typeof data.url !== "string") {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PLPAttributeCategory, } from "@spiffy-ai/commerce-api-client";
|
|
2
|
+
export const isApiPLPIdAttribute = (data) => {
|
|
3
|
+
if (data == null || typeof data !== "object") {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
if (!("id" in data) || typeof data.id !== "string") {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return true;
|
|
10
|
+
};
|
|
11
|
+
export const isApiPLPEventAttributes = (data) => {
|
|
12
|
+
if (data == null || typeof data !== "object") {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (!("category" in data) ||
|
|
16
|
+
typeof data.category !== "string" ||
|
|
17
|
+
!Object.values(PLPAttributeCategory).includes(data.category)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (!("attributes" in data) ||
|
|
21
|
+
typeof data.attributes !== "object" ||
|
|
22
|
+
!isApiPLPIdAttribute(data.attributes)) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const isApiPageResponseAttributes = (obj) => {
|
|
2
|
+
if (obj == null || typeof obj !== 'object') {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
if ('title' in obj && obj.title != null && typeof obj.title !== 'string') {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
if ('description' in obj && typeof obj.description !== 'string') {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
if ('url' in obj && typeof obj.url !== 'string') {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return true;
|
|
15
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { hasPropertyOfType } from '../utils';
|
|
2
|
+
import Logger from 'src/application/logging/logger';
|
|
3
|
+
export const isApiProductResponseAttributes = (attributes) => {
|
|
4
|
+
if (attributes == null || typeof attributes !== 'object') {
|
|
5
|
+
Logger.logError('isApiProductResponseAttributes: attributes is null or not an object', undefined, {
|
|
6
|
+
attributes,
|
|
7
|
+
});
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
if (!hasPropertyOfType(attributes, 'description', 'string', true)) {
|
|
11
|
+
Logger.logError('isApiProductResponseAttributes: description is not a string', undefined, {
|
|
12
|
+
attributes,
|
|
13
|
+
});
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
if (!hasPropertyOfType(attributes, 'image_url', 'string', true)) {
|
|
17
|
+
Logger.logError('isApiProductResponseAttributes: image_url is not a string', undefined, {
|
|
18
|
+
attributes,
|
|
19
|
+
});
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (!hasPropertyOfType(attributes, 'title', 'string')) {
|
|
23
|
+
Logger.logError('isApiProductResponseAttributes: title is not a string', undefined, {
|
|
24
|
+
attributes,
|
|
25
|
+
});
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
if (!hasPropertyOfType(attributes, 'url', 'string')) {
|
|
29
|
+
Logger.logError('isApiProductResponseAttributes: url is not a string', undefined, {
|
|
30
|
+
attributes,
|
|
31
|
+
});
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (!hasPropertyOfType(attributes, 'original_price', 'number', true)) {
|
|
35
|
+
Logger.logError('isApiProductResponseAttributes: original_price is not a number', undefined, {
|
|
36
|
+
attributes,
|
|
37
|
+
});
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (!hasPropertyOfType(attributes, 'sale_price', 'number', true)) {
|
|
41
|
+
Logger.logError('isApiProductResponseAttributes: sale_price is not a number', undefined, {
|
|
42
|
+
attributes,
|
|
43
|
+
});
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (!hasPropertyOfType(attributes, 'average_rating', 'number', true)) {
|
|
47
|
+
Logger.logError('isApiProductResponseAttributes: average_rating is not a number', undefined, {
|
|
48
|
+
attributes,
|
|
49
|
+
});
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
if (!hasPropertyOfType(attributes, 'number_reviews', 'number', true)) {
|
|
53
|
+
Logger.logError('isApiProductResponseAttributes: number_reviews is not a number', undefined, {
|
|
54
|
+
attributes,
|
|
55
|
+
});
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if (!hasPropertyOfType(attributes, 'metadata', 'array', true)) {
|
|
59
|
+
Logger.logError('isApiProductResponseAttributes: metadata is not an array', undefined, {
|
|
60
|
+
attributes,
|
|
61
|
+
});
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const isApiProductSearchResponseAttributes = (attributes) => {
|
|
2
|
+
if (attributes == null || typeof attributes !== "object") {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
if ("generated_query" in attributes &&
|
|
6
|
+
typeof attributes.generated_query !== "string") {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if ("product_count" in attributes &&
|
|
10
|
+
attributes.product_count != null &&
|
|
11
|
+
typeof attributes.product_count !== "number") {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
return true;
|
|
15
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const isApiProductSearchFilterResponseAttributes = (attributes) => {
|
|
2
|
+
if (attributes == null || typeof attributes !== "object") {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
if ("filter_name" in attributes &&
|
|
6
|
+
typeof attributes.filter_name !== "string") {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return true;
|
|
10
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ResponseCategory } from "@spiffy-ai/commerce-api-client";
|
|
2
|
+
import Logger from "src/application/logging/logger";
|
|
3
|
+
import { hasPropertyOfType } from "../utils";
|
|
4
|
+
export const isApiResponse = (data) => {
|
|
5
|
+
if (data == null || typeof data !== "object") {
|
|
6
|
+
Logger.logError("isApiResponse: data is null or not an object", undefined, {
|
|
7
|
+
data,
|
|
8
|
+
});
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
if (!hasPropertyOfType(data, "id", "string")) {
|
|
12
|
+
Logger.logError("isApiResponse: id is not a string", undefined, { data });
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (!hasPropertyOfType(data, "category", "string") ||
|
|
16
|
+
!Object.values(ResponseCategory).includes(data.category)) {
|
|
17
|
+
Logger.logError("isApiResponse: category is not a string or not a valid response category", undefined, { data });
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (!hasPropertyOfType(data, "created_at", "string")) {
|
|
21
|
+
Logger.logError("isApiResponse: created_at is not a string", undefined, {
|
|
22
|
+
data,
|
|
23
|
+
});
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if (!hasPropertyOfType(data, "attributes", "object", true)) {
|
|
27
|
+
Logger.logError("isApiResponse: attributes is not an object", undefined, {
|
|
28
|
+
data,
|
|
29
|
+
});
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isApiReviewRichInformation } from './isApiReviewRichInformation';
|
|
2
|
+
export const isApiReviewResponseAttributes = (obj) => {
|
|
3
|
+
if (obj == null || typeof obj !== 'object') {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
if ('title' in obj && obj.title != null && typeof obj.title !== 'string') {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if ('review' in obj && typeof obj.review !== 'string') {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
if ('reviewer' in obj && typeof obj.reviewer !== 'string') {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if ('stars' in obj && typeof obj.stars !== 'number') {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if ('rich_information' in obj && !isApiReviewRichInformation(obj.rich_information)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const isApiReviewRichInformation = (richInfo) => {
|
|
2
|
+
if (richInfo == null || typeof richInfo !== 'object') {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
if ('cons' in richInfo &&
|
|
6
|
+
(!Array.isArray(richInfo.cons) || richInfo.cons.some((con) => typeof con !== 'string'))) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if ('pros' in richInfo &&
|
|
10
|
+
(!Array.isArray(richInfo.pros) || richInfo.pros.some((pro) => typeof pro !== 'string'))) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
if ('review_date' in richInfo && typeof richInfo.review_date !== 'string') {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
if ('reviewer_title' in richInfo && typeof richInfo.reviewer_title !== 'string') {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if ('product_familiarity' in richInfo && typeof richInfo.product_familiarity !== 'string') {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const isApiSearchAttributes = (data) => {
|
|
2
|
+
if (data == null || typeof data !== 'object') {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
if (!('search_term' in data) || typeof data.search_term !== 'string') {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
if ('selected_filters' in data && !Array.isArray(data.selected_filters)) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
if (!!data.search_term) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (!('search_results' in data) ||
|
|
15
|
+
!Array.isArray(data.search_results) ||
|
|
16
|
+
!data.search_results.every((v) => typeof v === 'string')) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SuggestionCategory, } from '@spiffy-ai/commerce-api-client';
|
|
2
|
+
export const isSuggestion = (data) => {
|
|
3
|
+
if (data == null || typeof data !== 'object') {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
if (!('id' in data) || typeof data.id !== 'string') {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (!('category' in data) ||
|
|
10
|
+
typeof data.category !== 'string' ||
|
|
11
|
+
!Object.values(SuggestionCategory).includes(data.category)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (!('created_at' in data) || typeof data.created_at !== 'string') {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
if (!('content' in data) || typeof data.content !== 'string') {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if ('is_answer' in data && data.is_answer != null && typeof data.is_answer !== 'boolean') {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UserEventCategory } from '@spiffy-ai/commerce-api-client';
|
|
2
|
+
export const isApiUserEvent = (data) => {
|
|
3
|
+
if (data == null || typeof data !== 'object') {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
if (!('event_id' in data) || typeof data.event_id !== 'string') {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
if (!('created_at' in data) || typeof data.created_at !== 'string') {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
if (!('category' in data) ||
|
|
13
|
+
typeof data.category !== 'string' ||
|
|
14
|
+
!Object.values(UserEventCategory).includes(data.category)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import Logger from 'src/application/logging/logger';
|
|
2
|
+
const REQUIRED_COLOR_FIELDS = [
|
|
3
|
+
'accent_primary',
|
|
4
|
+
'accent_secondary',
|
|
5
|
+
'background_dark',
|
|
6
|
+
'background_light',
|
|
7
|
+
'background_primary',
|
|
8
|
+
'background_saturated',
|
|
9
|
+
'background_secondary',
|
|
10
|
+
'background_secondary_dark',
|
|
11
|
+
'background_tertiary',
|
|
12
|
+
'border_dark',
|
|
13
|
+
'border_light',
|
|
14
|
+
'border_medium',
|
|
15
|
+
'border_outline',
|
|
16
|
+
'text_accent',
|
|
17
|
+
'text_light',
|
|
18
|
+
'text_link',
|
|
19
|
+
'text_primary',
|
|
20
|
+
'text_secondary',
|
|
21
|
+
];
|
|
22
|
+
export const isGraphQLColorsConfig = (data) => {
|
|
23
|
+
if (typeof data !== 'object' || data === null) {
|
|
24
|
+
Logger.logError('Invalid graphql response for colors config', undefined, { data });
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
// Check each required field
|
|
28
|
+
const missingFields = REQUIRED_COLOR_FIELDS.filter((field) => !(field in data) || typeof data[field] !== 'string');
|
|
29
|
+
if (missingFields.length === REQUIRED_COLOR_FIELDS.length) {
|
|
30
|
+
Logger.logError('All color fields are missing or null', undefined);
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (missingFields.length > 0) {
|
|
34
|
+
Logger.logError('Missing or invalid color fields', undefined, {
|
|
35
|
+
data,
|
|
36
|
+
missingFields,
|
|
37
|
+
});
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
};
|