From d52e0dc376c6be09e3f9ef42bacc1c0b2372cff4 Mon Sep 17 00:00:00 2001 From: Diego Pascual Date: Mon, 11 Mar 2024 18:11:30 +0100 Subject: [PATCH] refactor: rename hasSemantics state --- .../src/x-modules/tagging/store/module.ts | 6 +++--- .../x-components/src/x-modules/tagging/store/types.ts | 6 +++--- packages/x-components/src/x-modules/tagging/wiring.ts | 11 +++++++---- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/x-components/src/x-modules/tagging/store/module.ts b/packages/x-components/src/x-modules/tagging/store/module.ts index 9846232ae9..9a77e2c980 100644 --- a/packages/x-components/src/x-modules/tagging/store/module.ts +++ b/packages/x-components/src/x-modules/tagging/store/module.ts @@ -17,7 +17,7 @@ export const taggingXStoreModule: TaggingXStoreModule = { clickedResultStorageTTLMs: null }, consent: null, - hasSemantics: false, + semanticQueriesModuleRegistered: false, queryTaggingInfo: null }), getters: {}, @@ -28,9 +28,9 @@ export const taggingXStoreModule: TaggingXStoreModule = { setQueryTaggingInfo(state, queryTaggingInfo: TaggingRequest) { state.queryTaggingInfo = queryTaggingInfo; }, - setHasSemantics(state, module) { + setSemanticQueriesModuleRegistered(state, module) { if (module === 'semanticQueries') { - state.hasSemantics = true; + state.semanticQueriesModuleRegistered = true; } }, setConfig, diff --git a/packages/x-components/src/x-modules/tagging/store/types.ts b/packages/x-components/src/x-modules/tagging/store/types.ts index 41087ad430..9faf7ec91e 100644 --- a/packages/x-components/src/x-modules/tagging/store/types.ts +++ b/packages/x-components/src/x-modules/tagging/store/types.ts @@ -16,7 +16,7 @@ export interface TaggingState { /** * Value to know if Semantics module is register. */ - hasSemantics: boolean; + semanticQueriesModuleRegistered: boolean; /** * Configuration for the `Tagging` module. */ @@ -53,11 +53,11 @@ export interface TaggingMutations extends ConfigMutations { */ setQueryTaggingInfo(queryTaggingInfo: TaggingRequest): void; /** - * Sets the hasSemantics property. + * Sets the semanticQueriesModuleRegistered property. * * @param module - The name of the register module. */ - setHasSemantics(module: XModuleName): void; + setSemanticQueriesModuleRegistered(module: XModuleName): void; } /** diff --git a/packages/x-components/src/x-modules/tagging/wiring.ts b/packages/x-components/src/x-modules/tagging/wiring.ts index 59d457581e..09ed74d0e4 100644 --- a/packages/x-components/src/x-modules/tagging/wiring.ts +++ b/packages/x-components/src/x-modules/tagging/wiring.ts @@ -93,11 +93,13 @@ const clearSessionWire = filter( export const setConsent = wireCommit('setConsent'); /** - * Sets the tagging state `hasSemantics`. + * Sets the tagging state `semanticQueriesModuleRegistered`. * * @public */ -export const setHasSemantics = wireCommit('setHasSemantics'); +export const setSemanticQueriesModuleRegisteredWire = wireCommit( + 'setSemanticQueriesModuleRegistered' +); /** * Sets the tagging config state. @@ -114,7 +116,8 @@ export const setTaggingConfig = wireCommit('mergeConfig'); export const trackQueryWire = filter( wireDispatch('track'), ({ eventPayload, store }) => - (eventPayload as TaggingRequest).params.totalHits > 0 || !store.state.x.tagging.hasSemantics + (eventPayload as TaggingRequest).params.totalHits > 0 || + !store.state.x.tagging.semanticQueriesModuleRegistered ); /** @@ -325,6 +328,6 @@ export const taggingWiring = createWiring({ trackNoResultsQueryWithSemanticsWireDebounced }, ModuleRegistered: { - setHasSemantics + setSemanticQueriesModuleRegisteredWire } });