@blaze-cms/plugin-gtm-fe 0.146.0-node18-core-styles.3 → 0.146.0-node18-core-styles-tooltips.1
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/CHANGELOG.md +3 -18
- package/lib/GoogleTagManagerEvent/GTMClickEvent.js +1 -1
- package/lib/GoogleTagManagerEvent/GTMClickEvent.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMEvent.js +6 -3
- package/lib/GoogleTagManagerEvent/GTMEvent.js.map +1 -1
- package/package.json +7 -8
- package/src/GoogleTagManagerEvent/GTMClickEvent.js +3 -2
- package/src/GoogleTagManagerEvent/GTMEvent.js +6 -2
- package/lib-es/GoogleTagManager/GTMFactory.js +0 -55
- package/lib-es/GoogleTagManager/GTMFactory.js.map +0 -1
- package/lib-es/GoogleTagManager/GTMRender.js +0 -72
- package/lib-es/GoogleTagManager/GTMRender.js.map +0 -1
- package/lib-es/GoogleTagManager/index.js +0 -3
- package/lib-es/GoogleTagManager/index.js.map +0 -1
- package/lib-es/GoogleTagManagerEvent/GTMClickEvent.js +0 -55
- package/lib-es/GoogleTagManagerEvent/GTMClickEvent.js.map +0 -1
- package/lib-es/GoogleTagManagerEvent/GTMClickEvents.js +0 -32
- package/lib-es/GoogleTagManagerEvent/GTMClickEvents.js.map +0 -1
- package/lib-es/GoogleTagManagerEvent/GTMEvent.js +0 -35
- package/lib-es/GoogleTagManagerEvent/GTMEvent.js.map +0 -1
- package/lib-es/GoogleTagManagerEvent/GTMEventFactory.js +0 -92
- package/lib-es/GoogleTagManagerEvent/GTMEventFactory.js.map +0 -1
- package/lib-es/GoogleTagManagerEvent/GTMEventRender.js +0 -81
- package/lib-es/GoogleTagManagerEvent/GTMEventRender.js.map +0 -1
- package/lib-es/GoogleTagManagerEvent/GTMEventSwitch.js +0 -40
- package/lib-es/GoogleTagManagerEvent/GTMEventSwitch.js.map +0 -1
- package/lib-es/GoogleTagManagerEvent/index.js +0 -3
- package/lib-es/GoogleTagManagerEvent/index.js.map +0 -1
- package/lib-es/constants.js +0 -28
- package/lib-es/constants.js.map +0 -1
- package/lib-es/helpers/build-and-push-web-vitals.js +0 -24
- package/lib-es/helpers/build-and-push-web-vitals.js.map +0 -1
- package/lib-es/helpers/build-data-layer.js +0 -34
- package/lib-es/helpers/build-data-layer.js.map +0 -1
- package/lib-es/helpers/build-nested-event.js +0 -69
- package/lib-es/helpers/build-nested-event.js.map +0 -1
- package/lib-es/helpers/build-props-to-display-array.js +0 -5
- package/lib-es/helpers/build-props-to-display-array.js.map +0 -1
- package/lib-es/helpers/build-user-layer.js +0 -45
- package/lib-es/helpers/build-user-layer.js.map +0 -1
- package/lib-es/helpers/build-user-query-props.js +0 -25
- package/lib-es/helpers/build-user-query-props.js.map +0 -1
- package/lib-es/helpers/filter-gtm-events.js +0 -14
- package/lib-es/helpers/filter-gtm-events.js.map +0 -1
- package/lib-es/helpers/get-ids-to-use.js +0 -8
- package/lib-es/helpers/get-ids-to-use.js.map +0 -1
- package/lib-es/helpers/get-render-props.js +0 -25
- package/lib-es/helpers/get-render-props.js.map +0 -1
- package/lib-es/helpers/index.js +0 -11
- package/lib-es/helpers/index.js.map +0 -1
- package/lib-es/helpers/push-to-data-layer.js +0 -9
- package/lib-es/helpers/push-to-data-layer.js.map +0 -1
- package/lib-es/helpers/reset-data-layer.js +0 -17
- package/lib-es/helpers/reset-data-layer.js.map +0 -1
- package/lib-es/index.js +0 -21
- package/lib-es/index.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [0.146.0-node18-core-styles.
|
|
6
|
+
# [0.146.0-node18-core-styles-tooltips.1](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles-tooltips.0...v0.146.0-node18-core-styles-tooltips.1) (2025-06-20)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
|
|
9
9
|
|
|
@@ -11,28 +11,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
# [0.146.0-node18-core-styles.
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# [0.146.0-node18-core-styles.1](https://github.com/thebyte9/blaze/compare/v0.146.0-node18-core-styles.0...v0.146.0-node18-core-styles.1) (2025-04-07)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# [0.146.0-node18-core-styles.0](https://github.com/thebyte9/blaze/compare/v0.145.0...v0.146.0-node18-core-styles.0) (2025-04-04)
|
|
14
|
+
# [0.146.0-node18-core-styles-tooltips.0](https://github.com/thebyte9/blaze/compare/v0.145.0...v0.146.0-node18-core-styles-tooltips.0) (2025-06-18)
|
|
31
15
|
|
|
32
16
|
|
|
33
17
|
### Bug Fixes
|
|
34
18
|
|
|
35
19
|
* fixed breaking tests, updated next to 14 ([fecb0e1](https://github.com/thebyte9/blaze/commit/fecb0e1d822bd69ebbaa084072a219f0fddd23f1))
|
|
20
|
+
* lint errors in node 18 dev ([#4784](https://github.com/thebyte9/blaze/issues/4784)) ([5b102df](https://github.com/thebyte9/blaze/commit/5b102df10a77abc62aa94ffa476f1c2156c17947))
|
|
36
21
|
* linting fixed automatically ([73135b9](https://github.com/thebyte9/blaze/commit/73135b9b8b0d5407e2e1dfba42ab2381f290607f))
|
|
37
22
|
* udpated yarn lock ([0cd4fa4](https://github.com/thebyte9/blaze/commit/0cd4fa4a185fca4b80b57e472badb771dd649ec2))
|
|
38
23
|
* updated with dev ([90f545f](https://github.com/thebyte9/blaze/commit/90f545f1beabb35e26ba6fb2b45a7a0dfd072927))
|
|
@@ -36,7 +36,7 @@ var GTMClickEvent = function GTMClickEvent(_ref) {
|
|
|
36
36
|
var _checkIfLoggedIn = (0, _coreAuthUi.checkIfLoggedIn)(),
|
|
37
37
|
userId = _checkIfLoggedIn.id;
|
|
38
38
|
var userProps = userId ? (0, _helpers.buildUserQueryProps)(userPropsToDisplay) : '';
|
|
39
|
-
var _useQuery = (0, _client.useQuery)((0, _reactPageBuilder.
|
|
39
|
+
var _useQuery = (0, _client.useQuery)((0, _reactPageBuilder.getCurrentUser)(userProps), {
|
|
40
40
|
variables: {
|
|
41
41
|
id: userId
|
|
42
42
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMClickEvent.js","names":["_react","_interopRequireDefault","require","_propTypes","_client","_coreAuthUi","_reactPageBuilder","_GTMEvent","_helpers","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","GTMClickEvent","_ref","event","componentProps","parentComponent","eventTrigger","propsToDisplay","userPropsToDisplay","eventEcommerce","_checkIfLoggedIn","checkIfLoggedIn","userId","id","userProps","buildUserQueryProps","_useQuery","useQuery","
|
|
1
|
+
{"version":3,"file":"GTMClickEvent.js","names":["_react","_interopRequireDefault","require","_propTypes","_client","_coreAuthUi","_reactPageBuilder","_GTMEvent","_helpers","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","GTMClickEvent","_ref","event","componentProps","parentComponent","eventTrigger","propsToDisplay","userPropsToDisplay","eventEcommerce","_checkIfLoggedIn","checkIfLoggedIn","userId","id","userProps","buildUserQueryProps","_useQuery","useQuery","getCurrentUser","variables","skip","userData","data","loading","dataLayerProps","buildDataLayer","dataLayerObject","buildNestedEvent","userLayerObject","buildUserLayer","extendedDataLayer","createElement","propTypes","PropTypes","object","isRequired","oneOfType","array","defaultProps","_default","exports"],"sources":["../../src/GoogleTagManagerEvent/GTMClickEvent.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport { getCurrentUser } from '@blaze-cms/react-page-builder';\n\nimport GTMEvent from './GTMEvent';\nimport { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';\n\nconst GTMClickEvent = ({ event, componentProps, parentComponent }) => {\n const { eventTrigger, propsToDisplay, userPropsToDisplay, eventEcommerce } = event;\n const { id: userId } = checkIfLoggedIn();\n const userProps = userId ? buildUserQueryProps(userPropsToDisplay) : '';\n const { data: userData, loading } = useQuery(getCurrentUser(userProps), {\n variables: { id: userId },\n skip: !userId\n });\n if (loading) return null;\n const dataLayerProps = buildDataLayer(componentProps, propsToDisplay);\n const dataLayerObject = buildNestedEvent(eventEcommerce, event, dataLayerProps, parentComponent);\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n return <GTMEvent dataLayerObject={extendedDataLayer} eventTrigger={eventTrigger} />;\n};\n\nGTMClickEvent.propTypes = {\n event: PropTypes.object.isRequired,\n componentProps: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\n parentComponent: PropTypes.object\n};\n\nGTMClickEvent.defaultProps = {\n componentProps: {},\n parentComponent: {}\n};\n\nexport default GTMClickEvent;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,O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C+B,SAAS,GAAG;EACxB7B,KAAK,EAAE8B,qBAAS,CAACC,MAAM,CAACC,UAAU;EAClC/B,cAAc,EAAE6B,qBAAS,CAACG,SAAS,CAAC,CAACH,qBAAS,CAACC,MAAM,EAAED,qBAAS,CAACI,KAAK,CAAC,CAAC;EACxEhC,eAAe,EAAE4B,qBAAS,CAACC;AAC7B,CAAC;AAEDjC,aAAa,CAACqC,YAAY,GAAG;EAC3BlC,cAAc,EAAE,CAAC,CAAC;EAClBC,eAAe,EAAE,CAAC;AACpB,CAAC;AAAC,IAAAkC,QAAA,GAAAC,OAAA,cAEavC,aAAa","ignoreList":[]}
|
|
@@ -40,10 +40,13 @@ var GTMEvent = function GTMEvent(_ref) {
|
|
|
40
40
|
setShouldPushLayer(false);
|
|
41
41
|
if (isOnSuccess) handleOnSuccess();
|
|
42
42
|
};
|
|
43
|
-
if (!isViewEvent && shouldPushLayer)
|
|
44
|
-
|
|
43
|
+
if (!isViewEvent && shouldPushLayer) {
|
|
44
|
+
pushDataLayer();
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return isViewEvent && shouldPushLayer ? /*#__PURE__*/_react["default"].createElement(_reactWaypoint.Waypoint, {
|
|
45
48
|
onEnter: pushDataLayer
|
|
46
|
-
})
|
|
49
|
+
}) : null;
|
|
47
50
|
};
|
|
48
51
|
GTMEvent.propTypes = {
|
|
49
52
|
handleOnSuccess: _propTypes["default"].func.isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEvent.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_reactWaypoint","_helpers","_constants","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","GTMEvent","_ref","dataLayerObject","eventTrigger","currentLocation","handleOnSuccess","_useState","useState","_useState2","_slicedToArray2","shouldPushLayer","setShouldPushLayer","isViewEvent","IN_VIEW","isOnSuccess","ON_SUCCESS","useEffect","pushDataLayer","pushToDataLayer","createElement","
|
|
1
|
+
{"version":3,"file":"GTMEvent.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_reactWaypoint","_helpers","_constants","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","GTMEvent","_ref","dataLayerObject","eventTrigger","currentLocation","handleOnSuccess","_useState","useState","_useState2","_slicedToArray2","shouldPushLayer","setShouldPushLayer","isViewEvent","IN_VIEW","isOnSuccess","ON_SUCCESS","useEffect","pushDataLayer","pushToDataLayer","createElement","Waypoint","onEnter","propTypes","PropTypes","func","isRequired","object","string","_default","exports"],"sources":["../../src/GoogleTagManagerEvent/GTMEvent.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { Waypoint } from 'react-waypoint';\nimport { pushToDataLayer } from '../helpers';\nimport { IN_VIEW, ON_SUCCESS } from '../constants';\n\nconst GTMEvent = ({ dataLayerObject, eventTrigger, currentLocation, handleOnSuccess }) => {\n const [shouldPushLayer, setShouldPushLayer] = useState(false);\n const isViewEvent = eventTrigger === IN_VIEW;\n const isOnSuccess = eventTrigger === ON_SUCCESS && !!handleOnSuccess;\n\n useEffect(() => {\n setShouldPushLayer(true);\n }, [currentLocation]);\n\n const pushDataLayer = () => {\n pushToDataLayer(dataLayerObject);\n setShouldPushLayer(false);\n if (isOnSuccess) handleOnSuccess();\n };\n\n if (!isViewEvent && shouldPushLayer) {\n pushDataLayer();\n return null;\n }\n\n return isViewEvent && shouldPushLayer ? <Waypoint onEnter={pushDataLayer} /> : null;\n};\n\nGTMEvent.propTypes = {\n handleOnSuccess: PropTypes.func.isRequired,\n dataLayerObject: PropTypes.object.isRequired,\n eventTrigger: PropTypes.string.isRequired,\n currentLocation: PropTypes.string.isRequired\n};\n\nexport default GTMEvent;\n"],"mappings":";;;;;;;;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,EAAEoB,qBAAS,CAACI,MAAM,CAACF,UAAU;EACzCrB,eAAe,EAAEmB,qBAAS,CAACI,MAAM,CAACF;AACpC,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,cAEa7B,QAAQ","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/plugin-gtm-fe",
|
|
3
|
-
"version": "0.146.0-node18-core-styles.
|
|
3
|
+
"version": "0.146.0-node18-core-styles-tooltips.1",
|
|
4
4
|
"description": "Blaze GTM plugin fe",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/core-auth-ui": "0.146.0-node18-core-styles.
|
|
31
|
-
"@blaze-cms/nextjs-components": "0.146.0-node18-core-styles.
|
|
32
|
-
"@blaze-cms/react-page-builder": "0.146.0-node18-core-styles.
|
|
33
|
-
"@blaze-cms/setup-ui": "0.146.0-node18-core-styles.0",
|
|
30
|
+
"@blaze-cms/core-auth-ui": "0.146.0-node18-core-styles-tooltips.0",
|
|
31
|
+
"@blaze-cms/nextjs-components": "0.146.0-node18-core-styles-tooltips.1",
|
|
32
|
+
"@blaze-cms/react-page-builder": "0.146.0-node18-core-styles-tooltips.1",
|
|
33
|
+
"@blaze-cms/setup-ui": "0.146.0-node18-core-styles-tooltips.0",
|
|
34
34
|
"core-js": "^3.2.1",
|
|
35
35
|
"regenerator-runtime": "^0.13.3",
|
|
36
36
|
"web-vitals": "^0.2.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@blaze-cms/core-ui": "0.146.0-node18-core-styles.
|
|
39
|
+
"@blaze-cms/core-ui": "0.146.0-node18-core-styles-tooltips.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"next": "14.1.0"
|
|
@@ -44,6 +44,5 @@
|
|
|
44
44
|
"eslintIgnore": [
|
|
45
45
|
"lib/*",
|
|
46
46
|
"lib-es/*"
|
|
47
|
-
]
|
|
48
|
-
"gitHead": "8e8b72f9aceac198ed183ebdffedd8e1798e2c50"
|
|
47
|
+
]
|
|
49
48
|
}
|
|
@@ -2,7 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useQuery } from '@apollo/client';
|
|
4
4
|
import { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';
|
|
5
|
-
import {
|
|
5
|
+
import { getCurrentUser } from '@blaze-cms/react-page-builder';
|
|
6
|
+
|
|
6
7
|
import GTMEvent from './GTMEvent';
|
|
7
8
|
import { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';
|
|
8
9
|
|
|
@@ -10,7 +11,7 @@ const GTMClickEvent = ({ event, componentProps, parentComponent }) => {
|
|
|
10
11
|
const { eventTrigger, propsToDisplay, userPropsToDisplay, eventEcommerce } = event;
|
|
11
12
|
const { id: userId } = checkIfLoggedIn();
|
|
12
13
|
const userProps = userId ? buildUserQueryProps(userPropsToDisplay) : '';
|
|
13
|
-
const { data: userData, loading } = useQuery(
|
|
14
|
+
const { data: userData, loading } = useQuery(getCurrentUser(userProps), {
|
|
14
15
|
variables: { id: userId },
|
|
15
16
|
skip: !userId
|
|
16
17
|
});
|
|
@@ -12,15 +12,19 @@ const GTMEvent = ({ dataLayerObject, eventTrigger, currentLocation, handleOnSucc
|
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
setShouldPushLayer(true);
|
|
14
14
|
}, [currentLocation]);
|
|
15
|
+
|
|
15
16
|
const pushDataLayer = () => {
|
|
16
17
|
pushToDataLayer(dataLayerObject);
|
|
17
18
|
setShouldPushLayer(false);
|
|
18
19
|
if (isOnSuccess) handleOnSuccess();
|
|
19
20
|
};
|
|
20
21
|
|
|
21
|
-
if (!isViewEvent && shouldPushLayer)
|
|
22
|
+
if (!isViewEvent && shouldPushLayer) {
|
|
23
|
+
pushDataLayer();
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
22
26
|
|
|
23
|
-
return
|
|
27
|
+
return isViewEvent && shouldPushLayer ? <Waypoint onEnter={pushDataLayer} /> : null;
|
|
24
28
|
};
|
|
25
29
|
|
|
26
30
|
GTMEvent.propTypes = {
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { useQuery } from '@apollo/client';
|
|
4
|
-
import { getSingleEntitySchema, buildPropsQuery } from '@blaze-cms/react-page-builder';
|
|
5
|
-
import { MainContext } from '@blaze-cms/nextjs-components';
|
|
6
|
-
import GTMRender from './GTMRender';
|
|
7
|
-
import { getRenderProps, buildPropsToDisplayArray } from '../helpers';
|
|
8
|
-
const GTMFactory = ({
|
|
9
|
-
propsToDisplay,
|
|
10
|
-
userPropsToDisplay,
|
|
11
|
-
parent,
|
|
12
|
-
gtmWebVitals
|
|
13
|
-
}) => {
|
|
14
|
-
const {
|
|
15
|
-
isPreview
|
|
16
|
-
} = useContext(MainContext);
|
|
17
|
-
const {
|
|
18
|
-
data,
|
|
19
|
-
error,
|
|
20
|
-
loading
|
|
21
|
-
} = useQuery(getSingleEntitySchema, {
|
|
22
|
-
variables: {
|
|
23
|
-
id: parent.itemEntity
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
if (typeof window === 'undefined') return null;
|
|
27
|
-
if (loading || error || !data) return null;
|
|
28
|
-
const propsToDisplayArr = buildPropsToDisplayArray(propsToDisplay);
|
|
29
|
-
const extraProps = buildPropsQuery(data, propsToDisplayArr) || '';
|
|
30
|
-
const {
|
|
31
|
-
action,
|
|
32
|
-
actionKey
|
|
33
|
-
} = getRenderProps(extraProps, isPreview, data);
|
|
34
|
-
return /*#__PURE__*/React.createElement(GTMRender, {
|
|
35
|
-
action: action,
|
|
36
|
-
actionKey: actionKey,
|
|
37
|
-
userPropsToDisplay: userPropsToDisplay,
|
|
38
|
-
propsToDisplay: propsToDisplay,
|
|
39
|
-
parentId: parent.itemId,
|
|
40
|
-
webVitals: gtmWebVitals
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
GTMFactory.propTypes = {
|
|
44
|
-
propsToDisplay: PropTypes.array,
|
|
45
|
-
userPropsToDisplay: PropTypes.array,
|
|
46
|
-
parent: PropTypes.object.isRequired,
|
|
47
|
-
gtmWebVitals: PropTypes.bool
|
|
48
|
-
};
|
|
49
|
-
GTMFactory.defaultProps = {
|
|
50
|
-
propsToDisplay: [],
|
|
51
|
-
userPropsToDisplay: [],
|
|
52
|
-
gtmWebVitals: false
|
|
53
|
-
};
|
|
54
|
-
export default GTMFactory;
|
|
55
|
-
//# sourceMappingURL=GTMFactory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import { useState } from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import { useQuery } from '@apollo/client';
|
|
7
|
-
import { withRouter } from 'next/router';
|
|
8
|
-
import { getCurrentUser } from '@blaze-cms/react-page-builder';
|
|
9
|
-
import { buildDataLayer, buildAndPushWebVitals, pushToDataLayer, buildUserQueryProps, buildUserLayer } from '../helpers';
|
|
10
|
-
const GTMRender = ({
|
|
11
|
-
router,
|
|
12
|
-
action,
|
|
13
|
-
propsToDisplay,
|
|
14
|
-
parentId,
|
|
15
|
-
webVitals,
|
|
16
|
-
userPropsToDisplay
|
|
17
|
-
}) => {
|
|
18
|
-
const {
|
|
19
|
-
asPath
|
|
20
|
-
} = router;
|
|
21
|
-
const [currentLocation, setCurrentLocation] = useState({
|
|
22
|
-
url: '',
|
|
23
|
-
shouldPushLayer: false
|
|
24
|
-
});
|
|
25
|
-
const {
|
|
26
|
-
data,
|
|
27
|
-
error,
|
|
28
|
-
loading
|
|
29
|
-
} = useQuery(action, {
|
|
30
|
-
variables: {
|
|
31
|
-
id: parentId
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const hasUserProps = userPropsToDisplay && userPropsToDisplay.length;
|
|
35
|
-
const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';
|
|
36
|
-
const {
|
|
37
|
-
data: userData,
|
|
38
|
-
loading: userLoading
|
|
39
|
-
} = useQuery(getCurrentUser(userProps), {
|
|
40
|
-
variables: {},
|
|
41
|
-
skip: !hasUserProps
|
|
42
|
-
});
|
|
43
|
-
if (loading || userLoading || !data || !data.entityData) return null;
|
|
44
|
-
if (data.entityData.id !== parentId) return null;
|
|
45
|
-
if (error) return error.message;
|
|
46
|
-
if (currentLocation.url !== asPath) setCurrentLocation({
|
|
47
|
-
url: asPath,
|
|
48
|
-
shouldPushLayer: true
|
|
49
|
-
});
|
|
50
|
-
if (!currentLocation.shouldPushLayer) return null;
|
|
51
|
-
const {
|
|
52
|
-
entityData
|
|
53
|
-
} = data;
|
|
54
|
-
const dataLayerObject = buildDataLayer(entityData, propsToDisplay, currentLocation.url);
|
|
55
|
-
const userLayerObject = buildUserLayer(userData, userPropsToDisplay);
|
|
56
|
-
const extendedDataLayer = _objectSpread(_objectSpread({}, dataLayerObject), userLayerObject);
|
|
57
|
-
if (webVitals) buildAndPushWebVitals();
|
|
58
|
-
pushToDataLayer(extendedDataLayer, true);
|
|
59
|
-
setCurrentLocation(_objectSpread(_objectSpread({}, currentLocation), {}, {
|
|
60
|
-
shouldPushLayer: false
|
|
61
|
-
}));
|
|
62
|
-
return null;
|
|
63
|
-
};
|
|
64
|
-
GTMRender.propTypes = {
|
|
65
|
-
userPropsToDisplay: PropTypes.array.isRequired,
|
|
66
|
-
action: PropTypes.object.isRequired,
|
|
67
|
-
propsToDisplay: PropTypes.array.isRequired,
|
|
68
|
-
parentId: PropTypes.string.isRequired,
|
|
69
|
-
webVitals: PropTypes.bool.isRequired
|
|
70
|
-
};
|
|
71
|
-
export default withRouter(GTMRender);
|
|
72
|
-
//# sourceMappingURL=GTMRender.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,SAC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AAC,CAAC;EAC9F,IAAI,CAACH,eAAe,CAACG,eAAe,EAAE,OAAO,IAAI;EAEjD,MAAM;IAAEY;EAAW,CAAC,GAAGX,IAAI;EAC3B,MAAMa,eAAe,GAAG9B,cAAc,CAAC4B,UAAU,EAAEpB,cAAc,EAAEK,eAAe,CAACE,GAAG,CAAC;EACvF,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 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import { useQuery } from '@apollo/client';
|
|
7
|
-
import { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';
|
|
8
|
-
import { getCurretUser } from '@blaze-cms/react-page-builder';
|
|
9
|
-
import GTMEvent from './GTMEvent';
|
|
10
|
-
import { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';
|
|
11
|
-
const GTMClickEvent = ({
|
|
12
|
-
event,
|
|
13
|
-
componentProps,
|
|
14
|
-
parentComponent
|
|
15
|
-
}) => {
|
|
16
|
-
const {
|
|
17
|
-
eventTrigger,
|
|
18
|
-
propsToDisplay,
|
|
19
|
-
userPropsToDisplay,
|
|
20
|
-
eventEcommerce
|
|
21
|
-
} = event;
|
|
22
|
-
const {
|
|
23
|
-
id: userId
|
|
24
|
-
} = checkIfLoggedIn();
|
|
25
|
-
const userProps = userId ? buildUserQueryProps(userPropsToDisplay) : '';
|
|
26
|
-
const {
|
|
27
|
-
data: userData,
|
|
28
|
-
loading
|
|
29
|
-
} = useQuery(getCurretUser(userProps), {
|
|
30
|
-
variables: {
|
|
31
|
-
id: userId
|
|
32
|
-
},
|
|
33
|
-
skip: !userId
|
|
34
|
-
});
|
|
35
|
-
if (loading) return null;
|
|
36
|
-
const dataLayerProps = buildDataLayer(componentProps, propsToDisplay);
|
|
37
|
-
const dataLayerObject = buildNestedEvent(eventEcommerce, event, dataLayerProps, parentComponent);
|
|
38
|
-
const userLayerObject = buildUserLayer(userData, userPropsToDisplay);
|
|
39
|
-
const extendedDataLayer = _objectSpread(_objectSpread({}, dataLayerObject), userLayerObject);
|
|
40
|
-
return /*#__PURE__*/React.createElement(GTMEvent, {
|
|
41
|
-
dataLayerObject: extendedDataLayer,
|
|
42
|
-
eventTrigger: eventTrigger
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
GTMClickEvent.propTypes = {
|
|
46
|
-
event: PropTypes.object.isRequired,
|
|
47
|
-
componentProps: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
48
|
-
parentComponent: PropTypes.object
|
|
49
|
-
};
|
|
50
|
-
GTMClickEvent.defaultProps = {
|
|
51
|
-
componentProps: {},
|
|
52
|
-
parentComponent: {}
|
|
53
|
-
};
|
|
54
|
-
export default GTMClickEvent;
|
|
55
|
-
//# sourceMappingURL=GTMClickEvent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GTMClickEvent.js","names":["React","PropTypes","useQuery","checkIfLoggedIn","getCurretUser","GTMEvent","buildDataLayer","buildNestedEvent","buildUserQueryProps","buildUserLayer","GTMClickEvent","event","componentProps","parentComponent","eventTrigger","propsToDisplay","userPropsToDisplay","eventEcommerce","id","userId","userProps","data","userData","loading","variables","skip","dataLayerProps","dataLayerObject","userLayerObject","extendedDataLayer","_objectSpread","createElement","propTypes","object","isRequired","oneOfType","array","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMClickEvent.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport { getCurretUser } from '@blaze-cms/react-page-builder';\nimport GTMEvent from './GTMEvent';\nimport { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';\n\nconst GTMClickEvent = ({ event, componentProps, parentComponent }) => {\n const { eventTrigger, propsToDisplay, userPropsToDisplay, eventEcommerce } = event;\n const { id: userId } = checkIfLoggedIn();\n const userProps = userId ? buildUserQueryProps(userPropsToDisplay) : '';\n const { data: userData, loading } = useQuery(getCurretUser(userProps), {\n variables: { id: userId },\n skip: !userId\n });\n if (loading) return null;\n const dataLayerProps = buildDataLayer(componentProps, propsToDisplay);\n const dataLayerObject = buildNestedEvent(eventEcommerce, event, dataLayerProps, parentComponent);\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n return <GTMEvent dataLayerObject={extendedDataLayer} eventTrigger={eventTrigger} />;\n};\n\nGTMClickEvent.propTypes = {\n event: PropTypes.object.isRequired,\n componentProps: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\n parentComponent: PropTypes.object\n};\n\nGTMClickEvent.defaultProps = {\n componentProps: {},\n parentComponent: {}\n};\n\nexport default GTMClickEvent;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,aAAa,QAAQ,+BAA+B;AAC7D,OAAOC,QAAQ,MAAM,YAAY;AACjC,SAASC,cAAc,EAAEC,gBAAgB,EAAEC,mBAAmB,EAAEC,cAAc,QAAQ,YAAY;AAElG,MAAMC,aAAa,GAAGA,CAAC;EAAEC,KAAK;EAAEC,cAAc;EAAEC;AAAgB,CAAC,KAAK;EACpE,MAAM;IAAEC,YAAY;IAAEC,cAAc;IAAEC,kBAAkB;IAAEC;EAAe,CAAC,GAAGN,KAAK;EAClF,MAAM;IAAEO,EAAE,EAAEC;EAAO,CAAC,GAAGhB,eAAe,CAAC,CAAC;EACxC,MAAMiB,SAAS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ropTypes from 'prop-types';
|
|
4
|
-
import GTMClickEvent from './GTMClickEvent';
|
|
5
|
-
const GTMClickEvents = ({
|
|
6
|
-
gtmEvents,
|
|
7
|
-
componentProps,
|
|
8
|
-
parentComponent
|
|
9
|
-
}) => gtmEvents.map((event, index) => {
|
|
10
|
-
const {
|
|
11
|
-
eventName
|
|
12
|
-
} = event;
|
|
13
|
-
const dynamicKey = [eventName, index].join('-');
|
|
14
|
-
return /*#__PURE__*/React.createElement(GTMClickEvent, _extends({
|
|
15
|
-
key: dynamicKey,
|
|
16
|
-
event: event,
|
|
17
|
-
componentProps: componentProps,
|
|
18
|
-
parentComponent: parentComponent
|
|
19
|
-
}, event));
|
|
20
|
-
});
|
|
21
|
-
GTMClickEvents.propTypes = {
|
|
22
|
-
gtmEvents: PropTypes.array,
|
|
23
|
-
componentProps: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
24
|
-
parentComponent: PropTypes.object
|
|
25
|
-
};
|
|
26
|
-
GTMClickEvents.defaultProps = {
|
|
27
|
-
gtmEvents: [],
|
|
28
|
-
componentProps: {},
|
|
29
|
-
parentComponent: {}
|
|
30
|
-
};
|
|
31
|
-
export default GTMClickEvents;
|
|
32
|
-
//# sourceMappingURL=GTMClickEvents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GTMClickEvents.js","names":["React","PropTypes","GTMClickEvent","GTMClickEvents","gtmEvents","componentProps","parentComponent","map","event","index","eventName","dynamicKey","join","createElement","_extends","key","propTypes","array","oneOfType","object","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMClickEvents.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport GTMClickEvent from './GTMClickEvent';\n\nconst GTMClickEvents = ({ gtmEvents, componentProps, parentComponent }) =>\n gtmEvents.map((event, index) => {\n const { eventName } = event;\n const dynamicKey = [eventName, index].join('-');\n\n return (\n <GTMClickEvent\n key={dynamicKey}\n event={event}\n componentProps={componentProps}\n parentComponent={parentComponent}\n {...event}\n />\n );\n });\n\nGTMClickEvents.propTypes = {\n gtmEvents: PropTypes.array,\n componentProps: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\n parentComponent: PropTypes.object\n};\n\nGTMClickEvents.defaultProps = {\n gtmEvents: [],\n componentProps: {},\n parentComponent: {}\n};\n\nexport default GTMClickEvents;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,aAAa,MAAM,iBAAiB;AAE3C,MAAMC,cAAc,GAAGA,CAAC;EAAEC,SAAS;EAAEC,cAAc;EAAEC;AAAgB,CAAC,KACpEF,SAAS,CAACG,GAAG,CAAC,CAACC,KAAK,EAAEC,KAAK,KAAK;EAC9B,MAAM;IAAEC;EAAU,CAAC,GAAGF,KAAK;EAC3B,MAAMG,UAAU,GAAG,CAACD,SAAS,EAAED,KAAK,CAAC,CAACG,IAAI,CAAC,GAAG,CAAC;EAE/C,oBACEZ,KAAA,CAAAa,aAAA,CAACX,aAAa,EAAAY,QAAA;IACZC,GAAG,EAAEJ,UAAW;IAChBH,KAAK,EAAEA,KAAM;IACbH,cAAc,EAAEA,cAAe;IAC/BC,eAAe,EAAEA;EAAgB,GAC7BE,KAAK,CACV,CAAC;AAEN,CAAC,CAAC;AAEJL,cAAc,CAACa,SAAS,GAAG;EACzBZ,SAAS,EAAEH,SAAS,CAACgB,KAAK;EAC1BZ,cAAc,EAAEJ,SAAS,CAACiB,SAAS,CAAC,CAACjB,SAAS,CAACkB,MAAM,EAAElB,SAAS,CAACgB,KAAK,CAAC,CAAC;EACxEX,eAAe,EAAEL,SAAS,CAACkB;AAC7B,CAAC;AAEDhB,cAAc,CAACiB,YAAY,GAAG;EAC5BhB,SAAS,EAAE,EAAE;EACbC,cAAc,EAAE,CAAC,CAAC;EAClBC,eAAe,EAAE,CAAC;AACpB,CAAC;AAED,eAAeH,cAAc","ignoreList":[]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Waypoint } from 'react-waypoint';
|
|
4
|
-
import { pushToDataLayer } from '../helpers';
|
|
5
|
-
import { IN_VIEW, ON_SUCCESS } from '../constants';
|
|
6
|
-
const GTMEvent = ({
|
|
7
|
-
dataLayerObject,
|
|
8
|
-
eventTrigger,
|
|
9
|
-
currentLocation,
|
|
10
|
-
handleOnSuccess
|
|
11
|
-
}) => {
|
|
12
|
-
const [shouldPushLayer, setShouldPushLayer] = useState(false);
|
|
13
|
-
const isViewEvent = eventTrigger === IN_VIEW;
|
|
14
|
-
const isOnSuccess = eventTrigger === ON_SUCCESS && !!handleOnSuccess;
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
setShouldPushLayer(true);
|
|
17
|
-
}, [currentLocation]);
|
|
18
|
-
const pushDataLayer = () => {
|
|
19
|
-
pushToDataLayer(dataLayerObject);
|
|
20
|
-
setShouldPushLayer(false);
|
|
21
|
-
if (isOnSuccess) handleOnSuccess();
|
|
22
|
-
};
|
|
23
|
-
if (!isViewEvent && shouldPushLayer) pushDataLayer();
|
|
24
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, isViewEvent && shouldPushLayer && /*#__PURE__*/React.createElement(Waypoint, {
|
|
25
|
-
onEnter: pushDataLayer
|
|
26
|
-
}));
|
|
27
|
-
};
|
|
28
|
-
GTMEvent.propTypes = {
|
|
29
|
-
handleOnSuccess: PropTypes.func.isRequired,
|
|
30
|
-
dataLayerObject: PropTypes.object.isRequired,
|
|
31
|
-
eventTrigger: PropTypes.string.isRequired,
|
|
32
|
-
currentLocation: PropTypes.string.isRequired
|
|
33
|
-
};
|
|
34
|
-
export default GTMEvent;
|
|
35
|
-
//# sourceMappingURL=GTMEvent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEvent.js","names":["React","useState","useEffect","PropTypes","Waypoint","pushToDataLayer","IN_VIEW","ON_SUCCESS","GTMEvent","dataLayerObject","eventTrigger","currentLocation","handleOnSuccess","shouldPushLayer","setShouldPushLayer","isViewEvent","isOnSuccess","pushDataLayer","createElement","Fragment","onEnter","propTypes","func","isRequired","object","string"],"sources":["../../src/GoogleTagManagerEvent/GTMEvent.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { Waypoint } from 'react-waypoint';\nimport { pushToDataLayer } from '../helpers';\nimport { IN_VIEW, ON_SUCCESS } from '../constants';\n\nconst GTMEvent = ({ dataLayerObject, eventTrigger, currentLocation, handleOnSuccess }) => {\n const [shouldPushLayer, setShouldPushLayer] = useState(false);\n const isViewEvent = eventTrigger === IN_VIEW;\n const isOnSuccess = eventTrigger === ON_SUCCESS && !!handleOnSuccess;\n\n useEffect(() => {\n setShouldPushLayer(true);\n }, [currentLocation]);\n const pushDataLayer = () => {\n pushToDataLayer(dataLayerObject);\n setShouldPushLayer(false);\n if (isOnSuccess) handleOnSuccess();\n };\n\n if (!isViewEvent && shouldPushLayer) pushDataLayer();\n\n return <>{isViewEvent && shouldPushLayer && <Waypoint onEnter={pushDataLayer} />}</>;\n};\n\nGTMEvent.propTypes = {\n handleOnSuccess: PropTypes.func.isRequired,\n dataLayerObject: PropTypes.object.isRequired,\n eventTrigger: PropTypes.string.isRequired,\n currentLocation: PropTypes.string.isRequired\n};\n\nexport default GTMEvent;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,eAAe,QAAQ,YAAY;AAC5C,SAASC,OAAO,EAAEC,UAAU,QAAQ,cAAc;AAElD,MAAMC,QAAQ,GAAGA,CAAC;EAAEC,eAAe;EAAEC,YAAY;EAAEC,eAAe;EAAEC;AAAgB,CAAC,KAAK;EACxF,MAAM,CAACC,eAAe,EAAEC,kBAAkB,CAAC,GAAGb,QAAQ,CAAC,KAAK,CAAC;EAC7D,MAAMc,WAAW,GAAGL,YAAY,KAAKJ,OAAO;EAC5C,MAAMU,WAAW,GAAGN,YAAY,KAAKH,UAAU,IAAI,CAAC,CAACK,eAAe;EAEpEV,SAAS,CAAC,MAAM;IACdY,kBAAkB,CAAC,IAAI,CAAC;EAC1B,CAAC,EAAE,CAACH,eAAe,CAAC,CAAC;EACrB,MAAMM,aAAa,GAAGA,CAAA,KAAM;IAC1BZ,eAAe,CAACI,eAAe,CAAC;IAChCK,kBAAkB,CAAC,KAAK,CAAC;IACzB,IAAIE,WAAW,EAAEJ,eAAe,CAAC,CAAC;EACpC,CAAC;EAED,IAAI,CAACG,WAAW,IAAIF,eAAe,EAAEI,aAAa,CAAC,CAAC;EAEpD,oBAAOjB,KAAA,CAAAkB,aAAA,CAAAlB,KAAA,CAAAmB,QAAA,QAAGJ,WAAW,IAAIF,eAAe,iBAAIb,KAAA,CAAAkB,aAAA,CAACd,QAAQ;IAACgB,OAAO,EAAEH;EAAc,CAAE,CAAI,CAAC;AACtF,CAAC;AAEDT,QAAQ,CAACa,SAAS,GAAG;EACnBT,eAAe,EAAET,SAAS,CAACmB,IAAI,CAACC,UAAU;EAC1Cd,eAAe,EAAEN,SAAS,CAACqB,MAAM,CAACD,UAAU;EAC5Cb,YAAY,EAAEP,SAAS,CAACsB,MAAM,CAACF,UAAU;EACzCZ,eAAe,EAAER,SAAS,CAACsB,MAAM,CAACF;AACpC,CAAC;AAED,eAAef,QAAQ","ignoreList":[]}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["propsToDisplay"];
|
|
4
|
-
import React, { useContext } from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import { useQuery } from '@apollo/client';
|
|
7
|
-
import { getSingleEntitySchema, buildPropsQuery } from '@blaze-cms/react-page-builder';
|
|
8
|
-
import { MainContext } from '@blaze-cms/nextjs-components';
|
|
9
|
-
import GTMEventRender from './GTMEventRender';
|
|
10
|
-
import { getRenderProps, getIdsToUse, buildPropsToDisplayArray } from '../helpers';
|
|
11
|
-
import { GTM_EVENT_FACTORY } from '../constants';
|
|
12
|
-
const GTMEventFactory = ({
|
|
13
|
-
parent,
|
|
14
|
-
gtmEvents,
|
|
15
|
-
parentData,
|
|
16
|
-
clickId,
|
|
17
|
-
parentComponent
|
|
18
|
-
}) => {
|
|
19
|
-
const {
|
|
20
|
-
isPreview
|
|
21
|
-
} = useContext(MainContext);
|
|
22
|
-
const [{
|
|
23
|
-
itemEntity = parent.itemEntity
|
|
24
|
-
} = {}] = parentData || [];
|
|
25
|
-
const {
|
|
26
|
-
data,
|
|
27
|
-
error,
|
|
28
|
-
loading
|
|
29
|
-
} = useQuery(getSingleEntitySchema, {
|
|
30
|
-
variables: {
|
|
31
|
-
id: itemEntity
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
if (loading || error || !data) return null;
|
|
35
|
-
return gtmEvents.map((_ref, i) => {
|
|
36
|
-
let {
|
|
37
|
-
propsToDisplay
|
|
38
|
-
} = _ref,
|
|
39
|
-
eventProps = _objectWithoutProperties(_ref, _excluded);
|
|
40
|
-
const hasNoPropsToDisplay = !propsToDisplay || !propsToDisplay.length;
|
|
41
|
-
const propsToDisplayArr = buildPropsToDisplayArray(propsToDisplay);
|
|
42
|
-
const extraProps = hasNoPropsToDisplay ? '' : buildPropsQuery(data, propsToDisplayArr);
|
|
43
|
-
const shouldUseParentData = !clickId && parentData && parentData.length;
|
|
44
|
-
const itemIdToUse = clickId || parent.itemId;
|
|
45
|
-
const itemId = shouldUseParentData ? getIdsToUse(parentData) : itemIdToUse;
|
|
46
|
-
const shouldUseMultiQuery = Array.isArray(itemId);
|
|
47
|
-
const {
|
|
48
|
-
action,
|
|
49
|
-
actionKey
|
|
50
|
-
} = getRenderProps(extraProps, isPreview, data, shouldUseMultiQuery);
|
|
51
|
-
const dynamicKey = `${GTM_EVENT_FACTORY}${i}`;
|
|
52
|
-
const queryVariables = shouldUseMultiQuery ? {
|
|
53
|
-
variables: {
|
|
54
|
-
where: {
|
|
55
|
-
id: {
|
|
56
|
-
_in: itemId
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
skip: hasNoPropsToDisplay
|
|
61
|
-
} : {
|
|
62
|
-
variables: {
|
|
63
|
-
id: itemId
|
|
64
|
-
},
|
|
65
|
-
skip: hasNoPropsToDisplay
|
|
66
|
-
};
|
|
67
|
-
return /*#__PURE__*/React.createElement(GTMEventRender, _extends({
|
|
68
|
-
key: dynamicKey,
|
|
69
|
-
action: action,
|
|
70
|
-
actionKey: actionKey,
|
|
71
|
-
propsToDisplay: propsToDisplay,
|
|
72
|
-
id: itemId,
|
|
73
|
-
queryVariables: queryVariables,
|
|
74
|
-
parentComponent: parentComponent
|
|
75
|
-
}, eventProps));
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
GTMEventFactory.propTypes = {
|
|
79
|
-
parent: PropTypes.object.isRequired,
|
|
80
|
-
clickId: PropTypes.string,
|
|
81
|
-
gtmEvents: PropTypes.array,
|
|
82
|
-
parentData: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
83
|
-
parentComponent: PropTypes.object
|
|
84
|
-
};
|
|
85
|
-
GTMEventFactory.defaultProps = {
|
|
86
|
-
clickId: null,
|
|
87
|
-
gtmEvents: [],
|
|
88
|
-
parentData: null,
|
|
89
|
-
parentComponent: {}
|
|
90
|
-
};
|
|
91
|
-
export default GTMEventFactory;
|
|
92
|
-
//# sourceMappingURL=GTMEventFactory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEventFactory.js","names":["React","useContext","PropTypes","useQuery","getSingleEntitySchema","buildPropsQuery","MainContext","GTMEventRender","getRenderProps","getIdsToUse","buildPropsToDisplayArray","GTM_EVENT_FACTORY","GTMEventFactory","parent","gtmEvents","parentData","clickId","parentComponent","isPreview","itemEntity","data","error","loading","variables","id","map","_ref","i","propsToDisplay","eventProps","_objectWithoutProperties","_excluded","hasNoPropsToDisplay","length","propsToDisplayArr","extraProps","shouldUseParentData","itemIdToUse","itemId","shouldUseMultiQuery","Array","isArray","action","actionKey","dynamicKey","queryVariables","where","_in","skip","createElement","_extends","key","propTypes","object","isRequired","string","array","oneOfType","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMEventFactory.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { getSingleEntitySchema, buildPropsQuery } from '@blaze-cms/react-page-builder';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport GTMEventRender from './GTMEventRender';\nimport { getRenderProps, getIdsToUse, buildPropsToDisplayArray } from '../helpers';\nimport { GTM_EVENT_FACTORY } from '../constants';\n\nconst GTMEventFactory = ({ parent, gtmEvents, parentData, clickId, parentComponent }) => {\n const { isPreview } = useContext(MainContext);\n const [{ itemEntity = parent.itemEntity } = {}] = parentData || [];\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: itemEntity }\n });\n\n if (loading || error || !data) return null;\n\n return gtmEvents.map(({ propsToDisplay, ...eventProps }, i) => {\n const hasNoPropsToDisplay = !propsToDisplay || !propsToDisplay.length;\n const propsToDisplayArr = buildPropsToDisplayArray(propsToDisplay);\n const extraProps = hasNoPropsToDisplay ? '' : buildPropsQuery(data, propsToDisplayArr);\n const shouldUseParentData = !clickId && parentData && parentData.length;\n const itemIdToUse = clickId || parent.itemId;\n const itemId = shouldUseParentData ? getIdsToUse(parentData) : itemIdToUse;\n const shouldUseMultiQuery = Array.isArray(itemId);\n const { action, actionKey } = getRenderProps(extraProps, isPreview, data, shouldUseMultiQuery);\n const dynamicKey = `${GTM_EVENT_FACTORY}${i}`;\n const queryVariables = shouldUseMultiQuery\n ? {\n variables: { where: { id: { _in: itemId } } },\n skip: hasNoPropsToDisplay\n }\n : {\n variables: { id: itemId },\n skip: hasNoPropsToDisplay\n };\n\n return (\n <GTMEventRender\n key={dynamicKey}\n action={action}\n actionKey={actionKey}\n propsToDisplay={propsToDisplay}\n id={itemId}\n queryVariables={queryVariables}\n parentComponent={parentComponent}\n {...eventProps}\n />\n );\n });\n};\n\nGTMEventFactory.propTypes = {\n parent: PropTypes.object.isRequired,\n clickId: PropTypes.string,\n gtmEvents: PropTypes.array,\n parentData: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\n parentComponent: PropTypes.object\n};\n\nGTMEventFactory.defaultProps = {\n clickId: null,\n gtmEvents: [],\n parentData: null,\n parentComponent: {}\n};\n\nexport default GTMEventFactory;\n"],"mappings":";;;AAAA,OAAOA,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,cAAc,MAAM,kBAAkB;AAC7C,SAASC,cAAc,EAAEC,WAAW,EAAEC,wBAAwB,QAAQ,YAAY;AAClF,SAASC,iBAAiB,QAAQ,cAAc;AAEhD,MAAMC,eAAe,GAAGA,CAAC;EAAEC,MAAM;EAAEC,SAAS;EAAEC,UAAU;EAAEC,OAAO;EAAEC;AAAgB,CAAC,KAAK;EACvF,MAAM;IAAEC;EAAU,CAAC,GAAGjB,UAAU,CAACK,WAAW,CAAC;EAC7C,MAAM,CAAC;IAAEa,UAAU,GAAGN,MAAM,CAACM;EAAW,CAAC,GAAG,CAAC,CAAC,CAAC,GAAGJ,UAAU,IAAI,EAAE;EAClE,MAAM;IAAEK,IAAI;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGnB,QAAQ,CAACC,qBAAqB,EAAE;IAC/DmB,SAAS,EAAE;MAAEC,EAAE,EAAEL;I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