@blaze-cms/plugin-gtm-fe 0.127.0 → 0.128.0-admin-updates.3
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.map +1 -1
- package/lib/GoogleTagManager/GTMRender.js.map +1 -1
- package/lib/GoogleTagManager/index.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMClickEvent.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMClickEvents.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMEvent.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMEventFactory.js +4 -4
- package/lib/GoogleTagManagerEvent/GTMEventFactory.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMEventRender.js.map +1 -1
- package/lib/GoogleTagManagerEvent/GTMEventSwitch.js.map +1 -1
- package/lib/GoogleTagManagerEvent/index.js.map +1 -1
- package/lib/constants.js.map +1 -1
- package/lib/helpers/build-and-push-web-vitals.js.map +1 -1
- package/lib/helpers/build-data-layer.js.map +1 -1
- package/lib/helpers/build-nested-event.js.map +1 -1
- package/lib/helpers/build-props-to-display-array.js.map +1 -1
- package/lib/helpers/build-user-layer.js.map +1 -1
- package/lib/helpers/build-user-query-props.js.map +1 -1
- package/lib/helpers/filter-gtm-events.js.map +1 -1
- package/lib/helpers/get-ids-to-use.js.map +1 -1
- package/lib/helpers/get-render-props.js.map +1 -1
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/push-to-data-layer.js.map +1 -1
- package/lib/helpers/reset-data-layer.js.map +1 -1
- package/lib/index.js +25 -27
- package/lib/index.js.map +1 -1
- package/lib-es/GoogleTagManager/GTMFactory.js.map +1 -1
- package/lib-es/GoogleTagManager/GTMRender.js.map +1 -1
- package/lib-es/GoogleTagManagerEvent/GTMClickEvent.js.map +1 -1
- package/lib-es/GoogleTagManagerEvent/GTMClickEvents.js.map +1 -1
- package/lib-es/GoogleTagManagerEvent/GTMEvent.js.map +1 -1
- package/lib-es/GoogleTagManagerEvent/GTMEventFactory.js.map +1 -1
- package/lib-es/GoogleTagManagerEvent/GTMEventRender.js.map +1 -1
- package/lib-es/GoogleTagManagerEvent/GTMEventSwitch.js.map +1 -1
- package/lib-es/helpers/build-and-push-web-vitals.js.map +1 -1
- package/lib-es/helpers/build-data-layer.js.map +1 -1
- package/lib-es/helpers/build-nested-event.js.map +1 -1
- package/lib-es/helpers/build-props-to-display-array.js.map +1 -1
- package/lib-es/helpers/build-user-layer.js.map +1 -1
- package/lib-es/helpers/get-render-props.js.map +1 -1
- package/lib-es/helpers/push-to-data-layer.js.map +1 -1
- package/lib-es/helpers/reset-data-layer.js.map +1 -1
- package/lib-es/index.js.map +1 -1
- package/package.json +7 -7
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.128.0-admin-updates.3](https://github.com/thebyte9/blaze/compare/v0.128.0-admin-updates.2...v0.128.0-admin-updates.3) (2023-03-09)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [0.128.0-admin-updates.0](https://github.com/thebyte9/blaze/compare/v0.127.1...v0.128.0-admin-updates.0) (2023-02-16)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [0.127.0](https://github.com/thebyte9/blaze/compare/v0.126.1...v0.127.0) (2023-02-10)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMFactory.js","names":["GTMFactory","propsToDisplay","userPropsToDisplay","parent","gtmWebVitals","useContext","MainContext","isPreview","useQuery","getSingleEntitySchema","variables","id","itemEntity","data","error","loading","window","propsToDisplayArr","buildPropsToDisplayArray","extraProps","buildPropsQuery","getRenderProps","action","actionKey","itemId","propTypes","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;AACA;AACA;AACA;AACA;AACA;AACA;AAAsE;AAAA;AAEtE,
|
|
1
|
+
{"version":3,"file":"GTMFactory.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_client","_reactPageBuilder","_nextjsComponents","_GTMRender","_helpers","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","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,SAAAQ,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAV,wBAAAc,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GAAA,uCAAAA,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA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,IAAI,CAAC;IAAjEU,MAAM,GAAAF,eAAA,CAANE,MAAM;IAAEC,SAAS,GAAAH,eAAA,CAATG,SAAS;EAEzB,oBACE3D,MAAA,YAAA4D,aAAA,CAACpD,UAAA,WAAS;IACRkD,MAAM,EAAEA,MAAO;IACfC,SAAS,EAAEA,SAAU;IACrBxB,kBAAkB,EAAEA,kBAAmB;IACvCD,cAAc,EAAEA,cAAe;IAC/B2B,QAAQ,EAAEzB,MAAM,CAAC0B,MAAO;IACxBC,SAAS,EAAE1B;EAAa,EACxB;AAEN,CAAC;AAEDL,UAAU,CAACgC,SAAS,GAAG;EACrB9B,cAAc,EAAE+B,qBAAS,CAACC,KAAK;EAC/B/B,kBAAkB,EAAE8B,qBAAS,CAACC,KAAK;EACnC9B,MAAM,EAAE6B,qBAAS,CAACE,MAAM,CAACC,UAAU;EACnC/B,YAAY,EAAE4B,qBAAS,CAACI;AAC1B,CAAC;AAEDrC,UAAU,CAACsC,YAAY,GAAG;EACxBpC,cAAc,EAAE,EAAE;EAClBC,kBAAkB,EAAE,EAAE;EACtBE,YAAY,EAAE;AAChB,CAAC;AAAC,IAAAkC,QAAA,GAEavC,UAAU;AAAAwC,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMRender.js","names":["GTMRender","router","action","propsToDisplay","parentId","webVitals","userPropsToDisplay","asPath","useState","url","shouldPushLayer","currentLocation","setCurrentLocation","useQuery","variables","id","data","error","loading","checkIfLoggedIn","userId","hasUserProps","
|
|
1
|
+
{"version":3,"file":"GTMRender.js","names":["_react","require","_propTypes","_interopRequireDefault","_client","_router","_reactPageBuilder","_coreAuthUi","_helpers","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_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","_checkIfLoggedIn","checkIfLoggedIn","userId","hasUserProps","userProps","buildUserQueryProps","_useQuery2","getUser","skip","userData","userLoading","entityData","message","dataLayerObject","buildDataLayer","userLayerObject","buildUserLayer","extendedDataLayer","buildAndPushWebVitals","pushToDataLayer","propTypes","PropTypes","array","isRequired","string","bool","_default","withRouter","exports"],"sources":["../../src/GoogleTagManager/GTMRender.js"],"sourcesContent":["import { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { withRouter } from 'next/router';\nimport { getUser } from '@blaze-cms/react-page-builder';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport {\n buildDataLayer,\n buildAndPushWebVitals,\n pushToDataLayer,\n buildUserQueryProps,\n buildUserLayer\n} from '../helpers';\n\nconst GTMRender = ({ router, action, propsToDisplay, parentId, webVitals, userPropsToDisplay }) => {\n const { asPath } = router;\n const [currentLocation, setCurrentLocation] = useState({ url: '', shouldPushLayer: false });\n\n const { data, error, loading } = useQuery(action, {\n variables: { id: parentId }\n });\n const { id: userId } = checkIfLoggedIn();\n const hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;\n const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';\n const { data: userData, loading: userLoading } = useQuery(getUser(userProps), {\n variables: { id: userId },\n skip: !hasUserProps\n });\n\n if (loading || userLoading || !data || !data.entityData) return null;\n if (data.entityData.id !== parentId) return null;\n if (error) return error.message;\n if (currentLocation.url !== asPath) setCurrentLocation({ url: asPath, shouldPushLayer: true });\n if (!currentLocation.shouldPushLayer) return null;\n\n const { entityData } = data;\n const dataLayerObject = buildDataLayer(entityData, propsToDisplay, currentLocation.url);\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n if (webVitals) buildAndPushWebVitals();\n pushToDataLayer(extendedDataLayer, true);\n setCurrentLocation({ ...currentLocation, shouldPushLayer: false });\n\n return null;\n};\n\nGTMRender.propTypes = {\n userPropsToDisplay: PropTypes.array.isRequired,\n action: PropTypes.object.isRequired,\n propsToDisplay: PropTypes.array.isRequired,\n parentId: PropTypes.string.isRequired,\n webVitals: PropTypes.bool.isRequired\n};\n\nexport default withRouter(GTMRender);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,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,WAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAMoB,SAAAQ,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,QAAAC,gBAAA,aAAAP,MAAA,EAAAM,GAAA,EAAAF,MAAA,CAAAE,GAAA,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,CAAC;EACxCzB,kBAAkB,CAAA5B,aAAA,CAAAA,aAAA,KAAM2B,eAAe;IAAEH,eAAe,EAAE;EAAK,GAAG;EAElE,OAAO,IAAI;AACb,CAAC;AAEDZ,SAAS,CAAC4C,SAAS,GAAG;EACpBrC,kBAAkB,EAAEsC,qBAAS,CAACC,KAAK,CAACC,UAAU;EAC9C5C,MAAM,EAAE0C,qBAAS,CAACrE,MAAM,CAACuE,UAAU;EACnC3C,cAAc,EAAEyC,qBAAS,CAACC,KAAK,CAACC,UAAU;EAC1C1C,QAAQ,EAAEwC,qBAAS,CAACG,MAAM,CAACD,UAAU;EACrCzC,SAAS,EAAEuC,qBAAS,CAACI,IAAI,CAACF;AAC5B,CAAC;AAAC,IAAAG,QAAA,GAEa,IAAAC,kBAAU,EAACnD,SAAS,CAAC;AAAAoD,OAAA,cAAAF,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["GTMFactory"],"sources":["../../src/GoogleTagManager/index.js"],"sourcesContent":["import GTMFactory from './GTMFactory';\n\nexport default GTMFactory;\n"],"mappings":";;;;;;;;AAAA;AAAsC,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_GTMFactory","_interopRequireDefault","require","_default","GTMFactory","exports"],"sources":["../../src/GoogleTagManager/index.js"],"sourcesContent":["import GTMFactory from './GTMFactory';\n\nexport default GTMFactory;\n"],"mappings":";;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAsC,IAAAC,QAAA,GAEvBC,sBAAU;AAAAC,OAAA,cAAAF,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMClickEvent.js","names":["GTMClickEvent","event","componentProps","parentComponent","eventTrigger","propsToDisplay","userPropsToDisplay","eventEcommerce","checkIfLoggedIn","userId","id","userProps","buildUserQueryProps","useQuery","getUser","variables","skip","userData","data","loading","dataLayerProps","buildDataLayer","dataLayerObject","buildNestedEvent","userLayerObject","buildUserLayer","extendedDataLayer","
|
|
1
|
+
{"version":3,"file":"GTMClickEvent.js","names":["_react","_interopRequireDefault","require","_propTypes","_client","_coreAuthUi","_reactPageBuilder","_GTMEvent","_helpers","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","GTMClickEvent","_ref","event","componentProps","parentComponent","eventTrigger","propsToDisplay","userPropsToDisplay","eventEcommerce","_checkIfLoggedIn","checkIfLoggedIn","userId","id","userProps","buildUserQueryProps","_useQuery","useQuery","getUser","variables","skip","userData","data","loading","dataLayerProps","buildDataLayer","dataLayerObject","buildNestedEvent","userLayerObject","buildUserLayer","extendedDataLayer","createElement","propTypes","PropTypes","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 { getUser } 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(getUser(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,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,QAAAC,gBAAA,aAAAP,MAAA,EAAAM,GAAA,EAAAF,MAAA,CAAAE,GAAA,SAAAhB,MAAA,CAAAkB,yB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AAC,yBAAgB,EAAClB,cAAc,EAAEN,KAAK,EAAEqB,cAAc,EAAEnB,eAAe,CAAC;EAChG,IAAMuB,eAAe,GAAG,IAAAC,uBAAc,EAACR,QAAQ,EAAEb,kBAAkB,CAAC;EAEpE,IAAMsB,iBAAiB,GAAAzC,aAAA,CAAAA,aAAA,KAAQqC,eAAe,GAAKE,eAAe,CAAE;EAEpE,oBAAO7D,MAAA,YAAAgE,aAAA,CAACzD,SAAA,WAAQ;IAACoD,eAAe,EAAEI,iBAAkB;IAACxB,YAAY,EAAEA;EAAa,EAAG;AACrF,CAAC;AAEDL,aAAa,CAAC+B,SAAS,GAAG;EACxB7B,KAAK,EAAE8B,qBAAS,CAACxD,MAAM,CAACyD,UAAU;EAClC9B,cAAc,EAAE6B,qBAAS,CAACE,SAAS,CAAC,CAACF,qBAAS,CAACxD,MAAM,EAAEwD,qBAAS,CAACG,KAAK,CAAC,CAAC;EACxE/B,eAAe,EAAE4B,qBAAS,CAACxD;AAC7B,CAAC;AAEDwB,aAAa,CAACoC,YAAY,GAAG;EAC3BjC,cAAc,EAAE,CAAC,CAAC;EAClBC,eAAe,EAAE,CAAC;AACpB,CAAC;AAAC,IAAAiC,QAAA,GAEarC,aAAa;AAAAsC,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMClickEvents.js","names":["GTMClickEvents","gtmEvents","componentProps","parentComponent","map","event","index","eventName","dynamicKey","join","propTypes","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;AACA;AACA;AAEA,
|
|
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,EACT;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,GAEapB,cAAc;AAAAqB,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEvent.js","names":["GTMEvent","dataLayerObject","eventTrigger","currentLocation","handleOnSuccess","useState","shouldPushLayer","setShouldPushLayer","isViewEvent","IN_VIEW","isOnSuccess","ON_SUCCESS","useEffect","pushDataLayer","pushToDataLayer","propTypes","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 () => {\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;AACA;AACA;AACA;AACA;AAAmD;AAAA;AAEnD,
|
|
1
|
+
{"version":3,"file":"GTMEvent.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_reactWaypoint","_helpers","_constants","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","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,SAAAM,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAR,wBAAAY,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GA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e;EAEpE,IAAAW,gBAAS,EACP,YAAM;IACJL,kBAAkB,CAAC,IAAI,CAAC;EAC1B,CAAC,EACD,CAACP,eAAe,CAAC,CAClB;EACD,IAAMa,aAAa,GAAG,SAAhBA,aAAaA,CAAA,EAAS;IAC1B,IAAAC,wBAAe,EAAChB,eAAe,CAAC;IAChCS,kBAAkB,CAAC,KAAK,CAAC;IACzB,IAAIG,WAAW,EAAET,eAAe,EAAE;EACpC,CAAC;EAED,IAAI,CAACO,WAAW,IAAIF,eAAe,EAAEO,aAAa,EAAE;EAEpD,oBAAO/C,MAAA,YAAAiD,aAAA,CAAAjD,MAAA,YAAAkD,QAAA,QAAGR,WAAW,IAAIF,eAAe,iBAAIxC,MAAA,YAAAiD,aAAA,CAAC5C,cAAA,CAAA8C,QAAQ;IAACC,OAAO,EAAEL;EAAc,EAAG,CAAI;AACtF,CAAC;AAEDjB,QAAQ,CAACuB,SAAS,GAAG;EACnBlB,eAAe,EAAEmB,qBAAS,CAACC,IAAI,CAACC,UAAU;EAC1CxB,eAAe,EAAEsB,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,GAEa7B,QAAQ;AAAA8B,OAAA,cAAAD,QAAA"}
|
|
@@ -40,10 +40,10 @@ var GTMEventFactory = function GTMEventFactory(_ref) {
|
|
|
40
40
|
isPreview = _useContext.isPreview;
|
|
41
41
|
var _ref2 = parentData || [],
|
|
42
42
|
_ref3 = (0, _slicedToArray2["default"])(_ref2, 1),
|
|
43
|
-
_ref3$ = _ref3[0]
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
itemEntity = _ref3
|
|
43
|
+
_ref3$ = _ref3[0],
|
|
44
|
+
_ref3$2 = _ref3$ === void 0 ? {} : _ref3$,
|
|
45
|
+
_ref3$2$itemEntity = _ref3$2.itemEntity,
|
|
46
|
+
itemEntity = _ref3$2$itemEntity === void 0 ? parent.itemEntity : _ref3$2$itemEntity;
|
|
47
47
|
var _useQuery = (0, _client.useQuery)(_reactPageBuilder.getSingleEntitySchema, {
|
|
48
48
|
variables: {
|
|
49
49
|
id: itemEntity
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEventFactory.js","names":["GTMEventFactory","parent","gtmEvents","parentData","clickId","parentComponent","useContext","MainContext","isPreview","itemEntity","useQuery","getSingleEntitySchema","variables","id","data","error","loading","map","i","propsToDisplay","eventProps","hasNoPropsToDisplay","length","propsToDisplayArr","buildPropsToDisplayArray","extraProps","buildPropsQuery","shouldUseParentData","itemIdToUse","itemId","getIdsToUse","shouldUseMultiQuery","Array","isArray","getRenderProps","action","actionKey","dynamicKey","GTM_EVENT_FACTORY","queryVariables","where","_in","skip","propTypes","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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAiD;AAAA;AAAA;AAEjD,
|
|
1
|
+
{"version":3,"file":"GTMEventFactory.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_client","_reactPageBuilder","_nextjsComponents","_GTMEventRender","_helpers","_constants","_excluded","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","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","i","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","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,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAZ,wBAAAgB,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAA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EAAE,IAAI;EAChBE,eAAe,EAAE,CAAC;AACpB,CAAC;AAAC,IAAA4D,QAAA,GAEalE,eAAe;AAAAmE,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEventRender.js","names":["GTMEventRender","router","action","actionKey","queryVariables","parentComponent","userPropsToDisplay","handleOnSuccess","eventProps","asPath","useState","currentLocation","setCurrentLocation","useQuery","data","error","loading","checkIfLoggedIn","userId","id","hasUserProps","
|
|
1
|
+
{"version":3,"file":"GTMEventRender.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_client","_coreAuthUi","_reactPageBuilder","_router","_GTMEvent","_helpers","_excluded","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","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","_checkIfLoggedIn","checkIfLoggedIn","userId","id","hasUserProps","userProps","buildUserQueryProps","_useQuery2","getUser","variables","skip","userData","userLoading","gtmData","entityData","eventTrigger","propsToDisplay","eventEcommerce","dataLayerProps","buildDataLayer","dataLayerObject","buildNestedEvent","userLayerObject","buildUserLayer","extendedDataLayer","createElement","propTypes","PropTypes","array","isRequired","string","func","defaultProps","_default","withRouter","exports"],"sources":["../../src/GoogleTagManagerEvent/GTMEventRender.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport { getUser } from '@blaze-cms/react-page-builder';\nimport { withRouter } from 'next/router';\nimport GTMEvent from './GTMEvent';\nimport { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';\n\nconst GTMEventRender = ({\n router,\n action,\n actionKey,\n queryVariables,\n parentComponent,\n userPropsToDisplay,\n handleOnSuccess,\n ...eventProps\n}) => {\n const { asPath } = router;\n const [currentLocation, setCurrentLocation] = useState('');\n const { data = {}, error, loading } = useQuery(action, queryVariables);\n const { id: userId } = checkIfLoggedIn();\n const hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;\n const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';\n const { data: userData, loading: userLoading } = useQuery(getUser(userProps), {\n variables: { id: userId },\n skip: !hasUserProps\n });\n\n if (loading || userLoading || error) return null;\n const gtmData = data.entityData || data[actionKey];\n\n if (currentLocation !== asPath) {\n setCurrentLocation(asPath);\n return null;\n }\n\n const { eventTrigger, propsToDisplay, eventEcommerce } = eventProps;\n const dataLayerProps = buildDataLayer(gtmData, propsToDisplay);\n\n const dataLayerObject = buildNestedEvent(\n eventEcommerce,\n eventProps,\n dataLayerProps,\n parentComponent\n );\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n return (\n <GTMEvent\n dataLayerObject={extendedDataLayer}\n eventTrigger={eventTrigger}\n currentLocation={currentLocation}\n handleOnSuccess={handleOnSuccess}\n />\n );\n};\n\nGTMEventRender.propTypes = {\n userPropsToDisplay: PropTypes.array,\n router: PropTypes.object.isRequired,\n action: PropTypes.object.isRequired,\n actionKey: PropTypes.string.isRequired,\n queryVariables: PropTypes.object.isRequired,\n parentComponent: PropTypes.object.isRequired,\n handleOnSuccess: PropTypes.func\n};\n\nGTMEventRender.defaultProps = {\n userPropsToDisplay: [],\n handleOnSuccess: () => {}\n};\n\nGTMEventRender.def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,EAAEgD,qBAAS,CAACvE,MAAM,CAACyE,UAAU;EACnCjD,SAAS,EAAE+C,qBAAS,CAACG,MAAM,CAACD,UAAU;EACtChD,cAAc,EAAE8C,qBAAS,CAACvE,MAAM,CAACyE,UAAU;EAC3C/C,eAAe,EAAE6C,qBAAS,CAACvE,MAAM,CAACyE,UAAU;EAC5C7C,eAAe,EAAE2C,qBAAS,CAACI;AAC7B,CAAC;AAEDvD,cAAc,CAACwD,YAAY,GAAG;EAC5BjD,kBAAkB,EAAE,EAAE;EACtBC,eAAe,EAAE,SAAAA,gBAAA,EAAM,CAAC;AAC1B,CAAC;AAEDR,cAAc,CAACwD,YAAY,GAAG;EAC5BjD,kBAAkB,EAAE;AACtB,CAAC;AAAC,IAAAkD,QAAA,GAEa,IAAAC,kBAAU,EAAC1D,cAAc,CAAC;AAAA2D,OAAA,cAAAF,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEventSwitch.js","names":["GTMEventSwitch","gtmEvents","clickState","clickId","props","window","length","filterGtmEvents","clickEvents","regularEvents","GTMClickFactory","GTMEventFactory","GTMClickEvents","propTypes","PropTypes","string","array","bool","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMEventSwitch.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport GTMClickEvents from './GTMClickEvents';\nimport GTMEventFactory from './GTMEventFactory';\nimport { filterGtmEvents } from '../helpers';\n\nconst GTMEventSwitch = ({ gtmEvents, clickState, clickId, ...props }) => {\n if (typeof window === 'undefined' || !gtmEvents.length) return null;\n const { clickEvents, regularEvents } = filterGtmEvents(gtmEvents);\n const GTMClickFactory = clickId ? GTMEventFactory : GTMClickEvents;\n\n return clickState ? (\n <GTMClickFactory gtmEvents={clickEvents} clickId={clickId} {...props} />\n ) : (\n <GTMEventFactory gtmEvents={regularEvents} {...props} />\n );\n};\n\nGTMEventSwitch.propTypes = {\n clickId: PropTypes.string,\n gtmEvents: PropTypes.array,\n clickState: PropTypes.bool\n};\n\nGTMEventSwitch.defaultProps = {\n clickId: null,\n gtmEvents: [],\n clickState: false\n};\n\nexport default GTMEventSwitch;\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAA6C;AAE7C,
|
|
1
|
+
{"version":3,"file":"GTMEventSwitch.js","names":["_react","_interopRequireDefault","require","_propTypes","_GTMClickEvents","_GTMEventFactory","_helpers","_excluded","GTMEventSwitch","_ref","gtmEvents","clickState","clickId","props","_objectWithoutProperties2","window","length","_filterGtmEvents","filterGtmEvents","clickEvents","regularEvents","GTMClickFactory","GTMEventFactory","GTMClickEvents","createElement","_extends2","propTypes","PropTypes","string","array","bool","defaultProps","_default","exports"],"sources":["../../src/GoogleTagManagerEvent/GTMEventSwitch.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport GTMClickEvents from './GTMClickEvents';\nimport GTMEventFactory from './GTMEventFactory';\nimport { filterGtmEvents } from '../helpers';\n\nconst GTMEventSwitch = ({ gtmEvents, clickState, clickId, ...props }) => {\n if (typeof window === 'undefined' || !gtmEvents.length) return null;\n const { clickEvents, regularEvents } = filterGtmEvents(gtmEvents);\n const GTMClickFactory = clickId ? GTMEventFactory : GTMClickEvents;\n\n return clickState ? (\n <GTMClickFactory gtmEvents={clickEvents} clickId={clickId} {...props} />\n ) : (\n <GTMEventFactory gtmEvents={regularEvents} {...props} />\n );\n};\n\nGTMEventSwitch.propTypes = {\n clickId: PropTypes.string,\n gtmEvents: PropTypes.array,\n clickState: PropTypes.bool\n};\n\nGTMEventSwitch.defaultProps = {\n clickId: null,\n gtmEvents: [],\n clickState: false\n};\n\nexport default GTMEventSwitch;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,gBAAA,GAAAJ,sBAA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
1
|
-
{"version":3,"file":"index.js","names":["GTMEventSwitch"],"sources":["../../src/GoogleTagManagerEvent/index.js"],"sourcesContent":["import GTMEventSwitch from './GTMEventSwitch';\n\nexport default GTMEventSwitch;\n"],"mappings":";;;;;;;;AAAA;AAA8C,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_GTMEventSwitch","_interopRequireDefault","require","_default","GTMEventSwitch","exports"],"sources":["../../src/GoogleTagManagerEvent/index.js"],"sourcesContent":["import GTMEventSwitch from './GTMEventSwitch';\n\nexport default GTMEventSwitch;\n"],"mappings":";;;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,IAAAC,QAAA,GAE/BC,0BAAc;AAAAC,OAAA,cAAAF,QAAA"}
|
package/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["EVENT","ON_LOAD","ON_CLICK","IN_VIEW","ON_SUCCESS","PAGE_VIEW","ECOMMERCE","GTM_PROPS","key","label","GTM_EVENT_NAMES","productImpresion","productDetailImpression","productClick","promotionClick","GTM_EVENT_FACTORY","PLUGIN_NAME","PRODUCTS"],"sources":["../src/constants.js"],"sourcesContent":["const EVENT = 'event';\nconst ON_LOAD = 'onLoad';\nconst ON_CLICK = 'onClick';\nconst IN_VIEW = 'inView';\nconst ON_SUCCESS = 'onSuccess';\nconst PAGE_VIEW = 'pageView';\nconst ECOMMERCE = 'ecommerce';\nconst GTM_PROPS = [\n { key: 'eventAction' },\n { key: 'eventLabel' },\n { key: 'eventCategory' },\n { key: 'eventName', label: 'event' }\n];\nconst GTM_EVENT_NAMES = {\n productImpresion: 'impressions',\n productDetailImpression: 'detail',\n productClick: 'click',\n promotionClick: 'promotionClick'\n};\n\nconst GTM_EVENT_FACTORY = 'GtmEventFactory';\nconst PLUGIN_NAME = 'gtm-fe';\nconst PRODUCTS = 'products';\n\nexport {\n PLUGIN_NAME,\n EVENT,\n ECOMMERCE,\n GTM_PROPS,\n GTM_EVENT_NAMES,\n GTM_EVENT_FACTORY,\n ON_CLICK,\n IN_VIEW,\n ON_SUCCESS,\n ON_LOAD,\n PRODUCTS,\n PAGE_VIEW\n};\n"],"mappings":";;;;;;;AAAA,IAAMA,KAAK,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"constants.js","names":["EVENT","exports","ON_LOAD","ON_CLICK","IN_VIEW","ON_SUCCESS","PAGE_VIEW","ECOMMERCE","GTM_PROPS","key","label","GTM_EVENT_NAMES","productImpresion","productDetailImpression","productClick","promotionClick","GTM_EVENT_FACTORY","PLUGIN_NAME","PRODUCTS"],"sources":["../src/constants.js"],"sourcesContent":["const EVENT = 'event';\nconst ON_LOAD = 'onLoad';\nconst ON_CLICK = 'onClick';\nconst IN_VIEW = 'inView';\nconst ON_SUCCESS = 'onSuccess';\nconst PAGE_VIEW = 'pageView';\nconst ECOMMERCE = 'ecommerce';\nconst GTM_PROPS = [\n { key: 'eventAction' },\n { key: 'eventLabel' },\n { key: 'eventCategory' },\n { key: 'eventName', label: 'event' }\n];\nconst GTM_EVENT_NAMES = {\n productImpresion: 'impressions',\n productDetailImpression: 'detail',\n productClick: 'click',\n promotionClick: 'promotionClick'\n};\n\nconst GTM_EVENT_FACTORY = 'GtmEventFactory';\nconst PLUGIN_NAME = 'gtm-fe';\nconst PRODUCTS = 'products';\n\nexport {\n PLUGIN_NAME,\n EVENT,\n ECOMMERCE,\n GTM_PROPS,\n GTM_EVENT_NAMES,\n GTM_EVENT_FACTORY,\n ON_CLICK,\n IN_VIEW,\n ON_SUCCESS,\n ON_LOAD,\n PRODUCTS,\n PAGE_VIEW\n};\n"],"mappings":";;;;;;;AAAA,IAAMA,KAAK,GAAG,OAAO;AAACC,OAAA,CAAAD,KAAA,GAAAA,KAAA;AACtB,IAAME,OAAO,GAAG,QAAQ;AAACD,OAAA,CAAAC,OAAA,GAAAA,OAAA;AACzB,IAAMC,QAAQ,GAAG,SAAS;AAACF,OAAA,CAAAE,QAAA,GAAAA,QAAA;AAC3B,IAAMC,OAAO,GAAG,QAAQ;AAACH,OAAA,CAAAG,OAAA,GAAAA,OAAA;AACzB,IAAMC,UAAU,GAAG,WAAW;AAACJ,OAAA,CAAAI,UAAA,GAAAA,UAAA;AAC/B,IAAMC,SAAS,GAAG,UAAU;AAACL,OAAA,CAAAK,SAAA,GAAAA,SAAA;AAC7B,IAAMC,SAAS,GAAG,WAAW;AAACN,OAAA,CAAAM,SAAA,GAAAA,SAAA;AAC9B,IAAMC,SAAS,GAAG,CAChB;EAAEC,GAAG,EAAE;AAAc,CAAC,EACtB;EAAEA,GAAG,EAAE;AAAa,CAAC,EACrB;EAAEA,GAAG,EAAE;AAAgB,CAAC,EACxB;EAAEA,GAAG,EAAE,WAAW;EAAEC,KAAK,EAAE;AAAQ,CAAC,CACrC;AAACT,OAAA,CAAAO,SAAA,GAAAA,SAAA;AACF,IAAMG,eAAe,GAAG;EACtBC,gBAAgB,EAAE,aAAa;EAC/BC,uBAAuB,EAAE,QAAQ;EACjCC,YAAY,EAAE,OAAO;EACrBC,cAAc,EAAE;AAClB,CAAC;AAACd,OAAA,CAAAU,eAAA,GAAAA,eAAA;AAEF,IAAMK,iBAAiB,GAAG,iBAAiB;AAACf,OAAA,CAAAe,iBAAA,GAAAA,iBAAA;AAC5C,IAAMC,WAAW,GAAG,QAAQ;AAAChB,OAAA,CAAAgB,WAAA,GAAAA,WAAA;AAC7B,IAAMC,QAAQ,GAAG,UAAU;AAACjB,OAAA,CAAAiB,QAAA,GAAAA,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-and-push-web-vitals.js","names":["buildAndPushWebVitals","getCLS","reportHandler","getFID","getLCP","name","delta","id","metrics","event","event_category","event_action","event_value","Math","round","event_label","nonInteraction","pushToDataLayer"],"sources":["../../src/helpers/build-and-push-web-vitals.js"],"sourcesContent":["import { getCLS, getFID, getLCP } from 'web-vitals';\nimport pushToDataLayer from './push-to-data-layer';\n\nconst buildAndPushWebVitals = () => {\n getCLS(reportHandler);\n getFID(reportHandler);\n getLCP(reportHandler);\n};\n\nconst reportHandler = ({ name, delta, id }) => {\n const metrics = {\n event: 'web-vitals',\n event_category: 'Web Vitals',\n event_action: name,\n event_value: Math.round(name === 'CLS' ? delta * 1000 : delta),\n event_label: id,\n nonInteraction: true\n };\n\n pushToDataLayer(metrics);\n};\n\nexport default buildAndPushWebVitals;\n"],"mappings":";;;;;;;;;AAAA;AACA;AAEA,
|
|
1
|
+
{"version":3,"file":"build-and-push-web-vitals.js","names":["_webVitals","require","_pushToDataLayer","_interopRequireDefault","buildAndPushWebVitals","getCLS","reportHandler","getFID","getLCP","_ref","name","delta","id","metrics","event","event_category","event_action","event_value","Math","round","event_label","nonInteraction","pushToDataLayer","_default","exports"],"sources":["../../src/helpers/build-and-push-web-vitals.js"],"sourcesContent":["import { getCLS, getFID, getLCP } from 'web-vitals';\nimport pushToDataLayer from './push-to-data-layer';\n\nconst buildAndPushWebVitals = () => {\n getCLS(reportHandler);\n getFID(reportHandler);\n getLCP(reportHandler);\n};\n\nconst reportHandler = ({ name, delta, id }) => {\n const metrics = {\n event: 'web-vitals',\n event_category: 'Web Vitals',\n event_action: name,\n event_value: Math.round(name === 'CLS' ? delta * 1000 : delta),\n event_label: id,\n nonInteraction: true\n };\n\n pushToDataLayer(metrics);\n};\n\nexport default buildAndPushWebVitals;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAMG,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAA,EAAS;EAClC,IAAAC,iBAAM,EAACC,aAAa,CAAC;EACrB,IAAAC,iBAAM,EAACD,aAAa,CAAC;EACrB,IAAAE,iBAAM,EAACF,aAAa,CAAC;AACvB,CAAC;AAED,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAAG,IAAA,EAA4B;EAAA,IAAtBC,IAAI,GAAAD,IAAA,CAAJC,IAAI;IAAEC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,EAAE,GAAAH,IAAA,CAAFG,EAAE;EACtC,IAAMC,OAAO,GAAG;IACdC,KAAK,EAAE,YAAY;IACnBC,cAAc,EAAE,YAAY;IAC5BC,YAAY,EAAEN,IAAI;IAClBO,WAAW,EAAEC,IAAI,CAACC,KAAK,CAACT,IAAI,KAAK,KAAK,GAAGC,KAAK,GAAG,IAAI,GAAGA,KAAK,CAAC;IAC9DS,WAAW,EAAER,EAAE;IACfS,cAAc,EAAE;EAClB,CAAC;EAED,IAAAC,2BAAe,EAACT,OAAO,CAAC;AAC1B,CAAC;AAAC,IAAAU,QAAA,GAEanB,qBAAqB;AAAAoB,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-data-layer.js","names":["getFinalValue","data","name","includes","split","relationName","fieldName","Array","isArray","reduce","str","element","index","buildProps","props","acc","key","label","propertiesToDisplay","staticMetric","buildDataLayerProps","map","currentData","buildDataLayer","propsToDisplay","url","length","propsToDisplayValues","event"],"sources":["../../src/helpers/build-data-layer.js"],"sourcesContent":["const getFinalValue = (data, name) => {\n if (name.includes('.')) {\n const [relationName, fieldName] = name.split('.');\n if (Array.isArray(data[relationName])) {\n return data[relationName].reduce(\n (str, element, index) => `${str}${index ? ',' : ''}${element[fieldName]}`,\n ''\n );\n }\n\n return data[relationName] ? data[relationName][fieldName] : data[fieldName] || '';\n }\n return data[name];\n};\n\nconst buildProps = (props, data) =>\n props.reduce((acc, { label: key, propertiesToDisplay: [name], staticMetric }) => {\n if (key && (staticMetric || name)) {\n acc[key] = staticMetric || getFinalValue(data, name);\n }\n\n return acc;\n }, {});\n\nconst buildDataLayerProps = (props, data) =>\n Array.isArray(data)\n ? data.map(currentData => buildProps(props, currentData))\n : buildProps(props, data);\n\nconst buildDataLayer = (data, propsToDisplay, url) => {\n if (!propsToDisplay || !propsToDisplay.length) return null;\n const propsToDisplayValues = buildDataLayerProps(propsToDisplay, data);\n\n return url\n ? {\n event: 'pageView',\n url,\n ...propsToDisplayValues\n }\n : propsToDisplayValues;\n};\n\nexport default buildDataLayer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,aAAa,GAAG,SAAhBA,
|
|
1
|
+
{"version":3,"file":"build-data-layer.js","names":["getFinalValue","data","name","includes","_name$split","split","_name$split2","_slicedToArray2","relationName","fieldName","Array","isArray","reduce","str","element","index","concat","buildProps","props","acc","_ref","key","label","_ref$propertiesToDisp","propertiesToDisplay","staticMetric","buildDataLayerProps","map","currentData","buildDataLayer","propsToDisplay","url","length","propsToDisplayValues","_objectSpread","event","_default","exports"],"sources":["../../src/helpers/build-data-layer.js"],"sourcesContent":["const getFinalValue = (data, name) => {\n if (name.includes('.')) {\n const [relationName, fieldName] = name.split('.');\n if (Array.isArray(data[relationName])) {\n return data[relationName].reduce(\n (str, element, index) => `${str}${index ? ',' : ''}${element[fieldName]}`,\n ''\n );\n }\n\n return data[relationName] ? data[relationName][fieldName] : data[fieldName] || '';\n }\n return data[name];\n};\n\nconst buildProps = (props, data) =>\n props.reduce((acc, { label: key, propertiesToDisplay: [name], staticMetric }) => {\n if (key && (staticMetric || name)) {\n acc[key] = staticMetric || getFinalValue(data, name);\n }\n\n return acc;\n }, {});\n\nconst buildDataLayerProps = (props, data) =>\n Array.isArray(data)\n ? data.map(currentData => buildProps(props, currentData))\n : buildProps(props, data);\n\nconst buildDataLayer = (data, propsToDisplay, url) => {\n if (!propsToDisplay || !propsToDisplay.length) return null;\n const propsToDisplayValues = buildDataLayerProps(propsToDisplay, data);\n\n return url\n ? {\n event: 'pageView',\n url,\n ...propsToDisplayValues\n }\n : propsToDisplayValues;\n};\n\nexport default buildDataLayer;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,IAAI,EAAEC,IAAI,EAAK;EACpC,IAAIA,IAAI,C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C;AAAA;AAER,IAAMO,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIR,KAAK,EAAEjB,IAAI;EAAA,OACtCS,KAAK,CAACC,OAAO,CAACV,IAAI,CAAC,GACfA,IAAI,CAAC0B,GAAG,CAAC,UAAAC,WAAW;IAAA,OAAIX,UAAU,CAACC,KAAK,EAAEU,WAAW,CAAC;EAAA,EAAC,GACvDX,UAAU,CAACC,KAAK,EAAEjB,IAAI,CAAC;AAAA;AAE7B,IAAM4B,cAAc,GAAG,SAAjBA,cAAcA,CAAI5B,IAAI,EAAE6B,cAAc,EAAEC,GAAG,EAAK;EACpD,IAAI,CAACD,cAAc,IAAI,CAACA,cAAc,CAACE,MAAM,EAAE,OAAO,IAAI;EAC1D,IAAMC,oBAAoB,GAAGP,mBAAmB,CAACI,cAAc,EAAE7B,IAAI,CAAC;EAEtE,OAAO8B,GAAG,GAAAG,aAAA;IAEJC,KAAK,EAAE,UAAU;IACjBJ,GAAG,EAAHA;EAAG,GACAE,oBAAoB,IAEzBA,oBAAoB;AAC1B,CAAC;AAAC,IAAAG,QAAA,GAEaP,cAAc;AAAAQ,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-nested-event.js","names":["buildNestedEvent","ecommerce","propsObject","props","parentComponent","productDetailImpression","GTM_EVENT_NAMES","productClick","eventAction","eventTrigger","name","gtmActionLabel","isClickEvent","ON_CLICK","actionField","list","hasMultipleItems","Array","isArray","basicEventObject","GTM_PROPS","
|
|
1
|
+
{"version":3,"file":"build-nested-event.js","names":["_constants","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","buildNestedEvent","ecommerce","propsObject","props","parentComponent","_ref2","_ref6","_ref8","productDetailImpression","GTM_EVENT_NAMES","productClick","eventAction","eventTrigger","name","gtmActionLabel","isClickEvent","ON_CLICK","actionField","list","hasMultipleItems","Array","isArray","basicEventObject","GTM_PROPS","_ref","label","gtmValue","gtmKey","parsedProps","items","EVENT","ECOMMERCE","_ref3","_ref5","parsedProducts","eventObject","PRODUCTS","ecommerceObject","_default","exports"],"sources":["../../src/helpers/build-nested-event.js"],"sourcesContent":["import { GTM_EVENT_NAMES, GTM_PROPS, EVENT, ECOMMERCE, PRODUCTS, ON_CLICK } from '../constants';\n\nconst buildNestedEvent = (ecommerce, propsObject, props, parentComponent) => {\n const { productDetailImpression, productClick } = GTM_EVENT_NAMES;\n const { eventAction, eventTrigger } = propsObject;\n const { name } = parentComponent;\n const gtmActionLabel = GTM_EVENT_NAMES[eventAction];\n const isClickEvent = eventTrigger === ON_CLICK || gtmActionLabel === productClick;\n const actionField = { list: name };\n const hasMultipleItems = Array.isArray(props);\n\n if (!ecommerce) {\n const basicEventObject = {};\n GTM_PROPS.forEach(({ key, label }) => {\n const gtmValue = propsObject[key];\n const gtmKey = label || key;\n if (gtmValue) basicEventObject[gtmKey] = gtmValue;\n });\n const parsedProps = hasMultipleItems ? { items: props } : props;\n\n return { ...basicEventObject, ...parsedProps };\n }\n\n if (!gtmActionLabel) return { [EVENT]: eventAction, [ECOMMERCE]: props };\n if (gtmActionLabel === productDetailImpression || gtmActionLabel === productClick) {\n const parsedProducts = hasMultipleItems ? props : [props];\n const eventObject = isClickEvent\n ? { [PRODUCTS]: parsedProducts, actionField }\n : { [PRODUCTS]: parsedProducts };\n return {\n [EVENT]: eventAction,\n [ECOMMERCE]: { [gtmActionLabel]: eventObject }\n };\n }\n\n const ecommerceObject = isClickEvent\n ? { [gtmActionLabel]: props, actionField }\n : { [gtmActionLabel]: props };\n return { [EVENT]: eventAction, [ECOMMERCE]: ecommerceObject };\n};\n\nexport default buildNestedEvent;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAAgG,SAAAC,QAAAC,MAAA,EA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AAMC,cAAc,GAAGf,gBAAgB,GAAGhB,KAAK,GAAG,CAACA,KAAK,CAAC;IACzD,IAAMgC,WAAW,GAAGpB,YAAY,IAAAiB,KAAA,WAAApC,gBAAA,aAAAoC,KAAA,EACzBI,mBAAQ,EAAGF,cAAc,OAAAtC,gBAAA,aAAAoC,KAAA,iBAAEf,WAAW,GAAAe,KAAA,QAAApC,gBAAA,iBACtCwC,mBAAQ,EAAGF,cAAc,CAAE;IAClC,OAAAD,KAAA,WAAArC,gBAAA,aAAAqC,KAAA,EACGH,gBAAK,EAAGnB,WAAW,OAAAf,gBAAA,aAAAqC,KAAA,EACnBF,oBAAS,MAAAnC,gBAAA,iBAAMkB,cAAc,EAAGqB,WAAW,IAAAF,KAAA;EAEhD;EAEA,IAAMI,eAAe,GAAGtB,YAAY,IAAAT,KAAA,WAAAV,gBAAA,aAAAU,KAAA,EAC7BQ,cAAc,EAAGX,KAAK,OAAAP,gBAAA,aAAAU,KAAA,iBAAEW,WAAW,GAAAX,KAAA,QAAAV,gBAAA,iBACnCkB,cAAc,EAAGX,KAAK,CAAE;EAC/B,OAAAI,KAAA,WAAAX,gBAAA,aAAAW,KAAA,EAAUuB,gBAAK,EAAGnB,WAAW,OAAAf,gBAAA,aAAAW,KAAA,EAAGwB,oBAAS,EAAGM,eAAe,GAAA9B,KAAA;AAC7D,CAAC;AAAC,IAAA+B,QAAA,GAEatC,gBAAgB;AAAAuC,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-props-to-display-array.js","names":["buildPropsToDisplayArray","propsToDisplay","map","prop","propertiesToDisplay","filter","Boolean"],"sources":["../../src/helpers/build-props-to-display-array.js"],"sourcesContent":["function buildPropsToDisplayArray(propsToDisplay = []) {\n return propsToDisplay\n .map(prop => !!prop && !!prop.propertiesToDisplay && prop.propertiesToDisplay[0])\n .filter(Boolean);\n}\n\nexport default buildPropsToDisplayArray;\n"],"mappings":";;;;;;;;;;AAAA,SAASA,
|
|
1
|
+
{"version":3,"file":"build-props-to-display-array.js","names":["buildPropsToDisplayArray","propsToDisplay","arguments","length","undefined","map","prop","propertiesToDisplay","filter","Boolean","_default","exports"],"sources":["../../src/helpers/build-props-to-display-array.js"],"sourcesContent":["function buildPropsToDisplayArray(propsToDisplay = []) {\n return propsToDisplay\n .map(prop => !!prop && !!prop.propertiesToDisplay && prop.propertiesToDisplay[0])\n .filter(Boolean);\n}\n\nexport default buildPropsToDisplayArray;\n"],"mappings":";;;;;;;;;;AAAA,SAASA,wBAAwBA,CAAA,EAAsB;EAAA,IAArBC,cAAc,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EACnD,OAAOD,cAAc,CAClBI,GAAG,CAAC,UAAAC,IAAI;IAAA,OAAI,CAAC,CAACA,IAAI,IAAI,CAAC,CAACA,IAAI,CAACC,mBAAmB,IAAID,IAAI,CAACC,mBAAmB,CAAC,CAAC,CAAC;EAAA,EAAC,CAChFC,MAAM,CAACC,OAAO,CAAC;AACpB;AAAC,IAAAC,QAAA,GAEcV,wBAAwB;AAAAW,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-user-layer.js","names":["getValue","propertiesToDisplay","getUser","split","baseProp","nestedProp","baseValue","isArray","Array","nestedValue","length","map","nested","join","checkAndSetProps","userPropsToDisplay","userDataLayer","forEach","prop","label","staticMetric","value","buildUserLayer","userData","user"],"sources":["../../src/helpers/build-user-layer.js"],"sourcesContent":["const getValue = (propertiesToDisplay, getUser) => {\n const [baseProp, nestedProp] = propertiesToDisplay[0].split('.');\n const baseValue = getUser[baseProp];\n const isArray = Array.isArray(baseValue);\n if (nestedProp && baseValue) {\n let nestedValue;\n if (isArray) {\n nestedValue = baseValue.length\n ? baseValue.map(nested => (nested ? nested[nestedProp] : '')).join(', ')\n : '';\n } else {\n nestedValue = baseValue[nestedProp];\n }\n return nestedValue || '';\n }\n return baseValue || '';\n};\n\nconst checkAndSetProps = (userPropsToDisplay, getUser) => {\n const userDataLayer = {};\n userPropsToDisplay.forEach(prop => {\n const { propertiesToDisplay, label, staticMetric } = prop;\n if (staticMetric) {\n userDataLayer[label] = staticMetric;\n return;\n }\n if (!propertiesToDisplay[0]) return;\n const value = getValue(propertiesToDisplay, getUser);\n userDataLayer[label] = value;\n });\n\n return userDataLayer;\n};\n\nconst buildUserLayer = (userData, userPropsToDisplay) => {\n if (!userData || !userData.getUser) return {};\n const { getUser } = userData;\n\n const userDataLayer = checkAndSetProps(userPropsToDisplay, getUser);\n\n return { user: userDataLayer };\n};\n\nexport default buildUserLayer;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAMA,QAAQ,GAAG,SAAXA,
|
|
1
|
+
{"version":3,"file":"build-user-layer.js","names":["getValue","propertiesToDisplay","getUser","_propertiesToDisplay$","split","_propertiesToDisplay$2","_slicedToArray2","baseProp","nestedProp","baseValue","isArray","Array","nestedValue","length","map","nested","join","checkAndSetProps","userPropsToDisplay","userDataLayer","forEach","prop","label","staticMetric","value","buildUserLayer","userData","user","_default","exports"],"sources":["../../src/helpers/build-user-layer.js"],"sourcesContent":["const getValue = (propertiesToDisplay, getUser) => {\n const [baseProp, nestedProp] = propertiesToDisplay[0].split('.');\n const baseValue = getUser[baseProp];\n const isArray = Array.isArray(baseValue);\n if (nestedProp && baseValue) {\n let nestedValue;\n if (isArray) {\n nestedValue = baseValue.length\n ? baseValue.map(nested => (nested ? nested[nestedProp] : '')).join(', ')\n : '';\n } else {\n nestedValue = baseValue[nestedProp];\n }\n return nestedValue || '';\n }\n return baseValue || '';\n};\n\nconst checkAndSetProps = (userPropsToDisplay, getUser) => {\n const userDataLayer = {};\n userPropsToDisplay.forEach(prop => {\n const { propertiesToDisplay, label, staticMetric } = prop;\n if (staticMetric) {\n userDataLayer[label] = staticMetric;\n return;\n }\n if (!propertiesToDisplay[0]) return;\n const value = getValue(propertiesToDisplay, getUser);\n userDataLayer[label] = value;\n });\n\n return userDataLayer;\n};\n\nconst buildUserLayer = (userData, userPropsToDisplay) => {\n if (!userData || !userData.getUser) return {};\n const { getUser } = userData;\n\n const userDataLayer = checkAndSetProps(userPropsToDisplay, getUser);\n\n return { user: userDataLayer };\n};\n\nexport default buildUserLayer;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAIC,mBAAmB,EAAEC,OAAO,EAAK;EACjD,IAAAC,qBAAA,GAA+BF,mBAAmB,CAAC,CAAC,CAAC,CAACG,KAAK,CAAC,GAAG,CAAC;IAAAC,sBAAA,OAAAC,eAAA,aAAAH,qBAAA;IAAzDI,QAAQ,GAAAF,sBAAA;IAAEG,UAAU,GAAAH,sBAAA;EAC3B,IAAMI,SAAS,GAAGP,OAAO,CAACK,QAAQ,CAAC;EACnC,IAAMG,OAAO,GAAGC,KAAK,CAACD,OAAO,CAACD,SAAS,CAAC;EACxC,IAAID,UAAU,IAAIC,SAAS,EAAE;IAC3B,IAAIG,WAAW;IACf,IAAIF,OAAO,EAAE;MACXE,WAAW,GAAGH,SAAS,CAACI,MAAM,GAC1BJ,SAAS,CAACK,GAAG,CAAC,UAAAC,MAAM;QAAA,OAAKA,MAAM,GAAGA,MAAM,CAACP,UAAU,CAAC,GAAG,EAAE;MAAA,CAAC,CAAC,CAACQ,IAAI,CAAC,IAAI,CAAC,GACtE,EAAE;IACR,CAAC,MAAM;MACLJ,WAAW,GAAGH,SAAS,CAACD,UAAU,CAAC;IACrC;IACA,OAAOI,WAAW,IAAI,EAAE;EAC1B;EACA,OAAOH,SAAS,IAAI,EAAE;AACxB,CAAC;AAED,IAAMQ,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAIC,kBAAkB,EAAEhB,OAAO,EAAK;EACxD,IAAMiB,aAAa,GAAG,CAAC,CAAC;EACxBD,kBAAkB,CAACE,OAAO,CAAC,UAAAC,IAAI,EAAI;IACjC,IAAQpB,mBAAmB,GAA0BoB,IAAI,CAAjDpB,mBAAmB;MAAEqB,KAAK,GAAmBD,IAAI,CAA5BC,KAAK;MAAEC,YAAY,GAAKF,IAAI,CAArBE,YAAY;IAChD,IAAIA,YAAY,EAAE;MAChBJ,aAAa,CAACG,KAAK,CAAC,GAAGC,YAAY;MACnC;IACF;IACA,IAAI,CAACtB,mBAAmB,CAAC,CAAC,CAAC,EAAE;IAC7B,IAAMuB,KAAK,GAAGxB,QAAQ,CAACC,mBAAmB,EAAEC,OAAO,CAAC;IACpDiB,aAAa,CAACG,KAAK,CAAC,GAAGE,KAAK;EAC9B,CAAC,CAAC;EAEF,OAAOL,aAAa;AACtB,CAAC;AAED,IAAMM,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,QAAQ,EAAER,kBAAkB,EAAK;EACvD,IAAI,CAACQ,QAAQ,IAAI,CAACA,QAAQ,CAACxB,OAAO,EAAE,OAAO,CAAC,CAAC;EAC7C,IAAQA,OAAO,GAAKwB,QAAQ,CAApBxB,OAAO;EAEf,IAAMiB,aAAa,GAAGF,gBAAgB,CAACC,kBAAkB,EAAEhB,OAAO,CAAC;EAEnE,OAAO;IAAEyB,IAAI,EAAER;EAAc,CAAC;AAChC,CAAC;AAAC,IAAAS,QAAA,GAEaH,cAAc;AAAAI,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-user-query-props.js","names":["buildUserQueryProps","userProps","length","basicProps","nestedProps","forEach","propertiesToDisplay","propKey","indexOf","split","baseProp","nestedProp","push","Object","keys","nestedKey","nested","prop","join"],"sources":["../../src/helpers/build-user-query-props.js"],"sourcesContent":["const buildUserQueryProps = userProps => {\n if (!userProps || !userProps.length) return '';\n const basicProps = [];\n const nestedProps = {};\n userProps.forEach(({ propertiesToDisplay }) => {\n const [propKey] = propertiesToDisplay;\n if (!propKey || propKey === 'id') return;\n if (propKey.indexOf('.') !== -1) {\n const [baseProp, nestedProp] = propKey.split('.');\n if (nestedProps[baseProp]) nestedProps[baseProp].push(nestedProp);\n else nestedProps[baseProp] = [nestedProp];\n } else basicProps.push(propKey);\n });\n\n Object.keys(nestedProps).forEach(nestedKey => {\n const nested = nestedProps[nestedKey];\n basicProps.push(nestedKey);\n basicProps.push('{');\n nested.forEach(prop => basicProps.push(prop));\n basicProps.push('}');\n });\n\n return basicProps.join(' ');\n};\n\nexport default buildUserQueryProps;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAMA,mBAAmB,GAAG,SAAtBA,
|
|
1
|
+
{"version":3,"file":"build-user-query-props.js","names":["buildUserQueryProps","userProps","length","basicProps","nestedProps","forEach","_ref","propertiesToDisplay","_propertiesToDisplay","_slicedToArray2","propKey","indexOf","_propKey$split","split","_propKey$split2","baseProp","nestedProp","push","Object","keys","nestedKey","nested","prop","join","_default","exports"],"sources":["../../src/helpers/build-user-query-props.js"],"sourcesContent":["const buildUserQueryProps = userProps => {\n if (!userProps || !userProps.length) return '';\n const basicProps = [];\n const nestedProps = {};\n userProps.forEach(({ propertiesToDisplay }) => {\n const [propKey] = propertiesToDisplay;\n if (!propKey || propKey === 'id') return;\n if (propKey.indexOf('.') !== -1) {\n const [baseProp, nestedProp] = propKey.split('.');\n if (nestedProps[baseProp]) nestedProps[baseProp].push(nestedProp);\n else nestedProps[baseProp] = [nestedProp];\n } else basicProps.push(propKey);\n });\n\n Object.keys(nestedProps).forEach(nestedKey => {\n const nested = nestedProps[nestedKey];\n basicProps.push(nestedKey);\n basicProps.push('{');\n nested.forEach(prop => basicProps.push(prop));\n basicProps.push('}');\n });\n\n return basicProps.join(' ');\n};\n\nexport default buildUserQueryProps;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAGC,SAAS,EAAI;EACvC,IAAI,CAACA,SAAS,IAAI,CAACA,SAAS,CAACC,MAAM,EAAE,OAAO,EAAE;EAC9C,IAAMC,UAAU,GAAG,EAAE;EACrB,IAAMC,WAAW,GAAG,CAAC,CA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AAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-gtm-events.js","names":["filterGtmEvents","gtmEvents","clickEvents","regularEvents","forEach","event","eventTrigger","ON_CLICK","push"],"sources":["../../src/helpers/filter-gtm-events.js"],"sourcesContent":["import { ON_CLICK } from '../constants';\n\nconst filterGtmEvents = gtmEvents => {\n const clickEvents = [];\n const regularEvents = [];\n gtmEvents.forEach(event => {\n event.eventTrigger && event.eventTrigger === ON_CLICK\n ? clickEvents.push(event)\n : regularEvents.push(event);\n });\n\n return { clickEvents, regularEvents };\n};\n\nexport default filterGtmEvents;\n"],"mappings":";;;;;;;;;;AAAA;AAEA,
|
|
1
|
+
{"version":3,"file":"filter-gtm-events.js","names":["_constants","require","filterGtmEvents","gtmEvents","clickEvents","regularEvents","forEach","event","eventTrigger","ON_CLICK","push","_default","exports"],"sources":["../../src/helpers/filter-gtm-events.js"],"sourcesContent":["import { ON_CLICK } from '../constants';\n\nconst filterGtmEvents = gtmEvents => {\n const clickEvents = [];\n const regularEvents = [];\n gtmEvents.forEach(event => {\n event.eventTrigger && event.eventTrigger === ON_CLICK\n ? clickEvents.push(event)\n : regularEvents.push(event);\n });\n\n return { clickEvents, regularEvents };\n};\n\nexport default filterGtmEvents;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAGC,SAAS,EAAI;EACnC,IAAMC,WAAW,GAAG,EAAE;EACtB,IAAMC,aAAa,GAAG,EAAE;EACxBF,SAAS,CAACG,OAAO,CAAC,UAAAC,KAAK,EAAI;IACzBA,KAAK,CAACC,YAAY,IAAID,KAAK,CAACC,YAAY,KAAKC,mBAAQ,GACjDL,WAAW,CAACM,IAAI,CAACH,KAAK,CAAC,GACvBF,aAAa,CAACK,IAAI,CAACH,KAAK,CAAC;EAC/B,CAAC,CAAC;EAEF,OAAO;IAAEH,WAAW,EAAXA,WAAW;IAAEC,aAAa,EAAbA;EAAc,CAAC;AACvC,CAAC;AAAC,IAAAM,QAAA,GAEaT,eAAe;AAAAU,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-ids-to-use.js","names":["getIdsToUse","parentData","length","map","id"],"sources":["../../src/helpers/get-ids-to-use.js"],"sourcesContent":["const getIdsToUse = parentData => {\n if (!parentData || !parentData.length) return [];\n\n return parentData.map(({ id }) => id);\n};\n\nexport default getIdsToUse;\n"],"mappings":";;;;;;;;AAAA,IAAMA,WAAW,GAAG,SAAdA,
|
|
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,GAEaN,WAAW;AAAAO,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-render-props.js","names":["getRenderProps","extraProps","isPreview","data","useMultiQuery","getEntitySchema","actions","get","getPublished","getAll","getAllPublished","queryToUse","generateMultiItemQuery","generateSingleItemQuery","singleActionKey","multiActionKey","actionKey","action"],"sources":["../../src/helpers/get-render-props.js"],"sourcesContent":["import { generateSingleItemQuery, generateMultiItemQuery } from '@blaze-cms/react-page-builder';\n\nconst getRenderProps = (extraProps, isPreview, data, useMultiQuery) => {\n const { getEntitySchema } = data;\n const {\n actions: { get, getPublished, getAll, getAllPublished }\n } = getEntitySchema;\n const queryToUse = useMultiQuery ? generateMultiItemQuery : generateSingleItemQuery;\n const singleActionKey = isPreview ? get : getPublished || get;\n const multiActionKey = isPreview ? getAll : getAllPublished || getAll;\n const actionKey = useMultiQuery ? multiActionKey : singleActionKey;\n const action = queryToUse(actionKey, extraProps);\n\n return { action, actionKey };\n};\n\nexport default getRenderProps;\n"],"mappings":";;;;;;;AAAA;AAEA,
|
|
1
|
+
{"version":3,"file":"get-render-props.js","names":["_reactPageBuilder","require","getRenderProps","extraProps","isPreview","data","useMultiQuery","getEntitySchema","_getEntitySchema$acti","actions","get","getPublished","getAll","getAllPublished","queryToUse","generateMultiItemQuery","generateSingleItemQuery","singleActionKey","multiActionKey","actionKey","action","_default","exports"],"sources":["../../src/helpers/get-render-props.js"],"sourcesContent":["import { generateSingleItemQuery, generateMultiItemQuery } from '@blaze-cms/react-page-builder';\n\nconst getRenderProps = (extraProps, isPreview, data, useMultiQuery) => {\n const { getEntitySchema } = data;\n const {\n actions: { get, getPublished, getAll, getAllPublished }\n } = getEntitySchema;\n const queryToUse = useMultiQuery ? generateMultiItemQuery : generateSingleItemQuery;\n const singleActionKey = isPreview ? get : getPublished || get;\n const multiActionKey = isPreview ? getAll : getAllPublished || getAll;\n const actionKey = useMultiQuery ? multiActionKey : singleActionKey;\n const action = queryToUse(actionKey, extraProps);\n\n return { action, actionKey };\n};\n\nexport default getRenderProps;\n"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,UAAU,EAAEC,SAAS,EAAEC,IAAI,EAAEC,aAAa,EAAK;EACrE,IAAQC,eAAe,GAAKF,IAAI,CAAxBE,eAAe;EACvB,IAAAC,qBAAA,GAEID,eAAe,CADjBE,OAAO;IAAIC,GAAG,GAAAF,qBAAA,CAAHE,GAAG;IAAEC,YAAY,GAAAH,qBAAA,CAAZG,YAAY;IAAEC,MAAM,GAAAJ,qBAAA,CAANI,MAAM;IAAEC,eAAe,GAAAL,qBAAA,CAAfK,eAAe;EAEvD,IAAMC,UAAU,GAAGR,aAAa,GAAGS,wCAAsB,GAAGC,yCAAuB;EACnF,IAAMC,eAAe,GAAGb,SAAS,GAAGM,GAAG,GAAGC,YAAY,IAAID,GAAG;EAC7D,IAAMQ,cAAc,GAAGd,SAAS,GAAGQ,MAAM,GAAGC,eAAe,IAAID,MAAM;EACrE,IAAMO,SAAS,GAAGb,aAAa,GAAGY,cAAc,GAAGD,eAAe;EAClE,IAAMG,MAAM,GAAGN,UAAU,CAACK,SAAS,EAAEhB,UAAU,CAAC;EAEhD,OAAO;IAAEiB,MAAM,EAANA,MAAM;IAAED,SAAS,EAATA;EAAU,CAAC;AAC9B,CAAC;AAAC,IAAAE,QAAA,GAEanB,cAAc;AAAAoB,OAAA,cAAAD,QAAA"}
|
package/lib/helpers/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/helpers/index.js"],"sourcesContent":["export { default as buildDataLayer } from './build-data-layer';\nexport { default as pushToDataLayer } from './push-to-data-layer';\nexport { default as buildNestedEvent } from './build-nested-event';\nexport { default as getRenderProps } from './get-render-props';\nexport { default as getIdsToUse } from './get-ids-to-use';\nexport { default as buildPropsToDisplayArray } from './build-props-to-display-array';\nexport { default as buildAndPushWebVitals } from './build-and-push-web-vitals';\nexport { default as filterGtmEvents } from './filter-gtm-events';\nexport { default as buildUserQueryProps } from './build-user-query-props';\nexport { default as buildUserLayer } from './build-user-layer';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_buildDataLayer","_interopRequireDefault","require","_pushToDataLayer","_buildNestedEvent","_getRenderProps","_getIdsToUse","_buildPropsToDisplayArray","_buildAndPushWebVitals","_filterGtmEvents","_buildUserQueryProps","_buildUserLayer"],"sources":["../../src/helpers/index.js"],"sourcesContent":["export { default as buildDataLayer } from './build-data-layer';\nexport { default as pushToDataLayer } from './push-to-data-layer';\nexport { default as buildNestedEvent } from './build-nested-event';\nexport { default as getRenderProps } from './get-render-props';\nexport { default as getIdsToUse } from './get-ids-to-use';\nexport { default as buildPropsToDisplayArray } from './build-props-to-display-array';\nexport { default as buildAndPushWebVitals } from './build-and-push-web-vitals';\nexport { default as filterGtmEvents } from './filter-gtm-events';\nexport { default as buildUserQueryProps } from './build-user-query-props';\nexport { default as buildUserLayer } from './build-user-layer';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,YAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,yBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,sBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,gBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,oBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,eAAA,GAAAV,sBAAA,CAAAC,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push-to-data-layer.js","names":["pushToDataLayer","dataLayer","isPageView","window","resetDataLayer","push"],"sources":["../../src/helpers/push-to-data-layer.js"],"sourcesContent":["import resetDataLayer from './reset-data-layer';\n\nconst pushToDataLayer = (dataLayer, isPageView) => {\n if (dataLayer && window.dataLayer) {\n if (isPageView) resetDataLayer();\n window.dataLayer.push(dataLayer);\n }\n};\n\nexport default pushToDataLayer;\n"],"mappings":";;;;;;;;AAAA;AAEA,
|
|
1
|
+
{"version":3,"file":"push-to-data-layer.js","names":["_resetDataLayer","_interopRequireDefault","require","pushToDataLayer","dataLayer","isPageView","window","resetDataLayer","push","_default","exports"],"sources":["../../src/helpers/push-to-data-layer.js"],"sourcesContent":["import resetDataLayer from './reset-data-layer';\n\nconst pushToDataLayer = (dataLayer, isPageView) => {\n if (dataLayer && window.dataLayer) {\n if (isPageView) resetDataLayer();\n window.dataLayer.push(dataLayer);\n }\n};\n\nexport default pushToDataLayer;\n"],"mappings":";;;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,SAAS,EAAEC,UAAU,EAAK;EACjD,IAAID,SAAS,IAAIE,MAAM,CAACF,SAAS,EAAE;IACjC,IAAIC,UAAU,EAAE,IAAAE,0BAAc,GAAE;IAChCD,MAAM,CAACF,SAAS,CAACI,IAAI,CAACJ,SAAS,CAAC;EAClC;AACF,CAAC;AAAC,IAAAK,QAAA,GAEaN,eAAe;AAAAO,OAAA,cAAAD,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reset-data-layer.js","names":["resetDataLayer","shouldReset","window","dataLayer","length","gtmIdRegex","keys","Object","google_tag_manager","GTMkeys","filter","key","test","forEach","GTMkey","reset","find","event","PAGE_VIEW"],"sources":["../../src/helpers/reset-data-layer.js"],"sourcesContent":["import { PAGE_VIEW } from '../constants';\n\nconst resetDataLayer = () => {\n if (!shouldReset()) return false;\n\n window.dataLayer.length = 0;\n const gtmIdRegex = /GTM-/i;\n const keys = Object.keys(window.google_tag_manager);\n const GTMkeys = keys.filter(\n key => gtmIdRegex.test(key) && window.google_tag_manager[key].dataLayer\n );\n GTMkeys.forEach(GTMkey => window.google_tag_manager[GTMkey].dataLayer.reset());\n\n return true;\n};\n\nfunction shouldReset() {\n return (\n window.google_tag_manager &&\n window.dataLayer &&\n window.dataLayer.find(({ event }) => event === PAGE_VIEW)\n );\n}\n\nexport default resetDataLayer;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAEA,
|
|
1
|
+
{"version":3,"file":"reset-data-layer.js","names":["_constants","require","resetDataLayer","shouldReset","window","dataLayer","length","gtmIdRegex","keys","Object","google_tag_manager","GTMkeys","filter","key","test","forEach","GTMkey","reset","find","_ref","event","PAGE_VIEW","_default","exports"],"sources":["../../src/helpers/reset-data-layer.js"],"sourcesContent":["import { PAGE_VIEW } from '../constants';\n\nconst resetDataLayer = () => {\n if (!shouldReset()) return false;\n\n window.dataLayer.length = 0;\n const gtmIdRegex = /GTM-/i;\n const keys = Object.keys(window.google_tag_manager);\n const GTMkeys = keys.filter(\n key => gtmIdRegex.test(key) && window.google_tag_manager[key].dataLayer\n );\n GTMkeys.forEach(GTMkey => window.google_tag_manager[GTMkey].dataLayer.reset());\n\n return true;\n};\n\nfunction shouldReset() {\n return (\n window.google_tag_manager &&\n window.dataLayer &&\n window.dataLayer.find(({ event }) => event === PAGE_VIEW)\n );\n}\n\nexport default resetDataLayer;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAA,EAAS;EAC3B,IAAI,CAACC,WAAW,EAAE,EAAE,OAAO,KAAK;EAEhCC,MAAM,CAACC,SAAS,CAACC,MAAM,GAAG,CAAC;EAC3B,IAAMC,UAAU,GAAG,OAAO;EAC1B,IAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACJ,MAAM,CAACM,kBAAkB,CAAC;EACnD,IAAMC,OAAO,GAAGH,IAAI,CAACI,MAAM,CACzB,UAAAC,GAAG;IAAA,OAAIN,UAAU,CAACO,IAAI,CAACD,GAAG,CAAC,IAAIT,MAAM,CAACM,kBAAkB,CAACG,GAAG,CAAC,CAACR,SAAS;EAAA,EACxE;EACDM,OAAO,CAACI,OAAO,CAAC,UAAAC,MAAM;IAAA,OAAIZ,MAAM,CAACM,kBAAkB,CAACM,MAAM,CAAC,CAACX,SAAS,CAACY,KAAK,EAAE;EAAA,EAAC;EAE9E,OAAO,IAAI;AACb,CAAC;AAED,SAASd,WAAWA,CAAA,EAAG;EACrB,OACEC,MAAM,CAACM,kBAAkB,IACzBN,MAAM,CAACC,SAAS,IAChBD,MAAM,CAACC,SAAS,CAACa,IAAI,CAAC,UAAAC,IAAA;IAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAA,OAAOA,KAAK,KAAKC,oBAAS;EAAA,EAAC;AAE7D;AAAC,IAAAC,QAAA,GAEcpB,cAAc;AAAAqB,OAAA,cAAAD,QAAA"}
|
package/lib/index.js
CHANGED
|
@@ -27,35 +27,33 @@ function load(_x) {
|
|
|
27
27
|
function _load() {
|
|
28
28
|
_load = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(app) {
|
|
29
29
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
30
|
-
while (1) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
addComponent({
|
|
43
|
-
key: 'gtm-events',
|
|
44
|
-
component: (0, _dynamic["default"])(function () {
|
|
45
|
-
return Promise.resolve().then(function () {
|
|
46
|
-
return _interopRequireWildcard(require( /* webpackChunkName: "blazePbGoogleTagManagerEvent" */'./GoogleTagManagerEvent'));
|
|
47
|
-
});
|
|
48
|
-
})
|
|
49
|
-
});
|
|
30
|
+
while (1) switch (_context.prev = _context.next) {
|
|
31
|
+
case 0:
|
|
32
|
+
app.events.once('load:custom:page-builder:component', function (addComponent) {
|
|
33
|
+
addComponent({
|
|
34
|
+
key: 'gtm',
|
|
35
|
+
component: (0, _dynamic["default"])(function () {
|
|
36
|
+
return Promise.resolve().then(function () {
|
|
37
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "blazePbGoogleTagManager" */'./GoogleTagManager'));
|
|
38
|
+
});
|
|
39
|
+
})
|
|
50
40
|
});
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
addComponent({
|
|
42
|
+
key: 'gtm-events',
|
|
43
|
+
component: (0, _dynamic["default"])(function () {
|
|
44
|
+
return Promise.resolve().then(function () {
|
|
45
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "blazePbGoogleTagManagerEvent" */'./GoogleTagManagerEvent'));
|
|
46
|
+
});
|
|
47
|
+
})
|
|
54
48
|
});
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
});
|
|
50
|
+
return _context.abrupt("return", {
|
|
51
|
+
name: _constants.PLUGIN_NAME,
|
|
52
|
+
version: _package["default"].version
|
|
53
|
+
});
|
|
54
|
+
case 2:
|
|
55
|
+
case "end":
|
|
56
|
+
return _context.stop();
|
|
59
57
|
}
|
|
60
58
|
}, _callee);
|
|
61
59
|
}));
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["load","app","events","once","addComponent","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_dynamic","_interopRequireDefault","require","_package","_constants","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","_interopRequireWildcard","obj","__esModule","_typeof2","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","load","_x","_load","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee","app","wrap","_callee$","_context","prev","next","events","once","addComponent","component","dynamic","Promise","resolve","then","abrupt","name","PLUGIN_NAME","version","pkg","stop","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import dynamic from 'next/dynamic';\n\nimport pkg from '../package.json';\nimport { PLUGIN_NAME } from './constants';\n\nexport default async function load(app) {\n app.events.once('load:custom:page-builder:component', addComponent => {\n addComponent({\n key: 'gtm',\n component: dynamic(() =>\n import(/* webpackChunkName: \"blazePbGoogleTagManager\" */ './GoogleTagManager')\n )\n });\n addComponent({\n key: 'gtm-events',\n component: dynamic(() =>\n import(/* webpackChunkName: \"blazePbGoogleTagManagerEvent\" */ './GoogleTagManagerEvent')\n )\n });\n });\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAA0C,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAI,wBAAAC,GAAA,EAAAL,WAAA,SAAAA,WAAA,IAAAK,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,iBAAAE,QAAA,aAAAF,GAAA,yBAAAA,GAAA,uCAAAA,GAAA,UAAAG,KAAA,GAAAT,wBAAA,CAAAC,WAAA,OAAAQ,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR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,CAAAW,MAAA,WAEI;YACLC,IAAI,EAAEC,sBAAW;YACjBC,OAAO,EAAEC,mBAAG,CAACD;UACf,CAAC;QAAA;QAAA;UAAA,OAAAd,QAAA,CAAAgB,IAAA;MAAA;IAAA,GAAApB,OAAA;EAAA,CACF;EAAA,OAAAN,KAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAEDJ,IAAI,CAAC6B,UAAU,GAAGJ,sBAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMFactory.js","names":["React","useContext","PropTypes","useQuery","getSingleEntitySchema","buildPropsQuery","MainContext","GTMRender","getRenderProps","buildPropsToDisplayArray","GTMFactory","propsToDisplay","userPropsToDisplay","parent","gtmWebVitals","isPreview","data","error","loading","variables","id","itemEntity","window","propsToDisplayArr","extraProps","action","actionKey","itemId","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,
|
|
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,EACxB;AAEN,CAAC;AAEDJ,UAAU,CAACqB,SAAS,GAAG;EACrBpB,cAAc,EAAET,SAAS,CAAC8B,KAAK;EAC/BpB,kBAAkB,EAAEV,SAAS,CAAC8B,KAAK;EACnCnB,MAAM,EAAEX,SAAS,CAAC+B,MAAM,CAACC,UAAU;EACnCpB,YAAY,EAAEZ,SAAS,CAACiC;AAC1B,CAAC;AAEDzB,UAAU,CAAC0B,YAAY,GAAG;EACxBzB,cAAc,EAAE,EAAE;EAClBC,kBAAkB,EAAE,EAAE;EACtBE,YAAY,EAAE;AAChB,CAAC;AAED,eAAeJ,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMRender.js","names":["useState","PropTypes","useQuery","withRouter","getUser","checkIfLoggedIn","buildDataLayer","buildAndPushWebVitals","pushToDataLayer","buildUserQueryProps","buildUserLayer","GTMRender","router","action","propsToDisplay","parentId","webVitals","userPropsToDisplay","asPath","currentLocation","setCurrentLocation","url","shouldPushLayer","data","error","loading","variables","id","userId","hasUserProps","length","userProps","userData","userLoading","skip","entityData","message","dataLayerObject","userLayerObject","extendedDataLayer","propTypes","array","isRequired","object","string","bool"],"sources":["../../src/GoogleTagManager/GTMRender.js"],"sourcesContent":["import { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { withRouter } from 'next/router';\nimport { getUser } from '@blaze-cms/react-page-builder';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport {\n buildDataLayer,\n buildAndPushWebVitals,\n pushToDataLayer,\n buildUserQueryProps,\n buildUserLayer\n} from '../helpers';\n\nconst GTMRender = ({ router, action, propsToDisplay, parentId, webVitals, userPropsToDisplay }) => {\n const { asPath } = router;\n const [currentLocation, setCurrentLocation] = useState({ url: '', shouldPushLayer: false });\n\n const { data, error, loading } = useQuery(action, {\n variables: { id: parentId }\n });\n const { id: userId } = checkIfLoggedIn();\n const hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;\n const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';\n const { data: userData, loading: userLoading } = useQuery(getUser(userProps), {\n variables: { id: userId },\n skip: !hasUserProps\n });\n\n if (loading || userLoading || !data || !data.entityData) return null;\n if (data.entityData.id !== parentId) return null;\n if (error) return error.message;\n if (currentLocation.url !== asPath) setCurrentLocation({ url: asPath, shouldPushLayer: true });\n if (!currentLocation.shouldPushLayer) return null;\n\n const { entityData } = data;\n const dataLayerObject = buildDataLayer(entityData, propsToDisplay, currentLocation.url);\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n if (webVitals) buildAndPushWebVitals();\n pushToDataLayer(extendedDataLayer, true);\n setCurrentLocation({ ...currentLocation, shouldPushLayer: false });\n\n return null;\n};\n\nGTMRender.propTypes = {\n userPropsToDisplay: PropTypes.array.isRequired,\n action: PropTypes.object.isRequired,\n propsToDisplay: PropTypes.array.isRequired,\n parentId: PropTypes.string.isRequired,\n webVitals: PropTypes.bool.isRequired\n};\n\nexport default withRouter(GTMRender);\n"],"mappings":";;;AAAA,SAASA,QAAQ,QAAQ,OAAO;AAChC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,OAAO,QAAQ,+BAA+B;AACvD,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SACEC,cAAc,EACdC,qBAAqB,EACrBC,eAAe,EACfC,mBAAmB,EACnBC,cAAc,QACT,YAAY;AAEnB,MAAMC,SAAS,
|
|
1
|
+
{"version":3,"file":"GTMRender.js","names":["useState","PropTypes","useQuery","withRouter","getUser","checkIfLoggedIn","buildDataLayer","buildAndPushWebVitals","pushToDataLayer","buildUserQueryProps","buildUserLayer","GTMRender","router","action","propsToDisplay","parentId","webVitals","userPropsToDisplay","asPath","currentLocation","setCurrentLocation","url","shouldPushLayer","data","error","loading","variables","id","userId","hasUserProps","length","userProps","userData","userLoading","skip","entityData","message","dataLayerObject","userLayerObject","extendedDataLayer","_objectSpread","propTypes","array","isRequired","object","string","bool"],"sources":["../../src/GoogleTagManager/GTMRender.js"],"sourcesContent":["import { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { withRouter } from 'next/router';\nimport { getUser } from '@blaze-cms/react-page-builder';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport {\n buildDataLayer,\n buildAndPushWebVitals,\n pushToDataLayer,\n buildUserQueryProps,\n buildUserLayer\n} from '../helpers';\n\nconst GTMRender = ({ router, action, propsToDisplay, parentId, webVitals, userPropsToDisplay }) => {\n const { asPath } = router;\n const [currentLocation, setCurrentLocation] = useState({ url: '', shouldPushLayer: false });\n\n const { data, error, loading } = useQuery(action, {\n variables: { id: parentId }\n });\n const { id: userId } = checkIfLoggedIn();\n const hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;\n const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';\n const { data: userData, loading: userLoading } = useQuery(getUser(userProps), {\n variables: { id: userId },\n skip: !hasUserProps\n });\n\n if (loading || userLoading || !data || !data.entityData) return null;\n if (data.entityData.id !== parentId) return null;\n if (error) return error.message;\n if (currentLocation.url !== asPath) setCurrentLocation({ url: asPath, shouldPushLayer: true });\n if (!currentLocation.shouldPushLayer) return null;\n\n const { entityData } = data;\n const dataLayerObject = buildDataLayer(entityData, propsToDisplay, currentLocation.url);\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n if (webVitals) buildAndPushWebVitals();\n pushToDataLayer(extendedDataLayer, true);\n setCurrentLocation({ ...currentLocation, shouldPushLayer: false });\n\n return null;\n};\n\nGTMRender.propTypes = {\n userPropsToDisplay: PropTypes.array.isRequired,\n action: PropTypes.object.isRequired,\n propsToDisplay: PropTypes.array.isRequired,\n parentId: PropTypes.string.isRequired,\n webVitals: PropTypes.bool.isRequired\n};\n\nexport default withRouter(GTMRender);\n"],"mappings":";;;AAAA,SAASA,QAAQ,QAAQ,OAAO;AAChC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,OAAO,QAAQ,+BAA+B;AACvD,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SACEC,cAAc,EACdC,qBAAqB,EACrBC,eAAe,EACfC,mBAAmB,EACnBC,cAAc,QACT,YAAY;AAEnB,MAAMC,SAAS,GAAGA,CAAC;EAAEC,MAAM;EAAEC,MAAM;EAAEC,cAAc;EAAEC,QAAQ;EAAEC,SAAS;EAAEC;AAAmB,CAAC,KAAK;EACjG,MAAM;IAAEC;EAAO,CAAC,GAAGN,MAAM;EACzB,MAAM,CAACO,eAAe,EAAEC,kBAAkB,CAAC,GAAGpB,QAAQ,CAAC;IAAEqB,GAAG,EAAE,EAAE;IAAEC,eAAe,EAAE;EAAM,CAAC,CAAC;EAE3F,MAAM;IAAEC,IAAI;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGvB,QAAQ,CAACW,MAAM,EAAE;IAChDa,SAAS,EAAE;MAAEC,EAAE,EAAEZ;IAAS;EAC5B,CAAC,CAAC;EACF,MAAM;IA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C;EACxCnB,kBAAkB,CAAAoB,aAAA,CAAAA,aAAA,KAAMrB,eAAe;IAAEG,eAAe,EAAE;EAAK,GAAG;EAElE,OAAO,IAAI;AACb,CAAC;AAEDX,SAAS,CAAC8B,SAAS,GAAG;EACpBxB,kBAAkB,EAAEhB,SAAS,CAACyC,KAAK,CAACC,UAAU;EAC9C9B,MAAM,EAAEZ,SAAS,CAAC2C,MAAM,CAACD,UAAU;EACnC7B,cAAc,EAAEb,SAAS,CAACyC,KAAK,CAACC,UAAU;EAC1C5B,QAAQ,EAAEd,SAAS,CAAC4C,MAAM,CAACF,UAAU;EACrC3B,SAAS,EAAEf,SAAS,CAAC6C,IAAI,CAACH;AAC5B,CAAC;AAED,eAAexC,UAAU,CAACQ,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMClickEvent.js","names":["React","PropTypes","useQuery","checkIfLoggedIn","getUser","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","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 { getUser } 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(getUser(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,OAAO,QAAQ,+BAA+B;AACvD,OAAOC,QAAQ,MAAM,YAAY;AACjC,SAASC,cAAc,EAAEC,gBAAgB,EAAEC,mBAAmB,EAAEC,cAAc,QAAQ,YAAY;AAElG,MAAMC,aAAa,
|
|
1
|
+
{"version":3,"file":"GTMClickEvent.js","names":["React","PropTypes","useQuery","checkIfLoggedIn","getUser","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 { getUser } 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(getUser(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,OAAO,QAAQ,+BAA+B;AACvD,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,EA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","gtmEvents","componentProps","parentComponent","map","event","index","eventName","dynamicKey","join","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,
|
|
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,EACT;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"}
|
|
@@ -1 +1 @@
|
|
|
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","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 () => {\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,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,
|
|
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 () => {\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,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,CACP,MAAM;IACJY,kBAAkB,CAAC,IAAI,CAAC;EAC1B,CAAC,EACD,CAACH,eAAe,CAAC,CAClB;EACD,MAAMM,aAAa,GAAGA,CAAA,KAAM;IAC1BZ,eAAe,CAACI,eAAe,CAAC;IAChCK,kBAAkB,CAAC,KAAK,CAAC;IACzB,IAAIE,WAAW,EAAEJ,eAAe,EAAE;EACpC,CAAC;EAED,IAAI,CAACG,WAAW,IAAIF,eAAe,EAAEI,aAAa,EAAE;EAEpD,oBAAOjB,KAAA,CAAAkB,aAAA,CAAAlB,KAAA,CAAAmB,QAAA,QAAGJ,WAAW,IAAIF,eAAe,iBAAIb,KAAA,CAAAkB,aAAA,CAACd,QAAQ;IAACgB,OAAO,EAAEH;EAAc,EAAG,CAAI;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEventFactory.js","names":["React","useContext","PropTypes","useQuery","getSingleEntitySchema","buildPropsQuery","MainContext","GTMEventRender","getRenderProps","getIdsToUse","buildPropsToDisplayArray","GTM_EVENT_FACTORY","GTMEventFactory","parent","gtmEvents","parentData","clickId","parentComponent","isPreview","itemEntity","data","error","loading","variables","id","map","i","propsToDisplay","eventProps","hasNoPropsToDisplay","length","propsToDisplayArr","extraProps","shouldUseParentData","itemIdToUse","itemId","shouldUseMultiQuery","Array","isArray","action","actionKey","dynamicKey","queryVariables","where","_in","skip","propTypes","object","isRequired","string","array","oneOfType","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMEventFactory.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { getSingleEntitySchema, buildPropsQuery } from '@blaze-cms/react-page-builder';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport GTMEventRender from './GTMEventRender';\nimport { getRenderProps, getIdsToUse, buildPropsToDisplayArray } from '../helpers';\nimport { GTM_EVENT_FACTORY } from '../constants';\n\nconst GTMEventFactory = ({ parent, gtmEvents, parentData, clickId, parentComponent }) => {\n const { isPreview } = useContext(MainContext);\n const [{ itemEntity = parent.itemEntity } = {}] = parentData || [];\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: itemEntity }\n });\n\n if (loading || error || !data) return null;\n\n return gtmEvents.map(({ propsToDisplay, ...eventProps }, i) => {\n const hasNoPropsToDisplay = !propsToDisplay || !propsToDisplay.length;\n const propsToDisplayArr = buildPropsToDisplayArray(propsToDisplay);\n const extraProps = hasNoPropsToDisplay ? '' : buildPropsQuery(data, propsToDisplayArr);\n const shouldUseParentData = !clickId && parentData && parentData.length;\n const itemIdToUse = clickId || parent.itemId;\n const itemId = shouldUseParentData ? getIdsToUse(parentData) : itemIdToUse;\n const shouldUseMultiQuery = Array.isArray(itemId);\n const { action, actionKey } = getRenderProps(extraProps, isPreview, data, shouldUseMultiQuery);\n const dynamicKey = `${GTM_EVENT_FACTORY}${i}`;\n const queryVariables = shouldUseMultiQuery\n ? {\n variables: { where: { id: { _in: itemId } } },\n skip: hasNoPropsToDisplay\n }\n : {\n variables: { id: itemId },\n skip: hasNoPropsToDisplay\n };\n\n return (\n <GTMEventRender\n key={dynamicKey}\n action={action}\n actionKey={actionKey}\n propsToDisplay={propsToDisplay}\n id={itemId}\n queryVariables={queryVariables}\n parentComponent={parentComponent}\n {...eventProps}\n />\n );\n });\n};\n\nGTMEventFactory.propTypes = {\n parent: PropTypes.object.isRequired,\n clickId: PropTypes.string,\n gtmEvents: PropTypes.array,\n parentData: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),\n parentComponent: PropTypes.object\n};\n\nGTMEventFactory.defaultProps = {\n clickId: null,\n gtmEvents: [],\n parentData: null,\n parentComponent: {}\n};\n\nexport default GTMEventFactory;\n"],"mappings":";;;AAAA,OAAOA,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,
|
|
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,MAA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AAEnD,SAAS,CAACsD,KAAK,CAAC,CAAC;EACpEvC,eAAe,EAAEf,SAAS,CAACmD;AAC7B,CAAC;AAEDzC,eAAe,CAAC8C,YAAY,GAAG;EAC7B1C,OAAO,EAAE,IAAI;EACbF,SAAS,EAAE,EAAE;EACbC,UAAU,EAAE,IAAI;EAChBE,eAAe,EAAE,CAAC;AACpB,CAAC;AAED,eAAeL,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEventRender.js","names":["React","useState","PropTypes","useQuery","checkIfLoggedIn","getUser","withRouter","GTMEvent","buildDataLayer","buildNestedEvent","buildUserQueryProps","buildUserLayer","GTMEventRender","router","action","actionKey","queryVariables","parentComponent","userPropsToDisplay","handleOnSuccess","eventProps","asPath","currentLocation","setCurrentLocation","data","error","loading","id","userId","hasUserProps","length","userProps","userData","userLoading","variables","skip","gtmData","entityData","eventTrigger","propsToDisplay","eventEcommerce","dataLayerProps","dataLayerObject","userLayerObject","extendedDataLayer","propTypes","array","object","isRequired","string","func","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMEventRender.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport { getUser } from '@blaze-cms/react-page-builder';\nimport { withRouter } from 'next/router';\nimport GTMEvent from './GTMEvent';\nimport { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';\n\nconst GTMEventRender = ({\n router,\n action,\n actionKey,\n queryVariables,\n parentComponent,\n userPropsToDisplay,\n handleOnSuccess,\n ...eventProps\n}) => {\n const { asPath } = router;\n const [currentLocation, setCurrentLocation] = useState('');\n const { data = {}, error, loading } = useQuery(action, queryVariables);\n const { id: userId } = checkIfLoggedIn();\n const hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;\n const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';\n const { data: userData, loading: userLoading } = useQuery(getUser(userProps), {\n variables: { id: userId },\n skip: !hasUserProps\n });\n\n if (loading || userLoading || error) return null;\n const gtmData = data.entityData || data[actionKey];\n\n if (currentLocation !== asPath) {\n setCurrentLocation(asPath);\n return null;\n }\n\n const { eventTrigger, propsToDisplay, eventEcommerce } = eventProps;\n const dataLayerProps = buildDataLayer(gtmData, propsToDisplay);\n\n const dataLayerObject = buildNestedEvent(\n eventEcommerce,\n eventProps,\n dataLayerProps,\n parentComponent\n );\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n return (\n <GTMEvent\n dataLayerObject={extendedDataLayer}\n eventTrigger={eventTrigger}\n currentLocation={currentLocation}\n handleOnSuccess={handleOnSuccess}\n />\n );\n};\n\nGTMEventRender.propTypes = {\n userPropsToDisplay: PropTypes.array,\n router: PropTypes.object.isRequired,\n action: PropTypes.object.isRequired,\n actionKey: PropTypes.string.isRequired,\n queryVariables: PropTypes.object.isRequired,\n parentComponent: PropTypes.object.isRequired,\n handleOnSuccess: PropTypes.func\n};\n\nGTMEventRender.defaultProps = {\n userPropsToDisplay: [],\n handleOnSuccess: () => {}\n};\n\nGTMEventRender.defaultProps = {\n userPropsToDisplay: []\n};\n\nexport default withRouter(GTMEventRender);\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,OAAO,QAAQ,+BAA+B;AACvD,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,QAAQ,MAAM,YAAY;AACjC,SAASC,cAAc,EAAEC,gBAAgB,EAAEC,mBAAmB,EAAEC,cAAc,QAAQ,YAAY;AAElG,MAAMC,cAAc,
|
|
1
|
+
{"version":3,"file":"GTMEventRender.js","names":["React","useState","PropTypes","useQuery","checkIfLoggedIn","getUser","withRouter","GTMEvent","buildDataLayer","buildNestedEvent","buildUserQueryProps","buildUserLayer","GTMEventRender","_ref","router","action","actionKey","queryVariables","parentComponent","userPropsToDisplay","handleOnSuccess","eventProps","_objectWithoutProperties","_excluded","asPath","currentLocation","setCurrentLocation","data","error","loading","id","userId","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 { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport { getUser } from '@blaze-cms/react-page-builder';\nimport { withRouter } from 'next/router';\nimport GTMEvent from './GTMEvent';\nimport { buildDataLayer, buildNestedEvent, buildUserQueryProps, buildUserLayer } from '../helpers';\n\nconst GTMEventRender = ({\n router,\n action,\n actionKey,\n queryVariables,\n parentComponent,\n userPropsToDisplay,\n handleOnSuccess,\n ...eventProps\n}) => {\n const { asPath } = router;\n const [currentLocation, setCurrentLocation] = useState('');\n const { data = {}, error, loading } = useQuery(action, queryVariables);\n const { id: userId } = checkIfLoggedIn();\n const hasUserProps = userId && userPropsToDisplay && userPropsToDisplay.length;\n const userProps = hasUserProps ? buildUserQueryProps(userPropsToDisplay) : '';\n const { data: userData, loading: userLoading } = useQuery(getUser(userProps), {\n variables: { id: userId },\n skip: !hasUserProps\n });\n\n if (loading || userLoading || error) return null;\n const gtmData = data.entityData || data[actionKey];\n\n if (currentLocation !== asPath) {\n setCurrentLocation(asPath);\n return null;\n }\n\n const { eventTrigger, propsToDisplay, eventEcommerce } = eventProps;\n const dataLayerProps = buildDataLayer(gtmData, propsToDisplay);\n\n const dataLayerObject = buildNestedEvent(\n eventEcommerce,\n eventProps,\n dataLayerProps,\n parentComponent\n );\n const userLayerObject = buildUserLayer(userData, userPropsToDisplay);\n const extendedDataLayer = { ...dataLayerObject, ...userLayerObject };\n\n return (\n <GTMEvent\n dataLayerObject={extendedDataLayer}\n eventTrigger={eventTrigger}\n currentLocation={currentLocation}\n handleOnSuccess={handleOnSuccess}\n />\n );\n};\n\nGTMEventRender.propTypes = {\n userPropsToDisplay: PropTypes.array,\n router: PropTypes.object.isRequired,\n action: PropTypes.object.isRequired,\n actionKey: PropTypes.string.isRequired,\n queryVariables: PropTypes.object.isRequired,\n parentComponent: PropTypes.object.isRequired,\n handleOnSuccess: PropTypes.func\n};\n\nGTMEventRender.defaultProps = {\n userPropsToDisplay: [],\n handleOnSuccess: () => {}\n};\n\nGTMEventRender.defaultProps = {\n userPropsToDisplay: []\n};\n\nexport default withRouter(GTMEventRender);\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,eAAe,QAAQ,yBAAyB;AACzD,SAASC,OAAO,QAAQ,+BAA+B;AACvD,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAOC,QAAQ,MAAM,YAAY;AACjC,SAASC,cAAc,EAAEC,gBAAgB,EAAEC,mBAAmB,EAAEC,cAAc,QAAQ,YAAY;AAElG,MAAMC,cAAc,GAAGC,IAAA,IASjB;EAAA,IATkB;MACtBC,MAAM;MACNC,MAAM;MACNC,SAAS;MACTC,cAAc;MACdC,eAAe;MACfC,kBAAkB;MAClBC;IAEF,CAAC,GAAAP,IAAA;IADIQ,UAAU,GAAAC,wBAAA,CAAAT,IAAA,EAAAU,SAAA;EAEb,MAAM;IAAEC;EAAO,CAAC,GAAGV,MAAM;EACzB,MAAM,CAACW,eAAe,EAAEC,kBAAkB,CAAC,GAAGzB,QAAQ,CAAC,EAAE,CAAC;EAC1D,MAAM;IAAE0B,IAAI,GAAG,CAAC,CAAC;IAAEC,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kB;IACnCN,YAAY,EAAEA,YAAa;IAC3BhB,eAAe,EAAEA,eAAgB;IACjCL,eAAe,EAAEA;EAAgB,EACjC;AAEN,CAAC;AAEDR,cAAc,CAACsC,SAAS,GAAG;EACzB/B,kBAAkB,EAAEjB,SAAS,CAACiD,KAAK;EACnCrC,MAAM,EAAEZ,SAAS,CAACkD,MAAM,CAACC,UAAU;EACnCtC,MAAM,EAAEb,SAAS,CAACkD,MAAM,CAACC,UAAU;EACnCrC,SAAS,EAAEd,SAAS,CAACoD,MAAM,CAACD,UAAU;EACtCpC,cAAc,EAAEf,SAAS,CAACkD,MAAM,CAACC,UAAU;EAC3CnC,eAAe,EAAEhB,SAAS,CAACkD,MAAM,CAACC,UAAU;EAC5CjC,eAAe,EAAElB,SAAS,CAACqD;AAC7B,CAAC;AAED3C,cAAc,CAAC4C,YAAY,GAAG;EAC5BrC,kBAAkB,EAAE,EAAE;EACtBC,eAAe,EAAEA,CAAA,KAAM,CAAC;AAC1B,CAAC;AAEDR,cAAc,CAAC4C,YAAY,GAAG;EAC5BrC,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAeb,UAAU,CAACM,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTMEventSwitch.js","names":["React","PropTypes","GTMClickEvents","GTMEventFactory","filterGtmEvents","GTMEventSwitch","gtmEvents","clickState","clickId","props","window","length","clickEvents","regularEvents","GTMClickFactory","propTypes","string","array","bool","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMEventSwitch.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport GTMClickEvents from './GTMClickEvents';\nimport GTMEventFactory from './GTMEventFactory';\nimport { filterGtmEvents } from '../helpers';\n\nconst GTMEventSwitch = ({ gtmEvents, clickState, clickId, ...props }) => {\n if (typeof window === 'undefined' || !gtmEvents.length) return null;\n const { clickEvents, regularEvents } = filterGtmEvents(gtmEvents);\n const GTMClickFactory = clickId ? GTMEventFactory : GTMClickEvents;\n\n return clickState ? (\n <GTMClickFactory gtmEvents={clickEvents} clickId={clickId} {...props} />\n ) : (\n <GTMEventFactory gtmEvents={regularEvents} {...props} />\n );\n};\n\nGTMEventSwitch.propTypes = {\n clickId: PropTypes.string,\n gtmEvents: PropTypes.array,\n clickState: PropTypes.bool\n};\n\nGTMEventSwitch.defaultProps = {\n clickId: null,\n gtmEvents: [],\n clickState: false\n};\n\nexport default GTMEventSwitch;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,SAASC,eAAe,QAAQ,YAAY;AAE5C,MAAMC,cAAc,
|
|
1
|
+
{"version":3,"file":"GTMEventSwitch.js","names":["React","PropTypes","GTMClickEvents","GTMEventFactory","filterGtmEvents","GTMEventSwitch","_ref","gtmEvents","clickState","clickId","props","_objectWithoutProperties","_excluded","window","length","clickEvents","regularEvents","GTMClickFactory","createElement","_extends","propTypes","string","array","bool","defaultProps"],"sources":["../../src/GoogleTagManagerEvent/GTMEventSwitch.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport GTMClickEvents from './GTMClickEvents';\nimport GTMEventFactory from './GTMEventFactory';\nimport { filterGtmEvents } from '../helpers';\n\nconst GTMEventSwitch = ({ gtmEvents, clickState, clickId, ...props }) => {\n if (typeof window === 'undefined' || !gtmEvents.length) return null;\n const { clickEvents, regularEvents } = filterGtmEvents(gtmEvents);\n const GTMClickFactory = clickId ? GTMEventFactory : GTMClickEvents;\n\n return clickState ? (\n <GTMClickFactory gtmEvents={clickEvents} clickId={clickId} {...props} />\n ) : (\n <GTMEventFactory gtmEvents={regularEvents} {...props} />\n );\n};\n\nGTMEventSwitch.propTypes = {\n clickId: PropTypes.string,\n gtmEvents: PropTypes.array,\n clickState: PropTypes.bool\n};\n\nGTMEventSwitch.defaultProps = {\n clickId: null,\n gtmEvents: [],\n clickState: false\n};\n\nexport default GTMEventSwitch;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,SAASC,eAAe,QAAQ,YAAY;AAE5C,MAAMC,cAAc,GAAGC,IAAA,IAAkD;EAAA,IAAjD;MAAEC,SAAS;MAAEC,UAAU;MAAEC;IAAkB,CAAC,GAAAH,IAAA;IAAPI,KAAK,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAChE,IAAI,OAAOC,MAAM,KAAK,WAAW,IAAI,CAACN,SAAS,CAACO,MAAM,EAAE,OAAO,IAAI;EACnE,MAAM;IAAEC,WAAW;IAAEC;EAAc,CAAC,GAAGZ,eAAe,CAACG,SAAS,CAAC;EACjE,MAAMU,eAAe,GAAGR,OAAO,GAAGN,eAAe,GAAGD,cAAc;EAElE,OAAOM,UAAU,gBACfR,KAAA,CAAAkB,aAAA,CAACD,eAAe,EAAAE,QAAA;IAACZ,SAAS,EAAEQ,WAAY;IAACN,OAAO,EAAEA;EAAQ,GAAKC,KAAK,EAAI,gBAExEV,KAAA,CAAAkB,aAAA,CAACf,eAAe,EAAAgB,QAAA;IAACZ,SAAS,EAAES;EAAc,GAAKN,KAAK,EACrD;AACH,CAAC;AAEDL,cAAc,CAACe,SAAS,GAAG;EACzBX,OAAO,EAAER,SAAS,CAACoB,MAAM;EACzBd,SAAS,EAAEN,SAAS,CAACqB,KAAK;EAC1Bd,UAAU,EAAEP,SAAS,CAACsB;AACxB,CAAC;AAEDlB,cAAc,CAACmB,YAAY,GAAG;EAC5Bf,OAAO,EAAE,IAAI;EACbF,SAAS,EAAE,EAAE;EACbC,UAAU,EAAE;AACd,CAAC;AAED,eAAeH,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-and-push-web-vitals.js","names":["getCLS","getFID","getLCP","pushToDataLayer","buildAndPushWebVitals","reportHandler","name","delta","id","metrics","event","event_category","event_action","event_value","Math","round","event_label","nonInteraction"],"sources":["../../src/helpers/build-and-push-web-vitals.js"],"sourcesContent":["import { getCLS, getFID, getLCP } from 'web-vitals';\nimport pushToDataLayer from './push-to-data-layer';\n\nconst buildAndPushWebVitals = () => {\n getCLS(reportHandler);\n getFID(reportHandler);\n getLCP(reportHandler);\n};\n\nconst reportHandler = ({ name, delta, id }) => {\n const metrics = {\n event: 'web-vitals',\n event_category: 'Web Vitals',\n event_action: name,\n event_value: Math.round(name === 'CLS' ? delta * 1000 : delta),\n event_label: id,\n nonInteraction: true\n };\n\n pushToDataLayer(metrics);\n};\n\nexport default buildAndPushWebVitals;\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,MAAM,EAAEC,MAAM,QAAQ,YAAY;AACnD,OAAOC,eAAe,MAAM,sBAAsB;AAElD,MAAMC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"build-and-push-web-vitals.js","names":["getCLS","getFID","getLCP","pushToDataLayer","buildAndPushWebVitals","reportHandler","name","delta","id","metrics","event","event_category","event_action","event_value","Math","round","event_label","nonInteraction"],"sources":["../../src/helpers/build-and-push-web-vitals.js"],"sourcesContent":["import { getCLS, getFID, getLCP } from 'web-vitals';\nimport pushToDataLayer from './push-to-data-layer';\n\nconst buildAndPushWebVitals = () => {\n getCLS(reportHandler);\n getFID(reportHandler);\n getLCP(reportHandler);\n};\n\nconst reportHandler = ({ name, delta, id }) => {\n const metrics = {\n event: 'web-vitals',\n event_category: 'Web Vitals',\n event_action: name,\n event_value: Math.round(name === 'CLS' ? delta * 1000 : delta),\n event_label: id,\n nonInteraction: true\n };\n\n pushToDataLayer(metrics);\n};\n\nexport default buildAndPushWebVitals;\n"],"mappings":"AAAA,SAASA,MAAM,EAAEC,MAAM,EAAEC,MAAM,QAAQ,YAAY;AACnD,OAAOC,eAAe,MAAM,sBAAsB;AAElD,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EAClCJ,MAAM,CAACK,aAAa,CAAC;EACrBJ,MAAM,CAACI,aAAa,CAAC;EACrBH,MAAM,CAACG,aAAa,CAAC;AACvB,CAAC;AAED,MAAMA,aAAa,GAAGA,CAAC;EAAEC,IAAI;EAAEC,KAAK;EAAEC;AAAG,CAAC,KAAK;EAC7C,MAAMC,OAAO,GAAG;IACdC,KAAK,EAAE,YAAY;IACnBC,cAAc,EAAE,YAAY;IAC5BC,YAAY,EAAEN,IAAI;IAClBO,WAAW,EAAEC,IAAI,CAACC,KAAK,CAACT,IAAI,KAAK,KAAK,GAAGC,KAAK,GAAG,IAAI,GAAGA,KAAK,CAAC;IAC9DS,WAAW,EAAER,EAAE;IACfS,cAAc,EAAE;EAClB,CAAC;EAEDd,eAAe,CAACM,OAAO,CAAC;AAC1B,CAAC;AAED,eAAeL,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-data-layer.js","names":["getFinalValue","data","name","includes","relationName","fieldName","split","Array","isArray","reduce","str","element","index","buildProps","props","acc","label","key","propertiesToDisplay","staticMetric","buildDataLayerProps","map","currentData","buildDataLayer","propsToDisplay","url","length","propsToDisplayValues","event"],"sources":["../../src/helpers/build-data-layer.js"],"sourcesContent":["const getFinalValue = (data, name) => {\n if (name.includes('.')) {\n const [relationName, fieldName] = name.split('.');\n if (Array.isArray(data[relationName])) {\n return data[relationName].reduce(\n (str, element, index) => `${str}${index ? ',' : ''}${element[fieldName]}`,\n ''\n );\n }\n\n return data[relationName] ? data[relationName][fieldName] : data[fieldName] || '';\n }\n return data[name];\n};\n\nconst buildProps = (props, data) =>\n props.reduce((acc, { label: key, propertiesToDisplay: [name], staticMetric }) => {\n if (key && (staticMetric || name)) {\n acc[key] = staticMetric || getFinalValue(data, name);\n }\n\n return acc;\n }, {});\n\nconst buildDataLayerProps = (props, data) =>\n Array.isArray(data)\n ? data.map(currentData => buildProps(props, currentData))\n : buildProps(props, data);\n\nconst buildDataLayer = (data, propsToDisplay, url) => {\n if (!propsToDisplay || !propsToDisplay.length) return null;\n const propsToDisplayValues = buildDataLayerProps(propsToDisplay, data);\n\n return url\n ? {\n event: 'pageView',\n url,\n ...propsToDisplayValues\n }\n : propsToDisplayValues;\n};\n\nexport default buildDataLayer;\n"],"mappings":";;;AAAA,MAAMA,aAAa,
|
|
1
|
+
{"version":3,"file":"build-data-layer.js","names":["getFinalValue","data","name","includes","relationName","fieldName","split","Array","isArray","reduce","str","element","index","buildProps","props","acc","label","key","propertiesToDisplay","staticMetric","buildDataLayerProps","map","currentData","buildDataLayer","propsToDisplay","url","length","propsToDisplayValues","_objectSpread","event"],"sources":["../../src/helpers/build-data-layer.js"],"sourcesContent":["const getFinalValue = (data, name) => {\n if (name.includes('.')) {\n const [relationName, fieldName] = name.split('.');\n if (Array.isArray(data[relationName])) {\n return data[relationName].reduce(\n (str, element, index) => `${str}${index ? ',' : ''}${element[fieldName]}`,\n ''\n );\n }\n\n return data[relationName] ? data[relationName][fieldName] : data[fieldName] || '';\n }\n return data[name];\n};\n\nconst buildProps = (props, data) =>\n props.reduce((acc, { label: key, propertiesToDisplay: [name], staticMetric }) => {\n if (key && (staticMetric || name)) {\n acc[key] = staticMetric || getFinalValue(data, name);\n }\n\n return acc;\n }, {});\n\nconst buildDataLayerProps = (props, data) =>\n Array.isArray(data)\n ? data.map(currentData => buildProps(props, currentData))\n : buildProps(props, data);\n\nconst buildDataLayer = (data, propsToDisplay, url) => {\n if (!propsToDisplay || !propsToDisplay.length) return null;\n const propsToDisplayValues = buildDataLayerProps(propsToDisplay, data);\n\n return url\n ? {\n event: 'pageView',\n url,\n ...propsToDisplayValues\n }\n : propsToDisplayValues;\n};\n\nexport default buildDataLayer;\n"],"mappings":";;;AAAA,MAAMA,aAAa,GAAGA,CAACC,IAAI,EAAEC,IAAI,KAAK;EACpC,IAAIA,IAAI,CAACC,QAAQ,CAAC,GAAG,CAAC,EAAE;IACtB,MAAM,CAACC,YAAY,EAA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AG,KAAK;EACpD,IAAI,CAACD,cAAc,IAAI,CAACA,cAAc,CAACE,MAAM,EAAE,OAAO,IAAI;EAC1D,MAAMC,oBAAoB,GAAGP,mBAAmB,CAACI,cAAc,EAAEvB,IAAI,CAAC;EAEtE,OAAOwB,GAAG,GAAAG,aAAA;IAEJC,KAAK,EAAE,UAAU;IACjBJ;EAAG,GACAE,oBAAoB,IAEzBA,oBAAoB;AAC1B,CAAC;AAED,eAAeJ,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-nested-event.js","names":["GTM_EVENT_NAMES","GTM_PROPS","EVENT","ECOMMERCE","PRODUCTS","ON_CLICK","buildNestedEvent","ecommerce","propsObject","props","parentComponent","productDetailImpression","productClick","eventAction","eventTrigger","name","gtmActionLabel","isClickEvent","actionField","list","hasMultipleItems","Array","isArray","basicEventObject","forEach","key","label","gtmValue","gtmKey","parsedProps","items","parsedProducts","eventObject","ecommerceObject"],"sources":["../../src/helpers/build-nested-event.js"],"sourcesContent":["import { GTM_EVENT_NAMES, GTM_PROPS, EVENT, ECOMMERCE, PRODUCTS, ON_CLICK } from '../constants';\n\nconst buildNestedEvent = (ecommerce, propsObject, props, parentComponent) => {\n const { productDetailImpression, productClick } = GTM_EVENT_NAMES;\n const { eventAction, eventTrigger } = propsObject;\n const { name } = parentComponent;\n const gtmActionLabel = GTM_EVENT_NAMES[eventAction];\n const isClickEvent = eventTrigger === ON_CLICK || gtmActionLabel === productClick;\n const actionField = { list: name };\n const hasMultipleItems = Array.isArray(props);\n\n if (!ecommerce) {\n const basicEventObject = {};\n GTM_PROPS.forEach(({ key, label }) => {\n const gtmValue = propsObject[key];\n const gtmKey = label || key;\n if (gtmValue) basicEventObject[gtmKey] = gtmValue;\n });\n const parsedProps = hasMultipleItems ? { items: props } : props;\n\n return { ...basicEventObject, ...parsedProps };\n }\n\n if (!gtmActionLabel) return { [EVENT]: eventAction, [ECOMMERCE]: props };\n if (gtmActionLabel === productDetailImpression || gtmActionLabel === productClick) {\n const parsedProducts = hasMultipleItems ? props : [props];\n const eventObject = isClickEvent\n ? { [PRODUCTS]: parsedProducts, actionField }\n : { [PRODUCTS]: parsedProducts };\n return {\n [EVENT]: eventAction,\n [ECOMMERCE]: { [gtmActionLabel]: eventObject }\n };\n }\n\n const ecommerceObject = isClickEvent\n ? { [gtmActionLabel]: props, actionField }\n : { [gtmActionLabel]: props };\n return { [EVENT]: eventAction, [ECOMMERCE]: ecommerceObject };\n};\n\nexport default buildNestedEvent;\n"],"mappings":";;;AAAA,SAASA,eAAe,EAAEC,SAAS,EAAEC,KAAK,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,cAAc;AAE/F,MAAMC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"build-nested-event.js","names":["GTM_EVENT_NAMES","GTM_PROPS","EVENT","ECOMMERCE","PRODUCTS","ON_CLICK","buildNestedEvent","ecommerce","propsObject","props","parentComponent","productDetailImpression","productClick","eventAction","eventTrigger","name","gtmActionLabel","isClickEvent","actionField","list","hasMultipleItems","Array","isArray","basicEventObject","forEach","key","label","gtmValue","gtmKey","parsedProps","items","_objectSpread","parsedProducts","eventObject","ecommerceObject"],"sources":["../../src/helpers/build-nested-event.js"],"sourcesContent":["import { GTM_EVENT_NAMES, GTM_PROPS, EVENT, ECOMMERCE, PRODUCTS, ON_CLICK } from '../constants';\n\nconst buildNestedEvent = (ecommerce, propsObject, props, parentComponent) => {\n const { productDetailImpression, productClick } = GTM_EVENT_NAMES;\n const { eventAction, eventTrigger } = propsObject;\n const { name } = parentComponent;\n const gtmActionLabel = GTM_EVENT_NAMES[eventAction];\n const isClickEvent = eventTrigger === ON_CLICK || gtmActionLabel === productClick;\n const actionField = { list: name };\n const hasMultipleItems = Array.isArray(props);\n\n if (!ecommerce) {\n const basicEventObject = {};\n GTM_PROPS.forEach(({ key, label }) => {\n const gtmValue = propsObject[key];\n const gtmKey = label || key;\n if (gtmValue) basicEventObject[gtmKey] = gtmValue;\n });\n const parsedProps = hasMultipleItems ? { items: props } : props;\n\n return { ...basicEventObject, ...parsedProps };\n }\n\n if (!gtmActionLabel) return { [EVENT]: eventAction, [ECOMMERCE]: props };\n if (gtmActionLabel === productDetailImpression || gtmActionLabel === productClick) {\n const parsedProducts = hasMultipleItems ? props : [props];\n const eventObject = isClickEvent\n ? { [PRODUCTS]: parsedProducts, actionField }\n : { [PRODUCTS]: parsedProducts };\n return {\n [EVENT]: eventAction,\n [ECOMMERCE]: { [gtmActionLabel]: eventObject }\n };\n }\n\n const ecommerceObject = isClickEvent\n ? { [gtmActionLabel]: props, actionField }\n : { [gtmActionLabel]: props };\n return { [EVENT]: eventAction, [ECOMMERCE]: ecommerceObject };\n};\n\nexport default buildNestedEvent;\n"],"mappings":";;;AAAA,SAASA,eAAe,EAAEC,SAAS,EAAEC,KAAK,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,cAAc;AAE/F,MAAMC,gBAAgB,GAAGA,CAACC,SAAS,EAAEC,WAAW,EAAEC,KAAK,EAAEC,eAAe,KAAK;EAC3E,MAAM;IAAEC,uBAAuB;IAAEC;EAAa,CAAC,GAAGZ,eAAe;EACjE,MAAM;IAAEa,WAAW;IAAEC;EAAa,CAAC,GAAGN,WAAW;EACjD,MAAM;IAAEO;EAAK,CAAC,GAAGL,eAAe;EAChC,MAAMM,cAAc,GAAGhB,eAAe,CAACa,WAAW,CAAC;EACnD,MAAMI,YAAY,GAAGH,YAAY,KAAKT,QAAQ,IAAIW,cAAc,KAAKJ,YAAY;EACjF,MAAMM,WAAW,GAAG;IAAEC,IAAI,EAAEJ;EAAK,CAAC;EAClC,MAAMK,gBAAgB,GAAGC,KAAK,CAACC,OAAO,CAACb,KAAK,CAAC;EAE7C,IAAI,CAACF,SAAS,EAAE;IACd,MAAMgB,gBAAgB,GAAG,CAAC,CAAC;IAC3BtB,SAAS,CAACuB,OAAO,CAAC,CAAC;MAAEC,GAAG;MAAEC;IAAM,CAAC,KAAK;MACpC,MAAMC,QAAQ,GAAGnB,WAAW,CAACiB,GAAG,CAAC;MACjC,MAAMG,MAAM,GAAGF,KAAK,IAAID,GAAG;MAC3B,IAAIE,QAAQ,EAAEJ,gBAAgB,CAACK,MAAM,CAAC,GAAGD,QAAQ;IACnD,CAAC,CAAC;IACF,MAAME,WAAW,GAAGT,gBAAgB,GAAG;MAAEU,KAAK,EAAErB;IAAM,CAAC,GAAGA,KAAK;IAE/D,OAAAsB,aAAA,CAAAA,aAAA,KAAYR,gBAAgB,GAAKM,WAAW;EAC9C;EAEA,IAAI,CAACb,cAAc,EAAE,OAAO;IAAE,CAACd,KAAK,GAAGW,WAAW;IAAE,CAACV,SAAS,GAAGM;EAAM,CAAC;EACxE,IAAIO,cAAc,KAAKL,uBAAuB,IAAIK,cAAc,KAAKJ,YAAY,EAAE;IACjF,MAAMoB,cAAc,GAAGZ,gBAAgB,GAAGX,KAAK,GAAG,CAACA,KAAK,CAAC;IACzD,MAAMwB,WAAW,GAAGhB,YAAY,GAC5B;MAAE,CAACb,QAAQ,GAAG4B,cAAc;MAAEd;IAAY,CAAC,GAC3C;MAAE,CAACd,QAAQ,GAAG4B;IAAe,CAAC;IAClC,OAAO;MACL,CAAC9B,KAAK,GAAGW,WAAW;MACpB,CAACV,SAAS,GAAG;QAAE,CAACa,cAAc,GAAGiB;MAAY;IAC/C,CAAC;EACH;EAEA,MAAMC,eAAe,GAAGjB,YAAY,GAChC;IAAE,CAACD,cAAc,GAAGP,KAAK;IAAES;EAAY,CAAC,GACxC;IAAE,CAACF,cAAc,GAAGP;EAAM,CAAC;EAC/B,OAAO;IAAE,CAACP,KAAK,GAAGW,WAAW;IAAE,CAACV,SAAS,GAAG+B;EAAgB,CAAC;AAC/D,CAAC;AAED,eAAe5B,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-props-to-display-array.js","names":["buildPropsToDisplayArray","propsToDisplay","map","prop","propertiesToDisplay","filter","Boolean"],"sources":["../../src/helpers/build-props-to-display-array.js"],"sourcesContent":["function buildPropsToDisplayArray(propsToDisplay = []) {\n return propsToDisplay\n .map(prop => !!prop && !!prop.propertiesToDisplay && prop.propertiesToDisplay[0])\n .filter(Boolean);\n}\n\nexport default buildPropsToDisplayArray;\n"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"file":"build-props-to-display-array.js","names":["buildPropsToDisplayArray","propsToDisplay","map","prop","propertiesToDisplay","filter","Boolean"],"sources":["../../src/helpers/build-props-to-display-array.js"],"sourcesContent":["function buildPropsToDisplayArray(propsToDisplay = []) {\n return propsToDisplay\n .map(prop => !!prop && !!prop.propertiesToDisplay && prop.propertiesToDisplay[0])\n .filter(Boolean);\n}\n\nexport default buildPropsToDisplayArray;\n"],"mappings":"AAAA,SAASA,wBAAwBA,CAACC,cAAc,GAAG,EAAE,EAAE;EACrD,OAAOA,cAAc,CAClBC,GAAG,CAACC,IAAI,IAAI,CAAC,CAACA,IAAI,IAAI,CAAC,CAACA,IAAI,CAACC,mBAAmB,IAAID,IAAI,CAACC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAChFC,MAAM,CAACC,OAAO,CAAC;AACpB;AAEA,eAAeN,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-user-layer.js","names":["getValue","propertiesToDisplay","getUser","baseProp","nestedProp","split","baseValue","isArray","Array","nestedValue","length","map","nested","join","checkAndSetProps","userPropsToDisplay","userDataLayer","forEach","prop","label","staticMetric","value","buildUserLayer","userData","user"],"sources":["../../src/helpers/build-user-layer.js"],"sourcesContent":["const getValue = (propertiesToDisplay, getUser) => {\n const [baseProp, nestedProp] = propertiesToDisplay[0].split('.');\n const baseValue = getUser[baseProp];\n const isArray = Array.isArray(baseValue);\n if (nestedProp && baseValue) {\n let nestedValue;\n if (isArray) {\n nestedValue = baseValue.length\n ? baseValue.map(nested => (nested ? nested[nestedProp] : '')).join(', ')\n : '';\n } else {\n nestedValue = baseValue[nestedProp];\n }\n return nestedValue || '';\n }\n return baseValue || '';\n};\n\nconst checkAndSetProps = (userPropsToDisplay, getUser) => {\n const userDataLayer = {};\n userPropsToDisplay.forEach(prop => {\n const { propertiesToDisplay, label, staticMetric } = prop;\n if (staticMetric) {\n userDataLayer[label] = staticMetric;\n return;\n }\n if (!propertiesToDisplay[0]) return;\n const value = getValue(propertiesToDisplay, getUser);\n userDataLayer[label] = value;\n });\n\n return userDataLayer;\n};\n\nconst buildUserLayer = (userData, userPropsToDisplay) => {\n if (!userData || !userData.getUser) return {};\n const { getUser } = userData;\n\n const userDataLayer = checkAndSetProps(userPropsToDisplay, getUser);\n\n return { user: userDataLayer };\n};\n\nexport default buildUserLayer;\n"],"mappings":"AAAA,MAAMA,QAAQ,
|
|
1
|
+
{"version":3,"file":"build-user-layer.js","names":["getValue","propertiesToDisplay","getUser","baseProp","nestedProp","split","baseValue","isArray","Array","nestedValue","length","map","nested","join","checkAndSetProps","userPropsToDisplay","userDataLayer","forEach","prop","label","staticMetric","value","buildUserLayer","userData","user"],"sources":["../../src/helpers/build-user-layer.js"],"sourcesContent":["const getValue = (propertiesToDisplay, getUser) => {\n const [baseProp, nestedProp] = propertiesToDisplay[0].split('.');\n const baseValue = getUser[baseProp];\n const isArray = Array.isArray(baseValue);\n if (nestedProp && baseValue) {\n let nestedValue;\n if (isArray) {\n nestedValue = baseValue.length\n ? baseValue.map(nested => (nested ? nested[nestedProp] : '')).join(', ')\n : '';\n } else {\n nestedValue = baseValue[nestedProp];\n }\n return nestedValue || '';\n }\n return baseValue || '';\n};\n\nconst checkAndSetProps = (userPropsToDisplay, getUser) => {\n const userDataLayer = {};\n userPropsToDisplay.forEach(prop => {\n const { propertiesToDisplay, label, staticMetric } = prop;\n if (staticMetric) {\n userDataLayer[label] = staticMetric;\n return;\n }\n if (!propertiesToDisplay[0]) return;\n const value = getValue(propertiesToDisplay, getUser);\n userDataLayer[label] = value;\n });\n\n return userDataLayer;\n};\n\nconst buildUserLayer = (userData, userPropsToDisplay) => {\n if (!userData || !userData.getUser) return {};\n const { getUser } = userData;\n\n const userDataLayer = checkAndSetProps(userPropsToDisplay, getUser);\n\n return { user: userDataLayer };\n};\n\nexport default buildUserLayer;\n"],"mappings":"AAAA,MAAMA,QAAQ,GAAGA,CAACC,mBAAmB,EAAEC,OAAO,KAAK;EACjD,MAAM,CAACC,QAAQ,EAAEC,UAAU,CAAC,GAAGH,mBAAmB,CAAC,CAAC,CAAC,CAACI,KAAK,CAAC,GAAG,CAAC;EAChE,MAAMC,SAAS,GAAGJ,OAAO,CAACC,QAAQ,CAAC;EACnC,MAAMI,OAAO,GAAGC,KAAK,CAACD,OAAO,CAACD,SAAS,CAAC;EACxC,IAAIF,UAAU,IAAIE,SAAS,EAAE;IAC3B,IAAIG,WAAW;IACf,IAAIF,OAAO,EAAE;MACXE,WAAW,GAAGH,SAAS,CAACI,MAAM,GAC1BJ,SAAS,CAACK,GAAG,CAACC,MAAM,IAAKA,MAAM,GAAGA,MAAM,CAACR,UAAU,CAAC,GAAG,EAAG,CAAC,CAACS,IAAI,CAAC,IAAI,CAAC,GACtE,EAAE;IACR,CAAC,MAAM;MACLJ,WAAW,GAAGH,SAAS,CAACF,UAAU,CAAC;IACrC;IACA,OAAOK,WAAW,IAAI,EAAE;EAC1B;EACA,OAAOH,SAAS,IAAI,EAAE;AACxB,CAAC;AAED,MAAMQ,gBAAgB,GAAGA,CAACC,kBAAkB,EAAEb,OAAO,KAAK;EACxD,MAAMc,aAAa,GAAG,CAAC,CAAC;EACxBD,kBAAkB,CAACE,OAAO,CAACC,IAAI,IAAI;IACjC,MAAM;MAAEjB,mBAAmB;MAAEkB,KAAK;MAAEC;IAAa,CAAC,GAAGF,IAAI;IACzD,IAAIE,YAAY,EAAE;MAChBJ,aAAa,CAACG,KAAK,CAAC,GAAGC,YAAY;MACnC;IACF;IACA,IAAI,CAACnB,mBAAmB,CAAC,CAAC,CAAC,EAAE;IAC7B,MAAMoB,KAAK,GAAGrB,QAAQ,CAACC,mBAAmB,EAAEC,OAAO,CAAC;IACpDc,aAAa,CAACG,KAAK,CAAC,GAAGE,KAAK;EAC9B,CAAC,CAAC;EAEF,OAAOL,aAAa;AACtB,CAAC;AAED,MAAMM,cAAc,GAAGA,CAACC,QAAQ,EAAER,kBAAkB,KAAK;EACvD,IAAI,CAACQ,QAAQ,IAAI,CAACA,QAAQ,CAACrB,OAAO,EAAE,OAAO,CAAC,CAAC;EAC7C,MAAM;IAAEA;EAAQ,CAAC,GAAGqB,QAAQ;EAE5B,MAAMP,aAAa,GAAGF,gBAAgB,CAACC,kBAAkB,EAAEb,OAAO,CAAC;EAEnE,OAAO;IAAEsB,IAAI,EAAER;EAAc,CAAC;AAChC,CAAC;AAED,eAAeM,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-render-props.js","names":["generateSingleItemQuery","generateMultiItemQuery","getRenderProps","extraProps","isPreview","data","useMultiQuery","getEntitySchema","actions","get","getPublished","getAll","getAllPublished","queryToUse","singleActionKey","multiActionKey","actionKey","action"],"sources":["../../src/helpers/get-render-props.js"],"sourcesContent":["import { generateSingleItemQuery, generateMultiItemQuery } from '@blaze-cms/react-page-builder';\n\nconst getRenderProps = (extraProps, isPreview, data, useMultiQuery) => {\n const { getEntitySchema } = data;\n const {\n actions: { get, getPublished, getAll, getAllPublished }\n } = getEntitySchema;\n const queryToUse = useMultiQuery ? generateMultiItemQuery : generateSingleItemQuery;\n const singleActionKey = isPreview ? get : getPublished || get;\n const multiActionKey = isPreview ? getAll : getAllPublished || getAll;\n const actionKey = useMultiQuery ? multiActionKey : singleActionKey;\n const action = queryToUse(actionKey, extraProps);\n\n return { action, actionKey };\n};\n\nexport default getRenderProps;\n"],"mappings":"AAAA,SAASA,uBAAuB,EAAEC,sBAAsB,QAAQ,+BAA+B;AAE/F,MAAMC,cAAc,
|
|
1
|
+
{"version":3,"file":"get-render-props.js","names":["generateSingleItemQuery","generateMultiItemQuery","getRenderProps","extraProps","isPreview","data","useMultiQuery","getEntitySchema","actions","get","getPublished","getAll","getAllPublished","queryToUse","singleActionKey","multiActionKey","actionKey","action"],"sources":["../../src/helpers/get-render-props.js"],"sourcesContent":["import { generateSingleItemQuery, generateMultiItemQuery } from '@blaze-cms/react-page-builder';\n\nconst getRenderProps = (extraProps, isPreview, data, useMultiQuery) => {\n const { getEntitySchema } = data;\n const {\n actions: { get, getPublished, getAll, getAllPublished }\n } = getEntitySchema;\n const queryToUse = useMultiQuery ? generateMultiItemQuery : generateSingleItemQuery;\n const singleActionKey = isPreview ? get : getPublished || get;\n const multiActionKey = isPreview ? getAll : getAllPublished || getAll;\n const actionKey = useMultiQuery ? multiActionKey : singleActionKey;\n const action = queryToUse(actionKey, extraProps);\n\n return { action, actionKey };\n};\n\nexport default getRenderProps;\n"],"mappings":"AAAA,SAASA,uBAAuB,EAAEC,sBAAsB,QAAQ,+BAA+B;AAE/F,MAAMC,cAAc,GAAGA,CAACC,UAAU,EAAEC,SAAS,EAAEC,IAAI,EAAEC,aAAa,KAAK;EACrE,MAAM;IAAEC;EAAgB,CAAC,GAAGF,IAAI;EAChC,MAAM;IACJG,OAAO,EAAE;MAAEC,GAAG;MAAEC,YAAY;MAAEC,MAAM;MAAEC;IAAgB;EACxD,CAAC,GAAGL,eAAe;EACnB,MAAMM,UAAU,GAAGP,aAAa,GAAGL,sBAAsB,GAAGD,uBAAuB;EACnF,MAAMc,eAAe,GAAGV,SAAS,GAAGK,GAAG,GAAGC,YAAY,IAAID,GAAG;EAC7D,MAAMM,cAAc,GAAGX,SAAS,GAAGO,MAAM,GAAGC,eAAe,IAAID,MAAM;EACrE,MAAMK,SAAS,GAAGV,aAAa,GAAGS,cAAc,GAAGD,eAAe;EAClE,MAAMG,MAAM,GAAGJ,UAAU,CAACG,SAAS,EAAEb,UAAU,CAAC;EAEhD,OAAO;IAAEc,MAAM;IAAED;EAAU,CAAC;AAC9B,CAAC;AAED,eAAed,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push-to-data-layer.js","names":["resetDataLayer","pushToDataLayer","dataLayer","isPageView","window","push"],"sources":["../../src/helpers/push-to-data-layer.js"],"sourcesContent":["import resetDataLayer from './reset-data-layer';\n\nconst pushToDataLayer = (dataLayer, isPageView) => {\n if (dataLayer && window.dataLayer) {\n if (isPageView) resetDataLayer();\n window.dataLayer.push(dataLayer);\n }\n};\n\nexport default pushToDataLayer;\n"],"mappings":"AAAA,OAAOA,cAAc,MAAM,oBAAoB;AAE/C,MAAMC,eAAe,
|
|
1
|
+
{"version":3,"file":"push-to-data-layer.js","names":["resetDataLayer","pushToDataLayer","dataLayer","isPageView","window","push"],"sources":["../../src/helpers/push-to-data-layer.js"],"sourcesContent":["import resetDataLayer from './reset-data-layer';\n\nconst pushToDataLayer = (dataLayer, isPageView) => {\n if (dataLayer && window.dataLayer) {\n if (isPageView) resetDataLayer();\n window.dataLayer.push(dataLayer);\n }\n};\n\nexport default pushToDataLayer;\n"],"mappings":"AAAA,OAAOA,cAAc,MAAM,oBAAoB;AAE/C,MAAMC,eAAe,GAAGA,CAACC,SAAS,EAAEC,UAAU,KAAK;EACjD,IAAID,SAAS,IAAIE,MAAM,CAACF,SAAS,EAAE;IACjC,IAAIC,UAAU,EAAEH,cAAc,EAAE;IAChCI,MAAM,CAACF,SAAS,CAACG,IAAI,CAACH,SAAS,CAAC;EAClC;AACF,CAAC;AAED,eAAeD,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reset-data-layer.js","names":["PAGE_VIEW","resetDataLayer","shouldReset","window","dataLayer","length","gtmIdRegex","keys","Object","google_tag_manager","GTMkeys","filter","key","test","forEach","GTMkey","reset","find","event"],"sources":["../../src/helpers/reset-data-layer.js"],"sourcesContent":["import { PAGE_VIEW } from '../constants';\n\nconst resetDataLayer = () => {\n if (!shouldReset()) return false;\n\n window.dataLayer.length = 0;\n const gtmIdRegex = /GTM-/i;\n const keys = Object.keys(window.google_tag_manager);\n const GTMkeys = keys.filter(\n key => gtmIdRegex.test(key) && window.google_tag_manager[key].dataLayer\n );\n GTMkeys.forEach(GTMkey => window.google_tag_manager[GTMkey].dataLayer.reset());\n\n return true;\n};\n\nfunction shouldReset() {\n return (\n window.google_tag_manager &&\n window.dataLayer &&\n window.dataLayer.find(({ event }) => event === PAGE_VIEW)\n );\n}\n\nexport default resetDataLayer;\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AAExC,MAAMC,cAAc,
|
|
1
|
+
{"version":3,"file":"reset-data-layer.js","names":["PAGE_VIEW","resetDataLayer","shouldReset","window","dataLayer","length","gtmIdRegex","keys","Object","google_tag_manager","GTMkeys","filter","key","test","forEach","GTMkey","reset","find","event"],"sources":["../../src/helpers/reset-data-layer.js"],"sourcesContent":["import { PAGE_VIEW } from '../constants';\n\nconst resetDataLayer = () => {\n if (!shouldReset()) return false;\n\n window.dataLayer.length = 0;\n const gtmIdRegex = /GTM-/i;\n const keys = Object.keys(window.google_tag_manager);\n const GTMkeys = keys.filter(\n key => gtmIdRegex.test(key) && window.google_tag_manager[key].dataLayer\n );\n GTMkeys.forEach(GTMkey => window.google_tag_manager[GTMkey].dataLayer.reset());\n\n return true;\n};\n\nfunction shouldReset() {\n return (\n window.google_tag_manager &&\n window.dataLayer &&\n window.dataLayer.find(({ event }) => event === PAGE_VIEW)\n );\n}\n\nexport default resetDataLayer;\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AAExC,MAAMC,cAAc,GAAGA,CAAA,KAAM;EAC3B,IAAI,CAACC,WAAW,EAAE,EAAE,OAAO,KAAK;EAEhCC,MAAM,CAACC,SAAS,CAACC,MAAM,GAAG,CAAC;EAC3B,MAAMC,UAAU,GAAG,OAAO;EAC1B,MAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACJ,MAAM,CAACM,kBAAkB,CAAC;EACnD,MAAMC,OAAO,GAAGH,IAAI,CAACI,MAAM,CACzBC,GAAG,IAAIN,UAAU,CAACO,IAAI,CAACD,GAAG,CAAC,IAAIT,MAAM,CAACM,kBAAkB,CAACG,GAAG,CAAC,CAACR,SAAS,CACxE;EACDM,OAAO,CAACI,OAAO,CAACC,MAAM,IAAIZ,MAAM,CAACM,kBAAkB,CAACM,MAAM,CAAC,CAACX,SAAS,CAACY,KAAK,EAAE,CAAC;EAE9E,OAAO,IAAI;AACb,CAAC;AAED,SAASd,WAAWA,CAAA,EAAG;EACrB,OACEC,MAAM,CAACM,kBAAkB,IACzBN,MAAM,CAACC,SAAS,IAChBD,MAAM,CAACC,SAAS,CAACa,IAAI,CAAC,CAAC;IAAEC;EAAM,CAAC,KAAKA,KAAK,KAAKlB,SAAS,CAAC;AAE7D;AAEA,eAAeC,cAAc"}
|
package/lib-es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["dynamic","pkg","PLUGIN_NAME","load","app","events","once","addComponent","key","component","name","version","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import dynamic from 'next/dynamic';\n\nimport pkg from '../package.json';\nimport { PLUGIN_NAME } from './constants';\n\nexport default async function load(app) {\n app.events.once('load:custom:page-builder:component', addComponent => {\n addComponent({\n key: 'gtm',\n component: dynamic(() =>\n import(/* webpackChunkName: \"blazePbGoogleTagManager\" */ './GoogleTagManager')\n )\n });\n addComponent({\n key: 'gtm-events',\n component: dynamic(() =>\n import(/* webpackChunkName: \"blazePbGoogleTagManagerEvent\" */ './GoogleTagManagerEvent')\n )\n });\n });\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,cAAc;AAElC,OAAOC,GAAG,MAAM,iBAAiB;AACjC,SAASC,WAAW,QAAQ,aAAa;AAEzC,eAAe,eAAeC,
|
|
1
|
+
{"version":3,"file":"index.js","names":["dynamic","pkg","PLUGIN_NAME","load","app","events","once","addComponent","key","component","name","version","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import dynamic from 'next/dynamic';\n\nimport pkg from '../package.json';\nimport { PLUGIN_NAME } from './constants';\n\nexport default async function load(app) {\n app.events.once('load:custom:page-builder:component', addComponent => {\n addComponent({\n key: 'gtm',\n component: dynamic(() =>\n import(/* webpackChunkName: \"blazePbGoogleTagManager\" */ './GoogleTagManager')\n )\n });\n addComponent({\n key: 'gtm-events',\n component: dynamic(() =>\n import(/* webpackChunkName: \"blazePbGoogleTagManagerEvent\" */ './GoogleTagManagerEvent')\n )\n });\n });\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,cAAc;AAElC,OAAOC,GAAG,MAAM,iBAAiB;AACjC,SAASC,WAAW,QAAQ,aAAa;AAEzC,eAAe,eAAeC,IAAIA,CAACC,GAAG,EAAE;EACtCA,GAAG,CAACC,MAAM,CAACC,IAAI,CAAC,oCAAoC,EAAEC,YAAY,IAAI;IACpEA,YAAY,CAAC;MACXC,GAAG,EAAE,KAAK;MACVC,SAAS,EAAET,OAAO,CAAC,MACjB,MAAM,EAAC,iDAAkD,oBAAoB,CAAC;IAElF,CAAC,CAAC;IACFO,YAAY,CAAC;MACXC,GAAG,EAAE,YAAY;MACjBC,SAAS,EAAET,OAAO,CAAC,MACjB,MAAM,EAAC,sDAAuD,yBAAyB,CAAC;IAE5F,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAO;IACLU,IAAI,EAAER,WAAW;IACjBS,OAAO,EAAEV,GAAG,CAACU;EACf,CAAC;AACH;AAEAR,IAAI,CAACS,UAAU,GAAGV,WAAW"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/plugin-gtm-fe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.128.0-admin-updates.3",
|
|
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": "
|
|
31
|
-
"@blaze-cms/nextjs-components": "
|
|
32
|
-
"@blaze-cms/react-page-builder": "
|
|
33
|
-
"@blaze-cms/setup-ui": "
|
|
30
|
+
"@blaze-cms/core-auth-ui": "0.128.0-admin-updates.0",
|
|
31
|
+
"@blaze-cms/nextjs-components": "0.128.0-admin-updates.0",
|
|
32
|
+
"@blaze-cms/react-page-builder": "0.128.0-admin-updates.3",
|
|
33
|
+
"@blaze-cms/setup-ui": "0.128.0-admin-updates.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": "
|
|
39
|
+
"@blaze-cms/core-ui": "0.128.0-admin-updates.0"
|
|
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": "f96b63b60fe8a99a75e822b6e3b3b88ea90d0cd2"
|
|
49
49
|
}
|