@gem-sdk/core 1.42.7 → 1.43.0-dev.100

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 (92) hide show
  1. package/dist/cjs/components/ComponentToolbarPreview.js +126 -7
  2. package/dist/cjs/components/ComponentWrapperPreview.js +44 -1
  3. package/dist/cjs/components/Render.liquid.js +3 -0
  4. package/dist/cjs/components/RenderCustomCode.js +3 -0
  5. package/dist/cjs/components/RenderPreview.js +1 -0
  6. package/dist/cjs/components/ai-generator/AIContentGenerator.js +252 -0
  7. package/dist/cjs/components/ai-generator/AIGenContentLoading.js +85 -0
  8. package/dist/cjs/components/ai-generator/components/PickProduct.js +219 -0
  9. package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +77 -0
  10. package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +47 -0
  11. package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +110 -0
  12. package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +37 -0
  13. package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +70 -0
  14. package/dist/cjs/components/ai-generator/icons/AIIcon.js +67 -0
  15. package/dist/cjs/components/ai-generator/icons/CloseIcon.js +19 -0
  16. package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +37 -0
  17. package/dist/cjs/components/ai-generator/icons/SearchIcon.js +21 -0
  18. package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +21 -0
  19. package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +27 -0
  20. package/dist/cjs/components/ai-generator/icons/WarningIcon.js +31 -0
  21. package/dist/cjs/components/constant.js +19 -2
  22. package/dist/cjs/components/resize/Spacing.js +21 -11
  23. package/dist/cjs/components/theme-section/CreateThemeSection.js +3 -0
  24. package/dist/cjs/components/theme-section/ThemeSectionStatus.js +14 -5
  25. package/dist/cjs/contexts/ArticleContext.js +39 -0
  26. package/dist/cjs/contexts/ArticleListContext.js +31 -0
  27. package/dist/cjs/contexts/BuilderPreviewContext.js +17 -10
  28. package/dist/cjs/contexts/SectionContext.js +1 -0
  29. package/dist/cjs/contexts/ShopContext.js +18 -0
  30. package/dist/cjs/graphql/queries/articles.generated.js +55 -0
  31. package/dist/cjs/graphql/queries/blogs.generated.js +63 -0
  32. package/dist/cjs/helpers/align.js +19 -0
  33. package/dist/cjs/helpers/background.js +6 -3
  34. package/dist/cjs/helpers/carousel.js +7 -10
  35. package/dist/cjs/helpers/colors.js +2 -2
  36. package/dist/cjs/helpers/queries/get-products.js +23 -0
  37. package/dist/cjs/helpers/shadow.js +1 -1
  38. package/dist/cjs/helpers/typography.js +43 -8
  39. package/dist/cjs/hooks/articles/useArticlesQuery.js +32 -0
  40. package/dist/cjs/hooks/shop/use-products-query.js +29 -0
  41. package/dist/cjs/hooks/useAnimations.js +3 -0
  42. package/dist/cjs/hooks/useFormatMoney.js +61 -60
  43. package/dist/cjs/hooks/useInitialSwatchesOptions.js +3 -0
  44. package/dist/cjs/hooks/useProduct.js +3 -0
  45. package/dist/cjs/index.js +14 -0
  46. package/dist/esm/components/ComponentToolbarPreview.js +127 -8
  47. package/dist/esm/components/ComponentWrapperPreview.js +44 -1
  48. package/dist/esm/components/Render.liquid.js +3 -0
  49. package/dist/esm/components/RenderCustomCode.js +3 -0
  50. package/dist/esm/components/RenderPreview.js +1 -0
  51. package/dist/esm/components/ai-generator/AIContentGenerator.js +250 -0
  52. package/dist/esm/components/ai-generator/AIGenContentLoading.js +83 -0
  53. package/dist/esm/components/ai-generator/components/PickProduct.js +217 -0
  54. package/dist/esm/components/ai-generator/components/ToneAndVoice.js +75 -0
  55. package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +45 -0
  56. package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +108 -0
  57. package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +35 -0
  58. package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +68 -0
  59. package/dist/esm/components/ai-generator/icons/AIIcon.js +65 -0
  60. package/dist/esm/components/ai-generator/icons/CloseIcon.js +17 -0
  61. package/dist/esm/components/ai-generator/icons/DropdownIcon.js +34 -0
  62. package/dist/esm/components/ai-generator/icons/SearchIcon.js +19 -0
  63. package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +19 -0
  64. package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +25 -0
  65. package/dist/esm/components/ai-generator/icons/WarningIcon.js +29 -0
  66. package/dist/esm/components/constant.js +19 -3
  67. package/dist/esm/components/resize/Spacing.js +21 -11
  68. package/dist/esm/components/theme-section/CreateThemeSection.js +3 -0
  69. package/dist/esm/components/theme-section/ThemeSectionStatus.js +14 -5
  70. package/dist/esm/contexts/ArticleContext.js +36 -0
  71. package/dist/esm/contexts/ArticleListContext.js +27 -0
  72. package/dist/esm/contexts/BuilderPreviewContext.js +17 -10
  73. package/dist/esm/contexts/SectionContext.js +1 -0
  74. package/dist/esm/contexts/ShopContext.js +19 -1
  75. package/dist/esm/graphql/queries/articles.generated.js +53 -0
  76. package/dist/esm/graphql/queries/blogs.generated.js +61 -0
  77. package/dist/esm/helpers/align.js +17 -0
  78. package/dist/esm/helpers/background.js +6 -4
  79. package/dist/esm/helpers/carousel.js +7 -10
  80. package/dist/esm/helpers/colors.js +2 -2
  81. package/dist/esm/helpers/queries/get-products.js +23 -1
  82. package/dist/esm/helpers/shadow.js +1 -1
  83. package/dist/esm/helpers/typography.js +43 -9
  84. package/dist/esm/hooks/articles/useArticlesQuery.js +29 -0
  85. package/dist/esm/hooks/shop/use-products-query.js +30 -2
  86. package/dist/esm/hooks/useAnimations.js +3 -0
  87. package/dist/esm/hooks/useFormatMoney.js +61 -61
  88. package/dist/esm/hooks/useInitialSwatchesOptions.js +3 -0
  89. package/dist/esm/hooks/useProduct.js +3 -0
  90. package/dist/esm/index.js +7 -3
  91. package/dist/types/index.d.ts +263 -51
  92. package/package.json +6 -3
@@ -0,0 +1,65 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+
3
+ const AIIcon = ()=>{
4
+ const getRandomId = ()=>{
5
+ return Math.random().toString(36).substring(7);
6
+ };
7
+ const linearGradientId = getRandomId();
8
+ return /*#__PURE__*/ jsxs("svg", {
9
+ width: "16",
10
+ height: "16",
11
+ viewBox: "0 0 16 16",
12
+ fill: "none",
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ children: [
15
+ /*#__PURE__*/ jsx("path", {
16
+ d: "M11.6363 2.67137C11.5886 2.52361 11.3795 2.52361 11.3318 2.67137L11.1133 3.34797C11.0352 3.58971 10.8469 3.78 10.606 3.86067L9.93715 4.08465C9.79156 4.1334 9.79156 4.33933 9.93715 4.38809L10.606 4.61207C10.8469 4.69273 11.0352 4.88302 11.1133 5.12477L11.3318 5.80137C11.3795 5.94913 11.5886 5.94913 11.6363 5.80137L11.8549 5.12477C11.933 4.88302 12.1212 4.69273 12.3621 4.61207L13.031 4.38809C13.1766 4.33933 13.1766 4.1334 13.031 4.08465L12.3621 3.86067C12.1212 3.78 11.933 3.58971 11.8549 3.34797L11.6363 2.67137Z",
17
+ fill: `url(#${linearGradientId}_0)`
18
+ }),
19
+ /*#__PURE__*/ jsx("path", {
20
+ d: "M7.61245 3.30705C7.54086 3.08541 7.22728 3.08541 7.15569 3.30705L6.39541 5.6608C6.16115 6.38604 5.59636 6.9569 4.87367 7.19891L2.56369 7.97242C2.3453 8.04555 2.34531 8.35445 2.5637 8.42758L4.87367 9.2011C5.59636 9.4431 6.16115 10.014 6.39541 10.7392L7.15569 13.093C7.22728 13.3146 7.54086 13.3146 7.61245 13.093L8.37273 10.7392C8.60699 10.014 9.17178 9.4431 9.89447 9.2011L12.2044 8.42758C12.4228 8.35445 12.4228 8.04555 12.2044 7.97242L9.89447 7.1989C9.17178 6.9569 8.60699 6.38604 8.37273 5.6608L7.61245 3.30705Z",
21
+ fill: `url(#${linearGradientId}_1)`
22
+ }),
23
+ /*#__PURE__*/ jsxs("defs", {
24
+ children: [
25
+ /*#__PURE__*/ jsxs("linearGradient", {
26
+ id: `${linearGradientId}_0`,
27
+ x1: "15.3433",
28
+ y1: "2.56054",
29
+ x2: "4.24885",
30
+ y2: "1.00838",
31
+ gradientUnits: "userSpaceOnUse",
32
+ children: [
33
+ /*#__PURE__*/ jsx("stop", {
34
+ stopColor: "#D8E1FF"
35
+ }),
36
+ /*#__PURE__*/ jsx("stop", {
37
+ offset: "1",
38
+ stopColor: "#C8ACFF"
39
+ })
40
+ ]
41
+ }),
42
+ /*#__PURE__*/ jsxs("linearGradient", {
43
+ id: `${linearGradientId}_1`,
44
+ x1: "15.3433",
45
+ y1: "2.56054",
46
+ x2: "4.24885",
47
+ y2: "1.00838",
48
+ gradientUnits: "userSpaceOnUse",
49
+ children: [
50
+ /*#__PURE__*/ jsx("stop", {
51
+ stopColor: "#D8E1FF"
52
+ }),
53
+ /*#__PURE__*/ jsx("stop", {
54
+ offset: "1",
55
+ stopColor: "#C8ACFF"
56
+ })
57
+ ]
58
+ })
59
+ ]
60
+ })
61
+ ]
62
+ });
63
+ };
64
+
65
+ export { AIIcon };
@@ -0,0 +1,17 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+
3
+ const CloseIcon = ()=>{
4
+ return /*#__PURE__*/ jsx("svg", {
5
+ width: "16",
6
+ height: "16",
7
+ viewBox: "0 0 16 16",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ d: "M11.1755 12.0243C11.4099 12.2586 11.7898 12.2586 12.0241 12.0243C12.2584 11.79 12.2584 11.4101 12.0241 11.1757L8.84833 8L12.0241 4.82427C12.2584 4.58995 12.2584 4.21005 12.0241 3.97574C11.7898 3.74142 11.4099 3.74142 11.1755 3.97574L7.9998 7.15148L4.82407 3.97574C4.58975 3.74142 4.20986 3.74142 3.97554 3.97574C3.74123 4.21005 3.74123 4.58995 3.97554 4.82427L7.15128 8L3.97554 11.1757C3.74123 11.4101 3.74123 11.79 3.97554 12.0243C4.20986 12.2586 4.58975 12.2586 4.82407 12.0243L7.9998 8.84853L11.1755 12.0243Z",
12
+ fill: "#F9F9F9"
13
+ })
14
+ });
15
+ };
16
+
17
+ export { CloseIcon };
@@ -0,0 +1,34 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+
3
+ const DropdownIcon = ()=>{
4
+ return /*#__PURE__*/ jsx("svg", {
5
+ width: "20",
6
+ height: "20",
7
+ viewBox: "0 0 20 20",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ fillRule: "evenodd",
12
+ clipRule: "evenodd",
13
+ d: "M5.13313 7.62204C5.31064 7.45932 5.59845 7.45932 5.77596 7.62204L10 11.4941L14.224 7.62204C14.4016 7.45932 14.6894 7.45932 14.8669 7.62204C15.0444 7.78476 15.0444 8.04858 14.8669 8.21129L10.3214 12.378C10.1439 12.5407 9.8561 12.5407 9.67859 12.378L5.13313 8.21129C4.95562 8.04858 4.95562 7.78476 5.13313 7.62204Z",
14
+ fill: "#F9F9F9"
15
+ })
16
+ });
17
+ };
18
+ const TickIcon = ()=>{
19
+ return /*#__PURE__*/ jsx("svg", {
20
+ width: "20",
21
+ height: "20",
22
+ viewBox: "0 0 20 20",
23
+ fill: "none",
24
+ xmlns: "http://www.w3.org/2000/svg",
25
+ children: /*#__PURE__*/ jsx("path", {
26
+ fillRule: "evenodd",
27
+ clipRule: "evenodd",
28
+ d: "M15.8415 5.1766C16.0528 5.41207 16.0528 5.79383 15.8415 6.0293L7.95016 14.8234C7.84869 14.9365 7.71107 15 7.56757 15C7.42408 15 7.28645 14.9365 7.18499 14.8234L4.15846 11.4505C3.94717 11.215 3.94718 10.8333 4.15848 10.5978C4.36978 10.3623 4.71236 10.3623 4.92365 10.5978L7.56759 13.5443L15.0764 5.1766C15.2877 4.94113 15.6302 4.94113 15.8415 5.1766Z",
29
+ fill: "#00C853"
30
+ })
31
+ });
32
+ };
33
+
34
+ export { DropdownIcon, TickIcon };
@@ -0,0 +1,19 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+
3
+ const SearchIcon = ()=>{
4
+ return /*#__PURE__*/ jsx("svg", {
5
+ width: "20",
6
+ height: "20",
7
+ viewBox: "0 0 20 20",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ fillRule: "evenodd",
12
+ clipRule: "evenodd",
13
+ d: "M8.75 2.5C5.29822 2.5 2.5 5.29822 2.5 8.75C2.5 12.2018 5.29822 15 8.75 15C10.2508 15 11.628 14.471 12.7055 13.5893L16.4775 17.3614C16.7216 17.6054 17.1173 17.6054 17.3614 17.3614C17.6054 17.1173 17.6054 16.7216 17.3614 16.4775L13.5893 12.7055C14.471 11.628 15 10.2508 15 8.75C15 5.29822 12.2018 2.5 8.75 2.5ZM3.75 8.75C3.75 5.98858 5.98858 3.75 8.75 3.75C11.5114 3.75 13.75 5.98858 13.75 8.75C13.75 11.5114 11.5114 13.75 8.75 13.75C5.98858 13.75 3.75 11.5114 3.75 8.75Z",
14
+ fill: "#AAAAAA"
15
+ })
16
+ });
17
+ };
18
+
19
+ export { SearchIcon };
@@ -0,0 +1,19 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+
3
+ const ShowMoreIcon = ()=>{
4
+ return /*#__PURE__*/ jsx("svg", {
5
+ width: "17",
6
+ height: "16",
7
+ viewBox: "0 0 17 16",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ children: /*#__PURE__*/ jsx("path", {
11
+ fillRule: "evenodd",
12
+ clipRule: "evenodd",
13
+ d: "M4.60651 6.09763C4.74852 5.96746 4.97876 5.96746 5.12077 6.09763L8.5 9.19526L11.8792 6.09763C12.0212 5.96746 12.2515 5.96746 12.3935 6.09763C12.5355 6.22781 12.5355 6.43886 12.3935 6.56904L8.75713 9.90237C8.61512 10.0325 8.38488 10.0325 8.24287 9.90237L4.60651 6.56904C4.4645 6.43886 4.4645 6.22781 4.60651 6.09763Z",
14
+ fill: "#F9F9F9"
15
+ })
16
+ });
17
+ };
18
+
19
+ export { ShowMoreIcon };
@@ -0,0 +1,25 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+
3
+ const UpgradeIcon = ()=>{
4
+ return /*#__PURE__*/ jsxs("svg", {
5
+ width: "16",
6
+ height: "16",
7
+ viewBox: "0 0 16 16",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ children: [
11
+ /*#__PURE__*/ jsx("path", {
12
+ d: "M4.5614 3.40226C4.75106 3.05549 5.2491 3.05549 5.43876 3.40226L5.59563 3.68909C5.76081 3.99112 6.00913 4.23944 6.31116 4.40462L6.59799 4.56149C6.94476 4.75115 6.94476 5.24919 6.59799 5.43885L6.31116 5.59572C6.00913 5.7609 5.76081 6.00923 5.59563 6.31125L5.43876 6.59808C5.2491 6.94485 4.75106 6.94485 4.5614 6.59808L4.40453 6.31125C4.23935 6.00923 3.99102 5.7609 3.689 5.59572L3.40217 5.43885C3.0554 5.24919 3.0554 4.75115 3.40217 4.56149L3.689 4.40462C3.99102 4.23944 4.23935 3.99112 4.40453 3.68909L4.5614 3.40226Z",
13
+ fill: "white"
14
+ }),
15
+ /*#__PURE__*/ jsx("path", {
16
+ "fill-rule": "evenodd",
17
+ "clip-rule": "evenodd",
18
+ d: "M10.3586 6.31151C10.2145 5.37846 8.87693 5.36015 8.70733 6.2889L8.68345 6.41972C8.45531 7.66902 7.46634 8.63997 6.21306 8.84509C5.29358 8.99558 5.27456 10.3111 6.1893 10.4881L6.27325 10.5044C7.49956 10.7417 8.45849 11.7006 8.69579 12.9269L8.72136 13.0591C8.90841 14.0257 10.2917 14.0257 10.4788 13.0591L10.4987 12.9561C10.739 11.7146 11.7162 10.7476 12.9601 10.5204C13.9075 10.3474 13.8556 8.9775 12.9032 8.83444C11.5987 8.63847 10.56 7.61516 10.3586 6.31151ZM9.60348 11.8213C10.01 10.8962 10.7327 10.146 11.6365 9.70404C10.718 9.2961 9.96932 8.57183 9.53477 7.66527C9.12271 8.54399 8.41761 9.2538 7.54422 9.67221C8.46419 10.1164 9.19752 10.8797 9.60348 11.8213Z",
19
+ fill: "white"
20
+ })
21
+ ]
22
+ });
23
+ };
24
+
25
+ export { UpgradeIcon };
@@ -0,0 +1,29 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+
3
+ const WarningIcon = ()=>{
4
+ return /*#__PURE__*/ jsxs("svg", {
5
+ width: "20",
6
+ height: "20",
7
+ viewBox: "0 0 20 20",
8
+ fill: "none",
9
+ xmlns: "http://www.w3.org/2000/svg",
10
+ children: [
11
+ /*#__PURE__*/ jsx("path", {
12
+ d: "M9.99997 6.75C10.4142 6.75 10.75 7.08579 10.75 7.5V11C10.75 11.4142 10.4142 11.75 9.99997 11.75C9.58576 11.75 9.24997 11.4142 9.24997 11V7.5C9.24997 7.08579 9.58576 6.75 9.99997 6.75Z",
13
+ fill: "#251A00"
14
+ }),
15
+ /*#__PURE__*/ jsx("path", {
16
+ d: "M11 13.5C11 14.0523 10.5523 14.5 10 14.5C9.44775 14.5 9.00003 14.0523 9.00003 13.5C9.00003 12.9477 9.44775 12.5 10 12.5C10.5523 12.5 11 12.9477 11 13.5Z",
17
+ fill: "#251A00"
18
+ }),
19
+ /*#__PURE__*/ jsx("path", {
20
+ "fill-rule": "evenodd",
21
+ "clip-rule": "evenodd",
22
+ d: "M10.0001 3.5C8.95474 3.5 8.21619 4.20232 7.84765 4.94672C7.65568 5.33448 6.75987 7.0441 5.84308 8.79353L5.81534 8.84646C4.92293 10.5493 4.01717 12.2777 3.80719 12.702C3.43513 13.4537 3.32934 14.4519 3.89956 15.316C4.46914 16.1791 5.44225 16.5 6.3636 16.5L13.6364 16.5C14.5577 16.5 15.5309 16.1791 16.1005 15.316C16.6707 14.4519 16.5649 13.4537 16.1928 12.702C15.9832 12.2784 15.08 10.555 14.189 8.85476L14.1569 8.79352C13.24 7.044 12.3443 5.33454 12.1525 4.94693C11.784 4.20242 11.0455 3.5 10.0001 3.5ZM9.19193 5.61225C9.59608 4.79592 10.4041 4.79592 10.8081 5.61225C11.0102 6.02061 11.9201 7.75686 12.8297 9.49243C13.7383 11.2262 14.6466 12.9594 14.8485 13.3673C15.2525 14.1837 14.8485 15 13.6364 15L6.3636 15C5.15153 15 4.74749 14.1837 5.15153 13.3673C5.35379 12.9587 6.26471 11.2205 7.17483 9.4838C8.08286 7.75111 8.99008 6.01994 9.19193 5.61225Z",
23
+ fill: "#251A00"
24
+ })
25
+ ]
26
+ });
27
+ };
28
+
29
+ export { WarningIcon };
@@ -34,7 +34,10 @@ const disableWrap = [
34
34
  'ProductImagesV2',
35
35
  'PostPurchaseProductImages',
36
36
  'Sticky',
37
- 'Heading'
37
+ 'Heading',
38
+ 'ProductBadge',
39
+ 'Marquee',
40
+ 'MarqueeItem'
38
41
  ];
39
42
  const customRenderChildren = [
40
43
  'Accordion',
@@ -45,7 +48,8 @@ const customRenderChildren = [
45
48
  ];
46
49
  const excludeApplyStyle = [
47
50
  'IconListV2',
48
- 'IconList'
51
+ 'IconList',
52
+ 'ProductBadge'
49
53
  ];
50
54
  const postPurchaseRequiredElements = [
51
55
  'PostPurchaseProductOffer',
@@ -64,5 +68,17 @@ const postPurchaseWrapElements = [
64
68
  'PostPurchaseCalloutBox',
65
69
  'PostPurchaseProductOffer'
66
70
  ];
71
+ const ableGenerateContentElements = [
72
+ 'Section',
73
+ 'Row',
74
+ 'Text',
75
+ 'Heading',
76
+ 'Accordion',
77
+ 'Product',
78
+ 'HeroBanner',
79
+ 'IconList',
80
+ 'IconListV2',
81
+ 'AdvancedList'
82
+ ];
67
83
 
68
- export { customRenderChildren, disableWrap, excludeApplyStyle, postPurchaseRequiredElements, postPurchaseWrapElements };
84
+ export { ableGenerateContentElements, customRenderChildren, disableWrap, excludeApplyStyle, postPurchaseRequiredElements, postPurchaseWrapElements };
@@ -6,10 +6,13 @@ import 'swr';
6
6
  import '@gem-sdk/adapter-shopify';
7
7
  import 'swr/mutation';
8
8
  import { usePageType } from '../../hooks/shop.js';
9
+ import 'swr/infinite';
9
10
  import 'vanilla-lazyload';
10
11
  import '../../hooks/useCartUI.js';
11
12
  import 'react-transition-group';
12
13
  import '@gem-sdk/core';
14
+ import 'classnames';
15
+ import 'dayjs';
13
16
  import '../../helpers/convert.js';
14
17
 
15
18
  function Spacing(props) {
@@ -123,7 +126,7 @@ function Spacing(props) {
123
126
  const tag = el.getAttribute('data-component-tag');
124
127
  return tag === 'Row' || tag === 'Product';
125
128
  };
126
- const updateSpacing = useCallback(()=>{
129
+ const updateSpacing = useCallback((isShowVisualize)=>{
127
130
  const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
128
131
  if (!$component) return;
129
132
  const toolbar = getChildrenByAttrSelector($component, 'data-toolbar');
@@ -136,7 +139,7 @@ function Spacing(props) {
136
139
  if ($marginBottom) {
137
140
  if ($bottomBg.current && $bottomDrag.current) {
138
141
  let value = style.marginBottom;
139
- onShowMarginBottomNumber(value);
142
+ isShowVisualize && onShowMarginBottomNumber(value);
140
143
  if (parseFloat(value) < 0) {
141
144
  value = '0';
142
145
  }
@@ -164,34 +167,41 @@ function Spacing(props) {
164
167
  setIsShowVisual(false);
165
168
  }, 2000);
166
169
  // break point 28px
167
- const topPosition = parsedValue < 28 && parsedValue >= 0 ? parsedValue / 2 + 16 : parsedValue > 28 ? 0 : 16;
170
+ const topPosition = parsedValue <= 28 && parsedValue >= 0 ? parsedValue / 2 + 16 : parsedValue > 28 ? 0 : 16;
168
171
  if ($visualNumberValue.current) {
169
172
  $visualNumberValue.current.style.transform = `translateY(${topPosition}px)`;
170
173
  }
171
174
  };
172
175
  const previousAdvanced = usePrevious(props.advanced?.['spacing-setting']);
173
176
  useEffect(()=>{
174
- // validate spacing setting changed
175
- if (JSON.stringify(previousAdvanced) !== JSON.stringify(props.advanced?.['spacing-setting'])) {
176
- updateSpacing();
177
- }
177
+ // validate margin bottom setting changed
178
+ const isShowVisualize = verifyMarginBottomChanged(previousAdvanced, props.advanced?.['spacing-setting']);
179
+ updateSpacing(isShowVisualize);
178
180
  }, [
179
181
  previousAdvanced,
180
182
  props.advanced,
181
183
  updateSpacing
182
184
  ]);
185
+ const verifyMarginBottomChanged = (prevValue, newValue)=>{
186
+ const listDevices = [
187
+ 'desktop',
188
+ 'tablet',
189
+ 'mobile'
190
+ ];
191
+ return listDevices.some((device)=>JSON.stringify(prevValue?.[device]?.margin?.bottom) !== JSON.stringify(newValue?.[device]?.margin?.bottom));
192
+ };
183
193
  const onWindowResize = useCallback(()=>{
184
194
  updateSpacing();
185
195
  }, [
186
196
  updateSpacing
187
197
  ]);
188
198
  useEffect(()=>{
189
- window.addEventListener('editor:toolbar:update-margin-bottom', updateSpacing);
190
- window.addEventListener('editor:toolbar:update-padding-left', updateSpacing);
199
+ window.addEventListener('editor:toolbar:update-margin-bottom', ()=>updateSpacing);
200
+ window.addEventListener('editor:toolbar:update-padding-left', ()=>updateSpacing);
191
201
  window.addEventListener('resize', onWindowResize);
192
202
  return ()=>{
193
- window.removeEventListener('editor:toolbar:update-margin-bottom', updateSpacing);
194
- window.removeEventListener('editor:toolbar:update-padding-left', updateSpacing);
203
+ window.removeEventListener('editor:toolbar:update-margin-bottom', ()=>updateSpacing);
204
+ window.removeEventListener('editor:toolbar:update-padding-left', ()=>updateSpacing);
195
205
  window.removeEventListener('resize', onWindowResize);
196
206
  };
197
207
  }, [
@@ -6,8 +6,11 @@ import { useShopStore } from '../../contexts/ShopContext.js';
6
6
  import '@gem-sdk/adapter-shopify';
7
7
  import 'swr';
8
8
  import 'swr/mutation';
9
+ import 'swr/infinite';
9
10
  import 'vanilla-lazyload';
10
11
  import '../../hooks/useCartUI.js';
12
+ import 'classnames';
13
+ import 'dayjs';
11
14
  import '../../helpers/convert.js';
12
15
 
13
16
  const SHOW_TOOLTIP_TIMEOUT = 600;
@@ -1,7 +1,16 @@
1
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
2
 
3
- const ThemeSectionStatus = ({ ...props })=>{
4
- const isRenderThemeSectionStatus = props.tag === 'Section' && props?.isThemeSection && props?.needPublishing;
3
+ const getStatusMessage = (status)=>{
4
+ switch(status){
5
+ case 'DRAFT':
6
+ return 'This Theme Section is Draft. Publish page will also publish Theme Section.';
7
+ case 'NEED_PUBLISHING':
8
+ return 'Need to republish. Go to global edit and publish this section';
9
+ }
10
+ };
11
+ const ThemeSectionStatusWrapper = ({ tag, status, isThemeSection })=>{
12
+ const isRenderThemeSectionStatus = tag === 'Section' && isThemeSection && (status === 'DRAFT' || status === 'NEED_PUBLISHING');
13
+ const statusMessage = getStatusMessage(status);
5
14
  return /*#__PURE__*/ jsx(Fragment, {
6
15
  children: isRenderThemeSectionStatus && /*#__PURE__*/ jsxs("div", {
7
16
  "data-theme-section-status": true,
@@ -22,13 +31,13 @@ const ThemeSectionStatus = ({ ...props })=>{
22
31
  })
23
32
  })
24
33
  }),
25
- /*#__PURE__*/ jsx("span", {
34
+ statusMessage && /*#__PURE__*/ jsx("span", {
26
35
  "data-theme-section-status-text": true,
27
- children: "Need to republish. Go to global edit and publish this section"
36
+ children: statusMessage
28
37
  })
29
38
  ]
30
39
  })
31
40
  });
32
41
  };
33
42
 
34
- export { ThemeSectionStatus };
43
+ export { ThemeSectionStatusWrapper };
@@ -0,0 +1,36 @@
1
+ import { jsx, Fragment } from 'react/jsx-runtime';
2
+ import { useStore, createStore } from 'zustand';
3
+ import { useId, useMemo, useContext, createContext } from 'react';
4
+
5
+ // const { Provider, useStore } = createContext<StoreApi<ProductContextProps>>();
6
+ const ArticleContext = /*#__PURE__*/ createContext(null);
7
+ const createArticleStoreProvider = (data)=>createStore(()=>({
8
+ ...data
9
+ }));
10
+ const ArticleProvider = ({ children, article })=>{
11
+ const uniqueId = useId();
12
+ const store = useMemo(()=>{
13
+ return createArticleStoreProvider({
14
+ article,
15
+ uniqueId
16
+ });
17
+ }, [
18
+ article,
19
+ uniqueId
20
+ ]);
21
+ return /*#__PURE__*/ jsx(ArticleContext.Provider, {
22
+ value: store,
23
+ children: /*#__PURE__*/ jsx(Fragment, {
24
+ children: children
25
+ })
26
+ });
27
+ };
28
+ const useArticleStore = (selector, equalityFn)=>{
29
+ const store = useContext(ArticleContext);
30
+ if (!store) {
31
+ throw new Error('Element of article must be used inside a Article');
32
+ }
33
+ return useStore(store, selector, equalityFn);
34
+ };
35
+
36
+ export { ArticleProvider, useArticleStore };
@@ -0,0 +1,27 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useContext, createContext } from 'react';
3
+ import { useStore, createStore } from 'zustand';
4
+
5
+ const ArticleListContext = /*#__PURE__*/ createContext(null);
6
+ const createArticleListProvider = (data)=>createStore(()=>({
7
+ ...data
8
+ }));
9
+ const ArticleListProvider = ({ articles, children, styles, settings })=>{
10
+ return /*#__PURE__*/ jsx(ArticleListContext.Provider, {
11
+ value: createArticleListProvider({
12
+ articles,
13
+ styles,
14
+ settings
15
+ }),
16
+ children: children
17
+ });
18
+ };
19
+ const useArticleListStore = (selector, equalityFn)=>{
20
+ const store = useContext(ArticleListContext);
21
+ if (!store) {
22
+ throw new Error('useArticleListStore must be used within a useArticleListStore');
23
+ }
24
+ return useStore(store, selector, equalityFn);
25
+ };
26
+
27
+ export { ArticleListContext, ArticleListProvider, useArticleListStore };
@@ -26,10 +26,11 @@ const root = {
26
26
  label: 'Root',
27
27
  childrens: []
28
28
  };
29
- const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>createStore((set, get)=>({
29
+ const createBuilderPreviewProvider = (args, pageName, isThemeSectionEditor)=>createStore((set, get)=>({
30
30
  state: args,
31
31
  loaded: false,
32
32
  isThemeSectionEditor: !!isThemeSectionEditor,
33
+ pageName: pageName,
33
34
  dynamicProduct: null,
34
35
  dynamicCollection: null,
35
36
  addItem: (args)=>{
@@ -251,7 +252,11 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>createStore((
251
252
  }
252
253
  },
253
254
  getItem: (id)=>{
254
- return get().state[id];
255
+ const item = get().state[id];
256
+ return {
257
+ ...item,
258
+ rawChildrens: item?.childrens?.map((v)=>get().state[v])
259
+ };
255
260
  },
256
261
  removeItem: (id)=>{
257
262
  if (id === 'ROOT') {
@@ -426,15 +431,16 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>createStore((
426
431
  updateItemAttribute: (id, value, attr)=>{
427
432
  if (!attr || ![
428
433
  'label',
429
- 'customLabel'
434
+ 'customLabel',
435
+ 'isShopifyVisibility'
430
436
  ].includes(attr)) return;
431
437
  const state = get().state;
432
438
  const item = state[id];
433
- // Ignore section
434
- if (item?.type === 'section') return;
435
439
  if (item) {
436
- const dateModified = Date.now();
437
- item.dateModified = dateModified;
440
+ if (item.type !== 'section') {
441
+ const dateModified = Date.now();
442
+ item.dateModified = dateModified;
443
+ }
438
444
  const updatedItem = {
439
445
  ...item,
440
446
  [attr]: value
@@ -448,13 +454,14 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>createStore((
448
454
  }
449
455
  }
450
456
  }));
451
- const BuilderPreviewProvider = ({ children, state, isThemeSectionEditor, lazy, ...passProps })=>{
457
+ const BuilderPreviewProvider = ({ children, state, isThemeSectionEditor, pageName, lazy, ...passProps })=>{
452
458
  const Component = lazy ? Suspense : Fragment;
453
459
  const value = useMemo(()=>{
454
- return createBuilderPreviewProvider(state, isThemeSectionEditor);
460
+ return createBuilderPreviewProvider(state, pageName, isThemeSectionEditor);
455
461
  }, [
456
462
  state,
457
- isThemeSectionEditor
463
+ isThemeSectionEditor,
464
+ pageName
458
465
  ]);
459
466
  return /*#__PURE__*/ jsx(Component, {
460
467
  children: /*#__PURE__*/ jsx(BuilderPreviewContext.Provider, {
@@ -8,6 +8,7 @@ const SectionContext = /*#__PURE__*/ createContext(null);
8
8
  const createSectionProvider = (data)=>createStore((set, get)=>({
9
9
  data: data ?? {},
10
10
  getSection: (id)=>{
11
+ console.log('get().data', get().data);
11
12
  const section = get().data[id];
12
13
  return section ?? undefined;
13
14
  },
@@ -1,7 +1,7 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { SWRConfig } from 'swr';
3
3
  import { useStore, createStore } from 'zustand';
4
- import { useMemo, useContext, createContext } from 'react';
4
+ import { useMemo, useEffect, useContext, createContext } from 'react';
5
5
  import { AddonProvider } from './AddonContext.js';
6
6
  import { ModalProvider } from './ModalContext.js';
7
7
 
@@ -51,6 +51,24 @@ const ShopProvider = ({ children, addons, storeOption, queryOption, ...passProps
51
51
  const store = useMemo(()=>createShopStoreProvider(storeOption), [
52
52
  storeOption
53
53
  ]);
54
+ const onUpdateLimitation = (e)=>{
55
+ const isAllow = !!e.detail?.isAllow;
56
+ const maxGenerateCount = e.detail?.maxGenerateCount;
57
+ const nextQuota = e.detail?.nextQuota;
58
+ store.setState({
59
+ generateContentLimitation: {
60
+ isAllow,
61
+ maxGenerateCount,
62
+ nextQuota
63
+ }
64
+ });
65
+ };
66
+ useEffect(()=>{
67
+ window.addEventListener('editor:ai-generate-content-update-limitation', onUpdateLimitation);
68
+ return ()=>{
69
+ window.removeEventListener('editor:ai-generate-content-update-limitation', onUpdateLimitation);
70
+ };
71
+ }, []);
54
72
  return /*#__PURE__*/ jsx(AddonProvider, {
55
73
  components: addons,
56
74
  children: /*#__PURE__*/ jsx(SWRConfig, {
@@ -0,0 +1,53 @@
1
+ const ArticlesDocument = `
2
+ query articles($after: Cursor, $before: Cursor, $first: Int, $last: Int, $orderBy: ArticleOrder, $where: ArticleWhereInput) {
3
+ articles(
4
+ after: $after
5
+ before: $before
6
+ first: $first
7
+ last: $last
8
+ orderBy: $orderBy
9
+ where: $where
10
+ ) {
11
+ edges {
12
+ cursor
13
+ node {
14
+ id
15
+ title
16
+ handle
17
+ description
18
+ templateSuffix
19
+ titleMeta
20
+ descriptionMeta
21
+ baseID
22
+ platform
23
+ tags
24
+ isSample
25
+ platformCreatedAt
26
+ author
27
+ blogs {
28
+ edges {
29
+ node {
30
+ title
31
+ }
32
+ }
33
+ }
34
+ media {
35
+ alt
36
+ width
37
+ src
38
+ height
39
+ }
40
+ }
41
+ }
42
+ pageInfo {
43
+ endCursor
44
+ hasNextPage
45
+ hasPreviousPage
46
+ startCursor
47
+ }
48
+ totalCount
49
+ }
50
+ }
51
+ `;
52
+
53
+ export { ArticlesDocument };