diff --git a/package-lock.json b/package-lock.json index e277b67281..2b58d1611f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@dropins/storefront-auth": "1.0.0-beta2", "@dropins/storefront-cart": "0.10.0", "@dropins/storefront-checkout": "0.1.0-alpha61", - "@dropins/storefront-order": "0.1.0-alpha32", + "@dropins/storefront-order": "1.0.0-beta1", "@dropins/storefront-pdp": "1.0.0-beta3", "@dropins/tools": "^0.36.0" }, @@ -783,9 +783,9 @@ "integrity": "sha512-w/6Me6NL1ImA8E3jSzazRihI6kLazVcOWTyXVycr0AgYz8Q2pBSCt9KlMzWZnFT9VsRuIn+wwMd8AsbQqQpetg==" }, "node_modules/@dropins/storefront-order": { - "version": "0.1.0-alpha32", - "resolved": "https://registry.npmjs.org/@dropins/storefront-order/-/storefront-order-0.1.0-alpha32.tgz", - "integrity": "sha512-kgoLuROfpMaenX8sJzHMWJxeY4OuQ11CVtTpkDQyxGi7jLhal1eR1ZLjF0MDC8/QZXWMME6OUodPHubQlqSXlw==" + "version": "1.0.0-beta1", + "resolved": "https://registry.npmjs.org/@dropins/storefront-order/-/storefront-order-1.0.0-beta1.tgz", + "integrity": "sha512-FIuwWkVS2e8rvgqwZXZdAkQJ6JC9kHPYt5hArRhJCqZzoI8BaJDYM1GgWT/FN5hmnDRw0Xg4HbBDCU5eaBfA+A==" }, "node_modules/@dropins/storefront-pdp": { "version": "1.0.0-beta3", diff --git a/package.json b/package.json index 974667ff55..694360a296 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@dropins/storefront-auth": "1.0.0-beta2", "@dropins/storefront-cart": "0.10.0", "@dropins/storefront-checkout": "0.1.0-alpha61", - "@dropins/storefront-order": "0.1.0-alpha32", + "@dropins/storefront-order": "1.0.0-beta1", "@dropins/storefront-pdp": "1.0.0-beta3", "@dropins/tools": "^0.36.0" } diff --git a/scripts/__dropins__/storefront-order/api.js b/scripts/__dropins__/storefront-order/api.js index 4ecab87f4c..6de3ff0c18 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{c as H,r as X}from"./chunks/requestGuestOrderCancel.js";import{f as _,h as T}from"./chunks/fetch-graphql.js";import{g as V,r as Y,s as z,a as j,b as J}from"./chunks/fetch-graphql.js";import{g as W}from"./chunks/getAttributesForm.js";import{g as tt,r as et}from"./chunks/requestReturn.js";import{g as at,a as ot}from"./chunks/getGuestOrder.js";import{g as st}from"./chunks/getCustomerOrdersReturn.js";import{c as m,P as R,a as A,G as D,O as g,B as O,b as h,A as C}from"./chunks/initialize.js";import{e as pt,g as ct,d as ut,i as dt}from"./chunks/initialize.js";import{g as Et}from"./chunks/getStoreConfig.js";import{h as f}from"./chunks/network-error.js";import{events as u}from"@dropins/tools/event-bus.js";import{r as Tt}from"./chunks/reorderItems.js";import"./chunks/GurestOrderFragment.graphql.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/transform-attributes-form.js";import"@dropins/tools/lib.js";const M=(e,r)=>({id:e,totalQuantity:r.totalQuantity,possibleOnepageCheckout:!0,items:r.items.map(t=>{var a,o,n,s,i,p;return{canApplyMsrp:!0,formattedPrice:"",id:t.id,quantity:t.totalQuantity,product:{canonicalUrl:((a=t.product)==null?void 0:a.canonicalUrl)??"",mainImageUrl:((o=t.product)==null?void 0:o.image)??"",name:((n=t.product)==null?void 0:n.name)??"",productId:0,productType:(s=t.product)==null?void 0:s.productType,sku:((i=t.product)==null?void 0:i.sku)??""},prices:{price:{value:t.price.value,currency:t.price.currency}},configurableOptions:((p=t.selectedOptions)==null?void 0:p.map(c=>({optionLabel:c.label,valueLabel:c.value})))||[]}})}),G=e=>{var a,o,n;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:((o=e.shipping)==null?void 0:o.code)??"",shippingAmount:((n=e.shipping)==null?void 0:n.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}]:[]}},N=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?m(r):null},d={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},b={PLACE_ORDER:"place-order"};function E(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function l(e,r){const t=E();t.push({[e]:null}),t.push({[e]:r})}function I(e,r){E().push(a=>{const o=a.getState?a.getState():{};a.push({event:e,eventInfo:{...o,...r}})})}function L(e,r){const t=G(r),a=M(e,r);l(d.ORDER_CONTEXT,{...t}),l(d.SHOPPING_CART_CONTEXT,{...a}),I(b.PLACE_ORDER)}const S=` +import{c as q,r as X}from"./chunks/requestGuestOrderCancel.js";import{f as E,h as _}from"./chunks/fetch-graphql.js";import{g as Y,r as z,s as j,a as J,b as K}from"./chunks/fetch-graphql.js";import{g as Z}from"./chunks/getAttributesForm.js";import{g as te,a as re,r as ae}from"./chunks/requestGuestReturn.js";import{g as ne,a as se}from"./chunks/getGuestOrder.js";import{g as pe}from"./chunks/getCustomerOrdersReturn.js";import{c as T,P as R,a as A,G as D,O as g,B as O,b as h,A as C}from"./chunks/initialize.js";import{e as ue,g as de,d as le,i as me}from"./chunks/initialize.js";import{g as _e}from"./chunks/getStoreConfig.js";import{h as f}from"./chunks/network-error.js";import{events as u}from"@dropins/tools/event-bus.js";import{a as Re,c as Ae,r as De}from"./chunks/confirmCancelOrder.js";import"./chunks/GurestOrderFragment.graphql.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/transform-attributes-form.js";import"./chunks/RequestReturnOrderFragment.graphql.js";import"@dropins/tools/lib.js";const G=(t,r)=>({id:t,totalQuantity:r.totalQuantity,possibleOnepageCheckout:!0,items:r.items.map(e=>{var a,o,n,s,i,p;return{canApplyMsrp:!0,formattedPrice:"",id:e.id,quantity:e.totalQuantity,product:{canonicalUrl:((a=e.product)==null?void 0:a.canonicalUrl)??"",mainImageUrl:((o=e.product)==null?void 0:o.image)??"",name:((n=e.product)==null?void 0:n.name)??"",productId:0,productType:(s=e.product)==null?void 0:s.productType,sku:((i=e.product)==null?void 0:i.sku)??""},prices:{price:{value:e.price.value,currency:e.price.currency}},configurableOptions:((p=e.selectedOptions)==null?void 0:p.map(c=>({optionLabel:c.label,valueLabel:c.value})))||[]}})}),M=t=>{var a,o,n;const r=t.coupons[0],e=(a=t.payments)==null?void 0:a[0];return{appliedCouponCode:(r==null?void 0:r.code)??"",email:t.email,grandTotal:t.grandTotal.value,orderId:t.number,orderType:"checkout",otherTax:0,salesTax:t.totalTax.value,shipping:{shippingMethod:((o=t.shipping)==null?void 0:o.code)??"",shippingAmount:((n=t.shipping)==null?void 0:n.amount)??0},subtotalExcludingTax:t.subtotal.value,subtotalIncludingTax:0,payments:e?[{paymentMethodCode:(e==null?void 0:e.code)||"",paymentMethodName:(e==null?void 0:e.name)||"",total:t.grandTotal.value}]:[]}},N=t=>{var e,a;const r=(a=(e=t==null?void 0:t.data)==null?void 0:e.placeOrder)==null?void 0:a.orderV2;return r?T(r):null},d={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},b={PLACE_ORDER:"place-order"};function m(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function l(t,r){const e=m();e.push({[t]:null}),e.push({[t]:r})}function I(t,r){m().push(a=>{const o=a.getState?a.getState():{};a.push({event:t,eventInfo:{...o,...r}})})}function L(t,r){const e=M(r),a=G(t,r);l(d.ORDER_CONTEXT,{...e}),l(d.SHOPPING_CART_CONTEXT,{...a}),I(b.PLACE_ORDER)}const S=` mutation PLACE_ORDER_MUTATION($cartId: String!) { placeOrder(input: { cart_id: $cartId }) { errors { @@ -89,4 +89,4 @@ import{c as H,r as X}from"./chunks/requestGuestOrderCancel.js";import{f as _,h a ${O} ${h} ${C} -`,k=async e=>{if(!e)throw new Error("No cart ID found");return _(S,{variables:{cartId:e}}).then(r=>{var a;(a=r.errors)!=null&&a.length&&T(r.errors);const t=N(r);return t&&(u.emit("order/placed",t),u.emit("cart/reset",void 0),L(e,t)),t}).catch(f)};export{H as cancelOrder,pt as config,_ as fetchGraphQl,W as getAttributesForm,tt as getAttributesList,V as getConfig,at as getCustomer,st as getCustomerOrdersReturn,ot as getGuestOrder,ct as getOrderDetailsById,Et as getStoreConfig,ut as guestOrderByToken,dt as initialize,k as placeOrder,Y as removeFetchGraphQlHeader,Tt as reorderItems,X as requestGuestOrderCancel,et as requestReturn,z as setEndpoint,j as setFetchGraphQlHeader,J as setFetchGraphQlHeaders}; +`,Q=async t=>{if(!t)throw new Error("No cart ID found");return E(S,{variables:{cartId:t}}).then(r=>{var a;(a=r.errors)!=null&&a.length&&_(r.errors);const e=N(r);return e&&(u.emit("order/placed",e),u.emit("cart/reset",void 0),L(t,e)),e}).catch(f)};export{q as cancelOrder,ue as config,Re as confirmCancelOrder,Ae as confirmGuestReturn,E as fetchGraphQl,Z as getAttributesForm,te as getAttributesList,Y as getConfig,ne as getCustomer,pe as getCustomerOrdersReturn,se as getGuestOrder,de as getOrderDetailsById,_e as getStoreConfig,le as guestOrderByToken,me as initialize,Q as placeOrder,z as removeFetchGraphQlHeader,De as reorderItems,X as requestGuestOrderCancel,re as requestGuestReturn,ae as requestReturn,j as setEndpoint,J as setFetchGraphQlHeader,K as setFetchGraphQlHeaders}; diff --git a/scripts/__dropins__/storefront-order/api/confirmGuestReturn/confirmGuestReturn.d.ts b/scripts/__dropins__/storefront-order/api/confirmGuestReturn/confirmGuestReturn.d.ts new file mode 100644 index 0000000000..2711506a10 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/confirmGuestReturn/confirmGuestReturn.d.ts @@ -0,0 +1,2 @@ +export declare const confirmGuestReturn: (orderId: string, confirmationKey: string) => Promise; +//# sourceMappingURL=confirmGuestReturn.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/confirmGuestReturn/graphql/confirmGuestReturn.graphql.d.ts b/scripts/__dropins__/storefront-order/api/confirmGuestReturn/graphql/confirmGuestReturn.graphql.d.ts new file mode 100644 index 0000000000..95af93e910 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/confirmGuestReturn/graphql/confirmGuestReturn.graphql.d.ts @@ -0,0 +1,2 @@ +export declare const CONFIRM_RETURN_GUEST_ORDER: string; +//# sourceMappingURL=confirmGuestReturn.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/confirmGuestReturn/index.d.ts b/scripts/__dropins__/storefront-order/api/confirmGuestReturn/index.d.ts new file mode 100644 index 0000000000..03db300d09 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/confirmGuestReturn/index.d.ts @@ -0,0 +1,2 @@ +export * from './confirmGuestReturn'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/graphql/OrderSummaryFragment.graphql.d.ts b/scripts/__dropins__/storefront-order/api/graphql/OrderSummaryFragment.graphql.d.ts index 94c708b81c..716d4ebe38 100644 --- a/scripts/__dropins__/storefront-order/api/graphql/OrderSummaryFragment.graphql.d.ts +++ b/scripts/__dropins__/storefront-order/api/graphql/OrderSummaryFragment.graphql.d.ts @@ -1,2 +1,2 @@ -export declare const ORDER_SUMMARY_FRAGMENT = "\n fragment ORDER_SUMMARY_FRAGMENT on OrderTotal {\n grand_total {\n value\n currency\n }\n total_giftcard {\n currency\n value\n }\n subtotal {\n currency\n value\n }\n taxes {\n amount {\n currency\n value\n }\n rate\n title\n }\n total_tax {\n currency\n value\n }\n total_shipping {\n currency\n value\n }\n discounts {\n amount {\n currency\n value\n }\n label\n }\n }\n"; +export declare const ORDER_SUMMARY_FRAGMENT = "\n fragment ORDER_SUMMARY_FRAGMENT on OrderTotal {\n grand_total {\n value\n currency\n }\n total_giftcard {\n currency\n value\n }\n subtotal_excl_tax {\n currency\n value\n }\n subtotal_incl_tax {\n currency\n value\n }\n taxes {\n amount {\n currency\n value\n }\n rate\n title\n }\n total_tax {\n currency\n value\n }\n total_shipping {\n currency\n value\n }\n discounts {\n amount {\n currency\n value\n }\n label\n }\n }\n"; //# sourceMappingURL=OrderSummaryFragment.graphql.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 0b19030217..3a572a4507 100644 --- a/scripts/__dropins__/storefront-order/api/index.d.ts +++ b/scripts/__dropins__/storefront-order/api/index.d.ts @@ -13,4 +13,7 @@ export * from './placeOrder'; export * from './reorderItems'; export * from './requestGuestOrderCancel'; export * from './requestReturn'; +export * from './requestGuestReturn'; +export * from './confirmGuestReturn'; +export * from './confirmCancelOrder'; //# sourceMappingURL=index.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..b9a8c0f202 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/requestGuestReturn/graphql/requestGuestReturn.graphql.d.ts @@ -0,0 +1,2 @@ +export declare const REQUEST_RETURN_GUEST_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..7c96cb4914 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/requestGuestReturn/requestGuestReturn.d.ts @@ -0,0 +1,9 @@ +import { RequestGuestReturnProps } from '../../types'; + +export declare const requestGuestReturn: (form: RequestGuestReturnProps) => 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/RequestReturnOrderFragment.graphql.js b/scripts/__dropins__/storefront-order/chunks/RequestReturnOrderFragment.graphql.js new file mode 100644 index 0000000000..fbf77e337f --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/RequestReturnOrderFragment.graphql.js @@ -0,0 +1,11 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +const R=` + fragment REQUEST_RETURN_ORDER_FRAGMENT on Return { + __typename + uid + status + number + created_at + } +`;export{R}; diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index 0e8cf12c0c..dd9c2eeb08 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 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}; +import{jsx as r,jsxs as c,Fragment as N}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as V}from"@dropins/tools/preact-hooks.js";import{classes as R,Slot as Q}from"@dropins/tools/lib.js";import{IllustratedMessage as n1,Icon as S,Card as U,ContentGrid as a1,Image as c1,Header as J,Pagination as L1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as i1}from"@dropins/tools/preact-compat.js";import"./ShippingStatusCard.js";import{f as T}from"./returnOrdersHelper.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{C as W}from"./OrderLoaders.js";import{c as s1}from"./capitalizeFirst.js";import{Text as X}from"@dropins/tools/i18n.js";const Y=L=>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",...L},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"})))),d1=L=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...L},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"})),K=({typeList:L,isEmpty:C,minifiedView:g,message:M})=>{const t=i1(()=>{switch(L){case"orders":return{icon:d1,text:r("p",{children:M}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,M]);return!C||!L||!t.text?null:r(n1,{className:R(["order-empty-list",t.className,g?"order-empty-list--minified":""]),message:t.text,icon:r(S,{source:t.icon}),"data-testid":"emptyList"})},I={size:"32",stroke:"2"},v1=({placeholderImage:L,minifiedViewKey:C,withReturnNumber:g=!1,withOrderNumber:M=!1,slots:t,pageInfo:i,withReturnsListButton:A=!0,isMobile:$=!1,returnsInMinifiedView:D=1,translations:a={},orderReturns:s=[],minifiedView:h=!1,withHeader:f=!0,withThumbnails:B=!0,selectedPage:k=1,handleSetSelectPage:z,routeReturnDetails:d,routeOrderDetails:v,routeTracking:b,routeReturnsList:x,routeProductDetails:m,loading:y})=>{const F=h?D:s.length,j=m!=null&&m()?"a":"span",H=V(()=>s.slice(0,F).map((e,t1)=>{var G,q;const w=((e==null?void 0:e.items)??[]).reduce((n,u)=>(u.requestQuantity??0)+n,0);return r(U,{variant:"secondary",className:"order-returns-list-content__cards-list",children:c("div",{className:"order-returns-list-content__cards-grid",children:[c("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:T(e.returnStatus)?r(X,{id:`Order.Returns.${C}.returnsList.returnStatus.${T(e.returnStatus)}`}):r("span",{children:s1(e.returnStatus)})}),g?c("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?c("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,u)=>{var _,p;const Z={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(Z),o=`${Z.number}_${u}`;return c("p",{children:[`${a.carrier} `,`${(p=Z.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?c("p",{children:[w," ",r(X,{id:`Order.Returns.${C}.returnsList.itemText`,plural:w,fields:{count:w}})]}):null]}),B?r(a1,{maxColumns:$?3:9,emptyGridContent:r(N,{}),className:R(["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,u)=>{var _,p,O,P;const Z=(_=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:L,o=`key_${u}_${n.uid}`;return r(j,{"data-testid":o,href:(m==null?void 0:m(n))??"#",children:r(c1,{alt:Z,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(S,{source:Y,...I})})]})},t1)}),[s,F,C,g,a,M,t,B,$,L,j,b,m,d,v]),r1=V(()=>c(N,{children:[f?r(J,{title:a.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,y?r(W,{withCard:!1}):c(N,{children:[H,r(K,{minifiedView:h,typeList:"orders",isEmpty:!s.length,message:a.emptyOrdersListMessage}),A?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:c("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:a.viewAllOrdersButton}),r(S,{source:Y,...I})]})})}):null]})]}),[x,A,f,a,H,h,s.length,y]),e1=V(()=>c(N,{children:[f?r(J,{title:a.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,y?r(W,{withCard:!1}):c(N,{children:[r(K,{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?r1:e1})};export{v1 as R}; diff --git a/scripts/__dropins__/storefront-order/chunks/capitalizeFirst.js b/scripts/__dropins__/storefront-order/chunks/capitalizeFirst.js new file mode 100644 index 0000000000..a8297f4927 --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/capitalizeFirst.js @@ -0,0 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +const a=e=>e&&e.charAt(0).toLocaleUpperCase()+e.slice(1).toLocaleLowerCase();export{a as c}; diff --git a/scripts/__dropins__/storefront-order/chunks/confirmCancelOrder.js b/scripts/__dropins__/storefront-order/chunks/confirmCancelOrder.js new file mode 100644 index 0000000000..0c05980aae --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/confirmCancelOrder.js @@ -0,0 +1,56 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import{h as d}from"./network-error.js";import{f as u,h as _}from"./fetch-graphql.js";import{R as I}from"./RequestReturnOrderFragment.graphql.js";import{G as a}from"./GurestOrderFragment.graphql.js";import{c as O}from"./initialize.js";import{events as T}from"@dropins/tools/event-bus.js";const N=` + mutation REORDER_ITEMS_MUTATION($orderNumber: String!) { + reorderItems(orderNumber: $orderNumber) { + cart { + itemsV2 { + items { + uid + } + } + } + userInputErrors { + code + message + path + } + } + } +`,$=async E=>await u(N,{method:"POST",variables:{orderNumber:E}}).then(t=>{var n,o,i,c,m,R;if((n=t.errors)!=null&&n.length)return _(t.errors);const e=!!((c=(i=(o=t==null?void 0:t.data)==null?void 0:o.reorderItems)==null?void 0:i.cart)!=null&&c.itemsV2.items.length),r=((R=(m=t==null?void 0:t.data)==null?void 0:m.reorderItems)==null?void 0:R.userInputErrors)??[];return{success:e,userInputErrors:r}}).catch(d),l=` + mutation CONFIRM_RETURN_GUEST_ORDER( + $orderId: ID! + $confirmationKey: String! + ) { + confirmReturn( + input: { order_id: $orderId, confirmation_key: $confirmationKey } + ) { + return { + ...REQUEST_RETURN_ORDER_FRAGMENT + order { + ...GUEST_ORDER_FRAGMENT + } + } + } + } + ${I} + ${a} +`,s=async(E,t)=>await u(l,{method:"POST",variables:{orderId:E,confirmationKey:t}}).then(e=>{var r,n,o,i,c,m,R;if((r=e.errors)!=null&&r.length)return _(e.errors);if((i=(o=(n=e==null?void 0:e.data)==null?void 0:n.confirmReturn)==null?void 0:o.return)!=null&&i.order){const f=O((R=(m=(c=e==null?void 0:e.data)==null?void 0:c.confirmReturn)==null?void 0:m.return)==null?void 0:R.order);return T.emit("order/data",f),f}return null}).catch(d),h=` + mutation CONFIRM_CANCEL_ORDER_MUTATION( + $orderId: ID! + $confirmationKey: String! + ) { + confirmCancelOrder( + input: { order_id: $orderId, confirmation_key: $confirmationKey } + ) { + order { + ...GUEST_ORDER_FRAGMENT + } + errorV2 { + message + code + } + } + } + ${a} +`,y=async(E,t)=>u(h,{variables:{orderId:E,confirmationKey:t}}).then(async({errors:e,data:r})=>{var i,c,m,R;const n=[...(i=r==null?void 0:r.confirmCancelOrder)!=null&&i.errorV2?[(c=r==null?void 0:r.confirmCancelOrder)==null?void 0:c.errorV2]:[],...e??[]];let o=null;return(m=r==null?void 0:r.confirmCancelOrder)!=null&&m.order&&(o=O((R=r==null?void 0:r.confirmCancelOrder)==null?void 0:R.order),T.emit("order/data",o)),n.length>0?_(n):o});export{y as a,s as c,$ as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/getQueryParam.js b/scripts/__dropins__/storefront-order/chunks/getQueryParam.js new file mode 100644 index 0000000000..29459cba0e --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/getQueryParam.js @@ -0,0 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +const t=r=>{try{return new URL(window.location.href).searchParams.get(r)??""}catch{return""}};export{t as g}; diff --git a/scripts/__dropins__/storefront-order/chunks/initialize.js b/scripts/__dropins__/storefront-order/chunks/initialize.js index 2510c9abfa..ed56d3ced3 100644 --- a/scripts/__dropins__/storefront-order/chunks/initialize.js +++ b/scripts/__dropins__/storefront-order/chunks/initialize.js @@ -126,7 +126,11 @@ import{merge as z,Initializer as na}from"@dropins/tools/lib.js";import{events as currency value } - subtotal { + subtotal_excl_tax { + currency + value + } + subtotal_incl_tax { currency value } @@ -195,7 +199,7 @@ import{merge as z,Initializer as na}from"@dropins/tools/lib.js";import{events as } } } -`,_a=a=>a||0,ua=a=>{var n,t,_;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:((t=a==null?void 0:a.thumbnail)==null?void 0:t.label)||"",url:((_=a==null?void 0:a.thumbnail)==null?void 0:_.url)||""}}},ea=a=>{if(!a||!("selected_options"in a))return;const n={};for(const t of a.selected_options)n[t.label]=t.value;return n},ia=a=>{const n=a==null?void 0:a.map(_=>({uid:_.uid,label:_.label,values:_.values.map(e=>e.product_name).join(", ")})),t={};return n==null||n.forEach(_=>{t[_.label]=_.values}),Object.keys(t).length>0?t:null},sa=a=>(a==null?void 0:a.length)>0?{count:a.length,result:a.map(n=>n.title).join(", ")}:null,la=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}),I=a=>a==null?void 0:a.filter(n=>n.__typename).map(n=>{var E,c,r,O,d,g,N,M,A,D,u,y,T,p,S,f,o,G,h,F,C,L,k,U,B,$,P,m,w,x;const{quantityCanceled:t,quantityInvoiced:_,quantityOrdered:e,quantityRefunded:i,quantityReturned:s,quantityShipped:l,quantityReturnRequested:R}=la(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:t,quantityInvoiced:_,quantityOrdered:e,quantityRefunded:i,quantityReturned:s,quantityShipped:l,quantityReturnRequested:R,id:n==null?void 0:n.id,discounted:((O=(r=(c=(E=n==null?void 0:n.product)==null?void 0:E.price_range)==null?void 0:c.maximum_price)==null?void 0:r.regular_price)==null?void 0:O.value)*(n==null?void 0:n.quantity_ordered)!==((d=n==null?void 0:n.product_sale_price)==null?void 0:d.value)*(n==null?void 0:n.quantity_ordered),total:{value:((g=n==null?void 0:n.product_sale_price)==null?void 0:g.value)*(n==null?void 0:n.quantity_ordered)||0,currency:((N=n==null?void 0:n.product_sale_price)==null?void 0:N.currency)||""},totalInclTax:{value:((M=n==null?void 0:n.product_sale_price)==null?void 0:M.value)*(n==null?void 0:n.quantity_ordered)||0,currency:(A=n==null?void 0:n.product_sale_price)==null?void 0:A.currency},price:{value:((D=n==null?void 0:n.product_sale_price)==null?void 0:D.value)||0,currency:(u=n==null?void 0:n.product_sale_price)==null?void 0:u.currency},priceInclTax:{value:((y=n==null?void 0:n.product_sale_price)==null?void 0:y.value)||0,currency:(T=n==null?void 0:n.product_sale_price)==null?void 0:T.currency},totalQuantity:_a(n==null?void 0:n.quantity_ordered),regularPrice:{value:(o=(f=(S=(p=n==null?void 0:n.product)==null?void 0:p.price_range)==null?void 0:S.maximum_price)==null?void 0:f.regular_price)==null?void 0:o.value,currency:(C=(F=(h=(G=n==null?void 0:n.product)==null?void 0:G.price_range)==null?void 0:h.maximum_price)==null?void 0:F.regular_price)==null?void 0:C.currency},product:ua(n==null?void 0:n.product),thumbnail:{label:((k=(L=n==null?void 0:n.product)==null?void 0:L.thumbnail)==null?void 0:k.label)||"",url:((B=(U=n==null?void 0:n.product)==null?void 0:U.thumbnail)==null?void 0:B.url)||""},giftCard:(n==null?void 0:n.__typename)==="GiftCardOrderItem"?{senderName:(($=n.gift_card)==null?void 0:$.sender_name)||"",senderEmail:((P=n.gift_card)==null?void 0:P.sender_email)||"",recipientEmail:((m=n.gift_card)==null?void 0:m.recipient_email)||"",recipientName:((w=n.gift_card)==null?void 0:w.recipient_name)||"",message:((x=n.gift_card)==null?void 0:x.message)||""}:void 0,configurableOptions:ea(n),bundleOptions:n.__typename==="BundleOrderItem"?ia(n.bundle_options):null,itemPrices:n.prices,downloadableLinks:n.__typename==="DownloadableOrderItem"?sa(n==null?void 0:n.downloadable_links):null}}),v=(a,n)=>{var O,d,g,N,M,A,D,u,y;const t=I(a.items),_=((O=ra(a==null?void 0:a.returns))==null?void 0:O.ordersReturn)??[],e=n?_.filter(T=>T.returnNumber===n):_,{total:i,...s}=ta({...a,items:t,returns:e},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),l=(d=a==null?void 0:a.payment_methods)==null?void 0:d[0],R=(l==null?void 0:l.type)||"",E=(l==null?void 0:l.name)||"",c=(g=s==null?void 0:s.items)==null?void 0:g.reduce((T,p)=>T+(p==null?void 0:p.totalQuantity),0),r={...i,...s,totalQuantity:c,shipping:{amount:((N=i==null?void 0:i.totalShipping)==null?void 0:N.value)??0,currency:((M=i==null?void 0:i.totalShipping)==null?void 0:M.currency)||"",code:s.shippingMethod??""},payments:[{code:R,name:E}]};return z(r,(y=(u=(D=(A=b==null?void 0:b.getConfig())==null?void 0:A.models)==null?void 0:D.OrderDataModel)==null?void 0:u.transformer)==null?void 0:y.call(u,a))},ca=(a,n,t)=>{var _,e,i,s,l,R,E;if((s=(i=(e=(_=n==null?void 0:n.data)==null?void 0:_.customer)==null?void 0:e.orders)==null?void 0:i.items)!=null&&s.length&&a==="orderData"){const c=(E=(R=(l=n==null?void 0:n.data)==null?void 0:l.customer)==null?void 0:R.orders)==null?void 0:E.items[0];return v(c,t)}return null},ra=a=>{var i,s,l,R,E;if(!((i=a==null?void 0:a.items)!=null&&i.length))return null;const n=a==null?void 0:a.items,t=a==null?void 0:a.page_info,e={ordersReturn:[...n].sort((c,r)=>+r.number-+c.number).map(c=>{var A,D;const{order:r,status:O,number:d,created_at:g}=c,N=((D=(A=c==null?void 0:c.shipping)==null?void 0:A.tracking)==null?void 0:D.map(u=>{const{status:y,carrier:T,tracking_number:p}=u;return{status:y,carrier:T,trackingNumber:p}}))??[],M=c.items.map(u=>{var G;const y=u==null?void 0:u.quantity,T=u==null?void 0:u.status,p=u==null?void 0:u.request_quantity,S=u==null?void 0:u.uid,f=u==null?void 0:u.order_item,o=((G=I([f]))==null?void 0:G.reduce((h,F)=>F,{}))??{};return{uid:S,quantity:y,status:T,requestQuantity:p,...o}});return{createdReturnAt:g,returnStatus:O,token:r==null?void 0:r.token,orderNumber:r==null?void 0:r.number,returnNumber:d,items:M,tracking:N}}),...t?{pageInfo:{pageSize:t.page_size,totalPages:t.total_pages,currentPage:t.current_page}}:{}};return z(e,(E=(R=(l=(s=b==null?void 0:b.getConfig())==null?void 0:s.models)==null?void 0:l.CustomerOrdersReturnModel)==null?void 0:R.transformer)==null?void 0:E.call(R,{...n,...t}))},Ma=(a,n)=>{var _,e;if(!((_=a==null?void 0:a.data)!=null&&_.guestOrder))return null;const t=(e=a==null?void 0:a.data)==null?void 0:e.guestOrder;return v(t,n)},Ra=(a,n)=>{var _,e;if(!((_=a==null?void 0:a.data)!=null&&_.guestOrderByToken))return null;const t=(e=a==null?void 0:a.data)==null?void 0:e.guestOrderByToken;return v(t,n)},Ea=` +`,_a=a=>a||0,ua=a=>{var n,t,_;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:((t=a==null?void 0:a.thumbnail)==null?void 0:t.label)||"",url:((_=a==null?void 0:a.thumbnail)==null?void 0:_.url)||""}}},ea=a=>{if(!a||!("selected_options"in a))return;const n={};for(const t of a.selected_options)n[t.label]=t.value;return n},ia=a=>{const n=a==null?void 0:a.map(_=>({uid:_.uid,label:_.label,values:_.values.map(e=>e.product_name).join(", ")})),t={};return n==null||n.forEach(_=>{t[_.label]=_.values}),Object.keys(t).length>0?t:null},sa=a=>(a==null?void 0:a.length)>0?{count:a.length,result:a.map(n=>n.title).join(", ")}:null,la=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}),I=a=>a==null?void 0:a.filter(n=>n.__typename).map(n=>{var E,c,r,O,d,g,N,M,A,D,u,y,T,p,S,o,f,G,h,F,C,L,k,U,B,$,P,x,m,w;const{quantityCanceled:t,quantityInvoiced:_,quantityOrdered:e,quantityRefunded:i,quantityReturned:s,quantityShipped:l,quantityReturnRequested:R}=la(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:t,quantityInvoiced:_,quantityOrdered:e,quantityRefunded:i,quantityReturned:s,quantityShipped:l,quantityReturnRequested:R,id:n==null?void 0:n.id,discounted:((O=(r=(c=(E=n==null?void 0:n.product)==null?void 0:E.price_range)==null?void 0:c.maximum_price)==null?void 0:r.regular_price)==null?void 0:O.value)*(n==null?void 0:n.quantity_ordered)!==((d=n==null?void 0:n.product_sale_price)==null?void 0:d.value)*(n==null?void 0:n.quantity_ordered),total:{value:((g=n==null?void 0:n.product_sale_price)==null?void 0:g.value)*(n==null?void 0:n.quantity_ordered)||0,currency:((N=n==null?void 0:n.product_sale_price)==null?void 0:N.currency)||""},totalInclTax:{value:((M=n==null?void 0:n.product_sale_price)==null?void 0:M.value)*(n==null?void 0:n.quantity_ordered)||0,currency:(A=n==null?void 0:n.product_sale_price)==null?void 0:A.currency},price:{value:((D=n==null?void 0:n.product_sale_price)==null?void 0:D.value)||0,currency:(u=n==null?void 0:n.product_sale_price)==null?void 0:u.currency},priceInclTax:{value:((y=n==null?void 0:n.product_sale_price)==null?void 0:y.value)||0,currency:(T=n==null?void 0:n.product_sale_price)==null?void 0:T.currency},totalQuantity:_a(n==null?void 0:n.quantity_ordered),regularPrice:{value:(f=(o=(S=(p=n==null?void 0:n.product)==null?void 0:p.price_range)==null?void 0:S.maximum_price)==null?void 0:o.regular_price)==null?void 0:f.value,currency:(C=(F=(h=(G=n==null?void 0:n.product)==null?void 0:G.price_range)==null?void 0:h.maximum_price)==null?void 0:F.regular_price)==null?void 0:C.currency},product:ua(n==null?void 0:n.product),thumbnail:{label:((k=(L=n==null?void 0:n.product)==null?void 0:L.thumbnail)==null?void 0:k.label)||"",url:((B=(U=n==null?void 0:n.product)==null?void 0:U.thumbnail)==null?void 0:B.url)||""},giftCard:(n==null?void 0:n.__typename)==="GiftCardOrderItem"?{senderName:(($=n.gift_card)==null?void 0:$.sender_name)||"",senderEmail:((P=n.gift_card)==null?void 0:P.sender_email)||"",recipientEmail:((x=n.gift_card)==null?void 0:x.recipient_email)||"",recipientName:((m=n.gift_card)==null?void 0:m.recipient_name)||"",message:((w=n.gift_card)==null?void 0:w.message)||""}:void 0,configurableOptions:ea(n),bundleOptions:n.__typename==="BundleOrderItem"?ia(n.bundle_options):null,itemPrices:n.prices,downloadableLinks:n.__typename==="DownloadableOrderItem"?sa(n==null?void 0:n.downloadable_links):null}}),v=(a,n)=>{var O,d,g,N,M,A,D,u,y;const t=I(a.items),_=((O=ra(a==null?void 0:a.returns))==null?void 0:O.ordersReturn)??[],e=n?_.filter(T=>T.returnNumber===n):_,{total:i,...s}=ta({...a,items:t,returns:e},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),l=(d=a==null?void 0:a.payment_methods)==null?void 0:d[0],R=(l==null?void 0:l.type)||"",E=(l==null?void 0:l.name)||"",c=(g=s==null?void 0:s.items)==null?void 0:g.reduce((T,p)=>T+(p==null?void 0:p.totalQuantity),0),r={...i,...s,totalQuantity:c,shipping:{amount:((N=i==null?void 0:i.totalShipping)==null?void 0:N.value)??0,currency:((M=i==null?void 0:i.totalShipping)==null?void 0:M.currency)||"",code:s.shippingMethod??""},payments:[{code:R,name:E}]};return z(r,(y=(u=(D=(A=b==null?void 0:b.getConfig())==null?void 0:A.models)==null?void 0:D.OrderDataModel)==null?void 0:u.transformer)==null?void 0:y.call(u,a))},ca=(a,n,t)=>{var _,e,i,s,l,R,E;if((s=(i=(e=(_=n==null?void 0:n.data)==null?void 0:_.customer)==null?void 0:e.orders)==null?void 0:i.items)!=null&&s.length&&a==="orderData"){const c=(E=(R=(l=n==null?void 0:n.data)==null?void 0:l.customer)==null?void 0:R.orders)==null?void 0:E.items[0];return v(c,t)}return null},ra=a=>{var i,s,l,R,E;if(!((i=a==null?void 0:a.items)!=null&&i.length))return null;const n=a==null?void 0:a.items,t=a==null?void 0:a.page_info,e={ordersReturn:[...n].sort((c,r)=>+r.number-+c.number).map(c=>{var A,D;const{order:r,status:O,number:d,created_at:g}=c,N=((D=(A=c==null?void 0:c.shipping)==null?void 0:A.tracking)==null?void 0:D.map(u=>{const{status:y,carrier:T,tracking_number:p}=u;return{status:y,carrier:T,trackingNumber:p}}))??[],M=c.items.map(u=>{var G;const y=u==null?void 0:u.quantity,T=u==null?void 0:u.status,p=u==null?void 0:u.request_quantity,S=u==null?void 0:u.uid,o=u==null?void 0:u.order_item,f=((G=I([o]))==null?void 0:G.reduce((h,F)=>F,{}))??{};return{uid:S,quantity:y,status:T,requestQuantity:p,...f}});return{createdReturnAt:g,returnStatus:O,token:r==null?void 0:r.token,orderNumber:r==null?void 0:r.number,returnNumber:d,items:M,tracking:N}}),...t?{pageInfo:{pageSize:t.page_size,totalPages:t.total_pages,currentPage:t.current_page}}:{}};return z(e,(E=(R=(l=(s=b==null?void 0:b.getConfig())==null?void 0:s.models)==null?void 0:l.CustomerOrdersReturnModel)==null?void 0:R.transformer)==null?void 0:E.call(R,{...n,...t}))},Ma=(a,n)=>{var _,e;if(!((_=a==null?void 0:a.data)!=null&&_.guestOrder))return null;const t=(e=a==null?void 0:a.data)==null?void 0:e.guestOrder;return v(t,n)},Ra=(a,n)=>{var _,e;if(!((_=a==null?void 0:a.data)!=null&&_.guestOrderByToken))return null;const t=(e=a==null?void 0:a.data)==null?void 0:e.guestOrderByToken;return v(t,n)},Ea=` query ORDER_BY_NUMBER($orderNumber: String!, $pageSize: Int) { customer { orders(filter: { number: { eq: $orderNumber } }) { diff --git a/scripts/__dropins__/storefront-order/chunks/reorderItems.js b/scripts/__dropins__/storefront-order/chunks/reorderItems.js deleted file mode 100644 index adcf632ac6..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/reorderItems.js +++ /dev/null @@ -1,20 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{h as i}from"./network-error.js";import{f as E,h as I}from"./fetch-graphql.js";const s=` - mutation REORDER_ITEMS_MUTATION($orderNumber: String!) { - reorderItems(orderNumber: $orderNumber) { - cart { - itemsV2 { - items { - uid - } - } - } - userInputErrors { - code - message - path - } - } - } -`,l=async c=>await E(s,{method:"POST",variables:{orderNumber:c}}).then(r=>{var t,e,a,m,o,u;if((t=r.errors)!=null&&t.length)return I(r.errors);const d=!!((m=(a=(e=r==null?void 0:r.data)==null?void 0:e.reorderItems)==null?void 0:a.cart)!=null&&m.itemsV2.items.length),h=((u=(o=r==null?void 0:r.data)==null?void 0:o.reorderItems)==null?void 0:u.userInputErrors)??[];return{success:d,userInputErrors:h}}).catch(i);export{l as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js b/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js index 067577d243..f135fe1bcb 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 d,a as T,G as i,O as A,B as D,b as c,A as u,c as E}from"./initialize.js";import{f as s,h as R}from"./fetch-graphql.js";import{G as O}from"./GurestOrderFragment.graphql.js";const G=` +import{P as T,a as d,G as i,O as A,B as D,b as c,A as u,c as E}from"./initialize.js";import{f as s,h as R}from"./fetch-graphql.js";import{G}from"./GurestOrderFragment.graphql.js";const O=` mutation CANCEL_ORDER_MUTATION($orderId: ID!, $reason: String!) { cancelOrder(input: { order_id: $orderId, reason: $reason }) { error @@ -79,14 +79,14 @@ import{P as d,a as T,G as i,O as A,B as D,b as c,A as u,c as E}from"./initialize } } } - ${d} ${T} + ${d} ${i} ${A} ${D} ${c} ${u} -`,M=async(r,e,n,t)=>{if(!r)throw new Error("No order ID found");if(!e)throw new Error("No reason found");return s(G,{variables:{orderId:r,reason:e}}).then(({errors:o,data:a})=>{if(o)return R(o);if(a.cancelOrder.error!=null){t();return}const _=E(a.cancelOrder.order);n(_)}).catch(()=>t())},l=` +`,M=async(r,e,_,t)=>{if(!r)throw new Error("No order ID found");if(!e)throw new Error("No reason found");return s(O,{variables:{orderId:r,reason:e}}).then(({errors:o,data:n})=>{if(o)return R(o);if(n.cancelOrder.error!=null){t();return}const a=E(n.cancelOrder.order);_(a)}).catch(()=>t())},N=` mutation REQUEST_GUEST_ORDER_CANCEL_MUTATION( $token: String! $reason: String! @@ -94,9 +94,9 @@ import{P as d,a as T,G as i,O as A,B as D,b as c,A as u,c as E}from"./initialize requestGuestOrderCancel(input: { token: $token, reason: $reason }) { error order { - ...guestOrderData + ...GUEST_ORDER_FRAGMENT } } } - ${O} -`,S=async(r,e,n,t)=>{if(!r)throw new Error("No order token found");if(!e)throw new Error("No reason found");return s(l,{variables:{token:r,reason:e}}).then(({errors:o,data:a})=>{if(o)return R(o);a.requestGuestOrderCancel.error!=null&&t();const _=E(a.requestGuestOrderCancel.order);n(_)}).catch(()=>t())};export{M as c,S as r}; + ${G} +`,S=async(r,e,_,t)=>{if(!r)throw new Error("No order token found");if(!e)throw new Error("No reason found");return s(N,{variables:{token:r,reason:e}}).then(({errors:o,data:n})=>{if(o)return R(o);n.requestGuestOrderCancel.error!=null&&t();const a=E(n.requestGuestOrderCancel.order);_(a)}).catch(()=>t())};export{M as c,S as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/requestGuestReturn.js b/scripts/__dropins__/storefront-order/chunks/requestGuestReturn.js new file mode 100644 index 0000000000..445a3d5263 --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/requestGuestReturn.js @@ -0,0 +1,54 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import{h as i,a as _}from"./network-error.js";import{f as s,h as o}from"./fetch-graphql.js";import{t as d}from"./transform-attributes-form.js";import{R as m}from"./RequestReturnOrderFragment.graphql.js";import{merge as l}from"@dropins/tools/lib.js";import{e as f}from"./initialize.js";const h=r=>{var u,n,E,c,R,T;if(!((n=(u=r==null?void 0:r.data)==null?void 0:u.requestReturn)!=null&&n.return))return{};const{created_at:e,...t}=r.data.requestReturn.return,a={...t,createdAt:e};return l(a,(T=(R=(c=(E=f.getConfig())==null?void 0:E.models)==null?void 0:c.RequestReturnModel)==null?void 0:R.transformer)==null?void 0:T.call(R,r.data.requestReturn.return))},U=` + query GET_ATTRIBUTES_LIST($entityType: AttributeEntityTypeEnum!) { + attributesList(entityType: $entityType) { + items { + ... on CustomerAttributeMetadata { + multiline_count + sort_order + validate_rules { + name + value + } + } + ... on ReturnItemAttributeMetadata { + sort_order + } + code + label + default_value + frontend_input + is_unique + is_required + options { + is_default + label + value + } + } + errors { + type + message + } + } + } +`,g=async r=>await s(U,{method:"GET",cache:"force-cache",variables:{entityType:r}}).then(e=>{var t,a,u;return(t=e.errors)!=null&&t.length?o(e.errors):d((u=(a=e==null?void 0:e.data)==null?void 0:a.attributesList)==null?void 0:u.items)}).catch(i),q=` + mutation REQUEST_RETURN_ORDER($input: RequestReturnInput!) { + requestReturn(input: $input) { + return { + ...REQUEST_RETURN_ORDER_FRAGMENT + } + } + } + ${m} +`,O=async r=>{const e=_(r,"snakeCase",{});return await s(q,{method:"POST",variables:{input:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?o(t.errors):h(t)}).catch(i)},S=` + mutation REQUEST_RETURN_GUEST_ORDER($input: RequestGuestReturnInput!) { + requestGuestReturn(input: $input) { + return { + ...REQUEST_RETURN_ORDER_FRAGMENT + } + } + } + ${m} +`,v=async r=>{const e=_(r,"snakeCase",{});return await s(S,{method:"POST",variables:{input:e}}).then(t=>{var n;if((n=t.errors)!=null&&n.length)return o(t.errors);const{created_at:a,...u}=t.data.requestGuestReturn.return;return{...u,createdAt:a}}).catch(i)};export{v as a,g,O as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/requestReturn.js b/scripts/__dropins__/storefront-order/chunks/requestReturn.js deleted file mode 100644 index cdc8685819..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/requestReturn.js +++ /dev/null @@ -1,53 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{h as E,a as c}from"./network-error.js";import{f as m,h as _}from"./fetch-graphql.js";import{t as T}from"./transform-attributes-form.js";import{merge as d}from"@dropins/tools/lib.js";import{e as l}from"./initialize.js";const f=` - fragment REQUEST_RETURN_ORDER_FRAGMENT on Return { - __typename - uid - status - number - created_at - } -`,h=t=>{var u,i,R,o,n,s;if(!((i=(u=t==null?void 0:t.data)==null?void 0:u.requestReturn)!=null&&i.return))return{};const{created_at:e,...r}=t.data.requestReturn.return,a={...r,createdAt:e};return d(a,(s=(n=(o=(R=l.getConfig())==null?void 0:R.models)==null?void 0:o.RequestReturnModel)==null?void 0:n.transformer)==null?void 0:s.call(n,t.data.requestReturn.return))},y=` - query GET_ATTRIBUTES_LIST($entityType: AttributeEntityTypeEnum!) { - attributesList(entityType: $entityType) { - items { - ... on CustomerAttributeMetadata { - multiline_count - sort_order - validate_rules { - name - value - } - } - ... on ReturnItemAttributeMetadata { - sort_order - } - code - label - default_value - frontend_input - is_unique - is_required - options { - is_default - label - value - } - } - errors { - type - message - } - } - } -`,N=async t=>await m(y,{method:"GET",cache:"force-cache",variables:{entityType:t}}).then(e=>{var r,a,u;return(r=e.errors)!=null&&r.length?_(e.errors):T((u=(a=e==null?void 0:e.data)==null?void 0:a.attributesList)==null?void 0:u.items)}).catch(E),b=` - mutation REQUEST_RETURN_ORDER($input: RequestReturnInput!) { - requestReturn(input: $input) { - return { - ...REQUEST_RETURN_ORDER_FRAGMENT - } - } - } - ${f} -`,p=async t=>{const e=c(t,"snakeCase",{});return await m(b,{method:"POST",variables:{input:e}}).then(r=>{var a;return(a=r.errors)!=null&&a.length?_(r.errors):h(r)}).catch(E)};export{N as g,p as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js b/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js index 8676d96c05..07dcb6203f 100644 --- a/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js +++ b/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{g as p,F as o}from"./getFormValues.js";const d={PENDING:"pending",AUTHORIZED:"authorized",PARTIALLY_AUTHORIZED:"partiallyAuthorized",RECEIVED:"received",PARTIALLY_RECEIVED:"partiallyReceived",APPROVED:"approved",PARTIALLY_APPROVED:"partiallyApproved",REJECTED:"rejected",PARTIALLY_REJECTED:"partiallyRejected",DENIED:"denied",PROCESSED_AND_CLOSED:"processedAndClosed",CLOSED:"closed"},u=(t,e)=>({id:`${t.id}_${t.fieldType}_${e+1}`,name:`${t.name}_${t.fieldType}_${e+1}`,code:`${t.code}_${t.fieldType}_${e+1}`,customUpperCode:`${t.customUpperCode}_${t.fieldType}_${e+1}`}),E=t=>{const e={};return!t||typeof t!="object"||Object.keys(t).length===0||Object.keys(t).forEach(n=>{if(/_(\d+)$/.exec(n)){const i=n==null?void 0:n.replace(/_\d+$/,"");e[i]=t[n]}else e[n]=t[n]}),e},A=(t,e)=>t.map(n=>({...n,...u(n,e)})),C=(t,e)=>t==null?void 0:t.flatMap(n=>Array.from({length:e},(s,i)=>({...n,...u(n,i)}))),l=t=>{const e=[],n=[];return Object.entries(t).forEach(([s,i])=>{const a=s.lastIndexOf("_"),r=s.slice(0,a),c=s.slice(a+1);c===o.MULTISELECT||c===o.SELECT?e.push({attributeCode:r,value:i}):n.push({attributeCode:r,value:i})}),{selectedCustomAttributes:e,enteredCustomAttributes:n}},_=t=>typeof t!="string"?"":d[t]??"",f=t=>{var n;const e=[];if(t!=null&&t.current.length)for(const{current:s}of t.current){if(!s)continue;const i=s.name.replace(/_\d+$/,""),a=((n=s==null?void 0:s.dataset)==null?void 0:n.quantity)??1,r=p(s),c=E(r);e.push({orderItemUid:i,quantityToReturn:+a,...l(c)})}return e},T=t=>{var e;return(e=t==null?void 0:t.items)!=null&&e.length?[...(t==null?void 0:t.items)??[]].sort((n,s)=>{const i=n.quantityShipped-n.quantityReturnRequested===0,a=s.quantityShipped-s.quantityReturnRequested===0;return i&&!a?1:!i&&a?-1:0}):[]};export{_ as f,A as m,f as p,C as r,T as s}; +import{g as p,F as c}from"./getFormValues.js";const d={PENDING:"pending",AUTHORIZED:"authorized",PARTIALLY_AUTHORIZED:"partiallyAuthorized",RECEIVED:"received",PARTIALLY_RECEIVED:"partiallyReceived",APPROVED:"approved",PARTIALLY_APPROVED:"partiallyApproved",REJECTED:"rejected",PARTIALLY_REJECTED:"partiallyRejected",DENIED:"denied",PROCESSED_AND_CLOSED:"processedAndClosed",CLOSED:"closed"},u=(t,n)=>({id:`${t.id}_${t.fieldType}_${n+1}`,name:`${t.name}_${t.fieldType}_${n+1}`,code:`${t.code}_${t.fieldType}_${n+1}`,customUpperCode:`${t.customUpperCode}_${t.fieldType}_${n+1}`}),l=t=>{const n={};return!t||typeof t!="object"||Object.keys(t).length===0||Object.keys(t).forEach(e=>{if(/_(\d+)$/.exec(e)){const s=e==null?void 0:e.replace(/_\d+$/,"");n[s]=t[e]}else n[e]=t[e]}),n},f=(t,n)=>t.map(e=>({...e,...u(e,n)})),A=(t,n)=>t==null?void 0:t.flatMap(e=>Array.from({length:n},(i,s)=>({...e,...u(e,s)}))),E=t=>{const n=[],e=[];return Object.entries(t).forEach(([i,s])=>{const r=i.lastIndexOf("_"),o=i.slice(0,r),a=i.slice(r+1);a===c.MULTISELECT||a===c.SELECT?n.push({attributeCode:o,value:s}):e.push({attributeCode:o,value:s})}),{selectedCustomAttributes:n,enteredCustomAttributes:e}},C=t=>typeof t!="string"?"":d[t]??"",R=t=>{var e;const n=[];if(t!=null&&t.current.length)for(const{current:i}of t.current){if(!i)continue;const s=i.name.replace(/_\d+$/,""),r=((e=i==null?void 0:i.dataset)==null?void 0:e.quantity)??1,o=p(i),a=l(o);n.push({orderItemUid:s,quantityToReturn:+r,...E(a)})}return n},_=t=>{var n;return(n=t==null?void 0:t.items)!=null&&n.length?[...(t==null?void 0:t.items)??[]].sort((e,i)=>{const s=e.quantityShipped-e.quantityReturnRequested===0,r=i.quantityShipped-i.quantityReturnRequested===0;return e.eligibleForReturn&&!i.eligibleForReturn?-1:!e.eligibleForReturn&&i.eligibleForReturn||s&&!r?1:!s&&r?-1:0}):[]};export{C as f,f as m,R as p,A as r,_ as s}; diff --git a/scripts/__dropins__/storefront-order/components/OrderCostSummaryContent/Blocks.d.ts b/scripts/__dropins__/storefront-order/components/OrderCostSummaryContent/Blocks.d.ts index 23bca034cb..1c01bb58dd 100644 --- a/scripts/__dropins__/storefront-order/components/OrderCostSummaryContent/Blocks.d.ts +++ b/scripts/__dropins__/storefront-order/components/OrderCostSummaryContent/Blocks.d.ts @@ -2,10 +2,11 @@ import { OrderDataModel } from '../../data/models'; import { TaxTypes } from '../../types'; type translationsTypes = Record; -export declare const Subtotal: ({ translations, order, subTotalValue, shoppingOrdersDisplaySubtotal, }: { +export declare const Subtotal: ({ translations, order, subtotalInclTax, subtotalExclTax, shoppingOrdersDisplaySubtotal, }: { translations: translationsTypes; order?: OrderDataModel | undefined; - subTotalValue: number; + subtotalInclTax: number; + subtotalExclTax: number; shoppingOrdersDisplaySubtotal: TaxTypes; }) => import("preact").JSX.Element; export declare const Shipping: ({ translations, shoppingOrdersDisplayShipping, order, totalShipping, }: { diff --git a/scripts/__dropins__/storefront-order/containers/CreateReturn.js b/scripts/__dropins__/storefront-order/containers/CreateReturn.js index 8f7909990e..a4eda97a2b 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 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/initialize.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}; +import{jsx as r,jsxs as N}from"@dropins/tools/preact-jsx-runtime.js";import{classes as B,Slot as H}from"@dropins/tools/lib.js";import{Icon as $,Header as W,InLineAlert as j,Button as M,Checkbox as G,CartItem as V,Image as Z}from"@dropins/tools/components.js";import{useState as w,useRef as D,useEffect as P,useCallback as F}from"@dropins/tools/preact-hooks.js";import{u as U,a as z}from"../chunks/ShippingStatusCard.js";import*as _ from"@dropins/tools/preact-compat.js";import{u as J}from"../chunks/useGetStoreConfig.js";import{createRef as K,Fragment as X}from"@dropins/tools/preact.js";import{s as Y,p as I,r as ee,m as te}from"../chunks/returnOrdersHelper.js";import{events as ne}from"@dropins/tools/event-bus.js";import{g as A}from"../chunks/getQueryParam.js";import{g as re,r as se,a as ae}from"../chunks/requestGuestReturn.js";import{s as ie}from"../chunks/setTaxStatus.js";import{S as ce,C as ue}from"../chunks/CartSummaryItem.js";import{a as oe}from"../chunks/OrderLoaders.js";import{useText as le}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/RequestReturnOrderFragment.graphql.js";import"../chunks/initialize.js";const de=a=>_.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},_.createElement("g",{clipPath:"url(#clip0_841_1324)"},_.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),_.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"})),_.createElement("defs",null,_.createElement("clipPath",{id:"clip0_841_1324"},_.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),pe=a=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},_.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"}),_.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),me=({onSuccess:a,onError:s,handleSetInLineAlert:i,orderData:l})=>{const[k,L]=w(!1),[o,R]=w({id:"",email:"",...l}),[v,x]=w("products"),[h,d]=w(!0),[g,f]=w([]),[C,t]=w([]),[m,e]=w([]),c=D([]);c.current.length!==g.length&&(c.current=g.map((n,p)=>c.current[p]||K())),P(()=>{const n=ne.on("order/data",p=>{var u;R(p);const O=Y(p);e(O),L(((u=A("orderRef"))==null?void 0:u.length)>20),d(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),P(()=>{re("RMA_ITEM").then(n=>{n!=null&&n.length&&(t(n),d(!1))})},[]);const y=F(n=>{f(p=>p.findIndex(u=>(u==null?void 0:u.productSku)===(n==null?void 0:n.productSku))>-1?p.filter(u=>(u==null?void 0:u.productSku)!==(n==null?void 0:n.productSku)):[...p,n])},[]),S=F(n=>{x(n),i(),n==="products"&&f([])},[i]),E=F((n,p)=>{const O=g.map(u=>u.productSku===p?{...u,currentReturnOrderQuantity:n}:u);f(O)},[g]),Q=F(async(n,p)=>{if(!p)return;d(!0);const O={orderUid:o.id,contactEmail:o.email},u=I(c);k?ae({token:A("orderRef"),contactEmail:O.contactEmail,items:u,commentText:"."}).then(b=>{a==null||a(b),S("success"),i()}).catch(b=>{s==null||s(b.message),i({type:"error",heading:b.message})}):se({...O,items:u}).then(b=>{a==null||a(b),S("success"),i()}).catch(b=>{s==null||s(b.message),i({type:"error",heading:b.message})}),d(!1)},[S,s,a,i,o,k]);return{order:o,steps:v,loading:h,formsRef:c,attributesList:C,selectedProductList:g,itemsEligibleForReturn:m,handleSelectedProductList:y,handleSetQuantity:E,handleChangeStep:S,onSubmit:Q}},he={success:pe,warning:de,error:ce},ge=()=>{const[a,s]=w({type:"success",heading:""}),i=F(l=>{if(!(l!=null&&l.type)){s({type:"success",heading:""});return}const k=r($,{source:he[l.type]});s({...l,icon:k})},[]);return{inLineAlertProps:a,handleSetInLineAlert:i}},je=({className:a,orderData:s,slots:i,onSuccess:l,onError:k,routeReturnSuccess:L,showConfigurableOptions:o})=>{const R=le({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:v,handleSetInLineAlert:x}=ge(),h=J(),{order:d,itemsEligibleForReturn:g,formsRef:f,attributesList:C,steps:t,loading:m,selectedProductList:e,handleSelectedProductList:c,handleSetQuantity:y,handleChangeStep:S,onSubmit:E}=me({orderData:s,onSuccess:l,onError:k,handleSetInLineAlert:x});if(m)return r("div",{children:r(oe,{})});if(!m&&!C.length)return r("div",{});const Q=(h==null?void 0:h.baseMediaUrl)??"",n={products:r(be,{itemsEligibleForReturn:g,placeholderImage:Q,taxConfig:ie((h==null?void 0:h.shoppingCartDisplayPrice)??0),slots:i,translations:R,loading:m,selectedProductList:e,handleSelectedProductList:c,showConfigurableOptions:o,handleSetQuantity:y,handleChangeStep:S}),attributes:r(ke,{placeholderImage:Q,slots:i,formsRef:f,loading:m,fieldsConfig:C,selectedProductList:e,handleChangeStep:S,translations:R,onSubmit:E}),success:r(fe,{translations:R,routeReturnSuccess:L,orderData:d}),error:null};return N("div",{className:B(["order-create-return",a]),children:[r(W,{title:R.headerText}),v.heading?r(j,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...v}):null,n[t]]})},fe=({routeReturnSuccess:a,translations:s,orderData:i})=>N("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(M,{href:(a==null?void 0:a(i))??"#",children:s.backStore})]}),be=({placeholderImage:a,itemsEligibleForReturn:s,slots:i,loading:l,taxConfig:k,translations:L,selectedProductList:o,handleSelectedProductList:R,showConfigurableOptions:v,handleSetQuantity:x,handleChangeStep:h})=>N("ul",{className:"order-return-order-product-list",children:[s==null?void 0:s.map((d,g)=>{const{quantityReturnRequested:f,quantityShipped:C,eligibleForReturn:t}=d,m=o.some(y=>(y==null?void 0:y.productSku)===d.productSku&&d.eligibleForReturn),e=C===f&&t||!t,c=C-f===0?f:C-f;return N("li",{className:B(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",e]]),children:[r(G,{"data-testid":`key_${g}`,name:`key_${g}`,checked:m,disabled:e,onChange:()=>{R({...d,currentReturnOrderQuantity:1})}}),r(ue,{placeholderImage:a,loading:l,product:{...d,totalQuantity:c||1},itemType:"",taxConfig:k,translations:L,showConfigurableOptions:v,disabledIncrementer:!m,onQuantity:c>1?y=>{x(y,d.productSku)}:void 0}),r(H,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:i==null?void 0:i.ReturnOrderItem})]},d.id)}),r("li",{className:"order-return-order-product-list__item",children:r(M,{type:"button",onClick:()=>h("attributes"),disabled:!o.length,children:L.nextStep})})]}),ke=({placeholderImage:a,slots:s,formsRef:i,selectedProductList:l,loading:k,fieldsConfig:L,translations:o,handleChangeStep:R,onSubmit:v})=>{const{formData:x,errors:h,formRef:d,handleChange:g,handleBlur:f,handleSubmit:C}=U({fieldsConfig:ee(L,l==null?void 0:l.length),onSubmit:v});return N("form",{className:"order-return-reason-form",ref:d,onSubmit:C,name:"returnReasonForm",children:[l.map((t,m)=>{var p,O,u,b,T,q;const e=t==null?void 0:t.giftCard,c=t==null?void 0:t.product,y=te(L,m),S=`${t==null?void 0:t.id}_${m}`,E=(t==null?void 0:t.currentReturnOrderQuantity)??1,Q={...t!=null&&t.currentReturnOrderQuantity?{[o.configurationsListQuantity]:E}:{},...t.configurableOptions||{},...t.bundleOptions||{},...e!=null&&e.senderName?{[o.sender]:e==null?void 0:e.senderName}:{},...e!=null&&e.senderEmail?{[o.sender]:e==null?void 0:e.senderEmail}:{},...e!=null&&e.recipientName?{[o.recipient]:e==null?void 0:e.recipientName}:{},...e!=null&&e.recipientEmail?{[o.recipient]:e==null?void 0:e.recipientEmail}:{},...e!=null&&e.message?{[o.message]:e==null?void 0:e.message}:{},...t!=null&&t.downloadableLinks?{[`${(p=t==null?void 0:t.downloadableLinks)==null?void 0:p.count} ${o.downloadableCount}`]:(O=t==null?void 0:t.downloadableLinks)==null?void 0:O.result}:{}},n=(b=(u=c==null?void 0:c.thumbnail)==null?void 0:u.url)!=null&&b.length?c.thumbnail.url:a;return N(X,{children:[r(V,{loading:k,title:r("div",{"data-testid":"product-name",children:(T=t==null?void 0:t.product)==null?void 0:T.name}),sku:r("div",{children:c==null?void 0:c.sku}),image:r(Z,{src:n,alt:((q=c==null?void 0:c.thumbnail)==null?void 0:q.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:Q}),r("form",{name:S,ref:i==null?void 0:i.current[m],"data-quantity":E,children:r(z,{className:"className",loading:k,fields:y,onChange:g,onBlur:f,errors:h,values:x})})]},t.id)}),r(H,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:s==null?void 0:s.ReturnFormActions,context:{handleChangeStep:R},children:N("div",{className:"order-return-reason-form__actions",children:[r(M,{variant:"secondary",type:"button",onClick:()=>{R("products")},children:o.backStep}),r(M,{children:o.submit})]})})]})};export{je as CreateReturn,je as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js b/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js index b949cc7d36..b15fa57476 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{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}; +import{jsx as c,jsxs as i,Fragment as v}from"@dropins/tools/preact-jsx-runtime.js";import{classes as Z}from"@dropins/tools/lib.js";import{useState as g,useEffect as V}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as b}from"@dropins/tools/event-bus.js";import{s as S}from"../chunks/setTaxStatus.js";import{Price as d,Icon as E,Accordion as f,AccordionSection as D,Card as I,Header as k}from"@dropins/tools/components.js";import{u as z}from"../chunks/useGetStoreConfig.js";import"../chunks/ShippingStatusCard.js";import*as _ from"@dropins/tools/preact-compat.js";import{O as A}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 $=s=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},_.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),j=s=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},_.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),P=s=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},_.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"})),W=({orderData:s,config:e})=>{const[t,n]=g(!0),[u,r]=g(s),[l,m]=g(null);return V(()=>{if(e){const{shoppingCartDisplayPrice:o,shoppingOrdersDisplayShipping:a,shoppingOrdersDisplaySubtotal:h,...y}=e;m(p=>({...p,...y,shoppingCartDisplayPrice:S(o),shoppingOrdersDisplayShipping:S(a),shoppingOrdersDisplaySubtotal:S(h)})),n(!1)}},[e]),V(()=>{const o=b.on("order/data",a=>{r(a)},{eager:!0});return()=>{o==null||o.off()}},[]),{loading:t,storeConfig:l,order:u}},mt=({withHeader:s,orderData:e,children:t,className:n,...u})=>{const r=z(),{loading:l,storeConfig:m,order:o}=W({orderData:e,config:r}),a=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",{...u,className:Z(["order-cost-summary",n]),children:c(K,{order:o,withHeader:s,loading:l,storeConfig:m,translations:a})})},q=({translations:s,order:e,subtotalInclTax:t,subtotalExclTax:n,shoppingOrdersDisplaySubtotal:u})=>{var h,y,p,x;const r=u.taxIncluded,l=u.taxExcluded,m=r&&!l?i(v,{children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(h=e==null?void 0:e.subtotalInclTax)==null?void 0:h.currency,amount:t})]}),c("div",{className:"order-cost-summary-content__description--subheader",children:c("span",{children:s.incl})})]}):null,o=l&&!r?i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(y=e==null?void 0:e.subtotalExclTax)==null?void 0:y.currency,amount:n})]}):null,a=l&&r?i(v,{children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:s.subtotal}),c(d,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(p=e==null?void 0:e.subtotalInclTax)==null?void 0:p.currency,amount:t})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[c(d,{currency:(x=e==null?void 0:e.subtotalExclTax)==null?void 0:x.currency,amount:n,size:"small",weight:"bold"})," ",c("span",{children:s.excl})]})]}):null;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[m,o,a]})},F=({translations:s,shoppingOrdersDisplayShipping:e,order:t,totalShipping:n})=>{var u,r,l,m;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:s.shipping}),(u=t==null?void 0:t.totalShipping)!=null&&u.value?c(d,{weight:"normal",currency:(r=t==null?void 0:t.totalShipping)==null?void 0:r.currency,amount:n}):c("span",{children:s.freeShipping})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[e.taxIncluded&&e.taxExcluded?i(v,{children:[c(d,{weight:"normal",currency:(l=t==null?void 0:t.totalShipping)==null?void 0:l.currency,amount:(m=t==null?void 0:t.totalShipping)==null?void 0:m.value,size:"small"}),i("span",{children:[" ",s.excl]})]}):null,e.taxIncluded&&!e.taxExcluded?c("span",{children:s.incl}):null]})]})},U=({translations:s,order:e,totalGiftcardValue:t,totalGiftcardCurrency:n})=>{var r,l,m,o;const u=(r=e==null?void 0:e.discounts)==null?void 0:r.every(a=>a.amount.value===0);return!((l=e==null?void 0:e.discounts)!=null&&l.length)&&(u||!t||t<1)||(m=e==null?void 0:e.discounts)!=null&&m.length&&u?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:s.discount}),c("span",{children:(o=e==null?void 0:e.discounts)==null?void 0:o.map(({amount:a},h)=>{const p=((a==null?void 0:a.value)??0)+t;return p===0?null:c(d,{weight:"normal",sale:!0,currency:a==null?void 0:a.currency,amount:-p},`${a==null?void 0:a.value}${h}`)})})]}),t>0?i("div",{className:"order-cost-summary-content__description--subheader",children:[i("span",{children:[c(E,{source:P,size:"16"}),c("span",{children:s.discountSubtitle.toLocaleUpperCase()})]}),c(d,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},G=({order:s})=>{var e;return c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--coupon",children:(e=s==null?void 0:s.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}`))})},R=({translations:s,renderTaxAccordion:e,totalAccordionTaxValue:t,order:n})=>{var l,m,o;const[u,r]=g(!1);return e?c(f,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:$,iconClose:j,children:i(D,{onStateChange:r,title:s.accordionTitle,secondaryText:c(v,{children:u?null:c(d,{weight:"normal",amount:t,currency:(m=n==null?void 0:n.totalTax)==null?void 0:m.currency})}),renderContentWhenClosed:!1,children:[(o=n==null?void 0:n.taxes)==null?void 0:o.map((a,h)=>{var y,p,x;return i("div",{className:"order-cost-summary-content__accordion-row",children:[c("p",{children:a==null?void 0:a.title}),c("p",{children:c(d,{weight:"normal",amount:(y=a==null?void 0:a.amount)==null?void 0:y.value,currency:(p=a==null?void 0:a.amount)==null?void 0:p.currency})})]},`${(x=a==null?void 0:a.amount)==null?void 0:x.value}${h}`)}),i("div",{className:"order-cost-summary-content__accordion-row order-cost-summary-content__accordion-total",children:[c("p",{children:s.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:s.tax}),c(d,{currency:(l=n==null?void 0:n.totalTax)==null?void 0:l.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},J=({translations:s,shoppingOrdersDisplaySubtotal:e,order:t})=>{var n,u,r,l;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:s.total}),c(d,{currency:(n=t==null?void 0:t.grandTotal)==null?void 0:n.currency,amount:(u=t==null?void 0:t.grandTotal)==null?void 0:u.value,weight:"bold",size:"medium"})]}),e.taxExcluded&&e.taxIncluded?i("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:s.totalExcludingTaxes}),c(d,{currency:(r=t==null?void 0:t.grandTotal)==null?void 0:r.currency,amount:((l=t==null?void 0:t.grandTotal)==null?void 0:l.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},K=({translations:s,loading:e,storeConfig:t,order:n,withHeader:u=!0})=>{var p,x,T,w,O,L,M;if(e||!n)return c(A,{});const r=((p=n==null?void 0:n.totalGiftcard)==null?void 0:p.value)??0,l=((x=n.totalGiftcard)==null?void 0:x.currency)??"",m=((T=n.subtotalInclTax)==null?void 0:T.value)??0,o=((w=n.subtotalExclTax)==null?void 0:w.value)??0,a=((O=n.totalShipping)==null?void 0:O.value)??0,h=!!((L=n==null?void 0:n.taxes)!=null&&L.length)&&(t==null?void 0:t.shoppingOrdersDisplayFullSummary),y=h?(M=n==null?void 0:n.taxes)==null?void 0:M.reduce((N,C)=>{var H;return+((H=C==null?void 0:C.amount)==null?void 0:H.value)+N},0):0;return i(I,{variant:"secondary",className:Z(["order-cost-summary-content"]),children:[u?c(k,{title:s.headerText}):null,i("div",{className:"order-cost-summary-content__wrapper",children:[c(q,{translations:s,order:n,subtotalInclTax:m,subtotalExclTax:o,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(F,{translations:s,order:n,totalShipping:a,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(U,{translations:s,order:n,totalGiftcardValue:r,totalGiftcardCurrency:l}),c(G,{order:n}),c(R,{order:n,translations:s,renderTaxAccordion:h,totalAccordionTaxValue:y}),c(J,{translations:s,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})};export{mt as OrderCostSummary,mt as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderReturns.js b/scripts/__dropins__/storefront-order/containers/OrderReturns.js index 6a98f6c332..c4d2b9a826 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 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}; +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 p,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";import"../chunks/capitalizeFirst.js";const h=({orderData:s})=>{const[i,n]=p(s),[o,u]=p([]);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}},B=({slots:s,className:i,orderData:n,withHeader:o,withThumbnails:u,routeReturnDetails:t,routeProductDetails:e,routeTracking:l})=>{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:l,loading:!1}):null})};export{B as OrderReturns,B as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderSearch.js b/scripts/__dropins__/storefront-order/containers/OrderSearch.js index e3900654b3..848af49fd4 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{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/GurestOrderFragment.graphql.js";import"../chunks/initialize.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"),n=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}):n||f(c,{orderRef:e.token})}else n||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 n=H(e.target);await B(n).then(o=>{o||u({text:m.invalidSearch,type:"warning"}),N.emit("order/data",o)}).catch(async o=>{var S;let d=!0;r==null||r({error:o.message});const h=t?await E():{email:""};(h==null?void 0:h.email)===(n==null?void 0:n.email)?f(i,{orderRef:n.number}):d=a==null?void 0:a({render:h===null||((S=o==null?void 0:o.message)==null?void 0:S.includes("Please login to view the order.")),formValues:n}),d&&u({text:o.message,type:"warning"})}).finally(()=>{p(!1)})},[t,r,a,i,m.invalidSearch]),inLineAlert:y,loading:b,normalizeFieldsConfig:O}},oe=({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{oe as OrderSearch,oe as default}; +import{jsx as t,jsxs as L}from"@dropins/tools/preact-jsx-runtime.js";import{classes as M}from"@dropins/tools/lib.js";import{Card as V,InLineAlert as k,Icon as C,Button as q}from"@dropins/tools/components.js";import{useState as v,useCallback as F,useEffect as _,useMemo as D}from"@dropins/tools/preact-hooks.js";import{F as H}from"../chunks/ShippingStatusCard.js";import*as w 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 B}from"../chunks/getFormValues.js";import{r as f}from"../chunks/redirectTo.js";import{g as E}from"../chunks/getQueryParam.js";import{g as x,a as z}from"../chunks/getGuestOrder.js";import{useText as U,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/GurestOrderFragment.graphql.js";import"../chunks/initialize.js";const X=s=>w.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},w.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"})),Z=({onError:s,isAuth:r,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c})=>{const[b,u]=v({text:"",type:"success"}),[y,p]=v(!1),n=U({invalidSearch:"Order.Errors.invalidSearch",email:"Order.OrderSearchForm.email",lastname:"Order.OrderSearchForm.lastname",number:"Order.OrderSearchForm.orderNumber"}),R=F(async e=>{const l=E("orderRef"),o=l&&l.length>20;if(!e&&!l||!(e!=null&&e.number)&&!(e!=null&&e.token)&&!l)return null;if(r){const d=await x();(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})},[r,i,c]);_(()=>{const e=N.on("order/data",l=>{R(l)},{eager:!0});return()=>{e==null||e.off()}},[R]),_(()=>{const e=E("orderRef"),l=e&&e.length>20?e:null;e&&(l?f(c,{orderRef:e}):r?f(i,{orderRef:e}):a==null||a({render:!0,formValues:{number:e}}))},[r,i,c,a]);const O=D(()=>[{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:n.email,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:n.lastname,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:2,name:"lastname",id:"lastname",code:"lastname"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:n.number,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:3,name:"number",id:"number",code:"number"}],[n]);return{onSubmit:F(async(e,l)=>{if(!l)return null;p(!0);const o=B(e.target);await z(o).then(m=>{m||u({text:n.invalidSearch,type:"warning"}),N.emit("order/data",m)}).catch(async m=>{var S;let d=!0;s==null||s({error:m.message});const h=r?await x():{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=m==null?void 0:m.message)==null?void 0:S.includes("Please login to view the order.")),formValues:o}),d&&u({text:m.message,type:"warning"})}).finally(()=>{p(!1)})},[r,s,a,i,n.invalidSearch]),inLineAlert:b,loading:y,normalizeFieldsConfig:O}},ne=({className:s,isAuth:r,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c,onError:b})=>{const{onSubmit:u,loading:y,inLineAlert:p,normalizeFieldsConfig:n}=Z({onError:b,isAuth:r,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c});return t("div",{className:M(["order-order-search",s]),children:t(j,{onSubmit:u,loading:y,inLineAlert:p,fieldsConfig:n})})},j=({onSubmit:s,loading:r,inLineAlert:a,fieldsConfig:i})=>L(V,{variant:"secondary",className:"order-order-search-form",children:[t("h2",{className:"order-order-search-form__title",children:t(T,{id:"Order.OrderSearchForm.title"})}),t("p",{children:t(T,{id:"Order.OrderSearchForm.description"})}),a.text?t(k,{"data-testid":"orderAlert",className:"order-order-search-form__alert",type:a.type,variant:"secondary",heading:a.text,icon:t(C,{source:X})}):null,t(H,{className:"order-order-search-form__wrapper",name:"orderSearchForm",loading:r,fieldsConfig:i,onSubmit:s,children:t("div",{className:"order-order-search-form__button-container",children:t(q,{className:"order-order-search-form__button",size:"medium",variant:"primary",type:"submit",disabled:r,children:t(T,{id:"Order.OrderSearchForm.button"})},"logIn")})})]});export{ne as OrderSearch,ne as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderStatus.js b/scripts/__dropins__/storefront-order/containers/OrderStatus.js index 677e078def..3e50d674bb 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderStatus.js +++ b/scripts/__dropins__/storefront-order/containers/OrderStatus.js @@ -1,21 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -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/GurestOrderFragment.graphql.js";import{f as Y,h as Z}from"../chunks/fetch-graphql.js";import{c as D}from"../chunks/initialize.js";import{useText as O,Text as x}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/network-error.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.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! - ) { - confirmCancelOrder( - input: { order_id: $orderId, confirmation_key: $confirmationKey } - ) { - order { - ...guestOrderData - } - errorV2 { - message - code - } - } - } - ${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}},$e=({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(x,{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(x,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:i(te,{orderRef:r,cancelReasons:l(d)})})]})},b=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:b(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||b(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{$e as OrderStatus,$e as default}; +import{jsx as s,Fragment as S,jsxs as A}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as $,classes as _}from"@dropins/tools/lib.js";import{Button as P,InLineAlert as B,Modal as V,Card as K,Header as Q}from"@dropins/tools/components.js";import{useState as C,useEffect as k,useCallback as T}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import{useMemo as J}from"@dropins/tools/preact-compat.js";import{u as G}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as I}from"@dropins/tools/event-bus.js";import{a as X,c as Y,r as Z}from"../chunks/confirmCancelOrder.js";import{useText as O,Text as M}from"@dropins/tools/i18n.js";import{C as D}from"../chunks/OrderLoaders.js";import{f as ee}from"../chunks/returnOrdersHelper.js";import{f as w}from"../chunks/formatDateToLocale.js";import{c as b}from"../chunks/capitalizeFirst.js";import{r as U}from"../chunks/redirectTo.js";import{O as te}from"../chunks/OrderCancelForm.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/network-error.js";import"../chunks/RequestReturnOrderFragment.graphql.js";import"../chunks/GurestOrderFragment.graphql.js";import"../chunks/initialize.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";var y=(t=>(t.CANCEL="CANCEL",t.RETURN="RETURN",t.REORDER="REORDER",t))(y||{});const re=({className:t,orderData:e,slots:n,routeCreateReturn:r,routeOnSuccess:u,onError:i})=>{const d=O({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=J(()=>{const c=e==null?void 0:e.availableActions,o=!!(c!=null&&c.length),a=!!(e!=null&&e.returnNumber),m=()=>{U(r,{},e)};return s(S,{children:n!=null&&n.OrderActions?s($,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:e}):s("div",{"data-testid":"availableActionsList",className:_(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!o]]),children:c==null?void 0:c.map(p=>{switch(p){case y.CANCEL:return s(S,{children:a?null:s(ce,{orderRef:(e==null?void 0:e.token)??(e==null?void 0:e.id)})});case y.RETURN:return s(P,{variant:"secondary",onClick:m,children:a?d.createAnotherReturn:d.createReturn});case y.REORDER:return s(S,{children:a?null:s(ie,{orderData:e,onError:i,routeOnSuccess:u,children:d.reorder})})}})})})},[i,e,u,r,n,d]);return s("div",{className:_(["order-order-actions",t]),children:l})},ne=({orderData:t})=>{const[e,n]=C(t),[r,u]=C(t==null?void 0:t.status);return k(()=>{const i=I.on("order/data",d=>{n(d),u(d.status)},{eager:!0});return()=>{i==null||i.off()}},[]),{orderStatus:r,order:e}},H=t=>{const e=new URL(window.location.href);t.forEach(n=>{e.searchParams.has(n)&&e.searchParams.delete(n)}),window.history.replaceState({},document.title,e.toString())},se=({enableOrderCancellation:t})=>{const e=O({cancelOrderHeading:"Order.OrderStatusContent.actions.cancel",confirmGuestReturnHeading:"Order.OrderStatusContent.actions.confirmGuestReturn",orderCancelled:"Order.OrderStatusContent.orderCanceled.message",guestRequestReturnMessage:"Order.OrderStatusContent.actions.confirmGuestReturnMessage"}),[n,r]=C(!1),[u,i]=C(!1),[d,l]=C({heading:"",text:"",status:void 0}),c=T(()=>{r(!0),H(["order_id","confirmation_key","action"])},[]),o=T((a,m,p)=>{l({heading:a,text:m,status:p}),H(["action"])},[]);return k(()=>{const a=new URLSearchParams(window.location.search),m=a.get("order_id")??"",p=a.get("confirmation_key")??"",g=a.get("action")??"";u||!m||!p||!g||(t&&g==="cancel"&&(i(!0),X(m,p).then(()=>{l({heading:e.cancelOrderHeading,text:e.orderCancelled,status:"success"})}).catch(h=>{l({heading:e.cancelOrderHeading,text:h.message,status:"warning"})})),g==="return"&&(i(!0),Y(m,p).then(()=>{l({heading:e.confirmGuestReturnHeading,text:e.guestRequestReturnMessage,status:"success"})}).catch(h=>{l({heading:e.confirmGuestReturnHeading,text:h.message,status:"warning"})})))},[t,e,o,u]),{orderActionStatus:d,isDismissed:n,onDismiss:c}},He=({slots:t,orderData:e,className:n,statusTitle:r,status:u,routeCreateReturn:i,onError:d,routeOnSuccess:l})=>{const{orderStatus:c,order:o}=ne({orderData:e}),a=G(),{orderActionStatus:m,isDismissed:p,onDismiss:g}=se({enableOrderCancellation:a==null?void 0:a.orderCancellationEnabled});return A("div",{className:_(["order-order-status",n]),children:[!p&&(m==null?void 0:m.status)!==void 0?s(B,{style:{marginBottom:"1rem"},heading:m.heading,onDismiss:g,description:m.text,type:m.status}):null,o?s(oe,{title:r,status:u||c,slots:t,orderData:o,routeCreateReturn:i,onError:d,routeOnSuccess:l}):s(D,{withCard:!1})]})},ce=({orderRef:t})=>{const[e,n]=C(!1),r=()=>{n(!0)},u=()=>{n(!1)},i=G(),d=(i==null?void 0:i.orderCancellationReasons)??[],l=c=>c.map((o,a)=>({text:o==null?void 0:o.description,value:a.toString()}));return I.on("order/data",c=>{const o=String(c.status).toLocaleLowerCase();(o==="guest order cancellation requested"||o==="canceled")&&u()}),A(S,{children:[s(P,{variant:"secondary",onClick:r,"data-testid":"cancel-button",children:s(M,{id:"Order.OrderStatusContent.actions.cancel"})}),e&&s(V,{centered:!0,size:"medium",onClose:u,className:"order-order-cancel__modal",title:s("h2",{className:"order-order-cancel__title",children:s(M,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:s(te,{orderRef:t,cancelReasons:l(d)})})]})},N={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"},oe=({slots:t,title:e,status:n,orderData:r,routeCreateReturn:u,onError:i,routeOnSuccess:d})=>{var x,E,L;const l=!!(r!=null&&r.returnNumber),c=String(n).toLocaleLowerCase(),o=(x=r==null?void 0:r.returns)==null?void 0:x[0],a=(o==null?void 0:o.returnStatus)??"",m=(o==null?void 0:o.createdReturnAt)??"",p=O({message:"Order.OrderStatusContent.orderPlaceholder.message",messageWithoutDate:"Order.OrderStatusContent.orderPlaceholder.messageWithoutDate"}),g=O(`Order.OrderStatusContent.${N[c]}.title`),h=O(`Order.OrderStatusContent.${N[c]}.message`),R=O(`Order.OrderStatusContent.${N[c]}.messageWithoutDate`),f=O({title:`Order.OrderStatusContent.returnStatus.${ee(a)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return s("div",{});const q=g!=null&&g.title?g:{title:b(c)},v=h!=null&&h.message?h:p,F=R!=null&&R.messageWithoutDate?R:p,W=r!=null&&r.orderStatusChangeDate?v==null?void 0:v.message.replace("{DATE}",w(r==null?void 0:r.orderStatusChangeDate)):F.messageWithoutDate,j=((L=(E=f==null?void 0:f.returnMessage)==null?void 0:E.replace("{ORDER_CREATE_DATE}",w(r==null?void 0:r.orderDate)))==null?void 0:L.replace("{RETURN_CREATE_DATE}",w(m)))??"",z=l?e??(f.title||b(a)):e??q.title;return A(K,{className:"order-order-status-content",variant:"secondary",children:[s(Q,{title:z}),A("div",{className:"order-order-status-content__wrapper",children:[s("div",{className:_(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(t!=null&&t.OrderActions)]]),children:s("p",{children:l?j:W})}),s(re,{orderData:r,slots:t,routeCreateReturn:u,routeOnSuccess:d,onError:i})]})]})},ie=({onError:t,routeOnSuccess:e,orderData:n,children:r})=>{const[u,i]=C(!1),d=T(()=>{i(!0);const l=n==null?void 0:n.number;Z(l).then(({success:c,userInputErrors:o})=>{c&&U(e,{}),o.length&&(t==null||t(o))}).catch(c=>{t==null||t(c.message)}).finally(()=>{i(!1)})},[n,e,t]);return s(P,{type:"button",disabled:u,variant:"secondary",className:"order-reorder",onClick:d,children:r})};export{He as OrderStatus,He as default}; diff --git a/scripts/__dropins__/storefront-order/containers/ReturnsList.js b/scripts/__dropins__/storefront-order/containers/ReturnsList.js index 74da1dcd46..0f701a7577 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 p}from"@dropins/tools/preact-jsx-runtime.js";import{classes as $}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";import{useState as o,useEffect as g,useCallback as M}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as T}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{g as v}from"../chunks/getCustomerOrdersReturn.js";import{u as y}from"../chunks/useIsMobile.js";import{R as A}from"../chunks/ReturnsListContent.js";import{useText as V}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/initialize.js";import"../chunks/returnOrdersHelper.js";import"../chunks/getFormValues.js";import"../chunks/OrderLoaders.js";const L={totalPages:1,currentPage:1,pageSize:1},k=({returnPageSize:i})=>{const[n,u]=o(!0),[s,a]=o([]),[m,l]=o(L),[t,d]=o(1);g(()=>{v(i,t).then(r=>{a((r==null?void 0:r.ordersReturn)??[]),l((r==null?void 0:r.pageInfo)??L)}).finally(()=>{u(!1)})},[i,t]),g(()=>{window==null||window.scrollTo({top:100,behavior:"smooth"})},[t]);const c=M(r=>{d(r)},[]);return{pageInfo:m,selectedPage:t,loading:n,orderReturns:s,handleSetSelectPage:c}},er=({slots:i,withReturnsListButton:n,className:u,minifiedView:s,withHeader:a,withThumbnails:m,returnPageSize:l,returnsInMinifiedView:t,routeReturnDetails:d,routeOrderDetails:c,routeTracking:r,routeReturnsList:R,routeProductDetails:O})=>{const f=T(),{pageInfo:b,selectedPage:w,handleSetSelectPage:h,loading:N,orderReturns:P}=k({returnPageSize:l}),S=y(),e=s?"minifiedView":"fullSizeView",I=V({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:$(["order-returns-list",u]),children:p(A,{placeholderImage:(f==null?void 0:f.baseMediaUrl)??"",minifiedViewKey:e,withOrderNumber:!0,withReturnNumber:!0,slots:i,selectedPage:w,handleSetSelectPage:h,pageInfo:b,withReturnsListButton:n,isMobile:S,orderReturns:P,translations:I,withHeader:a,returnsInMinifiedView:t,withThumbnails:m,minifiedView:s,routeReturnDetails:d,routeOrderDetails:c,routeTracking:r,routeReturnsList:R,routeProductDetails:O,loading:N})})};export{er as default}; +import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import{classes as $}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";import{useState as o,useEffect as g,useCallback as M}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as T}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{g as v}from"../chunks/getCustomerOrdersReturn.js";import{u as y}from"../chunks/useIsMobile.js";import{R as A}from"../chunks/ReturnsListContent.js";import{useText as V}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/initialize.js";import"../chunks/returnOrdersHelper.js";import"../chunks/getFormValues.js";import"../chunks/OrderLoaders.js";import"../chunks/capitalizeFirst.js";const L={totalPages:1,currentPage:1,pageSize:1},k=({returnPageSize:i})=>{const[n,u]=o(!0),[s,a]=o([]),[m,l]=o(L),[t,d]=o(1);g(()=>{v(i,t).then(r=>{a((r==null?void 0:r.ordersReturn)??[]),l((r==null?void 0:r.pageInfo)??L)}).finally(()=>{u(!1)})},[i,t]),g(()=>{window==null||window.scrollTo({top:100,behavior:"smooth"})},[t]);const c=M(r=>{d(r)},[]);return{pageInfo:m,selectedPage:t,loading:n,orderReturns:s,handleSetSelectPage:c}},tr=({slots:i,withReturnsListButton:n,className:u,minifiedView:s,withHeader:a,withThumbnails:m,returnPageSize:l,returnsInMinifiedView:t,routeReturnDetails:d,routeOrderDetails:c,routeTracking:r,routeReturnsList:R,routeProductDetails:O})=>{const p=T(),{pageInfo:b,selectedPage:w,handleSetSelectPage:h,loading:N,orderReturns:P}=k({returnPageSize:l}),S=y(),e=s?"minifiedView":"fullSizeView",I=V({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",u]),children:f(A,{placeholderImage:(p==null?void 0:p.baseMediaUrl)??"",minifiedViewKey:e,withOrderNumber:!0,withReturnNumber:!0,slots:i,selectedPage:w,handleSetSelectPage:h,pageInfo:b,withReturnsListButton:n,isMobile:S,orderReturns:P,translations:I,withHeader:a,returnsInMinifiedView:t,withThumbnails:m,minifiedView:s,routeReturnDetails:d,routeOrderDetails:c,routeTracking:r,routeReturnsList:R,routeProductDetails:O,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 6649338f09..e1daad6036 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 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}; +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 rn}from"@dropins/tools/event-bus.js";import{C as ln}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[l,h]=R(!0),[n,c]=R(s),[r,m]=R(!1);return tn(()=>{const u=rn.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:l,order:n,isVirtualProduct:r}},en=({value:s,variant:l="primary",size:h="medium",icon:n,className:c,children:r,disabled:m=!1,active:u=!1,activeChildren:o,activeIcon:b,href:e,...C})=>{let d="dropin-button";(n&&!r||n&&u&&!o||!n&&u&&b)&&(d="dropin-iconButton"),u&&o&&(d="dropin-button"),c=$([d,`${d}--${h}`,`${d}--${l}`,[`${d}--${l}--disabled`,m],r&&n&&`${d}--with-icon`,!r&&o&&n&&`${d}--with-icon`,u&&b&&`${d}--with-icon`,c]);const I=$(["dropin-button-icon",`dropin-button-icon--${l}`,[`dropin-button-icon--${l}--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}),r&&!u&&(typeof r=="string"?i("span",{children:r}):r),u&&o&&(typeof o=="string"?i("span",{children:o}):o)]})},cn=({placeholderImage:s,slots:l,collapseThreshold:h,translations:n,returnData:c,routeTracking:r,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,N;const d={title:"",number:(e==null?void 0:e.trackingNumber)??"",carrier:((y=e==null?void 0:e.carrier)==null?void 0:y.label)??""},I=r==null?void 0:r(d),g=I?()=>{window.open(I,"_blank","noreferrer")}:null;return S("div",{className:"order-shipping-status-card__header",children:[S("div",{children:[`${n.carrier} `,`${(N=d.carrier)==null?void 0:N.toLocaleUpperCase()} | `,d.number]}),g?i(en,{onClick:g,children:n.trackButton}):null]},`${d.number}_${C}`)}),l!=null&&l.ReturnItemsDetails?i(q,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:l==null?void 0:l.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,N,_;const d=(g=e.thumbnail)==null?void 0:g.label,I=(N=(y=e.thumbnail)==null?void 0:y.url)!=null&&N.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:l,slots:h,orderData:n,collapseThreshold:c=10,routeProductDetails:r,routeTracking:m})=>{var N,_,j,F,Q,K,W;const u=!!(n!=null&&n.returnNumber),o=n==null?void 0:n.returnNumber,b=r?"a":"span",e=(N=n==null?void 0:n.status)==null?void 0:N.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:l,returnData:p,routeTracking:m,routeProductDetails:r})}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,O)=>t+((O==null?void 0:O.quantityShipped)??O.orderItem.quantityShipped??0),0);return S(A,{variant:"secondary",className:"order-shipping-status-card",children:[i(x,{title:l.shippingCardTitle}),p==null?void 0:p.map(t=>{var a;const O=m==null?void 0:m(t),L=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:[l.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:l.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 O=(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:(r==null?void 0:r(t))??"#",children:i(M,{alt:O,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:l.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:(r==null?void 0:r(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:l.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:l.noInfoTitle})]})})]})},wn=({slots:s,className:l,collapseThreshold:h,orderData:n,routeOrderDetails:c,routeTracking:r,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",l]),children:!u&&o?i(mn,{placeholderImage:d,translations:C,routeOrderDetails:c,routeTracking:r,slots:s,orderData:o,collapseThreshold:h,routeProductDetails:m}):i(ln,{withCard:!1})})};export{wn as ShippingStatus,wn as default}; 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 a27ac60a28..d3805af02c 100644 --- a/scripts/__dropins__/storefront-order/data/models/order-details.d.ts +++ b/scripts/__dropins__/storefront-order/data/models/order-details.d.ts @@ -154,7 +154,8 @@ export type OrderDataModel = { totalGiftcard: MoneyProps; grandTotal: MoneyProps; totalShipping?: MoneyProps; - subtotal: MoneyProps; + subtotalExclTax: MoneyProps; + subtotalInclTax: MoneyProps; totalTax: MoneyProps; shippingAddress: OrderAddressModel; billingAddress: OrderAddressModel; diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useConfirmCancelOrder.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useConfirmCancelOrder.d.ts deleted file mode 100644 index 19c36d2d36..0000000000 --- a/scripts/__dropins__/storefront-order/hooks/containers/useConfirmCancelOrder.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ConfirmCancelOrderProps } from '../../types'; - -export declare const useConfirmCancelOrder: ({ enableOrderCancellation, }: ConfirmCancelOrderProps) => { - confirmOrderCancellation: { - text: string; - status: 'success' | 'error' | 'warning' | undefined; - }; -}; -//# sourceMappingURL=useConfirmCancelOrder.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 dedc3def4d..2c174c4258 100644 --- a/scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts @@ -39,7 +39,8 @@ export declare const useCreateReturn: ({ onSuccess, onError, handleSetInLineAler totalGiftcard?: import('../../types').MoneyProps | undefined; grandTotal?: import('../../types').MoneyProps | undefined; totalShipping?: import('../../types').MoneyProps | undefined; - subtotal?: import('../../types').MoneyProps | undefined; + subtotalExclTax?: import('../../types').MoneyProps | undefined; + subtotalInclTax?: import('../../types').MoneyProps | undefined; totalTax?: import('../../types').MoneyProps | undefined; shippingAddress?: import('../../data/models').OrderAddressModel | undefined; billingAddress?: import('../../data/models').OrderAddressModel | undefined; diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useOrderActions.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useOrderActions.d.ts new file mode 100644 index 0000000000..ac7b11d630 --- /dev/null +++ b/scripts/__dropins__/storefront-order/hooks/containers/useOrderActions.d.ts @@ -0,0 +1,12 @@ +import { UseOrderActionsProps } from '../../types'; + +export declare const useOrderActions: ({ enableOrderCancellation, }: UseOrderActionsProps) => { + orderActionStatus: { + heading: string; + text: string; + status: 'success' | 'error' | 'warning' | undefined; + }; + isDismissed: boolean; + onDismiss: () => void; +}; +//# sourceMappingURL=useOrderActions.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 eeec23d318..a67ffe6df1 100644 --- a/scripts/__dropins__/storefront-order/hooks/index.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/index.d.ts @@ -7,6 +7,7 @@ export * from './containers/useOrderSearch'; export * from './containers/useOrderStatus'; export * from './containers/useReturnsList'; export * from './containers/useShippingStatus'; +export * from './containers/useOrderActions'; export * from './useInLineAlert'; export * from './useIsMobile'; export * from './api/useGetStoreConfig'; 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 6a4befce7d..130bf4e825 100644 --- a/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts +++ b/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts @@ -183,6 +183,8 @@ declare const _default: { }, "actions": { "cancel": "Cancel order", + "confirmGuestReturn": "Return request confirmed", + "confirmGuestReturnMessage": "Your return request has been successfully confirmed.", "createReturn": "Return or replace", "createAnotherReturn": "Start another return", "reorder": "Reorder" @@ -232,7 +234,7 @@ declare const _default: { "messageWithoutDate": "Your order is processing. Check back for more details when your order ships." }, "guestOrderCancellationRequested": { - "title": "cancellation requested", + "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." }, diff --git a/scripts/__dropins__/storefront-order/lib/getQueryParam.d.ts b/scripts/__dropins__/storefront-order/lib/getQueryParam.d.ts index cb9f254ed4..8089cdd4f0 100644 --- a/scripts/__dropins__/storefront-order/lib/getQueryParam.d.ts +++ b/scripts/__dropins__/storefront-order/lib/getQueryParam.d.ts @@ -1,2 +1,2 @@ -export declare const getQueryParam: (param: string) => string | null; +export declare const getQueryParam: (param: string) => string; //# sourceMappingURL=getQueryParam.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/lib/removeQueryParams.d.ts b/scripts/__dropins__/storefront-order/lib/removeQueryParams.d.ts new file mode 100644 index 0000000000..5f56141e93 --- /dev/null +++ b/scripts/__dropins__/storefront-order/lib/removeQueryParams.d.ts @@ -0,0 +1,2 @@ +export declare const removeQueryParams: (params: string[]) => void; +//# sourceMappingURL=removeQueryParams.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 94a3765951..1365495e93 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-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 a.order-returns-list-content__actions{display:inline-block;width:100%}.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}; +.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);font-weight:700}.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 a.order-returns-list-content__actions{display:inline-block;width:100%}.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",confirmGuestReturn:"Return request confirmed",confirmGuestReturnMessage:"Your return request has been successfully confirmed.",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/confirmGuestReturn.types.d.ts b/scripts/__dropins__/storefront-order/types/api/confirmGuestReturn.types.d.ts new file mode 100644 index 0000000000..f78068c721 --- /dev/null +++ b/scripts/__dropins__/storefront-order/types/api/confirmGuestReturn.types.d.ts @@ -0,0 +1,18 @@ +import { OrderDataModel } from '../../data/models'; +import { ReturnProps } from './requestReturn.types'; + +interface ErrorsProps { + message: string; +} +export interface GuestConfirmReturnResponse { + data: { + confirmReturn: { + return: ReturnProps & { + order: OrderDataModel; + }; + }; + }; + errors?: ErrorsProps[]; +} +export {}; +//# sourceMappingURL=confirmGuestReturn.types.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/api/requestReturn.types.d.ts b/scripts/__dropins__/storefront-order/types/api/requestReturn.types.d.ts index ed9233bb5b..b9227060f0 100644 --- a/scripts/__dropins__/storefront-order/types/api/requestReturn.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/api/requestReturn.types.d.ts @@ -1,5 +1,5 @@ export interface RequestReturnProps { - orderUid: string; + orderUid?: string; contactEmail: string; items: { orderItemUid: string; @@ -14,20 +14,34 @@ export interface RequestReturnProps { }[]; }[]; } +export interface RequestGuestReturnProps extends RequestReturnProps { + token: string; + commentText: string; +} export interface ReturnProps { uid: string; number: string; status: string; created_at: string; } +interface ErrorsProps { + message: string; +} export interface RequestReturnResponse { data: { requestReturn: { return: ReturnProps; }; }; - errors?: { - message: string; - }[]; + errors?: ErrorsProps[]; +} +export interface RequestGuestReturnResponse { + data: { + requestGuestReturn: { + return: ReturnProps; + }; + }; + errors?: ErrorsProps[]; } +export {}; //# sourceMappingURL=requestReturn.types.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/index.d.ts b/scripts/__dropins__/storefront-order/types/index.d.ts index 4322eb4855..b1b829585e 100644 --- a/scripts/__dropins__/storefront-order/types/index.d.ts +++ b/scripts/__dropins__/storefront-order/types/index.d.ts @@ -8,6 +8,7 @@ export * from './api/guestOrderByToken.types'; export * from './api/placeOrder.types'; export * from './api/reorderItems.types'; export * from './api/requestReturn.types'; +export * from './api/confirmGuestReturn.types'; export * from './createReturn.types'; export * from './customerDetails.types'; export * from './emptyList.types'; @@ -22,4 +23,5 @@ export * from './orderStatus.types'; export * from './reorder.types'; export * from './returnsList.types'; export * from './shippingStatus.types'; +export * from './orderEmailActionHandler.types'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/orderCancel.types.d.ts b/scripts/__dropins__/storefront-order/types/orderCancel.types.d.ts index fe679f4a61..d475f88d9a 100644 --- a/scripts/__dropins__/storefront-order/types/orderCancel.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/orderCancel.types.d.ts @@ -10,7 +10,7 @@ export interface OrderCancelFormProps { submitButtonProps?: ButtonProps; cancelReasons: PickerOption[]; } -export interface ConfirmCancelOrderProps { +export interface UseOrderActionsProps { enableOrderCancellation: boolean | undefined; } //# sourceMappingURL=orderCancel.types.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/orderEmailActionHandler.types.d.ts b/scripts/__dropins__/storefront-order/types/orderEmailActionHandler.types.d.ts new file mode 100644 index 0000000000..3210948ee1 --- /dev/null +++ b/scripts/__dropins__/storefront-order/types/orderEmailActionHandler.types.d.ts @@ -0,0 +1,4 @@ +export interface OrderEmailActionHandlerProps { + routeRedirect: (orderToken: string, orderNumber: string, orderData: any) => string; +} +//# sourceMappingURL=orderEmailActionHandler.types.d.ts.map \ No newline at end of file