@gem-sdk/components 7.0.1 → 8.0.0-dev.19
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/carousel-v3/components/swiper/Swiper.js +1 -1
- package/dist/cjs/carousel-v3/hooks/useCarousel.js +1 -1
- package/dist/cjs/countdown-timer/common/helpers.js +1 -1
- package/dist/cjs/countdown-timer/hooks/useTimeLeft.js +1 -1
- package/dist/cjs/post-purchase/product/components/ProductPrice.js +1 -1
- package/dist/cjs/post-purchase/product/constants/ProductOfferPlaceholder.js +1 -1
- package/dist/cjs/post-purchase/product/hooks/useGetMoneyLines.js +1 -1
- package/dist/cjs/product/components/product-badge/ProductBadge.liquid.js +10 -10
- package/dist/cjs/product/components/product-badge/common/styles.js +1 -1
- package/dist/cjs/product/components/product-badge/utils/common.js +1 -1
- package/dist/cjs/product/components/product-badge/utils/renderBadgeLiquid.js +3 -4
- package/dist/cjs/product/components/product-button/hooks/useAddToCart.js +1 -1
- package/dist/cjs/product/components/product-discount-tag/hooks/useGpDiscountTag.js +1 -1
- package/dist/cjs/product/components/product-list/ProductListCarouselItem.liquid.js +1 -1
- package/dist/cjs/product/components/product-list/ProductListGridItem.liquid.js +1 -1
- package/dist/cjs/product/components/product-list-v3/ProductList.js +1 -1
- package/dist/cjs/product/components/product-list-v3/ProductListCarouselItem.liquid.js +1 -1
- package/dist/cjs/product/components/product-list-v3/ProductListGridItem.liquid.js +1 -1
- package/dist/cjs/product/components/product-price/hooks/useGpPrice.js +1 -1
- package/dist/cjs/product/components/product-variants/OptionVariantsNewFormat.liquid.js +41 -0
- package/dist/cjs/product/components/product-variants/OptionVariantsOldFormat.liquid.js +66 -0
- package/dist/cjs/product/components/product-variants/ProductVariants.liquid.js +25 -79
- package/dist/cjs/product/components/product-variants/common/base/styles.js +1 -1
- package/dist/cjs/product/components/product-variants/common/const.js +1 -0
- package/dist/cjs/product/components/product-variants/components/color/color.liquid.js +3 -3
- package/dist/cjs/product/components/product-view-more/ProductViewMore.liquid.js +1 -1
- package/dist/cjs/product/components/product-view-more/common/helpers.js +1 -1
- package/dist/cjs/product/components/product-wrap/Product.liquid.js +12 -10
- package/dist/cjs/product/helpers/product-bundle.js +1 -1
- package/dist/cjs/third-party/settings/BonLoyaltyRewardsReferrals/index.js +1 -1
- package/dist/esm/carousel-v3/components/swiper/Swiper.js +1 -1
- package/dist/esm/carousel-v3/hooks/useCarousel.js +1 -1
- package/dist/esm/countdown-timer/common/helpers.js +1 -1
- package/dist/esm/countdown-timer/hooks/useTimeLeft.js +1 -1
- package/dist/esm/post-purchase/product/components/ProductPrice.js +1 -1
- package/dist/esm/post-purchase/product/constants/ProductOfferPlaceholder.js +1 -1
- package/dist/esm/post-purchase/product/hooks/useGetMoneyLines.js +1 -1
- package/dist/esm/product/components/product-badge/ProductBadge.liquid.js +21 -21
- package/dist/esm/product/components/product-badge/common/styles.js +1 -1
- package/dist/esm/product/components/product-badge/utils/common.js +1 -1
- package/dist/esm/product/components/product-badge/utils/renderBadgeLiquid.js +3 -4
- package/dist/esm/product/components/product-button/hooks/useAddToCart.js +1 -1
- package/dist/esm/product/components/product-discount-tag/hooks/useGpDiscountTag.js +1 -1
- package/dist/esm/product/components/product-list/ProductListCarouselItem.liquid.js +3 -3
- package/dist/esm/product/components/product-list/ProductListGridItem.liquid.js +4 -4
- package/dist/esm/product/components/product-list-v3/ProductList.js +1 -1
- package/dist/esm/product/components/product-list-v3/ProductListCarouselItem.liquid.js +3 -3
- package/dist/esm/product/components/product-list-v3/ProductListGridItem.liquid.js +4 -4
- package/dist/esm/product/components/product-price/hooks/useGpPrice.js +1 -1
- package/dist/esm/product/components/product-variants/OptionVariantsNewFormat.liquid.js +41 -0
- package/dist/esm/product/components/product-variants/OptionVariantsOldFormat.liquid.js +66 -0
- package/dist/esm/product/components/product-variants/ProductVariants.liquid.js +40 -94
- package/dist/esm/product/components/product-variants/common/base/styles.js +1 -1
- package/dist/esm/product/components/product-variants/common/const.js +1 -0
- package/dist/esm/product/components/product-variants/components/color/color.liquid.js +3 -3
- package/dist/esm/product/components/product-view-more/ProductViewMore.liquid.js +1 -1
- package/dist/esm/product/components/product-view-more/common/helpers.js +1 -1
- package/dist/esm/product/components/product-wrap/Product.liquid.js +33 -31
- package/dist/esm/product/helpers/product-bundle.js +1 -1
- package/dist/esm/third-party/settings/BonLoyaltyRewardsReferrals/index.js +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cls as e,
|
|
1
|
+
import{cls as e,convertDecimalToNumber as t,formatMoney as r,makeStyleResponsive as i,getResponsiveValueByScreen as n}from"@gem-sdk/core";import{applyBundleDiscountAmount as o}from"../../../helpers/product-bundle.js";import{DiscountType as u}from"../../constants/product-bundle.js";let removeTrailingZeros=e=>e.replace(/\.00$/,""),getPriceDiffByPercent=(e,t)=>{if(!t)return"0";let r=1e3*t-1e3*e;return Math.round(100*r/(1e3*t))},getPriceDiffByValue=(e,t,i)=>removeTrailingZeros(r(t?(t-e).toFixed(2):"0",i)),getMinPrice=(e,i)=>{let n=e?.edges?.length&&e.edges.length>0?1/0:0;return e?.edges.forEach(({node:e})=>{if(!e)return;let r=t(e?.price);void 0!==r&&r<n&&(n=r)}),removeTrailingZeros(r(n.toString(),i))},checkNoDiscountState=(e,t)=>{let{discountPercentAmount:r}=o({currentVariant:e?.currentVariant,bundleItem:e?.bundleItem,options:{moneyFormat:t,useProductCompareAtPrice:e?.useProductCompareAtPrice}});return!(e?.bundleItem?.discountType===u.NoDiscount&&e?.useProductCompareAtPrice||Number(e?.bundleItem?.discountValue)&&r)&&!e?.currentVariant?.salePrice},getBadgeContent=(e,i,n)=>{if(!e.detail||!i?.trim()?.length)return i;let{detail:c,currentVariant:l}=e,{discountPercentAmount:a,discountAmount:d}=o({currentVariant:l,bundleItem:e?.bundleItem,options:{moneyFormat:n,useProductCompareAtPrice:e?.useProductCompareAtPrice}}),s=()=>e?.bundleItem?.discountType!==u.NoDiscount||e?.useProductCompareAtPrice?Number(e?.bundleItem?.discountValue)>0?`${a}%`:`${getPriceDiffByPercent(t(l?.price)??0,t(l?.salePrice)??0)||0}%`:"0%",p=()=>e?.bundleItem?.discountType!==u.NoDiscount||e?.useProductCompareAtPrice?Number(e?.bundleItem?.discountValue)>0?d:getPriceDiffByValue(t(l?.price)??0,t(l?.salePrice)??0,n):r("0",n),g=new Map([["{percent_discount}",s],["{amount_discount}",p],["{min_price}",()=>getMinPrice(c.variants,n)||0],["{inventory_quantity}",()=>l?.inventoryQuantity||0]]);return[...g.entries()].reduce((e,[t,r])=>e.replaceAll(t,r()),i)},checkDiscountContentProductBadge=e=>{if(!e)return!1;let t=/\{percent_discount\}|\{amount_discount\}/;return t.test(e)},getShapePlacementClass=(e,t,r="desktop")=>e?t?.[`--pos${deviceWithSurfix(r)}`]?"w-full h-full":"!gp-absolute":t?.[`--d${deviceWithSurfix(r)}`]?"":"!gp-inline-block gp-w-fit",getAlignShape=(t,r)=>r?"":e("gp-flex",{"gp-justify-start":t?.desktop==="left","gp-justify-center":t?.desktop==="center","gp-justify-end":t?.desktop==="right","tablet:gp-justify-start":t?.tablet==="left","tablet:gp-justify-center":t?.tablet==="center","tablet:gp-justify-end":t?.tablet==="right","mobile:gp-justify-start":t?.mobile==="left","mobile:gp-justify-center":t?.mobile==="center","mobile:gp-justify-end":t?.mobile==="right"}),convertToStyle=e=>Object.entries(e||{}).reduce((e,[t,r])=>{let i=new Map([["clipPath","clip-path"],["writingMode","writing-mode"],["borderRadius","border-radius"],["transform","transform"],["alignItems","align-items"],["maxWidth","max-width"]]),n=i.get(t)||t;return{...e,[n]:r}},{}),getWrapperStyle=e=>({[e?"z-index":"zIndex"]:2}),getWidthByShapeSize=(e,t)=>{let r={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let o=n(e,i,null),u=o?.width||t?.wrapperWidth;u&&(r={...r,[i]:u})}),r},getHeightByShapeSize=(e,t)=>{let r={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let o=n(e,i,null);r={...r,[i]:o?.height||t?.wrapperHeight}}),r},getSize=(e,t)=>{let r=i("w",getWidthByShapeSize(t,e)),n=i("h",getHeightByShapeSize(t,e));return{...r,...n}},getShapeWrapperPadding=e=>{let t={};if(1!==e)return t;let r=["desktop","mobile","tablet"];return r.forEach(e=>{t={...t,height:0,[`--p${"desktop"!==e?`-${e}`:""}`]:"50% 0"}}),t},deviceWithSurfix=e=>"desktop"===e?"":`-${e}`,getDeviceSpecificStyle=(e,t)=>{for(let r of({desktop:["desktop"],tablet:["tablet","desktop"],mobile:["mobile","tablet","desktop"]})[t])if(e?.[r])return e[r]},getIsNoDiscountState=({props:e,product:t,currentVariant:r,moneyFormat:i,useProductCompareAtPrice:n})=>{let{setting:o,"bundle-item":u}=e,c=checkDiscountContentProductBadge(o?.displayContent);return c&&checkNoDiscountState({detail:t,currentVariant:r,bundleItem:u,useProductCompareAtPrice:n},i)};export{checkDiscountContentProductBadge,checkNoDiscountState,convertToStyle,deviceWithSurfix,getAlignShape,getBadgeContent,getDeviceSpecificStyle,getIsNoDiscountState,getShapePlacementClass,getShapeWrapperPadding,getSize,getWidthByShapeSize,getWrapperStyle};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{CompareType as e}from"../types.js";let getMinValueForInventory=i=>i===e.ABOVE?0:i===e.BELOW?2:1,renderBadgeInFirstTime=(e,i
|
|
1
|
+
import{CompareType as e}from"../types.js";let getMinValueForInventory=i=>i===e.ABOVE?0:i===e.BELOW?2:1,renderBadgeInFirstTime=(e,i)=>`
|
|
2
2
|
{% assign isShow = true %}
|
|
3
3
|
{% assign conditionTriggers = "" %}
|
|
4
4
|
{% assign isInventoryStatus = false %}
|
|
@@ -16,9 +16,8 @@ import{CompareType as e}from"../types.js";let getMinValueForInventory=i=>i===e.A
|
|
|
16
16
|
{% assign price = variant.price | times: 1.0 %}
|
|
17
17
|
{% assign salePrice = variant.compare_at_price | times: 1.0 %}
|
|
18
18
|
{% assign priceSave = salePrice | minus: price %}
|
|
19
|
-
{% assign
|
|
20
|
-
{%
|
|
21
|
-
{% if priceSave <= 0 or isDiscountContent == false or isTextBadge == false %}
|
|
19
|
+
{% assign isEmptyBadgeContent = ${!i} %}
|
|
20
|
+
{% if priceSave <= 0 or isEmptyBadgeContent == true %}
|
|
22
21
|
{% assign isShow = false %}
|
|
23
22
|
{% endif %}
|
|
24
23
|
{% if isShow %}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useRenderMode as e,useProduct as t,useCurrency as r,useQuantity as i,useProductProperties as s,useCurrentVariant as n,useHasPreSelected as o,useStickyStore as a,useProductStore as u,useCreateCart as l,useAddToCart as c,useCurrentVariantInStock as
|
|
1
|
+
import{useRenderMode as e,useProduct as t,useCurrency as r,useQuantity as i,useProductProperties as s,useCurrentVariant as n,useHasPreSelected as o,useStickyStore as a,useProductStore as u,useCreateCart as l,useAddToCart as c,convertDecimalToNumber as m,useCurrentVariantInStock as b}from"@gem-sdk/core";import{useRef as d,useEffect as f,useCallback as p}from"react";import{addToCartTracking as v}from"../../../helpers/tracking.js";import{useDispatchAfterSubmitEvent as g}from"./useDispatchAfterSubmitEvent.js";import{useCartMessage as I}from"./useCartMessage.js";import{useCartOperations as k}from"./useCartOperations.js";let useBtnAddToCart=({styles:D,setting:S,builderProps:E})=>{let h=d(null),{isEditMode:j,isPreviewSharePageMode:y}=e(),C=t(),{currency:A}=r(),{quantity:M}=i(),O=s(),w=n(),{hasPreSelected:B}=o(),T=a(e=>e.setStickyVisible),q=u(e=>e.updateIsSubmit),x=g(E?.uid),{showMessage:L,notiComponent:U}=I(D,S),{handleSuccess:V,handleError:z,cartId:F}=k(S,L,x),{isMutating:G,trigger:H}=l({onSuccess:V,onError:z}),{isMutating:J,trigger:K}=c({onSuccess:V,onError:z});f(()=>{let e=new IntersectionObserver(e=>{let t=e[0];T(t?.isIntersecting)},{threshold:.1}),t=h.current;return h.current&&e.observe(h.current),()=>{t&&e.unobserve(t)}},[T]);let N=p(()=>{if(!w?.baseID||!M||!C?.baseID||void 0!==B&&!B||j||y)return;let e=O?.some(e=>e.required&&!e.value);if(q(!0),e)return;let t=O?.filter(e=>!!e.value)?.map(e=>({key:e.key,value:e.value}));v({quantity:M,currency:A,id:C?.baseID,name:C?.title,brand:C?.vendor,sku:w.sku,price:m(w?.price),variant:w.title});let r={quantity:M,attributes:t,variantId:w.baseID};S?.actionEffect!=="buy-now"&&F?K({cartId:F,lines:[r]}):H({items:[r]})},[j,y,F,A,M,O,B,C?.title,C?.vendor,C?.baseID,w?.sku,w?.price,w?.title,w?.baseID,S?.actionEffect,H,K,q]),P=b(),Q=G||J,R=w?S?.outOfStockLabel:"Unavailable";return{addToCartRef:h,isLoading:Q,isInStock:P,notiComponent:U,outOfStockLabel:R,addToCart:N}};export{useBtnAddToCart};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useMoneyFormat as e,useEditorMode as t,useProduct as r,useCurrentVariant as n,useQuantity as o,
|
|
1
|
+
import{useMoneyFormat as e,useEditorMode as t,useProduct as r,useCurrentVariant as n,useQuantity as o,convertDecimalToNumber as u,useFormatMoney as i,useProductBundleDiscount as p,formatMoney as c}from"@gem-sdk/core";import{useMemo as s}from"react";import{applyBundleDiscountAmount as a}from"../../../helpers/product-bundle.js";import{DiscountType as m}from"../../constants/product-bundle.js";let useGpDiscountTag=l=>{let{setting:d,...g}=l,{customContent:f}=d??{},b=g["bundle-item"],{moneyFormat:h}=e(),D=t(),$=r(),j=n(),{quantity:y,hasUpdatePrice:G}=o(),P=s(()=>G&&f?.unit!=="percentage"?y??1:1,[G,f?.unit,y]),T=u(j?.price)??0,k=u(j?.salePrice)??0,x=(k-T)*P,C=i(x<0?0:x,d?.moneyWithCurrentFormat||!1),F=s(()=>{if(!k&&0!==k||!T&&0!==T)return`${f?.unit==="percentage"?"0%":C}`;if(f?.unit==="percentage"){let e=Math.round(x/(k/100));return`${e<0?0:e}%`}return`${C}`},[f?.unit,C,T,x,k]),{useProductCompareAtPrice:I}=p(),{discountPercentAmount:M}=a({currentVariant:j,bundleItem:b,options:{moneyFormat:h,useProductCompareAtPrice:I}}),N=s(()=>{if(!b)return 0;let{discountPercentAmount:e,discountAmount:t}=a({currentVariant:j,bundleItem:b,options:{moneyFormat:h,useProductCompareAtPrice:I}}),{discountType:r}=b,{unit:n}=f||{};return r!==m.NoDiscount||I?"percentage"===n?`${e}%`:t:"percentage"===n?"0%":c("0",h)},[b,j,h,I,f]),W=s(()=>b?N:F,[N,b,F]),q=$?.baseID?.replace("gid://shopify/Product/",""),v=s(()=>{let e=b?M<=0:x<=0;return"edit"===D&&e},[b,M,D,x]);return{mode:D,product:$,salePrice:k,priceSave:x,currentProductId:q,unitCustomDisplay:W,shouldPlaceholderNoDiscount:v}};export{useGpDiscountTag};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{template as t}from"@gem-sdk/core";import{getClass as e}from"./common/classes.js";let ProductListItem=n=>{let{pageContext:o,children:a}=n,{productItemClass:r,gpProductClass:
|
|
1
|
+
import{template as t}from"@gem-sdk/core";import{getClass as e}from"./common/classes.js";let ProductListItem=n=>{let{pageContext:o,children:a}=n,{productItemClass:r,gpProductClass:i}=e(n);return t`
|
|
2
2
|
<gp-product
|
|
3
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "formId": "{{ product_form_id }}"}'
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "inventoryQuantity": {{ variant.inventory_quantity }}, "formId": "{{ product_form_id }}"}'
|
|
4
4
|
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }},"pageContext" : ${JSON.stringify(o)}}'
|
|
5
|
-
class="${
|
|
5
|
+
class="${i}"
|
|
6
6
|
|
|
7
7
|
>
|
|
8
8
|
{%- form 'product', product, id: product_form_id, class: 'form contents ${r}', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{template as t,RenderChildren as e}from"@gem-sdk/core";import{getClass as n}from"./common/classes.js";let ProductListItem=o=>{let{pageContext:a,rawChildren:r}=o,{productItemClass:
|
|
1
|
+
import{template as t,RenderChildren as e}from"@gem-sdk/core";import{getClass as n}from"./common/classes.js";let ProductListItem=o=>{let{pageContext:a,rawChildren:r}=o,{productItemClass:i,gpProductClass:c}=n(o),d=()=>t`
|
|
2
2
|
${r?.map((n,o)=>{if(n)return t`
|
|
3
3
|
${e({...n,index:o})}
|
|
4
4
|
`}).join("")}
|
|
5
5
|
`;return t`
|
|
6
6
|
<gp-product
|
|
7
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "formId": "{{ product_form_id }}"}'
|
|
7
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "inventoryQuantity": {{ variant.inventory_quantity }}, "formId": "{{ product_form_id }}"}'
|
|
8
8
|
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }},"pageContext" : ${JSON.stringify(a)}}'
|
|
9
|
-
class="${
|
|
9
|
+
class="${c}"
|
|
10
10
|
|
|
11
11
|
>
|
|
12
|
-
{%- form 'product', product, id: product_form_id, class: 'form contents ${
|
|
12
|
+
{%- form 'product', product, id: product_form_id, class: 'form contents ${i}', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
13
13
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
14
14
|
<input type="hidden" min="1" name="quantity" value="{{ quantity }}" />
|
|
15
15
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as t,jsxs as o}from"react/jsx-runtime";import r from"next/dynamic";import d from"../../../common/components/Loading.js";import{useState as l,useMemo as i,useEffect as a}from"react";import{useRenderMode as c,useCurrentDevice as
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as o}from"react/jsx-runtime";import r from"next/dynamic";import d from"../../../common/components/Loading.js";import{useState as l,useMemo as i,useEffect as a}from"react";import{useRenderMode as c,useCurrentDevice as s,usePageType as n,usePageStore as u,useFetchHandle as m,hasPublicStoreFrontData as g,createStoreFrontFetcher as h,useProductQuery as p,useProductsQueryAll as P,useProductsQuery as f,useCollectionQuery as b,flattenConnection as k,ProductListProvider as I,filterToolbarPreview as T}from"@gem-sdk/core";import y from"../SalePageProductListWarning.js";import v from"next/head";import O from"./ProductListGridLayout.js";import N from"./ProductListCarouselLayout.js";import{getStyle as S}from"./common/styles.js";import{If as C}from"@gem-sdk/system";import{getClass as E}from"./common/classes.js";import{getData as w}from"./common/helpers.js";import{getPropertyByDevice as L}from"../../../dialog/common/helpers.js";let ProductNotFound=r(()=>import("../ProductNotFound.js"),{loading:d}),ProductList=r=>{let{children:W,styles:j,builderProps:x,setting:G,builderAttrs:A}=r,{isRelatedProduct:M,productSetting:B}=w(r),F=B.relatedTag&&B.relatedTag[0],{isEditMode:Q,isPreviewSharePageMode:z}=c(),D=s(),H=n(),R=u(e=>e.dynamicProduct),$=u(e=>e.dynamicCollection),[_,V]=l(1),[q,U]=l(!0),[J,K]=l(),[X,Y]=l(!1),Z="GP_FUNNEL_PAGE"===H,ee="GP_COLLECTION"==H;ee&&(B.productSrc="DynamicCollection",B.collectionId=$?.collectionId??"latest");let et=B?.productSrc??"Collection",eo=R?.productId&&R?.productId!==B.relatedProductId?R?.productId:B.relatedProductId,er=m(),ed=u(e=>e.publicStoreFrontData),el=i(()=>g(ed)?h(ed):er,[ed]),{data:ei}=p(M&&eo?eo:void 0,{revalidateOnMount:Q||z},el),ea=B.relatedTag&&"tags"===B.relatedTag[0]&&(!ei?.tags||ei?.tags.length===0),ec=B.relatedTag&&"collection"===B.relatedTag[0]&&(!ei?.collections?.edges||ei?.collections.edges.length===0),es=B.relatedTag&&"vendor"===B.relatedTag[0]&&!ei?.vendor,en=ea||ec||es,eu=P(J,{revalidateOnMount:Q||z},el),em=Q||z,eg=f("PickProduct"===et?B?.productIds:void 0,{revalidateOnMount:em},{defaultSelectedProductCount:B?.numOfSelectedProducts}),eh=i(()=>({id:B?.collectionId??"latest",numberOfProducts:G?.numberOfProducts??4,orderBy:G?.orderBy}),[B?.collectionId,Number(G?.numberOfProducts),G?.orderBy]),ep=b("PickProduct"!==et?eh:void 0,{revalidateOnMount:em});a(()=>{if(M&&ei&&B.relatedTag&&"recommended-product"!==B.relatedType){let e;switch(Y(!1),B.hasRelatedExclude&&(e=B?.relatedExclude&&B.relatedExclude.split(",").map(e=>e.trim())),B.relatedTag[0]){case"vendor":K({vendor:B.relatedTag&&"vendor"===B.relatedTag[0]?ei?.vendor:"",limit:G?.numberOfProducts,idNEQ:ei.id});break;case"collection":{let t;let o=ei?.collections?.edges.map(e=>e.node?.id);if(!o||o?.length===0){Y(!0);break}K(t=e&&e.length>0?{idNEQ:ei.id,hasCollectionProductsWith:[{hasCollectionWith:[{idIn:o},{titleNotIn:e}]}],limit:G?.numberOfProducts}:{idNEQ:ei.id,hasCollectionProductsWith:[{hasCollectionWith:[{idIn:o}]}],limit:G?.numberOfProducts});break}case"tags":{let t;if(!ei.tags||0===ei.tags.length){Y(!0);break}K(t=e&&e.length>0?{idNEQ:ei.id,hasProductTagsWith:[{hasTagsWith:[{nameIn:ei.tags},{nameNotIn:e}]}],limit:G?.numberOfProducts}:{idNEQ:ei.id,hasProductTagsWith:[{hasTagsWith:[{nameIn:ei.tags}]}],limit:G?.numberOfProducts})}}}},[ei,B.relatedType,B.relatedTag,G?.numberOfProducts,B.relatedExclude,B.hasRelatedExclude,M]);let eP="PickProduct"===et?eg.isValidating:ep.isValidating,ef="PickProduct"===et?eg.isLoading:ep.isLoading,eb="PickProduct"===et?eg.error:ep.error,ek=ep.data?.collections?.edges?.[0]?.node,eI="PickProduct"===et?k(eg.data?.products):k(ek?.products),eT=u(e=>e.assignedProductIds),ey=u(e=>e.isApplyAllProducts),ev=i(()=>(eT??[]).length>0&&!ey||ey,[eT,ey]),eO=eu?.data?.products&&ev?k(eu?.data?.products):[],eN=M?eO:"PickProduct"===et&&B?.productIds?.length?B?.productIds?.map(e=>eI?.find(t=>t?.baseID===e)).filter(Boolean)??eI:"PickProduct"!==et?eI:eI.filter((e,t)=>t<(B?.numOfSelectedProducts??4)),eS=i(()=>X&&M&&Q||!eN.length&&!ef&&q&&Q,[q,ef,X,M,Q,eN.length]),eC=i(()=>!eN||X&&M,[X,M,eN]),eE=i(()=>{if(!G?.sameHeight)return[];let e=0,t=Math.ceil((eN?.length??0)/+(G?.slidesToShow?.[D]??1));return Array.from(Array(eN?.length??0)).map((o,r)=>(r>=+(G?.slidesToShow?.[D]??1)*(e+1)&&++e,{gridRow:`${1+_*e}/${_+1+_*e}`,marginBottom:e+1<t?L(j?.horizontalGutter,D):void 0}))},[G?.sameHeight,G?.slidesToShow,_,eN?.length,D,j?.horizontalGutter]),ew=i(()=>eP||ef||eb||!eN||X&&M,[eb,ef,X,M,eP,eN]);a(()=>{ew||setTimeout(()=>{let{builderData:e}=x??{},t=e?.childrens?.[0];if(!t)return;let o=document.querySelector(`[data-id=${t}] div`);o&&V(o.childElementCount||1)},Q?0:500)},[x,ew,Q]);let eL=i(()=>({collection:ek,products:eN,settings:{loop:G?.loop??{desktop:!1},scrollMode:G?.scrollMode??{desktop:"snap"},slidesToShow:G?.slidesToShow??{desktop:4,tablet:3,mobile:1},layout:j?.layout,dot:G?.dot,dotStyle:G?.dotStyle,arrow:G?.arrow,controlOverContent:G?.controlOverContent},styles:{horizontalGutter:j?.horizontalGutter,verticalGutter:j?.verticalGutter,fullWidth:j?.fullWidth,spacing:j?.spacing,width:j?.width,height:j?.height}}),[ek,eN,G,j]);if(x?.isPreview&&Z)return e(t,{});if(eS)return e(t,{children:C(q,e(ProductNotFound,{builderAttrs:A,collectionHandle:ek?.handle,productSrc:et,onClose:()=>U(!1),children:W,relatedTagString:F,assignProductNoTags:en,noAssignedProduct:!eo}))});let{productListWrapStyle:eW,productListContentStyle:ej,productListWrapAlignStyle:ex}=S(r),{productListWrapClass:eG}=E(r),eA=()=>e(t,{children:C(j?.layout==="grid",e(O,{...r,productSortedById:eN,generateGridRowArray:eE}),e(N,{...r,productSortedById:eN}))});return o("div",{...A,className:eG,style:eW,children:[!!j?.preloadBgImage&&o(v,{children:[!!j.backgroundImage?.desktop?.image?.src&&e("link",{rel:"preload",href:j.backgroundImage.desktop.image.src,as:"image"}),!!j.backgroundImage?.tablet?.image?.src&&e("link",{rel:"preload",href:j.backgroundImage?.tablet?.image?.src,as:"image"}),!!j.backgroundImage?.mobile?.image?.src&&e("link",{rel:"preload",href:j.backgroundImage?.mobile?.image?.src,as:"image"})]}),eP||ef?e(d,{}):eb?o("div",{children:["Error: ",eb?.message]}):eC?e("div",{children:"Products not found"}):e(I,{...eL,children:e("div",{className:"gp-flex gp-w-full",style:ex,children:o("div",{style:ej,children:[Z&&e(y,{}),eA()]})})}),T(W,!0)]})};export{ProductList as default};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{template as t}from"@gem-sdk/core";import{getClass as e}from"./common/classes.js";let ProductListItem=n=>{let{pageContext:o,children:a}=n,{productItemClass:r,gpProductClass:
|
|
1
|
+
import{template as t}from"@gem-sdk/core";import{getClass as e}from"./common/classes.js";let ProductListItem=n=>{let{pageContext:o,children:a}=n,{productItemClass:r,gpProductClass:i}=e(n);return t`
|
|
2
2
|
<gp-product
|
|
3
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "formId": "{{ product_form_id }}"}'
|
|
3
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 ,"inventoryQuantity": {{ variant.inventory_quantity }}, "formId": "{{ product_form_id }}"}'
|
|
4
4
|
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }},"pageContext" : ${JSON.stringify(o)}}'
|
|
5
|
-
class="${
|
|
5
|
+
class="${i}"
|
|
6
6
|
|
|
7
7
|
>
|
|
8
8
|
{%- form 'product', product, id: product_form_id, class: 'form contents ${r}', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{template as t,RenderChildren as e}from"@gem-sdk/core";import{getClass as n}from"./common/classes.js";let ProductListItem=o=>{let{pageContext:a,rawChildren:r}=o,{productItemClass:
|
|
1
|
+
import{template as t,RenderChildren as e}from"@gem-sdk/core";import{getClass as n}from"./common/classes.js";let ProductListItem=o=>{let{pageContext:a,rawChildren:r}=o,{productItemClass:i,gpProductClass:c}=n(o),d=()=>t`
|
|
2
2
|
${r?.map((n,o)=>{if(n)return t`
|
|
3
3
|
${e({...n,index:o})}
|
|
4
4
|
`}).join("")}
|
|
5
5
|
`;return t`
|
|
6
6
|
<gp-product
|
|
7
|
-
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 , "formId": "{{ product_form_id }}"}'
|
|
7
|
+
gp-context='{"variantSelected": {{ variant | json | escape }}, "inventory_management": {{ variant.inventory_management | json | escape }}, "inventory_policy": {{ variant.inventory_policy | json | escape }}, "quantity": 1 ,"inventoryQuantity": {{ variant.inventory_quantity }}, "formId": "{{ product_form_id }}"}'
|
|
8
8
|
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }},"pageContext" : ${JSON.stringify(a)}}'
|
|
9
|
-
class="${
|
|
9
|
+
class="${c}"
|
|
10
10
|
|
|
11
11
|
>
|
|
12
|
-
{%- form 'product', product, id: product_form_id, class: 'form contents ${
|
|
12
|
+
{%- form 'product', product, id: product_form_id, class: 'form contents ${i}', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
|
13
13
|
<input type="hidden" name="id" value="{{ variant.id }}" />
|
|
14
14
|
<input type="hidden" min="1" name="quantity" value="{{ quantity }}" />
|
|
15
15
|
<button type="submit" onclick="return false;" style="display:none;"></button>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useRef as e,useMemo as r}from"react";import{useTransition as t}from"../../product-variants/common/common.js";import{useEditorMode as c,useQuantity as i,useCurrentVariant as a,useProductBundleDiscount as n,
|
|
1
|
+
import{useRef as e,useMemo as r}from"react";import{useTransition as t}from"../../product-variants/common/common.js";import{useEditorMode as c,useQuantity as i,useCurrentVariant as a,useProductBundleDiscount as n,convertDecimalToNumber as o,useInteraction as u,useProduct as p,useShopStore as d,useFormatMoney as l}from"@gem-sdk/core";let useGpPrice=m=>{let{setting:s,builderProps:g}=m,b=e(null),h=c(),{quantity:y,hasUpdatePrice:P}=i(),v=a(),{useProductCompareAtPrice:f}=n(),w=m["bundle-item"],V=o(v?.price)??0,k=o(v?.salePrice)??0,q=s?.priceType==="compare",{trigger:T}=u(),x=p(),C=x?.baseID?.replace("gid://shopify/Product/",""),E=d(e=>e.showPriceCurrency),G=r(()=>w?.quantity?w.quantity:P&&y||1,[y,P,w?.quantity]),$=r(()=>{let e=Number(w?.discountValue);return w?.discountType==="percentage"?V*G*e/100:e},[w?.discountType,w?.discountValue,V,G]),j=r(()=>w?.discountValue?f?(k||V)*G:V*G:k*G,[w?.discountValue,V,G,k,f]),D=r(()=>{let e=V*G;return q?j:$?Math.max(0,e-$):e},[V,G,$,j,q]),I=(e,r)=>{T({event:"price"===r?"gp:rollback:price-change":"gp:rollback:compare-price-change",selector:`[data-id="${g?.uid}"]`,element:b.current}),T({event:"price"===r?"gp:price-change":"gp:compare-price-change",data:e,selector:`[data-id="${g?.uid}"]`,element:b.current})};t(e=>{e!==V&&I(V,"price")},[V]),t(e=>{e!==k&&I(k,"compare")},[k]);let M=()=>{if("edit"!==h)return;let e=new CustomEvent("editor:product-source-no-data-warning",{bubbles:!0,detail:{uid:g?.uid,value:!D&&q,tag:"ProductPrice"}});window.dispatchEvent(e)},N=l(D??0,E||!1),z=q&&!D,A="edit"!==h&&z;return{elementRef:b,moneyFormatted:N,currentProductId:C,isNoComparePrice:z,isNoComparePriceILP:A,emitNoDataSignal:M}};export{useGpPrice};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import{template as e}from"@gem-sdk/core";import{Liquid as s,LiquidIf as i}from"@gem-sdk/system";import{OPTION_VALUES_DELIMITER as n}from"./common/const.js";let renderOptionValuesNewFormatSwatches=t=>{let{renderVariantItem:o,variantPresetsLiquid:r}=t;return e`
|
|
2
|
+
${s("{%- assign optionRendered = false -%}")}
|
|
3
|
+
${s("{%- assign swatches = shop.metafields.GEMPAGES.swatchesJSONFormat.value -%}")}
|
|
4
|
+
|
|
5
|
+
${s(`{% for swatch in swatches %}
|
|
6
|
+
{%- assign optionTitle = swatch.optionTitle -%}
|
|
7
|
+
{%- assign optionType = swatch.optionType -%}
|
|
8
|
+
{%- assign labelsString = "" -%}
|
|
9
|
+
{%- assign colorArraysString = "" -%}
|
|
10
|
+
{%- assign imageUrlsString = "" -%}
|
|
11
|
+
|
|
12
|
+
{% for optionValue in swatch.optionValues %}
|
|
13
|
+
{%- assign labelsString = labelsString | append: optionValue.label | append: '${n}' -%}
|
|
14
|
+
{%- assign colorsJoined = optionValue.colors | join: '${n}' -%}
|
|
15
|
+
{%- assign colorArraysString = colorArraysString | append: colorsJoined | append: '${n}' -%}
|
|
16
|
+
{%- assign imageUrlsString = imageUrlsString | append: optionValue.imageUrl | append: '${n}' -%}
|
|
17
|
+
{% endfor %}
|
|
18
|
+
|
|
19
|
+
{%- assign labels = labelsString | split: '${n}' | slice: 0, labelsString.size -%}
|
|
20
|
+
{%- assign colorStrings = colorArraysString | split: '${n}' | slice: 0, colorArraysString.size -%}
|
|
21
|
+
{%- assign imageUrls = imageUrlsString | split: '${n}' | slice: 0, imageUrlsString.size -%}
|
|
22
|
+
|
|
23
|
+
{% if optionTitle == option.name %}
|
|
24
|
+
{%- assign variantPresetString = "${r}" -%}
|
|
25
|
+
{%- assign optionName = option.name | replace: "'", "'" | replace: '"', '"' -%}
|
|
26
|
+
{%- assign items = variantPresetString | split: '($2)' -%}
|
|
27
|
+
{%- assign type = 'dropdown' -%}
|
|
28
|
+
|
|
29
|
+
{% for item in items %}
|
|
30
|
+
{%- assign itemPreset = item | split: '($1)' -%}
|
|
31
|
+
{% if itemPreset[0] == optionName %}{%- assign type = itemPreset[1] -%}{% endif %}
|
|
32
|
+
{% if itemPreset[0] == 'base' %}{%- assign type = itemPreset[1] -%}{% endif %}
|
|
33
|
+
{% endfor %}
|
|
34
|
+
{%- assign optionRendered = true -%}
|
|
35
|
+
|
|
36
|
+
${o({showDropdown:!0})}
|
|
37
|
+
{% endif %}
|
|
38
|
+
{% endfor %}`)}
|
|
39
|
+
|
|
40
|
+
${i("optionRendered == false",o({showDropdown:!1,isRenderDefault:!0,typeOfOption:"optionType"}))}
|
|
41
|
+
`};export{renderOptionValuesNewFormatSwatches};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import{Liquid as e,LiquidFor as s,LiquidIf as t}from"@gem-sdk/system";import{template as i}from"@gem-sdk/core";let renderOptionValuesOld=a=>{let{renderVariantItem:n,variantPresetsLiquid:o}=a;return i`
|
|
2
|
+
${e("{%- assign optionRendered = false -%}")}
|
|
3
|
+
${e("{%- assign swatches = shop.metafields.GEMPAGES.swatches -%}")}
|
|
4
|
+
${e("{%- assign swatchesItems = swatches | split: '($1)' -%}")}
|
|
5
|
+
|
|
6
|
+
${s("swatchesItem in swatchesItems",`
|
|
7
|
+
${e('{%- assign colorArraysString = "" -%}')}
|
|
8
|
+
${e('{%- assign labelsString = "" -%}')}
|
|
9
|
+
${e('{%- assign imageUrlsString = "" -%}')}
|
|
10
|
+
${e("{%- assign attrItems = swatchesItem | split: '($3)' -%}")}
|
|
11
|
+
|
|
12
|
+
${s("attrItem in attrItems",`
|
|
13
|
+
${e("{%- assign attrs = attrItem | split: '($2)' -%}")}
|
|
14
|
+
${e("{%- assign optionKey = attrs[0] -%}")}
|
|
15
|
+
${e("{%- assign optionValue = attrs[1] -%}")}
|
|
16
|
+
${e(`
|
|
17
|
+
{% if optionKey == 'optionTitle' %}
|
|
18
|
+
{% assign optionTitle = optionValue %}
|
|
19
|
+
{% elsif optionKey == 'optionType' %}
|
|
20
|
+
{% assign optionType = optionValue %}
|
|
21
|
+
{% endif %}
|
|
22
|
+
`)}
|
|
23
|
+
|
|
24
|
+
${t('optionKey == "optionValues"',`
|
|
25
|
+
${e("{%- assign opValueItems = optionValue | split: '($4)' -%}")}
|
|
26
|
+
${s("opValueItem in opValueItems",`
|
|
27
|
+
${e("{%- assign opValueItemAttrs = opValueItem | split: '($6)' -%}")}
|
|
28
|
+
${s("opValueItemAttr in opValueItemAttrs",`
|
|
29
|
+
${e("{%- assign attrs = opValueItemAttr | split: '($5)' -%}")}
|
|
30
|
+
${e("{%- assign opValueItemKey = attrs[0] -%}")}
|
|
31
|
+
${e("{%- assign opValueItemValue = attrs[1] -%}")}
|
|
32
|
+
|
|
33
|
+
${t('opValueItemKey == "label"',`${e("{%- assign labelsString = labelsString | append: opValueItemValue -%}")}
|
|
34
|
+
${e('{%- assign labelsString = labelsString | append: "($8)" -%}')}`)}
|
|
35
|
+
|
|
36
|
+
${t('opValueItemKey == "colors"',`${e("{%- assign colorArraysString = colorArraysString | append: opValueItemValue -%}")}
|
|
37
|
+
${e('{%- assign colorArraysString = colorArraysString | append: "($8)" -%}')}`)}
|
|
38
|
+
|
|
39
|
+
${t('opValueItemKey == "imageUrl"',`${e("{%- assign imageUrlsString = imageUrlsString | append: opValueItemValue -%}")}
|
|
40
|
+
${e('{%- assign imageUrlsString = imageUrlsString | append: "($8)" -%}')}`)}
|
|
41
|
+
`)}
|
|
42
|
+
`)}
|
|
43
|
+
`)}
|
|
44
|
+
`)}
|
|
45
|
+
|
|
46
|
+
${e("{%- assign labels = labelsString | split: '($8)' -%}")}
|
|
47
|
+
${e("{%- assign colorStrings = colorArraysString | split: '($8)' -%}")}
|
|
48
|
+
${e("{%- assign imageUrls = imageUrlsString | split: '($8)' -%}")}
|
|
49
|
+
|
|
50
|
+
${t("optionTitle == option.name",`
|
|
51
|
+
${e(`{%- assign variantPresetString = "${o}" -%}`)}
|
|
52
|
+
${e('{%- assign optionName = option.name | replace: "\'", "'" | replace: \'"\', """ -%}')}
|
|
53
|
+
${e("{%- assign items = variantPresetString | split:'($2)' -%}")}
|
|
54
|
+
${e("{%- assign type = 'dropdown' -%}")}
|
|
55
|
+
${s("item in items",`
|
|
56
|
+
${e("{%- assign itemPreset = item | split:'($1)' -%}")}
|
|
57
|
+
${t("itemPreset[0] == optionName",e("{%- assign type = itemPreset[1] -%}"))}
|
|
58
|
+
${t('itemPreset[0] == "base"',e("{%- assign type = itemPreset[1] -%}"))}
|
|
59
|
+
`)}
|
|
60
|
+
${e("{%- assign optionRendered = true -%}")}
|
|
61
|
+
${n({showDropdown:!0})}
|
|
62
|
+
`)}
|
|
63
|
+
`)}
|
|
64
|
+
|
|
65
|
+
${t("optionRendered == false",n({showDropdown:!1,isRenderDefault:!0,typeOfOption:"optionType"}))}
|
|
66
|
+
`};export{renderOptionValuesOld};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
3
|
-
${v(
|
|
1
|
+
import{template as e,isLocalEnv as t,baseAssetURL as s,DEVICES as i,getResponsiveValueByScreen as o}from"@gem-sdk/core";import a from"../../../text/components/Text.liquid.js";import n from"./components/variants/index.liquid.js";import r from"./components/dropdown-swatches/Dropdown.liquid.js";import p from"./components/dropdown-group/DropdownGroup.liquid.js";import{getSettingPreloadData as l}from"../../../helpers.js";import{mappingVariantStyles as d}from"./utils/mappingVariantStyles.js";import{createClass as m,createStyle as c,createAttr as u,Liquid as f,LiquidIf as v,If as $,LiquidFor as _}from"@gem-sdk/system";import{getAttrs as g}from"./common/main/getAttr.js";import{getVariantOptionGroupStyle as h,getWrapperStyle as y}from"./common/main/styles.js";import{getVariantOptionGroupClass as j,getWrapDropdownClass as w}from"./common/main/classes.js";import{getTextVariantTitleData as S,getDropdownGroupData as A}from"./common/main/getData.js";import{getWrapVariantOptionClass as P}from"./common/variants/classes.js";import{getStyleOfObject as D}from"../../helpers/function.js";import{getMarginBottomStyle as V}from"./common/variants/styles.js";import{renderOptionValuesNewFormatSwatches as b}from"./OptionVariantsNewFormat.liquid.js";import{renderOptionValuesOld as E}from"./OptionVariantsOldFormat.liquid.js";let DEFAULT_ADVANCED_DISPLAY_SETTING={desktop:!0,tablet:!0,mobile:!0},ProductVariants=N=>{let{builderProps:T,styles:O,setting:x,advanced:q}=N,{align:G,swatchItemWidth:C,dropdownItemWidth:F,swatchSpacing:I,optionTypo:k,marginBottom:L}=O??{},{label:J,optionType:z,showAsSwatches:M,layout:U,hasPreSelected:W}=x??{},R=q?.d??DEFAULT_ADVANCED_DISPLAY_SETTING,{uid:Y}=T??{},H="groupOption"===z,K=()=>{let e={};return i.forEach(t=>{let s=o(C,t);e[t]="auto"===s}),e},Q=()=>{let e={};return i.forEach(t=>{e[t]=F?.[t]==="fill"}),e},B=x?.variantPresets?d(x?.variantPresets,O):[],X=B?.map(e=>({...e,presets:{[e.optionType]:e.presets[e.optionType]}})),Z={...x,variantPresetsOptionType:X},ee=e=>{let t={"'":"'",'"':"""},s=e;for(let i in t)e.indexOf(i)>=0&&(s=s.replaceAll(i,t[i]));return s},et=()=>x?.variantPresets?.map(e=>`${ee(e.optionName)}($2)${e.optionType}`).join("($1)"),es=()=>x?.variantPresets?.filter(e=>!!e?.hide)?.map(e=>e.optionName).join(","),ei=({showDropdown:t,isRenderDefault:s,typeOfOption:i})=>e`
|
|
2
|
+
${_("value in values",n({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:M,uid:Y,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:W?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:i,activeClass:W?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...O,...Z,swatchAutoWidth:K(),optionTypo:k,isRenderDefault:s}))}
|
|
3
|
+
${v(t?'type == "dropdown"':"false",r({...O,...Z,swatchAutoWidth:Q(),optionTypo:k}))}`,eo=x?.variantPresets?.map(e=>({name:ee(e.optionName),type:e.optionType})).map(e=>`${e.name}($1)${e.type}`).join("($2)").toString(),ea={renderVariantItem:ei,variantPresetsLiquid:eo??""},en=m(j(G)),er=c(h(I,I)),ep=S(N,"Liquid"),el=m(P(U,G)),ed=()=>e`
|
|
4
|
+
${f(`{%- assign presets = "${et()}" | split: '($1)' -%}`)}
|
|
5
|
+
${f(`{% assign hiddenPresetOptions = "${es()}" | split: ',' %}`)}
|
|
4
6
|
|
|
5
|
-
${
|
|
7
|
+
${f(`{% assign all_option_names = options | map: 'name' %}
|
|
6
8
|
{% assign filtered_options_string = '' %}
|
|
7
9
|
{% assign delimiter = '||' %}
|
|
8
10
|
|
|
@@ -25,29 +27,29 @@ import{composeMemo as e,template as t,DEVICES as s,getResponsiveValueByScreen as
|
|
|
25
27
|
|
|
26
28
|
{% assign filtered_options_array = filtered_options_string | split: delimiter %}`)}
|
|
27
29
|
|
|
28
|
-
${
|
|
30
|
+
${f("{% assign last_option_name = filtered_options_array | last %}")}
|
|
29
31
|
|
|
30
|
-
${
|
|
32
|
+
${_("option in options",`
|
|
31
33
|
<div
|
|
32
34
|
option-name="{{option.name | escape}}"
|
|
33
|
-
class="${
|
|
34
|
-
style="${
|
|
35
|
+
class="${el} ${v("hiddenPresetOptions contains option.name","gp-hidden")}"
|
|
36
|
+
style="${D(V(L))}${f("{% if forloop.last or option.name == last_option_name %}--mb:0;--mb-mobile:0;--mb-tablet:0;{% endif %}")}"
|
|
35
37
|
>
|
|
36
|
-
${
|
|
37
|
-
${
|
|
38
|
-
${
|
|
39
|
-
${
|
|
40
|
-
${
|
|
38
|
+
${f("{%- assign showVariantClass = 'variant-display' -%}")}
|
|
39
|
+
${f("{%- assign optionName = option.name -%}")}
|
|
40
|
+
${_("preset in presets",`
|
|
41
|
+
${f("{%- assign presetDetail = preset | split: '($2)' -%}")}
|
|
42
|
+
${v("presetDetail[1] == 'dropdown' and presetDetail[0] == optionName",`${f("{%- assign showVariantClass = '' -%}")} ${f("{%- break -%}")}`)}
|
|
41
43
|
`)}
|
|
42
|
-
${
|
|
44
|
+
${$(J,a(ep)," ")}
|
|
43
45
|
<div
|
|
44
46
|
variant-option-name="{{option.name | escape}}"
|
|
45
|
-
class="${
|
|
46
|
-
style="${
|
|
47
|
+
class="${en}"
|
|
48
|
+
style="${D(er)}"
|
|
47
49
|
>
|
|
48
|
-
${
|
|
49
|
-
${
|
|
50
|
-
${
|
|
50
|
+
${f("{%- assign values = option.values -%}")}
|
|
51
|
+
${f("{%- assign rootForloop = forloop.index0 -%}")}
|
|
52
|
+
${f(`
|
|
51
53
|
{%- if option.position == 1 -%}
|
|
52
54
|
{%- assign selectedValue = variant.option1 -%}
|
|
53
55
|
{%- elsif option.position == 2 -%}
|
|
@@ -56,78 +58,22 @@ import{composeMemo as e,template as t,DEVICES as s,getResponsiveValueByScreen as
|
|
|
56
58
|
{%- assign selectedValue = variant.option3 -%}
|
|
57
59
|
{%- endif -%}
|
|
58
60
|
`)}
|
|
59
|
-
${
|
|
60
|
-
${
|
|
61
|
+
${$(!W,f("{%- assign selectedValue = null -%}"),"")}
|
|
62
|
+
${$(M,em(),ei({showDropdown:!1,isRenderDefault:!0,typeOfOption:"optionType"}))}
|
|
61
63
|
</div>
|
|
62
64
|
</div>`)}
|
|
63
|
-
`,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
${f("swatchesItem in swatchesItems",`
|
|
69
|
-
${v('{%- assign colorArraysString = "" -%}')}
|
|
70
|
-
${v('{%- assign labelsString = "" -%}')}
|
|
71
|
-
${v('{%- assign imageUrlsString = "" -%}')}
|
|
72
|
-
${v("{%- assign attrItems = swatchesItem | split: '($3)' -%}")}
|
|
73
|
-
|
|
74
|
-
${f("attrItem in attrItems",`${v("{%- assign attrs = attrItem | split: '($2)' -%}")}
|
|
75
|
-
${v("{%- assign optionKey = attrs[0] -%}")}
|
|
76
|
-
${v("{%- assign optionValue = attrs[1] -%}")}
|
|
77
|
-
${v(`
|
|
78
|
-
{% if optionKey == 'optionTitle' %}
|
|
79
|
-
{% assign optionTitle = optionValue %}
|
|
80
|
-
{% elsif optionKey == 'optionType' %}
|
|
81
|
-
{% assign optionType = optionValue %}
|
|
82
|
-
{% endif %}
|
|
83
|
-
`)}
|
|
84
|
-
|
|
85
|
-
${y("optionKey == 'optionValues'",`${v("{%- assign opValueItems = optionValue | split: '($4)' -%}")}
|
|
86
|
-
${f("opValueItem in opValueItems",`${v("{%- assign opValueItemAttrs = opValueItem | split: '($6)' -%}")}
|
|
87
|
-
${f("opValueItemAttr in opValueItemAttrs",`${v("{%- assign attrs = opValueItemAttr | split: '($5)' -%}")}
|
|
88
|
-
${v("{%- assign opValueItemKey = attrs[0] -%}")}
|
|
89
|
-
${v("{%- assign opValueItemValue = attrs[1] -%}")}
|
|
90
|
-
|
|
91
|
-
${y("opValueItemKey == 'label'",`${v("{%- assign labelsString = labelsString | append: opValueItemValue -%}")}${v('{%- assign labelsString = labelsString | append: "($8)" -%}')}`)}
|
|
92
|
-
|
|
93
|
-
${y("opValueItemKey == 'colors'",`${v("{%- assign colorArraysString = colorArraysString | append: opValueItemValue -%}")}${v('{%- assign colorArraysString = colorArraysString | append: "($8)" -%}')}`)}
|
|
94
|
-
|
|
95
|
-
${y("opValueItemKey == 'imageUrl'",`${v("{%- assign imageUrlsString = imageUrlsString | append: opValueItemValue -%}")}${v('{%- assign imageUrlsString = imageUrlsString | append: "($8)" -%}')}`)}`)}`)}`)}
|
|
96
|
-
`)}
|
|
97
|
-
|
|
98
|
-
${v("{%- assign labels = labelsString | split: '($8)' -%}")}
|
|
99
|
-
${v("{%- assign colorStrings = colorArraysString | split: '($8)' -%}")}
|
|
100
|
-
${v("{%- assign imageUrls = imageUrlsString | split: '($8)' -%}")}
|
|
101
|
-
|
|
102
|
-
${y("optionTitle == option.name",`
|
|
103
|
-
${v(`{%- assign variantPresetString = "${en}" -%}`)}
|
|
104
|
-
${v('{%- assign optionName = option.name | replace: "\'", "'" | replace: \'"\', """ -%}')}
|
|
105
|
-
${v("{%- assign items = variantPresetString | split:'($2)' -%}")}
|
|
106
|
-
${v("{%- assign type = 'dropdown' -%}")}
|
|
107
|
-
${f("item in items",`
|
|
108
|
-
${v("{%- assign itemPreset = item | split:'($1)' -%}")}
|
|
109
|
-
${y("itemPreset[0] == optionName",v("{%- assign type = itemPreset[1] -%}"))}
|
|
110
|
-
${y('itemPreset[0] == "base"',v("{%- assign type = itemPreset[1] -%}"))}
|
|
111
|
-
`)}
|
|
112
|
-
${v("{%- assign optionRendered = true -%}")}
|
|
113
|
-
${f("value in values",r({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:L,uid:H,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:W?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",optionType:"optionType",activeClass:W?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...x,...B,swatchAutoWidth:Q(),optionTypo:k}))}
|
|
114
|
-
${y("type == 'dropdown'",p({...x,...B,swatchAutoWidth:Y(),optionTypo:k}))}
|
|
115
|
-
`)}
|
|
116
|
-
`)}
|
|
117
|
-
|
|
118
|
-
${y("optionRendered == false",ep())}
|
|
119
|
-
`,ep=()=>f("value in values",r({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:L,uid:H,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:W?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:"optionType",activeClass:W?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...x,...B,swatchAutoWidth:Q(),optionTypo:k,isRenderDefault:!0})),el=c(I(U)),em=w(N),ed=()=>`
|
|
120
|
-
<div className="${el}">
|
|
121
|
-
${l(em)}
|
|
65
|
+
`,em=()=>e`
|
|
66
|
+
${v("shop.metafields.GEMPAGES.swatches and shop.metafields.GEMPAGES.swatchesJSONFormat != blank",b(ea),E(ea))}
|
|
67
|
+
`,ec=m(w(G)),eu=A(N),ef=()=>`
|
|
68
|
+
<div className="${ec}">
|
|
69
|
+
${p(eu)}
|
|
122
70
|
</div>
|
|
123
|
-
|
|
124
|
-
${v("{%- assign total_combinations = 1 -%}")}
|
|
125
|
-
${f("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
|
|
71
|
+
`,ev=u(g({uid:Y,hasPreSelected:W,cssClass:q?.cssClass})),e$=c(y(N)),e_=m({"gp-flex gp-flex-col !gp-ml-0":!0}),eg=()=>{let e=t?"{{ 'gp-product-variant-v7-5.js' | asset_url }}":`${s}/assets-v2/gp-product-variant-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${l('class="gps-link" delay',"src")}="${e}" defer="defer"></script>`};return e`
|
|
126
72
|
<gp-product-variants
|
|
127
|
-
${
|
|
73
|
+
${ev}
|
|
128
74
|
gp-data='{
|
|
129
|
-
"setting":${JSON.stringify(
|
|
130
|
-
"styles":${JSON.stringify(
|
|
75
|
+
"setting":${JSON.stringify(Z)?.replaceAll("'","'")},
|
|
76
|
+
"styles":${JSON.stringify(O)},
|
|
131
77
|
"variants":{{product.variants | json | escape}},
|
|
132
78
|
"optionsWithValues": {{product.options_with_values | json | escape}},
|
|
133
79
|
"variantSelected": {{ variant | json | escape }},
|
|
@@ -137,21 +83,21 @@ import{composeMemo as e,template as t,DEVICES as s,getResponsiveValueByScreen as
|
|
|
137
83
|
"productId": {{product.id | json | escape}},
|
|
138
84
|
"productUrl": {{product.url | json | escape}},
|
|
139
85
|
"productHandle": {{product.handle | json | escape}},
|
|
140
|
-
"displayState": ${JSON.stringify(
|
|
86
|
+
"displayState": ${JSON.stringify(R)},
|
|
141
87
|
"totalVariantCombinations": {{total_combinations}},
|
|
142
88
|
"firstAvailableVariant": {{product.selected_or_first_available_variant | json | escape}}
|
|
143
89
|
}
|
|
144
90
|
'>
|
|
145
91
|
<div class="gp-hidden" style="--hvr-shadow: none; --hvr-shadow-tablet: none; --hvr-shadow-mobile: none"></div>
|
|
146
|
-
${
|
|
147
|
-
${
|
|
148
|
-
${
|
|
149
|
-
class="${
|
|
150
|
-
style="${
|
|
92
|
+
${f("{%- assign options = product.options_with_values -%}")}
|
|
93
|
+
${f("{%- assign variants = product.variants -%}")}
|
|
94
|
+
${v("options.size == 0 or options.size == 1 and variants.size == 1 and variants[0].title == 'Default Title' and variants[0].option1 == 'Default Title'","<div></div>",e`<div
|
|
95
|
+
class="${e_}"
|
|
96
|
+
style="${e$}"
|
|
151
97
|
>
|
|
152
|
-
${
|
|
98
|
+
${$(H,ef(),ed())}
|
|
153
99
|
</div>`)}
|
|
154
100
|
</gp-product-variants>
|
|
155
101
|
|
|
156
|
-
${
|
|
102
|
+
${eg()}
|
|
157
103
|
`};export{ProductVariants as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{composeTypographyStyle as e,getRadiusStyleActiveState as t,getStyleShadow as o,makeStyle as r,getSingleColorVariable as l,composeRadius as i,getGlobalColorStateStyle as p,handleConvertBorderStyle as a,handleConvertBorderWidth as n,handleConvertBorderColor as d,makeStyleResponsive as h}from"@gem-sdk/core";import{filterTruthyObject as c}from"../../../../../helpers.js";let getColorStyleWidth=e=>{let t=e?.height||"32px",o=e?.width||{desktop:t},r=Object.fromEntries(Object.entries(o).map(([e,o])=>{let r=o&&"undefined"!==o&&"auto"!==o?o:t;return[e,r]}));return h("minw",r)},getWrapperStyleActive=i=>{let{preset:p,optionTypography:a,optionTypo:n,typeOfOption:d}=i,h=p?.optionBgColor,
|
|
1
|
+
import{composeTypographyStyle as e,getRadiusStyleActiveState as t,getStyleShadow as o,makeStyle as r,getSingleColorVariable as l,composeRadius as i,getGlobalColorStateStyle as p,handleConvertBorderStyle as a,handleConvertBorderWidth as n,handleConvertBorderColor as d,makeStyleResponsive as h}from"@gem-sdk/core";import{filterTruthyObject as c}from"../../../../../helpers.js";let getColorStyleWidth=e=>{let t=e?.height||"32px",o=e?.width||{desktop:t},r=Object.fromEntries(Object.entries(o).map(([e,o])=>{let r=o&&"undefined"!==o&&"auto"!==o?o:t;return[e,r]}));return h("minw",r)},getWrapperStyleActive=i=>{let{preset:p,optionTypography:a,optionTypo:n,typeOfOption:d}=i,h=p?.optionBgColor,s=p?.optionTextColor,g=p?.optionBorder,b=p?.optionHasShadow,m=p?.optionShadow,u=p?.optionRounded,w="color"===d,x="image"===d||"image_shopify"===d,y=e(n,a),S=e=>{let t=h?.active??h?.normal,o=g?.active??g?.normal;return r({bg:e&&l(t),bs:o?.border,bw:o?.width,bc:l(o?.color)})},v=m?.active??m?.normal,C=b?.active??b?.normal,f=s?.active??s?.normal;return c({...S(!w),...t(u),...o({value:v,state:"active",styleAppliedFor:"box-shadow",isEnableShadow:C},!0),...y,...!w&&!x&&r({c:l(f)}),...w&&getColorStyleWidth(p),...r({h:p?.height})})},getWrapperStyleNormalAndHover=e=>{let{preset:t,optionTransform:l,optionTypography:h,optionTypo:s,typeOfOption:g}=e,b=t?.optionBgColor,m=t?.optionTextColor,u=t?.optionBorder,w=t?.optionHasShadow,x=t?.optionShadow,y=t?.optionRounded,S="color"===g,v="image"===g||"image_shopify"===g,C=["normal","hover"].reduce((e,t)=>({...e,...o({value:x?.[t],state:t,styleAppliedFor:"box-shadow",isEnableShadow:w?.[t]})}),{});return c({...i(y),...C,...!S&&p("bg",b),...!S&&a(u),...!S&&n(u),...!S&&d(u),...!S&&!v&&r({c:l}),...!S&&!v&&p("c",m),...typoStyleNotIn(s,h,["--c"]),...S&&getColorStyleWidth(t),...r({h:t?.height})})};function typoStyleNotIn(t,o,r){let l=e(t,o);return r&&0!==r.length?Object.fromEntries(Object.entries(l).filter(([e])=>!r.includes(e))):l}let getWrapperTextStyle=e=>{let{preset:o,typeOfOption:r,checked:l}=e,p=o?.optionBorder,h=o?.optionRounded,s="color"===r,g=()=>{let e="16px",t={"--pl":"0px","--pr":"0px","--pl-tablet":"0px","--pr-tablet":"0px","--pl-mobile":"0px","--pr-mobile":"0px","--pt":"0px","--pb":"0px"};return o?.width?.desktop?.toLowerCase()!=="auto"&&o?.width?.desktop||(t["--pl"]=e,t["--pr"]=e),o?.width?.tablet?.toLowerCase()!=="auto"&&o?.width?.tablet||(t["--pl-tablet"]=e,t["--pr-tablet"]=e),o?.width?.mobile?.toLowerCase()!=="auto"&&o?.width?.mobile||(t["--pl-mobile"]=e,t["--pr-mobile"]=e),(o?.height?.toLowerCase()==="auto"||o?.height)&&(t["--pt"]="8px",t["--pb"]="8px"),t},b={...h,active:{...h?.active||{},radiusType:"custom"}},m=l?t(b):i(h),u=!l&&s?{...a(p),...n(p),...d(p)}:{};return c({...!s&&g(),...s&&m,...u})},getColorStyle=({optionBorder:e,optionRounded:t,isActive:o,color:r})=>{let l=()=>r?r?.startsWith("linear-gradient")?{backgroundImage:r}:{backgroundColor:r}:{},p=t=>t?{"--bs":"none"}:a(e),h=o=>({"--d":"flex","--jc":"center"," --ai":"center","--w":"100%","--h":"100%","--of":"hidden","--hvr-c":"unset",...p(o),...n(e),...d(e),...i(t),...l()});return h(!!o)},getTextStyle=({optionTypo:t,optionTypography:o})=>{let r=e(t,o);return delete r["--c"],c({...r})};export{getColorStyle,getTextStyle,getWrapperStyleActive,getWrapperStyleNormalAndHover,getWrapperTextStyle};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let OPTION_VALUES_DELIMITER="|||";export{OPTION_VALUES_DELIMITER};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{template as o}from"@gem-sdk/core";import
|
|
1
|
+
import{template as o}from"@gem-sdk/core";import r from"../base/base.liquid.js";import{optionRoundedColorDefault as l}from"../../utils/mappingVariantStyles.js";import{OPTION_VALUES_DELIMITER as i}from"../../common/const.js";let ColorVariant=({isVariantOutStock:s,swatchValue:n,...t})=>o`
|
|
2
2
|
{% assign colorsString = null %}
|
|
3
3
|
{% assign colors = null %}
|
|
4
4
|
{% for label in labels %}
|
|
@@ -7,7 +7,7 @@ import{template as o}from"@gem-sdk/core";import l from"../base/base.liquid.js";i
|
|
|
7
7
|
{% endif %}
|
|
8
8
|
{% endfor %}
|
|
9
9
|
{% if colorsString != null %}
|
|
10
|
-
{% assign colors = colorsString | split: '
|
|
10
|
+
{% assign colors = colorsString | split: '${i}' %}
|
|
11
11
|
{% endif %}
|
|
12
|
-
${
|
|
12
|
+
${r({...t,typeOfOption:"color",optionRounded:l})}
|
|
13
13
|
`;export{ColorVariant as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import{If as e}from"@gem-sdk/system";import{getButtonStyle as r}from"./common/styles.js";import{getSettingPreloadData as s}from"../../../helpers.js";import o from"../../../button/components/Button.liquid.js";import{template as t,isLocalEnv as m,baseAssetURL as p}from"@gem-sdk/core";import{getButtonSettings as i,getButtonLiquidSettings as d}from"./common/helpers.js";let ProductViewMore=({style:c,styles:l,setting:a,advanced:u,builderProps:f,builderAttrs:n,pageContext:v})=>t`
|
|
2
2
|
<gp-product-view-more>
|
|
3
|
-
${o({styles:l,advanced:u,builderProps:f,builderAttrs:n,setting:{...i(a),...d(a)},style:{...r(c,l)},pageContext:v,className:"btn-view-more"})}
|
|
3
|
+
${o({styles:l,advanced:u,builderProps:f,builderAttrs:n,setting:{...i(a),...d(a,v)},style:{...r(c,l)},pageContext:v,className:"btn-view-more"})}
|
|
4
4
|
${e(m,`<script ${s('class="gps-link" delay',"src")}="{{ 'gp-product-view-more-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${s('class="gps-link" delay',"src")}="${p}/assets-v2/gp-product-view-more-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
5
5
|
</gp-product-view-more>
|
|
6
6
|
`;export{ProductViewMore as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let getButtonSettings=t=>{let{label:e,iconSvg:n,iconAlign:
|
|
1
|
+
let getButtonSettings=t=>{let{label:e,iconSvg:n,iconAlign:l,iconVisible:i,shouldClearSpace:u,enableHoverEffect:o}=t??{};return{label:e,iconSvg:n,iconAlign:l,iconVisible:i,shouldClearSpace:u,htmlType:"submit",enableHoverEffect:o}},getButtonLiquidSettings=(t,e)=>{let{translate:n,redirectNewTab:l}=t??{},i=e?.hasCollectionHandle?"{% if collection %}{{ collection.url }}{{ product.url }}{% else %}{{ product.url }}{% endif %}":"{{ product.url }}";return{translate:n,btnLink:{link:i,target:l?"_blank":"_self"},enableBtnLink:!0}};export{getButtonLiquidSettings,getButtonSettings};
|