@blaze-cms/plugin-gtm-fe 0.125.0-f-admin-updates.0 → 0.125.0

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +57 -1
  2. package/lib/GoogleTagManager/GTMFactory.js +13 -38
  3. package/lib/GoogleTagManager/GTMFactory.js.map +1 -1
  4. package/lib/GoogleTagManager/GTMRender.js +26 -60
  5. package/lib/GoogleTagManager/GTMRender.js.map +1 -1
  6. package/lib/GoogleTagManager/index.js +0 -4
  7. package/lib/GoogleTagManager/index.js.map +1 -1
  8. package/lib/GoogleTagManagerEvent/GTMClickEvent.js +13 -42
  9. package/lib/GoogleTagManagerEvent/GTMClickEvent.js.map +1 -1
  10. package/lib/GoogleTagManagerEvent/GTMClickEvents.js +2 -12
  11. package/lib/GoogleTagManagerEvent/GTMClickEvents.js.map +1 -1
  12. package/lib/GoogleTagManagerEvent/GTMEvent.js +6 -29
  13. package/lib/GoogleTagManagerEvent/GTMEvent.js.map +1 -1
  14. package/lib/GoogleTagManagerEvent/GTMEventFactory.js +18 -53
  15. package/lib/GoogleTagManagerEvent/GTMEventFactory.js.map +1 -1
  16. package/lib/GoogleTagManagerEvent/GTMEventRender.js +24 -70
  17. package/lib/GoogleTagManagerEvent/GTMEventRender.js.map +1 -1
  18. package/lib/GoogleTagManagerEvent/GTMEventSwitch.js +5 -19
  19. package/lib/GoogleTagManagerEvent/GTMEventSwitch.js.map +1 -1
  20. package/lib/GoogleTagManagerEvent/index.js +0 -4
  21. package/lib/GoogleTagManagerEvent/index.js.map +1 -1
  22. package/lib/constants.js +0 -1
  23. package/lib/constants.js.map +1 -1
  24. package/lib/helpers/build-and-push-web-vitals.js +2 -10
  25. package/lib/helpers/build-and-push-web-vitals.js.map +1 -1
  26. package/lib/helpers/build-data-layer.js +6 -41
  27. package/lib/helpers/build-data-layer.js.map +1 -1
  28. package/lib/helpers/build-nested-event.js +3 -30
  29. package/lib/helpers/build-nested-event.js.map +1 -1
  30. package/lib/helpers/build-props-to-display-array.js +0 -6
  31. package/lib/helpers/build-props-to-display-array.js.map +1 -1
  32. package/lib/helpers/build-user-layer.js +5 -29
  33. package/lib/helpers/build-user-layer.js.map +1 -1
  34. package/lib/helpers/build-user-query-props.js +4 -23
  35. package/lib/helpers/build-user-query-props.js.map +1 -1
  36. package/lib/helpers/filter-gtm-events.js +0 -7
  37. package/lib/helpers/filter-gtm-events.js.map +1 -1
  38. package/lib/helpers/get-ids-to-use.js +0 -4
  39. package/lib/helpers/get-ids-to-use.js.map +1 -1
  40. package/lib/helpers/get-render-props.js +4 -8
  41. package/lib/helpers/get-render-props.js.map +1 -1
  42. package/lib/helpers/index.js +0 -12
  43. package/lib/helpers/index.js.map +1 -1
  44. package/lib/helpers/push-to-data-layer.js +0 -5
  45. package/lib/helpers/push-to-data-layer.js.map +1 -1
  46. package/lib/helpers/reset-data-layer.js +0 -12
  47. package/lib/helpers/reset-data-layer.js.map +1 -1
  48. package/lib/index.js +2 -23
  49. package/lib/index.js.map +1 -1
  50. package/lib-es/GoogleTagManager/GTMFactory.js +0 -2
  51. package/lib-es/GoogleTagManager/GTMFactory.js.map +1 -1
  52. package/lib-es/GoogleTagManager/GTMRender.js +0 -7
  53. package/lib-es/GoogleTagManager/GTMRender.js.map +1 -1
  54. package/lib-es/GoogleTagManager/index.js.map +1 -1
  55. package/lib-es/GoogleTagManagerEvent/GTMClickEvent.js +0 -7
  56. package/lib-es/GoogleTagManagerEvent/GTMClickEvent.js.map +1 -1
  57. package/lib-es/GoogleTagManagerEvent/GTMClickEvents.js +0 -2
  58. package/lib-es/GoogleTagManagerEvent/GTMClickEvents.js.map +1 -1
  59. package/lib-es/GoogleTagManagerEvent/GTMEvent.js +0 -4
  60. package/lib-es/GoogleTagManagerEvent/GTMEvent.js.map +1 -1
  61. package/lib-es/GoogleTagManagerEvent/GTMEventFactory.js +3 -6
  62. package/lib-es/GoogleTagManagerEvent/GTMEventFactory.js.map +1 -1
  63. package/lib-es/GoogleTagManagerEvent/GTMEventRender.js +9 -19
  64. package/lib-es/GoogleTagManagerEvent/GTMEventRender.js.map +1 -1
  65. package/lib-es/GoogleTagManagerEvent/GTMEventSwitch.js +5 -8
  66. package/lib-es/GoogleTagManagerEvent/GTMEventSwitch.js.map +1 -1
  67. package/lib-es/GoogleTagManagerEvent/index.js.map +1 -1
  68. package/lib-es/constants.js.map +1 -1
  69. package/lib-es/helpers/build-and-push-web-vitals.js +0 -3
  70. package/lib-es/helpers/build-and-push-web-vitals.js.map +1 -1
  71. package/lib-es/helpers/build-data-layer.js +0 -11
  72. package/lib-es/helpers/build-data-layer.js.map +1 -1
  73. package/lib-es/helpers/build-nested-event.js +0 -9
  74. package/lib-es/helpers/build-nested-event.js.map +1 -1
  75. package/lib-es/helpers/build-props-to-display-array.js +0 -1
  76. package/lib-es/helpers/build-props-to-display-array.js.map +1 -1
  77. package/lib-es/helpers/build-user-layer.js +0 -9
  78. package/lib-es/helpers/build-user-layer.js.map +1 -1
  79. package/lib-es/helpers/build-user-query-props.js +0 -2
  80. package/lib-es/helpers/build-user-query-props.js.map +1 -1
  81. package/lib-es/helpers/filter-gtm-events.js +0 -2
  82. package/lib-es/helpers/filter-gtm-events.js.map +1 -1
  83. package/lib-es/helpers/get-ids-to-use.js +0 -1
  84. package/lib-es/helpers/get-ids-to-use.js.map +1 -1
  85. package/lib-es/helpers/get-render-props.js +0 -2
  86. package/lib-es/helpers/get-render-props.js.map +1 -1
  87. package/lib-es/helpers/index.js.map +1 -1
  88. package/lib-es/helpers/push-to-data-layer.js +0 -2
  89. package/lib-es/helpers/push-to-data-layer.js.map +1 -1
  90. package/lib-es/helpers/reset-data-layer.js +0 -3
  91. package/lib-es/helpers/reset-data-layer.js.map +1 -1
  92. package/lib-es/index.js +2 -6
  93. package/lib-es/index.js.map +1 -1
  94. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"GTMEventFactory.js","names":["React","useContext","PropTypes","useQuery","getSingleEntitySchema","buildPropsQuery","MainContext","GTMEventRender","getRenderProps","getIdsToUse","buildPropsToDisplayArray","GTM_EVENT_FACTORY","GTMEventFactory","parent","gtmEvents","parentData","clickId","parentComponent","isPreview","itemEntity","data","error","loading","variables","id","map","i","propsToDisplay","eventProps","hasNoPropsToDisplay","length","propsToDisplayArr","extraProps","shouldUseParentData","itemIdToUse","itemId","shouldUseMultiQuery","Array","isArray","action","actionKey","dynamicKey","queryVariables","where","_in","skip","propTypes","object","isRequired","string","array","oneOfType","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMEventFactory.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { getSingleEntitySchema, buildPropsQuery } from '@blaze-cms/react-page-builder';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport GTMEventRender from './GTMEventRender';\nimport { getRenderProps, getIdsToUse, buildPropsToDisplayArray } from '../helpers';\nimport { GTM_EVENT_FACTORY } from '../constants';\n\nconst GTMEventFactory = ({ parent, gtmEvents, parentData, clickId, parentComponent }) => {\n const { isPreview } = useContext(MainContext);\n const [{ itemEntity = parent.itemEntity } = {}] = parentData || [];\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: itemEntity }\n });\n\n if (loading || error || !data) return null;\n\n return gtmEvents.map(({ propsToDisplay, ...eventProps }, i) => {\n const hasNoPropsToDisplay = !propsToDisplay || !propsToDisplay.length;\n const propsToDisplayArr = buildPropsToDisplayArray(propsToDisplay);\n const extraProps = hasNoPropsToDisplay ? '' : buildPropsQuery(data, propsToDisplayArr);\n const shouldUseParentData = !clickId && parentData && parentData.length;\n const itemIdToUse = clickId || parent.itemId;\n const itemId = shouldUseParentData ? getIdsToUse(parentData) : itemIdToUse;\n const shouldUseMultiQuery = Array.isArray(itemId);\n const { action, actionKey } = getRenderProps(extraProps, isPreview, data, shouldUseMultiQuery);\n const dynamicKey = `${GTM_EVENT_FACTORY}${i}`;\n const queryVariables = shouldUseMultiQuery\n ? {\n variables: { where: { id: { _in: itemId } } },\n skip: hasNoPropsToDisplay\n }\n : {\n variables: { id: itemId },\n skip: hasNoPropsToDisplay\n };\n\n return (\n <GTMEventRender\n key={dynamicKey}\n action={action}\n actionKey={actionKey}\n propsToDisplay={propsToDisplay}\n id={itemId}\n queryVariables={queryVariables}\n parentComponent={parentComponent}\n {...eventProps}\n />\n );\n });\n};\n\nGTMEventFactory.propTypes = {\n parent: PropTypes.object.isRequired,\n clickId: PropTypes.string,\n gtmEvents: PropTypes.array,\n parentData: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\n parentComponent: PropTypes.object\n};\n\nGTMEventFactory.defaultProps = {\n clickId: null,\n gtmEvents: [],\n parentData: null,\n parentComponent: {}\n};\n\nexport default GTMEventFactory;\n"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,QAAT,QAAyB,gBAAzB;AACA,SAASC,qBAAT,EAAgCC,eAAhC,QAAuD,+BAAvD;AACA,SAASC,WAAT,QAA4B,8BAA5B;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,SAASC,cAAT,EAAyBC,WAAzB,EAAsCC,wBAAtC,QAAsE,YAAtE;AACA,SAASC,iBAAT,QAAkC,cAAlC;;AAEA,MAAMC,eAAe,GAAG,CAAC;EAAEC,MAAF;EAAUC,SAAV;EAAqBC,UAArB;EAAiCC,OAAjC;EAA0CC;AAA1C,CAAD,KAAiE;EACvF,MAAM;IAAEC;EAAF,IAAgBjB,UAAU,CAACK,WAAD,CAAhC;EACA,MAAM,CAAC;IAAEa,UAAU,GAAGN,MAAM,CAACM;EAAtB,IAAqC,EAAtC,IAA4CJ,UAAU,IAAI,EAAhE;EACA,MAAM;IAAEK,IAAF;IAAQC,KAAR;IAAeC;EAAf,IAA2BnB,QAAQ,CAACC,qBAAD,EAAwB;IAC/DmB,SAAS,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AG,EAAEY,UADP;MAEE,MAAM,EAAEF,MAFV;MAGE,SAAS,EAAEC,SAHb;MAIE,cAAc,EAAEb,cAJlB;MAKE,EAAE,EAAEQ,MALN;MAME,cAAc,EAAEO,cANlB;MAOE,eAAe,EAAEzB;IAPnB,GAQMW,UARN,EADF;EAYD,CAhCM,CAAP;AAiCD,CA1CD;;AA4CAhB,eAAe,CAACkC,SAAhB,GAA4B;EAC1BjC,MAAM,EAAEX,SAAS,CAAC6C,MAAV,CAAiBC,UADC;EAE1BhC,OAAO,EAAEd,SAAS,CAAC+C,MAFO;EAG1BnC,SAAS,EAAEZ,SAAS,CAACgD,KAHK;EAI1BnC,UAAU,EAAEb,SAAS,CAACiD,SAAV,CAAoB,CAACjD,SAAS,CAAC6C,MAAX,EAAmB7C,SAAS,CAACgD,KAA7B,CAApB,CAJc;EAK1BjC,eAAe,EAAEf,SAAS,CAAC6C;AALD,CAA5B;AAQAnC,eAAe,CAACwC,YAAhB,GAA+B;EAC7BpC,OAAO,EAAE,IADoB;EAE7BF,SAAS,EAAE,EAFkB;EAG7BC,UAAU,EAAE,IAHiB;EAI7BE,eAAe,EAAE;AAJY,CAA/B;AAOA,eAAeL,eAAf"}
1
+ {"version":3,"file":"GTMEventFactory.js","names":["React","useContext","PropTypes","useQuery","getSingleEntitySchema","buildPropsQuery","MainContext","GTMEventRender","getRenderProps","getIdsToUse","buildPropsToDisplayArray","GTM_EVENT_FACTORY","GTMEventFactory","parent","gtmEvents","parentData","clickId","parentComponent","isPreview","itemEntity","data","error","loading","variables","id","map","i","propsToDisplay","eventProps","hasNoPropsToDisplay","length","propsToDisplayArr","extraProps","shouldUseParentData","itemIdToUse","itemId","shouldUseMultiQuery","Array","isArray","action","actionKey","dynamicKey","queryVariables","where","_in","skip","propTypes","object","isRequired","string","array","oneOfType","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMEventFactory.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { getSingleEntitySchema, buildPropsQuery } from '@blaze-cms/react-page-builder';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport GTMEventRender from './GTMEventRender';\nimport { getRenderProps, getIdsToUse, buildPropsToDisplayArray } from '../helpers';\nimport { GTM_EVENT_FACTORY } from '../constants';\n\nconst GTMEventFactory = ({ parent, gtmEvents, parentData, clickId, parentComponent }) => {\n const { isPreview } = useContext(MainContext);\n const [{ itemEntity = parent.itemEntity } = {}] = parentData || [];\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: itemEntity }\n });\n\n if (loading || error || !data) return null;\n\n return gtmEvents.map(({ propsToDisplay, ...eventProps }, i) => {\n const hasNoPropsToDisplay = !propsToDisplay || !propsToDisplay.length;\n const propsToDisplayArr = buildPropsToDisplayArray(propsToDisplay);\n const extraProps = hasNoPropsToDisplay ? '' : buildPropsQuery(data, propsToDisplayArr);\n const shouldUseParentData = !clickId && parentData && parentData.length;\n const itemIdToUse = clickId || parent.itemId;\n const itemId = shouldUseParentData ? getIdsToUse(parentData) : itemIdToUse;\n const shouldUseMultiQuery = Array.isArray(itemId);\n const { action, actionKey } = getRenderProps(extraProps, isPreview, data, shouldUseMultiQuery);\n const dynamicKey = `${GTM_EVENT_FACTORY}${i}`;\n const queryVariables = shouldUseMultiQuery\n ? {\n variables: { where: { id: { _in: itemId } } },\n skip: hasNoPropsToDisplay\n }\n : {\n variables: { id: itemId },\n skip: hasNoPropsToDisplay\n };\n\n return (\n <GTMEventRender\n key={dynamicKey}\n action={action}\n actionKey={actionKey}\n propsToDisplay={propsToDisplay}\n id={itemId}\n queryVariables={queryVariables}\n parentComponent={parentComponent}\n {...eventProps}\n />\n );\n });\n};\n\nGTMEventFactory.propTypes = {\n parent: PropTypes.object.isRequired,\n clickId: PropTypes.string,\n gtmEvents: PropTypes.array,\n parentData: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\n parentComponent: PropTypes.object\n};\n\nGTMEventFactory.defaultProps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AC,CAACjD,SAAS,CAAC6C,MAAM,EAAE7C,SAAS,CAACgD,KAAK,CAAC,CAAC;EACpEjC,eAAe,EAAEf,SAAS,CAAC6C;AAC7B,CAAC;AAEDnC,eAAe,CAACwC,YAAY,GAAG;EAC7BpC,OAAO,EAAE,IAAI;EACbF,SAAS,EAAE,EAAE;EACbC,UAAU,EAAE,IAAI;EAChBE,eAAe,EAAE,CAAC;AACpB,CAAC;AAED,eAAeL,eAAe"}
@@ -1,11 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  const _excluded = ["router", "action", "actionKey", "queryVariables", "parentComponent", "userPropsToDisplay", "handleOnSuccess"];
4
-
5
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6
-
7
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
-
9
6
  import React, { useState } from 'react';
10
7
  import PropTypes from 'prop-types';
11
8
  import { useQuery } from '@apollo/client';
@@ -14,19 +11,17 @@ import { getUser } from '@blaze-cms/react-page-builder';
14
11
  import { withRouter } from 'next/router';
15
12
  import GTMEvent from './GTMEvent';
16
13
  import { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';
17
-
18
14
  const GTMEventRender = _ref => {
19
15
  let {
20
- router,
21
- action,
22
- actionKey,
23
- queryVariables,
24
- parentComponent,
25
- userPropsToDisplay,
26
- handleOnSuccess
27
- } = _ref,
28
- eventProps = _objectWithoutProperties(_ref, _excluded);
29
-
16
+ router,
17
+ action,
18
+ actionKey,
19
+ queryVariables,
20
+ parentComponent,
21
+ userPropsToDisplay,
22
+ handleOnSuccess
23
+ } = _ref,
24
+ eventProps = _objectWithoutProperties(_ref, _excluded);
30
25
  const {
31
26
  asPath
32
27
  } = router;
@@ -52,12 +47,10 @@ const GTMEventRender = _ref => {
52
47
  });
53
48
  if (loading || userLoading || error) return null;
54
49
  const gtmData = data.entityData || data[actionKey];
55
-
56
50
  if (currentLocation !== asPath) {
57
51
  setCurrentLocation(asPath);
58
52
  return null;
59
53
  }
60
-
61
54
  const {
62
55
  eventTrigger,
63
56
  propsToDisplay,
@@ -66,9 +59,7 @@ const GTMEventRender = _ref => {
66
59
  const dataLayerProps = buildDataLayer(gtmData, propsToDisplay);
67
60
  const dataLayerObject = buildNestedEvent(eventEcommerce, eventProps, dataLayerProps, parentComponent);
68
61
  const userLayerObject = buildUserLayer(userData, userPropsToDisplay);
69
-
70
62
  const extendedDataLayer = _objectSpread(_objectSpread({}, dataLayerObject), userLayerObject);
71
-
72
63
  return /*#__PURE__*/React.createElement(GTMEvent, {
73
64
  dataLayerObject: extendedDataLayer,
74
65
  eventTrigger: eventTrigger,
@@ -76,7 +67,6 @@ const GTMEventRender = _ref => {
76
67
  handleOnSuccess: handleOnSuccess
77
68
  });
78
69
  };
79
-
80
70
  GTMEventRender.propTypes = {
81
71
  userPropsToDisplay: PropTypes.array,
82
72
  router: PropTypes.object.isRequired,
@@ -1 +1 @@
1
- {"version":3,"file":"GTMEventRender.js","names":["React","useState","PropTypes","useQuery","checkIfLoggedIn","getUser","withRouter","GTMEvent","buildDataLayer","buildNestedEvent","buildUserQueryProps","buildUserLayer","GTMEventRender","router","action","actionKey","queryVariables","parentComponent","userPropsToDisplay","handleOnSuccess","eventProps","asPath","currentLocation","setCurrentLocation","data","error","loading","id","userId","hasUserProps","length","userProps","userData","userLoading","variables","skip","gtmData","entityData","eventTrigger","propsToDisplay","eventEcommerce","dataLayerProps","dataLayerObject","userLayerObject","extendedDataLayer","propTypes","array","object","isRequired","string","func","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMEventRender.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport { getUser } from '@blaze-cms/react-page-builder';\nimport { withRouter } from 'next/router';\nimport GTMEvent from './GTMEvent';\nimport { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';\n\nconst GTMEventRender = ({\n router,\n action,\n actionKey,\n queryVariables,\n parentComponent,\n userPropsToDisplay,\n handleOnSuccess,\n ...eventProps\n}) => {\n const { asPath } = router;\n const [currentLocation, setCurrentLocation] = useState('');\n const { data = {}, error, loading } = useQuery(action, queryVariables);\n const { id: userId } = checkIfLoggedIn();\n const hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;\n const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';\n const { data: userData, loading: userLoading } = useQuery(getUser(userProps), {\n variables: { id: userId },\n skip: !hasUserProps\n });\n\n if (loading || userLoading || error) return null;\n const gtmData = data.entityData || data[actionKey];\n\n if (currentLocation !== asPath) {\n setCurrentLocation(asPath);\n return null;\n }\n\n const { eventTrigger, propsToDisplay, eventEcommerce } = eventProps;\n const dataLayerProps = buildDataLayer(gtmData, propsToDisplay);\n\n const dataLayerObject = buildNestedEvent(\n eventEcommerce,\n eventProps,\n dataLayerProps,\n parentComponent\n );\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n return (\n <GTMEvent\n dataLayerObject={extendedDataLayer}\n eventTrigger={eventTrigger}\n currentLocation={currentLocation}\n handleOnSuccess={handleOnSuccess}\n />\n );\n};\n\nGTMEventRender.propTypes = {\n userPropsToDisplay: PropTypes.array,\n router: PropTypes.object.isRequired,\n action: PropTypes.object.isRequired,\n actionKey: PropTypes.string.isRequired,\n queryVariables: PropTypes.object.isRequired,\n parentComponent: PropTypes.object.isRequired,\n handleOnSuccess: PropTypes.func\n};\n\nGTMEventRender.defaultProps = {\n userPropsToDisplay: [],\n handleOnSuccess: () => {}\n};\n\nGTMEventRender.defaultProps = {\n userPropsToDisplay: []\n};\n\nexport default withRouter(GTMEventRender);\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAAgC,OAAhC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,QAAT,QAAyB,gBAAzB;AACA,SAASC,eAAT,QAAgC,yBAAhC;AACA,SAASC,OAAT,QAAwB,+BAAxB;AACA,SAASC,UAAT,QAA2B,aAA3B;AACA,OAAOC,QAAP,MAAqB,YAArB;AACA,SAASC,cAAT,EAAyBC,gBAAzB,EAA2CC,mBAA3C,EAAgEC,cAAhE,QAAsF,YAAtF;;AAEA,MAAMC,cAAc,GAAG,QASjB;EAAA,IATkB;IACtBC,MADsB;IAEtBC,MAFsB;IAGtBC,SAHsB;IAItBC,cAJsB;IAKtBC,eALsB;IAMtBC,kBANsB;IAOtBC;EAPsB,CASlB;EAAA,IADDC,UACC;;EACJ,MAAM;IAAEC;EAAF,IAAaR,MAAnB;EACA,MAAM,CAACS,eAAD,EAAkBC,kBAAlB,IAAwCtB,QAAQ,CAAC,EAAD,CAAtD;EACA,MAAM;IAAEuB,IAAI,GAAG,EAAT;IAAaC,KAAb;IAAoBC;EAApB,IAAgCvB,QAAQ,CAACW,MAAD,EAASE,cAAT,CAA9C;EACA,MAAM;IAAEW,EAAE,EAAEC;EAAN,IAAiBxB,eAAe,EAAtC;EACA,MAAMyB,YAAY,GAAGD,MAAM,IAAIV,kBAAV,IAAgCA,kBAAkB,CAACY,MAAxE;EACA,MAAMC,SAAS,GAAGF,YAAY,GAAGnB,mBAA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AHA;EAIzBjC,SAAS,EAAEb,SAAS,CAAC+C,MAAV,CAAiBD,UAJH;EAKzBhC,cAAc,EAAEd,SAAS,CAAC6C,MAAV,CAAiBC,UALR;EAMzB/B,eAAe,EAAEf,SAAS,CAAC6C,MAAV,CAAiBC,UANT;EAOzB7B,eAAe,EAAEjB,SAAS,CAACgD;AAPF,CAA3B;AAUAtC,cAAc,CAACuC,YAAf,GAA8B;EAC5BjC,kBAAkB,EAAE,EADQ;EAE5BC,eAAe,EAAE,MAAM,CAAE;AAFG,CAA9B;AAKAP,cAAc,CAACuC,YAAf,GAA8B;EAC5BjC,kBAAkB,EAAE;AADQ,CAA9B;AAIA,eAAeZ,UAAU,CAACM,cAAD,CAAzB"}
1
+ {"version":3,"file":"GTMEventRender.js","names":["React","useState","PropTypes","useQuery","checkIfLoggedIn","getUser","withRouter","GTMEvent","buildDataLayer","buildNestedEvent","buildUserQueryProps","buildUserLayer","GTMEventRender","router","action","actionKey","queryVariables","parentComponent","userPropsToDisplay","handleOnSuccess","eventProps","asPath","currentLocation","setCurrentLocation","data","error","loading","id","userId","hasUserProps","length","userProps","userData","userLoading","variables","skip","gtmData","entityData","eventTrigger","propsToDisplay","eventEcommerce","dataLayerProps","dataLayerObject","userLayerObject","extendedDataLayer","propTypes","array","object","isRequired","string","func","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMEventRender.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport { getUser } from '@blaze-cms/react-page-builder';\nimport { withRouter } from 'next/router';\nimport GTMEvent from './GTMEvent';\nimport { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';\n\nconst GTMEventRender = ({\n router,\n action,\n actionKey,\n queryVariables,\n parentComponent,\n userPropsToDisplay,\n handleOnSuccess,\n ...eventProps\n}) => {\n const { asPath } = router;\n const [currentLocation, setCurrentLocation] = useState('');\n const { data = {}, error, loading } = useQuery(action, queryVariables);\n const { id: userId } = checkIfLoggedIn();\n const hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;\n const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';\n const { data: userData, loading: userLoading } = useQuery(getUser(userProps), {\n variables: { id: userId },\n skip: !hasUserProps\n });\n\n if (loading || userLoading || error) return null;\n const gtmData = data.entityData || data[actionKey];\n\n if (currentLocation !== asPath) {\n setCurrentLocation(asPath);\n return null;\n }\n\n const { eventTrigger, propsToDisplay, eventEcommerce } = eventProps;\n const dataLayerProps = buildDataLayer(gtmData, propsToDisplay);\n\n const dataLayerObject = buildNestedEvent(\n eventEcommerce,\n eventProps,\n dataLayerProps,\n parentComponent\n );\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n return (\n <GTMEvent\n dataLayerObject={extendedDataLayer}\n eventTrigger={eventTrigger}\n currentLocation={currentLocation}\n handleOnSuccess={handleOnSuccess}\n />\n );\n};\n\nGTMEventRender.propTypes = {\n userPropsToDisplay: PropTypes.array,\n router: PropTypes.object.isRequired,\n action: PropTypes.object.isRequired,\n actionKey: PropTypes.string.isRequired,\n queryVariables: PropTypes.object.isRequired,\n parentComponent: PropTypes.object.isRequired,\n handleOnSuccess: PropTypes.func\n};\n\nGTMEventRender.defaultProps = {\n userPropsToDisplay: [],\n handleOnSuccess: () => {}\n};\n\nGTMEventRender.defaultProps = {\n userPropsToDisplay: []\n};\n\nexport default withRouter(GTMEventRender);\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,OAAO,QAAQ,+BAA+B;AACvD,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,QAAQ,MAAM,Y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GpB,UAAU;EACnE,MAAMqB,cAAc,GAAGjC,cAAc,CAAC4B,OAAO,EAAEG,cAAc,CAAC;EAE9D,MAAMG,eAAe,GAAGjC,gBAAgB,CACtC+B,cAAc,EACdpB,UAAU,EACVqB,cAAc,EACdxB,eAAe,CAChB;EACD,MAAM0B,eAAe,GAAGhC,cAAc,CAACqB,QAAQ,EAAEd,kBAAkB,CAAC;EACpE,MAAM0B,iBAAiB,mCAAQF,eAAe,GAAKC,eAAe,CAAE;EAEpE,oBACE,oBAAC,QAAQ;IACP,eAAe,EAAEC,iBAAkB;IACnC,YAAY,EAAEN,YAAa;IAC3B,eAAe,EAAEhB,eAAgB;IACjC,eAAe,EAAEH;EAAgB,EACjC;AAEN,CAAC;AAEDP,cAAc,CAACiC,SAAS,GAAG;EACzB3B,kBAAkB,EAAEhB,SAAS,CAAC4C,KAAK;EACnCjC,MAAM,EAAEX,SAAS,CAAC6C,MAAM,CAACC,UAAU;EACnClC,MAAM,EAAEZ,SAAS,CAAC6C,MAAM,CAACC,UAAU;EACnCjC,SAAS,EAAEb,SAAS,CAAC+C,MAAM,CAACD,UAAU;EACtChC,cAAc,EAAEd,SAAS,CAAC6C,MAAM,CAACC,UAAU;EAC3C/B,eAAe,EAAEf,SAAS,CAAC6C,MAAM,CAACC,UAAU;EAC5C7B,eAAe,EAAEjB,SAAS,CAACgD;AAC7B,CAAC;AAEDtC,cAAc,CAACuC,YAAY,GAAG;EAC5BjC,kBAAkB,EAAE,EAAE;EACtBC,eAAe,EAAE,MAAM,CAAC;AAC1B,CAAC;AAEDP,cAAc,CAACuC,YAAY,GAAG;EAC5BjC,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAeZ,UAAU,CAACM,cAAc,CAAC"}
@@ -6,15 +6,13 @@ import PropTypes from 'prop-types';
6
6
  import GTMClickEvents from './GTMClickEvents';
7
7
  import GTMEventFactory from './GTMEventFactory';
8
8
  import { filterGtmEvents } from '../helpers';
9
-
10
9
  const GTMEventSwitch = _ref => {
11
10
  let {
12
- gtmEvents,
13
- clickState,
14
- clickId
15
- } = _ref,
16
- props = _objectWithoutProperties(_ref, _excluded);
17
-
11
+ gtmEvents,
12
+ clickState,
13
+ clickId
14
+ } = _ref,
15
+ props = _objectWithoutProperties(_ref, _excluded);
18
16
  if (typeof window === 'undefined' || !gtmEvents.length) return null;
19
17
  const {
20
18
  clickEvents,
@@ -28,7 +26,6 @@ const GTMEventSwitch = _ref => {
28
26
  gtmEvents: regularEvents
29
27
  }, props));
30
28
  };
31
-
32
29
  GTMEventSwitch.propTypes = {
33
30
  clickId: PropTypes.string,
34
31
  gtmEvents: PropTypes.array,
@@ -1 +1 @@
1
- {"version":3,"file":"GTMEventSwitch.js","names":["React","PropTypes","GTMClickEvents","GTMEventFactory","filterGtmEvents","GTMEventSwitch","gtmEvents","clickState","clickId","props","window","length","clickEvents","regularEvents","GTMClickFactory","propTypes","string","array","bool","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMEventSwitch.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport GTMClickEvents from './GTMClickEvents';\nimport GTMEventFactory from './GTMEventFactory';\nimport { filterGtmEvents } from '../helpers';\n\nconst GTMEventSwitch = ({ gtmEvents, clickState, clickId, ...props }) => {\n if (typeof window === 'undefined' || !gtmEvents.length) return null;\n const { clickEvents, regularEvents } = filterGtmEvents(gtmEvents);\n const GTMClickFactory = clickId ? GTMEventFactory : GTMClickEvents;\n\n return clickState ? (\n <GTMClickFactory gtmEvents={clickEvents} clickId={clickId} {...props} />\n ) : (\n <GTMEventFactory gtmEvents={regularEvents} {...props} />\n );\n};\n\nGTMEventSwitch.propTypes = {\n clickId: PropTypes.string,\n gtmEvents: PropTypes.array,\n clickState: PropTypes.bool\n};\n\nGTMEventSwitch.defaultProps = {\n clickId: null,\n gtmEvents: [],\n clickState: false\n};\n\nexport default GTMEventSwitch;\n"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,cAAP,MAA2B,kBAA3B;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,SAASC,eAAT,QAAgC,YAAhC;;AAEA,MAAMC,cAAc,GAAG,QAAkD;EAAA,IAAjD;IAAEC,SAAF;IAAaC,UAAb;IAAyBC;EAAzB,CAAiD;EAAA,IAAZC,KAAY;;EACvE,IAAI,OAAOC,MAAP,KAAkB,WAAlB,IAAiC,CAACJ,SAAS,CAACK,MAAhD,EAAwD,OAAO,IAAP;EACxD,MAAM;IAAEC,WAAF;IAAeC;EAAf,IAAiCT,eAAe,CAACE,SAAD,CAAtD;EACA,MAAMQ,eAAe,GAAGN,OAAO,GAAGL,eAAH,GAAqBD,cAApD;EAEA,OAAOK,UAAU,gBACf,oBAAC,eAAD;IAAiB,SAAS,EAAEK,WAA5B;IAAyC,OAAO,EAAEJ;EAAlD,GAA+DC,KAA/D,EADe,gBAGf,oBAAC,eAAD;IAAiB,SAAS,EAAEI;EAA5B,GAA+CJ,KAA/C,EAHF;AAKD,CAVD;;AAYAJ,cAAc,CAACU,SAAf,GAA2B;EACzBP,OAAO,EAAEP,SAAS,CAACe,MADM;EAEzBV,SAAS,EAAEL,SAAS,CAACgB,KAFI;EAGzBV,UAAU,EAAEN,SAAS,CAACiB;AAHG,CAA3B;AAMAb,cAAc,CAACc,YAAf,GAA8B;EAC5BX,OAAO,EAAE,IADmB;EAE5BF,SAAS,EAAE,EAFiB;EAG5BC,UAAU,EAAE;AAHgB,CAA9B;AAMA,eAAeF,cAAf"}
1
+ {"version":3,"file":"GTMEventSwitch.js","names":["React","PropTypes","GTMClickEvents","GTMEventFactory","filterGtmEvents","GTMEventSwitch","gtmEvents","clickState","clickId","props","window","length","clickEvents","regularEvents","GTMClickFactory","propTypes","string","array","bool","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMEventSwitch.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport GTMClickEvents from './GTMClickEvents';\nimport GTMEventFactory from './GTMEventFactory';\nimport { filterGtmEvents } from '../helpers';\n\nconst GTMEventSwitch = ({ gtmEvents, clickState, clickId, ...props }) => {\n if (typeof window === 'undefined' || !gtmEvents.length) return null;\n const { clickEvents, regularEvents } = filterGtmEvents(gtmEvents);\n const GTMClickFactory = clickId ? GTMEventFactory : GTMClickEvents;\n\n return clickState ? (\n <GTMClickFactory gtmEvents={clickEvents} clickId={clickId} {...props} />\n ) : (\n <GTMEventFactory gtmEvents={regularEvents} {...props} />\n );\n};\n\nGTMEventSwitch.propTypes = {\n clickId: PropTypes.string,\n gtmEvents: PropTypes.array,\n clickState: PropTypes.bool\n};\n\nGTMEventSwitch.defaultProps = {\n clickId: null,\n gtmEvents: [],\n clickState: false\n};\n\nexport default GTMEventSwitch;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,SAASC,eAAe,QAAQ,YAAY;AAE5C,MAAMC,cAAc,GAAG,QAAkD;EAAA,IAAjD;MAAEC,SAAS;MAAEC,UAAU;MAAEC;IAAkB,CAAC;IAAPC,KAAK;EAChE,IAAI,OAAOC,MAAM,KAAK,WAAW,IAAI,CAACJ,SAAS,CAACK,MAAM,EAAE,OAAO,IAAI;EACnE,MAAM;IAAEC,WAAW;IAAEC;EAAc,CAAC,GAAGT,eAAe,CAACE,SAAS,CAAC;EACjE,MAAMQ,eAAe,GAAGN,OAAO,GAAGL,eAAe,GAAGD,cAAc;EAElE,OAAOK,UAAU,gBACf,oBAAC,eAAe;IAAC,SAAS,EAAEK,WAAY;IAAC,OAAO,EAAEJ;EAAQ,GAAKC,KAAK,EAAI,gBAExE,oBAAC,eAAe;IAAC,SAAS,EAAEI;EAAc,GAAKJ,KAAK,EACrD;AACH,CAAC;AAEDJ,cAAc,CAACU,SAAS,GAAG;EACzBP,OAAO,EAAEP,SAAS,CAACe,MAAM;EACzBV,SAAS,EAAEL,SAAS,CAACgB,KAAK;EAC1BV,UAAU,EAAEN,SAAS,CAACiB;AACxB,CAAC;AAEDb,cAAc,CAACc,YAAY,GAAG;EAC5BX,OAAO,EAAE,IAAI;EACbF,SAAS,EAAE,EAAE;EACbC,UAAU,EAAE;AACd,CAAC;AAED,eAAeF,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["GTMEventSwitch"],"sources":["../../src/GoogleTagManagerEvent/index.js"],"sourcesContent":["import GTMEventSwitch from './GTMEventSwitch';\n\nexport default GTMEventSwitch;\n"],"mappings":"AAAA,OAAOA,cAAP,MAA2B,kBAA3B;AAEA,eAAeA,cAAf"}
1
+ {"version":3,"file":"index.js","names":["GTMEventSwitch"],"sources":["../../src/GoogleTagManagerEvent/index.js"],"sourcesContent":["import GTMEventSwitch from './GTMEventSwitch';\n\nexport default GTMEventSwitch;\n"],"mappings":"AAAA,OAAOA,cAAc,MAAM,kBAAkB;AAE7C,eAAeA,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["EVENT","ON_LOAD","ON_CLICK","IN_VIEW","ON_SUCCESS","PAGE_VIEW","ECOMMERCE","GTM_PROPS","key","label","GTM_EVENT_NAMES","productImpresion","productDetailImpression","productClick","promotionClick","GTM_EVENT_FACTORY","PLUGIN_NAME","PRODUCTS"],"sources":["../src/constants.js"],"sourcesContent":["const EVENT = 'event';\nconst ON_LOAD = 'onLoad';\nconst ON_CLICK = 'onClick';\nconst IN_VIEW = 'inView';\nconst ON_SUCCESS = 'onSuccess';\nconst PAGE_VIEW = 'pageView';\nconst ECOMMERCE = 'ecommerce';\nconst GTM_PROPS = [\n { key: 'eventAction' },\n { key: 'eventLabel' },\n { key: 'eventCategory' },\n { key: 'eventName', label: 'event' }\n];\nconst GTM_EVENT_NAMES = {\n productImpresion: 'impressions',\n productDetailImpression: 'detail',\n productClick: 'click',\n promotionClick: 'promotionClick'\n};\n\nconst GTM_EVENT_FACTORY = 'GtmEventFactory';\nconst PLUGIN_NAME = 'gtm-fe';\nconst PRODUCTS = 'products';\n\nexport {\n PLUGIN_NAME,\n EVENT,\n ECOMMERCE,\n GTM_PROPS,\n GTM_EVENT_NAMES,\n GTM_EVENT_FACTORY,\n ON_CLICK,\n IN_VIEW,\n ON_SUCCESS,\n ON_LOAD,\n PRODUCTS,\n PAGE_VIEW\n};\n"],"mappings":"AAAA,MAAMA,KAAK,GAAG,OAAd;AACA,MAAMC,OAAO,GAAG,QAAhB;AACA,MAAMC,QAAQ,GAAG,SAAjB;AACA,MAAMC,OAAO,GAAG,QAAhB;AACA,MAAMC,UAAU,GAAG,WAAnB;AACA,MAAMC,SAAS,GAAG,UAAlB;AACA,MAAMC,SAAS,GAAG,WAAlB;AACA,MAAMC,SAAS,GAAG,CAChB;EAAEC,GAAG,EAAE;AAAP,CADgB,EAEhB;EAAEA,GAAG,EAAE;AAAP,CAFgB,EAGhB;EAAEA,GAAG,EAAE;AAAP,CAHgB,EAIhB;EAAEA,GAAG,EAAE,WAAP;EAAoBC,KAAK,EAAE;AAA3B,CAJgB,CAAlB;AAMA,MAAMC,eAAe,GAAG;EACtBC,gBAAgB,EAAE,aADI;EAEtBC,uBAAuB,EAAE,QAFH;EAGtBC,YAAY,EAAE,OAHQ;EAItBC,cAAc,EAAE;AAJM,CAAxB;AAOA,MAAMC,iBAAiB,GAAG,iBAA1B;AACA,MAAMC,WAAW,GAAG,QAApB;AACA,MAAMC,QAAQ,GAAG,UAAjB;AAEA,SACED,WADF,EAEEhB,KAFF,EAGEM,SAHF,EAIEC,SAJF,EAKEG,eALF,EAMEK,iBANF,EAOEb,QAPF,EAQEC,OARF,EASEC,UATF,EAUEH,OAVF,EAWEgB,QAXF,EAYEZ,SAZF"}
1
+ {"version":3,"file":"constants.js","names":["EVENT","ON_LOAD","ON_CLICK","IN_VIEW","ON_SUCCESS","PAGE_VIEW","ECOMMERCE","GTM_PROPS","key","label","GTM_EVENT_NAMES","productImpresion","productDetailImpression","productClick","promotionClick","GTM_EVENT_FACTORY","PLUGIN_NAME","PRODUCTS"],"sources":["../src/constants.js"],"sourcesContent":["const EVENT = 'event';\nconst ON_LOAD = 'onLoad';\nconst ON_CLICK = 'onClick';\nconst IN_VIEW = 'inView';\nconst ON_SUCCESS = 'onSuccess';\nconst PAGE_VIEW = 'pageView';\nconst ECOMMERCE = 'ecommerce';\nconst GTM_PROPS = [\n { key: 'eventAction' },\n { key: 'eventLabel' },\n { key: 'eventCategory' },\n { key: 'eventName', label: 'event' }\n];\nconst GTM_EVENT_NAMES = {\n productImpresion: 'impressions',\n productDetailImpression: 'detail',\n productClick: 'click',\n promotionClick: 'promotionClick'\n};\n\nconst GTM_EVENT_FACTORY = 'GtmEventFactory';\nconst PLUGIN_NAME = 'gtm-fe';\nconst PRODUCTS = 'products';\n\nexport {\n PLUGIN_NAME,\n EVENT,\n ECOMMERCE,\n GTM_PROPS,\n GTM_EVENT_NAMES,\n GTM_EVENT_FACTORY,\n ON_CLICK,\n IN_VIEW,\n ON_SUCCESS,\n ON_LOAD,\n PRODUCTS,\n PAGE_VIEW\n};\n"],"mappings":"AAAA,MAAMA,KAAK,GAAG,OAAO;AACrB,MAAMC,OAAO,GAAG,QAAQ;AACxB,MAAMC,QAAQ,GAAG,SAAS;AAC1B,MAAMC,OAAO,GAAG,QAAQ;AACxB,MAAMC,UAAU,GAAG,WAAW;AAC9B,MAAMC,SAAS,GAAG,UAAU;AAC5B,MAAMC,SAAS,GAAG,WAAW;AAC7B,MAAMC,SAAS,GAAG,CAChB;EAAEC,GAAG,EAAE;AAAc,CAAC,EACtB;EAAEA,GAAG,EAAE;AAAa,CAAC,EACrB;EAAEA,GAAG,EAAE;AAAgB,CAAC,EACxB;EAAEA,GAAG,EAAE,WAAW;EAAEC,KAAK,EAAE;AAAQ,CAAC,CACrC;AACD,MAAMC,eAAe,GAAG;EACtBC,gBAAgB,EAAE,aAAa;EAC/BC,uBAAuB,EAAE,QAAQ;EACjCC,YAAY,EAAE,OAAO;EACrBC,cAAc,EAAE;AAClB,CAAC;AAED,MAAMC,iBAAiB,GAAG,iBAAiB;AAC3C,MAAMC,WAAW,GAAG,QAAQ;AAC5B,MAAMC,QAAQ,GAAG,UAAU;AAE3B,SACED,WAAW,EACXhB,KAAK,EACLM,SAAS,EACTC,SAAS,EACTG,eAAe,EACfK,iBAAiB,EACjBb,QAAQ,EACRC,OAAO,EACPC,UAAU,EACVH,OAAO,EACPgB,QAAQ,EACRZ,SAAS"}
@@ -1,12 +1,10 @@
1
1
  import { getCLS, getFID, getLCP } from 'web-vitals';
2
2
  import pushToDataLayer from './push-to-data-layer';
3
-
4
3
  const buildAndPushWebVitals = () => {
5
4
  getCLS(reportHandler);
6
5
  getFID(reportHandler);
7
6
  getLCP(reportHandler);
8
7
  };
9
-
10
8
  const reportHandler = ({
11
9
  name,
12
10
  delta,
@@ -22,6 +20,5 @@ const reportHandler = ({
22
20
  };
23
21
  pushToDataLayer(metrics);
24
22
  };
25
-
26
23
  export default buildAndPushWebVitals;
27
24
  //# sourceMappingURL=build-and-push-web-vitals.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-and-push-web-vitals.js","names":["getCLS","getFID","getLCP","pushToDataLayer","buildAndPushWebVitals","reportHandler","name","delta","id","metrics","event","event_category","event_action","event_value","Math","round","event_label","nonInteraction"],"sources":["../../src/helpers/build-and-push-web-vitals.js"],"sourcesContent":["import { getCLS, getFID, getLCP } from 'web-vitals';\nimport pushToDataLayer from './push-to-data-layer';\n\nconst buildAndPushWebVitals = () => {\n getCLS(reportHandler);\n getFID(reportHandler);\n getLCP(reportHandler);\n};\n\nconst reportHandler = ({ name, delta, id }) => {\n const metrics = {\n event: 'web-vitals',\n event_category: 'Web Vitals',\n event_action: name,\n event_value: Math.round(name === 'CLS' ? delta * 1000 : delta),\n event_label: id,\n nonInteraction: true\n };\n\n pushToDataLayer(metrics);\n};\n\nexport default buildAndPushWebVitals;\n"],"mappings":"AAAA,SAASA,MAAT,EAAiBC,MAAjB,EAAyBC,MAAzB,QAAuC,YAAvC;AACA,OAAOC,eAAP,MAA4B,sBAA5B;;AAEA,MAAMC,qBAAqB,GAAG,MAAM;EAClCJ,MAAM,CAACK,aAAD,CAAN;EACAJ,MAAM,CAACI,aAAD,CAAN;EACAH,MAAM,CAACG,aAAD,CAAN;AACD,CAJD;;AAMA,MAAMA,aAAa,GAAG,CAAC;EAAEC,IAAF;EAAQC,KAAR;EAAeC;AAAf,CAAD,KAAyB;EAC7C,MAAMC,OAAO,GAAG;IACdC,KAAK,EAAE,YADO;IAEdC,cAAc,EAAE,YAFF;IAGdC,YAAY,EAAEN,IAHA;IAIdO,WAAW,EAAEC,IAAI,CAACC,KAAL,CAAWT,IAAI,KAAK,KAAT,GAAiBC,KAAK,GAAG,IAAzB,GAAgCA,KAA3C,CAJC;IAKdS,WAAW,EAAER,EALC;IAMdS,cAAc,EAAE;EANF,CAAhB;EASAd,eAAe,CAACM,OAAD,CAAf;AACD,CAXD;;AAaA,eAAeL,qBAAf"}
1
+ {"version":3,"file":"build-and-push-web-vitals.js","names":["getCLS","getFID","getLCP","pushToDataLayer","buildAndPushWebVitals","reportHandler","name","delta","id","metrics","event","event_category","event_action","event_value","Math","round","event_label","nonInteraction"],"sources":["../../src/helpers/build-and-push-web-vitals.js"],"sourcesContent":["import { getCLS, getFID, getLCP } from 'web-vitals';\nimport pushToDataLayer from './push-to-data-layer';\n\nconst buildAndPushWebVitals = () => {\n getCLS(reportHandler);\n getFID(reportHandler);\n getLCP(reportHandler);\n};\n\nconst reportHandler = ({ name, delta, id }) => {\n const metrics = {\n event: 'web-vitals',\n event_category: 'Web Vitals',\n event_action: name,\n event_value: Math.round(name === 'CLS' ? delta * 1000 : delta),\n event_label: id,\n nonInteraction: true\n };\n\n pushToDataLayer(metrics);\n};\n\nexport default buildAndPushWebVitals;\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,MAAM,EAAEC,MAAM,QAAQ,YAAY;AACnD,OAAOC,eAAe,MAAM,sBAAsB;AAElD,MAAMC,qBAAqB,GAAG,MAAM;EAClCJ,MAAM,CAACK,aAAa,CAAC;EACrBJ,MAAM,CAACI,aAAa,CAAC;EACrBH,MAAM,CAACG,aAAa,CAAC;AACvB,CAAC;AAED,MAAMA,aAAa,GAAG,CAAC;EAAEC,IAAI;EAAEC,KAAK;EAAEC;AAAG,CAAC,KAAK;EAC7C,MAAMC,OAAO,GAAG;IACdC,KAAK,EAAE,YAAY;IACnBC,cAAc,EAAE,YAAY;IAC5BC,YAAY,EAAEN,IAAI;IAClBO,WAAW,EAAEC,IAAI,CAACC,KAAK,CAACT,IAAI,KAAK,KAAK,GAAGC,KAAK,GAAG,IAAI,GAAGA,KAAK,CAAC;IAC9DS,WAAW,EAAER,EAAE;IACfS,cAAc,EAAE;EAClB,CAAC;EAEDd,eAAe,CAACM,OAAO,CAAC;AAC1B,CAAC;AAED,eAAeL,qBAAqB"}
@@ -1,23 +1,16 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
4
  const getFinalValue = (data, name) => {
8
5
  if (name.includes('.')) {
9
6
  const [relationName, fieldName] = name.split('.');
10
-
11
7
  if (Array.isArray(data[relationName])) {
12
8
  return data[relationName].reduce((str, element, index) => `${str}${index ? ',' : ''}${element[fieldName]}`, '');
13
9
  }
14
-
15
10
  return data[relationName] ? data[relationName][fieldName] : data[fieldName] || '';
16
11
  }
17
-
18
12
  return data[name];
19
13
  };
20
-
21
14
  const buildProps = (props, data) => props.reduce((acc, {
22
15
  label: key,
23
16
  propertiesToDisplay: [name],
@@ -26,12 +19,9 @@ const buildProps = (props, data) => props.reduce((acc, {
26
19
  if (key && (staticMetric || name)) {
27
20
  acc[key] = staticMetric || getFinalValue(data, name);
28
21
  }
29
-
30
22
  return acc;
31
23
  }, {});
32
-
33
24
  const buildDataLayerProps = (props, data) => Array.isArray(data) ? data.map(currentData => buildProps(props, currentData)) : buildProps(props, data);
34
-
35
25
  const buildDataLayer = (data, propsToDisplay, url) => {
36
26
  if (!propsToDisplay || !propsToDisplay.length) return null;
37
27
  const propsToDisplayValues = buildDataLayerProps(propsToDisplay, data);
@@ -40,6 +30,5 @@ const buildDataLayer = (data, propsToDisplay, url) => {
40
30
  url
41
31
  }, propsToDisplayValues) : propsToDisplayValues;
42
32
  };
43
-
44
33
  export default buildDataLayer;
45
34
  //# sourceMappingURL=build-data-layer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-data-layer.js","names":["getFinalValue","data","name","includes","relationName","fieldName","split","Array","isArray","reduce","str","element","index","buildProps","props","acc","label","key","propertiesToDisplay","staticMetric","buildDataLayerProps","map","currentData","buildDataLayer","propsToDisplay","url","length","propsToDisplayValues","event"],"sources":["../../src/helpers/build-data-layer.js"],"sourcesContent":["const getFinalValue = (data, name) => {\n if (name.includes('.')) {\n const [relationName, fieldName] = name.split('.');\n if (Array.isArray(data[relationName])) {\n return data[relationName].reduce(\n (str, element, index) => `${str}${index ? ',' : ''}${element[fieldName]}`,\n ''\n );\n }\n\n return data[relationName] ? data[relationName][fieldName] : data[fieldName] || '';\n }\n return data[name];\n};\n\nconst buildProps = (props, data) =>\n props.reduce((acc, { label: key, propertiesToDisplay: [name], staticMetric }) => {\n if (key && (staticMetric || name)) {\n acc[key] = staticMetric || getFinalValue(data, name);\n }\n\n return acc;\n }, {});\n\nconst buildDataLayerProps = (props, data) =>\n Array.isArray(data)\n ? data.map(currentData => buildProps(props, currentData))\n : buildProps(props, data);\n\nconst buildDataLayer = (data, propsToDisplay, url) => {\n if (!propsToDisplay || !propsToDisplay.length) return null;\n const propsToDisplayValues = buildDataLayerProps(propsToDisplay, data);\n\n return url\n ? {\n event: 'pageView',\n url,\n ...propsToDisplayValues\n }\n : propsToDisplayValues;\n};\n\nexport default buildDataLayer;\n"],"mappings":";;;;;;AAAA,MAAMA,aAAa,GAAG,CAACC,IAAD,EAAOC,IAAP,KAAgB;EACpC,IAAIA,IAAI,CAACC,QAAL,CAAc,GAAd,CAAJ,EAAwB;IACtB,MAAM,CAACC,YAAD,EAAeC,SAAf,IAA4BH,IAAI,CAACI,KAAL,CAAW,GAAX,CAAlC;;IACA,IAAIC,KAAK,CAACC,OAAN,CAAcP,IAAI,CAACG,YAAD,CAAlB,CAAJ,EAAuC;MACrC,OAAOH,IAAI,CAACG,YAAD,CAAJ,CAAmBK,MAAnB,CACL,CAACC,GAAD,EAAMC,OAAN,EAAeC,KAAf,KAA0B,GAAEF,GAAI,GAAEE,KAAK,GAAG,GAAH,GAAS,EAAG,GAAED,OAAO,CAACN,SAAD,CAAY,EADnE,EAEL,EAFK,CAAP;IAID;;IAED,OAAOJ,IAAI,CAACG,YAAD,CAAJ,GAAqBH,IAAI,CAACG,YAAD,CAAJ,CAAmBC,SAAnB,CAArB,GAAqDJ,IAAI,CAACI,SAAD,CAAJ,IAAmB,EAA/E;EACD;;EACD,OAAOJ,IAAI,CAACC,IAAD,CAAX;AACD,CAbD;;AAeA,MAAMW,UAAU,GAAG,CAACC,KAAD,EAAQb,IAAR,KACjBa,KAAK,CAACL,MAAN,CAAa,CAACM,GAAD,EAAM;EAAEC,KAAK,EAAEC,GAAT;EAAcC,mBAAmB,EAAE,CAAChB,IAAD,CAAnC;EAA2CiB;AAA3C,CAAN,KAAoE;EAC/E,IAAIF,GAAG,KAAKE,YAAY,IAAIjB,IAArB,CAAP,EAAmC;IACjCa,GAAG,CAACE,GAAD,CAAH,GAAWE,YAAY,IAAInB,aAAa,CAACC,IAAD,EAAOC,IAAP,CAAxC;EACD;;EAED,OAAOa,GAAP;AACD,CAND,EAMG,EANH,CADF;;AASA,MAAMK,mBAAmB,GAAG,CAACN,KAAD,EAAQb,IAAR,KAC1BM,KAAK,CAACC,OAAN,CAAcP,IAAd,IACIA,IAAI,CAACoB,GAAL,CAASC,WAAW,IAAIT,UAAU,CAACC,KAAD,EAAQQ,WAAR,CAAlC,CADJ,GAEIT,UAAU,CAACC,KAAD,EAAQb,IAAR,CAHhB;;AAKA,MAAMsB,cAAc,GAAG,CAACtB,IAAD,EAAOuB,cAAP,EAAuBC,GAAvB,KAA+B;EACpD,IAAI,CAACD,cAAD,IAAmB,CAACA,cAAc,CAACE,MAAvC,EAA+C,OAAO,IAAP;EAC/C,MAAMC,oBAAoB,GAAGP,mBAAmB,CAACI,cAAD,EAAiBvB,IAAjB,CAAhD;EAEA,OAAOwB,GAAG;IAEJG,KAAK,EAAE,UAFH;IAGJH;EAHI,GAIDE,oBAJC,IAMNA,oBANJ;AAOD,CAXD;;AAaA,eAAeJ,cAAf"}
1
+ {"version":3,"file":"build-data-layer.js","names":["getFinalValue","data","name","includes","relationName","fieldName","split","Array","isArray","reduce","str","element","index","buildProps","props","acc","label","key","propertiesToDisplay","staticMetric","buildDataLayerProps","map","currentData","buildDataLayer","propsToDisplay","url","length","propsToDisplayValues","event"],"sources":["../../src/helpers/build-data-layer.js"],"sourcesContent":["const getFinalValue = (data, name) => {\n if (name.includes('.')) {\n const [relationName, fieldName] = name.split('.');\n if (Array.isArray(data[relationName])) {\n return data[relationName].reduce(\n (str, element, index) => `${str}${index ? ',' : ''}${element[fieldName]}`,\n ''\n );\n }\n\n return data[relationName] ? data[relationName][fieldName] : data[fieldName] || '';\n }\n return data[name];\n};\n\nconst buildProps = (props, data) =>\n props.reduce((acc, { label: key, propertiesToDisplay: [name], staticMetric }) => {\n if (key && (staticMetric || name)) {\n acc[key] = staticMetric || getFinalValue(data, name);\n }\n\n return acc;\n }, {});\n\nconst buildDataLayerProps = (props, data) =>\n Array.isArray(data)\n ? data.map(currentData => buildProps(props, currentData))\n : buildProps(props, data);\n\nconst buildDataLayer = (data, propsToDisplay, url) => {\n if (!propsToDisplay || !propsToDisplay.length) return null;\n const propsToDisplayValues = buildDataLayerProps(propsToDisplay, data);\n\n return url\n ? {\n event: 'pageView',\n url,\n ...propsToDisplayValues\n }\n : propsToDisplayValues;\n};\n\nexport default buildDataLayer;\n"],"mappings":";;;AAAA,MAAMA,aAAa,GAAG,CAACC,IAAI,EAAEC,IAAI,KAAK;EACpC,IAAIA,IAAI,CAACC,QAAQ,CAAC,GAAG,CAAC,EAAE;IACtB,MAAM,CAACC,YAAY,EAAEC,SAAS,CAAC,GAAGH,IAAI,CAACI,KAAK,CAAC,GAAG,CAAC;IACjD,IAAIC,KAAK,CAACC,OAAO,CAACP,IAAI,CAACG,YAAY,CAAC,CAAC,EAAE;MACrC,OAAOH,IAAI,CAACG,YAAY,CAAC,CAACK,MAAM,CAC9B,CAACC,GAAG,EAAEC,OAAO,EAAEC,KAAK,KAAM,GAAEF,GAAI,GAAEE,KAAK,GAAG,GAAG,GAAG,EAAG,GAAED,OAAO,CAACN,SAAS,CAAE,EAAC,EACzE,EAAE,CACH;IACH;IAEA,OAAOJ,IAAI,CAACG,YAAY,CAAC,GAAGH,IAAI,CAACG,YAAY,CAAC,CAACC,SAAS,CAAC,GAAGJ,IAAI,CAACI,SAAS,CAAC,IAAI,EAAE;EACnF;EACA,OAAOJ,IAAI,CAACC,IAAI,CAAC;AACnB,CAAC;AAED,MAAMW,UAAU,GAAG,CAACC,KAAK,EAAEb,IAAI,KAC7Ba,KAAK,CAACL,MAAM,CAAC,CAACM,GAAG,EAAE;EAAEC,KAAK,EAAEC,GAAG;EAAEC,mBAAmB,EAAE,CAAChB,IAAI,CAAC;EAAEiB;AAAa,CAAC,KAAK;EAC/E,IAAIF,GAAG,KAAKE,YAAY,IAAIjB,IAAI,CAAC,EAAE;IACjCa,GAAG,CAACE,GAAG,CAAC,GAAGE,YAAY,IAAInB,aAAa,CAACC,IAAI,EAAEC,IAAI,CAAC;EACtD;EAEA,OAAOa,GAAG;AACZ,CAAC,EAAE,CAAC,CAAC,CAAC;AAER,MAAMK,mBAAmB,GAAG,CAACN,KAAK,EAAEb,IAAI,KACtCM,KAAK,CAACC,OAAO,CAACP,IAAI,CAAC,GACfA,IAAI,CAACoB,GAAG,CAACC,WAAW,IAAIT,UAAU,CAACC,KAAK,EAAEQ,WAAW,CAAC,CAAC,GACvDT,UAAU,CAACC,KAAK,EAAEb,IAAI,CAAC;AAE7B,MAAMsB,cAAc,GAAG,CAACtB,IAAI,EAAEuB,cAAc,EAAEC,GAAG,KAAK;EACpD,IAAI,CAACD,cAAc,IAAI,CAACA,cAAc,CAACE,MAAM,EAAE,OAAO,IAAI;EAC1D,MAAMC,oBAAoB,GAAGP,mBAAmB,CAACI,cAAc,EAAEvB,IAAI,CAAC;EAEtE,OAAOwB,GAAG;IAEJG,KAAK,EAAE,UAAU;IACjBH;EAAG,GACAE,oBAAoB,IAEzBA,oBAAoB;AAC1B,CAAC;AAED,eAAeJ,cAAc"}
@@ -1,11 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
4
  import { GTM_EVENT_NAMES, GTM_PROPS, EVENT, ECOMMERCE, PRODUCTS, ON_CLICK } from '../constants';
8
-
9
5
  const buildNestedEvent = (ecommerce, propsObject, props, parentComponent) => {
10
6
  const {
11
7
  productDetailImpression,
@@ -24,7 +20,6 @@ const buildNestedEvent = (ecommerce, propsObject, props, parentComponent) => {
24
20
  list: name
25
21
  };
26
22
  const hasMultipleItems = Array.isArray(props);
27
-
28
23
  if (!ecommerce) {
29
24
  const basicEventObject = {};
30
25
  GTM_PROPS.forEach(({
@@ -40,12 +35,10 @@ const buildNestedEvent = (ecommerce, propsObject, props, parentComponent) => {
40
35
  } : props;
41
36
  return _objectSpread(_objectSpread({}, basicEventObject), parsedProps);
42
37
  }
43
-
44
38
  if (!gtmActionLabel) return {
45
39
  [EVENT]: eventAction,
46
40
  [ECOMMERCE]: props
47
41
  };
48
-
49
42
  if (gtmActionLabel === productDetailImpression || gtmActionLabel === productClick) {
50
43
  const parsedProducts = hasMultipleItems ? props : [props];
51
44
  const eventObject = isClickEvent ? {
@@ -61,7 +54,6 @@ const buildNestedEvent = (ecommerce, propsObject, props, parentComponent) => {
61
54
  }
62
55
  };
63
56
  }
64
-
65
57
  const ecommerceObject = isClickEvent ? {
66
58
  [gtmActionLabel]: props,
67
59
  actionField
@@ -73,6 +65,5 @@ const buildNestedEvent = (ecommerce, propsObject, props, parentComponent) => {
73
65
  [ECOMMERCE]: ecommerceObject
74
66
  };
75
67
  };
76
-
77
68
  export default buildNestedEvent;
78
69
  //# sourceMappingURL=build-nested-event.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-nested-event.js","names":["GTM_EVENT_NAMES","GTM_PROPS","EVENT","ECOMMERCE","PRODUCTS","ON_CLICK","buildNestedEvent","ecommerce","propsObject","props","parentComponent","productDetailImpression","productClick","eventAction","eventTrigger","name","gtmActionLabel","isClickEvent","actionField","list","hasMultipleItems","Array","isArray","basicEventObject","forEach","key","label","gtmValue","gtmKey","parsedProps","items","parsedProducts","eventObject","ecommerceObject"],"sources":["../../src/helpers/build-nested-event.js"],"sourcesContent":["import { GTM_EVENT_NAMES, GTM_PROPS, EVENT, ECOMMERCE, PRODUCTS, ON_CLICK } from '../constants';\n\nconst buildNestedEvent = (ecommerce, propsObject, props, parentComponent) => {\n const { productDetailImpression, productClick } = GTM_EVENT_NAMES;\n const { eventAction, eventTrigger } = propsObject;\n const { name } = parentComponent;\n const gtmActionLabel = GTM_EVENT_NAMES[eventAction];\n const isClickEvent = eventTrigger === ON_CLICK || gtmActionLabel === productClick;\n const actionField = { list: name };\n const hasMultipleItems = Array.isArray(props);\n\n if (!ecommerce) {\n const basicEventObject = {};\n GTM_PROPS.forEach(({ key, label }) => {\n const gtmValue = propsObject[key];\n const gtmKey = label || key;\n if (gtmValue) basicEventObject[gtmKey] = gtmValue;\n });\n const parsedProps = hasMultipleItems ? { items: props } : props;\n\n return { ...basicEventObject, ...parsedProps };\n }\n\n if (!gtmActionLabel) return { [EVENT]: eventAction, [ECOMMERCE]: props };\n if (gtmActionLabel === productDetailImpression || gtmActionLabel === productClick) {\n const parsedProducts = hasMultipleItems ? props : [props];\n const eventObject = isClickEvent\n ? { [PRODUCTS]: parsedProducts, actionField }\n : { [PRODUCTS]: parsedProducts };\n return {\n [EVENT]: eventAction,\n [ECOMMERCE]: { [gtmActionLabel]: eventObject }\n };\n }\n\n const ecommerceObject = isClickEvent\n ? { [gtmActionLabel]: props, actionField }\n : { [gtmActionLabel]: props };\n return { [EVENT]: eventAction, [ECOMMERCE]: ecommerceObject };\n};\n\nexport default buildNestedEvent;\n"],"mappings":";;;;;;AAAA,SAASA,eAAT,EAA0BC,SAA1B,EAAqCC,KAArC,EAA4CC,SAA5C,EAAuDC,QAAvD,EAAiEC,QAAjE,QAAiF,cAAjF;;AAE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AY,GAC5B;MAAE,CAACb,QAAD,GAAY2B,cAAd;MAA8Bb;IAA9B,CAD4B,GAE5B;MAAE,CAACd,QAAD,GAAY2B;IAAd,CAFJ;IAGA,OAAO;MACL,CAAC7B,KAAD,GAASW,WADJ;MAEL,CAACV,SAAD,GAAa;QAAE,CAACa,cAAD,GAAkBgB;MAApB;IAFR,CAAP;EAID;;EAED,MAAMC,eAAe,GAAGhB,YAAY,GAChC;IAAE,CAACD,cAAD,GAAkBP,KAApB;IAA2BS;EAA3B,CADgC,GAEhC;IAAE,CAACF,cAAD,GAAkBP;EAApB,CAFJ;EAGA,OAAO;IAAE,CAACP,KAAD,GAASW,WAAX;IAAwB,CAACV,SAAD,GAAa8B;EAArC,CAAP;AACD,CArCD;;AAuCA,eAAe3B,gBAAf"}
1
+ {"version":3,"file":"build-nested-event.js","names":["GTM_EVENT_NAMES","GTM_PROPS","EVENT","ECOMMERCE","PRODUCTS","ON_CLICK","buildNestedEvent","ecommerce","propsObject","props","parentComponent","productDetailImpression","productClick","eventAction","eventTrigger","name","gtmActionLabel","isClickEvent","actionField","list","hasMultipleItems","Array","isArray","basicEventObject","forEach","key","label","gtmValue","gtmKey","parsedProps","items","parsedProducts","eventObject","ecommerceObject"],"sources":["../../src/helpers/build-nested-event.js"],"sourcesContent":["import { GTM_EVENT_NAMES, GTM_PROPS, EVENT, ECOMMERCE, PRODUCTS, ON_CLICK } from '../constants';\n\nconst buildNestedEvent = (ecommerce, propsObject, props, parentComponent) => {\n const { productDetailImpression, productClick } = GTM_EVENT_NAMES;\n const { eventAction, eventTrigger } = propsObject;\n const { name } = parentComponent;\n const gtmActionLabel = GTM_EVENT_NAMES[eventAction];\n const isClickEvent = eventTrigger === ON_CLICK || gtmActionLabel === productClick;\n const actionField = { list: name };\n const hasMultipleItems = Array.isArray(props);\n\n if (!ecommerce) {\n const basicEventObject = {};\n GTM_PROPS.forEach(({ key, label }) => {\n const gtmValue = propsObject[key];\n const gtmKey = label || key;\n if (gtmValue) basicEventObject[gtmKey] = gtmValue;\n });\n const parsedProps = hasMultipleItems ? { items: props } : props;\n\n return { ...basicEventObject, ...parsedProps };\n }\n\n if (!gtmActionLabel) return { [EVENT]: eventAction, [ECOMMERCE]: props };\n if (gtmActionLabel === productDetailImpression || gtmActionLabel === productClick) {\n const parsedProducts = hasMultipleItems ? props : [props];\n const eventObject = isClickEvent\n ? { [PRODUCTS]: parsedProducts, actionField }\n : { [PRODUCTS]: parsedProducts };\n return {\n [EVENT]: eventAction,\n [ECOMMERCE]: { [gtmActionLabel]: eventObject }\n };\n }\n\n const ecommerceObject = isClickEvent\n ? { [gtmActionLabel]: props, actionField }\n : { [gtmActionLabel]: props };\n return { [EVENT]: eventAction, [ECOMMERCE]: ecommerceObject };\n};\n\nexport default buildNestedEvent;\n"],"mappings":";;;AAAA,SAASA,eAAe,EAAEC,SAAS,EAAEC,KAAK,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,cAAc;AAE/F,MAAMC,gBAAgB,GAAG,CAACC,SAAS,EAAEC,WAAW,EAAEC,KAAK,EAAEC,eAAe,KAAK;EAC3E,MAAM;IAAEC,uBAAuB;IAAEC;EAAa,CAAC,GAAGZ,eAAe;EACjE,MAAM;IAAEa,WAAW;IAAEC;EAAa,CAAC,GAAGN,WAAW;EACjD,MAAM;IAAEO;EAAK,CAAC,GAAGL,eAAe;EAChC,MAAMM,cAAc,GAAGhB,eAAe,CAACa,WAAW,CAAC;EACnD,MAAMI,YAAY,GAAGH,YAAY,KAAKT,QAAQ,IAAIW,cAAc,KAAKJ,YAAY;EACjF,MAAMM,WAAW,GAAG;IAAEC,IAAI,EAAEJ;EAAK,CAAC;EAClC,MAAMK,gBAAgB,GAAGC,KAAK,CAACC,OAAO,CAACb,KAAK,CAAC;EAE7C,IAAI,CAACF,SAAS,EAAE;IACd,MAAMgB,gBAAgB,GAAG,CAAC,CAAC;IAC3BtB,SAAS,CAACuB,OAAO,CAAC,CAAC;MAAEC,GAAG;MAAEC;IAAM,CAAC,KAAK;MACpC,MAAMC,QAAQ,GAAGnB,WAAW,CAACiB,GAAG,CAAC;MACjC,MAAMG,MAAM,GAAGF,KAAK,IAAID,GAAG;MAC3B,IAAIE,QAAQ,EAAEJ,gBAAgB,CAACK,MAAM,CAAC,GAAGD,QAAQ;IACnD,CAAC,CAAC;IACF,MAAME,WAAW,GAAGT,gBAAgB,GAAG;MAAEU,KAAK,EAAErB;IAAM,CAAC,GAAGA,KAAK;IAE/D,uCAAYc,gBAAgB,GAAKM,WAAW;EAC9C;EAEA,IAAI,CAACb,cAAc,EAAE,OAAO;IAAE,CAACd,KAAK,GAAGW,WAAW;IAAE,CAACV,SAAS,GAAGM;EAAM,CAAC;EACxE,IAAIO,cAAc,KAAKL,uBAAuB,IAAIK,cAAc,KAAKJ,YAAY,EAAE;IACjF,MAAMmB,cAAc,GAAGX,gBAAgB,GAAGX,KAAK,GAAG,CAACA,KAAK,CAAC;IACzD,MAAMuB,WAAW,GAAGf,YAAY,GAC5B;MAAE,CAACb,QAAQ,GAAG2B,cAAc;MAAEb;IAAY,CAAC,GAC3C;MAAE,CAACd,QAAQ,GAAG2B;IAAe,CAAC;IAClC,OAAO;MACL,CAAC7B,KAAK,GAAGW,WAAW;MACpB,CAACV,SAAS,GAAG;QAAE,CAACa,cAAc,GAAGgB;MAAY;IAC/C,CAAC;EACH;EAEA,MAAMC,eAAe,GAAGhB,YAAY,GAChC;IAAE,CAACD,cAAc,GAAGP,KAAK;IAAES;EAAY,CAAC,GACxC;IAAE,CAACF,cAAc,GAAGP;EAAM,CAAC;EAC/B,OAAO;IAAE,CAACP,KAAK,GAAGW,WAAW;IAAE,CAACV,SAAS,GAAG8B;EAAgB,CAAC;AAC/D,CAAC;AAED,eAAe3B,gBAAgB"}
@@ -1,6 +1,5 @@
1
1
  function buildPropsToDisplayArray(propsToDisplay = []) {
2
2
  return propsToDisplay.map(prop => !!prop && !!prop.propertiesToDisplay && prop.propertiesToDisplay[0]).filter(Boolean);
3
3
  }
4
-
5
4
  export default buildPropsToDisplayArray;
6
5
  //# sourceMappingURL=build-props-to-display-array.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-props-to-display-array.js","names":["buildPropsToDisplayArray","propsToDisplay","map","prop","propertiesToDisplay","filter","Boolean"],"sources":["../../src/helpers/build-props-to-display-array.js"],"sourcesContent":["function buildPropsToDisplayArray(propsToDisplay = []) {\n return propsToDisplay\n .map(prop => !!prop && !!prop.propertiesToDisplay && prop.propertiesToDisplay[0])\n .filter(Boolean);\n}\n\nexport default buildPropsToDisplayArray;\n"],"mappings":"AAAA,SAASA,wBAAT,CAAkCC,cAAc,GAAG,EAAnD,EAAuD;EACrD,OAAOA,cAAc,CAClBC,GADI,CACAC,IAAI,IAAI,CAAC,CAACA,IAAF,IAAU,CAAC,CAACA,IAAI,CAACC,mBAAjB,IAAwCD,IAAI,CAACC,mBAAL,CAAyB,CAAzB,CADhD,EAEJC,MAFI,CAEGC,OAFH,CAAP;AAGD;;AAED,eAAeN,wBAAf"}
1
+ {"version":3,"file":"build-props-to-display-array.js","names":["buildPropsToDisplayArray","propsToDisplay","map","prop","propertiesToDisplay","filter","Boolean"],"sources":["../../src/helpers/build-props-to-display-array.js"],"sourcesContent":["function buildPropsToDisplayArray(propsToDisplay = []) {\n return propsToDisplay\n .map(prop => !!prop && !!prop.propertiesToDisplay && prop.propertiesToDisplay[0])\n .filter(Boolean);\n}\n\nexport default buildPropsToDisplayArray;\n"],"mappings":"AAAA,SAASA,wBAAwB,CAACC,cAAc,GAAG,EAAE,EAAE;EACrD,OAAOA,cAAc,CAClBC,GAAG,CAACC,IAAI,IAAI,CAAC,CAACA,IAAI,IAAI,CAAC,CAACA,IAAI,CAACC,mBAAmB,IAAID,IAAI,CAACC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAChFC,MAAM,CAACC,OAAO,CAAC;AACpB;AAEA,eAAeN,wBAAwB"}
@@ -2,22 +2,17 @@ const getValue = (propertiesToDisplay, getUser) => {
2
2
  const [baseProp, nestedProp] = propertiesToDisplay[0].split('.');
3
3
  const baseValue = getUser[baseProp];
4
4
  const isArray = Array.isArray(baseValue);
5
-
6
5
  if (nestedProp && baseValue) {
7
6
  let nestedValue;
8
-
9
7
  if (isArray) {
10
8
  nestedValue = baseValue.length ? baseValue.map(nested => nested ? nested[nestedProp] : '').join(', ') : '';
11
9
  } else {
12
10
  nestedValue = baseValue[nestedProp];
13
11
  }
14
-
15
12
  return nestedValue || '';
16
13
  }
17
-
18
14
  return baseValue || '';
19
15
  };
20
-
21
16
  const checkAndSetProps = (userPropsToDisplay, getUser) => {
22
17
  const userDataLayer = {};
23
18
  userPropsToDisplay.forEach(prop => {
@@ -26,19 +21,16 @@ const checkAndSetProps = (userPropsToDisplay, getUser) => {
26
21
  label,
27
22
  staticMetric
28
23
  } = prop;
29
-
30
24
  if (staticMetric) {
31
25
  userDataLayer[label] = staticMetric;
32
26
  return;
33
27
  }
34
-
35
28
  if (!propertiesToDisplay[0]) return;
36
29
  const value = getValue(propertiesToDisplay, getUser);
37
30
  userDataLayer[label] = value;
38
31
  });
39
32
  return userDataLayer;
40
33
  };
41
-
42
34
  const buildUserLayer = (userData, userPropsToDisplay) => {
43
35
  if (!userData || !userData.getUser) return {};
44
36
  const {
@@ -49,6 +41,5 @@ const buildUserLayer = (userData, userPropsToDisplay) => {
49
41
  user: userDataLayer
50
42
  };
51
43
  };
52
-
53
44
  export default buildUserLayer;
54
45
  //# sourceMappingURL=build-user-layer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-user-layer.js","names":["getValue","propertiesToDisplay","getUser","baseProp","nestedProp","split","baseValue","isArray","Array","nestedValue","length","map","nested","join","checkAndSetProps","userPropsToDisplay","userDataLayer","forEach","prop","label","staticMetric","value","buildUserLayer","userData","user"],"sources":["../../src/helpers/build-user-layer.js"],"sourcesContent":["const getValue = (propertiesToDisplay, getUser) => {\n const [baseProp, nestedProp] = propertiesToDisplay[0].split('.');\n const baseValue = getUser[baseProp];\n const isArray = Array.isArray(baseValue);\n if (nestedProp && baseValue) {\n let nestedValue;\n if (isArray) {\n nestedValue = baseValue.length\n ? baseValue.map(nested => (nested ? nested[nestedProp] : '')).join(', ')\n : '';\n } else {\n nestedValue = baseValue[nestedProp];\n }\n return nestedValue || '';\n }\n return baseValue || '';\n};\n\nconst checkAndSetProps = (userPropsToDisplay, getUser) => {\n const userDataLayer = {};\n userPropsToDisplay.forEach(prop => {\n const { propertiesToDisplay, label, staticMetric } = prop;\n if (staticMetric) {\n userDataLayer[label] = staticMetric;\n return;\n }\n if (!propertiesToDisplay[0]) return;\n const value = getValue(propertiesToDisplay, getUser);\n userDataLayer[label] = value;\n });\n\n return userDataLayer;\n};\n\nconst buildUserLayer = (userData, userPropsToDisplay) => {\n if (!userData || !userData.getUser) return {};\n const { getUser } = userData;\n\n const userDataLayer = checkAndSetProps(userPropsToDisplay, getUser);\n\n return { user: userDataLayer };\n};\n\nexport default buildUserLayer;\n"],"mappings":"AAAA,MAAMA,QAAQ,GAAG,CAACC,mBAAD,EAAsBC,OAAtB,KAAkC;EACjD,MAAM,CAACC,QAAD,EAAWC,UAAX,IAAyBH,mBAAmB,CAAC,CAAD,CAAnB,CAAuBI,KAAvB,CAA6B,GAA7B,CAA/B;EACA,MAAMC,SAAS,GAAGJ,OAAO,CAACC,QAAD,CAAzB;EACA,MAAMI,OAAO,GAAGC,KAAK,CAACD,OAAN,CAAcD,SAAd,CAAhB;;EACA,IAAIF,UAAU,IAAIE,SAAlB,EAA6B;IAC3B,IAAIG,WAAJ;;IACA,IAAIF,OAAJ,EAAa;MACXE,WAAW,GAAGH,SAAS,CAACI,MAAV,GACVJ,SAAS,CAACK,GAAV,CAAcC,MAAM,IAAKA,MAAM,GAAGA,MAAM,CAACR,UAAD,CAAT,GAAwB,EAAvD,EAA4DS,IAA5D,CAAiE,IAAjE,CADU,GAEV,EAFJ;IAGD,CAJD,MAIO;MACLJ,WAAW,GAAGH,SAAS,CAACF,UAAD,CAAvB;IACD;;IACD,OAAOK,WAAW,IAAI,EAAtB;EACD;;EACD,OAAOH,SAAS,IAAI,EAApB;AACD,CAhBD;;AAkBA,MAAMQ,gBAAgB,GAAG,CAACC,kBAAD,EAAqBb,OAArB,KAAiC;EACxD,MAAMc,aAAa,GAAG,EAAtB;EACAD,kBAAkB,CAACE,OAAnB,CAA2BC,IAAI,IAAI;IACjC,MAAM;MAAEjB,mBAAF;MAAuBkB,KAAvB;MAA8BC;IAA9B,IAA+CF,IAArD;;IACA,IAAIE,YAAJ,EAAkB;MAChBJ,aAAa,CAACG,KAAD,CAAb,GAAuBC,YAAvB;MACA;IACD;;IACD,IAAI,CAACnB,mBAAmB,CAAC,CAAD,CAAxB,EAA6B;IAC7B,MAAMoB,KAAK,GAAGrB,QAAQ,CAACC,mBAAD,EAAsBC,OAAtB,CAAtB;IACAc,aAAa,CAACG,KAAD,CAAb,GAAuBE,KAAvB;EACD,CATD;EAWA,OAAOL,aAAP;AACD,CAdD;;AAgBA,MAAMM,cAAc,GAAG,CAACC,QAAD,EAAWR,kBAAX,KAAkC;EACvD,IAAI,CAACQ,QAAD,IAAa,CAACA,QAAQ,CAACrB,OAA3B,EAAoC,OAAO,EAAP;EACpC,MAAM;IAAEA;EAAF,IAAcqB,QAApB;EAEA,MAAMP,aAAa,GAAGF,gBAAgB,CAACC,kBAAD,EAAqBb,OAArB,CAAtC;EAEA,OAAO;IAAEsB,IAAI,EAAER;EAAR,CAAP;AACD,CAPD;;AASA,eAAeM,cAAf"}
1
+ {"version":3,"file":"build-user-layer.js","names":["getValue","propertiesToDisplay","getUser","baseProp","nestedProp","split","baseValue","isArray","Array","nestedValue","length","map","nested","join","checkAndSetProps","userPropsToDisplay","userDataLayer","forEach","prop","label","staticMetric","value","buildUserLayer","userData","user"],"sources":["../../src/helpers/build-user-layer.js"],"sourcesContent":["const getValue = (propertiesToDisplay, getUser) => {\n const [baseProp, nestedProp] = propertiesToDisplay[0].split('.');\n const baseValue = getUser[baseProp];\n const isArray = Array.isArray(baseValue);\n if (nestedProp && baseValue) {\n let nestedValue;\n if (isArray) {\n nestedValue = baseValue.length\n ? baseValue.map(nested => (nested ? nested[nestedProp] : '')).join(', ')\n : '';\n } else {\n nestedValue = baseValue[nestedProp];\n }\n return nestedValue || '';\n }\n return baseValue || '';\n};\n\nconst checkAndSetProps = (userPropsToDisplay, getUser) => {\n const userDataLayer = {};\n userPropsToDisplay.forEach(prop => {\n const { propertiesToDisplay, label, staticMetric } = prop;\n if (staticMetric) {\n userDataLayer[label] = staticMetric;\n return;\n }\n if (!propertiesToDisplay[0]) return;\n const value = getValue(propertiesToDisplay, getUser);\n userDataLayer[label] = value;\n });\n\n return userDataLayer;\n};\n\nconst buildUserLayer = (userData, userPropsToDisplay) => {\n if (!userData || !userData.getUser) return {};\n const { getUser } = userData;\n\n const userDataLayer = checkAndSetProps(userPropsToDisplay, getUser);\n\n return { user: userDataLayer };\n};\n\nexport default buildUserLayer;\n"],"mappings":"AAAA,MAAMA,QAAQ,GAAG,CAACC,mBAAmB,EAAEC,OAAO,KAAK;EACjD,MAAM,CAACC,QAAQ,EAAEC,UAAU,CAAC,GAAGH,mBAAmB,CAAC,CAAC,CAAC,CAACI,KAAK,CAAC,GAAG,CAAC;EAChE,MAAMC,SAAS,GAAGJ,OAAO,CAACC,QAAQ,CAAC;EACnC,MAAMI,OAAO,GAAGC,KAAK,CAACD,OAAO,CAACD,SAAS,CAAC;EACxC,IAAIF,UAAU,IAAIE,SAAS,EAAE;IAC3B,IAAIG,WAAW;IACf,IAAIF,OAAO,EAAE;MACXE,WAAW,GAAGH,SAAS,CAACI,MAAM,GAC1BJ,SAAS,CAACK,GAAG,CAACC,MAAM,IAAKA,MAAM,GAAGA,MAAM,CAACR,UAAU,CAAC,GAAG,EAAG,CAAC,CAACS,IAAI,CAAC,IAAI,CAAC,GACtE,EAAE;IACR,CAAC,MAAM;MACLJ,WAAW,GAAGH,SAAS,CAACF,UAAU,CAAC;IACrC;IACA,OAAOK,WAAW,IAAI,EAAE;EAC1B;EACA,OAAOH,SAAS,IAAI,EAAE;AACxB,CAAC;AAED,MAAMQ,gBAAgB,GAAG,CAACC,kBAAkB,EAAEb,OAAO,KAAK;EACxD,MAAMc,aAAa,GAAG,CAAC,CAAC;EACxBD,kBAAkB,CAACE,OAAO,CAACC,IAAI,IAAI;IACjC,MAAM;MAAEjB,mBAAmB;MAAEkB,KAAK;MAAEC;IAAa,CAAC,GAAGF,IAAI;IACzD,IAAIE,YAAY,EAAE;MAChBJ,aAAa,CAACG,KAAK,CAAC,GAAGC,YAAY;MACnC;IACF;IACA,IAAI,CAACnB,mBAAmB,CAAC,CAAC,CAAC,EAAE;IAC7B,MAAMoB,KAAK,GAAGrB,QAAQ,CAACC,mBAAmB,EAAEC,OAAO,CAAC;IACpDc,aAAa,CAACG,KAAK,CAAC,GAAGE,KAAK;EAC9B,CAAC,CAAC;EAEF,OAAOL,aAAa;AACtB,CAAC;AAED,MAAMM,cAAc,GAAG,CAACC,QAAQ,EAAER,kBAAkB,KAAK;EACvD,IAAI,CAACQ,QAAQ,IAAI,CAACA,QAAQ,CAACrB,OAAO,EAAE,OAAO,CAAC,CAAC;EAC7C,MAAM;IAAEA;EAAQ,CAAC,GAAGqB,QAAQ;EAE5B,MAAMP,aAAa,GAAGF,gBAAgB,CAACC,kBAAkB,EAAEb,OAAO,CAAC;EAEnE,OAAO;IAAEsB,IAAI,EAAER;EAAc,CAAC;AAChC,CAAC;AAED,eAAeM,cAAc"}
@@ -7,7 +7,6 @@ const buildUserQueryProps = userProps => {
7
7
  }) => {
8
8
  const [propKey] = propertiesToDisplay;
9
9
  if (!propKey || propKey === 'id') return;
10
-
11
10
  if (propKey.indexOf('.') !== -1) {
12
11
  const [baseProp, nestedProp] = propKey.split('.');
13
12
  if (nestedProps[baseProp]) nestedProps[baseProp].push(nestedProp);else nestedProps[baseProp] = [nestedProp];
@@ -22,6 +21,5 @@ const buildUserQueryProps = userProps => {
22
21
  });
23
22
  return basicProps.join(' ');
24
23
  };
25
-
26
24
  export default buildUserQueryProps;
27
25
  //# sourceMappingURL=build-user-query-props.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-user-query-props.js","names":["buildUserQueryProps","userProps","length","basicProps","nestedProps","forEach","propertiesToDisplay","propKey","indexOf","baseProp","nestedProp","split","push","Object","keys","nestedKey","nested","prop","join"],"sources":["../../src/helpers/build-user-query-props.js"],"sourcesContent":["const buildUserQueryProps = userProps => {\n if (!userProps || !userProps.length) return '';\n const basicProps = [];\n const nestedProps = {};\n userProps.forEach(({ propertiesToDisplay }) => {\n const [propKey] = propertiesToDisplay;\n if (!propKey || propKey === 'id') return;\n if (propKey.indexOf('.') !== -1) {\n const [baseProp, nestedProp] = propKey.split('.');\n if (nestedProps[baseProp]) nestedProps[baseProp].push(nestedProp);\n else nestedProps[baseProp] = [nestedProp];\n } else basicProps.push(propKey);\n });\n\n Object.keys(nestedProps).forEach(nestedKey => {\n const nested = nestedProps[nestedKey];\n basicProps.push(nestedKey);\n basicProps.push('{');\n nested.forEach(prop => basicProps.push(prop));\n basicProps.push('}');\n });\n\n return basicProps.join(' ');\n};\n\nexport default buildUserQueryProps;\n"],"mappings":"AAAA,MAAMA,mBAAmB,GAAGC,SAAS,IAAI;EACvC,IAAI,CAACA,SAAD,IAAc,CAACA,SAAS,CAACC,MAA7B,EAAqC,OAAO,EAAP;EACrC,MAAMC,UAAU,GAAG,EAAnB;EACA,MAAMC,WAAW,GAAG,EAApB;EACAH,SAAS,CAACI,OAAV,CAAkB,CAAC;IAAEC;EAAF,CAAD,KAA6B;IAC7C,MAAM,CAACC,OAAD,IAAYD,mBAAlB;IACA,IAAI,CAACC,OAAD,IAAYA,OAAO,KAAK,IAA5B,EAAkC;;IAClC,IAAIA,OAAO,CAACC,OAAR,CAAgB,GAAhB,MAAyB,CAAC,CAA9B,EAAiC;MAC/B,MAAM,CAACC,QAAD,EAAWC,UAAX,IAAyBH,OAAO,CAACI,KAAR,CAAc,GAAd,CAA/B;MACA,IAAIP,WAAW,CAACK,QAAD,CAAf,EAA2BL,WAAW,CAACK,QAAD,CAAX,CAAsBG,IAAtB,CAA2BF,UAA3B,EAA3B,KACKN,WAAW,CAACK,QAAD,CAAX,GAAwB,CAACC,UAAD,CAAxB;IACN,CAJD,MAIOP,UAAU,CAACS,IAAX,CAAgBL,OAAhB;EACR,CARD;EAUAM,MAAM,CAACC,IAAP,CAAYV,WAAZ,EAAyBC,OAAzB,CAAiCU,SAAS,IAAI;IAC5C,MAAMC,MAAM,GAAGZ,WAAW,CAACW,SAAD,CAA1B;IACAZ,UAAU,CAACS,IAAX,CAAgBG,SAAhB;IACAZ,UAAU,CAACS,IAAX,CAAgB,GAAhB;IACAI,MAAM,CAACX,OAAP,CAAeY,IAAI,IAAId,UAAU,CAACS,IAAX,CAAgBK,IAAhB,CAAvB;IACAd,UAAU,CAACS,IAAX,CAAgB,GAAhB;EACD,CAND;EAQA,OAAOT,UAAU,CAACe,IAAX,CAAgB,GAAhB,CAAP;AACD,CAvBD;;AAyBA,eAAelB,mBAAf"}
1
+ {"version":3,"file":"build-user-query-props.js","names":["buildUserQueryProps","userProps","length","basicProps","nestedProps","forEach","propertiesToDisplay","propKey","indexOf","baseProp","nestedProp","split","push","Object","keys","nestedKey","nested","prop","join"],"sources":["../../src/helpers/build-user-query-props.js"],"sourcesContent":["const buildUserQueryProps = userProps => {\n if (!userProps || !userProps.length) return '';\n const basicProps = [];\n const nestedProps = {};\n userProps.forEach(({ propertiesToDisplay }) => {\n const [propKey] = propertiesToDisplay;\n if (!propKey || propKey === 'id') return;\n if (propKey.indexOf('.') !== -1) {\n const [baseProp, nestedProp] = propKey.split('.');\n if (nestedProps[baseProp]) nestedProps[baseProp].push(nestedProp);\n else nestedProps[baseProp] = [nestedProp];\n } else basicProps.push(propKey);\n });\n\n Object.keys(nestedProps).forEach(nestedKey => {\n const nested = nestedProps[nestedKey];\n basicProps.push(nestedKey);\n basicProps.push('{');\n nested.forEach(prop => basicProps.push(prop));\n basicProps.push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B,CAAC;AAED,eAAelB,mBAAmB"}
@@ -1,5 +1,4 @@
1
1
  import { ON_CLICK } from '../constants';
2
-
3
2
  const filterGtmEvents = gtmEvents => {
4
3
  const clickEvents = [];
5
4
  const regularEvents = [];
@@ -11,6 +10,5 @@ const filterGtmEvents = gtmEvents => {
11
10
  regularEvents
12
11
  };
13
12
  };
14
-
15
13
  export default filterGtmEvents;
16
14
  //# sourceMappingURL=filter-gtm-events.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter-gtm-events.js","names":["ON_CLICK","filterGtmEvents","gtmEvents","clickEvents","regularEvents","forEach","event","eventTrigger","push"],"sources":["../../src/helpers/filter-gtm-events.js"],"sourcesContent":["import { ON_CLICK } from '../constants';\n\nconst filterGtmEvents = gtmEvents => {\n const clickEvents = [];\n const regularEvents = [];\n gtmEvents.forEach(event => {\n event.eventTrigger && event.eventTrigger === ON_CLICK\n ? clickEvents.push(event)\n : regularEvents.push(event);\n });\n\n return { clickEvents, regularEvents };\n};\n\nexport default filterGtmEvents;\n"],"mappings":"AAAA,SAASA,QAAT,QAAyB,cAAzB;;AAEA,MAAMC,eAAe,GAAGC,SAAS,IAAI;EACnC,MAAMC,WAAW,GAAG,EAApB;EACA,MAAMC,aAAa,GAAG,EAAtB;EACAF,SAAS,CAACG,OAAV,CAAkBC,KAAK,IAAI;IACzBA,KAAK,CAACC,YAAN,IAAsBD,KAAK,CAACC,YAAN,KAAuBP,QAA7C,GACIG,WAAW,CAACK,IAAZ,CAAiBF,KAAjB,CADJ,GAEIF,aAAa,CAACI,IAAd,CAAmBF,KAAnB,CAFJ;EAGD,CAJD;EAMA,OAAO;IAAEH,WAAF;IAAeC;EAAf,CAAP;AACD,CAVD;;AAYA,eAAeH,eAAf"}
1
+ {"version":3,"file":"filter-gtm-events.js","names":["ON_CLICK","filterGtmEvents","gtmEvents","clickEvents","regularEvents","forEach","event","eventTrigger","push"],"sources":["../../src/helpers/filter-gtm-events.js"],"sourcesContent":["import { ON_CLICK } from '../constants';\n\nconst filterGtmEvents = gtmEvents => {\n const clickEvents = [];\n const regularEvents = [];\n gtmEvents.forEach(event => {\n event.eventTrigger && event.eventTrigger === ON_CLICK\n ? clickEvents.push(event)\n : regularEvents.push(event);\n });\n\n return { clickEvents, regularEvents };\n};\n\nexport default filterGtmEvents;\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,MAAMC,eAAe,GAAGC,SAAS,IAAI;EACnC,MAAMC,WAAW,GAAG,EAAE;EACtB,MAAMC,aAAa,GAAG,EAAE;EACxBF,SAAS,CAACG,OAAO,CAACC,KAAK,IAAI;IACzBA,KAAK,CAACC,YAAY,IAAID,KAAK,CAACC,YAAY,KAAKP,QAAQ,GACjDG,WAAW,CAACK,IAAI,CAACF,KAAK,CAAC,GACvBF,aAAa,CAACI,IAAI,CAACF,KAAK,CAAC;EAC/B,CAAC,CAAC;EAEF,OAAO;IAAEH,WAAW;IAAEC;EAAc,CAAC;AACvC,CAAC;AAED,eAAeH,eAAe"}
@@ -4,6 +4,5 @@ const getIdsToUse = parentData => {
4
4
  id
5
5
  }) => id);
6
6
  };
7
-
8
7
  export default getIdsToUse;
9
8
  //# sourceMappingURL=get-ids-to-use.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-ids-to-use.js","names":["getIdsToUse","parentData","length","map","id"],"sources":["../../src/helpers/get-ids-to-use.js"],"sourcesContent":["const getIdsToUse = parentData => {\n if (!parentData || !parentData.length) return [];\n\n return parentData.map(({ id }) => id);\n};\n\nexport default getIdsToUse;\n"],"mappings":"AAAA,MAAMA,WAAW,GAAGC,UAAU,IAAI;EAChC,IAAI,CAACA,UAAD,IAAe,CAACA,UAAU,CAACC,MAA/B,EAAuC,OAAO,EAAP;EAEvC,OAAOD,UAAU,CAACE,GAAX,CAAe,CAAC;IAAEC;EAAF,CAAD,KAAYA,EAA3B,CAAP;AACD,CAJD;;AAMA,eAAeJ,WAAf"}
1
+ {"version":3,"file":"get-ids-to-use.js","names":["getIdsToUse","parentData","length","map","id"],"sources":["../../src/helpers/get-ids-to-use.js"],"sourcesContent":["const getIdsToUse = parentData => {\n if (!parentData || !parentData.length) return [];\n\n return parentData.map(({ id }) => id);\n};\n\nexport default getIdsToUse;\n"],"mappings":"AAAA,MAAMA,WAAW,GAAGC,UAAU,IAAI;EAChC,IAAI,CAACA,UAAU,IAAI,CAACA,UAAU,CAACC,MAAM,EAAE,OAAO,EAAE;EAEhD,OAAOD,UAAU,CAACE,GAAG,CAAC,CAAC;IAAEC;EAAG,CAAC,KAAKA,EAAE,CAAC;AACvC,CAAC;AAED,eAAeJ,WAAW"}
@@ -1,5 +1,4 @@
1
1
  import { generateSingleItemQuery, generateMultiItemQuery } from '@blaze-cms/react-page-builder';
2
-
3
2
  const getRenderProps = (extraProps, isPreview, data, useMultiQuery) => {
4
3
  const {
5
4
  getEntitySchema
@@ -22,6 +21,5 @@ const getRenderProps = (extraProps, isPreview, data, useMultiQuery) => {
22
21
  actionKey
23
22
  };
24
23
  };
25
-
26
24
  export default getRenderProps;
27
25
  //# sourceMappingURL=get-render-props.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-render-props.js","names":["generateSingleItemQuery","generateMultiItemQuery","getRenderProps","extraProps","isPreview","data","useMultiQuery","getEntitySchema","actions","get","getPublished","getAll","getAllPublished","queryToUse","singleActionKey","multiActionKey","actionKey","action"],"sources":["../../src/helpers/get-render-props.js"],"sourcesContent":["import { generateSingleItemQuery, generateMultiItemQuery } from '@blaze-cms/react-page-builder';\n\nconst getRenderProps = (extraProps, isPreview, data, useMultiQuery) => {\n const { getEntitySchema } = data;\n const {\n actions: { get, getPublished, getAll, getAllPublished }\n } = getEntitySchema;\n const queryToUse = useMultiQuery ? generateMultiItemQuery : generateSingleItemQuery;\n const singleActionKey = isPreview ? get : getPublished || get;\n const multiActionKey = isPreview ? getAll : getAllPublished || getAll;\n const actionKey = useMultiQuery ? multiActionKey : singleActionKey;\n const action = queryToUse(actionKey, extraProps);\n\n return { action, actionKey };\n};\n\nexport default getRenderProps;\n"],"mappings":"AAAA,SAASA,uBAAT,EAAkCC,sBAAlC,QAAgE,+BAAhE;;AAEA,MAAMC,cAAc,GAAG,CAACC,UAAD,EAAaC,SAAb,EAAwBC,IAAxB,EAA8BC,aAA9B,KAAgD;EACrE,MAAM;IAAEC;EAAF,IAAsBF,IAA5B;EACA,MAAM;IACJG,OAAO,EAAE;MAAEC,GAAF;MAAOC,YAAP;MAAqBC,MAArB;MAA6BC;IAA7B;EADL,IAEFL,eAFJ;EAGA,MAAMM,UAAU,GAAGP,aAAa,GAAGL,sBAAH,GAA4BD,uBAA5D;EACA,MAAMc,eAAe,GAAGV,SAAS,GAAGK,GAAH,GAASC,YAAY,IAAID,GAA1D;EACA,MAAMM,cAAc,GAAGX,SAAS,GAAGO,MAAH,GAAYC,eAAe,IAAID,MAA/D;EACA,MAAMK,SAAS,GAAGV,aAAa,GAAGS,cAAH,GAAoBD,eAAnD;EACA,MAAMG,MAAM,GAAGJ,UAAU,CAACG,SAAD,EAAYb,UAAZ,CAAzB;EAEA,OAAO;IAAEc,MAAF;IAAUD;EAAV,CAAP;AACD,CAZD;;AAcA,eAAed,cAAf"}
1
+ {"version":3,"file":"get-render-props.js","names":["generateSingleItemQuery","generateMultiItemQuery","getRenderProps","extraProps","isPreview","data","useMultiQuery","getEntitySchema","actions","get","getPublished","getAll","getAllPublished","queryToUse","singleActionKey","multiActionKey","actionKey","action"],"sources":["../../src/helpers/get-render-props.js"],"sourcesContent":["import { generateSingleItemQuery, generateMultiItemQuery } from '@blaze-cms/react-page-builder';\n\nconst getRenderProps = (extraProps, isPreview, data, useMultiQuery) => {\n const { getEntitySchema } = data;\n const {\n actions: { get, getPublished, getAll, getAllPublished }\n } = getEntitySchema;\n const queryToUse = useMultiQuery ? generateMultiItemQuery : generateSingleItemQuery;\n const singleActionKey = isPreview ? get : getPublished || get;\n const multiActionKey = isPreview ? getAll : getAllPublished || getAll;\n const actionKey = useMultiQuery ? multiActionKey : singleActionKey;\n const action = queryToUse(actionKey, extraProps);\n\n return { action, actionKey };\n};\n\nexport default getRenderProps;\n"],"mappings":"AAAA,SAASA,uBAAuB,EAAEC,sBAAsB,QAAQ,+BAA+B;AAE/F,MAAMC,cAAc,GAAG,CAACC,UAAU,EAAEC,SAAS,EAAEC,IAAI,EAAEC,aAAa,KAAK;EACrE,MAAM;IAAEC;EAAgB,CAAC,GAAGF,IAAI;EAChC,MAAM;IACJG,OAAO,EAAE;MAAEC,GAAG;MAAEC,YAAY;MAAEC,MAAM;MAAEC;IAAgB;EACxD,CAAC,GAAGL,eAAe;EACnB,MAAMM,UAAU,GAAGP,aAAa,GAAGL,sBAAsB,GAAGD,uBAAuB;EACnF,MAAMc,eAAe,GAAGV,SAAS,GAAGK,GAAG,GAAGC,YAAY,IAAID,GAAG;EAC7D,MAAMM,cAAc,GAAGX,SAAS,GAAGO,MAAM,GAAGC,eAAe,IAAID,MAAM;EACrE,MAAMK,SAAS,GAAGV,aAAa,GAAGS,cAAc,GAAGD,eAAe;EAClE,MAAMG,MAAM,GAAGJ,UAAU,CAACG,SAAS,EAAEb,UAAU,CAAC;EAEhD,OAAO;IAAEc,MAAM;IAAED;EAAU,CAAC;AAC9B,CAAC;AAED,eAAed,cAAc"}