@gem-sdk/pages 2.0.0-staging.152 → 2.0.0-staging.709

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.
Files changed (62) hide show
  1. package/dist/cjs/components/FooterForPostPurchase.js +1 -1
  2. package/dist/cjs/components/builder/Footer.js +2 -2
  3. package/dist/cjs/components/builder/Header.js +0 -1
  4. package/dist/cjs/components/builder/Toolbar.js +6 -0
  5. package/dist/cjs/components/builder/Toolbox.js +27 -14
  6. package/dist/cjs/components/composable/getListFontWeightTypos.js +14 -0
  7. package/dist/cjs/components/image-to-layout/AddSectionImageToLayout.js +5 -4
  8. package/dist/cjs/components/image-to-layout/DropElement.js +34 -9
  9. package/dist/cjs/constants/index.js +15 -0
  10. package/dist/cjs/libs/api/get-home-page-props-v2.js +20 -8
  11. package/dist/cjs/libs/api/get-home-page-props.js +15 -3
  12. package/dist/cjs/libs/api/get-post-purchase-props-preview.js +38 -5
  13. package/dist/cjs/libs/api/get-static-page-props-preview.js +5 -0
  14. package/dist/cjs/libs/api/get-static-page-props-v2.js +19 -10
  15. package/dist/cjs/libs/api/get-static-page-props.js +16 -3
  16. package/dist/cjs/libs/google-fonts.js +25 -5
  17. package/dist/cjs/libs/helpers/gen-fonts.js +9 -3
  18. package/dist/cjs/libs/helpers/get-metafield.js +7 -0
  19. package/dist/cjs/libs/helpers/normalize.js +2 -1
  20. package/dist/cjs/libs/helpers/parse-json.js +1 -1
  21. package/dist/cjs/libs/helpers/sentry.js +17 -0
  22. package/dist/cjs/pages/404.js +1 -0
  23. package/dist/cjs/pages/500.js +1 -0
  24. package/dist/cjs/pages/CollectionGlobalProvider.js +1 -0
  25. package/dist/cjs/pages/builder.js +46 -41
  26. package/dist/cjs/pages/collection-detail.js +1 -0
  27. package/dist/cjs/pages/preview.js +1 -0
  28. package/dist/cjs/pages/product-detail.js +1 -0
  29. package/dist/cjs/pages/static-v2.js +22 -17
  30. package/dist/cjs/pages/static.js +1 -0
  31. package/dist/esm/components/FooterForPostPurchase.js +1 -1
  32. package/dist/esm/components/builder/Footer.js +2 -2
  33. package/dist/esm/components/builder/Header.js +1 -2
  34. package/dist/esm/components/builder/Toolbar.js +6 -0
  35. package/dist/esm/components/builder/Toolbox.js +27 -14
  36. package/dist/esm/components/composable/getListFontWeightTypos.js +12 -0
  37. package/dist/esm/components/image-to-layout/AddSectionImageToLayout.js +6 -5
  38. package/dist/esm/components/image-to-layout/DropElement.js +34 -9
  39. package/dist/esm/constants/index.js +15 -0
  40. package/dist/esm/libs/api/get-home-page-props-v2.js +21 -9
  41. package/dist/esm/libs/api/get-home-page-props.js +16 -4
  42. package/dist/esm/libs/api/get-post-purchase-props-preview.js +39 -6
  43. package/dist/esm/libs/api/get-static-page-props-preview.js +5 -0
  44. package/dist/esm/libs/api/get-static-page-props-v2.js +19 -10
  45. package/dist/esm/libs/api/get-static-page-props.js +17 -4
  46. package/dist/esm/libs/google-fonts.js +25 -5
  47. package/dist/esm/libs/helpers/gen-fonts.js +9 -3
  48. package/dist/esm/libs/helpers/get-metafield.js +5 -0
  49. package/dist/esm/libs/helpers/normalize.js +2 -1
  50. package/dist/esm/libs/helpers/parse-json.js +1 -1
  51. package/dist/esm/libs/helpers/sentry.js +15 -0
  52. package/dist/esm/pages/404.js +1 -0
  53. package/dist/esm/pages/500.js +1 -0
  54. package/dist/esm/pages/CollectionGlobalProvider.js +1 -0
  55. package/dist/esm/pages/builder.js +47 -42
  56. package/dist/esm/pages/collection-detail.js +1 -0
  57. package/dist/esm/pages/preview.js +1 -0
  58. package/dist/esm/pages/product-detail.js +1 -0
  59. package/dist/esm/pages/static-v2.js +23 -18
  60. package/dist/esm/pages/static.js +1 -0
  61. package/dist/types/index.d.ts +61 -53
  62. package/package.json +6 -6
@@ -10,6 +10,8 @@ var normalize = require('../helpers/normalize.js');
10
10
  var parseJson = require('../helpers/parse-json.js');
11
11
  var nextjs = require('@sentry/nextjs');
12
12
  var customFonts = require('../custom-fonts.js');
13
+ var getMetafield = require('../helpers/get-metafield.js');
14
+ var index = require('../../constants/index.js');
13
15
 
14
16
  const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
15
17
  try {
@@ -33,7 +35,9 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
33
35
  core.PublishedShopMetasDocument,
34
36
  {
35
37
  keys: [
36
- 'source_font'
38
+ 'source_font',
39
+ index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
40
+ index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
37
41
  ]
38
42
  }
39
43
  ])
@@ -56,24 +60,29 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
56
60
  customFonts.getCustomFonts(themePageCustomFonts)
57
61
  ]);
58
62
  const mobileOnly = dataBuilder.isMobile ?? false;
59
- const description = dataBuilder?.themePageDataSEO?.find((item)=>item?.key === 'global-meta-description')?.value;
60
- const thumbnail = parseJson.parseJson(dataBuilder?.themePageDataSEO?.find((item)=>item?.key === 'global-meta-thumbnail')?.value);
63
+ const description = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
64
+ const title = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_TITLE, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_TITLE)?.value;
65
+ const thumbnail = parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
66
+ const noindex = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.NOINDEX_KEY, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.NOINDEX_KEY)?.value;
67
+ const nofollow = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.NOFOLLOW_KEY, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.NOFOLLOW_KEY)?.value;
61
68
  const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
62
69
  const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
63
70
  const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
64
71
  const seo = {
65
72
  defaultTitle: shopMeta?.shop.name,
66
- title: dataBuilder?.name,
73
+ title: title || dataBuilder?.name,
67
74
  description: description ?? shopMeta?.shop.description,
68
75
  openGraph: {
69
76
  site_name: shopMeta?.shop.name,
70
77
  locale: shopMeta?.localization.country.isoCode,
71
- title: dataBuilder?.name ?? shopMeta?.shop.name,
78
+ title: (title || dataBuilder?.name) ?? shopMeta?.shop.name,
72
79
  description: description ?? shopMeta?.shop.description,
73
80
  images: thumbnail ? [
74
81
  thumbnail
75
82
  ] : []
76
83
  },
84
+ noindex: noindex === 'true',
85
+ nofollow: nofollow === 'true',
77
86
  canonical: `https://${shopData?.storeProperty?.primaryDomain}/${slug}`,
78
87
  additionalMetaTags: [
79
88
  {
@@ -145,11 +154,11 @@ const getStaticPagePropsV2 = (fetcher, shopifyFetcher)=>async (slug)=>{
145
154
  swatches: parseJson.parseJson(shopData?.storeProperty?.swatchesConfig),
146
155
  seo,
147
156
  mobileOnly,
148
- gaTrackingId: dataBuilder.themePageAnalytic?.gaTrackingID ?? null,
149
- facebookPixelId: dataBuilder.themePageAnalytic?.fbPixelID ?? null,
150
- tiktokPixelId: dataBuilder.themePageAnalytic?.tiktokPixelID ?? null,
151
- customCodeHeader: dataBuilder.themePageCustomCode?.header ?? null,
152
- customCodeBody: dataBuilder.themePageCustomCode?.body ?? null,
157
+ gaTrackingId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_GA_TRACKING_ID, dataBuilder?.metafields) ?? null,
158
+ facebookPixelId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_FB_PIXEL_ID, dataBuilder?.metafields) ?? null,
159
+ tiktokPixelId: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.ANALYTICS_TIKTOK_PIXEL_ID, dataBuilder?.metafields) ?? null,
160
+ customCodeHeader: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_HEADER, dataBuilder?.metafields) ?? null,
161
+ customCodeBody: getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.CUSTOM_CODE_BODY, dataBuilder?.metafields) ?? null,
153
162
  pageHandle: dataBuilder.handle ?? null,
154
163
  customFonts: customFonts$1,
155
164
  interaction: dataBuilder?.interaction,
@@ -7,6 +7,8 @@ var genCss = require('../helpers/gen-css.js');
7
7
  var generateManifres = require('../helpers/generate-manifres.js');
8
8
  var normalize = require('../helpers/normalize.js');
9
9
  var parseJson = require('../helpers/parse-json.js');
10
+ var index = require('../../constants/index.js');
11
+ var getMetafield = require('../helpers/get-metafield.js');
10
12
 
11
13
  const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
12
14
  const pageType = 'STATIC';
@@ -14,7 +16,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
14
16
  slug,
15
17
  slugType: pageType
16
18
  };
17
- const [theme, storeProperty, shopifyMeta] = await Promise.allSettled([
19
+ const [theme, storeProperty, shopifyMeta, publishedShopMetas] = await Promise.allSettled([
18
20
  fetcher([
19
21
  core.PublishedThemePagesDocument,
20
22
  variables
@@ -24,6 +26,16 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
24
26
  ]),
25
27
  shopifyFetcher([
26
28
  adapterShopify.ShopMetaDocument
29
+ ]),
30
+ fetcher([
31
+ core.PublishedShopMetasDocument,
32
+ {
33
+ keys: [
34
+ 'source_font',
35
+ index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION,
36
+ index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL
37
+ ]
38
+ }
27
39
  ])
28
40
  ]);
29
41
  if (theme.status === 'rejected') {
@@ -31,6 +43,7 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
31
43
  pageType
32
44
  };
33
45
  }
46
+ const publishedShopMetaValue = publishedShopMetas.status === 'fulfilled' ? publishedShopMetas.value : undefined;
34
47
  const dataBuilder = theme.value.publishedThemePages?.[0];
35
48
  const pageTemplate = normalize.parseBuilderTemplate(dataBuilder);
36
49
  const fontStyle = await googleFonts.getFontFromGlobalStyle(dataBuilder?.pageStyle?.data);
@@ -55,8 +68,8 @@ const getStaticPageProps = (fetcher, shopifyFetcher)=>async (slug)=>{
55
68
  }
56
69
  return acc;
57
70
  }, {});
58
- const description = dataBuilder?.themePageDataSEO?.find((item)=>item?.key === 'global-meta-description')?.value;
59
- const thumbnail = parseJson.parseJson(dataBuilder?.themePageDataSEO?.find((item)=>item?.key === 'global-meta-thumbnail')?.value);
71
+ const description = getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_DESCRIPTION)?.value;
72
+ const thumbnail = parseJson.parseJson(getMetafield.getPublishedThemePageMetafieldByKey(index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL, dataBuilder?.metafields) || publishedShopMetaValue?.publishedShopMetas?.find((item)=>item?.key === index.PublishedThemePageMetafields.GLOBAL_META_THUMBNAIL)?.value);
60
73
  const shopMeta = shopifyMeta.status === 'fulfilled' ? shopifyMeta.value : undefined;
61
74
  const shopData = storeProperty.status === 'fulfilled' ? storeProperty.value : undefined;
62
75
  const favicon = shopData?.storeProperty?.favicon ?? '/favicon/favicon-32x32.png';
@@ -36,7 +36,27 @@ const composeFonts = (fonts)=>{
36
36
  };
37
37
  });
38
38
  };
39
- const createFontUrl = (fonts, option, fontType)=>{
39
+ const handleGenerateFontParams = (variants, fontType = 'google')=>{
40
+ const regularWeights = [];
41
+ if (!variants.length) {
42
+ return fontType === 'bunny' ? '400' : 'wght@400';
43
+ }
44
+ // Get regular weights and remove italic variants
45
+ variants.forEach((variant)=>{
46
+ if (typeof variant !== 'string' || variant?.includes('italic')) {
47
+ return;
48
+ }
49
+ const weight = variant === 'regular' ? '400' : variant;
50
+ regularWeights.push(weight);
51
+ });
52
+ // Sort weights numerically (ex: [900, 700, 400] -> [400, 700, 900])
53
+ const sortedRegularWeights = regularWeights.sort((a, b)=>Number(a) - Number(b));
54
+ // Build the variant string with only regular weights
55
+ const axisPrefix = 'wght@';
56
+ const listVariantsGoogleFonts = sortedRegularWeights.map((weight)=>weight);
57
+ return fontType === 'google' ? `${axisPrefix}${listVariantsGoogleFonts.join(';')}` : sortedRegularWeights.join(',');
58
+ };
59
+ const createFontUrl = (fonts, option, fontType = 'google')=>{
40
60
  const mainFonts = fonts.filter((font)=>{
41
61
  return !([
42
62
  'bunny',
@@ -50,8 +70,8 @@ const createFontUrl = (fonts, option, fontType)=>{
50
70
  return index === arr.findIndex((t)=>t.family === font.family);
51
71
  });
52
72
  const family = composeFonts(uniqFonts).map((font)=>{
53
- return `${font.family.replace(/ /g, '+')}:${font.variants.join(',')}`;
54
- }).join('|');
73
+ return `${font.family.replace(/ /g, '+')}:${handleGenerateFontParams(font.variants, fontType)}`;
74
+ }).join(fontType === 'google' ? '&family=' : '|');
55
75
  params.append('family', family);
56
76
  params.append('display', display);
57
77
  if (option?.subset) {
@@ -61,7 +81,7 @@ const createFontUrl = (fonts, option, fontType)=>{
61
81
  params.append('effect', option.effect);
62
82
  }
63
83
  const bunnyFontUrl = `https://fonts.bunny.net/css?family=${family}`;
64
- const googleFontUrl = `https://fonts.googleapis.com/css?${decodeURIComponent(params.toString())}`;
84
+ const googleFontUrl = `https://fonts.googleapis.com/css2?${decodeURIComponent(params.toString())}`;
65
85
  return fontType === 'bunny' ? bunnyFontUrl : googleFontUrl;
66
86
  };
67
87
  // eslint-disable-next-line max-params
@@ -87,7 +107,7 @@ async function getFonts(fonts, option, isImportFontByUrl = true, fontType) {
87
107
  }
88
108
  }
89
109
  return value;
90
- } catch (e) {
110
+ } catch (_e) {
91
111
  return '';
92
112
  }
93
113
  }
@@ -35,6 +35,9 @@ const getFontFromGroupSetting = (fonts, groupSetting)=>{
35
35
  }
36
36
  }
37
37
  };
38
+ const uniqueArray = (arr)=>{
39
+ return Array.from(new Set(arr));
40
+ };
38
41
  const getFontValue = (fonts, value)=>{
39
42
  let customFontFamily = value.custom?.fontFamily;
40
43
  if (typeof customFontFamily === 'string') {
@@ -60,15 +63,18 @@ const getFontValue = (fonts, value)=>{
60
63
  });
61
64
  const customFontWeight = value.custom?.fontWeight && variants.includes(value.custom?.fontWeight) ? value.custom?.fontWeight : variants[0];
62
65
  if (customFontWeight) {
66
+ const fontVariants = uniqueArray([
67
+ customFontWeight,
68
+ ...value?.attrs?.isAlwaysLoadBold ? [
69
+ '700'
70
+ ] : []
71
+ ]);
63
72
  const isExist = fonts.find((item)=>item.family == fontFamily && item.variants.includes(customFontWeight));
64
73
  if (!isExist) {
65
74
  const isFontFamily = fonts.find((item)=>item.family == fontFamily);
66
75
  if (isFontFamily) {
67
76
  isFontFamily.variants.push(customFontWeight);
68
77
  } else {
69
- const fontVariants = [
70
- customFontWeight
71
- ];
72
78
  if (customFontWeight !== '700') {
73
79
  if (variants.includes('700')) {
74
80
  fontVariants.push('700'); // Auto add 700 for bold in editor inline
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ const getPublishedThemePageMetafieldByKey = (key, metafields)=>{
4
+ return metafields?.find((item)=>item?.key === key)?.value;
5
+ };
6
+
7
+ exports.getPublishedThemePageMetafieldByKey = getPublishedThemePageMetafieldByKey;
@@ -74,7 +74,8 @@ function normalizePageSectionResponseV2(sections, orders) {
74
74
  const parseBuilderTemplateV2 = (data)=>{
75
75
  return normalizePageSectionResponseV2([
76
76
  ...data?.pageSections ?? [],
77
- ...data?.themePageCustomSections ?? []
77
+ ...data?.themePageCustomSections ?? [],
78
+ ...data?.themeSections ?? []
78
79
  ], data?.sectionPosition);
79
80
  };
80
81
  const parseBuilderTemplate = (data)=>{
@@ -4,7 +4,7 @@ const parseJson = (json)=>{
4
4
  if (!json) return null;
5
5
  try {
6
6
  return JSON.parse(json);
7
- } catch (e) {
7
+ } catch (_e) {
8
8
  return null;
9
9
  }
10
10
  };
@@ -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;
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -17,6 +18,7 @@ var Body = require('../components/builder/Body.js');
17
18
 
18
19
  const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, pageType, editorImageToLayout, isThemeSectionEditor, hiddenToolbar, pageName, isOriginTemplate })=>{
19
20
  const [loadSuccess, setLoadSuccess] = react.useState(false);
21
+ const { t } = core.useI18n();
20
22
  const isDisableHeaderFooter = ()=>{
21
23
  return isThemeSectionEditor;
22
24
  };
@@ -64,47 +66,50 @@ const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, page
64
66
  components: components,
65
67
  children: /*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
66
68
  data: sectionData,
67
- children: /*#__PURE__*/ jsxRuntime.jsxs(core.BuilderPreviewProvider, {
68
- pageName: pageName,
69
- state: initState,
70
- isThemeSectionEditor: isThemeSectionEditor,
71
- children: [
72
- /*#__PURE__*/ jsxRuntime.jsx(Toolbox.default, {}),
73
- !hiddenToolbar && /*#__PURE__*/ jsxRuntime.jsx(Toolbar.default, {}),
74
- /*#__PURE__*/ jsxRuntime.jsx(PopupManager.default, {}),
75
- loadSuccess && /*#__PURE__*/ jsxRuntime.jsxs("div", {
76
- className: "builder gp-z-1 gp-relative",
77
- children: [
78
- !hiddenToolbar && (isDisableHeaderFooter() ? /*#__PURE__*/ jsxRuntime.jsx("div", {
79
- className: "gp-h-[40px] gp-bg-[#ffffff] gp-border-b-[1px] gp-border-[#eeeeee]",
80
- children: /*#__PURE__*/ jsxRuntime.jsx(SwitchView.default, {})
81
- }) : /*#__PURE__*/ jsxRuntime.jsx(Header.default, {
82
- pageType: pageType,
83
- isOriginTemplate: isOriginTemplate,
84
- openPageSetting: openPageSetting
85
- })),
86
- /*#__PURE__*/ jsxRuntime.jsx(Body.default, {
87
- pageType: pageType,
88
- isThemeSectionEditor: isThemeSectionEditor
89
- }),
90
- /*#__PURE__*/ jsxRuntime.jsx(ImageToLayout.default, {
91
- editorImageToLayout: editorImageToLayout || false
92
- }),
93
- /*#__PURE__*/ jsxRuntime.jsx(AddSectionImageToLayout.default, {
94
- editorImageToLayout: editorImageToLayout || false
95
- }),
96
- /*#__PURE__*/ jsxRuntime.jsx("div", {
97
- id: "visual-content"
98
- }),
99
- !isDisableHeaderFooter() && !hiddenToolbar && /*#__PURE__*/ jsxRuntime.jsx(Footer.default, {
100
- pageType: pageType,
101
- isOriginTemplate: isOriginTemplate,
102
- openPageSetting: openPageSetting
103
- })
104
- ]
105
- })
106
- ]
107
- }, "preview")
69
+ children: /*#__PURE__*/ jsxRuntime.jsx(core.I18nProvider, {
70
+ t: t,
71
+ children: /*#__PURE__*/ jsxRuntime.jsxs(core.BuilderPreviewProvider, {
72
+ pageName: pageName,
73
+ state: initState,
74
+ isThemeSectionEditor: isThemeSectionEditor,
75
+ children: [
76
+ /*#__PURE__*/ jsxRuntime.jsx(Toolbox.default, {}),
77
+ !hiddenToolbar && /*#__PURE__*/ jsxRuntime.jsx(Toolbar.default, {}),
78
+ /*#__PURE__*/ jsxRuntime.jsx(PopupManager.default, {}),
79
+ loadSuccess && /*#__PURE__*/ jsxRuntime.jsxs("div", {
80
+ className: "builder gp-z-1 gp-relative",
81
+ children: [
82
+ !hiddenToolbar && (isDisableHeaderFooter() ? /*#__PURE__*/ jsxRuntime.jsx("div", {
83
+ className: "gp-h-[40px] gp-bg-[#ffffff] gp-border-b-[1px] gp-border-[#eeeeee]",
84
+ children: /*#__PURE__*/ jsxRuntime.jsx(SwitchView.default, {})
85
+ }) : /*#__PURE__*/ jsxRuntime.jsx(Header.default, {
86
+ pageType: pageType,
87
+ isOriginTemplate: isOriginTemplate,
88
+ openPageSetting: openPageSetting
89
+ })),
90
+ /*#__PURE__*/ jsxRuntime.jsx(Body.default, {
91
+ pageType: pageType,
92
+ isThemeSectionEditor: isThemeSectionEditor
93
+ }),
94
+ /*#__PURE__*/ jsxRuntime.jsx(ImageToLayout.default, {
95
+ editorImageToLayout: editorImageToLayout || false
96
+ }),
97
+ /*#__PURE__*/ jsxRuntime.jsx(AddSectionImageToLayout.default, {
98
+ editorImageToLayout: editorImageToLayout || false
99
+ }),
100
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
101
+ id: "visual-content"
102
+ }),
103
+ !isDisableHeaderFooter() && !hiddenToolbar && /*#__PURE__*/ jsxRuntime.jsx(Footer.default, {
104
+ pageType: pageType,
105
+ isOriginTemplate: isOriginTemplate,
106
+ openPageSetting: openPageSetting
107
+ })
108
+ ]
109
+ })
110
+ ]
111
+ }, "preview")
112
+ })
108
113
  })
109
114
  })
110
115
  })
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  var jsxRuntime = require('react/jsx-runtime');
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -12,8 +12,9 @@ var FooterForPostPurchase = require('../components/FooterForPostPurchase.js');
12
12
  var Script = require('next/script');
13
13
  var react = require('react');
14
14
 
15
- const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, isPreview, interaction, pageBackground })=>{
15
+ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, elementFontStyle, customCodeHeader, shopToken, pageHandle, customFonts, isPostPurchase, shopName, productOffers, publicStoreFrontData, dynamicDiscountOffer, isPreview, interaction, pageBackground })=>{
16
16
  const router$1 = router.useRouter();
17
+ const { t } = core.useI18n();
17
18
  const baseAssetURL = process.env.NEXT_GP_BASE_ASSET_URL || 'https://d3kbi0je7pp4lw.cloudfront.net';
18
19
  useTrackingView.useTrackingView(shopToken, pageHandle, router$1.isFallback);
19
20
  const customCodeHeaderID = 'custom-code-header';
@@ -93,6 +94,7 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
93
94
  /*#__PURE__*/ jsxRuntime.jsx(core.PageProvider, {
94
95
  productOffers: productOffers,
95
96
  publicStoreFrontData: publicStoreFrontData,
97
+ dynamicDiscountOffer: dynamicDiscountOffer,
96
98
  children: /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
97
99
  components: components,
98
100
  children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
@@ -108,22 +110,25 @@ const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, f
108
110
  }),
109
111
  /*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
110
112
  data: sectionData,
111
- children: builderData?.map((builder)=>/*#__PURE__*/ jsxRuntime.jsxs(core.BuilderProvider, {
112
- state: builder.data,
113
- lazy: builder.lazy,
114
- priority: builder.priority,
115
- isPostPurchase: isPostPurchase,
116
- isPreview: isPreview,
117
- children: [
118
- /*#__PURE__*/ jsxRuntime.jsx(core.Render, {
119
- uid: builder.uid
120
- }),
121
- hasInteraction && /*#__PURE__*/ jsxRuntime.jsx(Script, {
122
- defer: true,
123
- src: `${baseAssetURL}/assets-v2/gp-flow-action-lip.js`
124
- })
125
- ]
126
- }, builder.uid))
113
+ children: /*#__PURE__*/ jsxRuntime.jsx(core.I18nProvider, {
114
+ t: t,
115
+ children: builderData?.map((builder)=>/*#__PURE__*/ jsxRuntime.jsxs(core.BuilderProvider, {
116
+ state: builder.data,
117
+ lazy: builder.lazy,
118
+ priority: builder.priority,
119
+ isPostPurchase: isPostPurchase,
120
+ isPreview: isPreview,
121
+ children: [
122
+ /*#__PURE__*/ jsxRuntime.jsx(core.Render, {
123
+ uid: builder.uid
124
+ }),
125
+ hasInteraction && /*#__PURE__*/ jsxRuntime.jsx(Script, {
126
+ defer: true,
127
+ src: `${baseAssetURL}/assets-v2/gp-flow-action-lip.js`
128
+ })
129
+ ]
130
+ }, builder.uid))
131
+ })
127
132
  }),
128
133
  isPostPurchase && /*#__PURE__*/ jsxRuntime.jsx(FooterForPostPurchase.default, {
129
134
  shopName: shopName || ''
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -9,7 +9,7 @@ const defaultMargin = {
9
9
  };
10
10
  const FooterForPostPurchase = (props)=>{
11
11
  return /*#__PURE__*/ jsx("div", {
12
- className: cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-bg-white gp-font-sans'),
12
+ className: cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-font-sans'),
13
13
  children: /*#__PURE__*/ jsx("div", {
14
14
  className: "gp-flex gp-flex-1 gp-items-center gp-justify-between gp-py-6",
15
15
  style: {
@@ -41,7 +41,7 @@ const Footer = (props)=>{
41
41
  ]);
42
42
  return /*#__PURE__*/ jsx(Fragment, {
43
43
  children: pageType === 'POST_PURCHASE' ? /*#__PURE__*/ jsx("div", {
44
- className: cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-bg-white gp-font-sans'),
44
+ className: cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-font-sans'),
45
45
  children: /*#__PURE__*/ jsx("div", {
46
46
  className: "gp-flex gp-flex-1 gp-items-center gp-justify-between gp-py-6",
47
47
  style: {
@@ -58,7 +58,7 @@ const Footer = (props)=>{
58
58
  })
59
59
  })
60
60
  }) : /*#__PURE__*/ jsx("div", {
61
- className: cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE] gp-bg-white gp-font-sans', {
61
+ className: cls('gp-footer-container gp-border-1 gp-group gp-flex gp-justify-center gp-border-y gp-border-[#EEEEEE gp-font-sans', {
62
62
  'gp-fixed gp-bottom-0 gp-w-full': shouldFixed
63
63
  }),
64
64
  children: /*#__PURE__*/ jsxs("div", {
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
- import { useShopStore, usePageStore, cls, makeStyleResponsive } from '@gem-sdk/core';
3
+ import { useShopStore, cls, makeStyleResponsive } from '@gem-sdk/core';
4
4
  import Devices from './SwitchView.js';
5
5
 
6
6
  const defaultMargin = {
@@ -18,7 +18,6 @@ const sizeCheck = {
18
18
  const Header = (props)=>{
19
19
  const { pageType, isOriginTemplate, openPageSetting } = props;
20
20
  const layoutSetting = useShopStore((s)=>s.layoutSettings);
21
- usePageStore((s)=>s.sidebarMode);
22
21
  const activeHeader = layoutSetting?.showHeader || isOriginTemplate;
23
22
  const headerColor = activeHeader ? HEADER_ON_COLOR : HEADER_OFF_COLOR;
24
23
  return /*#__PURE__*/ jsxs(Fragment, {
@@ -407,6 +407,7 @@ const Toolbar = ()=>{
407
407
  if (!value || !currentComponentActive.current) {
408
408
  return;
409
409
  }
410
+ let isClickProcessing = false;
410
411
  const selector = getSelectorComponent({
411
412
  ...currentComponentActive.current
412
413
  });
@@ -415,6 +416,7 @@ const Toolbar = ()=>{
415
416
  const $parents = $component?.querySelectorAll('[data-toolbar-parent]');
416
417
  if ($parents.length) {
417
418
  const onHover = ($parent)=>{
419
+ if (isClickProcessing) return;
418
420
  const uid = $parent.getAttribute('data-parent-uid');
419
421
  if (!uid) return;
420
422
  const $parentComponents = document.body.querySelector('#storefront')?.querySelectorAll(`[data-uid="${uid}"]`);
@@ -443,6 +445,7 @@ const Toolbar = ()=>{
443
445
  }
444
446
  };
445
447
  const onClick = async ($parent)=>{
448
+ isClickProcessing = true;
446
449
  const uid = $parent.getAttribute('data-parent-uid');
447
450
  if (!uid) return;
448
451
  const isElementInsideProduct = async ()=>{
@@ -474,6 +477,9 @@ const Toolbar = ()=>{
474
477
  });
475
478
  outHover($parent);
476
479
  window.dispatchEvent(event);
480
+ setTimeout(()=>{
481
+ isClickProcessing = false;
482
+ }, 0);
477
483
  };
478
484
  $parents.forEach(($parent)=>{
479
485
  $parent.addEventListener('mouseover', ()=>onHover($parent));