@gem-sdk/core 1.5.43 → 1.6.0
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.
- package/dist/cjs/contexts/ShopContext.js +1 -0
- package/dist/cjs/helpers/borders.js +8 -0
- package/dist/cjs/helpers/compose-advance-style.js +7 -0
- package/dist/cjs/helpers/queries/get-collection.js +3 -3
- package/dist/cjs/helpers/queries/get-product-by-slug.js +6 -6
- package/dist/cjs/helpers/queries/get-product.js +13 -10
- package/dist/cjs/helpers/queries/get-products.js +24 -11
- package/dist/cjs/helpers/radius.js +12 -0
- package/dist/cjs/hooks/shop/use-product-query.js +3 -1
- package/dist/cjs/hooks/shop/use-products-query.js +3 -1
- package/dist/cjs/hooks/shop.js +6 -1
- package/dist/cjs/index.js +2 -0
- package/dist/esm/contexts/ShopContext.js +1 -0
- package/dist/esm/helpers/borders.js +9 -2
- package/dist/esm/helpers/compose-advance-style.js +9 -2
- package/dist/esm/helpers/queries/get-collection.js +3 -3
- package/dist/esm/helpers/queries/get-product-by-slug.js +6 -6
- package/dist/esm/helpers/queries/get-product.js +13 -10
- package/dist/esm/helpers/queries/get-products.js +24 -11
- package/dist/esm/helpers/radius.js +12 -1
- package/dist/esm/hooks/shop/use-product-query.js +4 -2
- package/dist/esm/hooks/shop/use-products-query.js +4 -2
- package/dist/esm/hooks/shop.js +6 -2
- package/dist/esm/index.js +2 -2
- package/dist/types/index.d.ts +12 -5
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ var AddonContext = require('./AddonContext.js');
|
|
|
9
9
|
const ShopContext = /*#__PURE__*/ react.createContext(null);
|
|
10
10
|
const createShopStoreProvider = (data)=>zustand.createStore((set)=>({
|
|
11
11
|
mobileOnly: false,
|
|
12
|
+
isStorefront: true,
|
|
12
13
|
...data,
|
|
13
14
|
changeLocale: (locale)=>{
|
|
14
15
|
set({
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
var colors = require('./colors.js');
|
|
4
4
|
var makeStyle = require('./make-style.js');
|
|
5
5
|
|
|
6
|
+
const getBorderStyle = (value)=>{
|
|
7
|
+
return makeStyle.makeStyle({
|
|
8
|
+
'b': value?.border,
|
|
9
|
+
'bc': value?.color,
|
|
10
|
+
'bw': value?.width
|
|
11
|
+
});
|
|
12
|
+
};
|
|
6
13
|
const handleConvertBorderStyle = (value)=>{
|
|
7
14
|
if (!value) return undefined;
|
|
8
15
|
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
@@ -128,6 +135,7 @@ const handleConvertClassColor = (value)=>{
|
|
|
128
135
|
return colors.getGlobalColorStateClass('border', newVal);
|
|
129
136
|
};
|
|
130
137
|
|
|
138
|
+
exports.getBorderStyle = getBorderStyle;
|
|
131
139
|
exports.handleConvertBorderColor = handleConvertBorderColor;
|
|
132
140
|
exports.handleConvertBorderStyle = handleConvertBorderStyle;
|
|
133
141
|
exports.handleConvertBorderWidth = handleConvertBorderWidth;
|
|
@@ -114,6 +114,13 @@ function composeAdvanceStyle(data, tag) {
|
|
|
114
114
|
Object.assign(styles, shadow.getStyleShadowState(value, 'box-shadow', hasBoxShadow));
|
|
115
115
|
break;
|
|
116
116
|
}
|
|
117
|
+
} else {
|
|
118
|
+
if (attr === 'border') {
|
|
119
|
+
Object.assign(styles, borders.getBorderStyle(value));
|
|
120
|
+
}
|
|
121
|
+
if (attr === 'rounded') {
|
|
122
|
+
Object.assign(styles, radius.getCornerCSSFromGlobal(value));
|
|
123
|
+
}
|
|
117
124
|
}
|
|
118
125
|
});
|
|
119
126
|
} else {
|
|
@@ -87,7 +87,7 @@ const loopFetchCollection = async (fetcher, arg)=>{
|
|
|
87
87
|
},
|
|
88
88
|
orderByProduct: productSortedByOrder(arg.orderBy),
|
|
89
89
|
whereProduct: {
|
|
90
|
-
isStorefront:
|
|
90
|
+
isStorefront: arg.isStorefront,
|
|
91
91
|
isSample: arg.isSample
|
|
92
92
|
},
|
|
93
93
|
productsAfter: productAfterFetcher
|
|
@@ -155,7 +155,7 @@ const mergeProductCollectionVariant = async (fetcher, collection, isSample)=>{
|
|
|
155
155
|
};
|
|
156
156
|
return newCollection;
|
|
157
157
|
};
|
|
158
|
-
const fetchVariantsByBaseIds = async (fetcher, { ids , isSample })=>{
|
|
158
|
+
const fetchVariantsByBaseIds = async (fetcher, { ids , isSample , isStorefront })=>{
|
|
159
159
|
const initVariables = {
|
|
160
160
|
firstVariant: 100,
|
|
161
161
|
first: ids?.length || 1,
|
|
@@ -164,7 +164,7 @@ const fetchVariantsByBaseIds = async (fetcher, { ids , isSample })=>{
|
|
|
164
164
|
direction: 'DESC'
|
|
165
165
|
},
|
|
166
166
|
where: {
|
|
167
|
-
isStorefront
|
|
167
|
+
isStorefront,
|
|
168
168
|
isSample,
|
|
169
169
|
...ids?.length && {
|
|
170
170
|
baseIDIn: ids.sort()
|
|
@@ -27,12 +27,12 @@ const orderBy = {
|
|
|
27
27
|
field: 'UPDATED_AT',
|
|
28
28
|
direction: 'DESC'
|
|
29
29
|
};
|
|
30
|
-
const fetchProduct = async (fetcher, handle)=>{
|
|
30
|
+
const fetchProduct = async (fetcher, handle, isStorefront)=>{
|
|
31
31
|
const variables = {
|
|
32
32
|
orderBy,
|
|
33
33
|
where: {
|
|
34
34
|
handle,
|
|
35
|
-
isStorefront
|
|
35
|
+
isStorefront
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
const response = await fetcher([
|
|
@@ -41,12 +41,12 @@ const fetchProduct = async (fetcher, handle)=>{
|
|
|
41
41
|
]);
|
|
42
42
|
return response.product?.edges?.[0]?.node;
|
|
43
43
|
};
|
|
44
|
-
const fetchVariants = async (fetcher, handle)=>{
|
|
44
|
+
const fetchVariants = async (fetcher, handle, isStorefront)=>{
|
|
45
45
|
const initVariables = {
|
|
46
46
|
orderBy,
|
|
47
47
|
where: {
|
|
48
48
|
handle,
|
|
49
|
-
isStorefront
|
|
49
|
+
isStorefront
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
const query = async (variables, olds)=>{
|
|
@@ -70,12 +70,12 @@ const fetchVariants = async (fetcher, handle)=>{
|
|
|
70
70
|
};
|
|
71
71
|
return query(initVariables, []);
|
|
72
72
|
};
|
|
73
|
-
const fetchMedias = async (fetcher, handle)=>{
|
|
73
|
+
const fetchMedias = async (fetcher, handle, isStorefront)=>{
|
|
74
74
|
const initVariables = {
|
|
75
75
|
orderBy,
|
|
76
76
|
where: {
|
|
77
77
|
handle,
|
|
78
|
-
isStorefront
|
|
78
|
+
isStorefront
|
|
79
79
|
},
|
|
80
80
|
orderByMedia: {
|
|
81
81
|
field: 'POSITION',
|
|
@@ -4,19 +4,22 @@ var productLittleDetail_generated = require('../../graphql/queries/product-littl
|
|
|
4
4
|
var productMedias_generated = require('../../graphql/queries/product-medias.generated.js');
|
|
5
5
|
var productVariants_generated = require('../../graphql/queries/product-variants.generated.js');
|
|
6
6
|
|
|
7
|
-
const getProduct = async (fetcher, { id , isSample })=>{
|
|
7
|
+
const getProduct = async (fetcher, { id , isSample , isStorefront })=>{
|
|
8
8
|
const [product, variants, medias] = await Promise.all([
|
|
9
9
|
fetchProduct(fetcher, {
|
|
10
10
|
id,
|
|
11
|
-
isSample
|
|
11
|
+
isSample,
|
|
12
|
+
isStorefront
|
|
12
13
|
}),
|
|
13
14
|
fetchVariants(fetcher, {
|
|
14
15
|
id,
|
|
15
|
-
isSample
|
|
16
|
+
isSample,
|
|
17
|
+
isStorefront
|
|
16
18
|
}),
|
|
17
19
|
fetchMedias(fetcher, {
|
|
18
20
|
id,
|
|
19
|
-
isSample
|
|
21
|
+
isSample,
|
|
22
|
+
isStorefront
|
|
20
23
|
})
|
|
21
24
|
]);
|
|
22
25
|
if (!product) {
|
|
@@ -36,11 +39,11 @@ const orderBy = {
|
|
|
36
39
|
field: 'UPDATED_AT',
|
|
37
40
|
direction: 'DESC'
|
|
38
41
|
};
|
|
39
|
-
const fetchProduct = async (fetcher, { id , isSample })=>{
|
|
42
|
+
const fetchProduct = async (fetcher, { id , isSample , isStorefront })=>{
|
|
40
43
|
const variables = {
|
|
41
44
|
orderBy,
|
|
42
45
|
where: {
|
|
43
|
-
isStorefront
|
|
46
|
+
isStorefront,
|
|
44
47
|
isSample,
|
|
45
48
|
...id && id.toLowerCase() !== 'latest' && {
|
|
46
49
|
baseID: id
|
|
@@ -53,11 +56,11 @@ const fetchProduct = async (fetcher, { id , isSample })=>{
|
|
|
53
56
|
]);
|
|
54
57
|
return response.product?.edges?.[0]?.node;
|
|
55
58
|
};
|
|
56
|
-
const fetchVariants = async (fetcher, { id , isSample })=>{
|
|
59
|
+
const fetchVariants = async (fetcher, { id , isSample , isStorefront })=>{
|
|
57
60
|
const initVariables = {
|
|
58
61
|
orderBy,
|
|
59
62
|
where: {
|
|
60
|
-
isStorefront
|
|
63
|
+
isStorefront,
|
|
61
64
|
isSample,
|
|
62
65
|
...id && id.toLowerCase() !== 'latest' && {
|
|
63
66
|
baseID: id
|
|
@@ -85,11 +88,11 @@ const fetchVariants = async (fetcher, { id , isSample })=>{
|
|
|
85
88
|
};
|
|
86
89
|
return query(initVariables, []);
|
|
87
90
|
};
|
|
88
|
-
const fetchMedias = async (fetcher, { id , isSample })=>{
|
|
91
|
+
const fetchMedias = async (fetcher, { id , isSample , isStorefront })=>{
|
|
89
92
|
const initVariables = {
|
|
90
93
|
orderBy,
|
|
91
94
|
where: {
|
|
92
|
-
isStorefront
|
|
95
|
+
isStorefront,
|
|
93
96
|
isSample,
|
|
94
97
|
...id && id.toLowerCase() !== 'latest' && {
|
|
95
98
|
baseID: id
|
|
@@ -4,17 +4,28 @@ var products_generated = require('../../graphql/queries/products.generated.js');
|
|
|
4
4
|
var getCollection = require('./get-collection.js');
|
|
5
5
|
var getProduct = require('./get-product.js');
|
|
6
6
|
|
|
7
|
-
const getProducts = async (fetcher, { ids , isSample })=>{
|
|
7
|
+
const getProducts = async (fetcher, { ids , isSample , isStorefront })=>{
|
|
8
8
|
const products = await loopFetchProducts(fetcher, {
|
|
9
9
|
ids,
|
|
10
|
-
isSample
|
|
10
|
+
isSample,
|
|
11
|
+
isStorefront
|
|
11
12
|
});
|
|
12
13
|
if (!products) {
|
|
13
14
|
throw new Error('Product not found');
|
|
14
15
|
}
|
|
15
16
|
const [mergedVariant, mergedMedias] = await Promise.all([
|
|
16
|
-
mergeVariantsToProducts(
|
|
17
|
-
|
|
17
|
+
mergeVariantsToProducts({
|
|
18
|
+
fetcher,
|
|
19
|
+
products,
|
|
20
|
+
isSample,
|
|
21
|
+
isStorefront
|
|
22
|
+
}),
|
|
23
|
+
mergeMediasToProducts({
|
|
24
|
+
fetcher,
|
|
25
|
+
products,
|
|
26
|
+
isSample,
|
|
27
|
+
isStorefront
|
|
28
|
+
})
|
|
18
29
|
]);
|
|
19
30
|
return {
|
|
20
31
|
...products,
|
|
@@ -50,7 +61,7 @@ const fetchProducts = async (fetcher, variables)=>{
|
|
|
50
61
|
variables
|
|
51
62
|
]);
|
|
52
63
|
};
|
|
53
|
-
const loopFetchProducts = async (fetcher, { ids , isSample })=>{
|
|
64
|
+
const loopFetchProducts = async (fetcher, { ids , isSample , isStorefront })=>{
|
|
54
65
|
const numberOfProducts = (ids?.length == 0 ? 4 : ids?.length) ?? 4;
|
|
55
66
|
const productsPerPage = 8; // number of products per page
|
|
56
67
|
let variables; // variables of collection query
|
|
@@ -75,8 +86,8 @@ const loopFetchProducts = async (fetcher, { ids , isSample })=>{
|
|
|
75
86
|
direction: 'ASC'
|
|
76
87
|
},
|
|
77
88
|
where: {
|
|
78
|
-
isStorefront
|
|
79
|
-
isSample
|
|
89
|
+
isStorefront,
|
|
90
|
+
isSample,
|
|
80
91
|
...ids?.length ? {
|
|
81
92
|
baseIDIn: ids
|
|
82
93
|
} : {}
|
|
@@ -104,11 +115,12 @@ const loopFetchProducts = async (fetcher, { ids , isSample })=>{
|
|
|
104
115
|
}
|
|
105
116
|
return dataProducts;
|
|
106
117
|
};
|
|
107
|
-
const mergeVariantsToProducts = async (fetcher, products, isSample)=>{
|
|
118
|
+
const mergeVariantsToProducts = async ({ fetcher , products , isSample , isStorefront })=>{
|
|
108
119
|
const productsWithVariants = await Promise.all(products?.products?.edges?.map(async (product)=>{
|
|
109
120
|
const variants = await getProduct.fetchVariants(fetcher, {
|
|
110
121
|
id: product?.node?.baseID,
|
|
111
|
-
isSample
|
|
122
|
+
isSample,
|
|
123
|
+
isStorefront
|
|
112
124
|
});
|
|
113
125
|
return {
|
|
114
126
|
productId: product?.node?.baseID,
|
|
@@ -117,11 +129,12 @@ const mergeVariantsToProducts = async (fetcher, products, isSample)=>{
|
|
|
117
129
|
}) ?? []);
|
|
118
130
|
return productsWithVariants;
|
|
119
131
|
};
|
|
120
|
-
const mergeMediasToProducts = async (fetcher, products, isSample)=>{
|
|
132
|
+
const mergeMediasToProducts = async ({ fetcher , products , isSample , isStorefront })=>{
|
|
121
133
|
const productsWithMedias = await Promise.all(products?.products?.edges?.map(async (product)=>{
|
|
122
134
|
const medias = await getProduct.fetchMedias(fetcher, {
|
|
123
135
|
id: product?.node?.baseID,
|
|
124
|
-
isSample
|
|
136
|
+
isSample,
|
|
137
|
+
isStorefront
|
|
125
138
|
});
|
|
126
139
|
return {
|
|
127
140
|
productId: product?.node?.baseID,
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var constant = require('./constant.js');
|
|
4
|
+
var makeStyle = require('./make-style.js');
|
|
4
5
|
|
|
6
|
+
const getCornerCSSFromGlobal = (corner)=>{
|
|
7
|
+
if (!corner.radiusType) return {};
|
|
8
|
+
return makeStyle.makeStyle({
|
|
9
|
+
'bblr': corner.bblr,
|
|
10
|
+
'bbrr': corner.bbrr,
|
|
11
|
+
'btlr': corner.btlr,
|
|
12
|
+
'btrr': corner.btrr,
|
|
13
|
+
'radius': `var(--g-radius-${corner.radiusType})`
|
|
14
|
+
});
|
|
15
|
+
};
|
|
5
16
|
const getRadiusCSSFromGlobal = (state, key, device)=>{
|
|
6
17
|
if (!key || !state) return {};
|
|
7
18
|
const suffix = device && device !== 'desktop' ? constant.devicesMapping?.[device] : '';
|
|
@@ -83,6 +94,7 @@ const getRadiusStyleActiveState = (radiusValue)=>{
|
|
|
83
94
|
};
|
|
84
95
|
|
|
85
96
|
exports.composeRadius = composeRadius;
|
|
97
|
+
exports.getCornerCSSFromGlobal = getCornerCSSFromGlobal;
|
|
86
98
|
exports.getCustomRadius = getCustomRadius;
|
|
87
99
|
exports.getRadiusCSSFromGlobal = getRadiusCSSFromGlobal;
|
|
88
100
|
exports.getRadiusStyleActiveState = getRadiusStyleActiveState;
|
|
@@ -8,11 +8,13 @@ var useFetchHandle = require('../useFetchHandle.js');
|
|
|
8
8
|
const useProductQuery = (productId, options)=>{
|
|
9
9
|
const fetcher = useFetchHandle.useFetchHandle();
|
|
10
10
|
const isSample = shop.useIsSampleProduct();
|
|
11
|
+
const isStorefront = shop.useIsStorefrontProduct();
|
|
11
12
|
return useSWR(productId ? [
|
|
12
13
|
'query/product',
|
|
13
14
|
{
|
|
14
15
|
id: productId ?? 'latest',
|
|
15
|
-
isSample
|
|
16
|
+
isSample,
|
|
17
|
+
isStorefront
|
|
16
18
|
}
|
|
17
19
|
] : null, async ([, arg])=>{
|
|
18
20
|
return getProduct.getProduct(fetcher, arg);
|
|
@@ -8,13 +8,15 @@ var useFetchHandle = require('../useFetchHandle.js');
|
|
|
8
8
|
const useProductsQuery = (ids, options)=>{
|
|
9
9
|
const fetcher = useFetchHandle.useFetchHandle();
|
|
10
10
|
const isSample = shop.useIsSampleProduct();
|
|
11
|
+
const isStorefront = shop.useIsStorefrontProduct();
|
|
11
12
|
return useSWR([
|
|
12
13
|
'query/products',
|
|
13
14
|
{
|
|
14
15
|
ids: [
|
|
15
16
|
...ids ?? []
|
|
16
17
|
]?.sort(),
|
|
17
|
-
isSample
|
|
18
|
+
isSample,
|
|
19
|
+
isStorefront
|
|
18
20
|
}
|
|
19
21
|
], async ([, arg])=>{
|
|
20
22
|
return getProducts.getProducts(fetcher, arg);
|
package/dist/cjs/hooks/shop.js
CHANGED
|
@@ -84,7 +84,11 @@ function useConnectedShopify() {
|
|
|
84
84
|
}
|
|
85
85
|
function useIsSampleProduct() {
|
|
86
86
|
const { storefrontToken } = useStoreFront();
|
|
87
|
-
|
|
87
|
+
const isStorefront = ShopContext.useShopStore((state)=>state.isStorefront);
|
|
88
|
+
return isStorefront && !storefrontToken;
|
|
89
|
+
}
|
|
90
|
+
function useIsStorefrontProduct() {
|
|
91
|
+
return ShopContext.useShopStore((state)=>state.isStorefront);
|
|
88
92
|
}
|
|
89
93
|
function useCheckoutUrl(url) {
|
|
90
94
|
const { storefrontToken } = useStoreFront();
|
|
@@ -97,6 +101,7 @@ exports.useConnectedShopify = useConnectedShopify;
|
|
|
97
101
|
exports.useCurrency = useCurrency;
|
|
98
102
|
exports.useEditorMode = useEditorMode;
|
|
99
103
|
exports.useIsSampleProduct = useIsSampleProduct;
|
|
104
|
+
exports.useIsStorefrontProduct = useIsStorefrontProduct;
|
|
100
105
|
exports.useLocale = useLocale;
|
|
101
106
|
exports.useMatchMutate = useMatchMutate;
|
|
102
107
|
exports.useMobileOnly = useMobileOnly;
|
package/dist/cjs/index.js
CHANGED
|
@@ -166,6 +166,7 @@ exports.getSingleColorVariable = colors.getSingleColorVariable;
|
|
|
166
166
|
exports.isColor = colors.isColor;
|
|
167
167
|
exports.genTypoClass = typography.genTypoClass;
|
|
168
168
|
exports.composeRadius = radius.composeRadius;
|
|
169
|
+
exports.getCornerCSSFromGlobal = radius.getCornerCSSFromGlobal;
|
|
169
170
|
exports.getCustomRadius = radius.getCustomRadius;
|
|
170
171
|
exports.getRadiusCSSFromGlobal = radius.getRadiusCSSFromGlobal;
|
|
171
172
|
exports.getRadiusStyleActiveState = radius.getRadiusStyleActiveState;
|
|
@@ -191,6 +192,7 @@ exports.useConnectedShopify = shop.useConnectedShopify;
|
|
|
191
192
|
exports.useCurrency = shop.useCurrency;
|
|
192
193
|
exports.useEditorMode = shop.useEditorMode;
|
|
193
194
|
exports.useIsSampleProduct = shop.useIsSampleProduct;
|
|
195
|
+
exports.useIsStorefrontProduct = shop.useIsStorefrontProduct;
|
|
194
196
|
exports.useLocale = shop.useLocale;
|
|
195
197
|
exports.useMatchMutate = shop.useMatchMutate;
|
|
196
198
|
exports.useMobileOnly = shop.useMobileOnly;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStateResponsiveClass, getGlobalColorStateClass } from './colors.js';
|
|
2
|
-
import { makeStyleResponsiveState, makeStyleState } from './make-style.js';
|
|
2
|
+
import { makeStyleResponsiveState, makeStyleState, makeStyle } from './make-style.js';
|
|
3
3
|
|
|
4
|
+
const getBorderStyle = (value)=>{
|
|
5
|
+
return makeStyle({
|
|
6
|
+
'b': value?.border,
|
|
7
|
+
'bc': value?.color,
|
|
8
|
+
'bw': value?.width
|
|
9
|
+
});
|
|
10
|
+
};
|
|
4
11
|
const handleConvertBorderStyle = (value)=>{
|
|
5
12
|
if (!value) return undefined;
|
|
6
13
|
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
@@ -126,4 +133,4 @@ const handleConvertClassColor = (value)=>{
|
|
|
126
133
|
return getGlobalColorStateClass('border', newVal);
|
|
127
134
|
};
|
|
128
135
|
|
|
129
|
-
export { handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor };
|
|
136
|
+
export { getBorderStyle, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { handleConvertBorderStyle, handleConvertBorderWidth, handleConvertBorderColor } from './borders.js';
|
|
1
|
+
import { handleConvertBorderStyle, handleConvertBorderWidth, handleConvertBorderColor, getBorderStyle } from './borders.js';
|
|
2
2
|
import { isColor } from './colors.js';
|
|
3
3
|
import { layoutComponent } from './constant.js';
|
|
4
|
-
import { composeRadius } from './radius.js';
|
|
4
|
+
import { composeRadius, getCornerCSSFromGlobal } from './radius.js';
|
|
5
5
|
import { getStyleShadowState } from './shadow.js';
|
|
6
6
|
|
|
7
7
|
const composeSpacing = ({ source , spacing , type , suffix ='' })=>{
|
|
@@ -112,6 +112,13 @@ function composeAdvanceStyle(data, tag) {
|
|
|
112
112
|
Object.assign(styles, getStyleShadowState(value, 'box-shadow', hasBoxShadow));
|
|
113
113
|
break;
|
|
114
114
|
}
|
|
115
|
+
} else {
|
|
116
|
+
if (attr === 'border') {
|
|
117
|
+
Object.assign(styles, getBorderStyle(value));
|
|
118
|
+
}
|
|
119
|
+
if (attr === 'rounded') {
|
|
120
|
+
Object.assign(styles, getCornerCSSFromGlobal(value));
|
|
121
|
+
}
|
|
115
122
|
}
|
|
116
123
|
});
|
|
117
124
|
} else {
|
|
@@ -85,7 +85,7 @@ const loopFetchCollection = async (fetcher, arg)=>{
|
|
|
85
85
|
},
|
|
86
86
|
orderByProduct: productSortedByOrder(arg.orderBy),
|
|
87
87
|
whereProduct: {
|
|
88
|
-
isStorefront:
|
|
88
|
+
isStorefront: arg.isStorefront,
|
|
89
89
|
isSample: arg.isSample
|
|
90
90
|
},
|
|
91
91
|
productsAfter: productAfterFetcher
|
|
@@ -153,7 +153,7 @@ const mergeProductCollectionVariant = async (fetcher, collection, isSample)=>{
|
|
|
153
153
|
};
|
|
154
154
|
return newCollection;
|
|
155
155
|
};
|
|
156
|
-
const fetchVariantsByBaseIds = async (fetcher, { ids , isSample })=>{
|
|
156
|
+
const fetchVariantsByBaseIds = async (fetcher, { ids , isSample , isStorefront })=>{
|
|
157
157
|
const initVariables = {
|
|
158
158
|
firstVariant: 100,
|
|
159
159
|
first: ids?.length || 1,
|
|
@@ -162,7 +162,7 @@ const fetchVariantsByBaseIds = async (fetcher, { ids , isSample })=>{
|
|
|
162
162
|
direction: 'DESC'
|
|
163
163
|
},
|
|
164
164
|
where: {
|
|
165
|
-
isStorefront
|
|
165
|
+
isStorefront,
|
|
166
166
|
isSample,
|
|
167
167
|
...ids?.length && {
|
|
168
168
|
baseIDIn: ids.sort()
|
|
@@ -25,12 +25,12 @@ const orderBy = {
|
|
|
25
25
|
field: 'UPDATED_AT',
|
|
26
26
|
direction: 'DESC'
|
|
27
27
|
};
|
|
28
|
-
const fetchProduct = async (fetcher, handle)=>{
|
|
28
|
+
const fetchProduct = async (fetcher, handle, isStorefront)=>{
|
|
29
29
|
const variables = {
|
|
30
30
|
orderBy,
|
|
31
31
|
where: {
|
|
32
32
|
handle,
|
|
33
|
-
isStorefront
|
|
33
|
+
isStorefront
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
const response = await fetcher([
|
|
@@ -39,12 +39,12 @@ const fetchProduct = async (fetcher, handle)=>{
|
|
|
39
39
|
]);
|
|
40
40
|
return response.product?.edges?.[0]?.node;
|
|
41
41
|
};
|
|
42
|
-
const fetchVariants = async (fetcher, handle)=>{
|
|
42
|
+
const fetchVariants = async (fetcher, handle, isStorefront)=>{
|
|
43
43
|
const initVariables = {
|
|
44
44
|
orderBy,
|
|
45
45
|
where: {
|
|
46
46
|
handle,
|
|
47
|
-
isStorefront
|
|
47
|
+
isStorefront
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
const query = async (variables, olds)=>{
|
|
@@ -68,12 +68,12 @@ const fetchVariants = async (fetcher, handle)=>{
|
|
|
68
68
|
};
|
|
69
69
|
return query(initVariables, []);
|
|
70
70
|
};
|
|
71
|
-
const fetchMedias = async (fetcher, handle)=>{
|
|
71
|
+
const fetchMedias = async (fetcher, handle, isStorefront)=>{
|
|
72
72
|
const initVariables = {
|
|
73
73
|
orderBy,
|
|
74
74
|
where: {
|
|
75
75
|
handle,
|
|
76
|
-
isStorefront
|
|
76
|
+
isStorefront
|
|
77
77
|
},
|
|
78
78
|
orderByMedia: {
|
|
79
79
|
field: 'POSITION',
|
|
@@ -2,19 +2,22 @@ import { ProductLittleDetailDocument } from '../../graphql/queries/product-littl
|
|
|
2
2
|
import { ProductMediasDocument } from '../../graphql/queries/product-medias.generated.js';
|
|
3
3
|
import { ProductVariantsDocument } from '../../graphql/queries/product-variants.generated.js';
|
|
4
4
|
|
|
5
|
-
const getProduct = async (fetcher, { id , isSample })=>{
|
|
5
|
+
const getProduct = async (fetcher, { id , isSample , isStorefront })=>{
|
|
6
6
|
const [product, variants, medias] = await Promise.all([
|
|
7
7
|
fetchProduct(fetcher, {
|
|
8
8
|
id,
|
|
9
|
-
isSample
|
|
9
|
+
isSample,
|
|
10
|
+
isStorefront
|
|
10
11
|
}),
|
|
11
12
|
fetchVariants(fetcher, {
|
|
12
13
|
id,
|
|
13
|
-
isSample
|
|
14
|
+
isSample,
|
|
15
|
+
isStorefront
|
|
14
16
|
}),
|
|
15
17
|
fetchMedias(fetcher, {
|
|
16
18
|
id,
|
|
17
|
-
isSample
|
|
19
|
+
isSample,
|
|
20
|
+
isStorefront
|
|
18
21
|
})
|
|
19
22
|
]);
|
|
20
23
|
if (!product) {
|
|
@@ -34,11 +37,11 @@ const orderBy = {
|
|
|
34
37
|
field: 'UPDATED_AT',
|
|
35
38
|
direction: 'DESC'
|
|
36
39
|
};
|
|
37
|
-
const fetchProduct = async (fetcher, { id , isSample })=>{
|
|
40
|
+
const fetchProduct = async (fetcher, { id , isSample , isStorefront })=>{
|
|
38
41
|
const variables = {
|
|
39
42
|
orderBy,
|
|
40
43
|
where: {
|
|
41
|
-
isStorefront
|
|
44
|
+
isStorefront,
|
|
42
45
|
isSample,
|
|
43
46
|
...id && id.toLowerCase() !== 'latest' && {
|
|
44
47
|
baseID: id
|
|
@@ -51,11 +54,11 @@ const fetchProduct = async (fetcher, { id , isSample })=>{
|
|
|
51
54
|
]);
|
|
52
55
|
return response.product?.edges?.[0]?.node;
|
|
53
56
|
};
|
|
54
|
-
const fetchVariants = async (fetcher, { id , isSample })=>{
|
|
57
|
+
const fetchVariants = async (fetcher, { id , isSample , isStorefront })=>{
|
|
55
58
|
const initVariables = {
|
|
56
59
|
orderBy,
|
|
57
60
|
where: {
|
|
58
|
-
isStorefront
|
|
61
|
+
isStorefront,
|
|
59
62
|
isSample,
|
|
60
63
|
...id && id.toLowerCase() !== 'latest' && {
|
|
61
64
|
baseID: id
|
|
@@ -83,11 +86,11 @@ const fetchVariants = async (fetcher, { id , isSample })=>{
|
|
|
83
86
|
};
|
|
84
87
|
return query(initVariables, []);
|
|
85
88
|
};
|
|
86
|
-
const fetchMedias = async (fetcher, { id , isSample })=>{
|
|
89
|
+
const fetchMedias = async (fetcher, { id , isSample , isStorefront })=>{
|
|
87
90
|
const initVariables = {
|
|
88
91
|
orderBy,
|
|
89
92
|
where: {
|
|
90
|
-
isStorefront
|
|
93
|
+
isStorefront,
|
|
91
94
|
isSample,
|
|
92
95
|
...id && id.toLowerCase() !== 'latest' && {
|
|
93
96
|
baseID: id
|
|
@@ -2,17 +2,28 @@ import { ProductsDocument } from '../../graphql/queries/products.generated.js';
|
|
|
2
2
|
import { calculateFirstProduct } from './get-collection.js';
|
|
3
3
|
import { fetchVariants, fetchMedias } from './get-product.js';
|
|
4
4
|
|
|
5
|
-
const getProducts = async (fetcher, { ids , isSample })=>{
|
|
5
|
+
const getProducts = async (fetcher, { ids , isSample , isStorefront })=>{
|
|
6
6
|
const products = await loopFetchProducts(fetcher, {
|
|
7
7
|
ids,
|
|
8
|
-
isSample
|
|
8
|
+
isSample,
|
|
9
|
+
isStorefront
|
|
9
10
|
});
|
|
10
11
|
if (!products) {
|
|
11
12
|
throw new Error('Product not found');
|
|
12
13
|
}
|
|
13
14
|
const [mergedVariant, mergedMedias] = await Promise.all([
|
|
14
|
-
mergeVariantsToProducts(
|
|
15
|
-
|
|
15
|
+
mergeVariantsToProducts({
|
|
16
|
+
fetcher,
|
|
17
|
+
products,
|
|
18
|
+
isSample,
|
|
19
|
+
isStorefront
|
|
20
|
+
}),
|
|
21
|
+
mergeMediasToProducts({
|
|
22
|
+
fetcher,
|
|
23
|
+
products,
|
|
24
|
+
isSample,
|
|
25
|
+
isStorefront
|
|
26
|
+
})
|
|
16
27
|
]);
|
|
17
28
|
return {
|
|
18
29
|
...products,
|
|
@@ -48,7 +59,7 @@ const fetchProducts = async (fetcher, variables)=>{
|
|
|
48
59
|
variables
|
|
49
60
|
]);
|
|
50
61
|
};
|
|
51
|
-
const loopFetchProducts = async (fetcher, { ids , isSample })=>{
|
|
62
|
+
const loopFetchProducts = async (fetcher, { ids , isSample , isStorefront })=>{
|
|
52
63
|
const numberOfProducts = (ids?.length == 0 ? 4 : ids?.length) ?? 4;
|
|
53
64
|
const productsPerPage = 8; // number of products per page
|
|
54
65
|
let variables; // variables of collection query
|
|
@@ -73,8 +84,8 @@ const loopFetchProducts = async (fetcher, { ids , isSample })=>{
|
|
|
73
84
|
direction: 'ASC'
|
|
74
85
|
},
|
|
75
86
|
where: {
|
|
76
|
-
isStorefront
|
|
77
|
-
isSample
|
|
87
|
+
isStorefront,
|
|
88
|
+
isSample,
|
|
78
89
|
...ids?.length ? {
|
|
79
90
|
baseIDIn: ids
|
|
80
91
|
} : {}
|
|
@@ -102,11 +113,12 @@ const loopFetchProducts = async (fetcher, { ids , isSample })=>{
|
|
|
102
113
|
}
|
|
103
114
|
return dataProducts;
|
|
104
115
|
};
|
|
105
|
-
const mergeVariantsToProducts = async (fetcher, products, isSample)=>{
|
|
116
|
+
const mergeVariantsToProducts = async ({ fetcher , products , isSample , isStorefront })=>{
|
|
106
117
|
const productsWithVariants = await Promise.all(products?.products?.edges?.map(async (product)=>{
|
|
107
118
|
const variants = await fetchVariants(fetcher, {
|
|
108
119
|
id: product?.node?.baseID,
|
|
109
|
-
isSample
|
|
120
|
+
isSample,
|
|
121
|
+
isStorefront
|
|
110
122
|
});
|
|
111
123
|
return {
|
|
112
124
|
productId: product?.node?.baseID,
|
|
@@ -115,11 +127,12 @@ const mergeVariantsToProducts = async (fetcher, products, isSample)=>{
|
|
|
115
127
|
}) ?? []);
|
|
116
128
|
return productsWithVariants;
|
|
117
129
|
};
|
|
118
|
-
const mergeMediasToProducts = async (fetcher, products, isSample)=>{
|
|
130
|
+
const mergeMediasToProducts = async ({ fetcher , products , isSample , isStorefront })=>{
|
|
119
131
|
const productsWithMedias = await Promise.all(products?.products?.edges?.map(async (product)=>{
|
|
120
132
|
const medias = await fetchMedias(fetcher, {
|
|
121
133
|
id: product?.node?.baseID,
|
|
122
|
-
isSample
|
|
134
|
+
isSample,
|
|
135
|
+
isStorefront
|
|
123
136
|
});
|
|
124
137
|
return {
|
|
125
138
|
productId: product?.node?.baseID,
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { devicesMapping, stateMapping } from './constant.js';
|
|
2
|
+
import { makeStyle } from './make-style.js';
|
|
2
3
|
|
|
4
|
+
const getCornerCSSFromGlobal = (corner)=>{
|
|
5
|
+
if (!corner.radiusType) return {};
|
|
6
|
+
return makeStyle({
|
|
7
|
+
'bblr': corner.bblr,
|
|
8
|
+
'bbrr': corner.bbrr,
|
|
9
|
+
'btlr': corner.btlr,
|
|
10
|
+
'btrr': corner.btrr,
|
|
11
|
+
'radius': `var(--g-radius-${corner.radiusType})`
|
|
12
|
+
});
|
|
13
|
+
};
|
|
3
14
|
const getRadiusCSSFromGlobal = (state, key, device)=>{
|
|
4
15
|
if (!key || !state) return {};
|
|
5
16
|
const suffix = device && device !== 'desktop' ? devicesMapping?.[device] : '';
|
|
@@ -80,4 +91,4 @@ const getRadiusStyleActiveState = (radiusValue)=>{
|
|
|
80
91
|
return getRadiusCSSFromGlobal('normal', radiusValue?.active?.radiusType);
|
|
81
92
|
};
|
|
82
93
|
|
|
83
|
-
export { composeRadius, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState };
|
|
94
|
+
export { composeRadius, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState };
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import useSWR from 'swr';
|
|
2
2
|
import { getProduct } from '../../helpers/queries/get-product.js';
|
|
3
|
-
import { useIsSampleProduct } from '../shop.js';
|
|
3
|
+
import { useIsSampleProduct, useIsStorefrontProduct } from '../shop.js';
|
|
4
4
|
import { useFetchHandle } from '../useFetchHandle.js';
|
|
5
5
|
|
|
6
6
|
const useProductQuery = (productId, options)=>{
|
|
7
7
|
const fetcher = useFetchHandle();
|
|
8
8
|
const isSample = useIsSampleProduct();
|
|
9
|
+
const isStorefront = useIsStorefrontProduct();
|
|
9
10
|
return useSWR(productId ? [
|
|
10
11
|
'query/product',
|
|
11
12
|
{
|
|
12
13
|
id: productId ?? 'latest',
|
|
13
|
-
isSample
|
|
14
|
+
isSample,
|
|
15
|
+
isStorefront
|
|
14
16
|
}
|
|
15
17
|
] : null, async ([, arg])=>{
|
|
16
18
|
return getProduct(fetcher, arg);
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import useSWR from 'swr';
|
|
2
2
|
import { getProducts } from '../../helpers/queries/get-products.js';
|
|
3
|
-
import { useIsSampleProduct } from '../shop.js';
|
|
3
|
+
import { useIsSampleProduct, useIsStorefrontProduct } from '../shop.js';
|
|
4
4
|
import { useFetchHandle } from '../useFetchHandle.js';
|
|
5
5
|
|
|
6
6
|
const useProductsQuery = (ids, options)=>{
|
|
7
7
|
const fetcher = useFetchHandle();
|
|
8
8
|
const isSample = useIsSampleProduct();
|
|
9
|
+
const isStorefront = useIsStorefrontProduct();
|
|
9
10
|
return useSWR([
|
|
10
11
|
'query/products',
|
|
11
12
|
{
|
|
12
13
|
ids: [
|
|
13
14
|
...ids ?? []
|
|
14
15
|
]?.sort(),
|
|
15
|
-
isSample
|
|
16
|
+
isSample,
|
|
17
|
+
isStorefront
|
|
16
18
|
}
|
|
17
19
|
], async ([, arg])=>{
|
|
18
20
|
return getProducts(fetcher, arg);
|
package/dist/esm/hooks/shop.js
CHANGED
|
@@ -82,7 +82,11 @@ function useConnectedShopify() {
|
|
|
82
82
|
}
|
|
83
83
|
function useIsSampleProduct() {
|
|
84
84
|
const { storefrontToken } = useStoreFront();
|
|
85
|
-
|
|
85
|
+
const isStorefront = useShopStore((state)=>state.isStorefront);
|
|
86
|
+
return isStorefront && !storefrontToken;
|
|
87
|
+
}
|
|
88
|
+
function useIsStorefrontProduct() {
|
|
89
|
+
return useShopStore((state)=>state.isStorefront);
|
|
86
90
|
}
|
|
87
91
|
function useCheckoutUrl(url) {
|
|
88
92
|
const { storefrontToken } = useStoreFront();
|
|
@@ -90,4 +94,4 @@ function useCheckoutUrl(url) {
|
|
|
90
94
|
return storefrontToken ? `${url}?access_token=${storefrontToken}` : url;
|
|
91
95
|
}
|
|
92
96
|
|
|
93
|
-
export { useCheckoutUrl, useConnectedShopify, useCurrency, useEditorMode, useIsSampleProduct, useLocale, useMatchMutate, useMobileOnly, usePageType, usePluginEnable, useStoreFront, useSwatches };
|
|
97
|
+
export { useCheckoutUrl, useConnectedShopify, useCurrency, useEditorMode, useIsSampleProduct, useIsStorefrontProduct, useLocale, useMatchMutate, useMobileOnly, usePageType, usePluginEnable, useStoreFront, useSwatches };
|
package/dist/esm/index.js
CHANGED
|
@@ -42,7 +42,7 @@ export { genVariable } from './helpers/css-variable.js';
|
|
|
42
42
|
export { isDefined } from './helpers/is-defined.js';
|
|
43
43
|
export { getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getSingleColorVariable, isColor } from './helpers/colors.js';
|
|
44
44
|
export { genTypoClass } from './helpers/typography.js';
|
|
45
|
-
export { composeRadius, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState } from './helpers/radius.js';
|
|
45
|
+
export { composeRadius, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState } from './helpers/radius.js';
|
|
46
46
|
export { getSelectedVariant, parseSelectedOption } from './helpers/product.js';
|
|
47
47
|
import * as fpixel from './helpers/tracking/fpixel.js';
|
|
48
48
|
export { fpixel };
|
|
@@ -59,7 +59,7 @@ export { useCartNoteUpdate } from './hooks/cart/use-cart-note-update.js';
|
|
|
59
59
|
export { useCreateCart } from './hooks/cart/use-create-cart.js';
|
|
60
60
|
export { useRemoveCartItem } from './hooks/cart/use-remove-cart-item.js';
|
|
61
61
|
export { useUpdateCartItem } from './hooks/cart/use-update-cart-item.js';
|
|
62
|
-
export { useCheckoutUrl, useConnectedShopify, useCurrency, useEditorMode, useIsSampleProduct, useLocale, useMatchMutate, useMobileOnly, usePageType, usePluginEnable, useStoreFront, useSwatches } from './hooks/shop.js';
|
|
62
|
+
export { useCheckoutUrl, useConnectedShopify, useCurrency, useEditorMode, useIsSampleProduct, useIsStorefrontProduct, useLocale, useMatchMutate, useMobileOnly, usePageType, usePluginEnable, useStoreFront, useSwatches } from './hooks/shop.js';
|
|
63
63
|
export { useCollectionQuery } from './hooks/shop/use-collection-query.js';
|
|
64
64
|
export { useProductQuery } from './hooks/shop/use-product-query.js';
|
|
65
65
|
export { useProductsQuery } from './hooks/shop/use-products-query.js';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6982,6 +6982,7 @@ type ShopContextProps = {
|
|
|
6982
6982
|
provider?: 'BIGCOMMERCE' | 'SHOPIFY';
|
|
6983
6983
|
mobileOnly?: boolean;
|
|
6984
6984
|
swatches?: GlobalSwatchesData[];
|
|
6985
|
+
isStorefront?: boolean;
|
|
6985
6986
|
changeLocale: (locale: string) => void;
|
|
6986
6987
|
changeStorefrontInfo: (args: {
|
|
6987
6988
|
url?: string;
|
|
@@ -7316,6 +7317,7 @@ declare const getGlobalColorStyle: (data?: ColorValueType) => React.CSSPropertie
|
|
|
7316
7317
|
type TypographyClass = `g-${TypographyType}`;
|
|
7317
7318
|
declare const genTypoClass: (name: TypographyType) => TypographyClass;
|
|
7318
7319
|
|
|
7320
|
+
declare const getCornerCSSFromGlobal: (corner: CornerRadius) => React.CSSProperties;
|
|
7319
7321
|
declare const getRadiusCSSFromGlobal: (state: StateType, key?: RoundedSize, device?: NameDevices) => React.CSSProperties;
|
|
7320
7322
|
declare const getCustomRadius: (state: StateType, radius?: CornerRadius, device?: NameDevices) => React.CSSProperties;
|
|
7321
7323
|
declare const composeRadius: (value?: StateProp<CornerRadius> | ResponsiveStateProp<CornerRadius>) => React.CSSProperties;
|
|
@@ -7445,7 +7447,8 @@ declare const useEditorMode: () => RenderMode | undefined;
|
|
|
7445
7447
|
declare const useMobileOnly: () => boolean | undefined;
|
|
7446
7448
|
declare const useMatchMutate: () => (matcher: RegExp, ...args: any[]) => Promise<any[][]>;
|
|
7447
7449
|
declare function useConnectedShopify(): boolean;
|
|
7448
|
-
declare function useIsSampleProduct(): boolean;
|
|
7450
|
+
declare function useIsSampleProduct(): boolean | undefined;
|
|
7451
|
+
declare function useIsStorefrontProduct(): boolean | undefined;
|
|
7449
7452
|
declare function useCheckoutUrl(url?: string): string | undefined;
|
|
7450
7453
|
|
|
7451
7454
|
type Args$1 = {
|
|
@@ -7459,11 +7462,13 @@ declare const useCollectionQuery: (args: Args$1, options?: SWRConfiguration<Coll
|
|
|
7459
7462
|
declare const useProductQuery: (productId?: string, options?: SWRConfiguration<ProductSelectFragment>) => swr__internal.SWRResponse<ProductSelectFragment, any, Partial<swr__internal.PublicConfiguration<ProductSelectFragment, any, (arg: ["query/product", {
|
|
7460
7463
|
id?: string | undefined;
|
|
7461
7464
|
isSample?: boolean | undefined;
|
|
7465
|
+
isStorefront?: boolean | undefined;
|
|
7462
7466
|
}]) => swr__internal.FetcherResponse<ProductSelectFragment>>> | undefined>;
|
|
7463
7467
|
|
|
7464
7468
|
declare const useProductsQuery: (ids?: string[], options?: SWRConfiguration<ProductsQueryResponse>) => swr__internal.SWRResponse<ProductsQueryResponse, any, Partial<swr__internal.PublicConfiguration<ProductsQueryResponse, any, (arg: ["query/products", {
|
|
7465
7469
|
ids?: string[] | undefined;
|
|
7466
7470
|
isSample?: boolean | undefined;
|
|
7471
|
+
isStorefront?: boolean | undefined;
|
|
7467
7472
|
}]) => swr__internal.FetcherResponse<ProductsQueryResponse>>> | undefined>;
|
|
7468
7473
|
|
|
7469
7474
|
declare const useCurrentDevice: () => NameDevices;
|
|
@@ -7589,6 +7594,7 @@ type Args = {
|
|
|
7589
7594
|
numberOfProducts?: number;
|
|
7590
7595
|
orderBy?: OrderByType;
|
|
7591
7596
|
isSample?: boolean;
|
|
7597
|
+
isStorefront?: boolean;
|
|
7592
7598
|
};
|
|
7593
7599
|
declare const getCollection: (fetcher: FetchFunc, arg: Args) => Promise<CollectionDetailFilterQueryResponse>;
|
|
7594
7600
|
declare const calculateFirstProduct: (numberOfProducts: number, currentPage: number, productsPerPage: number) => number;
|
|
@@ -7596,17 +7602,18 @@ declare const calculateFirstProduct: (numberOfProducts: number, currentPage: num
|
|
|
7596
7602
|
type FetchParams = {
|
|
7597
7603
|
id?: string;
|
|
7598
7604
|
isSample?: boolean;
|
|
7605
|
+
isStorefront?: boolean;
|
|
7599
7606
|
};
|
|
7600
|
-
declare const getProduct: (fetcher: FetchFunc, { id, isSample }: FetchParams) => Promise<ProductSelectFragment>;
|
|
7607
|
+
declare const getProduct: (fetcher: FetchFunc, { id, isSample, isStorefront }: FetchParams) => Promise<ProductSelectFragment>;
|
|
7601
7608
|
type RequiredCursorEdge<T> = {
|
|
7602
7609
|
cursor: string;
|
|
7603
7610
|
node?: T;
|
|
7604
7611
|
};
|
|
7605
|
-
declare const fetchVariants: (fetcher: FetchFunc, { id, isSample }: FetchParams) => Promise<RequiredCursorEdge<VariantSelectFragment>[]>;
|
|
7606
|
-
declare const fetchMedias: (fetcher: FetchFunc, { id, isSample }: FetchParams) => Promise<(Pick<MediaEdge, "cursor"> & {
|
|
7612
|
+
declare const fetchVariants: (fetcher: FetchFunc, { id, isSample, isStorefront }: FetchParams) => Promise<RequiredCursorEdge<VariantSelectFragment>[]>;
|
|
7613
|
+
declare const fetchMedias: (fetcher: FetchFunc, { id, isSample, isStorefront }: FetchParams) => Promise<(Pick<MediaEdge, "cursor"> & {
|
|
7607
7614
|
node?: Maybe<Pick<Media, "width" | "height" | "id" | "contentType" | "src" | "alt">>;
|
|
7608
7615
|
})[]>;
|
|
7609
7616
|
|
|
7610
7617
|
declare const getProductBySlug: (fetcher: FetchFunc, slug?: string) => Promise<ProductSelectFragment>;
|
|
7611
7618
|
|
|
7612
|
-
export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, Border, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, 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, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, OptionNormalStyle, OptionSpecialStyle, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, RenderMemo as Render, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RoundedSize, 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, composeRadius, composeSize, composeSpacing, fetchMedias, fetchVariants, flattenConnection, fpixel, genTypoClass, genVariable, getCollection, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, globalEvent, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, isBrowser, isColor, isDefined, isEmptyChildren, isLocalEnv, loadScript, makeAspectRatio, makeHeight, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, prefetchQueries, props, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useIsSampleProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, 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 };
|
|
7619
|
+
export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, Border, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, 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, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, OptionNormalStyle, OptionSpecialStyle, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, RenderMemo as Render, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RoundedSize, 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, composeRadius, composeSize, composeSpacing, fetchMedias, fetchVariants, flattenConnection, fpixel, genTypoClass, genVariable, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, globalEvent, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, isBrowser, isColor, isDefined, isEmptyChildren, isLocalEnv, loadScript, makeAspectRatio, makeHeight, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, prefetchQueries, props, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useIsSampleProduct, useIsStorefrontProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, 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 };
|