@gem-sdk/core 1.9.25 → 1.9.36

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.
@@ -4,8 +4,9 @@ var useSWR = require('swr');
4
4
  var getCollection = require('./queries/get-collection.js');
5
5
  var getProduct = require('./queries/get-product.js');
6
6
  var getProducts = require('./queries/get-products.js');
7
+ var query = require('./query.js');
7
8
 
8
- const prefetchQueries = (input, isSample)=>{
9
+ const prefetchQueries = (input, options)=>{
9
10
  const queries = [];
10
11
  Object.keys(input).forEach((key)=>{
11
12
  const item = input[key];
@@ -16,13 +17,11 @@ const prefetchQueries = (input, isSample)=>{
16
17
  if (item.settings?.isAuto) break;
17
18
  const variables = {
18
19
  id: item.settings?.productSetting?.productId ?? 'latest',
19
- isSample
20
+ isSample: options?.isSample,
21
+ isStorefront: options?.isStorefront
20
22
  };
21
23
  data = {
22
- key: useSWR.unstable_serialize([
23
- 'query/product',
24
- variables
25
- ]),
24
+ key: useSWR.unstable_serialize(query.generateProductQueryKey(variables)),
26
25
  func: getProduct.getProduct,
27
26
  variables
28
27
  };
@@ -35,13 +34,11 @@ const prefetchQueries = (input, isSample)=>{
35
34
  id: item.settings?.collectionId ?? 'latest',
36
35
  numberOfProducts: item.settings?.numberOfProducts ?? 4,
37
36
  orderBy: item.settings?.orderBy,
38
- isSample
37
+ isSample: options?.isSample,
38
+ isStorefront: options?.isStorefront
39
39
  };
40
40
  data = {
41
- key: useSWR.unstable_serialize([
42
- 'query/collection',
43
- variables
44
- ]),
41
+ key: useSWR.unstable_serialize(query.generateCollectionQueryKey(variables)),
45
42
  func: getCollection.getCollection,
46
43
  variables
47
44
  };
@@ -50,13 +47,11 @@ const prefetchQueries = (input, isSample)=>{
50
47
  ids: [
51
48
  ...item?.settings?.productIds ?? []
52
49
  ].sort(),
53
- isSample
50
+ isSample: options?.isSample,
51
+ isStorefront: options?.isStorefront
54
52
  };
55
53
  data = {
56
- key: useSWR.unstable_serialize([
57
- 'query/products',
58
- variables
59
- ]),
54
+ key: useSWR.unstable_serialize(query.generateProductsQueryKey(variables)),
60
55
  func: getProducts.getProducts,
61
56
  variables
62
57
  };
@@ -4,6 +4,7 @@ var collectionDetailFilter_generated = require('../../graphql/queries/collection
4
4
  var productVariants_generated = require('../../graphql/queries/product-variants.generated.js');
5
5
  var isDefined = require('../is-defined.js');
6
6
 
7
+ const PRODUCT_PER_PAGE = 8; // number of products per page
7
8
  function productSortedByOrder(key) {
8
9
  switch(key){
9
10
  case 'TITLE_ASC':
@@ -54,8 +55,16 @@ const calculateFirstProduct = (numberOfProducts, currentPage, productsPerPage)=>
54
55
  if (numberOfProducts < productsPerPage) return numberOfProducts;
55
56
  return remainingProducts > 0 ? productsPerPage : productsPerPage + remainingProducts;
56
57
  };
58
+ const chunkArray = (array, size)=>{
59
+ const chunked_arr = [];
60
+ let index = 0;
61
+ while(index < array.length){
62
+ chunked_arr.push(array.slice(index, size + index));
63
+ index += size;
64
+ }
65
+ return chunked_arr;
66
+ };
57
67
  const loopFetchCollection = async (fetcher, arg)=>{
58
- const productsPerPage = 8; // number of products per page
59
68
  let variables; // variables of collection query
60
69
  let productAfterFetcher; // product after of collection query
61
70
  let dataCollection; // data of collection query
@@ -63,7 +72,7 @@ const loopFetchCollection = async (fetcher, arg)=>{
63
72
  let firstCollection;
64
73
  let currentPage = 1;
65
74
  if (arg.numberOfProducts) {
66
- const pages = Math.ceil(arg.numberOfProducts / productsPerPage);
75
+ const pages = Math.ceil(arg.numberOfProducts / PRODUCT_PER_PAGE);
67
76
  while(currentPage <= pages && hasNextPage !== false){
68
77
  variables = {
69
78
  firstVariant: 1,
@@ -76,7 +85,7 @@ const loopFetchCollection = async (fetcher, arg)=>{
76
85
  field: 'POSITION',
77
86
  direction: 'ASC'
78
87
  },
79
- firstProduct: calculateFirstProduct(arg.numberOfProducts, currentPage, productsPerPage),
88
+ firstProduct: calculateFirstProduct(arg.numberOfProducts, currentPage, PRODUCT_PER_PAGE),
80
89
  ...!arg.id || arg.id.toLowerCase() === 'latest' ? {
81
90
  where: {
82
91
  hasCollectionProducts: true,
@@ -95,8 +104,11 @@ const loopFetchCollection = async (fetcher, arg)=>{
95
104
  },
96
105
  isSample: arg.isSample
97
106
  },
98
- productsAfter: productAfterFetcher
107
+ ...productAfterFetcher ? {
108
+ productsAfter: productAfterFetcher
109
+ } : undefined
99
110
  };
111
+ console.log(111, variables);
100
112
  const pageData = await fetchCollection(fetcher, variables);
101
113
  productAfterFetcher = pageData?.collections?.edges?.[0]?.node?.products?.pageInfo?.endCursor;
102
114
  if (currentPage === 1) {
@@ -161,36 +173,48 @@ const mergeProductCollectionVariant = async (fetcher, collection, isSample)=>{
161
173
  return newCollection;
162
174
  };
163
175
  const fetchVariantsByBaseIds = async (fetcher, { ids , isSample , isStorefront })=>{
164
- const initVariables = {
165
- firstVariant: 100,
166
- first: ids?.length || 1,
167
- orderBy: {
168
- field: 'TITLE',
169
- direction: 'ASC'
170
- },
171
- where: {
172
- status: 'ACTIVE',
173
- isSample,
174
- ...isStorefront && {
175
- isStorefront
176
- },
177
- ...ids?.length && {
178
- baseIDIn: ids.sort()
179
- }
180
- }
181
- };
176
+ const chunkedIds = chunkArray(ids ?? [], 8);
177
+ const defaultEdges = [];
182
178
  const query = async (variables)=>{
183
179
  try {
184
- const response = await fetcher([
180
+ return await fetcher([
185
181
  productVariants_generated.ProductVariantsDocument,
186
182
  variables
187
183
  ]);
188
- return response;
189
184
  } catch {
190
185
  return {};
191
186
  }
192
187
  };
193
- return query(initVariables);
188
+ const promises = chunkedIds.map((chunkedId)=>{
189
+ const variables = {
190
+ firstVariant: 100,
191
+ first: chunkedId.length,
192
+ orderBy: {
193
+ field: 'TITLE',
194
+ direction: 'ASC'
195
+ },
196
+ where: {
197
+ status: 'ACTIVE',
198
+ isSample,
199
+ ...isStorefront && {
200
+ isStorefront
201
+ },
202
+ ...chunkedId.length && {
203
+ baseIDIn: chunkedId.sort()
204
+ }
205
+ }
206
+ };
207
+ return query(variables);
208
+ });
209
+ const responses = await Promise.all(promises);
210
+ const edges = responses?.reduce((acc, response)=>{
211
+ return acc.concat(response?.variants?.edges ?? []);
212
+ }, defaultEdges);
213
+ return {
214
+ variants: {
215
+ edges
216
+ }
217
+ };
194
218
  };
195
219
 
196
220
  exports.calculateFirstProduct = calculateFirstProduct;
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+
3
+ const generateProductQueryKey = (args)=>{
4
+ return [
5
+ 'query/product',
6
+ args
7
+ ];
8
+ };
9
+ const generateCollectionQueryKey = (args)=>{
10
+ return [
11
+ 'query/collection',
12
+ args
13
+ ];
14
+ };
15
+ const generateProductsQueryKey = (args)=>{
16
+ return [
17
+ 'query/products',
18
+ {
19
+ ...args,
20
+ ids: [
21
+ ...args.ids
22
+ ].sort()
23
+ }
24
+ ];
25
+ };
26
+
27
+ exports.generateCollectionQueryKey = generateCollectionQueryKey;
28
+ exports.generateProductQueryKey = generateProductQueryKey;
29
+ exports.generateProductsQueryKey = generateProductsQueryKey;
@@ -4,17 +4,15 @@ var useSWR = require('swr');
4
4
  var getCollection = require('../../helpers/queries/get-collection.js');
5
5
  var shop = require('../shop.js');
6
6
  var useFetchHandle = require('../useFetchHandle.js');
7
+ var query = require('../../helpers/query.js');
7
8
 
8
9
  const useCollectionQuery = (args, options)=>{
9
10
  const fetcher = useFetchHandle.useFetchHandle();
10
11
  const isSample = shop.useIsSampleProduct();
11
- return useSWR([
12
- 'query/collection',
13
- {
14
- ...args,
15
- isSample
16
- }
17
- ], ([, arg])=>{
12
+ return useSWR(args ? query.generateCollectionQueryKey({
13
+ ...args,
14
+ isSample
15
+ }) : null, ([, arg])=>{
18
16
  return getCollection.getCollection(fetcher, arg);
19
17
  }, options);
20
18
  };
@@ -6,10 +6,10 @@ var useFetchHandle = require('../useFetchHandle.js');
6
6
 
7
7
  const useCollectionsQuery = (variable, options)=>{
8
8
  const fetcher = useFetchHandle.useFetchHandle();
9
- return useSWR([
9
+ return useSWR(variable ? [
10
10
  'query/collections',
11
11
  variable
12
- ], async ([, arg])=>{
12
+ ] : null, async ([, arg])=>{
13
13
  return getCollections.getCollections(fetcher, arg);
14
14
  }, options);
15
15
  };
@@ -4,19 +4,17 @@ var useSWR = require('swr');
4
4
  var getProduct = require('../../helpers/queries/get-product.js');
5
5
  var shop = require('../shop.js');
6
6
  var useFetchHandle = require('../useFetchHandle.js');
7
+ var query = require('../../helpers/query.js');
7
8
 
8
9
  const useProductQuery = (productId, options)=>{
9
10
  const fetcher = useFetchHandle.useFetchHandle();
10
11
  const isSample = shop.useIsSampleProduct();
11
12
  const isStorefront = shop.useIsStorefrontProduct();
12
- return useSWR(productId ? [
13
- 'query/product',
14
- {
15
- id: productId ?? 'latest',
16
- isSample,
17
- isStorefront
18
- }
19
- ] : null, async ([, arg])=>{
13
+ return useSWR(productId ? query.generateProductQueryKey({
14
+ id: productId,
15
+ isSample,
16
+ isStorefront
17
+ }) : null, async ([, arg])=>{
20
18
  return getProduct.getProduct(fetcher, arg);
21
19
  }, options);
22
20
  };
@@ -4,21 +4,17 @@ var useSWR = require('swr');
4
4
  var getProducts = require('../../helpers/queries/get-products.js');
5
5
  var shop = require('../shop.js');
6
6
  var useFetchHandle = require('../useFetchHandle.js');
7
+ var query = require('../../helpers/query.js');
7
8
 
8
9
  const useProductsQuery = (ids, options)=>{
9
10
  const fetcher = useFetchHandle.useFetchHandle();
10
11
  const isSample = shop.useIsSampleProduct();
11
12
  const isStorefront = shop.useIsStorefrontProduct();
12
- return useSWR([
13
- 'query/products',
14
- {
15
- ids: [
16
- ...ids ?? []
17
- ]?.sort(),
18
- isSample,
19
- isStorefront
20
- }
21
- ], async ([, arg])=>{
13
+ return useSWR(ids ? query.generateProductsQueryKey({
14
+ ids,
15
+ isSample,
16
+ isStorefront
17
+ }) : null, async ([, arg])=>{
22
18
  return getProducts.getProducts(fetcher, arg);
23
19
  }, options);
24
20
  };
@@ -64,7 +64,7 @@ const useMobileOnly = ()=>{
64
64
  };
65
65
  const useMatchMutate = ()=>{
66
66
  const { cache , mutate } = useSWR.useSWRConfig();
67
- return (matcher, ...args)=>{
67
+ return (matcher, opts)=>{
68
68
  if (!(cache instanceof Map)) {
69
69
  throw new Error('matchMutate requires the cache provider to be a Map instance');
70
70
  }
@@ -74,7 +74,10 @@ const useMatchMutate = ()=>{
74
74
  keys.push(key);
75
75
  }
76
76
  });
77
- const mutations = keys.map((key)=>mutate(key, ...args));
77
+ const mutations = keys.map((key)=>{
78
+ const cacheData = cache.get(key);
79
+ return mutate(key, cacheData?.data, opts);
80
+ });
78
81
  return Promise.all(mutations);
79
82
  };
80
83
  };
package/dist/cjs/index.js CHANGED
@@ -53,6 +53,7 @@ var convert = require('./helpers/convert.js');
53
53
  var size = require('./helpers/size.js');
54
54
  var shadow = require('./helpers/shadow.js');
55
55
  var background = require('./helpers/background.js');
56
+ var query = require('./helpers/query.js');
56
57
  var useAddToCart = require('./hooks/cart/use-add-to-cart.js');
57
58
  var useCartData = require('./hooks/cart/use-cart-data.js');
58
59
  var useCartDiscountCodesUpdate = require('./hooks/cart/use-cart-discount-codes-update.js');
@@ -203,6 +204,9 @@ exports.getStyleShadowState = shadow.getStyleShadowState;
203
204
  exports.parseValueWithUnit = shadow.parseValueWithUnit;
204
205
  exports.composeBackgroundCss = background.composeBackgroundCss;
205
206
  exports.getStyleBackgroundByDevice = background.getStyleBackgroundByDevice;
207
+ exports.generateCollectionQueryKey = query.generateCollectionQueryKey;
208
+ exports.generateProductQueryKey = query.generateProductQueryKey;
209
+ exports.generateProductsQueryKey = query.generateProductsQueryKey;
206
210
  exports.useAddToCart = useAddToCart.useAddToCart;
207
211
  exports.useCartData = useCartData.useCartData;
208
212
  exports.useCartDiscountCodesUpdate = useCartDiscountCodesUpdate.useCartDiscountCodesUpdate;
@@ -2,8 +2,9 @@ import { unstable_serialize } from 'swr';
2
2
  import { getCollection } from './queries/get-collection.js';
3
3
  import { getProduct } from './queries/get-product.js';
4
4
  import { getProducts } from './queries/get-products.js';
5
+ import { generateCollectionQueryKey, generateProductsQueryKey, generateProductQueryKey } from './query.js';
5
6
 
6
- const prefetchQueries = (input, isSample)=>{
7
+ const prefetchQueries = (input, options)=>{
7
8
  const queries = [];
8
9
  Object.keys(input).forEach((key)=>{
9
10
  const item = input[key];
@@ -14,13 +15,11 @@ const prefetchQueries = (input, isSample)=>{
14
15
  if (item.settings?.isAuto) break;
15
16
  const variables = {
16
17
  id: item.settings?.productSetting?.productId ?? 'latest',
17
- isSample
18
+ isSample: options?.isSample,
19
+ isStorefront: options?.isStorefront
18
20
  };
19
21
  data = {
20
- key: unstable_serialize([
21
- 'query/product',
22
- variables
23
- ]),
22
+ key: unstable_serialize(generateProductQueryKey(variables)),
24
23
  func: getProduct,
25
24
  variables
26
25
  };
@@ -33,13 +32,11 @@ const prefetchQueries = (input, isSample)=>{
33
32
  id: item.settings?.collectionId ?? 'latest',
34
33
  numberOfProducts: item.settings?.numberOfProducts ?? 4,
35
34
  orderBy: item.settings?.orderBy,
36
- isSample
35
+ isSample: options?.isSample,
36
+ isStorefront: options?.isStorefront
37
37
  };
38
38
  data = {
39
- key: unstable_serialize([
40
- 'query/collection',
41
- variables
42
- ]),
39
+ key: unstable_serialize(generateCollectionQueryKey(variables)),
43
40
  func: getCollection,
44
41
  variables
45
42
  };
@@ -48,13 +45,11 @@ const prefetchQueries = (input, isSample)=>{
48
45
  ids: [
49
46
  ...item?.settings?.productIds ?? []
50
47
  ].sort(),
51
- isSample
48
+ isSample: options?.isSample,
49
+ isStorefront: options?.isStorefront
52
50
  };
53
51
  data = {
54
- key: unstable_serialize([
55
- 'query/products',
56
- variables
57
- ]),
52
+ key: unstable_serialize(generateProductsQueryKey(variables)),
58
53
  func: getProducts,
59
54
  variables
60
55
  };
@@ -2,6 +2,7 @@ import { CollectionDetailFilterDocument } from '../../graphql/queries/collection
2
2
  import { ProductVariantsDocument } from '../../graphql/queries/product-variants.generated.js';
3
3
  import { isDefined } from '../is-defined.js';
4
4
 
5
+ const PRODUCT_PER_PAGE = 8; // number of products per page
5
6
  function productSortedByOrder(key) {
6
7
  switch(key){
7
8
  case 'TITLE_ASC':
@@ -52,8 +53,16 @@ const calculateFirstProduct = (numberOfProducts, currentPage, productsPerPage)=>
52
53
  if (numberOfProducts < productsPerPage) return numberOfProducts;
53
54
  return remainingProducts > 0 ? productsPerPage : productsPerPage + remainingProducts;
54
55
  };
56
+ const chunkArray = (array, size)=>{
57
+ const chunked_arr = [];
58
+ let index = 0;
59
+ while(index < array.length){
60
+ chunked_arr.push(array.slice(index, size + index));
61
+ index += size;
62
+ }
63
+ return chunked_arr;
64
+ };
55
65
  const loopFetchCollection = async (fetcher, arg)=>{
56
- const productsPerPage = 8; // number of products per page
57
66
  let variables; // variables of collection query
58
67
  let productAfterFetcher; // product after of collection query
59
68
  let dataCollection; // data of collection query
@@ -61,7 +70,7 @@ const loopFetchCollection = async (fetcher, arg)=>{
61
70
  let firstCollection;
62
71
  let currentPage = 1;
63
72
  if (arg.numberOfProducts) {
64
- const pages = Math.ceil(arg.numberOfProducts / productsPerPage);
73
+ const pages = Math.ceil(arg.numberOfProducts / PRODUCT_PER_PAGE);
65
74
  while(currentPage <= pages && hasNextPage !== false){
66
75
  variables = {
67
76
  firstVariant: 1,
@@ -74,7 +83,7 @@ const loopFetchCollection = async (fetcher, arg)=>{
74
83
  field: 'POSITION',
75
84
  direction: 'ASC'
76
85
  },
77
- firstProduct: calculateFirstProduct(arg.numberOfProducts, currentPage, productsPerPage),
86
+ firstProduct: calculateFirstProduct(arg.numberOfProducts, currentPage, PRODUCT_PER_PAGE),
78
87
  ...!arg.id || arg.id.toLowerCase() === 'latest' ? {
79
88
  where: {
80
89
  hasCollectionProducts: true,
@@ -93,8 +102,11 @@ const loopFetchCollection = async (fetcher, arg)=>{
93
102
  },
94
103
  isSample: arg.isSample
95
104
  },
96
- productsAfter: productAfterFetcher
105
+ ...productAfterFetcher ? {
106
+ productsAfter: productAfterFetcher
107
+ } : undefined
97
108
  };
109
+ console.log(111, variables);
98
110
  const pageData = await fetchCollection(fetcher, variables);
99
111
  productAfterFetcher = pageData?.collections?.edges?.[0]?.node?.products?.pageInfo?.endCursor;
100
112
  if (currentPage === 1) {
@@ -159,36 +171,48 @@ const mergeProductCollectionVariant = async (fetcher, collection, isSample)=>{
159
171
  return newCollection;
160
172
  };
161
173
  const fetchVariantsByBaseIds = async (fetcher, { ids , isSample , isStorefront })=>{
162
- const initVariables = {
163
- firstVariant: 100,
164
- first: ids?.length || 1,
165
- orderBy: {
166
- field: 'TITLE',
167
- direction: 'ASC'
168
- },
169
- where: {
170
- status: 'ACTIVE',
171
- isSample,
172
- ...isStorefront && {
173
- isStorefront
174
- },
175
- ...ids?.length && {
176
- baseIDIn: ids.sort()
177
- }
178
- }
179
- };
174
+ const chunkedIds = chunkArray(ids ?? [], 8);
175
+ const defaultEdges = [];
180
176
  const query = async (variables)=>{
181
177
  try {
182
- const response = await fetcher([
178
+ return await fetcher([
183
179
  ProductVariantsDocument,
184
180
  variables
185
181
  ]);
186
- return response;
187
182
  } catch {
188
183
  return {};
189
184
  }
190
185
  };
191
- return query(initVariables);
186
+ const promises = chunkedIds.map((chunkedId)=>{
187
+ const variables = {
188
+ firstVariant: 100,
189
+ first: chunkedId.length,
190
+ orderBy: {
191
+ field: 'TITLE',
192
+ direction: 'ASC'
193
+ },
194
+ where: {
195
+ status: 'ACTIVE',
196
+ isSample,
197
+ ...isStorefront && {
198
+ isStorefront
199
+ },
200
+ ...chunkedId.length && {
201
+ baseIDIn: chunkedId.sort()
202
+ }
203
+ }
204
+ };
205
+ return query(variables);
206
+ });
207
+ const responses = await Promise.all(promises);
208
+ const edges = responses?.reduce((acc, response)=>{
209
+ return acc.concat(response?.variants?.edges ?? []);
210
+ }, defaultEdges);
211
+ return {
212
+ variants: {
213
+ edges
214
+ }
215
+ };
192
216
  };
193
217
 
194
218
  export { calculateFirstProduct, getCollection };
@@ -0,0 +1,25 @@
1
+ const generateProductQueryKey = (args)=>{
2
+ return [
3
+ 'query/product',
4
+ args
5
+ ];
6
+ };
7
+ const generateCollectionQueryKey = (args)=>{
8
+ return [
9
+ 'query/collection',
10
+ args
11
+ ];
12
+ };
13
+ const generateProductsQueryKey = (args)=>{
14
+ return [
15
+ 'query/products',
16
+ {
17
+ ...args,
18
+ ids: [
19
+ ...args.ids
20
+ ].sort()
21
+ }
22
+ ];
23
+ };
24
+
25
+ export { generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey };
@@ -2,17 +2,15 @@ import useSWR from 'swr';
2
2
  import { getCollection } from '../../helpers/queries/get-collection.js';
3
3
  import { useIsSampleProduct } from '../shop.js';
4
4
  import { useFetchHandle } from '../useFetchHandle.js';
5
+ import { generateCollectionQueryKey } from '../../helpers/query.js';
5
6
 
6
7
  const useCollectionQuery = (args, options)=>{
7
8
  const fetcher = useFetchHandle();
8
9
  const isSample = useIsSampleProduct();
9
- return useSWR([
10
- 'query/collection',
11
- {
12
- ...args,
13
- isSample
14
- }
15
- ], ([, arg])=>{
10
+ return useSWR(args ? generateCollectionQueryKey({
11
+ ...args,
12
+ isSample
13
+ }) : null, ([, arg])=>{
16
14
  return getCollection(fetcher, arg);
17
15
  }, options);
18
16
  };
@@ -4,10 +4,10 @@ import { useFetchHandle } from '../useFetchHandle.js';
4
4
 
5
5
  const useCollectionsQuery = (variable, options)=>{
6
6
  const fetcher = useFetchHandle();
7
- return useSWR([
7
+ return useSWR(variable ? [
8
8
  'query/collections',
9
9
  variable
10
- ], async ([, arg])=>{
10
+ ] : null, async ([, arg])=>{
11
11
  return getCollections(fetcher, arg);
12
12
  }, options);
13
13
  };
@@ -2,19 +2,17 @@ import useSWR from 'swr';
2
2
  import { getProduct } from '../../helpers/queries/get-product.js';
3
3
  import { useIsSampleProduct, useIsStorefrontProduct } from '../shop.js';
4
4
  import { useFetchHandle } from '../useFetchHandle.js';
5
+ import { generateProductQueryKey } from '../../helpers/query.js';
5
6
 
6
7
  const useProductQuery = (productId, options)=>{
7
8
  const fetcher = useFetchHandle();
8
9
  const isSample = useIsSampleProduct();
9
10
  const isStorefront = useIsStorefrontProduct();
10
- return useSWR(productId ? [
11
- 'query/product',
12
- {
13
- id: productId ?? 'latest',
14
- isSample,
15
- isStorefront
16
- }
17
- ] : null, async ([, arg])=>{
11
+ return useSWR(productId ? generateProductQueryKey({
12
+ id: productId,
13
+ isSample,
14
+ isStorefront
15
+ }) : null, async ([, arg])=>{
18
16
  return getProduct(fetcher, arg);
19
17
  }, options);
20
18
  };
@@ -2,21 +2,17 @@ import useSWR from 'swr';
2
2
  import { getProducts } from '../../helpers/queries/get-products.js';
3
3
  import { useIsSampleProduct, useIsStorefrontProduct } from '../shop.js';
4
4
  import { useFetchHandle } from '../useFetchHandle.js';
5
+ import { generateProductsQueryKey } from '../../helpers/query.js';
5
6
 
6
7
  const useProductsQuery = (ids, options)=>{
7
8
  const fetcher = useFetchHandle();
8
9
  const isSample = useIsSampleProduct();
9
10
  const isStorefront = useIsStorefrontProduct();
10
- return useSWR([
11
- 'query/products',
12
- {
13
- ids: [
14
- ...ids ?? []
15
- ]?.sort(),
16
- isSample,
17
- isStorefront
18
- }
19
- ], async ([, arg])=>{
11
+ return useSWR(ids ? generateProductsQueryKey({
12
+ ids,
13
+ isSample,
14
+ isStorefront
15
+ }) : null, async ([, arg])=>{
20
16
  return getProducts(fetcher, arg);
21
17
  }, options);
22
18
  };
@@ -62,7 +62,7 @@ const useMobileOnly = ()=>{
62
62
  };
63
63
  const useMatchMutate = ()=>{
64
64
  const { cache , mutate } = useSWRConfig();
65
- return (matcher, ...args)=>{
65
+ return (matcher, opts)=>{
66
66
  if (!(cache instanceof Map)) {
67
67
  throw new Error('matchMutate requires the cache provider to be a Map instance');
68
68
  }
@@ -72,7 +72,10 @@ const useMatchMutate = ()=>{
72
72
  keys.push(key);
73
73
  }
74
74
  });
75
- const mutations = keys.map((key)=>mutate(key, ...args));
75
+ const mutations = keys.map((key)=>{
76
+ const cacheData = cache.get(key);
77
+ return mutate(key, cacheData?.data, opts);
78
+ });
76
79
  return Promise.all(mutations);
77
80
  };
78
81
  };
package/dist/esm/index.js CHANGED
@@ -54,6 +54,7 @@ export { isLocalEnv } from './helpers/convert.js';
54
54
  export { composeSize, composeSizeCss, genSizeClass } from './helpers/size.js';
55
55
  export { composeShadowCss, getStyleShadow, getStyleShadowState, parseValueWithUnit } from './helpers/shadow.js';
56
56
  export { composeBackgroundCss, getStyleBackgroundByDevice } from './helpers/background.js';
57
+ export { generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey } from './helpers/query.js';
57
58
  export { useAddToCart } from './hooks/cart/use-add-to-cart.js';
58
59
  export { useCartData } from './hooks/cart/use-cart-data.js';
59
60
  export { useCartDiscountCodesUpdate } from './hooks/cart/use-cart-discount-codes-update.js';
@@ -1,6 +1,6 @@
1
1
  import { StoreApi } from 'zustand';
2
2
  import { Cart as Cart$1, addToCartOperation, getCartOperation, cartDiscountCodesUpdateOperation, cartNoteUpdateOperation, createCartOperation, removeCartItemOperation, updateCartLineOperation } from '@gem-sdk/adapter-shopify';
3
- import { SWRConfig, SWRConfiguration } from 'swr';
3
+ import { SWRConfig, SWRConfiguration, MutatorOptions } from 'swr';
4
4
  import { ShortHandProperty } from '@gem-sdk/styles';
5
5
  import * as swr_mutation from 'swr/mutation';
6
6
  import { SWRMutationConfiguration } from 'swr/mutation';
@@ -86,6 +86,7 @@ type RenderMode = 'edit' | 'preview';
86
86
 
87
87
  type InitComponentType<T = any> = {
88
88
  [K in keyof T]-?: {
89
+ main?: boolean;
89
90
  tag: K;
90
91
  label?: string;
91
92
  settings?: T[K] extends BaseProps ? T[K]['setting'] : unknown;
@@ -865,6 +866,7 @@ type ComponentSetting<P extends BaseProps> = {
865
866
  };
866
867
  };
867
868
  ui?: ControlUI[];
869
+ presets?: ComponentPreset[];
868
870
  };
869
871
  type ControlUI = {
870
872
  type: 'group' | 'tab' | 'advanced' | 'control';
@@ -886,6 +888,18 @@ type ControlUI = {
886
888
  };
887
889
  };
888
890
  };
891
+ type ComponentPreset = {
892
+ id: string;
893
+ name: {
894
+ en: string;
895
+ };
896
+ icon: {
897
+ desktop: string;
898
+ tablet?: string;
899
+ mobile?: string;
900
+ };
901
+ components: InitComponentType[];
902
+ };
889
903
 
890
904
  type Maybe<T> = T | undefined;
891
905
  type InputMaybe<T> = T | undefined;
@@ -7352,7 +7366,10 @@ type Result = {
7352
7366
  variables?: any;
7353
7367
  func?: (fetcher: FetchFunc, args?: any) => Promise<any>;
7354
7368
  };
7355
- declare const prefetchQueries: (input: BuilderState, isSample?: boolean) => Result[];
7369
+ declare const prefetchQueries: (input: BuilderState, options?: {
7370
+ isSample?: boolean;
7371
+ isStorefront?: boolean;
7372
+ }) => Result[];
7356
7373
 
7357
7374
  declare function getSpacingVariable(key?: SpacingType): string;
7358
7375
  declare const composeSpacing: (spacingValue?: ObjectDevices<SpacingType>) => React.CSSProperties;
@@ -7488,10 +7505,30 @@ type Options = {
7488
7505
  declare const getStyleBackgroundByDevice: (background?: ObjectDevices<Background>, options?: Options) => {};
7489
7506
  declare const composeBackgroundCss: (backgroundColor?: ColorValueType) => string;
7490
7507
 
7508
+ type ProductQueryKeyInput = {
7509
+ id?: string;
7510
+ isSample?: boolean;
7511
+ isStorefront?: boolean;
7512
+ };
7513
+ declare const generateProductQueryKey: (args: ProductQueryKeyInput) => ['query/product', ProductQueryKeyInput];
7514
+ type CollectionArgs = {
7515
+ id?: string;
7516
+ numberOfProducts?: number;
7517
+ orderBy?: 'TITLE_ASC' | 'TITLE_DESC' | 'CREATED_AT_ASC' | 'none' | 'CREATED_AT_DESC';
7518
+ isSample?: boolean;
7519
+ };
7520
+ declare const generateCollectionQueryKey: (args: CollectionArgs) => ['query/collection', CollectionArgs];
7521
+ type ProductsQueryKeyInput = {
7522
+ ids: string[];
7523
+ isSample?: boolean;
7524
+ isStorefront?: boolean;
7525
+ };
7526
+ declare const generateProductsQueryKey: (args: ProductsQueryKeyInput) => ['query/products', ProductsQueryKeyInput];
7527
+
7491
7528
  type Func$6 = ReturnType<typeof addToCartOperation>;
7492
7529
  type Response$6 = Awaited<ReturnType<Func$6>>;
7493
- type Args$7 = Parameters<Func$6>[0];
7494
- declare const useAddToCart: (options?: SWRMutationConfiguration<Response$6, any, Args$7, 'add-to-cart'>) => swr_mutation.SWRMutationResponse<_gem_sdk_adapter_common_dist_types_types_cart.Cart, any, _gem_sdk_adapter_common_dist_types_types_cart.AddCartLineInput, "add-to-cart">;
7530
+ type Args$6 = Parameters<Func$6>[0];
7531
+ declare const useAddToCart: (options?: SWRMutationConfiguration<Response$6, any, Args$6, 'add-to-cart'>) => swr_mutation.SWRMutationResponse<_gem_sdk_adapter_common_dist_types_types_cart.Cart, any, _gem_sdk_adapter_common_dist_types_types_cart.AddCartLineInput, "add-to-cart">;
7495
7532
 
7496
7533
  type Func$5 = ReturnType<typeof getCartOperation>;
7497
7534
  type Response$5 = Awaited<ReturnType<Func$5>>;
@@ -7499,28 +7536,28 @@ declare const useCartData: (options?: SWRConfiguration<Response$5 | undefined, a
7499
7536
 
7500
7537
  type Func$4 = ReturnType<typeof cartDiscountCodesUpdateOperation>;
7501
7538
  type Response$4 = Awaited<ReturnType<Func$4>>;
7502
- type Args$6 = Parameters<Func$4>[0];
7503
- declare const useCartDiscountCodesUpdate: (options?: SWRMutationConfiguration<Response$4, any, Args$6, 'cart-discount-codes-update'>) => swr_mutation.SWRMutationResponse<_gem_sdk_adapter_common_dist_types_types_cart.Cart, any, _gem_sdk_adapter_common_dist_types_types_cart.CartDiscountCodesUpdateInput, "cart-discount-codes-update">;
7539
+ type Args$5 = Parameters<Func$4>[0];
7540
+ declare const useCartDiscountCodesUpdate: (options?: SWRMutationConfiguration<Response$4, any, Args$5, 'cart-discount-codes-update'>) => swr_mutation.SWRMutationResponse<_gem_sdk_adapter_common_dist_types_types_cart.Cart, any, _gem_sdk_adapter_common_dist_types_types_cart.CartDiscountCodesUpdateInput, "cart-discount-codes-update">;
7504
7541
 
7505
7542
  type Func$3 = ReturnType<typeof cartNoteUpdateOperation>;
7506
7543
  type Response$3 = Awaited<ReturnType<Func$3>>;
7507
- type Args$5 = Parameters<Func$3>[0];
7508
- declare const useCartNoteUpdate: (options?: SWRMutationConfiguration<Response$3, any, Args$5, 'cart-note-update'>) => swr_mutation.SWRMutationResponse<_gem_sdk_adapter_common_dist_types_types_cart.Cart, any, _gem_sdk_adapter_common_dist_types_types_cart.CartNoteUpdateInput, "cart-note-update">;
7544
+ type Args$4 = Parameters<Func$3>[0];
7545
+ declare const useCartNoteUpdate: (options?: SWRMutationConfiguration<Response$3, any, Args$4, 'cart-note-update'>) => swr_mutation.SWRMutationResponse<_gem_sdk_adapter_common_dist_types_types_cart.Cart, any, _gem_sdk_adapter_common_dist_types_types_cart.CartNoteUpdateInput, "cart-note-update">;
7509
7546
 
7510
7547
  type Func$2 = ReturnType<typeof createCartOperation>;
7511
7548
  type Response$2 = Awaited<ReturnType<Func$2>>;
7512
- type Args$4 = Parameters<Func$2>[0];
7513
- declare const useCreateCart: (options?: SWRMutationConfiguration<Response$2, any, Args$4, 'create-cart'>) => swr_mutation.SWRMutationResponse<_gem_sdk_adapter_common_dist_types_types_cart.Cart, any, _gem_sdk_adapter_common_dist_types_types_cart.CreateCartInput, "create-cart">;
7549
+ type Args$3 = Parameters<Func$2>[0];
7550
+ declare const useCreateCart: (options?: SWRMutationConfiguration<Response$2, any, Args$3, 'create-cart'>) => swr_mutation.SWRMutationResponse<_gem_sdk_adapter_common_dist_types_types_cart.Cart, any, _gem_sdk_adapter_common_dist_types_types_cart.CreateCartInput, "create-cart">;
7514
7551
 
7515
7552
  type Func$1 = ReturnType<typeof removeCartItemOperation>;
7516
7553
  type Response$1 = Awaited<ReturnType<Func$1>>;
7517
- type Args$3 = Parameters<Func$1>[0];
7518
- declare const useRemoveCartItem: (options?: SWRMutationConfiguration<Response$1, any, Args$3, 'remove-cart-item'>) => swr_mutation.SWRMutationResponse<_gem_sdk_adapter_common_dist_types_types_cart.Cart, any, _gem_sdk_adapter_common_dist_types_types_cart.RemoveCartLineInput, "remove-cart-item">;
7554
+ type Args$2 = Parameters<Func$1>[0];
7555
+ declare const useRemoveCartItem: (options?: SWRMutationConfiguration<Response$1, any, Args$2, 'remove-cart-item'>) => swr_mutation.SWRMutationResponse<_gem_sdk_adapter_common_dist_types_types_cart.Cart, any, _gem_sdk_adapter_common_dist_types_types_cart.RemoveCartLineInput, "remove-cart-item">;
7519
7556
 
7520
7557
  type Func = ReturnType<typeof updateCartLineOperation>;
7521
7558
  type Response = Awaited<ReturnType<Func>>;
7522
- type Args$2 = Parameters<Func>[0];
7523
- declare const useUpdateCartItem: (options?: SWRMutationConfiguration<Response, any, Args$2, 'update-cart-item'>) => swr_mutation.SWRMutationResponse<_gem_sdk_adapter_common_dist_types_types_cart.Cart, any, _gem_sdk_adapter_common_dist_types_types_cart.UpdateCartLineInput, "update-cart-item">;
7559
+ type Args$1 = Parameters<Func>[0];
7560
+ declare const useUpdateCartItem: (options?: SWRMutationConfiguration<Response, any, Args$1, 'update-cart-item'>) => swr_mutation.SWRMutationResponse<_gem_sdk_adapter_common_dist_types_types_cart.Cart, any, _gem_sdk_adapter_common_dist_types_types_cart.UpdateCartLineInput, "update-cart-item">;
7524
7561
 
7525
7562
  declare const useLocale: () => {
7526
7563
  locale: string | undefined;
@@ -7543,19 +7580,13 @@ declare const useStoreFront: () => {
7543
7580
  declare const usePluginEnable: () => string[] | undefined;
7544
7581
  declare const useEditorMode: () => RenderMode | undefined;
7545
7582
  declare const useMobileOnly: () => boolean | undefined;
7546
- declare const useMatchMutate: () => (matcher: RegExp, ...args: any[]) => Promise<any[][]>;
7583
+ declare const useMatchMutate: () => <T = any>(matcher: RegExp, opts?: boolean | MutatorOptions<T> | undefined) => Promise<(T | undefined)[][]>;
7547
7584
  declare function useConnectedShopify(): boolean;
7548
7585
  declare function useIsSampleProduct(): boolean | undefined;
7549
7586
  declare function useIsStorefrontProduct(): boolean | undefined;
7550
7587
  declare function useCheckoutUrl(url?: string): string | undefined;
7551
7588
 
7552
- type Args$1 = {
7553
- id?: string;
7554
- numberOfProducts?: number;
7555
- orderBy?: 'TITLE_ASC' | 'TITLE_DESC' | 'CREATED_AT_ASC' | undefined | 'none' | 'CREATED_AT_DESC';
7556
- isSample?: boolean;
7557
- };
7558
- declare const useCollectionQuery: (args: Args$1, options?: SWRConfiguration<CollectionDetailFilterQueryResponse>) => swr__internal.SWRResponse<CollectionDetailFilterQueryResponse, any, Partial<swr__internal.PublicConfiguration<CollectionDetailFilterQueryResponse, any, (arg: ["query/collection", Args$1]) => swr__internal.FetcherResponse<CollectionDetailFilterQueryResponse>>> | undefined>;
7589
+ declare const useCollectionQuery: (args?: CollectionArgs, options?: SWRConfiguration<CollectionDetailFilterQueryResponse>) => swr__internal.SWRResponse<CollectionDetailFilterQueryResponse, any, Partial<swr__internal.PublicConfiguration<CollectionDetailFilterQueryResponse, any, (arg: ["query/collection", CollectionArgs]) => swr__internal.FetcherResponse<CollectionDetailFilterQueryResponse>>> | undefined>;
7559
7590
 
7560
7591
  declare const useCollectionsQuery: (variable: CollectionsQueryVariables, options?: SWRConfiguration<CollectionsQueryResponse>) => swr__internal.SWRResponse<CollectionsQueryResponse, any, Partial<swr__internal.PublicConfiguration<CollectionsQueryResponse, any, (arg: ["query/collections", Exact<{
7561
7592
  after?: InputMaybe<string>;
@@ -7566,17 +7597,9 @@ declare const useCollectionsQuery: (variable: CollectionsQueryVariables, options
7566
7597
  orderBy?: InputMaybe<CollectionOrder>;
7567
7598
  }>]) => swr__internal.FetcherResponse<CollectionsQueryResponse>>> | undefined>;
7568
7599
 
7569
- declare const useProductQuery: (productId?: string, options?: SWRConfiguration<ProductSelectFragment>) => swr__internal.SWRResponse<ProductSelectFragment, any, Partial<swr__internal.PublicConfiguration<ProductSelectFragment, any, (arg: ["query/product", {
7570
- id?: string | undefined;
7571
- isSample?: boolean | undefined;
7572
- isStorefront?: boolean | undefined;
7573
- }]) => swr__internal.FetcherResponse<ProductSelectFragment>>> | undefined>;
7600
+ declare const useProductQuery: (productId?: string, options?: SWRConfiguration<ProductSelectFragment>) => swr__internal.SWRResponse<ProductSelectFragment, any, Partial<swr__internal.PublicConfiguration<ProductSelectFragment, any, (arg: ["query/product", ProductQueryKeyInput]) => swr__internal.FetcherResponse<ProductSelectFragment>>> | undefined>;
7574
7601
 
7575
- declare const useProductsQuery: (ids?: string[], options?: SWRConfiguration<ProductsQueryResponse>) => swr__internal.SWRResponse<ProductsQueryResponse, any, Partial<swr__internal.PublicConfiguration<ProductsQueryResponse, any, (arg: ["query/products", {
7576
- ids?: string[] | undefined;
7577
- isSample?: boolean | undefined;
7578
- isStorefront?: boolean | undefined;
7579
- }]) => swr__internal.FetcherResponse<ProductsQueryResponse>>> | undefined>;
7602
+ declare const useProductsQuery: (ids?: string[], options?: SWRConfiguration<ProductsQueryResponse>) => swr__internal.SWRResponse<ProductsQueryResponse, any, Partial<swr__internal.PublicConfiguration<ProductsQueryResponse, any, (arg: ["query/products", ProductsQueryKeyInput]) => swr__internal.FetcherResponse<ProductsQueryResponse>>> | undefined>;
7580
7603
 
7581
7604
  declare const useCurrentDevice: () => NameDevices;
7582
7605
 
@@ -7723,4 +7746,4 @@ declare const fetchMedias: (fetcher: FetchFunc, { id, isSample, isStorefront }:
7723
7746
 
7724
7747
  declare const getProductBySlug: (fetcher: FetchFunc, slug?: string) => Promise<ProductSelectFragment>;
7725
7748
 
7726
- export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, BoldSubscriptionsWidgetType, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionSelectFragment, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentSetting, ContainerProp, ControlProp, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, ExtractState, FetchFunc, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, InitComponentType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OptionNormalStyle, OptionSpecialStyle, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PickyStoryWidgetType, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, RenderMemo as Render, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeType, SpacingType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TypographyProps, TypographySetting, TypographyType, VariantSelectFragment, calculateFirstProduct, cls, composeAdvanceStyle, composeBackgroundCss, composeBorderCss, composeCornerCss, composeGridLayout, composeRadius, composeShadowCss, composeSize, composeSizeCss, composeSpacing, composeTextColorCss, composeTypographyCss, convertOldLayout, fetchMedias, fetchVariants, flattenConnection, fpixel, genSizeClass, genTypoClass, genVariable, getBorderStyle, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, isBrowser, isColor, isDefined, isEmptyChildren, isLocalEnv, loadScript, makeAspectRatio, makeHeight, makeLineClamp, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, parseValueWithUnit, prefetchQueries, props, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useIsSampleProduct, useIsStorefrontProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
7749
+ export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, BoldSubscriptionsWidgetType, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionArgs, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionSelectFragment, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentPreset, ComponentSetting, ContainerProp, ControlProp, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, ExtractState, FetchFunc, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, InitComponentType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OptionNormalStyle, OptionSpecialStyle, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PickyStoryWidgetType, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductQueryKeyInput, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryKeyInput, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, RenderMemo as Render, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeType, SpacingType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TypographyProps, TypographySetting, TypographyType, VariantSelectFragment, calculateFirstProduct, cls, composeAdvanceStyle, composeBackgroundCss, composeBorderCss, composeCornerCss, composeGridLayout, composeRadius, composeShadowCss, composeSize, composeSizeCss, composeSpacing, composeTextColorCss, composeTypographyCss, convertOldLayout, fetchMedias, fetchVariants, flattenConnection, fpixel, genSizeClass, genTypoClass, genVariable, generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey, getBorderStyle, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, isBrowser, isColor, isDefined, isEmptyChildren, isLocalEnv, loadScript, makeAspectRatio, makeHeight, makeLineClamp, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, parseValueWithUnit, prefetchQueries, props, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useIsSampleProduct, useIsStorefrontProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.9.25",
3
+ "version": "1.9.36",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -29,9 +29,9 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "react-error-boundary": "4.0.3",
32
- "swr": "2.1.1",
32
+ "swr": "2.1.2",
33
33
  "vanilla-lazyload": "17.8.3",
34
- "zustand": "4.3.6"
34
+ "zustand": "4.3.7"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "react": "^17 || ^18",