@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
@@ -2,37 +2,42 @@ import { PageViewUpDocument } from '@gem-sdk/core';
2
2
  import { useCallback, useEffect } from 'react';
3
3
  import { isBot } from '../helpers/user-agent.js';
4
4
 
5
- const useTrackingView = (token, handle, isFallback) => {
6
- const shopToken = token || process.env.NEXT_PUBLIC_SHOP_TOKEN;
7
- const apiURL = process.env.NEXT_PUBLIC_API_URL;
8
- const sendTracking = useCallback((handle) => {
9
- if (!apiURL || !shopToken)
10
- return;
11
- const bot = isBot(navigator.userAgent);
12
- const variables = {
13
- pageHandle: handle,
14
- userAgent: bot ? 'BOT' : 'BROWSER',
15
- };
16
- const headers = {
17
- 'Content-Type': 'application/json',
18
- 'X-GemX-Shop-Token': shopToken,
19
- };
20
- fetch(apiURL, {
21
- method: 'POST',
22
- headers,
23
- body: JSON.stringify({
24
- query: PageViewUpDocument,
25
- variables,
26
- }),
27
- }).finally(() => {
28
- //
29
- });
30
- }, [apiURL, shopToken]);
31
- useEffect(() => {
32
- if (!handle || isFallback)
33
- return;
34
- sendTracking(handle);
35
- }, [handle, sendTracking, isFallback]);
5
+ const useTrackingView = (token, handle, isFallback)=>{
6
+ const shopToken = token || process.env.NEXT_PUBLIC_SHOP_TOKEN;
7
+ const apiURL = process.env.NEXT_PUBLIC_API_URL;
8
+ const sendTracking = useCallback((handle)=>{
9
+ if (!apiURL || !shopToken) return;
10
+ const bot = isBot(navigator.userAgent);
11
+ const variables = {
12
+ pageHandle: handle,
13
+ userAgent: bot ? 'BOT' : 'BROWSER'
14
+ };
15
+ const headers = {
16
+ 'Content-Type': 'application/json',
17
+ 'X-GemX-Shop-Token': shopToken
18
+ };
19
+ fetch(apiURL, {
20
+ method: 'POST',
21
+ headers,
22
+ body: JSON.stringify({
23
+ query: PageViewUpDocument,
24
+ variables
25
+ })
26
+ }).finally(()=>{
27
+ //
28
+ });
29
+ }, [
30
+ apiURL,
31
+ shopToken
32
+ ]);
33
+ useEffect(()=>{
34
+ if (!handle || isFallback) return;
35
+ sendTracking(handle);
36
+ }, [
37
+ handle,
38
+ sendTracking,
39
+ isFallback
40
+ ]);
36
41
  };
37
42
 
38
43
  export { useTrackingView };
@@ -2,32 +2,39 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import parse, { Element, Text } from 'html-react-parser';
3
3
  import Script from 'next/script';
4
4
 
5
- const parseHtml = (html, isHead) => {
6
- if (!html)
7
- return undefined;
8
- try {
9
- return parse(html, {
10
- replace: (node) => {
11
- if (node.type === 'script' && node instanceof Element) {
12
- const child = node.children?.[0];
13
- if (child instanceof Text) {
14
- if (isHead)
15
- return jsx("script", { ...node.attribs, dangerouslySetInnerHTML: { __html: child.data } });
16
- else
17
- return jsx(Script, { ...node.attribs, dangerouslySetInnerHTML: { __html: child.data } });
18
- }
19
- else {
20
- if (!isHead) {
21
- return jsx(Script, { ...node.attribs });
22
- }
23
- }
24
- }
25
- },
26
- });
27
- }
28
- catch {
29
- return undefined;
30
- }
5
+ const parseHtml = (html, isHead)=>{
6
+ if (!html) return undefined;
7
+ try {
8
+ return parse(html, {
9
+ replace: (node)=>{
10
+ if (node.type === 'script' && node instanceof Element) {
11
+ const child = node.children?.[0];
12
+ if (child instanceof Text) {
13
+ if (isHead) return /*#__PURE__*/ jsx("script", {
14
+ ...node.attribs,
15
+ dangerouslySetInnerHTML: {
16
+ __html: child.data
17
+ }
18
+ });
19
+ else return /*#__PURE__*/ jsx(Script, {
20
+ ...node.attribs,
21
+ dangerouslySetInnerHTML: {
22
+ __html: child.data
23
+ }
24
+ });
25
+ } else {
26
+ if (!isHead) {
27
+ return /*#__PURE__*/ jsx(Script, {
28
+ ...node.attribs
29
+ });
30
+ }
31
+ }
32
+ }
33
+ }
34
+ });
35
+ } catch {
36
+ return undefined;
37
+ }
31
38
  };
32
39
 
33
40
  export { parseHtml };
@@ -2,8 +2,40 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { NextSeo } from 'next-seo';
3
3
  import Image from 'next/image';
4
4
 
5
- const Page404 = () => {
6
- return (jsxs(Fragment, { children: [jsx(NextSeo, { title: "Page not found" }), 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: [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 }), jsxs("div", { className: "flex flex-col items-center justify-center gap-2 pb-36", children: [jsx("h1", { className: "mobile:text-2xl text-4xl font-semibold", children: "Oops! Page not found" }), jsx("p", { children: "Your page URL is incorrect." })] })] })] }));
5
+ const Page404 = ()=>{
6
+ return /*#__PURE__*/ jsxs(Fragment, {
7
+ children: [
8
+ /*#__PURE__*/ jsx(NextSeo, {
9
+ title: "Page not found"
10
+ }),
11
+ /*#__PURE__*/ jsxs("div", {
12
+ 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",
13
+ children: [
14
+ /*#__PURE__*/ jsx(Image, {
15
+ sizes: "(max-width: 768px) 100vw, 50vw",
16
+ src: "https://ucarecdn.com/27dfcf10-8fff-4341-90a0-dc97e4072acc/-/format/auto/",
17
+ width: 802,
18
+ height: 450,
19
+ alt: "Not found",
20
+ quality: 100,
21
+ priority: true
22
+ }),
23
+ /*#__PURE__*/ jsxs("div", {
24
+ className: "flex flex-col items-center justify-center gap-2 pb-36",
25
+ children: [
26
+ /*#__PURE__*/ jsx("h1", {
27
+ className: "mobile:text-2xl text-4xl font-semibold",
28
+ children: "Oops! Page not found"
29
+ }),
30
+ /*#__PURE__*/ jsx("p", {
31
+ children: "Your page URL is incorrect."
32
+ })
33
+ ]
34
+ })
35
+ ]
36
+ })
37
+ ]
38
+ });
7
39
  };
8
40
 
9
41
  export { Page404 };
@@ -4,14 +4,69 @@ import { NextSeo } from 'next-seo';
4
4
  import Image from 'next/image';
5
5
  import { useState } from 'react';
6
6
 
7
- const Page500 = () => {
8
- const [loading, setLoading] = useState(false);
9
- return (jsxs(Fragment, { children: [jsx(NextSeo, { title: "Service Unavailable" }), 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: [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 }), jsxs("div", { className: "flex flex-col gap-8 pb-36", children: [jsxs("div", { className: "flex flex-col items-center justify-center gap-2 text-center", children: [jsx("h1", { className: "mobile:text-2xl text-4xl font-semibold", children: "Service Unavailable" }), jsx("p", { className: "text-center", children: "The server is temporarily busy. Try again later." })] }), 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: () => {
10
- setLoading(true);
11
- window.location.reload();
12
- }, children: [jsx("svg", { className: cls('w-5', {
13
- 'animate-spin': loading,
14
- }), viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: 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"] })] })] })] }));
7
+ const Page500 = ()=>{
8
+ const [loading, setLoading] = useState(false);
9
+ return /*#__PURE__*/ jsxs(Fragment, {
10
+ children: [
11
+ /*#__PURE__*/ jsx(NextSeo, {
12
+ title: "Service Unavailable"
13
+ }),
14
+ /*#__PURE__*/ jsxs("div", {
15
+ 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",
16
+ children: [
17
+ /*#__PURE__*/ jsx(Image, {
18
+ sizes: "(max-width: 768px) 100vw, 50vw",
19
+ src: "https://ucarecdn.com/ea647025-54e3-4abb-87c4-859c5853ed56/-/format/auto/",
20
+ width: 802,
21
+ height: 450,
22
+ alt: "Not found",
23
+ quality: 100,
24
+ priority: true
25
+ }),
26
+ /*#__PURE__*/ jsxs("div", {
27
+ className: "flex flex-col gap-8 pb-36",
28
+ children: [
29
+ /*#__PURE__*/ jsxs("div", {
30
+ className: "flex flex-col items-center justify-center gap-2 text-center",
31
+ children: [
32
+ /*#__PURE__*/ jsx("h1", {
33
+ className: "mobile:text-2xl text-4xl font-semibold",
34
+ children: "Service Unavailable"
35
+ }),
36
+ /*#__PURE__*/ jsx("p", {
37
+ className: "text-center",
38
+ children: "The server is temporarily busy. Try again later."
39
+ })
40
+ ]
41
+ }),
42
+ /*#__PURE__*/ jsxs("button", {
43
+ className: "mx-auto inline-flex h-10 items-center justify-center gap-2 rounded bg-[#3C67FF] px-6 text-white active:translate-y-1",
44
+ onClick: ()=>{
45
+ setLoading(true);
46
+ window.location.reload();
47
+ },
48
+ children: [
49
+ /*#__PURE__*/ jsx("svg", {
50
+ className: cls('w-5', {
51
+ 'animate-spin': loading
52
+ }),
53
+ viewBox: "0 0 20 20",
54
+ fill: "none",
55
+ xmlns: "http://www.w3.org/2000/svg",
56
+ children: /*#__PURE__*/ jsx("path", {
57
+ 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",
58
+ fill: "currentColor"
59
+ })
60
+ }),
61
+ "Refresh"
62
+ ]
63
+ })
64
+ ]
65
+ })
66
+ ]
67
+ })
68
+ ]
69
+ });
15
70
  };
16
71
 
17
72
  export { Page500 };
@@ -4,21 +4,76 @@ import { NextSeo } from 'next-seo';
4
4
  import Head from 'next/head';
5
5
  import { useState, useEffect } from 'react';
6
6
  import Toolbox from '../components/builder/Toolbox.js';
7
+ import dynamic from 'next/dynamic';
7
8
 
8
- const BuilderPage = ({ components, seo, themeStyle, fontStyle, sectionData, }) => {
9
- const [loadSuccess, setLoadSuccess] = useState(false);
10
- const initState = {
11
- ROOT: {
12
- uid: 'ROOT',
13
- tag: 'Root',
14
- label: 'Root',
15
- childrens: [],
16
- },
17
- };
18
- useEffect(() => {
19
- setLoadSuccess(true);
20
- }, []);
21
- return (jsxs(Fragment, { children: [jsx(NextSeo, { ...seo }), jsxs(Head, { children: [themeStyle && (jsx("style", { type: "text/css", id: "global-style", dangerouslySetInnerHTML: { __html: themeStyle } })), fontStyle && (jsx("style", { "data-id": "google-fonts", type: "text/css", dangerouslySetInnerHTML: { __html: fontStyle } }))] }), jsx(BuilderComponentProvider, { components: components, children: jsx(SectionProvider, { data: sectionData, children: jsxs(BuilderPreviewProvider, { state: initState, children: [jsx(Toolbox, {}), loadSuccess && (jsxs("div", { className: "builder", children: [jsx("div", { id: "storefront", children: jsx(RenderPreview, { uid: "ROOT" }) }), jsx("div", { id: "visual-content" })] }))] }, "preview") }) })] }));
9
+ const Header = dynamic(()=>import('../components/Header.js'));
10
+ const Footer = dynamic(()=>import('../components/Footer.js'));
11
+ const BuilderPage = ({ components , seo , themeStyle , fontStyle , sectionData })=>{
12
+ const [loadSuccess, setLoadSuccess] = useState(false);
13
+ const initState = {
14
+ ROOT: {
15
+ uid: 'ROOT',
16
+ tag: 'Root',
17
+ label: 'Root',
18
+ childrens: []
19
+ }
20
+ };
21
+ useEffect(()=>{
22
+ setLoadSuccess(true);
23
+ }, []);
24
+ return /*#__PURE__*/ jsxs(Fragment, {
25
+ children: [
26
+ /*#__PURE__*/ jsx(NextSeo, {
27
+ ...seo
28
+ }),
29
+ /*#__PURE__*/ jsxs(Head, {
30
+ children: [
31
+ themeStyle && /*#__PURE__*/ jsx("style", {
32
+ type: "text/css",
33
+ id: "global-style",
34
+ dangerouslySetInnerHTML: {
35
+ __html: themeStyle
36
+ }
37
+ }),
38
+ fontStyle && /*#__PURE__*/ jsx("style", {
39
+ "data-id": "google-fonts",
40
+ type: "text/css",
41
+ dangerouslySetInnerHTML: {
42
+ __html: fontStyle
43
+ }
44
+ })
45
+ ]
46
+ }),
47
+ /*#__PURE__*/ jsx(Header, {}),
48
+ /*#__PURE__*/ jsx(BuilderComponentProvider, {
49
+ components: components,
50
+ children: /*#__PURE__*/ jsx(SectionProvider, {
51
+ data: sectionData,
52
+ children: /*#__PURE__*/ jsxs(BuilderPreviewProvider, {
53
+ state: initState,
54
+ children: [
55
+ /*#__PURE__*/ jsx(Toolbox, {}),
56
+ loadSuccess && /*#__PURE__*/ jsxs("div", {
57
+ className: "builder",
58
+ children: [
59
+ /*#__PURE__*/ jsx("div", {
60
+ id: "storefront",
61
+ children: /*#__PURE__*/ jsx(RenderPreview, {
62
+ uid: "ROOT"
63
+ })
64
+ }),
65
+ /*#__PURE__*/ jsx("div", {
66
+ id: "visual-content"
67
+ })
68
+ ]
69
+ })
70
+ ]
71
+ }, "preview")
72
+ })
73
+ }),
74
+ /*#__PURE__*/ jsx(Footer, {})
75
+ ]
76
+ });
22
77
  };
23
78
 
24
79
  export { BuilderPage };
@@ -5,13 +5,54 @@ import dynamic from 'next/dynamic';
5
5
  import Head from 'next/head';
6
6
  import { useRouter } from 'next/router';
7
7
 
8
- const CollectionProvider = dynamic(() => import('@gem-sdk/core').then((m) => m.CollectionProvider));
9
- const CollectionDetailPage = ({ seo, components, builderData, sectionData, themeStyle, collection, fontStyle, }) => {
10
- const router = useRouter();
11
- if (router.isFallback) {
12
- return jsx("div", { children: "Loading..." });
13
- }
14
- return (jsxs(Fragment, { children: [jsx(NextSeo, { ...seo }), jsxs(Head, { children: [themeStyle && (jsx("style", { "data-id": "global-style", type: "text/css", dangerouslySetInnerHTML: { __html: themeStyle } })), fontStyle && (jsx("style", { "data-id": "google-fonts", type: "text/css", dangerouslySetInnerHTML: { __html: fontStyle } }))] }), jsx(BuilderComponentProvider, { components: components, children: jsx(SectionProvider, { data: sectionData, children: jsx(CollectionProvider, { collection: collection, children: builderData && (jsx(BuilderProvider, { state: builderData, children: jsx(Render, { uid: "ROOT" }) })) }) }) })] }));
8
+ const CollectionProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.CollectionProvider));
9
+ const CollectionDetailPage = ({ seo , components , builderData , sectionData , themeStyle , collection , fontStyle })=>{
10
+ const router = useRouter();
11
+ if (router.isFallback) {
12
+ return /*#__PURE__*/ jsx("div", {
13
+ children: "Loading..."
14
+ });
15
+ }
16
+ return /*#__PURE__*/ jsxs(Fragment, {
17
+ children: [
18
+ /*#__PURE__*/ jsx(NextSeo, {
19
+ ...seo
20
+ }),
21
+ /*#__PURE__*/ jsxs(Head, {
22
+ children: [
23
+ themeStyle && /*#__PURE__*/ jsx("style", {
24
+ "data-id": "global-style",
25
+ type: "text/css",
26
+ dangerouslySetInnerHTML: {
27
+ __html: themeStyle
28
+ }
29
+ }),
30
+ fontStyle && /*#__PURE__*/ jsx("style", {
31
+ "data-id": "google-fonts",
32
+ type: "text/css",
33
+ dangerouslySetInnerHTML: {
34
+ __html: fontStyle
35
+ }
36
+ })
37
+ ]
38
+ }),
39
+ /*#__PURE__*/ jsx(BuilderComponentProvider, {
40
+ components: components,
41
+ children: /*#__PURE__*/ jsx(SectionProvider, {
42
+ data: sectionData,
43
+ children: /*#__PURE__*/ jsx(CollectionProvider, {
44
+ collection: collection,
45
+ children: builderData && /*#__PURE__*/ jsx(BuilderProvider, {
46
+ state: builderData,
47
+ children: /*#__PURE__*/ jsx(Render, {
48
+ uid: "ROOT"
49
+ })
50
+ })
51
+ })
52
+ })
53
+ })
54
+ ]
55
+ });
15
56
  };
16
57
 
17
58
  export { CollectionDetailPage as default };
@@ -1,18 +1,24 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import dynamic from 'next/dynamic';
3
3
 
4
- const StaticPage = dynamic(() => import('./static.js'));
5
- const ProductPage = dynamic(() => import('./product-detail.js'));
6
- const CollectionPage = dynamic(() => import('./collection-detail.js'));
7
- const PreviewPage = ({ pageType, ...props }) => {
8
- switch (pageType) {
9
- case 'PRODUCT':
10
- return jsx(ProductPage, { ...props });
11
- case 'COLLECTION':
12
- return jsx(CollectionPage, { ...props });
13
- default:
14
- return jsx(StaticPage, { ...props });
15
- }
4
+ const StaticPage = dynamic(()=>import('./static.js'));
5
+ const ProductPage = dynamic(()=>import('./product-detail.js'));
6
+ const CollectionPage = dynamic(()=>import('./collection-detail.js'));
7
+ const PreviewPage = ({ pageType , ...props })=>{
8
+ switch(pageType){
9
+ case 'PRODUCT':
10
+ return /*#__PURE__*/ jsx(ProductPage, {
11
+ ...props
12
+ });
13
+ case 'COLLECTION':
14
+ return /*#__PURE__*/ jsx(CollectionPage, {
15
+ ...props
16
+ });
17
+ default:
18
+ return /*#__PURE__*/ jsx(StaticPage, {
19
+ ...props
20
+ });
21
+ }
16
22
  };
17
23
 
18
24
  export { PreviewPage };
@@ -5,13 +5,59 @@ import dynamic from 'next/dynamic';
5
5
  import Head from 'next/head';
6
6
  import { useRouter } from 'next/router';
7
7
 
8
- const ProductProvider = dynamic(() => import('@gem-sdk/core').then((m) => m.ProductProvider));
9
- const ProductDetailPage = ({ themeStyle, fontStyle, seo, product, components, builderData, sectionData, }) => {
10
- const router = useRouter();
11
- if (router.isFallback) {
12
- return jsx("div", { children: "Loading..." });
13
- }
14
- return (jsxs(Fragment, { children: [jsx(NextSeo, { ...seo }), jsxs(Head, { children: [themeStyle && (jsx("style", { "data-id": "global-style", type: "text/css", dangerouslySetInnerHTML: { __html: themeStyle } })), fontStyle && (jsx("style", { "data-id": "google-fonts", type: "text/css", dangerouslySetInnerHTML: { __html: fontStyle } }))] }), jsx(BuilderComponentProvider, { components: components, children: jsx(SectionProvider, { data: sectionData, children: jsxs(ProductProvider, { product: product, children: [builderData && (jsx(BuilderProvider, { state: builderData, children: jsx(Render, { uid: "ROOT" }) })), jsx(AddOn, { name: "sticky-add-to-cart" })] }) }) })] }));
8
+ const ProductProvider = dynamic(()=>import('@gem-sdk/core').then((m)=>m.ProductProvider));
9
+ const ProductDetailPage = ({ themeStyle , fontStyle , seo , product , components , builderData , sectionData })=>{
10
+ const router = useRouter();
11
+ if (router.isFallback) {
12
+ return /*#__PURE__*/ jsx("div", {
13
+ children: "Loading..."
14
+ });
15
+ }
16
+ return /*#__PURE__*/ jsxs(Fragment, {
17
+ children: [
18
+ /*#__PURE__*/ jsx(NextSeo, {
19
+ ...seo
20
+ }),
21
+ /*#__PURE__*/ jsxs(Head, {
22
+ children: [
23
+ themeStyle && /*#__PURE__*/ jsx("style", {
24
+ "data-id": "global-style",
25
+ type: "text/css",
26
+ dangerouslySetInnerHTML: {
27
+ __html: themeStyle
28
+ }
29
+ }),
30
+ fontStyle && /*#__PURE__*/ jsx("style", {
31
+ "data-id": "google-fonts",
32
+ type: "text/css",
33
+ dangerouslySetInnerHTML: {
34
+ __html: fontStyle
35
+ }
36
+ })
37
+ ]
38
+ }),
39
+ /*#__PURE__*/ jsx(BuilderComponentProvider, {
40
+ components: components,
41
+ children: /*#__PURE__*/ jsx(SectionProvider, {
42
+ data: sectionData,
43
+ children: /*#__PURE__*/ jsxs(ProductProvider, {
44
+ product: product,
45
+ children: [
46
+ builderData && /*#__PURE__*/ jsx(BuilderProvider, {
47
+ state: builderData,
48
+ children: /*#__PURE__*/ jsx(Render, {
49
+ uid: "ROOT"
50
+ })
51
+ }),
52
+ /*#__PURE__*/ jsx(AddOn, {
53
+ name: "sticky-add-to-cart"
54
+ })
55
+ ]
56
+ })
57
+ })
58
+ })
59
+ ]
60
+ });
15
61
  };
16
62
 
17
63
  export { ProductDetailPage as default };
@@ -6,13 +6,68 @@ import { useRouter } from 'next/router';
6
6
  import { useTrackingView } from '../libs/hooks/use-tracking-view.js';
7
7
  import { parseHtml } from '../libs/parse-html.js';
8
8
 
9
- const StaticPageV2 = ({ components, builderData, sectionData, seo, themeStyle, fontStyle, customCodeHeader, shopToken, pageHandle, }) => {
10
- const router = useRouter();
11
- useTrackingView(shopToken, pageHandle, router.isFallback);
12
- if (router.isFallback) {
13
- return (jsx("div", { className: "flex h-full items-center justify-center", children: jsxs("div", { className: "flex gap-2", children: [jsx("span", { className: "aspect-square h-2 animate-[flashing_500ms_infinite_alternate] rounded-full bg-slate-800" }), jsx("span", { className: "aspect-square h-2 animate-[flashing_500ms_infinite_200ms_linear_alternate] rounded-full bg-slate-800" }), jsx("span", { className: "aspect-square h-2 animate-[flashing_500ms_infinite_500ms_alternate] rounded-full bg-slate-800" })] }) }));
14
- }
15
- return (jsxs(Fragment, { children: [jsx(NextSeo, { ...seo }), jsxs(Head, { children: [parseHtml(customCodeHeader, true), themeStyle && (jsx("style", { "data-id": "global-style", type: "text/css", dangerouslySetInnerHTML: { __html: themeStyle } })), fontStyle && (jsx("style", { "data-id": "google-fonts", type: "text/css", dangerouslySetInnerHTML: { __html: fontStyle } }))] }), jsx(BuilderComponentProvider, { components: components, children: jsx(SectionProvider, { data: sectionData, children: builderData?.map((builder) => (jsx(BuilderProvider, { state: builder.data, lazy: builder.lazy, priority: builder.priority, children: jsx(Render, { uid: builder.uid }) }, builder.uid))) }) })] }));
9
+ const StaticPageV2 = ({ components , builderData , sectionData , seo , themeStyle , fontStyle , customCodeHeader , shopToken , pageHandle })=>{
10
+ const router = useRouter();
11
+ useTrackingView(shopToken, pageHandle, router.isFallback);
12
+ if (router.isFallback) {
13
+ return /*#__PURE__*/ jsx("div", {
14
+ className: "flex h-full items-center justify-center",
15
+ children: /*#__PURE__*/ jsxs("div", {
16
+ className: "flex gap-2",
17
+ children: [
18
+ /*#__PURE__*/ jsx("span", {
19
+ className: "aspect-square h-2 animate-[flashing_500ms_infinite_alternate] rounded-full bg-slate-800"
20
+ }),
21
+ /*#__PURE__*/ jsx("span", {
22
+ className: "aspect-square h-2 animate-[flashing_500ms_infinite_200ms_linear_alternate] rounded-full bg-slate-800"
23
+ }),
24
+ /*#__PURE__*/ jsx("span", {
25
+ className: "aspect-square h-2 animate-[flashing_500ms_infinite_500ms_alternate] rounded-full bg-slate-800"
26
+ })
27
+ ]
28
+ })
29
+ });
30
+ }
31
+ return /*#__PURE__*/ jsxs(Fragment, {
32
+ children: [
33
+ /*#__PURE__*/ jsx(NextSeo, {
34
+ ...seo
35
+ }),
36
+ /*#__PURE__*/ jsxs(Head, {
37
+ children: [
38
+ parseHtml(customCodeHeader, true),
39
+ themeStyle && /*#__PURE__*/ jsx("style", {
40
+ "data-id": "global-style",
41
+ type: "text/css",
42
+ dangerouslySetInnerHTML: {
43
+ __html: themeStyle
44
+ }
45
+ }),
46
+ fontStyle && /*#__PURE__*/ jsx("style", {
47
+ "data-id": "google-fonts",
48
+ type: "text/css",
49
+ dangerouslySetInnerHTML: {
50
+ __html: fontStyle
51
+ }
52
+ })
53
+ ]
54
+ }),
55
+ /*#__PURE__*/ jsx(BuilderComponentProvider, {
56
+ components: components,
57
+ children: /*#__PURE__*/ jsx(SectionProvider, {
58
+ data: sectionData,
59
+ children: builderData?.map((builder)=>/*#__PURE__*/ jsx(BuilderProvider, {
60
+ state: builder.data,
61
+ lazy: builder.lazy,
62
+ priority: builder.priority,
63
+ children: /*#__PURE__*/ jsx(Render, {
64
+ uid: builder.uid
65
+ })
66
+ }, builder.uid))
67
+ })
68
+ })
69
+ ]
70
+ });
16
71
  };
17
72
 
18
73
  export { StaticPageV2 };