@gem-sdk/core 1.42.0 → 1.42.3-dev.63

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 (72) hide show
  1. package/dist/cjs/components/ComponentToolbarPreview.js +54 -6
  2. package/dist/cjs/components/ComponentWrapperPreview.js +44 -1
  3. package/dist/cjs/components/Render.liquid.js +2 -0
  4. package/dist/cjs/components/RenderCustomCode.js +2 -0
  5. package/dist/cjs/components/ai-generator/AIContentGenerator.js +205 -0
  6. package/dist/cjs/components/ai-generator/AIGenContentLoading.js +85 -0
  7. package/dist/cjs/components/ai-generator/components/PickProduct.js +218 -0
  8. package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +77 -0
  9. package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +47 -0
  10. package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +110 -0
  11. package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +37 -0
  12. package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +63 -0
  13. package/dist/cjs/components/ai-generator/icons/AIIcon.js +67 -0
  14. package/dist/cjs/components/ai-generator/icons/CloseIcon.js +19 -0
  15. package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +37 -0
  16. package/dist/cjs/components/ai-generator/icons/SearchIcon.js +21 -0
  17. package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +21 -0
  18. package/dist/cjs/components/constant.js +19 -2
  19. package/dist/cjs/components/resize/Spacing.js +2 -0
  20. package/dist/cjs/components/theme-section/CreateThemeSection.js +2 -0
  21. package/dist/cjs/contexts/ArticleContext.js +39 -0
  22. package/dist/cjs/contexts/ArticleListContext.js +32 -0
  23. package/dist/cjs/contexts/BuilderPreviewContext.js +11 -6
  24. package/dist/cjs/contexts/SectionContext.js +1 -0
  25. package/dist/cjs/helpers/align.js +19 -0
  26. package/dist/cjs/helpers/carousel.js +7 -10
  27. package/dist/cjs/helpers/colors.js +1 -1
  28. package/dist/cjs/helpers/queries/get-products.js +23 -0
  29. package/dist/cjs/helpers/typography.js +4 -4
  30. package/dist/cjs/hooks/articles/useArticlesQuery.js +152 -0
  31. package/dist/cjs/hooks/shop/use-products-query.js +29 -0
  32. package/dist/cjs/hooks/useAnimations.js +2 -0
  33. package/dist/cjs/hooks/useInitialSwatchesOptions.js +2 -0
  34. package/dist/cjs/hooks/useProduct.js +2 -0
  35. package/dist/cjs/index.js +11 -0
  36. package/dist/esm/components/ComponentToolbarPreview.js +54 -6
  37. package/dist/esm/components/ComponentWrapperPreview.js +44 -1
  38. package/dist/esm/components/Render.liquid.js +2 -0
  39. package/dist/esm/components/RenderCustomCode.js +2 -0
  40. package/dist/esm/components/ai-generator/AIContentGenerator.js +203 -0
  41. package/dist/esm/components/ai-generator/AIGenContentLoading.js +83 -0
  42. package/dist/esm/components/ai-generator/components/PickProduct.js +216 -0
  43. package/dist/esm/components/ai-generator/components/ToneAndVoice.js +75 -0
  44. package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +45 -0
  45. package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +108 -0
  46. package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +35 -0
  47. package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +61 -0
  48. package/dist/esm/components/ai-generator/icons/AIIcon.js +65 -0
  49. package/dist/esm/components/ai-generator/icons/CloseIcon.js +17 -0
  50. package/dist/esm/components/ai-generator/icons/DropdownIcon.js +34 -0
  51. package/dist/esm/components/ai-generator/icons/SearchIcon.js +19 -0
  52. package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +19 -0
  53. package/dist/esm/components/constant.js +19 -3
  54. package/dist/esm/components/resize/Spacing.js +2 -0
  55. package/dist/esm/components/theme-section/CreateThemeSection.js +2 -0
  56. package/dist/esm/contexts/ArticleContext.js +36 -0
  57. package/dist/esm/contexts/ArticleListContext.js +28 -0
  58. package/dist/esm/contexts/BuilderPreviewContext.js +11 -6
  59. package/dist/esm/contexts/SectionContext.js +1 -0
  60. package/dist/esm/helpers/align.js +17 -0
  61. package/dist/esm/helpers/carousel.js +7 -10
  62. package/dist/esm/helpers/colors.js +1 -1
  63. package/dist/esm/helpers/queries/get-products.js +23 -1
  64. package/dist/esm/helpers/typography.js +4 -4
  65. package/dist/esm/hooks/articles/useArticlesQuery.js +149 -0
  66. package/dist/esm/hooks/shop/use-products-query.js +30 -2
  67. package/dist/esm/hooks/useAnimations.js +2 -0
  68. package/dist/esm/hooks/useInitialSwatchesOptions.js +2 -0
  69. package/dist/esm/hooks/useProduct.js +2 -0
  70. package/dist/esm/index.js +4 -0
  71. package/dist/types/index.d.ts +161 -20
  72. package/package.json +5 -3
@@ -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;
@@ -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,12 @@ 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');
17
19
  require('../../helpers/convert.js');
18
20
 
19
21
  function Spacing(props) {
@@ -8,8 +8,10 @@ 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');
13
15
  require('../../helpers/convert.js');
14
16
 
15
17
  const SHOW_TOOLTIP_TIMEOUT = 600;
@@ -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,32 @@
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, blogs, children, styles, settings })=>{
12
+ return /*#__PURE__*/ jsxRuntime.jsx(ArticleListContext.Provider, {
13
+ value: createArticleListProvider({
14
+ articles,
15
+ styles,
16
+ settings,
17
+ blogs
18
+ }),
19
+ children: children
20
+ });
21
+ };
22
+ const useArticleListStore = (selector, equalityFn)=>{
23
+ const store = react.useContext(ArticleListContext);
24
+ if (!store) {
25
+ throw new Error('useArticleListStore must be used within a useArticleListStore');
26
+ }
27
+ return zustand.useStore(store, selector, equalityFn);
28
+ };
29
+
30
+ exports.ArticleListContext = ArticleListContext;
31
+ exports.ArticleListProvider = ArticleListProvider;
32
+ exports.useArticleListStore = useArticleListStore;
@@ -253,7 +253,11 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>zustand.creat
253
253
  }
254
254
  },
255
255
  getItem: (id)=>{
256
- return get().state[id];
256
+ const item = get().state[id];
257
+ return {
258
+ ...item,
259
+ rawChildrens: item?.childrens?.map((v)=>get().state[v])
260
+ };
257
261
  },
258
262
  removeItem: (id)=>{
259
263
  if (id === 'ROOT') {
@@ -428,15 +432,16 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>zustand.creat
428
432
  updateItemAttribute: (id, value, attr)=>{
429
433
  if (!attr || ![
430
434
  'label',
431
- 'customLabel'
435
+ 'customLabel',
436
+ 'isShopifyVisibility'
432
437
  ].includes(attr)) return;
433
438
  const state = get().state;
434
439
  const item = state[id];
435
- // Ignore section
436
- if (item?.type === 'section') return;
437
440
  if (item) {
438
- const dateModified = Date.now();
439
- item.dateModified = dateModified;
441
+ if (item.type !== 'section') {
442
+ const dateModified = Date.now();
443
+ item.dateModified = dateModified;
444
+ }
440
445
  const updatedItem = {
441
446
  ...item,
442
447
  [attr]: value
@@ -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
  },
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const convertTextAlignToJustify = (align)=>{
4
+ const devices = [
5
+ 'desktop',
6
+ 'tablet',
7
+ 'mobile'
8
+ ];
9
+ const result = {};
10
+ devices.forEach((device)=>{
11
+ const deviceType = device === 'desktop' ? '' : `${device}:`;
12
+ result[`${deviceType}gp-justify-start`] = align?.[device] === 'left';
13
+ result[`${deviceType}gp-justify-center`] = align?.[device] === 'center';
14
+ result[`${deviceType}gp-justify-end`] = align?.[device] === 'right';
15
+ });
16
+ return result;
17
+ };
18
+
19
+ exports.convertTextAlignToJustify = convertTextAlignToJustify;
@@ -2,24 +2,21 @@
2
2
 
3
3
  var getResonsiveValue = require('./get-resonsive-value.js');
4
4
 
5
- const getCarouselContainerHeight = (dotStyle, dotSize, dotGapToCarousel)=>{
6
- const getVal = (dotStyle, dotSize, dotGapToCarousel)=>{
7
- if (dotStyle === 'outside') {
8
- return `calc(100% - ${dotSize ?? '0'}px - ${!dotGapToCarousel || dotGapToCarousel === 'Auto' ? '0' : dotGapToCarousel}px)`;
9
- }
10
- return '100%';
5
+ const getCarouselContainerHeight = (dotStyle)=>{
6
+ const getVal = (dotStyle)=>{
7
+ return dotStyle === 'outside' ? 'auto' : '100%';
11
8
  };
12
9
  return {
13
- desktop: getVal(getResonsiveValue.getResponsiveValueByScreen(dotStyle, 'desktop'), getResonsiveValue.getResponsiveValueByScreen(dotSize, 'desktop'), getResonsiveValue.getResponsiveValueByScreen(dotGapToCarousel, 'desktop')),
14
- tablet: getVal(getResonsiveValue.getResponsiveValueByScreen(dotStyle, 'tablet'), getResonsiveValue.getResponsiveValueByScreen(dotSize, 'tablet'), getResonsiveValue.getResponsiveValueByScreen(dotGapToCarousel, 'tablet')),
15
- mobile: getVal(getResonsiveValue.getResponsiveValueByScreen(dotStyle, 'mobile'), getResonsiveValue.getResponsiveValueByScreen(dotSize, 'mobile'), getResonsiveValue.getResponsiveValueByScreen(dotGapToCarousel, 'mobile'))
10
+ desktop: getVal(getResonsiveValue.getResponsiveValueByScreen(dotStyle, 'desktop')),
11
+ tablet: getVal(getResonsiveValue.getResponsiveValueByScreen(dotStyle, 'tablet')),
12
+ mobile: getVal(getResonsiveValue.getResponsiveValueByScreen(dotStyle, 'mobile'))
16
13
  };
17
14
  };
18
15
  const makeContainerWidthOrHeight = (setting)=>{
19
16
  const getStyleName = (vertical)=>{
20
17
  return vertical ? 'w' : 'h';
21
18
  };
22
- const result = getCarouselContainerHeight(setting.dotStyle, setting.dotSize, setting.dotGapToCarousel);
19
+ const result = getCarouselContainerHeight(setting.dotStyle);
23
20
  return {
24
21
  [`--${getStyleName(getResonsiveValue.getResponsiveValueByScreen(setting?.vertical, 'desktop'))}`]: result.desktop,
25
22
  [`--${getStyleName(getResonsiveValue.getResponsiveValueByScreen(setting?.vertical, 'tablet'))}-tablet`]: result.tablet,
@@ -156,7 +156,7 @@ const getSingleColorVariable = (color)=>{
156
156
  };
157
157
  function isColor(color) {
158
158
  if (!color || typeof color !== 'string') return false;
159
- return color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent');
159
+ return color?.startsWith('#') || color?.startsWith('rgb') || color?.startsWith('hsl') || color?.startsWith('transparent') || color?.startsWith('linear-gradient');
160
160
  }
161
161
  const getGlobalColorStyle = (data)=>{
162
162
  if (!data) return {};
@@ -80,6 +80,28 @@ const getProductQueryAll = async (fetcher, arg)=>{
80
80
  const pageData = await fetchProducts(fetcher, variables);
81
81
  return pageData;
82
82
  };
83
+ const getListProductByVariables = async (fetcher, arg)=>{
84
+ const variables = {
85
+ first: arg.first || 8,
86
+ firstMedia: 1,
87
+ firstVariant: 1,
88
+ orderBy: {
89
+ field: 'PLATFORM_CREATED_AT',
90
+ direction: 'DESC'
91
+ },
92
+ orderByMedia: {
93
+ field: 'POSITION',
94
+ direction: 'ASC'
95
+ },
96
+ where: {
97
+ status: 'ACTIVE',
98
+ ...arg.where
99
+ },
100
+ after: arg.after
101
+ };
102
+ const pageData = await fetchProducts(fetcher, variables);
103
+ return pageData;
104
+ };
83
105
  const fetchProducts = async (fetcher, variables)=>{
84
106
  return fetcher([
85
107
  products_generated.ProductsDocument,
@@ -187,5 +209,6 @@ const mergeMediasToProducts = async ({ fetcher, products, isSample, isStorefront
187
209
  // );
188
210
  // };
189
211
 
212
+ exports.getListProductByVariables = getListProductByVariables;
190
213
  exports.getProductQueryAll = getProductQueryAll;
191
214
  exports.getProducts = getProducts;
@@ -29,7 +29,7 @@ const composeTypographyV2Css = (typography, isImportant)=>{
29
29
  ${fontSize?.desktop ? `font-size: ${fontSize?.desktop} ${composeImportant};` : ''}
30
30
  ${bold ? `font-weight: bold ${composeImportant};` : fontWeight ? `font-weight: ${fontWeight} ${composeImportant};` : ''}
31
31
  ${letterSpacing ? `letter-spacing: ${letterSpacing} ${composeImportant};` : ''}
32
- ${lineHeight ? `line-height: ${lineHeight} ${composeImportant};` : ''}
32
+ ${lineHeight?.desktop ? `line-height: ${lineHeight?.desktop} ${composeImportant};` : ''}
33
33
  ${italic ? `font-style: italic ${composeImportant};` : ''}
34
34
  ${underline ? `text-decoration-line: underline ${composeImportant};` : ''}
35
35
  ${transform ? `text-transform: ${transform} ${composeImportant};` : ''}
@@ -63,10 +63,10 @@ const composeTypographyV2 = (value, attrs)=>{
63
63
  fs: !attrs?.italic ? value?.fontStyle : undefined,
64
64
  ff: value?.fontFamily ? `var(--g-font-${value.fontFamily.replace(/ /g, '-')}, '${value.fontFamily}'), ${value.fallbackFontFamily}` : undefined,
65
65
  weight: !attrs?.bold ? value?.fontWeight : undefined,
66
- ls: value?.letterSpacing,
67
- lh: value?.lineHeight
66
+ ls: value?.letterSpacing
68
67
  }),
69
- ...makeStyle.makeStyleResponsive('size', value?.fontSize)
68
+ ...makeStyle.makeStyleResponsive('size', value?.fontSize),
69
+ ...makeStyle.makeStyleResponsive('lh', value?.lineHeight)
70
70
  });
71
71
  };
72
72
  const composeTypographyAttr = (attrs)=>{
@@ -0,0 +1,152 @@
1
+ 'use strict';
2
+
3
+ const mock = [
4
+ {
5
+ baseID: 'gid://shopify/OnlineStoreBlog/592066740457',
6
+ id: 592066740457,
7
+ title: 'Blog post might appear in a search engine listing',
8
+ created_at: '2024-05-09T04:06:12-04:00',
9
+ body_html: '<span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span>',
10
+ blog_id: 91970044137,
11
+ author: 'Dev Team',
12
+ user_id: 90371653865,
13
+ published_at: '2024-05-09T04:06:12-04:00',
14
+ updated_at: '2024-05-09T04:06:13-04:00',
15
+ summary_html: '',
16
+ template_suffix: '',
17
+ handle: 'blog-post-might-appear-in-a-search-engine-listing',
18
+ tags: 'vintage',
19
+ admin_graphql_api_id: 'gid://shopify/OnlineStoreArticle/592066740457',
20
+ image: {
21
+ created_at: '2024-05-09T04:06:12-04:00',
22
+ alt: '',
23
+ width: 1073,
24
+ height: 719,
25
+ src: 'https://cdn.shopify.com/s/files/1/0692/6562/1225/articles/Screenshot_2.jpg?v=1715241973'
26
+ }
27
+ },
28
+ {
29
+ baseID: 'gid://shopify/OnlineStoreBlog/592066707689',
30
+ id: 592066707689,
31
+ title: 'ar on your home page or blog.',
32
+ created_at: '2024-05-09T04:05:26-04:00',
33
+ body_html: '<span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span>',
34
+ blog_id: 91970044137,
35
+ author: 'Dev Team',
36
+ user_id: 90371653865,
37
+ published_at: '2024-05-09T04:05:25-04:00',
38
+ updated_at: '2024-05-09T05:35:29-04:00',
39
+ summary_html: '',
40
+ template_suffix: '',
41
+ handle: 'ar-on-your-home-page-or-blog',
42
+ tags: 'cotton, vintage',
43
+ admin_graphql_api_id: 'gid://shopify/OnlineStoreArticle/592066707689',
44
+ image: {
45
+ created_at: '2024-05-09T04:05:26-04:00',
46
+ alt: '',
47
+ width: 1080,
48
+ height: 719,
49
+ src: 'https://cdn.shopify.com/s/files/1/0692/6562/1225/articles/Screenshot_1.jpg?v=1715241926'
50
+ }
51
+ },
52
+ {
53
+ baseID: 'gid://shopify/OnlineStoreBlog/592066674921',
54
+ id: 592066674921,
55
+ title: 'Add a summary of the post.',
56
+ created_at: '2024-05-09T04:04:44-04:00',
57
+ body_html: '<span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span><span data-mce-fragment="1">Add a title and description to see how this Blog post might appear in a search engine listing</span>',
58
+ blog_id: 91970044137,
59
+ author: 'Dev Team',
60
+ user_id: 90371653865,
61
+ published_at: '2024-05-09T04:04:44-04:00',
62
+ updated_at: '2024-05-09T04:04:45-04:00',
63
+ summary_html: '',
64
+ template_suffix: '',
65
+ handle: 'add-a-summary-of-the-post',
66
+ tags: '',
67
+ admin_graphql_api_id: 'gid://shopify/OnlineStoreArticle/592066674921',
68
+ image: {
69
+ created_at: '2024-05-09T04:04:44-04:00',
70
+ alt: '',
71
+ width: 1086,
72
+ height: 718,
73
+ src: 'https://cdn.shopify.com/s/files/1/0692/6562/1225/articles/Screenshot_7.jpg?v=1715241885'
74
+ }
75
+ },
76
+ {
77
+ baseID: 'gid://shopify/OnlineStoreBlog/592058777833',
78
+ id: 592058777833,
79
+ title: 'Article Page - May 7, 10:47:14',
80
+ created_at: '2024-05-06T23:47:59-04:00',
81
+ body_html: '<h2>\n<span>Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span>\n</h2>',
82
+ blog_id: 91970044137,
83
+ author: 'GemPages',
84
+ user_id: null,
85
+ published_at: '2024-05-06T23:47:59-04:00',
86
+ updated_at: '2024-05-09T04:06:48-04:00',
87
+ summary_html: '',
88
+ template_suffix: 'gp-template-512584275137135821',
89
+ handle: 'article-page-may-7-10-47-14',
90
+ tags: 'vintage',
91
+ admin_graphql_api_id: 'gid://shopify/OnlineStoreArticle/592058777833',
92
+ image: {
93
+ created_at: '2024-05-09T04:06:41-04:00',
94
+ alt: '',
95
+ width: 578,
96
+ height: 585,
97
+ src: 'https://cdn.shopify.com/s/files/1/0692/6562/1225/articles/Screenshot_3.png?v=1715242002'
98
+ }
99
+ },
100
+ {
101
+ baseID: 'gid://shopify/OnlineStoreBlog/592058679529',
102
+ id: 592058679529,
103
+ title: 'Blog about your latest products or deals',
104
+ created_at: '2024-05-06T22:36:55-04:00',
105
+ body_html: '<span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span><span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span>',
106
+ blog_id: 91970044137,
107
+ author: 'Dev Team',
108
+ user_id: 90371653865,
109
+ published_at: '2024-05-06T22:36:54-04:00',
110
+ updated_at: '2024-05-09T03:46:39-04:00',
111
+ summary_html: '<span data-mce-fragment="1">Add a summary of the post to appear on your home page or blog.</span>',
112
+ template_suffix: 'gp-template-512584275137135821',
113
+ handle: 'blog-about-your-latest-products-or-deals',
114
+ tags: '',
115
+ admin_graphql_api_id: 'gid://shopify/OnlineStoreArticle/592058679529',
116
+ image: {
117
+ created_at: '2024-05-06T22:36:55-04:00',
118
+ alt: '',
119
+ width: 497,
120
+ height: 618,
121
+ src: 'https://cdn.shopify.com/s/files/1/0692/6562/1225/articles/Screenshot_3.jpg?v=1715049415'
122
+ }
123
+ }
124
+ ];
125
+ const useArticlesQuery = ()=>{
126
+ return mock;
127
+ };
128
+ const useBlogsQuery = ()=>{
129
+ return {
130
+ blogs: {
131
+ edges: [
132
+ {
133
+ node: {
134
+ id: '511006979737518962',
135
+ title: 'News',
136
+ baseID: 'gid://shopify/OnlineStoreBlog/91970044137',
137
+ tags: [],
138
+ handle: 'news',
139
+ descriptionMeta: '',
140
+ description: '',
141
+ titleMeta: '',
142
+ templateSuffix: '',
143
+ platform: 'SHOPIFY'
144
+ }
145
+ }
146
+ ]
147
+ }
148
+ };
149
+ };
150
+
151
+ exports.useArticlesQuery = useArticlesQuery;
152
+ exports.useBlogsQuery = useBlogsQuery;
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var useSWR = require('swr');
4
+ var useSWRInfinite = require('swr/infinite');
4
5
  var getProducts = require('../../helpers/queries/get-products.js');
5
6
  var query = require('../../helpers/query.js');
6
7
  var shop = require('../shop.js');
@@ -20,6 +21,33 @@ const useProductsQuery = (ids, options, params)=>{
20
21
  return getProducts.getProducts(params?.fetcher || fetcher, arg);
21
22
  }, options);
22
23
  };
24
+ const getKey = (variable)=>{
25
+ return (pageIndex, previousPageData)=>{
26
+ if (!variable || previousPageData && !previousPageData.products?.pageInfo?.hasNextPage) {
27
+ return null;
28
+ }
29
+ if (pageIndex === 0) {
30
+ return [
31
+ 'query/products',
32
+ variable
33
+ ];
34
+ }
35
+ return [
36
+ 'query/products',
37
+ {
38
+ ...variable,
39
+ after: previousPageData.products?.pageInfo?.endCursor
40
+ }
41
+ ];
42
+ };
43
+ };
44
+ const useListProductQuery = (variable, options)=>{
45
+ const fetcher = useFetchHandle.useFetchHandle();
46
+ const data = useSWRInfinite(getKey(variable), async ([, arg])=>{
47
+ return getProducts.getListProductByVariables(fetcher, arg);
48
+ }, options);
49
+ return data;
50
+ };
23
51
  const useProductsQueryAll = (variable, options)=>{
24
52
  const fetcher = useFetchHandle.useFetchHandle();
25
53
  return useSWR(variable ? [
@@ -30,5 +58,6 @@ const useProductsQueryAll = (variable, options)=>{
30
58
  }, options);
31
59
  };
32
60
 
61
+ exports.useListProductQuery = useListProductQuery;
33
62
  exports.useProductsQuery = useProductsQuery;
34
63
  exports.useProductsQueryAll = useProductsQueryAll;
@@ -7,10 +7,12 @@ require('zustand');
7
7
  require('swr');
8
8
  require('@gem-sdk/adapter-shopify');
9
9
  require('swr/mutation');
10
+ require('swr/infinite');
10
11
  require('vanilla-lazyload');
11
12
  require('./useCartUI.js');
12
13
  require('react-transition-group');
13
14
  require('@gem-sdk/core');
15
+ require('classnames');
14
16
  require('../helpers/convert.js');
15
17
 
16
18
  const useAnimations = ()=>{
@@ -13,10 +13,12 @@ require('react/jsx-runtime');
13
13
  require('zustand');
14
14
  require('@gem-sdk/adapter-shopify');
15
15
  require('swr/mutation');
16
+ require('swr/infinite');
16
17
  require('vanilla-lazyload');
17
18
  require('./useCartUI.js');
18
19
  require('react-transition-group');
19
20
  require('@gem-sdk/core');
21
+ require('classnames');
20
22
  var isBrowser = require('../helpers/is-browser.js');
21
23
  require('../helpers/convert.js');
22
24
 
@@ -8,11 +8,13 @@ require('swr');
8
8
  var PageContext = require('../contexts/PageContext.js');
9
9
  require('@gem-sdk/adapter-shopify');
10
10
  require('swr/mutation');
11
+ require('swr/infinite');
11
12
  require('vanilla-lazyload');
12
13
  require('./useCartUI.js');
13
14
  var variant = require('../helpers/variant.js');
14
15
  require('react-transition-group');
15
16
  require('@gem-sdk/core');
17
+ require('classnames');
16
18
  var flattenConnection = require('../helpers/flatten-connection.js');
17
19
  require('../helpers/convert.js');
18
20
  var product = require('../helpers/product.js');