@gem-sdk/pages 1.63.17 → 1.64.0

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.
@@ -69,7 +69,8 @@ const InteractionSelectOnPageHeader = ()=>{
69
69
  })
70
70
  });
71
71
  };
72
- return isSelectOnPage && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
72
+ if (!isSelectOnPage) return null;
73
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
73
74
  children: [
74
75
  /*#__PURE__*/ jsxRuntime.jsx("header", {
75
76
  className: "gp-flex gp-text-[12px] gp-justify-center gp-items-center gp-h-10 gp-fixed gp-top-0 gp-left-0 gp-w-full gp-z-[1000] gp-bg-[#151515] gp-text-white interaction-select-mode-header",
@@ -10,6 +10,7 @@ var getFallback = require('../helpers/get-fallback.js');
10
10
  var normalize = require('../helpers/normalize.js');
11
11
  var parseJson = require('../helpers/parse-json.js');
12
12
  var customFonts = require('../custom-fonts.js');
13
+ var sentry = require('../helpers/sentry.js');
13
14
 
14
15
  const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
15
16
  try {
@@ -31,6 +32,10 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
31
32
  ])
32
33
  ]);
33
34
  if (theme.status === 'rejected') {
35
+ sentry.sentryCaptureException('PreviewThemePageDocument', JSON.stringify(theme), {
36
+ variables,
37
+ theme
38
+ });
34
39
  throw new Error(theme.reason?.[0]);
35
40
  }
36
41
  const dataBuilder = theme.value.previewThemePage;
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ var nextjs = require('@sentry/nextjs');
4
+
5
+ const sentryCaptureException = (funcName, message, data, options)=>{
6
+ nextjs.withScope((scope)=>{
7
+ scope.setLevel(options?.level ?? 'log');
8
+ if (options?.tag) {
9
+ scope.setTag(options?.tag.key, options?.tag.value);
10
+ }
11
+ scope.setExtra('function', funcName);
12
+ scope.setExtra('data', JSON.stringify(data));
13
+ nextjs.captureMessage(`${funcName}: ${message}`);
14
+ });
15
+ };
16
+
17
+ exports.sentryCaptureException = sentryCaptureException;
@@ -44,6 +44,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
44
44
  })
45
45
  });
46
46
  }
47
+ const hasInteraction = (interaction?.value || []).length > 0;
47
48
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
48
49
  children: [
49
50
  /*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
@@ -93,7 +94,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
93
94
  isPostPurchase && /*#__PURE__*/ jsxRuntime.jsx(Header.default, {
94
95
  pageType: "POST_PURCHASE"
95
96
  }),
96
- /*#__PURE__*/ jsxRuntime.jsx("div", {
97
+ hasInteraction && /*#__PURE__*/ jsxRuntime.jsx("div", {
97
98
  dangerouslySetInnerHTML: {
98
99
  __html: `<div id="gp-interaction" style="display: none;">${JSON.stringify(interaction?.value || [])}</div>`
99
100
  }
@@ -110,7 +111,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
110
111
  /*#__PURE__*/ jsxRuntime.jsx(core.Render, {
111
112
  uid: builder.uid
112
113
  }),
113
- /*#__PURE__*/ jsxRuntime.jsx(Script, {
114
+ hasInteraction && /*#__PURE__*/ jsxRuntime.jsx(Script, {
114
115
  defer: true,
115
116
  src: `${baseAssetURL}/assets-v2/gp-flow-action-lip.js`
116
117
  })
@@ -65,7 +65,8 @@ const InteractionSelectOnPageHeader = ()=>{
65
65
  })
66
66
  });
67
67
  };
68
- return isSelectOnPage && /*#__PURE__*/ jsxs(Fragment, {
68
+ if (!isSelectOnPage) return null;
69
+ return /*#__PURE__*/ jsxs(Fragment, {
69
70
  children: [
70
71
  /*#__PURE__*/ jsx("header", {
71
72
  className: "gp-flex gp-text-[12px] gp-justify-center gp-items-center gp-h-10 gp-fixed gp-top-0 gp-left-0 gp-w-full gp-z-[1000] gp-bg-[#151515] gp-text-white interaction-select-mode-header",
@@ -8,6 +8,7 @@ import { getFallbackV2 } from '../helpers/get-fallback.js';
8
8
  import { parseBuilderTemplateV2 } from '../helpers/normalize.js';
9
9
  import { parseJson, serializableJson } from '../helpers/parse-json.js';
10
10
  import { getCustomFonts } from '../custom-fonts.js';
11
+ import { sentryCaptureException } from '../helpers/sentry.js';
11
12
 
12
13
  const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
13
14
  try {
@@ -29,6 +30,10 @@ const getStaticPagePropsPreview = (fetcher, shopifyFetcher)=>async (slug)=>{
29
30
  ])
30
31
  ]);
31
32
  if (theme.status === 'rejected') {
33
+ sentryCaptureException('PreviewThemePageDocument', JSON.stringify(theme), {
34
+ variables,
35
+ theme
36
+ });
32
37
  throw new Error(theme.reason?.[0]);
33
38
  }
34
39
  const dataBuilder = theme.value.previewThemePage;
@@ -0,0 +1,15 @@
1
+ import { withScope, captureMessage } from '@sentry/nextjs';
2
+
3
+ const sentryCaptureException = (funcName, message, data, options)=>{
4
+ withScope((scope)=>{
5
+ scope.setLevel(options?.level ?? 'log');
6
+ if (options?.tag) {
7
+ scope.setTag(options?.tag.key, options?.tag.value);
8
+ }
9
+ scope.setExtra('function', funcName);
10
+ scope.setExtra('data', JSON.stringify(data));
11
+ captureMessage(`${funcName}: ${message}`);
12
+ });
13
+ };
14
+
15
+ export { sentryCaptureException };
@@ -42,6 +42,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
42
42
  })
43
43
  });
44
44
  }
45
+ const hasInteraction = (interaction?.value || []).length > 0;
45
46
  return /*#__PURE__*/ jsxs(Fragment, {
46
47
  children: [
47
48
  /*#__PURE__*/ jsx(NextSeo, {
@@ -91,7 +92,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
91
92
  isPostPurchase && /*#__PURE__*/ jsx(Header, {
92
93
  pageType: "POST_PURCHASE"
93
94
  }),
94
- /*#__PURE__*/ jsx("div", {
95
+ hasInteraction && /*#__PURE__*/ jsx("div", {
95
96
  dangerouslySetInnerHTML: {
96
97
  __html: `<div id="gp-interaction" style="display: none;">${JSON.stringify(interaction?.value || [])}</div>`
97
98
  }
@@ -108,7 +109,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
108
109
  /*#__PURE__*/ jsx(Render, {
109
110
  uid: builder.uid
110
111
  }),
111
- /*#__PURE__*/ jsx(Script, {
112
+ hasInteraction && /*#__PURE__*/ jsx(Script, {
112
113
  defer: true,
113
114
  src: `${baseAssetURL}/assets-v2/gp-flow-action-lip.js`
114
115
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "1.63.17",
3
+ "version": "1.64.0",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -26,7 +26,7 @@
26
26
  "next": "latest"
27
27
  },
28
28
  "devDependencies": {
29
- "@gem-sdk/core": "1.63.17",
29
+ "@gem-sdk/core": "1.64.0",
30
30
  "@gem-sdk/plugin-cookie-bar": "1.58.0",
31
31
  "@gem-sdk/plugin-quick-view": "1.58.0",
32
32
  "@gem-sdk/plugin-sticky-add-to-cart": "1.58.0"