@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,67 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+
5
+ const AIIcon = ()=>{
6
+ const getRandomId = ()=>{
7
+ return Math.random().toString(36).substring(7);
8
+ };
9
+ const linearGradientId = getRandomId();
10
+ return /*#__PURE__*/ jsxRuntime.jsxs("svg", {
11
+ width: "16",
12
+ height: "16",
13
+ viewBox: "0 0 16 16",
14
+ fill: "none",
15
+ xmlns: "http://www.w3.org/2000/svg",
16
+ children: [
17
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
18
+ 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",
19
+ fill: `url(#${linearGradientId}_0)`
20
+ }),
21
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
22
+ 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",
23
+ fill: `url(#${linearGradientId}_1)`
24
+ }),
25
+ /*#__PURE__*/ jsxRuntime.jsxs("defs", {
26
+ children: [
27
+ /*#__PURE__*/ jsxRuntime.jsxs("linearGradient", {
28
+ id: `${linearGradientId}_0`,
29
+ x1: "15.3433",
30
+ y1: "2.56054",
31
+ x2: "4.24885",
32
+ y2: "1.00838",
33
+ gradientUnits: "userSpaceOnUse",
34
+ children: [
35
+ /*#__PURE__*/ jsxRuntime.jsx("stop", {
36
+ stopColor: "#D8E1FF"
37
+ }),
38
+ /*#__PURE__*/ jsxRuntime.jsx("stop", {
39
+ offset: "1",
40
+ stopColor: "#C8ACFF"
41
+ })
42
+ ]
43
+ }),
44
+ /*#__PURE__*/ jsxRuntime.jsxs("linearGradient", {
45
+ id: `${linearGradientId}_1`,
46
+ x1: "15.3433",
47
+ y1: "2.56054",
48
+ x2: "4.24885",
49
+ y2: "1.00838",
50
+ gradientUnits: "userSpaceOnUse",
51
+ children: [
52
+ /*#__PURE__*/ jsxRuntime.jsx("stop", {
53
+ stopColor: "#D8E1FF"
54
+ }),
55
+ /*#__PURE__*/ jsxRuntime.jsx("stop", {
56
+ offset: "1",
57
+ stopColor: "#C8ACFF"
58
+ })
59
+ ]
60
+ })
61
+ ]
62
+ })
63
+ ]
64
+ });
65
+ };
66
+
67
+ exports.AIIcon = AIIcon;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+
5
+ const CloseIcon = ()=>{
6
+ return /*#__PURE__*/ jsxRuntime.jsx("svg", {
7
+ width: "16",
8
+ height: "16",
9
+ viewBox: "0 0 16 16",
10
+ fill: "none",
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
13
+ 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",
14
+ fill: "#F9F9F9"
15
+ })
16
+ });
17
+ };
18
+
19
+ exports.CloseIcon = CloseIcon;
@@ -0,0 +1,37 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+
5
+ const DropdownIcon = ()=>{
6
+ return /*#__PURE__*/ jsxRuntime.jsx("svg", {
7
+ width: "20",
8
+ height: "20",
9
+ viewBox: "0 0 20 20",
10
+ fill: "none",
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
13
+ fillRule: "evenodd",
14
+ clipRule: "evenodd",
15
+ 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",
16
+ fill: "#F9F9F9"
17
+ })
18
+ });
19
+ };
20
+ const TickIcon = ()=>{
21
+ return /*#__PURE__*/ jsxRuntime.jsx("svg", {
22
+ width: "20",
23
+ height: "20",
24
+ viewBox: "0 0 20 20",
25
+ fill: "none",
26
+ xmlns: "http://www.w3.org/2000/svg",
27
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
28
+ fillRule: "evenodd",
29
+ clipRule: "evenodd",
30
+ 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",
31
+ fill: "#00C853"
32
+ })
33
+ });
34
+ };
35
+
36
+ exports.DropdownIcon = DropdownIcon;
37
+ exports.TickIcon = TickIcon;
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+
5
+ const SearchIcon = ()=>{
6
+ return /*#__PURE__*/ jsxRuntime.jsx("svg", {
7
+ width: "20",
8
+ height: "20",
9
+ viewBox: "0 0 20 20",
10
+ fill: "none",
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
13
+ fillRule: "evenodd",
14
+ clipRule: "evenodd",
15
+ 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",
16
+ fill: "#AAAAAA"
17
+ })
18
+ });
19
+ };
20
+
21
+ exports.SearchIcon = SearchIcon;
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+
5
+ const ShowMoreIcon = ()=>{
6
+ return /*#__PURE__*/ jsxRuntime.jsx("svg", {
7
+ width: "17",
8
+ height: "16",
9
+ viewBox: "0 0 17 16",
10
+ fill: "none",
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ children: /*#__PURE__*/ jsxRuntime.jsx("path", {
13
+ fillRule: "evenodd",
14
+ clipRule: "evenodd",
15
+ 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",
16
+ fill: "#F9F9F9"
17
+ })
18
+ });
19
+ };
20
+
21
+ exports.ShowMoreIcon = ShowMoreIcon;
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+
5
+ const UpgradeIcon = ()=>{
6
+ return /*#__PURE__*/ jsxRuntime.jsxs("svg", {
7
+ width: "16",
8
+ height: "16",
9
+ viewBox: "0 0 16 16",
10
+ fill: "none",
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ children: [
13
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
14
+ 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",
15
+ fill: "white"
16
+ }),
17
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
18
+ "fill-rule": "evenodd",
19
+ "clip-rule": "evenodd",
20
+ 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",
21
+ fill: "white"
22
+ })
23
+ ]
24
+ });
25
+ };
26
+
27
+ exports.UpgradeIcon = UpgradeIcon;
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+
5
+ const WarningIcon = ()=>{
6
+ return /*#__PURE__*/ jsxRuntime.jsxs("svg", {
7
+ width: "20",
8
+ height: "20",
9
+ viewBox: "0 0 20 20",
10
+ fill: "none",
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ children: [
13
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
14
+ 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",
15
+ fill: "#251A00"
16
+ }),
17
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
18
+ 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",
19
+ fill: "#251A00"
20
+ }),
21
+ /*#__PURE__*/ jsxRuntime.jsx("path", {
22
+ "fill-rule": "evenodd",
23
+ "clip-rule": "evenodd",
24
+ 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",
25
+ fill: "#251A00"
26
+ })
27
+ ]
28
+ });
29
+ };
30
+
31
+ exports.WarningIcon = WarningIcon;
@@ -36,7 +36,10 @@ const disableWrap = [
36
36
  'ProductImagesV2',
37
37
  'PostPurchaseProductImages',
38
38
  'Sticky',
39
- 'Heading'
39
+ 'Heading',
40
+ 'ProductBadge',
41
+ 'Marquee',
42
+ 'MarqueeItem'
40
43
  ];
41
44
  const customRenderChildren = [
42
45
  'Accordion',
@@ -47,7 +50,8 @@ const customRenderChildren = [
47
50
  ];
48
51
  const excludeApplyStyle = [
49
52
  'IconListV2',
50
- 'IconList'
53
+ 'IconList',
54
+ 'ProductBadge'
51
55
  ];
52
56
  const postPurchaseRequiredElements = [
53
57
  'PostPurchaseProductOffer',
@@ -66,7 +70,20 @@ const postPurchaseWrapElements = [
66
70
  'PostPurchaseCalloutBox',
67
71
  'PostPurchaseProductOffer'
68
72
  ];
73
+ const ableGenerateContentElements = [
74
+ 'Section',
75
+ 'Row',
76
+ 'Text',
77
+ 'Heading',
78
+ 'Accordion',
79
+ 'Product',
80
+ 'HeroBanner',
81
+ 'IconList',
82
+ 'IconListV2',
83
+ 'AdvancedList'
84
+ ];
69
85
 
86
+ exports.ableGenerateContentElements = ableGenerateContentElements;
70
87
  exports.customRenderChildren = customRenderChildren;
71
88
  exports.disableWrap = disableWrap;
72
89
  exports.excludeApplyStyle = excludeApplyStyle;
@@ -10,10 +10,13 @@ require('swr');
10
10
  require('@gem-sdk/adapter-shopify');
11
11
  require('swr/mutation');
12
12
  var shop = require('../../hooks/shop.js');
13
+ require('swr/infinite');
13
14
  require('vanilla-lazyload');
14
15
  require('../../hooks/useCartUI.js');
15
16
  require('react-transition-group');
16
17
  require('@gem-sdk/core');
18
+ require('classnames');
19
+ require('dayjs');
17
20
  require('../../helpers/convert.js');
18
21
 
19
22
  function Spacing(props) {
@@ -127,7 +130,7 @@ function Spacing(props) {
127
130
  const tag = el.getAttribute('data-component-tag');
128
131
  return tag === 'Row' || tag === 'Product';
129
132
  };
130
- const updateSpacing = react.useCallback(()=>{
133
+ const updateSpacing = react.useCallback((isShowVisualize)=>{
131
134
  const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
132
135
  if (!$component) return;
133
136
  const toolbar = getChildrenByAttrSelector($component, 'data-toolbar');
@@ -140,7 +143,7 @@ function Spacing(props) {
140
143
  if ($marginBottom) {
141
144
  if ($bottomBg.current && $bottomDrag.current) {
142
145
  let value = style.marginBottom;
143
- onShowMarginBottomNumber(value);
146
+ isShowVisualize && onShowMarginBottomNumber(value);
144
147
  if (parseFloat(value) < 0) {
145
148
  value = '0';
146
149
  }
@@ -168,34 +171,41 @@ function Spacing(props) {
168
171
  setIsShowVisual(false);
169
172
  }, 2000);
170
173
  // break point 28px
171
- const topPosition = parsedValue < 28 && parsedValue >= 0 ? parsedValue / 2 + 16 : parsedValue > 28 ? 0 : 16;
174
+ const topPosition = parsedValue <= 28 && parsedValue >= 0 ? parsedValue / 2 + 16 : parsedValue > 28 ? 0 : 16;
172
175
  if ($visualNumberValue.current) {
173
176
  $visualNumberValue.current.style.transform = `translateY(${topPosition}px)`;
174
177
  }
175
178
  };
176
179
  const previousAdvanced = usePrevious(props.advanced?.['spacing-setting']);
177
180
  react.useEffect(()=>{
178
- // validate spacing setting changed
179
- if (JSON.stringify(previousAdvanced) !== JSON.stringify(props.advanced?.['spacing-setting'])) {
180
- updateSpacing();
181
- }
181
+ // validate margin bottom setting changed
182
+ const isShowVisualize = verifyMarginBottomChanged(previousAdvanced, props.advanced?.['spacing-setting']);
183
+ updateSpacing(isShowVisualize);
182
184
  }, [
183
185
  previousAdvanced,
184
186
  props.advanced,
185
187
  updateSpacing
186
188
  ]);
189
+ const verifyMarginBottomChanged = (prevValue, newValue)=>{
190
+ const listDevices = [
191
+ 'desktop',
192
+ 'tablet',
193
+ 'mobile'
194
+ ];
195
+ return listDevices.some((device)=>JSON.stringify(prevValue?.[device]?.margin?.bottom) !== JSON.stringify(newValue?.[device]?.margin?.bottom));
196
+ };
187
197
  const onWindowResize = react.useCallback(()=>{
188
198
  updateSpacing();
189
199
  }, [
190
200
  updateSpacing
191
201
  ]);
192
202
  react.useEffect(()=>{
193
- window.addEventListener('editor:toolbar:update-margin-bottom', updateSpacing);
194
- window.addEventListener('editor:toolbar:update-padding-left', updateSpacing);
203
+ window.addEventListener('editor:toolbar:update-margin-bottom', ()=>updateSpacing);
204
+ window.addEventListener('editor:toolbar:update-padding-left', ()=>updateSpacing);
195
205
  window.addEventListener('resize', onWindowResize);
196
206
  return ()=>{
197
- window.removeEventListener('editor:toolbar:update-margin-bottom', updateSpacing);
198
- window.removeEventListener('editor:toolbar:update-padding-left', updateSpacing);
207
+ window.removeEventListener('editor:toolbar:update-margin-bottom', ()=>updateSpacing);
208
+ window.removeEventListener('editor:toolbar:update-padding-left', ()=>updateSpacing);
199
209
  window.removeEventListener('resize', onWindowResize);
200
210
  };
201
211
  }, [
@@ -8,8 +8,11 @@ var ShopContext = require('../../contexts/ShopContext.js');
8
8
  require('@gem-sdk/adapter-shopify');
9
9
  require('swr');
10
10
  require('swr/mutation');
11
+ require('swr/infinite');
11
12
  require('vanilla-lazyload');
12
13
  require('../../hooks/useCartUI.js');
14
+ require('classnames');
15
+ require('dayjs');
13
16
  require('../../helpers/convert.js');
14
17
 
15
18
  const SHOW_TOOLTIP_TIMEOUT = 600;
@@ -2,8 +2,17 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
 
5
- const ThemeSectionStatus = ({ ...props })=>{
6
- const isRenderThemeSectionStatus = props.tag === 'Section' && props?.isThemeSection && props?.needPublishing;
5
+ const getStatusMessage = (status)=>{
6
+ switch(status){
7
+ case 'DRAFT':
8
+ return 'This Theme Section is Draft. Publish page will also publish Theme Section.';
9
+ case 'NEED_PUBLISHING':
10
+ return 'Need to republish. Go to global edit and publish this section';
11
+ }
12
+ };
13
+ const ThemeSectionStatusWrapper = ({ tag, status, isThemeSection })=>{
14
+ const isRenderThemeSectionStatus = tag === 'Section' && isThemeSection && (status === 'DRAFT' || status === 'NEED_PUBLISHING');
15
+ const statusMessage = getStatusMessage(status);
7
16
  return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
8
17
  children: isRenderThemeSectionStatus && /*#__PURE__*/ jsxRuntime.jsxs("div", {
9
18
  "data-theme-section-status": true,
@@ -24,13 +33,13 @@ const ThemeSectionStatus = ({ ...props })=>{
24
33
  })
25
34
  })
26
35
  }),
27
- /*#__PURE__*/ jsxRuntime.jsx("span", {
36
+ statusMessage && /*#__PURE__*/ jsxRuntime.jsx("span", {
28
37
  "data-theme-section-status-text": true,
29
- children: "Need to republish. Go to global edit and publish this section"
38
+ children: statusMessage
30
39
  })
31
40
  ]
32
41
  })
33
42
  });
34
43
  };
35
44
 
36
- exports.ThemeSectionStatus = ThemeSectionStatus;
45
+ exports.ThemeSectionStatusWrapper = ThemeSectionStatusWrapper;
@@ -0,0 +1,39 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var zustand = require('zustand');
5
+ var react = require('react');
6
+
7
+ // const { Provider, useStore } = createContext<StoreApi<ProductContextProps>>();
8
+ const ArticleContext = /*#__PURE__*/ react.createContext(null);
9
+ const createArticleStoreProvider = (data)=>zustand.createStore(()=>({
10
+ ...data
11
+ }));
12
+ const ArticleProvider = ({ children, article })=>{
13
+ const uniqueId = react.useId();
14
+ const store = react.useMemo(()=>{
15
+ return createArticleStoreProvider({
16
+ article,
17
+ uniqueId
18
+ });
19
+ }, [
20
+ article,
21
+ uniqueId
22
+ ]);
23
+ return /*#__PURE__*/ jsxRuntime.jsx(ArticleContext.Provider, {
24
+ value: store,
25
+ children: /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
26
+ children: children
27
+ })
28
+ });
29
+ };
30
+ const useArticleStore = (selector, equalityFn)=>{
31
+ const store = react.useContext(ArticleContext);
32
+ if (!store) {
33
+ throw new Error('Element of article must be used inside a Article');
34
+ }
35
+ return zustand.useStore(store, selector, equalityFn);
36
+ };
37
+
38
+ exports.ArticleProvider = ArticleProvider;
39
+ exports.useArticleStore = useArticleStore;
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+ var zustand = require('zustand');
6
+
7
+ const ArticleListContext = /*#__PURE__*/ react.createContext(null);
8
+ const createArticleListProvider = (data)=>zustand.createStore(()=>({
9
+ ...data
10
+ }));
11
+ const ArticleListProvider = ({ articles, children, styles, settings })=>{
12
+ return /*#__PURE__*/ jsxRuntime.jsx(ArticleListContext.Provider, {
13
+ value: createArticleListProvider({
14
+ articles,
15
+ styles,
16
+ settings
17
+ }),
18
+ children: children
19
+ });
20
+ };
21
+ const useArticleListStore = (selector, equalityFn)=>{
22
+ const store = react.useContext(ArticleListContext);
23
+ if (!store) {
24
+ throw new Error('useArticleListStore must be used within a useArticleListStore');
25
+ }
26
+ return zustand.useStore(store, selector, equalityFn);
27
+ };
28
+
29
+ exports.ArticleListContext = ArticleListContext;
30
+ exports.ArticleListProvider = ArticleListProvider;
31
+ exports.useArticleListStore = useArticleListStore;
@@ -28,10 +28,11 @@ const root = {
28
28
  label: 'Root',
29
29
  childrens: []
30
30
  };
31
- const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>zustand.createStore((set, get)=>({
31
+ const createBuilderPreviewProvider = (args, pageName, isThemeSectionEditor)=>zustand.createStore((set, get)=>({
32
32
  state: args,
33
33
  loaded: false,
34
34
  isThemeSectionEditor: !!isThemeSectionEditor,
35
+ pageName: pageName,
35
36
  dynamicProduct: null,
36
37
  dynamicCollection: null,
37
38
  addItem: (args)=>{
@@ -253,7 +254,11 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>zustand.creat
253
254
  }
254
255
  },
255
256
  getItem: (id)=>{
256
- return get().state[id];
257
+ const item = get().state[id];
258
+ return {
259
+ ...item,
260
+ rawChildrens: item?.childrens?.map((v)=>get().state[v])
261
+ };
257
262
  },
258
263
  removeItem: (id)=>{
259
264
  if (id === 'ROOT') {
@@ -428,15 +433,16 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>zustand.creat
428
433
  updateItemAttribute: (id, value, attr)=>{
429
434
  if (!attr || ![
430
435
  'label',
431
- 'customLabel'
436
+ 'customLabel',
437
+ 'isShopifyVisibility'
432
438
  ].includes(attr)) return;
433
439
  const state = get().state;
434
440
  const item = state[id];
435
- // Ignore section
436
- if (item?.type === 'section') return;
437
441
  if (item) {
438
- const dateModified = Date.now();
439
- item.dateModified = dateModified;
442
+ if (item.type !== 'section') {
443
+ const dateModified = Date.now();
444
+ item.dateModified = dateModified;
445
+ }
440
446
  const updatedItem = {
441
447
  ...item,
442
448
  [attr]: value
@@ -450,13 +456,14 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>zustand.creat
450
456
  }
451
457
  }
452
458
  }));
453
- const BuilderPreviewProvider = ({ children, state, isThemeSectionEditor, lazy, ...passProps })=>{
459
+ const BuilderPreviewProvider = ({ children, state, isThemeSectionEditor, pageName, lazy, ...passProps })=>{
454
460
  const Component = lazy ? react.Suspense : react.Fragment;
455
461
  const value = react.useMemo(()=>{
456
- return createBuilderPreviewProvider(state, isThemeSectionEditor);
462
+ return createBuilderPreviewProvider(state, pageName, isThemeSectionEditor);
457
463
  }, [
458
464
  state,
459
- isThemeSectionEditor
465
+ isThemeSectionEditor,
466
+ pageName
460
467
  ]);
461
468
  return /*#__PURE__*/ jsxRuntime.jsx(Component, {
462
469
  children: /*#__PURE__*/ jsxRuntime.jsx(BuilderPreviewContext.Provider, {
@@ -10,6 +10,7 @@ const SectionContext = /*#__PURE__*/ react.createContext(null);
10
10
  const createSectionProvider = (data)=>zustand.createStore((set, get)=>({
11
11
  data: data ?? {},
12
12
  getSection: (id)=>{
13
+ console.log('get().data', get().data);
13
14
  const section = get().data[id];
14
15
  return section ?? undefined;
15
16
  },
@@ -53,6 +53,24 @@ const ShopProvider = ({ children, addons, storeOption, queryOption, ...passProps
53
53
  const store = react.useMemo(()=>createShopStoreProvider(storeOption), [
54
54
  storeOption
55
55
  ]);
56
+ const onUpdateLimitation = (e)=>{
57
+ const isAllow = !!e.detail?.isAllow;
58
+ const maxGenerateCount = e.detail?.maxGenerateCount;
59
+ const nextQuota = e.detail?.nextQuota;
60
+ store.setState({
61
+ generateContentLimitation: {
62
+ isAllow,
63
+ maxGenerateCount,
64
+ nextQuota
65
+ }
66
+ });
67
+ };
68
+ react.useEffect(()=>{
69
+ window.addEventListener('editor:ai-generate-content-update-limitation', onUpdateLimitation);
70
+ return ()=>{
71
+ window.removeEventListener('editor:ai-generate-content-update-limitation', onUpdateLimitation);
72
+ };
73
+ }, []);
56
74
  return /*#__PURE__*/ jsxRuntime.jsx(AddonContext.AddonProvider, {
57
75
  components: addons,
58
76
  children: /*#__PURE__*/ jsxRuntime.jsx(useSWR.SWRConfig, {
@@ -0,0 +1,55 @@
1
+ 'use strict';
2
+
3
+ const ArticlesDocument = `
4
+ query articles($after: Cursor, $before: Cursor, $first: Int, $last: Int, $orderBy: ArticleOrder, $where: ArticleWhereInput) {
5
+ articles(
6
+ after: $after
7
+ before: $before
8
+ first: $first
9
+ last: $last
10
+ orderBy: $orderBy
11
+ where: $where
12
+ ) {
13
+ edges {
14
+ cursor
15
+ node {
16
+ id
17
+ title
18
+ handle
19
+ description
20
+ templateSuffix
21
+ titleMeta
22
+ descriptionMeta
23
+ baseID
24
+ platform
25
+ tags
26
+ isSample
27
+ platformCreatedAt
28
+ author
29
+ blogs {
30
+ edges {
31
+ node {
32
+ title
33
+ }
34
+ }
35
+ }
36
+ media {
37
+ alt
38
+ width
39
+ src
40
+ height
41
+ }
42
+ }
43
+ }
44
+ pageInfo {
45
+ endCursor
46
+ hasNextPage
47
+ hasPreviousPage
48
+ startCursor
49
+ }
50
+ totalCount
51
+ }
52
+ }
53
+ `;
54
+
55
+ exports.ArticlesDocument = ArticlesDocument;