@gem-sdk/pages 1.5.7 → 1.5.23

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 (79) hide show
  1. package/dist/cjs/components/ErrorBoundary.js +32 -24
  2. package/dist/cjs/components/ErrorFallback.js +19 -2
  3. package/dist/cjs/components/FacebookPixel.js +25 -20
  4. package/dist/cjs/components/Footer.js +462 -0
  5. package/dist/cjs/components/GoogleAnalytic.js +49 -23
  6. package/dist/cjs/components/Header.js +211 -0
  7. package/dist/cjs/components/TikTokPixel.js +9 -6
  8. package/dist/cjs/components/builder/Toolbox.js +215 -188
  9. package/dist/cjs/layouts/main.js +19 -5
  10. package/dist/cjs/libs/api/get-builder-props.js +26 -24
  11. package/dist/cjs/libs/api/get-collection-props.js +59 -55
  12. package/dist/cjs/libs/api/get-home-page-props-v2.js +121 -114
  13. package/dist/cjs/libs/api/get-home-page-props.js +133 -123
  14. package/dist/cjs/libs/api/get-preview-props.js +10 -10
  15. package/dist/cjs/libs/api/get-product-props.js +64 -62
  16. package/dist/cjs/libs/api/get-static-page-props-preview.js +128 -121
  17. package/dist/cjs/libs/api/get-static-page-props-v2.js +126 -119
  18. package/dist/cjs/libs/api/get-static-page-props.js +130 -120
  19. package/dist/cjs/libs/fetcher.js +59 -63
  20. package/dist/cjs/libs/get-layout.js +5 -2
  21. package/dist/cjs/libs/get-storefront-api.js +7 -7
  22. package/dist/cjs/libs/getStaticPaths.js +5 -5
  23. package/dist/cjs/libs/google-fonts.js +54 -61
  24. package/dist/cjs/libs/helpers/gen-css.js +103 -94
  25. package/dist/cjs/libs/helpers/generate-manifres.js +1 -1
  26. package/dist/cjs/libs/helpers/get-fallback.js +24 -22
  27. package/dist/cjs/libs/helpers/normalize.js +82 -80
  28. package/dist/cjs/libs/helpers/parse-json.js +10 -12
  29. package/dist/cjs/libs/helpers/user-agent.js +2 -2
  30. package/dist/cjs/libs/hooks/use-tracking-view.js +36 -31
  31. package/dist/cjs/libs/parse-html.js +33 -26
  32. package/dist/cjs/pages/404.js +34 -2
  33. package/dist/cjs/pages/500.js +63 -8
  34. package/dist/cjs/pages/builder.js +69 -14
  35. package/dist/cjs/pages/collection-detail.js +48 -7
  36. package/dist/cjs/pages/preview.js +18 -12
  37. package/dist/cjs/pages/product-detail.js +53 -7
  38. package/dist/cjs/pages/static-v2.js +62 -7
  39. package/dist/cjs/pages/static.js +60 -6
  40. package/dist/esm/components/ErrorBoundary.js +32 -24
  41. package/dist/esm/components/ErrorFallback.js +19 -2
  42. package/dist/esm/components/FacebookPixel.js +25 -20
  43. package/dist/esm/components/Footer.js +458 -0
  44. package/dist/esm/components/GoogleAnalytic.js +49 -23
  45. package/dist/esm/components/Header.js +207 -0
  46. package/dist/esm/components/TikTokPixel.js +9 -6
  47. package/dist/esm/components/builder/Toolbox.js +217 -190
  48. package/dist/esm/layouts/main.js +19 -5
  49. package/dist/esm/libs/api/get-builder-props.js +26 -24
  50. package/dist/esm/libs/api/get-collection-props.js +59 -55
  51. package/dist/esm/libs/api/get-home-page-props-v2.js +121 -114
  52. package/dist/esm/libs/api/get-home-page-props.js +133 -123
  53. package/dist/esm/libs/api/get-preview-props.js +10 -10
  54. package/dist/esm/libs/api/get-product-props.js +64 -62
  55. package/dist/esm/libs/api/get-static-page-props-preview.js +128 -121
  56. package/dist/esm/libs/api/get-static-page-props-v2.js +126 -119
  57. package/dist/esm/libs/api/get-static-page-props.js +130 -120
  58. package/dist/esm/libs/fetcher.js +59 -63
  59. package/dist/esm/libs/get-layout.js +5 -2
  60. package/dist/esm/libs/get-storefront-api.js +7 -7
  61. package/dist/esm/libs/getStaticPaths.js +5 -5
  62. package/dist/esm/libs/google-fonts.js +54 -61
  63. package/dist/esm/libs/helpers/gen-css.js +103 -94
  64. package/dist/esm/libs/helpers/generate-manifres.js +1 -1
  65. package/dist/esm/libs/helpers/get-fallback.js +24 -22
  66. package/dist/esm/libs/helpers/normalize.js +82 -80
  67. package/dist/esm/libs/helpers/parse-json.js +10 -12
  68. package/dist/esm/libs/helpers/user-agent.js +2 -2
  69. package/dist/esm/libs/hooks/use-tracking-view.js +36 -31
  70. package/dist/esm/libs/parse-html.js +33 -26
  71. package/dist/esm/pages/404.js +34 -2
  72. package/dist/esm/pages/500.js +63 -8
  73. package/dist/esm/pages/builder.js +69 -14
  74. package/dist/esm/pages/collection-detail.js +48 -7
  75. package/dist/esm/pages/preview.js +18 -12
  76. package/dist/esm/pages/product-detail.js +53 -7
  77. package/dist/esm/pages/static-v2.js +62 -7
  78. package/dist/esm/pages/static.js +60 -6
  79. package/package.json +3 -3
@@ -1,85 +1,87 @@
1
1
  'use strict';
2
2
 
3
- const normalizeBuilderData = (data) => {
4
- const result = {};
5
- function compose(cData, currData = {}) {
6
- if (cData) {
7
- const { childrens, dateModified, editorConfigs, ...rest } = cData;
8
- if (rest.type === 'section') {
9
- currData[rest.uid] = rest;
10
- }
11
- else {
12
- const items = childrens?.map((child) => child?.uid) ?? [];
13
- currData[rest.uid] = { ...rest, childrens: items };
14
- if (childrens) {
15
- childrens.map((child) => compose(child, currData));
16
- }
17
- }
18
- }
19
- }
20
- compose(data, result);
21
- return { ...result };
22
- };
23
- const orderSection = (sections, orders) => {
24
- // Filter out sections that are not in the order list
25
- const ids = orders?.filter((id) => sections?.some((v) => v?.id === id));
26
- // Return the ordered sections
27
- const orderedSections = ids?.map((id) => sections?.find((v) => v?.id === id)) ?? [];
28
- // Return the sections that are not in the order list
29
- const sectionsNotInOrder = sections?.filter((v) => !v?.id || !ids?.includes(v.id)) ?? [];
30
- // Return the ordered sections + the sections that are not in the order list
31
- return orderedSections.concat(sectionsNotInOrder);
32
- };
33
- function normalizePageSectionResponse(sections, orders) {
34
- const sortedSections = orderSection(sections, orders);
35
- const childrens = sortedSections
36
- .map((item) => {
37
- if (!item?.component)
38
- return false;
39
- try {
40
- const data = JSON.parse(item.component);
41
- return data;
42
- }
43
- catch {
44
- return false;
45
- }
46
- })
47
- .filter(Boolean);
48
- return normalizeBuilderData({
49
- uid: 'ROOT',
50
- tag: 'Root',
51
- childrens,
52
- });
53
- }
54
- function normalizePageSectionResponseV2(sections, orders) {
55
- const sortedSections = orderSection(sections, orders);
56
- const childrens = sortedSections
57
- .map((item) => {
58
- if (!item?.component)
59
- return false;
60
- try {
61
- const data = JSON.parse(item.component);
62
- return data;
63
- }
64
- catch {
65
- return false;
66
- }
67
- })
68
- .filter(Boolean);
69
- return childrens.map((v) => {
70
- return {
71
- uid: v.uid,
72
- lazy: Boolean(v.settings?.lazy),
73
- priority: Boolean(v.settings?.priority),
74
- data: normalizeBuilderData(v),
75
- };
76
- });
77
- }
78
- const parseBuilderTemplateV2 = (data) => {
79
- return normalizePageSectionResponseV2([...(data?.pageSections ?? []), ...(data?.themePageCustomSections ?? [])], data?.sectionPosition);
80
- };
81
- const parseBuilderTemplate = (data) => {
82
- return normalizePageSectionResponse([...(data?.pageSections ?? []), ...(data?.themePageCustomSections ?? [])], data?.sectionPosition);
3
+ const normalizeBuilderData = (data)=>{
4
+ const result = {};
5
+ function compose(cData, currData = {}) {
6
+ if (cData) {
7
+ const { childrens , dateModified , editorConfigs , ...rest } = cData;
8
+ if (rest.type === 'section') {
9
+ currData[rest.uid] = rest;
10
+ } else {
11
+ const items = childrens?.map((child)=>child?.uid) ?? [];
12
+ currData[rest.uid] = {
13
+ ...rest,
14
+ childrens: items
15
+ };
16
+ if (childrens) {
17
+ childrens.map((child)=>compose(child, currData));
18
+ }
19
+ }
20
+ }
21
+ }
22
+ compose(data, result);
23
+ return {
24
+ ...result
25
+ };
26
+ };
27
+ const orderSection = (sections, orders)=>{
28
+ // Filter out sections that are not in the order list
29
+ const ids = orders?.filter((id)=>sections?.some((v)=>v?.id === id));
30
+ // Return the ordered sections
31
+ const orderedSections = ids?.map((id)=>sections?.find((v)=>v?.id === id)) ?? [];
32
+ // Return the sections that are not in the order list
33
+ const sectionsNotInOrder = sections?.filter((v)=>!v?.id || !ids?.includes(v.id)) ?? [];
34
+ // Return the ordered sections + the sections that are not in the order list
35
+ return orderedSections.concat(sectionsNotInOrder);
36
+ };
37
+ function normalizePageSectionResponse(sections, orders) {
38
+ const sortedSections = orderSection(sections, orders);
39
+ const childrens = sortedSections.map((item)=>{
40
+ if (!item?.component) return false;
41
+ try {
42
+ const data = JSON.parse(item.component);
43
+ return data;
44
+ } catch {
45
+ return false;
46
+ }
47
+ }).filter(Boolean);
48
+ return normalizeBuilderData({
49
+ uid: 'ROOT',
50
+ tag: 'Root',
51
+ childrens
52
+ });
53
+ }
54
+ function normalizePageSectionResponseV2(sections, orders) {
55
+ const sortedSections = orderSection(sections, orders);
56
+ const childrens = sortedSections.map((item)=>{
57
+ if (!item?.component) return false;
58
+ try {
59
+ const data = JSON.parse(item.component);
60
+ return data;
61
+ } catch {
62
+ return false;
63
+ }
64
+ }).filter(Boolean);
65
+ return childrens.map((v)=>{
66
+ return {
67
+ uid: v.uid,
68
+ lazy: Boolean(v.settings?.lazy),
69
+ priority: Boolean(v.settings?.priority),
70
+ data: normalizeBuilderData(v)
71
+ };
72
+ });
73
+ }
74
+ const parseBuilderTemplateV2 = (data)=>{
75
+ return normalizePageSectionResponseV2([
76
+ ...data?.pageSections ?? [],
77
+ ...data?.themePageCustomSections ?? []
78
+ ], data?.sectionPosition);
79
+ };
80
+ const parseBuilderTemplate = (data)=>{
81
+ return normalizePageSectionResponse([
82
+ ...data?.pageSections ?? [],
83
+ ...data?.themePageCustomSections ?? []
84
+ ], data?.sectionPosition);
83
85
  };
84
86
 
85
87
  exports.normalizeBuilderData = normalizeBuilderData;
@@ -1,17 +1,15 @@
1
1
  'use strict';
2
2
 
3
- const parseJson = (json) => {
4
- if (!json)
5
- return null;
6
- try {
7
- return JSON.parse(json);
8
- }
9
- catch (e) {
10
- return null;
11
- }
12
- };
13
- const serializableJson = (props) => {
14
- return JSON.parse(JSON.stringify(props));
3
+ const parseJson = (json)=>{
4
+ if (!json) return null;
5
+ try {
6
+ return JSON.parse(json);
7
+ } catch (e) {
8
+ return null;
9
+ }
10
+ };
11
+ const serializableJson = (props)=>{
12
+ return JSON.parse(JSON.stringify(props));
15
13
  };
16
14
 
17
15
  exports.parseJson = parseJson;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- function isBot(input) {
4
- return /Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Chrome-Lighthouse|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver/i.test(input);
3
+ function isBot(input) {
4
+ return /Googlebot|Mediapartners-Google|AdsBot-Google|googleweblight|Storebot-Google|Google-PageRenderer|Chrome-Lighthouse|Bingbot|BingPreview|Slurp|DuckDuckBot|baiduspider|yandex|sogou|LinkedInBot|bitlybot|tumblr|vkShare|quora link preview|facebookexternalhit|facebookcatalog|Twitterbot|applebot|redditbot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|ia_archiver/i.test(input);
5
5
  }
6
6
 
7
7
  exports.isBot = isBot;
@@ -4,37 +4,42 @@ var core = require('@gem-sdk/core');
4
4
  var react = require('react');
5
5
  var userAgent = require('../helpers/user-agent.js');
6
6
 
7
- const useTrackingView = (token, handle, isFallback) => {
8
- const shopToken = token || process.env.NEXT_PUBLIC_SHOP_TOKEN;
9
- const apiURL = process.env.NEXT_PUBLIC_API_URL;
10
- const sendTracking = react.useCallback((handle) => {
11
- if (!apiURL || !shopToken)
12
- return;
13
- const bot = userAgent.isBot(navigator.userAgent);
14
- const variables = {
15
- pageHandle: handle,
16
- userAgent: bot ? 'BOT' : 'BROWSER',
17
- };
18
- const headers = {
19
- 'Content-Type': 'application/json',
20
- 'X-GemX-Shop-Token': shopToken,
21
- };
22
- fetch(apiURL, {
23
- method: 'POST',
24
- headers,
25
- body: JSON.stringify({
26
- query: core.PageViewUpDocument,
27
- variables,
28
- }),
29
- }).finally(() => {
30
- //
31
- });
32
- }, [apiURL, shopToken]);
33
- react.useEffect(() => {
34
- if (!handle || isFallback)
35
- return;
36
- sendTracking(handle);
37
- }, [handle, sendTracking, isFallback]);
7
+ const useTrackingView = (token, handle, isFallback)=>{
8
+ const shopToken = token || process.env.NEXT_PUBLIC_SHOP_TOKEN;
9
+ const apiURL = process.env.NEXT_PUBLIC_API_URL;
10
+ const sendTracking = react.useCallback((handle)=>{
11
+ if (!apiURL || !shopToken) return;
12
+ const bot = userAgent.isBot(navigator.userAgent);
13
+ const variables = {
14
+ pageHandle: handle,
15
+ userAgent: bot ? 'BOT' : 'BROWSER'
16
+ };
17
+ const headers = {
18
+ 'Content-Type': 'application/json',
19
+ 'X-GemX-Shop-Token': shopToken
20
+ };
21
+ fetch(apiURL, {
22
+ method: 'POST',
23
+ headers,
24
+ body: JSON.stringify({
25
+ query: core.PageViewUpDocument,
26
+ variables
27
+ })
28
+ }).finally(()=>{
29
+ //
30
+ });
31
+ }, [
32
+ apiURL,
33
+ shopToken
34
+ ]);
35
+ react.useEffect(()=>{
36
+ if (!handle || isFallback) return;
37
+ sendTracking(handle);
38
+ }, [
39
+ handle,
40
+ sendTracking,
41
+ isFallback
42
+ ]);
38
43
  };
39
44
 
40
45
  exports.useTrackingView = useTrackingView;
@@ -4,32 +4,39 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var parse = require('html-react-parser');
5
5
  var Script = require('next/script');
6
6
 
7
- const parseHtml = (html, isHead) => {
8
- if (!html)
9
- return undefined;
10
- try {
11
- return parse(html, {
12
- replace: (node) => {
13
- if (node.type === 'script' && node instanceof parse.Element) {
14
- const child = node.children?.[0];
15
- if (child instanceof parse.Text) {
16
- if (isHead)
17
- return jsxRuntime.jsx("script", { ...node.attribs, dangerouslySetInnerHTML: { __html: child.data } });
18
- else
19
- return jsxRuntime.jsx(Script, { ...node.attribs, dangerouslySetInnerHTML: { __html: child.data } });
20
- }
21
- else {
22
- if (!isHead) {
23
- return jsxRuntime.jsx(Script, { ...node.attribs });
24
- }
25
- }
26
- }
27
- },
28
- });
29
- }
30
- catch {
31
- return undefined;
32
- }
7
+ const parseHtml = (html, isHead)=>{
8
+ if (!html) return undefined;
9
+ try {
10
+ return parse(html, {
11
+ replace: (node)=>{
12
+ if (node.type === 'script' && node instanceof parse.Element) {
13
+ const child = node.children?.[0];
14
+ if (child instanceof parse.Text) {
15
+ if (isHead) return /*#__PURE__*/ jsxRuntime.jsx("script", {
16
+ ...node.attribs,
17
+ dangerouslySetInnerHTML: {
18
+ __html: child.data
19
+ }
20
+ });
21
+ else return /*#__PURE__*/ jsxRuntime.jsx(Script, {
22
+ ...node.attribs,
23
+ dangerouslySetInnerHTML: {
24
+ __html: child.data
25
+ }
26
+ });
27
+ } else {
28
+ if (!isHead) {
29
+ return /*#__PURE__*/ jsxRuntime.jsx(Script, {
30
+ ...node.attribs
31
+ });
32
+ }
33
+ }
34
+ }
35
+ }
36
+ });
37
+ } catch {
38
+ return undefined;
39
+ }
33
40
  };
34
41
 
35
42
  exports.parseHtml = parseHtml;
@@ -4,8 +4,40 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var nextSeo = require('next-seo');
5
5
  var Image = require('next/image');
6
6
 
7
- const Page404 = () => {
8
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(nextSeo.NextSeo, { title: "Page not found" }), jsxRuntime.jsxs("div", { className: "tablet:max-w-2xl container mx-auto flex min-h-screen max-w-4xl flex-col items-center justify-center gap-8 px-8", children: [jsxRuntime.jsx(Image, { sizes: "(max-width: 768px) 100vw, 50vw", src: "https://ucarecdn.com/27dfcf10-8fff-4341-90a0-dc97e4072acc/-/format/auto/", width: 802, height: 450, alt: "Not found", quality: 100, priority: true }), jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center gap-2 pb-36", children: [jsxRuntime.jsx("h1", { className: "mobile:text-2xl text-4xl font-semibold", children: "Oops! Page not found" }), jsxRuntime.jsx("p", { children: "Your page URL is incorrect." })] })] })] }));
7
+ const Page404 = ()=>{
8
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
9
+ children: [
10
+ /*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
11
+ title: "Page not found"
12
+ }),
13
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
14
+ className: "tablet:max-w-2xl container mx-auto flex min-h-screen max-w-4xl flex-col items-center justify-center gap-8 px-8",
15
+ children: [
16
+ /*#__PURE__*/ jsxRuntime.jsx(Image, {
17
+ sizes: "(max-width: 768px) 100vw, 50vw",
18
+ src: "https://ucarecdn.com/27dfcf10-8fff-4341-90a0-dc97e4072acc/-/format/auto/",
19
+ width: 802,
20
+ height: 450,
21
+ alt: "Not found",
22
+ quality: 100,
23
+ priority: true
24
+ }),
25
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
26
+ className: "flex flex-col items-center justify-center gap-2 pb-36",
27
+ children: [
28
+ /*#__PURE__*/ jsxRuntime.jsx("h1", {
29
+ className: "mobile:text-2xl text-4xl font-semibold",
30
+ children: "Oops! Page not found"
31
+ }),
32
+ /*#__PURE__*/ jsxRuntime.jsx("p", {
33
+ children: "Your page URL is incorrect."
34
+ })
35
+ ]
36
+ })
37
+ ]
38
+ })
39
+ ]
40
+ });
9
41
  };
10
42
 
11
43
  exports.Page404 = Page404;
@@ -6,14 +6,69 @@ var nextSeo = require('next-seo');
6
6
  var Image = require('next/image');
7
7
  var react = require('react');
8
8
 
9
- const Page500 = () => {
10
- const [loading, setLoading] = react.useState(false);
11
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(nextSeo.NextSeo, { title: "Service Unavailable" }), jsxRuntime.jsxs("div", { className: "tablet:max-w-2xl container mx-auto flex min-h-screen max-w-4xl flex-col items-center justify-center gap-8 px-8", children: [jsxRuntime.jsx(Image, { sizes: "(max-width: 768px) 100vw, 50vw", src: "https://ucarecdn.com/ea647025-54e3-4abb-87c4-859c5853ed56/-/format/auto/", width: 802, height: 450, alt: "Not found", quality: 100, priority: true }), jsxRuntime.jsxs("div", { className: "flex flex-col gap-8 pb-36", children: [jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center gap-2 text-center", children: [jsxRuntime.jsx("h1", { className: "mobile:text-2xl text-4xl font-semibold", children: "Service Unavailable" }), jsxRuntime.jsx("p", { className: "text-center", children: "The server is temporarily busy. Try again later." })] }), jsxRuntime.jsxs("button", { className: "mx-auto inline-flex h-10 items-center justify-center gap-2 rounded bg-[#3C67FF] px-6 text-white active:translate-y-1", onClick: () => {
12
- setLoading(true);
13
- window.location.reload();
14
- }, children: [jsxRuntime.jsx("svg", { className: core.cls('w-5', {
15
- 'animate-spin': loading,
16
- }), viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M12.3408 3.03528C10.6845 2.42235 8.86506 2.41356 7.20294 3.01045C5.54082 3.60734 4.14265 4.77163 3.25471 6.29822C2.36677 7.82482 2.04603 9.61579 2.34898 11.3557C2.65193 13.0955 3.55915 14.6727 4.91081 15.8093C6.26248 16.9459 7.97189 17.5691 9.73794 17.5691C10.0831 17.5691 10.3629 17.2893 10.3629 16.9441C10.3629 16.5989 10.0831 16.3191 9.73792 16.3191C8.26621 16.3191 6.8417 15.7998 5.71531 14.8526C4.58892 13.9054 3.83291 12.5911 3.58045 11.1412C3.32799 9.69134 3.59528 8.19886 4.33523 6.9267C5.07518 5.65454 6.24032 4.6843 7.62542 4.18689C9.01052 3.68948 10.5267 3.69681 11.9069 4.20758C13.2872 4.71835 14.4429 5.69981 15.1705 6.97906C15.8981 8.25832 16.151 9.75331 15.8845 11.2007C15.677 12.3276 15.1651 13.3694 14.4127 14.2174L14.4127 11.7856C14.4127 11.4405 14.1329 11.1606 13.7877 11.1606C13.4425 11.1606 13.1627 11.4405 13.1627 11.7856L13.1627 15.4106C13.1627 15.5764 13.2285 15.7354 13.3457 15.8526C13.4629 15.9698 13.6219 16.0356 13.7877 16.0356H17.2845C17.6297 16.0356 17.9095 15.7558 17.9095 15.4106C17.9095 15.0655 17.6297 14.7856 17.2845 14.7856H15.5691C16.3513 13.8186 16.8858 12.6657 17.1139 11.427C17.4336 9.69015 17.1302 7.89616 16.257 6.36106C15.3839 4.82595 13.9971 3.64821 12.3408 3.03528Z", fill: "currentColor" }) }), "Refresh"] })] })] })] }));
9
+ const Page500 = ()=>{
10
+ const [loading, setLoading] = react.useState(false);
11
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
12
+ children: [
13
+ /*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
14
+ title: "Service Unavailable"
15
+ }),
16
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
17
+ className: "tablet:max-w-2xl container mx-auto flex min-h-screen max-w-4xl flex-col items-center justify-center gap-8 px-8",
18
+ children: [
19
+ /*#__PURE__*/ jsxRuntime.jsx(Image, {
20
+ sizes: "(max-width: 768px) 100vw, 50vw",
21
+ src: "https://ucarecdn.com/ea647025-54e3-4abb-87c4-859c5853ed56/-/format/auto/",
22
+ width: 802,
23
+ height: 450,
24
+ alt: "Not found",
25
+ quality: 100,
26
+ priority: true
27
+ }),
28
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
29
+ className: "flex flex-col gap-8 pb-36",
30
+ children: [
31
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
32
+ className: "flex flex-col items-center justify-center gap-2 text-center",
33
+ children: [
34
+ /*#__PURE__*/ jsxRuntime.jsx("h1", {
35
+ className: "mobile:text-2xl text-4xl font-semibold",
36
+ children: "Service Unavailable"
37
+ }),
38
+ /*#__PURE__*/ jsxRuntime.jsx("p", {
39
+ className: "text-center",
40
+ children: "The server is temporarily busy. Try again later."
41
+ })
42
+ ]
43
+ }),
44
+ /*#__PURE__*/ jsxRuntime.jsxs("button", {
45
+ className: "mx-auto inline-flex h-10 items-center justify-center gap-2 rounded bg-[#3C67FF] px-6 text-white active:translate-y-1",
46
+ onClick: ()=>{
47
+ setLoading(true);
48
+ window.location.reload();
49
+ },
50
+ children: [
51
+ /*#__PURE__*/ jsxRuntime.jsx("svg", {
52
+ className: core.cls('w-5', {
53
+ 'animate-spin': loading
54
+ }),
55
+ viewBox: "0 0 20 20",
56
+ fill: "none",
57
+ xmlns: "http://www.w3.org/2000/svg",
58
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
59
+ d: "M12.3408 3.03528C10.6845 2.42235 8.86506 2.41356 7.20294 3.01045C5.54082 3.60734 4.14265 4.77163 3.25471 6.29822C2.36677 7.82482 2.04603 9.61579 2.34898 11.3557C2.65193 13.0955 3.55915 14.6727 4.91081 15.8093C6.26248 16.9459 7.97189 17.5691 9.73794 17.5691C10.0831 17.5691 10.3629 17.2893 10.3629 16.9441C10.3629 16.5989 10.0831 16.3191 9.73792 16.3191C8.26621 16.3191 6.8417 15.7998 5.71531 14.8526C4.58892 13.9054 3.83291 12.5911 3.58045 11.1412C3.32799 9.69134 3.59528 8.19886 4.33523 6.9267C5.07518 5.65454 6.24032 4.6843 7.62542 4.18689C9.01052 3.68948 10.5267 3.69681 11.9069 4.20758C13.2872 4.71835 14.4429 5.69981 15.1705 6.97906C15.8981 8.25832 16.151 9.75331 15.8845 11.2007C15.677 12.3276 15.1651 13.3694 14.4127 14.2174L14.4127 11.7856C14.4127 11.4405 14.1329 11.1606 13.7877 11.1606C13.4425 11.1606 13.1627 11.4405 13.1627 11.7856L13.1627 15.4106C13.1627 15.5764 13.2285 15.7354 13.3457 15.8526C13.4629 15.9698 13.6219 16.0356 13.7877 16.0356H17.2845C17.6297 16.0356 17.9095 15.7558 17.9095 15.4106C17.9095 15.0655 17.6297 14.7856 17.2845 14.7856H15.5691C16.3513 13.8186 16.8858 12.6657 17.1139 11.427C17.4336 9.69015 17.1302 7.89616 16.257 6.36106C15.3839 4.82595 13.9971 3.64821 12.3408 3.03528Z",
60
+ fill: "currentColor"
61
+ })
62
+ }),
63
+ "Refresh"
64
+ ]
65
+ })
66
+ ]
67
+ })
68
+ ]
69
+ })
70
+ ]
71
+ });
17
72
  };
18
73
 
19
74
  exports.Page500 = Page500;
@@ -6,21 +6,76 @@ var nextSeo = require('next-seo');
6
6
  var Head = require('next/head');
7
7
  var react = require('react');
8
8
  var Toolbox = require('../components/builder/Toolbox.js');
9
+ var dynamic = require('next/dynamic');
9
10
 
10
- const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, }) => {
11
- const [loadSuccess, setLoadSuccess] = react.useState(false);
12
- const initState = {
13
- ROOT: {
14
- uid: 'ROOT',
15
- tag: 'Root',
16
- label: 'Root',
17
- childrens: [],
18
- },
19
- };
20
- react.useEffect(() => {
21
- setLoadSuccess(true);
22
- }, []);
23
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(nextSeo.NextSeo, { ...seo }), jsxRuntime.jsxs(Head, { children: [themeStyle && (jsxRuntime.jsx("style", { type: "text/css", id: "global-style", dangerouslySetInnerHTML: { __html: themeStyle } })), fontStyle && (jsxRuntime.jsx("style", { "data-id": "google-fonts", type: "text/css", dangerouslySetInnerHTML: { __html: fontStyle } }))] }), jsxRuntime.jsx(core.BuilderComponentProvider, { components: components, children: jsxRuntime.jsx(core.SectionProvider, { data: sectionData, children: jsxRuntime.jsxs(core.BuilderPreviewProvider, { state: initState, children: [jsxRuntime.jsx(Toolbox.default, {}), loadSuccess && (jsxRuntime.jsxs("div", { className: "builder", children: [jsxRuntime.jsx("div", { id: "storefront", children: jsxRuntime.jsx(core.RenderPreview, { uid: "ROOT" }) }), jsxRuntime.jsx("div", { id: "visual-content" })] }))] }, "preview") }) })] }));
11
+ const Header = dynamic(()=>Promise.resolve().then(function () { return require('../components/Header.js'); }));
12
+ const Footer = dynamic(()=>Promise.resolve().then(function () { return require('../components/Footer.js'); }));
13
+ const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData })=>{
14
+ const [loadSuccess, setLoadSuccess] = react.useState(false);
15
+ const initState = {
16
+ ROOT: {
17
+ uid: 'ROOT',
18
+ tag: 'Root',
19
+ label: 'Root',
20
+ childrens: []
21
+ }
22
+ };
23
+ react.useEffect(()=>{
24
+ setLoadSuccess(true);
25
+ }, []);
26
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
27
+ children: [
28
+ /*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
29
+ ...seo
30
+ }),
31
+ /*#__PURE__*/ jsxRuntime.jsxs(Head, {
32
+ children: [
33
+ themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
34
+ type: "text/css",
35
+ id: "global-style",
36
+ dangerouslySetInnerHTML: {
37
+ __html: themeStyle
38
+ }
39
+ }),
40
+ fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
41
+ "data-id": "google-fonts",
42
+ type: "text/css",
43
+ dangerouslySetInnerHTML: {
44
+ __html: fontStyle
45
+ }
46
+ })
47
+ ]
48
+ }),
49
+ /*#__PURE__*/ jsxRuntime.jsx(Header, {}),
50
+ /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
51
+ components: components,
52
+ children: /*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
53
+ data: sectionData,
54
+ children: /*#__PURE__*/ jsxRuntime.jsxs(core.BuilderPreviewProvider, {
55
+ state: initState,
56
+ children: [
57
+ /*#__PURE__*/ jsxRuntime.jsx(Toolbox.default, {}),
58
+ loadSuccess && /*#__PURE__*/ jsxRuntime.jsxs("div", {
59
+ className: "builder",
60
+ children: [
61
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
62
+ id: "storefront",
63
+ children: /*#__PURE__*/ jsxRuntime.jsx(core.RenderPreview, {
64
+ uid: "ROOT"
65
+ })
66
+ }),
67
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
68
+ id: "visual-content"
69
+ })
70
+ ]
71
+ })
72
+ ]
73
+ }, "preview")
74
+ })
75
+ }),
76
+ /*#__PURE__*/ jsxRuntime.jsx(Footer, {})
77
+ ]
78
+ });
24
79
  };
25
80
 
26
81
  exports.BuilderPage = BuilderPage;
@@ -9,13 +9,54 @@ var dynamic = require('next/dynamic');
9
9
  var Head = require('next/head');
10
10
  var router = require('next/router');
11
11
 
12
- const CollectionProvider = dynamic(() => import('@gem-sdk/core').then((m) => m.CollectionProvider));
13
- const CollectionDetailPage = ({ seo, components, builderData, sectionData, themeStyle, collection, fontStyle, }) => {
14
- const router$1 = router.useRouter();
15
- if (router$1.isFallback) {
16
- return jsxRuntime.jsx("div", { children: "Loading..." });
17
- }
18
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(nextSeo.NextSeo, { ...seo }), jsxRuntime.jsxs(Head, { children: [themeStyle && (jsxRuntime.jsx("style", { "data-id": "global-style", type: "text/css", dangerouslySetInnerHTML: { __html: themeStyle } })), fontStyle && (jsxRuntime.jsx("style", { "data-id": "google-fonts", type: "text/css", dangerouslySetInnerHTML: { __html: fontStyle } }))] }), jsxRuntime.jsx(core.BuilderComponentProvider, { components: components, children: jsxRuntime.jsx(core.SectionProvider, { data: sectionData, children: jsxRuntime.jsx(CollectionProvider, { collection: collection, children: builderData && (jsxRuntime.jsx(core.BuilderProvider, { state: builderData, children: jsxRuntime.jsx(core.Render, { uid: "ROOT" }) })) }) }) })] }));
12
+ const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
13
+ const CollectionDetailPage = ({ seo , components , builderData , sectionData , themeStyle , collection , fontStyle })=>{
14
+ const router$1 = router.useRouter();
15
+ if (router$1.isFallback) {
16
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
17
+ children: "Loading..."
18
+ });
19
+ }
20
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
21
+ children: [
22
+ /*#__PURE__*/ jsxRuntime.jsx(nextSeo.NextSeo, {
23
+ ...seo
24
+ }),
25
+ /*#__PURE__*/ jsxRuntime.jsxs(Head, {
26
+ children: [
27
+ themeStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
28
+ "data-id": "global-style",
29
+ type: "text/css",
30
+ dangerouslySetInnerHTML: {
31
+ __html: themeStyle
32
+ }
33
+ }),
34
+ fontStyle && /*#__PURE__*/ jsxRuntime.jsx("style", {
35
+ "data-id": "google-fonts",
36
+ type: "text/css",
37
+ dangerouslySetInnerHTML: {
38
+ __html: fontStyle
39
+ }
40
+ })
41
+ ]
42
+ }),
43
+ /*#__PURE__*/ jsxRuntime.jsx(core.BuilderComponentProvider, {
44
+ components: components,
45
+ children: /*#__PURE__*/ jsxRuntime.jsx(core.SectionProvider, {
46
+ data: sectionData,
47
+ children: /*#__PURE__*/ jsxRuntime.jsx(CollectionProvider, {
48
+ collection: collection,
49
+ children: builderData && /*#__PURE__*/ jsxRuntime.jsx(core.BuilderProvider, {
50
+ state: builderData,
51
+ children: /*#__PURE__*/ jsxRuntime.jsx(core.Render, {
52
+ uid: "ROOT"
53
+ })
54
+ })
55
+ })
56
+ })
57
+ })
58
+ ]
59
+ });
19
60
  };
20
61
 
21
62
  exports.default = CollectionDetailPage;