text: (window.webpackJsonp=window.webpackJsonp||[]).push([[729],{1499:function(A,n){throw new Error("Module parse failed: Unexpected token (1:10)\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders\n> {\"version\":3,\"file\":\"wiring.js\",\"sources\":[\"../../../../src/x-modules/tagging/wiring.ts\"],\"sourcesContent\":[\"import { Result, TaggingInfo } from '@empathyco/x-types';\\nimport {\\n  namespacedWireCommit,\\n  namespacedWireDispatch\\n} from '../../wiring/namespaced-wires.factory';\\nimport { namespacedDebounce } from '../../wiring/namespaced-wires.operators';\\nimport { wireServiceWithoutPayload } from '../../wiring/wires.factory';\\nimport { filter } from '../../wiring/wires.operators';\\nimport { Wire } from '../../wiring/wiring.types';\\nimport { createWiring } from '../../wiring/wiring.utils';\\nimport { DefaultSessionService } from './service/session.service';\\n\\n/**\\n * `tagging` {@link XModuleName | XModule name}.\\n *\\n * @internal\\n */\\nconst moduleName = 'tagging';\\n\\n/**\\n * Debounce function for the module.\\n */\\nconst moduleDebounce = namespacedDebounce(moduleName);\\n\\n/**\\n * WireCommit for {@link TaggingXModule}.\\n *\\n * @internal\\n */\\nconst wireCommit = namespacedWireCommit(moduleName);\\n\\n/**\\n * WireDispatch for {@link TaggingXModule}.\\n *\\n * @internal\\n */\\nconst wireDispatch = namespacedWireDispatch(moduleName);\\n\\n/**\\n * Wires without payload factory for {@link DefaultSessionService}.\\n */\\nconst wireSessionServiceWithoutPayload = wireServiceWithoutPayload(DefaultSessionService.instance);\\n\\n/**\\n * Clears the session id.\\n *\\n * @public\\n */\\nconst clearSessionWire = filter(\\n  wireSessionServiceWithoutPayload('clearSessionId'),\\n  ({ eventPayload: consent }) => !consent\\n);\\n\\n/**\\n * Sets the tagging state `consent`.\\n *\\n * @public\\n */\\nexport const setConsent = wireCommit('setConsent');\\n\\n/**\\n * Sets the tagging state config `queryTaggingDebounceMs`.\\n *\\n * @public\\n */\\nexport const setQueryTaggingDebounce = wireCommit('setQueryTaggingDebounce');\\n\\n/**\\n * Sets the tagging state `sessionTTLMs`.\\n *\\n * @public\\n */\\nexport const setSessionDuration = wireCommit('setSessionDuration');\\n\\n/**\\n * Tracks the tagging of the query.\\n *\\n * @public\\n */\\nexport const trackQueryWire = wireDispatch('track');\\n\\n/**\\n * Sets the tagging state of the query tagging info using a debounce which ends if the user\\n * accepts a query.\\n *\\n * @public\\n */\\nexport const setQueryTaggingInfo = moduleDebounce(\\n  wireCommit('setQueryTaggingInfo'),\\n  ({ state }) => state.config.queryTaggingDebounceMs,\\n  {\\n    cancelOn: 'UserClearedQuery',\\n    forceOn: [\\n      'UserClickedAResult',\\n      'UserClickedAPromoted',\\n      'UserClickedABanner',\\n      'UserClickedARedirection',\\n      'UserReachedResultsListEnd'\\n    ]\\n  }\\n);\\n\\n/**\\n * Tracks the tagging of the result.\\n *\\n * @public\\n */\\nexport const trackResultClickedWire = createTrackResultWire('click');\\n\\n/**\\n * Performs a track of a result added to the cart.\\n *\\n * @public\\n */\\nexport const trackAddToCartWire = createTrackResultWire('add2cart');\\n\\n/**\\n * Factory helper to create a wire for the track of a result.\\n *\\n * @param property - Key of the tagging object to track.\\n * @returns A new wire for the given property of the result tagging.\\n *\\n * @internal\\n */\\nfunction createTrackResultWire(property: keyof Result['tagging']): Wire<Result> {\\n  return filter(\\n    wireDispatch('track', ({ eventPayload: { tagging }, metadata: { location } }) => {\\n      const taggingInfo: TaggingInfo = tagging[property];\\n      taggingInfo.params.location = location as string;\\n      return taggingInfo;\\n    }),\\n    ({ eventPayload: { tagging } }) => !!tagging?.[property]\\n  );\\n}\\n\\n/**\\n * Wiring configuration for the {@link TaggingXModule | tagging module}.\\n *\\n * @internal\\n */\\nexport const taggingWiring = createWiring({\\n  ConsentProvided: {\\n    setConsent\\n  },\\n  ConsentChanged: {\\n    clearSessionWire\\n  },\\n  QueryTaggingDebounceProvided: {\\n    setQueryTaggingDebounce\\n  },\\n  SearchTaggingChanged: {\\n    setQueryTaggingInfo\\n  },\\n  SearchTaggingReceived: {\\n    trackQueryWire\\n  },\\n  SessionDurationProvided: {\\n    setSessionDuration\\n  },\\n  UserClickedAResult: {\\n    trackResultClickedWire\\n  },\\n  UserClickedResultAddToCart: {\\n    trackAddToCartWire\\n  }\\n});\\n\"],\"names\":[],\"mappings\":\";;;;;;;AAYA;;;;;AAKA,IAAM,UAAU,GAAG,SAAS,CAAC;AAE7B;;;AAGA,IAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;AAEtD;;;;;AAKA,IAAM,UAAU,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;AAEpD;;;;;AAKA,IAAM,YAAY,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;AAExD;;;AAGA,IAAM,gCAAgC,GAAG,yBAAyB,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AAEnG;;;;;AAKA,IAAM,gBAAgB,GAAG,MAAM,CAC7B,gCAAgC,CAAC,gBAAgB,CAAC,EAClD,UAAC,EAAyB;QAAT,OAAO,kBAAA;IAAO,OAAA,CAAC,OAAO;AAAR,CAAQ,CACxC,CAAC;AAEF;;;;;IAKa,UAAU,GAAG,UAAU,CAAC,YAAY,EAAE;AAEnD;;;;;IAKa,uBAAuB,GAAG,UAAU,CAAC,yBAAyB,EAAE;AAE7E;;;;;IAKa,kBAAkB,GAAG,UAAU,CAAC,oBAAoB,EAAE;AAEnE;;;;;IAKa,cAAc,GAAG,YAAY,CAAC,OAAO,EAAE;AAEpD;;;;;;IAMa,mBAAmB,GAAG,cAAc,CAC/C,UAAU,CAAC,qBAAqB,CAAC,EACjC,UAAC,EAAS;QAAP,KAAK,WAAA;IAAO,OAAA,KAAK,CAAC,MAAM,CAAC,sBAAsB;AAAnC,CAAmC,EAClD;IACE,QAAQ,EAAE,kBAAkB;IAC5B,OAAO,EAAE;QACP,oBAAoB;QACpB,sBAAsB;QACtB,oBAAoB;QACpB,yBAAyB;QACzB,2BAA2B;KAC5B;CACF,EACD;AAEF;;;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