@gem-sdk/plugin-cart-drawer 21.0.0 → 21.1.0-staging.40
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/CartDrawer.js +1 -1
- package/dist/cjs/components/CartLineItem.js +1 -1
- package/dist/cjs/components/CartLineItemQuantity.js +1 -1
- package/dist/cjs/components/DiscountCodeItem.js +1 -1
- package/dist/esm/components/CartDrawer.js +1 -1
- package/dist/esm/components/CartLineItem.js +1 -1
- package/dist/esm/components/CartLineItemQuantity.js +1 -1
- package/dist/esm/components/DiscountCodeItem.js +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@gem-sdk/core"),t=require("@gem-sdk/components"),l=require("react-transition-group"),s=require("react"),i=require("./CartDiscountCode.js"),a=require("./CartOrderNote.js"),p=require("./CartLineItem.js"),g=require("./CartFooter.js");const n={transition:"opacity 300ms ease-in-out",opacity:0},o={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0},exited:{opacity:0},unmounted:{opacity:0}},c=({className:c,style:d,setting:u})=>{let{data:x,isLoading:m,error:h}=r.useCartData(),{closeCart:b,isCartOpen:f}=r.useCartUI(),j=s.useRef(null);return e.jsx(l.Transition,{in:f,timeout:300,nodeRef:j,children:l=>e.jsxs("div",{ref:j,className:r.cls("gp-fixed gp-inset-0 gp-z-90",c,{"gp-invisible":!f,"gp-visible":f}),style:{...d,...n,...o[l],zIndex:t.ELEMENT_Z_INDEX.CART_DRAWER},children:[e.jsx("div",{"aria-hidden":!0,onClick:()=>b(),className:"gp-fixed gp-inset-0 gp-z-80 gp-bg-slate-600/40"}),e.jsx("div",{className:"gp-fixed gp-inset-y-0 gp-right-0 gp-z-90 gp-flex gp-w-full gp-max-w-[400px] gp-flex-col gp-bg-white gp-text-g-text-1 gp-shadow-2xl mobile:gp-w-full",children:m?e.jsx("div",{className:"gp-w-full gp-pt-10 gp-text-center",children:"Loading..."}):h?e.jsxs("div",{className:"gp-w-full gp-pt-10 gp-text-center gp-text-g-error",children:["Error: ",h?.[0]?.message]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"gp-flex gp-items-center gp-justify-between gp-border-b-g-line-3 gp-px-6 gp-py-3 border-b",children:[e.jsx("span",{className:"gp-font-g-heading gp-text-xl gp-font-semibold",children:u?.title}),e.jsx("button",{onClick:b,title:"Close cart drawer",children:e.jsx("svg",{className:"gp-w-5",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"m4.397 4.554.073-.084a.75.75 0 0 1 .976-.073l.084.073L12 10.939l6.47-6.47a.75.75 0 1 1 1.06 1.061L13.061 12l6.47 6.47a.75.75 0 0 1 .072.976l-.073.084a.75.75 0 0 1-.976.073l-.084-.073L12 13.061l-6.47 6.47a.75.75 0 0 1-1.06-1.061L10.939 12l-6.47-6.47a.75.75 0 0 1-.072-.976l.073-.084-.073.084Z"})})})]}),e.jsx("div",{className:"gp-group gp-h-full gp-overflow-y-auto gp-px-6 gp-pb-4 scrollbar:!gp-h-1.5 scrollbar:!gp-w-1.5 scrollbar:gp-bg-transparent scrollbar-track:!gp-rounded scrollbar-track:!gp-bg-slate-100 scrollbar-thumb:!gp-rounded scrollbar-thumb:!gp-bg-slate-300",children:x&&x.lineItems.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"gp-flex gp-flex-col",children:x.lineItems.map(t=>t?e.jsx(r.CartLineProvider,{line:t,children:e.jsx(p.default,{})},t.id):null)}),e.jsx(a.default,{placeholder:"Leave your order note here...",triggerUpdate:"blur"})]}):e.jsx("div",{className:"gp-w-full gp-pt-10 gp-text-center",children:u?.emptyLabel})}),e.jsx(i.default,{}),!!x&&!!x.lineItems.length&&e.jsx(g.default,{openMode:u?.openMode,checkoutUrl:x.checkoutUrl,price:x?.totalPrice,currencyCode:x?.currency.code})]})})]})})};c.defaultProps={setting:{title:"Your Cart",emptyLabel:"Your cart is empty",openMode:"page"}},exports.default=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("@gem-sdk/core"),t=require("@gem-sdk/components"),a=require("./CartLineItemQuantity.js"),r=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("@gem-sdk/core"),t=require("@gem-sdk/components"),a=require("./CartLineItemQuantity.js"),r=require("./LoadingIcon.js"),l=require("./icons/Trash.js");exports.default=()=>{let i=s.useCartLine(),{cartId:n}=s.useCartId(),{isMutating:g,trigger:p}=s.useRemoveCartItem(),c=s.useMoney(i.variant?.price?i.variant?.price:0),o=s.useMoney(i.variant?.listPrice?i.variant?.listPrice:0);return e.jsxs("div",{className:"gp-flex gp-items-center gp-gap-4 gp-border-b gp-border-b-g-line-2 gp-py-4 last:gp-border-b-transparent",children:[e.jsx("div",{className:"gp-aspect-square gp-w-16",children:i.variant?.image?.url&&e.jsx("img",{className:"gp-h-full gp-w-full gp-object-cover",src:i.variant.image.url,alt:i.variant?.image?.altText??""})}),e.jsxs("div",{className:"gp-flex-1",children:[e.jsxs("p",{className:"gp-line-clamp-2",children:[i.productTitle," ","Default Title"!==i.variant.name&&` - ${i.variant.name}`]}),e.jsxs("div",{className:"gp-flex gp-flex-col gp-gap-1 gp-text-sm",children:[e.jsxs("div",{className:"gp-flex gp-gap-2",children:[e.jsx("span",{className:"gp-font-semibold",children:c.localizedString}),i.variant?.listPrice>0&&e.jsx("span",{className:"gp-text-[#B4B4B4] gp-line-through",children:o.localizedString})]}),i.attributes?.map(s=>e.jsxs("div",{children:[s.key,": ",s.value]},s.key))]}),e.jsxs("div",{className:"gp-flex gp-items-center gp-justify-between",children:[e.jsx(a.default,{size:"medium"}),e.jsx("button",{onClick:()=>{t.openConfirm({title:e.jsxs("div",{className:"gp-flex gp-w-full gp-flex-col gp-items-center gp-gap-4",children:[e.jsx(l.default,{}),e.jsx("p",{className:"gp-font-g-body gp-text-xl gp-font-semibold",children:"Are you sure ?"})]}),content:e.jsxs("div",{className:"gp-text-center",children:[e.jsx("p",{children:"Do you really want to delete these items?"}),e.jsx("p",{children:"This process cannot be undone."})]}),className:"gp-w-full gp-max-w-[572px] gp-gap-4 gp-rounded",buttons:[{label:"Cancel",className:"gp-w-[130px] !gp-bg-g-bg-1"},{label:"Delete",className:"!gp-bg-g-error !gp-text-g-text-3 !font-g-body gp-w-[130px]",onClick:()=>{n&&i.id&&p({cartId:n,lineId:i.id})}}]})},"aria-label":"Remove item from cart",title:"Remove item from cart",type:"button",children:g?e.jsx(r.default,{className:"gp-text-g-brand"}):e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"gp-w-4 gp-text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("./CartLineQuantityAdjustButton.js"),s=require("@gem-sdk/core");const r=({size:r})=>{let l=s.useCartLine();return e.jsxs("div",{className:s.cls("gp-mt-2 gp-inline-flex gp-items-center gp-overflow-auto gp-rounded gp-border gp-border-g-line-3 gp-text-g-text-1",{"gp-h-12":"large"===r,"gp-h-10":"medium"===r,"gp-h-8":"small"===r}),children:[e.jsx(t.default,{adjust:"decrease","aria-label":"Decrease quantity",className:"gp-flex gp-aspect-square gp-h-full gp-items-center gp-justify-center",children:e.jsx("svg",{className:"gp-h-4",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M3.755 12.5h16.492a.75.75 0 0 0 0-1.5H3.755a.75.75 0 0 0 0 1.5Z"})})}),e.jsx("div",{className:"gp-flex gp-h-full gp-min-w-[50px] gp-select-none gp-items-center gp-justify-center gp-border-x gp-border-g-line-3 gp-px-2 gp-text-center gp-text-base gp-font-semibold",children:l.quantity}),e.jsx(t.default,{adjust:"increase","aria-label":"Increase quantity",className:"gp-flex gp-aspect-square gp-h-full gp-items-center gp-justify-center",children:e.jsx("svg",{className:"gp-h-4",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M11.75 3a.75.75 0 0 1 .743.648l.007.102.001 7.25h7.253a.75.75 0 0 1 .102 1.493l-.102.007h-7.253l.002 7.25a.75.75 0 0 1-1.493.101l-.007-.102-.002-7.249H3.752a.75.75 0 0 1-.102-1.493L3.752 11h7.25L11 3.75a.75.75 0 0 1 .75-.75Z"})})})]})};r.defaultProps={size:"medium"},exports.default=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("@gem-sdk/core"),l=require("@gem-sdk/components"),t=require("react"),a=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("@gem-sdk/core"),l=require("@gem-sdk/components"),t=require("react"),a=require("./LoadingIcon.js"),r=require("./icons/Trash.js");exports.default=({item:p})=>{let{cartId:g}=s.useCartId(),{trigger:c,isMutating:o}=s.useCartDiscountCodesUpdate(),{data:i}=s.useCartData(),n=t.useMemo(()=>i?.discounts?.map(e=>e.code).filter(s.isDefined)??[],[i?.discounts]),d=t.useCallback(s=>{l.openConfirm({title:e.jsxs("div",{className:"gp-flex gp-w-full gp-flex-col gp-items-center gp-gap-4",children:[e.jsx(r.default,{}),e.jsx("p",{className:"gp-font-g-body gp-text-xl gp-font-semibold",children:"Are you sure ?"})]}),content:e.jsx("div",{className:"gp-text-center",children:e.jsx("p",{children:"Do you really want to delete this code?"})}),className:"gp-w-full gp-max-w-[572px] gp-gap-4 gp-rounded",buttons:[{label:"Cancel",className:"gp-w-[130px] !gp-bg-g-bg-1"},{label:"Delete",className:"!gp-bg-g-error !gp-text-g-text-3 !font-g-body gp-w-[130px]",onClick:()=>{g&&c({cartId:g,discountCodes:n.filter(e=>e!==s)})}}]})},[g,c,n]);return e.jsxs("div",{className:"gp-flex gp-h-8 gp-items-center gp-gap-2 gp-rounded-sm gp-border gp-pl-2",children:[e.jsx("span",{className:s.cls("gp-flex-1",{"gp-text-g-error gp-line-through":!p.applicable,"gp-text-g-success":p.applicable}),children:p.code}),e.jsx("button",{disabled:o,onClick:()=>d(p.code),className:"gp-flex gp-aspect-square gp-h-full gp-items-center gp-justify-center",children:o?e.jsx(a.default,{className:"gp-text-g-brand"}):e.jsx("svg",{className:"gp-w-4",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"m4.397 4.554.073-.084a.75.75 0 0 1 .976-.073l.084.073L12 10.939l6.47-6.47a.75.75 0 1 1 1.06 1.061L13.061 12l6.47 6.47a.75.75 0 0 1 .072.976l-.073.084a.75.75 0 0 1-.976.073l-.084-.073L12 13.061l-6.47 6.47a.75.75 0 0 1-1.06-1.061L10.939 12l-6.47-6.47a.75.75 0 0 1-.072-.976l.073-.084-.073.084Z",fill:"currentColor"})})})]},p.code)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{
|
|
1
|
+
import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{useCartData as l,useCartUI as p,CartLineProvider as i,cls as o}from"@gem-sdk/core";import{ELEMENT_Z_INDEX as a}from"@gem-sdk/components";import{Transition as g}from"react-transition-group";import{useRef as n}from"react";import c from"./CartDiscountCode.js";import s from"./CartOrderNote.js";import d from"./CartLineItem.js";import m from"./CartFooter.js";let u={transition:"opacity 300ms ease-in-out",opacity:0},f={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0},exited:{opacity:0},unmounted:{opacity:0}},h=({className:h,style:b,setting:x})=>{let{data:w,isLoading:y,error:v}=l(),{closeCart:C,isCartOpen:N}=p(),L=n(null);return e(g,{in:N,timeout:300,nodeRef:L,children:l=>r("div",{ref:L,className:o("gp-fixed gp-inset-0 gp-z-90",h,{"gp-invisible":!N,"gp-visible":N}),style:{...b,...u,...f[l],zIndex:a.CART_DRAWER},children:[e("div",{"aria-hidden":!0,onClick:()=>C(),className:"gp-fixed gp-inset-0 gp-z-80 gp-bg-slate-600/40"}),e("div",{className:"gp-fixed gp-inset-y-0 gp-right-0 gp-z-90 gp-flex gp-w-full gp-max-w-[400px] gp-flex-col gp-bg-white gp-text-g-text-1 gp-shadow-2xl mobile:gp-w-full",children:y?e("div",{className:"gp-w-full gp-pt-10 gp-text-center",children:"Loading..."}):v?r("div",{className:"gp-w-full gp-pt-10 gp-text-center gp-text-g-error",children:["Error: ",v?.[0]?.message]}):r(t,{children:[r("div",{className:"gp-flex gp-items-center gp-justify-between gp-border-b-g-line-3 gp-px-6 gp-py-3 border-b",children:[e("span",{className:"gp-font-g-heading gp-text-xl gp-font-semibold",children:x?.title}),e("button",{onClick:C,title:"Close cart drawer",children:e("svg",{className:"gp-w-5",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"m4.397 4.554.073-.084a.75.75 0 0 1 .976-.073l.084.073L12 10.939l6.47-6.47a.75.75 0 1 1 1.06 1.061L13.061 12l6.47 6.47a.75.75 0 0 1 .072.976l-.073.084a.75.75 0 0 1-.976.073l-.084-.073L12 13.061l-6.47 6.47a.75.75 0 0 1-1.06-1.061L10.939 12l-6.47-6.47a.75.75 0 0 1-.072-.976l.073-.084-.073.084Z"})})})]}),e("div",{className:"gp-group gp-h-full gp-overflow-y-auto gp-px-6 gp-pb-4 scrollbar:!gp-h-1.5 scrollbar:!gp-w-1.5 scrollbar:gp-bg-transparent scrollbar-track:!gp-rounded scrollbar-track:!gp-bg-slate-100 scrollbar-thumb:!gp-rounded scrollbar-thumb:!gp-bg-slate-300",children:w&&w.lineItems.length?r(t,{children:[e("div",{className:"gp-flex gp-flex-col",children:w.lineItems.map(r=>r?e(i,{line:r,children:e(d,{})},r.id):null)}),e(s,{placeholder:"Leave your order note here...",triggerUpdate:"blur"})]}):e("div",{className:"gp-w-full gp-pt-10 gp-text-center",children:x?.emptyLabel})}),e(c,{}),!!w&&!!w.lineItems.length&&e(m,{openMode:x?.openMode,checkoutUrl:w.checkoutUrl,price:w?.totalPrice,currencyCode:w?.currency.code})]})})]})})};h.defaultProps={setting:{title:"Your Cart",emptyLabel:"Your cart is empty",openMode:"page"}};export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useCartLine as a,useCartId as r,useRemoveCartItem as l,useMoney as i}from"@gem-sdk/core";import{openConfirm as n}from"@gem-sdk/components";import p from"./CartLineItemQuantity.js";import s from"./
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useCartLine as a,useCartId as r,useRemoveCartItem as l,useMoney as i}from"@gem-sdk/core";import{openConfirm as n}from"@gem-sdk/components";import p from"./CartLineItemQuantity.js";import s from"./LoadingIcon.js";import g from"./icons/Trash.js";let c=()=>{let c=a(),{cartId:o}=r(),{isMutating:m,trigger:d}=l(),u=i(c.variant?.price?c.variant?.price:0),v=i(c.variant?.listPrice?c.variant?.listPrice:0);return e("div",{className:"gp-flex gp-items-center gp-gap-4 gp-border-b gp-border-b-g-line-2 gp-py-4 last:gp-border-b-transparent",children:[t("div",{className:"gp-aspect-square gp-w-16",children:c.variant?.image?.url&&t("img",{className:"gp-h-full gp-w-full gp-object-cover",src:c.variant.image.url,alt:c.variant?.image?.altText??""})}),e("div",{className:"gp-flex-1",children:[e("p",{className:"gp-line-clamp-2",children:[c.productTitle," ","Default Title"!==c.variant.name&&` - ${c.variant.name}`]}),e("div",{className:"gp-flex gp-flex-col gp-gap-1 gp-text-sm",children:[e("div",{className:"gp-flex gp-gap-2",children:[t("span",{className:"gp-font-semibold",children:u.localizedString}),c.variant?.listPrice>0&&t("span",{className:"gp-text-[#B4B4B4] gp-line-through",children:v.localizedString})]}),c.attributes?.map(t=>e("div",{children:[t.key,": ",t.value]},t.key))]}),e("div",{className:"gp-flex gp-items-center gp-justify-between",children:[t(p,{size:"medium"}),t("button",{onClick:()=>{n({title:e("div",{className:"gp-flex gp-w-full gp-flex-col gp-items-center gp-gap-4",children:[t(g,{}),t("p",{className:"gp-font-g-body gp-text-xl gp-font-semibold",children:"Are you sure ?"})]}),content:e("div",{className:"gp-text-center",children:[t("p",{children:"Do you really want to delete these items?"}),t("p",{children:"This process cannot be undone."})]}),className:"gp-w-full gp-max-w-[572px] gp-gap-4 gp-rounded",buttons:[{label:"Cancel",className:"gp-w-[130px] !gp-bg-g-bg-1"},{label:"Delete",className:"!gp-bg-g-error !gp-text-g-text-3 !font-g-body gp-w-[130px]",onClick:()=>{o&&c.id&&d({cartId:o,lineId:c.id})}}]})},"aria-label":"Remove item from cart",title:"Remove item from cart",type:"button",children:m?t(s,{className:"gp-text-g-brand"}):t("svg",{xmlns:"http://www.w3.org/2000/svg",className:"gp-w-4 gp-text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]})]})};export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useCartLine as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import r from"./CartLineQuantityAdjustButton.js";import{useCartLine as a,cls as l}from"@gem-sdk/core";let p=({size:p})=>{let g=a();return e("div",{className:l("gp-mt-2 gp-inline-flex gp-items-center gp-overflow-auto gp-rounded gp-border gp-border-g-line-3 gp-text-g-text-1",{"gp-h-12":"large"===p,"gp-h-10":"medium"===p,"gp-h-8":"small"===p}),children:[t(r,{adjust:"decrease","aria-label":"Decrease quantity",className:"gp-flex gp-aspect-square gp-h-full gp-items-center gp-justify-center",children:t("svg",{className:"gp-h-4",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M3.755 12.5h16.492a.75.75 0 0 0 0-1.5H3.755a.75.75 0 0 0 0 1.5Z"})})}),t("div",{className:"gp-flex gp-h-full gp-min-w-[50px] gp-select-none gp-items-center gp-justify-center gp-border-x gp-border-g-line-3 gp-px-2 gp-text-center gp-text-base gp-font-semibold",children:g.quantity}),t(r,{adjust:"increase","aria-label":"Increase quantity",className:"gp-flex gp-aspect-square gp-h-full gp-items-center gp-justify-center",children:t("svg",{className:"gp-h-4",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M11.75 3a.75.75 0 0 1 .743.648l.007.102.001 7.25h7.253a.75.75 0 0 1 .102 1.493l-.102.007h-7.253l.002 7.25a.75.75 0 0 1-1.493.101l-.007-.102-.002-7.249H3.752a.75.75 0 0 1-.102-1.493L3.752 11h7.25L11 3.75a.75.75 0 0 1 .75-.75Z"})})})]})};p.defaultProps={size:"medium"};export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{useCartId as t,useCartDiscountCodesUpdate as p,useCartData as g,isDefined as o,cls as r}from"@gem-sdk/core";import{openConfirm as s}from"@gem-sdk/components";import{useMemo as a,useCallback as c}from"react";import n from"./
|
|
1
|
+
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{useCartId as t,useCartDiscountCodesUpdate as p,useCartData as g,isDefined as o,cls as r}from"@gem-sdk/core";import{openConfirm as s}from"@gem-sdk/components";import{useMemo as a,useCallback as c}from"react";import n from"./LoadingIcon.js";import i from"./icons/Trash.js";let d=({item:d})=>{let{cartId:m}=t(),{trigger:f,isMutating:u}=p(),{data:x}=g(),h=a(()=>x?.discounts?.map(e=>e.code).filter(o)??[],[x?.discounts]),b=c(t=>{s({title:l("div",{className:"gp-flex gp-w-full gp-flex-col gp-items-center gp-gap-4",children:[e(i,{}),e("p",{className:"gp-font-g-body gp-text-xl gp-font-semibold",children:"Are you sure ?"})]}),content:e("div",{className:"gp-text-center",children:e("p",{children:"Do you really want to delete this code?"})}),className:"gp-w-full gp-max-w-[572px] gp-gap-4 gp-rounded",buttons:[{label:"Cancel",className:"gp-w-[130px] !gp-bg-g-bg-1"},{label:"Delete",className:"!gp-bg-g-error !gp-text-g-text-3 !font-g-body gp-w-[130px]",onClick:()=>{m&&f({cartId:m,discountCodes:h.filter(e=>e!==t)})}}]})},[m,f,h]);return l("div",{className:"gp-flex gp-h-8 gp-items-center gp-gap-2 gp-rounded-sm gp-border gp-pl-2",children:[e("span",{className:r("gp-flex-1",{"gp-text-g-error gp-line-through":!d.applicable,"gp-text-g-success":d.applicable}),children:d.code}),e("button",{disabled:u,onClick:()=>b(d.code),className:"gp-flex gp-aspect-square gp-h-full gp-items-center gp-justify-center",children:u?e(n,{className:"gp-text-g-brand"}):e("svg",{className:"gp-w-4",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"m4.397 4.554.073-.084a.75.75 0 0 1 .976-.073l.084.073L12 10.939l6.47-6.47a.75.75 0 1 1 1.06 1.061L13.061 12l6.47 6.47a.75.75 0 0 1 .072.976l-.073.084a.75.75 0 0 1-.976.073l-.084-.073L12 13.061l-6.47 6.47a.75.75 0 0 1-1.06-1.061L10.939 12l-6.47-6.47a.75.75 0 0 1-.072-.976l.073-.084-.073.084Z",fill:"currentColor"})})})]},d.code)};export{d as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/plugin-cart-drawer",
|
|
3
|
-
"version": "21.0.
|
|
3
|
+
"version": "21.1.0-staging.40",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
-
"cleanup": "rimraf es dist lib",
|
|
12
11
|
"prebuild": "yarn cleanup",
|
|
13
|
-
"pre:publish": "node ./../../helpers/convert-publish.js -p",
|
|
14
|
-
"post:publish": "node ./../../helpers/convert-publish.js",
|
|
15
|
-
"watch": "rollup -c ./../../helpers/rollup.config.mjs -w",
|
|
16
12
|
"build": "rollup -c ./../../helpers/rollup.config.mjs --environment NODE_ENV:production",
|
|
13
|
+
"cleanup": "rimraf es dist lib",
|
|
17
14
|
"lint": "oxlint --format=stylish ./src",
|
|
15
|
+
"post:publish": "node ./../../helpers/convert-publish.js",
|
|
16
|
+
"pre:publish": "node ./../../helpers/convert-publish.js -p",
|
|
17
|
+
"test": "jest -c ./../../helpers/jest.config.ts",
|
|
18
18
|
"type-check": "node ../../node_modules/typescript7/bin/tsc --noEmit",
|
|
19
|
-
"
|
|
19
|
+
"watch": "rollup -c ./../../helpers/rollup.config.mjs -w"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@gem-sdk/components": "21.0.
|
|
23
|
-
"@gem-sdk/core": "21.0.
|
|
24
|
-
"@gem-sdk/styles": "21.0.
|
|
22
|
+
"@gem-sdk/components": "21.1.0-staging.40",
|
|
23
|
+
"@gem-sdk/core": "21.1.0-staging.40",
|
|
24
|
+
"@gem-sdk/styles": "21.1.0-staging.40"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": "18.3.1",
|