@blaze-cms/plugin-gtm-fe 0.124.0-alpha.0 → 0.124.0-alpha.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 CHANGED
@@ -3,6 +3,142 @@
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.124.0-alpha.3](https://github.com/thebyte9/blaze/compare/v0.124.0-alpha.2...v0.124.0-alpha.3) (2022-04-29)
7
+
8
+ **Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
9
+
10
+
11
+
12
+
13
+
14
+ # [0.124.0-alpha.2](https://github.com/thebyte9/blaze/compare/v0.124.0-alpha.1...v0.124.0-alpha.2) (2022-04-29)
15
+
16
+ **Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
17
+
18
+
19
+
20
+
21
+
22
+ # [0.124.0-alpha.1](https://github.com/thebyte9/blaze/compare/v0.122.4...v0.124.0-alpha.1) (2022-04-27)
23
+
24
+
25
+
26
+ # [0.124.0-alpha.0](https://github.com/thebyte9/blaze/compare/v0.123.1-alpha.2...v0.124.0-alpha.0) (2022-04-25)
27
+
28
+
29
+
30
+ ## [0.123.1-alpha.2](https://github.com/thebyte9/blaze/compare/v0.123.1-alpha.1...v0.123.1-alpha.2) (2022-04-21)
31
+
32
+
33
+
34
+ ## [0.123.1-alpha.1](https://github.com/thebyte9/blaze/compare/v0.123.1-alpha.0...v0.123.1-alpha.1) (2022-04-21)
35
+
36
+
37
+
38
+ ## [0.123.1-alpha.0](https://github.com/thebyte9/blaze/compare/v0.123.0...v0.123.1-alpha.0) (2022-04-21)
39
+
40
+
41
+
42
+ # [0.123.0](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.29...v0.123.0) (2022-04-11)
43
+
44
+
45
+
46
+ # [0.123.0-alpha.27](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.26...v0.123.0-alpha.27) (2022-04-07)
47
+
48
+
49
+
50
+ # [0.123.0-alpha.25](https://github.com/thebyte9/blaze/compare/v0.122.3...v0.123.0-alpha.25) (2022-04-07)
51
+
52
+
53
+
54
+ # [0.123.0-alpha.24](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.23...v0.123.0-alpha.24) (2022-04-05)
55
+
56
+
57
+
58
+ # [0.123.0-alpha.23](https://github.com/thebyte9/blaze/compare/v0.122.2...v0.123.0-alpha.23) (2022-04-04)
59
+
60
+
61
+
62
+ # [0.123.0-alpha.22](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.21...v0.123.0-alpha.22) (2022-04-04)
63
+
64
+
65
+
66
+ # [0.123.0-alpha.21](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.20...v0.123.0-alpha.21) (2022-04-01)
67
+
68
+
69
+
70
+ # [0.123.0-alpha.20](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.19...v0.123.0-alpha.20) (2022-04-01)
71
+
72
+
73
+
74
+ # [0.123.0-alpha.19](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.18...v0.123.0-alpha.19) (2022-03-31)
75
+
76
+
77
+
78
+ # [0.123.0-alpha.18](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.17...v0.123.0-alpha.18) (2022-03-31)
79
+
80
+
81
+
82
+ # [0.123.0-alpha.17](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.16...v0.123.0-alpha.17) (2022-03-31)
83
+
84
+
85
+
86
+ # [0.123.0-alpha.16](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.15...v0.123.0-alpha.16) (2022-03-30)
87
+
88
+
89
+
90
+ # [0.123.0-alpha.15](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.14...v0.123.0-alpha.15) (2022-03-30)
91
+
92
+
93
+
94
+ # [0.123.0-alpha.14](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.13...v0.123.0-alpha.14) (2022-03-30)
95
+
96
+
97
+
98
+ # [0.123.0-alpha.13](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.12...v0.123.0-alpha.13) (2022-03-30)
99
+
100
+
101
+
102
+ # [0.123.0-alpha.12](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.9...v0.123.0-alpha.12) (2022-03-30)
103
+
104
+
105
+
106
+ # [0.123.0-alpha.9](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.8...v0.123.0-alpha.9) (2022-03-26)
107
+
108
+
109
+
110
+ # [0.123.0-alpha.8](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.7...v0.123.0-alpha.8) (2022-03-26)
111
+
112
+
113
+
114
+ # [0.123.0-alpha.7](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.6...v0.123.0-alpha.7) (2022-03-26)
115
+
116
+
117
+
118
+ # [0.123.0-alpha.6](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.5...v0.123.0-alpha.6) (2022-03-26)
119
+
120
+
121
+
122
+ # [0.123.0-alpha.5](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.4...v0.123.0-alpha.5) (2022-03-26)
123
+
124
+
125
+
126
+ # [0.123.0-alpha.4](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.3...v0.123.0-alpha.4) (2022-03-25)
127
+
128
+
129
+
130
+ # [0.123.0-alpha.3](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.2...v0.123.0-alpha.3) (2022-03-25)
131
+
132
+
133
+
134
+ # [0.123.0-alpha.2](https://github.com/thebyte9/blaze/compare/v0.123.0-alpha.1...v0.123.0-alpha.2) (2022-03-22)
135
+
136
+ **Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
137
+
138
+
139
+
140
+
141
+
6
142
  # [0.124.0-alpha.0](https://github.com/thebyte9/blaze/compare/v0.123.1-alpha.2...v0.124.0-alpha.0) (2022-04-25)
7
143
 
8
144
  **Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
@@ -10,6 +146,32 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
10
146
 
11
147
 
12
148
 
149
+ ## [0.122.4](https://github.com/thebyte9/blaze/compare/v0.122.3...v0.122.4) (2022-04-25)
150
+
151
+
152
+ ### Bug Fixes
153
+
154
+ * ensure up to date date for gtm view event ([#3443](https://github.com/thebyte9/blaze/issues/3443)) ([59049df](https://github.com/thebyte9/blaze/commit/59049df83c79abab080320e366a07aa6a745d071))
155
+
156
+
157
+
158
+
159
+
160
+ ## [0.122.3](https://github.com/thebyte9/blaze/compare/v0.122.2...v0.122.3) (2022-04-06)
161
+
162
+ **Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
163
+
164
+
165
+
166
+
167
+
168
+ ## [0.122.2](https://github.com/thebyte9/blaze/compare/v0.122.1...v0.122.2) (2022-04-04)
169
+
170
+ **Note:** Version bump only for package @blaze-cms/plugin-gtm-fe
171
+
172
+
173
+
174
+
13
175
 
14
176
  ## [0.123.1-alpha.2](https://github.com/thebyte9/blaze/compare/v0.123.1-alpha.1...v0.123.1-alpha.2) (2022-04-21)
15
177
 
@@ -91,6 +91,7 @@ var GTMRender = function GTMRender(_ref) {
91
91
  userLoading = _useQuery2.loading;
92
92
 
93
93
  if (loading || userLoading || !data || !data.entityData) return null;
94
+ if (data.entityData.id !== parentId) return null;
94
95
  if (error) return error.message;
95
96
  if (currentLocation.url !== asPath) setCurrentLocation({
96
97
  url: asPath,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/GoogleTagManager/GTMRender.js"],"names":["GTMRender","router","action","propsToDisplay","parentId","webVitals","userPropsToDisplay","asPath","url","shouldPushLayer","currentLocation","setCurrentLocation","variables","id","data","error","loading","userId","hasUserProps","length","userProps","skip","userData","userLoading","entityData","message","dataLayerObject","userLayerObject","extendedDataLayer","propTypes","PropTypes","array","isRequired","object","string","bool"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAQA,IAAMA,SAAS,GAAG,SAAZ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,EAAW,OAAOA,KAAK,CAACU,OAAb;AACX,MAAIf,eAAe,CAACF,GAAhB,KAAwBD,MAA5B,EAAoCI,kBAAkB,CAAC;AAAEH,IAAAA,GAAG,EAAED,MAAP;AAAeE,IAAAA,eAAe,EAAE;AAAhC,GAAD,CAAlB;AACpC,MAAI,CAACC,eAAe,CAACD,eAArB,EAAsC,OAAO,IAAP;AAEtC,MAAQe,UAAR,GAAuBV,IAAvB,CAAQU,UAAR;AACA,MAAME,eAAe,GAAG,6BAAeF,UAAf,EAA2BrB,cAA3B,EAA2CO,eAAe,CAACF,GAA3D,CAAxB;AACA,MAAMmB,eAAe,GAAG,6BAAeL,QAAf,EAAyBhB,kBAAzB,CAAxB;;AACA,MAAMsB,iBAAiB,mCAAQF,eAAR,GAA4BC,eAA5B,CAAvB;;AAEA,MAAItB,SAAJ,EAAe;AACf,gCAAgBuB,iBAAhB,EAAmC,IAAnC;AACAjB,EAAAA,kBAAkB,iCAAMD,eAAN;AAAuBD,IAAAA,eAAe,EAAE;AAAxC,KAAlB;AAEA,SAAO,IAAP;AACD,CA9BD;;AAgCAT,SAAS,CAAC6B,SAAV,GAAsB;AACpBvB,EAAAA,kBAAkB,EAAEwB,sBAAUC,KAAV,CAAgBC,UADhB;AAEpB9B,EAAAA,MAAM,EAAE4B,sBAAUG,MAAV,CAAiBD,UAFL;AAGpB7B,EAAAA,cAAc,EAAE2B,sBAAUC,KAAV,CAAgBC,UAHZ;AAIpB5B,EAAAA,QAAQ,EAAE0B,sBAAUI,MAAV,CAAiBF,UAJP;AAKpB3B,EAAAA,SAAS,EAAEyB,sBAAUK,IAAV,CAAeH;AALN,CAAtB;;eAQe,wBAAWhC,SAAX,C","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 (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"],"file":"GTMRender.js"}
1
+ {"version":3,"sources":["../../src/GoogleTagManager/GTMRender.js"],"names":["GTMRender","router","action","propsToDisplay","parentId","webVitals","userPropsToDisplay","asPath","url","shouldPushLayer","currentLocation","setCurrentLocation","variables","id","data","error","loading","userId","hasUserProps","length","userProps","skip","userData","userLoading","entityData","message","dataLayerObject","userLayerObject","extendedDataLayer","propTypes","PropTypes","array","isRequired","object","string","bool"],"mappings":";;;;;;;;;;;;;;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ourcesContent":["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"],"file":"GTMRender.js"}
@@ -51,6 +51,7 @@ const GTMRender = ({
51
51
  skip: !hasUserProps
52
52
  });
53
53
  if (loading || userLoading || !data || !data.entityData) return null;
54
+ if (data.entityData.id !== parentId) return null;
54
55
  if (error) return error.message;
55
56
  if (currentLocation.url !== asPath) setCurrentLocation({
56
57
  url: asPath,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/GoogleTagManager/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"],"mappings":";;;;;;AAAA,SAASA,QAAT,QAAyB,OAAzB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,QAAT,QAAyB,gBAAzB;AACA,SAASC,UAAT,QAA2B,aAA3B;AACA,SAASC,OAAT,QAAwB,+BAAxB;AACA,SAASC,eAAT,QAAgC,yBAAhC;AACA,SACEC,cADF,EAEEC,qBAFF,EAGEC,eAHF,EAIEC,mBAJF,EAKEC,cALF,QAMO,YANP;;AAQA,MAAMC,SAAS,GAAG,CAAC;AAAEC,EAAAA,MAAF;AAAUC,EAAAA,MAAV;AAAkBC,EAAAA,cAAlB;AAAkCC,EAAAA,QAAlC;AAA4CC,EAAAA,SAA5C;AAAuDC,EAAAA;AAAvD,CAAD,KAAiF;AACjG,QAAM;AAAEC,IAAAA;AAAF,MAAaN,MAAnB;AACA,QAAM,CAACO,eAAD,EAAkBC,kBAAlB,IAAwCpB,QAAQ,CAAC;AAAEqB,IAAAA,GAAG,EAAE,EAAP;AAAWC,IAAAA,eAAe,EAAE;AAA5B,GAAD,CAAtD;AAEA,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA,KAAR;AAAeC,IAAAA;AAAf,MAA2BvB,QAAQ,CAACW,MA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,SAAJ,EAAeT,qBAAqB;AACpCC,EAAAA,eAAe,CAAC+B,iBAAD,EAAoB,IAApB,CAAf;AACAnB,EAAAA,kBAAkB,iCAAMD,eAAN;AAAuBG,IAAAA,eAAe,EAAE;AAAxC,KAAlB;AAEA,SAAO,IAAP;AACD,CA9BD;;AAgCAX,SAAS,CAAC6B,SAAV,GAAsB;AACpBvB,EAAAA,kBAAkB,EAAEhB,SAAS,CAACwC,KAAV,CAAgBC,UADhB;AAEpB7B,EAAAA,MAAM,EAAEZ,SAAS,CAAC0C,MAAV,CAAiBD,UAFL;AAGpB5B,EAAAA,cAAc,EAAEb,SAAS,CAACwC,KAAV,CAAgBC,UAHZ;AAIpB3B,EAAAA,QAAQ,EAAEd,SAAS,CAAC2C,MAAV,CAAiBF,UAJP;AAKpB1B,EAAAA,SAAS,EAAEf,SAAS,CAAC4C,IAAV,CAAeH;AALN,CAAtB;AAQA,eAAevC,UAAU,CAACQ,SAAD,CAAzB","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 (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"],"file":"GTMRender.js"}
1
+ {"version":3,"sources":["../../src/GoogleTagManager/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"],"mappings":";;;;;;AAAA,SAASA,QAAT,QAAyB,OAAzB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,QAAT,QAAyB,gBAAzB;AACA,SAASC,UAAT,QAA2B,aAA3B;AACA,SAASC,OAAT,QAAwB,+BAAxB;AACA,SAASC,eAAT,QAAgC,yBAAhC;AACA,SACEC,cADF,EAEEC,qBAFF,EAGEC,eAHF,EAIEC,mBAJF,EAKEC,cALF,QAMO,YANP;;AAQA,MAAMC,SAAS,GAAG,CAAC;AAAEC,EAAAA,MAAF;AAAUC,EAAAA,MAAV;AAAkBC,EAAAA,cAAl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BH,MAA5B,EAAoCE,kBAAkB,CAAC;AAAEC,IAAAA,GAAG,EAAEH,MAAP;AAAeI,IAAAA,eAAe,EAAE;AAAhC,GAAD,CAAlB;AACpC,MAAI,CAACH,eAAe,CAACG,eAArB,EAAsC,OAAO,IAAP;AAEtC,QAAM;AAAEa,IAAAA;AAAF,MAAiBZ,IAAvB;AACA,QAAMc,eAAe,GAAG/B,cAAc,CAAC6B,UAAD,EAAarB,cAAb,EAA6BK,eAAe,CAACE,GAA7C,CAAtC;AACA,QAAMiB,eAAe,GAAG5B,cAAc,CAACsB,QAAD,EAAWf,kBAAX,CAAtC;;AACA,QAAMsB,iBAAiB,mCAAQF,eAAR,GAA4BC,eAA5B,CAAvB;;AAEA,MAAItB,SAAJ,EAAeT,qBAAqB;AACpCC,EAAAA,eAAe,CAAC+B,iBAAD,EAAoB,IAApB,CAAf;AACAnB,EAAAA,kBAAkB,iCAAMD,eAAN;AAAuBG,IAAAA,eAAe,EAAE;AAAxC,KAAlB;AAEA,SAAO,IAAP;AACD,CA/BD;;AAiCAX,SAAS,CAAC6B,SAAV,GAAsB;AACpBvB,EAAAA,kBAAkB,EAAEhB,SAAS,CAACwC,KAAV,CAAgBC,UADhB;AAEpB7B,EAAAA,MAAM,EAAEZ,SAAS,CAAC0C,MAAV,CAAiBD,UAFL;AAGpB5B,EAAAA,cAAc,EAAEb,SAAS,CAACwC,KAAV,CAAgBC,UAHZ;AAIpB3B,EAAAA,QAAQ,EAAEd,SAAS,CAAC2C,MAAV,CAAiBF,UAJP;AAKpB1B,EAAAA,SAAS,EAAEf,SAAS,CAAC4C,IAAV,CAAeH;AALN,CAAtB;AAQA,eAAevC,UAAU,CAACQ,SAAD,CAAzB","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"],"file":"GTMRender.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaze-cms/plugin-gtm-fe",
3
- "version": "0.124.0-alpha.0",
3
+ "version": "0.124.0-alpha.3",
4
4
  "description": "Blaze GTM plugin fe",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-es/index.js",
@@ -28,8 +28,8 @@
28
28
  "license": "GPL-3.0",
29
29
  "dependencies": {
30
30
  "@blaze-cms/core-auth-ui": "^0.119.0",
31
- "@blaze-cms/nextjs-components": "^0.123.0",
32
- "@blaze-cms/react-page-builder": "^0.124.0-alpha.0",
31
+ "@blaze-cms/nextjs-components": "^0.124.0-alpha.2",
32
+ "@blaze-cms/react-page-builder": "^0.124.0-alpha.3",
33
33
  "@blaze-cms/setup-ui": "^0.92.0",
34
34
  "core-js": "^3.2.1",
35
35
  "regenerator-runtime": "^0.13.3",
@@ -45,5 +45,5 @@
45
45
  "lib/*",
46
46
  "lib-es/*"
47
47
  ],
48
- "gitHead": "30ecfbfe736cb60cc83916cf154700dfeb8f0e74"
48
+ "gitHead": "a1111541646b69aba70356809b369b61da895d99"
49
49
  }
@@ -28,6 +28,7 @@ const GTMRender = ({ router, action, propsToDisplay, parentId, webVitals, userPr
28
28
  });
29
29
 
30
30
  if (loading || userLoading || !data || !data.entityData) return null;
31
+ if (data.entityData.id !== parentId) return null;
31
32
  if (error) return error.message;
32
33
  if (currentLocation.url !== asPath) setCurrentLocation({ url: asPath, shouldPushLayer: true });
33
34
  if (!currentLocation.shouldPushLayer) return null;