@gem-sdk/core 1.0.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/components/AddOn.js +18 -0
- package/dist/cjs/components/ComponentWrapper.js +45 -0
- package/dist/cjs/components/ComponentWrapperPreview.js +58 -0
- package/dist/cjs/components/Empty.js +7 -0
- package/dist/cjs/components/Render.js +28 -0
- package/dist/cjs/components/RenderBlock.js +21 -0
- package/dist/cjs/components/RenderPreview.js +28 -0
- package/dist/cjs/components/RenderSection.js +19 -0
- package/dist/cjs/contexts/AddonContext.js +25 -0
- package/dist/cjs/contexts/BuilderComponent.js +30 -0
- package/dist/cjs/contexts/BuilderContext.js +29 -0
- package/dist/cjs/contexts/BuilderPreviewContext.js +353 -0
- package/dist/cjs/contexts/CartLineContext.js +24 -0
- package/dist/cjs/contexts/CollectionContext.js +24 -0
- package/dist/cjs/contexts/ProductContext.js +126 -0
- package/dist/cjs/contexts/ProductListContext.js +24 -0
- package/dist/cjs/contexts/SectionContext.js +49 -0
- package/dist/cjs/contexts/ShopContext.js +43 -0
- package/dist/cjs/graphql/fragments/analytic.generated.js +11 -0
- package/dist/cjs/graphql/fragments/collection-detail.generated.js +13 -0
- package/dist/cjs/graphql/fragments/collection-product.generated.js +26 -0
- package/dist/cjs/graphql/fragments/data-seo.generated.js +11 -0
- package/dist/cjs/graphql/fragments/media.generated.js +14 -0
- package/dist/cjs/graphql/fragments/product-little.generated.js +25 -0
- package/dist/cjs/graphql/fragments/product-option-value.generated.js +13 -0
- package/dist/cjs/graphql/fragments/product-option.generated.js +14 -0
- package/dist/cjs/graphql/fragments/product.generated.js +33 -0
- package/dist/cjs/graphql/fragments/published-custom-section.generated.js +12 -0
- package/dist/cjs/graphql/fragments/published-page-section.generated.js +11 -0
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +27 -0
- package/dist/cjs/graphql/fragments/published-theme-style.generated.js +11 -0
- package/dist/cjs/graphql/fragments/selected-option.generated.js +11 -0
- package/dist/cjs/graphql/fragments/variant.generated.js +35 -0
- package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +34 -0
- package/dist/cjs/graphql/queries/collection.generated.js +52 -0
- package/dist/cjs/graphql/queries/preview-page.generated.js +23 -0
- package/dist/cjs/graphql/queries/product-little-detail.generated.js +24 -0
- package/dist/cjs/graphql/queries/product-medias.generated.js +29 -0
- package/dist/cjs/graphql/queries/product-variants.generated.js +33 -0
- package/dist/cjs/graphql/queries/products.generated.js +41 -0
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +23 -0
- package/dist/cjs/graphql/queries/storeProperty.generated.js +12 -0
- package/dist/cjs/helpers/GlobalEvent.js +17 -0
- package/dist/cjs/helpers/background.js +104 -0
- package/dist/cjs/helpers/borders.js +138 -0
- package/dist/cjs/helpers/clone-deep.js +5 -0
- package/dist/cjs/helpers/cls.js +20 -0
- package/dist/cjs/helpers/colors.js +157 -0
- package/dist/cjs/helpers/compose-advance-style.js +132 -0
- package/dist/cjs/helpers/constant.js +17 -0
- package/dist/cjs/helpers/css-variable.js +7 -0
- package/dist/cjs/helpers/email.js +11 -0
- package/dist/cjs/helpers/flatten-connection.js +10 -0
- package/dist/cjs/helpers/fpixel.js +29 -0
- package/dist/cjs/helpers/get-resonsive-value.js +32 -0
- package/dist/cjs/helpers/get-shortname.js +92 -0
- package/dist/cjs/helpers/gtag.js +48 -0
- package/dist/cjs/helpers/is-browser.js +9 -0
- package/dist/cjs/helpers/is-defined.js +7 -0
- package/dist/cjs/helpers/is-empty-children.js +12 -0
- package/dist/cjs/helpers/layout.js +17 -0
- package/dist/cjs/helpers/load-script.js +32 -0
- package/dist/cjs/helpers/make-style.js +99 -0
- package/dist/cjs/helpers/normalize-builder-data.js +17 -0
- package/dist/cjs/helpers/prefetch-queries.js +68 -0
- package/dist/cjs/helpers/product.js +35 -0
- package/dist/cjs/helpers/queries/get-collection.js +173 -0
- package/dist/cjs/helpers/queries/get-product-by-slug.js +99 -0
- package/dist/cjs/helpers/queries/get-product.js +113 -0
- package/dist/cjs/helpers/queries/get-products.js +135 -0
- package/dist/cjs/helpers/radius.js +91 -0
- package/dist/cjs/helpers/shadow.js +48 -0
- package/dist/cjs/helpers/size.js +20 -0
- package/dist/cjs/helpers/spacing.js +45 -0
- package/dist/cjs/helpers/tiktokpixel.js +17 -0
- package/dist/cjs/helpers/typography.js +7 -0
- package/dist/cjs/hooks/cart/use-add-to-cart.js +20 -0
- package/dist/cjs/hooks/cart/use-cart-data.js +26 -0
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +20 -0
- package/dist/cjs/hooks/cart/use-cart-note-update.js +20 -0
- package/dist/cjs/hooks/cart/use-create-cart.js +22 -0
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +20 -0
- package/dist/cjs/hooks/cart/use-update-cart-item.js +20 -0
- package/dist/cjs/hooks/shop/use-collection-query.js +16 -0
- package/dist/cjs/hooks/shop/use-product-query.js +16 -0
- package/dist/cjs/hooks/shop/use-products-query.js +16 -0
- package/dist/cjs/hooks/shop.js +80 -0
- package/dist/cjs/hooks/use-current-device.js +23 -0
- package/dist/cjs/hooks/use-lazy-video.js +15 -0
- package/dist/cjs/hooks/useCartId.js +36 -0
- package/dist/cjs/hooks/useCartLine.js +11 -0
- package/dist/cjs/hooks/useCartUI.js +42 -0
- package/dist/cjs/hooks/useCollection.js +9 -0
- package/dist/cjs/hooks/useFetchHandle.js +13 -0
- package/dist/cjs/hooks/useFormatMoney.js +17 -0
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +10 -0
- package/dist/cjs/hooks/useLoadScript.js +30 -0
- package/dist/cjs/hooks/useMoney.js +52 -0
- package/dist/cjs/hooks/usePrevious.js +17 -0
- package/dist/cjs/hooks/useProduct.js +90 -0
- package/dist/cjs/hooks/useProductList.js +21 -0
- package/dist/cjs/hooks/useSuspenseFetch.js +24 -0
- package/dist/cjs/hooks/useSwatchesOptions.js +39 -0
- package/dist/cjs/index.js +229 -0
- package/dist/cjs/types/global-style.js +7 -0
- package/dist/cjs/types/shop.js +2 -0
- package/dist/esm/components/AddOn.js +14 -0
- package/dist/esm/components/ComponentWrapper.js +40 -0
- package/dist/esm/components/ComponentWrapperPreview.js +54 -0
- package/dist/esm/components/Empty.js +3 -0
- package/dist/esm/components/Render.js +24 -0
- package/dist/esm/components/RenderBlock.js +17 -0
- package/dist/esm/components/RenderPreview.js +24 -0
- package/dist/esm/components/RenderSection.js +15 -0
- package/dist/esm/contexts/AddonContext.js +21 -0
- package/dist/esm/contexts/BuilderComponent.js +27 -0
- package/dist/esm/contexts/BuilderContext.js +26 -0
- package/dist/esm/contexts/BuilderPreviewContext.js +350 -0
- package/dist/esm/contexts/CartLineContext.js +21 -0
- package/dist/esm/contexts/CollectionContext.js +20 -0
- package/dist/esm/contexts/ProductContext.js +123 -0
- package/dist/esm/contexts/ProductListContext.js +20 -0
- package/dist/esm/contexts/SectionContext.js +45 -0
- package/dist/esm/contexts/ShopContext.js +40 -0
- package/dist/esm/graphql/fragments/analytic.generated.js +9 -0
- package/dist/esm/graphql/fragments/collection-detail.generated.js +11 -0
- package/dist/esm/graphql/fragments/collection-product.generated.js +24 -0
- package/dist/esm/graphql/fragments/data-seo.generated.js +9 -0
- package/dist/esm/graphql/fragments/media.generated.js +12 -0
- package/dist/esm/graphql/fragments/product-little.generated.js +23 -0
- package/dist/esm/graphql/fragments/product-option-value.generated.js +11 -0
- package/dist/esm/graphql/fragments/product-option.generated.js +12 -0
- package/dist/esm/graphql/fragments/product.generated.js +31 -0
- package/dist/esm/graphql/fragments/published-custom-section.generated.js +10 -0
- package/dist/esm/graphql/fragments/published-page-section.generated.js +9 -0
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +25 -0
- package/dist/esm/graphql/fragments/published-theme-style.generated.js +9 -0
- package/dist/esm/graphql/fragments/selected-option.generated.js +9 -0
- package/dist/esm/graphql/fragments/variant.generated.js +33 -0
- package/dist/esm/graphql/queries/collection-detail-filter.generated.js +32 -0
- package/dist/esm/graphql/queries/collection.generated.js +50 -0
- package/dist/esm/graphql/queries/preview-page.generated.js +21 -0
- package/dist/esm/graphql/queries/product-little-detail.generated.js +22 -0
- package/dist/esm/graphql/queries/product-medias.generated.js +27 -0
- package/dist/esm/graphql/queries/product-variants.generated.js +31 -0
- package/dist/esm/graphql/queries/products.generated.js +38 -0
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +21 -0
- package/dist/esm/graphql/queries/storeProperty.generated.js +10 -0
- package/dist/esm/helpers/GlobalEvent.js +13 -0
- package/dist/esm/helpers/background.js +102 -0
- package/dist/esm/helpers/borders.js +133 -0
- package/dist/esm/helpers/clone-deep.js +3 -0
- package/dist/esm/helpers/cls.js +18 -0
- package/dist/esm/helpers/colors.js +145 -0
- package/dist/esm/helpers/compose-advance-style.js +130 -0
- package/dist/esm/helpers/constant.js +13 -0
- package/dist/esm/helpers/css-variable.js +5 -0
- package/dist/esm/helpers/email.js +6 -0
- package/dist/esm/helpers/flatten-connection.js +8 -0
- package/dist/esm/helpers/fpixel.js +25 -0
- package/dist/esm/helpers/get-resonsive-value.js +28 -0
- package/dist/esm/helpers/get-shortname.js +90 -0
- package/dist/esm/helpers/gtag.js +45 -0
- package/dist/esm/helpers/is-browser.js +5 -0
- package/dist/esm/helpers/is-defined.js +5 -0
- package/dist/esm/helpers/is-empty-children.js +7 -0
- package/dist/esm/helpers/layout.js +15 -0
- package/dist/esm/helpers/load-script.js +30 -0
- package/dist/esm/helpers/make-style.js +91 -0
- package/dist/esm/helpers/normalize-builder-data.js +15 -0
- package/dist/esm/helpers/prefetch-queries.js +66 -0
- package/dist/esm/helpers/product.js +32 -0
- package/dist/esm/helpers/queries/get-collection.js +170 -0
- package/dist/esm/helpers/queries/get-product-by-slug.js +97 -0
- package/dist/esm/helpers/queries/get-product.js +109 -0
- package/dist/esm/helpers/queries/get-products.js +133 -0
- package/dist/esm/helpers/radius.js +86 -0
- package/dist/esm/helpers/shadow.js +45 -0
- package/dist/esm/helpers/size.js +18 -0
- package/dist/esm/helpers/spacing.js +42 -0
- package/dist/esm/helpers/tiktokpixel.js +15 -0
- package/dist/esm/helpers/typography.js +5 -0
- package/dist/esm/hooks/cart/use-add-to-cart.js +18 -0
- package/dist/esm/hooks/cart/use-cart-data.js +24 -0
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +18 -0
- package/dist/esm/hooks/cart/use-cart-note-update.js +18 -0
- package/dist/esm/hooks/cart/use-create-cart.js +20 -0
- package/dist/esm/hooks/cart/use-remove-cart-item.js +18 -0
- package/dist/esm/hooks/cart/use-update-cart-item.js +18 -0
- package/dist/esm/hooks/shop/use-collection-query.js +14 -0
- package/dist/esm/hooks/shop/use-product-query.js +14 -0
- package/dist/esm/hooks/shop/use-products-query.js +14 -0
- package/dist/esm/hooks/shop.js +68 -0
- package/dist/esm/hooks/use-current-device.js +21 -0
- package/dist/esm/hooks/use-lazy-video.js +13 -0
- package/dist/esm/hooks/useCartId.js +32 -0
- package/dist/esm/hooks/useCartLine.js +7 -0
- package/dist/esm/hooks/useCartUI.js +38 -0
- package/dist/esm/hooks/useCollection.js +7 -0
- package/dist/esm/hooks/useFetchHandle.js +11 -0
- package/dist/esm/hooks/useFormatMoney.js +13 -0
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +6 -0
- package/dist/esm/hooks/useLoadScript.js +26 -0
- package/dist/esm/hooks/useMoney.js +48 -0
- package/dist/esm/hooks/usePrevious.js +15 -0
- package/dist/esm/hooks/useProduct.js +78 -0
- package/dist/esm/hooks/useProductList.js +16 -0
- package/dist/esm/hooks/useSuspenseFetch.js +20 -0
- package/dist/esm/hooks/useSwatchesOptions.js +35 -0
- package/dist/esm/index.js +82 -0
- package/dist/esm/types/global-style.js +4 -0
- package/dist/esm/types/shop.js +1 -0
- package/dist/types/index.d.ts +7393 -0
- package/package.json +50 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { ProductsDocument } from '../../graphql/queries/products.generated.js';
|
|
2
|
+
import { calculateFirstProduct } from './get-collection.js';
|
|
3
|
+
import { fetchVariants, fetchMedias } from './get-product.js';
|
|
4
|
+
|
|
5
|
+
const getProducts = async (fetcher, { ids, isSample }) => {
|
|
6
|
+
const products = await loopFetchProducts(fetcher, { ids, isSample });
|
|
7
|
+
if (!products) {
|
|
8
|
+
throw new Error('Product not found');
|
|
9
|
+
}
|
|
10
|
+
const [mergedVariant, mergedMedias] = await Promise.all([
|
|
11
|
+
mergeVariantsToProducts(fetcher, products, isSample),
|
|
12
|
+
mergeMediasToProducts(fetcher, products, isSample),
|
|
13
|
+
]);
|
|
14
|
+
return { ...mergedMedias, ...mergedVariant };
|
|
15
|
+
};
|
|
16
|
+
const fetchProducts = async (fetcher, variables) => {
|
|
17
|
+
return fetcher([ProductsDocument, variables]);
|
|
18
|
+
};
|
|
19
|
+
const loopFetchProducts = async (fetcher, { ids, isSample }) => {
|
|
20
|
+
const numberOfProducts = (ids?.length == 0 ? 4 : ids?.length) ?? 4;
|
|
21
|
+
const productsPerPage = 8; // number of products per page
|
|
22
|
+
let variables; // variables of collection query
|
|
23
|
+
let productAfterFetcher; // product after of collection query
|
|
24
|
+
let dataProducts; // data of collection query
|
|
25
|
+
let hasNextPage; //
|
|
26
|
+
let firstProducts;
|
|
27
|
+
let currentPage = 1;
|
|
28
|
+
// counter number of queries
|
|
29
|
+
const pages = Math.ceil(numberOfProducts / productsPerPage);
|
|
30
|
+
while (currentPage <= pages && hasNextPage !== false) {
|
|
31
|
+
variables = {
|
|
32
|
+
first: calculateFirstProduct(numberOfProducts, currentPage, productsPerPage),
|
|
33
|
+
firstMedia: 1,
|
|
34
|
+
firstVariant: 1,
|
|
35
|
+
orderBy: {
|
|
36
|
+
direction: 'DESC',
|
|
37
|
+
field: 'UPDATED_AT',
|
|
38
|
+
},
|
|
39
|
+
where: {
|
|
40
|
+
isStorefront: true,
|
|
41
|
+
isSample: isSample,
|
|
42
|
+
...(ids?.length ? { baseIDIn: ids.sort() } : {}),
|
|
43
|
+
},
|
|
44
|
+
after: productAfterFetcher,
|
|
45
|
+
};
|
|
46
|
+
const pageData = await fetchProducts(fetcher, variables);
|
|
47
|
+
productAfterFetcher = pageData?.products?.pageInfo?.endCursor;
|
|
48
|
+
if (currentPage === 1) {
|
|
49
|
+
dataProducts = pageData; // set data of first page
|
|
50
|
+
firstProducts = pageData;
|
|
51
|
+
}
|
|
52
|
+
else if (firstProducts?.products && pageData?.products?.edges.length) {
|
|
53
|
+
// concat new values to the old ones
|
|
54
|
+
firstProducts.products = {
|
|
55
|
+
edges: firstProducts.products.edges.concat(pageData?.products?.edges),
|
|
56
|
+
pageInfo: pageData?.products?.pageInfo,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
currentPage++;
|
|
60
|
+
// hasNextPage = false if there is no more pages then break the loop
|
|
61
|
+
if (!firstProducts) {
|
|
62
|
+
hasNextPage = false;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return dataProducts;
|
|
67
|
+
};
|
|
68
|
+
const mergeVariantsToProducts = async (fetcher, products, isSample) => {
|
|
69
|
+
const productsWithVariants = await Promise.all(products?.products?.edges?.map(async (product) => {
|
|
70
|
+
return fetchVariants(fetcher, { id: product?.node?.baseID, isSample }).then((variants) => {
|
|
71
|
+
const res = {
|
|
72
|
+
...product,
|
|
73
|
+
...(product.node
|
|
74
|
+
? {
|
|
75
|
+
node: {
|
|
76
|
+
...product.node,
|
|
77
|
+
variants: variants.length ? { edges: variants } : undefined,
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
: {}),
|
|
81
|
+
};
|
|
82
|
+
return res;
|
|
83
|
+
});
|
|
84
|
+
}) ?? []).then((res) => {
|
|
85
|
+
return {
|
|
86
|
+
products: {
|
|
87
|
+
edges: res,
|
|
88
|
+
pageInfo: products?.products?.pageInfo,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
return productsWithVariants;
|
|
93
|
+
};
|
|
94
|
+
const mergeMediasToProducts = async (fetcher, products, isSample) => {
|
|
95
|
+
const productsWithMedias = await Promise.all(products?.products?.edges?.map(async (product) => {
|
|
96
|
+
return fetchMedias(fetcher, { id: product?.node?.baseID, isSample }).then((media) => {
|
|
97
|
+
const res = {
|
|
98
|
+
...product,
|
|
99
|
+
...(product.node
|
|
100
|
+
? {
|
|
101
|
+
node: {
|
|
102
|
+
...product.node,
|
|
103
|
+
medias: media.length ? { edges: media } : undefined,
|
|
104
|
+
},
|
|
105
|
+
}
|
|
106
|
+
: {}),
|
|
107
|
+
};
|
|
108
|
+
return res;
|
|
109
|
+
});
|
|
110
|
+
}) ?? []).then((res) => {
|
|
111
|
+
return {
|
|
112
|
+
products: {
|
|
113
|
+
edges: res,
|
|
114
|
+
pageInfo: products?.products?.pageInfo,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
return productsWithMedias;
|
|
119
|
+
};
|
|
120
|
+
// future can be used for fetching products with paging ids
|
|
121
|
+
// const pagingQuery = (
|
|
122
|
+
// data: string[],
|
|
123
|
+
// currentPage: number,
|
|
124
|
+
// productsPerPage: number,
|
|
125
|
+
// first: number,
|
|
126
|
+
// ): string[] => {
|
|
127
|
+
// return data.slice(
|
|
128
|
+
// (currentPage - 1) * productsPerPage,
|
|
129
|
+
// (currentPage - 1) * productsPerPage + first,
|
|
130
|
+
// );
|
|
131
|
+
// };
|
|
132
|
+
|
|
133
|
+
export { getProducts };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { devicesMapping, stateMapping } from './constant.js';
|
|
2
|
+
|
|
3
|
+
const getRadiusCSSFromGlobal = (state, key, device) => {
|
|
4
|
+
if (!key || !state)
|
|
5
|
+
return {};
|
|
6
|
+
const suffix = device && device !== 'desktop' ? devicesMapping?.[device] : '';
|
|
7
|
+
const mState = stateMapping?.[state];
|
|
8
|
+
return {
|
|
9
|
+
[`-${mState}-radius${suffix}`]: `var(--g-radius-${key})`,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
const getCustomRadius = (state, radius, device) => {
|
|
13
|
+
if (!radius || !state)
|
|
14
|
+
return {};
|
|
15
|
+
const suffix = device && device !== 'desktop' ? devicesMapping?.[device] : '';
|
|
16
|
+
const mState = stateMapping?.[state];
|
|
17
|
+
return {
|
|
18
|
+
[`-${mState}-bblr${suffix}`]: radius.bblr,
|
|
19
|
+
[`-${mState}-bbrr${suffix}`]: radius.bbrr,
|
|
20
|
+
[`-${mState}-btlr${suffix}`]: radius.btlr,
|
|
21
|
+
[`-${mState}-btrr${suffix}`]: radius.btrr,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const composeRadius = (value) => {
|
|
25
|
+
if (!value)
|
|
26
|
+
return {};
|
|
27
|
+
if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
|
|
28
|
+
return composeRadiusResponsiveState(value);
|
|
29
|
+
}
|
|
30
|
+
return composeRadiusState(value);
|
|
31
|
+
};
|
|
32
|
+
const composeRadiusState = (radiusValue, device) => {
|
|
33
|
+
const style = {};
|
|
34
|
+
switch (radiusValue?.normal?.radiusType) {
|
|
35
|
+
case 'medium':
|
|
36
|
+
case 'large':
|
|
37
|
+
case 'small':
|
|
38
|
+
Object.assign(style, getRadiusCSSFromGlobal('normal', radiusValue?.normal?.radiusType, device));
|
|
39
|
+
break;
|
|
40
|
+
case 'circle':
|
|
41
|
+
case 'none':
|
|
42
|
+
case 'custom':
|
|
43
|
+
Object.assign(style, getCustomRadius('normal', radiusValue.normal, device));
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
switch (radiusValue?.hover?.radiusType) {
|
|
47
|
+
case 'medium':
|
|
48
|
+
case 'large':
|
|
49
|
+
case 'small':
|
|
50
|
+
Object.assign(style, getRadiusCSSFromGlobal('hover', radiusValue?.hover?.radiusType, device));
|
|
51
|
+
break;
|
|
52
|
+
case 'circle':
|
|
53
|
+
case 'none':
|
|
54
|
+
case 'custom':
|
|
55
|
+
Object.assign(style, getCustomRadius('hover', radiusValue.hover, device));
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
switch (radiusValue?.focus?.radiusType) {
|
|
59
|
+
case 'medium':
|
|
60
|
+
case 'large':
|
|
61
|
+
case 'small':
|
|
62
|
+
Object.assign(style, getRadiusCSSFromGlobal('focus', radiusValue?.focus?.radiusType, device));
|
|
63
|
+
break;
|
|
64
|
+
case 'circle':
|
|
65
|
+
case 'none':
|
|
66
|
+
case 'custom':
|
|
67
|
+
Object.assign(style, getCustomRadius('focus', radiusValue.focus, device));
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
return style;
|
|
71
|
+
};
|
|
72
|
+
const composeRadiusResponsiveState = (radiusValue) => {
|
|
73
|
+
const style = {};
|
|
74
|
+
Object.assign(style, composeRadiusState(radiusValue?.desktop, 'desktop'));
|
|
75
|
+
Object.assign(style, composeRadiusState(radiusValue?.tablet, 'tablet'));
|
|
76
|
+
Object.assign(style, composeRadiusState(radiusValue?.mobile, 'mobile'));
|
|
77
|
+
return style;
|
|
78
|
+
};
|
|
79
|
+
const getRadiusStyleActiveState = (radiusValue) => {
|
|
80
|
+
if (radiusValue?.active?.radiusType === 'custom') {
|
|
81
|
+
return getCustomRadius('normal', radiusValue?.active);
|
|
82
|
+
}
|
|
83
|
+
return getRadiusCSSFromGlobal('normal', radiusValue?.active?.radiusType);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export { composeRadius, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getSingleColorVariable } from './colors.js';
|
|
2
|
+
import { stateMapping } from './constant.js';
|
|
3
|
+
import { getShortName } from './get-shortname.js';
|
|
4
|
+
|
|
5
|
+
const parseValueWithUnit = (valueWithUnit) => {
|
|
6
|
+
const matches = valueWithUnit.match(/(\d+)(.+)/);
|
|
7
|
+
if (matches && matches.length === 3) {
|
|
8
|
+
const value = Number(matches[1] ?? 0);
|
|
9
|
+
const unit = matches[2];
|
|
10
|
+
return { value, unit: unit ?? 'px' };
|
|
11
|
+
}
|
|
12
|
+
return { value: 0, unit: 'px' };
|
|
13
|
+
};
|
|
14
|
+
const getStyleShadow = (shadowStyle, isActiveState = false) => {
|
|
15
|
+
const { styleAppliedFor, value, isEnableShadow } = shadowStyle || {};
|
|
16
|
+
let { state } = shadowStyle || {};
|
|
17
|
+
if (!state)
|
|
18
|
+
state = 'normal';
|
|
19
|
+
if (!styleAppliedFor || !value)
|
|
20
|
+
return {};
|
|
21
|
+
if (typeof value.distance == 'undefined')
|
|
22
|
+
return {};
|
|
23
|
+
const { value: distance, unit: unitDistance } = parseValueWithUnit(`${value?.distance}`);
|
|
24
|
+
return {
|
|
25
|
+
[`-${!isActiveState ? stateMapping?.[state] : ''}-${getShortName(styleAppliedFor)}`]: isEnableShadow
|
|
26
|
+
? `${Math.cos((parseFloat(`${value?.angle}`) * Math.PI) / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin((parseFloat(`${value?.angle}`) * Math.PI) / 180) * parseFloat(`${distance}`)}${unitDistance} ${value?.blur} ${styleAppliedFor === 'box-shadow' ? value?.spread + ' ' : ''}${getSingleColorVariable(value?.color)}`
|
|
27
|
+
: 'none',
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow) => {
|
|
31
|
+
if (!shadow || !styleAppliedFor)
|
|
32
|
+
return {};
|
|
33
|
+
const style = {};
|
|
34
|
+
for (const [key, value] of Object.entries(shadow)) {
|
|
35
|
+
Object.assign(style, getStyleShadow({
|
|
36
|
+
value: value,
|
|
37
|
+
state: key,
|
|
38
|
+
styleAppliedFor,
|
|
39
|
+
isEnableShadow: isEnableShadow?.[key],
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
return style;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { getStyleShadow, getStyleShadowState };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { devicesMapping } from './constant.js';
|
|
2
|
+
|
|
3
|
+
function getCustomSizeCSSByDevice(size, device) {
|
|
4
|
+
if (!size || !device)
|
|
5
|
+
return {};
|
|
6
|
+
const suffix = devicesMapping[device] ?? '';
|
|
7
|
+
return {
|
|
8
|
+
[`--pl${suffix}`]: size?.[device]?.horizontal,
|
|
9
|
+
[`--pr${suffix}`]: size?.[device]?.horizontal,
|
|
10
|
+
[`--pt${suffix}`]: size?.[device]?.vertical,
|
|
11
|
+
[`--pb${suffix}`]: size?.[device]?.vertical,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const composeSize = (size) => {
|
|
15
|
+
return Object.assign({}, getCustomSizeCSSByDevice(size, 'desktop'), getCustomSizeCSSByDevice(size, 'tablet'), getCustomSizeCSSByDevice(size, 'mobile'));
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { composeSize };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { devicesMapping } from './constant.js';
|
|
2
|
+
|
|
3
|
+
function getSpacingCSSByType(key, device) {
|
|
4
|
+
if (!key)
|
|
5
|
+
return {};
|
|
6
|
+
const suffix = device ? devicesMapping?.[device] ?? '' : '';
|
|
7
|
+
return {
|
|
8
|
+
[`--p${suffix}`]: `var(--g-s-${key})`,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function getSpacingVariable(key) {
|
|
12
|
+
if (!key)
|
|
13
|
+
return '';
|
|
14
|
+
return `var(--g-s-${key})`;
|
|
15
|
+
}
|
|
16
|
+
const composeSpacing = (spacingValue) => {
|
|
17
|
+
const style = {};
|
|
18
|
+
switch (spacingValue?.desktop) {
|
|
19
|
+
case 'm':
|
|
20
|
+
case 'l':
|
|
21
|
+
case 's':
|
|
22
|
+
Object.assign(style, getSpacingCSSByType(spacingValue.desktop));
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
switch (spacingValue?.tablet) {
|
|
26
|
+
case 'm':
|
|
27
|
+
case 'l':
|
|
28
|
+
case 's':
|
|
29
|
+
Object.assign(style, getSpacingCSSByType(spacingValue.tablet, 'tablet'));
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
switch (spacingValue?.mobile) {
|
|
33
|
+
case 'm':
|
|
34
|
+
case 'l':
|
|
35
|
+
case 's':
|
|
36
|
+
Object.assign(style, getSpacingCSSByType(spacingValue.mobile, 'mobile'));
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
return style;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { composeSpacing, getSpacingVariable };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const addToCart = (product) => {
|
|
2
|
+
if (!window?.ttq?.track)
|
|
3
|
+
return;
|
|
4
|
+
window.ttq.track('AddToCart', {
|
|
5
|
+
content_id: product.id,
|
|
6
|
+
content_type: 'product',
|
|
7
|
+
content_name: product.name,
|
|
8
|
+
quantity: product.quantity,
|
|
9
|
+
price: product.price,
|
|
10
|
+
value: (product.price ?? 0) * (product.quantity ?? 0),
|
|
11
|
+
currency: product.currency,
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { addToCart };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { addToCartOperation } from '@gem-sdk/adapter-shopify';
|
|
2
|
+
import { useSWRConfig } from 'swr';
|
|
3
|
+
import useSWRMutation from 'swr/mutation';
|
|
4
|
+
import { useStoreFront } from '../shop.js';
|
|
5
|
+
|
|
6
|
+
const useAddToCart = (options) => {
|
|
7
|
+
const shop = useStoreFront();
|
|
8
|
+
const { mutate } = useSWRConfig();
|
|
9
|
+
return useSWRMutation('add-to-cart', (_, { arg }) => addToCartOperation(shop)(arg), {
|
|
10
|
+
...options,
|
|
11
|
+
onSuccess: (result, key, config) => {
|
|
12
|
+
mutate('cart', result, false);
|
|
13
|
+
options?.onSuccess?.(result, key, config);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { useAddToCart };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getCartOperation } from '@gem-sdk/adapter-shopify';
|
|
2
|
+
import useSWR from 'swr';
|
|
3
|
+
import { useStoreFront } from '../shop.js';
|
|
4
|
+
import useCartId from '../useCartId.js';
|
|
5
|
+
|
|
6
|
+
const useCartData = (options) => {
|
|
7
|
+
const { cartId, clearCartId } = useCartId();
|
|
8
|
+
const shop = useStoreFront();
|
|
9
|
+
return useSWR(cartId ? 'cart' : null, () => getCartOperation(shop)({ cartId: cartId }), {
|
|
10
|
+
revalidateOnMount: true,
|
|
11
|
+
revalidateOnFocus: true,
|
|
12
|
+
keepPreviousData: false,
|
|
13
|
+
dedupingInterval: 2000,
|
|
14
|
+
...options,
|
|
15
|
+
onSuccess(data, key, config) {
|
|
16
|
+
if (!data) {
|
|
17
|
+
clearCartId();
|
|
18
|
+
}
|
|
19
|
+
options?.onSuccess?.(data, key, config);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { useCartData };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { cartDiscountCodesUpdateOperation } from '@gem-sdk/adapter-shopify';
|
|
2
|
+
import { useSWRConfig } from 'swr';
|
|
3
|
+
import useSWRMutation from 'swr/mutation';
|
|
4
|
+
import { useStoreFront } from '../shop.js';
|
|
5
|
+
|
|
6
|
+
const useCartDiscountCodesUpdate = (options) => {
|
|
7
|
+
const shop = useStoreFront();
|
|
8
|
+
const { mutate } = useSWRConfig();
|
|
9
|
+
return useSWRMutation('cart-discount-codes-update', (_, { arg }) => cartDiscountCodesUpdateOperation(shop)(arg), {
|
|
10
|
+
...options,
|
|
11
|
+
onSuccess: (result, key, config) => {
|
|
12
|
+
mutate('cart', result, false);
|
|
13
|
+
options?.onSuccess?.(result, key, config);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { useCartDiscountCodesUpdate };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { cartNoteUpdateOperation } from '@gem-sdk/adapter-shopify';
|
|
2
|
+
import { useSWRConfig } from 'swr';
|
|
3
|
+
import useSWRMutation from 'swr/mutation';
|
|
4
|
+
import { useStoreFront } from '../shop.js';
|
|
5
|
+
|
|
6
|
+
const useCartNoteUpdate = (options) => {
|
|
7
|
+
const shop = useStoreFront();
|
|
8
|
+
const { mutate } = useSWRConfig();
|
|
9
|
+
return useSWRMutation('cart-note-update', (_, { arg }) => cartNoteUpdateOperation(shop)(arg), {
|
|
10
|
+
...options,
|
|
11
|
+
onSuccess: (result, key, config) => {
|
|
12
|
+
mutate('cart', result, false);
|
|
13
|
+
options?.onSuccess?.(result, key, config);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { useCartNoteUpdate };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createCartOperation } from '@gem-sdk/adapter-shopify';
|
|
2
|
+
import { useSWRConfig } from 'swr';
|
|
3
|
+
import useSWRMutation from 'swr/mutation';
|
|
4
|
+
import { useStoreFront } from '../shop.js';
|
|
5
|
+
|
|
6
|
+
const useCreateCart = (options) => {
|
|
7
|
+
const shop = useStoreFront();
|
|
8
|
+
const { mutate } = useSWRConfig();
|
|
9
|
+
return useSWRMutation('create-cart', (_, { arg }) => {
|
|
10
|
+
return createCartOperation(shop)(arg);
|
|
11
|
+
}, {
|
|
12
|
+
...options,
|
|
13
|
+
onSuccess: (result, key, config) => {
|
|
14
|
+
mutate('cart', result, false);
|
|
15
|
+
options?.onSuccess?.(result, key, config);
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { useCreateCart };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { removeCartItemOperation } from '@gem-sdk/adapter-shopify';
|
|
2
|
+
import { useSWRConfig } from 'swr';
|
|
3
|
+
import useSWRMutation from 'swr/mutation';
|
|
4
|
+
import { useStoreFront } from '../shop.js';
|
|
5
|
+
|
|
6
|
+
const useRemoveCartItem = (options) => {
|
|
7
|
+
const shop = useStoreFront();
|
|
8
|
+
const { mutate } = useSWRConfig();
|
|
9
|
+
return useSWRMutation('remove-cart-item', (_, { arg }) => removeCartItemOperation(shop)(arg), {
|
|
10
|
+
...options,
|
|
11
|
+
onSuccess: (result, key, config) => {
|
|
12
|
+
mutate('cart', result, false);
|
|
13
|
+
options?.onSuccess?.(result, key, config);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { useRemoveCartItem };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { updateCartLineOperation } from '@gem-sdk/adapter-shopify';
|
|
2
|
+
import { useSWRConfig } from 'swr';
|
|
3
|
+
import useSWRMutation from 'swr/mutation';
|
|
4
|
+
import { useStoreFront } from '../shop.js';
|
|
5
|
+
|
|
6
|
+
const useUpdateCartItem = (options) => {
|
|
7
|
+
const shop = useStoreFront();
|
|
8
|
+
const { mutate } = useSWRConfig();
|
|
9
|
+
return useSWRMutation('update-cart-item', (_, { arg }) => updateCartLineOperation(shop)(arg), {
|
|
10
|
+
...options,
|
|
11
|
+
onSuccess: (result, key, config) => {
|
|
12
|
+
mutate('cart', result, false);
|
|
13
|
+
options?.onSuccess?.(result, key, config);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { useUpdateCartItem };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import useSWR from 'swr';
|
|
2
|
+
import { getCollection } from '../../helpers/queries/get-collection.js';
|
|
3
|
+
import { useIsSampleProduct } from '../shop.js';
|
|
4
|
+
import { useFetchHandle } from '../useFetchHandle.js';
|
|
5
|
+
|
|
6
|
+
const useCollectionQuery = (args, options) => {
|
|
7
|
+
const fetcher = useFetchHandle();
|
|
8
|
+
const isSample = useIsSampleProduct();
|
|
9
|
+
return useSWR(['query/collection', { ...args, isSample }], ([, arg]) => {
|
|
10
|
+
return getCollection(fetcher, arg);
|
|
11
|
+
}, options);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { useCollectionQuery };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import useSWR from 'swr';
|
|
2
|
+
import { getProduct } from '../../helpers/queries/get-product.js';
|
|
3
|
+
import { useIsSampleProduct } from '../shop.js';
|
|
4
|
+
import { useFetchHandle } from '../useFetchHandle.js';
|
|
5
|
+
|
|
6
|
+
const useProductQuery = (productId, options) => {
|
|
7
|
+
const fetcher = useFetchHandle();
|
|
8
|
+
const isSample = useIsSampleProduct();
|
|
9
|
+
return useSWR(productId ? ['query/product', { id: productId ?? 'latest', isSample }] : null, async ([, arg]) => {
|
|
10
|
+
return getProduct(fetcher, arg);
|
|
11
|
+
}, options);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { useProductQuery };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import useSWR from 'swr';
|
|
2
|
+
import { getProducts } from '../../helpers/queries/get-products.js';
|
|
3
|
+
import { useIsSampleProduct } from '../shop.js';
|
|
4
|
+
import { useFetchHandle } from '../useFetchHandle.js';
|
|
5
|
+
|
|
6
|
+
const useProductsQuery = (ids, options) => {
|
|
7
|
+
const fetcher = useFetchHandle();
|
|
8
|
+
const isSample = useIsSampleProduct();
|
|
9
|
+
return useSWR(['query/products', { ids, isSample }], async ([, arg]) => {
|
|
10
|
+
return getProducts(fetcher, arg);
|
|
11
|
+
}, options);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { useProductsQuery };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useSWRConfig } from 'swr';
|
|
3
|
+
import { useShopStore } from '../contexts/ShopContext.js';
|
|
4
|
+
|
|
5
|
+
const useLocale = () => {
|
|
6
|
+
const locale = useShopStore((state) => state.locale);
|
|
7
|
+
const changeLocale = useShopStore((state) => state.changeLocale);
|
|
8
|
+
return useMemo(() => ({ locale, changeLocale }), [locale, changeLocale]);
|
|
9
|
+
};
|
|
10
|
+
const useCurrency = () => {
|
|
11
|
+
const currency = useShopStore((state) => state.currency);
|
|
12
|
+
const changeCurrency = useShopStore((state) => state.changeCurrency);
|
|
13
|
+
return useMemo(() => ({ currency, changeCurrency }), [currency, changeCurrency]);
|
|
14
|
+
};
|
|
15
|
+
const useSwatches = () => {
|
|
16
|
+
const swatches = useShopStore((state) => state.swatches);
|
|
17
|
+
const changeSwatches = useShopStore((state) => state.changeSwatches);
|
|
18
|
+
return useMemo(() => ({ swatches, changeSwatches }), [swatches, changeSwatches]);
|
|
19
|
+
};
|
|
20
|
+
const usePageType = () => {
|
|
21
|
+
const pageType = useShopStore((state) => state.pageType);
|
|
22
|
+
return useMemo(() => pageType || 'STATIC', [pageType]);
|
|
23
|
+
};
|
|
24
|
+
const useStoreFront = () => {
|
|
25
|
+
const provider = useShopStore((state) => state.provider);
|
|
26
|
+
const storefrontToken = useShopStore((state) => state.storefrontToken);
|
|
27
|
+
const storefrontUrl = useShopStore((state) => state.storefrontUrl);
|
|
28
|
+
return {
|
|
29
|
+
provider,
|
|
30
|
+
storefrontToken,
|
|
31
|
+
storefrontUrl,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const usePluginEnable = () => {
|
|
35
|
+
return useShopStore((state) => state.plugins);
|
|
36
|
+
};
|
|
37
|
+
const useEditorMode = () => {
|
|
38
|
+
return useShopStore((state) => state.mode);
|
|
39
|
+
};
|
|
40
|
+
const useMobileOnly = () => {
|
|
41
|
+
return useShopStore((state) => state.mobileOnly);
|
|
42
|
+
};
|
|
43
|
+
const useMatchMutate = () => {
|
|
44
|
+
const { cache, mutate } = useSWRConfig();
|
|
45
|
+
return (matcher, ...args) => {
|
|
46
|
+
if (!(cache instanceof Map)) {
|
|
47
|
+
throw new Error('matchMutate requires the cache provider to be a Map instance');
|
|
48
|
+
}
|
|
49
|
+
const keys = [];
|
|
50
|
+
cache.forEach((_, key) => {
|
|
51
|
+
if (matcher.test(key)) {
|
|
52
|
+
keys.push(key);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const mutations = keys.map((key) => mutate(key, ...args));
|
|
56
|
+
return Promise.all(mutations);
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
function useConnectedShopify() {
|
|
60
|
+
const { storefrontToken } = useStoreFront();
|
|
61
|
+
return !!storefrontToken;
|
|
62
|
+
}
|
|
63
|
+
function useIsSampleProduct() {
|
|
64
|
+
const { storefrontToken } = useStoreFront();
|
|
65
|
+
return !storefrontToken;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { useConnectedShopify, useCurrency, useEditorMode, useIsSampleProduct, useLocale, useMatchMutate, useMobileOnly, usePageType, usePluginEnable, useStoreFront, useSwatches };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useSyncExternalStore } from 'react';
|
|
2
|
+
|
|
3
|
+
function subscribe(callback) {
|
|
4
|
+
window.addEventListener('resize', callback);
|
|
5
|
+
return () => window.removeEventListener('resize', callback);
|
|
6
|
+
}
|
|
7
|
+
const useCurrentDevice = () => {
|
|
8
|
+
return useSyncExternalStore(subscribe, () => {
|
|
9
|
+
if (window.innerWidth < 768) {
|
|
10
|
+
return 'mobile';
|
|
11
|
+
}
|
|
12
|
+
else if (window.innerWidth >= 768 && window.innerWidth < 1024) {
|
|
13
|
+
return 'tablet';
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return 'desktop';
|
|
17
|
+
}
|
|
18
|
+
}, () => 'desktop');
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { useCurrentDevice };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import LazyLoad from 'vanilla-lazyload';
|
|
3
|
+
|
|
4
|
+
const useLazyVideo = () => {
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const lazyLoadInstance = new LazyLoad({
|
|
7
|
+
use_native: true,
|
|
8
|
+
});
|
|
9
|
+
lazyLoadInstance.update();
|
|
10
|
+
}, []);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { useLazyVideo };
|