@dropins/storefront-order 0.1.0-alpha25 → 0.1.0-alpha27
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/index.d.ts +10 -9
- package/api/placeOrder/graphql/placeOrderMutation.d.ts +2 -0
- package/api/placeOrder/index.d.ts +2 -0
- package/api/placeOrder/placeOrder.d.ts +4 -0
- package/api.js +102 -13
- package/chunks/OrderCancelForm.js +1 -1
- package/chunks/OrderLoaders.js +1 -1
- package/chunks/ReturnsListContent.js +1 -1
- package/chunks/getCustomerOrdersReturn.js +1 -1
- package/chunks/getGuestOrder.graphql.js +1 -1
- package/chunks/getGuestOrder.js +11 -0
- package/chunks/requestGuestOrderCancel.js +1 -1
- package/chunks/transform-customer-orders-returns.js +142 -0
- package/components/OrderHeader/OrderHeader.d.ts +9 -0
- package/components/OrderHeader/index.d.ts +2 -0
- package/components/OrderLoaders/OrderLoaders.d.ts +1 -0
- package/components/index.d.ts +12 -11
- package/configs/mock.config.d.ts +54 -0
- package/containers/CreateReturn.js +1 -1
- package/containers/CustomerDetails.js +1 -1
- package/containers/OrderCancelForm.js +1 -1
- package/containers/OrderCostSummary.js +1 -1
- package/containers/OrderHeader/OrderHeader.d.ts +5 -0
- package/containers/OrderHeader/index.d.ts +3 -0
- package/containers/OrderHeader.d.ts +3 -0
- package/containers/OrderHeader.js +3 -0
- package/containers/OrderProductList.js +1 -1
- package/containers/OrderReturns.js +1 -1
- package/containers/OrderSearch.js +1 -1
- package/containers/OrderStatus.js +3 -3
- package/containers/ReturnsList.js +1 -1
- package/containers/ShippingStatus.js +1 -1
- package/containers/index.d.ts +8 -7
- package/data/models/acdl.d.ts +99 -0
- package/data/models/index.d.ts +3 -3
- package/data/transforms/index.d.ts +6 -4
- package/data/transforms/transform-acdl.d.ts +5 -0
- package/data/transforms/transform-customer-address-input.d.ts +22 -0
- package/data/transforms/transform-place-order.d.ts +5 -0
- package/hooks/containers/useOrderHeader.d.ts +8 -0
- package/hooks/index.d.ts +6 -5
- package/i18n/en_US.json.d.ts +11 -1
- package/lib/acdl.d.ts +18 -0
- package/package.json +1 -1
- package/render.js +2 -2
- package/types/api/placeOrder.types.d.ts +19 -0
- package/types/index.d.ts +16 -14
- package/types/orderHeader.types.d.ts +19 -0
- package/chunks/getCustomer.js +0 -11
- package/chunks/transform-order-details.js +0 -142
- /package/chunks/{OrderCancel.js → ShippingStatusCard.js} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2024 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as r,jsxs as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as A,Slot as q}from"@dropins/tools/lib.js";import{Icon as B,
|
|
3
|
+
import{jsx as r,jsxs as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as A,Slot as q}from"@dropins/tools/lib.js";import{Icon as B,Header as P,InLineAlert as H,Button as Q,Checkbox as $,CartItem as W,Image as j}from"@dropins/tools/components.js";import{useState as v,useRef as V,useEffect as T,useCallback as F}from"@dropins/tools/preact-hooks.js";import{u as Z,a as D}from"../chunks/ShippingStatusCard.js";import*as R from"@dropins/tools/preact-compat.js";import{s as z}from"../chunks/setTaxStatus.js";import{createRef as U,Fragment as G}from"@dropins/tools/preact.js";import{s as J,p as K,r as X,m as Y}from"../chunks/returnOrdersHelper.js";import{events as I}from"@dropins/tools/event-bus.js";import{g as ee,r as te}from"../chunks/requestReturn.js";import{g as ne}from"../chunks/getStoreConfig.js";import{S as re,C as se}from"../chunks/CartSummaryItem.js";import{a as ae}from"../chunks/OrderLoaders.js";import{useText as ie}from"@dropins/tools/i18n.js";import"../chunks/getFormValues.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const ce=s=>R.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},R.createElement("g",{clipPath:"url(#clip0_841_1324)"},R.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),R.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),R.createElement("defs",null,R.createElement("clipPath",{id:"clip0_841_1324"},R.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),ue=s=>R.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},R.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"}),R.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),oe=({onSuccess:s,onError:a,handleSetInLineAlert:i,orderData:h})=>{const[m,l]=v({id:"",email:"",...h}),[L,g]=v("products"),[_,f]=v(!0),[c,b]=v([]),[k,y]=v([]),[t,C]=v({taxIncluded:!1,taxExcluded:!1}),[e,u]=v([]),p=V([]);p.current.length!==c.length&&(p.current=c.map((n,o)=>p.current[o]||U())),T(()=>{const n=I.on("order/data",o=>{l(o);const O=J(o);u(O),f(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ne().then(n=>{if(!n)return;const o=z(n==null?void 0:n.shoppingCartDisplayPrice);C(o)})},[]),T(()=>{ee("RMA_ITEM").then(n=>{n!=null&&n.length&&(y(n),f(!1))})},[]);const E=F(n=>{b(o=>o.findIndex(d=>(d==null?void 0:d.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(d=>(d==null?void 0:d.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),S=F(n=>{g(n),i(),n==="products"&&b([])},[i]),N=F((n,o)=>{const O=c.map(d=>d.productSku===o?{...d,currentReturnOrderQuantity:n}:d);b(O)},[c]),w=F(async(n,o)=>{if(!o)return;f(!0);const O={orderUid:m.id,contactEmail:m.email},d=K(p);te({...O,items:d}).then(M=>{s==null||s(M),S("success"),i()}).catch(M=>{a==null||a(M.message),i({type:"error",heading:M.message})}),f(!1)},[S,a,s,i,m]);return{order:m,steps:L,loading:_,formsRef:p,taxConfig:t,attributesList:k,selectedProductList:c,itemsEligibleForReturn:e,handleSelectedProductList:E,handleSetQuantity:N,handleChangeStep:S,onSubmit:w}},le={success:ue,warning:ce,error:re},de=()=>{const[s,a]=v({type:"success",heading:""}),i=F(h=>{if(!(h!=null&&h.type)){a({type:"success",heading:""});return}const m=r(B,{source:le[h.type]});a({...h,icon:m})},[]);return{inLineAlertProps:s,handleSetInLineAlert:i}},Ae=({className:s,orderData:a,slots:i,onSuccess:h,onError:m,routeReturnSuccess:l,showConfigurableOptions:L})=>{const g=ie({headerText:"Order.CreateReturn.headerText",successTitle:"Order.CreateReturn.success.title",successMessage:"Order.CreateReturn.success.message",sender:"Order.CreateReturn.giftCard.sender",recipient:"Order.CreateReturn.giftCard.recipient",message:"Order.CreateReturn.giftCard.message",outOfStock:"Order.CreateReturn.stockStatus.outOfStock",nextStep:"Order.CreateReturn.buttons.nextStep",backStep:"Order.CreateReturn.buttons.backStep",submit:"Order.CreateReturn.buttons.submit",backStore:"Order.CreateReturn.buttons.backStore",downloadableCount:"Order.CreateReturn.downloadableCount",returnedItems:"Order.CreateReturn.returnedItems",configurationsListQuantity:"Order.CreateReturn.configurationsList.quantity"}),{inLineAlertProps:_,handleSetInLineAlert:f}=de(),{order:c,itemsEligibleForReturn:b,formsRef:k,taxConfig:y,attributesList:t,steps:C,loading:e,selectedProductList:u,handleSelectedProductList:p,handleSetQuantity:E,handleChangeStep:S,onSubmit:N}=oe({orderData:a,onSuccess:h,onError:m,handleSetInLineAlert:f});if(e)return r("div",{children:r(ae,{})});if(!e&&!t.length)return r("div",{});const w={products:r(he,{itemsEligibleForReturn:b,slots:i,translations:g,loading:e,taxConfig:y,selectedProductList:u,handleSelectedProductList:p,showConfigurableOptions:L,handleSetQuantity:E,handleChangeStep:S}),attributes:r(me,{slots:i,formsRef:k,loading:e,fieldsConfig:t,selectedProductList:u,handleChangeStep:S,translations:g,onSubmit:N}),success:r(pe,{translations:g,routeReturnSuccess:l,orderData:c}),error:null};return x("div",{className:A(["order-create-return",s]),children:[r(P,{title:g.headerText}),_.heading?r(H,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",..._}):null,w[C]]})},pe=({routeReturnSuccess:s,translations:a,orderData:i})=>x("div",{className:"order-return-order-message",children:[r("p",{className:"order-return-order-message__title",children:a.successTitle}),r("p",{className:"order-return-order-message__subtitle",children:a.successMessage}),r(Q,{href:(s==null?void 0:s(i))??"#",children:a.backStore})]}),he=({itemsEligibleForReturn:s,slots:a,loading:i,taxConfig:h,translations:m,selectedProductList:l,handleSelectedProductList:L,showConfigurableOptions:g,handleSetQuantity:_,handleChangeStep:f})=>x("ul",{className:"order-return-order-product-list",children:[s==null?void 0:s.map((c,b)=>{const{quantityReturnRequested:k,quantityShipped:y,eligibleForReturn:t}=c,C=l.some(p=>(p==null?void 0:p.productSku)===c.productSku&&c.eligibleForReturn),e=y===k&&t,u=y-k===0?k:y-k;return x("li",{className:A(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",e]]),children:[r($,{"data-testid":`key_${b}`,name:`key_${b}`,checked:C,disabled:e,onChange:()=>{L({...c,currentReturnOrderQuantity:1})}}),r(se,{loading:i,product:{...c,totalQuantity:u},itemType:"",taxConfig:h,translations:m,showConfigurableOptions:g,disabledIncrementer:!C,onQuantity:u>1?p=>{_(p,c.productSku)}:void 0}),r(q,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:a==null?void 0:a.ReturnOrderItem})]},c.id)}),r("li",{className:"order-return-order-product-list__item",children:r(Q,{type:"button",onClick:()=>f("attributes"),disabled:!l.length,children:m.nextStep})})]}),me=({slots:s,formsRef:a,selectedProductList:i,loading:h,fieldsConfig:m,translations:l,handleChangeStep:L,onSubmit:g})=>{const{formData:_,errors:f,formRef:c,handleChange:b,handleBlur:k,handleSubmit:y}=Z({fieldsConfig:X(m,i==null?void 0:i.length),onSubmit:g});return x("form",{className:"order-return-reason-form",ref:c,onSubmit:y,name:"returnReasonForm",children:[i.map((t,C)=>{var w,n,o,O,d;const e=t==null?void 0:t.giftCard,u=t==null?void 0:t.product,p=Y(m,C),E=`${t==null?void 0:t.id}_${C}`,S=(t==null?void 0:t.currentReturnOrderQuantity)??1,N={...t!=null&&t.currentReturnOrderQuantity?{[l.configurationsListQuantity]:S}:{},...t.configurableOptions||{},...t.bundleOptions||{},...e!=null&&e.senderName?{[l.sender]:e==null?void 0:e.senderName}:{},...e!=null&&e.senderEmail?{[l.sender]:e==null?void 0:e.senderEmail}:{},...e!=null&&e.recipientName?{[l.recipient]:e==null?void 0:e.recipientName}:{},...e!=null&&e.recipientEmail?{[l.recipient]:e==null?void 0:e.recipientEmail}:{},...e!=null&&e.message?{[l.message]:e==null?void 0:e.message}:{},...t!=null&&t.downloadableLinks?{[`${(w=t==null?void 0:t.downloadableLinks)==null?void 0:w.count} ${l.downloadableCount}`]:(n=t==null?void 0:t.downloadableLinks)==null?void 0:n.result}:{}};return x(G,{children:[r(W,{loading:h,title:r("div",{"data-testid":"product-name",children:(o=t==null?void 0:t.product)==null?void 0:o.name}),sku:r("div",{children:u==null?void 0:u.sku}),image:r(j,{src:((O=u==null?void 0:u.thumbnail)==null?void 0:O.url)??"",alt:((d=u==null?void 0:u.thumbnail)==null?void 0:d.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:N}),r("form",{name:E,ref:a==null?void 0:a.current[C],"data-quantity":S,children:r(D,{className:"className",loading:h,fields:p,onChange:b,onBlur:k,errors:f,values:_})})]},t.id)}),r(q,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:s==null?void 0:s.ReturnFormActions,context:{handleChangeStep:L},children:x("div",{className:"order-return-reason-form__actions",children:[r(Q,{variant:"secondary",type:"button",onClick:()=>{L("products")},children:l.backStep}),r(Q,{children:l.submit})]})})]})};export{Ae as CreateReturn,Ae as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2024 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as r,jsxs as c,Fragment as L}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as T,classes as _}from"@dropins/tools/lib.js";import{useState as k,useEffect as E,useCallback as B
|
|
3
|
+
import{jsx as r,jsxs as c,Fragment as L}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as T,classes as _}from"@dropins/tools/lib.js";import{useMemo as S,useState as k,useEffect as E,useCallback as B}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as z}from"@dropins/tools/event-bus.js";import{c as F}from"../chunks/convertCase.js";import{g as q}from"../chunks/getAttributesForm.js";import{Icon as K,Price as G,Card as J,Header as Q}from"@dropins/tools/components.js";import{f as U}from"../chunks/returnOrdersHelper.js";import{f as X}from"../chunks/formatDateToLocale.js";import"../chunks/ShippingStatusCard.js";import*as u from"@dropins/tools/preact-compat.js";import{D as Y}from"../chunks/OrderLoaders.js";import{Text as ee,useText as te}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/getFormValues.js";const re=i=>u.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),ne=i=>u.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.00718 5H22.1507C22.7047 5 23.1579 5.45323 23.1579 6.00718V7.51794C23.1579 7.51794 1.01007 7.58844 1 7.55823V6.00718C1 5.45323 1.45323 5 2.00718 5Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M23.1579 9.78409V18.3451C23.1579 18.899 22.7047 19.3523 22.1507 19.3523H2.00718C1.45323 19.3523 1 18.899 1 18.3451V9.78409H23.1579Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M3.01465 15.9682H8.40305",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.6192 17.5897C18.4535 17.5897 19.1299 16.9133 19.1299 16.0789C19.1299 15.2446 18.4535 14.5682 17.6192 14.5682C16.7848 14.5682 16.1084 15.2446 16.1084 16.0789C16.1084 16.9133 16.7848 17.5897 17.6192 17.5897Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8848 17.5897C20.7192 17.5897 21.3956 16.9133 21.3956 16.0789C21.3956 15.2446 20.7192 14.5682 19.8848 14.5682C19.0504 14.5682 18.374 15.2446 18.374 16.0789C18.374 16.9133 19.0504 17.5897 19.8848 17.5897Z",stroke:"currentColor",strokeWidth:1})),O=(i,e)=>{var d;const m=o=>{const s=Array.isArray(o.value)?o.value.join(" "):o==null?void 0:o.value;return o.label?`${o.label}: ${s}`:s};return(d=i[e])==null?void 0:d.map((o,s)=>r("p",{children:m(o)},`${o.value}${s}`))},oe=i=>{var s,t;const e=i&&i.length>0,m=e?(s=i[0])==null?void 0:s.name:"",d=e?(t=i[0])==null?void 0:t.code:"";return{selectedPaymentMethod:m,selectedPaymentMethodCode:d,hasToDisplayPaymentMethod:e&&m!==""}},ie=({loading:i,order:e,withHeader:m=!0,title:d,paymentIconsMap:o={},normalizeAddress:s,translations:t,slots:l})=>{var D,M,A,N;const g=!!(e!=null&&e.returnNumber),n=(D=e==null?void 0:e.returns)==null?void 0:D[0],h=S(()=>({checkmo:re,card:ne,...o}),[o]);if(!e||i)return r(Y,{});const a=(e==null?void 0:e.email)??"",p=(M=e==null?void 0:e.shipping)==null?void 0:M.code,f=(A=e==null?void 0:e.shipping)==null?void 0:A.amount,w=(N=e==null?void 0:e.shipping)==null?void 0:N.currency,x=e==null?void 0:e.payments,{selectedPaymentMethod:P,selectedPaymentMethodCode:y,hasToDisplayPaymentMethod:H}=oe(x),v=h[y],C=O(s,"shippingAddress")??[],b=O(s,"billingAddress")??[],I=c("div",{className:"order-customer-details-content__container-email",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.emailTitle}),r("p",{children:a})]}),V=g?c("div",{className:"order-customer-details-content__container-return-information","data-testid":"returnDetailsBlock",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.returnInformationTitle}),r("div",{className:"order-customer-details-content__container-description",children:r(T,{"data-testid":"OrderReturnInformation",name:"OrderReturnInformation",slot:l==null?void 0:l.OrderReturnInformation,context:n,children:c(L,{children:[c("p",{children:[t.createdReturnAt,r("span",{children:X(n==null?void 0:n.createdReturnAt)})]}),c("p",{children:[t.returnStatusLabel,r(ee,{id:`Order.CustomerDetails.returnStatus.${U(n==null?void 0:n.returnStatus)}`})]}),c("p",{children:[t.orderNumberLabel,r("span",{children:n==null?void 0:n.orderNumber})]})]})})})]}):null,W=C.length?c("div",{className:"order-customer-details-content__container-shipping_address",children:[r("div",{className:"order-customer-details-content__container-title",children:t.shippingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:C})]}):null,j=b.length?c("div",{className:_(["order-customer-details-content__container-billing_address",["order-customer-details-content__container-billing_address--fullwidth",!C.length]]),children:[r("div",{className:"order-customer-details-content__container-title",children:t.billingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:b})]}):null,R=H?c("div",{className:_(["order-customer-details-content__container-payment_methods",["order-customer-details-content__container-payment_methods--fullwidth",!p]]),children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.paymentMethodsTitle}),c("p",{"data-testid":"payment_methods_description",className:_([["order-customer-details-content__container-payment_methods--icon",!!v]]),children:[r(T,{"data-testid":"PaymentMethodIcon",name:"PaymentMethodIcon",slot:l==null?void 0:l.PaymentMethodIcon,context:{selectedPaymentMethodCode:y},children:v?r(K,{source:v}):null}),P]})]}):null,Z=p?c("div",{className:"order-customer-details-content__container-shipping_methods",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.shippingMethodsTitle}),f?c("p",{"data-testid":"shipping_methods_price",children:[r(G,{amount:f,currency:w})," ",p]}):r("p",{"data-testid":"shipping_methods_placeholder",children:t==null?void 0:t.freeShipping})]}):null,$=g?V:c(L,{children:[j,Z,R]});return c(J,{"data-testid":"order-details",variant:"secondary",className:_(["order-customer-details-content"]),children:[m?r(Q,{title:d??(t==null?void 0:t.headerText)}):null,c("div",{className:_(["order-customer-details-content__container",["order-customer-details-content__container--no-margin",C.length||b.length]]),children:[I,W,$]})]})},se=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],ce=({orderData:i})=>{const[e,m]=k(!0),[d,o]=k(i),[s,t]=k([]);E(()=>{const n=z.on("order/data",h=>{o(h)},{eager:!0});return()=>{n==null||n.off()}},[]),E(()=>{q("shortRequest").then(n=>{if(n){const h=n.map(({name:a,orderNumber:p,label:f})=>({name:F(a),orderNumber:p,label:se.includes(a)?null:f}));t(h)}}).finally(()=>{m(!1)})},[]);const l=B(n=>{if(!s.length||!d||!d[n])return[];const h=Object.fromEntries(Object.entries(d[n]).map(([a,p])=>[a.toLowerCase(),p]));return s.filter(({name:a})=>h[a.toLowerCase()]).map(a=>({name:a.name,orderNumber:a.orderNumber,value:h[a.name.toLowerCase()],label:a.label}))},[s,d]),g=S(()=>({billingAddress:l("billingAddress"),shippingAddress:l("shippingAddress")}),[l]);return{order:d,normalizeAddress:g,loading:e}},Ne=({paymentIconsMap:i,orderData:e,title:m,className:d,slots:o})=>{const s=te({emailTitle:"Order.CustomerDetails.email.title",shippingAddressTitle:"Order.CustomerDetails.shippingAddress.title",shippingMethodsTitle:"Order.CustomerDetails.shippingMethods.title",billingAddressTitle:"Order.CustomerDetails.billingAddress.title",paymentMethodsTitle:"Order.CustomerDetails.paymentMethods.title",returnInformationTitle:"Order.CustomerDetails.returnInformation.title",headerText:"Order.CustomerDetails.headerText",freeShipping:"Order.CustomerDetails.freeShipping",createdReturnAt:"Order.CustomerDetails.orderReturnLabels.createdReturnAt",orderNumberLabel:"Order.CustomerDetails.orderReturnLabels.orderNumberLabel",returnStatusLabel:"Order.CustomerDetails.orderReturnLabels.returnStatusLabel"}),{order:t,normalizeAddress:l,loading:g}=ce({orderData:e});return r("div",{className:_(["order-customer-details",d]),children:r(ie,{slots:o,loading:g,order:t,title:m,paymentIconsMap:i,normalizeAddress:l,translations:s})})};export{Ne as CustomerDetails,Ne as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2024 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{O as C,O as F}from"../chunks/OrderCancelForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/
|
|
3
|
+
import{O as C,O as F}from"../chunks/OrderCancelForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/transform-customer-orders-returns.js";import"../chunks/convertCase.js";import"../chunks/getGuestOrder.graphql.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";export{C as OrderCancelForm,F as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2024 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as i,jsx as c,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{classes as H}from"@dropins/tools/lib.js";import{useState as g,useEffect as T}from"@dropins/tools/preact-hooks.js";import{events as V}from"@dropins/tools/event-bus.js";import{s as C}from"../chunks/setTaxStatus.js";import{g as N}from"../chunks/getStoreConfig.js";import"@dropins/tools/preact.js";import{Price as d,Icon as f,Accordion as b,AccordionSection as E,Card as D,Header as k}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import*as x from"@dropins/tools/preact-compat.js";import{O as z}from"../chunks/OrderLoaders.js";import{useText as B}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const I=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",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),A=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",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),$=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:"M22 6.25H22.75C22.75 5.83579 22.4142 5.5 22 5.5V6.25ZM22 9.27L22.2514 9.97663C22.5503 9.87029 22.75 9.58731 22.75 9.27H22ZM20.26 12.92L19.5534 13.1714L19.5539 13.1728L20.26 12.92ZM22 14.66H22.75C22.75 14.3433 22.551 14.0607 22.2528 13.9539L22 14.66ZM22 17.68V18.43C22.4142 18.43 22.75 18.0942 22.75 17.68H22ZM2 17.68H1.25C1.25 18.0942 1.58579 18.43 2 18.43V17.68ZM2 14.66L1.74865 13.9534C1.44969 14.0597 1.25 14.3427 1.25 14.66H2ZM3.74 11.01L4.44663 10.7586L4.44611 10.7572L3.74 11.01ZM2 9.27H1.25C1.25 9.58675 1.44899 9.86934 1.7472 9.97611L2 9.27ZM2 6.25V5.5C1.58579 5.5 1.25 5.83579 1.25 6.25H2ZM21.25 6.25V9.27H22.75V6.25H21.25ZM21.7486 8.56337C19.8706 9.23141 18.8838 11.2889 19.5534 13.1714L20.9666 12.6686C20.5762 11.5711 21.1494 10.3686 22.2514 9.97663L21.7486 8.56337ZM19.5539 13.1728C19.9195 14.1941 20.7259 15.0005 21.7472 15.3661L22.2528 13.9539C21.6541 13.7395 21.1805 13.2659 20.9661 12.6672L19.5539 13.1728ZM21.25 14.66V17.68H22.75V14.66H21.25ZM22 16.93H2V18.43H22V16.93ZM2.75 17.68V14.66H1.25V17.68H2.75ZM2.25135 15.3666C4.12941 14.6986 5.11623 12.6411 4.44663 10.7586L3.03337 11.2614C3.42377 12.3589 2.85059 13.5614 1.74865 13.9534L2.25135 15.3666ZM4.44611 10.7572C4.08045 9.73588 3.27412 8.92955 2.2528 8.56389L1.7472 9.97611C2.34588 10.1905 2.81955 10.6641 3.03389 11.2628L4.44611 10.7572ZM2.75 9.27V6.25H1.25V9.27H2.75ZM2 7H22V5.5H2V7ZM7.31 6.74V18.17H8.81V6.74H7.31ZM17.0997 8.39967L11.0397 14.4597L12.1003 15.5203L18.1603 9.46033L17.0997 8.39967ZM12.57 9.67C12.57 9.87231 12.4159 10 12.27 10V11.5C13.2839 11.5 14.07 10.6606 14.07 9.67H12.57ZM12.27 10C12.1241 10 11.97 9.87231 11.97 9.67H10.47C10.47 10.6606 11.2561 11.5 12.27 11.5V10ZM11.97 9.67C11.97 9.46769 12.1241 9.34 12.27 9.34V7.84C11.2561 7.84 10.47 8.67938 10.47 9.67H11.97ZM12.27 9.34C12.4159 9.34 12.57 9.46769 12.57 9.67H14.07C14.07 8.67938 13.2839 7.84 12.27 7.84V9.34ZM17.22 14.32C17.22 14.5223 17.0659 14.65 16.92 14.65V16.15C17.9339 16.15 18.72 15.3106 18.72 14.32H17.22ZM16.92 14.65C16.7741 14.65 16.62 14.5223 16.62 14.32H15.12C15.12 15.3106 15.9061 16.15 16.92 16.15V14.65ZM16.62 14.32C16.62 14.1177 16.7741 13.99 16.92 13.99V12.49C15.9061 12.49 15.12 13.3294 15.12 14.32H16.62ZM16.92 13.99C17.0659 13.99 17.22 14.1177 17.22 14.32H18.72C18.72 13.3294 17.9339 12.49 16.92 12.49V13.99Z",fill:"#3D3D3D"})),j=({orderData:e})=>{const[a,t]=g(!0),[n,l]=g(e),[r,m]=g(null);return T(()=>{N().then(u=>{if(u){const{shoppingCartDisplayPrice:o,shoppingOrdersDisplayShipping:s,shoppingOrdersDisplaySubtotal:y,...h}=u;m(p=>({...p,...h,shoppingCartDisplayPrice:C(o),shoppingOrdersDisplayShipping:C(s),shoppingOrdersDisplaySubtotal:C(y)}))}}).finally(()=>{t(!1)})},[]),T(()=>{const u=V.on("order/data",o=>{l(o)},{eager:!0});return()=>{u==null||u.off()}},[]),{loading:a,storeConfig:r,order:n}},P=({translations:e,order:a,subTotalValue:t,shoppingOrdersDisplaySubtotal:n})=>{var l,r;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(l=a==null?void 0:a.subtotal)==null?void 0:l.currency,amount:t})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[!n.taxExcluded&&n.taxIncluded?c("span",{children:e.incl}):null,n.taxExcluded&&n.taxIncluded?i(S,{children:[c(d,{currency:(r=a==null?void 0:a.subtotal)==null?void 0:r.currency,amount:t,size:"small"})," ",c("span",{children:e.excl})]}):null]})]})},W=({translations:e,shoppingOrdersDisplayShipping:a,order:t,totalShipping:n})=>{var l,r,m,u;return t!=null&&t.isVirtual?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--shipping",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.shipping}),(l=t==null?void 0:t.totalShipping)!=null&&l.value?c(d,{weight:"normal",currency:(r=t==null?void 0:t.totalShipping)==null?void 0:r.currency,amount:n}):c("span",{children:e.freeShipping})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[a.taxIncluded&&a.taxExcluded?i(S,{children:[c(d,{weight:"normal",currency:(m=t==null?void 0:t.totalShipping)==null?void 0:m.currency,amount:(u=t==null?void 0:t.totalShipping)==null?void 0:u.value,size:"small"}),i("span",{children:[" ",e.excl]})]}):null,a.taxIncluded&&!a.taxExcluded?c("span",{children:e.incl}):null]})]})},q=({translations:e,order:a,totalGiftcardValue:t,totalGiftcardCurrency:n})=>{var r,m,u,o;const l=(r=a==null?void 0:a.discounts)==null?void 0:r.every(s=>s.amount.value===0);return!((m=a==null?void 0:a.discounts)!=null&&m.length)&&(l||!t||t<1)||(u=a==null?void 0:a.discounts)!=null&&u.length&&l?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--discount",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.discount}),c("span",{children:(o=a==null?void 0:a.discounts)==null?void 0:o.map(({amount:s},y)=>{const p=((s==null?void 0:s.value)??0)+t;return p===0?null:c(d,{weight:"normal",sale:!0,currency:s==null?void 0:s.currency,amount:-p},`${s==null?void 0:s.value}${y}`)})})]}),t>0?i("div",{className:"order-cost-summary-content__description--subheader",children:[i("span",{children:[c(f,{source:$,size:"16"}),c("span",{children:e.discountSubtitle.toLocaleUpperCase()})]}),c(d,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},F=({order:e})=>{var a;return c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--coupon",children:(a=e==null?void 0:e.coupons)==null?void 0:a.map((t,n)=>i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:t.code}),c("span",{children:"TBD"})]},`${t==null?void 0:t.code}${n}`))})},U=({translations:e,renderTaxAccordion:a,totalAccordionTaxValue:t,order:n})=>{var m,u,o;const[l,r]=g(!1);return a?c(b,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:I,iconClose:A,children:i(E,{onStateChange:r,title:e.accordionTitle,secondaryText:c(S,{children:l?null:c(d,{weight:"normal",amount:t,currency:(u=n==null?void 0:n.totalTax)==null?void 0:u.currency})}),renderContentWhenClosed:!1,children:[(o=n==null?void 0:n.taxes)==null?void 0:o.map((s,y)=>{var h,p,_;return i("div",{className:"order-cost-summary-content__accordion-row",children:[c("p",{children:s==null?void 0:s.title}),c("p",{children:c(d,{weight:"normal",amount:(h=s==null?void 0:s.amount)==null?void 0:h.value,currency:(p=s==null?void 0:s.amount)==null?void 0:p.currency})})]},`${(_=s==null?void 0:s.amount)==null?void 0:_.value}${y}`)}),i("div",{className:"order-cost-summary-content__accordion-row order-cost-summary-content__accordion-total",children:[c("p",{children:e.accordionTotalTax}),c("p",{children:c(d,{weight:"normal",amount:t,currency:n.totalTax.currency,size:"medium"})})]})]})}):c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--tax",children:i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.tax}),c(d,{currency:(m=n==null?void 0:n.totalTax)==null?void 0:m.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},R=({translations:e,shoppingOrdersDisplaySubtotal:a,order:t})=>{var n,l,r,m;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--total",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.total}),c(d,{currency:(n=t==null?void 0:t.grandTotal)==null?void 0:n.currency,amount:(l=t==null?void 0:t.grandTotal)==null?void 0:l.value,weight:"bold",size:"medium"})]}),a.taxExcluded&&a.taxIncluded?i("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:e.totalExcludingTaxes}),c(d,{currency:(r=t==null?void 0:t.grandTotal)==null?void 0:r.currency,amount:((m=t==null?void 0:t.grandTotal)==null?void 0:m.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},G=({translations:e,loading:a,storeConfig:t,order:n,withHeader:l=!0})=>{var h,p,_,O,w,L;if(a||!n)return c(z,{});const r=((h=n==null?void 0:n.totalGiftcard)==null?void 0:h.value)??0,m=((p=n.totalGiftcard)==null?void 0:p.currency)??"",u=((_=n.subtotal)==null?void 0:_.value)??0,o=((O=n.totalShipping)==null?void 0:O.value)??0,s=!!((w=n==null?void 0:n.taxes)!=null&&w.length)&&(t==null?void 0:t.shoppingOrdersDisplayFullSummary),y=s?(L=n==null?void 0:n.taxes)==null?void 0:L.reduce((Z,v)=>{var M;return+((M=v==null?void 0:v.amount)==null?void 0:M.value)+Z},0):0;return i(D,{variant:"secondary",className:H(["order-cost-summary-content"]),children:[l?c(k,{title:e.headerText}):null,i("div",{className:"order-cost-summary-content__wrapper",children:[c(P,{translations:e,order:n,subTotalValue:u,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(W,{translations:e,order:n,totalShipping:o,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(q,{translations:e,order:n,totalGiftcardValue:r,totalGiftcardCurrency:m}),c(F,{order:n}),c(U,{order:n,translations:e,renderTaxAccordion:s,totalAccordionTaxValue:y}),c(R,{translations:e,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})},rt=({withHeader:e,orderData:a,children:t,className:n,...l})=>{const{loading:r,storeConfig:m,order:u}=j({orderData:a}),o=B({subtotal:"Order.OrderCostSummary.subtotal.title",shipping:"Order.OrderCostSummary.shipping.title",freeShipping:"Order.OrderCostSummary.shipping.freeShipping",tax:"Order.OrderCostSummary.tax.title",incl:"Order.OrderCostSummary.tax.incl",excl:"Order.OrderCostSummary.tax.excl",discount:"Order.OrderCostSummary.discount.title",discountSubtitle:"Order.OrderCostSummary.discount.subtitle",total:"Order.OrderCostSummary.total.title",accordionTitle:"Order.OrderCostSummary.tax.accordionTitle",accordionTotalTax:"Order.OrderCostSummary.tax.accordionTotalTax",totalExcludingTaxes:"Order.OrderCostSummary.tax.totalExcludingTaxes",headerText:"Order.OrderCostSummary.headerText"});return c("div",{...l,className:H(["order-cost-summary",n]),children:c(G,{order:u,withHeader:e,loading:r,storeConfig:m,translations:o})})};export{rt as OrderCostSummary,rt as default};
|
|
3
|
+
import{jsx as c,jsxs as i,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{classes as H}from"@dropins/tools/lib.js";import{useState as g,useEffect as T}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as V}from"@dropins/tools/event-bus.js";import{s as C}from"../chunks/setTaxStatus.js";import{g as N}from"../chunks/getStoreConfig.js";import{Price as d,Icon as f,Accordion as b,AccordionSection as E,Card as D,Header as k}from"@dropins/tools/components.js";import"../chunks/ShippingStatusCard.js";import*as x from"@dropins/tools/preact-compat.js";import{O as z}from"../chunks/OrderLoaders.js";import{useText as B}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const I=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",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),A=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",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),$=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:"M22 6.25H22.75C22.75 5.83579 22.4142 5.5 22 5.5V6.25ZM22 9.27L22.2514 9.97663C22.5503 9.87029 22.75 9.58731 22.75 9.27H22ZM20.26 12.92L19.5534 13.1714L19.5539 13.1728L20.26 12.92ZM22 14.66H22.75C22.75 14.3433 22.551 14.0607 22.2528 13.9539L22 14.66ZM22 17.68V18.43C22.4142 18.43 22.75 18.0942 22.75 17.68H22ZM2 17.68H1.25C1.25 18.0942 1.58579 18.43 2 18.43V17.68ZM2 14.66L1.74865 13.9534C1.44969 14.0597 1.25 14.3427 1.25 14.66H2ZM3.74 11.01L4.44663 10.7586L4.44611 10.7572L3.74 11.01ZM2 9.27H1.25C1.25 9.58675 1.44899 9.86934 1.7472 9.97611L2 9.27ZM2 6.25V5.5C1.58579 5.5 1.25 5.83579 1.25 6.25H2ZM21.25 6.25V9.27H22.75V6.25H21.25ZM21.7486 8.56337C19.8706 9.23141 18.8838 11.2889 19.5534 13.1714L20.9666 12.6686C20.5762 11.5711 21.1494 10.3686 22.2514 9.97663L21.7486 8.56337ZM19.5539 13.1728C19.9195 14.1941 20.7259 15.0005 21.7472 15.3661L22.2528 13.9539C21.6541 13.7395 21.1805 13.2659 20.9661 12.6672L19.5539 13.1728ZM21.25 14.66V17.68H22.75V14.66H21.25ZM22 16.93H2V18.43H22V16.93ZM2.75 17.68V14.66H1.25V17.68H2.75ZM2.25135 15.3666C4.12941 14.6986 5.11623 12.6411 4.44663 10.7586L3.03337 11.2614C3.42377 12.3589 2.85059 13.5614 1.74865 13.9534L2.25135 15.3666ZM4.44611 10.7572C4.08045 9.73588 3.27412 8.92955 2.2528 8.56389L1.7472 9.97611C2.34588 10.1905 2.81955 10.6641 3.03389 11.2628L4.44611 10.7572ZM2.75 9.27V6.25H1.25V9.27H2.75ZM2 7H22V5.5H2V7ZM7.31 6.74V18.17H8.81V6.74H7.31ZM17.0997 8.39967L11.0397 14.4597L12.1003 15.5203L18.1603 9.46033L17.0997 8.39967ZM12.57 9.67C12.57 9.87231 12.4159 10 12.27 10V11.5C13.2839 11.5 14.07 10.6606 14.07 9.67H12.57ZM12.27 10C12.1241 10 11.97 9.87231 11.97 9.67H10.47C10.47 10.6606 11.2561 11.5 12.27 11.5V10ZM11.97 9.67C11.97 9.46769 12.1241 9.34 12.27 9.34V7.84C11.2561 7.84 10.47 8.67938 10.47 9.67H11.97ZM12.27 9.34C12.4159 9.34 12.57 9.46769 12.57 9.67H14.07C14.07 8.67938 13.2839 7.84 12.27 7.84V9.34ZM17.22 14.32C17.22 14.5223 17.0659 14.65 16.92 14.65V16.15C17.9339 16.15 18.72 15.3106 18.72 14.32H17.22ZM16.92 14.65C16.7741 14.65 16.62 14.5223 16.62 14.32H15.12C15.12 15.3106 15.9061 16.15 16.92 16.15V14.65ZM16.62 14.32C16.62 14.1177 16.7741 13.99 16.92 13.99V12.49C15.9061 12.49 15.12 13.3294 15.12 14.32H16.62ZM16.92 13.99C17.0659 13.99 17.22 14.1177 17.22 14.32H18.72C18.72 13.3294 17.9339 12.49 16.92 12.49V13.99Z",fill:"#3D3D3D"})),j=({orderData:e})=>{const[a,t]=g(!0),[n,l]=g(e),[r,m]=g(null);return T(()=>{N().then(u=>{if(u){const{shoppingCartDisplayPrice:o,shoppingOrdersDisplayShipping:s,shoppingOrdersDisplaySubtotal:y,...h}=u;m(p=>({...p,...h,shoppingCartDisplayPrice:C(o),shoppingOrdersDisplayShipping:C(s),shoppingOrdersDisplaySubtotal:C(y)}))}}).finally(()=>{t(!1)})},[]),T(()=>{const u=V.on("order/data",o=>{l(o)},{eager:!0});return()=>{u==null||u.off()}},[]),{loading:a,storeConfig:r,order:n}},rt=({withHeader:e,orderData:a,children:t,className:n,...l})=>{const{loading:r,storeConfig:m,order:u}=j({orderData:a}),o=B({subtotal:"Order.OrderCostSummary.subtotal.title",shipping:"Order.OrderCostSummary.shipping.title",freeShipping:"Order.OrderCostSummary.shipping.freeShipping",tax:"Order.OrderCostSummary.tax.title",incl:"Order.OrderCostSummary.tax.incl",excl:"Order.OrderCostSummary.tax.excl",discount:"Order.OrderCostSummary.discount.title",discountSubtitle:"Order.OrderCostSummary.discount.subtitle",total:"Order.OrderCostSummary.total.title",accordionTitle:"Order.OrderCostSummary.tax.accordionTitle",accordionTotalTax:"Order.OrderCostSummary.tax.accordionTotalTax",totalExcludingTaxes:"Order.OrderCostSummary.tax.totalExcludingTaxes",headerText:"Order.OrderCostSummary.headerText"});return c("div",{...l,className:H(["order-cost-summary",n]),children:c(G,{order:u,withHeader:e,loading:r,storeConfig:m,translations:o})})},P=({translations:e,order:a,subTotalValue:t,shoppingOrdersDisplaySubtotal:n})=>{var l,r;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(l=a==null?void 0:a.subtotal)==null?void 0:l.currency,amount:t})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[!n.taxExcluded&&n.taxIncluded?c("span",{children:e.incl}):null,n.taxExcluded&&n.taxIncluded?i(S,{children:[c(d,{currency:(r=a==null?void 0:a.subtotal)==null?void 0:r.currency,amount:t,size:"small"})," ",c("span",{children:e.excl})]}):null]})]})},W=({translations:e,shoppingOrdersDisplayShipping:a,order:t,totalShipping:n})=>{var l,r,m,u;return t!=null&&t.isVirtual?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--shipping",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.shipping}),(l=t==null?void 0:t.totalShipping)!=null&&l.value?c(d,{weight:"normal",currency:(r=t==null?void 0:t.totalShipping)==null?void 0:r.currency,amount:n}):c("span",{children:e.freeShipping})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[a.taxIncluded&&a.taxExcluded?i(S,{children:[c(d,{weight:"normal",currency:(m=t==null?void 0:t.totalShipping)==null?void 0:m.currency,amount:(u=t==null?void 0:t.totalShipping)==null?void 0:u.value,size:"small"}),i("span",{children:[" ",e.excl]})]}):null,a.taxIncluded&&!a.taxExcluded?c("span",{children:e.incl}):null]})]})},q=({translations:e,order:a,totalGiftcardValue:t,totalGiftcardCurrency:n})=>{var r,m,u,o;const l=(r=a==null?void 0:a.discounts)==null?void 0:r.every(s=>s.amount.value===0);return!((m=a==null?void 0:a.discounts)!=null&&m.length)&&(l||!t||t<1)||(u=a==null?void 0:a.discounts)!=null&&u.length&&l?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--discount",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.discount}),c("span",{children:(o=a==null?void 0:a.discounts)==null?void 0:o.map(({amount:s},y)=>{const p=((s==null?void 0:s.value)??0)+t;return p===0?null:c(d,{weight:"normal",sale:!0,currency:s==null?void 0:s.currency,amount:-p},`${s==null?void 0:s.value}${y}`)})})]}),t>0?i("div",{className:"order-cost-summary-content__description--subheader",children:[i("span",{children:[c(f,{source:$,size:"16"}),c("span",{children:e.discountSubtitle.toLocaleUpperCase()})]}),c(d,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},F=({order:e})=>{var a;return c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--coupon",children:(a=e==null?void 0:e.coupons)==null?void 0:a.map((t,n)=>i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:t.code}),c("span",{children:"TBD"})]},`${t==null?void 0:t.code}${n}`))})},U=({translations:e,renderTaxAccordion:a,totalAccordionTaxValue:t,order:n})=>{var m,u,o;const[l,r]=g(!1);return a?c(b,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:I,iconClose:A,children:i(E,{onStateChange:r,title:e.accordionTitle,secondaryText:c(S,{children:l?null:c(d,{weight:"normal",amount:t,currency:(u=n==null?void 0:n.totalTax)==null?void 0:u.currency})}),renderContentWhenClosed:!1,children:[(o=n==null?void 0:n.taxes)==null?void 0:o.map((s,y)=>{var h,p,_;return i("div",{className:"order-cost-summary-content__accordion-row",children:[c("p",{children:s==null?void 0:s.title}),c("p",{children:c(d,{weight:"normal",amount:(h=s==null?void 0:s.amount)==null?void 0:h.value,currency:(p=s==null?void 0:s.amount)==null?void 0:p.currency})})]},`${(_=s==null?void 0:s.amount)==null?void 0:_.value}${y}`)}),i("div",{className:"order-cost-summary-content__accordion-row order-cost-summary-content__accordion-total",children:[c("p",{children:e.accordionTotalTax}),c("p",{children:c(d,{weight:"normal",amount:t,currency:n.totalTax.currency,size:"medium"})})]})]})}):c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--tax",children:i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.tax}),c(d,{currency:(m=n==null?void 0:n.totalTax)==null?void 0:m.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},R=({translations:e,shoppingOrdersDisplaySubtotal:a,order:t})=>{var n,l,r,m;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--total",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.total}),c(d,{currency:(n=t==null?void 0:t.grandTotal)==null?void 0:n.currency,amount:(l=t==null?void 0:t.grandTotal)==null?void 0:l.value,weight:"bold",size:"medium"})]}),a.taxExcluded&&a.taxIncluded?i("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:e.totalExcludingTaxes}),c(d,{currency:(r=t==null?void 0:t.grandTotal)==null?void 0:r.currency,amount:((m=t==null?void 0:t.grandTotal)==null?void 0:m.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},G=({translations:e,loading:a,storeConfig:t,order:n,withHeader:l=!0})=>{var h,p,_,O,w,L;if(a||!n)return c(z,{});const r=((h=n==null?void 0:n.totalGiftcard)==null?void 0:h.value)??0,m=((p=n.totalGiftcard)==null?void 0:p.currency)??"",u=((_=n.subtotal)==null?void 0:_.value)??0,o=((O=n.totalShipping)==null?void 0:O.value)??0,s=!!((w=n==null?void 0:n.taxes)!=null&&w.length)&&(t==null?void 0:t.shoppingOrdersDisplayFullSummary),y=s?(L=n==null?void 0:n.taxes)==null?void 0:L.reduce((Z,v)=>{var M;return+((M=v==null?void 0:v.amount)==null?void 0:M.value)+Z},0):0;return i(D,{variant:"secondary",className:H(["order-cost-summary-content"]),children:[l?c(k,{title:e.headerText}):null,i("div",{className:"order-cost-summary-content__wrapper",children:[c(P,{translations:e,order:n,subTotalValue:u,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(W,{translations:e,order:n,totalShipping:o,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(q,{translations:e,order:n,totalGiftcardValue:r,totalGiftcardCurrency:m}),c(F,{order:n}),c(U,{order:n,translations:e,renderTaxAccordion:s,totalAccordionTaxValue:y}),c(R,{translations:e,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})};export{rt as OrderCostSummary,rt as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as u,jsxs as k}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/lib.js";import{Icon as O,Header as H,Button as d}from"@dropins/tools/components.js";import{useState as f,useEffect as p}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import*as c from"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{events as _}from"@dropins/tools/event-bus.js";import{b}from"../chunks/OrderLoaders.js";import{useText as w,Text as L}from"@dropins/tools/i18n.js";const V=e=>c.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},c.createElement("g",{clipPath:"url(#clip0_4797_15077)"},c.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.15 20.85L1.5 17.53V6.63L10.15 10V20.85Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),c.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.63001L10.15 3.20001L18.8 6.63001L10.15 10L1.5 6.63001Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),c.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.17969 4.77002L14.8297 8.15002V11.47",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),c.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.7896 12.64V6.63L10.1396 10V20.85L14.8296 19.05",stroke:"currentColor",strokeLinejoin:"round"}),c.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M15.71 17.26C15.71 15.38 17.23 13.86 19.11 13.86C20.99 13.86 22.51 15.38 22.51 17.26C22.51 19.14 20.99 20.66 19.11 20.66C17.23 20.66 15.71 19.14 15.71 17.26Z",stroke:"currentColor"}),c.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M17.4805 17.49L18.5605 18.41L20.7205 16.33",stroke:"currentColor",strokeLinecap:"square",strokeLinejoin:"round"})),c.createElement("defs",null,c.createElement("clipPath",{id:"clip0_4797_15077"},c.createElement("rect",{width:22,height:18.65,fill:"white",transform:"translate(1 2.70001)"}))));function s(e){var r;return{region:{region_id:e!=null&&e.regionId?Number(e==null?void 0:e.regionId):null,region:e==null?void 0:e.region},city:e==null?void 0:e.city,company:e==null?void 0:e.company,country_code:e==null?void 0:e.country,firstname:e==null?void 0:e.firstName,lastname:e==null?void 0:e.lastName,middlename:e==null?void 0:e.middleName,postcode:e==null?void 0:e.postCode,street:e==null?void 0:e.street,telephone:e==null?void 0:e.telephone,custom_attributesV2:((r=e==null?void 0:e.customAttributes)==null?void 0:r.map(i=>({attribute_code:i.code,value:i.value})))||[]}}const M=({orderData:e,handleEmailAvailability:r,handleSignUpClick:i})=>{const[t,N]=f(e),[l,v]=f(),[C,h]=f(r?void 0:!0),a=t==null?void 0:t.email,E=i&&t!==void 0&&l===!1&&C===!0?()=>{const o=t.shippingAddress,n=t.billingAddress,A=[{code:"email",defaultValue:t.email},{code:"firstname",defaultValue:(n==null?void 0:n.firstName)??""},{code:"lastname",defaultValue:(n==null?void 0:n.lastName)??""}];let m=[];if(o){const g={...s(o),default_shipping:!0};m=[{...s(n),default_billing:!0},g]}else m=[{...s(n),default_billing:!0,default_shipping:!0}];i({inputsDefaultValueSet:A,addressesData:m})}:void 0;return p(()=>{const o=_.on("authenticated",n=>{v(n)},{eager:!0});return()=>{o==null||o.off()}},[]),p(()=>{const o=_.on("order/data",n=>{N(n)},{eager:!0});return()=>{o==null||o.off()}},[]),p(()=>{r&&l!==void 0&&(l||!a||r(a).then(o=>h(o)).catch(()=>h(!0)))},[l,r,a]),{order:t,onSignUpClickHandler:E}},R=e=>{var t;const{order:r,onSignUpClickHandler:i}=M(e);return r?u(j,{customerName:(t=r.billingAddress)==null?void 0:t.firstName,onSignUpClick:i,orderNumber:r.number}):u(b,{})},j=({customerName:e,orderNumber:r,onSignUpClick:i})=>{const t=w({title:u(L,{id:"Order.OrderHeader.title",fields:{name:e}}),defaultTitle:"Order.OrderHeader.defaultTitle",order:u(L,{id:"Order.OrderHeader.order",fields:{order:r}}),createAccountMessage:"Order.OrderHeader.CreateAccount.message",createAccountButton:"Order.OrderHeader.CreateAccount.button"});return k("div",{"data-testid":"order-header",className:"order-header order-header__card",children:[u(O,{source:V,size:"64",className:"order-header__icon"}),u(H,{className:"order-header__title",title:t.title,size:"large",divider:!1,children:e?t.title:t.defaultTitle}),u("p",{className:"order-header__order",children:t.order}),i&&k("div",{className:"order-header-create-account",children:[u("p",{className:"order-header-create-account__message",children:t.createAccountMessage}),u(d,{"data-testid":"create-account-button",className:"order-header-create-account__button",size:"medium",variant:"secondary",type:"submit",onClick:i,children:t.createAccountButton})]})]})};export{R as OrderHeader,R as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2024 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as a,jsxs as P}from"@dropins/tools/preact-jsx-runtime.js";import{
|
|
3
|
+
import{jsx as a,jsxs as P}from"@dropins/tools/preact-jsx-runtime.js";import{classes as h}from"@dropins/tools/lib.js";import{Card as x,Header as q}from"@dropins/tools/components.js";import{useState as g,useEffect as L,useMemo as R}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{Fragment as T}from"@dropins/tools/preact.js";import{events as S}from"@dropins/tools/event-bus.js";import{s as b}from"../chunks/setTaxStatus.js";import{g as N}from"../chunks/getStoreConfig.js";import{a as Q}from"../chunks/OrderLoaders.js";import{C as k}from"../chunks/CartSummaryItem.js";import{useText as v}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const w=({orderData:s})=>{const[o,r]=g(!0),[d,n]=g(s),[t,i]=g({taxIncluded:!1,taxExcluded:!1});return L(()=>{N().then(e=>{if(e){const c=b(e==null?void 0:e.shoppingCartDisplayPrice);i(c)}}).finally(()=>{r(!1)})},[]),L(()=>{const e=S.on("order/data",c=>{n(c)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:o,taxConfig:t,order:d}},W=({className:s,orderData:o,withHeader:r,showConfigurableOptions:d,routeProductDetails:n})=>{const{loading:t,taxConfig:i,order:e}=w({orderData:o});return a("div",{className:h(["order-order-product-list",s]),children:a(I,{loading:t,taxConfig:i,order:e,withHeader:r,showConfigurableOptions:d,routeProductDetails:n})})},G=s=>{const o=(s==null?void 0:s.items)??[],r=o.filter(t=>(t==null?void 0:t.eligibleForReturn)&&(t==null?void 0:t.quantityReturnRequested)).map(t=>({...t,totalQuantity:t.quantityReturnRequested})),d=new Map(r.map(t=>[t.id,t])),n=o.map(t=>{const i=d.get(t==null?void 0:t.id);if(i){const e=t.totalQuantity-i.quantityReturnRequested;return e===0?null:{...t,totalQuantity:e}}return t}).filter(t=>t!==null);return{returnedList:r,canceledItems:n==null?void 0:n.filter(t=>t.quantityCanceled),nonCanceledItems:n==null?void 0:n.filter(t=>!t.quantityCanceled)}},I=({loading:s,taxConfig:o,order:r=null,withHeader:d=!0,showConfigurableOptions:n,routeProductDetails:t})=>{const i=!!(r!=null&&r.returnNumber),e=v({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),c=R(()=>{var m,p;if(!r)return[];if(!i){const{returnedList:u,canceledItems:f,nonCanceledItems:C}=G(r);return[{type:"returned",list:u,title:e.returned},{type:"cancelled",list:f,title:e.cancelled},{type:"allItems",list:C,title:e.allOrders}].filter(O=>{var y;return((y=O==null?void 0:O.list)==null?void 0:y.length)>0})}return[{type:"returned",list:((p=(m=r.returns.find(u=>u.returnNumber===(r==null?void 0:r.returnNumber)))==null?void 0:m.items)==null?void 0:p.map(u=>({...u,totalQuantity:u.requestQuantity})))??[],title:e.returned}]},[r,i,e]);return r?c.every(l=>l.list.length===0)?null:a(x,{variant:"secondary",className:"order-order-product-list-content",children:c.map((l,m)=>{var u;const p=l.list.reduce((f,{totalQuantity:C})=>C+f,0);return P(T,{children:[d?a(q,{title:`${l.title} (${p})`}):null,a("ul",{className:"order-order-product-list-content__items",children:(u=l.list)==null?void 0:u.map(f=>a("li",{"data-testid":"order-product-list-content-item",children:a(k,{loading:s,product:f,itemType:l.type,taxConfig:o,translations:e,showConfigurableOptions:n,routeProductDetails:t})},f.id))})]},m)})}):a(Q,{})};export{W as OrderProductList,W as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2024 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/
|
|
3
|
+
import{jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import{classes as c}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";import{useState as d,useEffect as R}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{events as L}from"@dropins/tools/event-bus.js";import{u as O}from"../chunks/useIsMobile.js";import{R as b}from"../chunks/ReturnsListContent.js";import{useText as g}from"@dropins/tools/i18n.js";import"../chunks/returnOrdersHelper.js";import"../chunks/getFormValues.js";import"../chunks/OrderLoaders.js";const w=({orderData:s})=>{const[i,n]=d(s),[u,o]=d([]);return R(()=>{const t=L.on("order/data",e=>{n(e),o(e==null?void 0:e.returns)},{eager:!0});return()=>{t==null||t.off()}},[]),{order:i,orderReturns:u}},v=({slots:s,className:i,orderData:n,withHeader:u,withThumbnails:o,routeReturnDetails:t,routeProductDetails:e,routeTracking:f})=>{const{orderReturns:m}=w({orderData:n}),l=O(),r="fullSizeView",p=g({minifiedViewTitle:`Order.Returns.${r}.returnsList.minifiedViewTitle`,ariaLabelLink:`Order.Returns.${r}.returnsList.ariaLabelLink`,emptyOrdersListMessage:`Order.Returns.${r}.returnsList.emptyOrdersListMessage`,orderNumber:`Order.Returns.${r}.returnsList.orderNumber`,returnNumber:`Order.Returns.${r}.returnsList.returnNumber`,carrier:`Order.Returns.${r}.returnsList.carrier`});return a("div",{className:c(["order-order-returns",i]),children:m.length?a(b,{pageInfo:{pageSize:1,totalPages:1,currentPage:1},minifiedViewKey:r,slots:s,isMobile:l,withOrderNumber:!1,withReturnNumber:!0,orderReturns:m,translations:p,withHeader:u,withThumbnails:o,minifiedView:!1,routeReturnDetails:t,routeProductDetails:e,routeTracking:f,loading:!1}):null})};export{v as OrderReturns,v as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2024 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
3
|
+
import{jsx as s,jsxs as V}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L}from"@dropins/tools/lib.js";import{Card as M,InLineAlert as k,Icon as C,Button as q}from"@dropins/tools/components.js";import{useState as v,useCallback as w,useEffect as F,useMemo as D}from"@dropins/tools/preact-hooks.js";import{F as U}from"../chunks/ShippingStatusCard.js";import*as _ from"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{events as N}from"@dropins/tools/event-bus.js";import{F as g,g as H}from"../chunks/getFormValues.js";import{r as f}from"../chunks/redirectTo.js";import{g as E,a as B}from"../chunks/getGuestOrder.js";import{useText as z,Text as T}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getGuestOrder.graphql.js";import"../chunks/transform-customer-orders-returns.js";import"../chunks/convertCase.js";const P=r=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},_.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),x=r=>{try{return new URL(window.location.href).searchParams.get(r)}catch{return null}},X=({onError:r,isAuth:t,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c})=>{const[y,u]=v({text:"",type:"success"}),[b,p]=v(!1),m=z({invalidSearch:"Order.Errors.invalidSearch",email:"Order.OrderSearchForm.email",lastname:"Order.OrderSearchForm.lastname",number:"Order.OrderSearchForm.orderNumber"}),R=w(async e=>{const l=x("orderRef"),o=l&&l.length>20;if(!e&&!l||!(e!=null&&e.number)&&!(e!=null&&e.token)&&!l)return null;if(t){const d=await E();(d==null?void 0:d.email)===e.email?f(i,{orderRef:e==null?void 0:e.number}):o||f(c,{orderRef:e.token})}else o||f(c,{orderRef:e==null?void 0:e.token})},[t,i,c]);F(()=>{const e=N.on("order/data",l=>{R(l)},{eager:!0});return()=>{e==null||e.off()}},[R]),F(()=>{const e=x("orderRef"),l=e&&e.length>20?e:null;e&&(l?f(c,{orderRef:e}):t?f(i,{orderRef:e}):a==null||a({render:!0,formValues:{number:e}}))},[t,i,c,a]);const O=D(()=>[{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.email,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.lastname,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:2,name:"lastname",id:"lastname",code:"lastname"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.number,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:3,name:"number",id:"number",code:"number"}],[m]);return{onSubmit:w(async(e,l)=>{if(!l)return null;p(!0);const o=H(e.target);await B(o).then(n=>{n||u({text:m.invalidSearch,type:"warning"}),N.emit("order/data",n)}).catch(async n=>{var S;let d=!0;r==null||r({error:n.message});const h=t?await E():{email:""};(h==null?void 0:h.email)===(o==null?void 0:o.email)?f(i,{orderRef:o.number}):d=a==null?void 0:a({render:h===null||((S=n==null?void 0:n.message)==null?void 0:S.includes("Please login to view the order.")),formValues:o}),d&&u({text:n.message,type:"warning"})}).finally(()=>{p(!1)})},[t,r,a,i,m.invalidSearch]),inLineAlert:y,loading:b,normalizeFieldsConfig:O}},me=({className:r,isAuth:t,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c,onError:y})=>{const{onSubmit:u,loading:b,inLineAlert:p,normalizeFieldsConfig:m}=X({onError:y,isAuth:t,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c});return s("div",{className:L(["order-order-search",r]),children:s(Z,{onSubmit:u,loading:b,inLineAlert:p,fieldsConfig:m})})},Z=({onSubmit:r,loading:t,inLineAlert:a,fieldsConfig:i})=>V(M,{variant:"secondary",className:"order-order-search-form",children:[s("h2",{className:"order-order-search-form__title",children:s(T,{id:"Order.OrderSearchForm.title"})}),s("p",{children:s(T,{id:"Order.OrderSearchForm.description"})}),a.text?s(k,{"data-testid":"orderAlert",className:"order-order-search-form__alert",type:a.type,variant:"secondary",heading:a.text,icon:s(C,{source:P})}):null,s(U,{className:"order-order-search-form__wrapper",name:"orderSearchForm",loading:t,fieldsConfig:i,onSubmit:r,children:s("div",{className:"order-order-search-form__button-container",children:s(q,{className:"order-order-search-form__button",size:"medium",variant:"primary",type:"submit",disabled:t,children:s(T,{id:"Order.OrderSearchForm.button"})},"logIn")})})]});export{me as OrderSearch,me as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2024 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as c,
|
|
3
|
+
import{jsx as c,Fragment as S,jsxs as N}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as F,classes as y}from"@dropins/tools/lib.js";import{Button as E,InLineAlert as P,Modal as G,Card as V,Header as K}from"@dropins/tools/components.js";import{useState as O,useEffect as v,useCallback as q}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import{useMemo as H,useState as W}from"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{events as I}from"@dropins/tools/event-bus.js";import{G as j}from"../chunks/getGuestOrder.graphql.js";import{f as J,h as z}from"../chunks/fetch-graphql.js";import{b as B}from"../chunks/transform-customer-orders-returns.js";import{useText as C,Text as x}from"@dropins/tools/i18n.js";import{C as Q}from"../chunks/OrderLoaders.js";import{f as X}from"../chunks/returnOrdersHelper.js";import{f as $}from"../chunks/formatDateToLocale.js";import{r as k}from"../chunks/redirectTo.js";import{g as Y}from"../chunks/getStoreConfig.js";import{O as Z}from"../chunks/OrderCancelForm.js";import{r as D}from"../chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";var _=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(_||{});const ee=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:i,onError:s})=>{const a=C({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=H(()=>{const d=t==null?void 0:t.availableActions,o=!!(d!=null&&d.length),m=!!(t!=null&&t.returnNumber),p=()=>{k(e,{},t)};return c(S,{children:n!=null&&n.OrderActions?c(F,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):c("div",{"data-testid":"availableActionsList",className:y(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!o]]),children:d==null?void 0:d.map(g=>{switch(g){case _.CANCEL:return c(S,{children:m?null:c(oe,{orderRef:(t==null?void 0:t.token)??(t==null?void 0:t.id)})});case _.RETURN:return c(E,{variant:"secondary",onClick:p,children:m?a.createAnotherReturn:a.createReturn});case _.REORDER:return c(S,{children:m?null:c(ie,{orderData:t,onError:s,routeOnSuccess:i,children:a.reorder})})}})})})},[s,t,i,e,n,a]);return c("div",{className:y(["order-order-actions",r]),children:l})},U=()=>{const[r,t]=O(null);return v(()=>{const n=sessionStorage.getItem("orderStoreConfig"),e=n?JSON.parse(n):null;e?t(e):Y().then(i=>{i&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(i)),t(i))})},[]),r},te=({orderData:r})=>{const[t,n]=O(r),[e,i]=O(r==null?void 0:r.status);return v(()=>{const s=I.on("order/data",a=>{n(a),i(a.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},re=`
|
|
4
4
|
mutation CONFIRM_CANCEL_ORDER_MUTATION(
|
|
5
5
|
$orderId: ID!,
|
|
6
6
|
$confirmationKey: String!
|
|
@@ -18,5 +18,5 @@ import{jsx as c,jsxs as N,Fragment as S}from"@dropins/tools/preact-jsx-runtime.j
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
${
|
|
22
|
-
`,
|
|
21
|
+
${j}
|
|
22
|
+
`,ne=async(r,t)=>J(re,{variables:{orderId:r,confirmationKey:t}}).then(async({errors:n,data:e})=>{var a,l,d,o;const i=[...(a=e==null?void 0:e.confirmCancelOrder)!=null&&a.errorV2?[(l=e==null?void 0:e.confirmCancelOrder)==null?void 0:l.errorV2]:[],...n??[]];let s=null;return(d=e==null?void 0:e.confirmCancelOrder)!=null&&d.order&&(s=B((o=e==null?void 0:e.confirmCancelOrder)==null?void 0:o.order),I.emit("order/data",s)),i.length>0?z(i):s}),se=({enableOrderCancellation:r})=>{const t=C({orderCancelled:"Order.OrderStatusContent.orderCanceled.message"}),[n,e]=O({text:"",status:void 0});return v(()=>{if(!r)return;const i=new URLSearchParams(window.location.search),s=i.get("order_id"),a=i.get("confirmation_key");s&&a&&ne(s,a).then(()=>{e({text:t.orderCancelled,status:"success"})}).catch(l=>{e({text:l.message,status:"warning"})})},[r,t.orderCancelled]),{confirmOrderCancellation:n}},be=({slots:r,orderData:t,className:n,statusTitle:e,status:i,routeCreateReturn:s,onError:a,routeOnSuccess:l})=>{const{orderStatus:d,order:o}=te({orderData:t}),[m,p]=W(!1),g=()=>{p(!0);const f=new URL(window.location.href),A=f.searchParams.get("order_id"),T=f.searchParams.get("confirmation_key");A&&T&&(f.searchParams.delete("order_id"),f.searchParams.delete("confirmation_key"),window.history.replaceState({},document.title,f.toString()))},h=C({cancelOrder:"Order.OrderStatusContent.actions.cancel"}),R=U(),{confirmOrderCancellation:u}=se({enableOrderCancellation:R==null?void 0:R.orderCancellationEnabled});return N("div",{className:y(["order-order-status",n]),children:[!m&&(u==null?void 0:u.status)!==void 0&&c(P,{heading:h.cancelOrder,onDismiss:g,description:u.text,type:u.status}),o?c(ce,{title:e,status:i||d,slots:r,orderData:o,routeCreateReturn:s,onError:a,routeOnSuccess:l}):c(Q,{withCard:!1})]})},oe=({orderRef:r})=>{const[t,n]=O(!1),e=()=>{n(!0)},i=()=>{n(!1)},s=U(),a=(s==null?void 0:s.orderCancellationReasons)??[],l=d=>d.map((o,m)=>({text:o==null?void 0:o.description,value:m.toString()}));return I.on("order/data",d=>{const o=String(d.status).toLocaleLowerCase();(o==="guest order cancellation requested"||o==="canceled")&&i()}),N(S,{children:[c(E,{variant:"secondary",onClick:e,"data-testid":"cancel-button",children:c(x,{id:"Order.OrderStatusContent.actions.cancel"})}),t&&c(G,{centered:!0,size:"medium",onClose:i,className:"order-order-cancel__modal",title:c("h2",{className:"order-order-cancel__title",children:c(x,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:c(Z,{orderRef:r,cancelReasons:l(a)})})]})},w={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested"},ce=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:i,onError:s,routeOnSuccess:a})=>{var M,L,b;const l=!!(e!=null&&e.returnNumber),d=String(n).toLocaleLowerCase(),o=(M=e==null?void 0:e.returns)==null?void 0:M[0],m=(o==null?void 0:o.returnStatus)??"",p=(o==null?void 0:o.createdReturnAt)??"",g=C(`Order.OrderStatusContent.${w[d]}.title`),h=C(`Order.OrderStatusContent.${w[d]}.message`),R=C(`Order.OrderStatusContent.${w[d]}.messageWithoutDate`),u=C({title:`Order.OrderStatusContent.returnStatus.${X(m)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return c("div",{});const f=e!=null&&e.orderStatusChangeDate?h==null?void 0:h.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):R.messageWithoutDate,A=((b=(L=u==null?void 0:u.returnMessage)==null?void 0:L.replace("{ORDER_CREATE_DATE}",$(e==null?void 0:e.orderDate)))==null?void 0:b.replace("{RETURN_CREATE_DATE}",$(p)))??"",T=l?t??u.title:t??g.title;return N(V,{className:"order-order-status-content",variant:"secondary",children:[c(K,{title:T}),N("div",{className:"order-order-status-content__wrapper",children:[c("div",{className:y(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:c("p",{children:l?A:f})}),c(ee,{orderData:e,slots:r,routeCreateReturn:i,routeOnSuccess:a,onError:s})]})]})},ie=({onError:r,routeOnSuccess:t,orderData:n,children:e})=>{const[i,s]=O(!1),a=q(()=>{s(!0);const l=n==null?void 0:n.number;D(l).then(({success:d,userInputErrors:o})=>{d&&k(t,{}),o.length&&(r==null||r(o))}).catch(d=>{r==null||r(d.message)}).finally(()=>{s(!1)})},[n,t,r]);return c(E,{type:"button",disabled:i,variant:"secondary",className:"order-reorder",onClick:a,children:e})};export{be as OrderStatus,be as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2024 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/
|
|
3
|
+
import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import{classes as $}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";import{useState as s,useEffect as h,useCallback as I}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{g as y}from"../chunks/getCustomerOrdersReturn.js";import{u as A}from"../chunks/useIsMobile.js";import{R as M}from"../chunks/ReturnsListContent.js";import{useText as T}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-customer-orders-returns.js";import"../chunks/convertCase.js";import"../chunks/returnOrdersHelper.js";import"../chunks/getFormValues.js";import"../chunks/OrderLoaders.js";const g={totalPages:1,currentPage:1,pageSize:1},V=({returnPageSize:t})=>{const[n,o]=s(!0),[i,u]=s([]),[a,m]=s(g),[d,l]=s(1);h(()=>{y(t).then(r=>{u((r==null?void 0:r.ordersReturn)??[]),m((r==null?void 0:r.pageInfo)??g)}).finally(()=>{o(!1)})},[t]);const c=I(r=>{l(r)},[]);return{pageInfo:a,selectedPage:d,loading:n,orderReturns:i,handleSetSelectPage:c}},Y=({slots:t,withReturnsListButton:n,className:o,minifiedView:i,withHeader:u,withThumbnails:a,returnPageSize:m,returnsInMinifiedView:d,routeReturnDetails:l,routeOrderDetails:c,routeTracking:r,routeReturnsList:p,routeProductDetails:L})=>{const{pageInfo:R,selectedPage:O,handleSetSelectPage:b,loading:w,orderReturns:N}=V({returnPageSize:m}),P=A(),e=i?"minifiedView":"fullSizeView",S=T({viewAllOrdersButton:`Order.Returns.${e}.returnsList.viewAllOrdersButton`,ariaLabelLink:`Order.Returns.${e}.returnsList.ariaLabelLink`,emptyOrdersListMessage:`Order.Returns.${e}.returnsList.emptyOrdersListMessage`,minifiedViewTitle:`Order.Returns.${e}.returnsList.minifiedViewTitle`,orderNumber:`Order.Returns.${e}.returnsList.orderNumber`,returnNumber:`Order.Returns.${e}.returnsList.returnNumber`,carrier:`Order.Returns.${e}.returnsList.carrier`});return f("div",{className:$(["order-returns-list",o]),children:f(M,{minifiedViewKey:e,withOrderNumber:!0,withReturnNumber:!0,slots:t,selectedPage:O,handleSetSelectPage:b,pageInfo:R,withReturnsListButton:n,isMobile:P,orderReturns:N,translations:S,withHeader:u,returnsInMinifiedView:d,withThumbnails:a,minifiedView:i,routeReturnDetails:l,routeOrderDetails:c,routeTracking:r,routeReturnsList:p,routeProductDetails:L,loading:w})})};export{Y as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2024 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as i,jsxs as S,Fragment as a}from"@dropins/tools/preact-jsx-runtime.js";import{classes as _,VComponent as A,Slot as E}from"@dropins/tools/lib.js";import{Card as L,Header as w,Accordion as R,AccordionSection as q,ContentGrid as G,Image as V}from"@dropins/tools/components.js";import
|
|
3
|
+
import{jsx as i,jsxs as S,Fragment as a}from"@dropins/tools/preact-jsx-runtime.js";import{classes as _,VComponent as A,Slot as E}from"@dropins/tools/lib.js";import{Card as L,Header as w,Accordion as R,AccordionSection as q,ContentGrid as G,Image as V}from"@dropins/tools/components.js";import{useState as x,useEffect as k}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{events as D}from"@dropins/tools/event-bus.js";import{C as nn}from"../chunks/OrderLoaders.js";import{u as en}from"../chunks/useIsMobile.js";import{Text as B,useText as pn}from"@dropins/tools/i18n.js";var M=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(M||{});const tn=({orderData:e})=>{const[l,n]=x(!0),[t,m]=x(e),[h,f]=x(!1);return k(()=>{const u=D.on("order/data",d=>{m(d),f(d==null?void 0:d.isVirtual),n(!1)},{eager:!0});return e!=null&&e.id&&n(!1),()=>{u==null||u.off()}},[e]),{loading:l,order:t,isVirtualProduct:h}},v=({value:e,variant:l="primary",size:n="medium",icon:t,className:m,children:h,disabled:f=!1,active:u=!1,activeChildren:d,activeIcon:p,href:C,...b})=>{let g="dropin-button";(t&&!h||t&&u&&!d||!t&&u&&p)&&(g="dropin-iconButton"),u&&d&&(g="dropin-button"),m=_([g,`${g}--${n}`,`${g}--${l}`,[`${g}--${l}--disabled`,f],h&&t&&`${g}--with-icon`,!h&&d&&t&&`${g}--with-icon`,u&&p&&`${g}--with-icon`,m]);const c=_(["dropin-button-icon",`dropin-button-icon--${l}`,[`dropin-button-icon--${l}--disabled`,f],t==null?void 0:t.props.className]),y=C?{node:i("a",{}),role:"link",href:C,...b,disabled:f,active:u,onKeyDown:I=>{f&&I.preventDefault()},tabIndex:f?-1:0}:{node:i("button",{}),role:"button",...b,value:e,disabled:f,active:u};return S(A,{...y,className:m,children:[t&&!u&&i(A,{node:t,className:c}),p&&u&&i(A,{node:p,className:c}),h&&!u&&(typeof h=="string"?i("span",{children:h}):h),u&&d&&(typeof d=="string"?i("span",{children:d}):d)]})},sn=({slots:e,collapseThreshold:l,translations:n,returnData:t,routeTracking:m,routeProductDetails:h})=>{var d;const f=en(),u=h?"a":"span";return S(L,{variant:"secondary",className:_(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[i(w,{title:n.returnOrderCardTitle}),S("div",{children:[(d=t==null?void 0:t.tracking)==null?void 0:d.map((p,C)=>{var y,I;const b={title:"",number:(p==null?void 0:p.trackingNumber)??"",carrier:((y=p==null?void 0:p.carrier)==null?void 0:y.label)??""},g=m==null?void 0:m(b),c=g?()=>{window.open(g,"_blank","noreferrer")}:null;return S("div",{className:"order-shipping-status-card__header",children:[S("div",{children:[`${n.carrier} `,`${(I=b.carrier)==null?void 0:I.toLocaleUpperCase()} | `,b.number]}),c?i(v,{onClick:c,children:n.trackButton}):null]},`${b.number}_${C}`)}),e!=null&&e.ReturnItemsDetails?i(E,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:t.items}}):null,i(R,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(q,{defaultOpen:l>=t.items.length,title:i(B,{id:"Order.ShippingStatusCard.itemText",plural:t.items.reduce((p,C)=>p+C.requestQuantity,0),fields:{count:t.items.reduce((p,C)=>p+C.requestQuantity,0)}}),children:i(G,{maxColumns:f?3:9,emptyGridContent:i(a,{}),className:_(["order-shipping-status-card__images",["order-shipping-status-card__images-3",f]]),children:t.items.map((p,C)=>{var c,y;const b=(c=p.thumbnail)==null?void 0:c.label,g=(y=p.thumbnail)==null?void 0:y.url;return i(u,{href:(h==null?void 0:h(p))??"#","data-testid":`${C}${p.uid}`,children:i(V,{alt:b,src:g,width:85,height:114})},`${C}${p.uid}`)})})})})]})]})},ln=({translations:e,slots:l,orderData:n,collapseThreshold:t=10,routeProductDetails:m,routeTracking:h})=>{var I,U,H,j,F,Q,K;const f=!!(n!=null&&n.returnNumber),u=n==null?void 0:n.returnNumber,d=m?"a":"span",p=(I=n==null?void 0:n.status)==null?void 0:I.toLocaleLowerCase(),b=((U=n==null?void 0:n.shipments)==null?void 0:U.length)===1&&(p==null?void 0:p.includes(M.COMPLETE)),g=(H=n==null?void 0:n.shipments)==null?void 0:H.every(s=>s.tracking.length===0),c=(j=n==null?void 0:n.items)==null?void 0:j.filter(s=>(s==null?void 0:s.quantityShipped)===0||(s==null?void 0:s.quantityShipped)<(s==null?void 0:s.quantityOrdered)),y=(F=n==null?void 0:n.items)==null?void 0:F.reduce((s,o)=>{const N=o.quantityOrdered-o.quantityShipped;return s+(N>0?N:0)},0);if(f&&(n!=null&&n.returns.length)){const s=n.returns.find(o=>o.returnNumber===u);return!s||s.tracking.length===0?null:i(sn,{slots:l,collapseThreshold:t,translations:e,returnData:s,routeTracking:h,routeProductDetails:m})}return!n||p!=null&&p.includes(M.CANCELED)?null:(Q=n==null?void 0:n.shipments)!=null&&Q.length?g&&!(c!=null&&c.length)&&b?null:S(a,{children:[(K=n==null?void 0:n.shipments)==null?void 0:K.map(({tracking:s,items:o,id:N},P)=>{const W=o.reduce((r,O)=>r+((O==null?void 0:O.quantityShipped)??0),0);return S(L,{variant:"secondary",className:"order-shipping-status-card",children:[i(w,{title:e.shippingCardTitle}),s==null?void 0:s.map(r=>{var T;const O=h==null?void 0:h(r),$=O?()=>{window.open(O,"_blank","noreferrer")}:null;return S("div",{className:"order-shipping-status-card__header",role:"status",children:[S("div",{className:"order-shipping-status-card__header--content",children:[S("p",{children:[e.carrier," ",(T=r==null?void 0:r.carrier)==null?void 0:T.toLocaleUpperCase()," | ",r==null?void 0:r.number]}),i("p",{children:r==null?void 0:r.title})]}),l!=null&&l.DeliveryTrackActions?i(E,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:l==null?void 0:l.DeliveryTrackActions,context:{trackInformation:r}}):$?i(v,{onClick:$,children:e.trackButton}):null]},r.number)}),b?null:i(R,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(q,{"data-position":P+1,defaultOpen:t>=(o==null?void 0:o.length),title:i(B,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:W,fields:{count:W}}),children:i(G,{maxColumns:6,emptyGridContent:i(a,{}),className:"order-shipping-status-card__images",children:o==null?void 0:o.map(r=>{var T,Y,z,J,X,Z;const O=(z=(Y=(T=r==null?void 0:r.orderItem)==null?void 0:T.product)==null?void 0:Y.thumbnail)==null?void 0:z.label,$=(Z=(X=(J=r==null?void 0:r.orderItem)==null?void 0:J.product)==null?void 0:X.thumbnail)==null?void 0:Z.url;return i(d,{href:(m==null?void 0:m(r))??"#",children:i(V,{alt:O,src:$||"",width:85,height:114})},r.id)})})})}),l!=null&&l.DeliveryTimeLine?i(E,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:l==null?void 0:l.DeliveryTimeLine,context:{}}):null]},N)}),c!=null&&c.length?S(L,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[i(w,{title:e.notYetShippedTitle}),i(R,{actionIconPosition:"right",children:i(q,{defaultOpen:t>=(c==null?void 0:c.length),title:i(B,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:y,fields:{count:y}}),children:i(G,{maxColumns:6,emptyGridContent:i(a,{}),className:"order-shipping-status-card__images",children:c==null?void 0:c.map(s=>{var o,N;return i(d,{href:(m==null?void 0:m(s))??"#",children:i(V,{alt:(o=s.thumbnail)==null?void 0:o.label,src:((N=s.thumbnail)==null?void 0:N.url)||"",width:85,height:114})},s.id)})})})})]}):null]}):S(L,{variant:"secondary",className:"order-shipping-status-card",children:[i(w,{title:e.shippingInfoTitle}),i("div",{className:"order-shipping-status-card__header",children:S("div",{className:"order-shipping-status-card__header--content",children:[n!=null&&n.carrier?i("p",{children:n==null?void 0:n.carrier}):null,i("p",{children:e.noInfoTitle})]})})]})},bn=({slots:e,className:l,collapseThreshold:n,orderData:t,routeOrderDetails:m,routeTracking:h,routeProductDetails:f})=>{const{loading:u,order:d,isVirtualProduct:p}=tn({orderData:t}),C=pn({carrier:"Order.ShippingStatusCard.carrier",prepositionOf:"Order.ShippingStatusCard.prepositionOf",returnOrderCardTitle:"Order.ShippingStatusCard.returnOrderCardTitle",shippingCardTitle:"Order.ShippingStatusCard.shippingCardTitle",shippingInfoTitle:"Order.ShippingStatusCard.shippingInfoTitle",notYetShippedTitle:"Order.ShippingStatusCard.notYetShippedTitle",noInfoTitle:"Order.ShippingStatusCard.noInfoTitle",returnNumber:"Order.ShippingStatusCard.returnNumber",orderNumber:"Order.ShippingStatusCard.orderNumber",trackButton:"Order.ShippingStatusCard.trackButton"});return!u&&p?null:i("div",{className:_(["order-shipping-status",l]),children:!u&&d?i(ln,{translations:C,routeOrderDetails:m,routeTracking:h,slots:e,orderData:d,collapseThreshold:n,routeProductDetails:f}):i(nn,{withCard:!1})})};export{bn as ShippingStatus,bn as default};
|
package/containers/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './OrderStatus';
|
|
3
|
-
export * from './ShippingStatus';
|
|
1
|
+
export * from './CreateReturn';
|
|
4
2
|
export * from './CustomerDetails';
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './OrderProductList';
|
|
3
|
+
export * from './OrderCancelForm';
|
|
7
4
|
export * from './OrderCostSummary';
|
|
5
|
+
export * from './OrderHeader';
|
|
6
|
+
export * from './OrderProductList';
|
|
8
7
|
export * from './OrderReturns';
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
8
|
+
export * from './OrderSearch';
|
|
9
|
+
export * from './OrderStatus';
|
|
10
|
+
export * from './ReturnsList';
|
|
11
|
+
export * from './ShippingStatus';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This module contains the schema type definitions to build the ShoppingCart
|
|
3
|
+
* and Order contexts, which are required to trigger the "place-order" event.
|
|
4
|
+
*
|
|
5
|
+
* The following schema types have been extracted from the Adobe Commerce
|
|
6
|
+
* Events SDK package.
|
|
7
|
+
*
|
|
8
|
+
* ShoppingCart schema type @see https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/types/schemas/shoppingCart.ts
|
|
9
|
+
* Order schema type @see https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/types/schemas/order.ts
|
|
10
|
+
*/
|
|
11
|
+
type ShoppingCartItem = {
|
|
12
|
+
canApplyMsrp: boolean;
|
|
13
|
+
formattedPrice: string;
|
|
14
|
+
id: string;
|
|
15
|
+
prices: {
|
|
16
|
+
price: Price;
|
|
17
|
+
};
|
|
18
|
+
product: Product;
|
|
19
|
+
configurableOptions?: Array<ConfigurableOption>;
|
|
20
|
+
quantity: number;
|
|
21
|
+
};
|
|
22
|
+
type Price = {
|
|
23
|
+
value: number;
|
|
24
|
+
currency?: string;
|
|
25
|
+
regularPrice?: number;
|
|
26
|
+
};
|
|
27
|
+
type Product = {
|
|
28
|
+
productId: number;
|
|
29
|
+
name: string;
|
|
30
|
+
sku: string;
|
|
31
|
+
topLevelSku?: string | null;
|
|
32
|
+
specialToDate?: string | null;
|
|
33
|
+
specialFromDate?: string | null;
|
|
34
|
+
newToDate?: string | null;
|
|
35
|
+
newFromDate?: string | null;
|
|
36
|
+
createdAt?: string | null;
|
|
37
|
+
updatedAt?: string | null;
|
|
38
|
+
manufacturer?: string | null;
|
|
39
|
+
countryOfManufacture?: string | null;
|
|
40
|
+
categories?: string[] | null;
|
|
41
|
+
productType?: string | null;
|
|
42
|
+
pricing?: {
|
|
43
|
+
regularPrice: number;
|
|
44
|
+
minimalPrice?: number;
|
|
45
|
+
maximalPrice?: number;
|
|
46
|
+
specialPrice?: number;
|
|
47
|
+
tierPricing?: {
|
|
48
|
+
customerGroupId?: number | null;
|
|
49
|
+
qty: number;
|
|
50
|
+
value: number;
|
|
51
|
+
}[];
|
|
52
|
+
currencyCode: string | null;
|
|
53
|
+
};
|
|
54
|
+
canonicalUrl?: string | null;
|
|
55
|
+
mainImageUrl?: string | null;
|
|
56
|
+
};
|
|
57
|
+
type ConfigurableOption = {
|
|
58
|
+
id?: number;
|
|
59
|
+
optionLabel: string;
|
|
60
|
+
valueId?: number;
|
|
61
|
+
valueLabel: string;
|
|
62
|
+
};
|
|
63
|
+
type Payment = {
|
|
64
|
+
paymentMethodCode: string;
|
|
65
|
+
paymentMethodName: string;
|
|
66
|
+
total: number;
|
|
67
|
+
};
|
|
68
|
+
type Shipping = {
|
|
69
|
+
shippingMethod?: string;
|
|
70
|
+
shippingAmount?: number;
|
|
71
|
+
};
|
|
72
|
+
export type ShoppingCartContext = {
|
|
73
|
+
id: string | null;
|
|
74
|
+
items?: Array<ShoppingCartItem>;
|
|
75
|
+
prices?: {
|
|
76
|
+
subtotalExcludingTax?: Price;
|
|
77
|
+
subtotalIncludingTax?: Price;
|
|
78
|
+
};
|
|
79
|
+
totalQuantity: number;
|
|
80
|
+
possibleOnepageCheckout?: boolean;
|
|
81
|
+
giftMessageSelected?: boolean;
|
|
82
|
+
giftWrappingSelected?: boolean;
|
|
83
|
+
source?: string;
|
|
84
|
+
};
|
|
85
|
+
export type OrderContext = {
|
|
86
|
+
appliedCouponCode: string;
|
|
87
|
+
email: string;
|
|
88
|
+
grandTotal: number;
|
|
89
|
+
orderId: string;
|
|
90
|
+
orderType?: 'checkout' | 'instant_purchase';
|
|
91
|
+
otherTax: number;
|
|
92
|
+
payments?: Payment[];
|
|
93
|
+
salesTax: number;
|
|
94
|
+
shipping?: Shipping;
|
|
95
|
+
subtotalExcludingTax: number;
|
|
96
|
+
subtotalIncludingTax: number;
|
|
97
|
+
};
|
|
98
|
+
export {};
|
|
99
|
+
//# sourceMappingURL=acdl.d.ts.map
|
package/data/models/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './acdl';
|
|
2
2
|
export * from './attributes-form';
|
|
3
|
-
export * from './store-config';
|
|
4
3
|
export * from './customer';
|
|
5
|
-
export * from './store-config';
|
|
6
4
|
export * from './customer-orders-return';
|
|
5
|
+
export * from './order-details';
|
|
6
|
+
export * from './store-config';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export * from './transform-
|
|
2
|
-
export * from './transform-guest-order';
|
|
1
|
+
export * from './transform-acdl';
|
|
3
2
|
export * from './transform-attributes-form';
|
|
4
|
-
export * from './transform-store-config';
|
|
5
3
|
export * from './transform-customer';
|
|
6
|
-
export * from './transform-
|
|
4
|
+
export * from './transform-customer-address-input';
|
|
7
5
|
export * from './transform-customer-orders-returns';
|
|
6
|
+
export * from './transform-guest-order';
|
|
7
|
+
export * from './transform-order-details';
|
|
8
|
+
export * from './transform-place-order';
|
|
9
|
+
export * from './transform-store-config';
|
|
8
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OrderContext, OrderDataModel, ShoppingCartContext } from '../models';
|
|
2
|
+
|
|
3
|
+
export declare const transformShoppingCartContext: (cartId: string, data: OrderDataModel) => ShoppingCartContext;
|
|
4
|
+
export declare const transformOrderContext: (data: OrderDataModel) => OrderContext;
|
|
5
|
+
//# sourceMappingURL=transform-acdl.d.ts.map
|