diff --git a/build.mjs b/build.mjs index fca97b1fd9..174a4b1948 100644 --- a/build.mjs +++ b/build.mjs @@ -2,12 +2,12 @@ import { overrideGQLOperations } from '@dropins/build-tools/gql-extend.js'; overrideGQLOperations([ - { - npm: '@dropins/storefront-cart', - operations: [], - }, - { - npm: '@dropins/storefront-checkout', - operations: [], - }, + // { + // npm: '@dropins/storefront-cart', + // operations: [], + // }, + // { + // npm: '@dropins/storefront-checkout', + // operations: [], + // }, ]); diff --git a/scripts/__dropins__/storefront-order/api.js b/scripts/__dropins__/storefront-order/api.js index 6f810512f0..6de3ff0c18 100644 --- a/scripts/__dropins__/storefront-order/api.js +++ b/scripts/__dropins__/storefront-order/api.js @@ -1,217 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{c as ae,r as se}from"./chunks/requestGuestOrderCancel.js";import{f as i,h as y}from"./chunks/fetch-graphql.js";import{g as de,r as ne,s as ie,a as le,b as ue}from"./chunks/fetch-graphql.js";import{g as pe}from"./chunks/getAttributesForm.js";import{g as _e,r as Oe}from"./chunks/requestReturn.js";import{t as f}from"./chunks/getGuestOrder.js";import{g as he,a as Re}from"./chunks/getGuestOrder.js";import{g as Ee}from"./chunks/getCustomerOrdersReturn.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as m,G as p,O as c,B as _,R as C,b as A,c as G}from"./chunks/transform-customer-orders-returns.js";import{O,A as D}from"./chunks/getGuestOrder.graphql.js";import{g as ye}from"./chunks/getStoreConfig.js";import{Initializer as $}from"@dropins/tools/lib.js";import{events as n}from"@dropins/tools/event-bus.js";import{r as ge}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/transform-attributes-form.js";import"./chunks/convertCase.js";const N=` -query ORDER_BY_NUMBER($orderNumber: String!, $pageSize: Int) { - customer { - orders( - filter: { number: { eq: $orderNumber } } - ) { - items { - email - available_actions - status - number - id - order_date - order_status_change_date - carrier - shipping_method - is_virtual - returns(pageSize: $pageSize) { - ...OrderReturns - } - items_eligible_for_return { - ...OrderItemDetails - ... on BundleOrderItem { - ...BundleOrderItemDetails - } - ... on GiftCardOrderItem { - ...GiftCardDetails - product { - ...ProductDetails - } - } - ... on DownloadableOrderItem { - product_name - downloadable_links { - sort_order - title - } - } - } - applied_coupons { - code - } - shipments { - id - number - tracking { - title - number - carrier - } - comments { - message - timestamp - } - items { - id - product_sku - product_name - quantity_shipped - order_item { - ...OrderItemDetails - ... on GiftCardOrderItem { - ...GiftCardDetails - product { - ...ProductDetails - } - } - } - } - } - payment_methods { - name - type - } - shipping_address { - ...AddressesList - } - billing_address { - ...AddressesList - } - items { - ...OrderItemDetails - ... on BundleOrderItem { - ...BundleOrderItemDetails - } - ... on GiftCardOrderItem { - ...GiftCardDetails - product { - ...ProductDetails - } - } - ... on DownloadableOrderItem { - product_name - downloadable_links { - sort_order - title - } - } - } - total { - ...OrderSummary - } - } - } - } -} -${u} -${m} -${p} -${c} -${_} -${O} -${D} -${C} -`,v=(e,t)=>({id:e,totalQuantity:t.totalQuantity,possibleOnepageCheckout:!0,items:t.items.map(r=>{var a,s,o,d,h,R;return{canApplyMsrp:!0,formattedPrice:"",id:r.id,quantity:r.totalQuantity,product:{canonicalUrl:((a=r.product)==null?void 0:a.canonicalUrl)??"",mainImageUrl:((s=r.product)==null?void 0:s.image)??"",name:((o=r.product)==null?void 0:o.name)??"",productId:0,productType:(d=r.product)==null?void 0:d.productType,sku:((h=r.product)==null?void 0:h.sku)??""},prices:{price:{value:r.price.value,currency:r.price.currency}},configurableOptions:((R=r.selectedOptions)==null?void 0:R.map(b=>({optionLabel:b.label,valueLabel:b.value})))||[]}})}),L=e=>{var a,s,o;const t=e.coupons[0],r=(a=e.payments)==null?void 0:a[0];return{appliedCouponCode:(t==null?void 0:t.code)??"",email:e.email,grandTotal:e.grandTotal.value,orderId:e.number,orderType:"checkout",otherTax:0,salesTax:e.totalTax.value,shipping:{shippingMethod:((s=e.shipping)==null?void 0:s.code)??"",shippingAmount:((o=e.shipping)==null?void 0:o.amount)??0},subtotalExcludingTax:e.subtotal.value,subtotalIncludingTax:0,payments:r?[{paymentMethodCode:(r==null?void 0:r.code)||"",paymentMethodName:(r==null?void 0:r.name)||"",total:e.grandTotal.value}]:[]}},S=e=>{var r,a;const t=(a=(r=e==null?void 0:e.data)==null?void 0:r.placeOrder)==null?void 0:a.orderV2;return t?A(t):null},k=async({orderId:e,returnRef:t,queryType:r,returnsPageSize:a=50})=>await i(N,{method:"GET",cache:"force-cache",variables:{orderNumber:e,pageSize:a}}).then(s=>G(r??"orderData",s,t)).catch(l),w=` -query ORDER_BY_TOKEN($token: String!) { - guestOrderByToken(input: { token: $token }) { - email - id - number - order_date - order_status_change_date - status - token - carrier - shipping_method - printed_card_included - gift_receipt_included - available_actions - is_virtual - items_eligible_for_return { - ...OrderItemDetails - } - returns(pageSize: 50) { - ...OrderReturns - } - payment_methods { - name - type - } - applied_coupons { - code - } - shipments { - id - tracking { - title - number - carrier - } - comments { - message - timestamp - } - items { - id - product_sku - product_name - order_item { - ...OrderItemDetails - ... on GiftCardOrderItem { - ...GiftCardDetails - product { - ...ProductDetails - } - } - } - } - } - payment_methods { - name - type - } - shipping_address { - ...AddressesList - } - billing_address { - ...AddressesList - } - items { - ...OrderItemDetails - ... on BundleOrderItem { - ...BundleOrderItemDetails - } - ... on GiftCardOrderItem { - ...GiftCardDetails - product { - ...ProductDetails - } - } - ... on DownloadableOrderItem { - product_name - downloadable_links { - sort_order - title - } - } - } - total { - ...OrderSummary - } - } -} -${u} -${m} -${p} -${c} -${_} -${O} -${D} -${C} -`,x=async(e,t)=>await i(w,{method:"GET",cache:"no-cache",variables:{token:e}}).then(r=>{var a;return(a=r.errors)!=null&&a.length?y(r.errors):f(r,t)}).catch(l),B="orderData",P=async e=>{var d;const t=typeof(e==null?void 0:e.orderRef)=="string"?e==null?void 0:e.orderRef:"",r=typeof(e==null?void 0:e.returnRef)=="string"?e==null?void 0:e.returnRef:"",a=t&&typeof(e==null?void 0:e.orderRef)=="string"&&((d=e==null?void 0:e.orderRef)==null?void 0:d.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){n.emit("order/data",{...s,returnNumber:r});return}if(!t)return;const o=a?await x(t,r):await k({orderId:t,returnRef:r,queryType:B});o?n.emit("order/data",{...o,returnNumber:r}):n.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},g=new $({init:async e=>{const t={};g.config.setConfig({...t,...e}),P(e).catch(console.error)},listeners:()=>[]}),Z=g.config,E={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},M={PLACE_ORDER:"place-order"};function I(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function T(e,t){const r=I();r.push({[e]:null}),r.push({[e]:t})}function F(e,t){I().push(a=>{const s=a.getState?a.getState():{};a.push({event:e,eventInfo:{...s,...t}})})}function U(e,t){const r=L(t),a=v(e,t);T(E.ORDER_CONTEXT,{...r}),T(E.SHOPPING_CART_CONTEXT,{...a}),F(M.PLACE_ORDER)}const q=` +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 { @@ -248,11 +37,11 @@ ${C} product_sku product_name order_item { - ...OrderItemDetails + ...ORDER_ITEM_DETAILS_FRAGMENT ... on GiftCardOrderItem { - ...GiftCardDetails + ...GIFT_CARD_DETAILS_FRAGMENT product { - ...ProductDetails + ...PRODUCT_DETAILS_FRAGMENT } } } @@ -263,20 +52,20 @@ ${C} type } shipping_address { - ...AddressesList + ...ADDRESS_FRAGMENT } billing_address { - ...AddressesList + ...ADDRESS_FRAGMENT } items { - ...OrderItemDetails + ...ORDER_ITEM_DETAILS_FRAGMENT ... on BundleOrderItem { - ...BundleOrderItemDetails + ...BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT } ... on GiftCardOrderItem { - ...GiftCardDetails + ...GIFT_CARD_DETAILS_FRAGMENT product { - ...ProductDetails + ...PRODUCT_DETAILS_FRAGMENT } } ... on DownloadableOrderItem { @@ -288,16 +77,16 @@ ${C} } } total { - ...OrderSummary + ...ORDER_SUMMARY_FRAGMENT } } } } - ${u} - ${m} - ${p} - ${c} - ${_} - ${O} + ${R} + ${A} ${D} -`,ee=async e=>{if(!e)throw new Error("No cart ID found");return i(q,{variables:{cartId:e}}).then(t=>{var a;(a=t.errors)!=null&&a.length&&y(t.errors);const r=S(t);return r&&(n.emit("order/placed",r),n.emit("cart/reset",void 0),U(e,r)),r}).catch(l)};export{ae as cancelOrder,Z as config,i as fetchGraphQl,pe as getAttributesForm,_e as getAttributesList,de as getConfig,he as getCustomer,Ee as getCustomerOrdersReturn,Re as getGuestOrder,k as getOrderDetailsById,ye as getStoreConfig,x as guestOrderByToken,g as initialize,ee as placeOrder,ne as removeFetchGraphQlHeader,ge as reorderItems,se as requestGuestOrderCancel,Oe as requestReturn,ie as setEndpoint,le as setFetchGraphQlHeader,ue as setFetchGraphQlHeaders}; + ${g} + ${O} + ${h} + ${C} +`,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/getAttributesForm/graphql/getAttributesForm.graphql.d.ts b/scripts/__dropins__/storefront-order/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts index e210426503..de5037a870 100644 --- a/scripts/__dropins__/storefront-order/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts +++ b/scripts/__dropins__/storefront-order/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts @@ -1,3 +1,3 @@ export declare const GET_ATTRIBUTES_FORM = "\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n"; -export declare const GET_ATTRIBUTES_FORM_SHORT = "\n query GET_ATTRIBUTES_FORM_SHORT {\n attributesForm(formCode: \"customer_register_address\") {\n items {\n frontend_input\n label\n code\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n }\n }\n }\n }\n"; +export declare const GET_ATTRIBUTES_FORM_SHORT = "\n query GET_ATTRIBUTES_FORM_SHORT {\n attributesForm(formCode: \"customer_register_address\") {\n items {\n frontend_input\n label\n code\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n }\n }\n }\n }\n"; //# sourceMappingURL=getAttributesForm.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/getCustomer/graphql/getCustomer.graphql.d.ts b/scripts/__dropins__/storefront-order/api/getCustomer/graphql/getCustomer.graphql.d.ts index ba5cc6e262..c7eb0fa664 100644 --- a/scripts/__dropins__/storefront-order/api/getCustomer/graphql/getCustomer.graphql.d.ts +++ b/scripts/__dropins__/storefront-order/api/getCustomer/graphql/getCustomer.graphql.d.ts @@ -1,2 +1,2 @@ -export declare const GET_CUSTOMER = "\n query GET_CUSTOMER {\n customer {\n firstname\n lastname\n email\n }\n }\n"; +export declare const GET_CUSTOMER = "\n query GET_CUSTOMER {\n customer {\n firstname\n lastname\n email\n }\n }\n"; //# sourceMappingURL=getCustomer.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/getCustomerOrdersReturn/getCustomerOrdersReturn.d.ts b/scripts/__dropins__/storefront-order/api/getCustomerOrdersReturn/getCustomerOrdersReturn.d.ts index 7c1c1f422a..3aae328671 100644 --- a/scripts/__dropins__/storefront-order/api/getCustomerOrdersReturn/getCustomerOrdersReturn.d.ts +++ b/scripts/__dropins__/storefront-order/api/getCustomerOrdersReturn/getCustomerOrdersReturn.d.ts @@ -1,4 +1,4 @@ import { CustomerOrdersReturnModel } from '../../data/models'; -export declare const getCustomerOrdersReturn: (pageSize?: number) => Promise; +export declare const getCustomerOrdersReturn: (pageSize?: number, currentPage?: number) => Promise; //# sourceMappingURL=getCustomerOrdersReturn.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/getGuestOrder/graphql/getGuestOrder.graphql.d.ts b/scripts/__dropins__/storefront-order/api/getGuestOrder/graphql/getGuestOrder.graphql.d.ts index 767e397160..0970dc5aff 100644 --- a/scripts/__dropins__/storefront-order/api/getGuestOrder/graphql/getGuestOrder.graphql.d.ts +++ b/scripts/__dropins__/storefront-order/api/getGuestOrder/graphql/getGuestOrder.graphql.d.ts @@ -1,3 +1,2 @@ -export declare const GUEST_ORDER_FRAGMENT: string; export declare const GET_GUEST_ORDER: string; //# sourceMappingURL=getGuestOrder.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/customerAddressFragment.graphql.d.ts b/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/customerAddressFragment.graphql.d.ts deleted file mode 100644 index fe3f1ab4c0..0000000000 --- a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/customerAddressFragment.graphql.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const ADDRESS = "\nfragment AddressesList on OrderAddress {\n city\n company\n country_code\n fax\n firstname\n lastname\n middlename\n postcode\n prefix\n region\n region_id\n street\n suffix\n telephone\n vat_id\n}"; -//# sourceMappingURL=customerAddressFragment.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/index.d.ts b/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/index.d.ts deleted file mode 100644 index ffe4a7baff..0000000000 --- a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './orderSummaryFragment.graphql'; -export * from './orderByNumber.graphql'; -export * from './customerAddressFragment.graphql'; -export * from './orderItemsFragment.graphql'; -export * from './returnsFragment.graphql'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts b/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts deleted file mode 100644 index f77179d486..0000000000 --- a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare const PRODUCT_DETAILS_FRAGMENT = "\n fragment ProductDetails on ProductInterface {\n __typename\n canonical_url\n url_key\n uid\n name\n sku\n only_x_left_in_stock\n stock_status\n thumbnail {\n label\n url\n }\n price_range {\n maximum_price {\n regular_price {\n currency\n value\n }\n }\n }\n }\n"; -export declare const PRICE_DETAILS_FRAGMENT = "\n fragment PriceDetails on OrderItemInterface {\n prices {\n price_including_tax {\n value\n currency\n }\n original_price {\n value\n currency\n }\n original_price_including_tax {\n value\n currency\n }\n price {\n value\n currency\n }\n }\n }\n"; -export declare const GIFT_CARD_DETAILS_FRAGMENT = "\n fragment GiftCardDetails on GiftCardOrderItem {\n ...PriceDetails\n gift_message {\n message\n }\n gift_card {\n recipient_name\n recipient_email\n sender_name\n sender_email\n message\n }\n }\n"; -export declare const ORDER_ITEM_DETAILS_FRAGMENT = "\n fragment OrderItemDetails on OrderItemInterface {\n __typename\n status\n product_sku\n eligible_for_return\n product_name\n product_url_key\n id\n quantity_ordered\n quantity_shipped\n quantity_canceled\n quantity_invoiced\n quantity_refunded\n quantity_return_requested\n product_sale_price {\n value\n currency\n }\n selected_options {\n label\n value\n }\n product {\n ...ProductDetails\n }\n ...PriceDetails\n }\n"; -export declare const BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT = "\n fragment BundleOrderItemDetails on BundleOrderItem {\n ...PriceDetails\n bundle_options {\n uid\n label\n values {\n uid\n product_name\n }\n }\n }\n"; -//# sourceMappingURL=orderItemsFragment.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/orderSummaryFragment.graphql.d.ts b/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/orderSummaryFragment.graphql.d.ts deleted file mode 100644 index 2771a8ebdf..0000000000 --- a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/orderSummaryFragment.graphql.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const ORDER_SUMMARY = "\nfragment OrderSummary 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}"; -//# sourceMappingURL=orderSummaryFragment.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/returnsFragment.graphql.d.ts b/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/returnsFragment.graphql.d.ts deleted file mode 100644 index 32e34d1e89..0000000000 --- a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/returnsFragment.graphql.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const RETURNS_FRAGMENT = "\n fragment OrderReturns on Returns {\n __typename\n items {\n number\n status\n created_at\n shipping {\n tracking {\n status {\n text\n type\n }\n carrier {\n uid\n label\n }\n tracking_number\n }\n }\n order {\n number\n token\n }\n items {\n uid\n quantity\n status\n request_quantity\n order_item {\n ...OrderItemDetails\n ... on GiftCardOrderItem {\n ...GiftCardDetails\n product {\n ...ProductDetails\n }\n }\n }\n }\n }\n }\n"; -//# sourceMappingURL=returnsFragment.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/getStoreConfig/graphql/StoreConfigQuery.d.ts b/scripts/__dropins__/storefront-order/api/getStoreConfig/graphql/StoreConfigQuery.d.ts index db98e3117d..4ffb839df6 100644 --- a/scripts/__dropins__/storefront-order/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +++ b/scripts/__dropins__/storefront-order/api/getStoreConfig/graphql/StoreConfigQuery.d.ts @@ -1,2 +1,2 @@ -export declare const STORE_CONFIG_QUERY = "\nquery STORE_CONFIG_QUERY {\n storeConfig {\n order_cancellation_enabled\n order_cancellation_reasons {\n description\n }\n base_media_url\n orders_invoices_credit_memos_display_price\n orders_invoices_credit_memos_display_shipping_amount\n orders_invoices_credit_memos_display_subtotal\n orders_invoices_credit_memos_display_grandtotal\n orders_invoices_credit_memos_display_full_summary\n orders_invoices_credit_memos_display_zero_tax\n }\n}\n"; +export declare const STORE_CONFIG_QUERY = "\n query STORE_CONFIG_QUERY {\n storeConfig {\n order_cancellation_enabled\n order_cancellation_reasons {\n description\n }\n base_media_url\n orders_invoices_credit_memos_display_price\n orders_invoices_credit_memos_display_shipping_amount\n orders_invoices_credit_memos_display_subtotal\n orders_invoices_credit_memos_display_grandtotal\n orders_invoices_credit_memos_display_full_summary\n orders_invoices_credit_memos_display_zero_tax\n }\n }\n"; //# sourceMappingURL=StoreConfigQuery.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/graphql/RequestReturnOrderFragment.graphql.d.ts b/scripts/__dropins__/storefront-order/api/graphql/RequestReturnOrderFragment.graphql.d.ts index cd8afabdbd..3266d431f6 100644 --- a/scripts/__dropins__/storefront-order/api/graphql/RequestReturnOrderFragment.graphql.d.ts +++ b/scripts/__dropins__/storefront-order/api/graphql/RequestReturnOrderFragment.graphql.d.ts @@ -1,2 +1,2 @@ -export declare const REQUEST_RETURN_ORDER_FRAGMENT = "\n fragment OrderReturn on Return {\n __typename\n uid\n status\n number\n created_at\n }\n"; +export declare const REQUEST_RETURN_ORDER_FRAGMENT = "\n fragment REQUEST_RETURN_ORDER_FRAGMENT on Return {\n __typename\n uid\n status\n number\n created_at\n }\n"; //# sourceMappingURL=RequestReturnOrderFragment.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/graphql/customerAddressFragment.graphql.d.ts b/scripts/__dropins__/storefront-order/api/graphql/customerAddressFragment.graphql.d.ts index 73f121173c..33dd3d63a5 100644 --- a/scripts/__dropins__/storefront-order/api/graphql/customerAddressFragment.graphql.d.ts +++ b/scripts/__dropins__/storefront-order/api/graphql/customerAddressFragment.graphql.d.ts @@ -1,2 +1,2 @@ -export declare const ADDRESS_FRAGMENT = "\n fragment AddressesList on OrderAddress {\n city\n company\n country_code\n fax\n firstname\n lastname\n middlename\n postcode\n prefix\n region\n region_id\n street\n suffix\n telephone\n vat_id\n }\n"; +export declare const ADDRESS_FRAGMENT = "\n fragment ADDRESS_FRAGMENT on OrderAddress {\n city\n company\n country_code\n fax\n firstname\n lastname\n middlename\n postcode\n prefix\n region\n region_id\n street\n suffix\n telephone\n vat_id\n }\n"; //# sourceMappingURL=CustomerAddressFragment.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/graphql/orderItemsFragment.graphql.d.ts b/scripts/__dropins__/storefront-order/api/graphql/orderItemsFragment.graphql.d.ts index 2d3843cc5f..46518c21b1 100644 --- a/scripts/__dropins__/storefront-order/api/graphql/orderItemsFragment.graphql.d.ts +++ b/scripts/__dropins__/storefront-order/api/graphql/orderItemsFragment.graphql.d.ts @@ -1,6 +1,6 @@ -export declare const PRODUCT_DETAILS_FRAGMENT = "\n fragment ProductDetails on ProductInterface {\n __typename\n canonical_url\n url_key\n uid\n name\n sku\n only_x_left_in_stock\n stock_status\n thumbnail {\n label\n url\n }\n price_range {\n maximum_price {\n regular_price {\n currency\n value\n }\n }\n }\n }\n"; -export declare const PRICE_DETAILS_FRAGMENT = "\n fragment PriceDetails on OrderItemInterface {\n prices {\n price_including_tax {\n value\n currency\n }\n original_price {\n value\n currency\n }\n original_price_including_tax {\n value\n currency\n }\n price {\n value\n currency\n }\n }\n }\n"; -export declare const GIFT_CARD_DETAILS_FRAGMENT = "\n fragment GiftCardDetails on GiftCardOrderItem {\n ...PriceDetails\n gift_message {\n message\n }\n gift_card {\n recipient_name\n recipient_email\n sender_name\n sender_email\n message\n }\n }\n"; -export declare const ORDER_ITEM_DETAILS_FRAGMENT = "\n fragment OrderItemDetails on OrderItemInterface {\n __typename\n status\n product_sku\n eligible_for_return\n product_name\n product_url_key\n id\n quantity_ordered\n quantity_shipped\n quantity_canceled\n quantity_invoiced\n quantity_refunded\n quantity_return_requested\n product_sale_price {\n value\n currency\n }\n selected_options {\n label\n value\n }\n product {\n ...ProductDetails\n }\n ...PriceDetails\n }\n"; -export declare const BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT = "\n fragment BundleOrderItemDetails on BundleOrderItem {\n ...PriceDetails\n bundle_options {\n uid\n label\n values {\n uid\n product_name\n }\n }\n }\n"; +export declare const PRODUCT_DETAILS_FRAGMENT = "\n fragment PRODUCT_DETAILS_FRAGMENT on ProductInterface {\n __typename\n canonical_url\n url_key\n uid\n name\n sku\n only_x_left_in_stock\n stock_status\n thumbnail {\n label\n url\n }\n price_range {\n maximum_price {\n regular_price {\n currency\n value\n }\n }\n }\n }\n"; +export declare const PRICE_DETAILS_FRAGMENT = "\n fragment PRICE_DETAILS_FRAGMENT on OrderItemInterface {\n prices {\n price_including_tax {\n value\n currency\n }\n original_price {\n value\n currency\n }\n original_price_including_tax {\n value\n currency\n }\n price {\n value\n currency\n }\n }\n }\n"; +export declare const GIFT_CARD_DETAILS_FRAGMENT = "\n fragment GIFT_CARD_DETAILS_FRAGMENT on GiftCardOrderItem {\n ...PRICE_DETAILS_FRAGMENT\n gift_message {\n message\n }\n gift_card {\n recipient_name\n recipient_email\n sender_name\n sender_email\n message\n }\n }\n"; +export declare const ORDER_ITEM_DETAILS_FRAGMENT = "\n fragment ORDER_ITEM_DETAILS_FRAGMENT on OrderItemInterface {\n __typename\n status\n product_sku\n eligible_for_return\n product_name\n product_url_key\n id\n quantity_ordered\n quantity_shipped\n quantity_canceled\n quantity_invoiced\n quantity_refunded\n quantity_return_requested\n product_sale_price {\n value\n currency\n }\n selected_options {\n label\n value\n }\n product {\n ...PRODUCT_DETAILS_FRAGMENT\n }\n ...PRICE_DETAILS_FRAGMENT\n }\n"; +export declare const BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT = "\n fragment BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT on BundleOrderItem {\n ...PRICE_DETAILS_FRAGMENT\n bundle_options {\n uid\n label\n values {\n uid\n product_name\n }\n }\n }\n"; //# sourceMappingURL=OrderItemsFragment.graphql.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 fad6b8ff21..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 OrderSummary 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/graphql/returnsFragment.graphql.d.ts b/scripts/__dropins__/storefront-order/api/graphql/returnsFragment.graphql.d.ts index d1ff42e7b8..02bf061131 100644 --- a/scripts/__dropins__/storefront-order/api/graphql/returnsFragment.graphql.d.ts +++ b/scripts/__dropins__/storefront-order/api/graphql/returnsFragment.graphql.d.ts @@ -1,2 +1,2 @@ -export declare const RETURNS_FRAGMENT = "\n fragment OrderReturns on Returns {\n __typename\n items {\n number\n status\n created_at\n shipping {\n tracking {\n status {\n text\n type\n }\n carrier {\n uid\n label\n }\n tracking_number\n }\n }\n order {\n number\n token\n }\n items {\n uid\n quantity\n status\n request_quantity\n order_item {\n ...OrderItemDetails\n ... on GiftCardOrderItem {\n ...GiftCardDetails\n product {\n ...ProductDetails\n }\n }\n }\n }\n }\n }\n"; +export declare const RETURNS_FRAGMENT = "\n fragment RETURNS_FRAGMENT on Returns {\n __typename\n items {\n number\n status\n created_at\n shipping {\n tracking {\n status {\n text\n type\n }\n carrier {\n uid\n label\n }\n tracking_number\n }\n }\n order {\n number\n token\n }\n items {\n uid\n quantity\n status\n request_quantity\n order_item {\n ...ORDER_ITEM_DETAILS_FRAGMENT\n ... on GiftCardOrderItem {\n ...GIFT_CARD_DETAILS_FRAGMENT\n product {\n ...PRODUCT_DETAILS_FRAGMENT\n }\n }\n }\n }\n }\n }\n"; //# sourceMappingURL=ReturnsFragment.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/initialize/initialize.d.ts b/scripts/__dropins__/storefront-order/api/initialize/initialize.d.ts index fc29428e5f..c5ac724da0 100644 --- a/scripts/__dropins__/storefront-order/api/initialize/initialize.d.ts +++ b/scripts/__dropins__/storefront-order/api/initialize/initialize.d.ts @@ -1,8 +1,14 @@ -import { Initializer } from '@dropins/tools/types/elsie/src/lib'; +import { Initializer, Model } from '@dropins/tools/types/elsie/src/lib'; import { Lang } from '@dropins/tools/types/elsie/src/i18n'; +import { CustomerOrdersReturnModel, OrderDataModel, RequestReturnModel } from '../../data/models'; type ConfigProps = { langDefinitions?: Lang; + models?: { + OrderDataModel?: Model; + CustomerOrdersReturnModel?: Model; + RequestReturnModel?: Model; + }; }; export declare const initialize: Initializer; export declare const config: import('@dropins/tools/types/elsie/src/lib').Config; diff --git a/scripts/__dropins__/storefront-order/api/reorderItems/graphql/reorderItems.graphql.d.ts b/scripts/__dropins__/storefront-order/api/reorderItems/graphql/reorderItems.graphql.d.ts index d1743c1dca..b99af32348 100644 --- a/scripts/__dropins__/storefront-order/api/reorderItems/graphql/reorderItems.graphql.d.ts +++ b/scripts/__dropins__/storefront-order/api/reorderItems/graphql/reorderItems.graphql.d.ts @@ -1,2 +1,2 @@ -export declare const REORDER_ITEMS_MUTATION = "\nmutation REORDER_ITEMS_MUTATION($orderNumber: String!) {\n reorderItems(orderNumber: $orderNumber) {\n cart {\n itemsV2 {\n items {\n uid\n }\n }\n }\n userInputErrors{\n code\n message\n path\n }\n }\n}\n"; +export declare const REORDER_ITEMS_MUTATION = "\n mutation REORDER_ITEMS_MUTATION($orderNumber: String!) {\n reorderItems(orderNumber: $orderNumber) {\n cart {\n itemsV2 {\n items {\n uid\n }\n }\n }\n userInputErrors {\n code\n message\n path\n }\n }\n }\n"; //# sourceMappingURL=reorderItems.graphql.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/api/requestReturn/graphql/fragments.d.ts b/scripts/__dropins__/storefront-order/api/requestReturn/graphql/fragments.d.ts deleted file mode 100644 index 1a06f4fcf8..0000000000 --- a/scripts/__dropins__/storefront-order/api/requestReturn/graphql/fragments.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare const REQUEST_RETURN_ORDER_FRAGMENT = "\n fragment OrderReturn on Return {\n __typename\n uid\n status\n number\n created_at\n }\n"; -//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/requestReturn/requestReturn.d.ts b/scripts/__dropins__/storefront-order/api/requestReturn/requestReturn.d.ts index 8f385843e8..1d09d04e35 100644 --- a/scripts/__dropins__/storefront-order/api/requestReturn/requestReturn.d.ts +++ b/scripts/__dropins__/storefront-order/api/requestReturn/requestReturn.d.ts @@ -1,9 +1,5 @@ import { RequestReturnProps } from '../../types'; +import { RequestReturnModel } from '../../data/models'; -export declare const requestReturn: (form: RequestReturnProps) => Promise<{ - uid: string; - number: string; - status: string; - createdAt: string; -}>; +export declare const requestReturn: (form: RequestReturnProps) => Promise; //# sourceMappingURL=requestReturn.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/chunks/GurestOrderFragment.graphql.js b/scripts/__dropins__/storefront-order/chunks/GurestOrderFragment.graphql.js index 79ef9c704f..b3f1d975cb 100644 --- a/scripts/__dropins__/storefront-order/chunks/GurestOrderFragment.graphql.js +++ b/scripts/__dropins__/storefront-order/chunks/GurestOrderFragment.graphql.js @@ -1,7 +1,7 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{P as e,b as t,G as r,O as a,B as d,d as s,A as i,R as _}from"./initialize.js";const n=` - fragment guestOrderData on CustomerOrder { +import{P as _,a as e,G as E,O as R,B as t,b as r,A as T,R as a}from"./initialize.js";const d=` + fragment GUEST_ORDER_FRAGMENT on CustomerOrder { email id number @@ -16,10 +16,10 @@ import{P as e,b as t,G as r,O as a,B as d,d as s,A as i,R as _}from"./initialize available_actions is_virtual items_eligible_for_return { - ...OrderItemDetails + ...ORDER_ITEM_DETAILS_FRAGMENT } returns { - ...OrderReturns + ...RETURNS_FRAGMENT } payment_methods { name @@ -45,11 +45,11 @@ import{P as e,b as t,G as r,O as a,B as d,d as s,A as i,R as _}from"./initialize product_sku product_name order_item { - ...OrderItemDetails + ...ORDER_ITEM_DETAILS_FRAGMENT ... on GiftCardOrderItem { - ...GiftCardDetails + ...GIFT_CARD_DETAILS_FRAGMENT product { - ...ProductDetails + ...PRODUCT_DETAILS_FRAGMENT } } } @@ -60,20 +60,20 @@ import{P as e,b as t,G as r,O as a,B as d,d as s,A as i,R as _}from"./initialize type } shipping_address { - ...AddressesList + ...ADDRESS_FRAGMENT } billing_address { - ...AddressesList + ...ADDRESS_FRAGMENT } items { - ...OrderItemDetails + ...ORDER_ITEM_DETAILS_FRAGMENT ... on BundleOrderItem { - ...BundleOrderItemDetails + ...BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT } ... on GiftCardOrderItem { - ...GiftCardDetails + ...GIFT_CARD_DETAILS_FRAGMENT product { - ...ProductDetails + ...PRODUCT_DETAILS_FRAGMENT } } ... on DownloadableOrderItem { @@ -85,15 +85,15 @@ import{P as e,b as t,G as r,O as a,B as d,d as s,A as i,R as _}from"./initialize } } total { - ...OrderSummary + ...ORDER_SUMMARY_FRAGMENT } } + ${_} ${e} + ${E} + ${R} ${t} ${r} + ${T} ${a} - ${d} - ${s} - ${i} - ${_} -`;export{n as G}; +`;export{d as G}; diff --git a/scripts/__dropins__/storefront-order/chunks/OrderCancel.js b/scripts/__dropins__/storefront-order/chunks/OrderCancel.js deleted file mode 100644 index 3d86843b29..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/OrderCancel.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{jsx as h,Fragment as v,jsxs as M}from"@dropins/tools/preact-jsx-runtime.js";import{useRef as _,useState as D,useEffect as w,useCallback as T}from"@dropins/tools/preact-hooks.js";import{useText as y}from"@dropins/tools/i18n.js";import*as C from"@dropins/tools/preact-compat.js";import{memo as V,useCallback as L}from"@dropins/tools/preact-compat.js";import{classes as k}from"@dropins/tools/lib.js";import{Field as q,Picker as A,Input as I,InputDate as R,Checkbox as O,TextArea as N}from"@dropins/tools/components.js";const j=l=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...l},C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.8052 14.4968C10.8552 14.4968 9.9752 14.0268 9.4452 13.2368L9.4152 13.1868L9.3852 13.1268C8.1352 11.2268 7.5352 8.96681 7.6852 6.68681C7.7552 4.42681 9.6052 2.61681 11.8652 2.60681H12.0052C14.2752 2.47681 16.2152 4.21681 16.3452 6.47681C16.3452 6.55681 16.3452 6.62681 16.3452 6.70681C16.4852 8.94681 15.9052 11.1768 14.6852 13.0568L14.6052 13.1768C14.0552 13.9868 13.1352 14.4668 12.1652 14.4768H12.0052C11.9352 14.4768 11.8652 14.4868 11.7952 14.4868L11.8052 14.4968Z",stroke:"currentColor"}),C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M4.3252 21.5469C4.3552 20.4169 4.4752 19.2869 4.6752 18.1769C4.8952 17.1669 6.4752 16.0269 8.9052 15.1569C9.2352 15.0369 9.4852 14.7869 9.5952 14.4569L9.8052 14.0269",stroke:"currentColor"}),C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M14.425 14.4069L14.165 14.1569C14.375 14.5969 14.725 14.9569 15.155 15.1869C16.945 15.7969 19.125 16.9569 19.375 18.2069C19.585 19.3069 19.685 20.4269 19.675 21.5369",stroke:"currentColor"})),H=l=>l.reduce((u,{code:i,required:$,defaultValue:s})=>($&&(u[i]=s),u),{}),S=({fieldsConfig:l,onSubmit:u})=>{const{requiredFieldError:i}=y({requiredFieldError:"Order.Form.notifications.requiredFieldError"}),$=_(null),[s,n]=D({}),[o,t]=D({});w(()=>{if(n({}),!l||!l.length)return;const c=H(l);n(c)},[l==null?void 0:l.length]),w(()=>()=>{var c;n({}),(c=$.current)==null||c.reset()},[]);const p=T((c,e)=>{const r=l.find(d=>d.code===c);return r!=null&&r.required&&!e?i:""},[l,i]),b=T(c=>{const{name:e,value:r,type:a,checked:d}=c==null?void 0:c.target,f=a==="checkbox"?d:r;n(E=>({...E,[e]:f}))},[]),x=T(c=>{const{name:e,value:r,type:a,checked:d}=c==null?void 0:c.target,f=a==="checkbox"?d:r;t(E=>({...E,[e]:p(e,f)}))},[p]),F=T(c=>{c.preventDefault();let e=!0,r={},a=null;for(const[d,f]of Object.entries(s)){const E=p(d,f);E&&(r[d]=E,e=!1,a||(a=d))}if(t(r),a&&$.current){const d=$.current.elements.namedItem(a);d==null||d.focus()}u==null||u(c,e)},[s,p,u]);return{formData:s,errors:o,formRef:$,handleChange:b,handleBlur:x,handleSubmit:F}},U=V(({loading:l,values:u,fields:i=[],errors:$,className:s="",onChange:n,onBlur:o})=>{const t=`${s}__item`,p=L((e,r,a)=>{const d=e.options.map(f=>({text:f.label,value:f.value}));return h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:l,children:h(A,{name:e.id,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:d,onBlur:o,handleSelect:n,value:r||e.defaultValue})},e.id)},[s,l,t,o,n]),b=L((e,r,a)=>{const d=e.id==="email",f=d?h(j,{}):void 0,E=d?"username":"";return h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e==null?void 0:e.is_hidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:l,children:h(I,{"aria-label":e.label,"aria-required":e.required,autoComplete:E,icon:f,type:"text",name:e.id,value:r||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:o,onChange:n})},e.id)},[s,l,t,o,n]),x=L((e,r,a)=>h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:l,children:h(R,{type:"text",name:e.id,value:r||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:o,onChange:n})},e.id),[s,l,t,o,n]),F=L((e,r,a)=>h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:l,children:h(O,{name:e.id,checked:r||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:o,onChange:n})},e.id),[s,l,t,o,n]),c=L((e,r,a)=>h(q,{error:a,className:k([t,`${t}--${e.id}`,[`${t}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${s}--${e.id}`,disabled:l,children:h(N,{type:"text",name:e.id,value:r===void 0?e.defaultValue:r,label:`${e.label} ${e.required?"*":""}`,onBlur:o,onChange:n})},e.id),[s,l,t,o,n]);return i.length?h(v,{children:i.map(e=>{var d;const r=($==null?void 0:$[e.id])??"",a=(u==null?void 0:u[e.id])??"";switch(e.fieldType){case"TEXT":return(d=e==null?void 0:e.options)!=null&&d.length?p(e,a,r):b(e,a,r);case"MULTILINE":return b(e,a,r);case"SELECT":return p(e,a,r);case"DATE":return x(e,a,r);case"BOOLEAN":return F(e,a,r);case"TEXTAREA":return c(e,a,r);default:return null}})}):null}),K=V(({name:l,loading:u,children:i,className:$="defaultForm",fieldsConfig:s,onSubmit:n})=>{const{formData:o,errors:t,formRef:p,handleChange:b,handleBlur:x,handleSubmit:F}=S({fieldsConfig:s,onSubmit:n});return M("form",{className:k(["order-form",$]),onSubmit:F,name:l,ref:p,children:[h(U,{className:$,loading:u,fields:s,onChange:b,onBlur:x,errors:t,values:o}),i]})});export{K as F,U as a,S as u}; diff --git a/scripts/__dropins__/storefront-order/chunks/OrderItemsFragment.graphql.js b/scripts/__dropins__/storefront-order/chunks/OrderItemsFragment.graphql.js deleted file mode 100644 index d335aa4b83..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/OrderItemsFragment.graphql.js +++ /dev/null @@ -1,101 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -const e=` - fragment ProductDetails on ProductInterface { - __typename - canonical_url - url_key - uid - name - sku - only_x_left_in_stock - stock_status - thumbnail { - label - url - } - price_range { - maximum_price { - regular_price { - currency - value - } - } - } - } -`,r=` - fragment PriceDetails on OrderItemInterface { - prices { - price_including_tax { - value - currency - } - original_price { - value - currency - } - original_price_including_tax { - value - currency - } - price { - value - currency - } - } - } -`,t=` - fragment GiftCardDetails on GiftCardOrderItem { - ...PriceDetails - gift_message { - message - } - gift_card { - recipient_name - recipient_email - sender_name - sender_email - message - } - } -`,a=` - fragment OrderItemDetails on OrderItemInterface { - __typename - status - product_sku - eligible_for_return - product_name - product_url_key - id - quantity_ordered - quantity_shipped - quantity_canceled - quantity_invoiced - quantity_refunded - quantity_return_requested - product_sale_price { - value - currency - } - selected_options { - label - value - } - product { - ...ProductDetails - } - ...PriceDetails - } -`,n=` - fragment BundleOrderItemDetails on BundleOrderItem { - ...PriceDetails - bundle_options { - uid - label - values { - uid - product_name - } - } - } -`;export{n as B,t as G,a as O,e as P,r as a}; 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/WarningWithCircle.js b/scripts/__dropins__/storefront-order/chunks/WarningWithCircle.js deleted file mode 100644 index 5d04461464..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/WarningWithCircle.js +++ /dev/null @@ -1 +0,0 @@ -import*as e from"@dropins/tools/preact-compat.js";const r=t=>e.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e.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"}),e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"}));export{r as S}; 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/convertCase.js b/scripts/__dropins__/storefront-order/chunks/convertCase.js deleted file mode 100644 index 9edffe763d..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/convertCase.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -const l=r=>r.replace(/_([a-z])/g,(n,s)=>s.toUpperCase()),C=r=>r.replace(/([A-Z])/g,n=>`_${n.toLowerCase()}`),u=(r,n,s)=>{const c=["string","boolean","number"],p=n==="camelCase"?l:C;return Array.isArray(r)?r.map(e=>c.includes(typeof e)||e===null?e:typeof e=="object"?u(e,n,s):e):r!==null&&typeof r=="object"?Object.entries(r).reduce((e,[t,o])=>{const f=s&&s[t]?s[t]:p(t);return e[f]=c.includes(typeof o)||o===null?o:u(o,n,s),e},{}):r};export{u as a,l as c}; diff --git a/scripts/__dropins__/storefront-order/chunks/form.types.js b/scripts/__dropins__/storefront-order/chunks/form.types.js deleted file mode 100644 index 3525528924..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/form.types.js +++ /dev/null @@ -1 +0,0 @@ -var I=(E=>(E.BOOLEAN="BOOLEAN",E.DATE="DATE",E.DATETIME="DATETIME",E.DROPDOWN="DROPDOWN",E.FILE="FILE",E.GALLERY="GALLERY",E.HIDDEN="HIDDEN",E.IMAGE="IMAGE",E.MEDIA_IMAGE="MEDIA_IMAGE",E.MULTILINE="MULTILINE",E.MULTISELECT="MULTISELECT",E.PRICE="PRICE",E.SELECT="SELECT",E.TEXT="TEXT",E.TEXTAREA="TEXTAREA",E.UNDEFINED="UNDEFINED",E.VISUAL="VISUAL",E.WEIGHT="WEIGHT",E.EMPTY="",E))(I||{});export{I as F}; diff --git a/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js b/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js index 4798180f90..0600701db6 100644 --- a/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js +++ b/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js @@ -34,7 +34,7 @@ import{h as i}from"./network-error.js";import{f as u,h as s}from"./fetch-graphql } `,_=` query GET_ATTRIBUTES_FORM_SHORT { - attributesForm(formCode: "customer_register_address") { + attributesForm(formCode: "customer_register_address") { items { frontend_input label diff --git a/scripts/__dropins__/storefront-order/chunks/getCustomer.js b/scripts/__dropins__/storefront-order/chunks/getCustomer.js deleted file mode 100644 index b6bcf17289..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/getCustomer.js +++ /dev/null @@ -1,11 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{h}from"./network-error.js";import{f,h as i}from"./fetch-graphql.js";import{a as O}from"./getGuestOrder.graphql.js";import{b as l}from"./transform-order-details.js";const T=(t,a)=>{var u,c;if(!((u=t==null?void 0:t.data)!=null&&u.guestOrder))return null;const r=(c=t==null?void 0:t.data)==null?void 0:c.guestOrder;return l(r,a)},k=(t,a)=>{var u,c;if(!((u=t==null?void 0:t.data)!=null&&u.guestOrderByToken))return null;const r=(c=t==null?void 0:t.data)==null?void 0:c.guestOrderByToken;return l(r,a)},g=t=>{var a,r,u,c,m,d;return{email:((r=(a=t==null?void 0:t.data)==null?void 0:a.customer)==null?void 0:r.email)||"",firstname:((c=(u=t==null?void 0:t.data)==null?void 0:u.customer)==null?void 0:c.firstname)||"",lastname:((d=(m=t==null?void 0:t.data)==null?void 0:m.customer)==null?void 0:d.lastname)||""}},B=async t=>await f(O,{method:"GET",cache:"no-cache",variables:{input:t}}).then(a=>{var r;return(r=a.errors)!=null&&r.length?i(a.errors):T(a)}).catch(h),E=` - query GET_CUSTOMER { - customer { - firstname - lastname - email - } - } -`,C=async()=>await f(E,{method:"GET",cache:"force-cache"}).then(t=>{var a;return(a=t.errors)!=null&&a.length?i(t.errors):g(t)}).catch(h);export{B as a,C as g,k as t}; diff --git a/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js b/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js index e8c7e16995..2d67bd0baf 100644 --- a/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js +++ b/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js @@ -1,21 +1,21 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{h as R}from"./network-error.js";import{f as E,h as _}from"./fetch-graphql.js";import{R as T,P as o,a as s,G as c,O as u,t as h}from"./transform-customer-orders-returns.js";const n=` -query GET_CUSTOMER_ORDERS_RETURN($pageSize: Int) { - customer { - returns(pageSize: $pageSize) { - page_info { - page_size - total_pages - current_page +import{h as R}from"./network-error.js";import{R as E,P as T,a as _,G as c,O as s,t as o}from"./initialize.js";import{f as n}from"./fetch-graphql.js";const u=` + query GET_CUSTOMER_ORDERS_RETURN($currentPage: Int, $pageSize: Int) { + customer { + returns(currentPage: $currentPage, pageSize: $pageSize) { + page_info { + page_size + total_pages + current_page + } + ...RETURNS_FRAGMENT + } } - ...OrderReturns } - } -} -${T} -${o} -${s} -${c} -${u} -`,G=async(e=10)=>await E(n,{method:"GET",cache:"force-cache",variables:{pageSize:e}}).then(r=>{var t,a;return(t=r.errors)!=null&&t.length?_(r.errors):h((a=r==null?void 0:r.data)==null?void 0:a.customer.returns)}).catch(R);export{G as g}; + ${E} + ${T} + ${_} + ${c} + ${s} +`,G=async(e=10,t=1)=>await n(u,{method:"GET",cache:"force-cache",variables:{pageSize:e,currentPage:t}}).then(r=>{var a;return o((a=r==null?void 0:r.data)==null?void 0:a.customer.returns)}).catch(R);export{G as g}; diff --git a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js deleted file mode 100644 index 9648df9f1c..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js +++ /dev/null @@ -1,160 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{P as e,a as t,G as r,O as a,B as s,R as d}from"./transform-customer-orders-returns.js";const n=` -fragment OrderSummary on OrderTotal { - grand_total { - value - currency - } - total_giftcard { - currency - value - } - subtotal { - currency - value - } - taxes { - amount { - currency - value - } - rate - title - } - total_tax { - currency - value - } - total_shipping { - currency - value - } - discounts { - amount { - currency - value - } - label - } -}`,i=` -fragment AddressesList on OrderAddress { - city - company - country_code - fax - firstname - lastname - middlename - postcode - prefix - region - region_id - street - suffix - telephone - vat_id -}`,o=` - fragment guestOrderData on CustomerOrder { - email - id - number - order_date - order_status_change_date - status - token - carrier - shipping_method - printed_card_included - gift_receipt_included - available_actions - is_virtual - items_eligible_for_return { - ...OrderItemDetails - } - returns { - ...OrderReturns - } - payment_methods { - name - type - } - applied_coupons { - code - } - shipments { - id - tracking { - title - number - carrier - } - comments { - message - timestamp - } - items { - __typename - id - product_sku - product_name - order_item { - ...OrderItemDetails - ... on GiftCardOrderItem { - ...GiftCardDetails - product { - ...ProductDetails - } - } - } - } - } - payment_methods { - name - type - } - shipping_address { - ...AddressesList - } - billing_address { - ...AddressesList - } - items { - ...OrderItemDetails - ... on BundleOrderItem { - ...BundleOrderItemDetails - } - ... on GiftCardOrderItem { - ...GiftCardDetails - product { - ...ProductDetails - } - } - ... on DownloadableOrderItem { - product_name - downloadable_links { - sort_order - title - } - } - } - total { - ...OrderSummary - } - } -${e} -${t} -${r} -${a} -${s} -${n} -${i} -${d} -`,u=` - query GET_GUEST_ORDER($input: GuestOrderInformationInput!) { - guestOrder(input:$input) { - ...guestOrderData - } - } -${o} -`;export{i as A,o as G,n as O,u as a}; diff --git a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.js b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.js index 32abb2e0e5..d7d2442923 100644 --- a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.js +++ b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.js @@ -1,11 +1,18 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{h}from"./network-error.js";import{f,h as i}from"./fetch-graphql.js";import{a as O}from"./getGuestOrder.graphql.js";import{b as l}from"./transform-customer-orders-returns.js";const T=t=>{var a,r,u,c,m,d;return{email:((r=(a=t==null?void 0:t.data)==null?void 0:a.customer)==null?void 0:r.email)||"",firstname:((c=(u=t==null?void 0:t.data)==null?void 0:u.customer)==null?void 0:c.firstname)||"",lastname:((d=(m=t==null?void 0:t.data)==null?void 0:m.customer)==null?void 0:d.lastname)||""}},g=(t,a)=>{var u,c;if(!((u=t==null?void 0:t.data)!=null&&u.guestOrder))return null;const r=(c=t==null?void 0:t.data)==null?void 0:c.guestOrder;return l(r,a)},k=(t,a)=>{var u,c;if(!((u=t==null?void 0:t.data)!=null&&u.guestOrderByToken))return null;const r=(c=t==null?void 0:t.data)==null?void 0:c.guestOrderByToken;return l(r,a)},E=` +import{h as E}from"./network-error.js";import{f as i,h}from"./fetch-graphql.js";import{G as n}from"./GurestOrderFragment.graphql.js";import{f as o}from"./initialize.js";const G=t=>{var a,r,m,c,u,e;return{email:((r=(a=t==null?void 0:t.data)==null?void 0:a.customer)==null?void 0:r.email)||"",firstname:((c=(m=t==null?void 0:t.data)==null?void 0:m.customer)==null?void 0:c.firstname)||"",lastname:((e=(u=t==null?void 0:t.data)==null?void 0:u.customer)==null?void 0:e.lastname)||""}},f=` query GET_CUSTOMER { customer { - firstname - lastname - email + firstname + lastname + email } } -`,B=async()=>await f(E,{method:"GET",cache:"force-cache"}).then(t=>{var a;return(a=t.errors)!=null&&a.length?i(t.errors):T(t)}).catch(h),C=async t=>await f(O,{method:"GET",cache:"no-cache",variables:{input:t}}).then(a=>{var r;return(r=a.errors)!=null&&r.length?i(a.errors):g(a)}).catch(h);export{C as a,B as g,k as t}; +`,_=async()=>await i(f,{method:"GET",cache:"force-cache"}).then(t=>{var a;return(a=t.errors)!=null&&a.length?h(t.errors):G(t)}).catch(E),T=` + query GET_GUEST_ORDER($input: GuestOrderInformationInput!) { + guestOrder(input: $input) { + ...GUEST_ORDER_FRAGMENT + } + } + ${n} +`,S=async t=>await i(T,{method:"GET",cache:"no-cache",variables:{input:t}}).then(a=>o(a)).catch(E);export{S as a,_ as g}; 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/getStoreConfig.js b/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js index 8f697f9dc6..a164a243a7 100644 --- a/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js +++ b/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js @@ -1,19 +1,19 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ import{f as s,h as i}from"./fetch-graphql.js";function o(e){return e?{baseMediaUrl:e.base_media_url,orderCancellationEnabled:e.order_cancellation_enabled,orderCancellationReasons:e.order_cancellation_reasons,shoppingCartDisplayPrice:e.orders_invoices_credit_memos_display_price,shoppingOrdersDisplaySubtotal:e.orders_invoices_credit_memos_display_subtotal,shoppingOrdersDisplayShipping:e.orders_invoices_credit_memos_display_shipping_amount,shoppingOrdersDisplayGrandTotal:e.orders_invoices_credit_memos_display_grandtotal,shoppingOrdersDisplayFullSummary:e.orders_invoices_credit_memos_display_full_summary,shoppingOrdersDisplayZeroTax:e.orders_invoices_credit_memos_display_zero_tax}:null}const _=` -query STORE_CONFIG_QUERY { - storeConfig { - order_cancellation_enabled - order_cancellation_reasons { + query STORE_CONFIG_QUERY { + storeConfig { + order_cancellation_enabled + order_cancellation_reasons { description + } + base_media_url + orders_invoices_credit_memos_display_price + orders_invoices_credit_memos_display_shipping_amount + orders_invoices_credit_memos_display_subtotal + orders_invoices_credit_memos_display_grandtotal + orders_invoices_credit_memos_display_full_summary + orders_invoices_credit_memos_display_zero_tax } - base_media_url - orders_invoices_credit_memos_display_price - orders_invoices_credit_memos_display_shipping_amount - orders_invoices_credit_memos_display_subtotal - orders_invoices_credit_memos_display_grandtotal - orders_invoices_credit_memos_display_full_summary - orders_invoices_credit_memos_display_zero_tax } -} `,l=async()=>s(_,{method:"GET",cache:"force-cache"}).then(({errors:e,data:r})=>e?i(e):o(r.storeConfig));export{l as g}; diff --git a/scripts/__dropins__/storefront-order/chunks/initialize.js b/scripts/__dropins__/storefront-order/chunks/initialize.js index 199cadd40b..ed56d3ced3 100644 --- a/scripts/__dropins__/storefront-order/chunks/initialize.js +++ b/scripts/__dropins__/storefront-order/chunks/initialize.js @@ -1,7 +1,7 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as G}from"@dropins/tools/event-bus.js";import{f as Q,h as Y}from"./fetch-graphql.js";import{a as ea,h as K}from"./convertCase.js";const j=` - fragment AddressesList on OrderAddress { +import{merge as z,Initializer as na}from"@dropins/tools/lib.js";import{events as q}from"@dropins/tools/event-bus.js";import{a as ta,h as Y}from"./network-error.js";import{f as Q}from"./fetch-graphql.js";const K=` + fragment ADDRESS_FRAGMENT on OrderAddress { city company country_code @@ -18,8 +18,8 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as telephone vat_id } -`,H=` - fragment ProductDetails on ProductInterface { +`,j=` + fragment PRODUCT_DETAILS_FRAGMENT on ProductInterface { __typename canonical_url url_key @@ -41,8 +41,8 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as } } } -`,J=` - fragment PriceDetails on OrderItemInterface { +`,H=` + fragment PRICE_DETAILS_FRAGMENT on OrderItemInterface { prices { price_including_tax { value @@ -62,9 +62,9 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as } } } -`,V=` - fragment GiftCardDetails on GiftCardOrderItem { - ...PriceDetails +`,J=` + fragment GIFT_CARD_DETAILS_FRAGMENT on GiftCardOrderItem { + ...PRICE_DETAILS_FRAGMENT gift_message { message } @@ -76,8 +76,8 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as message } } -`,W=` - fragment OrderItemDetails on OrderItemInterface { +`,V=` + fragment ORDER_ITEM_DETAILS_FRAGMENT on OrderItemInterface { __typename status product_sku @@ -100,13 +100,13 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as value } product { - ...ProductDetails + ...PRODUCT_DETAILS_FRAGMENT } - ...PriceDetails + ...PRICE_DETAILS_FRAGMENT } -`,X=` - fragment BundleOrderItemDetails on BundleOrderItem { - ...PriceDetails +`,W=` + fragment BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT on BundleOrderItem { + ...PRICE_DETAILS_FRAGMENT bundle_options { uid label @@ -116,8 +116,8 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as } } } -`,Z=` - fragment OrderSummary on OrderTotal { +`,X=` + fragment ORDER_SUMMARY_FRAGMENT on OrderTotal { grand_total { value currency @@ -126,7 +126,11 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as currency value } - subtotal { + subtotal_excl_tax { + currency + value + } + subtotal_incl_tax { currency value } @@ -154,48 +158,48 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as label } } -`,I=` - fragment OrderReturns on Returns { - __typename - items { - number - status - created_at - shipping { - tracking { - status { - text - type - } - carrier { - uid - label +`,Z=` + fragment RETURNS_FRAGMENT on Returns { + __typename + items { + number + status + created_at + shipping { + tracking { + status { + text + type + } + carrier { + uid + label + } + tracking_number } - tracking_number } - } - order { - number - token - } - items { - uid - quantity - status - request_quantity - order_item { - ...OrderItemDetails - ... on GiftCardOrderItem { - ...GiftCardDetails - product { - ...ProductDetails + order { + number + token + } + items { + uid + quantity + status + request_quantity + order_item { + ...ORDER_ITEM_DETAILS_FRAGMENT + ... on GiftCardOrderItem { + ...GIFT_CARD_DETAILS_FRAGMENT + product { + ...PRODUCT_DETAILS_FRAGMENT + } } } } } - } } -`,ia=` +`,_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 } }) { @@ -211,17 +215,17 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as shipping_method is_virtual returns(pageSize: $pageSize) { - ...OrderReturns + ...RETURNS_FRAGMENT } items_eligible_for_return { - ...OrderItemDetails + ...ORDER_ITEM_DETAILS_FRAGMENT ... on BundleOrderItem { - ...BundleOrderItemDetails + ...BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT } ... on GiftCardOrderItem { - ...GiftCardDetails + ...GIFT_CARD_DETAILS_FRAGMENT product { - ...ProductDetails + ...PRODUCT_DETAILS_FRAGMENT } } ... on DownloadableOrderItem { @@ -253,11 +257,11 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as product_name quantity_shipped order_item { - ...OrderItemDetails + ...ORDER_ITEM_DETAILS_FRAGMENT ... on GiftCardOrderItem { - ...GiftCardDetails + ...GIFT_CARD_DETAILS_FRAGMENT product { - ...ProductDetails + ...PRODUCT_DETAILS_FRAGMENT } } } @@ -268,20 +272,20 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as type } shipping_address { - ...AddressesList + ...ADDRESS_FRAGMENT } billing_address { - ...AddressesList + ...ADDRESS_FRAGMENT } items { - ...OrderItemDetails + ...ORDER_ITEM_DETAILS_FRAGMENT ... on BundleOrderItem { - ...BundleOrderItemDetails + ...BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT } ... on GiftCardOrderItem { - ...GiftCardDetails + ...GIFT_CARD_DETAILS_FRAGMENT product { - ...ProductDetails + ...PRODUCT_DETAILS_FRAGMENT } } ... on DownloadableOrderItem { @@ -293,21 +297,21 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as } } total { - ...OrderSummary + ...ORDER_SUMMARY_FRAGMENT } } } } } + ${j} ${H} ${J} ${V} ${W} ${X} + ${K} ${Z} - ${j} - ${I} -`,ua=a=>{var l,s,r,d,p;if(!((l=a==null?void 0:a.items)!=null&&l.length))return null;const t=a==null?void 0:a.items,n=a==null?void 0:a.page_info,i={ordersReturn:[...t].sort((c,_)=>+_.number-+c.number).map(c=>{var O,f;const{order:_,status:h,number:R,created_at:q}=c,D=((f=(O=c==null?void 0:c.shipping)==null?void 0:O.tracking)==null?void 0:f.map(u=>{const{status:y,carrier:o,tracking_number:g}=u;return{status:y,carrier:o,trackingNumber:g}}))??[],v=c.items.map(u=>{var E;const y=u==null?void 0:u.quantity,o=u==null?void 0:u.status,g=u==null?void 0:u.request_quantity,b=u==null?void 0:u.uid,T=u==null?void 0:u.order_item,m=((E=aa([T]))==null?void 0:E.reduce((N,C)=>C,{}))??{};return{uid:b,quantity:y,status:o,requestQuantity:g,...m}});return{createdReturnAt:q,returnStatus:h,token:_==null?void 0:_.token,orderNumber:_==null?void 0:_.number,returnNumber:R,items:v,tracking:D}}),...n?{pageInfo:{pageSize:n.page_size,totalPages:n.total_pages,currentPage:n.current_page}}:{}};return U(i,(p=(d=(r=(s=k==null?void 0:k.getConfig())==null?void 0:s.models)==null?void 0:r.CustomerOrdersReturnModel)==null?void 0:d.transformer)==null?void 0:p.call(d,{...t,...n}))},sa=a=>a||0,la=a=>{var t,n,e;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:((t=a==null?void 0:a.image)==null?void 0:t.url)||"",productType:(a==null?void 0:a.__typename)||"",thumbnail:{label:((n=a==null?void 0:a.thumbnail)==null?void 0:n.label)||"",url:((e=a==null?void 0:a.thumbnail)==null?void 0:e.url)||""}}},ra=a=>{if(!a||!("selected_options"in a))return;const t={};for(const n of a.selected_options)t[n.label]=n.value;return t},ca=a=>{const t=a==null?void 0:a.map(e=>({uid:e.uid,label:e.label,values:e.values.map(i=>i.product_name).join(", ")})),n={};return t==null||t.forEach(e=>{n[e.label]=e.values}),Object.keys(n).length>0?n:null},_a=a=>(a==null?void 0:a.length)>0?{count:a.length,result:a.map(t=>t.title).join(", ")}:null,da=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}),aa=a=>a==null?void 0:a.filter(t=>t.__typename).map(t=>{var p,c,_,h,R,q,D,v,O,f,u,y,o,g,b,T,m,E,N,C,B,A,$,P,w,x,M,L,F,z;const{quantityCanceled:n,quantityInvoiced:e,quantityOrdered:i,quantityRefunded:l,quantityReturned:s,quantityShipped:r,quantityReturnRequested:d}=da(t);return{type:t==null?void 0:t.__typename,eligibleForReturn:t==null?void 0:t.eligible_for_return,productSku:t==null?void 0:t.product_sku,productName:t.product_name,productUrlKey:t.product_url_key,quantityCanceled:n,quantityInvoiced:e,quantityOrdered:i,quantityRefunded:l,quantityReturned:s,quantityShipped:r,quantityReturnRequested:d,id:t==null?void 0:t.id,discounted:((h=(_=(c=(p=t==null?void 0:t.product)==null?void 0:p.price_range)==null?void 0:c.maximum_price)==null?void 0:_.regular_price)==null?void 0:h.value)*(t==null?void 0:t.quantity_ordered)!==((R=t==null?void 0:t.product_sale_price)==null?void 0:R.value)*(t==null?void 0:t.quantity_ordered),total:{value:((q=t==null?void 0:t.product_sale_price)==null?void 0:q.value)*(t==null?void 0:t.quantity_ordered)||0,currency:((D=t==null?void 0:t.product_sale_price)==null?void 0:D.currency)||""},totalInclTax:{value:((v=t==null?void 0:t.product_sale_price)==null?void 0:v.value)*(t==null?void 0:t.quantity_ordered)||0,currency:(O=t==null?void 0:t.product_sale_price)==null?void 0:O.currency},price:{value:((f=t==null?void 0:t.product_sale_price)==null?void 0:f.value)||0,currency:(u=t==null?void 0:t.product_sale_price)==null?void 0:u.currency},priceInclTax:{value:((y=t==null?void 0:t.product_sale_price)==null?void 0:y.value)||0,currency:(o=t==null?void 0:t.product_sale_price)==null?void 0:o.currency},totalQuantity:sa(t==null?void 0:t.quantity_ordered),regularPrice:{value:(m=(T=(b=(g=t==null?void 0:t.product)==null?void 0:g.price_range)==null?void 0:b.maximum_price)==null?void 0:T.regular_price)==null?void 0:m.value,currency:(B=(C=(N=(E=t==null?void 0:t.product)==null?void 0:E.price_range)==null?void 0:N.maximum_price)==null?void 0:C.regular_price)==null?void 0:B.currency},product:la(t==null?void 0:t.product),thumbnail:{label:(($=(A=t==null?void 0:t.product)==null?void 0:A.thumbnail)==null?void 0:$.label)||"",url:((w=(P=t==null?void 0:t.product)==null?void 0:P.thumbnail)==null?void 0:w.url)||""},giftCard:(t==null?void 0:t.__typename)==="GiftCardOrderItem"?{senderName:((x=t.gift_card)==null?void 0:x.sender_name)||"",senderEmail:((M=t.gift_card)==null?void 0:M.sender_email)||"",recipientEmail:((L=t.gift_card)==null?void 0:L.recipient_email)||"",recipientName:((F=t.gift_card)==null?void 0:F.recipient_name)||"",message:((z=t.gift_card)==null?void 0:z.message)||""}:void 0,configurableOptions:ra(t),bundleOptions:t.__typename==="BundleOrderItem"?ca(t.bundle_options):null,itemPrices:t.prices,downloadableLinks:t.__typename==="DownloadableOrderItem"?_a(t==null?void 0:t.downloadable_links):null}}),S=(a,t)=>{var h,R,q,D,v,O,f,u,y,o;const n=aa(a.items),e=((h=ua(a==null?void 0:a.returns))==null?void 0:h.ordersReturn)??[],i=t?e.filter(g=>g.returnNumber===t):e,{total:l,...s}=ea({...a,items:n,returns:i},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),r=(R=a==null?void 0:a.payment_methods)==null?void 0:R[0],d=(r==null?void 0:r.type)||"",p=(r==null?void 0:r.name)||"",c=(q=s==null?void 0:s.items)==null?void 0:q.reduce((g,b)=>g+(b==null?void 0:b.totalQuantity),0),_={...l,...s,totalQuantity:c,shipping:{amount:((D=s==null?void 0:s.total)==null?void 0:D.totalShipping.value)??0,currency:((O=(v=s.total)==null?void 0:v.totalShipping)==null?void 0:O.currency)||"",code:s.shippingMethod??""},payments:[{code:d,name:p}]};return U(_,(o=(y=(u=(f=k==null?void 0:k.getConfig())==null?void 0:f.models)==null?void 0:u.OrderDataModel)==null?void 0:y.transformer)==null?void 0:o.call(y,a))},ya=(a,t,n)=>{var e,i,l,s,r,d,p;if((s=(l=(i=(e=t==null?void 0:t.data)==null?void 0:e.customer)==null?void 0:i.orders)==null?void 0:l.items)!=null&&s.length&&a==="orderData"){const c=(p=(d=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:d.orders)==null?void 0:p.items[0];return S(c,n)}return null},va=(a,t)=>{var e,i;if(!((e=a==null?void 0:a.data)!=null&&e.guestOrder))return null;const n=(i=a==null?void 0:a.data)==null?void 0:i.guestOrder;return S(n,t)},pa=(a,t)=>{var e,i;if(!((e=a==null?void 0:a.data)!=null&&e.guestOrderByToken))return null;const n=(i=a==null?void 0:a.data)==null?void 0:i.guestOrderByToken;return S(n,t)},ga=async({orderId:a,returnRef:t,queryType:n,returnsPageSize:e=50})=>await Q(ia,{method:"GET",cache:"force-cache",variables:{orderNumber:a,pageSize:e}}).then(i=>{var l;return(l=i.errors)!=null&&l.length?Y(i.errors):ya(n??"orderData",i,t)}).catch(K),oa=` +`,Ta=async({orderId:a,returnRef:n,queryType:t,returnsPageSize:_=50})=>await Q(Ea,{method:"GET",cache:"force-cache",variables:{orderNumber:a,pageSize:_}}).then(e=>ca(t??"orderData",e,n)).catch(Y),pa=` query ORDER_BY_TOKEN($token: String!) { guestOrderByToken(input: { token: $token }) { email @@ -324,10 +328,10 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as available_actions is_virtual items_eligible_for_return { - ...OrderItemDetails + ...ORDER_ITEM_DETAILS_FRAGMENT } returns(pageSize: 50) { - ...OrderReturns + ...RETURNS_FRAGMENT } payment_methods { name @@ -352,11 +356,11 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as product_sku product_name order_item { - ...OrderItemDetails + ...ORDER_ITEM_DETAILS_FRAGMENT ... on GiftCardOrderItem { - ...GiftCardDetails + ...GIFT_CARD_DETAILS_FRAGMENT product { - ...ProductDetails + ...PRODUCT_DETAILS_FRAGMENT } } } @@ -367,20 +371,20 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as type } shipping_address { - ...AddressesList + ...ADDRESS_FRAGMENT } billing_address { - ...AddressesList + ...ADDRESS_FRAGMENT } items { - ...OrderItemDetails + ...ORDER_ITEM_DETAILS_FRAGMENT ... on BundleOrderItem { - ...BundleOrderItemDetails + ...BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT } ... on GiftCardOrderItem { - ...GiftCardDetails + ...GIFT_CARD_DETAILS_FRAGMENT product { - ...ProductDetails + ...PRODUCT_DETAILS_FRAGMENT } } ... on DownloadableOrderItem { @@ -392,16 +396,16 @@ import{merge as U,Initializer as na}from"@dropins/tools/lib.js";import{events as } } total { - ...OrderSummary + ...ORDER_SUMMARY_FRAGMENT } } } + ${j} ${H} ${J} ${V} ${W} ${X} + ${K} ${Z} - ${j} - ${I} -`,Oa=async(a,t)=>await Q(oa,{method:"GET",cache:"no-cache",variables:{token:a}}).then(n=>{var e;return(e=n.errors)!=null&&e.length?Y(n.errors):pa(n,t)}).catch(K),fa="orderData",ba=async a=>{var s;const t=typeof(a==null?void 0:a.orderRef)=="string"?a==null?void 0:a.orderRef:"",n=typeof(a==null?void 0:a.returnRef)=="string"?a==null?void 0:a.returnRef:"",e=t&&typeof(a==null?void 0:a.orderRef)=="string"&&((s=a==null?void 0:a.orderRef)==null?void 0:s.length)>20,i=(a==null?void 0:a.orderData)??null;if(i){G.emit("order/data",{...i,returnNumber:n});return}if(!t)return;const l=e?await Oa(t,n):await ga({orderId:t,returnRef:n,queryType:fa});l?G.emit("order/data",{...l,returnNumber:n}):G.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},ta=new na({init:async a=>{const t={};ta.config.setConfig({...t,...a}),ba(a).catch(console.error)},listeners:()=>[]}),k=ta.config;export{j as A,X as B,V as G,W as O,H as P,I as R,Oa as a,J as b,k as c,Z as d,S as e,va as f,ga as g,ta as i,ua as t}; +`,ya=async(a,n)=>await Q(pa,{method:"GET",cache:"no-cache",variables:{token:a}}).then(t=>Ra(t,n)).catch(Y),Aa="orderData",Da=async a=>{var s;const n=typeof(a==null?void 0:a.orderRef)=="string"?a==null?void 0:a.orderRef:"",t=typeof(a==null?void 0:a.returnRef)=="string"?a==null?void 0:a.returnRef:"",_=n&&typeof(a==null?void 0:a.orderRef)=="string"&&((s=a==null?void 0:a.orderRef)==null?void 0:s.length)>20,e=(a==null?void 0:a.orderData)??null;if(e){q.emit("order/data",{...e,returnNumber:t});return}if(!n)return;const i=_?await ya(n,t):await Ta({orderId:n,returnRef:t,queryType:Aa});i?q.emit("order/data",{...i,returnNumber:t}):q.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},aa=new na({init:async a=>{const n={};aa.config.setConfig({...n,...a}),Da(a).catch(console.error)},listeners:()=>[]}),b=aa.config;export{K as A,W as B,J as G,V as O,j as P,Z as R,H as a,X as b,v as c,ya as d,b as e,Ma as f,Ta as g,aa as i,ra as t}; diff --git a/scripts/__dropins__/storefront-order/chunks/network-error.js b/scripts/__dropins__/storefront-order/chunks/network-error.js index b7780a4913..92b148ebc6 100644 --- a/scripts/__dropins__/storefront-order/chunks/network-error.js +++ b/scripts/__dropins__/storefront-order/chunks/network-error.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{events as o}from"@dropins/tools/event-bus.js";const s=r=>{throw r instanceof DOMException&&r.name==="AbortError"||o.emit("order/error",{source:"auth",type:"network",error:r.message}),r};export{s as h}; +import{events as a}from"@dropins/tools/event-bus.js";const b=r=>r.replace(/_([a-z])/g,(o,s)=>s.toUpperCase()),i=r=>r.replace(/([A-Z])/g,o=>`_${o.toLowerCase()}`),u=(r,o,s)=>{const c=["string","boolean","number"],p=o==="camelCase"?b:i;return Array.isArray(r)?r.map(e=>c.includes(typeof e)||e===null?e:typeof e=="object"?u(e,o,s):e):r!==null&&typeof r=="object"?Object.entries(r).reduce((e,[n,t])=>{const f=s&&s[n]?s[n]:p(n);return e[f]=c.includes(typeof t)||t===null?t:u(t,o,s),e},{}):r},C=r=>{throw r instanceof DOMException&&r.name==="AbortError"||a.emit("order/error",{source:"auth",type:"network",error:r.message}),r};export{u as a,b as c,C as h}; diff --git a/scripts/__dropins__/storefront-order/chunks/reorderItems.js b/scripts/__dropins__/storefront-order/chunks/reorderItems.js deleted file mode 100644 index 00cd1961a1..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 c6d464d3c9..f135fe1bcb 100644 --- a/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js +++ b/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js @@ -1,99 +1,102 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{P as c,a as u,G as l,O as E,B as m,b as d}from"./transform-customer-orders-returns.js";import{O,A as D,G as R}from"./getGuestOrder.graphql.js";import{f as i,h as _}from"./fetch-graphql.js";const T=` -mutation CANCEL_ORDER_MUTATION($orderId: ID!, $reason: String!) { - cancelOrder(input: { order_id: $orderId, reason: $reason }) { - error - order { - email - available_actions - status - number - id - order_date - carrier - shipping_method - is_virtual - applied_coupons { - code - } - shipments { - id +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 + order { + email + available_actions + status number - tracking { - title - number - carrier - } - comments { - message - timestamp + id + order_date + carrier + shipping_method + is_virtual + applied_coupons { + code } - items { + shipments { id - product_sku - product_name - order_item { - ...OrderItemDetails - ... on GiftCardOrderItem { - ...GiftCardDetails - product { - ...ProductDetails + number + tracking { + title + number + carrier + } + comments { + message + timestamp + } + items { + id + product_sku + product_name + order_item { + ...ORDER_ITEM_DETAILS_FRAGMENT + ... on GiftCardOrderItem { + ...GIFT_CARD_DETAILS_FRAGMENT + product { + ...PRODUCT_DETAILS_FRAGMENT + } } } } } - } - payment_methods { - name - type - } - shipping_address { - ...AddressesList - } - billing_address { - ...AddressesList - } - items { - ...OrderItemDetails - ... on BundleOrderItem { - ...BundleOrderItemDetails + payment_methods { + name + type } - ... on GiftCardOrderItem { - ...GiftCardDetails - product { - ...ProductDetails - } + shipping_address { + ...ADDRESS_FRAGMENT } - ... on DownloadableOrderItem { - product_name - downloadable_links { - sort_order - title + billing_address { + ...ADDRESS_FRAGMENT + } + items { + ...ORDER_ITEM_DETAILS_FRAGMENT + ... on BundleOrderItem { + ...BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT + } + ... on GiftCardOrderItem { + ...GIFT_CARD_DETAILS_FRAGMENT + product { + ...PRODUCT_DETAILS_FRAGMENT + } + } + ... on DownloadableOrderItem { + product_name + downloadable_links { + sort_order + title + } } } - } - total { - ...OrderSummary + total { + ...ORDER_SUMMARY_FRAGMENT + } } } } -} -${c} -${u} -${l} -${E} -${m} -${O} -${D} -`,G=async(r,e,s,t)=>{if(!r)throw new Error("No order ID found");if(!e)throw new Error("No reason found");return i(T,{variables:{orderId:r,reason:e}}).then(({errors:a,data:o})=>{if(a)return _(a);if(o.cancelOrder.error!=null){t();return}const n=d(o.cancelOrder.order);s(n)}).catch(()=>t())},A=` -mutation REQUEST_GUEST_ORDER_CANCEL_MUTATION($token: String!, $reason: String!) { - requestGuestOrderCancel(input: { token: $token, reason: $reason }) { - error - order { - ...guestOrderData + ${T} + ${d} + ${i} + ${A} + ${D} + ${c} + ${u} +`,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! + ) { + requestGuestOrderCancel(input: { token: $token, reason: $reason }) { + error + order { + ...GUEST_ORDER_FRAGMENT + } } } -} -${R} -`,C=async(r,e,s,t)=>{if(!r)throw new Error("No order token found");if(!e)throw new Error("No reason found");return i(A,{variables:{token:r,reason:e}}).then(({errors:a,data:o})=>{if(a)return _(a);o.requestGuestOrderCancel.error!=null&&t();const n=d(o.requestGuestOrderCancel.order);s(n)}).catch(()=>t())};export{G as c,C 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 9d1c33e47d..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/requestReturn.js +++ /dev/null @@ -1,52 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{h as i}from"./network-error.js";import{f as s,h as o}from"./fetch-graphql.js";import{t as R}from"./transform-attributes-form.js";import{a as c}from"./convertCase.js";const m=` - 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 - } - } - } -`,f=async n=>await s(m,{method:"GET",cache:"force-cache",variables:{entityType:n}}).then(t=>{var e,r,a;return(e=t.errors)!=null&&e.length?o(t.errors):R((a=(r=t==null?void 0:t.data)==null?void 0:r.attributesList)==null?void 0:a.items)}).catch(i),_=` - fragment OrderReturn on Return { - __typename - uid - status - number - created_at - } -`,T=` -mutation REQUEST_RETURN_ORDER($input: RequestReturnInput!) { - requestReturn(input: $input) { - return { - ...OrderReturn - } - } -} -${_}`,y=async n=>{const t=c(n,"snakeCase",{});return await s(T,{method:"POST",variables:{input:t}}).then(e=>{var u;if((u=e.errors)!=null&&u.length)return o(e.errors);const{created_at:r,...a}=e.data.requestReturn.return;return{...a,createdAt:r}}).catch(i)};export{f as g,y as r}; 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/chunks/transform-attributes-form.js b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js index ee0f7dcf66..19aed95cc1 100644 --- a/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js +++ b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{c as i,a as d}from"./convertCase.js";const l=n=>{let s=[];for(const e of n)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let o=2;o<=e.multiline_count;o++){const c={...e,name:`${e.code}_${o}`,code:`${e.code}_${o}`,id:`${e.code}_${o}`};s.push(c)}return s},f=(n=[])=>{var c;if(!(n!=null&&n.length))return[];const s=(c=n.filter(t=>{var r;return!((r=t.frontend_input)!=null&&r.includes("HIDDEN"))}))==null?void 0:c.map(({code:t,...r})=>{const u=t!=="country_id"?t:"country_code";return{...r,name:u,id:u,code:u}}),e=l(s);return[...s,...e].map(t=>{const r=i(t.code);return d({...t,customUpperCode:r},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((t,r)=>t.orderNumber-r.orderNumber)};export{f as t}; +import{c as i,a as d}from"./network-error.js";const l=n=>{let s=[];for(const e of n)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let o=2;o<=e.multiline_count;o++){const c={...e,name:`${e.code}_${o}`,code:`${e.code}_${o}`,id:`${e.code}_${o}`};s.push(c)}return s},f=(n=[])=>{var c;if(!(n!=null&&n.length))return[];const s=(c=n.filter(t=>{var r;return!((r=t.frontend_input)!=null&&r.includes("HIDDEN"))}))==null?void 0:c.map(({code:t,...r})=>{const u=t!=="country_id"?t:"country_code";return{...r,name:u,id:u,code:u}}),e=l(s);return[...s,...e].map(t=>{const r=i(t.code);return d({...t,customUpperCode:r},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((t,r)=>t.orderNumber-r.orderNumber)};export{f as t}; diff --git a/scripts/__dropins__/storefront-order/chunks/transform-customer-orders-returns.js b/scripts/__dropins__/storefront-order/chunks/transform-customer-orders-returns.js deleted file mode 100644 index 2f34188ce8..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/transform-customer-orders-returns.js +++ /dev/null @@ -1,142 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{a as z}from"./convertCase.js";const d=` - fragment ProductDetails on ProductInterface { - __typename - canonical_url - url_key - uid - name - sku - only_x_left_in_stock - stock_status - thumbnail { - label - url - } - price_range { - maximum_price { - regular_price { - currency - value - } - } - } - } -`,r=` - fragment PriceDetails on OrderItemInterface { - prices { - price_including_tax { - value - currency - } - original_price { - value - currency - } - original_price_including_tax { - value - currency - } - price { - value - currency - } - } - } -`,m=` - fragment GiftCardDetails on GiftCardOrderItem { - ...PriceDetails - gift_message { - message - } - gift_card { - recipient_name - recipient_email - sender_name - sender_email - message - } - } -`,I=` - fragment OrderItemDetails on OrderItemInterface { - __typename - status - product_sku - eligible_for_return - product_name - product_url_key - id - quantity_ordered - quantity_shipped - quantity_canceled - quantity_invoiced - quantity_refunded - quantity_return_requested - product_sale_price { - value - currency - } - selected_options { - label - value - } - product { - ...ProductDetails - } - ...PriceDetails - } -`,nn=` - fragment BundleOrderItemDetails on BundleOrderItem { - ...PriceDetails - bundle_options { - uid - label - values { - uid - product_name - } - } - } -`,an=` - fragment OrderReturns on Returns { - __typename - items { - number - status - created_at - shipping { - tracking { - status { - text - type - } - carrier { - uid - label - } - tracking_number - } - } - order { - number - token - } - items { - uid - quantity - status - request_quantity - order_item { - ...OrderItemDetails - ... on GiftCardOrderItem { - ...GiftCardDetails - product { - ...ProductDetails - } - } - } - } - } - } -`,H=a=>a||0,J=a=>{var n,s,c;return{...a,canonicalUrl:(a==null?void 0:a.canonical_url)||"",urlKey:(a==null?void 0:a.url_key)||"",id:(a==null?void 0:a.uid)||"",name:(a==null?void 0:a.name)||"",sku:(a==null?void 0:a.sku)||"",image:((n=a==null?void 0:a.image)==null?void 0:n.url)||"",productType:(a==null?void 0:a.__typename)||"",thumbnail:{label:((s=a==null?void 0:a.thumbnail)==null?void 0:s.label)||"",url:((c=a==null?void 0:a.thumbnail)==null?void 0:c.url)||""}}},V=a=>{if(!a||!("selected_options"in a))return;const n={};for(const s of a.selected_options)n[s.label]=s.value;return n},W=a=>{const n=a==null?void 0:a.map(c=>({uid:c.uid,label:c.label,values:c.values.map(t=>t.product_name).join(", ")})),s={};return n==null||n.forEach(c=>{s[c.label]=c.values}),Object.keys(s).length>0?s:null},X=a=>(a==null?void 0:a.length)>0?{count:a.length,result:a.map(n=>n.title).join(", ")}:null,Y=a=>({quantityCanceled:(a==null?void 0:a.quantity_canceled)??0,quantityInvoiced:(a==null?void 0:a.quantity_invoiced)??0,quantityOrdered:(a==null?void 0:a.quantity_ordered)??0,quantityRefunded:(a==null?void 0:a.quantity_refunded)??0,quantityReturned:(a==null?void 0:a.quantity_returned)??0,quantityShipped:(a==null?void 0:a.quantity_shipped)??0,quantityReturnRequested:(a==null?void 0:a.quantity_return_requested)??0}),K=a=>a==null?void 0:a.filter(n=>n.__typename).map(n=>{var y,b,h,q,R,i,p,g,f,v,O,N,E,T,k,C,D,P,A,G,S,x,L,F,M,B,Q,U,j,w;const{quantityCanceled:s,quantityInvoiced:c,quantityOrdered:t,quantityRefunded:l,quantityReturned:u,quantityShipped:_,quantityReturnRequested:e}=Y(n);return{type:n==null?void 0:n.__typename,eligibleForReturn:n==null?void 0:n.eligible_for_return,productSku:n==null?void 0:n.product_sku,productName:n.product_name,productUrlKey:n.product_url_key,quantityCanceled:s,quantityInvoiced:c,quantityOrdered:t,quantityRefunded:l,quantityReturned:u,quantityShipped:_,quantityReturnRequested:e,id:n==null?void 0:n.id,discounted:((q=(h=(b=(y=n==null?void 0:n.product)==null?void 0:y.price_range)==null?void 0:b.maximum_price)==null?void 0:h.regular_price)==null?void 0:q.value)*(n==null?void 0:n.quantity_ordered)!==((R=n==null?void 0:n.product_sale_price)==null?void 0:R.value)*(n==null?void 0:n.quantity_ordered),total:{value:((i=n==null?void 0:n.product_sale_price)==null?void 0:i.value)*(n==null?void 0:n.quantity_ordered)||0,currency:((p=n==null?void 0:n.product_sale_price)==null?void 0:p.currency)||""},totalInclTax:{value:((g=n==null?void 0:n.product_sale_price)==null?void 0:g.value)*(n==null?void 0:n.quantity_ordered)||0,currency:(f=n==null?void 0:n.product_sale_price)==null?void 0:f.currency},price:{value:((v=n==null?void 0:n.product_sale_price)==null?void 0:v.value)||0,currency:(O=n==null?void 0:n.product_sale_price)==null?void 0:O.currency},priceInclTax:{value:((N=n==null?void 0:n.product_sale_price)==null?void 0:N.value)||0,currency:(E=n==null?void 0:n.product_sale_price)==null?void 0:E.currency},totalQuantity:H(n==null?void 0:n.quantity_ordered),regularPrice:{value:(D=(C=(k=(T=n==null?void 0:n.product)==null?void 0:T.price_range)==null?void 0:k.maximum_price)==null?void 0:C.regular_price)==null?void 0:D.value,currency:(S=(G=(A=(P=n==null?void 0:n.product)==null?void 0:P.price_range)==null?void 0:A.maximum_price)==null?void 0:G.regular_price)==null?void 0:S.currency},product:J(n==null?void 0:n.product),thumbnail:{label:((L=(x=n==null?void 0:n.product)==null?void 0:x.thumbnail)==null?void 0:L.label)||"",url:((M=(F=n==null?void 0:n.product)==null?void 0:F.thumbnail)==null?void 0:M.url)||""},giftCard:(n==null?void 0:n.__typename)==="GiftCardOrderItem"?{senderName:((B=n.gift_card)==null?void 0:B.sender_name)||"",senderEmail:((Q=n.gift_card)==null?void 0:Q.sender_email)||"",recipientEmail:((U=n.gift_card)==null?void 0:U.recipient_email)||"",recipientName:((j=n.gift_card)==null?void 0:j.recipient_name)||"",message:((w=n.gift_card)==null?void 0:w.message)||""}:void 0,configurableOptions:V(n),bundleOptions:n.__typename==="BundleOrderItem"?W(n.bundle_options):null,itemPrices:n.prices,downloadableLinks:n.__typename==="DownloadableOrderItem"?X(n==null?void 0:n.downloadable_links):null}}),Z=(a,n)=>{var q,R,i,p,g,f;const s=K(a.items),c=((q=$(a==null?void 0:a.returns))==null?void 0:q.ordersReturn)??[],t=n?c.filter(v=>v.returnNumber===n):c,{total:l,...u}=z({...a,items:s,returns:t},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),_=(R=a==null?void 0:a.payment_methods)==null?void 0:R[0],e=(_==null?void 0:_.type)||"",y=(_==null?void 0:_.name)||"",b=(i=u==null?void 0:u.items)==null?void 0:i.reduce((v,O)=>v+(O==null?void 0:O.totalQuantity),0);return{...l,...u,totalQuantity:b,shipping:{amount:((p=u==null?void 0:u.total)==null?void 0:p.totalShipping.value)??0,currency:((f=(g=u.total)==null?void 0:g.totalShipping)==null?void 0:f.currency)||"",code:u.shippingMethod??""},payments:[{code:e,name:y}]}},un=(a,n,s)=>{var c,t,l,u,_,e,y;if((u=(l=(t=(c=n==null?void 0:n.data)==null?void 0:c.customer)==null?void 0:t.orders)==null?void 0:l.items)!=null&&u.length&&a==="orderData"){const b=(y=(e=(_=n==null?void 0:n.data)==null?void 0:_.customer)==null?void 0:e.orders)==null?void 0:y.items[0];return Z(b,s)}return null},$=a=>{var t;if(!((t=a==null?void 0:a.items)!=null&&t.length))return null;const n=a==null?void 0:a.items,s=a==null?void 0:a.page_info;return{ordersReturn:[...n].sort((l,u)=>+u.number-+l.number).map(l=>{var q,R;const{order:u,status:_,number:e,created_at:y}=l,b=((R=(q=l==null?void 0:l.shipping)==null?void 0:q.tracking)==null?void 0:R.map(i=>{const{status:p,carrier:g,tracking_number:f}=i;return{status:p,carrier:g,trackingNumber:f}}))??[],h=l.items.map(i=>{var E;const p=i==null?void 0:i.quantity,g=i==null?void 0:i.status,f=i==null?void 0:i.request_quantity,v=i==null?void 0:i.uid,O=i==null?void 0:i.order_item,N=((E=K([O]))==null?void 0:E.reduce((T,k)=>k,{}))??{};return{uid:v,quantity:p,status:g,requestQuantity:f,...N}});return{createdReturnAt:y,returnStatus:_,token:u==null?void 0:u.token,orderNumber:u==null?void 0:u.number,returnNumber:e,items:h,tracking:b}}),...s?{pageInfo:{pageSize:s.page_size,totalPages:s.total_pages,currentPage:s.current_page}}:{}}};export{nn as B,m as G,I as O,d as P,an as R,r as a,Z as b,un as c,$ as t}; diff --git a/scripts/__dropins__/storefront-order/chunks/transform-order-details.js b/scripts/__dropins__/storefront-order/chunks/transform-order-details.js deleted file mode 100644 index 5097738f53..0000000000 --- a/scripts/__dropins__/storefront-order/chunks/transform-order-details.js +++ /dev/null @@ -1,142 +0,0 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{a as z}from"./convertCase.js";const d=` - fragment ProductDetails on ProductInterface { - __typename - canonical_url - url_key - uid - name - sku - only_x_left_in_stock - stock_status - thumbnail { - label - url - } - price_range { - maximum_price { - regular_price { - currency - value - } - } - } - } -`,r=` - fragment PriceDetails on OrderItemInterface { - prices { - price_including_tax { - value - currency - } - original_price { - value - currency - } - original_price_including_tax { - value - currency - } - price { - value - currency - } - } - } -`,m=` - fragment GiftCardDetails on GiftCardOrderItem { - ...PriceDetails - gift_message { - message - } - gift_card { - recipient_name - recipient_email - sender_name - sender_email - message - } - } -`,I=` - fragment OrderItemDetails on OrderItemInterface { - __typename - status - product_sku - eligible_for_return - product_name - product_url_key - id - quantity_ordered - quantity_shipped - quantity_canceled - quantity_invoiced - quantity_refunded - quantity_return_requested - product_sale_price { - value - currency - } - selected_options { - label - value - } - product { - ...ProductDetails - } - ...PriceDetails - } -`,nn=` - fragment BundleOrderItemDetails on BundleOrderItem { - ...PriceDetails - bundle_options { - uid - label - values { - uid - product_name - } - } - } -`,an=` - fragment OrderReturns on Returns { - __typename - items { - number - status - created_at - shipping { - tracking { - status { - text - type - } - carrier { - uid - label - } - tracking_number - } - } - order { - number - token - } - items { - uid - quantity - status - request_quantity - order_item { - ...OrderItemDetails - ... on GiftCardOrderItem { - ...GiftCardDetails - product { - ...ProductDetails - } - } - } - } - } - } -`,H=a=>{var t;if(!((t=a==null?void 0:a.items)!=null&&t.length))return null;const n=a==null?void 0:a.items,s=a==null?void 0:a.page_info;return{ordersReturn:[...n].sort((l,u)=>+u.number-+l.number).map(l=>{var q,R;const{order:u,status:_,number:e,created_at:y}=l,b=((R=(q=l==null?void 0:l.shipping)==null?void 0:q.tracking)==null?void 0:R.map(i=>{const{status:p,carrier:g,tracking_number:f}=i;return{status:p,carrier:g,trackingNumber:f}}))??[],h=l.items.map(i=>{var E;const p=i==null?void 0:i.quantity,g=i==null?void 0:i.status,f=i==null?void 0:i.request_quantity,v=i==null?void 0:i.uid,O=i==null?void 0:i.order_item,N=((E=K([O]))==null?void 0:E.reduce((T,k)=>k,{}))??{};return{uid:v,quantity:p,status:g,requestQuantity:f,...N}});return{createdReturnAt:y,returnStatus:_,token:u==null?void 0:u.token,orderNumber:u==null?void 0:u.number,returnNumber:e,items:h,tracking:b}}),...s?{pageInfo:{pageSize:s.page_size,totalPages:s.total_pages,currentPage:s.current_page}}:{}}},J=a=>a||0,V=a=>{var n,s,c;return{...a,canonicalUrl:(a==null?void 0:a.canonical_url)||"",urlKey:(a==null?void 0:a.url_key)||"",id:(a==null?void 0:a.uid)||"",name:(a==null?void 0:a.name)||"",sku:(a==null?void 0:a.sku)||"",image:((n=a==null?void 0:a.image)==null?void 0:n.url)||"",productType:(a==null?void 0:a.__typename)||"",thumbnail:{label:((s=a==null?void 0:a.thumbnail)==null?void 0:s.label)||"",url:((c=a==null?void 0:a.thumbnail)==null?void 0:c.url)||""}}},W=a=>{if(!a||!("selected_options"in a))return;const n={};for(const s of a.selected_options)n[s.label]=s.value;return n},X=a=>{const n=a==null?void 0:a.map(c=>({uid:c.uid,label:c.label,values:c.values.map(t=>t.product_name).join(", ")})),s={};return n==null||n.forEach(c=>{s[c.label]=c.values}),Object.keys(s).length>0?s:null},Y=a=>(a==null?void 0:a.length)>0?{count:a.length,result:a.map(n=>n.title).join(", ")}:null,Z=a=>({quantityCanceled:(a==null?void 0:a.quantity_canceled)??0,quantityInvoiced:(a==null?void 0:a.quantity_invoiced)??0,quantityOrdered:(a==null?void 0:a.quantity_ordered)??0,quantityRefunded:(a==null?void 0:a.quantity_refunded)??0,quantityReturned:(a==null?void 0:a.quantity_returned)??0,quantityShipped:(a==null?void 0:a.quantity_shipped)??0,quantityReturnRequested:(a==null?void 0:a.quantity_return_requested)??0}),K=a=>a==null?void 0:a.filter(n=>n.__typename).map(n=>{var y,b,h,q,R,i,p,g,f,v,O,N,E,T,k,C,D,P,A,G,S,x,L,F,M,B,Q,U,j,w;const{quantityCanceled:s,quantityInvoiced:c,quantityOrdered:t,quantityRefunded:l,quantityReturned:u,quantityShipped:_,quantityReturnRequested:e}=Z(n);return{type:n==null?void 0:n.__typename,eligibleForReturn:n==null?void 0:n.eligible_for_return,productSku:n==null?void 0:n.product_sku,productName:n.product_name,productUrlKey:n.product_url_key,quantityCanceled:s,quantityInvoiced:c,quantityOrdered:t,quantityRefunded:l,quantityReturned:u,quantityShipped:_,quantityReturnRequested:e,id:n==null?void 0:n.id,discounted:((q=(h=(b=(y=n==null?void 0:n.product)==null?void 0:y.price_range)==null?void 0:b.maximum_price)==null?void 0:h.regular_price)==null?void 0:q.value)*(n==null?void 0:n.quantity_ordered)!==((R=n==null?void 0:n.product_sale_price)==null?void 0:R.value)*(n==null?void 0:n.quantity_ordered),total:{value:((i=n==null?void 0:n.product_sale_price)==null?void 0:i.value)*(n==null?void 0:n.quantity_ordered)||0,currency:((p=n==null?void 0:n.product_sale_price)==null?void 0:p.currency)||""},totalInclTax:{value:((g=n==null?void 0:n.product_sale_price)==null?void 0:g.value)*(n==null?void 0:n.quantity_ordered)||0,currency:(f=n==null?void 0:n.product_sale_price)==null?void 0:f.currency},price:{value:((v=n==null?void 0:n.product_sale_price)==null?void 0:v.value)||0,currency:(O=n==null?void 0:n.product_sale_price)==null?void 0:O.currency},priceInclTax:{value:((N=n==null?void 0:n.product_sale_price)==null?void 0:N.value)||0,currency:(E=n==null?void 0:n.product_sale_price)==null?void 0:E.currency},totalQuantity:J(n==null?void 0:n.quantity_ordered),regularPrice:{value:(D=(C=(k=(T=n==null?void 0:n.product)==null?void 0:T.price_range)==null?void 0:k.maximum_price)==null?void 0:C.regular_price)==null?void 0:D.value,currency:(S=(G=(A=(P=n==null?void 0:n.product)==null?void 0:P.price_range)==null?void 0:A.maximum_price)==null?void 0:G.regular_price)==null?void 0:S.currency},product:V(n==null?void 0:n.product),thumbnail:{label:((L=(x=n==null?void 0:n.product)==null?void 0:x.thumbnail)==null?void 0:L.label)||"",url:((M=(F=n==null?void 0:n.product)==null?void 0:F.thumbnail)==null?void 0:M.url)||""},giftCard:(n==null?void 0:n.__typename)==="GiftCardOrderItem"?{senderName:((B=n.gift_card)==null?void 0:B.sender_name)||"",senderEmail:((Q=n.gift_card)==null?void 0:Q.sender_email)||"",recipientEmail:((U=n.gift_card)==null?void 0:U.recipient_email)||"",recipientName:((j=n.gift_card)==null?void 0:j.recipient_name)||"",message:((w=n.gift_card)==null?void 0:w.message)||""}:void 0,configurableOptions:W(n),bundleOptions:n.__typename==="BundleOrderItem"?X(n.bundle_options):null,itemPrices:n.prices,downloadableLinks:n.__typename==="DownloadableOrderItem"?Y(n==null?void 0:n.downloadable_links):null}}),$=(a,n)=>{var q,R,i,p,g,f;const s=K(a.items),c=((q=H(a==null?void 0:a.returns))==null?void 0:q.ordersReturn)??[],t=n?c.filter(v=>v.returnNumber===n):c,{total:l,...u}=z({...a,items:s,returns:t},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),_=(R=a==null?void 0:a.payment_methods)==null?void 0:R[0],e=(_==null?void 0:_.type)||"",y=(_==null?void 0:_.name)||"",b=(i=u==null?void 0:u.items)==null?void 0:i.reduce((v,O)=>v+(O==null?void 0:O.totalQuantity),0);return{...l,...u,totalQuantity:b,shipping:{amount:((p=u==null?void 0:u.total)==null?void 0:p.totalShipping.value)??0,currency:((f=(g=u.total)==null?void 0:g.totalShipping)==null?void 0:f.currency)||"",code:u.shippingMethod??""},payments:[{code:e,name:y}]}},un=(a,n,s)=>{var c,t,l,u,_,e,y;if((u=(l=(t=(c=n==null?void 0:n.data)==null?void 0:c.customer)==null?void 0:t.orders)==null?void 0:l.items)!=null&&u.length&&a==="orderData"){const b=(y=(e=(_=n==null?void 0:n.data)==null?void 0:_.customer)==null?void 0:e.orders)==null?void 0:y.items[0];return $(b,s)}return null};export{nn as B,m as G,I as O,d as P,an as R,r as a,$ as b,un as c,H as t}; diff --git a/scripts/__dropins__/storefront-order/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 7081ff9cd0..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/convertCase.js";const oe=a=>C.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},C.createElement("g",{clipPath:"url(#clip0_841_1324)"},C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),C.createElement("defs",null,C.createElement("clipPath",{id:"clip0_841_1324"},C.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),le=a=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),C.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),de=({onSuccess:a,onError:s,handleSetInLineAlert:c,orderData:l})=>{const[g,O]=w({id:"",email:"",...l}),[d,f]=w("products"),[L,k]=w(!0),[p,m]=w([]),[_,R]=w([]),[y,t]=w([]),u=D([]);u.current.length!==p.length&&(u.current=p.map((n,o)=>u.current[o]||J())),q(()=>{const n=te.on("order/data",o=>{O(o);const S=X(o);t(S),k(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),q(()=>{ne("RMA_ITEM").then(n=>{n!=null&&n.length&&(R(n),k(!1))})},[]);const e=E(n=>{m(o=>o.findIndex(h=>(h==null?void 0:h.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(h=>(h==null?void 0:h.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),i=E(n=>{f(n),c(),n==="products"&&m([])},[c]),b=E((n,o)=>{const S=p.map(h=>h.productSku===o?{...h,currentReturnOrderQuantity:n}:h);m(S)},[p]),N=E(async(n,o)=>{if(!o)return;k(!0);const S={orderUid:g.id,contactEmail:g.email},h=Y(u);re({...S,items:h}).then(v=>{a==null||a(v),i("success"),c()}).catch(v=>{s==null||s(v.message),c({type:"error",heading:v.message})}),k(!1)},[i,s,a,c,g]);return{order:g,steps:d,loading:L,formsRef:u,attributesList:_,selectedProductList:p,itemsEligibleForReturn:y,handleSelectedProductList:e,handleSetQuantity:b,handleChangeStep:i,onSubmit:N}},pe={success:le,warning:oe,error:ae},he=()=>{const[a,s]=w({type:"success",heading:""}),c=E(l=>{if(!(l!=null&&l.type)){s({type:"success",heading:""});return}const g=r(H,{source:pe[l.type]});s({...l,icon:g})},[]);return{inLineAlertProps:a,handleSetInLineAlert:c}},Pe=({className:a,orderData:s,slots:c,onSuccess:l,onError:g,routeReturnSuccess:O,showConfigurableOptions:d})=>{const f=ue({headerText:"Order.CreateReturn.headerText",successTitle:"Order.CreateReturn.success.title",successMessage:"Order.CreateReturn.success.message",sender:"Order.CreateReturn.giftCard.sender",recipient:"Order.CreateReturn.giftCard.recipient",message:"Order.CreateReturn.giftCard.message",outOfStock:"Order.CreateReturn.stockStatus.outOfStock",nextStep:"Order.CreateReturn.buttons.nextStep",backStep:"Order.CreateReturn.buttons.backStep",submit:"Order.CreateReturn.buttons.submit",backStore:"Order.CreateReturn.buttons.backStore",downloadableCount:"Order.CreateReturn.downloadableCount",returnedItems:"Order.CreateReturn.returnedItems",configurationsListQuantity:"Order.CreateReturn.configurationsList.quantity"}),{inLineAlertProps:L,handleSetInLineAlert:k}=he(),p=G(),{order:m,itemsEligibleForReturn:_,formsRef:R,attributesList:y,steps:t,loading:u,selectedProductList:e,handleSelectedProductList:i,handleSetQuantity:b,handleChangeStep:N,onSubmit:n}=de({orderData:s,onSuccess:l,onError:g,handleSetInLineAlert:k});if(u)return r("div",{children:r(ie,{})});if(!u&&!y.length)return r("div",{});const o=(p==null?void 0:p.baseMediaUrl)??"",S={products:r(ge,{itemsEligibleForReturn:_,placeholderImage:o,taxConfig:se((p==null?void 0:p.shoppingCartDisplayPrice)??0),slots:c,translations:f,loading:u,selectedProductList:e,handleSelectedProductList:i,showConfigurableOptions:d,handleSetQuantity:b,handleChangeStep:N}),attributes:r(fe,{placeholderImage:o,slots:c,formsRef:R,loading:u,fieldsConfig:y,selectedProductList:e,handleChangeStep:N,translations:f,onSubmit:n}),success:r(me,{translations:f,routeReturnSuccess:O,orderData:m}),error:null};return x("div",{className:B(["order-create-return",a]),children:[r($,{title:f.headerText}),L.heading?r(W,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...L}):null,S[t]]})},me=({routeReturnSuccess:a,translations:s,orderData:c})=>x("div",{className:"order-return-order-message",children:[r("p",{className:"order-return-order-message__title",children:s.successTitle}),r("p",{className:"order-return-order-message__subtitle",children:s.successMessage}),r(F,{href:(a==null?void 0:a(c))??"#",children:s.backStore})]}),ge=({placeholderImage:a,itemsEligibleForReturn:s,slots:c,loading:l,taxConfig:g,translations:O,selectedProductList:d,handleSelectedProductList:f,showConfigurableOptions:L,handleSetQuantity:k,handleChangeStep:p})=>x("ul",{className:"order-return-order-product-list",children:[s==null?void 0:s.map((m,_)=>{const{quantityReturnRequested:R,quantityShipped:y,eligibleForReturn:t}=m,u=d.some(b=>(b==null?void 0:b.productSku)===m.productSku&&m.eligibleForReturn),e=y===R&&t,i=y-R===0?R:y-R;return x("li",{className:B(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",e]]),children:[r(j,{"data-testid":`key_${_}`,name:`key_${_}`,checked:u,disabled:e,onChange:()=>{f({...m,currentReturnOrderQuantity:1})}}),r(ce,{placeholderImage:a,loading:l,product:{...m,totalQuantity:i},itemType:"",taxConfig:g,translations:O,showConfigurableOptions:L,disabledIncrementer:!u,onQuantity:i>1?b=>{k(b,m.productSku)}:void 0}),r(P,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:c==null?void 0:c.ReturnOrderItem})]},m.id)}),r("li",{className:"order-return-order-product-list__item",children:r(F,{type:"button",onClick:()=>p("attributes"),disabled:!d.length,children:O.nextStep})})]}),fe=({placeholderImage:a,slots:s,formsRef:c,selectedProductList:l,loading:g,fieldsConfig:O,translations:d,handleChangeStep:f,onSubmit:L})=>{const{formData:k,errors:p,formRef:m,handleChange:_,handleBlur:R,handleSubmit:y}=U({fieldsConfig:I(O,l==null?void 0:l.length),onSubmit:L});return x("form",{className:"order-return-reason-form",ref:m,onSubmit:y,name:"returnReasonForm",children:[l.map((t,u)=>{var h,v,M,Q,A,T;const e=t==null?void 0:t.giftCard,i=t==null?void 0:t.product,b=ee(O,u),N=`${t==null?void 0:t.id}_${u}`,n=(t==null?void 0:t.currentReturnOrderQuantity)??1,o={...t!=null&&t.currentReturnOrderQuantity?{[d.configurationsListQuantity]:n}:{},...t.configurableOptions||{},...t.bundleOptions||{},...e!=null&&e.senderName?{[d.sender]:e==null?void 0:e.senderName}:{},...e!=null&&e.senderEmail?{[d.sender]:e==null?void 0:e.senderEmail}:{},...e!=null&&e.recipientName?{[d.recipient]:e==null?void 0:e.recipientName}:{},...e!=null&&e.recipientEmail?{[d.recipient]:e==null?void 0:e.recipientEmail}:{},...e!=null&&e.message?{[d.message]:e==null?void 0:e.message}:{},...t!=null&&t.downloadableLinks?{[`${(h=t==null?void 0:t.downloadableLinks)==null?void 0:h.count} ${d.downloadableCount}`]:(v=t==null?void 0:t.downloadableLinks)==null?void 0:v.result}:{}},S=(Q=(M=i==null?void 0:i.thumbnail)==null?void 0:M.url)!=null&&Q.length?i.thumbnail.url:a;return x(K,{children:[r(V,{loading:g,title:r("div",{"data-testid":"product-name",children:(A=t==null?void 0:t.product)==null?void 0:A.name}),sku:r("div",{children:i==null?void 0:i.sku}),image:r(Z,{src:S,alt:((T=i==null?void 0:i.thumbnail)==null?void 0:T.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:o}),r("form",{name:N,ref:c==null?void 0:c.current[u],"data-quantity":n,children:r(z,{className:"className",loading:g,fields:b,onChange:_,onBlur:R,errors:p,values:k})})]},t.id)}),r(P,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:s==null?void 0:s.ReturnFormActions,context:{handleChangeStep:f},children:x("div",{className:"order-return-reason-form__actions",children:[r(F,{variant:"secondary",type:"button",onClick:()=>{f("products")},children:d.backStep}),r(F,{children:d.submit})]})})]})};export{Pe as CreateReturn,Pe as default}; +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/CustomerDetails.js b/scripts/__dropins__/storefront-order/containers/CustomerDetails.js index d3d2deb6ab..75f96d413f 100644 --- a/scripts/__dropins__/storefront-order/containers/CustomerDetails.js +++ b/scripts/__dropins__/storefront-order/containers/CustomerDetails.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as r,jsxs as c,Fragment as L}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as T,classes as _}from"@dropins/tools/lib.js";import{useMemo as S,useState as k,useEffect as E,useCallback as B}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as z}from"@dropins/tools/event-bus.js";import{c as F}from"../chunks/convertCase.js";import{g as q}from"../chunks/getAttributesForm.js";import{Icon as K,Price as G,Card as J,Header as Q}from"@dropins/tools/components.js";import{f as U}from"../chunks/returnOrdersHelper.js";import{f as X}from"../chunks/formatDateToLocale.js";import"../chunks/ShippingStatusCard.js";import*as u from"@dropins/tools/preact-compat.js";import{D as Y}from"../chunks/OrderLoaders.js";import{Text as ee,useText as te}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/getFormValues.js";const re=i=>u.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),ne=i=>u.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.00718 5H22.1507C22.7047 5 23.1579 5.45323 23.1579 6.00718V7.51794C23.1579 7.51794 1.01007 7.58844 1 7.55823V6.00718C1 5.45323 1.45323 5 2.00718 5Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M23.1579 9.78409V18.3451C23.1579 18.899 22.7047 19.3523 22.1507 19.3523H2.00718C1.45323 19.3523 1 18.899 1 18.3451V9.78409H23.1579Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M3.01465 15.9682H8.40305",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.6192 17.5897C18.4535 17.5897 19.1299 16.9133 19.1299 16.0789C19.1299 15.2446 18.4535 14.5682 17.6192 14.5682C16.7848 14.5682 16.1084 15.2446 16.1084 16.0789C16.1084 16.9133 16.7848 17.5897 17.6192 17.5897Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8848 17.5897C20.7192 17.5897 21.3956 16.9133 21.3956 16.0789C21.3956 15.2446 20.7192 14.5682 19.8848 14.5682C19.0504 14.5682 18.374 15.2446 18.374 16.0789C18.374 16.9133 19.0504 17.5897 19.8848 17.5897Z",stroke:"currentColor",strokeWidth:1})),O=(i,e)=>{var d;const m=o=>{const s=Array.isArray(o.value)?o.value.join(" "):o==null?void 0:o.value;return o.label?`${o.label}: ${s}`:s};return(d=i[e])==null?void 0:d.map((o,s)=>r("p",{children:m(o)},`${o.value}${s}`))},oe=i=>{var s,t;const e=i&&i.length>0,m=e?(s=i[0])==null?void 0:s.name:"",d=e?(t=i[0])==null?void 0:t.code:"";return{selectedPaymentMethod:m,selectedPaymentMethodCode:d,hasToDisplayPaymentMethod:e&&m!==""}},ie=({loading:i,order:e,withHeader:m=!0,title:d,paymentIconsMap:o={},normalizeAddress:s,translations:t,slots:l})=>{var D,M,A,N;const g=!!(e!=null&&e.returnNumber),n=(D=e==null?void 0:e.returns)==null?void 0:D[0],h=S(()=>({checkmo:re,card:ne,...o}),[o]);if(!e||i)return r(Y,{});const a=(e==null?void 0:e.email)??"",p=(M=e==null?void 0:e.shipping)==null?void 0:M.code,f=(A=e==null?void 0:e.shipping)==null?void 0:A.amount,w=(N=e==null?void 0:e.shipping)==null?void 0:N.currency,x=e==null?void 0:e.payments,{selectedPaymentMethod:P,selectedPaymentMethodCode:y,hasToDisplayPaymentMethod:H}=oe(x),v=h[y],C=O(s,"shippingAddress")??[],b=O(s,"billingAddress")??[],I=c("div",{className:"order-customer-details-content__container-email",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.emailTitle}),r("p",{children:a})]}),V=g?c("div",{className:"order-customer-details-content__container-return-information","data-testid":"returnDetailsBlock",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.returnInformationTitle}),r("div",{className:"order-customer-details-content__container-description",children:r(T,{"data-testid":"OrderReturnInformation",name:"OrderReturnInformation",slot:l==null?void 0:l.OrderReturnInformation,context:n,children:c(L,{children:[c("p",{children:[t.createdReturnAt,r("span",{children:X(n==null?void 0:n.createdReturnAt)})]}),c("p",{children:[t.returnStatusLabel,r(ee,{id:`Order.CustomerDetails.returnStatus.${U(n==null?void 0:n.returnStatus)}`})]}),c("p",{children:[t.orderNumberLabel,r("span",{children:n==null?void 0:n.orderNumber})]})]})})})]}):null,W=C.length?c("div",{className:"order-customer-details-content__container-shipping_address",children:[r("div",{className:"order-customer-details-content__container-title",children:t.shippingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:C})]}):null,j=b.length?c("div",{className:_(["order-customer-details-content__container-billing_address",["order-customer-details-content__container-billing_address--fullwidth",!C.length]]),children:[r("div",{className:"order-customer-details-content__container-title",children:t.billingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:b})]}):null,R=H?c("div",{className:_(["order-customer-details-content__container-payment_methods",["order-customer-details-content__container-payment_methods--fullwidth",!p]]),children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.paymentMethodsTitle}),c("p",{"data-testid":"payment_methods_description",className:_([["order-customer-details-content__container-payment_methods--icon",!!v]]),children:[r(T,{"data-testid":"PaymentMethodIcon",name:"PaymentMethodIcon",slot:l==null?void 0:l.PaymentMethodIcon,context:{selectedPaymentMethodCode:y},children:v?r(K,{source:v}):null}),P]})]}):null,Z=p?c("div",{className:"order-customer-details-content__container-shipping_methods",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.shippingMethodsTitle}),f?c("p",{"data-testid":"shipping_methods_price",children:[r(G,{amount:f,currency:w})," ",p]}):r("p",{"data-testid":"shipping_methods_placeholder",children:t==null?void 0:t.freeShipping})]}):null,$=g?V:c(L,{children:[j,Z,R]});return c(J,{"data-testid":"order-details",variant:"secondary",className:_(["order-customer-details-content"]),children:[m?r(Q,{title:d??(t==null?void 0:t.headerText)}):null,c("div",{className:_(["order-customer-details-content__container",["order-customer-details-content__container--no-margin",C.length||b.length]]),children:[I,W,$]})]})},se=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],ce=({orderData:i})=>{const[e,m]=k(!0),[d,o]=k(i),[s,t]=k([]);E(()=>{const n=z.on("order/data",h=>{o(h)},{eager:!0});return()=>{n==null||n.off()}},[]),E(()=>{q("shortRequest").then(n=>{if(n){const h=n.map(({name:a,orderNumber:p,label:f})=>({name:F(a),orderNumber:p,label:se.includes(a)?null:f}));t(h)}}).finally(()=>{m(!1)})},[]);const l=B(n=>{if(!s.length||!d||!d[n])return[];const h=Object.fromEntries(Object.entries(d[n]).map(([a,p])=>[a.toLowerCase(),p]));return s.filter(({name:a})=>h[a.toLowerCase()]).map(a=>({name:a.name,orderNumber:a.orderNumber,value:h[a.name.toLowerCase()],label:a.label}))},[s,d]),g=S(()=>({billingAddress:l("billingAddress"),shippingAddress:l("shippingAddress")}),[l]);return{order:d,normalizeAddress:g,loading:e}},Ne=({paymentIconsMap:i,orderData:e,title:m,className:d,slots:o})=>{const s=te({emailTitle:"Order.CustomerDetails.email.title",shippingAddressTitle:"Order.CustomerDetails.shippingAddress.title",shippingMethodsTitle:"Order.CustomerDetails.shippingMethods.title",billingAddressTitle:"Order.CustomerDetails.billingAddress.title",paymentMethodsTitle:"Order.CustomerDetails.paymentMethods.title",returnInformationTitle:"Order.CustomerDetails.returnInformation.title",headerText:"Order.CustomerDetails.headerText",freeShipping:"Order.CustomerDetails.freeShipping",createdReturnAt:"Order.CustomerDetails.orderReturnLabels.createdReturnAt",orderNumberLabel:"Order.CustomerDetails.orderReturnLabels.orderNumberLabel",returnStatusLabel:"Order.CustomerDetails.orderReturnLabels.returnStatusLabel"}),{order:t,normalizeAddress:l,loading:g}=ce({orderData:e});return r("div",{className:_(["order-customer-details",d]),children:r(ie,{slots:o,loading:g,order:t,title:m,paymentIconsMap:i,normalizeAddress:l,translations:s})})};export{Ne as CustomerDetails,Ne as default}; +import{jsx as r,jsxs as c,Fragment as L}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as T,classes as _}from"@dropins/tools/lib.js";import{useMemo as S,useState as k,useEffect as E,useCallback as B}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as z}from"@dropins/tools/event-bus.js";import{c as F}from"../chunks/network-error.js";import{g as q}from"../chunks/getAttributesForm.js";import{Icon as K,Price as G,Card as J,Header as Q}from"@dropins/tools/components.js";import{f as U}from"../chunks/returnOrdersHelper.js";import{f as X}from"../chunks/formatDateToLocale.js";import"../chunks/ShippingStatusCard.js";import*as u from"@dropins/tools/preact-compat.js";import{D as Y}from"../chunks/OrderLoaders.js";import{Text as ee,useText as te}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/getFormValues.js";const re=i=>u.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),ne=i=>u.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...i},u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.00718 5H22.1507C22.7047 5 23.1579 5.45323 23.1579 6.00718V7.51794C23.1579 7.51794 1.01007 7.58844 1 7.55823V6.00718C1 5.45323 1.45323 5 2.00718 5Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M23.1579 9.78409V18.3451C23.1579 18.899 22.7047 19.3523 22.1507 19.3523H2.00718C1.45323 19.3523 1 18.899 1 18.3451V9.78409H23.1579Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M3.01465 15.9682H8.40305",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round"}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.6192 17.5897C18.4535 17.5897 19.1299 16.9133 19.1299 16.0789C19.1299 15.2446 18.4535 14.5682 17.6192 14.5682C16.7848 14.5682 16.1084 15.2446 16.1084 16.0789C16.1084 16.9133 16.7848 17.5897 17.6192 17.5897Z",stroke:"currentColor",strokeWidth:1}),u.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8848 17.5897C20.7192 17.5897 21.3956 16.9133 21.3956 16.0789C21.3956 15.2446 20.7192 14.5682 19.8848 14.5682C19.0504 14.5682 18.374 15.2446 18.374 16.0789C18.374 16.9133 19.0504 17.5897 19.8848 17.5897Z",stroke:"currentColor",strokeWidth:1})),O=(i,e)=>{var d;const m=o=>{const s=Array.isArray(o.value)?o.value.join(" "):o==null?void 0:o.value;return o.label?`${o.label}: ${s}`:s};return(d=i[e])==null?void 0:d.map((o,s)=>r("p",{children:m(o)},`${o.value}${s}`))},oe=i=>{var s,t;const e=i&&i.length>0,m=e?(s=i[0])==null?void 0:s.name:"",d=e?(t=i[0])==null?void 0:t.code:"";return{selectedPaymentMethod:m,selectedPaymentMethodCode:d,hasToDisplayPaymentMethod:e&&m!==""}},ie=({loading:i,order:e,withHeader:m=!0,title:d,paymentIconsMap:o={},normalizeAddress:s,translations:t,slots:l})=>{var D,M,A,N;const g=!!(e!=null&&e.returnNumber),n=(D=e==null?void 0:e.returns)==null?void 0:D[0],h=S(()=>({checkmo:re,card:ne,...o}),[o]);if(!e||i)return r(Y,{});const a=(e==null?void 0:e.email)??"",p=(M=e==null?void 0:e.shipping)==null?void 0:M.code,f=(A=e==null?void 0:e.shipping)==null?void 0:A.amount,w=(N=e==null?void 0:e.shipping)==null?void 0:N.currency,x=e==null?void 0:e.payments,{selectedPaymentMethod:P,selectedPaymentMethodCode:y,hasToDisplayPaymentMethod:H}=oe(x),v=h[y],C=O(s,"shippingAddress")??[],b=O(s,"billingAddress")??[],I=c("div",{className:"order-customer-details-content__container-email",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.emailTitle}),r("p",{children:a})]}),V=g?c("div",{className:"order-customer-details-content__container-return-information","data-testid":"returnDetailsBlock",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.returnInformationTitle}),r("div",{className:"order-customer-details-content__container-description",children:r(T,{"data-testid":"OrderReturnInformation",name:"OrderReturnInformation",slot:l==null?void 0:l.OrderReturnInformation,context:n,children:c(L,{children:[c("p",{children:[t.createdReturnAt,r("span",{children:X(n==null?void 0:n.createdReturnAt)})]}),c("p",{children:[t.returnStatusLabel,r(ee,{id:`Order.CustomerDetails.returnStatus.${U(n==null?void 0:n.returnStatus)}`})]}),c("p",{children:[t.orderNumberLabel,r("span",{children:n==null?void 0:n.orderNumber})]})]})})})]}):null,W=C.length?c("div",{className:"order-customer-details-content__container-shipping_address",children:[r("div",{className:"order-customer-details-content__container-title",children:t.shippingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:C})]}):null,j=b.length?c("div",{className:_(["order-customer-details-content__container-billing_address",["order-customer-details-content__container-billing_address--fullwidth",!C.length]]),children:[r("div",{className:"order-customer-details-content__container-title",children:t.billingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:b})]}):null,R=H?c("div",{className:_(["order-customer-details-content__container-payment_methods",["order-customer-details-content__container-payment_methods--fullwidth",!p]]),children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.paymentMethodsTitle}),c("p",{"data-testid":"payment_methods_description",className:_([["order-customer-details-content__container-payment_methods--icon",!!v]]),children:[r(T,{"data-testid":"PaymentMethodIcon",name:"PaymentMethodIcon",slot:l==null?void 0:l.PaymentMethodIcon,context:{selectedPaymentMethodCode:y},children:v?r(K,{source:v}):null}),P]})]}):null,Z=p?c("div",{className:"order-customer-details-content__container-shipping_methods",children:[r("div",{className:"order-customer-details-content__container-title",children:t==null?void 0:t.shippingMethodsTitle}),f?c("p",{"data-testid":"shipping_methods_price",children:[r(G,{amount:f,currency:w})," ",p]}):r("p",{"data-testid":"shipping_methods_placeholder",children:t==null?void 0:t.freeShipping})]}):null,$=g?V:c(L,{children:[j,Z,R]});return c(J,{"data-testid":"order-details",variant:"secondary",className:_(["order-customer-details-content"]),children:[m?r(Q,{title:d??(t==null?void 0:t.headerText)}):null,c("div",{className:_(["order-customer-details-content__container",["order-customer-details-content__container--no-margin",C.length||b.length]]),children:[I,W,$]})]})},se=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],ce=({orderData:i})=>{const[e,m]=k(!0),[d,o]=k(i),[s,t]=k([]);E(()=>{const n=z.on("order/data",h=>{o(h)},{eager:!0});return()=>{n==null||n.off()}},[]),E(()=>{q("shortRequest").then(n=>{if(n){const h=n.map(({name:a,orderNumber:p,label:f})=>({name:F(a),orderNumber:p,label:se.includes(a)?null:f}));t(h)}}).finally(()=>{m(!1)})},[]);const l=B(n=>{if(!s.length||!d||!d[n])return[];const h=Object.fromEntries(Object.entries(d[n]).map(([a,p])=>[a.toLowerCase(),p]));return s.filter(({name:a})=>h[a.toLowerCase()]).map(a=>({name:a.name,orderNumber:a.orderNumber,value:h[a.name.toLowerCase()],label:a.label}))},[s,d]),g=S(()=>({billingAddress:l("billingAddress"),shippingAddress:l("shippingAddress")}),[l]);return{order:d,normalizeAddress:g,loading:e}},Ae=({paymentIconsMap:i,orderData:e,title:m,className:d,slots:o})=>{const s=te({emailTitle:"Order.CustomerDetails.email.title",shippingAddressTitle:"Order.CustomerDetails.shippingAddress.title",shippingMethodsTitle:"Order.CustomerDetails.shippingMethods.title",billingAddressTitle:"Order.CustomerDetails.billingAddress.title",paymentMethodsTitle:"Order.CustomerDetails.paymentMethods.title",returnInformationTitle:"Order.CustomerDetails.returnInformation.title",headerText:"Order.CustomerDetails.headerText",freeShipping:"Order.CustomerDetails.freeShipping",createdReturnAt:"Order.CustomerDetails.orderReturnLabels.createdReturnAt",orderNumberLabel:"Order.CustomerDetails.orderReturnLabels.orderNumberLabel",returnStatusLabel:"Order.CustomerDetails.orderReturnLabels.returnStatusLabel"}),{order:t,normalizeAddress:l,loading:g}=ce({orderData:e});return r("div",{className:_(["order-customer-details",d]),children:r(ie,{slots:o,loading:g,order:t,title:m,paymentIconsMap:i,normalizeAddress:l,translations:s})})};export{Ae as CustomerDetails,Ae as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js b/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js index 0c44a5a686..a148b2ddf6 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js +++ b/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{O as C,O as F}from"../chunks/OrderCancelForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/transform-customer-orders-returns.js";import"../chunks/convertCase.js";import"../chunks/getGuestOrder.graphql.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";export{C as OrderCancelForm,F as default}; +import{O as C,O as F}from"../chunks/OrderCancelForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/initialize.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/GurestOrderFragment.graphql.js";export{C as OrderCancelForm,F as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js b/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js index 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 bb4523a2ad..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/getGuestOrder.graphql.js";import"../chunks/transform-customer-orders-returns.js";import"../chunks/convertCase.js";const P=r=>_.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},_.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),x=r=>{try{return new URL(window.location.href).searchParams.get(r)}catch{return null}},X=({onError:r,isAuth:t,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c})=>{const[y,u]=v({text:"",type:"success"}),[b,p]=v(!1),m=z({invalidSearch:"Order.Errors.invalidSearch",email:"Order.OrderSearchForm.email",lastname:"Order.OrderSearchForm.lastname",number:"Order.OrderSearchForm.orderNumber"}),R=w(async e=>{const l=x("orderRef"),o=l&&l.length>20;if(!e&&!l||!(e!=null&&e.number)&&!(e!=null&&e.token)&&!l)return null;if(t){const d=await E();(d==null?void 0:d.email)===e.email?f(i,{orderRef:e==null?void 0:e.number}):o||f(c,{orderRef:e.token})}else o||f(c,{orderRef:e==null?void 0:e.token})},[t,i,c]);F(()=>{const e=N.on("order/data",l=>{R(l)},{eager:!0});return()=>{e==null||e.off()}},[R]),F(()=>{const e=x("orderRef"),l=e&&e.length>20?e:null;e&&(l?f(c,{orderRef:e}):t?f(i,{orderRef:e}):a==null||a({render:!0,formValues:{number:e}}))},[t,i,c,a]);const O=D(()=>[{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.email,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.lastname,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:2,name:"lastname",id:"lastname",code:"lastname"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.number,options:[],defaultValue:"",fieldType:g.TEXT,className:"",required:!0,orderNumber:3,name:"number",id:"number",code:"number"}],[m]);return{onSubmit:w(async(e,l)=>{if(!l)return null;p(!0);const o=H(e.target);await B(o).then(n=>{n||u({text:m.invalidSearch,type:"warning"}),N.emit("order/data",n)}).catch(async n=>{var S;let d=!0;r==null||r({error:n.message});const h=t?await E():{email:""};(h==null?void 0:h.email)===(o==null?void 0:o.email)?f(i,{orderRef:o.number}):d=a==null?void 0:a({render:h===null||((S=n==null?void 0:n.message)==null?void 0:S.includes("Please login to view the order.")),formValues:o}),d&&u({text:n.message,type:"warning"})}).finally(()=>{p(!1)})},[t,r,a,i,m.invalidSearch]),inLineAlert:y,loading:b,normalizeFieldsConfig:O}},me=({className:r,isAuth:t,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c,onError:y})=>{const{onSubmit:u,loading:b,inLineAlert:p,normalizeFieldsConfig:m}=X({onError:y,isAuth:t,renderSignIn:a,routeCustomerOrder:i,routeGuestOrder:c});return s("div",{className:L(["order-order-search",r]),children:s(Z,{onSubmit:u,loading:b,inLineAlert:p,fieldsConfig:m})})},Z=({onSubmit:r,loading:t,inLineAlert:a,fieldsConfig:i})=>V(M,{variant:"secondary",className:"order-order-search-form",children:[s("h2",{className:"order-order-search-form__title",children:s(T,{id:"Order.OrderSearchForm.title"})}),s("p",{children:s(T,{id:"Order.OrderSearchForm.description"})}),a.text?s(k,{"data-testid":"orderAlert",className:"order-order-search-form__alert",type:a.type,variant:"secondary",heading:a.text,icon:s(C,{source:P})}):null,s(U,{className:"order-order-search-form__wrapper",name:"orderSearchForm",loading:t,fieldsConfig:i,onSubmit:r,children:s("div",{className:"order-order-search-form__button-container",children:s(q,{className:"order-order-search-form__button",size:"medium",variant:"primary",type:"submit",disabled:t,children:s(T,{id:"Order.OrderSearchForm.button"})},"logIn")})})]});export{me as OrderSearch,me as default}; +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 f889b85251..3e50d674bb 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderStatus.js +++ b/scripts/__dropins__/storefront-order/containers/OrderStatus.js @@ -1,22 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as o,Fragment as S,jsxs as N}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as F,classes as y}from"@dropins/tools/lib.js";import{Button as E,InLineAlert as P,Modal as G,Card as V,Header as K}from"@dropins/tools/components.js";import{useState as g,useEffect as $,useCallback as q}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import{useMemo as H,useState as W}from"@dropins/tools/preact-compat.js";import{u as k}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as v}from"@dropins/tools/event-bus.js";import{G as j}from"../chunks/getGuestOrder.graphql.js";import{f as z,h as B}from"../chunks/fetch-graphql.js";import{b as Q}from"../chunks/transform-customer-orders-returns.js";import{useText as O,Text as b}from"@dropins/tools/i18n.js";import{C as J}from"../chunks/OrderLoaders.js";import{f as X}from"../chunks/returnOrdersHelper.js";import{f as x}from"../chunks/formatDateToLocale.js";import{r as U}from"../chunks/redirectTo.js";import{O as Y}from"../chunks/OrderCancelForm.js";import{r as Z}from"../chunks/reorderItems.js";import"../chunks/getStoreConfig.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";var _=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(_||{});const D=({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=H(()=>{const i=t==null?void 0:t.availableActions,c=!!(i!=null&&i.length),m=!!(t!=null&&t.returnNumber),f=()=>{U(e,{},t)};return o(S,{children:n!=null&&n.OrderActions?o(F,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):o("div",{"data-testid":"availableActionsList",className:y(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!c]]),children:i==null?void 0:i.map(p=>{switch(p){case _.CANCEL:return o(S,{children:m?null:o(se,{orderRef:(t==null?void 0:t.token)??(t==null?void 0:t.id)})});case _.RETURN:return o(E,{variant:"secondary",onClick:f,children:m?d.createAnotherReturn:d.createReturn});case _.REORDER:return o(S,{children:m?null:o(oe,{orderData:t,onError:s,routeOnSuccess:a,children:d.reorder})})}})})})},[s,t,a,e,n,d]);return o("div",{className:y(["order-order-actions",r]),children:l})},ee=({orderData:r})=>{const[t,n]=g(r),[e,a]=g(r==null?void 0:r.status);return $(()=>{const s=v.on("order/data",d=>{n(d),a(d.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},re=` - mutation CONFIRM_CANCEL_ORDER_MUTATION( - $orderId: ID!, - $confirmationKey: String! - ) { - confirmCancelOrder(input: { - order_id: $orderId, - confirmation_key: $confirmationKey - }) { - order { - ...guestOrderData - } - errorV2 { - message - code - } - } - } -${j} -`,te=async(r,t)=>z(re,{variables:{orderId:r,confirmationKey:t}}).then(async({errors:n,data:e})=>{var d,l,i,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(i=e==null?void 0:e.confirmCancelOrder)!=null&&i.order&&(s=Q((c=e==null?void 0:e.confirmCancelOrder)==null?void 0:c.order),v.emit("order/data",s)),a.length>0?B(a):s}),ne=({enableOrderCancellation:r})=>{const t=O({orderCancelled:"Order.OrderStatusContent.orderCanceled.message"}),[n,e]=g({text:"",status:void 0});return $(()=>{if(!r)return;const a=new URLSearchParams(window.location.search),s=a.get("order_id"),d=a.get("confirmation_key");s&&d&&te(s,d).then(()=>{e({text:t.orderCancelled,status:"success"})}).catch(l=>{e({text:l.message,status:"warning"})})},[r,t.orderCancelled]),{confirmOrderCancellation:n}},be=({slots:r,orderData:t,className:n,statusTitle:e,status:a,routeCreateReturn:s,onError:d,routeOnSuccess:l})=>{const{orderStatus:i,order:c}=ee({orderData:t}),[m,f]=W(!1),p=()=>{f(!0);const C=new URL(window.location.href),A=C.searchParams.get("order_id"),T=C.searchParams.get("confirmation_key");A&&T&&(C.searchParams.delete("order_id"),C.searchParams.delete("confirmation_key"),window.history.replaceState({},document.title,C.toString()))},h=O({cancelOrder:"Order.OrderStatusContent.actions.cancel"}),R=k(),{confirmOrderCancellation:u}=ne({enableOrderCancellation:R==null?void 0:R.orderCancellationEnabled});return N("div",{className:y(["order-order-status",n]),children:[!m&&(u==null?void 0:u.status)!==void 0&&o(P,{heading:h.cancelOrder,onDismiss:p,description:u.text,type:u.status}),c?o(ce,{title:e,status:a||i,slots:r,orderData:c,routeCreateReturn:s,onError:d,routeOnSuccess:l}):o(J,{withCard:!1})]})},se=({orderRef:r})=>{const[t,n]=g(!1),e=()=>{n(!0)},a=()=>{n(!1)},s=k(),d=(s==null?void 0:s.orderCancellationReasons)??[],l=i=>i.map((c,m)=>({text:c==null?void 0:c.description,value:m.toString()}));return v.on("order/data",i=>{const c=String(i.status).toLocaleLowerCase();(c==="guest order cancellation requested"||c==="canceled")&&a()}),N(S,{children:[o(E,{variant:"secondary",onClick:e,"data-testid":"cancel-button",children:o(b,{id:"Order.OrderStatusContent.actions.cancel"})}),t&&o(G,{centered:!0,size:"medium",onClose:a,className:"order-order-cancel__modal",title:o("h2",{className:"order-order-cancel__title",children:o(b,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:o(Y,{orderRef:r,cancelReasons:l(d)})})]})},w={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested"},ce=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:a,onError:s,routeOnSuccess:d})=>{var M,I,L;const l=!!(e!=null&&e.returnNumber),i=String(n).toLocaleLowerCase(),c=(M=e==null?void 0:e.returns)==null?void 0:M[0],m=(c==null?void 0:c.returnStatus)??"",f=(c==null?void 0:c.createdReturnAt)??"",p=O(`Order.OrderStatusContent.${w[i]}.title`),h=O(`Order.OrderStatusContent.${w[i]}.message`),R=O(`Order.OrderStatusContent.${w[i]}.messageWithoutDate`),u=O({title:`Order.OrderStatusContent.returnStatus.${X(m)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return o("div",{});const C=e!=null&&e.orderStatusChangeDate?h==null?void 0:h.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):R.messageWithoutDate,A=((L=(I=u==null?void 0:u.returnMessage)==null?void 0:I.replace("{ORDER_CREATE_DATE}",x(e==null?void 0:e.orderDate)))==null?void 0:L.replace("{RETURN_CREATE_DATE}",x(f)))??"",T=l?t??u.title:t??p.title;return N(V,{className:"order-order-status-content",variant:"secondary",children:[o(K,{title:T}),N("div",{className:"order-order-status-content__wrapper",children:[o("div",{className:y(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:o("p",{children:l?A:C})}),o(D,{orderData:e,slots:r,routeCreateReturn:a,routeOnSuccess:d,onError:s})]})]})},oe=({onError:r,routeOnSuccess:t,orderData:n,children:e})=>{const[a,s]=g(!1),d=q(()=>{s(!0);const l=n==null?void 0:n.number;Z(l).then(({success:i,userInputErrors:c})=>{i&&U(t,{}),c.length&&(r==null||r(c))}).catch(i=>{r==null||r(i.message)}).finally(()=>{s(!1)})},[n,t,r]);return o(E,{type:"button",disabled:a,variant:"secondary",className:"order-reorder",onClick:d,children:e})};export{be as OrderStatus,be 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 0f17307321..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 I}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";import{useState as s,useEffect as $,useCallback as y}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import"@dropins/tools/preact-compat.js";import{u as M}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";import{g as A}from"../chunks/getCustomerOrdersReturn.js";import{u as T}from"../chunks/useIsMobile.js";import{R as V}from"../chunks/ReturnsListContent.js";import{useText as k}from"@dropins/tools/i18n.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/network-error.js";import"../chunks/transform-customer-orders-returns.js";import"../chunks/convertCase.js";import"../chunks/returnOrdersHelper.js";import"../chunks/getFormValues.js";import"../chunks/OrderLoaders.js";const g={totalPages:1,currentPage:1,pageSize:1},v=({returnPageSize:t})=>{const[o,n]=s(!0),[i,u]=s([]),[a,m]=s(g),[d,l]=s(1);$(()=>{A(t).then(async r=>{u((r==null?void 0:r.ordersReturn)??[]),m((r==null?void 0:r.pageInfo)??g)}).finally(()=>{n(!1)})},[t]);const c=y(r=>{l(r)},[]);return{pageInfo:a,selectedPage:d,loading:o,orderReturns:i,handleSetSelectPage:c}},tr=({slots:t,withReturnsListButton:o,className:n,minifiedView:i,withHeader:u,withThumbnails:a,returnPageSize:m,returnsInMinifiedView:d,routeReturnDetails:l,routeOrderDetails:c,routeTracking:r,routeReturnsList:L,routeProductDetails:R})=>{const f=M(),{pageInfo:O,selectedPage:b,handleSetSelectPage:w,loading:N,orderReturns:P}=v({returnPageSize:m}),S=T(),e=i?"minifiedView":"fullSizeView",h=k({viewAllOrdersButton:`Order.Returns.${e}.returnsList.viewAllOrdersButton`,ariaLabelLink:`Order.Returns.${e}.returnsList.ariaLabelLink`,emptyOrdersListMessage:`Order.Returns.${e}.returnsList.emptyOrdersListMessage`,minifiedViewTitle:`Order.Returns.${e}.returnsList.minifiedViewTitle`,orderNumber:`Order.Returns.${e}.returnsList.orderNumber`,returnNumber:`Order.Returns.${e}.returnsList.returnNumber`,carrier:`Order.Returns.${e}.returnsList.carrier`});return p("div",{className:I(["order-returns-list",n]),children:p(V,{placeholderImage:(f==null?void 0:f.baseMediaUrl)??"",minifiedViewKey:e,withOrderNumber:!0,withReturnNumber:!0,slots:t,selectedPage:b,handleSetSelectPage:w,pageInfo:O,withReturnsListButton:o,isMobile:S,orderReturns:P,translations:h,withHeader:u,returnsInMinifiedView:d,withThumbnails:a,minifiedView:i,routeReturnDetails:l,routeOrderDetails:c,routeTracking:r,routeReturnsList:L,routeProductDetails:R,loading:N})})};export{tr as default}; +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/context/ConfigStoreContext.d.ts b/scripts/__dropins__/storefront-order/context/ConfigStoreContext.d.ts deleted file mode 100644 index f11f3943aa..0000000000 --- a/scripts/__dropins__/storefront-order/context/ConfigStoreContext.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export declare const ConfigStoreProvider: ({ children }: any) => import("preact").JSX.Element; -export declare const useConfig: () => { - placeholderImage: string; - taxConfig: { - taxIncluded: boolean; - taxExcluded: boolean; - }; -}; -//# sourceMappingURL=ConfigStoreContext.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/data/models/index.d.ts b/scripts/__dropins__/storefront-order/data/models/index.d.ts index 82e3b25717..33d6b55695 100644 --- a/scripts/__dropins__/storefront-order/data/models/index.d.ts +++ b/scripts/__dropins__/storefront-order/data/models/index.d.ts @@ -2,6 +2,7 @@ export * from './acdl'; export * from './attributes-form'; export * from './customer'; export * from './customer-orders-return'; +export * from './request-return'; export * from './order-details'; export * from './store-config'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/data/models/order-details.d.ts b/scripts/__dropins__/storefront-order/data/models/order-details.d.ts index 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/data/transforms/index.d.ts b/scripts/__dropins__/storefront-order/data/transforms/index.d.ts index 2d69442ddd..a10f2a7e82 100644 --- a/scripts/__dropins__/storefront-order/data/transforms/index.d.ts +++ b/scripts/__dropins__/storefront-order/data/transforms/index.d.ts @@ -7,4 +7,5 @@ export * from './transform-guest-order'; export * from './transform-order-details'; export * from './transform-place-order'; export * from './transform-store-config'; +export * from './transform-request-return'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/data/transforms/transform-request-return.d.ts b/scripts/__dropins__/storefront-order/data/transforms/transform-request-return.d.ts new file mode 100644 index 0000000000..487d8f8cf4 --- /dev/null +++ b/scripts/__dropins__/storefront-order/data/transforms/transform-request-return.d.ts @@ -0,0 +1,5 @@ +import { RequestReturnResponse } from '../../types'; +import { RequestReturnModel } from '../models'; + +export declare const transformRequestReturn: (response: RequestReturnResponse) => RequestReturnModel | {}; +//# sourceMappingURL=transform-request-return.d.ts.map \ No newline at end of file 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/containers/useOrderCostSummary.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useOrderCostSummary.d.ts index 12c733ecf5..e5fdda0bad 100644 --- a/scripts/__dropins__/storefront-order/hooks/containers/useOrderCostSummary.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/containers/useOrderCostSummary.d.ts @@ -1,7 +1,7 @@ import { OrderDataModel } from '../../data/models'; import { StoreConfigProps, UseOrderCostSummaryProps } from '../../types'; -export declare const useOrderCostSummary: ({ orderData, config }: UseOrderCostSummaryProps) => { +export declare const useOrderCostSummary: ({ orderData, config, }: UseOrderCostSummaryProps) => { loading: boolean; storeConfig: StoreConfigProps | null; order: OrderDataModel | undefined; 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 edd3dafb0f..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,10 +183,17 @@ 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" }, + "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.", @@ -227,9 +234,44 @@ 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." + }, + "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": { diff --git a/scripts/__dropins__/storefront-order/lib/capitalizeFirst.d.ts b/scripts/__dropins__/storefront-order/lib/capitalizeFirst.d.ts new file mode 100644 index 0000000000..18269aab6f --- /dev/null +++ b/scripts/__dropins__/storefront-order/lib/capitalizeFirst.d.ts @@ -0,0 +1,2 @@ +export declare const capitalizeFirst: (str: string) => string; +//# sourceMappingURL=capitalizeFirst.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/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/reload b/scripts/__dropins__/storefront-order/reload deleted file mode 100644 index 81fd586dc6..0000000000 --- a/scripts/__dropins__/storefront-order/reload +++ /dev/null @@ -1 +0,0 @@ -{"at":1733252071636} \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/render.js b/scripts/__dropins__/storefront-order/render.js index 9e267a2262..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 .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 n}from"@dropins/tools/lib.js";import{useState as s,useEffect as d}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as u}from"@dropins/tools/event-bus.js";const c={CreateReturn:{headerText:"Return items",downloadableCount:"Files",returnedItems:"Returned items:",configurationsList:{quantity:"Quantity"},stockStatus:{inStock:"In stock",outOfStock:"Out of stock"},giftCard:{sender:"Sender",recipient:"Recipient",message:"Note"},success:{title:"Return submitted",message:"Your return request has been successfully submitted."},buttons:{nextStep:"Continue",backStep:"Back",submit:"Submit return",backStore:"Back to order"}},OrderCostSummary:{headerText:"Order summary",headerReturnText:"Return summary",subtotal:{title:"Subtotal"},shipping:{title:"Shipping",freeShipping:"Free shipping"},tax:{accordionTitle:"Taxes",accordionTotalTax:"Tax Total",totalExcludingTaxes:"Total excluding taxes",title:"Tax",incl:"Including taxes",excl:"Excluding taxes"},discount:{title:"Discount",subtitle:"discounted"},total:{title:"Total"}},Returns:{minifiedView:{returnsList:{viewAllOrdersButton:"View all returns",ariaLabelLink:"Redirect to full order information",emptyOrdersListMessage:"No returns",minifiedViewTitle:"Recent returns",orderNumber:"Order number:",returnNumber:"Return number:",carrier:"Carrier:",itemText:{none:"",one:"item",many:"items"},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"}}},fullSizeView:{returnsList:{viewAllOrdersButton:"View all orders",ariaLabelLink:"Redirect to full order information",emptyOrdersListMessage:"No returns",minifiedViewTitle:"Returns",orderNumber:"Order number:",returnNumber:"Return number:",carrier:"Carrier:",itemText:{none:"",one:"item",many:"items"},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"}}}},OrderProductListContent:{cancelledTitle:"Cancelled",allOrdersTitle:"Your order",returnedTitle:"Returned",refundedTitle:"Your refunded",downloadableCount:"Files",stockStatus:{inStock:"In stock",outOfStock:"Out of stock"},GiftCard:{sender:"Sender",recipient:"Recipient",message:"Note"}},OrderSearchForm:{title:"Enter your information to view order details",description:"You can find your order number in the receipt you received via email.",button:"View Order",email:"Email",lastname:"Last Name",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},ShippingStatusCard:{orderNumber:"Order number:",returnNumber:"Return number:",itemText:{none:"",one:"Package contents ({{count}} item)",many:"Package contents ({{count}} items)"},trackButton:"Track package",carrier:"Carrier:",prepositionOf:"of",returnOrderCardTitle:"Package details",shippingCardTitle:"Package details",shippingInfoTitle:"Shipping information",notYetShippedTitle:"Not yet shipped",notYetShippedImagesTitle:{singular:"Package contents ({{count}} item)",plural:"Package contents ({{count}} items)"}},OrderStatusContent:{noInfoTitle:"Check back later for more details.",returnMessage:"The order was placed on {ORDER_CREATE_DATE} and your return process started on {RETURN_CREATE_DATE}",returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."},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:c},m={default:p},h=({children:t})=>{const[o,i]=s("en_US");return d(()=>{const e=u.on("locale",a=>{i(a)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},R=new n(r(h,{}));export{R 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