@gem-sdk/components 4.0.0-staging.1177 → 4.0.0-staging.1181
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/article/hooks/useArticleLink.js +1 -1
- package/dist/cjs/collection/components/collection-description/CollectionDescription.js +1 -1
- package/dist/cjs/common/components/NoDataState.js +1 -1
- package/dist/cjs/link/common/helpers.js +1 -1
- package/dist/cjs/link/components/CustomLink.js +1 -1
- package/dist/cjs/link/components/Link.js +1 -1
- package/dist/cjs/link/components/ProductLink.js +1 -1
- package/dist/cjs/product/components/product-bundle/ProductBundleDiscount.js +1 -1
- package/dist/cjs/product/components/product-title/ProductTitle.js +1 -1
- package/dist/esm/article/hooks/useArticleLink.js +1 -1
- package/dist/esm/collection/components/collection-description/CollectionDescription.js +1 -1
- package/dist/esm/common/components/NoDataState.js +1 -1
- package/dist/esm/link/common/helpers.js +1 -1
- package/dist/esm/link/components/CustomLink.js +1 -1
- package/dist/esm/link/components/Link.js +1 -1
- package/dist/esm/link/components/ProductLink.js +1 -1
- package/dist/esm/product/components/product-bundle/ProductBundleDiscount.js +1 -1
- package/dist/esm/product/components/product-title/ProductTitle.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),helpers=require("../../link/common/helpers.js"),React=require("react");const useArticleLink=()=>{let e=core.useArticleStore(e=>e.article),r=core.useShopStore(e=>e.storefrontUrl),{isPreviewSharePageMode:t}=core.useRenderMode(),o=e?.handle?helpers.urlJoin("blogs",e?.blog?.handle??"",e.handle):"#",
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),helpers=require("../../link/common/helpers.js"),React=require("react");const useArticleLink=()=>{let e=core.useArticleStore(e=>e.article),r=core.useShopStore(e=>e.storefrontUrl),{isPreviewSharePageMode:t}=core.useRenderMode(),o=e?.handle?helpers.urlJoin("blogs",e?.blog?.handle??"",e.handle):"#",l=React.useMemo(()=>{if(t)return`/articles/${e?.handle}`;if(!r)return"#";let l=new URL(r);return e?`${l.protocol}//${l.host}/${o}`:"#"},[r,e,o,t]);return{shopifyArticleLink:l}};exports.useArticleLink=useArticleLink;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),styles=require("./common/styles.js"),classes=require("./common/classes.js"),system=require("@gem-sdk/system"),helpers=require("./common/helpers.js"),useDescription=require("../../hooks/useDescription.js");const DescriptionNotFoundString="This collection does not have a description",CollectionDescription=({setting:e,builderProps:s,pageContext:t,advanced:l})=>{let
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),styles=require("./common/styles.js"),classes=require("./common/classes.js"),system=require("@gem-sdk/system"),helpers=require("./common/helpers.js"),useDescription=require("../../hooks/useDescription.js");const DescriptionNotFoundString="This collection does not have a description",CollectionDescription=({setting:e,builderProps:s,pageContext:t,advanced:l})=>{let{isPreviewSharePageMode:r}=core.useRenderMode(),i=core.useCollection(),{ref:a,open:n,isShowViewMore:o,handleToggleShowMore:c,hasLineClamp:m}=useDescription.useGpDescription(e),u=i?.descriptionHtml,y=system.createClass(classes.getClassContainerCollectionDes({setting:e})),p=system.createClass(classes.getClassEmptyCollectionDes()),d=system.createClass(classes.getClassButtonViewMore({setting:e})),x=system.createClass(classes.getDescriptionClasses({advanced:l})),j=system.createClass({...classes.getShowMoreIconClasses(),...n?{"gp-rotate-180":!0}:{}}),C=system.createClass(classes.getShowMoreTextClasses()),g=system.createClass(classes.getClassPreBuilt()),h=system.createStyle({...styles.getDefaultStyleCollectionDes({setting:e}),...n?{}:core.makeStyleResponsive("line-clamp",core.makeLineClamp(e?.lineClamp,e?.hasLineClamp))}),S=system.createStyle({...styles.getStyleDefaultViewMore(e)}),R=helpers.getViewLessText({setting:e,builderProps:s,pageContext:t,type:"react"}),D=helpers.getViewMoreText({setting:e,builderProps:s,pageContext:t,type:"react"}),M=system.createAttr({"data-id":`${s?.uid}`}),I=system.createAttr({"data-gp-text":""}),{gpDescriptionCss:f,textDescriptionCss:v}=styles.getStaticCss(),N=r?"":jsxRuntime.jsx("div",{className:p,dangerouslySetInnerHTML:{__html:"This collection does not have a description"}});return jsxRuntime.jsx(jsxRuntime.Fragment,{children:system.If(!u,N,jsxRuntime.jsxs("div",{...M,className:x,children:[jsxRuntime.jsx("style",{children:v}),jsxRuntime.jsx("style",{children:f}),jsxRuntime.jsx("div",{className:g}),jsxRuntime.jsx("div",{ref:a,className:y,style:h,dangerouslySetInnerHTML:{__html:i?.descriptionHtml??""},...I}),system.If(m&&o,jsxRuntime.jsxs("button",{type:"button",className:d,style:S,onClick:c,children:[jsxRuntime.jsx("span",{className:C,children:system.If(n,R?.toString()??"",D?.toString()??"")}),system.If(e?.enableViewMoreIcon,jsxRuntime.jsx("span",{className:j,dangerouslySetInnerHTML:{__html:helpers.ICON_SVG}}),"")]}),"")]}))})};exports.default=CollectionDescription;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),React=require("react"),core=require("@gem-sdk/core");const NoDataState=({title:e,description:t,elementType:r,builderAttrs:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),React=require("react"),core=require("@gem-sdk/core");const NoDataState=({title:e,description:t,elementType:r,builderAttrs:n,descriptionActions:s,primaryBtnTitle:l,secondaryBtnTitle:p,primaryBtnCb:i,secondaryBtnCb:c,additionalMedia:o,customClass:a,icon:d=!0,rawMode:g,children:u})=>{let x=React.useRef(null),{isEditMode:m,isPreviewSharePageMode:b}=core.useRenderMode(),[f,j]=React.useState("row"),h=()=>{let e=x.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-product",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},C=()=>{let e=x.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-article",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},w=()=>{if(m)return;let e=new CustomEvent("editor:product-source-no-data-warning",{bubbles:!0,detail:{uid:n?.["data-uid"]??n?.uid,value:!0,tag:n?.["data-component-tag"]??n?.tag}});window.dispatchEvent(e)},R={syncProduct:h,syncArticle:C};return(React.useEffect(()=>{let e=new ResizeObserver(()=>{let e=x.current?x.current?.offsetWidth:0;j(e>272?"row":"column")});return x.current&&e.observe(x.current),()=>{e?.disconnect()}},[]),b)?null:jsxRuntime.jsxs("div",{...n,ref:x,className:core.cls("gp-font-[Inter] gp-bg-white gp-border gp-border-dashed gp-border-box gp-rounded-lg gp-flex gp-flex-col",g?"gp-p-0":"gp-p-2"),onClick:w,children:[jsxRuntime.jsxs("div",{className:core.cls("gp-w-full gp-h-full gp-rounded-lg gp-flex gp-p-2 gp-gap-2","primary"===r?"gp-bg-[#FFF1DF]":"",g?"gp-justify-center":"",a||""),style:{flexDirection:f},children:[d&&!g&&jsxRuntime.jsx("div",{className:core.cls("gp-w-[28px] gp-h-[28px] gp-min-w-[28px] gp-flex gp-items-center gp-justify-center gp-rounded-[8px]","primary"===r?"":"gp-bg-[#FDB913]"),children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M9.99997 6.75C10.4142 6.75 10.75 7.08579 10.75 7.5V11C10.75 11.4142 10.4142 11.75 9.99997 11.75C9.58576 11.75 9.24997 11.4142 9.24997 11V7.5C9.24997 7.08579 9.58576 6.75 9.99997 6.75Z",fill:"primary"===r?"#916A00":"#212121"}),jsxRuntime.jsx("path",{d:"M11 13.5C11 14.0523 10.5523 14.5 10 14.5C9.44775 14.5 9.00003 14.0523 9.00003 13.5C9.00003 12.9477 9.44775 12.5 10 12.5C10.5523 12.5 11 12.9477 11 13.5Z",fill:"primary"===r?"#916A00":"#212121"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.0001 3.5C8.95474 3.5 8.21619 4.20232 7.84765 4.94672C7.65568 5.33448 6.75987 7.0441 5.84308 8.79353L5.81534 8.84646C4.92293 10.5493 4.01717 12.2777 3.80719 12.702C3.43513 13.4537 3.32934 14.4519 3.89956 15.316C4.46914 16.1791 5.44225 16.5 6.3636 16.5L13.6364 16.5C14.5577 16.5 15.5309 16.1791 16.1005 15.316C16.6707 14.4519 16.5649 13.4537 16.1928 12.702C15.9832 12.2784 15.08 10.555 14.189 8.85476L14.1569 8.79352C13.24 7.044 12.3443 5.33454 12.1525 4.94693C11.784 4.20242 11.0455 3.5 10.0001 3.5ZM9.19193 5.61225C9.59608 4.79592 10.4041 4.79592 10.8081 5.61225C11.0102 6.02061 11.9201 7.75686 12.8297 9.49243C13.7383 11.2262 14.6466 12.9594 14.8485 13.3673C15.2525 14.1837 14.8485 15 13.6364 15L6.3636 15C5.15153 15 4.74749 14.1837 5.15153 13.3673C5.35379 12.9587 6.26471 11.2205 7.17483 9.4838C8.08286 7.75111 8.99008 6.01994 9.19193 5.61225Z",fill:"primary"===r?"#916A00":"#212121"})]})}),jsxRuntime.jsxs("div",{className:"gp-flex-col gp-flex gp-justify-between",children:[e&&jsxRuntime.jsx("p",{className:core.cls("gp-text-[#916A00] gp-text-[13px] gp-font-semibold"),dangerouslySetInnerHTML:{__html:e}}),t&&jsxRuntime.jsxs("p",{className:core.cls(g?"gp-mb-0":"gp-mb-[4px]","primary"===r?"gp-text-[#916A00] gp-text-[13px]":"gp-text-[#212121] gp-text-[12px]"),children:[t," ",s?.map((e,t)=>{let r=t?"or":"",n="string"==typeof e.callback?R?.[e.callback]:e.callback;return jsxRuntime.jsxs("span",{children:[" ",r," ",jsxRuntime.jsx("span",{role:"presentation",className:"gp-underline gp-cursor-pointer gp-leading-5",onClick:n,children:e.text})]},`description-action-${t}`)})]}),(l||p)&&jsxRuntime.jsxs("div",{className:"gp-flex gp-flex-wrap gp-gap-2 gp-rounded-4 gp-border-box",children:[jsxRuntime.jsx("button",{onClick:i,className:"w-h-7 gp-bg-[#212121] gp-rounded-8 gp-p-2 gp-text-xs hover:gp-bg-[#3b3b3b] gp-text-white gp-rounded-lg",children:l}),jsxRuntime.jsx("button",{onClick:c,className:"w-h-7 gp-bg-white gp-text-[#212121] hover:gp-bg-[#f6f6f6] gp-text-xs gp-p-2 gp-rounded-lg",children:p})]})]})]}),o&&jsxRuntime.jsx("div",{className:"gp-w-full",dangerouslySetInnerHTML:{__html:o}}),core.filterToolbarPreview(u,!0)]})};exports.default=NoDataState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function normalize(e){let r=[];if(0===e.length)return"";if("string"!=typeof e[0])throw TypeError("Url must be a string. Received "+e[0]);e[0].match(/^[^/:]+:\/*$/)&&e.length>1&&(e[0]=e.shift()+e[0]),e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(let t=0;t<e.length;t++){let
|
|
1
|
+
"use strict";function normalize(e){let r=[];if(0===e.length)return"";if("string"!=typeof e[0])throw TypeError("Url must be a string. Received "+e[0]);e[0].match(/^[^/:]+:\/*$/)&&e.length>1&&(e[0]=e.shift()+e[0]),e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(let t=0;t<e.length;t++){let l=e[t];if("string"!=typeof l)throw TypeError("Url must be a string. Received "+l);""!==l&&(t>0&&(l=l.replace(/^\/+/,"")),l=t<e.length-1?l.replace(/\/+$/,""):l.replace(/\/+$/,"/"),r.push(l))}let t=r.join("/");t=t.replace(/\/(\?|&|#[^!])/g,"$1");let l=t.split("?");return l.shift()+(l.length>0?"?":"")+l.join("&")}function urlJoin(...e){let r=Array.from(Array.isArray(e[0])?e[0]:e);return normalize(r)}exports.urlJoin=urlJoin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),Link=require("next/link"),core=require("@gem-sdk/core");const CustomLink=({children:e,dataId:r,...t})=>{let{isPreviewSharePageMode:i}=core.useRenderMode(),n={title:t.title,"data-id":r};return i?jsxRuntime.jsx("a",{...n,...t,href:
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),Link=require("next/link"),core=require("@gem-sdk/core"),helpers=require("../../helpers.js");const CustomLink=({children:e,dataId:r,...t})=>{let{isPreviewSharePageMode:i}=core.useRenderMode(),n={title:t.title,"data-id":r},s=t.href?.toString(),l=()=>{helpers.handleClickLink({link:s,type:s?.startsWith("#el")?"open-popup":void 0})};return i?jsxRuntime.jsx("a",{...n,...t,href:s,onClick:l,children:e}):jsxRuntime.jsx(Link,{...n,...t,children:e})};exports.default=CustomLink;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),React=require("react"),CustomLink=require("./CustomLink.js"),ProductLink=require("./ProductLink.js")
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),React=require("react"),CustomLink=require("./CustomLink.js"),ProductLink=require("./ProductLink.js");const Link=({setting:e,className:t,style:r,children:u,title:i,dataId:o})=>{let a=React.useMemo(()=>e?.type==="product"?ProductLink.default:CustomLink.default,[e?.type]),l={};return a==CustomLink.default&&(l.title=i),jsxRuntime.jsx(a,{...l,"data-id":o,target:e?.target,rel:e?.noFollow?"nofollow":void 0,"aria-label":e?.label,href:e?.href,className:t,style:r,children:u})};exports.default=Link;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core");const ProductLink=({children:e,...r})=>{let t=core.useProduct()
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core");const ProductLink=({children:e,...r})=>{let t=core.useProduct();return jsxRuntime.jsx("a",{title:t?.title,href:t?`/products/${t.handle}`:"#",...r,children:core.isEmptyChildren(e)?t?t.title:null:e})};exports.default=ProductLink;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),NoDataState=require("../../../common/components/NoDataState.js"),system=require("@gem-sdk/system"),styles=require("./common/styles.js"),classes=require("./common/classes.js"),useProductBundleDataState=require("./hooks/useProductBundleDataState.js"),useProductBundleDiscountState=require("./hooks/useProductBundleDiscountState.js"),ProductBundleDiscountChildrenItem=require("./ProductBundleDiscountChildrenItem.js");const ProductBundleDiscount=({builderAttrs:e,style:t,children:s,setting:u,styles:n,advanced:l})=>{let
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),NoDataState=require("../../../common/components/NoDataState.js"),system=require("@gem-sdk/system"),styles=require("./common/styles.js"),classes=require("./common/classes.js"),useProductBundleDataState=require("./hooks/useProductBundleDataState.js"),useProductBundleDiscountState=require("./hooks/useProductBundleDiscountState.js"),ProductBundleDiscountChildrenItem=require("./ProductBundleDiscountChildrenItem.js");const ProductBundleDiscount=({builderAttrs:e,style:t,children:s,setting:u,styles:n,advanced:l})=>{let{isEditMode:r,isPreviewSharePageMode:i}=core.useRenderMode(),{isSelected:d,setSelected:a}=useProductBundleDiscountState.default(u),{emitRedirectSetupPage:c,redirectGuideline:o,svg:m}=useProductBundleDataState.default(),y=system.createClass(classes.getContainerClasses(u,l?.cssClass)),j=system.createClass(classes.getNoDiscountClasses),S=system.createStyle(styles.getSizeSettings(n)?.gap),D=system.createStyle(styles.getContainerStyles(S,n,t));if(!u?.bundleItems?.length&&r)return jsxRuntime.jsx(NoDataState.default,{elementType:"secondary",description:"Increase AOV with bundle quantity.",descriptionActions:[{text:"Setup bundle discount",callback:c},{text:"read guideline",callback:o}],additionalMedia:m});let h=(e,t)=>{if(u?.hideNoDiscountItem&&e?.discountType==="no_discount")return null;let l=s?.[t];if(React.isValidElement(l))return jsxRuntime.jsx(ProductBundleDiscountChildrenItem.default,{index:t,childItem:l,setting:u,styles:n,isSelected:d(t),setSelected:a,bundleItem:e},t)},x=(core.isEmptyChildren(s)||u?.bundleItems?.length==0)&&!i;return jsxRuntime.jsxs("div",{...e,className:y,style:D,children:[system.If(x,jsxRuntime.jsx("div",{className:j,children:"This product has no bundle discount"})),u?.bundleItems?.map((e,t)=>h(e,t))]})};exports.default=ProductBundleDiscount;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),Link=require("next/link"),core=require("@gem-sdk/core"),helpers=require("../../../link/common/helpers.js"),Text=require("../../../text/components/Text.js"),system=require("@gem-sdk/system"),helpers$1=require("./common/helpers.js");const ProductTitle=e=>{let{setting:t,builderProps:r}=e,{isPreviewSharePageMode:s}=core.useRenderMode(),i=core.useProduct(),
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),Link=require("next/link"),core=require("@gem-sdk/core"),helpers=require("../../../link/common/helpers.js"),Text=require("../../../text/components/Text.js"),system=require("@gem-sdk/system"),helpers$1=require("./common/helpers.js");const ProductTitle=e=>{let{setting:t,builderProps:r}=e,{isPreviewSharePageMode:s}=core.useRenderMode(),i=core.useProduct(),l=s?`/products/${i?.handle}`:i?.handle?helpers.urlJoin("/products",i.handle):"#",o=i?.baseID?.replace("gid://shopify/Product/",""),u=core.useEditorMode(),d=()=>jsxRuntime.jsx(Text.default,{...helpers$1.getTextProps(e,i?.title)}),n={href:l,title:i?.title},c=t?.linkProduct,p=system.createClass({"gp-product-title-link-wrapper":!0}),m=system.createAttr({id:`shopify-text-element-${r?.uid}`,...o&&{"data-product-id":o}});return jsxRuntime.jsx("div",{..."edit"===u&&m,children:system.Unless(!!i,"",system.If(c,jsxRuntime.jsx(Link,{...n,className:p,children:d()}),d()))})};exports.default=ProductTitle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useArticleStore as r,useShopStore as e,useRenderMode as t}from"@gem-sdk/core";import{urlJoin as o}from"../../link/common/helpers.js";import{useMemo as l}from"react";let useArticleLink=()=>{let
|
|
1
|
+
import{useArticleStore as r,useShopStore as e,useRenderMode as t}from"@gem-sdk/core";import{urlJoin as o}from"../../link/common/helpers.js";import{useMemo as l}from"react";let useArticleLink=()=>{let n=r(r=>r.article),i=e(r=>r.storefrontUrl),{isPreviewSharePageMode:m}=t(),s=n?.handle?o("blogs",n?.blog?.handle??"",n.handle):"#",c=l(()=>{if(m)return`/articles/${n?.handle}`;if(!i)return"#";let r=new URL(i);return n?`${r.protocol}//${r.host}/${s}`:"#"},[i,n,s,m]);return{shopifyArticleLink:c}};export{useArticleLink};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as e,Fragment as t,jsxs as o}from"react/jsx-runtime";import{
|
|
2
|
+
import{jsx as e,Fragment as t,jsxs as o}from"react/jsx-runtime";import{useRenderMode as s,useCollection as i,makeStyleResponsive as r,makeLineClamp as n}from"@gem-sdk/core";import{getDefaultStyleCollectionDes as l,getStyleDefaultViewMore as a,getStaticCss as m}from"./common/styles.js";import{getClassContainerCollectionDes as c,getClassEmptyCollectionDes as d,getClassButtonViewMore as p,getDescriptionClasses as h,getShowMoreIconClasses as y,getShowMoreTextClasses as u,getClassPreBuilt as g}from"./common/classes.js";import{createClass as f,createStyle as N,createAttr as v,If as S}from"@gem-sdk/system";import{getViewLessText as _,getViewMoreText as j,ICON_SVG as C}from"./common/helpers.js";import{useGpDescription as H}from"../../hooks/useDescription.js";let DescriptionNotFoundString="This collection does not have a description",CollectionDescription=({setting:T,builderProps:k,pageContext:D,advanced:I})=>{let{isPreviewSharePageMode:L}=s(),M=i(),{ref:b,open:x,isShowViewMore:w,handleToggleShowMore:F,hasLineClamp:V}=H(T),$=M?.descriptionHtml,q=f(c({setting:T})),z=f(d()),A=f(p({setting:T})),B=f(h({advanced:I})),E=f({...y(),...x?{"gp-rotate-180":!0}:{}}),G=f(u()),J=f(g()),K=N({...l({setting:T}),...x?{}:r("line-clamp",n(T?.lineClamp,T?.hasLineClamp))}),O=N({...a(T)}),P=_({setting:T,builderProps:k,pageContext:D,type:"react"}),Q=j({setting:T,builderProps:k,pageContext:D,type:"react"}),R=v({"data-id":`${k?.uid}`}),U=v({"data-gp-text":""}),{gpDescriptionCss:W,textDescriptionCss:X}=m(),Y=L?"":e("div",{className:z,dangerouslySetInnerHTML:{__html:"This collection does not have a description"}});return e(t,{children:S(!$,Y,o("div",{...R,className:B,children:[e("style",{children:X}),e("style",{children:W}),e("div",{className:J}),e("div",{ref:b,className:q,style:K,dangerouslySetInnerHTML:{__html:M?.descriptionHtml??""},...U}),S(V&&w,o("button",{type:"button",className:A,style:O,onClick:F,children:[e("span",{className:G,children:S(x,P?.toString()??"",Q?.toString()??"")}),S(T?.enableViewMoreIcon,e("span",{className:E,dangerouslySetInnerHTML:{__html:C}}),"")]}),"")]}))})};export{CollectionDescription as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as r,useState as p,useEffect as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as r,useState as p,useEffect as l}from"react";import{useRenderMode as n,cls as i,filterToolbarPreview as g}from"@gem-sdk/core";let NoDataState=({title:a,description:d,elementType:o,builderAttrs:c,descriptionActions:s,primaryBtnTitle:u,secondaryBtnTitle:m,primaryBtnCb:b,secondaryBtnCb:f,additionalMedia:x,customClass:h,icon:C=!0,rawMode:w,children:v})=>{let y=r(null),{isEditMode:N,isPreviewSharePageMode:k}=n(),[A,E]=p("row"),L=()=>{let e=y.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-product",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},M=()=>{let e=y.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-article",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},D=()=>{if(N)return;let e=new CustomEvent("editor:product-source-no-data-warning",{bubbles:!0,detail:{uid:c?.["data-uid"]??c?.uid,value:!0,tag:c?.["data-component-tag"]??c?.tag}});window.dispatchEvent(e)},F={syncProduct:L,syncArticle:M};return(l(()=>{let e=new ResizeObserver(()=>{let e=y.current?y.current?.offsetWidth:0;E(e>272?"row":"column")});return y.current&&e.observe(y.current),()=>{e?.disconnect()}},[]),k)?null:e("div",{...c,ref:y,className:i("gp-font-[Inter] gp-bg-white gp-border gp-border-dashed gp-border-box gp-rounded-lg gp-flex gp-flex-col",w?"gp-p-0":"gp-p-2"),onClick:D,children:[e("div",{className:i("gp-w-full gp-h-full gp-rounded-lg gp-flex gp-p-2 gp-gap-2","primary"===o?"gp-bg-[#FFF1DF]":"",w?"gp-justify-center":"",h||""),style:{flexDirection:A},children:[C&&!w&&t("div",{className:i("gp-w-[28px] gp-h-[28px] gp-min-w-[28px] gp-flex gp-items-center gp-justify-center gp-rounded-[8px]","primary"===o?"":"gp-bg-[#FDB913]"),children:e("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("path",{d:"M9.99997 6.75C10.4142 6.75 10.75 7.08579 10.75 7.5V11C10.75 11.4142 10.4142 11.75 9.99997 11.75C9.58576 11.75 9.24997 11.4142 9.24997 11V7.5C9.24997 7.08579 9.58576 6.75 9.99997 6.75Z",fill:"primary"===o?"#916A00":"#212121"}),t("path",{d:"M11 13.5C11 14.0523 10.5523 14.5 10 14.5C9.44775 14.5 9.00003 14.0523 9.00003 13.5C9.00003 12.9477 9.44775 12.5 10 12.5C10.5523 12.5 11 12.9477 11 13.5Z",fill:"primary"===o?"#916A00":"#212121"}),t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.0001 3.5C8.95474 3.5 8.21619 4.20232 7.84765 4.94672C7.65568 5.33448 6.75987 7.0441 5.84308 8.79353L5.81534 8.84646C4.92293 10.5493 4.01717 12.2777 3.80719 12.702C3.43513 13.4537 3.32934 14.4519 3.89956 15.316C4.46914 16.1791 5.44225 16.5 6.3636 16.5L13.6364 16.5C14.5577 16.5 15.5309 16.1791 16.1005 15.316C16.6707 14.4519 16.5649 13.4537 16.1928 12.702C15.9832 12.2784 15.08 10.555 14.189 8.85476L14.1569 8.79352C13.24 7.044 12.3443 5.33454 12.1525 4.94693C11.784 4.20242 11.0455 3.5 10.0001 3.5ZM9.19193 5.61225C9.59608 4.79592 10.4041 4.79592 10.8081 5.61225C11.0102 6.02061 11.9201 7.75686 12.8297 9.49243C13.7383 11.2262 14.6466 12.9594 14.8485 13.3673C15.2525 14.1837 14.8485 15 13.6364 15L6.3636 15C5.15153 15 4.74749 14.1837 5.15153 13.3673C5.35379 12.9587 6.26471 11.2205 7.17483 9.4838C8.08286 7.75111 8.99008 6.01994 9.19193 5.61225Z",fill:"primary"===o?"#916A00":"#212121"})]})}),e("div",{className:"gp-flex-col gp-flex gp-justify-between",children:[a&&t("p",{className:i("gp-text-[#916A00] gp-text-[13px] gp-font-semibold"),dangerouslySetInnerHTML:{__html:a}}),d&&e("p",{className:i(w?"gp-mb-0":"gp-mb-[4px]","primary"===o?"gp-text-[#916A00] gp-text-[13px]":"gp-text-[#212121] gp-text-[12px]"),children:[d," ",s?.map((r,p)=>{let l=p?"or":"",n="string"==typeof r.callback?F?.[r.callback]:r.callback;return e("span",{children:[" ",l," ",t("span",{role:"presentation",className:"gp-underline gp-cursor-pointer gp-leading-5",onClick:n,children:r.text})]},`description-action-${p}`)})]}),(u||m)&&e("div",{className:"gp-flex gp-flex-wrap gp-gap-2 gp-rounded-4 gp-border-box",children:[t("button",{onClick:b,className:"w-h-7 gp-bg-[#212121] gp-rounded-8 gp-p-2 gp-text-xs hover:gp-bg-[#3b3b3b] gp-text-white gp-rounded-lg",children:u}),t("button",{onClick:f,className:"w-h-7 gp-bg-white gp-text-[#212121] hover:gp-bg-[#f6f6f6] gp-text-xs gp-p-2 gp-rounded-lg",children:m})]})]})]}),x&&t("div",{className:"gp-w-full",dangerouslySetInnerHTML:{__html:x}}),g(v,!0)]})};export{NoDataState as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function normalize(e){let r=[];if(0===e.length)return"";if("string"!=typeof e[0])throw TypeError("Url must be a string. Received "+e[0]);e[0].match(/^[^/:]+:\/*$/)&&e.length>1&&(e[0]=e.shift()+e[0]),e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(let t=0;t<e.length;t++){let
|
|
1
|
+
function normalize(e){let r=[];if(0===e.length)return"";if("string"!=typeof e[0])throw TypeError("Url must be a string. Received "+e[0]);e[0].match(/^[^/:]+:\/*$/)&&e.length>1&&(e[0]=e.shift()+e[0]),e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(let t=0;t<e.length;t++){let l=e[t];if("string"!=typeof l)throw TypeError("Url must be a string. Received "+l);""!==l&&(t>0&&(l=l.replace(/^\/+/,"")),l=t<e.length-1?l.replace(/\/+$/,""):l.replace(/\/+$/,"/"),r.push(l))}let t=r.join("/");t=t.replace(/\/(\?|&|#[^!])/g,"$1");let l=t.split("?");return l.shift()+(l.length>0?"?":"")+l.join("&")}function urlJoin(...e){let r=Array.from(Array.isArray(e[0])?e[0]:e);return normalize(r)}export{urlJoin};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as t}from"react/jsx-runtime";import
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";import e from"next/link";import{useRenderMode as r}from"@gem-sdk/core";import{handleClickLink as i}from"../../helpers.js";let CustomLink=({children:o,dataId:l,...m})=>{let{isPreviewSharePageMode:n}=r(),p={title:m.title,"data-id":l},s=m.href?.toString(),a=()=>{i({link:s,type:s?.startsWith("#el")?"open-popup":void 0})};return n?t("a",{...p,...m,href:s,onClick:a,children:o}):t(e,{...p,...m,children:o})};export{CustomLink as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";import{useMemo as r}from"react";import e from"./CustomLink.js";import o from"./ProductLink.js";let Link=({setting:l,className:a,style:i,children:m,title:n,dataId:f})=>{let p=r(()=>l?.type==="product"?o:e,[l?.type]),s={};return p==e&&(s.title=n),t(p,{...s,"data-id":f,target:l?.target,rel:l?.noFollow?"nofollow":void 0,"aria-label":l?.label,href:l?.href,className:a,style:i,children:m})};export{Link as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";import{useProduct as e,isEmptyChildren as r}from"@gem-sdk/core";let ProductLink=({children:l,...i})=>{let o=e();return t("a",{title:o?.title,href:o?`/products/${o.handle}`:"#",...i,children:r(l)?o?o.title:null:l})};export{ProductLink as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useRenderMode as o,isEmptyChildren as s}from"@gem-sdk/core";import{isValidElement as n}from"react";import r from"../../../common/components/NoDataState.js";import{createClass as i,createStyle as d,If as m}from"@gem-sdk/system";import{getSizeSettings as l,getContainerStyles as c}from"./common/styles.js";import{getContainerClasses as u,getNoDiscountClasses as a}from"./common/classes.js";import p from"./hooks/useProductBundleDataState.js";import f from"./hooks/useProductBundleDiscountState.js";import h from"./ProductBundleDiscountChildrenItem.js";let ProductBundleDiscount=({builderAttrs:b,style:y,children:I,setting:g,styles:j,advanced:D})=>{let{isEditMode:k,isPreviewSharePageMode:S}=o(),{isSelected:x,setSelected:B}=f(g),{emitRedirectSetupPage:P,redirectGuideline:N,svg:T}=p(),v=i(u(g,D?.cssClass)),A=i(a),C=d(l(j)?.gap),q=d(c(C,j,y));if(!g?.bundleItems?.length&&k)return e(r,{elementType:"secondary",description:"Increase AOV with bundle quantity.",descriptionActions:[{text:"Setup bundle discount",callback:P},{text:"read guideline",callback:N}],additionalMedia:T});let w=(t,o)=>{if(g?.hideNoDiscountItem&&t?.discountType==="no_discount")return null;let s=I?.[o];if(n(s))return e(h,{index:o,childItem:s,setting:g,styles:j,isSelected:x(o),setSelected:B,bundleItem:t},o)},M=(s(I)||g?.bundleItems?.length==0)&&!S;return t("div",{...b,className:v,style:q,children:[m(M,e("div",{className:A,children:"This product has no bundle discount"})),g?.bundleItems?.map((e,t)=>w(e,t))]})};export{ProductBundleDiscount as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as t}from"react/jsx-runtime";import e from"next/link";import{useRenderMode as r,useProduct as o,useEditorMode as i}from"@gem-sdk/core";import{urlJoin as m}from"../../../link/common/helpers.js";import d from"../../../text/components/Text.js";import{createClass as l,createAttr as p,Unless as s,If as c}from"@gem-sdk/system";import{getTextProps as n}from"./common/helpers.js";let ProductTitle=a=>{let{setting:
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";import e from"next/link";import{useRenderMode as r,useProduct as o,useEditorMode as i}from"@gem-sdk/core";import{urlJoin as m}from"../../../link/common/helpers.js";import d from"../../../text/components/Text.js";import{createClass as l,createAttr as p,Unless as s,If as c}from"@gem-sdk/system";import{getTextProps as n}from"./common/helpers.js";let ProductTitle=a=>{let{setting:u,builderProps:f}=a,{isPreviewSharePageMode:h}=r(),k=o(),x=h?`/products/${k?.handle}`:k?.handle?m("/products",k.handle):"#",g=k?.baseID?.replace("gid://shopify/Product/",""),j=i(),P=()=>t(d,{...n(a,k?.title)}),y={href:x,title:k?.title},T=u?.linkProduct,$=l({"gp-product-title-link-wrapper":!0}),b=p({id:`shopify-text-element-${f?.uid}`,...g&&{"data-product-id":g}});return t("div",{..."edit"===j&&b,children:s(!!k,"",c(T,t(e,{...y,className:$,children:P()}),P()))})};export{ProductTitle as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/components",
|
|
3
|
-
"version": "4.0.0-staging.
|
|
3
|
+
"version": "4.0.0-staging.1181",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"scan-all-text": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/scan-all-text && node ./scripts/scan-all-text"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@gem-sdk/core": "4.0.0-staging.
|
|
28
|
+
"@gem-sdk/core": "4.0.0-staging.1181",
|
|
29
29
|
"@gem-sdk/styles": "3.1.0-staging.1137",
|
|
30
30
|
"@gem-sdk/system": "3.1.0-staging.1137",
|
|
31
31
|
"tsup": "^8.5.0",
|