@dropins/storefront-cart 1.3.1-alpha2 → 1.4.0-alpha1
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/api/fetch-graphql/fetch-graphql.d.ts +2 -2
- package/api/initialize/initialize.d.ts +3 -3
- package/chunks/CartSummaryGrid.js +1 -1
- package/chunks/CartSummaryList.js +1 -1
- package/chunks/CartSummaryTable2.js +3 -0
- package/chunks/Coupons.js +1 -1
- package/chunks/EmptyCart.js +1 -1
- package/chunks/OrderSummary.js +1 -1
- package/chunks/OrderSummaryLine.js +1 -1
- package/chunks/WarningWithCircle.js +3 -0
- package/components/CartSummaryTable/CartSummaryTable.d.ts +42 -0
- package/components/CartSummaryTable/Elements/Item/Item.d.ts +13 -0
- package/components/CartSummaryTable/Elements/Item/index.d.ts +11 -0
- package/components/CartSummaryTable/Elements/index.d.ts +2 -0
- package/components/CartSummaryTable/index.d.ts +11 -0
- package/components/GiftOptions/Elements/GiftOptionModal.d.ts +1 -1
- package/components/GiftOptions/GiftOptions.d.ts +1 -1
- package/components/index.d.ts +1 -0
- package/containers/CartSummaryGrid/CartSummaryGrid.d.ts +2 -2
- package/containers/CartSummaryGrid.js +1 -1
- package/containers/CartSummaryList/CartSummaryList.d.ts +2 -2
- package/containers/CartSummaryList.js +1 -1
- package/containers/CartSummaryTable/CartSummaryTable.d.ts +86 -0
- package/containers/CartSummaryTable/index.d.ts +11 -0
- package/containers/CartSummaryTable.d.ts +3 -0
- package/containers/CartSummaryTable.js +3 -0
- package/containers/Coupons/Coupons.d.ts +1 -1
- package/containers/Coupons.js +1 -1
- package/containers/EmptyCart/EmptyCart.d.ts +1 -1
- package/containers/EmptyCart.js +1 -1
- package/containers/EstimateShipping/EstimateShipping.d.ts +1 -1
- package/containers/EstimateShipping.js +1 -1
- package/containers/GiftCards/GiftCards.d.ts +1 -1
- package/containers/GiftCards.js +1 -1
- package/containers/GiftOptions/GiftOptions.d.ts +2 -2
- package/containers/GiftOptions.js +1 -1
- package/containers/MiniCart/MiniCart.d.ts +2 -2
- package/containers/MiniCart.js +1 -1
- package/containers/OrderSummary/OrderSummary.d.ts +1 -1
- package/containers/OrderSummary.js +1 -1
- package/containers/OrderSummaryLine/OrderSummaryLine.d.ts +1 -1
- package/containers/OrderSummaryLine.js +1 -1
- package/containers/index.d.ts +1 -0
- package/hooks/useCartItems.d.ts +85 -0
- package/hooks/useGiftOptions.d.ts +1 -2
- package/i18n/en_US.json.d.ts +16 -5
- package/package.json +1 -1
- package/render/render.d.ts +1 -1
- package/render.js +3 -2
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{C as T,C as c}from"../chunks/CartSummaryTable2.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/i18n.js";import"@dropins/tools/event-bus.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/persisted-data.js";import"../chunks/updateProductsFromCart.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/acdl.js";import"../chunks/WarningWithCircle.js";export{T as CartSummaryTable,c as default};
|
package/containers/Coupons.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as E,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{useState as l,useEffect as m}from"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import{Tag as b,Icon as x,Button as L,Input as R}from"@dropins/tools/components.js";/* empty css
|
|
3
|
+
import{jsxs as E,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{useState as l,useEffect as m}from"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import{Tag as b,Icon as x,Button as L,Input as R}from"@dropins/tools/components.js";/* empty css */import{S as P,C as B}from"../chunks/Coupons.js";import"@dropins/tools/preact-hooks.js";import"../chunks/resetCart.js";import{events as S}from"@dropins/tools/event-bus.js";import{a as f,A as h}from"../chunks/applyCouponsToCart.js";import{useText as $}from"@dropins/tools/i18n.js";import"../chunks/Coupon.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/persisted-data.js";import"../chunks/refreshCart.js";import"../fragments.js";const U=({children:z,...w})=>{const[d,c]=l(new Set),[i,C]=l([]),[u,p]=l(new Set),s=$({applyButton:"Cart.PriceSummary.coupon.applyAction",placeholder:"Cart.PriceSummary.coupon.placeholder",ariaLabelRemove:"Cart.PriceSummary.coupon.ariaLabelRemove"}),y=async o=>{const e=o.coupon,r=new Set(d);r.add(e),p(new Set);const n=Array.from(r);f(n,h.REPLACE).then(a=>{if(a===null)throw new Error("Error adding coupon code");c(r)}).catch(a=>{console.warn(a),p(new Set([a.message]))})},A=o=>{const e=new Set(d);e.delete(o),p(new Set);const r=Array.from(e);f(r,h.REPLACE).then(n=>{if(n===null)throw new Error("Error removing coupon code");c(e)}).catch(n=>{console.warn(n),p(new Set([n.message]))})};m(()=>{const o=S.on("cart/data",e=>{const r=e==null?void 0:e.appliedCoupons;if(!r){C([]),p(new Set);return}const n=r.map(a=>a.code);C(n),p(new Set)},{eager:!0});return()=>{o==null||o.off()}},[]),m(()=>{c(new Set(i))},[i]),m(()=>{const o=S.on("shipping/estimate",()=>{p(new Set)},{eager:!0});return()=>{o==null||o.off()}},[]);const g=i.map((o,e)=>E(b,{className:"coupon-code-form__applied-item",children:[t("span",{children:o}),t("button",{"aria-label":`${s.ariaLabelRemove} ${o}`,onClick:()=>A(o),"data-testid":`remove-coupon-${e+1}`,children:t(x,{source:P,size:"16"})})]},o)),v=u.size>0?t("div",{"data-testid":"coupon-code-error",children:Array.from(u)[0]}):void 0;return t(B,{...w,couponCodeField:t(R,{"aria-label":s.placeholder,type:"text",placeholder:s.placeholder,name:"coupon",variant:"primary",value:"","data-testid":"coupon-code-input",maxLength:50,error:u.size>0}),applyCouponsButton:t(L,{variant:"secondary",children:s.applyButton}),error:v,appliedCoupons:t("div",{children:g}),onApplyCoupon:y})};export{U as Coupons,U as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'preact/compat';
|
|
2
|
-
import { Container } from '
|
|
2
|
+
import { Container } from '@dropins/tools/types/elsie/src/lib';
|
|
3
3
|
|
|
4
4
|
export interface EmptyCartProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
routeCTA?: () => string;
|
package/containers/EmptyCart.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as m}from"@dropins/tools/preact-jsx-runtime.js";import{E as p}from"../chunks/EmptyCart.js";import"@dropins/tools/lib.js";import"@dropins/tools/preact-compat.js";/* empty css
|
|
3
|
+
import{jsx as m}from"@dropins/tools/preact-jsx-runtime.js";import{E as p}from"../chunks/EmptyCart.js";import"@dropins/tools/lib.js";import"@dropins/tools/preact-compat.js";/* empty css */import"@dropins/tools/components.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/i18n.js";const c=({routeCTA:t})=>m(p,{ctaLinkURL:t==null?void 0:t()});export{c as EmptyCart,c as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as T,jsx as e,Fragment as V}from"@dropins/tools/preact-jsx-runtime.js";import{classes as D,VComponent as B,getFormValues as $}from"@dropins/tools/lib.js";import{Button as q,Input as w,Picker as G,Price as U}from"@dropins/tools/components.js";/* empty css
|
|
3
|
+
import{jsxs as T,jsx as e,Fragment as V}from"@dropins/tools/preact-jsx-runtime.js";import{classes as D,VComponent as B,getFormValues as $}from"@dropins/tools/lib.js";import{Button as q,Input as w,Picker as G,Price as U}from"@dropins/tools/components.js";/* empty css */import{useRef as H,useState as s,useEffect as Z,useCallback as J}from"@dropins/tools/preact-compat.js";import{useText as M,Text as k}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-hooks.js";import{s as X}from"../chunks/resetCart.js";import{events as R}from"@dropins/tools/event-bus.js";import{s as j}from"../chunks/persisted-data.js";import{g as O,a as Q,b as W}from"../chunks/getEstimateShipping.js";import"@dropins/tools/fetch-graphql.js";const Y=({countryField:z,destinationText:f,estimateButton:I,estimated:A,loading:N,onEstimate:l,price:S,priceExcludingTax:F,priceIncludingTax:n,stateField:C,taxExcluded:y,taxIncluded:P,zipField:m})=>{const d=H(null),[L,x]=s(!0),[E,i]=s("zip"),r=M({editZipAction:"Cart.EstimateShipping.editZipAction",destinationLinkAriaLabel:"Cart.EstimateShipping.destinationLinkAriaLabel",shippingLabel:"Cart.EstimateShipping.label",zipPlaceholder:"Cart.EstimateShipping.zipPlaceholder"}),_=p=>{p.preventDefault(),x(b=>!b)},t=p=>{p.preventDefault(),x(!0),i(b=>b==="zip"?"state":"zip")},h=p=>{p.preventDefault(),x(!1);const b=$(d.current);l==null||l(b)},v=r.destinationLinkAriaLabel.replace("{destination}",f);return T("div",{"data-testid":"estimate-shipping",className:D(["cart-estimate-shipping",["cart-estimate-shipping--loading",N]]),children:[e("span",{className:"cart-estimate-shipping__label",children:A?f?T(V,{children:[e(k,{id:"Cart.EstimateShipping.estimatedDestination"})," ",e("a",{className:"cart-estimate-shippingLink",role:"button",href:"",onClick:_,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&_(p)},tabIndex:0,"aria-label":v,"data-testid":"shipping-destination-link",children:f})]}):e(k,{id:"Cart.EstimateShipping.estimated"}):e(k,{id:"Cart.EstimateShipping.label"})}),e(B,{node:S,className:"cart-estimate-shipping__price"}),A&&T(V,{children:[e("div",{className:D(["cart-estimate-shipping__caption"]),children:e("a",{href:"#",className:"cart-estimate-shipping__link",onClick:t,"data-testid":"shipping-alternate-field-link",children:E==="zip"?e(k,{id:"Cart.EstimateShipping.alternateField.state"}):e(k,{id:"Cart.EstimateShipping.alternateField.zip"})})}),T("form",{className:D(["cart-estimate-shipping--edit",["cart-estimate-shipping--hide",!L]]),ref:d,"data-testid":"shipping-estimate-form",children:[z&&e(B,{node:z,className:D(["cart-estimate-shipping--country"])}),E==="state"?C&&e(B,{node:C,className:D(["cart-estimate-shipping--state"])}):m&&e(B,{node:m,className:D(["cart-estimate-shipping--zip"])}),I&&e(B,{node:I,className:D(["cart-estimate-shipping--action"]),onClick:h,type:"submit"})]})]}),P&&e("div",{"data-testid":"shipping-tax-included",className:D(["cart-estimate-shipping__caption"]),children:T("span",{children:[n," ",e(k,{id:"Cart.EstimateShipping.withTaxes"})]})}),y?e("div",{"data-testid":"shipping-tax-included-excluded",className:D(["cart-estimate-shipping__caption"]),children:T("span",{children:[F," ",e(k,{id:"Cart.EstimateShipping.withoutTaxes"})]})}):void 0]})},ee=()=>{const[z,f]=s(!1),[I,A]=s([]),[N,l]=s("US"),[S,F]=s(""),[n,C]=s(""),[y,P]=s([]),[m,d]=s(!1),[L,x]=s(),[E,i]=s(),[r,_]=s(""),[t,h]=s(!1),v=()=>{l("US"),F(""),C(""),x(null),i(null),_(""),h(!1)},p=async u=>{const{shippingCountry:a,shippingState:o="",shippingZip:c=""}=u,K={countryCode:a,postcode:c,region:{region:o}};return f(!0),W(K).then(g=>(g&&(x({amount:g.amount.value,currency:g.amount.currency,priceIncludingtax:{amount:g.price_incl_tax.value,currency:g.price_incl_tax.currency},priceExcludingtax:{amount:g.price_excl_tax.value,currency:g.price_excl_tax.currency}}),i({carrier_code:g.carrier_code,method_code:g.method_code}),l(a),F(o),C(c),_(o||c||a),h(!0)),l(a),F(o),C(c),_(o||c||a),g)).finally(()=>{f(!1)})},b=u=>{u.preventDefault(),F(""),C("");const a=u.target.value;l(a)};return Z(()=>{O().then(u=>{let a="US";const o=u.map(c=>(c.isDefaultCountry&&(a=c.id),{text:c.label,value:c.id}));A(o),l(a)})},[]),Z(()=>{d(!0),Q(N).then(u=>{const a=u.map(o=>({text:o.name,value:o.code}));P(a)}).finally(()=>{d(!1)})},[N,d]),{loading:z,regionsLoading:m,estimatedDestinationText:r,countries:I,selectedCountry:N,selectedRegion:S,selectedZip:n,regions:y,estimatedShippingPrice:L,estimatedShippingMethod:E,shippingEstimated:t,handleEstimateShipping:p,handleCountrySelected:b,resetValues:v,setPriceSummaryLoading:f}},he=({showDefaultEstimatedShippingCost:z})=>{var _;const[f,I]=s(!1),{loading:A,countries:N,regions:l,selectedCountry:S,estimatedDestinationText:F,estimatedShippingPrice:n,handleCountrySelected:C,handleEstimateShipping:y,regionsLoading:P,selectedRegion:m,selectedZip:d,shippingEstimated:L,resetValues:x}=ee(),E=J(t=>{y(t).then(()=>{j(t)})},[y]);Z(()=>{const t=R.on("cart/data",h=>{var a,o,c;I((h==null?void 0:h.isVirtual)||!1);const v=(o=(a=h==null?void 0:h.addresses)==null?void 0:a.shipping)==null?void 0:o[0];if(z&&!v&&y({shippingCountry:((c=X.config)==null?void 0:c.defaultCountry)??""}),!v)return;const{countryCode:p,regionCode:b,zipCode:u}=v;E({shippingCountry:p,shippingState:b,shippingZip:u})},{eager:!0});return()=>{t==null||t.off()}},[]),Z(()=>{const t=R.on("cart/updated",()=>{L&&y({shippingCountry:S,shippingState:m,shippingZip:d})});return()=>{t==null||t.off()}},[L,S,m,d,y]),Z(()=>{const t=R.on("cart/reset",()=>{x(),j(null)});return()=>{t==null||t.off()}},[x]),Z(()=>{const t=R.on("cart/merged",()=>{L&&E({shippingCountry:S,shippingState:m,shippingZip:d})});return()=>{t==null||t.off()}},[L,S,m,d,E]);const i=M({applyButton:"Cart.PriceSummary.estimatedShippingForm.apply.label",countryField:"Cart.PriceSummary.estimatedShippingForm.country.placeholder",freeShipping:"Cart.PriceSummary.freeShipping",stateField:"Cart.PriceSummary.estimatedShippingForm.state.placeholder",taxToBeDetermined:"Cart.PriceSummary.taxToBeDetermined",zipField:"Cart.PriceSummary.estimatedShippingForm.zip.placeholder"});if(f)return null;const r=(_=X.config)==null?void 0:_.shoppingCartDisplaySetting;return e(Y,{loading:A,taxIncluded:(r==null?void 0:r.shipping)==="INCLUDING_TAX",taxExcluded:(r==null?void 0:r.shipping)==="INCLUDING_EXCLUDING_TAX",price:(n==null?void 0:n.amount)==0?e("span",{"data-testId":"free-shipping",children:i.freeShipping}):(r==null?void 0:r.shipping)==="INCLUDING_TAX"&&n?e(U,{"data-testid":"shipping",...n.priceIncludingtax}):n?e(U,{...n}):e("span",{children:i.taxToBeDetermined}),estimated:!0,priceExcludingTax:n!=null&&n.priceExcludingtax?e(U,{"data-testid":"shipping-excluding-tax",...n.priceExcludingtax}):e("span",{children:i.taxToBeDetermined}),countryField:e(G,{name:"shippingCountry",placeholder:i.countryField,value:S,variant:"primary",options:N,handleSelect:C,"data-testid":"estimate-shipping-country-selector"}),stateField:l.length>0?e(G,{name:"shippingState",placeholder:i.stateField,variant:"primary",options:l,value:m,"data-testid":"estimate-shipping-state-selector",disabled:P}):e(w,{"aria-label":i.stateField,name:"shippingState",placeholder:i.stateField,variant:"primary",value:m,disabled:P,"data-testid":"estimate-shipping-state-input",maxLength:50}),zipField:e(w,{"aria-label":i.zipField,name:"shippingZip",placeholder:i.zipField,variant:"primary","data-testid":"estimate-shipping-zip-input",value:d,maxLength:12}),estimateButton:e(q,{variant:"secondary","data-testid":"estimate-shipping-apply-button","aria-label":i.applyButton,children:i.applyButton}),destinationText:F||i.taxToBeDetermined,onEstimate:E})};export{he as EstimateShipping,he as default};
|
package/containers/GiftCards.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as y,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import{useState as p,useEffect as l}from"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import{Tag as G,Icon as v,Button as b,Input as A}from"@dropins/tools/components.js";/* empty css
|
|
3
|
+
import{jsxs as y,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import{useState as p,useEffect as l}from"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import{Tag as G,Icon as v,Button as b,Input as A}from"@dropins/tools/components.js";/* empty css */import{S as L,C as x}from"../chunks/Coupons.js";import"@dropins/tools/preact-hooks.js";import"../chunks/resetCart.js";import{events as E}from"@dropins/tools/event-bus.js";import{r as P,a as T}from"../chunks/removeGiftCardFromCart.js";import{S as B}from"../chunks/GiftCard.js";import{useText as R}from"@dropins/tools/i18n.js";import"../chunks/Coupon.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/persisted-data.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/acdl.js";const X=({children:z,...C})=>{const[m,d]=p(new Set),[s,f]=p([]),[c,i]=p(new Set),o=R({giftCardTitle:"Cart.PriceSummary.giftCard.title",applyButton:"Cart.PriceSummary.giftCard.applyAction",placeholder:"Cart.PriceSummary.giftCard.placeholder",ariaLabel:"Cart.PriceSummary.giftCard.ariaLabel",ariaLabelRemove:"Cart.PriceSummary.giftCard.ariaLabelRemove",empty:"Cart.PriceSummary.giftCard.errors.empty"}),u=async r=>{const t=r==null?void 0:r.giftCardCode;if(t==="")return i(new Set([o.empty])),!0;const e=new Set(m);e.add(t),i(new Set),T(t).then(n=>{if(n===null)throw new Error("Error adding gift card code");d(e)}).catch(n=>{console.warn(n),i(new Set([n.message]))})},S=r=>{const t=new Set(m);t.delete(r),i(new Set),P(r).then(e=>{if(e===null)throw new Error("Error removing gift card code");d(t)}).catch(e=>{console.warn(e),i(new Set([e.message]))})};l(()=>{const r=E.on("cart/data",t=>{const e=t==null?void 0:t.appliedGiftCards;if(!e){f([]),i(new Set);return}const n=e.map(({code:w})=>w);f(n),i(new Set)},{eager:!0});return()=>{r==null||r.off()}},[]),l(()=>{d(new Set(s))},[s]);const g=s.map((r,t)=>y(G,{className:"coupon-code-form__applied-item",children:[a("span",{children:r}),a("button",{"aria-label":`${o.ariaLabelRemove} ${r}`,onClick:()=>S(r),"data-testid":`remove-giftcard-${t+1}`,children:a(v,{source:L,size:"16"})})]},r)),h=c.size>0?a("div",{"data-testid":"giftcard-code-error",children:Array.from(c)[0]}):void 0;return a(x,{...C,className:"cart-gift-cards",accordionSectionTitle:o.giftCardTitle,accordionSectionIcon:B,couponCodeField:a(A,{"aria-label":o.ariaLabel,type:"text",placeholder:o.placeholder,name:"giftCardCode",variant:"primary",value:"","data-testid":"giftcard-code-input",maxLength:50,error:c.size>0}),applyCouponsButton:a(b,{variant:"secondary",children:o.applyButton}),error:h,appliedCoupons:a("div",{children:g}),onApplyCoupon:u})};export{X as GiftCards,X as default};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Item } from '../../data/models';
|
|
2
|
-
import { Container, SlotProps } from '
|
|
2
|
+
import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
3
3
|
import { GiftOptionsViewProps, GiftOptionsDataSourcesProps, GiftFormDataType, ProductGiftOptionsConfig, GiftOptionsReadOnlyViewProps } from '../../types';
|
|
4
|
-
import { ImageNodeRenderProps, ImageProps } from '
|
|
4
|
+
import { ImageNodeRenderProps, ImageProps } from '@dropins/tools/types/elsie/src/components';
|
|
5
5
|
|
|
6
6
|
export interface GiftOptionsProps {
|
|
7
7
|
item: Item | ProductGiftOptionsConfig;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as t,jsxs as u,Fragment as A}from"@dropins/tools/preact-jsx-runtime.js";import{classes as We,Slot as Ze}from"@dropins/tools/lib.js";import{Modal as De,ContentGrid as Xe,ImageSwatch as Je,Button as se,Price as ce,Skeleton as Qe,SkeletonRow as Ye,Field as j,Checkbox as ae,Input as Me,TextArea as Ue,Accordion as Ne,AccordionSection as Pe,Icon as D,Card as Ve,ProgressSpinner as et}from"@dropins/tools/components.js";/* empty css */import*as X from"@dropins/tools/preact-compat.js";import{useRef as tt,useEffect as J,useState as M,useId as $e,useCallback as K,useMemo as le}from"@dropins/tools/preact-hooks.js";import{useText as Z}from"@dropins/tools/i18n.js";import{s as L}from"../chunks/resetCart.js";import{S as Re}from"../chunks/ChevronDown.js";import{S as Se}from"../chunks/ChevronUp.js";import{events as rt}from"@dropins/tools/event-bus.js";import{u as it}from"../chunks/updateProductsFromCart.js";import{s as nt}from"../chunks/setGiftOptionsOnCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/persisted-data.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/acdl.js";const ee=e=>X.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),X.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),de=e=>X.createElement("svg",{width:20,height:23,viewBox:"0 0 20 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{d:"M10 6L10 21.5M10 6H12.25C13.4926 6 14.5 4.99264 14.5 3.75C14.5 2.50736 13.4926 1.5 12.25 1.5C11.0074 1.5 10 2.50736 10 3.75M10 6V3.75M10 6H7.75C6.50736 6 5.5 4.99264 5.5 3.75C5.5 2.50736 6.50736 1.5 7.75 1.5C8.99264 1.5 10 2.50736 10 3.75M3.25 10.75H16.75C17.9926 10.75 19 9.74264 19 8.5C19 7.25736 17.9926 6.25 16.75 6.25H3.25C2.00736 6.25 1 7.25736 1 8.5C1 9.74264 2.00736 10.75 3.25 10.75ZM4.75 21.5H15.25C16.4926 21.5 17.5 20.4926 17.5 19.25V13.25C17.5 12.0074 16.4926 11 15.25 11H4.75C3.50736 11 2.5 12.0074 2.5 13.25V19.25C2.5 20.4926 3.50736 21.5 4.75 21.5Z",stroke:"currentColor",strokeWidth:1.5}));function ot(e){const i=tt(null);return J(()=>{if(!e||!i.current)return;const l=i.current,d=l.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])');if(d.length===0)return;const r=d[0],f=d[d.length-1];function g(o){o.key==="Tab"&&(o.shiftKey&&document.activeElement===r?(o.preventDefault(),f.focus()):!o.shiftKey&&document.activeElement===f&&(o.preventDefault(),r.focus()))}return l.addEventListener("keydown",g),()=>{l.removeEventListener("keydown",g)}},[e]),i}const at=({view:e,showModal:i,productName:l,giftWrappingConfig:d,imageSwatchImageNode:r,setShowModal:f,updateGiftOptions:g})=>{var w;const o=ot(i),n=Z({modalTitle:"Cart.GiftOptions.modal.title",defaultTitle:"Cart.GiftOptions.modal.defaultTitle",modalWrappingText:"Cart.GiftOptions.modal.wrappingText",modalWrappingSubText:"Cart.GiftOptions.modal.wrappingSubText",modalConfirmButton:"Cart.GiftOptions.modal.modalConfirmButton",modalCancelButton:"Cart.GiftOptions.modal.modalCancelButton",ariaLabelModal:"Cart.GiftOptions.modal.ariaLabelModal",ariaLabelModalOpen:"Cart.GiftOptions.modal.ariaLabelModalOpen",ariaLabelModalClose:"Cart.GiftOptions.modal.ariaLabelModalClose",ariaLabelWrapping:"Cart.GiftOptions.modal.ariaLabelWrapping"}),[c,C]=M();if(J(()=>{const p=d.find(T=>T.selected)??d[0];C(p)},[d]),J(()=>{const p=document==null?void 0:document.querySelector(".cart-gift-options-view__modal-wrapper");p&&(p==null||p.focus())},[]),!i||!d.length)return null;const s=l?`${n.modalTitle} ${l}`:n.defaultTitle;return t("div",{ref:o,className:"cart-gift-options-view__modal-wrapper",tabIndex:0,"aria-label":`${n.ariaLabelModal} ${i?n.ariaLabelModalOpen:n.ariaLabelModalClose} ${l}`,children:u(De,{"data-testid":`gift-option-modal-${e}`,className:"cart-gift-options-view__modal",size:"medium",title:u(A,{children:[t("span",{children:s}),c&&((w=c==null?void 0:c.price)==null?void 0:w.value)>0?t(ce,{amount:c.price.value,currency:c.price.currency,weight:"normal"}):null]}),centered:!0,onClose:f,children:[u("div",{className:"cart-gift-options-view__modal-content",children:[t("span",{className:"cart-gift-options-view__modal-text",children:n.modalWrappingText}),t(Xe,{emptyGridContent:t(A,{}),maxColumns:6,columnWidth:"100px",className:"cart-gift-options-view__modal-grid",children:d.map(p=>t(Je,{groupAriaLabel:n.ariaLabelWrapping,selected:(c==null?void 0:c.uid)===(p==null?void 0:p.uid),onValue:()=>{C(p)},imageNode:r,name:"giftWrappingId",value:p.uid,src:p.image.url,alt:p.design,label:p.design,"data-testid":`gift-option-modal-image-${p.uid}`,className:"cart-gift-options-view__modal-grid-item"},p.uid))}),t("span",{className:"cart-gift-options-view__modal-sub-text",children:c==null?void 0:c.design})]}),t(se,{"data-testid":"gift-option-modal-confirm-button",type:"button",onClick:()=>{g("giftWrappingId",c==null?void 0:c.uid,{isGiftWrappingSelected:!0}),f()},children:n.modalConfirmButton}),t(se,{type:"button",variant:"secondary",onClick:f,"data-testid":"gift-option-modal-cancel-button",children:n.modalCancelButton})]})})},lt=()=>t(Qe,{children:t(Ye,{variant:"row",size:"small",fullWidth:!0,lines:1,multilineGap:"small"})}),st=({className:e,view:i,item:l,giftOptions:d,disabled:r,cartData:f,giftWrappingConfig:g,setShowModal:o,onInputChange:n,areGiftOptionsVisible:c})=>{var N,P,B,z;const C=$e(),s=Z({customize:`Cart.GiftOptions.${i}.customize`,giftReceiptIncludedTitle:`Cart.GiftOptions.${i}.giftReceiptIncluded.title`,giftReceiptIncludedText:`Cart.GiftOptions.${i}.giftReceiptIncluded.subtitle`,printedCardIncludedTitle:`Cart.GiftOptions.${i}.printedCardIncluded.title`,printedCardIncludedText:`Cart.GiftOptions.${i}.printedCardIncluded.subtitle`,giftOptionsWrapTitle:`Cart.GiftOptions.${i}.giftOptionsWrap.title`,giftOptionsWrapText:`Cart.GiftOptions.${i}.giftOptionsWrap.subtitle`,requiredFieldError:"Cart.GiftOptions.formText.requiredFieldError"}),w=l==null?void 0:l.productGiftWrapping,p=f==null?void 0:f.cartGiftWrapping,T=i==="product"?w:p,y=T==null?void 0:T.find(S=>S.uid===d.giftWrappingId),V=(y==null?void 0:y.design)??"",O=l==null?void 0:l.giftWrappingPrice,v=V?`${s.giftOptionsWrapText} ${V}`:"",F=+(((P=(N=L.config)==null?void 0:N.printedCardPrice)==null?void 0:P.value)??0)>0?(B=L.config)==null?void 0:B.printedCardPrice:null;let _=null;O!=null&&O.value?_=O:(z=y==null?void 0:y.price)!=null&&z.value&&(_=y.price);const W=S=>S?u("span",{children:[" (+",t(ce,{amount:S.value,currency:S.currency,weight:"normal"}),")"]}):null;return u("div",{className:We([e,[`${e}--hidden`,!c.isGiftOptionsVisible]]),children:[c.isGiftReceiptVisible?t(j,{disabled:r,className:"cart-gift-options-view__field-gift-receipt",children:t(ae,{id:`giftReceiptIncluded-${C}`,disabled:r,name:"giftReceiptIncluded",checked:d.giftReceiptIncluded,placeholder:s.giftReceiptIncludedTitle,label:s.giftReceiptIncludedTitle,description:s.giftReceiptIncludedText,onChange:n})}):null,c.isPrintedCartVisible?t(j,{disabled:r,className:"cart-gift-options-view__field-printed-card",children:t(ae,{id:`printedCardIncluded-${C}`,disabled:r,name:"printedCardIncluded",checked:d.printedCardIncluded,placeholder:s.printedCardIncludedTitle,label:u(A,{children:[s.printedCardIncludedTitle,W(F)]}),description:s.printedCardIncludedText,onChange:n})}):null,c.isGiftWrappingVisible?u(A,{children:[t(j,{disabled:r,className:"cart-gift-options-view__field-gift-wrap",children:t(ae,{id:`giftOptionsWrap-${C}`,disabled:r,name:"isGiftWrappingSelected",checked:d.isGiftWrappingSelected,placeholder:s.giftOptionsWrapTitle,label:u(A,{children:[s.giftOptionsWrapTitle,W(_)]}),description:v,onChange:n})}),t(se,{disabled:r||!g.length,type:"button","data-testid":`gift-option-customize-${i}`,variant:"tertiary",onClick:()=>o(!0),children:s.customize})]}):null]})},dt=({view:e,giftOptions:i,disabled:l,errorMessage:d,onInputChange:r,onBlur:f,isGiftMessageVisible:g})=>{const o=$e(),n=Z({formTitle:`Cart.GiftOptions.${e}.formContent.formTitle`,formTo:`Cart.GiftOptions.${e}.formContent.formTo`,formFrom:`Cart.GiftOptions.${e}.formContent.formFrom`,giftMessageTitle:`Cart.GiftOptions.${e}.formContent.giftMessageTitle`,formToPlaceholder:`Cart.GiftOptions.${e}.formContent.formToPlaceholder`,formFromPlaceholder:`Cart.GiftOptions.${e}.formContent.formFromPlaceholder`,formMessagePlaceholder:`Cart.GiftOptions.${e}.formContent.formMessagePlaceholder`});return g?u(A,{children:[t("span",{children:n.formTitle}),u("div",{children:[t("span",{children:n.formTo}),t(j,{disabled:l,error:d.recipientName,children:t(Me,{id:`recipientName-${o}`,disabled:l,type:"text",name:"recipientName",value:i.recipientName,placeholder:n.formToPlaceholder,onChange:r,onBlur:f})})]}),u("div",{children:[t("span",{children:n.formFrom}),t(j,{disabled:l,error:d.senderName,children:t(Me,{id:`senderName-${o}`,disabled:l,type:"text",name:"senderName",value:i.senderName,placeholder:n.formFromPlaceholder,onChange:r,onBlur:f})})]}),u("div",{children:[t("span",{children:n.giftMessageTitle}),t(j,{disabled:l,children:t(Ue,{id:`message-${o}`,errorMessage:d.message,disabled:l,name:"message",value:i.message,label:n.formMessagePlaceholder,onChange:r,onBlur:f})})]})]}):null},ct=({view:e,giftOptions:i,giftWrappingConfig:l,readOnlyFormOrderView:d})=>{const r=Z({readOnlyProductTitle:"Cart.GiftOptions.product.readOnlyFormView.title",wrapping:"Cart.GiftOptions.product.readOnlyFormView.wrapping",recipient:"Cart.GiftOptions.product.readOnlyFormView.recipient",sender:"Cart.GiftOptions.product.readOnlyFormView.sender",message:"Cart.GiftOptions.product.readOnlyFormView.message",readOnlyOrderTitle:"Cart.GiftOptions.order.readOnlyFormView.title",readOnlyOrderGiftReceiptTitle:"Cart.GiftOptions.order.readOnlyFormView.giftReceipt",readOnlyOrderGiftReceiptText:"Cart.GiftOptions.order.readOnlyFormView.giftReceiptText",readOnlyOrderGiftPrintCardTitle:"Cart.GiftOptions.order.readOnlyFormView.printCard",readOnlyOrderGiftPrintCardText:"Cart.GiftOptions.order.readOnlyFormView.printCardText",readOnlyOrderGiftWrapTitle:"Cart.GiftOptions.order.readOnlyFormView.giftWrap",readOnlyOrderGiftWrapOptionsText:"Cart.GiftOptions.order.readOnlyFormView.giftWrapOptions",readOnlyOrderFormTitle:"Cart.GiftOptions.order.readOnlyFormView.formTitle",readOnlyOrderFormTo:"Cart.GiftOptions.order.readOnlyFormView.formTo",readOnlyOrderFormFrom:"Cart.GiftOptions.order.readOnlyFormView.formFrom",readOnlyOrderFormMessageTitle:"Cart.GiftOptions.order.readOnlyFormView.formMessageTitle"}),{recipientName:f,senderName:g,message:o,giftReceiptIncluded:n,printedCardIncluded:c,isGiftWrappingSelected:C}=i,s=l==null?void 0:l.find(({uid:O})=>O===(i==null?void 0:i.giftWrappingId)),w=!!f||!!g||!!o,p=s==null?void 0:s.design,T=n||c||(s==null?void 0:s.selected),y=[{id:1,title:r.wrapping,message:C?p:""},{id:2,title:r.recipient,message:f},{id:3,title:r.sender,message:g},{id:4,title:r.message,message:o}],V=y.every(({message:O})=>!O);if(e==="product"&&!V)return t(Ne,{"data-testid":"gift-options-product",iconClose:Se,iconOpen:Re,actionIconPosition:"right",children:t(Pe,{title:r.readOnlyProductTitle,showIconLeft:!0,iconLeft:de,defaultOpen:!1,renderContentWhenClosed:!1,children:t("div",{children:y.filter(O=>O.message).map(O=>u("p",{children:[O.title," ",O.message]},O.id))})})});if(e==="order"&&(w||T)){const O=u("div",{className:"cart-gift-options-readonly__header",children:[t(D,{source:de,size:"24"}),t("span",{children:r.readOnlyOrderTitle})]}),v=u(A,{children:[n?u("div",{className:"cart-gift-options-readonly__checkboxes cart-gift-options-readonly__checkboxes--gift-receipt",children:[t(D,{source:ee,size:"16"}),t("p",{children:r.readOnlyOrderGiftReceiptTitle}),t("p",{children:r.readOnlyOrderGiftReceiptText})]}):null,c?u("div",{className:"cart-gift-options-readonly__checkboxes cart-gift-options-readonly__checkboxes--print-card",children:[t(D,{source:ee,size:"16"}),t("p",{children:r.readOnlyOrderGiftPrintCardTitle}),t("p",{children:r.readOnlyOrderGiftPrintCardText})]}):null,s!=null&&s.selected?u("div",{className:"cart-gift-options-readonly__checkboxes cart-gift-options-readonly__checkboxes--gift-wrap",children:[t(D,{source:ee,size:"16"}),u("p",{children:[r.readOnlyOrderGiftWrapTitle," (+",t(ce,{amount:s.price.value,currency:s.price.currency,weight:"normal"}),")"]}),t("p",{children:`${r.readOnlyOrderGiftWrapOptionsText} ${s==null?void 0:s.design}`})]}):null]}),F=w?u("div",{className:"cart-gift-options-readonly__form",children:[t("div",{children:r.readOnlyOrderFormTitle}),u("div",{children:[u("p",{children:[t("span",{children:r.readOnlyOrderFormTo}),t("span",{children:f})]}),u("p",{children:[t("span",{children:r.readOnlyOrderFormFrom}),t("span",{children:g})]})]}),u("div",{children:[t("p",{children:r.readOnlyOrderFormMessageTitle}),t("p",{children:o})]})]}):null;return u(Ve,{variant:d,children:[O,v,F]})}return null},ft=({item:e,view:i,loading:l,giftOptions:d,showModal:r,isEditable:f,errorsField:g,updateLoading:o,cartData:n,fieldsDisabled:c,isGiftOptionsApplied:C,giftWrappingConfig:s,readOnlyFormOrderView:w,isGiftMessageVisible:p,areGiftOptionsVisible:T,imageSwatchImageNode:y,onBlur:V,setShowModal:O,updateGiftOptions:v,onInputChange:F,handleFormMouseLeave:_})=>{const W=Z({accordionHeading:`Cart.GiftOptions.${i}.accordionHeading`}),N=K(P=>t(Ne,{"data-testid":"gift-options-product",iconClose:Se,iconOpen:Re,actionIconPosition:"right",children:t(Pe,{title:u("div",{className:"cart-gift-options-view__icon--success",children:[t("span",{children:W.accordionHeading}),C?t(D,{source:ee,size:"16"}):null]}),ariaLabelTitle:W.accordionHeading,showIconLeft:!0,iconLeft:de,defaultOpen:C||P,renderContentWhenClosed:!1,children:u(A,{children:[t(st,{className:"cart-gift-options-view__top",view:i,item:e,giftOptions:d,disabled:c,onInputChange:F,cartData:n,giftWrappingConfig:s,setShowModal:O,areGiftOptionsVisible:T}),t("form",{className:"cart-gift-options-view__footer",onMouseLeave:_,children:t(dt,{view:i,giftOptions:d,disabled:c,errorMessage:g,onInputChange:F,onBlur:V,isGiftMessageVisible:p})})]})})}),[i,e,n,W,g,d,c,s,T,C,p,V,O,F,_]);return!T.isGiftOptionsVisible&&!p?null:u("div",{id:"cart-gift-options-view",className:We(["cart-gift-options-view",`cart-gift-options-view--${i}`,["cart-gift-options-view--loading",o]]),children:[o?t(et,{className:"cart-gift-options-view__spinner"}):null,l?t(lt,{}):u(A,{children:[f?null:t("div",{className:"cart-gift-options-view--readonly",children:t(ct,{view:i,giftOptions:d,giftWrappingConfig:s,readOnlyFormOrderView:w})}),r?t(at,{view:i,productName:e&&"name"in e?e==null?void 0:e.name:"",showModal:r,giftWrappingConfig:s,setShowModal:()=>O(!1),updateGiftOptions:v,imageSwatchImageNode:y}):null,i==="product"&&f?N(!1):null,i==="order"&&f?t(Ve,{variant:"secondary",children:N(!0)}):null]})]})},U={recipientName:"",senderName:"",message:""},pt={giftReceiptIncluded:!1,printedCardIncluded:!1,isGiftWrappingSelected:!1},ke=(e,i)=>{var d,r;if(!i)return!!((d=L.config)!=null&&d.allowGiftMessageOnOrder);const l=((r=L.config)==null?void 0:r.allowGiftMessageOnOrderItems)??!1;return typeof(e==null?void 0:e.giftMessageAvailable)=="boolean"?e==null?void 0:e.giftMessageAvailable:l},ut=(e,i)=>{const{allowGiftWrappingOnOrder:l,allowGiftWrappingOnOrderItems:d,allowGiftMessageOnOrder:r,allowGiftMessageOnOrderItems:f,allowGiftReceipt:g,allowPrintedCard:o}=L.config||{},n=!f&&!d&&!ke(i,!0),c=!l&&!r&&!g&&!o;return!!(e==="product"&&n||e==="order"&&c)},gt=({item:e,view:i,dataSource:l,initialLoading:d,handleItemsLoading:r,handleItemsError:f,onItemUpdate:g,onGiftOptionsChange:o})=>{var pe,ue,ge,me,Oe,he;const n=i==="product",c=Z({requiredFieldError:"Cart.GiftOptions.formText.requiredFieldError"}),[C,s]=M(()=>d),[w,p]=M({isGiftReceiptVisible:!0,isPrintedCartVisible:!0,isGiftWrappingVisible:!0,isGiftOptionsVisible:!0}),[T,y]=M(!0),[V,O]=M(!1),[v,F]=M(!1),[_,W]=M(!1),[N,P]=M(!1),[B,z]=M(!1),[S,te]=M([]),[h,re]=M(null),[Ie,ie]=M(U),[G,fe]=M(()=>({giftWrappingId:"",...U,...pt})),Q=((pe=G.recipientName)==null?void 0:pe.trim())&&((ue=G.senderName)==null?void 0:ue.trim())&&((ge=G.message)==null?void 0:ge.trim()),Y=!((me=G.recipientName)!=null&&me.trim())&&!((Oe=G.senderName)!=null&&Oe.trim())&&!((he=G.message)!=null&&he.trim()),R=K(async a=>{switch(O(i==="order"),F(!0),i){case"product":{"uid"in e&&(r==null||r(e.uid,!0),f==null||f(e.uid));const{recipientName:m,senderName:x,message:b,giftWrappingId:E,isGiftWrappingSelected:k}=a,H={gift_message:{to:m??"",from:x??"",message:b??""},gift_wrapping_id:k?E:null};"uid"in e&&"quantity"in e&&await it([{uid:e.uid,quantity:e.quantity,giftOptions:H}]).then(()=>{g==null||g({item:e})}).finally(()=>{r==null||r(e.uid,!1),F(!1),W(!1),O(!1)}).catch($=>{console.warn($)})}break;case"order":await nt(a).finally(()=>{F(!1),W(!1),O(!1)});break;default:console.error('Incorrect "view" prop value provided for GiftOptions container (storefront-cart)');break}},[f,r,e,g,i]),ne=K((a,m,x={})=>{fe(b=>{const E=I=>I in b,k=I=>E(I)?b[I]:void 0;if(!(k(a)!==m||Object.keys(x).some(I=>k(I)!==x[I])))return o==null||o(b),b;const $={...b,[a]:m,...x};return!$.recipientName&&!$.senderName&&!$.message&&P(!0),(typeof m=="boolean"||["giftWrappingId","giftReceiptIncluded","printedCardIncluded"].includes(a))&&(P(!1),typeof o=="function"?o($):R($)),W(!0),o==null||o($),$})},[R,o]),Le=K(async()=>{v||typeof o!="function"&&(Y&&N&&(ie(U),P(!1),await R(G)),_&&Q&&(P(!0),await R(G)))},[R,G,_,Y,N,v,o,Q]),Ae=K(async a=>{if(v||typeof o=="function")return;const{name:m,value:x}=a.target;ie(b=>({...b,[m]:x.trim()?"":c.requiredFieldError})),Y&&N&&(ie(U),P(!1),await R(G)),_&&Q&&await R(G)},[v,Y,N,_,Q,c,R,G,o]),Ee=K(a=>{const m=a.target,x=m.name,b=m.type==="checkbox"?m.checked:m.value;ne(x,b)},[ne]);J(()=>{if(n)return;const a=rt.on(l==="cart"?"cart/data":"order/data",m=>{var E,k;re(m);const x=(E=m==null?void 0:m.items)==null?void 0:E.every(({giftWrappingAvailable:H})=>H),b=(k=m==null?void 0:m.cartGiftWrapping)==null?void 0:k.some(H=>H.selected);!x&&b&&R({...G,giftWrappingId:"",isGiftWrappingSelected:!1})},{eager:!0});return()=>{a==null||a.off()}},[R,l,G,n]);const oe=le(()=>{var Te,be,Fe,we,ve,_e;if(!h&&!e)return null;const a=n?(Te=e==null?void 0:e.productGiftWrapping)==null?void 0:Te.map(q=>{var xe;return{...q,price:e!=null&&e.giftWrappingPrice&&((xe=e==null?void 0:e.giftWrappingPrice)==null?void 0:xe.value)>0?e.giftWrappingPrice:q.price}}):(h==null?void 0:h.cartGiftWrapping)||[],m=a==null?void 0:a.find(q=>q.selected),x=(m==null?void 0:m.uid)??((be=a==null?void 0:a[0])==null?void 0:be.uid),b=!!m,E=n?e.giftMessage:h==null?void 0:h.giftMessage,k=h==null?void 0:h.printedCardIncluded,H=h==null?void 0:h.giftReceiptIncluded,$=ke(e,n),I=(Fe=L.config)==null?void 0:Fe.allowGiftWrappingOnOrder,ze=(we=L.config)==null?void 0:we.allowGiftReceipt,qe=(ve=L.config)==null?void 0:ve.allowPrintedCard,Ke=(_e=h==null?void 0:h.items)==null?void 0:_e.every(q=>q.giftWrappingAvailable),je=e==null?void 0:e.giftWrappingAvailable,Ce=n?!1:!!ze,Ge=n?!1:!!qe,ye=n?!!je&&!!a.length:!!I&&!!a.length&&!!Ke;return p({isGiftReceiptVisible:Ce,isPrintedCartVisible:Ge,isGiftWrappingVisible:ye,isGiftOptionsVisible:!(!Ce&&!Ge&&!ye)}),y($),{...e&&"uid"in e?{itemId:e.uid}:{},...n?{}:{printedCardIncluded:k,giftReceiptIncluded:H},...E,giftWrappingId:x,isGiftWrappingSelected:b,giftWrappingOptions:a}},[h,e,n]);J(()=>{if(!oe)return;const{giftWrappingOptions:a,...m}=oe;fe(m),a!=null&&a.length&&te(a),s(!1)},[oe]);const He=le(()=>Object.entries(G).filter(([a])=>a!=="itemId"&&a!=="giftWrappingId").some(([,a])=>!!a),[G]),Be=le(()=>{var a;return!C&&!!((a=L)!=null&&a.config)&&ut(i,e)},[e,C,i]);return{loading:C,giftOptions:G,showModal:B,errorsField:Ie,updateLoading:V,cartData:h,fieldsDisabled:v,isGiftOptionsApplied:He,giftWrappingConfig:S,setFieldsDisabled:F,handleFormMouseLeave:Le,onInputChange:Ee,updateGiftOptions:ne,setShowModal:z,handleBlur:Ae,isGiftMessageVisible:T,areGiftOptionsVisible:w,isGiftOptionsHidden:Be}},$t=({item:e,view:i="order",readOnlyFormOrderView:l="primary",dataSource:d="cart",isEditable:r=!0,initialLoading:f=!0,slots:g,handleItemsLoading:o,handleItemsError:n,onItemUpdate:c,onGiftOptionsChange:C})=>{const{isGiftMessageVisible:s,areGiftOptionsVisible:w,loading:p,giftOptions:T,showModal:y,errorsField:V,updateLoading:O,cartData:v,isGiftOptionsApplied:F,fieldsDisabled:_,giftWrappingConfig:W,handleFormMouseLeave:N,updateGiftOptions:P,setShowModal:B,onInputChange:z,handleBlur:S,isGiftOptionsHidden:te}=gt({item:e,view:i,dataSource:d,initialLoading:f,handleItemsLoading:o,handleItemsError:n,onItemUpdate:c,onGiftOptionsChange:C});return te?null:t(ft,{item:e,view:i,loading:p,onBlur:S,giftOptions:T,showModal:y,isEditable:r,errorsField:V,setShowModal:B,updateLoading:O,updateGiftOptions:P,cartData:v,isGiftOptionsApplied:F,fieldsDisabled:_,giftWrappingConfig:W,handleFormMouseLeave:N,readOnlyFormOrderView:l,onInputChange:z,isGiftMessageVisible:s,areGiftOptionsVisible:w,imageSwatchImageNode:g!=null&&g.SwatchImage?({imageSwatchContext:h,...re})=>t(Ze,{name:"SwatchImage",slotTag:"span",contentTag:"span",slot:g.SwatchImage,context:{item:e,imageSwatchContext:h,defaultImageProps:re}}):void 0})};export{$t as GiftOptions,$t as default};
|
|
3
|
+
import{jsx as t,jsxs as u,Fragment as A}from"@dropins/tools/preact-jsx-runtime.js";import{classes as We,Slot as Ze}from"@dropins/tools/lib.js";import{Modal as De,ContentGrid as Xe,ImageSwatch as Je,Button as se,Price as ce,Skeleton as Qe,SkeletonRow as Ye,Field as j,Checkbox as ae,Input as Me,TextArea as Ue,Accordion as Ne,AccordionSection as Pe,Icon as D,Card as Ve,ProgressSpinner as et}from"@dropins/tools/components.js";/* empty css */import*as X from"@dropins/tools/preact-compat.js";import{useRef as tt,useEffect as J,useState as M,useId as $e,useCallback as K,useMemo as le}from"@dropins/tools/preact-hooks.js";import{useText as Z}from"@dropins/tools/i18n.js";import{s as L}from"../chunks/resetCart.js";import{S as Re}from"../chunks/ChevronDown.js";import{S as Se}from"../chunks/ChevronUp.js";import{events as rt}from"@dropins/tools/event-bus.js";import{u as it}from"../chunks/updateProductsFromCart.js";import{s as nt}from"../chunks/setGiftOptionsOnCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/persisted-data.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/acdl.js";const te=e=>X.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),X.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),de=e=>X.createElement("svg",{width:20,height:23,viewBox:"0 0 20 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},X.createElement("path",{d:"M10 6L10 21.5M10 6H12.25C13.4926 6 14.5 4.99264 14.5 3.75C14.5 2.50736 13.4926 1.5 12.25 1.5C11.0074 1.5 10 2.50736 10 3.75M10 6V3.75M10 6H7.75C6.50736 6 5.5 4.99264 5.5 3.75C5.5 2.50736 6.50736 1.5 7.75 1.5C8.99264 1.5 10 2.50736 10 3.75M3.25 10.75H16.75C17.9926 10.75 19 9.74264 19 8.5C19 7.25736 17.9926 6.25 16.75 6.25H3.25C2.00736 6.25 1 7.25736 1 8.5C1 9.74264 2.00736 10.75 3.25 10.75ZM4.75 21.5H15.25C16.4926 21.5 17.5 20.4926 17.5 19.25V13.25C17.5 12.0074 16.4926 11 15.25 11H4.75C3.50736 11 2.5 12.0074 2.5 13.25V19.25C2.5 20.4926 3.50736 21.5 4.75 21.5Z",stroke:"currentColor",strokeWidth:1.5}));function ot(e){const i=tt(null);return J(()=>{if(!e||!i.current)return;const l=i.current,d=l.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])');if(d.length===0)return;const r=d[0],f=d[d.length-1];function g(o){o.key==="Tab"&&(o.shiftKey&&document.activeElement===r?(o.preventDefault(),f.focus()):!o.shiftKey&&document.activeElement===f&&(o.preventDefault(),r.focus()))}return l.addEventListener("keydown",g),()=>{l.removeEventListener("keydown",g)}},[e]),i}const at=({view:e,showModal:i,productName:l,giftWrappingConfig:d,imageSwatchImageNode:r,setShowModal:f,updateGiftOptions:g})=>{var w;const o=ot(i),n=Z({modalTitle:"Cart.GiftOptions.modal.title",defaultTitle:"Cart.GiftOptions.modal.defaultTitle",modalWrappingText:"Cart.GiftOptions.modal.wrappingText",modalWrappingSubText:"Cart.GiftOptions.modal.wrappingSubText",modalConfirmButton:"Cart.GiftOptions.modal.modalConfirmButton",modalCancelButton:"Cart.GiftOptions.modal.modalCancelButton",ariaLabelModal:"Cart.GiftOptions.modal.ariaLabelModal",ariaLabelModalOpen:"Cart.GiftOptions.modal.ariaLabelModalOpen",ariaLabelModalClose:"Cart.GiftOptions.modal.ariaLabelModalClose",ariaLabelWrapping:"Cart.GiftOptions.modal.ariaLabelWrapping"}),[c,C]=M();if(J(()=>{const p=d.find(T=>T.selected)??d[0];C(p)},[d]),J(()=>{const p=document==null?void 0:document.querySelector(".cart-gift-options-view__modal-wrapper");p&&(p==null||p.focus())},[]),!i||!d.length)return null;const s=l?`${n.modalTitle} ${l}`:n.defaultTitle;return t("div",{ref:o,className:"cart-gift-options-view__modal-wrapper",tabIndex:0,"aria-label":`${n.ariaLabelModal} ${i?n.ariaLabelModalOpen:n.ariaLabelModalClose} ${l}`,children:u(De,{"data-testid":`gift-option-modal-${e}`,className:"cart-gift-options-view__modal",size:"medium",title:u(A,{children:[t("span",{children:s}),c&&((w=c==null?void 0:c.price)==null?void 0:w.value)>0?t(ce,{amount:c.price.value,currency:c.price.currency,weight:"normal"}):null]}),centered:!0,onClose:f,children:[u("div",{className:"cart-gift-options-view__modal-content",children:[t("span",{className:"cart-gift-options-view__modal-text",children:n.modalWrappingText}),t(Xe,{emptyGridContent:t(A,{}),maxColumns:6,columnWidth:"100px",className:"cart-gift-options-view__modal-grid",children:d.map(p=>t(Je,{groupAriaLabel:n.ariaLabelWrapping,selected:(c==null?void 0:c.uid)===(p==null?void 0:p.uid),onValue:()=>{C(p)},imageNode:r,name:"giftWrappingId",value:p.uid,src:p.image.url,alt:p.design,label:p.design,"data-testid":`gift-option-modal-image-${p.uid}`,className:"cart-gift-options-view__modal-grid-item"},p.uid))}),t("span",{className:"cart-gift-options-view__modal-sub-text",children:c==null?void 0:c.design})]}),t(se,{"data-testid":"gift-option-modal-confirm-button",type:"button",onClick:()=>{g("giftWrappingId",c==null?void 0:c.uid,{isGiftWrappingSelected:!0}),f()},children:n.modalConfirmButton}),t(se,{type:"button",variant:"secondary",onClick:f,"data-testid":"gift-option-modal-cancel-button",children:n.modalCancelButton})]})})},lt=()=>t(Qe,{children:t(Ye,{variant:"row",size:"small",fullWidth:!0,lines:1,multilineGap:"small"})}),st=({className:e,view:i,item:l,giftOptions:d,disabled:r,cartData:f,giftWrappingConfig:g,setShowModal:o,onInputChange:n,areGiftOptionsVisible:c})=>{var N,P,B,z;const C=$e(),s=Z({customize:`Cart.GiftOptions.${i}.customize`,giftReceiptIncludedTitle:`Cart.GiftOptions.${i}.giftReceiptIncluded.title`,giftReceiptIncludedText:`Cart.GiftOptions.${i}.giftReceiptIncluded.subtitle`,printedCardIncludedTitle:`Cart.GiftOptions.${i}.printedCardIncluded.title`,printedCardIncludedText:`Cart.GiftOptions.${i}.printedCardIncluded.subtitle`,giftOptionsWrapTitle:`Cart.GiftOptions.${i}.giftOptionsWrap.title`,giftOptionsWrapText:`Cart.GiftOptions.${i}.giftOptionsWrap.subtitle`,requiredFieldError:"Cart.GiftOptions.formText.requiredFieldError"}),w=l==null?void 0:l.productGiftWrapping,p=f==null?void 0:f.cartGiftWrapping,T=i==="product"?w:p,y=T==null?void 0:T.find(S=>S.uid===d.giftWrappingId),V=(y==null?void 0:y.design)??"",O=l==null?void 0:l.giftWrappingPrice,v=V?`${s.giftOptionsWrapText} ${V}`:"",F=+(((P=(N=L.config)==null?void 0:N.printedCardPrice)==null?void 0:P.value)??0)>0?(B=L.config)==null?void 0:B.printedCardPrice:null;let _=null;O!=null&&O.value?_=O:(z=y==null?void 0:y.price)!=null&&z.value&&(_=y.price);const W=S=>S?u("span",{children:[" (+",t(ce,{amount:S.value,currency:S.currency,weight:"normal"}),")"]}):null;return u("div",{className:We([e,[`${e}--hidden`,!c.isGiftOptionsVisible]]),children:[c.isGiftReceiptVisible?t(j,{disabled:r,className:"cart-gift-options-view__field-gift-receipt",children:t(ae,{id:`giftReceiptIncluded-${C}`,disabled:r,name:"giftReceiptIncluded",checked:d.giftReceiptIncluded,placeholder:s.giftReceiptIncludedTitle,label:s.giftReceiptIncludedTitle,description:s.giftReceiptIncludedText,onChange:n})}):null,c.isPrintedCartVisible?t(j,{disabled:r,className:"cart-gift-options-view__field-printed-card",children:t(ae,{id:`printedCardIncluded-${C}`,disabled:r,name:"printedCardIncluded",checked:d.printedCardIncluded,placeholder:s.printedCardIncludedTitle,label:u(A,{children:[s.printedCardIncludedTitle,W(F)]}),description:s.printedCardIncludedText,onChange:n})}):null,c.isGiftWrappingVisible?u(A,{children:[t(j,{disabled:r,className:"cart-gift-options-view__field-gift-wrap",children:t(ae,{id:`giftOptionsWrap-${C}`,disabled:r,name:"isGiftWrappingSelected",checked:d.isGiftWrappingSelected,placeholder:s.giftOptionsWrapTitle,label:u(A,{children:[s.giftOptionsWrapTitle,W(_)]}),description:v,onChange:n})}),t(se,{disabled:r||!g.length,type:"button","data-testid":`gift-option-customize-${i}`,variant:"tertiary",onClick:()=>o(!0),children:s.customize})]}):null]})},dt=({view:e,giftOptions:i,disabled:l,errorMessage:d,onInputChange:r,onBlur:f,isGiftMessageVisible:g})=>{const o=$e(),n=Z({formTitle:`Cart.GiftOptions.${e}.formContent.formTitle`,formTo:`Cart.GiftOptions.${e}.formContent.formTo`,formFrom:`Cart.GiftOptions.${e}.formContent.formFrom`,giftMessageTitle:`Cart.GiftOptions.${e}.formContent.giftMessageTitle`,formToPlaceholder:`Cart.GiftOptions.${e}.formContent.formToPlaceholder`,formFromPlaceholder:`Cart.GiftOptions.${e}.formContent.formFromPlaceholder`,formMessagePlaceholder:`Cart.GiftOptions.${e}.formContent.formMessagePlaceholder`});return g?u(A,{children:[t("span",{children:n.formTitle}),u("div",{children:[t("span",{children:n.formTo}),t(j,{disabled:l,error:d.recipientName,children:t(Me,{id:`recipientName-${o}`,disabled:l,type:"text",name:"recipientName",value:i.recipientName,placeholder:n.formToPlaceholder,onChange:r,onBlur:f})})]}),u("div",{children:[t("span",{children:n.formFrom}),t(j,{disabled:l,error:d.senderName,children:t(Me,{id:`senderName-${o}`,disabled:l,type:"text",name:"senderName",value:i.senderName,placeholder:n.formFromPlaceholder,onChange:r,onBlur:f})})]}),u("div",{children:[t("span",{children:n.giftMessageTitle}),t(j,{disabled:l,children:t(Ue,{id:`message-${o}`,errorMessage:d.message,disabled:l,name:"message",value:i.message,label:n.formMessagePlaceholder,onChange:r,onBlur:f})})]})]}):null},ct=({view:e,giftOptions:i,giftWrappingConfig:l,readOnlyFormOrderView:d})=>{const r=Z({readOnlyProductTitle:"Cart.GiftOptions.product.readOnlyFormView.title",wrapping:"Cart.GiftOptions.product.readOnlyFormView.wrapping",recipient:"Cart.GiftOptions.product.readOnlyFormView.recipient",sender:"Cart.GiftOptions.product.readOnlyFormView.sender",message:"Cart.GiftOptions.product.readOnlyFormView.message",readOnlyOrderTitle:"Cart.GiftOptions.order.readOnlyFormView.title",readOnlyOrderGiftReceiptTitle:"Cart.GiftOptions.order.readOnlyFormView.giftReceipt",readOnlyOrderGiftReceiptText:"Cart.GiftOptions.order.readOnlyFormView.giftReceiptText",readOnlyOrderGiftPrintCardTitle:"Cart.GiftOptions.order.readOnlyFormView.printCard",readOnlyOrderGiftPrintCardText:"Cart.GiftOptions.order.readOnlyFormView.printCardText",readOnlyOrderGiftWrapTitle:"Cart.GiftOptions.order.readOnlyFormView.giftWrap",readOnlyOrderGiftWrapOptionsText:"Cart.GiftOptions.order.readOnlyFormView.giftWrapOptions",readOnlyOrderFormTitle:"Cart.GiftOptions.order.readOnlyFormView.formTitle",readOnlyOrderFormTo:"Cart.GiftOptions.order.readOnlyFormView.formTo",readOnlyOrderFormFrom:"Cart.GiftOptions.order.readOnlyFormView.formFrom",readOnlyOrderFormMessageTitle:"Cart.GiftOptions.order.readOnlyFormView.formMessageTitle"}),{recipientName:f,senderName:g,message:o,giftReceiptIncluded:n,printedCardIncluded:c,isGiftWrappingSelected:C}=i,s=l==null?void 0:l.find(({uid:O})=>O===(i==null?void 0:i.giftWrappingId)),w=!!f||!!g||!!o,p=s==null?void 0:s.design,T=n||c||(s==null?void 0:s.selected),y=[{id:1,title:r.wrapping,message:C?p:""},{id:2,title:r.recipient,message:f},{id:3,title:r.sender,message:g},{id:4,title:r.message,message:o}],V=y.every(({message:O})=>!O);if(e==="product"&&!V)return t(Ne,{"data-testid":"gift-options-product",iconClose:Se,iconOpen:Re,actionIconPosition:"right",children:t(Pe,{title:r.readOnlyProductTitle,showIconLeft:!0,iconLeft:de,defaultOpen:!1,renderContentWhenClosed:!1,children:t("div",{children:y.filter(O=>O.message).map(O=>u("p",{children:[O.title," ",O.message]},O.id))})})});if(e==="order"&&(w||T)){const O=u("div",{className:"cart-gift-options-readonly__header",children:[t(D,{source:de,size:"24"}),t("span",{children:r.readOnlyOrderTitle})]}),v=u(A,{children:[n?u("div",{className:"cart-gift-options-readonly__checkboxes cart-gift-options-readonly__checkboxes--gift-receipt",children:[t(D,{source:te,size:"16"}),t("p",{children:r.readOnlyOrderGiftReceiptTitle}),t("p",{children:r.readOnlyOrderGiftReceiptText})]}):null,c?u("div",{className:"cart-gift-options-readonly__checkboxes cart-gift-options-readonly__checkboxes--print-card",children:[t(D,{source:te,size:"16"}),t("p",{children:r.readOnlyOrderGiftPrintCardTitle}),t("p",{children:r.readOnlyOrderGiftPrintCardText})]}):null,s!=null&&s.selected?u("div",{className:"cart-gift-options-readonly__checkboxes cart-gift-options-readonly__checkboxes--gift-wrap",children:[t(D,{source:te,size:"16"}),u("p",{children:[r.readOnlyOrderGiftWrapTitle," (+",t(ce,{amount:s.price.value,currency:s.price.currency,weight:"normal"}),")"]}),t("p",{children:`${r.readOnlyOrderGiftWrapOptionsText} ${s==null?void 0:s.design}`})]}):null]}),F=w?u("div",{className:"cart-gift-options-readonly__form",children:[t("div",{children:r.readOnlyOrderFormTitle}),u("div",{children:[u("p",{children:[t("span",{children:r.readOnlyOrderFormTo}),t("span",{children:f})]}),u("p",{children:[t("span",{children:r.readOnlyOrderFormFrom}),t("span",{children:g})]})]}),u("div",{children:[t("p",{children:r.readOnlyOrderFormMessageTitle}),t("p",{children:o})]})]}):null;return u(Ve,{variant:d,children:[O,v,F]})}return null},ft=({item:e,view:i,loading:l,giftOptions:d,showModal:r,isEditable:f,errorsField:g,updateLoading:o,cartData:n,fieldsDisabled:c,isGiftOptionsApplied:C,giftWrappingConfig:s,readOnlyFormOrderView:w,isGiftMessageVisible:p,areGiftOptionsVisible:T,imageSwatchImageNode:y,onBlur:V,setShowModal:O,updateGiftOptions:v,onInputChange:F,handleFormMouseLeave:_})=>{const W=Z({accordionHeading:`Cart.GiftOptions.${i}.accordionHeading`}),N=K(P=>t(Ne,{"data-testid":"gift-options-product",iconClose:Se,iconOpen:Re,actionIconPosition:"right",children:t(Pe,{title:u("div",{className:"cart-gift-options-view__icon--success",children:[t("span",{children:W.accordionHeading}),C?t(D,{source:te,size:"16"}):null]}),ariaLabelTitle:W.accordionHeading,showIconLeft:!0,iconLeft:de,defaultOpen:C||P,renderContentWhenClosed:!1,children:u(A,{children:[t(st,{className:"cart-gift-options-view__top",view:i,item:e,giftOptions:d,disabled:c,onInputChange:F,cartData:n,giftWrappingConfig:s,setShowModal:O,areGiftOptionsVisible:T}),t("form",{className:"cart-gift-options-view__footer",onMouseLeave:_,children:t(dt,{view:i,giftOptions:d,disabled:c,errorMessage:g,onInputChange:F,onBlur:V,isGiftMessageVisible:p})})]})})}),[i,e,n,W,g,d,c,s,T,C,p,V,O,F,_]);return!T.isGiftOptionsVisible&&!p?null:u("div",{id:"cart-gift-options-view",className:We(["cart-gift-options-view",`cart-gift-options-view--${i}`,["cart-gift-options-view--loading",o]]),children:[o?t(et,{className:"cart-gift-options-view__spinner"}):null,l?t(lt,{}):u(A,{children:[f?null:t("div",{className:"cart-gift-options-view--readonly",children:t(ct,{view:i,giftOptions:d,giftWrappingConfig:s,readOnlyFormOrderView:w})}),r?t(at,{view:i,productName:e&&"name"in e?e==null?void 0:e.name:"",showModal:r,giftWrappingConfig:s,setShowModal:()=>O(!1),updateGiftOptions:v,imageSwatchImageNode:y}):null,i==="product"&&f?N(!1):null,i==="order"&&f?t(Ve,{variant:"secondary",children:N(!0)}):null]})]})},ee={recipientName:"",senderName:"",message:""},pt={giftReceiptIncluded:!1,printedCardIncluded:!1,isGiftWrappingSelected:!1},ke=(e,i)=>{var d,r;if(!i)return!!((d=L.config)!=null&&d.allowGiftMessageOnOrder);const l=((r=L.config)==null?void 0:r.allowGiftMessageOnOrderItems)??!1;return typeof(e==null?void 0:e.giftMessageAvailable)=="boolean"?e==null?void 0:e.giftMessageAvailable:l},ut=(e,i)=>{const{allowGiftWrappingOnOrder:l,allowGiftWrappingOnOrderItems:d,allowGiftMessageOnOrder:r,allowGiftMessageOnOrderItems:f,allowGiftReceipt:g,allowPrintedCard:o}=L.config||{},n=!f&&!d&&!ke(i,!0),c=!l&&!r&&!g&&!o;return!!(e==="product"&&n||e==="order"&&c)},gt=({item:e,view:i,dataSource:l,initialLoading:d,handleItemsLoading:r,handleItemsError:f,onItemUpdate:g,onGiftOptionsChange:o})=>{var pe,ue,ge,me,Oe,he;const n=i==="product",c=Z({requiredFieldError:"Cart.GiftOptions.formText.requiredFieldError"}),[C,s]=M(()=>d),[w,p]=M({isGiftReceiptVisible:!0,isPrintedCartVisible:!0,isGiftWrappingVisible:!0,isGiftOptionsVisible:!0}),[T,y]=M(!0),[V,O]=M(!1),[v,F]=M(!1),[_,W]=M(!1),[N,P]=M(!1),[B,z]=M(!1),[S,re]=M([]),[h,Q]=M(null),[Ie,ie]=M(ee),[G,fe]=M(()=>({giftWrappingId:"",...ee,...pt})),Y=((pe=G.recipientName)==null?void 0:pe.trim())&&((ue=G.senderName)==null?void 0:ue.trim())&&((ge=G.message)==null?void 0:ge.trim()),U=!((me=G.recipientName)!=null&&me.trim())&&!((Oe=G.senderName)!=null&&Oe.trim())&&!((he=G.message)!=null&&he.trim()),R=K(async a=>{switch(O(i==="order"),F(!0),i){case"product":{"uid"in e&&(r==null||r(e.uid,!0),f==null||f(e.uid));const{recipientName:m,senderName:x,message:b,giftWrappingId:E,isGiftWrappingSelected:k}=a,H={gift_message:{to:m??"",from:x??"",message:b??""},gift_wrapping_id:k?E:null};"uid"in e&&"quantity"in e&&await it([{uid:e.uid,quantity:e.quantity,giftOptions:H}]).then(()=>{g==null||g({item:e})}).finally(()=>{r==null||r(e.uid,!1),F(!1),W(!1),O(!1)}).catch($=>{console.warn($)})}break;case"order":await nt(a).finally(()=>{F(!1),W(!1),O(!1)});break;default:console.error('Incorrect "view" prop value provided for GiftOptions container (storefront-cart)');break}},[f,r,e,g,i]),ne=K((a,m,x={})=>{fe(b=>{const E=I=>I in b,k=I=>E(I)?b[I]:void 0;if(!(k(a)!==m||Object.keys(x).some(I=>k(I)!==x[I])))return o==null||o(b),b;const $={...b,[a]:m,...x};return!$.recipientName&&!$.senderName&&!$.message&&P(!0),(typeof m=="boolean"||["giftWrappingId","giftReceiptIncluded","printedCardIncluded"].includes(a))&&(P(!1),typeof o=="function"?o($):R($)),W(!0),o==null||o($),$})},[R,o]),Le=K(async()=>{v||typeof o!="function"&&(U&&N&&(ie(ee),P(!1),await R(G)),_&&Y&&(P(!0),await R(G)))},[R,G,_,U,N,v,o,Y]),Ae=K(async a=>{if(v||typeof o=="function")return;const{name:m,value:x}=a.target;ie(b=>({...b,[m]:x.trim()?"":c.requiredFieldError})),U&&N&&(ie(ee),P(!1),await R(G)),_&&Y&&await R(G)},[v,U,N,_,Y,c,R,G,o]),Ee=K(a=>{const m=a.target,x=m.name,b=m.type==="checkbox"?m.checked:m.value;ne(x,b)},[ne]);J(()=>{if(n)return;const a=rt.on(l==="cart"?"cart/data":"order/data",m=>{var E,k;Q(m);const x=(E=m==null?void 0:m.items)==null?void 0:E.some(({giftWrappingAvailable:H})=>H),b=(k=m==null?void 0:m.cartGiftWrapping)==null?void 0:k.some(H=>H.selected);!x&&b&&R({...G,giftWrappingId:"",isGiftWrappingSelected:!1})},{eager:!0});return()=>{a==null||a.off()}},[Q,R,l,G,n]);const oe=le(()=>{var Te,be,Fe,we,ve,_e;if(!h&&!e)return null;const a=n?(Te=e==null?void 0:e.productGiftWrapping)==null?void 0:Te.map(q=>{var xe;return{...q,price:e!=null&&e.giftWrappingPrice&&((xe=e==null?void 0:e.giftWrappingPrice)==null?void 0:xe.value)>0?e.giftWrappingPrice:q.price}}):(h==null?void 0:h.cartGiftWrapping)||[],m=a==null?void 0:a.find(q=>q.selected),x=(m==null?void 0:m.uid)??((be=a==null?void 0:a[0])==null?void 0:be.uid),b=!!m,E=n?e.giftMessage:h==null?void 0:h.giftMessage,k=h==null?void 0:h.printedCardIncluded,H=h==null?void 0:h.giftReceiptIncluded,$=ke(e,n),I=(Fe=L.config)==null?void 0:Fe.allowGiftWrappingOnOrder,ze=(we=L.config)==null?void 0:we.allowGiftReceipt,qe=(ve=L.config)==null?void 0:ve.allowPrintedCard,Ke=(_e=h==null?void 0:h.items)==null?void 0:_e.some(q=>q.giftWrappingAvailable),je=e==null?void 0:e.giftWrappingAvailable,Ce=n?!1:!!ze,Ge=n?!1:!!qe,ye=n?!!je&&!!a.length:!!I&&!!a.length&&!!Ke;return p({isGiftReceiptVisible:Ce,isPrintedCartVisible:Ge,isGiftWrappingVisible:ye,isGiftOptionsVisible:!(!Ce&&!Ge&&!ye)}),y($),{...e&&"uid"in e?{itemId:e.uid}:{},...n?{}:{printedCardIncluded:k,giftReceiptIncluded:H},...E,giftWrappingId:x,isGiftWrappingSelected:b,giftWrappingOptions:a}},[h,e,n]);J(()=>{if(!oe)return;const{giftWrappingOptions:a,...m}=oe;fe(m),a!=null&&a.length&&re(a),s(!1)},[oe]);const He=le(()=>Object.entries(G).filter(([a])=>a!=="itemId"&&a!=="giftWrappingId").some(([,a])=>!!a),[G]),Be=le(()=>{var a;return!C&&!!((a=L)!=null&&a.config)&&ut(i,e)},[e,C,i]);return{loading:C,giftOptions:G,showModal:B,errorsField:Ie,updateLoading:V,cartData:h,fieldsDisabled:v,isGiftOptionsApplied:He,giftWrappingConfig:S,setFieldsDisabled:F,handleFormMouseLeave:Le,onInputChange:Ee,updateGiftOptions:ne,setShowModal:z,handleBlur:Ae,isGiftMessageVisible:T,areGiftOptionsVisible:w,isGiftOptionsHidden:Be}},$t=({item:e,view:i="order",readOnlyFormOrderView:l="primary",dataSource:d="cart",isEditable:r=!0,initialLoading:f=!0,slots:g,handleItemsLoading:o,handleItemsError:n,onItemUpdate:c,onGiftOptionsChange:C})=>{const{isGiftMessageVisible:s,areGiftOptionsVisible:w,loading:p,giftOptions:T,showModal:y,errorsField:V,updateLoading:O,cartData:v,isGiftOptionsApplied:F,fieldsDisabled:_,giftWrappingConfig:W,handleFormMouseLeave:N,updateGiftOptions:P,setShowModal:B,onInputChange:z,handleBlur:S,isGiftOptionsHidden:re}=gt({item:e,view:i,dataSource:d,initialLoading:f,handleItemsLoading:o,handleItemsError:n,onItemUpdate:c,onGiftOptionsChange:C});return re?null:t(ft,{item:e,view:i,loading:p,onBlur:S,giftOptions:T,showModal:y,isEditable:r,errorsField:V,setShowModal:B,updateLoading:O,updateGiftOptions:P,cartData:v,isGiftOptionsApplied:F,fieldsDisabled:_,giftWrappingConfig:W,handleFormMouseLeave:N,readOnlyFormOrderView:l,onInputChange:z,isGiftMessageVisible:s,areGiftOptionsVisible:w,imageSwatchImageNode:g!=null&&g.SwatchImage?({imageSwatchContext:h,...Q})=>t(Ze,{name:"SwatchImage",slotTag:"span",contentTag:"span",slot:g.SwatchImage,context:{item:e,imageSwatchContext:h,defaultImageProps:Q}}):void 0})};export{$t as GiftOptions,$t as default};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'preact/compat';
|
|
2
|
-
import { Container, SlotProps } from '
|
|
2
|
+
import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
3
3
|
import { CartModel } from '../../data/models';
|
|
4
|
-
import { ImageProps } from '
|
|
4
|
+
import { ImageProps } from '@dropins/tools/types/elsie/src/components';
|
|
5
5
|
|
|
6
6
|
export interface MiniCartProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
7
|
routeProduct?: (item: CartModel['items'][0]) => string;
|
package/containers/MiniCart.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as i,jsxs as
|
|
3
|
+
import{jsx as i,jsxs as m,Fragment as R}from"@dropins/tools/preact-jsx-runtime.js";import{useState as j,useEffect as w,useCallback as O}from"@dropins/tools/preact-compat.js";import{classes as h,VComponent as u,Slot as y}from"@dropins/tools/lib.js";import{g as B}from"../chunks/persisted-data.js";import{events as V}from"@dropins/tools/event-bus.js";import{Button as L,Price as N}from"@dropins/tools/components.js";/* empty css */import{useText as D}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-hooks.js";import{s as b}from"../chunks/resetCart.js";import{p as $}from"../chunks/acdl.js";import{u as q}from"../chunks/updateProductsFromCart.js";import"../chunks/CartSummaryGrid.js";import{C as z}from"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"../chunks/CartSummaryTable2.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/EmptyCart.js";import"../chunks/WarningWithCircle.js";import"../chunks/ChevronDown.js";import"../chunks/getEstimatedTotals.js";import"../chunks/OrderSummaryLine.js";import"../chunks/ChevronUp.js";import"../chunks/Coupon.js";import"../chunks/GiftCard.js";const J=({className:_,products:s,productListFooter:l,subtotal:e,subtotalExcludingTaxes:d,preCheckoutSection:n,ctas:o,...x})=>{const p=D({subtotal:"Cart.MiniCart.subtotal",subtotalExcludingTaxes:"Cart.MiniCart.subtotalExcludingTaxes"});return i("div",{...x,className:h(["cart-mini-cart",_]),children:s&&m(R,{children:[i("div",{className:"cart-mini-cart__products","data-testid":"mini-cart-products-wrapper",children:s}),l&&i("div",{className:h(["cart-mini-cart__productListFooter"]),"data-testid":"mini-cart-product-list-footer",children:i(u,{node:l})}),m("div",{className:"cart-mini-cart__footer","data-testid":"mini-cart-subtotals",children:[e&&m("div",{className:"cart-mini-cart__footer__estimated-total","data-testid":"mini-cart-subtotal",children:[p.subtotal,i(u,{node:e})]}),d&&m("div",{className:"cart-mini-cart__footer__estimated-total-excluding-taxes","data-testid":"mini-cart-subtotal-excluding-taxes",children:[p.subtotalExcludingTaxes,i(u,{node:d,className:h(["dropin-price-summary__price","dropin-price-summary__price--muted"])})]}),n&&i("div",{className:h(["cart-mini-cart__preCheckoutSection"]),"data-testid":"mini-cart-pre-checkout-section",children:i(u,{node:n})}),o&&i(u,{node:o,className:"cart-mini-cart__footer__ctas"})]})]})})},K=({children:_,initialData:s=null,hideFooter:l=!0,slots:e,routeProduct:d,routeCart:n,routeCheckout:o,routeEmptyCartCTA:x,showDiscount:p,showSavings:P,enableItemRemoval:S=!0,enableQuantityUpdate:T=!1,hideHeading:M=!1,...Q})=>{var v,k,I;const[t,U]=j(s),a=(v=b.config)==null?void 0:v.shoppingCartDisplaySetting;w(()=>{const r=V.on("cart/data",f=>{U(f)},{eager:!0});return()=>{r==null||r.off()}},[]);const g=D({cartLink:"Cart.MiniCart.cartLink",checkoutLink:"Cart.MiniCart.checkoutLink"}),C=(r,f)=>q([{uid:r,quantity:f}]),E=r=>C(r,0),c=t==null?void 0:t.hasOutOfStockItems,F=O(()=>{t&&!c&&$(t,b.locale)},[t,c]),G=i(y,{name:"ProductList",slot:e==null?void 0:e.ProductList,context:{itemQuantityUpdateHandler:C,itemRemoveHandler:E,totalQuantity:t==null?void 0:t.totalQuantity},children:i(z,{"data-testid":"default-cart-summary-list",routeProduct:d,routeEmptyCartCTA:x,initialData:t,maxItems:(k=b.config)==null?void 0:k.miniCartMaxItemsDisplay,showMaxItems:!!((I=b.config)!=null&&I.miniCartMaxItemsDisplay),hideHeading:M||!(t!=null&&t.totalQuantity),hideFooter:l,enableRemoveItem:S,enableUpdateItemQuantity:T,showDiscount:p,showSavings:P,slots:{Thumbnail:e==null?void 0:e.Thumbnail}})}),X=r=>i(y,{name:"ProductListFooter",slot:e==null?void 0:e.ProductListFooter,context:{data:r}}),A=r=>i(y,{name:"PreCheckoutSection",slot:e==null?void 0:e.PreCheckoutSection,context:{data:r}}),H=()=>(a==null?void 0:a.subtotal)==="INCLUDING_TAX"||(a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?{amount:t==null?void 0:t.subtotal.includingTax.value,currency:t==null?void 0:t.subtotal.includingTax.currency,"data-testid":"subtotal-including-tax",style:{font:"inherit"}}:{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-excluding-tax",style:{font:"inherit"}};return i(J,{...Q,productListFooter:X(t),subtotal:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&i(N,{...H()}):void 0,subtotalExcludingTaxes:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&((a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?i(N,{amount:t==null?void 0:t.subtotal.excludingTax.value,currency:t==null?void 0:t.subtotal.excludingTax.currency,"data-testid":"subtotal-including-excluding-tax",style:{font:"inherit"}}):void 0):void 0,preCheckoutSection:A(t),ctas:t!=null&&t.totalQuantity?m("div",{children:[o&&i(L,{"data-testid":"route-checkout-button",variant:"primary",href:c?void 0:o(),disabled:c,"aria-disabled":c,onClick:F,children:g.checkoutLink}),n&&i(L,{"data-testid":"route-cart-button",variant:"tertiary",href:n(),children:g.cartLink})]}):void 0,products:G})};K.getInitialData=async function(){return B()};export{K as MiniCart,K as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'preact/compat';
|
|
2
|
-
import { Container, SlotProps } from '
|
|
2
|
+
import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
3
3
|
import { CartModel } from '../../data/models';
|
|
4
4
|
import { OrderSummaryLineItem } from '../../components';
|
|
5
5
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{O as k,O as n}from"../chunks/OrderSummary.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getEstimatedTotals.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/acdl.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";/* empty css
|
|
3
|
+
import{O as k,O as n}from"../chunks/OrderSummary.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/persisted-data.js";import"../chunks/resetCart.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getEstimatedTotals.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/acdl.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";/* empty css */import"../chunks/OrderSummaryLine.js";import"../chunks/ChevronUp.js";import"../chunks/ChevronDown.js";import"@dropins/tools/i18n.js";import"../chunks/Coupon.js";import"../chunks/GiftCard.js";export{k as OrderSummary,n as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'preact/compat';
|
|
2
|
-
import { Container } from '
|
|
2
|
+
import { Container } from '@dropins/tools/types/elsie/src/lib';
|
|
3
3
|
import { VNode } from 'preact';
|
|
4
4
|
|
|
5
5
|
export interface OrderSummaryLineProps extends Omit<HTMLAttributes<HTMLDivElement>, 'label'> {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{O,O as d}from"../chunks/OrderSummaryLine.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css
|
|
3
|
+
import{O,O as d}from"../chunks/OrderSummaryLine.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import"@dropins/tools/components.js";/* empty css */import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact-hooks.js";export{O as OrderSummaryLine,d as default};
|
package/containers/index.d.ts
CHANGED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { CartModel } from '../data/models';
|
|
2
|
+
import { useText } from '@dropins/tools/types/elsie/src/i18n';
|
|
3
|
+
import { PriceProps } from '@dropins/tools/types/elsie/src/components/Price';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Params for the useCartItems hook
|
|
7
|
+
*
|
|
8
|
+
* @param {
|
|
9
|
+
* dictionary: ReturnType<typeof useText>;
|
|
10
|
+
* onQuantityUpdate?: (item: CartModel['items'][number], quantity: number) => void;
|
|
11
|
+
* onItemRemove?: (item: CartModel['items'][number]) => void;
|
|
12
|
+
* }
|
|
13
|
+
*
|
|
14
|
+
* dictionary - The dictionary
|
|
15
|
+
* onQuantityUpdate - The function to call when the quantity is updated
|
|
16
|
+
* onItemRemove - The function to call when the item is removed
|
|
17
|
+
*/
|
|
18
|
+
export interface useCartItemsProps {
|
|
19
|
+
dictionary: ReturnType<typeof useText>;
|
|
20
|
+
onQuantityUpdate?: (item: CartModel['items'][number], quantity: number) => void;
|
|
21
|
+
onItemRemove?: (item: CartModel['items'][number]) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Params for the getConfiguration function
|
|
25
|
+
*/
|
|
26
|
+
interface GetConfigurationParams {
|
|
27
|
+
item: CartModel['items'][number];
|
|
28
|
+
}
|
|
29
|
+
interface ItemUpdateState {
|
|
30
|
+
isUpdating: boolean;
|
|
31
|
+
updatedValue: any;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Type for the API returned by useCartItems
|
|
35
|
+
*
|
|
36
|
+
* This interface ensures that the returned object from the hook is well-typed and clear for consumers.
|
|
37
|
+
*/
|
|
38
|
+
export interface UseCartItemsApi {
|
|
39
|
+
showIncludedTaxPrice: boolean;
|
|
40
|
+
showExcludingTaxPrice: boolean;
|
|
41
|
+
itemsUpdating: Map<string, ItemUpdateState>;
|
|
42
|
+
itemUpdateErrors: Map<string, string>;
|
|
43
|
+
getConfiguration: (params: GetConfigurationParams) => object | undefined;
|
|
44
|
+
getPriceProps: (item: CartModel['items'][number]) => PriceProps;
|
|
45
|
+
getSubtotalProps: (item: CartModel['items'][number]) => {
|
|
46
|
+
subtotalProps: PriceProps;
|
|
47
|
+
subtotalDiscountProps: PriceProps | null;
|
|
48
|
+
};
|
|
49
|
+
processQuantityChange: (item: CartModel['items'][number], value: number) => Promise<void>;
|
|
50
|
+
debouncedQuantityChange: (item: CartModel['items'][number], value: number) => void;
|
|
51
|
+
setItemsUpdating: (itemsUpdating: Map<string, ItemUpdateState>) => void;
|
|
52
|
+
getWarningMessage: (item: CartModel['items'][number]) => string | undefined;
|
|
53
|
+
setItemUpdateError: (uid: string, error: string) => void;
|
|
54
|
+
handleRemoveItem: (item: CartModel['items'][number]) => Promise<CartModel | null>;
|
|
55
|
+
setItemUpdating: (uid: string, state: boolean) => void;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* useCartItems hook
|
|
59
|
+
*
|
|
60
|
+
* Provides an API for managing and retrieving calculated cart items data, including price, subtotal, configuration, quantity updates, and error handling.
|
|
61
|
+
*
|
|
62
|
+
* @param {Object} params
|
|
63
|
+
* @param {ReturnType<typeof useText>} params.dictionary - The i18n dictionary
|
|
64
|
+
* @param {(item: CartModel['items'][number], quantity: number) => void} [params.onQuantityUpdate] - Callback when item quantity is updated
|
|
65
|
+
* @param {(item: CartModel['items'][number]) => void} [params.onItemRemove] - Callback when item is removed
|
|
66
|
+
*
|
|
67
|
+
* @returns {Object} API for cart item management:
|
|
68
|
+
* - showIncludedTaxPrice: boolean
|
|
69
|
+
* - showExcludingTaxPrice: boolean
|
|
70
|
+
* - itemsUpdating: Map<string, ItemUpdateState>
|
|
71
|
+
* - itemUpdateErrors: Map<string, string>
|
|
72
|
+
* - getConfiguration(item): object | undefined
|
|
73
|
+
* - getPriceProps(item): PriceProps
|
|
74
|
+
* - getSubtotalProps(item): { subtotalProps: PriceProps, subtotalDiscountProps: PriceProps | null }
|
|
75
|
+
* - processQuantityChange(item, value): Promise<void>
|
|
76
|
+
* - debouncedQuantityChange(item, value): void
|
|
77
|
+
* - setItemsUpdating(map): void
|
|
78
|
+
* - getWarningMessage(item): string | undefined
|
|
79
|
+
* - setItemUpdateError(uid, error): void
|
|
80
|
+
* - handleRemoveItem(item): Promise<CartModel>
|
|
81
|
+
* - setItemUpdating(uid, state): void
|
|
82
|
+
*/
|
|
83
|
+
export declare const useCartItems: ({ dictionary, onQuantityUpdate, onItemRemove }: useCartItemsProps) => UseCartItemsApi;
|
|
84
|
+
export {};
|
|
85
|
+
//# sourceMappingURL=useCartItems.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CartModel, Item } from '../data/models';
|
|
2
2
|
import { GiftOptionsDataSourcesProps, GiftOptionsViewProps, GiftWrappingConfigProps, GiftFormDataType, ProductGiftOptionsConfig } from '../types';
|
|
3
3
|
|
|
4
|
-
interface UseGiftOptionsProps {
|
|
4
|
+
export interface UseGiftOptionsProps {
|
|
5
5
|
item: Item | ProductGiftOptionsConfig;
|
|
6
6
|
view: GiftOptionsViewProps;
|
|
7
7
|
dataSource: GiftOptionsDataSourcesProps;
|
|
@@ -42,5 +42,4 @@ export declare const useGiftOptions: ({ item, view, dataSource, initialLoading,
|
|
|
42
42
|
};
|
|
43
43
|
isGiftOptionsHidden: boolean;
|
|
44
44
|
};
|
|
45
|
-
export {};
|
|
46
45
|
//# sourceMappingURL=useGiftOptions.d.ts.map
|
package/i18n/en_US.json.d.ts
CHANGED
|
@@ -6,6 +6,15 @@ declare const _default: {
|
|
|
6
6
|
"viewAll": "View all in cart",
|
|
7
7
|
"viewMore": "View more"
|
|
8
8
|
},
|
|
9
|
+
"CartSummaryTable": {
|
|
10
|
+
"item": "Item",
|
|
11
|
+
"price": "Price",
|
|
12
|
+
"qty": "Qty",
|
|
13
|
+
"subtotal": "Subtotal",
|
|
14
|
+
"mobilePrice": "Price",
|
|
15
|
+
"mobileQty": "Qty",
|
|
16
|
+
"mobileSubtotal": "Subtotal"
|
|
17
|
+
},
|
|
9
18
|
"MiniCart": {
|
|
10
19
|
"heading": "Shopping Cart ({count})",
|
|
11
20
|
"subtotal": "Subtotal",
|
|
@@ -123,7 +132,9 @@ declare const _default: {
|
|
|
123
132
|
"insufficientQuantityGeneral": "Not enough items for sale",
|
|
124
133
|
"notAvailableMessage": "Requested qty. not available",
|
|
125
134
|
"discountPercentage": "{discount}% off",
|
|
126
|
-
"savingsAmount": "Savings"
|
|
135
|
+
"savingsAmount": "Savings",
|
|
136
|
+
"includingTax": "Incl. tax",
|
|
137
|
+
"excludingTax": "Excl. tax"
|
|
127
138
|
},
|
|
128
139
|
"EstimateShipping": {
|
|
129
140
|
"label": "Shipping",
|
|
@@ -181,8 +192,8 @@ declare const _default: {
|
|
|
181
192
|
"formTo": "To",
|
|
182
193
|
"formFrom": "From",
|
|
183
194
|
"giftMessageTitle": "Gift message",
|
|
184
|
-
"formToPlaceholder": "Recipient
|
|
185
|
-
"formFromPlaceholder": "Sender
|
|
195
|
+
"formToPlaceholder": "Recipient's name",
|
|
196
|
+
"formFromPlaceholder": "Sender's name",
|
|
186
197
|
"formMessagePlaceholder": "Gift message"
|
|
187
198
|
},
|
|
188
199
|
"readOnlyFormView": {
|
|
@@ -219,8 +230,8 @@ declare const _default: {
|
|
|
219
230
|
"formTo": "To",
|
|
220
231
|
"formFrom": "From",
|
|
221
232
|
"giftMessageTitle": "Gift message",
|
|
222
|
-
"formToPlaceholder": "Recipient
|
|
223
|
-
"formFromPlaceholder": "Sender
|
|
233
|
+
"formToPlaceholder": "Recipient's name",
|
|
234
|
+
"formFromPlaceholder": "Sender's name",
|
|
224
235
|
"formMessagePlaceholder": "Gift message"
|
|
225
236
|
},
|
|
226
237
|
"readOnlyFormView": {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/storefront-cart", "version": "1.
|
|
1
|
+
{"name": "@dropins/storefront-cart", "version": "1.4.0-alpha1", "@dropins/tools": "~1.2.1", "license": "SEE LICENSE IN LICENSE.md"}
|
package/render/render.d.ts
CHANGED