@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.
- package/lib/GoogleTagManager/GTMFactory.js +32 -37
- package/lib/GoogleTagManager/GTMFactory.js.map +1 -1
- package/lib/GoogleTagManager/GTMRender.js +47 -59
- package/lib/GoogleTagManager/GTMRender.js.map +1 -1
- package/lib/GoogleTagManager/index.js +2 -3
- package/lib/GoogleTagManager/index.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMClickEvent.js +35 -40
- package/lib/GoogleTagManagerEvent/GTMClickEvent.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMClickEvents.js +21 -23
- package/lib/GoogleTagManagerEvent/GTMClickEvents.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMEvent.js +24 -33
- package/lib/GoogleTagManagerEvent/GTMEvent.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMEventFactory.js +50 -60
- package/lib/GoogleTagManagerEvent/GTMEventFactory.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMEventRender.js +53 -71
- package/lib/GoogleTagManagerEvent/GTMEventRender.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMEventSwitch.js +20 -18
- package/lib/GoogleTagManagerEvent/GTMEventSwitch.js.map +1 -1
- package/lib/GoogleTagManagerEvent/index.js +2 -3
- package/lib/GoogleTagManagerEvent/index.js.map +1 -1
- package/lib/constants.js +12 -13
- package/lib/constants.js.map +1 -1
- package/lib/helpers/build-and-push-web-vitals.js +10 -11
- package/lib/helpers/build-and-push-web-vitals.js.map +1 -1
- package/lib/helpers/build-data-layer.js +20 -48
- package/lib/helpers/build-data-layer.js.map +1 -1
- package/lib/helpers/build-nested-event.js +54 -38
- package/lib/helpers/build-nested-event.js.map +1 -1
- package/lib/helpers/build-props-to-display-array.js +4 -11
- package/lib/helpers/build-props-to-display-array.js.map +1 -1
- package/lib/helpers/build-user-layer.js +22 -32
- package/lib/helpers/build-user-layer.js.map +1 -1
- package/lib/helpers/build-user-query-props.js +13 -27
- package/lib/helpers/build-user-query-props.js.map +1 -1
- package/lib/helpers/filter-gtm-events.js +8 -12
- package/lib/helpers/filter-gtm-events.js.map +1 -1
- package/lib/helpers/get-ids-to-use.js +6 -9
- package/lib/helpers/get-ids-to-use.js.map +1 -1
- package/lib/helpers/get-render-props.js +21 -17
- package/lib/helpers/get-render-props.js.map +1 -1
- package/lib/helpers/index.js +20 -21
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/push-to-data-layer.js +4 -5
- package/lib/helpers/push-to-data-layer.js.map +1 -1
- package/lib/helpers/reset-data-layer.js +10 -23
- package/lib/helpers/reset-data-layer.js.map +1 -1
- package/lib/index.js +17 -51
- package/lib/index.js.map +1 -1
- package/lib-es/GoogleTagManager/GTMFactory.js.map +1 -1
- package/lib-es/GoogleTagManager/GTMRender.js +4 -10
- package/lib-es/GoogleTagManager/GTMRender.js.map +1 -1
- package/lib-es/GoogleTagManager/index.js.map +1 -1
- package/lib-es/GoogleTagManagerEvent/GTMClickEvent.js +2 -2
- package/lib-es/GoogleTagManagerEvent/GTMClickEvent.js.map +1 -1
- package/lib-es/GoogleTagManagerEvent/GTMClickEvents.js.map +1 -1
- package/lib-es/GoogleTagManagerEvent/GTMEvent.js +6 -3
- package/lib-es/GoogleTagManagerEvent/GTMEvent.js.map +1 -1
- package/lib-es/GoogleTagManagerEvent/GTMEventFactory.js.map +1 -1
- package/lib-es/GoogleTagManagerEvent/GTMEventRender.js +4 -10
- package/lib-es/GoogleTagManagerEvent/GTMEventRender.js.map +1 -1
- package/lib-es/GoogleTagManagerEvent/GTMEventSwitch.js.map +1 -1
- package/lib-es/GoogleTagManagerEvent/index.js.map +1 -1
- package/lib-es/constants.js.map +1 -1
- package/lib-es/helpers/build-and-push-web-vitals.js.map +1 -1
- package/lib-es/helpers/build-data-layer.js.map +1 -1
- package/lib-es/helpers/build-nested-event.js.map +1 -1
- package/lib-es/helpers/build-props-to-display-array.js.map +1 -1
- package/lib-es/helpers/build-user-layer.js.map +1 -1
- package/lib-es/helpers/build-user-query-props.js.map +1 -1
- package/lib-es/helpers/filter-gtm-events.js.map +1 -1
- package/lib-es/helpers/get-ids-to-use.js.map +1 -1
- package/lib-es/helpers/get-render-props.js.map +1 -1
- package/lib-es/helpers/index.js.map +1 -1
- package/lib-es/helpers/push-to-data-layer.js.map +1 -1
- package/lib-es/helpers/reset-data-layer.js.map +1 -1
- package/lib-es/index.js +2 -2
- package/lib-es/index.js.map +1 -1
- package/package.json +19 -15
- package/src/GoogleTagManager/GTMRender.js +4 -6
- package/src/GoogleTagManagerEvent/GTMClickEvent.js +3 -2
- package/src/GoogleTagManagerEvent/GTMEvent.js +9 -8
- package/src/GoogleTagManagerEvent/GTMEventRender.js +4 -6
- package/src/index.js +5 -4
- package/CHANGELOG.md +0 -1779
- package/babel.config.js +0 -3
- 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
|
|
9
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
userProps.forEach(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
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(
|
|
34
|
-
|
|
21
|
+
Object.keys(nestedProps).forEach(nestedKey => {
|
|
22
|
+
const nested = nestedProps[nestedKey];
|
|
35
23
|
basicProps.push(nestedKey);
|
|
36
24
|
basicProps.push('{');
|
|
37
|
-
nested.forEach(
|
|
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
|
|
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","
|
|
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
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
gtmEvents.forEach(
|
|
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
|
|
20
|
-
regularEvents
|
|
15
|
+
clickEvents,
|
|
16
|
+
regularEvents
|
|
21
17
|
};
|
|
22
18
|
};
|
|
23
|
-
var _default = exports
|
|
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":"
|
|
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
|
|
8
|
-
|
|
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(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
9
|
+
return parentData.map(({
|
|
10
|
+
id
|
|
11
|
+
}) => id);
|
|
15
12
|
};
|
|
16
|
-
var _default = exports
|
|
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","
|
|
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
|
|
6
|
+
exports.default = void 0;
|
|
8
7
|
var _reactPageBuilder = require("@blaze-cms/react-page-builder");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
|
23
|
-
actionKey
|
|
26
|
+
action,
|
|
27
|
+
actionKey
|
|
24
28
|
};
|
|
25
29
|
};
|
|
26
|
-
var _default = exports
|
|
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","
|
|
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":[]}
|
package/lib/helpers/index.js
CHANGED
|
@@ -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
|
|
11
|
-
return _buildAndPushWebVitals
|
|
9
|
+
get: function () {
|
|
10
|
+
return _buildAndPushWebVitals.default;
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
13
|
Object.defineProperty(exports, "buildDataLayer", {
|
|
15
14
|
enumerable: true,
|
|
16
|
-
get: function
|
|
17
|
-
return _buildDataLayer
|
|
15
|
+
get: function () {
|
|
16
|
+
return _buildDataLayer.default;
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
19
|
Object.defineProperty(exports, "buildNestedEvent", {
|
|
21
20
|
enumerable: true,
|
|
22
|
-
get: function
|
|
23
|
-
return _buildNestedEvent
|
|
21
|
+
get: function () {
|
|
22
|
+
return _buildNestedEvent.default;
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
25
|
Object.defineProperty(exports, "buildPropsToDisplayArray", {
|
|
27
26
|
enumerable: true,
|
|
28
|
-
get: function
|
|
29
|
-
return _buildPropsToDisplayArray
|
|
27
|
+
get: function () {
|
|
28
|
+
return _buildPropsToDisplayArray.default;
|
|
30
29
|
}
|
|
31
30
|
});
|
|
32
31
|
Object.defineProperty(exports, "buildUserLayer", {
|
|
33
32
|
enumerable: true,
|
|
34
|
-
get: function
|
|
35
|
-
return _buildUserLayer
|
|
33
|
+
get: function () {
|
|
34
|
+
return _buildUserLayer.default;
|
|
36
35
|
}
|
|
37
36
|
});
|
|
38
37
|
Object.defineProperty(exports, "buildUserQueryProps", {
|
|
39
38
|
enumerable: true,
|
|
40
|
-
get: function
|
|
41
|
-
return _buildUserQueryProps
|
|
39
|
+
get: function () {
|
|
40
|
+
return _buildUserQueryProps.default;
|
|
42
41
|
}
|
|
43
42
|
});
|
|
44
43
|
Object.defineProperty(exports, "filterGtmEvents", {
|
|
45
44
|
enumerable: true,
|
|
46
|
-
get: function
|
|
47
|
-
return _filterGtmEvents
|
|
45
|
+
get: function () {
|
|
46
|
+
return _filterGtmEvents.default;
|
|
48
47
|
}
|
|
49
48
|
});
|
|
50
49
|
Object.defineProperty(exports, "getIdsToUse", {
|
|
51
50
|
enumerable: true,
|
|
52
|
-
get: function
|
|
53
|
-
return _getIdsToUse
|
|
51
|
+
get: function () {
|
|
52
|
+
return _getIdsToUse.default;
|
|
54
53
|
}
|
|
55
54
|
});
|
|
56
55
|
Object.defineProperty(exports, "getRenderProps", {
|
|
57
56
|
enumerable: true,
|
|
58
|
-
get: function
|
|
59
|
-
return _getRenderProps
|
|
57
|
+
get: function () {
|
|
58
|
+
return _getRenderProps.default;
|
|
60
59
|
}
|
|
61
60
|
});
|
|
62
61
|
Object.defineProperty(exports, "pushToDataLayer", {
|
|
63
62
|
enumerable: true,
|
|
64
|
-
get: function
|
|
65
|
-
return _pushToDataLayer
|
|
63
|
+
get: function () {
|
|
64
|
+
return _pushToDataLayer.default;
|
|
66
65
|
}
|
|
67
66
|
});
|
|
68
67
|
var _buildDataLayer = _interopRequireDefault(require("./build-data-layer"));
|
package/lib/helpers/index.js.map
CHANGED
|
@@ -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":"
|
|
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
|
|
7
|
+
exports.default = void 0;
|
|
9
8
|
var _resetDataLayer = _interopRequireDefault(require("./reset-data-layer"));
|
|
10
|
-
|
|
9
|
+
const pushToDataLayer = (dataLayer, isPageView) => {
|
|
11
10
|
if (dataLayer && window.dataLayer) {
|
|
12
|
-
if (isPageView) (0, _resetDataLayer
|
|
11
|
+
if (isPageView) (0, _resetDataLayer.default)();
|
|
13
12
|
window.dataLayer.push(dataLayer);
|
|
14
13
|
}
|
|
15
14
|
};
|
|
16
|
-
var _default = exports
|
|
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":"
|
|
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
|
|
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
|
-
|
|
8
|
+
const resetDataLayer = () => {
|
|
17
9
|
if (!shouldReset()) return false;
|
|
18
10
|
window.dataLayer.length = 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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(
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
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","
|
|
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
|
|
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
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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","
|
|
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,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAE3B,eAAekB,IAAIA,CAACC,GAAG,EAAE;EACtCA,GAAG,CAACC,MAAM,CAACC,IAAI,CAAC,oCAAoC,EAAEC,YAAY,IAAI;IACpEA,YAAY,CAAC;MACXC,GAAG,EAAE,KAAK;MACVC,SAAS,EAAE,IAAAC,gBAAO,EAChB,MAAAC,OAAA,CAAAC,OAAA,GAAAC,IAAA,OAAA9B,uBAAA,CAAAH,OAAA,CAA+D,oBAAoB,GACrF;IACF,CAAC,CAAC;IACF2B,YAAY,CAAC;MACXC,GAAG,EAAE,YAAY;MACjBC,SAAS,EAAE,IAAAC,gBAAO,EAChB,MAAAC,OAAA,CAAAC,OAAA,GAAAC,IAAA,OAAA9B,uBAAA,CAAAH,OAAA,CACgE,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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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 gtmWebVit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c,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 {
|
|
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(
|
|
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","
|
|
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,MAAM;IAAEC;EAAO,CAAC,GAAGN,MAAM;EACzB,MAAM,CAACO,eAAe,EAAEC,kBAAkB,CAAC,GAAGnB,QAAQ,CAAC;IAAEoB,GAAG,EAAE,EAAE;IAAEC,eAAe,EAAE;EAAM,CAAC,CAAC;EAE3F,MAAM;IAAEC,IAAI;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGtB,QAAQ,CAACU,MAAM,EAAE;IAChDa,SAAS,EAAE;MAAEC,EAAE,EAAEZ;IAAS;EAC5B,CAAC,CAAC;EACF,MAAMa,YAAY,GAAGX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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":[]}
|