@dropins/storefront-cart 1.1.0 → 1.2.0-beta1
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/applyGiftCardToCart/applyGiftCardToCart.d.ts +4 -0
- package/api/applyGiftCardToCart/graphql/ApplyGiftCardToCartMutation.d.ts +18 -0
- package/api/applyGiftCardToCart/index.d.ts +18 -0
- package/api/fragments.d.ts +1 -0
- package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +1 -1
- package/api/graphql/GiftFragment.d.ts +5 -0
- package/api/index.d.ts +3 -0
- package/api/removeGiftCardFromCart/graphql/RemoveGiftCardFromCartMutation.d.ts +18 -0
- package/api/removeGiftCardFromCart/index.d.ts +18 -0
- package/api/removeGiftCardFromCart/removeGiftCardFromCart.d.ts +4 -0
- package/api/setGiftOptionsOnCart/graphql/UpdateGiftOptionsMutation.d.ts +18 -0
- package/api/setGiftOptionsOnCart/index.d.ts +18 -0
- package/api/setGiftOptionsOnCart/setGiftOptionsOnCart.d.ts +5 -0
- package/api/updateProductsFromCart/updateProductsFromCart.d.ts +8 -0
- package/api.js +3 -3
- package/chunks/CartSummaryGrid.js +1 -1
- package/chunks/CartSummaryList.js +1 -1
- package/chunks/ChevronUp.js +3 -0
- package/chunks/Coupons.js +3 -0
- package/chunks/EmptyCart.js +1 -1
- package/chunks/GiftCard.js +3 -0
- package/chunks/OrderSummary.js +1 -1
- package/chunks/OrderSummaryLine.js +1 -1
- package/chunks/refreshCart.js +28 -16
- package/chunks/removeGiftCardFromCart.js +31 -0
- package/chunks/setGiftOptionsOnCart.js +20 -0
- package/chunks/updateProductsFromCart.js +4 -4
- package/components/Coupons/Coupons.d.ts +2 -0
- package/components/GiftOptions/Elements/CheckboxGroup.d.ts +20 -0
- package/components/GiftOptions/Elements/FormFields.d.ts +15 -0
- package/components/GiftOptions/Elements/GiftLoader.d.ts +4 -0
- package/components/GiftOptions/Elements/GiftOptionModal.d.ts +14 -0
- package/components/GiftOptions/Elements/ReadOnlyFormView.d.ts +11 -0
- package/components/GiftOptions/Elements/index.d.ts +5 -0
- package/components/GiftOptions/GiftOptions.d.ts +29 -0
- package/components/GiftOptions/index.d.ts +19 -0
- package/components/OrderSummary/OrderSummary.d.ts +27 -0
- package/components/OrderSummaryLine/OrderSummaryLine.d.ts +2 -2
- package/components/index.d.ts +1 -0
- package/containers/CartSummaryGrid.js +1 -1
- package/containers/CartSummaryList.js +1 -1
- package/containers/Coupons.js +1 -1
- package/containers/EmptyCart.js +1 -1
- package/containers/EstimateShipping.js +1 -1
- package/containers/GiftCards/GiftCards.d.ts +7 -0
- package/containers/GiftCards/index.d.ts +19 -0
- package/containers/GiftCards.d.ts +3 -0
- package/containers/GiftCards.js +3 -0
- package/containers/GiftOptions/GiftOptions.d.ts +20 -0
- package/containers/GiftOptions/index.d.ts +19 -0
- package/containers/GiftOptions.d.ts +3 -0
- package/containers/GiftOptions.js +3 -0
- package/containers/MiniCart.js +1 -1
- package/containers/OrderSummary/OrderSummary.d.ts +2 -0
- package/containers/OrderSummary.js +1 -1
- package/containers/OrderSummaryLine/OrderSummaryLine.d.ts +2 -2
- package/containers/OrderSummaryLine.js +1 -1
- package/containers/index.d.ts +2 -0
- package/data/models/cart-model.d.ts +51 -0
- package/data/models/gift-card-account.d.ts +8 -0
- package/data/models/index.d.ts +1 -0
- package/data/models/store-models.d.ts +11 -16
- package/data/transforms/__fixtures__/cartModel.d.ts +14 -0
- package/data/transforms/__fixtures__/productTypesData.d.ts +15 -0
- package/data/transforms/index.d.ts +1 -0
- package/data/transforms/transform-gift-card-account.d.ts +4 -0
- package/fragments.js +130 -5
- package/hooks/index.d.ts +1 -0
- package/hooks/useGiftOptions.d.ts +46 -0
- package/i18n/en_US.json.d.ts +117 -1
- package/lib/giftOptionsHelper.d.ts +18 -0
- package/package.json +1 -1
- package/render.js +2 -2
- package/types/giftOptions.types.d.ts +35 -0
- package/types/index.d.ts +2 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './GiftOptions';
|
|
18
|
+
export { GiftOptions as default } from './GiftOptions';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsxs as f,Fragment as B,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{classes as xe}from"@dropins/tools/lib.js";import{Modal as Ze,Price as le,ContentGrid as Xe,ImageSwatch as Je,Button as oe,Skeleton as Qe,SkeletonRow as Ye,Field as Z,Checkbox as ie,Input as ve,TextArea as Ue,Accordion as Pe,AccordionSection as Ne,Icon as J,Card as We,ProgressSpinner as De}from"@dropins/tools/components.js";/* empty css */import*as Q from"@dropins/tools/preact-compat.js";import{useState as P,useEffect as se,useId as Me,useCallback as K,useMemo as ne}from"@dropins/tools/preact-hooks.js";import{useText as X}from"@dropins/tools/i18n.js";import{s as H}from"../chunks/resetCart.js";import{S as Ve}from"../chunks/ChevronUp.js";import{S as $e}from"../chunks/ChevronDown.js";import{events as er}from"@dropins/tools/event-bus.js";import{u as rr}from"../chunks/updateProductsFromCart.js";import{s as tr}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 D=e=>Q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},Q.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"}),Q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),de=e=>Q.createElement("svg",{width:20,height:23,viewBox:"0 0 20 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},Q.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})),ir=({view:e,showModal:o,productName:l,giftWrappingConfig:c,setShowModal:t,updateGiftOptions:p})=>{var O;const u=X({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"}),[n,d]=P();if(se(()=>{const i=c.find(N=>N.selected)??c[0];d(i)},[c]),!o||!c.length)return null;const m=l?`${u.modalTitle} ${l}`:u.defaultTitle;return f(Ze,{"data-testid":`gift-option-modal-${e}`,className:"cart-gift-options-view__modal",size:"medium",title:f(B,{children:[r("span",{children:m}),n&&((O=n==null?void 0:n.price)==null?void 0:O.value)>0?r(le,{amount:n.price.value,currency:n.price.currency,weight:"normal"}):null]}),centered:!0,onClose:t,children:[f("div",{className:"cart-gift-options-view__modal-content",children:[r("span",{className:"cart-gift-options-view__modal-text",children:u.modalWrappingText}),r(Xe,{emptyGridContent:r(B,{}),maxColumns:6,columnWidth:"100px",className:"cart-gift-options-view__modal-grid",children:c.map(i=>r(Je,{selected:(n==null?void 0:n.uid)===(i==null?void 0:i.uid),onValue:()=>{d(i)},name:"giftWrappingId",value:i.uid,src:i.image.url,alt:i.image.design,label:i.image.design,"data-testid":`gift-option-modal-image-${i.uid}`,className:"cart-gift-options-view__modal-grid-item"},i.uid))}),r("span",{className:"cart-gift-options-view__modal-sub-text",children:n==null?void 0:n.design})]}),r(oe,{"data-testid":"gift-option-modal-confirm-button",type:"button",onClick:()=>{p("giftWrappingId",n==null?void 0:n.uid,{isGiftWrappingSelected:!0}),t()},children:u.modalConfirmButton}),r(oe,{type:"button",variant:"secondary",onClick:t,"data-testid":"gift-option-modal-cancel-button",children:u.modalCancelButton})]})},nr=()=>r(Qe,{children:r(Ye,{variant:"row",size:"small",fullWidth:!0,lines:1,multilineGap:"small"})}),or=({className:e,view:o,item:l,giftOptions:c,disabled:t,cartData:p,giftWrappingConfig:u,setShowModal:n,onInputChange:d,areGiftOptionsVisible:m})=>{var $,S,z,q;const O=Me(),i=X({customize:`Cart.GiftOptions.${o}.customize`,giftReceiptIncludedTitle:`Cart.GiftOptions.${o}.giftReceiptIncluded.title`,giftReceiptIncludedText:`Cart.GiftOptions.${o}.giftReceiptIncluded.subtitle`,printedCardIncludedTitle:`Cart.GiftOptions.${o}.printedCardIncluded.title`,printedCardIncludedText:`Cart.GiftOptions.${o}.printedCardIncluded.subtitle`,giftOptionsWrapTitle:`Cart.GiftOptions.${o}.giftOptionsWrap.title`,giftOptionsWrapText:`Cart.GiftOptions.${o}.giftOptionsWrap.subtitle`,requiredFieldError:"Cart.GiftOptions.formText.requiredFieldError"}),N=l==null?void 0:l.productGiftWrapping,M=p==null?void 0:p.cartGiftWrapping,b=o==="product"?N:M,G=b==null?void 0:b.find(I=>I.uid===c.giftWrappingId),W=(G==null?void 0:G.design)??"",g=l==null?void 0:l.giftWrappingPrice,T=W?`${i.giftOptionsWrapText} ${W}`:"",_=+(((S=($=H.config)==null?void 0:$.printedCardPrice)==null?void 0:S.value)??0)>0?(z=H.config)==null?void 0:z.printedCardPrice:null;let v=null;g!=null&&g.value?v=g:(q=G==null?void 0:G.price)!=null&&q.value&&(v=G.price);const V=I=>I?f("span",{children:[" (+",r(le,{amount:I.value,currency:I.currency,weight:"normal"}),")"]}):null;return f("div",{className:xe([e,[`${e}--hidden`,!m.isGiftOptionsVisible]]),children:[m.isGiftReceiptVisible?r(Z,{disabled:t,className:"cart-gift-options-view__field-gift-receipt",children:r(ie,{id:`giftReceiptIncluded-${O}`,disabled:t,name:"giftReceiptIncluded",checked:c.giftReceiptIncluded,placeholder:i.giftReceiptIncludedTitle,label:i.giftReceiptIncludedTitle,description:i.giftReceiptIncludedText,onChange:d})}):null,m.isPrintedCartVisible?r(Z,{disabled:t,className:"cart-gift-options-view__field-printed-card",children:r(ie,{id:`printedCardIncluded-${O}`,disabled:t,name:"printedCardIncluded",checked:c.printedCardIncluded,placeholder:i.printedCardIncludedTitle,label:f(B,{children:[i.printedCardIncludedTitle,V(_)]}),description:i.printedCardIncludedText,onChange:d})}):null,m.isGiftWrappingVisible?f(B,{children:[r(Z,{disabled:t,className:"cart-gift-options-view__field-gift-wrap",children:r(ie,{id:`giftOptionsWrap-${O}`,disabled:t,name:"isGiftWrappingSelected",checked:c.isGiftWrappingSelected,placeholder:i.giftOptionsWrapTitle,label:f(B,{children:[i.giftOptionsWrapTitle,V(v)]}),description:T,onChange:d})}),r(oe,{disabled:t||!u.length,type:"button","data-testid":`gift-option-customize-${o}`,variant:"tertiary",onClick:()=>n(!0),children:i.customize})]}):null]})},sr=({view:e,giftOptions:o,disabled:l,errorMessage:c,onInputChange:t,onBlur:p,isGiftMessageVisible:u})=>{const n=Me(),d=X({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 u?f(B,{children:[r("span",{children:d.formTitle}),f("div",{children:[r("span",{children:d.formTo}),r(Z,{disabled:l,error:c.recipientName,children:r(ve,{id:`recipientName-${n}`,disabled:l,type:"text",name:"recipientName",value:o.recipientName,placeholder:d.formToPlaceholder,onChange:t,onBlur:p})})]}),f("div",{children:[r("span",{children:d.formFrom}),r(Z,{disabled:l,error:c.senderName,children:r(ve,{id:`senderName-${n}`,disabled:l,type:"text",name:"senderName",value:o.senderName,placeholder:d.formFromPlaceholder,onChange:t,onBlur:p})})]}),f("div",{children:[r("span",{children:d.giftMessageTitle}),r(Z,{disabled:l,children:r(Ue,{id:`message-${n}`,errorMessage:c.message,disabled:l,name:"message",value:o.message,label:d.formMessagePlaceholder,onChange:t,onBlur:p})})]})]}):null},dr=({view:e,giftOptions:o,giftWrappingConfig:l,readOnlyFormOrderView:c})=>{const t=X({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:p,senderName:u,message:n,giftReceiptIncluded:d,printedCardIncluded:m,isGiftWrappingSelected:O}=o,i=l==null?void 0:l.find(({uid:g})=>g===(o==null?void 0:o.giftWrappingId)),N=!!p||!!u||!!n,M=i==null?void 0:i.design,b=d||m||(i==null?void 0:i.selected),G=[{id:1,title:t.wrapping,message:O?M:""},{id:2,title:t.recipient,message:p},{id:3,title:t.sender,message:u},{id:4,title:t.message,message:n}],W=G.every(({message:g})=>!g);if(e==="product"&&!W)return r(Pe,{"data-testid":"gift-options-product",iconClose:Ve,iconOpen:$e,actionIconPosition:"right",children:r(Ne,{title:t.readOnlyProductTitle,showIconLeft:!0,iconLeft:de,defaultOpen:!1,renderContentWhenClosed:!1,children:r("div",{children:G.filter(g=>g.message).map(g=>f("p",{children:[g.title," ",g.message]},g.id))})})});if(e==="order"&&(N||b)){const g=f("div",{className:"cart-gift-options-readonly__header",children:[r(J,{source:de,size:"24"}),r("span",{children:t.readOnlyOrderTitle})]}),T=f(B,{children:[d?f("div",{className:"cart-gift-options-readonly__checkboxes cart-gift-options-readonly__checkboxes--gift-receipt",children:[r(J,{source:D,size:"16"}),r("p",{children:t.readOnlyOrderGiftReceiptTitle}),r("p",{children:t.readOnlyOrderGiftReceiptText})]}):null,m?f("div",{className:"cart-gift-options-readonly__checkboxes cart-gift-options-readonly__checkboxes--print-card",children:[r(J,{source:D,size:"16"}),r("p",{children:t.readOnlyOrderGiftPrintCardTitle}),r("p",{children:t.readOnlyOrderGiftPrintCardText})]}):null,i!=null&&i.selected?f("div",{className:"cart-gift-options-readonly__checkboxes cart-gift-options-readonly__checkboxes--gift-wrap",children:[r(J,{source:D,size:"16"}),f("p",{children:[t.readOnlyOrderGiftWrapTitle," (+",r(le,{amount:i.price.value,currency:i.price.currency,weight:"normal"}),")"]}),r("p",{children:`${t.readOnlyOrderGiftWrapOptionsText} ${i==null?void 0:i.design}`})]}):null]}),_=N?f("div",{className:"cart-gift-options-readonly__form",children:[r("div",{children:t.readOnlyOrderFormTitle}),f("div",{children:[f("p",{children:[r("span",{children:t.readOnlyOrderFormTo}),r("span",{children:p})]}),f("p",{children:[r("span",{children:t.readOnlyOrderFormFrom}),r("span",{children:u})]})]}),f("div",{children:[r("p",{children:t.readOnlyOrderFormMessageTitle}),r("p",{children:n})]})]}):null;return f(We,{variant:c,children:[g,T,_]})}return null},lr=({item:e,view:o,loading:l,giftOptions:c,showModal:t,isEditable:p,errorsField:u,updateLoading:n,cartData:d,fieldsDisabled:m,isGiftOptionsApplied:O,giftWrappingConfig:i,readOnlyFormOrderView:N,isGiftMessageVisible:M,areGiftOptionsVisible:b,onBlur:G,setShowModal:W,updateGiftOptions:g,onInputChange:T,handleFormMouseLeave:_})=>{const v=X({accordionHeading:`Cart.GiftOptions.${o}.accordionHeading`}),V=K($=>r(Pe,{"data-testid":"gift-options-product",iconClose:Ve,iconOpen:$e,actionIconPosition:"right",children:r(Ne,{title:f("div",{className:"cart-gift-options-view__icon--success",children:[r("span",{children:v.accordionHeading}),O?r(J,{source:D,size:"16"}):null]}),showIconLeft:!0,iconLeft:de,defaultOpen:O||$,renderContentWhenClosed:!1,children:f(B,{children:[r(or,{className:"cart-gift-options-view__top",view:o,item:e,giftOptions:c,disabled:m,onInputChange:T,cartData:d,giftWrappingConfig:i,setShowModal:W,areGiftOptionsVisible:b}),r("form",{className:"cart-gift-options-view__footer",onMouseLeave:_,children:r(sr,{view:o,giftOptions:c,disabled:m,errorMessage:u,onInputChange:T,onBlur:G,isGiftMessageVisible:M})})]})})}),[o,e,d,v,u,c,m,i,b,O,M,G,W,T,_]);return!b.isGiftOptionsVisible&&!M?null:f("div",{id:"cart-gift-options-view",className:xe(["cart-gift-options-view",`cart-gift-options-view--${o}`,["cart-gift-options-view--loading",n]]),children:[n?r(De,{className:"cart-gift-options-view__spinner"}):null,l?r(nr,{}):f(B,{children:[p?null:r("div",{className:"cart-gift-options-view--readonly",children:r(dr,{view:o,giftOptions:c,giftWrappingConfig:i,readOnlyFormOrderView:N})}),r(ir,{view:o,productName:e&&"name"in e?e==null?void 0:e.name:"",showModal:t,giftWrappingConfig:i,setShowModal:()=>W(!1),updateGiftOptions:g}),o==="product"&&p?V(!1):null,o==="order"&&p?r(We,{variant:"secondary",children:V(!0)}):null]})]})},U={recipientName:"",senderName:"",message:""},cr={giftReceiptIncluded:!1,printedCardIncluded:!1,isGiftWrappingSelected:!1},Re=(e,o)=>{var c,t;if(!o)return!!((c=H.config)!=null&&c.allowGiftMessageOnOrder);const l=((t=H.config)==null?void 0:t.allowGiftMessageOnOrderItems)??!1;return typeof(e==null?void 0:e.giftMessageAvailable)=="boolean"?e==null?void 0:e.giftMessageAvailable:l},ar=(e,o)=>{const{allowGiftWrappingOnOrder:l,allowGiftWrappingOnOrderItems:c,allowGiftMessageOnOrder:t,allowGiftMessageOnOrderItems:p,allowGiftReceipt:u,allowPrintedCard:n}=H.config||{},d=!p&&!c&&!Re(o,!0),m=!l&&!t&&!u&&!n;return!!(e==="product"&&d||e==="order"&&m)},fr=({item:e,view:o,dataSource:l,initialLoading:c,handleItemsLoading:t,handleItemsError:p,onItemUpdate:u,onGiftOptionsChange:n})=>{var ae,fe,pe,ue,ge,me;const d=o==="product",m=X({requiredFieldError:"Cart.GiftOptions.formText.requiredFieldError"}),[O,i]=P(()=>c),[N,M]=P({isGiftReceiptVisible:!0,isPrintedCartVisible:!0,isGiftWrappingVisible:!0,isGiftOptionsVisible:!0}),[b,G]=P(!0),[W,g]=P(!1),[T,_]=P(!1),[v,V]=P(!1),[$,S]=P(!1),[z,q]=P(!1),[I,ke]=P([]),[h,Se]=P(null),[Ie,ee]=P(U),[y,ce]=P(()=>({giftWrappingId:"",...U,...cr})),re=((ae=y.recipientName)==null?void 0:ae.trim())&&((fe=y.senderName)==null?void 0:fe.trim())&&((pe=y.message)==null?void 0:pe.trim()),Y=!((ue=y.recipientName)!=null&&ue.trim())&&!((ge=y.senderName)!=null&&ge.trim())&&!((me=y.message)!=null&&me.trim()),k=K(async s=>{switch(g(o==="order"),_(!0),o){case"product":{"uid"in e&&(t==null||t(e.uid,!0),p==null||p(e.uid));const{recipientName:a,senderName:F,message:C,giftWrappingId:x,isGiftWrappingSelected:w}=s,E={gift_message:{to:a??"",from:F??"",message:C??""},gift_wrapping_id:w?x:null};"uid"in e&&"quantity"in e&&await rr([{uid:e.uid,quantity:e.quantity,giftOptions:E}]).then(()=>{u==null||u({item:e})}).finally(()=>{t==null||t(e.uid,!1),_(!1),V(!1),g(!1)}).catch(R=>{console.warn(R)})}break;case"order":await tr(s).finally(()=>{_(!1),V(!1),g(!1)});break;default:console.error('Incorrect "view" prop value provided for GiftOptions container (storefront-cart)');break}},[p,t,e,u,o]),te=K((s,a,F={})=>{ce(C=>{const x=A=>A in C,w=A=>x(A)?C[A]:void 0;if(!(w(s)!==a||Object.keys(F).some(A=>w(A)!==F[A])))return n==null||n(C),C;const R={...C,[s]:a,...F};return!R.recipientName&&!R.senderName&&!R.message&&S(!0),(typeof a=="boolean"||["giftWrappingId","giftReceiptIncluded","printedCardIncluded"].includes(s))&&(typeof n=="function"?n(R):k(R)),V(!0),n==null||n(R),R})},[k,n]),Ae=K(async()=>{T||typeof n!="function"&&(Y&&$&&(ee(U),S(!1),await k(y)),v&&re&&(S(!0),await k(y)))},[k,y,v,Y,$,T,n]),He=K(async s=>{if(T||typeof n=="function")return;const{name:a,value:F}=s.target;ee(C=>({...C,[a]:F.trim()?"":m.requiredFieldError})),Y&&$&&(ee(U),S(!1),await k(y)),v&&re&&await k(y)},[T,Y,$,v,re,m,k,y,n]),Be=K(s=>{const a=s.target,F=a.name,C=a.type==="checkbox"?a.checked:a.value;te(F,C)},[te]);se(()=>{if(d)return;const s=er.on(l==="cart"?"cart/data":"order/data",a=>{var x,w;Se(a);const F=(x=a==null?void 0:a.items)==null?void 0:x.every(({giftWrappingAvailable:E})=>E),C=(w=a==null?void 0:a.cartGiftWrapping)==null?void 0:w.some(E=>E.selected);!F&&C&&k({...y,giftWrappingId:"",isGiftWrappingSelected:!1})},{eager:!0});return()=>{s==null||s.off()}},[k,l,y,d]);const L=ne(()=>{var Ge,ye,Te,Fe,we,be;if(!h&&!e)return null;const s=d?(Ge=e==null?void 0:e.productGiftWrapping)==null?void 0:Ge.map(j=>{var _e;return{...j,price:e!=null&&e.giftWrappingPrice&&((_e=e==null?void 0:e.giftWrappingPrice)==null?void 0:_e.value)>0?e.giftWrappingPrice:j.price}}):(h==null?void 0:h.cartGiftWrapping)||[],a=s==null?void 0:s.find(j=>j.selected),F=(a==null?void 0:a.uid)??((ye=s==null?void 0:s[0])==null?void 0:ye.uid),C=!!a,x=d?e.giftMessage:h==null?void 0:h.giftMessage,w=h==null?void 0:h.printedCardIncluded,E=h==null?void 0:h.giftReceiptIncluded,R=Re(e,d),A=(Te=H.config)==null?void 0:Te.allowGiftWrappingOnOrder,qe=(Fe=H.config)==null?void 0:Fe.allowGiftReceipt,Le=(we=H.config)==null?void 0:we.allowPrintedCard,je=(be=h==null?void 0:h.items)==null?void 0:be.every(j=>j.giftWrappingAvailable),Ke=e==null?void 0:e.giftWrappingAvailable,Oe=d?!1:!!qe,he=d?!1:!!Le,Ce=d?!!Ke&&!!s.length:!!A&&!!s.length&&!!je;return M({isGiftReceiptVisible:Oe,isPrintedCartVisible:he,isGiftWrappingVisible:Ce,isGiftOptionsVisible:!(!Oe&&!he&&!Ce)}),G(R),{...e&&"uid"in e?{itemId:e.uid}:{},...d?{}:{printedCardIncluded:w,giftReceiptIncluded:E},...x,giftWrappingId:F,isGiftWrappingSelected:C,giftWrappingOptions:s}},[h,e,d]);se(()=>{if(!L)return;const{giftWrappingOptions:s}=L;ce(a=>{const F=x=>x in a,C=Object.keys(L).reduce((x,w)=>F(w)&&a[w]!==L[w]?{...x,[w]:L[w]}:x,{});return Object.keys(C).length>0?{...a,...C}:a}),s!=null&&s.length&&ke(s),i(!1)},[L]);const Ee=ne(()=>Object.entries(y).filter(([s])=>s!=="itemId"&&s!=="giftWrappingId").some(([,s])=>!!s),[y]),ze=ne(()=>{var s;return!O&&!!((s=H)!=null&&s.config)&&ar(o,e)},[e,O,o]);return{loading:O,giftOptions:y,showModal:z,errorsField:Ie,updateLoading:W,cartData:h,fieldsDisabled:T,isGiftOptionsApplied:Ee,giftWrappingConfig:I,setFieldsDisabled:_,handleFormMouseLeave:Ae,onInputChange:Be,updateGiftOptions:te,setShowModal:q,handleBlur:He,isGiftMessageVisible:b,areGiftOptionsVisible:N,isGiftOptionsHidden:ze}},Wr=({item:e,view:o="order",readOnlyFormOrderView:l="primary",dataSource:c="cart",isEditable:t=!0,initialLoading:p=!0,handleItemsLoading:u,handleItemsError:n,onItemUpdate:d,onGiftOptionsChange:m})=>{const{isGiftMessageVisible:O,areGiftOptionsVisible:i,loading:N,giftOptions:M,showModal:b,errorsField:G,updateLoading:W,cartData:g,isGiftOptionsApplied:T,fieldsDisabled:_,giftWrappingConfig:v,handleFormMouseLeave:V,updateGiftOptions:$,setShowModal:S,onInputChange:z,handleBlur:q,isGiftOptionsHidden:I}=fr({item:e,view:o,dataSource:c,initialLoading:p,handleItemsLoading:u,handleItemsError:n,onItemUpdate:d,onGiftOptionsChange:m});return I?null:r(lr,{item:e,view:o,loading:N,onBlur:q,giftOptions:M,showModal:b,isEditable:t,errorsField:G,setShowModal:S,updateLoading:W,updateGiftOptions:$,cartData:g,isGiftOptionsApplied:T,fieldsDisabled:_,giftWrappingConfig:v,handleFormMouseLeave:V,readOnlyFormOrderView:l,onInputChange:z,isGiftMessageVisible:O,areGiftOptionsVisible:i})};export{Wr as GiftOptions,Wr as default};
|
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 s,Fragment as X}from"@dropins/tools/preact-jsx-runtime.js";import{useState as A,useEffect as H,useCallback as R}from"@dropins/tools/preact-compat.js";import{classes as h,VComponent as u,Slot as _}from"@dropins/tools/lib.js";import{g as j}from"../chunks/persisted-data.js";import{events as w}from"@dropins/tools/event-bus.js";import{Price as I,Button as N}from"@dropins/tools/components.js";/* empty css
|
|
3
|
+
import{jsx as i,jsxs as s,Fragment as X}from"@dropins/tools/preact-jsx-runtime.js";import{useState as A,useEffect as H,useCallback as R}from"@dropins/tools/preact-compat.js";import{classes as h,VComponent as u,Slot as _}from"@dropins/tools/lib.js";import{g as j}from"../chunks/persisted-data.js";import{events as w}from"@dropins/tools/event-bus.js";import{Price as I,Button 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 O}from"../chunks/acdl.js";import{u as B}from"../chunks/updateProductsFromCart.js";import"../chunks/CartSummaryGrid.js";import{C as V}from"../chunks/CartSummaryList.js";import"../chunks/OrderSummary.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/refreshCart.js";import"../fragments.js";import"../chunks/EmptyCart.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 $=({className:f,products:m,productListFooter:l,subtotal:e,subtotalExcludingTaxes:d,preCheckoutSection:o,ctas:n,...x})=>{const p=D({subtotal:"Cart.MiniCart.subtotal",subtotalExcludingTaxes:"Cart.MiniCart.subtotalExcludingTaxes"});return i("div",{...x,className:h(["cart-mini-cart",f]),children:m&&s(X,{children:[i("div",{className:"cart-mini-cart__products","data-testid":"mini-cart-products-wrapper",children:m}),l&&i("div",{className:h(["cart-mini-cart__productListFooter"]),"data-testid":"mini-cart-product-list-footer",children:i(u,{node:l})}),s("div",{className:"cart-mini-cart__footer","data-testid":"mini-cart-subtotals",children:[e&&s("div",{className:"cart-mini-cart__footer__estimated-total","data-testid":"mini-cart-subtotal",children:[p.subtotal,i(u,{node:e})]}),d&&s("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"])})]}),o&&i("div",{className:h(["cart-mini-cart__preCheckoutSection"]),"data-testid":"mini-cart-pre-checkout-section",children:i(u,{node:o})}),n&&i(u,{node:n,className:"cart-mini-cart__footer__ctas"})]})]})})},q=({children:f,initialData:m=null,hideFooter:l=!0,slots:e,routeProduct:d,routeCart:o,routeCheckout:n,routeEmptyCartCTA:x,showDiscount:p,showSavings:P,...S})=>{var v,k,L;const[t,M]=A(m),a=(v=b.config)==null?void 0:v.shoppingCartDisplaySetting;H(()=>{const r=w.on("cart/data",y=>{M(y)},{eager:!0});return()=>{r==null||r.off()}},[]);const g=D({cartLink:"Cart.MiniCart.cartLink",checkoutLink:"Cart.MiniCart.checkoutLink"}),C=(r,y)=>B([{uid:r,quantity:y}]),Q=r=>C(r,0),c=t==null?void 0:t.hasOutOfStockItems,T=R(()=>{t&&!c&&O(t,b.locale)},[t,c]),E=i(_,{name:"ProductList",slot:e==null?void 0:e.ProductList,context:{itemQuantityUpdateHandler:C,itemRemoveHandler:Q,totalQuantity:t==null?void 0:t.totalQuantity},children:i(V,{"data-testid":"default-cart-summary-list",routeProduct:d,routeEmptyCartCTA:x,initialData:t,maxItems:(k=b.config)==null?void 0:k.miniCartMaxItemsDisplay,showMaxItems:!!((L=b.config)!=null&&L.miniCartMaxItemsDisplay),hideHeading:!(t!=null&&t.totalQuantity),hideFooter:l,enableRemoveItem:!0,showDiscount:p,showSavings:P})}),U=r=>i(_,{name:"ProductListFooter",slot:e==null?void 0:e.ProductListFooter,context:{data:r}}),F=r=>i(_,{name:"PreCheckoutSection",slot:e==null?void 0:e.PreCheckoutSection,context:{data:r}}),G=()=>(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($,{...S,productListFooter:U(t),subtotal:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&i(I,{...G()}):void 0,subtotalExcludingTaxes:t!=null&&t.totalQuantity?(t==null?void 0:t.subtotal)&&((a==null?void 0:a.subtotal)==="INCLUDING_EXCLUDING_TAX"?i(I,{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:F(t),ctas:t!=null&&t.totalQuantity?s("div",{children:[n&&i(N,{"data-testid":"route-checkout-button",variant:"primary",href:c?void 0:n(),disabled:c,"aria-disabled":c,onClick:T,children:g.checkoutLink}),o&&i(N,{"data-testid":"route-cart-button",variant:"tertiary",href:o(),children:g.cartLink})]}):void 0,products:E})};q.getInitialData=async function(){return j()};export{q as MiniCart,q as default};
|
|
@@ -11,8 +11,10 @@ export interface OrderSummaryProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
slots?: {
|
|
12
12
|
EstimateShipping?: SlotProps;
|
|
13
13
|
Coupons?: SlotProps;
|
|
14
|
+
GiftCards?: SlotProps;
|
|
14
15
|
};
|
|
15
16
|
enableCoupons?: boolean;
|
|
17
|
+
enableGiftCards?: boolean;
|
|
16
18
|
errors: boolean;
|
|
17
19
|
showTotalSaved?: boolean;
|
|
18
20
|
updateLineItems?: (lineItems: Array<OrderSummaryLineItem>) => Array<OrderSummaryLineItem>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{O as
|
|
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/ChevronDown.js";import"../chunks/ChevronUp.js";import"@dropins/tools/i18n.js";import"../chunks/Coupon.js";import"../chunks/GiftCard.js";export{k as OrderSummary,n as default};
|
|
@@ -2,8 +2,8 @@ import { HTMLAttributes } from 'preact/compat';
|
|
|
2
2
|
import { Container } from '@dropins/tools/types/elsie/src/lib';
|
|
3
3
|
import { VNode } from 'preact';
|
|
4
4
|
|
|
5
|
-
export interface OrderSummaryLineProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
label: string;
|
|
5
|
+
export interface OrderSummaryLineProps extends Omit<HTMLAttributes<HTMLDivElement>, 'label'> {
|
|
6
|
+
label: VNode | string;
|
|
7
7
|
price: VNode<HTMLAttributes<HTMLSpanElement>>;
|
|
8
8
|
classSuffixes?: Array<string>;
|
|
9
9
|
labelClassSuffix?: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{O as
|
|
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
|
@@ -15,6 +15,29 @@
|
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
17
|
export interface CartModel {
|
|
18
|
+
totalGiftOptions: {
|
|
19
|
+
giftWrappingForItems: Price;
|
|
20
|
+
giftWrappingForItemsInclTax: Price;
|
|
21
|
+
giftWrappingForOrder: Price;
|
|
22
|
+
giftWrappingForOrderInclTax: Price;
|
|
23
|
+
printedCard: Price;
|
|
24
|
+
printedCardInclTax: Price;
|
|
25
|
+
};
|
|
26
|
+
cartGiftWrapping: {
|
|
27
|
+
uid: string;
|
|
28
|
+
design: string;
|
|
29
|
+
selected: boolean;
|
|
30
|
+
image: WrappingImage;
|
|
31
|
+
price: Price;
|
|
32
|
+
}[];
|
|
33
|
+
giftReceiptIncluded: boolean;
|
|
34
|
+
printedCardIncluded: boolean;
|
|
35
|
+
giftMessage: {
|
|
36
|
+
recipientName: string;
|
|
37
|
+
senderName: string;
|
|
38
|
+
message: string;
|
|
39
|
+
};
|
|
40
|
+
appliedGiftCards: AppliedGiftCardProps[];
|
|
18
41
|
id: string;
|
|
19
42
|
totalQuantity: number;
|
|
20
43
|
totalUniqueItems: number;
|
|
@@ -48,6 +71,12 @@ export interface CartModel {
|
|
|
48
71
|
hasFullyOutOfStockItems?: boolean;
|
|
49
72
|
appliedCoupons?: Coupon[];
|
|
50
73
|
}
|
|
74
|
+
export interface AppliedGiftCardProps {
|
|
75
|
+
code: string;
|
|
76
|
+
appliedBalance: Price;
|
|
77
|
+
currentBalance: Price;
|
|
78
|
+
expirationDate: string;
|
|
79
|
+
}
|
|
51
80
|
interface TotalPriceModifier {
|
|
52
81
|
amount: Price;
|
|
53
82
|
label: string;
|
|
@@ -58,6 +87,24 @@ interface FixedProductTax {
|
|
|
58
87
|
label: string;
|
|
59
88
|
}
|
|
60
89
|
export interface Item {
|
|
90
|
+
giftWrappingAvailable: boolean;
|
|
91
|
+
giftWrappingPrice: {
|
|
92
|
+
currency: string;
|
|
93
|
+
value: number;
|
|
94
|
+
};
|
|
95
|
+
productGiftWrapping: {
|
|
96
|
+
uid: string;
|
|
97
|
+
design: string;
|
|
98
|
+
selected: boolean;
|
|
99
|
+
image: WrappingImage;
|
|
100
|
+
price: Price;
|
|
101
|
+
}[];
|
|
102
|
+
giftMessage: {
|
|
103
|
+
recipientName: string;
|
|
104
|
+
senderName: string;
|
|
105
|
+
message: string;
|
|
106
|
+
};
|
|
107
|
+
giftMessageAvailable: boolean | null;
|
|
61
108
|
taxedPrice: Price;
|
|
62
109
|
rowTotal: Price;
|
|
63
110
|
rowTotalIncludingTax: Price;
|
|
@@ -135,5 +182,9 @@ interface Attribute {
|
|
|
135
182
|
interface Coupon {
|
|
136
183
|
code: string;
|
|
137
184
|
}
|
|
185
|
+
export interface WrappingImage {
|
|
186
|
+
url: string;
|
|
187
|
+
design: string;
|
|
188
|
+
}
|
|
138
189
|
export {};
|
|
139
190
|
//# sourceMappingURL=cart-model.d.ts.map
|
package/data/models/index.d.ts
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* __________________
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2024 Adobe
|
|
6
|
-
* All Rights Reserved.
|
|
7
|
-
*
|
|
8
|
-
* NOTICE: All information contained herein is, and remains
|
|
9
|
-
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
-
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
-
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
-
* property laws, including trade secret and copyright laws.
|
|
13
|
-
* Dissemination of this information or reproduction of this material
|
|
14
|
-
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
-
* from Adobe.
|
|
16
|
-
*******************************************************************/
|
|
1
|
+
import { Price } from './cart-model';
|
|
2
|
+
|
|
17
3
|
export interface StoreConfigModel {
|
|
18
4
|
displayMiniCart: boolean;
|
|
19
5
|
miniCartMaxItemsDisplay: number;
|
|
@@ -34,5 +20,14 @@ export interface StoreConfigModel {
|
|
|
34
20
|
zeroTax: boolean;
|
|
35
21
|
};
|
|
36
22
|
useConfigurableParentThumbnail: boolean;
|
|
23
|
+
allowGiftWrappingOnOrder: boolean | null;
|
|
24
|
+
allowGiftWrappingOnOrderItems: boolean | null;
|
|
25
|
+
allowGiftMessageOnOrder: boolean | null;
|
|
26
|
+
allowGiftMessageOnOrderItems: boolean | null;
|
|
27
|
+
allowGiftReceipt: boolean;
|
|
28
|
+
allowPrintedCard: boolean;
|
|
29
|
+
printedCardPrice: Price;
|
|
30
|
+
cartGiftWrapping: string;
|
|
31
|
+
cartPrintedCard: string;
|
|
37
32
|
}
|
|
38
33
|
//# sourceMappingURL=store-models.d.ts.map
|
|
@@ -3,4 +3,18 @@ import { CartModel } from '../../models/cart-model';
|
|
|
3
3
|
export declare const cart: CartModel;
|
|
4
4
|
export declare const sampleDataCart: CartModel;
|
|
5
5
|
export declare const sampleDataWithCoupons: CartModel;
|
|
6
|
+
export declare const sampleDataWithGiftCodes: CartModel;
|
|
7
|
+
export declare const sampleGiftWrappingConfig: {
|
|
8
|
+
design: string;
|
|
9
|
+
uid: string;
|
|
10
|
+
selected: boolean;
|
|
11
|
+
image: {
|
|
12
|
+
url: string;
|
|
13
|
+
label: string;
|
|
14
|
+
};
|
|
15
|
+
price: {
|
|
16
|
+
currency: string;
|
|
17
|
+
value: number;
|
|
18
|
+
};
|
|
19
|
+
}[];
|
|
6
20
|
//# sourceMappingURL=cartModel.d.ts.map
|
|
@@ -28,6 +28,7 @@ declare const bundleOptions: {
|
|
|
28
28
|
}[];
|
|
29
29
|
uid: string;
|
|
30
30
|
quantity: number;
|
|
31
|
+
gift_message_available: string;
|
|
31
32
|
errors: null;
|
|
32
33
|
prices: {
|
|
33
34
|
price: {
|
|
@@ -93,6 +94,7 @@ declare const bundleOptionsEmpty: {
|
|
|
93
94
|
bundle_options: never[];
|
|
94
95
|
uid: string;
|
|
95
96
|
quantity: number;
|
|
97
|
+
gift_message_available: string;
|
|
96
98
|
errors: null;
|
|
97
99
|
prices: {
|
|
98
100
|
price: {
|
|
@@ -160,6 +162,7 @@ declare const giftCardPhysical: {
|
|
|
160
162
|
sender_name: string;
|
|
161
163
|
uid: string;
|
|
162
164
|
quantity: number;
|
|
165
|
+
gift_message_available: string;
|
|
163
166
|
errors: null;
|
|
164
167
|
prices: {
|
|
165
168
|
price: {
|
|
@@ -229,6 +232,7 @@ declare const giftCardVirtual: {
|
|
|
229
232
|
sender_name: string;
|
|
230
233
|
uid: string;
|
|
231
234
|
quantity: number;
|
|
235
|
+
gift_message_available: string;
|
|
232
236
|
errors: null;
|
|
233
237
|
prices: {
|
|
234
238
|
price: {
|
|
@@ -292,6 +296,7 @@ declare const giftCardVirtual: {
|
|
|
292
296
|
declare const simple: {
|
|
293
297
|
uid: string;
|
|
294
298
|
quantity: number;
|
|
299
|
+
gift_message_available: string;
|
|
295
300
|
errors: null;
|
|
296
301
|
prices: {
|
|
297
302
|
price: {
|
|
@@ -374,6 +379,7 @@ declare const simpleCustomizable: {
|
|
|
374
379
|
})[];
|
|
375
380
|
uid: string;
|
|
376
381
|
quantity: number;
|
|
382
|
+
gift_message_available: string;
|
|
377
383
|
errors: null;
|
|
378
384
|
prices: {
|
|
379
385
|
price: {
|
|
@@ -466,6 +472,7 @@ declare const configurable: {
|
|
|
466
472
|
};
|
|
467
473
|
uid: string;
|
|
468
474
|
quantity: number;
|
|
475
|
+
gift_message_available: string;
|
|
469
476
|
errors: null;
|
|
470
477
|
prices: {
|
|
471
478
|
price: {
|
|
@@ -576,6 +583,7 @@ declare const configurableCustomizable: {
|
|
|
576
583
|
};
|
|
577
584
|
uid: string;
|
|
578
585
|
quantity: number;
|
|
586
|
+
gift_message_available: string;
|
|
579
587
|
errors: null;
|
|
580
588
|
prices: {
|
|
581
589
|
price: {
|
|
@@ -640,6 +648,7 @@ declare const giftCard: {
|
|
|
640
648
|
__typename: string;
|
|
641
649
|
uid: string;
|
|
642
650
|
quantity: number;
|
|
651
|
+
gift_message_available: string;
|
|
643
652
|
errors: null;
|
|
644
653
|
prices: {
|
|
645
654
|
price: {
|
|
@@ -708,6 +717,7 @@ declare const downloadbleWithMultipleLinks: {
|
|
|
708
717
|
}[];
|
|
709
718
|
uid: string;
|
|
710
719
|
quantity: number;
|
|
720
|
+
gift_message_available: string;
|
|
711
721
|
errors: null;
|
|
712
722
|
prices: {
|
|
713
723
|
price: {
|
|
@@ -804,6 +814,7 @@ declare const simpleLowInventory: {
|
|
|
804
814
|
};
|
|
805
815
|
uid: string;
|
|
806
816
|
quantity: number;
|
|
817
|
+
gift_message_available: string;
|
|
807
818
|
errors: null;
|
|
808
819
|
prices: {
|
|
809
820
|
price: {
|
|
@@ -876,6 +887,7 @@ declare const complexInsufficientQuantity: {
|
|
|
876
887
|
}[];
|
|
877
888
|
uid: string;
|
|
878
889
|
quantity: number;
|
|
890
|
+
gift_message_available: string;
|
|
879
891
|
errors: null;
|
|
880
892
|
prices: {
|
|
881
893
|
price: {
|
|
@@ -948,6 +960,7 @@ declare const complexInsufficientQuantityGeneralMessage: {
|
|
|
948
960
|
}[];
|
|
949
961
|
uid: string;
|
|
950
962
|
quantity: number;
|
|
963
|
+
gift_message_available: string;
|
|
951
964
|
errors: null;
|
|
952
965
|
prices: {
|
|
953
966
|
price: {
|
|
@@ -1030,6 +1043,7 @@ declare const complexWithProductAttributes: {
|
|
|
1030
1043
|
}[];
|
|
1031
1044
|
uid: string;
|
|
1032
1045
|
quantity: number;
|
|
1046
|
+
gift_message_available: string;
|
|
1033
1047
|
errors: null;
|
|
1034
1048
|
prices: {
|
|
1035
1049
|
price: {
|
|
@@ -1122,6 +1136,7 @@ declare const simpleWithNoDiscount: {
|
|
|
1122
1136
|
};
|
|
1123
1137
|
uid: string;
|
|
1124
1138
|
quantity: number;
|
|
1139
|
+
gift_message_available: string;
|
|
1125
1140
|
errors: null;
|
|
1126
1141
|
};
|
|
1127
1142
|
export { bundleOptions, bundleOptionsEmpty, giftCardPhysical, giftCardVirtual, simple, simpleCustomizable, configurable, configurableCustomizable, giftCard, downloadbleWithMultipleLinks, simpleLowInventory, complexInsufficientQuantity, complexInsufficientQuantityGeneralMessage, complexWithProductAttributes, simpleWithNoDiscount, };
|
package/fragments.js
CHANGED
|
@@ -31,7 +31,7 @@ const e=`
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
`,
|
|
34
|
+
`,_=`
|
|
35
35
|
fragment CUSTOMIZABLE_OPTIONS_FRAGMENT on SelectedCustomizableOption {
|
|
36
36
|
type
|
|
37
37
|
customizable_option_uid
|
|
@@ -57,7 +57,55 @@ const e=`
|
|
|
57
57
|
...CUSTOMIZABLE_OPTIONS_FRAGMENT
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
`,t=`
|
|
61
|
+
fragment APPLIED_GIFT_CARDS_FRAGMENT on AppliedGiftCard {
|
|
62
|
+
__typename
|
|
63
|
+
code
|
|
64
|
+
applied_balance {
|
|
65
|
+
value
|
|
66
|
+
currency
|
|
67
|
+
}
|
|
68
|
+
current_balance {
|
|
69
|
+
value
|
|
70
|
+
currency
|
|
71
|
+
}
|
|
72
|
+
expiration_date
|
|
73
|
+
}
|
|
60
74
|
`,r=`
|
|
75
|
+
fragment GIFT_MESSAGE_FRAGMENT on GiftMessage {
|
|
76
|
+
__typename
|
|
77
|
+
from
|
|
78
|
+
to
|
|
79
|
+
message
|
|
80
|
+
}
|
|
81
|
+
`,i=`
|
|
82
|
+
fragment GIFT_WRAPPING_FRAGMENT on GiftWrapping {
|
|
83
|
+
__typename
|
|
84
|
+
uid
|
|
85
|
+
design
|
|
86
|
+
image {
|
|
87
|
+
url
|
|
88
|
+
}
|
|
89
|
+
price {
|
|
90
|
+
value
|
|
91
|
+
currency
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
`,n=`
|
|
95
|
+
fragment AVAILABLE_GIFT_WRAPPING_FRAGMENT on GiftWrapping {
|
|
96
|
+
__typename
|
|
97
|
+
uid
|
|
98
|
+
design
|
|
99
|
+
image {
|
|
100
|
+
url
|
|
101
|
+
label
|
|
102
|
+
}
|
|
103
|
+
price {
|
|
104
|
+
currency
|
|
105
|
+
value
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
`,l=`
|
|
61
109
|
fragment CART_ITEM_FRAGMENT on CartItemInterface {
|
|
62
110
|
__typename
|
|
63
111
|
uid
|
|
@@ -117,6 +165,12 @@ const e=`
|
|
|
117
165
|
product {
|
|
118
166
|
name
|
|
119
167
|
sku
|
|
168
|
+
gift_message_available
|
|
169
|
+
gift_wrapping_available
|
|
170
|
+
gift_wrapping_price {
|
|
171
|
+
currency
|
|
172
|
+
value
|
|
173
|
+
}
|
|
120
174
|
thumbnail {
|
|
121
175
|
url
|
|
122
176
|
label
|
|
@@ -149,11 +203,29 @@ const e=`
|
|
|
149
203
|
}
|
|
150
204
|
}
|
|
151
205
|
... on SimpleCartItem {
|
|
206
|
+
available_gift_wrapping {
|
|
207
|
+
...AVAILABLE_GIFT_WRAPPING_FRAGMENT
|
|
208
|
+
}
|
|
209
|
+
gift_message {
|
|
210
|
+
...GIFT_MESSAGE_FRAGMENT
|
|
211
|
+
}
|
|
212
|
+
gift_wrapping {
|
|
213
|
+
...GIFT_WRAPPING_FRAGMENT
|
|
214
|
+
}
|
|
152
215
|
customizable_options {
|
|
153
216
|
...CUSTOMIZABLE_OPTIONS_FRAGMENT
|
|
154
217
|
}
|
|
155
218
|
}
|
|
156
219
|
... on ConfigurableCartItem {
|
|
220
|
+
available_gift_wrapping {
|
|
221
|
+
...AVAILABLE_GIFT_WRAPPING_FRAGMENT
|
|
222
|
+
}
|
|
223
|
+
gift_message {
|
|
224
|
+
...GIFT_MESSAGE_FRAGMENT
|
|
225
|
+
}
|
|
226
|
+
gift_wrapping {
|
|
227
|
+
...GIFT_WRAPPING_FRAGMENT
|
|
228
|
+
}
|
|
157
229
|
configurable_options {
|
|
158
230
|
configurable_product_option_uid
|
|
159
231
|
option_label
|
|
@@ -178,6 +250,15 @@ const e=`
|
|
|
178
250
|
}
|
|
179
251
|
...DOWNLOADABLE_CART_ITEMS_FRAGMENT
|
|
180
252
|
... on BundleCartItem {
|
|
253
|
+
available_gift_wrapping {
|
|
254
|
+
...AVAILABLE_GIFT_WRAPPING_FRAGMENT
|
|
255
|
+
}
|
|
256
|
+
gift_message {
|
|
257
|
+
...GIFT_MESSAGE_FRAGMENT
|
|
258
|
+
}
|
|
259
|
+
gift_wrapping {
|
|
260
|
+
...GIFT_WRAPPING_FRAGMENT
|
|
261
|
+
}
|
|
181
262
|
bundle_options {
|
|
182
263
|
uid
|
|
183
264
|
label
|
|
@@ -202,14 +283,57 @@ const e=`
|
|
|
202
283
|
}
|
|
203
284
|
|
|
204
285
|
${e}
|
|
205
|
-
${
|
|
286
|
+
${_}
|
|
206
287
|
${a}
|
|
207
|
-
|
|
288
|
+
${i}
|
|
289
|
+
${r}
|
|
290
|
+
${n}
|
|
291
|
+
`,c=`
|
|
208
292
|
fragment CART_FRAGMENT on Cart {
|
|
209
293
|
id
|
|
210
294
|
total_quantity
|
|
211
295
|
is_virtual
|
|
296
|
+
applied_gift_cards {
|
|
297
|
+
...APPLIED_GIFT_CARDS_FRAGMENT
|
|
298
|
+
}
|
|
299
|
+
gift_receipt_included
|
|
300
|
+
printed_card_included
|
|
301
|
+
gift_message {
|
|
302
|
+
...GIFT_MESSAGE_FRAGMENT
|
|
303
|
+
}
|
|
304
|
+
gift_wrapping {
|
|
305
|
+
...GIFT_WRAPPING_FRAGMENT
|
|
306
|
+
}
|
|
307
|
+
available_gift_wrappings {
|
|
308
|
+
...AVAILABLE_GIFT_WRAPPING_FRAGMENT
|
|
309
|
+
}
|
|
212
310
|
prices {
|
|
311
|
+
gift_options {
|
|
312
|
+
gift_wrapping_for_items {
|
|
313
|
+
currency
|
|
314
|
+
value
|
|
315
|
+
}
|
|
316
|
+
gift_wrapping_for_items_incl_tax {
|
|
317
|
+
currency
|
|
318
|
+
value
|
|
319
|
+
}
|
|
320
|
+
gift_wrapping_for_order {
|
|
321
|
+
currency
|
|
322
|
+
value
|
|
323
|
+
}
|
|
324
|
+
gift_wrapping_for_order_incl_tax {
|
|
325
|
+
currency
|
|
326
|
+
value
|
|
327
|
+
}
|
|
328
|
+
printed_card {
|
|
329
|
+
currency
|
|
330
|
+
value
|
|
331
|
+
}
|
|
332
|
+
printed_card_incl_tax {
|
|
333
|
+
currency
|
|
334
|
+
value
|
|
335
|
+
}
|
|
336
|
+
}
|
|
213
337
|
subtotal_with_discount_excluding_tax {
|
|
214
338
|
currency
|
|
215
339
|
value
|
|
@@ -272,5 +396,6 @@ const e=`
|
|
|
272
396
|
}
|
|
273
397
|
}
|
|
274
398
|
|
|
275
|
-
${
|
|
276
|
-
|
|
399
|
+
${l}
|
|
400
|
+
${t}
|
|
401
|
+
`;export{t as APPLIED_GIFT_CARDS_FRAGMENT,n as AVAILABLE_GIFT_WRAPPING_FRAGMENT,c as CART_FRAGMENT,l as CART_ITEM_FRAGMENT,a as DOWNLOADABLE_CART_ITEMS_FRAGMENT,r as GIFT_MESSAGE_FRAGMENT,i as GIFT_WRAPPING_FRAGMENT};
|