diff --git a/scripts/__dropins__/storefront-order/api.js b/scripts/__dropins__/storefront-order/api.js index 2a5966305a..87dcbe23bb 100644 --- a/scripts/__dropins__/storefront-order/api.js +++ b/scripts/__dropins__/storefront-order/api.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{Initializer as I}from"@dropins/tools/lib.js";import{events as o}from"@dropins/tools/event-bus.js";import{f as n,h as m}from"./chunks/fetch-graphql.js";import{g as q,r as U,s as Y,a as Q,b as H}from"./chunks/fetch-graphql.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as _,G as p,O as c,B as D,R as O,c as b}from"./chunks/transform-order-details.js";import{O as R,A as h}from"./chunks/getGuestOrder.graphql.js";import{t as G}from"./chunks/getCustomer.js";import{g as j,a as J}from"./chunks/getCustomer.js";import{g as W}from"./chunks/getAttributesForm.js";import{g as Z}from"./chunks/getStoreConfig.js";import{g as re}from"./chunks/getCustomerOrdersReturn.js";import{g as ae,r as se}from"./chunks/requestReturn.js";import{c as oe,r as ie}from"./chunks/requestGuestOrderCancel.js";import{r as me}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";import"./chunks/transform-attributes-form.js";const T=` +import{c as ie,r as ue}from"./chunks/requestGuestOrderCancel.js";import{f as i,h as I}from"./chunks/fetch-graphql.js";import{g as me,r as pe,s as ce,a as _e,b as Oe}from"./chunks/fetch-graphql.js";import{g as De}from"./chunks/getAttributesForm.js";import{R as f}from"./chunks/requestReturn.js";import{g as Ee,r as Te}from"./chunks/requestReturn.js";import{t as A}from"./chunks/getGuestOrder.js";import{g as ye,a as Ce}from"./chunks/getGuestOrder.js";import{g as Ie}from"./chunks/getCustomerOrdersReturn.js";import{h as u}from"./chunks/network-error.js";import{P as l,a as m,G as p,O as c,B as _,R as y,b as G,c as $}from"./chunks/transform-customer-orders-returns.js";import{O,A as R}from"./chunks/getGuestOrder.graphql.js";import{g as Ae}from"./chunks/getStoreConfig.js";import{Initializer as N}from"@dropins/tools/lib.js";import{events as d}from"@dropins/tools/event-bus.js";import{r as $e}from"./chunks/reorderItems.js";import{a as S}from"./chunks/convertCase.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/transform-attributes-form.js";const v=` query ORDER_BY_NUMBER($orderNumber: String!, $pageSize: Int) { customer { orders( @@ -106,15 +106,15 @@ query ORDER_BY_NUMBER($orderNumber: String!, $pageSize: Int) { } } } -${u} -${_} +${l} +${m} ${p} ${c} -${D} -${R} -${h} +${_} ${O} -`,y=async({orderId:e,returnRef:r,queryType:t,returnsPageSize:a=50})=>await n(T,{method:"GET",cache:"force-cache",variables:{orderNumber:e,pageSize:a}}).then(s=>{var d;return(d=s.errors)!=null&&d.length?m(s.errors):b(t??"orderData",s,r)}).catch(l),f=` +${R} +${y} +`,L=(e,r)=>({id:e,totalQuantity:r.totalQuantity,possibleOnepageCheckout:!0,items:r.items.map(t=>{var a,s,o,n,D,h;return{canApplyMsrp:!0,formattedPrice:"",id:t.id,quantity:t.totalQuantity,product:{canonicalUrl:((a=t.product)==null?void 0:a.canonicalUrl)??"",mainImageUrl:((s=t.product)==null?void 0:s.image)??"",name:((o=t.product)==null?void 0:o.name)??"",productId:0,productType:(n=t.product)==null?void 0:n.productType,sku:((D=t.product)==null?void 0:D.sku)??""},prices:{price:{value:t.price.value,currency:t.price.currency}},configurableOptions:((h=t.selectedOptions)==null?void 0:h.map(E=>({optionLabel:E.label,valueLabel:E.value})))||[]}})}),k=e=>{var a,s,o;const r=e.coupons[0],t=(a=e.payments)==null?void 0:a[0];return{appliedCouponCode:(r==null?void 0:r.code)??"",email:e.email,grandTotal:e.grandTotal.value,orderId:e.number,orderType:"checkout",otherTax:0,salesTax:e.totalTax.value,shipping:{shippingMethod:((s=e.shipping)==null?void 0:s.code)??"",shippingAmount:((o=e.shipping)==null?void 0:o.amount)??0},subtotalExcludingTax:e.subtotal.value,subtotalIncludingTax:0,payments:t?[{paymentMethodCode:(t==null?void 0:t.code)||"",paymentMethodName:(t==null?void 0:t.name)||"",total:e.grandTotal.value}]:[]}},w=e=>{var t,a;const r=(a=(t=e==null?void 0:e.data)==null?void 0:t.placeOrder)==null?void 0:a.orderV2;return r?G(r):null},x=async({orderId:e,returnRef:r,queryType:t,returnsPageSize:a=50})=>await i(v,{method:"GET",cache:"force-cache",variables:{orderNumber:e,pageSize:a}}).then(s=>$(t??"orderData",s,r)).catch(u),B=` query ORDER_BY_TOKEN($token: String!) { guestOrderByToken(input: { token: $token }) { email @@ -203,12 +203,109 @@ query ORDER_BY_TOKEN($token: String!) { } } } -${u} -${_} +${l} +${m} ${p} ${c} -${D} -${R} -${h} +${_} ${O} -`,$=async(e,r)=>await n(f,{method:"GET",cache:"no-cache",variables:{token:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?m(t.errors):G(t,r)}).catch(l),A="orderData",C=async e=>{var i;const r=typeof(e==null?void 0:e.orderRef)=="string"?e==null?void 0:e.orderRef:"",t=typeof(e==null?void 0:e.returnRef)=="string"?e==null?void 0:e.returnRef:"",a=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((i=e==null?void 0:e.orderRef)==null?void 0:i.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){o.emit("order/data",{...s,returnNumber:t});return}if(!r)return;const d=a?await $(r,t):await y({orderId:r,returnRef:t,queryType:A});d?o.emit("order/data",{...d,returnNumber:t}):o.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},E=new I({init:async e=>{const r={};E.config.setConfig({...r,...e}),C(e).catch(console.error)},listeners:()=>[]}),x=E.config;export{oe as cancelOrder,x as config,n as fetchGraphQl,W as getAttributesForm,ae as getAttributesList,q as getConfig,j as getCustomer,re as getCustomerOrdersReturn,J as getGuestOrder,y as getOrderDetailsById,Z as getStoreConfig,$ as guestOrderByToken,E as initialize,U as removeFetchGraphQlHeader,me as reorderItems,ie as requestGuestOrderCancel,se as requestReturn,Y as setEndpoint,Q as setFetchGraphQlHeader,H as setFetchGraphQlHeaders}; +${R} +${y} +`,P=async(e,r)=>await i(B,{method:"GET",cache:"no-cache",variables:{token:e}}).then(t=>A(t,r)).catch(u),M="orderData",U=async e=>{var n;const r=typeof(e==null?void 0:e.orderRef)=="string"?e==null?void 0:e.orderRef:"",t=typeof(e==null?void 0:e.returnRef)=="string"?e==null?void 0:e.returnRef:"",a=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((n=e==null?void 0:e.orderRef)==null?void 0:n.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){d.emit("order/data",{...s,returnNumber:t});return}if(!r)return;const o=a?await P(r,t):await x({orderId:r,returnRef:t,queryType:M});o?d.emit("order/data",{...o,returnNumber:t}):d.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},C=new N({init:async e=>{const r={};C.config.setConfig({...r,...e}),U(e).catch(console.error)},listeners:()=>[]}),ae=C.config,T={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},F={PLACE_ORDER:"place-order"};function g(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function b(e,r){const t=g();t.push({[e]:null}),t.push({[e]:r})}function q(e,r){g().push(a=>{const s=a.getState?a.getState():{};a.push({event:e,eventInfo:{...s,...r}})})}function Q(e,r){const t=k(r),a=L(e,r);b(T.ORDER_CONTEXT,{...t}),b(T.SHOPPING_CART_CONTEXT,{...a}),q(F.PLACE_ORDER)}const z=` + mutation PLACE_ORDER_MUTATION($cartId: String!) { + placeOrder(input: { cart_id: $cartId }) { + errors { + code + message + } + orderV2 { + email + available_actions + status + number + id + order_date + carrier + shipping_method + is_virtual + applied_coupons { + code + } + shipments { + id + number + tracking { + title + number + carrier + } + comments { + message + timestamp + } + items { + id + product_sku + product_name + order_item { + ...OrderItemDetails + ... on GiftCardOrderItem { + ...GiftCardDetails + product { + ...ProductDetails + } + } + } + } + } + payment_methods { + name + type + } + shipping_address { + ...AddressesList + } + billing_address { + ...AddressesList + } + items { + ...OrderItemDetails + ... on BundleOrderItem { + ...BundleOrderItemDetails + } + ... on GiftCardOrderItem { + ...GiftCardDetails + product { + ...ProductDetails + } + } + ... on DownloadableOrderItem { + product_name + downloadable_links { + sort_order + title + } + } + } + total { + ...OrderSummary + } + } + } + } + ${l} + ${m} + ${p} + ${c} + ${_} + ${O} + ${R} +`,se=async e=>{if(!e)throw new Error("No cart ID found");return i(z,{variables:{cartId:e}}).then(r=>{var a;(a=r.errors)!=null&&a.length&&I(r.errors);const t=w(r);return t&&(d.emit("order/placed",t),d.emit("cart/reset",void 0),Q(e,t)),t}).catch(u)},Y=` +mutation REQUEST_RETURN_ORDER($input: RequestReturnInput!) { + requestReturn(input: $input) { + return { + ...OrderReturn + } + } +} +${f}`,oe=async e=>{const r=S(e,"snakeCase",{});return await i(Y,{method:"POST",variables:{input:r}}).then(t=>{console.log("response",t);const{created_at:a,...s}=t.data.requestGuestReturn.return;return{...s,createdAt:a}}).catch(u)};export{ie as cancelOrder,ae as config,i as fetchGraphQl,De as getAttributesForm,Ee as getAttributesList,me as getConfig,ye as getCustomer,Ie as getCustomerOrdersReturn,Ce as getGuestOrder,x as getOrderDetailsById,Ae as getStoreConfig,P as guestOrderByToken,C as initialize,se as placeOrder,pe as removeFetchGraphQlHeader,$e as reorderItems,ue as requestGuestOrderCancel,oe as requestGuestReturn,Te as requestReturn,ce as setEndpoint,_e as setFetchGraphQlHeader,Oe as setFetchGraphQlHeaders}; diff --git a/scripts/__dropins__/storefront-order/api/getStoreConfig/graphql/StoreConfigQuery.d.ts b/scripts/__dropins__/storefront-order/api/getStoreConfig/graphql/StoreConfigQuery.d.ts index 2ac0a81be9..db98e3117d 100644 --- a/scripts/__dropins__/storefront-order/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +++ b/scripts/__dropins__/storefront-order/api/getStoreConfig/graphql/StoreConfigQuery.d.ts @@ -1,2 +1,2 @@ -export declare const STORE_CONFIG_QUERY = "\nquery STORE_CONFIG_QUERY {\n storeConfig {\n order_cancellation_enabled\n order_cancellation_reasons {\n description\n }\n orders_invoices_credit_memos_display_price\n orders_invoices_credit_memos_display_shipping_amount\n orders_invoices_credit_memos_display_subtotal\n orders_invoices_credit_memos_display_grandtotal\n orders_invoices_credit_memos_display_full_summary\n orders_invoices_credit_memos_display_zero_tax\n }\n}\n"; +export declare const STORE_CONFIG_QUERY = "\nquery STORE_CONFIG_QUERY {\n storeConfig {\n order_cancellation_enabled\n order_cancellation_reasons {\n description\n }\n base_media_url\n orders_invoices_credit_memos_display_price\n orders_invoices_credit_memos_display_shipping_amount\n orders_invoices_credit_memos_display_subtotal\n orders_invoices_credit_memos_display_grandtotal\n orders_invoices_credit_memos_display_full_summary\n orders_invoices_credit_memos_display_zero_tax\n }\n}\n"; //# sourceMappingURL=StoreConfigQuery.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/index.d.ts b/scripts/__dropins__/storefront-order/api/index.d.ts index 73b1a3e4db..c8c477bc76 100644 --- a/scripts/__dropins__/storefront-order/api/index.d.ts +++ b/scripts/__dropins__/storefront-order/api/index.d.ts @@ -1,15 +1,17 @@ -export * from './initialize'; +export * from './cancelOrder'; export * from './fetch-graphql'; -export * from './getOrderDetailsById'; -export * from './getGuestOrder'; -export * from './guestOrderByToken'; export * from './getAttributesForm'; +export * from './getAttributesList'; export * from './getCustomer'; -export * from './getStoreConfig'; export * from './getCustomerOrdersReturn'; -export * from './getAttributesList'; -export * from './requestReturn'; -export * from './cancelOrder'; -export * from './requestGuestOrderCancel'; +export * from './getGuestOrder'; +export * from './getOrderDetailsById'; +export * from './getStoreConfig'; +export * from './guestOrderByToken'; +export * from './initialize'; +export * from './placeOrder'; export * from './reorderItems'; +export * from './requestGuestOrderCancel'; +export * from './requestReturn'; +export * from './requestGuestReturn'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/placeOrder/graphql/placeOrderMutation.d.ts b/scripts/__dropins__/storefront-order/api/placeOrder/graphql/placeOrderMutation.d.ts new file mode 100644 index 0000000000..b4b1eddb62 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/placeOrder/graphql/placeOrderMutation.d.ts @@ -0,0 +1,2 @@ +export declare const PLACE_ORDER_MUTATION: string; +//# sourceMappingURL=placeOrderMutation.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/placeOrder/index.d.ts b/scripts/__dropins__/storefront-order/api/placeOrder/index.d.ts new file mode 100644 index 0000000000..65c2281404 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/placeOrder/index.d.ts @@ -0,0 +1,2 @@ +export * from './placeOrder'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/placeOrder/placeOrder.d.ts b/scripts/__dropins__/storefront-order/api/placeOrder/placeOrder.d.ts new file mode 100644 index 0000000000..4826b6a8d9 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/placeOrder/placeOrder.d.ts @@ -0,0 +1,4 @@ +import { OrderDataModel } from '../../data/models'; + +export declare const placeOrder: (cartId: string) => Promise; +//# sourceMappingURL=placeOrder.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/requestGuestReturn/graphql/requestGuestReturn.graphql.d.ts b/scripts/__dropins__/storefront-order/api/requestGuestReturn/graphql/requestGuestReturn.graphql.d.ts new file mode 100644 index 0000000000..bfe109bb5a --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/requestGuestReturn/graphql/requestGuestReturn.graphql.d.ts @@ -0,0 +1,2 @@ +export declare const REQUEST_RETURN_ORDER: string; +//# sourceMappingURL=requestGuestReturn.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/requestGuestReturn/index.d.ts b/scripts/__dropins__/storefront-order/api/requestGuestReturn/index.d.ts new file mode 100644 index 0000000000..bcca4ec752 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/requestGuestReturn/index.d.ts @@ -0,0 +1,2 @@ +export * from './requestGuestReturn'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/requestGuestReturn/requestGuestReturn.d.ts b/scripts/__dropins__/storefront-order/api/requestGuestReturn/requestGuestReturn.d.ts new file mode 100644 index 0000000000..8bc7a6f8fc --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/requestGuestReturn/requestGuestReturn.d.ts @@ -0,0 +1,9 @@ +import { RequestReturnProps } from '../../types'; + +export declare const requestGuestReturn: (form: RequestReturnProps) => Promise<{ + uid: string; + number: string; + status: string; + createdAt: string; +}>; +//# sourceMappingURL=requestGuestReturn.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js b/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js index 43382f95c4..97f5fb2f5a 100644 --- a/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js +++ b/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as n,jsxs as w,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{Price as u,CartItem as o,Icon as r,Image as U,Incrementer as c}from"@dropins/tools/components.js";import{useCallback as d}from"@dropins/tools/preact-hooks.js";import{classes as X}from"@dropins/tools/lib.js";import{O as p}from"./OrderLoaders.js";import*as Q from"@dropins/tools/preact-compat.js";const ee=_=>Q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",..._},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:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),te=({loading:_,product:e,itemType:Y,taxConfig:D,translations:v,disabledIncrementer:C,onQuantity:k,showConfigurableOptions:N,routeProductDetails:E})=>{var M,Z,j,q,x,z,O,W,$,i,B,F,K,R,A,G,J;const{taxExcluded:V,taxIncluded:f}=D,t=d((h,T,g)=>n(u,{amount:h,currency:T,weight:"normal",...g}),[]);if(!e)return n(p,{});let b={};const L=Y==="cancelled",I=(Z=(M=e==null?void 0:e.product)==null?void 0:M.stockStatus)==null?void 0:Z.includes("IN_STOCK"),a=e==null?void 0:e.giftCard,l=(j=e==null?void 0:e.itemPrices)==null?void 0:j.priceIncludingTax,s=(q=e==null?void 0:e.itemPrices)==null?void 0:q.originalPrice,m=(x=e==null?void 0:e.itemPrices)==null?void 0:x.price,P=e.totalQuantity>1?{quantity:e.totalQuantity}:{},y=e.discounted&&((z=e.price)==null?void 0:z.value)!==(s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),H={...(e==null?void 0:e.configurableOptions)||{},...(e==null?void 0:e.bundleOptions)||{},...a!=null&&a.senderName?{[v.sender]:a==null?void 0:a.senderName}:{},...a!=null&&a.senderEmail?{[v.sender]:a==null?void 0:a.senderEmail}:{},...a!=null&&a.senderName?{[v.sender]:a==null?void 0:a.senderName}:{},...a!=null&&a.recipientEmail?{[v.recipient]:a==null?void 0:a.recipientEmail}:{},...a!=null&&a.message?{[v.message]:a==null?void 0:a.message}:{},...e!=null&&e.downloadableLinks?{[`${(O=e==null?void 0:e.downloadableLinks)==null?void 0:O.count} ${v.downloadableCount}`]:(W=e==null?void 0:e.downloadableLinks)==null?void 0:W.result}:{}};if(f&&V){const h=y?s==null?void 0:s.value:(l==null?void 0:l.value)*(e==null?void 0:e.totalQuantity);b={taxExcluded:!0,taxIncluded:void 0,price:t(s==null?void 0:s.value,s==null?void 0:s.currency),total:w(S,{children:[t(h,s==null?void 0:s.currency,{variant:e.discounted&&(l==null?void 0:l.value)!==h?"strikethrough":"default"}),e.discounted&&(l==null?void 0:l.value)!==h?t(l==null?void 0:l.value,l==null?void 0:l.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:t((m==null?void 0:m.value)*e.totalQuantity,m==null?void 0:m.currency)}}else if(!f&&V)b={taxExcluded:void 0,taxIncluded:void 0,price:t(s==null?void 0:s.value,s==null?void 0:s.currency),total:w(S,{children:[t((s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),l==null?void 0:l.currency,{variant:y?"strikethrough":"default"}),y?t(($=e.price)==null?void 0:$.value,(i=e.price)==null?void 0:i.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:t((m==null?void 0:m.value)*(e==null?void 0:e.totalQuantity),m==null?void 0:m.currency)};else if(f&&!V){const h=y?s.value:l.value*e.totalQuantity;b={taxExcluded:void 0,taxIncluded:!0,price:t(l==null?void 0:l.value,l==null?void 0:l.currency),total:w(S,{children:[t(h,l==null?void 0:l.currency,{variant:y?"strikethrough":"default",weight:"bold"}),y?t(l==null?void 0:l.value,l==null?void 0:l.currency,{sale:!0,weight:"bold"}):null]})}}return n(o,{loading:_,alert:L&&I?w("span",{children:[n(r,{source:ee}),v.outOfStock]}):n(S,{}),configurations:(N==null?void 0:N(H))??H,title:E?n("a",{"data-testid":"product-name",className:X(["cart-summary-item__title",["cart-summary-item__title--strikethrough",L]]),href:E(e),children:(B=e==null?void 0:e.product)==null?void 0:B.name}):n("div",{"data-testid":"product-name",className:X(["cart-summary-item__title",["cart-summary-item__title--strikethrough",L]]),children:(F=e==null?void 0:e.product)==null?void 0:F.name}),sku:n("div",{children:(K=e==null?void 0:e.product)==null?void 0:K.sku}),...P,image:E?n("a",{href:E(e),children:n(U,{src:(R=e==null?void 0:e.product)==null?void 0:R.thumbnail.url,alt:(A=e==null?void 0:e.product)==null?void 0:A.thumbnail.label,loading:"lazy",width:"90",height:"120"})}):n(U,{src:(G=e==null?void 0:e.product)==null?void 0:G.thumbnail.url,alt:(J=e==null?void 0:e.product)==null?void 0:J.thumbnail.label,loading:"lazy",width:"90",height:"120"}),...b,footer:k&&!C?n(c,{value:1,min:1,max:e==null?void 0:e.totalQuantity,onValue:h=>k==null?void 0:k(Number(h)),name:"quantity","data-testid":"returnIncrementer",readonly:!0}):void 0})};export{te as C,ee as S}; +import{jsx as v,jsxs as S,Fragment as _}from"@dropins/tools/preact-jsx-runtime.js";import{Price as P,Image as T,CartItem as g,Icon as u,Incrementer as o}from"@dropins/tools/components.js";import{useCallback as G}from"@dropins/tools/preact-hooks.js";import{classes as J}from"@dropins/tools/lib.js";import{O as r}from"./OrderLoaders.js";import*as M from"@dropins/tools/preact-compat.js";const c=k=>M.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...k},M.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"}),M.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),se=({placeholderImage:k="",loading:X,product:e,itemType:Y,taxConfig:D,translations:h,disabledIncrementer:i,onQuantity:E,showConfigurableOptions:V,routeProductDetails:w})=>{var q,x,O,W,$,z,B,F,K,R,U;const{taxExcluded:f,taxIncluded:L}=D,t=G((m,H,b)=>v(P,{amount:m,currency:H,weight:"normal",...b}),[]),Z=G(m=>{var b,A;const H=(b=m==null?void 0:m.product)!=null&&b.thumbnail.url.length?(A=m==null?void 0:m.product)==null?void 0:A.thumbnail.url:k;return v(T,{src:H,alt:m==null?void 0:m.productName,loading:"lazy",width:"90",height:"120"})},[k]);if(!e)return v(r,{});let N={};const Q=Y==="cancelled",C=(x=(q=e==null?void 0:e.product)==null?void 0:q.stockStatus)==null?void 0:x.includes("IN_STOCK"),l=e==null?void 0:e.giftCard,a=(O=e==null?void 0:e.itemPrices)==null?void 0:O.priceIncludingTax,s=(W=e==null?void 0:e.itemPrices)==null?void 0:W.originalPrice,n=($=e==null?void 0:e.itemPrices)==null?void 0:$.price,I=e.totalQuantity>1?{quantity:e.totalQuantity}:{},y=e.discounted&&((z=e.price)==null?void 0:z.value)!==(s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),j={...(e==null?void 0:e.configurableOptions)||{},...(e==null?void 0:e.bundleOptions)||{},...l!=null&&l.senderName?{[h.sender]:l==null?void 0:l.senderName}:{},...l!=null&&l.senderEmail?{[h.sender]:l==null?void 0:l.senderEmail}:{},...l!=null&&l.senderName?{[h.sender]:l==null?void 0:l.senderName}:{},...l!=null&&l.recipientEmail?{[h.recipient]:l==null?void 0:l.recipientEmail}:{},...l!=null&&l.message?{[h.message]:l==null?void 0:l.message}:{},...e!=null&&e.downloadableLinks?{[`${(B=e==null?void 0:e.downloadableLinks)==null?void 0:B.count} ${h.downloadableCount}`]:(F=e==null?void 0:e.downloadableLinks)==null?void 0:F.result}:{}};if(L&&f){const m=y?s==null?void 0:s.value:(a==null?void 0:a.value)*(e==null?void 0:e.totalQuantity);N={taxExcluded:!0,taxIncluded:void 0,price:t(s==null?void 0:s.value,s==null?void 0:s.currency),total:S(_,{children:[t(m,s==null?void 0:s.currency,{variant:e.discounted&&(a==null?void 0:a.value)!==m?"strikethrough":"default"}),e.discounted&&(a==null?void 0:a.value)!==m?t(a==null?void 0:a.value,a==null?void 0:a.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:t((n==null?void 0:n.value)*e.totalQuantity,n==null?void 0:n.currency)}}else if(!L&&f)N={taxExcluded:void 0,taxIncluded:void 0,price:t(s==null?void 0:s.value,s==null?void 0:s.currency),total:S(_,{children:[t((s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),a==null?void 0:a.currency,{variant:y?"strikethrough":"default"}),y?t((K=e.price)==null?void 0:K.value,(R=e.price)==null?void 0:R.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:t((n==null?void 0:n.value)*(e==null?void 0:e.totalQuantity),n==null?void 0:n.currency)};else if(L&&!f){const m=y?s.value:a.value*e.totalQuantity;N={taxExcluded:void 0,taxIncluded:!0,price:t(a==null?void 0:a.value,a==null?void 0:a.currency),total:S(_,{children:[t(m,a==null?void 0:a.currency,{variant:y?"strikethrough":"default",weight:"bold"}),y?t(a==null?void 0:a.value,a==null?void 0:a.currency,{sale:!0,weight:"bold"}):null]})}}return v(g,{loading:X,alert:Q&&C?S("span",{children:[v(u,{source:c}),h.outOfStock]}):v(_,{}),configurations:(V==null?void 0:V(j))??j,title:w?v("a",{"data-testid":"product-name",className:J(["cart-summary-item__title",["cart-summary-item__title--strikethrough",Q]]),href:w(e),children:e==null?void 0:e.productName}):v("div",{"data-testid":"product-name",className:J(["cart-summary-item__title",["cart-summary-item__title--strikethrough",Q]]),children:e==null?void 0:e.productName}),sku:v("div",{children:(U=e==null?void 0:e.product)==null?void 0:U.sku}),...I,image:w?v("a",{href:w(e),children:Z(e)}):Z(e),...N,footer:E&&!i?v(o,{value:1,min:1,max:e==null?void 0:e.totalQuantity,onValue:m=>E==null?void 0:E(Number(m)),name:"quantity","data-testid":"returnIncrementer",readonly:!0}):void 0})};export{se as C,c as S}; diff --git a/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js b/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js index 0f693b9b21..10df655718 100644 --- a/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js +++ b/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsxs as g,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{InLineAlert as v,Picker as x,Button as F}from"@dropins/tools/components.js";import{F as S}from"./OrderCancel.js";import"@dropins/tools/lib.js";import{useState as n}from"@dropins/tools/preact-hooks.js";import{events as d}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{r as E,c as _}from"./requestGuestOrderCancel.js";import{useText as D,Text as l}from"@dropins/tools/i18n.js";const k=({orderRef:a,pickerProps:m,submitButtonProps:u,cancelReasons:t})=>{const o=D({ErrorHeading:"Order.OrderCancelForm.errorHeading",ErrorDescription:"Order.OrderCancelForm.errorDescription",orderCancellationLabel:"Order.OrderCancelForm.label"}),[i,p]=n(0),[f,O]=n(!1),[b,h]=n(!1);d.on("authenticated",e=>{e&&h(!0)},{eager:!0});const C=e=>{e.preventDefault();const s=Number(e.target.value);p(s)};return g(S,{onSubmit:async e=>(e.preventDefault(),(a.length>20?E:_)(a,t[i].text,c=>{b||(c.status="guest order cancellation requested"),d.emit("order/data",c)},()=>{O(!0)})),"data-testid":"order-order-cancel-reasons-form__text",children:[f&&r(v,{heading:o.ErrorHeading,description:o.ErrorDescription}),r("div",{className:"order-order-cancel-reasons-form__text",children:r(l,{id:"Order.OrderCancelForm.description"})}),r(x,{name:"cancellationReasons",floatingLabel:o.orderCancellationLabel,defaultOption:t[0],variant:"primary",options:t,value:String(i),handleSelect:C,required:!0,"data-testid":"order-cancellation-reasons-selector",...m}),r("div",{className:"order-order-cancel-reasons-form__button-container",children:r(F,{variant:"primary","data-testid":"order-cancel-submit-button",...u,children:r(l,{id:"Order.OrderCancelForm.button"})})})]})};export{k as O}; +import{jsxs as g,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{InLineAlert as v,Picker as x,Button as F}from"@dropins/tools/components.js";import{F as S}from"./ShippingStatusCard.js";import"@dropins/tools/lib.js";import{useState as n}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{events as d}from"@dropins/tools/event-bus.js";import{r as E,c as _}from"./requestGuestOrderCancel.js";import{useText as D,Text as l}from"@dropins/tools/i18n.js";const k=({orderRef:a,pickerProps:m,submitButtonProps:u,cancelReasons:t})=>{const o=D({ErrorHeading:"Order.OrderCancelForm.errorHeading",ErrorDescription:"Order.OrderCancelForm.errorDescription",orderCancellationLabel:"Order.OrderCancelForm.label"}),[i,p]=n(0),[f,O]=n(!1),[b,h]=n(!1);d.on("authenticated",e=>{e&&h(!0)},{eager:!0});const C=e=>{e.preventDefault();const s=Number(e.target.value);p(s)};return g(S,{onSubmit:async e=>(e.preventDefault(),(a.length>20?E:_)(a,t[i].text,c=>{b||(c.status="guest order cancellation requested"),d.emit("order/data",c)},()=>{O(!0)})),"data-testid":"order-order-cancel-reasons-form__text",children:[f&&r(v,{heading:o.ErrorHeading,description:o.ErrorDescription}),r("div",{className:"order-order-cancel-reasons-form__text",children:r(l,{id:"Order.OrderCancelForm.description"})}),r(x,{name:"cancellationReasons",floatingLabel:o.orderCancellationLabel,defaultOption:t[0],variant:"primary",options:t,value:String(i),handleSelect:C,required:!0,"data-testid":"order-cancellation-reasons-selector",...m}),r("div",{className:"order-order-cancel-reasons-form__button-container",children:r(F,{variant:"primary","data-testid":"order-cancel-submit-button",...u,children:r(l,{id:"Order.OrderCancelForm.button"})})})]})};export{k as O}; diff --git a/scripts/__dropins__/storefront-order/chunks/OrderLoaders.js b/scripts/__dropins__/storefront-order/chunks/OrderLoaders.js index b7f31ec61f..cf9eb06f10 100644 --- a/scripts/__dropins__/storefront-order/chunks/OrderLoaders.js +++ b/scripts/__dropins__/storefront-order/chunks/OrderLoaders.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as e,jsxs as a}from"@dropins/tools/preact-jsx-runtime.js";import{Card as n,Skeleton as i,SkeletonRow as r,CartItemSkeleton as t}from"@dropins/tools/components.js";import"./OrderCancel.js";import{classes as o}from"@dropins/tools/lib.js";const z=({testId:s,withCard:d=!0})=>{const l=a(i,{"data-testid":s??"skeletonLoader",children:[e(r,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(r,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(r,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return d?l:e(n,{variant:"secondary",className:o(["order-order-loaders","order-order-loaders--card-loader"]),children:l})},g=s=>e(n,{variant:"secondary",...s,children:a(i,{"data-testid":"order-details-skeleton",children:[e(r,{variant:"heading",size:"medium",fullWidth:!0}),e(r,{size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"})]})}),f=()=>a(i,{"data-testid":"order-product-list-skeleton",style:{gridTemplateColumns:"1fr"},children:[e(r,{variant:"heading",fullWidth:!0,size:"medium"}),e(t,{}),e(t,{}),e(t,{}),e(t,{}),e(t,{})]}),v=()=>a(i,{"data-testid":"order-cost-summary-content-skeleton",className:"order-cost-summary-content",children:[e(r,{variant:"heading",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"heading",size:"small",fullWidth:!0,lines:3})]});export{z as C,g as D,v as O,f as a}; +import{jsx as e,jsxs as a}from"@dropins/tools/preact-jsx-runtime.js";import"./ShippingStatusCard.js";import{Card as d,Skeleton as i,SkeletonRow as r,CartItemSkeleton as t}from"@dropins/tools/components.js";import{classes as m}from"@dropins/tools/lib.js";const z=({testId:s,withCard:n=!0})=>{const l=a(i,{"data-testid":s??"skeletonLoader",children:[e(r,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(r,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(r,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return n?l:e(d,{variant:"secondary",className:m(["order-order-loaders","order-order-loaders--card-loader"]),children:l})},v=s=>e(d,{variant:"secondary",...s,children:a(i,{"data-testid":"order-details-skeleton",children:[e(r,{variant:"heading",size:"medium",fullWidth:!0}),e(r,{size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"})]})}),g=()=>a(i,{"data-testid":"order-product-list-skeleton",style:{gridTemplateColumns:"1fr"},children:[e(r,{variant:"heading",fullWidth:!0,size:"medium"}),e(t,{}),e(t,{}),e(t,{}),e(t,{}),e(t,{})]}),p=()=>a(i,{"data-testid":"order-cost-summary-content-skeleton",className:"order-cost-summary-content",children:[e(r,{variant:"heading",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"heading",size:"small",fullWidth:!0,lines:3})]}),f=()=>a(i,{"data-testid":"order-header-skeleton",className:"order-header",children:[e(r,{variant:"empty",size:"xlarge",fullWidth:!0}),e(r,{variant:"empty",size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{size:"small",fullWidth:!0}),e(r,{variant:"heading",size:"xsmall",fullWidth:!0})]});export{z as C,v as D,p as O,g as a,f as b}; diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index e0bd981972..0e8cf12c0c 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as r,jsxs as i,Fragment as _}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as X,Slot as q}from"@dropins/tools/lib.js";import{IllustratedMessage as D,Icon as V,Card as O,ContentGrid as r1,Image as e1,Header as P,Pagination as t1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as n1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as a1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const J=c=>l.createElement("svg",{id:"Icon_Chevron_right_Base","data-name":"Icon \\u2013 Chevron right \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...c},l.createElement("g",{id:"Large"},l.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),l.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},l.createElement("path",{vectorEffect:"non-scaling-stroke",id:"chevron",d:"M199.75,367.5l4.255,-4.255-4.255,-4.255",transform:"translate(-189.25 -351.0)",fill:"none",stroke:"currentColor"})))),c1=c=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c},l.createElement("path",{d:"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z",fill:"#D6D6D6"})),T=({typeList:c,isEmpty:p,minifiedView:N,message:t})=>{const a=n1(()=>{switch(c){case"orders":return{icon:c1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[c,t]);return!p||!c||!a.text?null:r(D,{className:X(["order-empty-list",a.className,N?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},W={size:"32",stroke:"2"},_1=({minifiedViewKey:c,withReturnNumber:p=!1,withOrderNumber:N=!1,slots:t,pageInfo:a,withReturnsListButton:A=!0,isMobile:E=!1,returnsInMinifiedView:Y=1,translations:L={},orderReturns:s=[],minifiedView:h=!1,withHeader:g=!0,withThumbnails:B=!0,selectedPage:S=1,handleSetSelectPage:k,routeReturnDetails:d,routeOrderDetails:f,routeTracking:v,routeReturnsList:b,routeProductDetails:m,loading:x})=>{const z=h?Y:s.length,j=m!=null&&m()?"a":"span",y=w(()=>s.slice(0,z).map((e,R)=>{var F,G;const $=((e==null?void 0:e.items)??[]).reduce((n,C)=>(C.requestQuantity??0)+n,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:i("div",{className:"order-returns-list-content__cards-grid",children:[i("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${c}.returnsList.returnStatus.${a1(e.returnStatus)}`})}),p?i("p",{children:[L.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,N?i("p",{children:[L.orderNumber," ",r("a",{href:(f==null?void 0:f({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((n,C)=>{var Z,u;const M={title:"",number:(n==null?void 0:n.trackingNumber)??"",carrier:((Z=n==null?void 0:n.carrier)==null?void 0:Z.label)??""},H=v==null?void 0:v(M),o=`${M.number}_${C}`;return i("p",{children:[`${L.carrier} `,`${(u=M.carrier)==null?void 0:u.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer","data-testid":`${o}_link`,children:n.trackingNumber}):r("span",{"data-testid":`${o}_span`,children:n.trackingNumber})]},o)}),t!=null&&t.ReturnItemsDetails?r(q,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):null,!(t!=null&&t.ReturnItemsDetails)&&e.items.length?i("p",{children:[$," ",r(U,{id:`Order.Returns.${c}.returnsList.itemText`,plural:$,fields:{count:$}})]}):null]}),B?r(r1,{maxColumns:E?3:9,emptyGridContent:r(_,{}),className:X(["order-returns-list-content__images",["order-returns-list-content__images-3",E]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((n,C)=>{var Z,u;const M=(Z=n.thumbnail)==null?void 0:Z.label,H=(u=n.thumbnail)==null?void 0:u.url,o=`key_${C}_${n.uid}`;return r(j,{"data-testid":o,href:(m==null?void 0:m(n))??"#",children:r(e1,{alt:M,src:H,width:85,height:114})},o)})}):null,t!=null&&t.DetailsActionParams?r(q,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:t==null?void 0:t.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:J,...W})})]})},R)}),[s,z,c,p,L,d,N,f,t,B,E,m,v,j]),I=w(()=>i(_,{children:[g?r(P,{title:L.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,x?r(Q,{withCard:!1}):i(_,{children:[y,r(T,{minifiedView:h,typeList:"orders",isEmpty:!s.length,message:L.emptyOrdersListMessage}),A?r("a",{className:"order-returns-list-content__actions",href:(b==null?void 0:b())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:i("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:L.viewAllOrdersButton}),r(V,{source:J,...W})]})})}):null]})]}),[b,A,g,L,y,h,s.length,x]),K=w(()=>i(_,{children:[g?r(P,{title:L.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,x?r(Q,{withCard:!1}):i(_,{children:[r(T,{minifiedView:h,typeList:"orders",isEmpty:!s.length,message:L.emptyOrdersListMessage}),y,(a==null?void 0:a.totalPages)>1?r(t1,{totalPages:a==null?void 0:a.totalPages,currentPage:S,onChange:k}):null]})]}),[y,h,s,L,a==null?void 0:a.totalPages,S,k,x,g]);return r("div",{className:"order-returns-list-content",children:h?I:K})};export{_1 as R}; +import{jsx as r,jsxs as L,Fragment as N}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as V}from"@dropins/tools/preact-hooks.js";import{classes as I,Slot as Q}from"@dropins/tools/lib.js";import{IllustratedMessage as t1,Icon as A,Card as U,ContentGrid as n1,Image as a1,Header as J,Pagination as L1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as c1}from"@dropins/tools/preact-compat.js";import"./ShippingStatusCard.js";import{f as i1}from"./returnOrdersHelper.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{C as T}from"./OrderLoaders.js";import{Text as W}from"@dropins/tools/i18n.js";const X=c=>l.createElement("svg",{id:"Icon_Chevron_right_Base","data-name":"Icon \\u2013 Chevron right \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...c},l.createElement("g",{id:"Large"},l.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),l.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},l.createElement("path",{vectorEffect:"non-scaling-stroke",id:"chevron",d:"M199.75,367.5l4.255,-4.255-4.255,-4.255",transform:"translate(-189.25 -351.0)",fill:"none",stroke:"currentColor"})))),s1=c=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...c},l.createElement("path",{d:"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z",fill:"#D6D6D6"})),Y=({typeList:c,isEmpty:C,minifiedView:g,message:M})=>{const t=c1(()=>{switch(c){case"orders":return{icon:s1,text:r("p",{children:M}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[c,M]);return!C||!c||!t.text?null:r(t1,{className:I(["order-empty-list",t.className,g?"order-empty-list--minified":""]),message:t.text,icon:r(A,{source:t.icon}),"data-testid":"emptyList"})},K={size:"32",stroke:"2"},g1=({placeholderImage:c,minifiedViewKey:C,withReturnNumber:g=!1,withOrderNumber:M=!1,slots:t,pageInfo:i,withReturnsListButton:B=!0,isMobile:$=!1,returnsInMinifiedView:R=1,translations:a={},orderReturns:s=[],minifiedView:h=!1,withHeader:f=!0,withThumbnails:S=!0,selectedPage:k=1,handleSetSelectPage:z,routeReturnDetails:d,routeOrderDetails:v,routeTracking:b,routeReturnsList:x,routeProductDetails:m,loading:y})=>{const j=h?R:s.length,F=m!=null&&m()?"a":"span",H=V(()=>s.slice(0,j).map((e,e1)=>{var G,q;const w=((e==null?void 0:e.items)??[]).reduce((n,Z)=>(Z.requestQuantity??0)+n,0);return r(U,{variant:"secondary",className:"order-returns-list-content__cards-list",children:L("div",{className:"order-returns-list-content__cards-grid",children:[L("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(W,{id:`Order.Returns.${C}.returnsList.returnStatus.${i1(e.returnStatus)}`})}),g?L("p",{children:[a.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,M?L("p",{children:[a.orderNumber," ",r("a",{href:(v==null?void 0:v({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(G=e==null?void 0:e.tracking)==null?void 0:G.map((n,Z)=>{var _,p;const u={title:"",number:(n==null?void 0:n.trackingNumber)??"",carrier:((_=n==null?void 0:n.carrier)==null?void 0:_.label)??""},E=b==null?void 0:b(u),o=`${u.number}_${Z}`;return L("p",{children:[`${a.carrier} `,`${(p=u.carrier)==null?void 0:p.toLocaleUpperCase()} | `,E?r("a",{href:E,target:"_blank",rel:"noreferrer","data-testid":`${o}_link`,children:n.trackingNumber}):r("span",{"data-testid":`${o}_span`,children:n.trackingNumber})]},o)}),t!=null&&t.ReturnItemsDetails?r(Q,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):null,!(t!=null&&t.ReturnItemsDetails)&&e.items.length?L("p",{children:[w," ",r(W,{id:`Order.Returns.${C}.returnsList.itemText`,plural:w,fields:{count:w}})]}):null]}),S?r(n1,{maxColumns:$?3:9,emptyGridContent:r(N,{}),className:I(["order-returns-list-content__images",["order-returns-list-content__images-3",$]]),children:(q=e==null?void 0:e.items)==null?void 0:q.map((n,Z)=>{var _,p,O,P;const u=(_=n.thumbnail)==null?void 0:_.label,E=(O=(p=n.thumbnail)==null?void 0:p.url)!=null&&O.length?(P=n.thumbnail)==null?void 0:P.url:c,o=`key_${Z}_${n.uid}`;return r(F,{"data-testid":o,href:(m==null?void 0:m(n))??"#",children:r(a1,{alt:u,src:E,width:85,height:114})},o)})}):null,t!=null&&t.DetailsActionParams?r(Q,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:t==null?void 0:t.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(A,{source:X,...K})})]})},e1)}),[s,j,C,g,a,M,t,S,$,c,F,b,m,d,v]),D=V(()=>L(N,{children:[f?r(J,{title:a.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,y?r(T,{withCard:!1}):L(N,{children:[H,r(Y,{minifiedView:h,typeList:"orders",isEmpty:!s.length,message:a.emptyOrdersListMessage}),B?r("a",{className:"order-returns-list-content__actions",href:(x==null?void 0:x())??"#",children:r(U,{variant:"secondary",className:"order-returns-list-content__card",children:L("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:a.viewAllOrdersButton}),r(A,{source:X,...K})]})})}):null]})]}),[x,B,f,a,H,h,s.length,y]),r1=V(()=>L(N,{children:[f?r(J,{title:a.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,y?r(T,{withCard:!1}):L(N,{children:[r(Y,{minifiedView:h,typeList:"orders",isEmpty:!s.length,message:a.emptyOrdersListMessage}),H,(i==null?void 0:i.totalPages)>1?r(L1,{totalPages:i==null?void 0:i.totalPages,currentPage:k,onChange:z}):null]})]}),[H,h,s,a,i==null?void 0:i.totalPages,k,z,y,f]);return r("div",{className:"order-returns-list-content",children:h?D:r1})};export{g1 as R}; diff --git a/scripts/__dropins__/storefront-order/chunks/OrderCancel.js b/scripts/__dropins__/storefront-order/chunks/ShippingStatusCard.js similarity index 100% rename from scripts/__dropins__/storefront-order/chunks/OrderCancel.js rename to scripts/__dropins__/storefront-order/chunks/ShippingStatusCard.js diff --git a/scripts/__dropins__/storefront-order/chunks/getCustomer.js b/scripts/__dropins__/storefront-order/chunks/getCustomer.js deleted file mode 100644 index b6bcf17289..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/getCustomer.js +++ /dev/null @@ -1,11 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{h}from"./network-error.js";import{f,h as i}from"./fetch-graphql.js";import{a as O}from"./getGuestOrder.graphql.js";import{b as l}from"./transform-order-details.js";const T=(t,a)=>{var u,c;if(!((u=t==null?void 0:t.data)!=null&&u.guestOrder))return null;const r=(c=t==null?void 0:t.data)==null?void 0:c.guestOrder;return l(r,a)},k=(t,a)=>{var u,c;if(!((u=t==null?void 0:t.data)!=null&&u.guestOrderByToken))return null;const r=(c=t==null?void 0:t.data)==null?void 0:c.guestOrderByToken;return l(r,a)},g=t=>{var a,r,u,c,m,d;return{email:((r=(a=t==null?void 0:t.data)==null?void 0:a.customer)==null?void 0:r.email)||"",firstname:((c=(u=t==null?void 0:t.data)==null?void 0:u.customer)==null?void 0:c.firstname)||"",lastname:((d=(m=t==null?void 0:t.data)==null?void 0:m.customer)==null?void 0:d.lastname)||""}},B=async t=>await f(O,{method:"GET",cache:"no-cache",variables:{input:t}}).then(a=>{var r;return(r=a.errors)!=null&&r.length?i(a.errors):T(a)}).catch(h),E=` - query GET_CUSTOMER { - customer { - firstname - lastname - email - } - } -`,C=async()=>await f(E,{method:"GET",cache:"force-cache"}).then(t=>{var a;return(a=t.errors)!=null&&a.length?i(t.errors):g(t)}).catch(h);export{B as a,C as g,k as t}; diff --git a/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js b/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js index 413fdd1530..57f40f0cb7 100644 --- a/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js +++ b/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{h as R}from"./network-error.js";import{f as E,h as _}from"./fetch-graphql.js";import{R as T,P as o,a as s,G as c,O as u,t as h}from"./transform-order-details.js";const n=` +import{h as e}from"./network-error.js";import{R,P as E,a as _,G as T,O as s,t as o}from"./transform-customer-orders-returns.js";import{f as c}from"./fetch-graphql.js";const u=` query GET_CUSTOMER_ORDERS_RETURN($pageSize: Int) { customer { returns(pageSize: $pageSize) { @@ -13,9 +13,9 @@ query GET_CUSTOMER_ORDERS_RETURN($pageSize: Int) { } } } +${R} +${E} +${_} ${T} -${o} ${s} -${c} -${u} -`,G=async(e=10)=>await E(n,{method:"GET",cache:"force-cache",variables:{pageSize:e}}).then(r=>{var t,a;return(t=r.errors)!=null&&t.length?_(r.errors):h((a=r==null?void 0:r.data)==null?void 0:a.customer.returns)}).catch(R);export{G as g}; +`,G=async(t=10)=>await c(u,{method:"GET",cache:"force-cache",variables:{pageSize:t}}).then(r=>{var a;return o((a=r==null?void 0:r.data)==null?void 0:a.customer.returns)}).catch(e);export{G as g}; diff --git a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js index fd7bfbcd07..9648df9f1c 100644 --- a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js +++ b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{P as e,a as t,G as r,O as a,B as s,R as d}from"./transform-order-details.js";const n=` +import{P as e,a as t,G as r,O as a,B as s,R as d}from"./transform-customer-orders-returns.js";const n=` fragment OrderSummary on OrderTotal { grand_total { value diff --git a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.js b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.js new file mode 100644 index 0000000000..6b9b316048 --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.js @@ -0,0 +1,11 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import{h}from"./network-error.js";import{f,h as l}from"./fetch-graphql.js";import{a as O}from"./getGuestOrder.graphql.js";import{b as i}from"./transform-customer-orders-returns.js";const T=t=>{var a,m,r,c,u,d;return{email:((m=(a=t==null?void 0:t.data)==null?void 0:a.customer)==null?void 0:m.email)||"",firstname:((c=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:c.firstname)||"",lastname:((d=(u=t==null?void 0:t.data)==null?void 0:u.customer)==null?void 0:d.lastname)||""}},E=(t,a)=>{var r,c;if(!((r=t==null?void 0:t.data)!=null&&r.guestOrder))return null;const m=(c=t==null?void 0:t.data)==null?void 0:c.guestOrder;return i(m,a)},k=(t,a)=>{var r,c;if(!((r=t==null?void 0:t.data)!=null&&r.guestOrderByToken))return null;const m=(c=t==null?void 0:t.data)==null?void 0:c.guestOrderByToken;return i(m,a)},g=` + query GET_CUSTOMER { + customer { + firstname + lastname + email + } + } +`,B=async()=>await f(g,{method:"GET",cache:"force-cache"}).then(t=>{var a;return(a=t.errors)!=null&&a.length?l(t.errors):T(t)}).catch(h),C=async t=>await f(O,{method:"GET",cache:"no-cache",variables:{input:t}}).then(a=>E(a)).catch(h);export{C as a,B as g,k as t}; diff --git a/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js b/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js index 2bde8978d2..8f697f9dc6 100644 --- a/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js +++ b/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js @@ -1,12 +1,13 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{f as o,h as s}from"./fetch-graphql.js";function i(e){return e?{orderCancellationEnabled:e.order_cancellation_enabled,orderCancellationReasons:e.order_cancellation_reasons,shoppingCartDisplayPrice:e.orders_invoices_credit_memos_display_price,shoppingOrdersDisplaySubtotal:e.orders_invoices_credit_memos_display_subtotal,shoppingOrdersDisplayShipping:e.orders_invoices_credit_memos_display_shipping_amount,shoppingOrdersDisplayGrandTotal:e.orders_invoices_credit_memos_display_grandtotal,shoppingOrdersDisplayFullSummary:e.orders_invoices_credit_memos_display_full_summary,shoppingOrdersDisplayZeroTax:e.orders_invoices_credit_memos_display_zero_tax}:null}const _=` +import{f as s,h as i}from"./fetch-graphql.js";function o(e){return e?{baseMediaUrl:e.base_media_url,orderCancellationEnabled:e.order_cancellation_enabled,orderCancellationReasons:e.order_cancellation_reasons,shoppingCartDisplayPrice:e.orders_invoices_credit_memos_display_price,shoppingOrdersDisplaySubtotal:e.orders_invoices_credit_memos_display_subtotal,shoppingOrdersDisplayShipping:e.orders_invoices_credit_memos_display_shipping_amount,shoppingOrdersDisplayGrandTotal:e.orders_invoices_credit_memos_display_grandtotal,shoppingOrdersDisplayFullSummary:e.orders_invoices_credit_memos_display_full_summary,shoppingOrdersDisplayZeroTax:e.orders_invoices_credit_memos_display_zero_tax}:null}const _=` query STORE_CONFIG_QUERY { storeConfig { order_cancellation_enabled order_cancellation_reasons { description } + base_media_url orders_invoices_credit_memos_display_price orders_invoices_credit_memos_display_shipping_amount orders_invoices_credit_memos_display_subtotal @@ -15,4 +16,4 @@ query STORE_CONFIG_QUERY { orders_invoices_credit_memos_display_zero_tax } } -`,c=async()=>o(_,{method:"GET",cache:"force-cache"}).then(({errors:e,data:r})=>e?s(e):i(r.storeConfig));export{c as g}; +`,l=async()=>s(_,{method:"GET",cache:"force-cache"}).then(({errors:e,data:r})=>e?i(e):o(r.storeConfig));export{l as g}; diff --git a/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js b/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js index e01dd91a6e..c6d464d3c9 100644 --- a/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js +++ b/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{P as c,a as u,G as l,O as E,B as m,b as d}from"./transform-order-details.js";import{O,A as D,G as R}from"./getGuestOrder.graphql.js";import{f as i,h as _}from"./fetch-graphql.js";const T=` +import{P as c,a as u,G as l,O as E,B as m,b as d}from"./transform-customer-orders-returns.js";import{O,A as D,G as R}from"./getGuestOrder.graphql.js";import{f as i,h as _}from"./fetch-graphql.js";const T=` mutation CANCEL_ORDER_MUTATION($orderId: ID!, $reason: String!) { cancelOrder(input: { order_id: $orderId, reason: $reason }) { error diff --git a/scripts/__dropins__/storefront-order/chunks/requestReturn.js b/scripts/__dropins__/storefront-order/chunks/requestReturn.js index 9d1c33e47d..296c4f6e8b 100644 --- a/scripts/__dropins__/storefront-order/chunks/requestReturn.js +++ b/scripts/__dropins__/storefront-order/chunks/requestReturn.js @@ -49,4 +49,4 @@ mutation REQUEST_RETURN_ORDER($input: RequestReturnInput!) { } } } -${_}`,y=async n=>{const t=c(n,"snakeCase",{});return await s(T,{method:"POST",variables:{input:t}}).then(e=>{var u;if((u=e.errors)!=null&&u.length)return o(e.errors);const{created_at:r,...a}=e.data.requestReturn.return;return{...a,createdAt:r}}).catch(i)};export{f as g,y as r}; +${_}`,y=async n=>{const t=c(n,"snakeCase",{});return await s(T,{method:"POST",variables:{input:t}}).then(e=>{var u;if((u=e.errors)!=null&&u.length)return o(e.errors);const{created_at:r,...a}=e.data.requestReturn.return;return{...a,createdAt:r}}).catch(i)};export{_ as R,f as g,y as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/transform-customer-orders-returns.js b/scripts/__dropins__/storefront-order/chunks/transform-customer-orders-returns.js new file mode 100644 index 0000000000..b562f132b5 --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/transform-customer-orders-returns.js @@ -0,0 +1,142 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import{a as z}from"./convertCase.js";const d=` + fragment ProductDetails on ProductInterface { + __typename + canonical_url + url_key + uid + name + sku + only_x_left_in_stock + stock_status + thumbnail { + label + url + } + price_range { + maximum_price { + regular_price { + currency + value + } + } + } + } +`,r=` + fragment PriceDetails on OrderItemInterface { + prices { + price_including_tax { + value + currency + } + original_price { + value + currency + } + original_price_including_tax { + value + currency + } + price { + value + currency + } + } + } +`,m=` + fragment GiftCardDetails on GiftCardOrderItem { + ...PriceDetails + gift_message { + message + } + gift_card { + recipient_name + recipient_email + sender_name + sender_email + message + } + } +`,I=` + fragment OrderItemDetails on OrderItemInterface { + __typename + status + product_sku + eligible_for_return + product_name + product_url_key + id + quantity_ordered + quantity_shipped + quantity_canceled + quantity_invoiced + quantity_refunded + quantity_return_requested + product_sale_price { + value + currency + } + selected_options { + label + value + } + product { + ...ProductDetails + } + ...PriceDetails + } +`,nn=` + fragment BundleOrderItemDetails on BundleOrderItem { + ...PriceDetails + bundle_options { + uid + label + values { + uid + product_name + } + } + } +`,an=` + fragment OrderReturns on Returns { + __typename + items { + number + status + created_at + shipping { + tracking { + status { + text + type + } + carrier { + uid + label + } + tracking_number + } + } + order { + number + token + } + items { + uid + quantity + status + request_quantity + order_item { + ...OrderItemDetails + ... on GiftCardOrderItem { + ...GiftCardDetails + product { + ...ProductDetails + } + } + } + } + } + } +`,H=a=>a||0,J=a=>{var n,i,l;return{...a,canonicalUrl:(a==null?void 0:a.canonical_url)||"",urlKey:(a==null?void 0:a.url_key)||"",id:(a==null?void 0:a.uid)||"",name:(a==null?void 0:a.name)||"",sku:(a==null?void 0:a.sku)||"",image:((n=a==null?void 0:a.image)==null?void 0:n.url)||"",productType:(a==null?void 0:a.__typename)||"",thumbnail:{label:((i=a==null?void 0:a.thumbnail)==null?void 0:i.label)||"",url:((l=a==null?void 0:a.thumbnail)==null?void 0:l.url)||""}}},V=a=>{if(!a||!("selected_options"in a))return;const n={};for(const i of a.selected_options)n[i.label]=i.value;return n},W=a=>{const n=a==null?void 0:a.map(l=>({uid:l.uid,label:l.label,values:l.values.map(t=>t.product_name).join(", ")})),i={};return n==null||n.forEach(l=>{i[l.label]=l.values}),Object.keys(i).length>0?i:null},X=a=>(a==null?void 0:a.length)>0?{count:a.length,result:a.map(n=>n.title).join(", ")}:null,Y=a=>({quantityCanceled:(a==null?void 0:a.quantity_canceled)??0,quantityInvoiced:(a==null?void 0:a.quantity_invoiced)??0,quantityOrdered:(a==null?void 0:a.quantity_ordered)??0,quantityRefunded:(a==null?void 0:a.quantity_refunded)??0,quantityReturned:(a==null?void 0:a.quantity_returned)??0,quantityShipped:(a==null?void 0:a.quantity_shipped)??0,quantityReturnRequested:(a==null?void 0:a.quantity_return_requested)??0}),K=a=>a==null?void 0:a.filter(n=>n.__typename).map(n=>{var p,b,O,q,R,u,g,f,y,v,E,N,h,T,k,C,D,P,A,G,S,x,L,F,M,B,Q,U,j,w;const{quantityCanceled:i,quantityInvoiced:l,quantityOrdered:t,quantityRefunded:s,quantityReturned:c,quantityShipped:_,quantityReturnRequested:e}=Y(n);return{type:n==null?void 0:n.__typename,eligibleForReturn:n==null?void 0:n.eligible_for_return,productSku:n==null?void 0:n.product_sku,productName:n.product_name,productUrlKey:n.product_url_key,quantityCanceled:i,quantityInvoiced:l,quantityOrdered:t,quantityRefunded:s,quantityReturned:c,quantityShipped:_,quantityReturnRequested:e,id:n==null?void 0:n.id,discounted:((q=(O=(b=(p=n==null?void 0:n.product)==null?void 0:p.price_range)==null?void 0:b.maximum_price)==null?void 0:O.regular_price)==null?void 0:q.value)*(n==null?void 0:n.quantity_ordered)!==((R=n==null?void 0:n.product_sale_price)==null?void 0:R.value)*(n==null?void 0:n.quantity_ordered),total:{value:((u=n==null?void 0:n.product_sale_price)==null?void 0:u.value)*(n==null?void 0:n.quantity_ordered)||0,currency:((g=n==null?void 0:n.product_sale_price)==null?void 0:g.currency)||""},totalInclTax:{value:((f=n==null?void 0:n.product_sale_price)==null?void 0:f.value)*(n==null?void 0:n.quantity_ordered)||0,currency:(y=n==null?void 0:n.product_sale_price)==null?void 0:y.currency},price:{value:((v=n==null?void 0:n.product_sale_price)==null?void 0:v.value)||0,currency:(E=n==null?void 0:n.product_sale_price)==null?void 0:E.currency},priceInclTax:{value:((N=n==null?void 0:n.product_sale_price)==null?void 0:N.value)||0,currency:(h=n==null?void 0:n.product_sale_price)==null?void 0:h.currency},totalQuantity:H(n==null?void 0:n.quantity_ordered),regularPrice:{value:(D=(C=(k=(T=n==null?void 0:n.product)==null?void 0:T.price_range)==null?void 0:k.maximum_price)==null?void 0:C.regular_price)==null?void 0:D.value,currency:(S=(G=(A=(P=n==null?void 0:n.product)==null?void 0:P.price_range)==null?void 0:A.maximum_price)==null?void 0:G.regular_price)==null?void 0:S.currency},product:J(n==null?void 0:n.product),thumbnail:{label:((L=(x=n==null?void 0:n.product)==null?void 0:x.thumbnail)==null?void 0:L.label)||"",url:((M=(F=n==null?void 0:n.product)==null?void 0:F.thumbnail)==null?void 0:M.url)||""},giftCard:(n==null?void 0:n.__typename)==="GiftCardOrderItem"?{senderName:((B=n.gift_card)==null?void 0:B.sender_name)||"",senderEmail:((Q=n.gift_card)==null?void 0:Q.sender_email)||"",recipientEmail:((U=n.gift_card)==null?void 0:U.recipient_email)||"",recipientName:((j=n.gift_card)==null?void 0:j.recipient_name)||"",message:((w=n.gift_card)==null?void 0:w.message)||""}:void 0,configurableOptions:V(n),bundleOptions:n.__typename==="BundleOrderItem"?W(n.bundle_options):null,itemPrices:n.prices,downloadableLinks:n.__typename==="DownloadableOrderItem"?X(n==null?void 0:n.downloadable_links):null}}),Z=(a,n)=>{var q,R,u,g,f;const i=K(a.items),l=((q=$(a==null?void 0:a.returns))==null?void 0:q.ordersReturn)??[],t=n?l.filter(y=>y.returnNumber===n):l,{total:s,...c}=z({...a,items:i,returns:t},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),_=(R=a==null?void 0:a.payment_methods)==null?void 0:R[0],e=(_==null?void 0:_.type)||"",p=(_==null?void 0:_.name)||"",b=(u=c==null?void 0:c.items)==null?void 0:u.reduce((y,v)=>y+(v==null?void 0:v.totalQuantity),0);return{...s,...c,totalQuantity:b,shipping:{amount:((g=s==null?void 0:s.totalShipping)==null?void 0:g.value)??0,currency:((f=s==null?void 0:s.totalShipping)==null?void 0:f.currency)||"",code:c.shippingMethod??""},payments:[{code:e,name:p}]}},un=(a,n,i)=>{var l,t,s,c,_,e,p;if((c=(s=(t=(l=n==null?void 0:n.data)==null?void 0:l.customer)==null?void 0:t.orders)==null?void 0:s.items)!=null&&c.length&&a==="orderData"){const b=(p=(e=(_=n==null?void 0:n.data)==null?void 0:_.customer)==null?void 0:e.orders)==null?void 0:p.items[0];return Z(b,i)}return null},$=a=>{var t;if(!((t=a==null?void 0:a.items)!=null&&t.length))return null;const n=a==null?void 0:a.items,i=a==null?void 0:a.page_info;return{ordersReturn:[...n].sort((s,c)=>+c.number-+s.number).map(s=>{var q,R;const{order:c,status:_,number:e,created_at:p}=s,b=((R=(q=s==null?void 0:s.shipping)==null?void 0:q.tracking)==null?void 0:R.map(u=>{const{status:g,carrier:f,tracking_number:y}=u;return{status:g,carrier:f,trackingNumber:y}}))??[],O=s.items.map(u=>{var h;const g=u==null?void 0:u.quantity,f=u==null?void 0:u.status,y=u==null?void 0:u.request_quantity,v=u==null?void 0:u.uid,E=u==null?void 0:u.order_item,N=((h=K([E]))==null?void 0:h.reduce((T,k)=>k,{}))??{};return{uid:v,quantity:g,status:f,requestQuantity:y,...N}});return{createdReturnAt:p,returnStatus:_,token:c==null?void 0:c.token,orderNumber:c==null?void 0:c.number,returnNumber:e,items:O,tracking:b}}),...i?{pageInfo:{pageSize:i.page_size,totalPages:i.total_pages,currentPage:i.current_page}}:{}}};export{nn as B,m as G,I as O,d as P,an as R,r as a,Z as b,un as c,$ as t}; diff --git a/scripts/__dropins__/storefront-order/chunks/transform-order-details.js b/scripts/__dropins__/storefront-order/chunks/transform-order-details.js deleted file mode 100644 index 5097738f53..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/transform-order-details.js +++ /dev/null @@ -1,142 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{a as z}from"./convertCase.js";const d=` - fragment ProductDetails on ProductInterface { - __typename - canonical_url - url_key - uid - name - sku - only_x_left_in_stock - stock_status - thumbnail { - label - url - } - price_range { - maximum_price { - regular_price { - currency - value - } - } - } - } -`,r=` - fragment PriceDetails on OrderItemInterface { - prices { - price_including_tax { - value - currency - } - original_price { - value - currency - } - original_price_including_tax { - value - currency - } - price { - value - currency - } - } - } -`,m=` - fragment GiftCardDetails on GiftCardOrderItem { - ...PriceDetails - gift_message { - message - } - gift_card { - recipient_name - recipient_email - sender_name - sender_email - message - } - } -`,I=` - fragment OrderItemDetails on OrderItemInterface { - __typename - status - product_sku - eligible_for_return - product_name - product_url_key - id - quantity_ordered - quantity_shipped - quantity_canceled - quantity_invoiced - quantity_refunded - quantity_return_requested - product_sale_price { - value - currency - } - selected_options { - label - value - } - product { - ...ProductDetails - } - ...PriceDetails - } -`,nn=` - fragment BundleOrderItemDetails on BundleOrderItem { - ...PriceDetails - bundle_options { - uid - label - values { - uid - product_name - } - } - } -`,an=` - fragment OrderReturns on Returns { - __typename - items { - number - status - created_at - shipping { - tracking { - status { - text - type - } - carrier { - uid - label - } - tracking_number - } - } - order { - number - token - } - items { - uid - quantity - status - request_quantity - order_item { - ...OrderItemDetails - ... on GiftCardOrderItem { - ...GiftCardDetails - product { - ...ProductDetails - } - } - } - } - } - } -`,H=a=>{var t;if(!((t=a==null?void 0:a.items)!=null&&t.length))return null;const n=a==null?void 0:a.items,s=a==null?void 0:a.page_info;return{ordersReturn:[...n].sort((l,u)=>+u.number-+l.number).map(l=>{var q,R;const{order:u,status:_,number:e,created_at:y}=l,b=((R=(q=l==null?void 0:l.shipping)==null?void 0:q.tracking)==null?void 0:R.map(i=>{const{status:p,carrier:g,tracking_number:f}=i;return{status:p,carrier:g,trackingNumber:f}}))??[],h=l.items.map(i=>{var E;const p=i==null?void 0:i.quantity,g=i==null?void 0:i.status,f=i==null?void 0:i.request_quantity,v=i==null?void 0:i.uid,O=i==null?void 0:i.order_item,N=((E=K([O]))==null?void 0:E.reduce((T,k)=>k,{}))??{};return{uid:v,quantity:p,status:g,requestQuantity:f,...N}});return{createdReturnAt:y,returnStatus:_,token:u==null?void 0:u.token,orderNumber:u==null?void 0:u.number,returnNumber:e,items:h,tracking:b}}),...s?{pageInfo:{pageSize:s.page_size,totalPages:s.total_pages,currentPage:s.current_page}}:{}}},J=a=>a||0,V=a=>{var n,s,c;return{...a,canonicalUrl:(a==null?void 0:a.canonical_url)||"",urlKey:(a==null?void 0:a.url_key)||"",id:(a==null?void 0:a.uid)||"",name:(a==null?void 0:a.name)||"",sku:(a==null?void 0:a.sku)||"",image:((n=a==null?void 0:a.image)==null?void 0:n.url)||"",productType:(a==null?void 0:a.__typename)||"",thumbnail:{label:((s=a==null?void 0:a.thumbnail)==null?void 0:s.label)||"",url:((c=a==null?void 0:a.thumbnail)==null?void 0:c.url)||""}}},W=a=>{if(!a||!("selected_options"in a))return;const n={};for(const s of a.selected_options)n[s.label]=s.value;return n},X=a=>{const n=a==null?void 0:a.map(c=>({uid:c.uid,label:c.label,values:c.values.map(t=>t.product_name).join(", ")})),s={};return n==null||n.forEach(c=>{s[c.label]=c.values}),Object.keys(s).length>0?s:null},Y=a=>(a==null?void 0:a.length)>0?{count:a.length,result:a.map(n=>n.title).join(", ")}:null,Z=a=>({quantityCanceled:(a==null?void 0:a.quantity_canceled)??0,quantityInvoiced:(a==null?void 0:a.quantity_invoiced)??0,quantityOrdered:(a==null?void 0:a.quantity_ordered)??0,quantityRefunded:(a==null?void 0:a.quantity_refunded)??0,quantityReturned:(a==null?void 0:a.quantity_returned)??0,quantityShipped:(a==null?void 0:a.quantity_shipped)??0,quantityReturnRequested:(a==null?void 0:a.quantity_return_requested)??0}),K=a=>a==null?void 0:a.filter(n=>n.__typename).map(n=>{var y,b,h,q,R,i,p,g,f,v,O,N,E,T,k,C,D,P,A,G,S,x,L,F,M,B,Q,U,j,w;const{quantityCanceled:s,quantityInvoiced:c,quantityOrdered:t,quantityRefunded:l,quantityReturned:u,quantityShipped:_,quantityReturnRequested:e}=Z(n);return{type:n==null?void 0:n.__typename,eligibleForReturn:n==null?void 0:n.eligible_for_return,productSku:n==null?void 0:n.product_sku,productName:n.product_name,productUrlKey:n.product_url_key,quantityCanceled:s,quantityInvoiced:c,quantityOrdered:t,quantityRefunded:l,quantityReturned:u,quantityShipped:_,quantityReturnRequested:e,id:n==null?void 0:n.id,discounted:((q=(h=(b=(y=n==null?void 0:n.product)==null?void 0:y.price_range)==null?void 0:b.maximum_price)==null?void 0:h.regular_price)==null?void 0:q.value)*(n==null?void 0:n.quantity_ordered)!==((R=n==null?void 0:n.product_sale_price)==null?void 0:R.value)*(n==null?void 0:n.quantity_ordered),total:{value:((i=n==null?void 0:n.product_sale_price)==null?void 0:i.value)*(n==null?void 0:n.quantity_ordered)||0,currency:((p=n==null?void 0:n.product_sale_price)==null?void 0:p.currency)||""},totalInclTax:{value:((g=n==null?void 0:n.product_sale_price)==null?void 0:g.value)*(n==null?void 0:n.quantity_ordered)||0,currency:(f=n==null?void 0:n.product_sale_price)==null?void 0:f.currency},price:{value:((v=n==null?void 0:n.product_sale_price)==null?void 0:v.value)||0,currency:(O=n==null?void 0:n.product_sale_price)==null?void 0:O.currency},priceInclTax:{value:((N=n==null?void 0:n.product_sale_price)==null?void 0:N.value)||0,currency:(E=n==null?void 0:n.product_sale_price)==null?void 0:E.currency},totalQuantity:J(n==null?void 0:n.quantity_ordered),regularPrice:{value:(D=(C=(k=(T=n==null?void 0:n.product)==null?void 0:T.price_range)==null?void 0:k.maximum_price)==null?void 0:C.regular_price)==null?void 0:D.value,currency:(S=(G=(A=(P=n==null?void 0:n.product)==null?void 0:P.price_range)==null?void 0:A.maximum_price)==null?void 0:G.regular_price)==null?void 0:S.currency},product:V(n==null?void 0:n.product),thumbnail:{label:((L=(x=n==null?void 0:n.product)==null?void 0:x.thumbnail)==null?void 0:L.label)||"",url:((M=(F=n==null?void 0:n.product)==null?void 0:F.thumbnail)==null?void 0:M.url)||""},giftCard:(n==null?void 0:n.__typename)==="GiftCardOrderItem"?{senderName:((B=n.gift_card)==null?void 0:B.sender_name)||"",senderEmail:((Q=n.gift_card)==null?void 0:Q.sender_email)||"",recipientEmail:((U=n.gift_card)==null?void 0:U.recipient_email)||"",recipientName:((j=n.gift_card)==null?void 0:j.recipient_name)||"",message:((w=n.gift_card)==null?void 0:w.message)||""}:void 0,configurableOptions:W(n),bundleOptions:n.__typename==="BundleOrderItem"?X(n.bundle_options):null,itemPrices:n.prices,downloadableLinks:n.__typename==="DownloadableOrderItem"?Y(n==null?void 0:n.downloadable_links):null}}),$=(a,n)=>{var q,R,i,p,g,f;const s=K(a.items),c=((q=H(a==null?void 0:a.returns))==null?void 0:q.ordersReturn)??[],t=n?c.filter(v=>v.returnNumber===n):c,{total:l,...u}=z({...a,items:s,returns:t},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),_=(R=a==null?void 0:a.payment_methods)==null?void 0:R[0],e=(_==null?void 0:_.type)||"",y=(_==null?void 0:_.name)||"",b=(i=u==null?void 0:u.items)==null?void 0:i.reduce((v,O)=>v+(O==null?void 0:O.totalQuantity),0);return{...l,...u,totalQuantity:b,shipping:{amount:((p=u==null?void 0:u.total)==null?void 0:p.totalShipping.value)??0,currency:((f=(g=u.total)==null?void 0:g.totalShipping)==null?void 0:f.currency)||"",code:u.shippingMethod??""},payments:[{code:e,name:y}]}},un=(a,n,s)=>{var c,t,l,u,_,e,y;if((u=(l=(t=(c=n==null?void 0:n.data)==null?void 0:c.customer)==null?void 0:t.orders)==null?void 0:l.items)!=null&&u.length&&a==="orderData"){const b=(y=(e=(_=n==null?void 0:n.data)==null?void 0:_.customer)==null?void 0:e.orders)==null?void 0:y.items[0];return $(b,s)}return null};export{nn as B,m as G,I as O,d as P,an as R,r as a,$ as b,un as c,H as t}; diff --git a/scripts/__dropins__/storefront-order/chunks/useGetStoreConfig.js b/scripts/__dropins__/storefront-order/chunks/useGetStoreConfig.js new file mode 100644 index 0000000000..4398ad0c43 --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/useGetStoreConfig.js @@ -0,0 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import{useState as i,useEffect as s}from"@dropins/tools/preact-hooks.js";import{g as f}from"./getStoreConfig.js";const c=()=>{const[n,e]=i(null);return s(()=>{const o=sessionStorage.getItem("orderStoreConfig"),r=o?JSON.parse(o):null;r?e(r):f().then(t=>{t&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(t)),e(t))})},[]),n};export{c as u}; diff --git a/scripts/__dropins__/storefront-order/components/OrderHeader/OrderHeader.d.ts b/scripts/__dropins__/storefront-order/components/OrderHeader/OrderHeader.d.ts new file mode 100644 index 0000000000..52b21f7f41 --- /dev/null +++ b/scripts/__dropins__/storefront-order/components/OrderHeader/OrderHeader.d.ts @@ -0,0 +1,9 @@ +import { FunctionComponent } from 'preact'; + +export interface OrderHeaderProps { + customerName?: string; + onSignUpClick?: () => void; + orderNumber: string; +} +export declare const OrderHeader: FunctionComponent; +//# sourceMappingURL=OrderHeader.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/components/OrderHeader/index.d.ts b/scripts/__dropins__/storefront-order/components/OrderHeader/index.d.ts new file mode 100644 index 0000000000..17a315206a --- /dev/null +++ b/scripts/__dropins__/storefront-order/components/OrderHeader/index.d.ts @@ -0,0 +1,2 @@ +export * from './OrderHeader'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/components/OrderLoaders/OrderLoaders.d.ts b/scripts/__dropins__/storefront-order/components/OrderLoaders/OrderLoaders.d.ts index d24057df04..18ebf55c54 100644 --- a/scripts/__dropins__/storefront-order/components/OrderLoaders/OrderLoaders.d.ts +++ b/scripts/__dropins__/storefront-order/components/OrderLoaders/OrderLoaders.d.ts @@ -6,4 +6,5 @@ export declare const CardLoader: ({ testId, withCard, }: { export declare const DetailsSkeleton: (props: any) => import("preact").JSX.Element; export declare const OrderProductListSkeleton: () => import("preact").JSX.Element; export declare const OrderSummarySkeleton: () => import("preact").JSX.Element; +export declare const OrderHeaderSkeleton: () => import("preact").JSX.Element; //# sourceMappingURL=OrderLoaders.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/components/index.d.ts b/scripts/__dropins__/storefront-order/components/index.d.ts index 1960b8b54f..b27b68b1a2 100644 --- a/scripts/__dropins__/storefront-order/components/index.d.ts +++ b/scripts/__dropins__/storefront-order/components/index.d.ts @@ -1,17 +1,18 @@ -export * from './OrderSearchForm'; -export * from './Form'; -export * from './OrderStatusContent'; -export * from './ShippingStatusCard'; -export * from './OrderLoaders'; -export * from './OrderActions'; export * from './CustomerDetailsContent'; export * from './EmptyList'; -export * from './ReturnsListContent'; -export * from './OrderProductListContent'; +export * from './Form'; +export * from './OrderActions'; +export * from './OrderCancel'; export * from './OrderCostSummaryContent'; -export * from './ReturnOrderProductList'; +export * from './OrderHeader'; +export * from './OrderLoaders'; +export * from './OrderProductListContent'; +export * from './OrderSearchForm'; +export * from './OrderStatusContent'; +export * from './Reorder'; export * from './ReturnOrderMessage'; +export * from './ReturnOrderProductList'; export * from './ReturnReasonForm'; -export * from './OrderCancel'; -export * from './Reorder'; +export * from './ReturnsListContent'; +export * from './ShippingStatusCard'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/configs/mock.config.d.ts b/scripts/__dropins__/storefront-order/configs/mock.config.d.ts index f66c00d6bb..ba35296ddc 100644 --- a/scripts/__dropins__/storefront-order/configs/mock.config.d.ts +++ b/scripts/__dropins__/storefront-order/configs/mock.config.d.ts @@ -405,6 +405,7 @@ export declare const transformMockOrderOutput: { availableActions: string[]; status: string; number: string; + email: string; id: string; orderDate: string; carrier: string; @@ -544,6 +545,54 @@ export declare const transformMockOrderOutput: { recipientName: string; }; id: undefined; + selectedOptions?: undefined; + } | { + type: string; + id: string; + giftCard: undefined; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + canonicalUrl: string; + id: string; + name: string; + sku: string; + image: string; + productType: string; + thumbnail: { + label: string; + url: string; + }; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Size?: undefined; + Color?: undefined; + }; + selectedOptions?: undefined; } | { type: string; id: string; @@ -570,6 +619,10 @@ export declare const transformMockOrderOutput: { value: number; currency: string; }; + selectedOptions: { + label: string; + value: string; + }[]; product: { canonicalUrl: string; id: string; @@ -636,6 +689,7 @@ export declare const transformMockOrderOutput: { Size: string; Color: string; }; + selectedOptions?: undefined; })[]; totalQuantity: number; shipping: { @@ -3658,4 +3712,17 @@ export declare const customerReturnDetailsFullMock: { })[]; }; }; +export declare const storeConfigMock: { + baseMediaUrl: string; + orderCancellationEnabled: boolean; + orderCancellationReasons: { + description: string; + }[]; + shoppingCartDisplayPrice: number; + shoppingOrdersDisplaySubtotal: number; + shoppingOrdersDisplayShipping: number; + shoppingOrdersDisplayGrandTotal: boolean; + shoppingOrdersDisplayFullSummary: boolean; + shoppingOrdersDisplayZeroTax: boolean; +}; //# sourceMappingURL=mock.config.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/containers/CreateReturn.js b/scripts/__dropins__/storefront-order/containers/CreateReturn.js index 69a4351032..7081ff9cd0 100644 --- a/scripts/__dropins__/storefront-order/containers/CreateReturn.js +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -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,Checkbox as P,Button as Q,CartItem as H,Image as $,Header as W,InLineAlert as j}from"@dropins/tools/components.js";import{u as V,a as Z}from"../chunks/OrderCancel.js";import{useState as v,useRef as D,useEffect as T,useCallback as F}from"@dropins/tools/preact-hooks.js";import{events as z}from"@dropins/tools/event-bus.js";import{s as U}from"../chunks/setTaxStatus.js";import{createRef as G,Fragment as J}from"@dropins/tools/preact.js";import{s as K,p as X,r as Y,m as I}from"../chunks/returnOrdersHelper.js";import{g as ee,r as te}from"../chunks/requestReturn.js";import{g as ne}from"../chunks/getStoreConfig.js";import*as R from"@dropins/tools/preact-compat.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=D([]);p.current.length!==c.length&&(p.current=c.map((n,o)=>p.current[o]||G())),T(()=>{const n=z.on("order/data",o=>{l(o);const O=K(o);u(O),f(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ne().then(n=>{if(!n)return;const o=U(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=X(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}},pe=({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(P,{"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})})]}),he=({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})]}),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}=V({fieldsConfig:Y(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=I(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(J,{children:[r(H,{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($,{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(Z,{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})]})})]})},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(pe,{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(he,{translations:g,routeReturnSuccess:l,orderData:c}),error:null};return x("div",{className:A(["order-create-return",s]),children:[r(W,{title:g.headerText}),_.heading?r(j,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",..._}):null,w[C]]})};export{Ae as CreateReturn,Ae as default}; +import{jsx as r,jsxs as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as B,Slot as P}from"@dropins/tools/lib.js";import{Icon as H,Header as $,InLineAlert as W,Button as F,Checkbox as j,CartItem as V,Image as Z}from"@dropins/tools/components.js";import{useState as w,useRef as D,useEffect as q,useCallback as E}from"@dropins/tools/preact-hooks.js";import{u as U,a as z}from"../chunks/ShippingStatusCard.js";import*as C from"@dropins/tools/preact-compat.js";import{u as G}from"../chunks/useGetStoreConfig.js";import{createRef as J,Fragment as K}from"@dropins/tools/preact.js";import{s as X,p as Y,r as I,m as ee}from"../chunks/returnOrdersHelper.js";import{events as te}from"@dropins/tools/event-bus.js";import{g as ne,r as re}from"../chunks/requestReturn.js";import{s as se}from"../chunks/setTaxStatus.js";import{S as ae,C as ce}from"../chunks/CartSummaryItem.js";import{a as ie}from"../chunks/OrderLoaders.js";import{useText as ue}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getFormValues.js";import"../chunks/network-error.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const oe=a=>C.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},C.createElement("g",{clipPath:"url(#clip0_841_1324)"},C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),C.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"})),C.createElement("defs",null,C.createElement("clipPath",{id:"clip0_841_1324"},C.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),le=a=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},C.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"}),C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),de=({onSuccess:a,onError:s,handleSetInLineAlert:c,orderData:l})=>{const[g,O]=w({id:"",email:"",...l}),[d,f]=w("products"),[L,k]=w(!0),[p,m]=w([]),[_,R]=w([]),[y,t]=w([]),u=D([]);u.current.length!==p.length&&(u.current=p.map((n,o)=>u.current[o]||J())),q(()=>{const n=te.on("order/data",o=>{O(o);const S=X(o);t(S),k(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),q(()=>{ne("RMA_ITEM").then(n=>{n!=null&&n.length&&(R(n),k(!1))})},[]);const e=E(n=>{m(o=>o.findIndex(h=>(h==null?void 0:h.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(h=>(h==null?void 0:h.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),i=E(n=>{f(n),c(),n==="products"&&m([])},[c]),b=E((n,o)=>{const S=p.map(h=>h.productSku===o?{...h,currentReturnOrderQuantity:n}:h);m(S)},[p]),N=E(async(n,o)=>{if(!o)return;k(!0);const S={orderUid:g.id,contactEmail:g.email},h=Y(u);re({...S,items:h}).then(v=>{a==null||a(v),i("success"),c()}).catch(v=>{s==null||s(v.message),c({type:"error",heading:v.message})}),k(!1)},[i,s,a,c,g]);return{order:g,steps:d,loading:L,formsRef:u,attributesList:_,selectedProductList:p,itemsEligibleForReturn:y,handleSelectedProductList:e,handleSetQuantity:b,handleChangeStep:i,onSubmit:N}},pe={success:le,warning:oe,error:ae},he=()=>{const[a,s]=w({type:"success",heading:""}),c=E(l=>{if(!(l!=null&&l.type)){s({type:"success",heading:""});return}const g=r(H,{source:pe[l.type]});s({...l,icon:g})},[]);return{inLineAlertProps:a,handleSetInLineAlert:c}},Pe=({className:a,orderData:s,slots:c,onSuccess:l,onError:g,routeReturnSuccess:O,showConfigurableOptions:d})=>{const f=ue({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:L,handleSetInLineAlert:k}=he(),p=G(),{order:m,itemsEligibleForReturn:_,formsRef:R,attributesList:y,steps:t,loading:u,selectedProductList:e,handleSelectedProductList:i,handleSetQuantity:b,handleChangeStep:N,onSubmit:n}=de({orderData:s,onSuccess:l,onError:g,handleSetInLineAlert:k});if(u)return r("div",{children:r(ie,{})});if(!u&&!y.length)return r("div",{});const o=(p==null?void 0:p.baseMediaUrl)??"",S={products:r(ge,{itemsEligibleForReturn:_,placeholderImage:o,taxConfig:se((p==null?void 0:p.shoppingCartDisplayPrice)??0),slots:c,translations:f,loading:u,selectedProductList:e,handleSelectedProductList:i,showConfigurableOptions:d,handleSetQuantity:b,handleChangeStep:N}),attributes:r(fe,{placeholderImage:o,slots:c,formsRef:R,loading:u,fieldsConfig:y,selectedProductList:e,handleChangeStep:N,translations:f,onSubmit:n}),success:r(me,{translations:f,routeReturnSuccess:O,orderData:m}),error:null};return x("div",{className:B(["order-create-return",a]),children:[r($,{title:f.headerText}),L.heading?r(W,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...L}):null,S[t]]})},me=({routeReturnSuccess:a,translations:s,orderData:c})=>x("div",{className:"order-return-order-message",children:[r("p",{className:"order-return-order-message__title",children:s.successTitle}),r("p",{className:"order-return-order-message__subtitle",children:s.successMessage}),r(F,{href:(a==null?void 0:a(c))??"#",children:s.backStore})]}),ge=({placeholderImage:a,itemsEligibleForReturn:s,slots:c,loading:l,taxConfig:g,translations:O,selectedProductList:d,handleSelectedProductList:f,showConfigurableOptions:L,handleSetQuantity:k,handleChangeStep:p})=>x("ul",{className:"order-return-order-product-list",children:[s==null?void 0:s.map((m,_)=>{const{quantityReturnRequested:R,quantityShipped:y,eligibleForReturn:t}=m,u=d.some(b=>(b==null?void 0:b.productSku)===m.productSku&&m.eligibleForReturn),e=y===R&&t,i=y-R===0?R:y-R;return x("li",{className:B(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",e]]),children:[r(j,{"data-testid":`key_${_}`,name:`key_${_}`,checked:u,disabled:e,onChange:()=>{f({...m,currentReturnOrderQuantity:1})}}),r(ce,{placeholderImage:a,loading:l,product:{...m,totalQuantity:i},itemType:"",taxConfig:g,translations:O,showConfigurableOptions:L,disabledIncrementer:!u,onQuantity:i>1?b=>{k(b,m.productSku)}:void 0}),r(P,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:c==null?void 0:c.ReturnOrderItem})]},m.id)}),r("li",{className:"order-return-order-product-list__item",children:r(F,{type:"button",onClick:()=>p("attributes"),disabled:!d.length,children:O.nextStep})})]}),fe=({placeholderImage:a,slots:s,formsRef:c,selectedProductList:l,loading:g,fieldsConfig:O,translations:d,handleChangeStep:f,onSubmit:L})=>{const{formData:k,errors:p,formRef:m,handleChange:_,handleBlur:R,handleSubmit:y}=U({fieldsConfig:I(O,l==null?void 0:l.length),onSubmit:L});return x("form",{className:"order-return-reason-form",ref:m,onSubmit:y,name:"returnReasonForm",children:[l.map((t,u)=>{var h,v,M,Q,A,T;const e=t==null?void 0:t.giftCard,i=t==null?void 0:t.product,b=ee(O,u),N=`${t==null?void 0:t.id}_${u}`,n=(t==null?void 0:t.currentReturnOrderQuantity)??1,o={...t!=null&&t.currentReturnOrderQuantity?{[d.configurationsListQuantity]:n}:{},...t.configurableOptions||{},...t.bundleOptions||{},...e!=null&&e.senderName?{[d.sender]:e==null?void 0:e.senderName}:{},...e!=null&&e.senderEmail?{[d.sender]:e==null?void 0:e.senderEmail}:{},...e!=null&&e.recipientName?{[d.recipient]:e==null?void 0:e.recipientName}:{},...e!=null&&e.recipientEmail?{[d.recipient]:e==null?void 0:e.recipientEmail}:{},...e!=null&&e.message?{[d.message]:e==null?void 0:e.message}:{},...t!=null&&t.downloadableLinks?{[`${(h=t==null?void 0:t.downloadableLinks)==null?void 0:h.count} ${d.downloadableCount}`]:(v=t==null?void 0:t.downloadableLinks)==null?void 0:v.result}:{}},S=(Q=(M=i==null?void 0:i.thumbnail)==null?void 0:M.url)!=null&&Q.length?i.thumbnail.url:a;return x(K,{children:[r(V,{loading:g,title:r("div",{"data-testid":"product-name",children:(A=t==null?void 0:t.product)==null?void 0:A.name}),sku:r("div",{children:i==null?void 0:i.sku}),image:r(Z,{src:S,alt:((T=i==null?void 0:i.thumbnail)==null?void 0:T.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:o}),r("form",{name:N,ref:c==null?void 0:c.current[u],"data-quantity":n,children:r(z,{className:"className",loading:g,fields:b,onChange:_,onBlur:R,errors:p,values:k})})]},t.id)}),r(P,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:s==null?void 0:s.ReturnFormActions,context:{handleChangeStep:f},children:x("div",{className:"order-return-reason-form__actions",children:[r(F,{variant:"secondary",type:"button",onClick:()=>{f("products")},children:d.backStep}),r(F,{children:d.submit})]})})]})};export{Pe as CreateReturn,Pe as default}; diff --git a/scripts/__dropins__/storefront-order/containers/CustomerDetails.js b/scripts/__dropins__/storefront-order/containers/CustomerDetails.js index 5e65d42237..d3d2deb6ab 100644 --- a/scripts/__dropins__/storefront-order/containers/CustomerDetails.js +++ b/scripts/__dropins__/storefront-order/containers/CustomerDetails.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -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,useMemo as S}from"@dropins/tools/preact-hooks.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"@dropins/tools/preact.js";import{Icon as K,Price as G,Card as J,Header as Q}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import*as u from"@dropins/tools/preact-compat.js";import{f as U}from"../chunks/returnOrdersHelper.js";import{f as X}from"../chunks/formatDateToLocale.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})),oe=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],ie=({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:oe.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}},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}`))},se=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!==""}},ce=({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}=se(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,$]})]})},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}=ie({orderData:e});return r("div",{className:_(["order-customer-details",d]),children:r(ce,{slots:o,loading:g,order:t,title:m,paymentIconsMap:i,normalizeAddress:l,translations:s})})};export{Ne as CustomerDetails,Ne as default}; +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}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js b/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js index aa5ede1190..0c44a5a686 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js +++ b/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -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/OrderCancel.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/event-bus.js";import"@dropins/tools/preact.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/transform-order-details.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}; +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}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js b/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js index 5e15d76563..b949cc7d36 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js +++ b/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -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}; +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 v,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{Price as d,Icon as N,Accordion as b,AccordionSection as f,Card as E,Header as D}from"@dropins/tools/components.js";import{u as k}from"../chunks/useGetStoreConfig.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/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const I=a=>x.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},x.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),A=a=>x.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},x.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),$=a=>x.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},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:a,config:e})=>{const[t,n]=v(!0),[l,r]=v(a),[u,o]=v(null);return T(()=>{if(e){const{shoppingCartDisplayPrice:m,shoppingOrdersDisplayShipping:s,shoppingOrdersDisplaySubtotal:y,...h}=e;o(p=>({...p,...h,shoppingCartDisplayPrice:C(m),shoppingOrdersDisplayShipping:C(s),shoppingOrdersDisplaySubtotal:C(y)})),n(!1)}},[e]),T(()=>{const m=V.on("order/data",s=>{r(s)},{eager:!0});return()=>{m==null||m.off()}},[]),{loading:t,storeConfig:u,order:l}},ut=({withHeader:a,orderData:e,children:t,className:n,...l})=>{const r=k(),{loading:u,storeConfig:o,order:m}=j({orderData:e,config:r}),s=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(R,{order:m,withHeader:a,loading:u,storeConfig:o,translations:s})})},P=({translations:a,order:e,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:a.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(l=e==null?void 0:e.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:a.incl}):null,n.taxExcluded&&n.taxIncluded?i(S,{children:[c(d,{currency:(r=e==null?void 0:e.subtotal)==null?void 0:r.currency,amount:t,size:"small"})," ",c("span",{children:a.excl})]}):null]})]})},W=({translations:a,shoppingOrdersDisplayShipping:e,order:t,totalShipping:n})=>{var l,r,u,o;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:a.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:a.freeShipping})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[e.taxIncluded&&e.taxExcluded?i(S,{children:[c(d,{weight:"normal",currency:(u=t==null?void 0:t.totalShipping)==null?void 0:u.currency,amount:(o=t==null?void 0:t.totalShipping)==null?void 0:o.value,size:"small"}),i("span",{children:[" ",a.excl]})]}):null,e.taxIncluded&&!e.taxExcluded?c("span",{children:a.incl}):null]})]})},q=({translations:a,order:e,totalGiftcardValue:t,totalGiftcardCurrency:n})=>{var r,u,o,m;const l=(r=e==null?void 0:e.discounts)==null?void 0:r.every(s=>s.amount.value===0);return!((u=e==null?void 0:e.discounts)!=null&&u.length)&&(l||!t||t<1)||(o=e==null?void 0:e.discounts)!=null&&o.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:a.discount}),c("span",{children:(m=e==null?void 0:e.discounts)==null?void 0:m.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(N,{source:$,size:"16"}),c("span",{children:a.discountSubtitle.toLocaleUpperCase()})]}),c(d,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},F=({order:a})=>{var e;return c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--coupon",children:(e=a==null?void 0:a.coupons)==null?void 0:e.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:a,renderTaxAccordion:e,totalAccordionTaxValue:t,order:n})=>{var u,o,m;const[l,r]=v(!1);return e?c(b,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:I,iconClose:A,children:i(f,{onStateChange:r,title:a.accordionTitle,secondaryText:c(S,{children:l?null:c(d,{weight:"normal",amount:t,currency:(o=n==null?void 0:n.totalTax)==null?void 0:o.currency})}),renderContentWhenClosed:!1,children:[(m=n==null?void 0:n.taxes)==null?void 0:m.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:a.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:a.tax}),c(d,{currency:(u=n==null?void 0:n.totalTax)==null?void 0:u.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},G=({translations:a,shoppingOrdersDisplaySubtotal:e,order:t})=>{var n,l,r,u;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:a.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"})]}),e.taxExcluded&&e.taxIncluded?i("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:a.totalExcludingTaxes}),c(d,{currency:(r=t==null?void 0:t.grandTotal)==null?void 0:r.currency,amount:((u=t==null?void 0:t.grandTotal)==null?void 0:u.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},R=({translations:a,loading:e,storeConfig:t,order:n,withHeader:l=!0})=>{var h,p,_,O,w,L;if(e||!n)return c(z,{});const r=((h=n==null?void 0:n.totalGiftcard)==null?void 0:h.value)??0,u=((p=n.totalGiftcard)==null?void 0:p.currency)??"",o=((_=n.subtotal)==null?void 0:_.value)??0,m=((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,g)=>{var M;return+((M=g==null?void 0:g.amount)==null?void 0:M.value)+Z},0):0;return i(E,{variant:"secondary",className:H(["order-cost-summary-content"]),children:[l?c(D,{title:a.headerText}):null,i("div",{className:"order-cost-summary-content__wrapper",children:[c(P,{translations:a,order:n,subTotalValue:o,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(W,{translations:a,order:n,totalShipping:m,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(q,{translations:a,order:n,totalGiftcardValue:r,totalGiftcardCurrency:u}),c(F,{order:n}),c(U,{order:n,translations:a,renderTaxAccordion:s,totalAccordionTaxValue:y}),c(G,{translations:a,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})};export{ut as OrderCostSummary,ut as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderHeader.d.ts b/scripts/__dropins__/storefront-order/containers/OrderHeader.d.ts new file mode 100644 index 0000000000..b698d2d3ef --- /dev/null +++ b/scripts/__dropins__/storefront-order/containers/OrderHeader.d.ts @@ -0,0 +1,3 @@ +export * from './OrderHeader/index' +import _default from './OrderHeader/index' +export default _default diff --git a/scripts/__dropins__/storefront-order/containers/OrderHeader.js b/scripts/__dropins__/storefront-order/containers/OrderHeader.js new file mode 100644 index 0000000000..ea4ab4300c --- /dev/null +++ b/scripts/__dropins__/storefront-order/containers/OrderHeader.js @@ -0,0 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +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}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderHeader/OrderHeader.d.ts b/scripts/__dropins__/storefront-order/containers/OrderHeader/OrderHeader.d.ts new file mode 100644 index 0000000000..ced3a986ff --- /dev/null +++ b/scripts/__dropins__/storefront-order/containers/OrderHeader/OrderHeader.d.ts @@ -0,0 +1,5 @@ +import { OrderHeaderProps } from '../../types'; +import { FunctionComponent } from 'preact'; + +export declare const OrderHeader: FunctionComponent; +//# sourceMappingURL=OrderHeader.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/containers/OrderHeader/index.d.ts b/scripts/__dropins__/storefront-order/containers/OrderHeader/index.d.ts new file mode 100644 index 0000000000..829eff409c --- /dev/null +++ b/scripts/__dropins__/storefront-order/containers/OrderHeader/index.d.ts @@ -0,0 +1,3 @@ +export * from './OrderHeader'; +export { OrderHeader as default } from './OrderHeader'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/containers/OrderProductList.js b/scripts/__dropins__/storefront-order/containers/OrderProductList.js index 0bd3dc97db..2c8ad403ba 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderProductList.js +++ b/scripts/__dropins__/storefront-order/containers/OrderProductList.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as a,jsxs as P}from"@dropins/tools/preact-jsx-runtime.js";import{Card as h,Header as x}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as q}from"@dropins/tools/lib.js";import{useState as g,useEffect as L,useMemo as R}from"@dropins/tools/preact-hooks.js";import{events as T}from"@dropins/tools/event-bus.js";import{s as S}from"../chunks/setTaxStatus.js";import{g as b}from"../chunks/getStoreConfig.js";import{Fragment as N}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.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(()=>{b().then(e=>{if(e){const c=S(e==null?void 0:e.shoppingCartDisplayPrice);i(c)}}).finally(()=>{r(!1)})},[]),L(()=>{const e=T.on("order/data",c=>{n(c)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:o,taxConfig:t,order:d}},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(h,{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(N,{children:[d?a(x,{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,{})},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:q(["order-order-product-list",s]),children:a(I,{loading:t,taxConfig:i,order:e,withHeader:r,showConfigurableOptions:d,routeProductDetails:n})})};export{W as OrderProductList,W as default}; +import{jsx as a,jsxs as g}from"@dropins/tools/preact-jsx-runtime.js";import{classes as h}from"@dropins/tools/lib.js";import{Card as q,Header as R}from"@dropins/tools/components.js";import{useState as P,useEffect as S,useMemo as T}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as b}from"../chunks/useGetStoreConfig.js";import{Fragment as x}from"@dropins/tools/preact.js";import{events as N}from"@dropins/tools/event-bus.js";import{s as Q}from"../chunks/setTaxStatus.js";import{a as k}from"../chunks/OrderLoaders.js";import{C as G}from"../chunks/CartSummaryItem.js";import{useText as M}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const v=({orderData:n})=>{const[u,i]=P(!0),[e,r]=P(n);return S(()=>{const t=N.on("order/data",o=>{r(o),i(!1)},{eager:!0});return()=>{t==null||t.off()}},[]),{loading:u,order:e}},Y=({className:n,orderData:u,withHeader:i,showConfigurableOptions:e,routeProductDetails:r})=>{const t=b(),{loading:o,order:d}=v({orderData:u});return a("div",{className:h(["order-order-product-list",n]),children:a(I,{loading:o,placeholderImage:(t==null?void 0:t.baseMediaUrl)??"",taxConfig:Q((t==null?void 0:t.shoppingCartDisplayPrice)??0),order:d,withHeader:i,showConfigurableOptions:e,routeProductDetails:r})})},w=n=>{const u=(n==null?void 0:n.items)??[],i=u.filter(t=>(t==null?void 0:t.eligibleForReturn)&&(t==null?void 0:t.quantityReturnRequested)).map(t=>({...t,totalQuantity:t.quantityReturnRequested})),e=new Map(i.map(t=>[t.id,t])),r=u.map(t=>{const o=e.get(t==null?void 0:t.id);if(o){const d=t.totalQuantity-o.quantityReturnRequested;return d===0?null:{...t,totalQuantity:d}}return t}).filter(t=>t!==null);return{returnedList:i,canceledItems:r==null?void 0:r.filter(t=>t.quantityCanceled),nonCanceledItems:r==null?void 0:r.filter(t=>!t.quantityCanceled)}},I=({placeholderImage:n,loading:u,taxConfig:i,order:e=null,withHeader:r=!0,showConfigurableOptions:t,routeProductDetails:o})=>{const d=!!(e!=null&&e.returnNumber),c=M({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"}),L=T(()=>{var p,f;if(!e)return[];if(!d){const{returnedList:s,canceledItems:m,nonCanceledItems:O}=w(e);return[{type:"returned",list:s,title:c.returned},{type:"cancelled",list:m,title:c.cancelled},{type:"allItems",list:O,title:c.allOrders}].filter(C=>{var y;return((y=C==null?void 0:C.list)==null?void 0:y.length)>0})}return[{type:"returned",list:((f=(p=e.returns.find(s=>s.returnNumber===(e==null?void 0:e.returnNumber)))==null?void 0:p.items)==null?void 0:f.map(s=>({...s,totalQuantity:s.requestQuantity})))??[],title:c.returned}]},[e,d,c]);return e?L.every(l=>l.list.length===0)?null:a(q,{variant:"secondary",className:"order-order-product-list-content",children:L.map((l,p)=>{var s;const f=l.list.reduce((m,{totalQuantity:O})=>O+m,0);return g(x,{children:[r?a(R,{title:`${l.title} (${f})`}):null,a("ul",{className:"order-order-product-list-content__items",children:(s=l.list)==null?void 0:s.map(m=>a("li",{"data-testid":"order-product-list-content-item",children:a(G,{placeholderImage:n,loading:u,product:m,itemType:l.type,taxConfig:i,translations:c,showConfigurableOptions:t,routeProductDetails:o})},m.id))})]},p)})}):a(k,{})};export{Y as OrderProductList,Y as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderReturns.js b/scripts/__dropins__/storefront-order/containers/OrderReturns.js index 1fcfe1cee5..6a98f6c332 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderReturns.js +++ b/scripts/__dropins__/storefront-order/containers/OrderReturns.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as c}from"@dropins/tools/lib.js";import{useState as d,useEffect as R}from"@dropins/tools/preact-hooks.js";import{events as L}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as O}from"../chunks/useIsMobile.js";import"@dropins/tools/preact-compat.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}; +import{jsx as d}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";import{useState as l,useEffect as O}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as b}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as g}from"@dropins/tools/event-bus.js";import{u as w}from"../chunks/useIsMobile.js";import{R as N}from"../chunks/ReturnsListContent.js";import{useText as $}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/returnOrdersHelper.js";import"../chunks/getFormValues.js";import"../chunks/OrderLoaders.js";const h=({orderData:s})=>{const[i,n]=l(s),[o,u]=l([]);return O(()=>{const t=g.on("order/data",e=>{n(e),u(e==null?void 0:e.returns)},{eager:!0});return()=>{t==null||t.off()}},[]),{order:i,orderReturns:o}},A=({slots:s,className:i,orderData:n,withHeader:o,withThumbnails:u,routeReturnDetails:t,routeProductDetails:e,routeTracking:p})=>{const m=b(),{orderReturns:a}=h({orderData:n}),f=w(),r="fullSizeView",c=(m==null?void 0:m.baseMediaUrl)??"",R=$({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 d("div",{className:L(["order-order-returns",i]),children:a.length?d(N,{placeholderImage:c,pageInfo:{pageSize:1,totalPages:1,currentPage:1},minifiedViewKey:r,slots:s,isMobile:f,withOrderNumber:!1,withReturnNumber:!0,orderReturns:a,translations:R,withHeader:o,withThumbnails:u,minifiedView:!1,routeReturnDetails:t,routeProductDetails:e,routeTracking:p,loading:!1}):null})};export{A as OrderReturns,A as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderSearch.js b/scripts/__dropins__/storefront-order/containers/OrderSearch.js index 9c102f1595..bb4523a2ad 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderSearch.js +++ b/scripts/__dropins__/storefront-order/containers/OrderSearch.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsxs as V,jsx as s}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{F as D}from"../chunks/OrderCancel.js";import{useState as v,useCallback as w,useEffect as F,useMemo as U}from"@dropins/tools/preact-hooks.js";import{events as _}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import*as N from"@dropins/tools/preact-compat.js";import{Text as g,useText as H}from"@dropins/tools/i18n.js";import{F as T,g as B}from"../chunks/getFormValues.js";import{r as f}from"../chunks/redirectTo.js";import{g as E,a as z}from"../chunks/getCustomer.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-order-details.js";import"../chunks/convertCase.js";const P=r=>N.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},N.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=({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(g,{id:"Order.OrderSearchForm.title"})}),s("p",{children:s(g,{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(D,{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(g,{id:"Order.OrderSearchForm.button"})},"logIn")})})]}),x=r=>{try{return new URL(window.location.href).searchParams.get(r)}catch{return null}},Z=({onError:r,isAuth:t,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c})=>{const[y,u]=v({text:"",type:"success"}),[b,p]=v(!1),m=H({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=_.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=U(()=>[{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.email,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.lastname,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:2,name:"lastname",id:"lastname",code:"lastname"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.number,options:[],defaultValue:"",fieldType:T.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=B(e.target);await z(o).then(n=>{n||u({text:m.invalidSearch,type:"warning"}),_.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}=Z({onError:y,isAuth:t,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c});return s("div",{className:L(["order-order-search",r]),children:s(X,{onSubmit:u,loading:b,inLineAlert:p,fieldsConfig:m})})};export{me as OrderSearch,me as default}; +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}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderStatus.js b/scripts/__dropins__/storefront-order/containers/OrderStatus.js index d5a91e3a36..30d2a30cff 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderStatus.js +++ b/scripts/__dropins__/storefront-order/containers/OrderStatus.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as c,jsxs as N,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{Card as F,Header as P,Button as E,InLineAlert as G,Modal as V}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{f as K}from"../chunks/returnOrdersHelper.js";import{classes as y,Slot as q}from"@dropins/tools/lib.js";import{f as x}from"../chunks/formatDateToLocale.js";import{useState as O,useEffect as v,useCallback as H}from"@dropins/tools/preact-hooks.js";import{events as I}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{useMemo as W,useState as j}from"@dropins/tools/preact-compat.js";import{r as k}from"../chunks/redirectTo.js";import{O as J}from"../chunks/OrderCancelForm.js";import{useText as C,Text as $}from"@dropins/tools/i18n.js";import{r as z}from"../chunks/reorderItems.js";import{C as B}from"../chunks/OrderLoaders.js";import{G as Q}from"../chunks/getGuestOrder.graphql.js";import{f as X,h as Y}from"../chunks/fetch-graphql.js";import{b as Z}from"../chunks/transform-order-details.js";import{g as D}from"../chunks/getStoreConfig.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";var _=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(_||{});const 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"},ee=({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.${K(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}",x(e==null?void 0:e.orderDate)))==null?void 0:b.replace("{RETURN_CREATE_DATE}",x(p)))??"",T=l?t??u.title:t??g.title;return N(F,{className:"order-order-status-content",variant:"secondary",children:[c(P,{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(re,{orderData:e,slots:r,routeCreateReturn:i,routeOnSuccess:a,onError:s})]})]})},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=({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=W(()=>{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(q,{"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(ce,{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):D().then(i=>{i&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(i)),t(i))})},[]),r},ne=` +import{jsx as i,Fragment as _,jsxs as N}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as j,classes as A}from"@dropins/tools/lib.js";import{Button as E,InLineAlert as z,Modal as K,Card as q,Header as H}from"@dropins/tools/components.js";import{useState as S,useEffect as U,useCallback as B}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import{useMemo as Q,useState as J}from"@dropins/tools/preact-compat.js";import{u as $}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as P}from"@dropins/tools/event-bus.js";import{G as X}from"../chunks/getGuestOrder.graphql.js";import{f as Y,h as Z}from"../chunks/fetch-graphql.js";import{b as D}from"../chunks/transform-customer-orders-returns.js";import{useText as O,Text as b}from"@dropins/tools/i18n.js";import{C as ee}from"../chunks/OrderLoaders.js";import{f as re}from"../chunks/returnOrdersHelper.js";import{f as v}from"../chunks/formatDateToLocale.js";import{r as k}from"../chunks/redirectTo.js";import{O as te}from"../chunks/OrderCancelForm.js";import{r as ne}from"../chunks/reorderItems.js";import"../chunks/getStoreConfig.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 y=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(y||{});const se=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:a,onError:s})=>{const d=O({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=Q(()=>{const o=t==null?void 0:t.availableActions,c=!!(o!=null&&o.length),u=!!(t!=null&&t.returnNumber),R=()=>{k(e,{},t)};return i(_,{children:n!=null&&n.OrderActions?i(j,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):i("div",{"data-testid":"availableActionsList",className:A(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!c]]),children:o==null?void 0:o.map(f=>{switch(f){case y.CANCEL:return i(_,{children:u?null:i(ae,{orderRef:(t==null?void 0:t.token)??(t==null?void 0:t.id)})});case y.RETURN:return i(E,{variant:"secondary",onClick:R,children:u?d.createAnotherReturn:d.createReturn});case y.REORDER:return i(_,{children:u?null:i(ue,{orderData:t,onError:s,routeOnSuccess:a,children:d.reorder})})}})})})},[s,t,a,e,n,d]);return i("div",{className:A(["order-order-actions",r]),children:l})},oe=({orderData:r})=>{const[t,n]=S(r),[e,a]=S(r==null?void 0:r.status);return U(()=>{const s=P.on("order/data",d=>{n(d),a(d.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},ce=` mutation CONFIRM_CANCEL_ORDER_MUTATION( $orderId: ID!, $confirmationKey: String! @@ -18,5 +18,5 @@ import{jsx as c,jsxs as N,Fragment as S}from"@dropins/tools/preact-jsx-runtime.j } } } -${Q} -`,se=async(r,t)=>X(ne,{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=Z((o=e==null?void 0:e.confirmCancelOrder)==null?void 0:o.order),I.emit("order/data",s)),i.length>0?Y(i):s}),oe=({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&&se(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]=j(!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}=oe({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(G,{heading:h.cancelOrder,onDismiss:g,description:u.text,type:u.status}),o?c(ee,{title:e,status:i||d,slots:r,orderData:o,routeCreateReturn:s,onError:a,routeOnSuccess:l}):c(B,{withCard:!1})]})},ce=({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($,{id:"Order.OrderStatusContent.actions.cancel"})}),t&&c(V,{centered:!0,size:"medium",onClose:i,className:"order-order-cancel__modal",title:c("h2",{className:"order-order-cancel__title",children:c($,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:c(J,{orderRef:r,cancelReasons:l(a)})})]})},ie=({onError:r,routeOnSuccess:t,orderData:n,children:e})=>{const[i,s]=O(!1),a=H(()=>{s(!0);const l=n==null?void 0:n.number;z(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}; +${X} +`,ie=async(r,t)=>Y(ce,{variables:{orderId:r,confirmationKey:t}}).then(async({errors:n,data:e})=>{var d,l,o,c;const a=[...(d=e==null?void 0:e.confirmCancelOrder)!=null&&d.errorV2?[(l=e==null?void 0:e.confirmCancelOrder)==null?void 0:l.errorV2]:[],...n??[]];let s=null;return(o=e==null?void 0:e.confirmCancelOrder)!=null&&o.order&&(s=D((c=e==null?void 0:e.confirmCancelOrder)==null?void 0:c.order),P.emit("order/data",s)),a.length>0?Z(a):s}),de=({enableOrderCancellation:r})=>{const t=O({orderCancelled:"Order.OrderStatusContent.orderCanceled.message"}),[n,e]=S({text:"",status:void 0});return U(()=>{if(!r)return;const a=new URLSearchParams(window.location.search),s=a.get("order_id"),d=a.get("confirmation_key");s&&d&&ie(s,d).then(()=>{e({text:t.orderCancelled,status:"success"})}).catch(l=>{e({text:l.message,status:"warning"})})},[r,t.orderCancelled]),{confirmOrderCancellation:n}},ke=({slots:r,orderData:t,className:n,statusTitle:e,status:a,routeCreateReturn:s,onError:d,routeOnSuccess:l})=>{const{orderStatus:o,order:c}=oe({orderData:t}),[u,R]=J(!1),f=()=>{R(!0);const p=new URL(window.location.href),T=p.searchParams.get("order_id"),g=p.searchParams.get("confirmation_key");T&&g&&(p.searchParams.delete("order_id"),p.searchParams.delete("confirmation_key"),window.history.replaceState({},document.title,p.toString()))},h=O({cancelOrder:"Order.OrderStatusContent.actions.cancel"}),C=$(),{confirmOrderCancellation:m}=de({enableOrderCancellation:C==null?void 0:C.orderCancellationEnabled});return N("div",{className:A(["order-order-status",n]),children:[!u&&(m==null?void 0:m.status)!==void 0&&i(z,{heading:h.cancelOrder,onDismiss:f,description:m.text,type:m.status}),c?i(le,{title:e,status:a||o,slots:r,orderData:c,routeCreateReturn:s,onError:d,routeOnSuccess:l}):i(ee,{withCard:!1})]})},ae=({orderRef:r})=>{const[t,n]=S(!1),e=()=>{n(!0)},a=()=>{n(!1)},s=$(),d=(s==null?void 0:s.orderCancellationReasons)??[],l=o=>o.map((c,u)=>({text:c==null?void 0:c.description,value:u.toString()}));return P.on("order/data",o=>{const c=String(o.status).toLocaleLowerCase();(c==="guest order cancellation requested"||c==="canceled")&&a()}),N(_,{children:[i(E,{variant:"secondary",onClick:e,"data-testid":"cancel-button",children:i(b,{id:"Order.OrderStatusContent.actions.cancel"})}),t&&i(K,{centered:!0,size:"medium",onClose:a,className:"order-order-cancel__modal",title:i("h2",{className:"order-order-cancel__title",children:i(b,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:i(te,{orderRef:r,cancelReasons:l(d)})})]})},x=r=>r&&r.charAt(0).toLocaleUpperCase()+r.slice(1).toLocaleLowerCase(),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","pending payment":"orderPendingPayment",rejected:"orderRejected",authorized:"orderAuthorized","paypal canceled reversal":"orderPaypalCanceledReversal","pending paypal":"orderPendingPaypal","paypal reversed":"orderPaypalReversed",closed:"orderClosed"},le=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:a,onError:s,routeOnSuccess:d})=>{var L,I,M;const l=!!(e!=null&&e.returnNumber),o=String(n).toLocaleLowerCase(),c=(L=e==null?void 0:e.returns)==null?void 0:L[0],u=(c==null?void 0:c.returnStatus)??"",R=(c==null?void 0:c.createdReturnAt)??"",f=O({message:"Order.OrderStatusContent.orderPlaceholder.message",messageWithoutDate:"Order.OrderStatusContent.orderPlaceholder.messageWithoutDate"}),h=O(`Order.OrderStatusContent.${w[o]}.title`),C=O(`Order.OrderStatusContent.${w[o]}.message`),m=O(`Order.OrderStatusContent.${w[o]}.messageWithoutDate`),p=O({title:`Order.OrderStatusContent.returnStatus.${re(u)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return i("div",{});const T=h!=null&&h.title?h:{title:x(o)},g=C!=null&&C.message?C:f,F=m!=null&&m.messageWithoutDate?m:f,G=e!=null&&e.orderStatusChangeDate?g==null?void 0:g.message.replace("{DATE}",v(e==null?void 0:e.orderStatusChangeDate)):F.messageWithoutDate,V=((M=(I=p==null?void 0:p.returnMessage)==null?void 0:I.replace("{ORDER_CREATE_DATE}",v(e==null?void 0:e.orderDate)))==null?void 0:M.replace("{RETURN_CREATE_DATE}",v(R)))??"",W=l?t??(p.title||x(u)):t??T.title;return N(q,{className:"order-order-status-content",variant:"secondary",children:[i(H,{title:W}),N("div",{className:"order-order-status-content__wrapper",children:[i("div",{className:A(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:i("p",{children:l?V:G})}),i(se,{orderData:e,slots:r,routeCreateReturn:a,routeOnSuccess:d,onError:s})]})]})},ue=({onError:r,routeOnSuccess:t,orderData:n,children:e})=>{const[a,s]=S(!1),d=B(()=>{s(!0);const l=n==null?void 0:n.number;ne(l).then(({success:o,userInputErrors:c})=>{o&&k(t,{}),c.length&&(r==null||r(c))}).catch(o=>{r==null||r(o.message)}).finally(()=>{s(!1)})},[n,t,r]);return i(E,{type:"button",disabled:a,variant:"secondary",className:"order-reorder",onClick:d,children:e})};export{ke as OrderStatus,ke as default}; diff --git a/scripts/__dropins__/storefront-order/containers/ReturnsList.js b/scripts/__dropins__/storefront-order/containers/ReturnsList.js index 09fcf8e325..0f17307321 100644 --- a/scripts/__dropins__/storefront-order/containers/ReturnsList.js +++ b/scripts/__dropins__/storefront-order/containers/ReturnsList.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as $}from"@dropins/tools/lib.js";import{useState as s,useEffect as h,useCallback as I}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as y}from"../chunks/getCustomerOrdersReturn.js";import"@dropins/tools/preact.js";import{u as A}from"../chunks/useIsMobile.js";import"@dropins/tools/preact-compat.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-order-details.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}; +import{jsx as p}from"@dropins/tools/preact-jsx-runtime.js";import{classes as I}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";import{useState as s,useEffect as $,useCallback as y}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as M}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{g as A}from"../chunks/getCustomerOrdersReturn.js";import{u as T}from"../chunks/useIsMobile.js";import{R as V}from"../chunks/ReturnsListContent.js";import{useText as k}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/network-error.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[o,n]=s(!0),[i,u]=s([]),[a,m]=s(g),[d,l]=s(1);$(()=>{A(t).then(async r=>{u((r==null?void 0:r.ordersReturn)??[]),m((r==null?void 0:r.pageInfo)??g)}).finally(()=>{n(!1)})},[t]);const c=y(r=>{l(r)},[]);return{pageInfo:a,selectedPage:d,loading:o,orderReturns:i,handleSetSelectPage:c}},tr=({slots:t,withReturnsListButton:o,className:n,minifiedView:i,withHeader:u,withThumbnails:a,returnPageSize:m,returnsInMinifiedView:d,routeReturnDetails:l,routeOrderDetails:c,routeTracking:r,routeReturnsList:L,routeProductDetails:R})=>{const f=M(),{pageInfo:O,selectedPage:b,handleSetSelectPage:w,loading:N,orderReturns:P}=v({returnPageSize:m}),S=T(),e=i?"minifiedView":"fullSizeView",h=k({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 p("div",{className:I(["order-returns-list",n]),children:p(V,{placeholderImage:(f==null?void 0:f.baseMediaUrl)??"",minifiedViewKey:e,withOrderNumber:!0,withReturnNumber:!0,slots:t,selectedPage:b,handleSetSelectPage:w,pageInfo:O,withReturnsListButton:o,isMobile:S,orderReturns:P,translations:h,withHeader:u,returnsInMinifiedView:d,withThumbnails:a,minifiedView:i,routeReturnDetails:l,routeOrderDetails:c,routeTracking:r,routeReturnsList:L,routeProductDetails:R,loading:N})})};export{tr as default}; diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index f8605409a1..6649338f09 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -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"../chunks/OrderCancel.js";import{useState as x,useEffect as k}from"@dropins/tools/preact-hooks.js";import{events as D}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as nn}from"../chunks/useIsMobile.js";import{Text as B,useText as en}from"@dropins/tools/i18n.js";import{C as pn}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.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=nn(),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=en({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(pn,{withCard:!1})})};export{bn as ShippingStatus,bn as default}; +import{jsx as i,jsxs as S,Fragment as w}from"@dropins/tools/preact-jsx-runtime.js";import{classes as $,VComponent as E,Slot as q}from"@dropins/tools/lib.js";import{Card as A,Header as x,Accordion as G,AccordionSection as V,ContentGrid as B,Image as M}from"@dropins/tools/components.js";import{useState as R,useEffect as tn}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as sn}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as ln}from"@dropins/tools/event-bus.js";import{C as rn}from"../chunks/OrderLoaders.js";import{u as hn}from"../chunks/useIsMobile.js";import{Text as U,useText as un}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";var H=(s=>(s.PENDING="pending",s.SHIPPING="shipping",s.COMPLETE="complete",s.PROCESSING="processing",s.HOLD="on hold",s.CANCELED="Canceled",s.SUSPECTED_FRAUD="suspected fraud",s.PAYMENT_REVIEW="payment review",s))(H||{});const dn=({orderData:s})=>{const[r,h]=R(!0),[n,c]=R(s),[l,m]=R(!1);return tn(()=>{const u=ln.on("order/data",o=>{c(o),m(o==null?void 0:o.isVirtual),h(!1)},{eager:!0});return s!=null&&s.id&&h(!1),()=>{u==null||u.off()}},[s]),{loading:r,order:n,isVirtualProduct:l}},en=({value:s,variant:r="primary",size:h="medium",icon:n,className:c,children:l,disabled:m=!1,active:u=!1,activeChildren:o,activeIcon:b,href:e,...C})=>{let d="dropin-button";(n&&!l||n&&u&&!o||!n&&u&&b)&&(d="dropin-iconButton"),u&&o&&(d="dropin-button"),c=$([d,`${d}--${h}`,`${d}--${r}`,[`${d}--${r}--disabled`,m],l&&n&&`${d}--with-icon`,!l&&o&&n&&`${d}--with-icon`,u&&b&&`${d}--with-icon`,c]);const I=$(["dropin-button-icon",`dropin-button-icon--${r}`,[`dropin-button-icon--${r}--disabled`,m],n==null?void 0:n.props.className]),g=e?{node:i("a",{}),role:"link",href:e,...C,disabled:m,active:u,onKeyDown:y=>{m&&y.preventDefault()},tabIndex:m?-1:0}:{node:i("button",{}),role:"button",...C,value:s,disabled:m,active:u};return S(E,{...g,className:c,children:[n&&!u&&i(E,{node:n,className:I}),b&&u&&i(E,{node:b,className:I}),l&&!u&&(typeof l=="string"?i("span",{children:l}):l),u&&o&&(typeof o=="string"?i("span",{children:o}):o)]})},cn=({placeholderImage:s,slots:r,collapseThreshold:h,translations:n,returnData:c,routeTracking:l,routeProductDetails:m})=>{var b;const u=hn(),o=m?"a":"span";return S(A,{variant:"secondary",className:$(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[i(x,{title:n.returnOrderCardTitle}),S("div",{children:[(b=c==null?void 0:c.tracking)==null?void 0:b.map((e,C)=>{var y,O;const d={title:"",number:(e==null?void 0:e.trackingNumber)??"",carrier:((y=e==null?void 0:e.carrier)==null?void 0:y.label)??""},I=l==null?void 0:l(d),g=I?()=>{window.open(I,"_blank","noreferrer")}:null;return S("div",{className:"order-shipping-status-card__header",children:[S("div",{children:[`${n.carrier} `,`${(O=d.carrier)==null?void 0:O.toLocaleUpperCase()} | `,d.number]}),g?i(en,{onClick:g,children:n.trackButton}):null]},`${d.number}_${C}`)}),r!=null&&r.ReturnItemsDetails?i(q,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:r==null?void 0:r.ReturnItemsDetails,context:{items:c.items}}):null,i(G,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(V,{defaultOpen:h>=c.items.length,title:i(U,{id:"Order.ShippingStatusCard.itemText",plural:c.items.reduce((e,C)=>e+C.requestQuantity,0),fields:{count:c.items.reduce((e,C)=>e+C.requestQuantity,0)}}),children:i(B,{maxColumns:u?3:9,emptyGridContent:i(w,{}),className:$(["order-shipping-status-card__images",["order-shipping-status-card__images-3",u]]),children:c.items.map((e,C)=>{var g,y,O,_;const d=(g=e.thumbnail)==null?void 0:g.label,I=(O=(y=e.thumbnail)==null?void 0:y.url)!=null&&O.length?(_=e.thumbnail)==null?void 0:_.url:s;return i(o,{href:(m==null?void 0:m(e))??"#","data-testid":`${C}${e.uid}`,children:i(M,{alt:d,src:I,width:85,height:114})},`${C}${e.uid}`)})})})})]})]})},mn=({placeholderImage:s,translations:r,slots:h,orderData:n,collapseThreshold:c=10,routeProductDetails:l,routeTracking:m})=>{var O,_,j,F,Q,K,W;const u=!!(n!=null&&n.returnNumber),o=n==null?void 0:n.returnNumber,b=l?"a":"span",e=(O=n==null?void 0:n.status)==null?void 0:O.toLocaleLowerCase(),d=((_=n==null?void 0:n.shipments)==null?void 0:_.length)===1&&(e==null?void 0:e.includes(H.COMPLETE)),I=(j=n==null?void 0:n.shipments)==null?void 0:j.every(p=>p.tracking.length===0),g=(F=n==null?void 0:n.items)==null?void 0:F.filter(p=>(p==null?void 0:p.quantityShipped)===0||(p==null?void 0:p.quantityShipped)<(p==null?void 0:p.quantityOrdered)),y=(Q=n==null?void 0:n.items)==null?void 0:Q.reduce((p,f)=>{const T=f.quantityOrdered-f.quantityShipped;return p+(T>0?T:0)},0);if(u&&(n!=null&&n.returns.length)){const p=n.returns.find(f=>f.returnNumber===o);return!p||p.tracking.length===0?null:i(cn,{placeholderImage:s,slots:h,collapseThreshold:c,translations:r,returnData:p,routeTracking:m,routeProductDetails:l})}return!n||e!=null&&e.includes(H.CANCELED)?null:(K=n==null?void 0:n.shipments)!=null&&K.length?I&&!(g!=null&&g.length)&&d?null:S(w,{children:[(W=n==null?void 0:n.shipments)==null?void 0:W.map(({tracking:p,items:f,id:T},pn)=>{const Y=f.reduce((t,N)=>t+((N==null?void 0:N.quantityShipped)??0),0);return S(A,{variant:"secondary",className:"order-shipping-status-card",children:[i(x,{title:r.shippingCardTitle}),p==null?void 0:p.map(t=>{var a;const N=m==null?void 0:m(t),L=N?()=>{window.open(N,"_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:[r.carrier," ",(a=t==null?void 0:t.carrier)==null?void 0:a.toLocaleUpperCase()," | ",t==null?void 0:t.number]}),i("p",{children:t==null?void 0:t.title})]}),h!=null&&h.DeliveryTrackActions?i(q,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:h==null?void 0:h.DeliveryTrackActions,context:{trackInformation:t}}):L?i(en,{onClick:L,children:r.trackButton}):null]},t.number)}),d?null:i(G,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(V,{"data-position":pn+1,defaultOpen:c>=(f==null?void 0:f.length),title:i(U,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:Y,fields:{count:Y}}),children:i(B,{maxColumns:6,emptyGridContent:i(w,{}),className:"order-shipping-status-card__images",children:f==null?void 0:f.map(t=>{var a,z,J,X,Z,v,P,k,D,nn;const N=(J=(z=(a=t==null?void 0:t.orderItem)==null?void 0:a.product)==null?void 0:z.thumbnail)==null?void 0:J.label,L=(P=(v=(Z=(X=t==null?void 0:t.orderItem)==null?void 0:X.product)==null?void 0:Z.thumbnail)==null?void 0:v.url)!=null&&P.length?(nn=(D=(k=t==null?void 0:t.orderItem)==null?void 0:k.product)==null?void 0:D.thumbnail)==null?void 0:nn.url:s;return i(b,{href:(l==null?void 0:l(t))??"#",children:i(M,{alt:N,src:L,width:85,height:114})},t.id)})})})}),h!=null&&h.DeliveryTimeLine?i(q,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:h==null?void 0:h.DeliveryTimeLine,context:{}}):null]},T)}),g!=null&&g.length?S(A,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[i(x,{title:r.notYetShippedTitle}),i(G,{actionIconPosition:"right",children:i(V,{defaultOpen:c>=(g==null?void 0:g.length),title:i(U,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:y,fields:{count:y}}),children:i(B,{maxColumns:6,emptyGridContent:i(w,{}),className:"order-shipping-status-card__images",children:g==null?void 0:g.map(p=>{var f,T;return i(b,{href:(l==null?void 0:l(p))??"#",children:i(M,{alt:(f=p.thumbnail)==null?void 0:f.label,src:((T=p.thumbnail)==null?void 0:T.url)||"",width:85,height:114})},p.id)})})})})]}):null]}):S(A,{variant:"secondary",className:"order-shipping-status-card",children:[i(x,{title:r.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:r.noInfoTitle})]})})]})},wn=({slots:s,className:r,collapseThreshold:h,orderData:n,routeOrderDetails:c,routeTracking:l,routeProductDetails:m})=>{const{loading:u,order:o,isVirtualProduct:b}=dn({orderData:n}),e=sn(),C=un({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"});if(!u&&b)return null;const d=(e==null?void 0:e.baseMediaUrl)??"";return i("div",{className:$(["order-shipping-status",r]),children:!u&&o?i(mn,{placeholderImage:d,translations:C,routeOrderDetails:c,routeTracking:l,slots:s,orderData:o,collapseThreshold:h,routeProductDetails:m}):i(rn,{withCard:!1})})};export{wn as ShippingStatus,wn as default}; diff --git a/scripts/__dropins__/storefront-order/containers/index.d.ts b/scripts/__dropins__/storefront-order/containers/index.d.ts index 06da75d995..33f75b0a3d 100644 --- a/scripts/__dropins__/storefront-order/containers/index.d.ts +++ b/scripts/__dropins__/storefront-order/containers/index.d.ts @@ -1,11 +1,12 @@ -export * from './OrderSearch'; -export * from './OrderStatus'; -export * from './ShippingStatus'; +export * from './CreateReturn'; export * from './CustomerDetails'; -export * from './ReturnsList'; -export * from './OrderProductList'; +export * from './OrderCancelForm'; export * from './OrderCostSummary'; +export * from './OrderHeader'; +export * from './OrderProductList'; export * from './OrderReturns'; -export * from './CreateReturn'; -export * from './OrderCancelForm'; +export * from './OrderSearch'; +export * from './OrderStatus'; +export * from './ReturnsList'; +export * from './ShippingStatus'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/data/models/acdl.d.ts b/scripts/__dropins__/storefront-order/data/models/acdl.d.ts new file mode 100644 index 0000000000..bb2c6081bc --- /dev/null +++ b/scripts/__dropins__/storefront-order/data/models/acdl.d.ts @@ -0,0 +1,99 @@ +/** + * This module contains the schema type definitions to build the ShoppingCart + * and Order contexts, which are required to trigger the "place-order" event. + * + * The following schema types have been extracted from the Adobe Commerce + * Events SDK package. + * + * ShoppingCart schema type @see https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/types/schemas/shoppingCart.ts + * Order schema type @see https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/types/schemas/order.ts + */ +type ShoppingCartItem = { + canApplyMsrp: boolean; + formattedPrice: string; + id: string; + prices: { + price: Price; + }; + product: Product; + configurableOptions?: Array; + quantity: number; +}; +type Price = { + value: number; + currency?: string; + regularPrice?: number; +}; +type Product = { + productId: number; + name: string; + sku: string; + topLevelSku?: string | null; + specialToDate?: string | null; + specialFromDate?: string | null; + newToDate?: string | null; + newFromDate?: string | null; + createdAt?: string | null; + updatedAt?: string | null; + manufacturer?: string | null; + countryOfManufacture?: string | null; + categories?: string[] | null; + productType?: string | null; + pricing?: { + regularPrice: number; + minimalPrice?: number; + maximalPrice?: number; + specialPrice?: number; + tierPricing?: { + customerGroupId?: number | null; + qty: number; + value: number; + }[]; + currencyCode: string | null; + }; + canonicalUrl?: string | null; + mainImageUrl?: string | null; +}; +type ConfigurableOption = { + id?: number; + optionLabel: string; + valueId?: number; + valueLabel: string; +}; +type Payment = { + paymentMethodCode: string; + paymentMethodName: string; + total: number; +}; +type Shipping = { + shippingMethod?: string; + shippingAmount?: number; +}; +export type ShoppingCartContext = { + id: string | null; + items?: Array; + prices?: { + subtotalExcludingTax?: Price; + subtotalIncludingTax?: Price; + }; + totalQuantity: number; + possibleOnepageCheckout?: boolean; + giftMessageSelected?: boolean; + giftWrappingSelected?: boolean; + source?: string; +}; +export type OrderContext = { + appliedCouponCode: string; + email: string; + grandTotal: number; + orderId: string; + orderType?: 'checkout' | 'instant_purchase'; + otherTax: number; + payments?: Payment[]; + salesTax: number; + shipping?: Shipping; + subtotalExcludingTax: number; + subtotalIncludingTax: number; +}; +export {}; +//# sourceMappingURL=acdl.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/data/models/index.d.ts b/scripts/__dropins__/storefront-order/data/models/index.d.ts index 25a5e493bb..82e3b25717 100644 --- a/scripts/__dropins__/storefront-order/data/models/index.d.ts +++ b/scripts/__dropins__/storefront-order/data/models/index.d.ts @@ -1,7 +1,7 @@ -export * from './order-details'; +export * from './acdl'; export * from './attributes-form'; -export * from './store-config'; export * from './customer'; -export * from './store-config'; export * from './customer-orders-return'; +export * from './order-details'; +export * from './store-config'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/data/models/order-details.d.ts b/scripts/__dropins__/storefront-order/data/models/order-details.d.ts index 2caff4eebd..a27ac60a28 100644 --- a/scripts/__dropins__/storefront-order/data/models/order-details.d.ts +++ b/scripts/__dropins__/storefront-order/data/models/order-details.d.ts @@ -119,6 +119,7 @@ export type ShipmentsModel = { items: ShipmentItemsModel[]; }; export type OrderDataModel = { + placeholderImage?: string; returnNumber: string; id: string; orderStatusChangeDate?: string; diff --git a/scripts/__dropins__/storefront-order/data/models/store-config.d.ts b/scripts/__dropins__/storefront-order/data/models/store-config.d.ts index 9df6001dc3..1770b4f2ec 100644 --- a/scripts/__dropins__/storefront-order/data/models/store-config.d.ts +++ b/scripts/__dropins__/storefront-order/data/models/store-config.d.ts @@ -1,4 +1,5 @@ export interface StoreConfigModel { + baseMediaUrl: string; orderCancellationEnabled: boolean; orderCancellationReasons: OrderCancellationReason[]; shoppingCartDisplayPrice: 1 | 2 | 3; diff --git a/scripts/__dropins__/storefront-order/data/transforms/index.d.ts b/scripts/__dropins__/storefront-order/data/transforms/index.d.ts index 22fb3ce575..2d69442ddd 100644 --- a/scripts/__dropins__/storefront-order/data/transforms/index.d.ts +++ b/scripts/__dropins__/storefront-order/data/transforms/index.d.ts @@ -1,8 +1,10 @@ -export * from './transform-order-details'; -export * from './transform-guest-order'; +export * from './transform-acdl'; export * from './transform-attributes-form'; -export * from './transform-store-config'; export * from './transform-customer'; -export * from './transform-store-config'; +export * from './transform-customer-address-input'; export * from './transform-customer-orders-returns'; +export * from './transform-guest-order'; +export * from './transform-order-details'; +export * from './transform-place-order'; +export * from './transform-store-config'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/data/transforms/transform-acdl.d.ts b/scripts/__dropins__/storefront-order/data/transforms/transform-acdl.d.ts new file mode 100644 index 0000000000..c30df667ff --- /dev/null +++ b/scripts/__dropins__/storefront-order/data/transforms/transform-acdl.d.ts @@ -0,0 +1,5 @@ +import { OrderContext, OrderDataModel, ShoppingCartContext } from '../models'; + +export declare const transformShoppingCartContext: (cartId: string, data: OrderDataModel) => ShoppingCartContext; +export declare const transformOrderContext: (data: OrderDataModel) => OrderContext; +//# sourceMappingURL=transform-acdl.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/data/transforms/transform-customer-address-input.d.ts b/scripts/__dropins__/storefront-order/data/transforms/transform-customer-address-input.d.ts new file mode 100644 index 0000000000..4050049a7b --- /dev/null +++ b/scripts/__dropins__/storefront-order/data/transforms/transform-customer-address-input.d.ts @@ -0,0 +1,22 @@ +import { OrderAddressModel } from '../models'; + +export declare function transformCustomerAddressInput(address: OrderAddressModel): { + region: { + region_id: number | null; + region: string | undefined; + }; + city: string | undefined; + company: string | undefined; + country_code: string | undefined; + firstname: string | undefined; + lastname: string | undefined; + middlename: string | undefined; + postcode: string | undefined; + street: string[] | undefined; + telephone: string | undefined; + custom_attributesV2: { + attribute_code: string; + value: string; + }[]; +}; +//# sourceMappingURL=transform-customer-address-input.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/data/transforms/transform-place-order.d.ts b/scripts/__dropins__/storefront-order/data/transforms/transform-place-order.d.ts new file mode 100644 index 0000000000..5758b4d2a2 --- /dev/null +++ b/scripts/__dropins__/storefront-order/data/transforms/transform-place-order.d.ts @@ -0,0 +1,5 @@ +import { PlaceOrderResponse } from '../../types'; +import { OrderDataModel } from '../models'; + +export declare const transformPlaceOrder: (response: PlaceOrderResponse) => OrderDataModel | null; +//# sourceMappingURL=transform-place-order.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts index 8785b2223c..dedc3def4d 100644 --- a/scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts @@ -1,9 +1,10 @@ import { AttributesFormModel, OrderItemModel } from '../../data/models'; -import { StepsTypes, TaxTypes, UseCreateReturn } from '../../types'; +import { StepsTypes, UseCreateReturn } from '../../types'; import { RefObject } from 'preact'; export declare const useCreateReturn: ({ onSuccess, onError, handleSetInLineAlert, orderData, }: UseCreateReturn) => { order: { + placeholderImage?: string | undefined; returnNumber?: string | undefined; id: string; orderStatusChangeDate?: string | undefined; @@ -52,7 +53,6 @@ export declare const useCreateReturn: ({ onSuccess, onError, handleSetInLineAler steps: StepsTypes; loading: boolean; formsRef: import('preact/hooks').MutableRef[]>; - taxConfig: TaxTypes; attributesList: [] | AttributesFormModel[]; selectedProductList: [] | OrderItemModel[]; itemsEligibleForReturn: OrderItemModel[]; diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useOrderCostSummary.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useOrderCostSummary.d.ts index 10e8080d22..e5fdda0bad 100644 --- a/scripts/__dropins__/storefront-order/hooks/containers/useOrderCostSummary.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/containers/useOrderCostSummary.d.ts @@ -1,7 +1,7 @@ import { OrderDataModel } from '../../data/models'; import { StoreConfigProps, UseOrderCostSummaryProps } from '../../types'; -export declare const useOrderCostSummary: ({ orderData, }: UseOrderCostSummaryProps) => { +export declare const useOrderCostSummary: ({ orderData, config, }: UseOrderCostSummaryProps) => { loading: boolean; storeConfig: StoreConfigProps | null; order: OrderDataModel | undefined; diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useOrderHeader.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useOrderHeader.d.ts new file mode 100644 index 0000000000..1c941f6f80 --- /dev/null +++ b/scripts/__dropins__/storefront-order/hooks/containers/useOrderHeader.d.ts @@ -0,0 +1,8 @@ +import { OrderDataModel } from '../../data/models'; +import { UseOrderHeaderProps } from '../../types'; + +export declare const useOrderHeader: ({ orderData, handleEmailAvailability, handleSignUpClick, }: UseOrderHeaderProps) => { + order: OrderDataModel | undefined; + onSignUpClickHandler: (() => void) | undefined; +}; +//# sourceMappingURL=useOrderHeader.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useOrderProductList.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useOrderProductList.d.ts index 41ed08fd54..3b7b764fd5 100644 --- a/scripts/__dropins__/storefront-order/hooks/containers/useOrderProductList.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/containers/useOrderProductList.d.ts @@ -1,9 +1,8 @@ import { OrderDataModel } from '../../data/models'; -import { TaxTypes, UseOrderProductListProps } from '../../types'; +import { UseOrderProductListProps } from '../../types'; export declare const useOrderProductList: ({ orderData, }: UseOrderProductListProps) => { loading: boolean; - taxConfig: TaxTypes; order: OrderDataModel | undefined; }; //# sourceMappingURL=useOrderProductList.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/hooks/index.d.ts b/scripts/__dropins__/storefront-order/hooks/index.d.ts index 8edc217cda..eeec23d318 100644 --- a/scripts/__dropins__/storefront-order/hooks/index.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/index.d.ts @@ -1,11 +1,13 @@ +export * from './containers/useCreateReturn'; +export * from './containers/useCustomerDetails'; +export * from './containers/useOrderCostSummary'; +export * from './containers/useOrderHeader'; +export * from './containers/useOrderProductList'; export * from './containers/useOrderSearch'; export * from './containers/useOrderStatus'; -export * from './containers/useShippingStatus'; -export * from './containers/useCustomerDetails'; export * from './containers/useReturnsList'; -export * from './containers/useOrderProductList'; -export * from './containers/useOrderCostSummary'; -export * from './containers/useCreateReturn'; +export * from './containers/useShippingStatus'; export * from './useInLineAlert'; export * from './useIsMobile'; +export * from './api/useGetStoreConfig'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts b/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts index 128c70a944..6a4befce7d 100644 --- a/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts +++ b/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts @@ -187,6 +187,11 @@ declare const _default: { "createAnotherReturn": "Start another return", "reorder": "Reorder" }, + "orderPlaceholder": { + "title": "", + "message": "Your order has been in its current status since {DATE}.", + "messageWithoutDate": "Your order has been in its current status for some time." + }, "orderPending": { "title": "Pending", "message": "The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.", @@ -230,6 +235,41 @@ declare const _default: { "title": "cancellation requested", "message": "The cancellation has been requested on {DATE}. Check your email for further instructions.", "messageWithoutDate": "The cancellation has been requested. Check your email for further instructions." + }, + "orderPendingPayment": { + "title": "Pending Payment", + "message": "The order was successfully placed on {DATE}, but it is awaiting payment. Please complete the payment so we can start processing your order.", + "messageWithoutDate": "Your order is awaiting payment. Please complete the payment so we can start processing your order." + }, + "orderRejected": { + "title": "Rejected", + "message": "Your order was rejected on {DATE}. Please contact us for more information.", + "messageWithoutDate": "Your order was rejected. Please contact us for more information." + }, + "orderAuthorized": { + "title": "Authorized", + "message": "Your order was successfully authorized on {DATE}. We will begin processing your order shortly.", + "messageWithoutDate": "Your order was successfully authorized. We will begin processing your order shortly." + }, + "orderPaypalCanceledReversal": { + "title": "PayPal Canceled Reversal", + "message": "The PayPal transaction reversal was canceled on {DATE}. Please check your order details for more information.", + "messageWithoutDate": "The PayPal transaction reversal was canceled. Please check your order details for more information." + }, + "orderPendingPaypal": { + "title": "Pending PayPal", + "message": "Your order is awaiting PayPal payment confirmation since {DATE}. Please check your PayPal account for the payment status.", + "messageWithoutDate": "Your order is awaiting PayPal payment confirmation. Please check your PayPal account for the payment status." + }, + "orderPaypalReversed": { + "title": "PayPal Reversed", + "message": "The PayPal payment was reversed on {DATE}. Please contact us for further details.", + "messageWithoutDate": "The PayPal payment was reversed. Please contact us for further details." + }, + "orderClosed": { + "title": "Closed", + "message": "The order placed on {DATE} has been closed. For any further assistance, please contact support.", + "messageWithoutDate": "Your order has been closed. For any further assistance, please contact support." } }, "CustomerDetails": { @@ -287,8 +327,18 @@ declare const _default: { "button": "Submit Cancellation", "errorHeading": "Error", "errorDescription": "There was an error processing your order cancellation." + }, + "OrderHeader": { + "title": "{{name}}, thank you for your order!", + "defaultTitle": "Thank you for your order!", + "order": "ORDER #{{order}}", + "CreateAccount": { + "message": "Save your information for faster checkout next time.", + "button": "Create an account" + } } } -}; +} +; export default _default; diff --git a/scripts/__dropins__/storefront-order/lib/acdl.d.ts b/scripts/__dropins__/storefront-order/lib/acdl.d.ts new file mode 100644 index 0000000000..4b20d2ad49 --- /dev/null +++ b/scripts/__dropins__/storefront-order/lib/acdl.d.ts @@ -0,0 +1,18 @@ +import { OrderDataModel } from '../data/models'; + +/** + * See: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/contexts.ts + */ +export declare const contexts: { + SHOPPING_CART_CONTEXT: string; + ORDER_CONTEXT: string; +}; +/** + * See: https://github.com/adobe/commerce-events/blob/main/packages/storefront-events-sdk/src/events.ts + */ +export declare const events: { + PLACE_ORDER: string; +}; +export declare function getAdobeDataLayer(): any; +export declare function publishPlaceOrderEvent(cartId: string, data: OrderDataModel): void; +//# sourceMappingURL=acdl.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/lib/capitalizeFirst.d.ts b/scripts/__dropins__/storefront-order/lib/capitalizeFirst.d.ts new file mode 100644 index 0000000000..18269aab6f --- /dev/null +++ b/scripts/__dropins__/storefront-order/lib/capitalizeFirst.d.ts @@ -0,0 +1,2 @@ +export declare const capitalizeFirst: (str: string) => string; +//# sourceMappingURL=capitalizeFirst.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/render.js b/scripts/__dropins__/storefront-order/render.js index a338507bd7..1659690ec2 100644 --- a/scripts/__dropins__/storefront-order/render.js +++ b/scripts/__dropins__/storefront-order/render.js @@ -1,5 +1,5 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ (function(n,e){try{if(typeof document<"u"){const r=document.createElement("style"),a=e.styleId;for(const t in e.attributes)r.setAttribute(t,e.attributes[t]);r.setAttribute("data-dropin",a),r.appendChild(document.createTextNode(n));const o=document.querySelector('style[data-dropin="sdk"]');if(o)o.after(r);else{const t=document.querySelector('link[rel="stylesheet"], style');t?t.before(r):document.head.append(r)}}}catch(r){console.error("dropin-styles (injectCodeFunction)",r)}})(`.dropin-button,.dropin-iconButton{border:0 none;cursor:pointer;white-space:normal}.dropin-button{border-radius:var(--shape-border-radius-3);font-size:var(--type-button-1-font);font-weight:var(--type-button-1-font);padding:var(--spacing-xsmall) var(--spacing-medium);display:flex;justify-content:center;align-items:center;text-align:left;word-wrap:break-word}.dropin-iconButton{height:var(--spacing-xbig);width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button:disabled,.dropin-iconButton:disabled{pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button:not(:disabled),.dropin-iconButton:not(:disabled){cursor:pointer}.dropin-button:focus,.dropin-iconButton:focus{outline:none}.dropin-button:focus-visible,.dropin-iconButton:focus-visible{outline:var(--spacing-xxsmall) solid var(--color-button-focus)}.dropin-button--primary,a.dropin-button--primary,.dropin-iconButton--primary{border:none;background:var(--color-brand-500) 0 0% no-repeat padding-box;color:var(--color-neutral-50);text-align:left;margin-right:0}.dropin-iconButton--primary{border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button--primary--disabled,a.dropin-button--primary--disabled,.dropin-iconButton--primary--disabled{background:var(--color-neutral-300) 0 0% no-repeat padding-box;color:var(--color-neutral-500);fill:var(--color-neutral-300);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--primary:hover,a.dropin-button--primary:hover,.dropin-iconButton--primary:hover,.dropin-button--primary:focus:hover,.dropin-iconButton--primary:focus:hover{background-color:var(--color-button-hover);text-decoration:none}.dropin-button--primary:focus,.dropin-iconButton--primary:focus{background-color:var(--color-brand-500)}.dropin-button--primary:hover:active,.dropin-iconButton--primary:hover:active{background-color:var(--color-button-active)}.dropin-button--secondary,a.dropin-button--secondary,.dropin-iconButton--secondary{border:var(--shape-border-width-2) solid var(--color-brand-500);background:none 0 0% no-repeat padding-box;color:var(--color-brand-500);padding-top:calc(var(--spacing-xsmall) - var(--shape-border-width-2));padding-left:calc(var(--spacing-medium) - var(--shape-border-width-2))}.dropin-iconButton--secondary{border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall);padding-top:calc(var(--spacing-xsmall) - var(--shape-border-width-2));padding-left:calc(var(--spacing-xsmall) - var(--shape-border-width-2))}.dropin-button--secondary--disabled,a.dropin-button--secondary--disabled,.dropin-iconButton--secondary--disabled{border:var(--shape-border-width-2) solid var(--color-neutral-300);background:none 0 0% no-repeat padding-box;color:var(--color-neutral-500);fill:var(--color-neutral-300);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--secondary:hover,a.dropin-button--secondary:hover,.dropin-iconButton--secondary:hover{border:var(--shape-border-width-2) solid var(--color-button-hover);color:var(--color-button-hover);text-decoration:none}.dropin-button--secondary:active,.dropin-iconButton--secondary:active{border:var(--shape-border-width-2) solid var(--color-button-active);color:var(--color-button-active)}.dropin-button--tertiary,a.dropin-button--tertiary,.dropin-iconButton--tertiary{border:none;background:none 0 0% no-repeat padding-box;color:var(--color-brand-500)}.dropin-iconButton--tertiary{border:none;border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button--tertiary--disabled,a.dropin-button--tertiary--disabled,.dropin-iconButton--tertiary--disabled{border:none;color:var(--color-neutral-500);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--tertiary:hover,a.dropin-button--tertiary:hover,.dropin-iconButton--tertiary:hover{color:var(--color-button-hover);text-decoration:none}.dropin-button--tertiary:active,.dropin-iconButton--tertiary:active{color:var(--color-button-active)}.dropin-button--tertiary:focus-visible,.dropin-iconButton--tertiary:focus-visible{-webkit-box-shadow:inset 0 0 0 2px var(--color-neutral-800);-moz-box-shadow:inset 0 0 0 2px var(--color-neutral-800);box-shadow:inset 0 0 0 2px var(--color-neutral-800)}.dropin-button--large{font:var(--type-button-1-font);letter-spacing:var(--type-button-1-letter-spacing)}.dropin-button--medium{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.dropin-button-icon{height:24px}.dropin-button--with-icon{column-gap:var(--spacing-xsmall);row-gap:var(--spacing-xsmall)} -.order-order-search-form{gap:var(--spacing-small);border-color:transparent}.order-order-search-form .dropin-card__content{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}.order-order-search-form p{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.order-order-search-form__title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin:0}.order-order-search-form__wrapper{display:grid;grid-template-columns:1fr;grid-template-rows:auto;grid-template-areas:"email" "lastname" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--lastname{grid-area:lastname}.order-order-search-form__wrapper__item--number{grid-area:number}.order-order-search-form__button-container{display:flex;justify-content:flex-end;grid-area:button}.order-order-search-form form button{align-self:flex-end;justify-self:flex-end;margin-top:var(--spacing-small)}@media (min-width: 768px){.order-order-search-form__wrapper{grid-template-columns:1fr 1fr;grid-template-rows:auto auto auto;grid-template-areas:"email lastname" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}.order-return-order-product-list .dropin-incrementer__button-container{margin:0}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message a{max-width:162px;padding:var(--spacing-xsmall)}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{text-align:left;color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}`,{styleId:"order"}); -import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as n}from"@dropins/tools/lib.js";import{useState as s,useEffect as d}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as c}from"@dropins/tools/event-bus.js";const u={CreateReturn:{headerText:"Return items",downloadableCount:"Files",returnedItems:"Returned items:",configurationsList:{quantity:"Quantity"},stockStatus:{inStock:"In stock",outOfStock:"Out of stock"},giftCard:{sender:"Sender",recipient:"Recipient",message:"Note"},success:{title:"Return submitted",message:"Your return request has been successfully submitted."},buttons:{nextStep:"Continue",backStep:"Back",submit:"Submit return",backStore:"Back to order"}},OrderCostSummary:{headerText:"Order summary",headerReturnText:"Return summary",subtotal:{title:"Subtotal"},shipping:{title:"Shipping",freeShipping:"Free shipping"},tax:{accordionTitle:"Taxes",accordionTotalTax:"Tax Total",totalExcludingTaxes:"Total excluding taxes",title:"Tax",incl:"Including taxes",excl:"Excluding taxes"},discount:{title:"Discount",subtitle:"discounted"},total:{title:"Total"}},Returns:{minifiedView:{returnsList:{viewAllOrdersButton:"View all returns",ariaLabelLink:"Redirect to full order information",emptyOrdersListMessage:"No returns",minifiedViewTitle:"Recent returns",orderNumber:"Order number:",returnNumber:"Return number:",carrier:"Carrier:",itemText:{none:"",one:"item",many:"items"},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"}}},fullSizeView:{returnsList:{viewAllOrdersButton:"View all orders",ariaLabelLink:"Redirect to full order information",emptyOrdersListMessage:"No returns",minifiedViewTitle:"Returns",orderNumber:"Order number:",returnNumber:"Return number:",carrier:"Carrier:",itemText:{none:"",one:"item",many:"items"},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"}}}},OrderProductListContent:{cancelledTitle:"Cancelled",allOrdersTitle:"Your order",returnedTitle:"Returned",refundedTitle:"Your refunded",downloadableCount:"Files",stockStatus:{inStock:"In stock",outOfStock:"Out of stock"},GiftCard:{sender:"Sender",recipient:"Recipient",message:"Note"}},OrderSearchForm:{title:"Enter your information to view order details",description:"You can find your order number in the receipt you received via email.",button:"View Order",email:"Email",lastname:"Last Name",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},ShippingStatusCard:{orderNumber:"Order number:",returnNumber:"Return number:",itemText:{none:"",one:"Package contents ({{count}} item)",many:"Package contents ({{count}} items)"},trackButton:"Track package",carrier:"Carrier:",prepositionOf:"of",returnOrderCardTitle:"Package details",shippingCardTitle:"Package details",shippingInfoTitle:"Shipping information",notYetShippedTitle:"Not yet shipped",notYetShippedImagesTitle:{singular:"Package contents ({{count}} item)",plural:"Package contents ({{count}} items)"}},OrderStatusContent:{noInfoTitle:"Check back later for more details.",returnMessage:"The order was placed on {ORDER_CREATE_DATE} and your return process started on {RETURN_CREATE_DATE}",returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."}},p={Order:u},m={default:p},h=({children:t})=>{const[o,i]=s("en_US");return d(()=>{const e=c.on("locale",a=>{i(a)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},T=new n(r(h,{}));export{T as render}; +.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-order-cancel-reasons-form__text{text-align:left;color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-header{text-align:center;padding:var(--spacing-xxbig)}.order-header__icon{margin-bottom:var(--spacing-small)}.order-header__title{color:var(--color-neutral-800);font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);justify-content:center;margin:0}.order-header__title:first-letter{text-transform:uppercase}.order-header__order{color:var(--color-neutral-700);font:var(--type-details-overline-font);letter-spacing:var(--type-details-overline-letter-spacing);margin:var(--spacing-xxsmall) 0 0 0}.order-header .success-icon{color:var(--color-positive-500)}.order-header-create-account{display:grid;gap:var(--spacing-small);margin-top:var(--spacing-large)}.order-header-create-account__message{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.order-header-create-account__button{display:flex;margin:0 auto;text-align:center}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-order-search-form{gap:var(--spacing-small);border-color:transparent}.order-order-search-form .dropin-card__content{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}.order-order-search-form p{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.order-order-search-form__title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin:0}.order-order-search-form__wrapper{display:grid;grid-template-columns:1fr;grid-template-rows:auto;grid-template-areas:"email" "lastname" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--lastname{grid-area:lastname}.order-order-search-form__wrapper__item--number{grid-area:number}.order-order-search-form__button-container{display:flex;justify-content:flex-end;grid-area:button}.order-order-search-form form button{align-self:flex-end;justify-self:flex-end;margin-top:var(--spacing-small)}@media (min-width: 768px){.order-order-search-form__wrapper{grid-template-columns:1fr 1fr;grid-template-rows:auto auto auto;grid-template-areas:"email lastname" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-return-order-message p{margin:0;padding:0}.order-return-order-message a{max-width:162px;padding:var(--spacing-xsmall)}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}.order-return-order-product-list .dropin-incrementer__button-container{margin:0}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}`,{styleId:"order"}); +import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as i}from"@dropins/tools/lib.js";import{useState as n,useEffect as d}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as c}from"@dropins/tools/event-bus.js";const u={CreateReturn:{headerText:"Return items",downloadableCount:"Files",returnedItems:"Returned items:",configurationsList:{quantity:"Quantity"},stockStatus:{inStock:"In stock",outOfStock:"Out of stock"},giftCard:{sender:"Sender",recipient:"Recipient",message:"Note"},success:{title:"Return submitted",message:"Your return request has been successfully submitted."},buttons:{nextStep:"Continue",backStep:"Back",submit:"Submit return",backStore:"Back to order"}},OrderCostSummary:{headerText:"Order summary",headerReturnText:"Return summary",subtotal:{title:"Subtotal"},shipping:{title:"Shipping",freeShipping:"Free shipping"},tax:{accordionTitle:"Taxes",accordionTotalTax:"Tax Total",totalExcludingTaxes:"Total excluding taxes",title:"Tax",incl:"Including taxes",excl:"Excluding taxes"},discount:{title:"Discount",subtitle:"discounted"},total:{title:"Total"}},Returns:{minifiedView:{returnsList:{viewAllOrdersButton:"View all returns",ariaLabelLink:"Redirect to full order information",emptyOrdersListMessage:"No returns",minifiedViewTitle:"Recent returns",orderNumber:"Order number:",returnNumber:"Return number:",carrier:"Carrier:",itemText:{none:"",one:"item",many:"items"},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"}}},fullSizeView:{returnsList:{viewAllOrdersButton:"View all orders",ariaLabelLink:"Redirect to full order information",emptyOrdersListMessage:"No returns",minifiedViewTitle:"Returns",orderNumber:"Order number:",returnNumber:"Return number:",carrier:"Carrier:",itemText:{none:"",one:"item",many:"items"},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"}}}},OrderProductListContent:{cancelledTitle:"Cancelled",allOrdersTitle:"Your order",returnedTitle:"Returned",refundedTitle:"Your refunded",downloadableCount:"Files",stockStatus:{inStock:"In stock",outOfStock:"Out of stock"},GiftCard:{sender:"Sender",recipient:"Recipient",message:"Note"}},OrderSearchForm:{title:"Enter your information to view order details",description:"You can find your order number in the receipt you received via email.",button:"View Order",email:"Email",lastname:"Last Name",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},ShippingStatusCard:{orderNumber:"Order number:",returnNumber:"Return number:",itemText:{none:"",one:"Package contents ({{count}} item)",many:"Package contents ({{count}} items)"},trackButton:"Track package",carrier:"Carrier:",prepositionOf:"of",returnOrderCardTitle:"Package details",shippingCardTitle:"Package details",shippingInfoTitle:"Shipping information",notYetShippedTitle:"Not yet shipped",notYetShippedImagesTitle:{singular:"Package contents ({{count}} item)",plural:"Package contents ({{count}} items)"}},OrderStatusContent:{noInfoTitle:"Check back later for more details.",returnMessage:"The order was placed on {ORDER_CREATE_DATE} and your return process started on {RETURN_CREATE_DATE}",returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPlaceholder:{title:"",message:"Your order has been in its current status since {DATE}.",messageWithoutDate:"Your order has been in its current status for some time."},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."},orderPendingPayment:{title:"Pending Payment",message:"The order was successfully placed on {DATE}, but it is awaiting payment. Please complete the payment so we can start processing your order.",messageWithoutDate:"Your order is awaiting payment. Please complete the payment so we can start processing your order."},orderRejected:{title:"Rejected",message:"Your order was rejected on {DATE}. Please contact us for more information.",messageWithoutDate:"Your order was rejected. Please contact us for more information."},orderAuthorized:{title:"Authorized",message:"Your order was successfully authorized on {DATE}. We will begin processing your order shortly.",messageWithoutDate:"Your order was successfully authorized. We will begin processing your order shortly."},orderPaypalCanceledReversal:{title:"PayPal Canceled Reversal",message:"The PayPal transaction reversal was canceled on {DATE}. Please check your order details for more information.",messageWithoutDate:"The PayPal transaction reversal was canceled. Please check your order details for more information."},orderPendingPaypal:{title:"Pending PayPal",message:"Your order is awaiting PayPal payment confirmation since {DATE}. Please check your PayPal account for the payment status.",messageWithoutDate:"Your order is awaiting PayPal payment confirmation. Please check your PayPal account for the payment status."},orderPaypalReversed:{title:"PayPal Reversed",message:"The PayPal payment was reversed on {DATE}. Please contact us for further details.",messageWithoutDate:"The PayPal payment was reversed. Please contact us for further details."},orderClosed:{title:"Closed",message:"The order placed on {DATE} has been closed. For any further assistance, please contact support.",messageWithoutDate:"Your order has been closed. For any further assistance, please contact support."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."},OrderHeader:{title:"{{name}}, thank you for your order!",defaultTitle:"Thank you for your order!",order:"ORDER #{{order}}",CreateAccount:{message:"Save your information for faster checkout next time.",button:"Create an account"}}},p={Order:u},m={default:p},h=({children:t})=>{const[o,a]=n("en_US");return d(()=>{const e=c.on("locale",s=>{a(s)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},T=new i(r(h,{}));export{T as render}; diff --git a/scripts/__dropins__/storefront-order/types/api/placeOrder.types.d.ts b/scripts/__dropins__/storefront-order/types/api/placeOrder.types.d.ts new file mode 100644 index 0000000000..fe5b52e24f --- /dev/null +++ b/scripts/__dropins__/storefront-order/types/api/placeOrder.types.d.ts @@ -0,0 +1,19 @@ +import { OrderProps } from '..'; + +export interface PlaceOrderProps extends OrderProps { +} +export interface PlaceOrderResponse { + data: { + placeOrder?: { + errors?: { + code: string; + message: string; + }[]; + orderV2?: PlaceOrderProps; + }; + }; + errors?: { + message: string; + }[]; +} +//# sourceMappingURL=placeOrder.types.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts b/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts index 9454fae5bb..17aafb587b 100644 --- a/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts @@ -27,6 +27,7 @@ export interface CreateReturnProps { showConfigurableOptions?: (options: options | {}) => options; } export interface ReturnOrderProductListProps { + placeholderImage: string; slots?: { ReturnOrderItem: SlotProps; }; @@ -41,6 +42,7 @@ export interface ReturnOrderProductListProps { handleChangeStep: (value: StepsTypes) => void; } export interface ReturnReasonFormProps { + placeholderImage: string; slots?: { ReturnFormActions: SlotProps<{ handleChangeStep: (value: StepsTypes) => void; diff --git a/scripts/__dropins__/storefront-order/types/index.d.ts b/scripts/__dropins__/storefront-order/types/index.d.ts index 0c1bb08da9..4322eb4855 100644 --- a/scripts/__dropins__/storefront-order/types/index.d.ts +++ b/scripts/__dropins__/storefront-order/types/index.d.ts @@ -1,23 +1,25 @@ -export * from './api/guestOrderByToken.types'; -export * from './api/getOrderDetails.types'; -export * from './api/getGuestOrder.types'; export * from './api/getAttributesForm.types'; +export * from './api/getAttributesList.types'; export * from './api/getCustomer.types'; export * from './api/getCustomerOrdersReturn.types'; -export * from './api/getAttributesList.types'; -export * from './api/requestReturn.types'; +export * from './api/getGuestOrder.types'; +export * from './api/getOrderDetails.types'; +export * from './api/guestOrderByToken.types'; +export * from './api/placeOrder.types'; export * from './api/reorderItems.types'; -export * from './orderSearch.types'; -export * from './form.types'; -export * from './orderStatus.types'; -export * from './shippingStatus.types'; +export * from './api/requestReturn.types'; +export * from './createReturn.types'; export * from './customerDetails.types'; -export * from './orderCancel.types'; -export * from './returnsList.types'; export * from './emptyList.types'; -export * from './orderProductList.types'; -export * from './orderCostSummary.types'; -export * from './createReturn.types'; +export * from './form.types'; export * from './notification.types'; +export * from './orderCancel.types'; +export * from './orderCostSummary.types'; +export * from './orderHeader.types'; +export * from './orderProductList.types'; +export * from './orderSearch.types'; +export * from './orderStatus.types'; export * from './reorder.types'; +export * from './returnsList.types'; +export * from './shippingStatus.types'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/orderCostSummary.types.d.ts b/scripts/__dropins__/storefront-order/types/orderCostSummary.types.d.ts index ceee817ad9..1578f9a786 100644 --- a/scripts/__dropins__/storefront-order/types/orderCostSummary.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/orderCostSummary.types.d.ts @@ -23,6 +23,7 @@ export interface OrderCostSummaryContentProps { } export interface UseOrderCostSummaryProps { orderData?: OrderDataModel; + config: StoreConfigModel | null; } export {}; //# sourceMappingURL=orderCostSummary.types.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/orderHeader.types.d.ts b/scripts/__dropins__/storefront-order/types/orderHeader.types.d.ts new file mode 100644 index 0000000000..8d0c15a079 --- /dev/null +++ b/scripts/__dropins__/storefront-order/types/orderHeader.types.d.ts @@ -0,0 +1,19 @@ +import { OrderDataModel } from '../data/models'; + +export interface SignUpContext { + inputsDefaultValueSet: DefaultValues; + addressesData: any[]; +} +type DefaultValues = { + code: string; + defaultValue: string; +}[]; +export interface OrderHeaderProps { + handleEmailAvailability?: (email: string) => Promise; + handleSignUpClick?: (ctx: SignUpContext) => void; + orderData?: OrderDataModel; +} +export interface UseOrderHeaderProps extends OrderHeaderProps { +} +export {}; +//# sourceMappingURL=orderHeader.types.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/orderProductList.types.d.ts b/scripts/__dropins__/storefront-order/types/orderProductList.types.d.ts index 3e797fed12..027355ea02 100644 --- a/scripts/__dropins__/storefront-order/types/orderProductList.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/orderProductList.types.d.ts @@ -13,11 +13,13 @@ export interface OrderProductListProps { routeProductDetails?: (product: any) => string; } export interface OrderProductListContentProps extends Omit { + placeholderImage: string; order?: OrderDataModel; taxConfig: TaxTypes; loading: boolean; } export interface CartSummaryItemProps { + placeholderImage?: string; disabledIncrementer?: boolean; loading: boolean; itemType: string; diff --git a/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts b/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts index 17cf40f211..e06e0c2017 100644 --- a/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts @@ -40,6 +40,7 @@ export interface ReturnsListProps { withThumbnails?: boolean; } export interface ReturnsListContentProps extends Omit { + placeholderImage?: string; minifiedViewKey: 'minifiedView' | 'fullSizeView'; orderReturns?: OrdersReturnPropsModel[] | []; translations: Record; diff --git a/scripts/__dropins__/storefront-order/types/shippingStatus.types.d.ts b/scripts/__dropins__/storefront-order/types/shippingStatus.types.d.ts index f546da4fa6..c6699b9f7b 100644 --- a/scripts/__dropins__/storefront-order/types/shippingStatus.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/shippingStatus.types.d.ts @@ -28,6 +28,7 @@ export interface UseShippingStatusProps { orderData?: OrderDataModel; } export interface ShippingStatusCardProps { + placeholderImage: string; translations: Record; slots?: { DeliveryTimeLine?: SlotProps; diff --git a/scripts/configs.js b/scripts/configs.js index 6f3869f83b..9e4d3a551f 100644 --- a/scripts/configs.js +++ b/scripts/configs.js @@ -1,4 +1,4 @@ -const ALLOWED_CONFIGS = ['prod', 'stage', 'dev']; +const ALLOWED_CONFIGS = ["prod", "stage", "dev"]; /** * This function calculates the environment in which the site is running based on the URL. @@ -9,19 +9,19 @@ const ALLOWED_CONFIGS = ['prod', 'stage', 'dev']; */ export const calcEnvironment = () => { const { host, href } = window.location; - let environment = 'prod'; - if (href.includes('.aem.page') || host.includes('staging')) { - environment = 'stage'; + let environment = "prod"; + if (href.includes(".aem.page") || host.includes("staging")) { + environment = "stage"; } - if (href.includes('localhost')) { - environment = 'dev'; + if (href.includes("localhost")) { + environment = "dev"; } - const environmentFromConfig = window.sessionStorage.getItem('environment'); + const environmentFromConfig = window.sessionStorage.getItem("environment"); if ( - environmentFromConfig - && ALLOWED_CONFIGS.includes(environmentFromConfig) - && environment !== 'prod' + environmentFromConfig && + ALLOWED_CONFIGS.includes(environmentFromConfig) && + environment !== "prod" ) { return environmentFromConfig; } @@ -31,8 +31,8 @@ export const calcEnvironment = () => { function buildConfigURL(environment) { const env = environment || calcEnvironment(); - let fileName = 'configs.json?sheet=prod'; - if (env !== 'prod') { + let fileName = "configs.json?sheet=prod"; + if (env !== "prod") { fileName = `configs-${env}.json`; } const configURL = new URL(`${window.location.origin}/${fileName}`); @@ -45,12 +45,15 @@ const getConfigForEnvironment = async (environment) => { try { const configJSON = window.sessionStorage.getItem(`config:${env}`); if (!configJSON) { - throw new Error('No config in session storage'); + throw new Error("No config in session storage"); } const parsedConfig = JSON.parse(configJSON); - if (!parsedConfig[':expiry'] || parsedConfig[':expiry'] < Math.round(Date.now() / 1000)) { - throw new Error('Config expired'); + if ( + !parsedConfig[":expiry"] || + parsedConfig[":expiry"] < Math.round(Date.now() / 1000) + ) { + throw new Error("Config expired"); } return parsedConfig; @@ -60,12 +63,21 @@ const getConfigForEnvironment = async (environment) => { throw new Error(`Failed to fetch config for ${env}`); } configJSON = await configJSON.json(); - configJSON[':expiry'] = Math.round(Date.now() / 1000) + 7200; + configJSON[":expiry"] = Math.round(Date.now() / 1000) + 7200; window.sessionStorage.setItem(`config:${env}`, JSON.stringify(configJSON)); return configJSON; } }; +/** + * This function retrieves a configuration value for a given environment. + * + * @param {string} configParam - The configuration parameter to retrieve. + * @param {string} [environment] - Optional, overwrite the current environment. + * @returns {Promise} - The value of the configuration parameter, or undefined. + */ +// scripts/configs.js + /** * This function retrieves a configuration value for a given environment. * @@ -77,15 +89,19 @@ export const getConfigValue = async (configParam, environment) => { const env = environment || calcEnvironment(); const config = await getConfigForEnvironment(env); const configElements = config.data; + + if (configParam === "commerce-core-endpoint") + return "https://mcstaging.aemshop.net/graphql"; // <=== This line, put any URL + return configElements.find((c) => c.key === configParam)?.value; }; export const getCookie = (cookieName) => { - const cookies = document.cookie.split(';'); + const cookies = document.cookie.split(";"); let foundValue; cookies.forEach((cookie) => { - const [name, value] = cookie.trim().split('='); + const [name, value] = cookie.trim().split("="); if (name === cookieName) { foundValue = decodeURIComponent(value); } @@ -94,4 +110,5 @@ export const getCookie = (cookieName) => { return foundValue; }; -export const checkIsAuthenticated = () => !!getCookie('auth_dropin_user_token') ?? false; +export const checkIsAuthenticated = () => + !!getCookie("auth_dropin_user_token") ?? false;