@blaze-cms/plugin-gtm-fe 0.146.0-core-styles.45 → 0.146.0-core-styles.52
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 +16 -0
- package/lib/GoogleTagManager/GTMFactory.js +1 -2
- package/lib/GoogleTagManager/GTMFactory.js.map +1 -1
- package/lib/GoogleTagManager/GTMRender.js +3 -8
- package/lib/GoogleTagManager/GTMRender.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMClickEvent.js +1 -1
- package/lib/GoogleTagManagerEvent/GTMClickEvent.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMClickEvents.js +1 -0
- package/lib/GoogleTagManagerEvent/GTMClickEvents.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMEvent.js +1 -2
- package/lib/GoogleTagManagerEvent/GTMEvent.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMEventFactory.js +2 -3
- package/lib/GoogleTagManagerEvent/GTMEventFactory.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMEventRender.js +4 -10
- package/lib/GoogleTagManagerEvent/GTMEventRender.js.map +1 -1
- package/lib/helpers/get-ids-to-use.js +1 -0
- package/lib/helpers/get-ids-to-use.js.map +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib-es/GoogleTagManager/GTMRender.js +4 -10
- package/lib-es/GoogleTagManager/GTMRender.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/GTMEventRender.js +4 -10
- package/lib-es/GoogleTagManagerEvent/GTMEventRender.js.map +1 -1
- package/package.json +5 -5
- package/src/GoogleTagManager/GTMRender.js +4 -6
- package/src/GoogleTagManagerEvent/GTMClickEvent.js +2 -2
- package/src/GoogleTagManagerEvent/GTMEventRender.js +4 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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-core-styles.52](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.51...v0.146.0-core-styles.52) (2025-05-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [0.146.0-core-styles.50](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.49...v0.146.0-core-styles.50) (2025-04-30)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [0.146.0-core-styles.45](https://github.com/thebyte9/blaze/compare/v0.146.0-core-styles.44...v0.146.0-core-styles.45) (2025-03-27)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
|
|
@@ -20,8 +20,7 @@ var _reactPageBuilder = require("@blaze-cms/react-page-builder");
|
|
|
20
20
|
var _nextjsComponents = require("@blaze-cms/nextjs-components");
|
|
21
21
|
var _GTMRender = _interopRequireDefault(require("./GTMRender"));
|
|
22
22
|
var _helpers = require("../helpers");
|
|
23
|
-
function
|
|
24
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
23
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(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 (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
25
24
|
var GTMFactory = function GTMFactory(_ref) {
|
|
26
25
|
var propsToDisplay = _ref.propsToDisplay,
|
|
27
26
|
userPropsToDisplay = _ref.userPropsToDisplay,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMFactory.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_client","_reactPageBuilder","_nextjsComponents","_GTMRender","_helpers","
|
|
1
|
+
{"version":3,"file":"GTMFactory.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_client","_reactPageBuilder","_nextjsComponents","_GTMRender","_helpers","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GTMFactory","_ref","propsToDisplay","userPropsToDisplay","parent","gtmWebVitals","_useContext","useContext","MainContext","isPreview","_useQuery","useQuery","getSingleEntitySchema","variables","id","itemEntity","data","error","loading","window","propsToDisplayArr","buildPropsToDisplayArray","extraProps","buildPropsQuery","_getRenderProps","getRenderProps","action","actionKey","createElement","parentId","itemId","webVitals","propTypes","PropTypes","array","object","isRequired","bool","defaultProps","_default","exports"],"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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAAsE,SAAAD,wBAAAS,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,wBA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AAkC,QAAA,GAAAC,OAAA,cAEaxC,UAAU","ignoreList":[]}
|
|
@@ -22,7 +22,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
22
22
|
var _client = require("@apollo/client");
|
|
23
23
|
var _router = require("next/router");
|
|
24
24
|
var _reactPageBuilder = require("@blaze-cms/react-page-builder");
|
|
25
|
-
var _coreAuthUi = require("@blaze-cms/core-auth-ui");
|
|
26
25
|
var _helpers = require("../helpers");
|
|
27
26
|
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; }
|
|
28
27
|
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) { (0, _defineProperty2["default"])(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; }
|
|
@@ -49,14 +48,10 @@ var GTMRender = function GTMRender(_ref) {
|
|
|
49
48
|
data = _useQuery.data,
|
|
50
49
|
error = _useQuery.error,
|
|
51
50
|
loading = _useQuery.loading;
|
|
52
|
-
var
|
|
53
|
-
userId = _checkIfLoggedIn.id;
|
|
54
|
-
var hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;
|
|
51
|
+
var hasUserProps = userPropsToDisplay && userPropsToDisplay.length;
|
|
55
52
|
var userProps = hasUserProps ? (0, _helpers.buildUserQueryProps)(userPropsToDisplay) : '';
|
|
56
|
-
var _useQuery2 = (0, _client.useQuery)((0, _reactPageBuilder.
|
|
57
|
-
variables: {
|
|
58
|
-
id: userId
|
|
59
|
-
},
|
|
53
|
+
var _useQuery2 = (0, _client.useQuery)((0, _reactPageBuilder.getCurrentUser)(userProps), {
|
|
54
|
+
variables: {},
|
|
60
55
|
skip: !hasUserProps
|
|
61
56
|
}),
|
|
62
57
|
userData = _useQuery2.data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMRender.js","names":["_react","require","_propTypes","_interopRequireDefault","_client","_router","_reactPageBuilder","
|
|
1
|
+
{"version":3,"file":"GTMRender.js","names":["_react","require","_propTypes","_interopRequireDefault","_client","_router","_reactPageBuilder","_helpers","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","GTMRender","_ref","router","action","propsToDisplay","parentId","webVitals","userPropsToDisplay","asPath","_useState","useState","url","shouldPushLayer","_useState2","_slicedToArray2","currentLocation","setCurrentLocation","_useQuery","useQuery","variables","id","data","error","loading","hasUserProps","userProps","buildUserQueryProps","_useQuery2","getCurrentUser","skip","userData","userLoading","entityData","message","dataLayerObject","buildDataLayer","userLayerObject","buildUserLayer","extendedDataLayer","buildAndPushWebVitals","pushToDataLayer","propTypes","PropTypes","array","isRequired","object","string","bool","_default","exports","withRouter"],"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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAMoB,SAAAO,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAA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c,EAACP,QAAQ,EAAEvB,kBAAkB,CAAC;EACpE,IAAM+B,iBAAiB,GAAA9C,aAAA,CAAAA,aAAA,KAAQ0C,eAAe,GAAKE,eAAe,CAAE;EAEpE,IAAI9B,SAAS,EAAE,IAAAiC,8BAAqB,EAAC,CAAC;EACtC,IAAAC,wBAAe,EAACF,iBAAiB,EAAE,IAAI,CAAC;EACxCtB,kBAAkB,CAAAxB,aAAA,CAAAA,aAAA,KAAMuB,eAAe;IAAEH,eAAe,EAAE;EAAK,EAAE,CAAC;EAElE,OAAO,IAAI;AACb,CAAC;AAEDZ,SAAS,CAACyC,SAAS,GAAG;EACpBlC,kBAAkB,EAAEmC,qBAAS,CAACC,KAAK,CAACC,UAAU;EAC9CzC,MAAM,EAAEuC,qBAAS,CAACG,MAAM,CAACD,UAAU;EACnCxC,cAAc,EAAEsC,qBAAS,CAACC,KAAK,CAACC,UAAU;EAC1CvC,QAAQ,EAAEqC,qBAAS,CAACI,MAAM,CAACF,UAAU;EACrCtC,SAAS,EAAEoC,qBAAS,CAACK,IAAI,CAACH;AAC5B,CAAC;AAAC,IAAAI,QAAA,GAAAC,OAAA,cAEa,IAAAC,kBAAU,EAAClD,SAAS,CAAC","ignoreList":[]}
|
|
@@ -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.getCurretUser)(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","getCurretUser","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 { 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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAAmG,SAAAO,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CA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,EAAED;MAAO,CAAC;MACzBQ,IAAI,EAAE,CAACR;IACT,CAAC,CAAC;IAHYS,QAAQ,GAAAL,SAAA,CAAdM,IAAI;IAAYC,OAAO,GAAAP,SAAA,CAAPO,OAAO;EAI/B,IAAIA,OAAO,EAAE,OAAO,IAAI;EACxB,IAAMC,cAAc,GAAG,IAAAC,uBAAc,EAACrB,cAAc,EAAEG,cAAc,CAAC;EACrE,IAAMmB,eAAe,GAAG,IAAAC,yBAAgB,EAAClB,cAAc,EAAEN,KAAK,EAAEqB,cAAc,EAAEnB,eAAe,CAAC;EAChG,IAAMuB,eAAe,GAAG,IAAAC,uBAAc,EAACR,QAAQ,EAAEb,kBAAkB,CAAC;EAEpE,IAAMsB,iBAAiB,GAAArC,aAAA,CAAAA,aAAA,KAAQiC,eAAe,GAAKE,eAAe,CAAE;EAEpE,oBAAOzD,MAAA,YAAA4D,aAAA,CAACrD,SAAA,WAAQ;IAACgD,eAAe,EAAEI,iBAAkB;IAACxB,YAAY,EAAEA;EAAa,CAAE,CAAC;AACrF,CAAC;AAEDL,aAAa,CAAC+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":[]}
|
|
@@ -9,6 +9,7 @@ exports["default"] = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
require("core-js/modules/es.array.join.js");
|
|
11
11
|
require("core-js/modules/es.array.map.js");
|
|
12
|
+
require("core-js/modules/es.object.to-string.js");
|
|
12
13
|
var _react = _interopRequireDefault(require("react"));
|
|
13
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
15
|
var _GTMClickEvent = _interopRequireDefault(require("./GTMClickEvent"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMClickEvents.js","names":["_react","_interopRequireDefault","require","_propTypes","_GTMClickEvent","GTMClickEvents","_ref","gtmEvents","componentProps","parentComponent","map","event","index","eventName","dynamicKey","join","createElement","_extends2","key","propTypes","PropTypes","array","oneOfType","object","defaultProps","_default","exports"],"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":"
|
|
1
|
+
{"version":3,"file":"GTMClickEvents.js","names":["_react","_interopRequireDefault","require","_propTypes","_GTMClickEvent","GTMClickEvents","_ref","gtmEvents","componentProps","parentComponent","map","event","index","eventName","dynamicKey","join","createElement","_extends2","key","propTypes","PropTypes","array","oneOfType","object","defaultProps","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAMG,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA;EAAA,IAAMC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAEC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IAAEC,eAAe,GAAAH,IAAA,CAAfG,eAAe;EAAA,OAClEF,SAAS,CAACG,GAAG,CAAC,UAACC,KAAK,EAAEC,KAAK,EAAK;IAC9B,IAAQC,SAAS,GAAKF,KAAK,CAAnBE,SAAS;IACjB,IAAMC,UAAU,GAAG,CAACD,SAAS,EAAED,KAAK,CAAC,CAACG,IAAI,CAAC,GAAG,CAAC;IAE/C,oBACEf,MAAA,YAAAgB,aAAA,CAACZ,cAAA,WAAa,MAAAa,SAAA;MACZC,GAAG,EAAEJ,UAAW;MAChBH,KAAK,EAAEA,KAAM;MACbH,cAAc,EAAEA,cAAe;MAC/BC,eAAe,EAAEA;IAAgB,GAC7BE,KAAK,CACV,CAAC;EAEN,CAAC,CAAC;AAAA;AAEJN,cAAc,CAACc,SAAS,GAAG;EACzBZ,SAAS,EAAEa,qBAAS,CAACC,KAAK;EAC1Bb,cAAc,EAAEY,qBAAS,CAACE,SAAS,CAAC,CAACF,qBAAS,CAACG,MAAM,EAAEH,qBAAS,CAACC,KAAK,CAAC,CAAC;EACxEZ,eAAe,EAAEW,qBAAS,CAACG;AAC7B,CAAC;AAEDlB,cAAc,CAACmB,YAAY,GAAG;EAC5BjB,SAAS,EAAE,EAAE;EACbC,cAAc,EAAE,CAAC,CAAC;EAClBC,eAAe,EAAE,CAAC;AACpB,CAAC;AAAC,IAAAgB,QAAA,GAAAC,OAAA,cAEarB,cAAc","ignoreList":[]}
|
|
@@ -19,8 +19,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
19
19
|
var _reactWaypoint = require("react-waypoint");
|
|
20
20
|
var _helpers = require("../helpers");
|
|
21
21
|
var _constants = require("../constants");
|
|
22
|
-
function
|
|
23
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
22
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(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 (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
24
23
|
var GTMEvent = function GTMEvent(_ref) {
|
|
25
24
|
var dataLayerObject = _ref.dataLayerObject,
|
|
26
25
|
eventTrigger = _ref.eventTrigger,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEvent.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_reactWaypoint","_helpers","_constants","
|
|
1
|
+
{"version":3,"file":"GTMEvent.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_reactWaypoint","_helpers","_constants","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GTMEvent","_ref","dataLayerObject","eventTrigger","currentLocation","handleOnSuccess","_useState","useState","_useState2","_slicedToArray2","shouldPushLayer","setShouldPushLayer","isViewEvent","IN_VIEW","isOnSuccess","ON_SUCCESS","useEffect","pushDataLayer","pushToDataLayer","createElement","Fragment","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 () => {\n setShouldPushLayer(true);\n },\n [currentLocation]\n );\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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAAmD,SAAAD,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,wBAAAO,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,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,cAAAM,GAAA,IAAAd,CAAA,gBAAAc,GAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,GAAA,OAAAP,CAAA,IAAAD,CAAA,GAAAW,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAnB,CAAA,EAAAc,GAAA,OAAAP,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAM,GAAA,EAAAP,CAAA,IAAAC,CAAA,CAAAM,GAAA,IAAAd,CAA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qBAAS,CAACG,MAAM,CAACD,UAAU;EAC5CvB,YAAY,EAAEqB,qBAAS,CAACI,MAAM,CAACF,UAAU;EACzCtB,eAAe,EAAEoB,qBAAS,CAACI,MAAM,CAACF;AACpC,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,cAEa9B,QAAQ","ignoreList":[]}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
require("core-js/modules/es.array.iterator.js");
|
|
4
4
|
require("core-js/modules/es.object.define-property.js");
|
|
5
5
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
6
|
-
require("core-js/modules/es.object.to-string.js");
|
|
7
6
|
require("core-js/modules/es.string.iterator.js");
|
|
8
7
|
require("core-js/modules/es.weak-map.js");
|
|
9
8
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
@@ -18,6 +17,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
18
17
|
require("core-js/modules/es.array.concat.js");
|
|
19
18
|
require("core-js/modules/es.array.is-array.js");
|
|
20
19
|
require("core-js/modules/es.array.map.js");
|
|
20
|
+
require("core-js/modules/es.object.to-string.js");
|
|
21
21
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
22
22
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
23
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -28,8 +28,7 @@ var _GTMEventRender = _interopRequireDefault(require("./GTMEventRender"));
|
|
|
28
28
|
var _helpers = require("../helpers");
|
|
29
29
|
var _constants = require("../constants");
|
|
30
30
|
var _excluded = ["propsToDisplay"];
|
|
31
|
-
function
|
|
32
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
31
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(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 (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
33
32
|
var GTMEventFactory = function GTMEventFactory(_ref) {
|
|
34
33
|
var parent = _ref.parent,
|
|
35
34
|
gtmEvents = _ref.gtmEvents,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEventFactory.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_client","_reactPageBuilder","_nextjsComponents","_GTMEventRender","_helpers","_constants","_excluded","
|
|
1
|
+
{"version":3,"file":"GTMEventFactory.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_client","_reactPageBuilder","_nextjsComponents","_GTMEventRender","_helpers","_constants","_excluded","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GTMEventFactory","_ref","parent","gtmEvents","parentData","clickId","parentComponent","_useContext","useContext","MainContext","isPreview","_ref2","_ref3","_slicedToArray2","_ref3$","_ref3$2","_ref3$2$itemEntity","itemEntity","_useQuery","useQuery","getSingleEntitySchema","variables","id","data","error","loading","map","_ref4","propsToDisplay","eventProps","_objectWithoutProperties2","hasNoPropsToDisplay","length","propsToDisplayArr","buildPropsToDisplayArray","extraProps","buildPropsQuery","shouldUseParentData","itemIdToUse","itemId","getIdsToUse","shouldUseMultiQuery","Array","isArray","_getRenderProps","getRenderProps","action","actionKey","dynamicKey","concat","GTM_EVENT_FACTORY","queryVariables","where","_in","skip","createElement","_extends2","key","propTypes","PropTypes","object","isRequired","string","array","oneOfType","defaultProps","_default","exports"],"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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAAiD,IAAAS,SAAA;AAAA,SAAAV,wBAAAW,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAb,uBAAA,YAAAA,wBAAAW,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,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mBAAmB,GACtC;MACEpB,SAAS,EAAE;QAAE+B,KAAK,EAAE;UAAE9B,EAAE,EAAE;YAAE+B,GAAG,EAAEd;UAAO;QAAE;MAAE,CAAC;MAC7Ce,IAAI,EAAEvB;IACR,CAAC,GACD;MACEV,SAAS,EAAE;QAAEC,EAAE,EAAEiB;MAAO,CAAC;MACzBe,IAAI,EAAEvB;IACR,CAAC;IAEL,oBACE/D,MAAA,YAAAuF,aAAA,CAAC/E,eAAA,WAAc,MAAAgF,SAAA;MACbC,GAAG,EAAET,UAAW;MAChBF,MAAM,EAAEA,MAAO;MACfC,SAAS,EAAEA,SAAU;MACrBnB,cAAc,EAAEA,cAAe;MAC/BN,EAAE,EAAEiB,MAAO;MACXY,cAAc,EAAEA,cAAe;MAC/B7C,eAAe,EAAEA;IAAgB,GAC7BuB,UAAU,CACf,CAAC;EAEN,CAAC,CAAC;AACJ,CAAC;AAED7B,eAAe,CAAC0D,SAAS,GAAG;EAC1BxD,MAAM,EAAEyD,qBAAS,CAACC,MAAM,CAACC,UAAU;EACnCxD,OAAO,EAAEsD,qBAAS,CAACG,MAAM;EACzB3D,SAAS,EAAEwD,qBAAS,CAACI,KAAK;EAC1B3D,UAAU,EAAEuD,qBAAS,CAACK,SAAS,CAAC,CAACL,qBAAS,CAACC,MAAM,EAAED,qBAAS,CAACI,KAAK,CAAC,CAAC;EACpEzD,eAAe,EAAEqD,qBAAS,CAACC;AAC7B,CAAC;AAED5D,eAAe,CAACiE,YAAY,GAAG;EAC7B5D,OAAO,EAAE,IAAI;EACbF,SAAS,EAAE,EAAE;EACbC,UAAU,EAAE,IAAI;EAChBE,eAAe,EAAE,CAAC;AACpB,CAAC;AAAC,IAAA4D,QAAA,GAAAC,OAAA,cAEanE,eAAe","ignoreList":[]}
|
|
@@ -26,14 +26,12 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
26
26
|
var _react = _interopRequireWildcard(require("react"));
|
|
27
27
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
28
28
|
var _client = require("@apollo/client");
|
|
29
|
-
var _coreAuthUi = require("@blaze-cms/core-auth-ui");
|
|
30
29
|
var _reactPageBuilder = require("@blaze-cms/react-page-builder");
|
|
31
30
|
var _router = require("next/router");
|
|
32
31
|
var _GTMEvent = _interopRequireDefault(require("./GTMEvent"));
|
|
33
32
|
var _helpers = require("../helpers");
|
|
34
33
|
var _excluded = ["router", "action", "actionKey", "queryVariables", "parentComponent", "userPropsToDisplay", "handleOnSuccess"];
|
|
35
|
-
function
|
|
36
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
34
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(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 (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
37
35
|
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; }
|
|
38
36
|
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) { (0, _defineProperty2["default"])(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; }
|
|
39
37
|
var GTMEventRender = function GTMEventRender(_ref) {
|
|
@@ -55,14 +53,10 @@ var GTMEventRender = function GTMEventRender(_ref) {
|
|
|
55
53
|
data = _useQuery$data === void 0 ? {} : _useQuery$data,
|
|
56
54
|
error = _useQuery.error,
|
|
57
55
|
loading = _useQuery.loading;
|
|
58
|
-
var
|
|
59
|
-
userId = _checkIfLoggedIn.id;
|
|
60
|
-
var hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;
|
|
56
|
+
var hasUserProps = userPropsToDisplay && userPropsToDisplay.length;
|
|
61
57
|
var userProps = hasUserProps ? (0, _helpers.buildUserQueryProps)(userPropsToDisplay) : '';
|
|
62
|
-
var _useQuery2 = (0, _client.useQuery)((0, _reactPageBuilder.
|
|
63
|
-
variables: {
|
|
64
|
-
id: userId
|
|
65
|
-
},
|
|
58
|
+
var _useQuery2 = (0, _client.useQuery)((0, _reactPageBuilder.getCurrentUser)(userProps), {
|
|
59
|
+
variables: {},
|
|
66
60
|
skip: !hasUserProps
|
|
67
61
|
}),
|
|
68
62
|
userData = _useQuery2.data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEventRender.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_client","
|
|
1
|
+
{"version":3,"file":"GTMEventRender.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_client","_reactPageBuilder","_router","_GTMEvent","_helpers","_excluded","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","GTMEventRender","_ref","router","action","actionKey","queryVariables","parentComponent","userPropsToDisplay","handleOnSuccess","eventProps","_objectWithoutProperties2","asPath","_useState","useState","_useState2","_slicedToArray2","currentLocation","setCurrentLocation","_useQuery","useQuery","_useQuery$data","data","error","loading","hasUserProps","userProps","buildUserQueryProps","_useQuery2","getCurrentUser","variables","skip","userData","userLoading","gtmData","entityData","eventTrigger","propsToDisplay","eventEcommerce","dataLayerProps","buildDataLayer","dataLayerObject","buildNestedEvent","userLayerObject","buildUserLayer","extendedDataLayer","createElement","propTypes","PropTypes","array","object","isRequired","string","func","defaultProps","_default","exports","withRouter"],"sources":["../../src/GoogleTagManagerEvent/GTMEventRender.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { getCurrentUser } from '@blaze-cms/react-page-builder';\nimport { withRouter } from 'next/router';\nimport GTMEvent from './GTMEvent';\nimport { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';\n\nconst GTMEventRender = ({\n router,\n action,\n actionKey,\n queryVariables,\n parentComponent,\n userPropsToDisplay,\n handleOnSuccess,\n ...eventProps\n}) => {\n const { asPath } = router;\n const [currentLocation, setCurrentLocation] = useState('');\n const { data = {}, error, loading } = useQuery(action, queryVariables);\n const 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 || error) return null;\n const gtmData = data.entityData || data[actionKey];\n\n if (currentLocation !== asPath) {\n setCurrentLocation(asPath);\n return null;\n }\n\n const { eventTrigger, propsToDisplay, eventEcommerce } = eventProps;\n const dataLayerProps = buildDataLayer(gtmData, propsToDisplay);\n\n const dataLayerObject = buildNestedEvent(\n eventEcommerce,\n eventProps,\n dataLayerProps,\n parentComponent\n );\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n return (\n <GTMEvent\n dataLayerObject={extendedDataLayer}\n eventTrigger={eventTrigger}\n currentLocation={currentLocation}\n handleOnSuccess={handleOnSuccess}\n />\n );\n};\n\nGTMEventRender.propTypes = {\n userPropsToDisplay: PropTypes.array,\n router: PropTypes.object.isRequired,\n action: PropTypes.object.isRequired,\n actionKey: PropTypes.string.isRequired,\n queryVariables: PropTypes.object.isRequired,\n parentComponent: PropTypes.object.isRequired,\n handleOnSuccess: PropTypes.func\n};\n\nGTMEventRender.defaultProps = {\n userPropsToDisplay: [],\n handleOnSuccess: () => {}\n};\n\nGTMEventRender.defaultProps = {\n userPropsToDisplay: []\n};\n\nexport default withRouter(GTMEventRender);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAAmG,IAAAQ,SAAA;AAAA,SAAAT,wBAAAU,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAAA,wBAAAU,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,C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A,CAAClF,SAAA,WAAQ;IACP6E,eAAe,EAAEI,iBAAkB;IACnCT,YAAY,EAAEA,YAAa;IAC3BnB,eAAe,EAAEA,eAAgB;IACjCR,eAAe,EAAEA;EAAgB,CAClC,CAAC;AAEN,CAAC;AAEDR,cAAc,CAAC8C,SAAS,GAAG;EACzBvC,kBAAkB,EAAEwC,qBAAS,CAACC,KAAK;EACnC9C,MAAM,EAAE6C,qBAAS,CAACE,MAAM,CAACC,UAAU;EACnC/C,MAAM,EAAE4C,qBAAS,CAACE,MAAM,CAACC,UAAU;EACnC9C,SAAS,EAAE2C,qBAAS,CAACI,MAAM,CAACD,UAAU;EACtC7C,cAAc,EAAE0C,qBAAS,CAACE,MAAM,CAACC,UAAU;EAC3C5C,eAAe,EAAEyC,qBAAS,CAACE,MAAM,CAACC,UAAU;EAC5C1C,eAAe,EAAEuC,qBAAS,CAACK;AAC7B,CAAC;AAEDpD,cAAc,CAACqD,YAAY,GAAG;EAC5B9C,kBAAkB,EAAE,EAAE;EACtBC,eAAe,EAAE,SAAjBA,eAAeA,CAAA,EAAQ,CAAC;AAC1B,CAAC;AAEDR,cAAc,CAACqD,YAAY,GAAG;EAC5B9C,kBAAkB,EAAE;AACtB,CAAC;AAAC,IAAA+C,QAAA,GAAAC,OAAA,cAEa,IAAAC,kBAAU,EAACxD,cAAc,CAAC","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
require("core-js/modules/es.array.map.js");
|
|
9
|
+
require("core-js/modules/es.object.to-string.js");
|
|
9
10
|
var getIdsToUse = function getIdsToUse(parentData) {
|
|
10
11
|
if (!parentData || !parentData.length) return [];
|
|
11
12
|
return parentData.map(function (_ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-ids-to-use.js","names":["getIdsToUse","parentData","length","map","_ref","id","_default","exports"],"sources":["../../src/helpers/get-ids-to-use.js"],"sourcesContent":["const getIdsToUse = parentData => {\n if (!parentData || !parentData.length) return [];\n\n return parentData.map(({ id }) => id);\n};\n\nexport default getIdsToUse;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-ids-to-use.js","names":["getIdsToUse","parentData","length","map","_ref","id","_default","exports"],"sources":["../../src/helpers/get-ids-to-use.js"],"sourcesContent":["const getIdsToUse = parentData => {\n if (!parentData || !parentData.length) return [];\n\n return parentData.map(({ id }) => id);\n};\n\nexport default getIdsToUse;\n"],"mappings":";;;;;;;;;AAAA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAGC,UAAU,EAAI;EAChC,IAAI,CAACA,UAAU,IAAI,CAACA,UAAU,CAACC,MAAM,EAAE,OAAO,EAAE;EAEhD,OAAOD,UAAU,CAACE,GAAG,CAAC,UAAAC,IAAA;IAAA,IAAGC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IAAA,OAAOA,EAAE;EAAA,EAAC;AACvC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEaP,WAAW","ignoreList":[]}
|
package/lib/index.js
CHANGED
|
@@ -19,8 +19,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
19
19
|
var _dynamic = _interopRequireDefault(require("next/dynamic"));
|
|
20
20
|
var _package = _interopRequireDefault(require("../package.json"));
|
|
21
21
|
var _constants = require("./constants");
|
|
22
|
-
function
|
|
23
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != (0, _typeof2["default"])(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
22
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != (0, _typeof2["default"])(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
24
23
|
function load(_x) {
|
|
25
24
|
return _load.apply(this, arguments);
|
|
26
25
|
}
|
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__","_typeof2","has","get","set","_t2","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","load","_x","_load","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee","app","wrap","_callee$","_context","prev","next","events","once","addComponent","key","component","dynamic","Promise","resolve","then","abrupt","name","PLUGIN_NAME","version","pkg","stop","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import dynamic from 'next/dynamic';\n\nimport pkg from '../package.json';\nimport { PLUGIN_NAME } from './constants';\n\nexport default async function load(app) {\n app.events.once('load:custom:page-builder:component', addComponent => {\n addComponent({\n key: 'gtm',\n component: dynamic(() =>\n import(/* webpackChunkName: \"blazePbGoogleTagManager\" */ './GoogleTagManager')\n )\n });\n addComponent({\n key: 'gtm-events',\n component: dynamic(() =>\n import(/* webpackChunkName: \"blazePbGoogleTagManagerEvent\" */ './GoogleTagManagerEvent')\n )\n });\n });\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,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,MAAA;EAAAA,KAAA,OAAAG,kBAAA,0BAAAC,YAAA,YAAAC,IAAA,CAAnB,SAAAC,QAAoBC,GAAG;IAAA,OAAAH,YAAA,YAAAI,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UACpCL,GAAG,CAACM,MAAM,CAACC,IAAI,CAAC,oCAAoC,EAAE,UAAAC,YAAY,EAAI;YACpEA,YAAY,CAAC;cACXC,GAAG,EAAE,KAAK;cACVC,SAAS,EAAE,IAAAC,mBAAO,EAAC;gBAAA,OAAAC,OAAA,CAAAC,OAAA,GAAAC,IAAA;kBAAA,OAAA5C,uBAAA,CAAAH,OAAA,CACV,iDAAkD,oBAAoB;gBAAA;cAAA,CAC/E;YACF,CAAC,CAAC;YACFyC,YAAY,CAAC;cACXC,GAAG,EAAE,YAAY;cACjBC,SAAS,EAAE,IAAAC,mBAAO,EAAC;gBAAA,OAAAC,OAAA,CAAAC,OAAA,GAAAC,IAAA;kBAAA,OAAA5C,uBAAA,CAAAH,OAAA,CACV,sDAAuD,yBAAyB;gBAAA;cAAA,CACzF;YACF,CAAC,CAAC;UACJ,CAAC,CAAC;UAAC,OAAAoC,QAAA,CAAAY,MAAA,WAEI;YACLC,IAAI,EAAEC,sBAAW;YACjBC,OAAO,EAAEC,mBAAG,CAACD;UACf,CAAC;QAAA;QAAA;UAAA,OAAAf,QAAA,CAAAiB,IAAA;MAAA;IAAA,GAAArB,OAAA;EAAA,CACF;EAAA,OAAAN,KAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAEDJ,IAAI,CAAC8B,UAAU,GAAGJ,sBAAW","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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AEC,GAAG,EAAEH,MAAM;IAAEI,eAAe,EAAE;EAAK,CAAC,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":[]}
|
|
@@ -5,7 +5,7 @@ import React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useQuery } from '@apollo/client';
|
|
7
7
|
import { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';
|
|
8
|
-
import {
|
|
8
|
+
import { getCurretUser } from '@blaze-cms/react-page-builder';
|
|
9
9
|
import GTMEvent from './GTMEvent';
|
|
10
10
|
import { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';
|
|
11
11
|
const GTMClickEvent = ({
|
|
@@ -26,7 +26,7 @@ const GTMClickEvent = ({
|
|
|
26
26
|
const {
|
|
27
27
|
data: userData,
|
|
28
28
|
loading
|
|
29
|
-
} = useQuery(
|
|
29
|
+
} = useQuery(getCurretUser(userProps), {
|
|
30
30
|
variables: {
|
|
31
31
|
id: userId
|
|
32
32
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMClickEvent.js","names":["React","PropTypes","useQuery","checkIfLoggedIn","
|
|
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,GAAGD,MAAM,GAAGX,mBAAmB,CAACQ,kBAAkB,CAAC,GAAG,EAAE;EACvE,MAAM;IAAEK,IAAI,EAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGrB,QAAQ,CAACE,aAAa,CAACgB,SAAS,CAAC,EAAE;IACrEI,SAAS,EAAE;MAAEN,EAAE,EAAEC;IAAO,CAAC;IACzBM,IAAI,EAAE,CAACN;EACT,CAAC,CAAC;EACF,IAAII,OAAO,EAAE,OAAO,IAAI;EACxB,MAAMG,cAAc,GAAGpB,cAAc,CAACM,cAAc,EAAEG,cAAc,CAAC;EACrE,MAAMY,eAAe,GAAGpB,gBAAgB,CAACU,cAAc,EAAEN,KAAK,EAAEe,cAAc,EAAEb,eAAe,CAAC;EAChG,MAAMe,eAAe,GAAGnB,cAAc,CAACa,QAAQ,EAAEN,kBAAkB,CAAC;EAEpE,MAAMa,iBAAiB,GAAAC,aAAA,CAAAA,aAAA,KAAQH,eAAe,GAAKC,eAAe,CAAE;EAEpE,oBAAO5B,KAAA,CAAA+B,aAAA,CAAC1B,QAAQ;IAACsB,eAAe,EAAEE,iBAAkB;IAACf,YAAY,EAAEA;EAAa,CAAE,CAAC;AACrF,CAAC;AAEDJ,aAAa,CAACsB,SAAS,GAAG;EACxBrB,KAAK,EAAEV,SAAS,CAACgC,MAAM,CAACC,UAAU;EAClCtB,cAAc,EAAEX,SAAS,CAACkC,SAAS,CAAC,CAAClC,SAAS,CAACgC,MAAM,EAAEhC,SAAS,CAACmC,KAAK,CAAC,CAAC;EACxEvB,eAAe,EAAEZ,SAAS,CAACgC;AAC7B,CAAC;AAEDvB,aAAa,CAAC2B,YAAY,GAAG;EAC3BzB,cAAc,EAAE,CAAC,CAAC;EAClBC,eAAe,EAAE,CAAC;AACpB,CAAC;AAED,eAAeH,aAAa","ignoreList":[]}
|
|
@@ -6,8 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useQuery } from '@apollo/client';
|
|
9
|
-
import {
|
|
10
|
-
import { getUser } from '@blaze-cms/react-page-builder';
|
|
9
|
+
import { getCurrentUser } from '@blaze-cms/react-page-builder';
|
|
11
10
|
import { withRouter } from 'next/router';
|
|
12
11
|
import GTMEvent from './GTMEvent';
|
|
13
12
|
import { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';
|
|
@@ -31,18 +30,13 @@ const GTMEventRender = _ref => {
|
|
|
31
30
|
error,
|
|
32
31
|
loading
|
|
33
32
|
} = useQuery(action, queryVariables);
|
|
34
|
-
const
|
|
35
|
-
id: userId
|
|
36
|
-
} = checkIfLoggedIn();
|
|
37
|
-
const hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;
|
|
33
|
+
const hasUserProps = userPropsToDisplay && userPropsToDisplay.length;
|
|
38
34
|
const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';
|
|
39
35
|
const {
|
|
40
36
|
data: userData,
|
|
41
37
|
loading: userLoading
|
|
42
|
-
} = useQuery(
|
|
43
|
-
variables: {
|
|
44
|
-
id: userId
|
|
45
|
-
},
|
|
38
|
+
} = useQuery(getCurrentUser(userProps), {
|
|
39
|
+
variables: {},
|
|
46
40
|
skip: !hasUserProps
|
|
47
41
|
});
|
|
48
42
|
if (loading || userLoading || error) return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEventRender.js","names":["React","useState","PropTypes","useQuery","
|
|
1
|
+
{"version":3,"file":"GTMEventRender.js","names":["React","useState","PropTypes","useQuery","getCurrentUser","withRouter","GTMEvent","buildDataLayer","buildNestedEvent","buildUserQueryProps","buildUserLayer","GTMEventRender","_ref","router","action","actionKey","queryVariables","parentComponent","userPropsToDisplay","handleOnSuccess","eventProps","_objectWithoutProperties","_excluded","asPath","currentLocation","setCurrentLocation","data","error","loading","hasUserProps","length","userProps","userData","userLoading","variables","skip","gtmData","entityData","eventTrigger","propsToDisplay","eventEcommerce","dataLayerProps","dataLayerObject","userLayerObject","extendedDataLayer","_objectSpread","createElement","propTypes","array","object","isRequired","string","func","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMEventRender.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { getCurrentUser } from '@blaze-cms/react-page-builder';\nimport { withRouter } from 'next/router';\nimport GTMEvent from './GTMEvent';\nimport { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';\n\nconst GTMEventRender = ({\n router,\n action,\n actionKey,\n queryVariables,\n parentComponent,\n userPropsToDisplay,\n handleOnSuccess,\n ...eventProps\n}) => {\n const { asPath } = router;\n const [currentLocation, setCurrentLocation] = useState('');\n const { data = {}, error, loading } = useQuery(action, queryVariables);\n const 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 || error) return null;\n const gtmData = data.entityData || data[actionKey];\n\n if (currentLocation !== asPath) {\n setCurrentLocation(asPath);\n return null;\n }\n\n const { eventTrigger, propsToDisplay, eventEcommerce } = eventProps;\n const dataLayerProps = buildDataLayer(gtmData, propsToDisplay);\n\n const dataLayerObject = buildNestedEvent(\n eventEcommerce,\n eventProps,\n dataLayerProps,\n parentComponent\n );\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n return (\n <GTMEvent\n dataLayerObject={extendedDataLayer}\n eventTrigger={eventTrigger}\n currentLocation={currentLocation}\n handleOnSuccess={handleOnSuccess}\n />\n );\n};\n\nGTMEventRender.propTypes = {\n userPropsToDisplay: PropTypes.array,\n router: PropTypes.object.isRequired,\n action: PropTypes.object.isRequired,\n actionKey: PropTypes.string.isRequired,\n queryVariables: PropTypes.object.isRequired,\n parentComponent: PropTypes.object.isRequired,\n handleOnSuccess: PropTypes.func\n};\n\nGTMEventRender.defaultProps = {\n userPropsToDisplay: [],\n handleOnSuccess: () => {}\n};\n\nGTMEventRender.defaultProps = {\n userPropsToDisplay: []\n};\n\nexport default withRouter(GTMEventRender);\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,Q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ANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/plugin-gtm-fe",
|
|
3
|
-
"version": "0.146.0-core-styles.
|
|
3
|
+
"version": "0.146.0-core-styles.52",
|
|
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-core-styles.
|
|
30
|
+
"@blaze-cms/core-auth-ui": "0.146.0-core-styles.52",
|
|
31
31
|
"@blaze-cms/nextjs-components": "0.146.0-core-styles.42",
|
|
32
|
-
"@blaze-cms/react-page-builder": "0.146.0-core-styles.
|
|
32
|
+
"@blaze-cms/react-page-builder": "0.146.0-core-styles.52",
|
|
33
33
|
"@blaze-cms/setup-ui": "0.145.1-core-styles.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-core-styles.
|
|
39
|
+
"@blaze-cms/core-ui": "0.146.0-core-styles.52"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"next": "12.x"
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"lib/*",
|
|
46
46
|
"lib-es/*"
|
|
47
47
|
],
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "b3ac6c631d3363ef099165ca1a055d2a09b3705b"
|
|
49
49
|
}
|
|
@@ -2,8 +2,7 @@ import { useState } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useQuery } from '@apollo/client';
|
|
4
4
|
import { withRouter } from 'next/router';
|
|
5
|
-
import {
|
|
6
|
-
import { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';
|
|
5
|
+
import { getCurrentUser } from '@blaze-cms/react-page-builder';
|
|
7
6
|
import {
|
|
8
7
|
buildDataLayer,
|
|
9
8
|
buildAndPushWebVitals,
|
|
@@ -19,11 +18,10 @@ const GTMRender = ({ router, action, propsToDisplay, parentId, webVitals, userPr
|
|
|
19
18
|
const { data, error, loading } = useQuery(action, {
|
|
20
19
|
variables: { id: parentId }
|
|
21
20
|
});
|
|
22
|
-
const
|
|
23
|
-
const hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;
|
|
21
|
+
const hasUserProps = userPropsToDisplay && userPropsToDisplay.length;
|
|
24
22
|
const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';
|
|
25
|
-
const { data: userData, loading: userLoading } = useQuery(
|
|
26
|
-
variables: {
|
|
23
|
+
const { data: userData, loading: userLoading } = useQuery(getCurrentUser(userProps), {
|
|
24
|
+
variables: {},
|
|
27
25
|
skip: !hasUserProps
|
|
28
26
|
});
|
|
29
27
|
|
|
@@ -2,7 +2,7 @@ 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 { getCurretUser } from '@blaze-cms/react-page-builder';
|
|
6
6
|
import GTMEvent from './GTMEvent';
|
|
7
7
|
import { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ const GTMClickEvent = ({ event, componentProps, parentComponent }) => {
|
|
|
10
10
|
const { eventTrigger, propsToDisplay, userPropsToDisplay, eventEcommerce } = event;
|
|
11
11
|
const { id: userId } = checkIfLoggedIn();
|
|
12
12
|
const userProps = userId ? buildUserQueryProps(userPropsToDisplay) : '';
|
|
13
|
-
const { data: userData, loading } = useQuery(
|
|
13
|
+
const { data: userData, loading } = useQuery(getCurretUser(userProps), {
|
|
14
14
|
variables: { id: userId },
|
|
15
15
|
skip: !userId
|
|
16
16
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useQuery } from '@apollo/client';
|
|
4
|
-
import {
|
|
5
|
-
import { getUser } from '@blaze-cms/react-page-builder';
|
|
4
|
+
import { getCurrentUser } from '@blaze-cms/react-page-builder';
|
|
6
5
|
import { withRouter } from 'next/router';
|
|
7
6
|
import GTMEvent from './GTMEvent';
|
|
8
7
|
import { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';
|
|
@@ -20,11 +19,10 @@ const GTMEventRender = ({
|
|
|
20
19
|
const { asPath } = router;
|
|
21
20
|
const [currentLocation, setCurrentLocation] = useState('');
|
|
22
21
|
const { data = {}, error, loading } = useQuery(action, queryVariables);
|
|
23
|
-
const
|
|
24
|
-
const hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;
|
|
22
|
+
const hasUserProps = userPropsToDisplay && userPropsToDisplay.length;
|
|
25
23
|
const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';
|
|
26
|
-
const { data: userData, loading: userLoading } = useQuery(
|
|
27
|
-
variables: {
|
|
24
|
+
const { data: userData, loading: userLoading } = useQuery(getCurrentUser(userProps), {
|
|
25
|
+
variables: {},
|
|
28
26
|
skip: !hasUserProps
|
|
29
27
|
});
|
|
30
28
|
|