@blaze-cms/plugin-gtm-fe 0.146.0-translations.6 → 0.147.0-rc-eagle.2

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 (86) hide show
  1. package/lib/GoogleTagManager/GTMFactory.js +32 -37
  2. package/lib/GoogleTagManager/GTMFactory.js.map +1 -1
  3. package/lib/GoogleTagManager/GTMRender.js +47 -59
  4. package/lib/GoogleTagManager/GTMRender.js.map +1 -1
  5. package/lib/GoogleTagManager/index.js +2 -3
  6. package/lib/GoogleTagManager/index.js.map +1 -1
  7. package/lib/GoogleTagManagerEvent/GTMClickEvent.js +35 -40
  8. package/lib/GoogleTagManagerEvent/GTMClickEvent.js.map +1 -1
  9. package/lib/GoogleTagManagerEvent/GTMClickEvents.js +21 -23
  10. package/lib/GoogleTagManagerEvent/GTMClickEvents.js.map +1 -1
  11. package/lib/GoogleTagManagerEvent/GTMEvent.js +24 -33
  12. package/lib/GoogleTagManagerEvent/GTMEvent.js.map +1 -1
  13. package/lib/GoogleTagManagerEvent/GTMEventFactory.js +50 -60
  14. package/lib/GoogleTagManagerEvent/GTMEventFactory.js.map +1 -1
  15. package/lib/GoogleTagManagerEvent/GTMEventRender.js +53 -71
  16. package/lib/GoogleTagManagerEvent/GTMEventRender.js.map +1 -1
  17. package/lib/GoogleTagManagerEvent/GTMEventSwitch.js +20 -18
  18. package/lib/GoogleTagManagerEvent/GTMEventSwitch.js.map +1 -1
  19. package/lib/GoogleTagManagerEvent/index.js +2 -3
  20. package/lib/GoogleTagManagerEvent/index.js.map +1 -1
  21. package/lib/constants.js +12 -13
  22. package/lib/constants.js.map +1 -1
  23. package/lib/helpers/build-and-push-web-vitals.js +10 -11
  24. package/lib/helpers/build-and-push-web-vitals.js.map +1 -1
  25. package/lib/helpers/build-data-layer.js +20 -48
  26. package/lib/helpers/build-data-layer.js.map +1 -1
  27. package/lib/helpers/build-nested-event.js +54 -38
  28. package/lib/helpers/build-nested-event.js.map +1 -1
  29. package/lib/helpers/build-props-to-display-array.js +4 -11
  30. package/lib/helpers/build-props-to-display-array.js.map +1 -1
  31. package/lib/helpers/build-user-layer.js +22 -32
  32. package/lib/helpers/build-user-layer.js.map +1 -1
  33. package/lib/helpers/build-user-query-props.js +13 -27
  34. package/lib/helpers/build-user-query-props.js.map +1 -1
  35. package/lib/helpers/filter-gtm-events.js +8 -12
  36. package/lib/helpers/filter-gtm-events.js.map +1 -1
  37. package/lib/helpers/get-ids-to-use.js +6 -9
  38. package/lib/helpers/get-ids-to-use.js.map +1 -1
  39. package/lib/helpers/get-render-props.js +21 -17
  40. package/lib/helpers/get-render-props.js.map +1 -1
  41. package/lib/helpers/index.js +20 -21
  42. package/lib/helpers/index.js.map +1 -1
  43. package/lib/helpers/push-to-data-layer.js +4 -5
  44. package/lib/helpers/push-to-data-layer.js.map +1 -1
  45. package/lib/helpers/reset-data-layer.js +10 -23
  46. package/lib/helpers/reset-data-layer.js.map +1 -1
  47. package/lib/index.js +17 -51
  48. package/lib/index.js.map +1 -1
  49. package/lib-es/GoogleTagManager/GTMFactory.js.map +1 -1
  50. package/lib-es/GoogleTagManager/GTMRender.js +4 -10
  51. package/lib-es/GoogleTagManager/GTMRender.js.map +1 -1
  52. package/lib-es/GoogleTagManager/index.js.map +1 -1
  53. package/lib-es/GoogleTagManagerEvent/GTMClickEvent.js +2 -2
  54. package/lib-es/GoogleTagManagerEvent/GTMClickEvent.js.map +1 -1
  55. package/lib-es/GoogleTagManagerEvent/GTMClickEvents.js.map +1 -1
  56. package/lib-es/GoogleTagManagerEvent/GTMEvent.js +6 -3
  57. package/lib-es/GoogleTagManagerEvent/GTMEvent.js.map +1 -1
  58. package/lib-es/GoogleTagManagerEvent/GTMEventFactory.js.map +1 -1
  59. package/lib-es/GoogleTagManagerEvent/GTMEventRender.js +4 -10
  60. package/lib-es/GoogleTagManagerEvent/GTMEventRender.js.map +1 -1
  61. package/lib-es/GoogleTagManagerEvent/GTMEventSwitch.js.map +1 -1
  62. package/lib-es/GoogleTagManagerEvent/index.js.map +1 -1
  63. package/lib-es/constants.js.map +1 -1
  64. package/lib-es/helpers/build-and-push-web-vitals.js.map +1 -1
  65. package/lib-es/helpers/build-data-layer.js.map +1 -1
  66. package/lib-es/helpers/build-nested-event.js.map +1 -1
  67. package/lib-es/helpers/build-props-to-display-array.js.map +1 -1
  68. package/lib-es/helpers/build-user-layer.js.map +1 -1
  69. package/lib-es/helpers/build-user-query-props.js.map +1 -1
  70. package/lib-es/helpers/filter-gtm-events.js.map +1 -1
  71. package/lib-es/helpers/get-ids-to-use.js.map +1 -1
  72. package/lib-es/helpers/get-render-props.js.map +1 -1
  73. package/lib-es/helpers/index.js.map +1 -1
  74. package/lib-es/helpers/push-to-data-layer.js.map +1 -1
  75. package/lib-es/helpers/reset-data-layer.js.map +1 -1
  76. package/lib-es/index.js +2 -2
  77. package/lib-es/index.js.map +1 -1
  78. package/package.json +19 -15
  79. package/src/GoogleTagManager/GTMRender.js +4 -6
  80. package/src/GoogleTagManagerEvent/GTMClickEvent.js +3 -2
  81. package/src/GoogleTagManagerEvent/GTMEvent.js +9 -8
  82. package/src/GoogleTagManagerEvent/GTMEventRender.js +4 -6
  83. package/src/index.js +5 -4
  84. package/CHANGELOG.md +0 -1779
  85. package/babel.config.js +0 -3
  86. package/jest.config.js +0 -3
@@ -1,45 +1,31 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.define-property.js");
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
- exports["default"] = void 0;
9
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
- require("core-js/modules/es.array.for-each.js");
11
- require("core-js/modules/es.object.to-string.js");
12
- require("core-js/modules/web.dom-collections.for-each.js");
13
- require("core-js/modules/es.array.index-of.js");
14
- require("core-js/modules/es.object.keys.js");
15
- require("core-js/modules/es.array.join.js");
16
- var buildUserQueryProps = function buildUserQueryProps(userProps) {
6
+ exports.default = void 0;
7
+ const buildUserQueryProps = userProps => {
17
8
  if (!userProps || !userProps.length) return '';
18
- var basicProps = [];
19
- var nestedProps = {};
20
- userProps.forEach(function (_ref) {
21
- var propertiesToDisplay = _ref.propertiesToDisplay;
22
- var _propertiesToDisplay = (0, _slicedToArray2["default"])(propertiesToDisplay, 1),
23
- propKey = _propertiesToDisplay[0];
9
+ const basicProps = [];
10
+ const nestedProps = {};
11
+ userProps.forEach(({
12
+ propertiesToDisplay
13
+ }) => {
14
+ const [propKey] = propertiesToDisplay;
24
15
  if (!propKey || propKey === 'id') return;
25
16
  if (propKey.indexOf('.') !== -1) {
26
- var _propKey$split = propKey.split('.'),
27
- _propKey$split2 = (0, _slicedToArray2["default"])(_propKey$split, 2),
28
- baseProp = _propKey$split2[0],
29
- nestedProp = _propKey$split2[1];
17
+ const [baseProp, nestedProp] = propKey.split('.');
30
18
  if (nestedProps[baseProp]) nestedProps[baseProp].push(nestedProp);else nestedProps[baseProp] = [nestedProp];
31
19
  } else basicProps.push(propKey);
32
20
  });
33
- Object.keys(nestedProps).forEach(function (nestedKey) {
34
- var nested = nestedProps[nestedKey];
21
+ Object.keys(nestedProps).forEach(nestedKey => {
22
+ const nested = nestedProps[nestedKey];
35
23
  basicProps.push(nestedKey);
36
24
  basicProps.push('{');
37
- nested.forEach(function (prop) {
38
- return basicProps.push(prop);
39
- });
25
+ nested.forEach(prop => basicProps.push(prop));
40
26
  basicProps.push('}');
41
27
  });
42
28
  return basicProps.join(' ');
43
29
  };
44
- var _default = exports["default"] = buildUserQueryProps;
30
+ var _default = exports.default = buildUserQueryProps;
45
31
  //# 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","_ref","propertiesToDisplay","_propertiesToDisplay","_slicedToArray2","propKey","indexOf","_propKey$split","split","_propKey$split2","baseProp","nestedProp","push","Object","keys","nestedKey","nested","prop","join","_default","exports"],"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,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAGC,SAAS,EAAI;EACvC,IAAI,CAACA,SAAS,IAAI,CAACA,SAAS,CAACC,MAAM,EAAE,OAAO,EAAE;EAC9C,IAAMC,UAAU,GAAG,EAAE;EACrB,IAAMC,WAAW,GAAG,CAAC,CAAC;EACtBH,SAAS,CAACI,OAAO,CAAC,UAAAC,IAAA,EAA6B;IAAA,IAA1BC,mBAAmB,GAAAD,IAAA,CAAnBC,mBAAmB;IACtC,IAAAC,oBAAA,OAAAC,eAAA,aAAkBF,mBAAmB;MAA9BG,OAAO,GAAAF,oBAAA;IACd,IAAI,CAACE,OAAO,IAAIA,OAAO,KAAK,IAAI,EAAE;IAClC,IAAIA,OAAO,CAACC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;MAC/B,IAAAC,cAAA,GAA+BF,OAAO,CAACG,KAAK,CAAC,GAAG,CAAC;QAAAC,eAAA,OAAAL,eAAA,aAAAG,cAAA;QAA1CG,QAAQ,GAAAD,eAAA;QAAEE,UAAU,GAAAF,eAAA;MAC3B,IAAIV,WAAW,CAACW,QAAQ,CAAC,EAAEX,WAAW,CAACW,QAAQ,CAAC,CAACE,IAAI,CAACD,UAAU,CAAC,CAAC,KAC7DZ,WAAW,CAACW,QAAQ,CAAC,GAAG,CAACC,UAAU,CAAC;IAC3C,CAAC,MAAMb,UAAU,CAACc,IAAI,CAACP,OAAO,CAAC;EACjC,CAAC,CAAC;EAEFQ,MAAM,CAACC,IAAI,CAACf,WAAW,CAAC,CAACC,OAAO,CAAC,UAAAe,SAAS,EAAI;IAC5C,IAAMC,MAAM,GAAGjB,WAAW,CAACgB,SAAS,CAAC;IACrCjB,UAAU,CAACc,IAAI,CAACG,SAAS,CAAC;IAC1BjB,UAAU,CAACc,IAAI,CAAC,GAAG,CAAC;IACpBI,MAAM,CAAChB,OAAO,CAAC,UAAAiB,IAAI;MAAA,OAAInB,UAAU,CAACc,IAAI,CAACK,IAAI,CAAC;IAAA,EAAC;IAC7CnB,UAAU,CAACc,IAAI,CAAC,GAAG,CAAC;EACtB,CAAC,CAAC;EAEF,OAAOd,UAAU,CAACoB,IAAI,CAAC,GAAG,CAAC;AAC7B,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEazB,mBAAmB"}
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","_default","exports","default"],"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,SAAS,IAAI,CAACA,SAAS,CAACC,MAAM,EAAE,OAAO,EAAE;EAC9C,MAAMC,UAAU,GAAG,EAAE;EACrB,MAAMC,WAAW,GAAG,CAAC,CAAC;EACtBH,SAAS,CAACI,OAAO,CAAC,CAAC;IAAEC;EAAoB,CAAC,KAAK;IAC7C,MAAM,CAACC,OAAO,CAAC,GAAGD,mBAAmB;IACrC,IAAI,CAACC,OAAO,IAAIA,OAAO,KAAK,IAAI,EAAE;IAClC,IAAIA,OAAO,CAACC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;MAC/B,MAAM,CAACC,QAAQ,EAAEC,UAAU,CAAC,GAAGH,OAAO,CAACI,KAAK,CAAC,GAAG,CAAC;MACjD,IAAIP,WAAW,CAACK,QAAQ,CAAC,EAAEL,WAAW,CAACK,QAAQ,CAAC,CAACG,IAAI,CAACF,UAAU,CAAC,CAAC,KAC7DN,WAAW,CAACK,QAAQ,CAAC,GAAG,CAACC,UAAU,CAAC;IAC3C,CAAC,MAAMP,UAAU,CAACS,IAAI,CAACL,OAAO,CAAC;EACjC,CAAC,CAAC;EAEFM,MAAM,CAACC,IAAI,CAACV,WAAW,CAAC,CAACC,OAAO,CAACU,SAAS,IAAI;IAC5C,MAAMC,MAAM,GAAGZ,WAAW,CAACW,SAAS,CAAC;IACrCZ,UAAU,CAACS,IAAI,CAACG,SAAS,CAAC;IAC1BZ,UAAU,CAACS,IAAI,CAAC,GAAG,CAAC;IACpBI,MAAM,CAACX,OAAO,CAACY,IAAI,IAAId,UAAU,CAACS,IAAI,CAACK,IAAI,CAAC,CAAC;IAC7Cd,UAAU,CAACS,IAAI,CAAC,GAAG,CAAC;EACtB,CAAC,CAAC;EAEF,OAAOT,UAAU,CAACe,IAAI,CAAC,GAAG,CAAC;AAC7B,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEarB,mBAAmB","ignoreList":[]}
@@ -1,24 +1,20 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.define-property.js");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports["default"] = void 0;
8
- require("core-js/modules/es.array.for-each.js");
9
- require("core-js/modules/es.object.to-string.js");
10
- require("core-js/modules/web.dom-collections.for-each.js");
6
+ exports.default = void 0;
11
7
  var _constants = require("../constants");
12
- var filterGtmEvents = function filterGtmEvents(gtmEvents) {
13
- var clickEvents = [];
14
- var regularEvents = [];
15
- gtmEvents.forEach(function (event) {
8
+ const filterGtmEvents = gtmEvents => {
9
+ const clickEvents = [];
10
+ const regularEvents = [];
11
+ gtmEvents.forEach(event => {
16
12
  event.eventTrigger && event.eventTrigger === _constants.ON_CLICK ? clickEvents.push(event) : regularEvents.push(event);
17
13
  });
18
14
  return {
19
- clickEvents: clickEvents,
20
- regularEvents: regularEvents
15
+ clickEvents,
16
+ regularEvents
21
17
  };
22
18
  };
23
- var _default = exports["default"] = filterGtmEvents;
19
+ var _default = exports.default = filterGtmEvents;
24
20
  //# sourceMappingURL=filter-gtm-events.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter-gtm-events.js","names":["_constants","require","filterGtmEvents","gtmEvents","clickEvents","regularEvents","forEach","event","eventTrigger","ON_CLICK","push","_default","exports"],"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,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAGC,SAAS,EAAI;EACnC,IAAMC,WAAW,GAAG,EAAE;EACtB,IAAMC,aAAa,GAAG,EAAE;EACxBF,SAAS,CAACG,OAAO,CAAC,UAAAC,KAAK,EAAI;IACzBA,KAAK,CAACC,YAAY,IAAID,KAAK,CAACC,YAAY,KAAKC,mBAAQ,GACjDL,WAAW,CAACM,IAAI,CAACH,KAAK,CAAC,GACvBF,aAAa,CAACK,IAAI,CAACH,KAAK,CAAC;EAC/B,CAAC,CAAC;EAEF,OAAO;IAAEH,WAAW,EAAXA,WAAW;IAAEC,aAAa,EAAbA;EAAc,CAAC;AACvC,CAAC;AAAC,IAAAM,QAAA,GAAAC,OAAA,cAEaV,eAAe"}
1
+ {"version":3,"file":"filter-gtm-events.js","names":["_constants","require","filterGtmEvents","gtmEvents","clickEvents","regularEvents","forEach","event","eventTrigger","ON_CLICK","push","_default","exports","default"],"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,IAAAA,UAAA,GAAAC,OAAA;AAEA,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,KAAKC,mBAAQ,GACjDL,WAAW,CAACM,IAAI,CAACH,KAAK,CAAC,GACvBF,aAAa,CAACK,IAAI,CAACH,KAAK,CAAC;EAC/B,CAAC,CAAC;EAEF,OAAO;IAAEH,WAAW;IAAEC;EAAc,CAAC;AACvC,CAAC;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaX,eAAe","ignoreList":[]}
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.define-property.js");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports["default"] = void 0;
8
- require("core-js/modules/es.array.map.js");
9
- var getIdsToUse = function getIdsToUse(parentData) {
6
+ exports.default = void 0;
7
+ const getIdsToUse = parentData => {
10
8
  if (!parentData || !parentData.length) return [];
11
- return parentData.map(function (_ref) {
12
- var id = _ref.id;
13
- return id;
14
- });
9
+ return parentData.map(({
10
+ id
11
+ }) => id);
15
12
  };
16
- var _default = exports["default"] = getIdsToUse;
13
+ var _default = exports.default = getIdsToUse;
17
14
  //# sourceMappingURL=get-ids-to-use.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-ids-to-use.js","names":["getIdsToUse","parentData","length","map","_ref","id","_default","exports"],"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,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAGC,UAAU,EAAI;EAChC,IAAI,CAACA,UAAU,IAAI,CAACA,UAAU,CAACC,MAAM,EAAE,OAAO,EAAE;EAEhD,OAAOD,UAAU,CAACE,GAAG,CAAC,UAAAC,IAAA;IAAA,IAAGC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IAAA,OAAOA,EAAE;EAAA,EAAC;AACvC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEaP,WAAW"}
1
+ {"version":3,"file":"get-ids-to-use.js","names":["getIdsToUse","parentData","length","map","id","_default","exports","default"],"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;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaP,WAAW","ignoreList":[]}
@@ -1,27 +1,31 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.define-property.js");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports["default"] = void 0;
6
+ exports.default = void 0;
8
7
  var _reactPageBuilder = require("@blaze-cms/react-page-builder");
9
- var getRenderProps = function getRenderProps(extraProps, isPreview, data, useMultiQuery) {
10
- var getEntitySchema = data.getEntitySchema;
11
- var _getEntitySchema$acti = getEntitySchema.actions,
12
- get = _getEntitySchema$acti.get,
13
- getPublished = _getEntitySchema$acti.getPublished,
14
- getAll = _getEntitySchema$acti.getAll,
15
- getAllPublished = _getEntitySchema$acti.getAllPublished;
16
- var queryToUse = useMultiQuery ? _reactPageBuilder.generateMultiItemQuery : _reactPageBuilder.generateSingleItemQuery;
17
- var singleActionKey = isPreview ? get : getPublished || get;
18
- var multiActionKey = isPreview ? getAll : getAllPublished || getAll;
19
- var actionKey = useMultiQuery ? multiActionKey : singleActionKey;
20
- var action = queryToUse(actionKey, extraProps);
8
+ const getRenderProps = (extraProps, isPreview, data, useMultiQuery) => {
9
+ const {
10
+ getEntitySchema
11
+ } = data;
12
+ const {
13
+ actions: {
14
+ get,
15
+ getPublished,
16
+ getAll,
17
+ getAllPublished
18
+ }
19
+ } = getEntitySchema;
20
+ const queryToUse = useMultiQuery ? _reactPageBuilder.generateMultiItemQuery : _reactPageBuilder.generateSingleItemQuery;
21
+ const singleActionKey = isPreview ? get : getPublished || get;
22
+ const multiActionKey = isPreview ? getAll : getAllPublished || getAll;
23
+ const actionKey = useMultiQuery ? multiActionKey : singleActionKey;
24
+ const action = queryToUse(actionKey, extraProps);
21
25
  return {
22
- action: action,
23
- actionKey: actionKey
26
+ action,
27
+ actionKey
24
28
  };
25
29
  };
26
- var _default = exports["default"] = getRenderProps;
30
+ var _default = exports.default = getRenderProps;
27
31
  //# sourceMappingURL=get-render-props.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-render-props.js","names":["_reactPageBuilder","require","getRenderProps","extraProps","isPreview","data","useMultiQuery","getEntitySchema","_getEntitySchema$acti","actions","get","getPublished","getAll","getAllPublished","queryToUse","generateMultiItemQuery","generateSingleItemQuery","singleActionKey","multiActionKey","actionKey","action","_default","exports"],"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,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,UAAU,EAAEC,SAAS,EAAEC,IAAI,EAAEC,aAAa,EAAK;EACrE,IAAQC,eAAe,GAAKF,IAAI,CAAxBE,eAAe;EACvB,IAAAC,qBAAA,GAEID,eAAe,CADjBE,OAAO;IAAIC,GAAG,GAAAF,qBAAA,CAAHE,GAAG;IAAEC,YAAY,GAAAH,qBAAA,CAAZG,YAAY;IAAEC,MAAM,GAAAJ,qBAAA,CAANI,MAAM;IAAEC,eAAe,GAAAL,qBAAA,CAAfK,eAAe;EAEvD,IAAMC,UAAU,GAAGR,aAAa,GAAGS,wCAAsB,GAAGC,yCAAuB;EACnF,IAAMC,eAAe,GAAGb,SAAS,GAAGM,GAAG,GAAGC,YAAY,IAAID,GAAG;EAC7D,IAAMQ,cAAc,GAAGd,SAAS,GAAGQ,MAAM,GAAGC,eAAe,IAAID,MAAM;EACrE,IAAMO,SAAS,GAAGb,aAAa,GAAGY,cAAc,GAAGD,eAAe;EAClE,IAAMG,MAAM,GAAGN,UAAU,CAACK,SAAS,EAAEhB,UAAU,CAAC;EAEhD,OAAO;IAAEiB,MAAM,EAANA,MAAM;IAAED,SAAS,EAATA;EAAU,CAAC;AAC9B,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,cAEapB,cAAc"}
1
+ {"version":3,"file":"get-render-props.js","names":["_reactPageBuilder","require","getRenderProps","extraProps","isPreview","data","useMultiQuery","getEntitySchema","actions","get","getPublished","getAll","getAllPublished","queryToUse","generateMultiItemQuery","generateSingleItemQuery","singleActionKey","multiActionKey","actionKey","action","_default","exports","default"],"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,IAAAA,iBAAA,GAAAC,OAAA;AAEA,MAAMC,cAAc,GAAGA,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,GAAGQ,wCAAsB,GAAGC,yCAAuB;EACnF,MAAMC,eAAe,GAAGZ,SAAS,GAAGK,GAAG,GAAGC,YAAY,IAAID,GAAG;EAC7D,MAAMQ,cAAc,GAAGb,SAAS,GAAGO,MAAM,GAAGC,eAAe,IAAID,MAAM;EACrE,MAAMO,SAAS,GAAGZ,aAAa,GAAGW,cAAc,GAAGD,eAAe;EAClE,MAAMG,MAAM,GAAGN,UAAU,CAACK,SAAS,EAAEf,UAAU,CAAC;EAEhD,OAAO;IAAEgB,MAAM;IAAED;EAAU,CAAC;AAC9B,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEapB,cAAc","ignoreList":[]}
@@ -1,68 +1,67 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.define-property.js");
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  Object.defineProperty(exports, "buildAndPushWebVitals", {
9
8
  enumerable: true,
10
- get: function get() {
11
- return _buildAndPushWebVitals["default"];
9
+ get: function () {
10
+ return _buildAndPushWebVitals.default;
12
11
  }
13
12
  });
14
13
  Object.defineProperty(exports, "buildDataLayer", {
15
14
  enumerable: true,
16
- get: function get() {
17
- return _buildDataLayer["default"];
15
+ get: function () {
16
+ return _buildDataLayer.default;
18
17
  }
19
18
  });
20
19
  Object.defineProperty(exports, "buildNestedEvent", {
21
20
  enumerable: true,
22
- get: function get() {
23
- return _buildNestedEvent["default"];
21
+ get: function () {
22
+ return _buildNestedEvent.default;
24
23
  }
25
24
  });
26
25
  Object.defineProperty(exports, "buildPropsToDisplayArray", {
27
26
  enumerable: true,
28
- get: function get() {
29
- return _buildPropsToDisplayArray["default"];
27
+ get: function () {
28
+ return _buildPropsToDisplayArray.default;
30
29
  }
31
30
  });
32
31
  Object.defineProperty(exports, "buildUserLayer", {
33
32
  enumerable: true,
34
- get: function get() {
35
- return _buildUserLayer["default"];
33
+ get: function () {
34
+ return _buildUserLayer.default;
36
35
  }
37
36
  });
38
37
  Object.defineProperty(exports, "buildUserQueryProps", {
39
38
  enumerable: true,
40
- get: function get() {
41
- return _buildUserQueryProps["default"];
39
+ get: function () {
40
+ return _buildUserQueryProps.default;
42
41
  }
43
42
  });
44
43
  Object.defineProperty(exports, "filterGtmEvents", {
45
44
  enumerable: true,
46
- get: function get() {
47
- return _filterGtmEvents["default"];
45
+ get: function () {
46
+ return _filterGtmEvents.default;
48
47
  }
49
48
  });
50
49
  Object.defineProperty(exports, "getIdsToUse", {
51
50
  enumerable: true,
52
- get: function get() {
53
- return _getIdsToUse["default"];
51
+ get: function () {
52
+ return _getIdsToUse.default;
54
53
  }
55
54
  });
56
55
  Object.defineProperty(exports, "getRenderProps", {
57
56
  enumerable: true,
58
- get: function get() {
59
- return _getRenderProps["default"];
57
+ get: function () {
58
+ return _getRenderProps.default;
60
59
  }
61
60
  });
62
61
  Object.defineProperty(exports, "pushToDataLayer", {
63
62
  enumerable: true,
64
- get: function get() {
65
- return _pushToDataLayer["default"];
63
+ get: function () {
64
+ return _pushToDataLayer.default;
66
65
  }
67
66
  });
68
67
  var _buildDataLayer = _interopRequireDefault(require("./build-data-layer"));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_buildDataLayer","_interopRequireDefault","require","_pushToDataLayer","_buildNestedEvent","_getRenderProps","_getIdsToUse","_buildPropsToDisplayArray","_buildAndPushWebVitals","_filterGtmEvents","_buildUserQueryProps","_buildUserLayer"],"sources":["../../src/helpers/index.js"],"sourcesContent":["export { default as buildDataLayer } from './build-data-layer';\nexport { default as pushToDataLayer } from './push-to-data-layer';\nexport { default as buildNestedEvent } from './build-nested-event';\nexport { default as getRenderProps } from './get-render-props';\nexport { default as getIdsToUse } from './get-ids-to-use';\nexport { default as buildPropsToDisplayArray } from './build-props-to-display-array';\nexport { default as buildAndPushWebVitals } from './build-and-push-web-vitals';\nexport { default as filterGtmEvents } from './filter-gtm-events';\nexport { default as buildUserQueryProps } from './build-user-query-props';\nexport { default as buildUserLayer } from './build-user-layer';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,YAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,yBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,sBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,oBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,eAAA,GAAAV,sBAAA,CAAAC,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_buildDataLayer","_interopRequireDefault","require","_pushToDataLayer","_buildNestedEvent","_getRenderProps","_getIdsToUse","_buildPropsToDisplayArray","_buildAndPushWebVitals","_filterGtmEvents","_buildUserQueryProps","_buildUserLayer"],"sources":["../../src/helpers/index.js"],"sourcesContent":["export { default as buildDataLayer } from './build-data-layer';\nexport { default as pushToDataLayer } from './push-to-data-layer';\nexport { default as buildNestedEvent } from './build-nested-event';\nexport { default as getRenderProps } from './get-render-props';\nexport { default as getIdsToUse } from './get-ids-to-use';\nexport { default as buildPropsToDisplayArray } from './build-props-to-display-array';\nexport { default as buildAndPushWebVitals } from './build-and-push-web-vitals';\nexport { default as filterGtmEvents } from './filter-gtm-events';\nexport { default as buildUserQueryProps } from './build-user-query-props';\nexport { default as buildUserLayer } from './build-user-layer';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,YAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,yBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,sBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,oBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,eAAA,GAAAV,sBAAA,CAAAC,OAAA","ignoreList":[]}
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.define-property.js");
4
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports["default"] = void 0;
7
+ exports.default = void 0;
9
8
  var _resetDataLayer = _interopRequireDefault(require("./reset-data-layer"));
10
- var pushToDataLayer = function pushToDataLayer(dataLayer, isPageView) {
9
+ const pushToDataLayer = (dataLayer, isPageView) => {
11
10
  if (dataLayer && window.dataLayer) {
12
- if (isPageView) (0, _resetDataLayer["default"])();
11
+ if (isPageView) (0, _resetDataLayer.default)();
13
12
  window.dataLayer.push(dataLayer);
14
13
  }
15
14
  };
16
- var _default = exports["default"] = pushToDataLayer;
15
+ var _default = exports.default = pushToDataLayer;
17
16
  //# sourceMappingURL=push-to-data-layer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"push-to-data-layer.js","names":["_resetDataLayer","_interopRequireDefault","require","pushToDataLayer","dataLayer","isPageView","window","resetDataLayer","push","_default","exports"],"sources":["../../src/helpers/push-to-data-layer.js"],"sourcesContent":["import resetDataLayer from './reset-data-layer';\n\nconst pushToDataLayer = (dataLayer, isPageView) => {\n if (dataLayer && window.dataLayer) {\n if (isPageView) resetDataLayer();\n window.dataLayer.push(dataLayer);\n }\n};\n\nexport default pushToDataLayer;\n"],"mappings":";;;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,SAAS,EAAEC,UAAU,EAAK;EACjD,IAAID,SAAS,IAAIE,MAAM,CAACF,SAAS,EAAE;IACjC,IAAIC,UAAU,EAAE,IAAAE,0BAAc,EAAC,CAAC;IAChCD,MAAM,CAACF,SAAS,CAACI,IAAI,CAACJ,SAAS,CAAC;EAClC;AACF,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,cAEaP,eAAe"}
1
+ {"version":3,"file":"push-to-data-layer.js","names":["_resetDataLayer","_interopRequireDefault","require","pushToDataLayer","dataLayer","isPageView","window","resetDataLayer","push","_default","exports","default"],"sources":["../../src/helpers/push-to-data-layer.js"],"sourcesContent":["import resetDataLayer from './reset-data-layer';\n\nconst pushToDataLayer = (dataLayer, isPageView) => {\n if (dataLayer && window.dataLayer) {\n if (isPageView) resetDataLayer();\n window.dataLayer.push(dataLayer);\n }\n};\n\nexport default pushToDataLayer;\n"],"mappings":";;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,MAAMC,eAAe,GAAGA,CAACC,SAAS,EAAEC,UAAU,KAAK;EACjD,IAAID,SAAS,IAAIE,MAAM,CAACF,SAAS,EAAE;IACjC,IAAIC,UAAU,EAAE,IAAAE,uBAAc,EAAC,CAAC;IAChCD,MAAM,CAACF,SAAS,CAACI,IAAI,CAACJ,SAAS,CAAC;EAClC;AACF,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaR,eAAe","ignoreList":[]}
@@ -1,36 +1,23 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.object.define-property.js");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports["default"] = void 0;
8
- require("core-js/modules/es.object.keys.js");
9
- require("core-js/modules/es.array.filter.js");
10
- require("core-js/modules/es.object.to-string.js");
11
- require("core-js/modules/es.regexp.exec.js");
12
- require("core-js/modules/es.array.for-each.js");
13
- require("core-js/modules/web.dom-collections.for-each.js");
14
- require("core-js/modules/es.array.find.js");
6
+ exports.default = void 0;
15
7
  var _constants = require("../constants");
16
- var resetDataLayer = function resetDataLayer() {
8
+ const resetDataLayer = () => {
17
9
  if (!shouldReset()) return false;
18
10
  window.dataLayer.length = 0;
19
- var gtmIdRegex = /GTM-/i;
20
- var keys = Object.keys(window.google_tag_manager);
21
- var GTMkeys = keys.filter(function (key) {
22
- return gtmIdRegex.test(key) && window.google_tag_manager[key].dataLayer;
23
- });
24
- GTMkeys.forEach(function (GTMkey) {
25
- return window.google_tag_manager[GTMkey].dataLayer.reset();
26
- });
11
+ const gtmIdRegex = /GTM-/i;
12
+ const keys = Object.keys(window.google_tag_manager);
13
+ const GTMkeys = keys.filter(key => gtmIdRegex.test(key) && window.google_tag_manager[key].dataLayer);
14
+ GTMkeys.forEach(GTMkey => window.google_tag_manager[GTMkey].dataLayer.reset());
27
15
  return true;
28
16
  };
29
17
  function shouldReset() {
30
- return window.google_tag_manager && window.dataLayer && window.dataLayer.find(function (_ref) {
31
- var event = _ref.event;
32
- return event === _constants.PAGE_VIEW;
33
- });
18
+ return window.google_tag_manager && window.dataLayer && window.dataLayer.find(({
19
+ event
20
+ }) => event === _constants.PAGE_VIEW);
34
21
  }
35
- var _default = exports["default"] = resetDataLayer;
22
+ var _default = exports.default = resetDataLayer;
36
23
  //# sourceMappingURL=reset-data-layer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reset-data-layer.js","names":["_constants","require","resetDataLayer","shouldReset","window","dataLayer","length","gtmIdRegex","keys","Object","google_tag_manager","GTMkeys","filter","key","test","forEach","GTMkey","reset","find","_ref","event","PAGE_VIEW","_default","exports"],"sources":["../../src/helpers/reset-data-layer.js"],"sourcesContent":["import { PAGE_VIEW } from '../constants';\n\nconst resetDataLayer = () => {\n if (!shouldReset()) return false;\n\n window.dataLayer.length = 0;\n const gtmIdRegex = /GTM-/i;\n const keys = Object.keys(window.google_tag_manager);\n const GTMkeys = keys.filter(\n key => gtmIdRegex.test(key) && window.google_tag_manager[key].dataLayer\n );\n GTMkeys.forEach(GTMkey => window.google_tag_manager[GTMkey].dataLayer.reset());\n\n return true;\n};\n\nfunction shouldReset() {\n return (\n window.google_tag_manager &&\n window.dataLayer &&\n window.dataLayer.find(({ event }) => event === PAGE_VIEW)\n );\n}\n\nexport default resetDataLayer;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAA,EAAS;EAC3B,IAAI,CAACC,WAAW,CAAC,CAAC,EAAE,OAAO,KAAK;EAEhCC,MAAM,CAACC,SAAS,CAACC,MAAM,GAAG,CAAC;EAC3B,IAAMC,UAAU,GAAG,OAAO;EAC1B,IAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACJ,MAAM,CAACM,kBAAkB,CAAC;EACnD,IAAMC,OAAO,GAAGH,IAAI,CAACI,MAAM,CACzB,UAAAC,GAAG;IAAA,OAAIN,UAAU,CAACO,IAAI,CAACD,GAAG,CAAC,IAAIT,MAAM,CAACM,kBAAkB,CAACG,GAAG,CAAC,CAACR,SAAS;EAAA,CACzE,CAAC;EACDM,OAAO,CAACI,OAAO,CAAC,UAAAC,MAAM;IAAA,OAAIZ,MAAM,CAACM,kBAAkB,CAACM,MAAM,CAAC,CAACX,SAAS,CAACY,KAAK,CAAC,CAAC;EAAA,EAAC;EAE9E,OAAO,IAAI;AACb,CAAC;AAED,SAASd,WAAWA,CAAA,EAAG;EACrB,OACEC,MAAM,CAACM,kBAAkB,IACzBN,MAAM,CAACC,SAAS,IAChBD,MAAM,CAACC,SAAS,CAACa,IAAI,CAAC,UAAAC,IAAA;IAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAA,OAAOA,KAAK,KAAKC,oBAAS;EAAA,EAAC;AAE7D;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEcrB,cAAc"}
1
+ {"version":3,"file":"reset-data-layer.js","names":["_constants","require","resetDataLayer","shouldReset","window","dataLayer","length","gtmIdRegex","keys","Object","google_tag_manager","GTMkeys","filter","key","test","forEach","GTMkey","reset","find","event","PAGE_VIEW","_default","exports","default"],"sources":["../../src/helpers/reset-data-layer.js"],"sourcesContent":["import { PAGE_VIEW } from '../constants';\n\nconst resetDataLayer = () => {\n if (!shouldReset()) return false;\n\n window.dataLayer.length = 0;\n const gtmIdRegex = /GTM-/i;\n const keys = Object.keys(window.google_tag_manager);\n const GTMkeys = keys.filter(\n key => gtmIdRegex.test(key) && window.google_tag_manager[key].dataLayer\n );\n GTMkeys.forEach(GTMkey => window.google_tag_manager[GTMkey].dataLayer.reset());\n\n return true;\n};\n\nfunction shouldReset() {\n return (\n window.google_tag_manager &&\n window.dataLayer &&\n window.dataLayer.find(({ event }) => event === PAGE_VIEW)\n );\n}\n\nexport default resetDataLayer;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,MAAMC,cAAc,GAAGA,CAAA,KAAM;EAC3B,IAAI,CAACC,WAAW,CAAC,CAAC,EAAE,OAAO,KAAK;EAEhCC,MAAM,CAACC,SAAS,CAACC,MAAM,GAAG,CAAC;EAC3B,MAAMC,UAAU,GAAG,OAAO;EAC1B,MAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACJ,MAAM,CAACM,kBAAkB,CAAC;EACnD,MAAMC,OAAO,GAAGH,IAAI,CAACI,MAAM,CACzBC,GAAG,IAAIN,UAAU,CAACO,IAAI,CAACD,GAAG,CAAC,IAAIT,MAAM,CAACM,kBAAkB,CAACG,GAAG,CAAC,CAACR,SAChE,CAAC;EACDM,OAAO,CAACI,OAAO,CAACC,MAAM,IAAIZ,MAAM,CAACM,kBAAkB,CAACM,MAAM,CAAC,CAACX,SAAS,CAACY,KAAK,CAAC,CAAC,CAAC;EAE9E,OAAO,IAAI;AACb,CAAC;AAED,SAASd,WAAWA,CAAA,EAAG;EACrB,OACEC,MAAM,CAACM,kBAAkB,IACzBN,MAAM,CAACC,SAAS,IAChBD,MAAM,CAACC,SAAS,CAACa,IAAI,CAAC,CAAC;IAAEC;EAAM,CAAC,KAAKA,KAAK,KAAKC,oBAAS,CAAC;AAE7D;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcrB,cAAc","ignoreList":[]}
package/lib/index.js CHANGED
@@ -4,60 +4,26 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports["default"] = load;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- require("core-js/modules/es.object.to-string.js");
10
- require("core-js/modules/es.promise.js");
11
- require("core-js/modules/es.array.iterator.js");
12
- require("core-js/modules/es.string.iterator.js");
13
- require("core-js/modules/es.weak-map.js");
14
- require("core-js/modules/web.dom-collections.iterator.js");
15
- require("core-js/modules/es.object.define-property.js");
16
- require("core-js/modules/es.object.get-own-property-descriptor.js");
17
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
18
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
7
+ exports.default = load;
19
8
  var _dynamic = _interopRequireDefault(require("next/dynamic"));
20
9
  var _package = _interopRequireDefault(require("../package.json"));
21
10
  var _constants = require("./constants");
22
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
23
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != (0, _typeof2["default"])(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
24
- function load(_x) {
25
- return _load.apply(this, arguments);
26
- }
27
- function _load() {
28
- _load = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(app) {
29
- return _regenerator["default"].wrap(function _callee$(_context) {
30
- while (1) switch (_context.prev = _context.next) {
31
- case 0:
32
- app.events.once('load:custom:page-builder:component', function (addComponent) {
33
- addComponent({
34
- key: 'gtm',
35
- component: (0, _dynamic["default"])(function () {
36
- return Promise.resolve().then(function () {
37
- return _interopRequireWildcard(require( /* webpackChunkName: "blazePbGoogleTagManager" */'./GoogleTagManager'));
38
- });
39
- })
40
- });
41
- addComponent({
42
- key: 'gtm-events',
43
- component: (0, _dynamic["default"])(function () {
44
- return Promise.resolve().then(function () {
45
- return _interopRequireWildcard(require( /* webpackChunkName: "blazePbGoogleTagManagerEvent" */'./GoogleTagManagerEvent'));
46
- });
47
- })
48
- });
49
- });
50
- return _context.abrupt("return", {
51
- name: _constants.PLUGIN_NAME,
52
- version: _package["default"].version
53
- });
54
- case 2:
55
- case "end":
56
- return _context.stop();
57
- }
58
- }, _callee);
59
- }));
60
- return _load.apply(this, arguments);
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ async function load(app) {
13
+ app.events.once('load:custom:page-builder:component', addComponent => {
14
+ addComponent({
15
+ key: 'gtm',
16
+ component: (0, _dynamic.default)(() => Promise.resolve().then(() => _interopRequireWildcard(require('./GoogleTagManager'))))
17
+ });
18
+ addComponent({
19
+ key: 'gtm-events',
20
+ component: (0, _dynamic.default)(() => Promise.resolve().then(() => _interopRequireWildcard(require('./GoogleTagManagerEvent'))))
21
+ });
22
+ });
23
+ return {
24
+ name: _constants.PLUGIN_NAME,
25
+ version: _package.default.version
26
+ };
61
27
  }
62
28
  load.pluginName = _constants.PLUGIN_NAME;
63
29
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_dynamic","_interopRequireDefault","require","_package","_constants","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","_typeof2","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","load","_x","_load","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee","app","wrap","_callee$","_context","prev","next","events","once","addComponent","key","component","dynamic","Promise","resolve","then","abrupt","name","PLUGIN_NAME","version","pkg","stop","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import dynamic from 'next/dynamic';\n\nimport pkg from '../package.json';\nimport { PLUGIN_NAME } from './constants';\n\nexport default async function load(app) {\n app.events.once('load:custom:page-builder:component', addComponent => {\n addComponent({\n key: 'gtm',\n component: dynamic(() =>\n import(/* webpackChunkName: \"blazePbGoogleTagManager\" */ './GoogleTagManager')\n )\n });\n addComponent({\n key: 'gtm-events',\n component: dynamic(() =>\n import(/* webpackChunkName: \"blazePbGoogleTagManagerEvent\" */ './GoogleTagManagerEvent')\n )\n });\n });\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAA0C,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAI,wBAAAJ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,eAAAA,CAAA,oBAAAM,QAAA,aAAAN,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAI,GAAA,CAAAP,CAAA,UAAAG,CAAA,CAAAK,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAf,CAAA,oBAAAe,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAlB,CAAA,EAAAe,CAAA,S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AAqC,QAAA,CAAAY,MAAA,WAEI;YACLC,IAAI,EAAEC,sBAAW;YACjBC,OAAO,EAAEC,mBAAG,CAACD;UACf,CAAC;QAAA;QAAA;UAAA,OAAAf,QAAA,CAAAiB,IAAA;MAAA;IAAA,GAAArB,OAAA;EAAA,CACF;EAAA,OAAAN,KAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAEDJ,IAAI,CAAC8B,UAAU,GAAGJ,sBAAW"}
1
+ {"version":3,"file":"index.js","names":["_dynamic","_interopRequireDefault","require","_package","_constants","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","load","app","events","once","addComponent","key","component","dynamic","Promise","resolve","then","name","PLUGIN_NAME","version","pkg","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import dynamic from 'next/dynamic';\n\nimport pkg from '../package.json';\nimport { PLUGIN_NAME } from './constants';\n\nexport default async function load(app) {\n app.events.once('load:custom:page-builder:component', addComponent => {\n addComponent({\n key: 'gtm',\n component: dynamic(\n () => import(/* webpackChunkName: \"blazePbGoogleTagManager\" */ './GoogleTagManager')\n )\n });\n addComponent({\n key: 'gtm-events',\n component: dynamic(\n () =>\n import(/* webpackChunkName: \"blazePbGoogleTagManagerEvent\" */ './GoogleTagManagerEvent')\n )\n });\n });\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAA0C,SAAAG,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,I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gE,yBAAyB,GAC3F;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLkC,IAAI,EAAEC,sBAAW;IACjBC,OAAO,EAAEC,gBAAG,CAACD;EACf,CAAC;AACH;AAEAb,IAAI,CAACe,UAAU,GAAGH,sBAAW","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"GTMFactory.js","names":["React","useContext","PropTypes","useQuery","getSingleEntitySchema","buildPropsQuery","MainContext","GTMRender","getRenderProps","buildPropsToDisplayArray","GTMFactory","propsToDisplay","userPropsToDisplay","parent","gtmWebVitals","isPreview","data","error","loading","variables","id","itemEntity","window","propsToDisplayArr","extraProps","action","actionKey","createElement","parentId","itemId","webVitals","propTypes","array","object","isRequired","bool","defaultProps"],"sources":["../../src/GoogleTagManager/GTMFactory.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 GTMRender from './GTMRender';\nimport { getRenderProps, buildPropsToDisplayArray } from '../helpers';\n\nconst GTMFactory = ({ propsToDisplay, userPropsToDisplay, parent, gtmWebVitals }) => {\n const { isPreview } = useContext(MainContext);\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: parent.itemEntity }\n });\n\n if (typeof window === 'undefined') return null;\n if (loading || error || !data) return null;\n\n const propsToDisplayArr = buildPropsToDisplayArray(propsToDisplay);\n const extraProps = buildPropsQuery(data, propsToDisplayArr) || '';\n const { action, actionKey } = getRenderProps(extraProps, isPreview, data);\n\n return (\n <GTMRender\n action={action}\n actionKey={actionKey}\n userPropsToDisplay={userPropsToDisplay}\n propsToDisplay={propsToDisplay}\n parentId={parent.itemId}\n webVitals={gtmWebVitals}\n />\n );\n};\n\nGTMFactory.propTypes = {\n propsToDisplay: PropTypes.array,\n userPropsToDisplay: PropTypes.array,\n parent: PropTypes.object.isRequired,\n gtmWebVitals: PropTypes.bool\n};\n\nGTMFactory.defaultProps = {\n propsToDisplay: [],\n userPropsToDisplay: [],\n gtmWebVitals: false\n};\n\nexport default GTMFactory;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,qBAAqB,EAAEC,eAAe,QAAQ,+BAA+B;AACtF,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,cAAc,EAAEC,wBAAwB,QAAQ,YAAY;AAErE,MAAMC,UAAU,GAAGA,CAAC;EAAEC,cAAc;EAAEC,kBAAkB;EAAEC,MAAM;EAAEC;AAAa,CAAC,KAAK;EACnF,MAAM;IAAEC;EAAU,CAAC,GAAGd,UAAU,CAACK,WAAW,CAAC;EAC7C,MAAM;IAAEU,IAAI;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGf,QAAQ,CAACC,qBAAqB,EAAE;IAC/De,SAAS,EAAE;MAAEC,EAAE,EAAEP,MAAM,CAACQ;IAAW;EACrC,CAAC,CAAC;EAEF,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE,OAAO,IAAI;EAC9C,IAAIJ,OAAO,IAAID,KAAK,IAAI,CAACD,IAAI,EAAE,OAAO,IAAI;EAE1C,MAAMO,iBAAiB,GAAGd,wBAAwB,CAACE,cAAc,CAAC;EAClE,MAAMa,UAAU,GAAGnB,eAAe,CAACW,IAAI,EAAEO,iBAAiB,CAAC,IAAI,EAAE;EACjE,MAAM;IAAEE,MAAM;IAAEC;EAAU,CAAC,GAAGlB,cAAc,CAACgB,UAAU,EAAET,SAAS,EAAEC,IAAI,CAAC;EAEzE,oBACEhB,KAAA,CAAA2B,aAAA,CAACpB,SAAS;IACRkB,MAAM,EAAEA,MAAO;IACfC,SAAS,EAAEA,SAAU;IACrBd,kBAAkB,EAAEA,kBAAmB;IACvCD,cAAc,EAAEA,cAAe;IAC/BiB,QAAQ,EAAEf,MAAM,CAACgB,MAAO;IACxBC,SAAS,EAAEhB;EAAa,CACzB,CAAC;AAEN,CAAC;AAEDJ,UAAU,CAACqB,SAAS,GAAG;EACrBpB,cAAc,EAAET,SAAS,CAAC8B,KAAK;EAC/BpB,kBAAkB,EAAEV,SAAS,CAAC8B,KAAK;EACnCnB,MAAM,EAAEX,SAAS,CAAC+B,MAAM,CAACC,UAAU;EACnCpB,YAAY,EAAEZ,SAAS,CAACiC;AAC1B,CAAC;AAEDzB,UAAU,CAAC0B,YAAY,GAAG;EACxBzB,cAAc,EAAE,EAAE;EAClBC,kBAAkB,EAAE,EAAE;EACtBE,YAAY,EAAE;AAChB,CAAC;AAED,eAAeJ,UAAU"}
1
+ {"version":3,"file":"GTMFactory.js","names":["React","useContext","PropTypes","useQuery","getSingleEntitySchema","buildPropsQuery","MainContext","GTMRender","getRenderProps","buildPropsToDisplayArray","GTMFactory","propsToDisplay","userPropsToDisplay","parent","gtmWebVitals","isPreview","data","error","loading","variables","id","itemEntity","window","propsToDisplayArr","extraProps","action","actionKey","createElement","parentId","itemId","webVitals","propTypes","array","object","isRequired","bool","defaultProps"],"sources":["../../src/GoogleTagManager/GTMFactory.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 GTMRender from './GTMRender';\nimport { getRenderProps, buildPropsToDisplayArray } from '../helpers';\n\nconst GTMFactory = ({ propsToDisplay, userPropsToDisplay, parent, gtmWebVitals }) => {\n const { isPreview } = useContext(MainContext);\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: parent.itemEntity }\n });\n\n if (typeof window === 'undefined') return null;\n if (loading || error || !data) return null;\n\n const propsToDisplayArr = buildPropsToDisplayArray(propsToDisplay);\n const extraProps = buildPropsQuery(data, propsToDisplayArr) || '';\n const { action, actionKey } = getRenderProps(extraProps, isPreview, data);\n\n return (\n <GTMRender\n action={action}\n actionKey={actionKey}\n userPropsToDisplay={userPropsToDisplay}\n propsToDisplay={propsToDisplay}\n parentId={parent.itemId}\n webVitals={gtmWebVitals}\n />\n );\n};\n\nGTMFactory.propTypes = {\n propsToDisplay: PropTypes.array,\n userPropsToDisplay: PropTypes.array,\n parent: PropTypes.object.isRequired,\n gtmWebVitals: PropTypes.bool\n};\n\nGTMFactory.defaultProps = {\n propsToDisplay: [],\n userPropsToDisplay: [],\n gtmWebVitals: false\n};\n\nexport default GTMFactory;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,qBAAqB,EAAEC,eAAe,QAAQ,+BAA+B;AACtF,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,cAAc,EAAEC,wBAAwB,QAAQ,YAAY;AAErE,MAAMC,UAAU,GAAGA,CAAC;EAAEC,cAAc;EAAEC,kBAAkB;EAAEC,MAAM;EAAEC;AAAa,CAAC,KAAK;EACnF,MAAM;IAAEC;EAAU,CAAC,GAAGd,UAAU,CAACK,WAAW,CAAC;EAC7C,MAAM;IAAEU,IAAI;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGf,QAAQ,CAACC,qBAAqB,EAAE;IAC/De,SAAS,EAAE;MAAEC,EAAE,EAAEP,MAAM,CAACQ;IAAW;EACrC,CAAC,CAAC;EAEF,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE,OAAO,IAAI;EAC9C,IAAIJ,OAAO,IAAID,KAAK,IAAI,CAACD,IAAI,EAAE,OAAO,IAAI;EAE1C,MAAMO,iBAAiB,GAAGd,wBAAwB,CAACE,cAAc,CAAC;EAClE,MAAMa,UAAU,GAAGnB,eAAe,CAACW,IAAI,EAAEO,iBAAiB,CAAC,IAAI,EAAE;EACjE,MAAM;IAAEE,MAAM;IAAEC;EAAU,CAAC,GAAGlB,cAAc,CAACgB,UAAU,EAAET,SAAS,EAAEC,IAAI,CAAC;EAEzE,oBACEhB,KAAA,CAAA2B,aAAA,CAACpB,SAAS;IACRkB,MAAM,EAAEA,MAAO;IACfC,SAAS,EAAEA,SAAU;IACrBd,kBAAkB,EAAEA,kBAAmB;IACvCD,cAAc,EAAEA,cAAe;IAC/BiB,QAAQ,EAAEf,MAAM,CAACgB,MAAO;IACxBC,SAAS,EAAEhB;EAAa,CACzB,CAAC;AAEN,CAAC;AAEDJ,UAAU,CAACqB,SAAS,GAAG;EACrBpB,cAAc,EAAET,SAAS,CAAC8B,KAAK;EAC/BpB,kBAAkB,EAAEV,SAAS,CAAC8B,KAAK;EACnCnB,MAAM,EAAEX,SAAS,CAAC+B,MAAM,CAACC,UAAU;EACnCpB,YAAY,EAAEZ,SAAS,CAACiC;AAC1B,CAAC;AAEDzB,UAAU,CAAC0B,YAAY,GAAG;EACxBzB,cAAc,EAAE,EAAE;EAClBC,kBAAkB,EAAE,EAAE;EACtBE,YAAY,EAAE;AAChB,CAAC;AAED,eAAeJ,UAAU","ignoreList":[]}
@@ -5,8 +5,7 @@ import { useState } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { useQuery } from '@apollo/client';
7
7
  import { withRouter } from 'next/router';
8
- import { getUser } from '@blaze-cms/react-page-builder';
9
- import { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';
8
+ import { getCurrentUser } from '@blaze-cms/react-page-builder';
10
9
  import { buildDataLayer, buildAndPushWebVitals, pushToDataLayer, buildUserQueryProps, buildUserLayer } from '../helpers';
11
10
  const GTMRender = ({
12
11
  router,
@@ -32,18 +31,13 @@ const GTMRender = ({
32
31
  id: parentId
33
32
  }
34
33
  });
35
- const {
36
- id: userId
37
- } = checkIfLoggedIn();
38
- const hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;
34
+ const hasUserProps = userPropsToDisplay && userPropsToDisplay.length;
39
35
  const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';
40
36
  const {
41
37
  data: userData,
42
38
  loading: userLoading
43
- } = useQuery(getUser(userProps), {
44
- variables: {
45
- id: userId
46
- },
39
+ } = useQuery(getCurrentUser(userProps), {
40
+ variables: {},
47
41
  skip: !hasUserProps
48
42
  });
49
43
  if (loading || userLoading || !data || !data.entityData) return null;
@@ -1 +1 @@
1
- {"version":3,"file":"GTMRender.js","names":["useState","PropTypes","useQuery","withRouter","getUser","checkIfLoggedIn","buildDataLayer","buildAndPushWebVitals","pushToDataLayer","buildUserQueryProps","buildUserLayer","GTMRender","router","action","propsToDisplay","parentId","webVitals","userPropsToDisplay","asPath","currentLocation","setCurrentLocation","url","shouldPushLayer","data","error","loading","variables","id","userId","hasUserProps","length","userProps","userData","userLoading","skip","entityData","message","dataLayerObject","userLayerObject","extendedDataLayer","_objectSpread","propTypes","array","isRequired","object","string","bool"],"sources":["../../src/GoogleTagManager/GTMRender.js"],"sourcesContent":["import { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { withRouter } from 'next/router';\nimport { getUser } from '@blaze-cms/react-page-builder';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport {\n buildDataLayer,\n buildAndPushWebVitals,\n pushToDataLayer,\n buildUserQueryProps,\n buildUserLayer\n} from '../helpers';\n\nconst GTMRender = ({ router, action, propsToDisplay, parentId, webVitals, userPropsToDisplay }) => {\n const { asPath } = router;\n const [currentLocation, setCurrentLocation] = useState({ url: '', shouldPushLayer: false });\n\n const { data, error, loading } = useQuery(action, {\n variables: { id: parentId }\n });\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 || !data || !data.entityData) return null;\n if (data.entityData.id !== parentId) return null;\n if (error) return error.message;\n if (currentLocation.url !== asPath) setCurrentLocation({ url: asPath, shouldPushLayer: true });\n if (!currentLocation.shouldPushLayer) return null;\n\n const { entityData } = data;\n const dataLayerObject = buildDataLayer(entityData, propsToDisplay, currentLocation.url);\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n if (webVitals) buildAndPushWebVitals();\n pushToDataLayer(extendedDataLayer, true);\n setCurrentLocation({ ...currentLocation, shouldPushLayer: false });\n\n return null;\n};\n\nGTMRender.propTypes = {\n userPropsToDisplay: PropTypes.array.isRequired,\n action: PropTypes.object.isRequired,\n propsToDisplay: PropTypes.array.isRequired,\n parentId: PropTypes.string.isRequired,\n webVitals: PropTypes.bool.isRequired\n};\n\nexport default withRouter(GTMRender);\n"],"mappings":";;;AAAA,SAASA,QAAQ,QAAQ,OAAO;AAChC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,OAAO,QAAQ,+BAA+B;AACvD,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SACEC,cAAc,EACdC,qBAAqB,EACrBC,eAAe,EACfC,mBAAmB,EACnBC,cAAc,QACT,YAAY;AAEnB,MAAMC,SAAS,GAAGA,CAAC;EAAEC,MAAM;EAAEC,MAAM;EAAEC,cAAc;EAAEC,QAAQ;EAAEC,SAAS;EAAEC;AAAmB,CAAC,KAAK;EACjG,MAAM;IAAEC;EAAO,CAAC,GAAGN,MAAM;EACzB,MAAM,CAACO,eAAe,EAAEC,kBAAkB,CAAC,GAAGpB,QAAQ,CAAC;IAAEqB,GAAG,EAAE,EAAE;IAAEC,eAAe,EAAE;EAAM,CAAC,CAAC;EAE3F,MAAM;IAAEC,IAAI;IAAEC,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GAAAC,aAAA,CAAAA,aAAA,KAAQH,eAAe,GAAKC,eAAe,CAAE;EAEpE,IAAItB,SAAS,EAAET,qBAAqB,CAAC,CAAC;EACtCC,eAAe,CAAC+B,iBAAiB,EAAE,IAAI,CAAC;EACxCnB,kBAAkB,CAAAoB,aAAA,CAAAA,aAAA,KAAMrB,eAAe;IAAEG,eAAe,EAAE;EAAK,EAAE,CAAC;EAElE,OAAO,IAAI;AACb,CAAC;AAEDX,SAAS,CAAC8B,SAAS,GAAG;EACpBxB,kBAAkB,EAAEhB,SAAS,CAACyC,KAAK,CAACC,UAAU;EAC9C9B,MAAM,EAAEZ,SAAS,CAAC2C,MAAM,CAACD,UAAU;EACnC7B,cAAc,EAAEb,SAAS,CAACyC,KAAK,CAACC,UAAU;EAC1C5B,QAAQ,EAAEd,SAAS,CAAC4C,MAAM,CAACF,UAAU;EACrC3B,SAAS,EAAEf,SAAS,CAAC6C,IAAI,CAACH;AAC5B,CAAC;AAED,eAAexC,UAAU,CAACQ,SAAS,CAAC"}
1
+ {"version":3,"file":"GTMRender.js","names":["useState","PropTypes","useQuery","withRouter","getCurrentUser","buildDataLayer","buildAndPushWebVitals","pushToDataLayer","buildUserQueryProps","buildUserLayer","GTMRender","router","action","propsToDisplay","parentId","webVitals","userPropsToDisplay","asPath","currentLocation","setCurrentLocation","url","shouldPushLayer","data","error","loading","variables","id","hasUserProps","length","userProps","userData","userLoading","skip","entityData","message","dataLayerObject","userLayerObject","extendedDataLayer","_objectSpread","propTypes","array","isRequired","object","string","bool"],"sources":["../../src/GoogleTagManager/GTMRender.js"],"sourcesContent":["import { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { withRouter } from 'next/router';\nimport { getCurrentUser } from '@blaze-cms/react-page-builder';\nimport {\n buildDataLayer,\n buildAndPushWebVitals,\n pushToDataLayer,\n buildUserQueryProps,\n buildUserLayer\n} from '../helpers';\n\nconst GTMRender = ({ router, action, propsToDisplay, parentId, webVitals, userPropsToDisplay }) => {\n const { asPath } = router;\n const [currentLocation, setCurrentLocation] = useState({ url: '', shouldPushLayer: false });\n\n const { data, error, loading } = useQuery(action, {\n variables: { id: parentId }\n });\n const hasUserProps = userPropsToDisplay && userPropsToDisplay.length;\n const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';\n const { data: userData, loading: userLoading } = useQuery(getCurrentUser(userProps), {\n variables: {},\n skip: !hasUserProps\n });\n\n if (loading || userLoading || !data || !data.entityData) return null;\n if (data.entityData.id !== parentId) return null;\n if (error) return error.message;\n if (currentLocation.url !== asPath) setCurrentLocation({ url: asPath, shouldPushLayer: true });\n if (!currentLocation.shouldPushLayer) return null;\n\n const { entityData } = data;\n const dataLayerObject = buildDataLayer(entityData, propsToDisplay, currentLocation.url);\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n if (webVitals) buildAndPushWebVitals();\n pushToDataLayer(extendedDataLayer, true);\n setCurrentLocation({ ...currentLocation, shouldPushLayer: false });\n\n return null;\n};\n\nGTMRender.propTypes = {\n userPropsToDisplay: PropTypes.array.isRequired,\n action: PropTypes.object.isRequired,\n propsToDisplay: PropTypes.array.isRequired,\n parentId: PropTypes.string.isRequired,\n webVitals: PropTypes.bool.isRequired\n};\n\nexport default withRouter(GTMRender);\n"],"mappings":";;;AAAA,SAASA,QAAQ,QAAQ,OAAO;AAChC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SACEC,cAAc,EACdC,qBAAqB,EACrBC,eAAe,EACfC,mBAAmB,EACnBC,cAAc,QACT,YAAY;AAEnB,MAAMC,SAAS,GAAGA,CAAC;EAAEC,MAAM;EAAEC,MAAM;EAAEC,cAAc;EAAEC,QAAQ;EAAEC,SAAS;EAAEC;AAAmB,CAAC,KAAK;EACjG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ACvF,MAAMgB,eAAe,GAAG3B,cAAc,CAACqB,QAAQ,EAAEd,kBAAkB,CAAC;EACpE,MAAMqB,iBAAiB,GAAAC,aAAA,CAAAA,aAAA,KAAQH,eAAe,GAAKC,eAAe,CAAE;EAEpE,IAAIrB,SAAS,EAAET,qBAAqB,CAAC,CAAC;EACtCC,eAAe,CAAC8B,iBAAiB,EAAE,IAAI,CAAC;EACxClB,kBAAkB,CAAAmB,aAAA,CAAAA,aAAA,KAAMpB,eAAe;IAAEG,eAAe,EAAE;EAAK,EAAE,CAAC;EAElE,OAAO,IAAI;AACb,CAAC;AAEDX,SAAS,CAAC6B,SAAS,GAAG;EACpBvB,kBAAkB,EAAEf,SAAS,CAACuC,KAAK,CAACC,UAAU;EAC9C7B,MAAM,EAAEX,SAAS,CAACyC,MAAM,CAACD,UAAU;EACnC5B,cAAc,EAAEZ,SAAS,CAACuC,KAAK,CAACC,UAAU;EAC1C3B,QAAQ,EAAEb,SAAS,CAAC0C,MAAM,CAACF,UAAU;EACrC1B,SAAS,EAAEd,SAAS,CAAC2C,IAAI,CAACH;AAC5B,CAAC;AAED,eAAetC,UAAU,CAACO,SAAS,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["GTMFactory"],"sources":["../../src/GoogleTagManager/index.js"],"sourcesContent":["import GTMFactory from './GTMFactory';\n\nexport default GTMFactory;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,cAAc;AAErC,eAAeA,UAAU"}
1
+ {"version":3,"file":"index.js","names":["GTMFactory"],"sources":["../../src/GoogleTagManager/index.js"],"sourcesContent":["import GTMFactory from './GTMFactory';\n\nexport default GTMFactory;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,cAAc;AAErC,eAAeA,UAAU","ignoreList":[]}