@graphcommerce/googletagmanager 6.0.0-canary.26 → 6.0.0-canary.28

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
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.0.0-canary.28
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1823](https://github.com/graphcommerce-org/graphcommerce/pull/1823) [`605d74434`](https://github.com/graphcommerce-org/graphcommerce/commit/605d74434b78baa83f3574b6a4249eae0431d570) - Fix/upgrade instructions ([@paales](https://github.com/paales))
8
+
9
+ ## 6.0.0-canary.27
10
+
11
+ ### Patch Changes
12
+
13
+ - [#1821](https://github.com/graphcommerce-org/graphcommerce/pull/1821) [`1abc50a21`](https://github.com/graphcommerce-org/graphcommerce/commit/1abc50a21103270fad04e4a9ea892ee1e75233e9) - Fix regression bugs and upgrade packages to latest versions ([@paales](https://github.com/paales))
14
+
3
15
  ## 6.0.0-canary.26
4
16
 
5
17
  ## 6.0.0-canary.25
@@ -21,8 +21,6 @@ export function GoogleTagManagerScript() {
21
21
  }
22
22
  }, [router.events])
23
23
 
24
- if (!id) return null
25
-
26
24
  return (
27
25
  <>
28
26
  <Script id={`gtm-${id}`} strategy='afterInteractive'>{`
@@ -35,7 +33,7 @@ export function GoogleTagManagerScript() {
35
33
  <noscript>
36
34
  {/* eslint-disable-next-line jsx-a11y/iframe-has-title */}
37
35
  <iframe
38
- src={`https://www.googletagmanager.com/ns.html?id=${process.env.NEXT_PUBLIC_GTM_ID}`}
36
+ src={`https://www.googletagmanager.com/ns.html?id=${id}`}
39
37
  height='0'
40
38
  width='0'
41
39
  style={{ display: 'none', visibility: 'hidden' }}
@@ -1,5 +1,7 @@
1
1
  import { useI18nConfig } from '@graphcommerce/next-ui'
2
2
 
3
3
  export function useGoogleTagmanagerId() {
4
- return useI18nConfig().googleTagmanagerId ?? import.meta.graphCommerce.googleTagmanagerId
4
+ const id = useI18nConfig().googleTagmanagerId ?? import.meta.graphCommerce.googleTagmanagerId
5
+ if (!id) throw new Error('No googleTagmanagerId found in config')
6
+ return id
5
7
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/googletagmanager",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "6.0.0-canary.26",
5
+ "version": "6.0.0-canary.28",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,16 +12,17 @@
12
12
  }
13
13
  },
14
14
  "devDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "6.0.0-canary.26",
16
- "@graphcommerce/prettier-config-pwa": "6.0.0-canary.26",
17
- "@graphcommerce/typescript-config-pwa": "6.0.0-canary.26",
15
+ "@graphcommerce/eslint-config-pwa": "6.0.0-canary.28",
16
+ "@graphcommerce/prettier-config-pwa": "6.0.0-canary.28",
17
+ "@graphcommerce/typescript-config-pwa": "6.0.0-canary.28",
18
18
  "@types/gapi.client.tagmanager": "^2.0.2"
19
19
  },
20
20
  "dependencies": {
21
- "@graphcommerce/magento-product": "6.0.0-canary.26"
21
+ "@graphcommerce/magento-product": "6.0.0-canary.28",
22
+ "@graphcommerce/next-ui": "6.0.0-canary.28"
22
23
  },
23
24
  "peerDependencies": {
24
- "next": "^13.1.1",
25
+ "next": "^13.2.0",
25
26
  "react": "^18.2.0",
26
27
  "react-dom": "^18.2.0"
27
28
  }
@@ -1,32 +1,19 @@
1
1
  import type { PagesProps } from '@graphcommerce/framer-next-pages'
2
- import type { PluginProps } from '@graphcommerce/next-config'
2
+ import type { IfConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { GoogleTagManagerScript } from '../components/GoogleTagManagerScript'
4
4
 
5
5
  export const component = 'FramerNextPages'
6
6
  export const exported = '@graphcommerce/framer-next-pages'
7
-
8
- let warned = false
7
+ export const ifConfig: IfConfig = 'googleTagmanagerId'
9
8
 
10
9
  function GtagFramerNextPages(props: PluginProps<PagesProps>) {
11
10
  const { Prev, ...rest } = props
12
-
13
- if (process.env.NEXT_PUBLIC_GTM_ID) {
14
- return (
15
- <>
16
- <GoogleTagManagerScript />
17
- <Prev {...rest} />
18
- </>
19
- )
20
- }
21
-
22
- if (process.env.NODE_ENV !== 'production') {
23
- if (!warned) {
24
- console.info('[@graphcommerce/googletagmanager]: process.env.NEXT_PUBLIC_GTM_ID not found')
25
- warned = true
26
- }
27
- }
28
-
29
- return <Prev {...rest} />
11
+ return (
12
+ <>
13
+ <GoogleTagManagerScript />
14
+ <Prev {...rest} />
15
+ </>
16
+ )
30
17
  }
31
18
 
32
19
  export const Plugin = GtagFramerNextPages