@gem-sdk/core 1.9.35 → 1.9.39

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
  };
@@ -108,7 +108,6 @@ const loopFetchCollection = async (fetcher, arg)=>{
108
108
  productsAfter: productAfterFetcher
109
109
  } : undefined
110
110
  };
111
- console.log(111, variables);
112
111
  const pageData = await fetchCollection(fetcher, variables);
113
112
  productAfterFetcher = pageData?.collections?.edges?.[0]?.node?.products?.pageInfo?.endCursor;
114
113
  if (currentPage === 1) {
@@ -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(args ? [
12
- 'query/collection',
13
- {
14
- ...args,
15
- isSample
16
- }
17
- ] : null, ([, 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
  };
@@ -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
  };
@@ -2,6 +2,7 @@
2
2
 
3
3
  var useSWR = require('swr');
4
4
  var getProducts = require('../../helpers/queries/get-products.js');
5
+ var query = require('../../helpers/query.js');
5
6
  var shop = require('../shop.js');
6
7
  var useFetchHandle = require('../useFetchHandle.js');
7
8
 
@@ -9,16 +10,11 @@ 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(ids ? [
13
- 'query/products',
14
- {
15
- ids: [
16
- ...ids
17
- ].sort(),
18
- isSample,
19
- isStorefront
20
- }
21
- ] : null, 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
  };
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
  };
@@ -106,7 +106,6 @@ const loopFetchCollection = async (fetcher, arg)=>{
106
106
  productsAfter: productAfterFetcher
107
107
  } : undefined
108
108
  };
109
- console.log(111, variables);
110
109
  const pageData = await fetchCollection(fetcher, variables);
111
110
  productAfterFetcher = pageData?.collections?.edges?.[0]?.node?.products?.pageInfo?.endCursor;
112
111
  if (currentPage === 1) {
@@ -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(args ? [
10
- 'query/collection',
11
- {
12
- ...args,
13
- isSample
14
- }
15
- ] : null, ([, arg])=>{
10
+ return useSWR(args ? generateCollectionQueryKey({
11
+ ...args,
12
+ isSample
13
+ }) : null, ([, arg])=>{
16
14
  return getCollection(fetcher, arg);
17
15
  }, options);
18
16
  };
@@ -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
  };
@@ -1,5 +1,6 @@
1
1
  import useSWR from 'swr';
2
2
  import { getProducts } from '../../helpers/queries/get-products.js';
3
+ import { generateProductsQueryKey } from '../../helpers/query.js';
3
4
  import { useIsSampleProduct, useIsStorefrontProduct } from '../shop.js';
4
5
  import { useFetchHandle } from '../useFetchHandle.js';
5
6
 
@@ -7,16 +8,11 @@ const useProductsQuery = (ids, options)=>{
7
8
  const fetcher = useFetchHandle();
8
9
  const isSample = useIsSampleProduct();
9
10
  const isStorefront = useIsStorefrontProduct();
10
- return useSWR(ids ? [
11
- 'query/products',
12
- {
13
- ids: [
14
- ...ids
15
- ].sort(),
16
- isSample,
17
- isStorefront
18
- }
19
- ] : null, 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
  };
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';
@@ -7366,7 +7366,10 @@ type Result = {
7366
7366
  variables?: any;
7367
7367
  func?: (fetcher: FetchFunc, args?: any) => Promise<any>;
7368
7368
  };
7369
- declare const prefetchQueries: (input: BuilderState, isSample?: boolean) => Result[];
7369
+ declare const prefetchQueries: (input: BuilderState, options?: {
7370
+ isSample?: boolean;
7371
+ isStorefront?: boolean;
7372
+ }) => Result[];
7370
7373
 
7371
7374
  declare function getSpacingVariable(key?: SpacingType): string;
7372
7375
  declare const composeSpacing: (spacingValue?: ObjectDevices<SpacingType>) => React.CSSProperties;
@@ -7502,10 +7505,46 @@ type Options = {
7502
7505
  declare const getStyleBackgroundByDevice: (background?: ObjectDevices<Background>, options?: Options) => {};
7503
7506
  declare const composeBackgroundCss: (backgroundColor?: ColorValueType) => string;
7504
7507
 
7508
+ type OrderByType = 'TITLE_ASC' | 'TITLE_DESC' | 'CREATED_AT_ASC' | undefined | 'none' | 'CREATED_AT_DESC';
7509
+ type FetchCollectionArgs = {
7510
+ id?: string;
7511
+ numberOfProducts?: number;
7512
+ orderBy?: OrderByType;
7513
+ isSample?: boolean;
7514
+ isStorefront?: boolean;
7515
+ };
7516
+ declare const getCollection: (fetcher: FetchFunc, arg: FetchCollectionArgs) => Promise<CollectionDetailFilterQueryResponse>;
7517
+ declare const calculateFirstProduct: (numberOfProducts: number, currentPage: number, productsPerPage: number) => number;
7518
+
7519
+ type FetchProductParams = {
7520
+ id?: string;
7521
+ isSample?: boolean;
7522
+ isStorefront?: boolean;
7523
+ };
7524
+ declare const getProduct: (fetcher: FetchFunc, { id, isSample, isStorefront }: FetchProductParams) => Promise<ProductSelectFragment>;
7525
+ type RequiredCursorEdge<T> = {
7526
+ cursor: string;
7527
+ node?: T;
7528
+ };
7529
+ declare const fetchVariants: (fetcher: FetchFunc, { id, isSample, isStorefront }: FetchProductParams) => Promise<RequiredCursorEdge<VariantSelectFragment>[]>;
7530
+ declare const fetchMedias: (fetcher: FetchFunc, { id, isSample, isStorefront }: FetchProductParams) => Promise<(Pick<MediaEdge, "cursor"> & {
7531
+ node?: Maybe<Pick<Media, "width" | "height" | "id" | "contentType" | "src" | "alt">>;
7532
+ })[]>;
7533
+
7534
+ type FetchProductsParams = {
7535
+ ids: string[];
7536
+ isSample?: boolean;
7537
+ isStorefront?: boolean;
7538
+ };
7539
+
7540
+ declare const generateProductQueryKey: (args: FetchProductParams) => ['query/product', FetchProductParams];
7541
+ declare const generateCollectionQueryKey: (args: FetchCollectionArgs) => ['query/collection', FetchCollectionArgs];
7542
+ declare const generateProductsQueryKey: (args: FetchProductsParams) => ['query/products', FetchProductsParams];
7543
+
7505
7544
  type Func$6 = ReturnType<typeof addToCartOperation>;
7506
7545
  type Response$6 = Awaited<ReturnType<Func$6>>;
7507
- type Args$7 = Parameters<Func$6>[0];
7508
- 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">;
7546
+ type Args$5 = Parameters<Func$6>[0];
7547
+ declare const useAddToCart: (options?: SWRMutationConfiguration<Response$6, any, Args$5, '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">;
7509
7548
 
7510
7549
  type Func$5 = ReturnType<typeof getCartOperation>;
7511
7550
  type Response$5 = Awaited<ReturnType<Func$5>>;
@@ -7513,28 +7552,28 @@ declare const useCartData: (options?: SWRConfiguration<Response$5 | undefined, a
7513
7552
 
7514
7553
  type Func$4 = ReturnType<typeof cartDiscountCodesUpdateOperation>;
7515
7554
  type Response$4 = Awaited<ReturnType<Func$4>>;
7516
- type Args$6 = Parameters<Func$4>[0];
7517
- 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">;
7555
+ type Args$4 = Parameters<Func$4>[0];
7556
+ declare const useCartDiscountCodesUpdate: (options?: SWRMutationConfiguration<Response$4, any, Args$4, '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">;
7518
7557
 
7519
7558
  type Func$3 = ReturnType<typeof cartNoteUpdateOperation>;
7520
7559
  type Response$3 = Awaited<ReturnType<Func$3>>;
7521
- type Args$5 = Parameters<Func$3>[0];
7522
- 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">;
7560
+ type Args$3 = Parameters<Func$3>[0];
7561
+ declare const useCartNoteUpdate: (options?: SWRMutationConfiguration<Response$3, any, Args$3, '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">;
7523
7562
 
7524
7563
  type Func$2 = ReturnType<typeof createCartOperation>;
7525
7564
  type Response$2 = Awaited<ReturnType<Func$2>>;
7526
- type Args$4 = Parameters<Func$2>[0];
7527
- 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">;
7565
+ type Args$2 = Parameters<Func$2>[0];
7566
+ declare const useCreateCart: (options?: SWRMutationConfiguration<Response$2, any, Args$2, '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">;
7528
7567
 
7529
7568
  type Func$1 = ReturnType<typeof removeCartItemOperation>;
7530
7569
  type Response$1 = Awaited<ReturnType<Func$1>>;
7531
- type Args$3 = Parameters<Func$1>[0];
7532
- 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">;
7570
+ type Args$1 = Parameters<Func$1>[0];
7571
+ declare const useRemoveCartItem: (options?: SWRMutationConfiguration<Response$1, any, Args$1, '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">;
7533
7572
 
7534
7573
  type Func = ReturnType<typeof updateCartLineOperation>;
7535
7574
  type Response = Awaited<ReturnType<Func>>;
7536
- type Args$2 = Parameters<Func>[0];
7537
- 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">;
7575
+ type Args = Parameters<Func>[0];
7576
+ declare const useUpdateCartItem: (options?: SWRMutationConfiguration<Response, any, Args, '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">;
7538
7577
 
7539
7578
  declare const useLocale: () => {
7540
7579
  locale: string | undefined;
@@ -7563,13 +7602,7 @@ declare function useIsSampleProduct(): boolean | undefined;
7563
7602
  declare function useIsStorefrontProduct(): boolean | undefined;
7564
7603
  declare function useCheckoutUrl(url?: string): string | undefined;
7565
7604
 
7566
- type Args$1 = {
7567
- id?: string;
7568
- numberOfProducts?: number;
7569
- orderBy?: 'TITLE_ASC' | 'TITLE_DESC' | 'CREATED_AT_ASC' | undefined | 'none' | 'CREATED_AT_DESC';
7570
- isSample?: boolean;
7571
- };
7572
- 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>;
7605
+ declare const useCollectionQuery: (args?: FetchCollectionArgs, options?: SWRConfiguration<CollectionDetailFilterQueryResponse>) => swr__internal.SWRResponse<CollectionDetailFilterQueryResponse, any, Partial<swr__internal.PublicConfiguration<CollectionDetailFilterQueryResponse, any, (arg: ["query/collection", FetchCollectionArgs]) => swr__internal.FetcherResponse<CollectionDetailFilterQueryResponse>>> | undefined>;
7573
7606
 
7574
7607
  declare const useCollectionsQuery: (variable: CollectionsQueryVariables, options?: SWRConfiguration<CollectionsQueryResponse>) => swr__internal.SWRResponse<CollectionsQueryResponse, any, Partial<swr__internal.PublicConfiguration<CollectionsQueryResponse, any, (arg: ["query/collections", Exact<{
7575
7608
  after?: InputMaybe<string>;
@@ -7580,17 +7613,9 @@ declare const useCollectionsQuery: (variable: CollectionsQueryVariables, options
7580
7613
  orderBy?: InputMaybe<CollectionOrder>;
7581
7614
  }>]) => swr__internal.FetcherResponse<CollectionsQueryResponse>>> | undefined>;
7582
7615
 
7583
- declare const useProductQuery: (productId?: string, options?: SWRConfiguration<ProductSelectFragment>) => swr__internal.SWRResponse<ProductSelectFragment, any, Partial<swr__internal.PublicConfiguration<ProductSelectFragment, any, (arg: ["query/product", {
7584
- id?: string | undefined;
7585
- isSample?: boolean | undefined;
7586
- isStorefront?: boolean | undefined;
7587
- }]) => swr__internal.FetcherResponse<ProductSelectFragment>>> | undefined>;
7616
+ declare const useProductQuery: (productId?: string, options?: SWRConfiguration<ProductSelectFragment>) => swr__internal.SWRResponse<ProductSelectFragment, any, Partial<swr__internal.PublicConfiguration<ProductSelectFragment, any, (arg: ["query/product", FetchProductParams]) => swr__internal.FetcherResponse<ProductSelectFragment>>> | undefined>;
7588
7617
 
7589
- declare const useProductsQuery: (ids?: string[], options?: SWRConfiguration<ProductsQueryResponse>) => swr__internal.SWRResponse<ProductsQueryResponse, any, Partial<swr__internal.PublicConfiguration<ProductsQueryResponse, any, (arg: ["query/products", {
7590
- ids?: string[] | undefined;
7591
- isSample?: boolean | undefined;
7592
- isStorefront?: boolean | undefined;
7593
- }]) => swr__internal.FetcherResponse<ProductsQueryResponse>>> | undefined>;
7618
+ declare const useProductsQuery: (ids?: string[], options?: SWRConfiguration<ProductsQueryResponse>) => swr__internal.SWRResponse<ProductsQueryResponse, any, Partial<swr__internal.PublicConfiguration<ProductsQueryResponse, any, (arg: ["query/products", FetchProductsParams]) => swr__internal.FetcherResponse<ProductsQueryResponse>>> | undefined>;
7594
7619
 
7595
7620
  declare const useCurrentDevice: () => NameDevices;
7596
7621
 
@@ -7709,32 +7734,6 @@ type PublishedThemePageSelectFragment = Pick<PublishedThemePage, 'id' | 'name' |
7709
7734
  themePageCustomCode?: Maybe<Pick<CustomCode, 'body' | 'header'>>;
7710
7735
  };
7711
7736
 
7712
- type OrderByType = 'TITLE_ASC' | 'TITLE_DESC' | 'CREATED_AT_ASC' | undefined | 'none' | 'CREATED_AT_DESC';
7713
- type Args = {
7714
- id?: string;
7715
- numberOfProducts?: number;
7716
- orderBy?: OrderByType;
7717
- isSample?: boolean;
7718
- isStorefront?: boolean;
7719
- };
7720
- declare const getCollection: (fetcher: FetchFunc, arg: Args) => Promise<CollectionDetailFilterQueryResponse>;
7721
- declare const calculateFirstProduct: (numberOfProducts: number, currentPage: number, productsPerPage: number) => number;
7722
-
7723
- type FetchParams = {
7724
- id?: string;
7725
- isSample?: boolean;
7726
- isStorefront?: boolean;
7727
- };
7728
- declare const getProduct: (fetcher: FetchFunc, { id, isSample, isStorefront }: FetchParams) => Promise<ProductSelectFragment>;
7729
- type RequiredCursorEdge<T> = {
7730
- cursor: string;
7731
- node?: T;
7732
- };
7733
- declare const fetchVariants: (fetcher: FetchFunc, { id, isSample, isStorefront }: FetchParams) => Promise<RequiredCursorEdge<VariantSelectFragment>[]>;
7734
- declare const fetchMedias: (fetcher: FetchFunc, { id, isSample, isStorefront }: FetchParams) => Promise<(Pick<MediaEdge, "cursor"> & {
7735
- node?: Maybe<Pick<Media, "width" | "height" | "id" | "contentType" | "src" | "alt">>;
7736
- })[]>;
7737
-
7738
7737
  declare const getProductBySlug: (fetcher: FetchFunc, slug?: string) => Promise<ProductSelectFragment>;
7739
7738
 
7740
- 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, 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, 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 };
7739
+ 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, ComponentPreset, ComponentSetting, ContainerProp, ControlProp, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, ExtractState, FetchCollectionArgs, FetchFunc, FetchProductParams, 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, 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.35",
3
+ "version": "1.9.39",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",