@gem-sdk/core 1.13.42 → 1.14.0-dev.284
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 +1 -18
- package/dist/cjs/components/ComponentWrapper.js +1 -28
- package/dist/cjs/components/ComponentWrapperPreview.js +1 -72
- package/dist/cjs/components/Empty.js +1 -7
- package/dist/cjs/components/Render.js +1 -65
- package/dist/cjs/components/Render.liquid.js +15 -158
- package/dist/cjs/components/RenderBlock.js +1 -54
- package/dist/cjs/components/RenderCustomCode.js +5 -0
- package/dist/cjs/components/RenderPreview.js +1 -66
- package/dist/cjs/components/RenderSection.js +1 -23
- package/dist/cjs/components/constant.js +1 -39
- package/dist/cjs/components/src/product/helpers/variant-presets.js +1 -0
- package/dist/cjs/contexts/AddonContext.js +1 -36
- package/dist/cjs/contexts/BuilderComponent.js +1 -34
- package/dist/cjs/contexts/BuilderContext.js +1 -35
- package/dist/cjs/contexts/BuilderPreviewContext.js +1 -370
- package/dist/cjs/contexts/CartLineContext.js +1 -29
- package/dist/cjs/contexts/CollectionContext.js +1 -38
- package/dist/cjs/contexts/ModalContext.js +1 -47
- package/dist/cjs/contexts/ProductContext.js +1 -149
- package/dist/cjs/contexts/ProductListContext.js +1 -32
- package/dist/cjs/contexts/SectionContext.js +1 -53
- package/dist/cjs/contexts/ShopContext.js +1 -70
- package/dist/cjs/graphql/fragments/analytic.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection-detail.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection-product.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection.generated.js +2 -6
- package/dist/cjs/graphql/fragments/custom-code.generated.js +2 -6
- package/dist/cjs/graphql/fragments/data-seo.generated.js +2 -6
- package/dist/cjs/graphql/fragments/media.generated.js +3 -6
- package/dist/cjs/graphql/fragments/product-little.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product-option-value.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product-option.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-custom-section.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-page-section.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-theme-style.generated.js +2 -6
- package/dist/cjs/graphql/fragments/selected-option.generated.js +2 -6
- package/dist/cjs/graphql/fragments/variant.generated.js +2 -6
- package/dist/cjs/graphql/mutations/page-view-up.generated.js +3 -7
- package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +2 -16
- package/dist/cjs/graphql/queries/collection.generated.js +2 -14
- package/dist/cjs/graphql/queries/collections.generated.js +2 -9
- package/dist/cjs/graphql/queries/preview-page.generated.js +2 -14
- package/dist/cjs/graphql/queries/product-little-detail.generated.js +2 -11
- package/dist/cjs/graphql/queries/product-medias.generated.js +2 -8
- package/dist/cjs/graphql/queries/product-value-label.generated.js +7 -0
- package/dist/cjs/graphql/queries/product-variants.generated.js +2 -10
- package/dist/cjs/graphql/queries/products.generated.js +3 -17
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +2 -14
- package/dist/cjs/graphql/queries/store-property.generated.js +2 -6
- package/dist/cjs/helpers/GlobalEvent.js +1 -19
- package/dist/cjs/helpers/background.js +1 -109
- package/dist/cjs/helpers/borders.js +4 -183
- package/dist/cjs/helpers/clone-deep.js +1 -5
- package/dist/cjs/helpers/cls.js +1 -16
- package/dist/cjs/helpers/colors.js +1 -183
- package/dist/cjs/helpers/compose-advance-style.js +1 -188
- package/dist/cjs/helpers/constant.js +1 -23
- package/dist/cjs/helpers/convert.js +1 -7
- package/dist/cjs/helpers/css-variable.js +1 -7
- package/dist/cjs/helpers/email.js +1 -11
- package/dist/cjs/helpers/flatten-connection.js +1 -9
- package/dist/cjs/helpers/get-resonsive-value.js +1 -31
- package/dist/cjs/helpers/get-shortname.js +1 -92
- package/dist/cjs/helpers/is-browser.js +1 -9
- package/dist/cjs/helpers/is-defined.js +1 -7
- package/dist/cjs/helpers/is-empty-children.js +1 -12
- package/dist/cjs/helpers/is-safari.js +1 -9
- package/dist/cjs/helpers/layout.js +1 -59
- package/dist/cjs/helpers/load-script.js +1 -31
- package/dist/cjs/helpers/make-style.js +1 -128
- package/dist/cjs/helpers/normalize-builder-data.js +1 -23
- package/dist/cjs/helpers/prefetch-queries.js +1 -78
- package/dist/cjs/helpers/product.js +1 -45
- package/dist/cjs/helpers/queries/get-collection.js +1 -220
- package/dist/cjs/helpers/queries/get-collections.js +1 -21
- package/dist/cjs/helpers/queries/get-product-by-slug.js +1 -125
- package/dist/cjs/helpers/queries/get-product.js +1 -154
- package/dist/cjs/helpers/queries/get-products.js +1 -161
- package/dist/cjs/helpers/query.js +1 -29
- package/dist/cjs/helpers/radius.js +6 -134
- package/dist/cjs/helpers/render.js +1 -71
- package/dist/cjs/helpers/shadow.js +1 -56
- package/dist/cjs/helpers/size.js +4 -35
- package/dist/cjs/helpers/spacing.js +1 -43
- package/dist/cjs/helpers/tracking/fpixel.js +1 -28
- package/dist/cjs/helpers/tracking/gtag.js +1 -93
- package/dist/cjs/helpers/tracking/tiktokpixel.js +1 -17
- package/dist/cjs/helpers/typography.js +17 -105
- package/dist/cjs/helpers/variant.js +1 -8
- package/dist/cjs/hooks/cart/use-add-to-cart.js +1 -20
- package/dist/cjs/hooks/cart/use-cart-data.js +1 -28
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +1 -20
- package/dist/cjs/hooks/cart/use-cart-note-update.js +1 -20
- package/dist/cjs/hooks/cart/use-create-cart.js +1 -22
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +1 -20
- package/dist/cjs/hooks/cart/use-update-cart-item.js +1 -20
- package/dist/cjs/hooks/shop/use-collection-query.js +1 -22
- package/dist/cjs/hooks/shop/use-collections-query.js +1 -17
- package/dist/cjs/hooks/shop/use-product-query.js +1 -22
- package/dist/cjs/hooks/shop/use-products-query.js +1 -22
- package/dist/cjs/hooks/shop.js +1 -126
- package/dist/cjs/hooks/use-current-device.js +1 -21
- package/dist/cjs/hooks/use-lazy-video.js +1 -15
- package/dist/cjs/hooks/useCartId.js +1 -44
- package/dist/cjs/hooks/useCartLine.js +1 -11
- package/dist/cjs/hooks/useCartUI.js +1 -48
- package/dist/cjs/hooks/useCollection.js +1 -9
- package/dist/cjs/hooks/useFetchHandle.js +1 -13
- package/dist/cjs/hooks/useFormatMoney.js +1 -58
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +1 -0
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +1 -10
- package/dist/cjs/hooks/useLoadScript.js +1 -32
- package/dist/cjs/hooks/useMoney.js +1 -84
- package/dist/cjs/hooks/usePrevious.js +1 -19
- package/dist/cjs/hooks/useProduct.js +1 -124
- package/dist/cjs/hooks/useProductList.js +1 -21
- package/dist/cjs/hooks/useSuspenseFetch.js +1 -27
- package/dist/cjs/hooks/useSwatchesOptions.js +1 -41
- package/dist/cjs/index.js +1 -291
- package/dist/cjs/types/global-style.js +1 -14
- package/dist/cjs/types/shop.js +1 -2
- package/dist/esm/components/AddOn.js +1 -14
- package/dist/esm/components/ComponentWrapper.js +1 -24
- package/dist/esm/components/ComponentWrapperPreview.js +1 -68
- package/dist/esm/components/Empty.js +1 -3
- package/dist/esm/components/Render.js +1 -61
- package/dist/esm/components/Render.liquid.js +15 -153
- package/dist/esm/components/RenderBlock.js +1 -50
- package/dist/esm/components/RenderCustomCode.js +5 -0
- package/dist/esm/components/RenderPreview.js +1 -62
- package/dist/esm/components/RenderSection.js +1 -19
- package/dist/esm/components/constant.js +1 -37
- package/dist/esm/components/src/product/helpers/variant-presets.js +1 -0
- package/dist/esm/contexts/AddonContext.js +1 -32
- package/dist/esm/contexts/BuilderComponent.js +1 -31
- package/dist/esm/contexts/BuilderContext.js +1 -32
- package/dist/esm/contexts/BuilderPreviewContext.js +1 -367
- package/dist/esm/contexts/CartLineContext.js +1 -26
- package/dist/esm/contexts/CollectionContext.js +1 -35
- package/dist/esm/contexts/ModalContext.js +1 -44
- package/dist/esm/contexts/ProductContext.js +1 -146
- package/dist/esm/contexts/ProductListContext.js +1 -28
- package/dist/esm/contexts/SectionContext.js +1 -49
- package/dist/esm/contexts/ShopContext.js +1 -67
- package/dist/esm/graphql/fragments/analytic.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection-detail.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection-product.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection.generated.js +2 -4
- package/dist/esm/graphql/fragments/custom-code.generated.js +2 -4
- package/dist/esm/graphql/fragments/data-seo.generated.js +2 -4
- package/dist/esm/graphql/fragments/media.generated.js +3 -4
- package/dist/esm/graphql/fragments/product-little.generated.js +2 -4
- package/dist/esm/graphql/fragments/product-option-value.generated.js +2 -4
- package/dist/esm/graphql/fragments/product-option.generated.js +2 -4
- package/dist/esm/graphql/fragments/product.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-custom-section.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-page-section.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-theme-style.generated.js +2 -4
- package/dist/esm/graphql/fragments/selected-option.generated.js +2 -4
- package/dist/esm/graphql/fragments/variant.generated.js +2 -4
- package/dist/esm/graphql/mutations/page-view-up.generated.js +3 -5
- package/dist/esm/graphql/queries/collection-detail-filter.generated.js +10 -22
- package/dist/esm/graphql/queries/collection.generated.js +8 -18
- package/dist/esm/graphql/queries/collections.generated.js +3 -8
- package/dist/esm/graphql/queries/preview-page.generated.js +8 -18
- package/dist/esm/graphql/queries/product-little-detail.generated.js +5 -12
- package/dist/esm/graphql/queries/product-medias.generated.js +2 -6
- package/dist/esm/graphql/queries/product-value-label.generated.js +7 -0
- package/dist/esm/graphql/queries/product-variants.generated.js +4 -10
- package/dist/esm/graphql/queries/products.generated.js +9 -20
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +8 -18
- package/dist/esm/graphql/queries/store-property.generated.js +2 -4
- package/dist/esm/helpers/GlobalEvent.js +1 -15
- package/dist/esm/helpers/background.js +1 -106
- package/dist/esm/helpers/borders.js +4 -175
- package/dist/esm/helpers/clone-deep.js +1 -3
- package/dist/esm/helpers/cls.js +1 -14
- package/dist/esm/helpers/colors.js +1 -168
- package/dist/esm/helpers/compose-advance-style.js +1 -185
- package/dist/esm/helpers/constant.js +1 -19
- package/dist/esm/helpers/convert.js +1 -4
- package/dist/esm/helpers/css-variable.js +1 -5
- package/dist/esm/helpers/email.js +1 -6
- package/dist/esm/helpers/flatten-connection.js +1 -7
- package/dist/esm/helpers/get-resonsive-value.js +1 -27
- package/dist/esm/helpers/get-shortname.js +1 -90
- package/dist/esm/helpers/is-browser.js +1 -5
- package/dist/esm/helpers/is-defined.js +1 -5
- package/dist/esm/helpers/is-empty-children.js +1 -7
- package/dist/esm/helpers/is-safari.js +1 -5
- package/dist/esm/helpers/layout.js +1 -54
- package/dist/esm/helpers/load-script.js +1 -29
- package/dist/esm/helpers/make-style.js +1 -117
- package/dist/esm/helpers/normalize-builder-data.js +1 -21
- package/dist/esm/helpers/prefetch-queries.js +1 -76
- package/dist/esm/helpers/product.js +1 -41
- package/dist/esm/helpers/queries/get-collection.js +1 -217
- package/dist/esm/helpers/queries/get-collections.js +1 -19
- package/dist/esm/helpers/queries/get-product-by-slug.js +1 -123
- package/dist/esm/helpers/queries/get-product.js +1 -150
- package/dist/esm/helpers/queries/get-products.js +1 -159
- package/dist/esm/helpers/query.js +1 -25
- package/dist/esm/helpers/radius.js +6 -127
- package/dist/esm/helpers/render.js +1 -64
- package/dist/esm/helpers/shadow.js +1 -51
- package/dist/esm/helpers/size.js +4 -31
- package/dist/esm/helpers/spacing.js +1 -40
- package/dist/esm/helpers/tracking/fpixel.js +1 -24
- package/dist/esm/helpers/tracking/gtag.js +1 -87
- package/dist/esm/helpers/tracking/tiktokpixel.js +1 -15
- package/dist/esm/helpers/typography.js +17 -96
- package/dist/esm/helpers/variant.js +1 -6
- package/dist/esm/hooks/cart/use-add-to-cart.js +1 -18
- package/dist/esm/hooks/cart/use-cart-data.js +1 -26
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +1 -18
- package/dist/esm/hooks/cart/use-cart-note-update.js +1 -18
- package/dist/esm/hooks/cart/use-create-cart.js +1 -20
- package/dist/esm/hooks/cart/use-remove-cart-item.js +1 -18
- package/dist/esm/hooks/cart/use-update-cart-item.js +1 -18
- package/dist/esm/hooks/shop/use-collection-query.js +1 -20
- package/dist/esm/hooks/shop/use-collections-query.js +1 -15
- package/dist/esm/hooks/shop/use-product-query.js +1 -20
- package/dist/esm/hooks/shop/use-products-query.js +1 -20
- package/dist/esm/hooks/shop.js +1 -111
- package/dist/esm/hooks/use-current-device.js +1 -19
- package/dist/esm/hooks/use-lazy-video.js +1 -13
- package/dist/esm/hooks/useCartId.js +1 -40
- package/dist/esm/hooks/useCartLine.js +1 -7
- package/dist/esm/hooks/useCartUI.js +1 -44
- package/dist/esm/hooks/useCollection.js +1 -7
- package/dist/esm/hooks/useFetchHandle.js +1 -11
- package/dist/esm/hooks/useFormatMoney.js +1 -56
- package/dist/esm/hooks/useInitialSwatchesOptions.js +1 -0
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +1 -6
- package/dist/esm/hooks/useLoadScript.js +1 -28
- package/dist/esm/hooks/useMoney.js +1 -80
- package/dist/esm/hooks/usePrevious.js +1 -17
- package/dist/esm/hooks/useProduct.js +1 -111
- package/dist/esm/hooks/useProductList.js +1 -16
- package/dist/esm/hooks/useSuspenseFetch.js +1 -23
- package/dist/esm/hooks/useSwatchesOptions.js +1 -37
- package/dist/esm/index.js +1 -92
- package/dist/esm/types/global-style.js +1 -11
- package/dist/types/index.d.ts +1212 -1031
- package/package.json +3 -3
|
@@ -1,56 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const useFormatMoney = (amount, withCurrency)=>{
|
|
4
|
-
const { moneyFormat, moneyWithCurrencyFormat } = useMoneyFormat();
|
|
5
|
-
const formatMoney = function(cents, format) {
|
|
6
|
-
let value = '';
|
|
7
|
-
const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
|
|
8
|
-
const formatString = format || '${{amount}}';
|
|
9
|
-
/**
|
|
10
|
-
* check default
|
|
11
|
-
* @param opt opt
|
|
12
|
-
* @param def def
|
|
13
|
-
* @returns any
|
|
14
|
-
*/ function defaultOption(opt, def) {
|
|
15
|
-
return typeof opt == 'undefined' ? def : opt;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* formatWithDelimiters
|
|
19
|
-
* @param number number
|
|
20
|
-
* @param precision precision
|
|
21
|
-
* @param thousands thousands
|
|
22
|
-
* @param decimal decimal
|
|
23
|
-
* @returns any
|
|
24
|
-
*/ // eslint-disable-next-line max-params
|
|
25
|
-
function formatWithDelimiters(number, precision, thousands, decimal) {
|
|
26
|
-
precision = defaultOption(precision, 2);
|
|
27
|
-
thousands = defaultOption(thousands, ',');
|
|
28
|
-
decimal = defaultOption(decimal, '.');
|
|
29
|
-
if (isNaN(number) || number == null) {
|
|
30
|
-
return 0;
|
|
31
|
-
}
|
|
32
|
-
// shopify làm tròn bằng cách cắt đi các số ở đằng sau chứ không sử dụng toFixed để làm tròn như toán học
|
|
33
|
-
number = parseFloat(`${number}`).toFixed(Number(precision) + 1).slice(0, -1);
|
|
34
|
-
const parts = number.split('.'), dollars = parts[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + thousands), cents = parts[1] ? decimal + parts[1] : '';
|
|
35
|
-
return dollars + cents;
|
|
36
|
-
}
|
|
37
|
-
switch(formatString.match(placeholderRegex)[1]){
|
|
38
|
-
case 'amount':
|
|
39
|
-
value = formatWithDelimiters(cents, 2);
|
|
40
|
-
break;
|
|
41
|
-
case 'amount_no_decimals':
|
|
42
|
-
value = formatWithDelimiters(cents, 0);
|
|
43
|
-
break;
|
|
44
|
-
case 'amount_with_comma_separator':
|
|
45
|
-
value = formatWithDelimiters(cents, 2, '.', ',');
|
|
46
|
-
break;
|
|
47
|
-
case 'amount_no_decimals_with_comma_separator':
|
|
48
|
-
value = formatWithDelimiters(cents, 0, '.', ',');
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
return formatString.replace(placeholderRegex, value);
|
|
52
|
-
};
|
|
53
|
-
return withCurrency ? formatMoney(`${amount}`, moneyWithCurrencyFormat || moneyFormat) : formatMoney(`${amount}`, moneyFormat);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export { useFormatMoney };
|
|
1
|
+
import{useMoneyFormat as e}from"./shop.js";let useFormatMoney=(t,a)=>{let{moneyFormat:r,moneyWithCurrencyFormat:o}=e(),n=function(e,t){let a="",r=/\{\{\s*(\w+)\s*\}\}/,o=t||"${{amount}}";function n(e,t){return void 0===e?t:e}function s(e,t,a,r){if(t=n(t,2),a=n(a,","),r=n(r,"."),isNaN(e)||null==e)return 0;e=parseFloat(`${e}`).toFixed(Number(t)+1).slice(0,-1);let o=e.split("."),s=o[0]?.replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+a),m=o[1]?r+o[1]:"";return s+m}switch(o.match(r)[1]){case"amount":a=s(e,2);break;case"amount_no_decimals":a=s(e,0);break;case"amount_with_comma_separator":a=s(e,2,".",",");break;case"amount_no_decimals_with_comma_separator":a=s(e,0,".",",")}return o.replace(r,a)};return n(`${t}`,a&&o||r)};export{useFormatMoney};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"swr";import{ProductOptionNameDocument as t}from"../graphql/queries/product-value-label.generated.js";import{colorPreset as o}from"../components/src/product/helpers/variant-presets.js";import{useSwatches as a}from"./shop.js";import{useFetchHandle as l}from"./useFetchHandle.js";import{useShopStore as r}from"../contexts/ShopContext.js";let swatchChange=!1,colorChange=!1,useInitialSwatchesOptions=t=>{let o=l(),s=r(e=>e.changeSwatches),{swatches:n}=a(),{data:p}=e(["/query/productOptionName",{}],async()=>fetchProductValueLabel(o),{revalidateOnMount:!0}),c=[];if(n?.forEach(e=>{c.push(e.optionTitle)}),p?.productOptionName?.forEach(e=>{c.includes(e)||(swatchChange=!0,n?.push({optionTitle:e,optionType:"rectangle_list",optionValues:[]}))}),!t)return[];setDefaultSwatches(n,t),n?.length&&(swatchChange||colorChange)&&(window?.parent?.postMessage?.(JSON.stringify({type:"update-swatches",swatches:n}),"*"),s(n))},getColorDefault=(e,t)=>{let a=e?o[e.toLocaleLowerCase()]:void 0,l=a?[a]:[],r=t?.[0];return!r&&l.length&&(colorChange=!0),r?[r]:l},getProductOptionsLabelByName=(e,t)=>{let o=[],a=e.find(e=>e.name===t);return a?.values.forEach(e=>{o.push(e.label??"")}),o},getSwatchesOptionsLabel=e=>{let t=[];return e.forEach(e=>{t.push(e.label??"")}),t},setDefaultSwatches=(e,t)=>(e&&e?.map(e=>{let o=getProductOptionsLabelByName(t,e.optionTitle),a=getSwatchesOptionsLabel(e.optionValues);o.forEach(t=>{a.includes(t)||e.optionValues.push({label:t,colors:getColorDefault(t),imageUrl:""})}),e.optionValues.map(e=>({...e,colors:getColorDefault(e.label,e.colors)}))}),e),fetchProductValueLabel=async e=>{let o={},a=async o=>{let a=await e([t,o]);return a};return a(o)};export{useInitialSwatchesOptions as default};
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
// const isBrowser = typeof window !== 'undefined';
|
|
4
|
-
const useIsomorphicLayoutEffect = useLayoutEffect;
|
|
5
|
-
|
|
6
|
-
export { useIsomorphicLayoutEffect as default };
|
|
1
|
+
import{useLayoutEffect as o}from"react";let useIsomorphicLayoutEffect=o;export{useIsomorphicLayoutEffect as default};
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { loadScript } from '../helpers/load-script.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The `useLoadScript` hook loads an external script tag on the client-side.
|
|
6
|
-
*/ function useLoadScript(url, options) {
|
|
7
|
-
const [status, setStatus] = useState('loading');
|
|
8
|
-
const stringifiedOptions = JSON.stringify(options);
|
|
9
|
-
useEffect(()=>{
|
|
10
|
-
async function loadScriptWrapper() {
|
|
11
|
-
try {
|
|
12
|
-
setStatus('loading');
|
|
13
|
-
await loadScript(url, options);
|
|
14
|
-
setStatus('done');
|
|
15
|
-
} catch (error) {
|
|
16
|
-
setStatus('error');
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
loadScriptWrapper();
|
|
20
|
-
}, [
|
|
21
|
-
url,
|
|
22
|
-
stringifiedOptions,
|
|
23
|
-
options
|
|
24
|
-
]);
|
|
25
|
-
return status;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { useLoadScript as default };
|
|
1
|
+
import{useState as r,useEffect as t}from"react";import{loadScript as o}from"../helpers/load-script.js";function useLoadScript(a,i){let[e,n]=r("loading"),c=JSON.stringify(i);return t(()=>{(async function(){try{n("loading"),await o(a,i),n("done")}catch(r){n("error")}})()},[a,c,i]),e}export{useLoadScript as default};
|
|
@@ -1,80 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useLocale, useCurrency } from './shop.js';
|
|
3
|
-
|
|
4
|
-
const useMoney = (amount)=>{
|
|
5
|
-
const { locale } = useLocale();
|
|
6
|
-
const { currency } = useCurrency();
|
|
7
|
-
const options = useMemo(()=>({
|
|
8
|
-
style: 'currency',
|
|
9
|
-
currency: currency
|
|
10
|
-
}), [
|
|
11
|
-
currency
|
|
12
|
-
]);
|
|
13
|
-
const defaultFormatter = useLazyFormatter(locale, options);
|
|
14
|
-
const nameFormatter = useLazyFormatter(locale, {
|
|
15
|
-
...options,
|
|
16
|
-
currencyDisplay: 'name'
|
|
17
|
-
});
|
|
18
|
-
const narrowSymbolFormatter = useLazyFormatter(locale, {
|
|
19
|
-
...options,
|
|
20
|
-
currencyDisplay: 'narrowSymbol'
|
|
21
|
-
});
|
|
22
|
-
const withoutTrailingZerosFormatter = useLazyFormatter(locale, {
|
|
23
|
-
...options,
|
|
24
|
-
minimumFractionDigits: 0,
|
|
25
|
-
maximumFractionDigits: 0
|
|
26
|
-
});
|
|
27
|
-
const withoutCurrencyFormatter = useLazyFormatter(locale);
|
|
28
|
-
const withoutTrailingZerosOrCurrencyFormatter = useLazyFormatter(locale, {
|
|
29
|
-
minimumFractionDigits: 0,
|
|
30
|
-
maximumFractionDigits: 0
|
|
31
|
-
});
|
|
32
|
-
const isPartCurrency = (part)=>part.type === 'currency';
|
|
33
|
-
// By wrapping these properties in functions, we only
|
|
34
|
-
// create formatters if they are going to be used.
|
|
35
|
-
const lazyFormatters = useMemo(()=>({
|
|
36
|
-
currencyCode: ()=>currency,
|
|
37
|
-
localizedString: ()=>defaultFormatter().format(amount),
|
|
38
|
-
parts: ()=>defaultFormatter().formatToParts(amount),
|
|
39
|
-
withoutTrailingZeros: ()=>amount % 1 === 0 ? withoutTrailingZerosFormatter().format(amount) : defaultFormatter().format(amount),
|
|
40
|
-
withoutTrailingZerosAndCurrency: ()=>amount % 1 === 0 ? withoutTrailingZerosOrCurrencyFormatter().format(amount) : withoutCurrencyFormatter().format(amount),
|
|
41
|
-
currencyName: ()=>nameFormatter().formatToParts(amount).find(isPartCurrency)?.value ?? currency,
|
|
42
|
-
currencySymbol: ()=>defaultFormatter().formatToParts(amount).find(isPartCurrency)?.value ?? currency,
|
|
43
|
-
currencyNarrowSymbol: ()=>narrowSymbolFormatter().formatToParts(amount).find(isPartCurrency)?.value ?? '',
|
|
44
|
-
amount: ()=>defaultFormatter().formatToParts(amount).filter((part)=>[
|
|
45
|
-
'decimal',
|
|
46
|
-
'fraction',
|
|
47
|
-
'group',
|
|
48
|
-
'integer',
|
|
49
|
-
'literal'
|
|
50
|
-
].includes(part.type)).map((part)=>part.value).join('')
|
|
51
|
-
}), [
|
|
52
|
-
currency,
|
|
53
|
-
amount,
|
|
54
|
-
nameFormatter,
|
|
55
|
-
defaultFormatter,
|
|
56
|
-
narrowSymbolFormatter,
|
|
57
|
-
withoutCurrencyFormatter,
|
|
58
|
-
withoutTrailingZerosFormatter,
|
|
59
|
-
withoutTrailingZerosOrCurrencyFormatter
|
|
60
|
-
]);
|
|
61
|
-
// Call functions automatically when the properties are accessed
|
|
62
|
-
// to keep these functions as an implementation detail.
|
|
63
|
-
return useMemo(()=>new Proxy(lazyFormatters, {
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
65
|
-
get: (target, key)=>Reflect.get(target, key)?.call(null)
|
|
66
|
-
}), [
|
|
67
|
-
lazyFormatters
|
|
68
|
-
]);
|
|
69
|
-
};
|
|
70
|
-
function useLazyFormatter(locale, options) {
|
|
71
|
-
return useMemo(()=>{
|
|
72
|
-
let memoized;
|
|
73
|
-
return ()=>memoized ??= new Intl.NumberFormat(locale, options);
|
|
74
|
-
}, [
|
|
75
|
-
locale,
|
|
76
|
-
options
|
|
77
|
-
]);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export { useMoney as default };
|
|
1
|
+
import{useMemo as r}from"react";import{useLocale as t,useCurrency as e}from"./shop.js";let useMoney=a=>{let{locale:o}=t(),{currency:m}=e(),i=r(()=>({style:"currency",currency:m}),[m]),n=useLazyFormatter(o,i),u=useLazyFormatter(o,{...i,currencyDisplay:"name"}),c=useLazyFormatter(o,{...i,currencyDisplay:"narrowSymbol"}),l=useLazyFormatter(o,{...i,minimumFractionDigits:0,maximumFractionDigits:0}),s=useLazyFormatter(o),y=useLazyFormatter(o,{minimumFractionDigits:0,maximumFractionDigits:0}),f=r=>"currency"===r.type,F=r(()=>({currencyCode:()=>m,localizedString:()=>n().format(a),parts:()=>n().formatToParts(a),withoutTrailingZeros:()=>a%1==0?l().format(a):n().format(a),withoutTrailingZerosAndCurrency:()=>a%1==0?y().format(a):s().format(a),currencyName:()=>u().formatToParts(a).find(f)?.value??m,currencySymbol:()=>n().formatToParts(a).find(f)?.value??m,currencyNarrowSymbol:()=>c().formatToParts(a).find(f)?.value??"",amount:()=>n().formatToParts(a).filter(r=>["decimal","fraction","group","integer","literal"].includes(r.type)).map(r=>r.value).join("")}),[m,a,u,n,c,s,l,y]);return r(()=>new Proxy(F,{get:(r,t)=>Reflect.get(r,t)?.call(null)}),[F])};function useLazyFormatter(t,e){return r(()=>{let r;return()=>r??=new Intl.NumberFormat(t,e)},[t,e])}export{useMoney as default};
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const usePrevious = (value)=>{
|
|
4
|
-
// The ref object is a generic container whose current property is mutable ...
|
|
5
|
-
// ... and can hold any value, similar to an instance property on a class
|
|
6
|
-
const ref = useRef();
|
|
7
|
-
// Store current value in ref
|
|
8
|
-
useEffect(()=>{
|
|
9
|
-
ref.current = value;
|
|
10
|
-
}, [
|
|
11
|
-
value
|
|
12
|
-
]); // Only re-run if value changes
|
|
13
|
-
// Return previous value (happens before update in useEffect above)
|
|
14
|
-
return ref.current;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { usePrevious };
|
|
1
|
+
import{useRef as r,useEffect as e}from"react";let usePrevious=t=>{let u=r();return e(()=>{u.current=t},[t]),u.current};export{usePrevious};
|
|
@@ -1,111 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useProductStore } from '../contexts/ProductContext.js';
|
|
3
|
-
import { flattenConnection } from '../helpers/flatten-connection.js';
|
|
4
|
-
import 'swr';
|
|
5
|
-
import { getSelectedVariant } from '../helpers/product.js';
|
|
6
|
-
import '../helpers/convert.js';
|
|
7
|
-
import { checkInStock } from '../helpers/variant.js';
|
|
8
|
-
|
|
9
|
-
const useUniqProductID = ()=>{
|
|
10
|
-
return useProductStore((s)=>s.uiqueId);
|
|
11
|
-
};
|
|
12
|
-
const useProduct = ()=>{
|
|
13
|
-
return useProductStore((s)=>s.product);
|
|
14
|
-
};
|
|
15
|
-
const useFeaturedImageGlobal = ()=>{
|
|
16
|
-
return useProductStore((s)=>s.featuredImageGlobal);
|
|
17
|
-
};
|
|
18
|
-
const useProductProperties = ()=>{
|
|
19
|
-
return useProductStore((s)=>s.properties);
|
|
20
|
-
};
|
|
21
|
-
const useQuantity = ()=>{
|
|
22
|
-
const quantity = useProductStore((s)=>s.quantity);
|
|
23
|
-
const decrement = useProductStore((s)=>s.decrementQuantity);
|
|
24
|
-
const increment = useProductStore((s)=>s.incrementQuantity);
|
|
25
|
-
const updateQuantity = useProductStore((s)=>s.setQuantity);
|
|
26
|
-
const reset = useCallback(()=>{
|
|
27
|
-
updateQuantity(1);
|
|
28
|
-
}, [
|
|
29
|
-
updateQuantity
|
|
30
|
-
]);
|
|
31
|
-
return useMemo(()=>({
|
|
32
|
-
quantity,
|
|
33
|
-
increment,
|
|
34
|
-
decrement,
|
|
35
|
-
reset,
|
|
36
|
-
setQuantity: updateQuantity
|
|
37
|
-
}), [
|
|
38
|
-
decrement,
|
|
39
|
-
increment,
|
|
40
|
-
quantity,
|
|
41
|
-
reset,
|
|
42
|
-
updateQuantity
|
|
43
|
-
]);
|
|
44
|
-
};
|
|
45
|
-
const useSelectedOption = ()=>{
|
|
46
|
-
const setSelectedOption = useProductStore((s)=>s.setSelectedOption);
|
|
47
|
-
const selectedOptions = useProductStore((s)=>s.selectedOptions);
|
|
48
|
-
const forceSelectedOption = useProductStore((s)=>s.forceSelectedOption);
|
|
49
|
-
const updateOption = useCallback((optionId, optionValue)=>{
|
|
50
|
-
setSelectedOption(optionId, optionValue);
|
|
51
|
-
}, [
|
|
52
|
-
setSelectedOption
|
|
53
|
-
]);
|
|
54
|
-
return useMemo(()=>({
|
|
55
|
-
selectedOptions,
|
|
56
|
-
setSelectedOption: updateOption,
|
|
57
|
-
forceSelectedOption
|
|
58
|
-
}), [
|
|
59
|
-
selectedOptions,
|
|
60
|
-
updateOption,
|
|
61
|
-
forceSelectedOption
|
|
62
|
-
]);
|
|
63
|
-
};
|
|
64
|
-
const useVariants = ()=>{
|
|
65
|
-
const variants = useProductStore((s)=>s.product?.variants);
|
|
66
|
-
return flattenConnection(variants);
|
|
67
|
-
};
|
|
68
|
-
const useVariant = (id)=>{
|
|
69
|
-
const variants = useVariants();
|
|
70
|
-
return useMemo(()=>variants?.find((v)=>v?.id === id), [
|
|
71
|
-
id,
|
|
72
|
-
variants
|
|
73
|
-
]);
|
|
74
|
-
};
|
|
75
|
-
const useCurrentVariant = ()=>{
|
|
76
|
-
const { selectedOptions } = useSelectedOption();
|
|
77
|
-
const variants = useVariants();
|
|
78
|
-
return useMemo(()=>getSelectedVariant(variants, selectedOptions), [
|
|
79
|
-
selectedOptions,
|
|
80
|
-
variants
|
|
81
|
-
]);
|
|
82
|
-
};
|
|
83
|
-
const useCurrentVariantInStock = ()=>{
|
|
84
|
-
const currentVariant = useCurrentVariant();
|
|
85
|
-
const isInStock = checkInStock(currentVariant);
|
|
86
|
-
return isInStock;
|
|
87
|
-
};
|
|
88
|
-
const useVariantOutStock = (optionId, optionValue)=>{
|
|
89
|
-
const { selectedOptions } = useSelectedOption();
|
|
90
|
-
const variants = useVariants();
|
|
91
|
-
const matchedVariant = getSelectedVariant(variants, {
|
|
92
|
-
...selectedOptions,
|
|
93
|
-
[optionId]: optionValue
|
|
94
|
-
});
|
|
95
|
-
const isInStock = checkInStock(matchedVariant);
|
|
96
|
-
return !isInStock;
|
|
97
|
-
};
|
|
98
|
-
const useCheckAvailableVariantInStock = (optionId, optionValue)=>{
|
|
99
|
-
const variants = useVariants();
|
|
100
|
-
return variants ? variants.some((item)=>{
|
|
101
|
-
if (item) {
|
|
102
|
-
const { selectedOptions } = item;
|
|
103
|
-
const opt = selectedOptions?.some((option)=>option?.name === optionId && option.value === optionValue);
|
|
104
|
-
const isInStock = checkInStock(item);
|
|
105
|
-
return opt && isInStock;
|
|
106
|
-
}
|
|
107
|
-
return false;
|
|
108
|
-
}) : false;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export { useCheckAvailableVariantInStock, useCurrentVariant, useCurrentVariantInStock, useFeaturedImageGlobal, useProduct, useProductProperties, useQuantity, useSelectedOption, useUniqProductID, useVariant, useVariantOutStock, useVariants };
|
|
1
|
+
import{useCallback as e,useEffect as t,useMemo as r}from"react";import{useProductStore as n}from"../contexts/ProductContext.js";import{flattenConnection as u}from"../helpers/flatten-connection.js";import"swr";import{getSelectedVariant as s}from"../helpers/product.js";import"../helpers/convert.js";import{checkInStock as o}from"../helpers/variant.js";let useUniqProductID=()=>n(e=>e.uiqueId),useProduct=()=>n(e=>e.product),useFeaturedImageGlobal=()=>n(e=>e.featuredImageGlobal),useProductProperties=()=>n(e=>e.properties),useIsSyncProduct=()=>n(e=>e.isSyncProduct),useQuantity=()=>{let u=n(e=>e.quantity),s=n(e=>e.decrementQuantity),o=n(e=>e.incrementQuantity),a=n(e=>e.setQuantity),i=n(e=>e.isSyncProduct),c=n(e=>e.product),l=c?.id,d=e(()=>{a(1)},[a]);return t(()=>{if(i){let e=new CustomEvent("set-product-quantity",{bubbles:!0,cancelable:!0,composed:!0,detail:{quantity:u,productId:l}});window.dispatchEvent(e)}},[u,i,l]),r(()=>({quantity:u,increment:o,decrement:s,reset:d,setQuantity:a}),[s,o,u,d,a])},useSelectedOption=()=>{let t=n(e=>e.setSelectedOption),u=n(e=>e.selectedOptions),s=n(e=>e.forceSelectedOption),o=n(e=>e.isSyncProduct),a=e((e,r,n,u)=>{if(!u&&o){let t=new CustomEvent("set-selected-option",{bubbles:!0,cancelable:!0,composed:!0,detail:{optionId:e,optionValue:r,productId:n}});window.dispatchEvent(t)}t(e,r)},[t,o]),i=e((e,t,r)=>{if(!r&&o){let r=new CustomEvent("force-selected-option",{bubbles:!0,cancelable:!0,composed:!0,detail:{selectedOption:e,productId:t}});window.dispatchEvent(r)}s(e)},[s,o]);return r(()=>({selectedOptions:u,setSelectedOption:a,forceSelectedOption:i}),[u,a,i])},useVariants=()=>{let e=n(e=>e.product?.variants);return u(e)},useVariant=e=>{let t=useVariants();return r(()=>t?.find(t=>t?.id===e),[e,t])},useCurrentVariant=()=>{let{selectedOptions:e}=useSelectedOption(),t=useVariants();return r(()=>s(t,e),[e,t])},useCurrentVariantInStock=()=>{let e=useCurrentVariant();return o(e)},useVariantOutStock=(e,t)=>{let{selectedOptions:r}=useSelectedOption(),n=useVariants(),u=s(n,{...r,[e]:t}),a=o(u);return!a},useCheckAvailableVariantInStock=(e,t)=>{let r=useVariants();return!!r&&r.some(r=>{if(r){let{selectedOptions:n}=r,u=n?.some(r=>r?.name===e&&r.value===t),s=o(r);return u&&s}return!1})};export{useCheckAvailableVariantInStock,useCurrentVariant,useCurrentVariantInStock,useFeaturedImageGlobal,useIsSyncProduct,useProduct,useProductProperties,useQuantity,useSelectedOption,useUniqProductID,useVariant,useVariantOutStock,useVariants};
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const useProductList = ()=>{
|
|
4
|
-
return useProductListStore((s)=>s.collection);
|
|
5
|
-
};
|
|
6
|
-
const useProductListProducts = ()=>{
|
|
7
|
-
return useProductListStore((s)=>s.products);
|
|
8
|
-
};
|
|
9
|
-
const useProductListSettings = ()=>{
|
|
10
|
-
return useProductListStore((s)=>s.settings);
|
|
11
|
-
};
|
|
12
|
-
const useProductListStyles = ()=>{
|
|
13
|
-
return useProductListStore((s)=>s.styles);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { useProductList, useProductListProducts, useProductListSettings, useProductListStyles };
|
|
1
|
+
import{useProductListStore as t}from"../contexts/ProductListContext.js";let useProductList=()=>t(t=>t.collection),useProductListProducts=()=>t(t=>t.products),useProductListSettings=()=>t(t=>t.settings),useProductListStyles=()=>t(t=>t.styles);export{useProductList,useProductListProducts,useProductListSettings,useProductListStyles};
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const useSuspenseFetch = (key, promise)=>{
|
|
3
|
-
const value = cache.get(key) || {
|
|
4
|
-
status: 'new',
|
|
5
|
-
data: null
|
|
6
|
-
};
|
|
7
|
-
if (value.status === 'resolved') {
|
|
8
|
-
return {
|
|
9
|
-
data: value.data
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
promise().then((data)=>{
|
|
13
|
-
value.status = 'resolved';
|
|
14
|
-
value.data = data;
|
|
15
|
-
cache.set(key, value);
|
|
16
|
-
}).catch(()=>{
|
|
17
|
-
value.status = 'error';
|
|
18
|
-
value.data = null;
|
|
19
|
-
});
|
|
20
|
-
throw promise();
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export { useSuspenseFetch as default };
|
|
1
|
+
let cache=new Map,useSuspenseFetch=(e,t)=>{let a=cache.get(e)||{status:"new",data:null};if("resolved"===a.status)return{data:a.data};throw t().then(t=>{a.status="resolved",a.data=t,cache.set(e,a)}).catch(()=>{a.status="error",a.data=null}),t()};export{useSuspenseFetch as default};
|
|
@@ -1,37 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const initialSwatchOptionValue = {
|
|
4
|
-
label: '',
|
|
5
|
-
colors: [],
|
|
6
|
-
imageUrl: ''
|
|
7
|
-
};
|
|
8
|
-
const initialGlobalSwatchesData = {
|
|
9
|
-
optionTitle: '',
|
|
10
|
-
optionType: '',
|
|
11
|
-
optionValues: []
|
|
12
|
-
};
|
|
13
|
-
const useSwatchesOptions = (options)=>{
|
|
14
|
-
const { swatches } = useSwatches();
|
|
15
|
-
if (!options) return [];
|
|
16
|
-
return options?.map((option)=>{
|
|
17
|
-
const swatchOption = swatches?.find((sw)=>sw?.optionTitle === option?.name) || {
|
|
18
|
-
...initialGlobalSwatchesData
|
|
19
|
-
};
|
|
20
|
-
return {
|
|
21
|
-
...option,
|
|
22
|
-
optionType: swatchOption ? swatchOption.optionType : '',
|
|
23
|
-
values: option.values?.map((val)=>{
|
|
24
|
-
const swatchValue = swatchOption && swatchOption?.optionValues?.find((swatOp)=>swatOp?.label === val?.label) || {
|
|
25
|
-
...initialSwatchOptionValue
|
|
26
|
-
};
|
|
27
|
-
return {
|
|
28
|
-
...val,
|
|
29
|
-
colors: swatchValue?.colors || [],
|
|
30
|
-
imageUrl: swatchValue?.imageUrl || ''
|
|
31
|
-
};
|
|
32
|
-
})
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export { useSwatchesOptions as default };
|
|
1
|
+
import{useSwatches as t}from"./shop.js";let initialSwatchOptionValue={label:"",colors:[],imageUrl:""},initialGlobalSwatchesData={optionTitle:"",optionType:"",optionValues:[]},useSwatchesOptions=a=>{let{swatches:e}=t();return a?a?.map(t=>{let a=e?.find(a=>a?.optionTitle===t?.name)||{...initialGlobalSwatchesData};return{...t,optionType:a?a.optionType:"",values:t.values?.map(t=>{let e=a&&a?.optionValues?.find(a=>a?.label===t?.label)||{...initialSwatchOptionValue};return{...t,colors:e?.colors||[],imageUrl:e?.imageUrl||""}})}}):[]};export{useSwatchesOptions as default};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,92 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { default as Render } from './components/Render.js';
|
|
3
|
-
export { default as RenderPreview } from './components/RenderPreview.js';
|
|
4
|
-
export { RenderChildren, default as RenderLiquid } from './components/Render.liquid.js';
|
|
5
|
-
export { AddonProvider, useAddon, useAddons } from './contexts/AddonContext.js';
|
|
6
|
-
export { BuilderComponentProvider, useBuilderComponent } from './contexts/BuilderComponent.js';
|
|
7
|
-
export { BuilderProvider, useBuilderStore } from './contexts/BuilderContext.js';
|
|
8
|
-
export { BuilderPreviewProvider, useBuilderPreviewStore } from './contexts/BuilderPreviewContext.js';
|
|
9
|
-
export { CartLineProvider, useCartLineStore } from './contexts/CartLineContext.js';
|
|
10
|
-
export { ProductListProvider, useProductListStore } from './contexts/ProductListContext.js';
|
|
11
|
-
export { ProductProvider, useProductStore } from './contexts/ProductContext.js';
|
|
12
|
-
export { SectionProvider, useSection, useSectionStore } from './contexts/SectionContext.js';
|
|
13
|
-
export { ShopProvider, useShopStore } from './contexts/ShopContext.js';
|
|
14
|
-
export { CollectionProvider, useCollectionStore } from './contexts/CollectionContext.js';
|
|
15
|
-
export { ModalProvider, useModalStore } from './contexts/ModalContext.js';
|
|
16
|
-
export { PageViewUpDocument } from './graphql/mutations/page-view-up.generated.js';
|
|
17
|
-
export { CollectionDetailFilterDocument } from './graphql/queries/collection-detail-filter.generated.js';
|
|
18
|
-
export { CollectionDocument } from './graphql/queries/collection.generated.js';
|
|
19
|
-
export { CollectionsDocument } from './graphql/queries/collections.generated.js';
|
|
20
|
-
export { PublishedThemePagesDocument } from './graphql/queries/published-theme-pages.generated.js';
|
|
21
|
-
export { ProductsDocument } from './graphql/queries/products.generated.js';
|
|
22
|
-
export { StorePropertyDocument } from './graphql/queries/store-property.generated.js';
|
|
23
|
-
export { PreviewPageDocument } from './graphql/queries/preview-page.generated.js';
|
|
24
|
-
export { composeBorderCss, getBorderStyle, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn } from './helpers/borders.js';
|
|
25
|
-
export { cls } from './helpers/cls.js';
|
|
26
|
-
export { flattenConnection } from './helpers/flatten-connection.js';
|
|
27
|
-
export { getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen } from './helpers/get-resonsive-value.js';
|
|
28
|
-
export { getShortName } from './helpers/get-shortname.js';
|
|
29
|
-
export { default as globalEvent } from './helpers/GlobalEvent.js';
|
|
30
|
-
export { default as isBrowser } from './helpers/is-browser.js';
|
|
31
|
-
export { default as isSafari } from './helpers/is-safari.js';
|
|
32
|
-
export { isEmptyChildren } from './helpers/is-empty-children.js';
|
|
33
|
-
export { makeAspectRatio, makeHeight, makeLineClamp, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, removeNullUndefined } from './helpers/make-style.js';
|
|
34
|
-
export { normalizeBuilderData } from './helpers/normalize-builder-data.js';
|
|
35
|
-
export { prefetchQueries } from './helpers/prefetch-queries.js';
|
|
36
|
-
export { composeSpacing, getSpacingVariable } from './helpers/spacing.js';
|
|
37
|
-
export { loadScript } from './helpers/load-script.js';
|
|
38
|
-
export { validateEmail } from './helpers/email.js';
|
|
39
|
-
export { genVariable } from './helpers/css-variable.js';
|
|
40
|
-
export { composeGridLayout, convertOldLayout, gridToArrayRegex, optionLayoutStyle } from './helpers/layout.js';
|
|
41
|
-
export { isDefined } from './helpers/is-defined.js';
|
|
42
|
-
export { composeTextColorCss, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getSingleColorVariable, isColor } from './helpers/colors.js';
|
|
43
|
-
export { composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass } from './helpers/typography.js';
|
|
44
|
-
export { composeCornerCss, composeRadius, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState } from './helpers/radius.js';
|
|
45
|
-
export { checkAvailableVariantInStock, getSelectedVariant, parseSelectedOption } from './helpers/product.js';
|
|
46
|
-
import * as fpixel from './helpers/tracking/fpixel.js';
|
|
47
|
-
export { fpixel };
|
|
48
|
-
import * as gtag from './helpers/tracking/gtag.js';
|
|
49
|
-
export { gtag };
|
|
50
|
-
import * as tiktokpixel from './helpers/tracking/tiktokpixel.js';
|
|
51
|
-
export { tiktokpixel };
|
|
52
|
-
export { RenderIf, composeMemo, dataStringify, props, styles, template } from './helpers/render.js';
|
|
53
|
-
export { baseAssetURL, isLocalEnv } from './helpers/convert.js';
|
|
54
|
-
export { composeSize, composeSizeCss, genSizeClass } from './helpers/size.js';
|
|
55
|
-
export { composeShadowCss, getStyleShadow, getStyleShadowState, parseValueWithUnit } from './helpers/shadow.js';
|
|
56
|
-
export { composeBackgroundCss, getStyleBackgroundByDevice } from './helpers/background.js';
|
|
57
|
-
export { generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey } from './helpers/query.js';
|
|
58
|
-
export { composeAdvanceStyle, splitStyle } from './helpers/compose-advance-style.js';
|
|
59
|
-
export { useAddToCart } from './hooks/cart/use-add-to-cart.js';
|
|
60
|
-
export { useCartData } from './hooks/cart/use-cart-data.js';
|
|
61
|
-
export { useCartDiscountCodesUpdate } from './hooks/cart/use-cart-discount-codes-update.js';
|
|
62
|
-
export { useCartNoteUpdate } from './hooks/cart/use-cart-note-update.js';
|
|
63
|
-
export { useCreateCart } from './hooks/cart/use-create-cart.js';
|
|
64
|
-
export { useRemoveCartItem } from './hooks/cart/use-remove-cart-item.js';
|
|
65
|
-
export { useUpdateCartItem } from './hooks/cart/use-update-cart-item.js';
|
|
66
|
-
export { useCheckoutUrl, useConnectedShopify, useCurrency, useEditorMode, useIsSampleProduct, useIsStorefrontProduct, useLocale, useMatchMutate, useMobileOnly, useMoneyFormat, usePageType, usePluginEnable, useStoreFront, useSwatches } from './hooks/shop.js';
|
|
67
|
-
export { useCollectionQuery } from './hooks/shop/use-collection-query.js';
|
|
68
|
-
export { useCollectionsQuery } from './hooks/shop/use-collections-query.js';
|
|
69
|
-
export { useProductQuery } from './hooks/shop/use-product-query.js';
|
|
70
|
-
export { useProductsQuery } from './hooks/shop/use-products-query.js';
|
|
71
|
-
export { useCurrentDevice } from './hooks/use-current-device.js';
|
|
72
|
-
export { useFormatMoney } from './hooks/useFormatMoney.js';
|
|
73
|
-
export { useLazyVideo } from './hooks/use-lazy-video.js';
|
|
74
|
-
export { default as useCartId } from './hooks/useCartId.js';
|
|
75
|
-
export { default as useCartLine } from './hooks/useCartLine.js';
|
|
76
|
-
export { default as useCartUI } from './hooks/useCartUI.js';
|
|
77
|
-
export { useCollection } from './hooks/useCollection.js';
|
|
78
|
-
export { useId } from 'react';
|
|
79
|
-
export { default as useIsomorphicLayoutEffect } from './hooks/useIsomorphicLayoutEffect.js';
|
|
80
|
-
export { default as useLoadScript } from './hooks/useLoadScript.js';
|
|
81
|
-
export { default as useMoney } from './hooks/useMoney.js';
|
|
82
|
-
export { usePrevious } from './hooks/usePrevious.js';
|
|
83
|
-
export { useCheckAvailableVariantInStock, useCurrentVariant, useCurrentVariantInStock, useFeaturedImageGlobal, useProduct, useProductProperties, useQuantity, useSelectedOption, useUniqProductID, useVariant, useVariantOutStock, useVariants } from './hooks/useProduct.js';
|
|
84
|
-
export { useProductList, useProductListProducts, useProductListSettings, useProductListStyles } from './hooks/useProductList.js';
|
|
85
|
-
export { default as useSuspenseFetch } from './hooks/useSuspenseFetch.js';
|
|
86
|
-
export { default as useSwatchesOptions } from './hooks/useSwatchesOptions.js';
|
|
87
|
-
import * as shop from './types/shop.js';
|
|
88
|
-
export { shop as ShopType };
|
|
89
|
-
export { OptionNormalStyle, OptionSpecialStyle } from './types/global-style.js';
|
|
90
|
-
export { calculateFirstProduct, getCollection } from './helpers/queries/get-collection.js';
|
|
91
|
-
export { fetchMedias, fetchVariants, getProduct } from './helpers/queries/get-product.js';
|
|
92
|
-
export { getProductBySlug } from './helpers/queries/get-product-by-slug.js';
|
|
1
|
+
export{default as AddOn}from"./components/AddOn.js";export{default as Render}from"./components/Render.js";export{default as RenderPreview}from"./components/RenderPreview.js";export{RenderChildren,default as RenderLiquid,WrapRenderChildren}from"./components/Render.liquid.js";export{AddonProvider,useAddon,useAddons}from"./contexts/AddonContext.js";export{BuilderComponentProvider,useBuilderComponent}from"./contexts/BuilderComponent.js";export{BuilderProvider,useBuilderStore}from"./contexts/BuilderContext.js";export{BuilderPreviewProvider,useBuilderPreviewStore}from"./contexts/BuilderPreviewContext.js";export{CartLineProvider,useCartLineStore}from"./contexts/CartLineContext.js";export{ProductListProvider,useProductListStore}from"./contexts/ProductListContext.js";export{ProductProvider,useProductStore}from"./contexts/ProductContext.js";export{SectionProvider,useSection,useSectionStore}from"./contexts/SectionContext.js";export{ShopProvider,useShopStore}from"./contexts/ShopContext.js";export{CollectionProvider,useCollectionStore}from"./contexts/CollectionContext.js";export{ModalProvider,useModalStore}from"./contexts/ModalContext.js";export{PageViewUpDocument}from"./graphql/mutations/page-view-up.generated.js";export{CollectionDetailFilterDocument}from"./graphql/queries/collection-detail-filter.generated.js";export{CollectionDocument}from"./graphql/queries/collection.generated.js";export{CollectionsDocument}from"./graphql/queries/collections.generated.js";export{PublishedThemePagesDocument}from"./graphql/queries/published-theme-pages.generated.js";export{ProductsDocument}from"./graphql/queries/products.generated.js";export{StorePropertyDocument}from"./graphql/queries/store-property.generated.js";export{PreviewPageDocument}from"./graphql/queries/preview-page.generated.js";export{composeBorderCss,getBorderStyle,handleConvertBorderColor,handleConvertBorderStyle,handleConvertBorderWidth,handleConvertClassColor,handleConvertClassColorDynamicBtn}from"./helpers/borders.js";export{cls}from"./helpers/cls.js";export{flattenConnection}from"./helpers/flatten-connection.js";export{getResponsiveStateValue,getResponsiveValue,getResponsiveValueByScreen,isColumnDirectionExist}from"./helpers/get-resonsive-value.js";export{getShortName}from"./helpers/get-shortname.js";export{default as globalEvent}from"./helpers/GlobalEvent.js";export{default as isBrowser}from"./helpers/is-browser.js";export{default as isSafari}from"./helpers/is-safari.js";export{isEmptyChildren}from"./helpers/is-empty-children.js";export{makeAspectRatio,makeGlobalSizeWidthResponsive,makeHeight,makeLineClamp,makeStyle,makeStyleResponsive,makeStyleResponsiveState,makeStyleState,makeWidth,removeNullUndefined}from"./helpers/make-style.js";export{normalizeBuilderData}from"./helpers/normalize-builder-data.js";export{prefetchQueries}from"./helpers/prefetch-queries.js";export{composeSpacing,getSpacingVariable}from"./helpers/spacing.js";export{loadScript}from"./helpers/load-script.js";export{validateEmail}from"./helpers/email.js";export{genVariable}from"./helpers/css-variable.js";export{composeGridLayout,convertOldLayout,gridToArrayRegex,optionLayoutStyle}from"./helpers/layout.js";export{isDefined}from"./helpers/is-defined.js";export{composeTextColorCss,getGlobalColorCSSProp,getGlobalColorClass,getGlobalColorResponsiveClass,getGlobalColorResponsiveStyle,getGlobalColorStateClass,getGlobalColorStateClassDynamicBtn,getGlobalColorStateResponsiveClass,getGlobalColorStateResponsiveClassDynamicBtn,getGlobalColorStateResponsiveStyle,getGlobalColorStateStyle,getGlobalColorStyle,getSingleColorVariable,isColor}from"./helpers/colors.js";export{composeTypography,composeTypographyAttr,composeTypographyClassName,composeTypographyCss,composeTypographyStyle,composeTypographyV2,composeTypographyV2Css,genTypoClass}from"./helpers/typography.js";export{composeCornerCss,composeRadius,composeRadiusResponsive,getCornerCSSFromGlobal,getCustomRadius,getRadiusCSSFromGlobal,getRadiusStyleActiveState}from"./helpers/radius.js";export{checkAvailableVariantInStock,getSelectedVariant,parseSelectedOption}from"./helpers/product.js";import*as e from"./helpers/tracking/fpixel.js";import*as o from"./helpers/tracking/gtag.js";import*as r from"./helpers/tracking/tiktokpixel.js";export{RenderIf,composeMemo,dataStringify,props,styles,template}from"./helpers/render.js";export{baseAssetURL,isLocalEnv}from"./helpers/convert.js";export{composeSize,composeSizeCss,genSizeClass}from"./helpers/size.js";export{composeShadowCss,getStyleShadow,getStyleShadowState,parseValueWithUnit}from"./helpers/shadow.js";export{composeBackgroundCss,getStyleBackgroundByDevice}from"./helpers/background.js";export{generateCollectionQueryKey,generateProductQueryKey,generateProductsQueryKey}from"./helpers/query.js";export{composeAdvanceStyle,splitStyle}from"./helpers/compose-advance-style.js";export{useAddToCart}from"./hooks/cart/use-add-to-cart.js";export{useCartData}from"./hooks/cart/use-cart-data.js";export{useCartDiscountCodesUpdate}from"./hooks/cart/use-cart-discount-codes-update.js";export{useCartNoteUpdate}from"./hooks/cart/use-cart-note-update.js";export{useCreateCart}from"./hooks/cart/use-create-cart.js";export{useRemoveCartItem}from"./hooks/cart/use-remove-cart-item.js";export{useUpdateCartItem}from"./hooks/cart/use-update-cart-item.js";export{useCheckoutUrl,useConnectedShopify,useCurrency,useEditorMode,useIsSampleProduct,useIsStorefrontProduct,useLocale,useMatchMutate,useMobileOnly,useMoneyFormat,usePageType,usePluginEnable,useStoreFront,useSwatches}from"./hooks/shop.js";export{useCollectionQuery}from"./hooks/shop/use-collection-query.js";export{useCollectionsQuery}from"./hooks/shop/use-collections-query.js";export{useProductQuery}from"./hooks/shop/use-product-query.js";export{useProductsQuery}from"./hooks/shop/use-products-query.js";export{useCurrentDevice}from"./hooks/use-current-device.js";export{useFormatMoney}from"./hooks/useFormatMoney.js";export{useLazyVideo}from"./hooks/use-lazy-video.js";export{default as useCartId}from"./hooks/useCartId.js";export{default as useCartLine}from"./hooks/useCartLine.js";export{default as useCartUI}from"./hooks/useCartUI.js";export{useCollection}from"./hooks/useCollection.js";export{useId}from"react";export{default as useIsomorphicLayoutEffect}from"./hooks/useIsomorphicLayoutEffect.js";export{default as useLoadScript}from"./hooks/useLoadScript.js";export{default as useMoney}from"./hooks/useMoney.js";export{usePrevious}from"./hooks/usePrevious.js";export{useCheckAvailableVariantInStock,useCurrentVariant,useCurrentVariantInStock,useFeaturedImageGlobal,useIsSyncProduct,useProduct,useProductProperties,useQuantity,useSelectedOption,useUniqProductID,useVariant,useVariantOutStock,useVariants}from"./hooks/useProduct.js";export{useProductList,useProductListProducts,useProductListSettings,useProductListStyles}from"./hooks/useProductList.js";export{default as useSuspenseFetch}from"./hooks/useSuspenseFetch.js";export{default as useSwatchesOptions}from"./hooks/useSwatchesOptions.js";export{default as useInitialSwatchesOptions}from"./hooks/useInitialSwatchesOptions.js";import*as t from"./types/shop.js";export{OptionNormalStyle,OptionSpecialStyle}from"./types/global-style.js";export{calculateFirstProduct,getCollection}from"./helpers/queries/get-collection.js";export{fetchMedias,fetchVariants,getProduct}from"./helpers/queries/get-product.js";export{getProductBySlug}from"./helpers/queries/get-product-by-slug.js";export{e as fpixel,o as gtag,r as tiktokpixel,t as ShopType};
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
'radio_buttons',
|
|
3
|
-
'dropdown'
|
|
4
|
-
];
|
|
5
|
-
const OptionSpecialStyle = [
|
|
6
|
-
'color',
|
|
7
|
-
'image',
|
|
8
|
-
'rectangle_list'
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
export { OptionNormalStyle, OptionSpecialStyle };
|
|
1
|
+
let OptionNormalStyle=["radio_buttons","dropdown"],OptionSpecialStyle=["color","image","rectangle_list","image_shopify"];export{OptionNormalStyle,OptionSpecialStyle};
|