@gem-sdk/pages 1.12.0-staging-66146a03 → 1.12.0-staging-101c3f37

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.
@@ -9,8 +9,6 @@ var react = require('react');
9
9
  const FacebookPixel = ({ pixelId })=>{
10
10
  const router$1 = router.useRouter();
11
11
  react.useEffect(()=>{
12
- // This pageview only triggers the first time (it's important for Pixel to have real information)
13
- core.fpixel.pageview();
14
12
  const handleRouteChange = ()=>{
15
13
  core.fpixel.pageview();
16
14
  };
@@ -26,7 +24,7 @@ const FacebookPixel = ({ pixelId })=>{
26
24
  if (!pixelId) return null;
27
25
  return /*#__PURE__*/ jsxRuntime.jsx(Script, {
28
26
  id: "fb-pixel",
29
- strategy: "afterInteractive",
27
+ strategy: "lazyOnload",
30
28
  dangerouslySetInnerHTML: {
31
29
  __html: `
32
30
  !function(f,b,e,v,n,t,s)
@@ -38,6 +36,7 @@ const FacebookPixel = ({ pixelId })=>{
38
36
  s.parentNode.insertBefore(t,s)}(window, document,'script',
39
37
  'https://connect.facebook.net/en_US/fbevents.js');
40
38
  fbq('init', ${pixelId});
39
+ fbq('track', 'PageView');
41
40
  `
42
41
  }
43
42
  });
@@ -22,17 +22,20 @@ const GoogleAnalytic = ({ trackingId })=>{
22
22
  trackingId,
23
23
  router$1.events
24
24
  ]);
25
+ const handleOnReady = ()=>{
26
+ core.gtag.pageview(router$1.pathname, trackingId);
27
+ };
25
28
  if (!trackingId) return null;
26
29
  if (trackingId.startsWith('UA-')) return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
27
30
  children: [
28
31
  /*#__PURE__*/ jsxRuntime.jsx(Script, {
29
- src: "https://www.google-analytics.com/analytics.js",
30
- async: true,
31
- strategy: "afterInteractive"
32
+ strategy: "lazyOnload",
33
+ onReady: handleOnReady,
34
+ src: "https://www.google-analytics.com/analytics.js"
32
35
  }),
33
36
  /*#__PURE__*/ jsxRuntime.jsx(Script, {
34
- strategy: "afterInteractive",
35
37
  id: "google-analytics",
38
+ strategy: "lazyOnload",
36
39
  dangerouslySetInnerHTML: {
37
40
  __html: `window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
38
41
  ga('create', '${trackingId}', 'auto');
@@ -46,12 +49,13 @@ const GoogleAnalytic = ({ trackingId })=>{
46
49
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
47
50
  children: [
48
51
  /*#__PURE__*/ jsxRuntime.jsx(Script, {
49
- strategy: "afterInteractive",
52
+ strategy: "lazyOnload",
53
+ onReady: handleOnReady,
50
54
  src: `https://www.googletagmanager.com/gtag/js?id=${trackingId}`
51
55
  }),
52
56
  /*#__PURE__*/ jsxRuntime.jsx(Script, {
53
57
  id: "gtag-init",
54
- strategy: "afterInteractive",
58
+ strategy: "lazyOnload",
55
59
  dangerouslySetInnerHTML: {
56
60
  __html: `
57
61
  window.dataLayer = window.dataLayer || [];
@@ -7,7 +7,7 @@ const TikTokPixel = ({ pixelId })=>{
7
7
  if (!pixelId) return null;
8
8
  return /*#__PURE__*/ jsxRuntime.jsx(Script, {
9
9
  id: "tiktok-pixel",
10
- strategy: "afterInteractive",
10
+ strategy: "lazyOnload",
11
11
  dangerouslySetInnerHTML: {
12
12
  __html: `
13
13
  !function (w, d, t) {
@@ -25,6 +25,7 @@ const getBuilderProps = async (fetcher, shopifyFetcher)=>{
25
25
  const countryIsoCode = shopMeta?.localization.country.isoCode ?? null;
26
26
  const locale = !languageIsoCode || !countryIsoCode ? null : `${languageIsoCode}-${countryIsoCode}`;
27
27
  return parseJson.serializableJson({
28
+ moneyFormat: shopMeta?.shop.moneyFormat ?? null,
28
29
  currency: shopMeta?.localization.country.currency.isoCode ?? null,
29
30
  languageIsoCode,
30
31
  countryIsoCode,
@@ -119,6 +119,7 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
119
119
  swr: {
120
120
  fallback
121
121
  },
122
+ moneyFormat: shopMeta?.shop.moneyFormat ?? null,
122
123
  currency: shopMeta?.localization.country.currency.isoCode ?? null,
123
124
  languageIsoCode,
124
125
  countryIsoCode,
@@ -138,6 +138,7 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
138
138
  swr: {
139
139
  fallback
140
140
  },
141
+ moneyFormat: shopMeta?.shop.moneyFormat ?? null,
141
142
  currency: shopMeta?.localization.country.currency.isoCode ?? null,
142
143
  locale,
143
144
  languageIsoCode,
@@ -122,6 +122,7 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
122
122
  fontStyle,
123
123
  builderData: pageTemplate,
124
124
  pageType,
125
+ moneyFormat: shopMeta?.shop.moneyFormat ?? null,
125
126
  currency: shopMeta?.localization.country.currency.isoCode ?? null,
126
127
  languageIsoCode,
127
128
  countryIsoCode,
@@ -119,6 +119,7 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
119
119
  fontStyle,
120
120
  builderData: pageTemplate,
121
121
  pageType,
122
+ moneyFormat: shopMeta?.shop.moneyFormat ?? null,
122
123
  currency: shopMeta?.localization.country.currency.isoCode ?? null,
123
124
  languageIsoCode,
124
125
  countryIsoCode,
@@ -132,6 +132,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
132
132
  fontStyle,
133
133
  builderData: pageTemplate,
134
134
  pageType,
135
+ moneyFormat: shopMeta?.shop.moneyFormat ?? null,
135
136
  currency: shopMeta?.localization.country.currency.isoCode ?? null,
136
137
  languageIsoCode,
137
138
  countryIsoCode,
@@ -7,8 +7,6 @@ import { useEffect } from 'react';
7
7
  const FacebookPixel = ({ pixelId })=>{
8
8
  const router = useRouter();
9
9
  useEffect(()=>{
10
- // This pageview only triggers the first time (it's important for Pixel to have real information)
11
- fpixel.pageview();
12
10
  const handleRouteChange = ()=>{
13
11
  fpixel.pageview();
14
12
  };
@@ -24,7 +22,7 @@ const FacebookPixel = ({ pixelId })=>{
24
22
  if (!pixelId) return null;
25
23
  return /*#__PURE__*/ jsx(Script, {
26
24
  id: "fb-pixel",
27
- strategy: "afterInteractive",
25
+ strategy: "lazyOnload",
28
26
  dangerouslySetInnerHTML: {
29
27
  __html: `
30
28
  !function(f,b,e,v,n,t,s)
@@ -36,6 +34,7 @@ const FacebookPixel = ({ pixelId })=>{
36
34
  s.parentNode.insertBefore(t,s)}(window, document,'script',
37
35
  'https://connect.facebook.net/en_US/fbevents.js');
38
36
  fbq('init', ${pixelId});
37
+ fbq('track', 'PageView');
39
38
  `
40
39
  }
41
40
  });
@@ -20,17 +20,20 @@ const GoogleAnalytic = ({ trackingId })=>{
20
20
  trackingId,
21
21
  router.events
22
22
  ]);
23
+ const handleOnReady = ()=>{
24
+ gtag.pageview(router.pathname, trackingId);
25
+ };
23
26
  if (!trackingId) return null;
24
27
  if (trackingId.startsWith('UA-')) return /*#__PURE__*/ jsxs(Fragment, {
25
28
  children: [
26
29
  /*#__PURE__*/ jsx(Script, {
27
- src: "https://www.google-analytics.com/analytics.js",
28
- async: true,
29
- strategy: "afterInteractive"
30
+ strategy: "lazyOnload",
31
+ onReady: handleOnReady,
32
+ src: "https://www.google-analytics.com/analytics.js"
30
33
  }),
31
34
  /*#__PURE__*/ jsx(Script, {
32
- strategy: "afterInteractive",
33
35
  id: "google-analytics",
36
+ strategy: "lazyOnload",
34
37
  dangerouslySetInnerHTML: {
35
38
  __html: `window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
36
39
  ga('create', '${trackingId}', 'auto');
@@ -44,12 +47,13 @@ const GoogleAnalytic = ({ trackingId })=>{
44
47
  return /*#__PURE__*/ jsxs(Fragment, {
45
48
  children: [
46
49
  /*#__PURE__*/ jsx(Script, {
47
- strategy: "afterInteractive",
50
+ strategy: "lazyOnload",
51
+ onReady: handleOnReady,
48
52
  src: `https://www.googletagmanager.com/gtag/js?id=${trackingId}`
49
53
  }),
50
54
  /*#__PURE__*/ jsx(Script, {
51
55
  id: "gtag-init",
52
- strategy: "afterInteractive",
56
+ strategy: "lazyOnload",
53
57
  dangerouslySetInnerHTML: {
54
58
  __html: `
55
59
  window.dataLayer = window.dataLayer || [];
@@ -5,7 +5,7 @@ const TikTokPixel = ({ pixelId })=>{
5
5
  if (!pixelId) return null;
6
6
  return /*#__PURE__*/ jsx(Script, {
7
7
  id: "tiktok-pixel",
8
- strategy: "afterInteractive",
8
+ strategy: "lazyOnload",
9
9
  dangerouslySetInnerHTML: {
10
10
  __html: `
11
11
  !function (w, d, t) {
@@ -23,6 +23,7 @@ const getBuilderProps = async (fetcher, shopifyFetcher)=>{
23
23
  const countryIsoCode = shopMeta?.localization.country.isoCode ?? null;
24
24
  const locale = !languageIsoCode || !countryIsoCode ? null : `${languageIsoCode}-${countryIsoCode}`;
25
25
  return serializableJson({
26
+ moneyFormat: shopMeta?.shop.moneyFormat ?? null,
26
27
  currency: shopMeta?.localization.country.currency.isoCode ?? null,
27
28
  languageIsoCode,
28
29
  countryIsoCode,
@@ -117,6 +117,7 @@ const getHomePagePropsV2 = (fetcher, shopifyFetcher)=>async ()=>{
117
117
  swr: {
118
118
  fallback
119
119
  },
120
+ moneyFormat: shopMeta?.shop.moneyFormat ?? null,
120
121
  currency: shopMeta?.localization.country.currency.isoCode ?? null,
121
122
  languageIsoCode,
122
123
  countryIsoCode,
@@ -136,6 +136,7 @@ const getHomePageProps = (fetcher, shopifyFetcher)=>async ()=>{
136
136
  swr: {
137
137
  fallback
138
138
  },
139
+ moneyFormat: shopMeta?.shop.moneyFormat ?? null,
139
140
  currency: shopMeta?.localization.country.currency.isoCode ?? null,
140
141
  locale,
141
142
  languageIsoCode,
@@ -120,6 +120,7 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
120
120
  fontStyle,
121
121
  builderData: pageTemplate,
122
122
  pageType,
123
+ moneyFormat: shopMeta?.shop.moneyFormat ?? null,
123
124
  currency: shopMeta?.localization.country.currency.isoCode ?? null,
124
125
  languageIsoCode,
125
126
  countryIsoCode,
@@ -117,6 +117,7 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
117
117
  fontStyle,
118
118
  builderData: pageTemplate,
119
119
  pageType,
120
+ moneyFormat: shopMeta?.shop.moneyFormat ?? null,
120
121
  currency: shopMeta?.localization.country.currency.isoCode ?? null,
121
122
  languageIsoCode,
122
123
  countryIsoCode,
@@ -130,6 +130,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
130
130
  fontStyle,
131
131
  builderData: pageTemplate,
132
132
  pageType,
133
+ moneyFormat: shopMeta?.shop.moneyFormat ?? null,
133
134
  currency: shopMeta?.localization.country.currency.isoCode ?? null,
134
135
  languageIsoCode,
135
136
  countryIsoCode,
@@ -20,6 +20,8 @@ type PageBuilderProps = {
20
20
  shopToken?: string | null;
21
21
  pageHandle?: string | null;
22
22
  currency?: string | null;
23
+ moneyFormat?: string | null;
24
+ moneyWithCurrencyFormat?: string | null;
23
25
  locale?: string | null;
24
26
  languageIsoCode?: string | null;
25
27
  countryIsoCode?: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "1.12.0-staging-66146a03",
3
+ "version": "1.12.0-staging-101c3f37",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -25,7 +25,7 @@
25
25
  "next-seo": "^6.0.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@gem-sdk/core": "1.11.1-staging-66146a03",
28
+ "@gem-sdk/core": "1.12.0-staging-2b439c82",
29
29
  "@gem-sdk/plugin-cookie-bar": "1.11.1-staging-66146a03",
30
30
  "@gem-sdk/plugin-quick-view": "1.11.1-staging-66146a03",
31
31
  "@gem-sdk/plugin-sticky-add-to-cart": "1.11.1-staging-66146a03"