From 2eb34af91f5895cb5662732ca134cedc76d5c6d1 Mon Sep 17 00:00:00 2001 From: Abrasimov Yaroslav Date: Fri, 8 Nov 2024 18:42:40 +0100 Subject: [PATCH 01/30] Integrate CreateReturn container --- .../commerce-create-return.css | 5 +++++ .../commerce-create-return.js | 15 +++++++++++++++ .../commerce-order-status.js | 13 ++++++++++++- scripts/constants.js | 2 ++ scripts/initializers/order.js | 6 +++++- 5 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 blocks/commerce-create-return/commerce-create-return.css create mode 100644 blocks/commerce-create-return/commerce-create-return.js diff --git a/blocks/commerce-create-return/commerce-create-return.css b/blocks/commerce-create-return/commerce-create-return.css new file mode 100644 index 0000000000..8b401f767f --- /dev/null +++ b/blocks/commerce-create-return/commerce-create-return.css @@ -0,0 +1,5 @@ +/* stylelint-disable no-empty-source */ + +body:not(.columns) main div.order-create-return { + margin-top: var(--spacing-large); +} diff --git a/blocks/commerce-create-return/commerce-create-return.js b/blocks/commerce-create-return/commerce-create-return.js new file mode 100644 index 0000000000..5f1e325b2b --- /dev/null +++ b/blocks/commerce-create-return/commerce-create-return.js @@ -0,0 +1,15 @@ +/* eslint-disable import/no-unresolved */ +/* eslint-disable import/no-extraneous-dependencies */ +import { render as orderRenderer } from '@dropins/storefront-order/render.js'; +import { CreateReturn } from '@dropins/storefront-order/containers/CreateReturn.js'; +import { checkIsAuthenticated } from '../../scripts/configs.js'; +import { ORDER_DETAILS_PATH, CUSTOMER_ORDER_DETAILS_PATH } from '../../scripts/constants.js'; + +// Initialize +import '../../scripts/initializers/order.js'; + +export default async function decorate(block) { + await orderRenderer.render(CreateReturn, { + routeReturnSuccess: (orderData) => (checkIsAuthenticated() ? `${CUSTOMER_ORDER_DETAILS_PATH}?orderRef=${orderData.number}` : `${ORDER_DETAILS_PATH}?orderRef=${orderData.token}`), + })(block); +} diff --git a/blocks/commerce-order-status/commerce-order-status.js b/blocks/commerce-order-status/commerce-order-status.js index d47b0061a6..313f56686e 100644 --- a/blocks/commerce-order-status/commerce-order-status.js +++ b/blocks/commerce-order-status/commerce-order-status.js @@ -3,13 +3,24 @@ import { render as orderRenderer } from '@dropins/storefront-order/render.js'; import { OrderStatus } from '@dropins/storefront-order/containers/OrderStatus.js'; import { checkIsAuthenticated } from '../../scripts/configs.js'; +import { CREATE_RETURN_PATH, CUSTOMER_CREATE_RETURN_PATH } from '../../scripts/constants.js'; // Initialize import '../../scripts/initializers/order.js'; export default async function decorate(block) { await orderRenderer.render(OrderStatus, { - routeCreateReturn: (orderData) => (checkIsAuthenticated() ? `/customer/create-return?orderId=${orderData.id}` : `/create-return?orderId=${orderData.id}`), + routeCreateReturn: ({ token, number: orderNumber }) => { + const isAuthenticated = checkIsAuthenticated(); + + const { searchParams } = new URL(window.location.href); + const orderRefFromUrl = searchParams.get('orderRef'); + const newOrderRef = isAuthenticated ? orderNumber : token; + + const encodedOrderRef = encodeURIComponent(orderRefFromUrl || newOrderRef); + + return checkIsAuthenticated() ? `${CUSTOMER_CREATE_RETURN_PATH}?orderRef=${encodedOrderRef}` : `${CREATE_RETURN_PATH}?orderRef=${encodedOrderRef}`; + }, routeOnSuccess: () => '/cart', })(block); } diff --git a/scripts/constants.js b/scripts/constants.js index 73493043c3..0a1c3b29f8 100644 --- a/scripts/constants.js +++ b/scripts/constants.js @@ -4,11 +4,13 @@ export const SUPPORT_PATH = '/support'; export const ORDER_STATUS_PATH = '/order-status'; export const ORDER_DETAILS_PATH = '/order-details'; export const RETURN_DETAILS_PATH = '/return-details'; +export const CREATE_RETURN_PATH = '/create-return'; // CUSTOMER export const CUSTOMER_PATH = '/customer'; export const CUSTOMER_ORDER_DETAILS_PATH = `${CUSTOMER_PATH}${ORDER_DETAILS_PATH}`; export const CUSTOMER_RETURN_DETAILS_PATH = `${CUSTOMER_PATH}${RETURN_DETAILS_PATH}`; +export const CUSTOMER_CREATE_RETURN_PATH = `${CUSTOMER_PATH}${CREATE_RETURN_PATH}`; export const CUSTOMER_ORDERS_PATH = `${CUSTOMER_PATH}/orders`; export const CUSTOMER_RETURNS_PATH = `${CUSTOMER_PATH}/returns`; export const CUSTOMER_ADDRESS_PATH = `${CUSTOMER_PATH}/address`; diff --git a/scripts/initializers/order.js b/scripts/initializers/order.js index 1c92fcb421..5b2828e383 100644 --- a/scripts/initializers/order.js +++ b/scripts/initializers/order.js @@ -10,6 +10,8 @@ import { ORDER_DETAILS_PATH, CUSTOMER_RETURN_DETAILS_PATH, RETURN_DETAILS_PATH, + CUSTOMER_CREATE_RETURN_PATH, + CREATE_RETURN_PATH, CUSTOMER_ORDERS_PATH, ORDER_STATUS_PATH, CUSTOMER_PATH, @@ -26,7 +28,9 @@ await initializeDropin(async () => { if (pathname === ORDER_DETAILS_PATH || pathname === CUSTOMER_ORDER_DETAILS_PATH || pathname === RETURN_DETAILS_PATH - || pathname === CUSTOMER_RETURN_DETAILS_PATH) { + || pathname === CUSTOMER_RETURN_DETAILS_PATH + || pathname === CREATE_RETURN_PATH + || pathname === CUSTOMER_CREATE_RETURN_PATH) { await handleUserOrdersRedirects(pathname, isAccountPage, orderRef, returnRef, isTokenProvided); } })(); From 35591359c48fb3d2fcda497432f7084aa3bd51aa Mon Sep 17 00:00:00 2001 From: Abrasimov Yaroslav Date: Fri, 8 Nov 2024 18:44:04 +0100 Subject: [PATCH 02/30] Add order build (manually) --- scripts/__dropins__/storefront-order/api.js | 44 +- .../getAttributesList/getAttributesList.d.ts | 5 + .../graphql/getAttributesList.graphql.d.ts | 2 + .../api/getAttributesList/index.d.ts | 2 + .../graphql/orderItemsFragment.graphql.d.ts | 2 +- .../storefront-order/api/index.d.ts | 2 + .../graphql/requestReturn.graphql.d.ts | 2 + .../api/requestReturn/index.d.ts | 2 + .../api/requestReturn/requestReturn.d.ts | 9 + .../storefront-order/chunks/OrderCancel.js | 2 +- .../chunks/OrderCancelForm.js | 2 +- .../chunks/ReturnsListContent.js | 2 +- .../storefront-order/chunks/convertCase.js | 2 +- .../storefront-order/chunks/form.types.js | 3 + .../chunks/getAttributesForm.js | 6 +- .../storefront-order/chunks/getCustomer.js | 2 +- .../storefront-order/chunks/getFormValues.js | 3 + .../chunks/getGuestOrder.graphql.js | 7 +- .../storefront-order/chunks/requestReturn.js | 47 + .../chunks/returnOrdersHelper.js | 2 +- .../chunks/transform-attributes-form.js | 3 + .../chunks/transform-order-details.js | 7 +- .../ReturnOrderMessage.d.ts | 5 + .../components/ReturnOrderMessage/index.d.ts | 3 + .../ReturnOrderProductList.d.ts | 5 + .../ReturnOrderProductList/index.d.ts | 3 + .../ReturnReasonForm/ReturnReasonForm.d.ts | 5 + .../components/ReturnReasonForm/index.d.ts | 3 + .../storefront-order/components/index.d.ts | 3 + .../storefront-order/configs/mock.config.d.ts | 1169 +++++++++++++++++ .../containers/CreateReturn.d.ts | 3 + .../containers/CreateReturn.js | 3 + .../containers/CreateReturn/CreateReturn.d.ts | 5 + .../containers/CreateReturn/index.d.ts | 3 + .../containers/CustomerDetails.js | 2 +- .../containers/OrderCancelForm.js | 2 +- .../containers/OrderCostSummary.js | 2 +- .../containers/OrderProductList.js | 2 +- .../containers/OrderReturns.js | 2 +- .../containers/OrderSearch.js | 2 +- .../containers/OrderStatus.js | 4 +- .../containers/ReturnsList.js | 2 +- .../containers/ShippingStatus.js | 2 +- .../storefront-order/containers/index.d.ts | 1 + .../data/models/attributes-form.d.ts | 23 +- .../data/models/order-details.d.ts | 7 +- .../transforms/transform-attributes-form.d.ts | 5 +- .../storefront-order/hooks/index.d.ts | 4 +- .../hooks/useInLineAlert.d.ts | 7 + .../storefront-order/i18n/en_US.json.d.ts | 32 +- .../lib/returnOrdersHelper.d.ts | 82 ++ .../__dropins__/storefront-order/render.js | 4 +- .../types/createReturn.types.d.ts | 69 + .../storefront-order/types/form.types.d.ts | 2 +- .../storefront-order/types/index.d.ts | 4 + .../types/notification.types.d.ts | 14 + .../types/orderProductList.types.d.ts | 9 +- 57 files changed, 1580 insertions(+), 71 deletions(-) create mode 100644 scripts/__dropins__/storefront-order/api/getAttributesList/getAttributesList.d.ts create mode 100644 scripts/__dropins__/storefront-order/api/getAttributesList/graphql/getAttributesList.graphql.d.ts create mode 100644 scripts/__dropins__/storefront-order/api/getAttributesList/index.d.ts create mode 100644 scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts create mode 100644 scripts/__dropins__/storefront-order/api/requestReturn/index.d.ts create mode 100644 scripts/__dropins__/storefront-order/api/requestReturn/requestReturn.d.ts create mode 100644 scripts/__dropins__/storefront-order/chunks/form.types.js create mode 100644 scripts/__dropins__/storefront-order/chunks/getFormValues.js create mode 100644 scripts/__dropins__/storefront-order/chunks/requestReturn.js create mode 100644 scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js create mode 100644 scripts/__dropins__/storefront-order/components/ReturnOrderMessage/ReturnOrderMessage.d.ts create mode 100644 scripts/__dropins__/storefront-order/components/ReturnOrderMessage/index.d.ts create mode 100644 scripts/__dropins__/storefront-order/components/ReturnOrderProductList/ReturnOrderProductList.d.ts create mode 100644 scripts/__dropins__/storefront-order/components/ReturnOrderProductList/index.d.ts create mode 100644 scripts/__dropins__/storefront-order/components/ReturnReasonForm/ReturnReasonForm.d.ts create mode 100644 scripts/__dropins__/storefront-order/components/ReturnReasonForm/index.d.ts create mode 100644 scripts/__dropins__/storefront-order/containers/CreateReturn.d.ts create mode 100644 scripts/__dropins__/storefront-order/containers/CreateReturn.js create mode 100644 scripts/__dropins__/storefront-order/containers/CreateReturn/CreateReturn.d.ts create mode 100644 scripts/__dropins__/storefront-order/containers/CreateReturn/index.d.ts create mode 100644 scripts/__dropins__/storefront-order/hooks/useInLineAlert.d.ts create mode 100644 scripts/__dropins__/storefront-order/types/createReturn.types.d.ts create mode 100644 scripts/__dropins__/storefront-order/types/notification.types.d.ts diff --git a/scripts/__dropins__/storefront-order/api.js b/scripts/__dropins__/storefront-order/api.js index 69462980d3..1609d77c30 100644 --- a/scripts/__dropins__/storefront-order/api.js +++ b/scripts/__dropins__/storefront-order/api.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{Initializer as I}from"@dropins/tools/lib.js";import{events as d}from"@dropins/tools/event-bus.js";import{f as n,h as m}from"./chunks/fetch-graphql.js";import{g as P,r as U,s as Y,a as q,b as Q}from"./chunks/fetch-graphql.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as _,G as c,O as p,B as O,R as h,c as T}from"./chunks/transform-order-details.js";import{O as D,A as R}from"./chunks/getGuestOrder.graphql.js";import{t as G}from"./chunks/getCustomer.js";import{a as H,g as K}from"./chunks/getCustomer.js";import{g as J}from"./chunks/getAttributesForm.js";import{g as W}from"./chunks/getStoreConfig.js";import{g as Z}from"./chunks/getCustomerOrdersReturn.js";import{c as re,r as te}from"./chunks/requestGuestOrderCancel.js";import{r as se}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";const b=` +import{Initializer as I}from"@dropins/tools/lib.js";import{events as d}from"@dropins/tools/event-bus.js";import{f as n,h as m}from"./chunks/fetch-graphql.js";import{g as U,r as q,s as z,a as Y,b as Q}from"./chunks/fetch-graphql.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as _,G as p,O as c,B as O,R as D,c as b}from"./chunks/transform-order-details.js";import{O as h,A as R}from"./chunks/getGuestOrder.graphql.js";import{t as f}from"./chunks/getCustomer.js";import{g as K,a as j}from"./chunks/getCustomer.js";import{g as V}from"./chunks/getAttributesForm.js";import{g as X}from"./chunks/getStoreConfig.js";import{g as ee}from"./chunks/getCustomerOrdersReturn.js";import{g as te,r as ae}from"./chunks/requestReturn.js";import{c as de,r as oe}from"./chunks/requestGuestOrderCancel.js";import{r as ne}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";import"./chunks/transform-attributes-form.js";const G=` query ORDER_BY_NUMBER($orderNumber: String!) { customer { orders( @@ -17,9 +17,28 @@ query ORDER_BY_NUMBER($orderNumber: String!) { carrier shipping_method is_virtual - returns { + returns(pageSize: 50) { ...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 } @@ -88,13 +107,13 @@ query ORDER_BY_NUMBER($orderNumber: String!) { } ${u} ${_} -${c} ${p} +${c} ${O} -${D} -${R} ${h} -`,f=async(e,r,t)=>await n(b,{method:"GET",cache:"force-cache",variables:{orderNumber:e}}).then(a=>{var s;return(s=a.errors)!=null&&s.length?m(a.errors):T(t??"orderData",a,r)}).catch(l),y=` +${R} +${D} +`,T=async(e,r,t)=>await n(G,{method:"GET",cache:"force-cache",variables:{orderNumber:e}}).then(a=>{var s;return(s=a.errors)!=null&&s.length?m(a.errors):b(t??"orderData",a,r)}).catch(l),g=` query ORDER_BY_TOKEN($token: String!) { guestOrderByToken(input: { token: $token }) { email @@ -110,7 +129,10 @@ query ORDER_BY_TOKEN($token: String!) { gift_receipt_included available_actions is_virtual - returns { + items_eligible_for_return { + ...OrderItemDetails + } + returns(pageSize: 50) { ...OrderReturns } payment_methods { @@ -182,10 +204,10 @@ query ORDER_BY_TOKEN($token: String!) { } ${u} ${_} -${c} ${p} +${c} ${O} -${D} -${R} ${h} -`,A=async(e,r)=>await n(y,{method:"GET",cache:"no-cache",variables:{token:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?m(t.errors):G(t,r)}).catch(l),$=async e=>{var i;const r=(e==null?void 0:e.orderRef)??"",t=(e==null?void 0:e.returnRef)??"",a=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((i=e==null?void 0:e.orderRef)==null?void 0:i.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){d.emit("order/data",{...s,returnNumber:t});return}if(!r){console.error("Order Token or number not received.");return}const o=a?await A(r,t):await f(r,t,"orderData");o?d.emit("order/data",{...o,returnNumber:t}):d.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},E=new I({init:async e=>{const r={};E.config.setConfig({...r,...e}),$(e).catch(console.error)},listeners:()=>[]}),v=E.config;export{re as cancelOrder,v as config,n as fetchGraphQl,J as getAttributesForm,P as getConfig,H as getCustomer,Z as getCustomerOrdersReturn,K as getGuestOrder,f as getOrderDetailsById,W as getStoreConfig,A as guestOrderByToken,E as initialize,U as removeFetchGraphQlHeader,se as reorderItems,te as requestGuestOrderCancel,Y as setEndpoint,q as setFetchGraphQlHeader,Q as setFetchGraphQlHeaders}; +${R} +${D} +`,A=async(e,r)=>await n(g,{method:"GET",cache:"no-cache",variables:{token:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?m(t.errors):f(t,r)}).catch(l),y=async e=>{var i;const r=(e==null?void 0:e.orderRef)??"",t=(e==null?void 0:e.returnRef)??"",a=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((i=e==null?void 0:e.orderRef)==null?void 0:i.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){d.emit("order/data",{...s,returnNumber:t});return}if(!r){console.error("Order Token or number not received.");return}const o=a?await A(r,t):await T(r,t,"orderData");o?d.emit("order/data",{...o,returnNumber:t}):d.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},E=new I({init:async e=>{const r={};E.config.setConfig({...r,...e}),y(e).catch(console.error)},listeners:()=>[]}),v=E.config;export{de as cancelOrder,v as config,n as fetchGraphQl,V as getAttributesForm,te as getAttributesList,U as getConfig,K as getCustomer,ee as getCustomerOrdersReturn,j as getGuestOrder,T as getOrderDetailsById,X as getStoreConfig,A as guestOrderByToken,E as initialize,q as removeFetchGraphQlHeader,ne as reorderItems,oe as requestGuestOrderCancel,ae as requestReturn,z as setEndpoint,Y as setFetchGraphQlHeader,Q as setFetchGraphQlHeaders}; diff --git a/scripts/__dropins__/storefront-order/api/getAttributesList/getAttributesList.d.ts b/scripts/__dropins__/storefront-order/api/getAttributesList/getAttributesList.d.ts new file mode 100644 index 0000000000..d0a1d0bbec --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/getAttributesList/getAttributesList.d.ts @@ -0,0 +1,5 @@ +import { AttributesFormModel } from '../../data/models'; + +export declare const getAttributesList: (entityType: string) => Promise; +//# sourceMappingURL=getAttributesList.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/getAttributesList/graphql/getAttributesList.graphql.d.ts b/scripts/__dropins__/storefront-order/api/getAttributesList/graphql/getAttributesList.graphql.d.ts new file mode 100644 index 0000000000..cc05caa302 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/getAttributesList/graphql/getAttributesList.graphql.d.ts @@ -0,0 +1,2 @@ +export declare const GET_ATTRIBUTES_LIST = "\n query GET_ATTRIBUTES_LIST($entityType: AttributeEntityTypeEnum!) {\n attributesList(entityType: $entityType) {\n items {\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n ... on ReturnItemAttributeMetadata {\n sort_order\n }\n code\n label\n default_value\n frontend_input\n is_unique\n is_required\n options {\n is_default\n label\n value\n }\n }\n errors {\n type\n message\n }\n }\n }\n"; +//# sourceMappingURL=getAttributesList.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/getAttributesList/index.d.ts b/scripts/__dropins__/storefront-order/api/getAttributesList/index.d.ts new file mode 100644 index 0000000000..c226df6d13 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/getAttributesList/index.d.ts @@ -0,0 +1,2 @@ +export * from './getAttributesList'; +//# 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 index 7edf396967..423e9d49c4 100644 --- a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts +++ b/scripts/__dropins__/storefront-order/api/getOrderDetailsById/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_name\n product_url_key\n id\n quantity_ordered\n quantity_shipped\n quantity_canceled\n quantity_invoiced\n quantity_refunded\n quantity_returned\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 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 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/index.d.ts b/scripts/__dropins__/storefront-order/api/index.d.ts index 0bdab16aa0..73b1a3e4db 100644 --- a/scripts/__dropins__/storefront-order/api/index.d.ts +++ b/scripts/__dropins__/storefront-order/api/index.d.ts @@ -7,6 +7,8 @@ export * from './getAttributesForm'; export * from './getCustomer'; export * from './getStoreConfig'; export * from './getCustomerOrdersReturn'; +export * from './getAttributesList'; +export * from './requestReturn'; export * from './cancelOrder'; export * from './requestGuestOrderCancel'; export * from './reorderItems'; diff --git a/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts b/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts new file mode 100644 index 0000000000..e543a059fe --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts @@ -0,0 +1,2 @@ +export declare const REQUEST_RETURN_ORDER = "\nmutation REQUEST_RETURN_ORDER($input: RequestReturnInput!) {\n requestReturn(input: $input) {\n return {\n uid\n status\n number\n created_at\n }\n }\n}\n"; +//# sourceMappingURL=requestReturn.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/requestReturn/index.d.ts b/scripts/__dropins__/storefront-order/api/requestReturn/index.d.ts new file mode 100644 index 0000000000..46e713fe3f --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/requestReturn/index.d.ts @@ -0,0 +1,2 @@ +export * from './requestReturn'; +//# sourceMappingURL=index.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 new file mode 100644 index 0000000000..8f385843e8 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/requestReturn/requestReturn.d.ts @@ -0,0 +1,9 @@ +import { RequestReturnProps } from '../../types'; + +export declare const requestReturn: (form: RequestReturnProps) => Promise<{ + uid: string; + number: string; + status: string; + createdAt: string; +}>; +//# sourceMappingURL=requestReturn.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/chunks/OrderCancel.js b/scripts/__dropins__/storefront-order/chunks/OrderCancel.js index 80820a2827..3e61b1f999 100644 --- a/scripts/__dropins__/storefront-order/chunks/OrderCancel.js +++ b/scripts/__dropins__/storefront-order/chunks/OrderCancel.js @@ -1,3 +1,3 @@ /*! 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:c})=>($&&(u[i]=c),u),{}),S=({fieldsConfig:l,onSubmit:u})=>{const{requiredFieldError:i}=y({requiredFieldError:"Order.Form.notifications.requiredFieldError"}),$=_(null),[c,n]=D({}),[o,t]=D({});w(()=>{if(n({}),!l||!l.length)return;const s=H(l);n(s)},[l==null?void 0:l.length]),w(()=>()=>{var s;n({}),(s=$.current)==null||s.reset()},[]);const p=T((s,e)=>{const r=l.find(d=>d.code===s);return r!=null&&r.required&&!e?i:""},[l,i]),b=T(s=>{const{name:e,value:r,type:a,checked:d}=s==null?void 0:s.target,f=a==="checkbox"?d:r;n(E=>({...E,[e]:f}))},[]),x=T(s=>{const{name:e,value:r,type:a,checked:d}=s==null?void 0:s.target,f=a==="checkbox"?d:r;t(E=>({...E,[e]:p(e,f)}))},[p]),F=T(s=>{s.preventDefault();let e=!0,r={},a=null;for(const[d,f]of Object.entries(c)){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(s,e)},[c,p,u]);return{formData:c,errors:o,formRef:$,handleChange:b,handleBlur:x,handleSubmit:F}},U=V(({loading:l,values:u,fields:i=[],errors:$,className:c="",onChange:n,onBlur:o})=>{const t=`${c}__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":`${c}--${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)},[c,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":`${c}--${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)},[c,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":`${c}--${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),[c,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":`${c}--${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),[c,l,t,o,n]),s=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":`${c}--${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),[c,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 s(e,a,r);default:return null}})}):null}),K=V(({name:l,loading:u,children:i,className:$="defaultForm",fieldsConfig:c,onSubmit:n})=>{const{formData:o,errors:t,formRef:p,handleChange:b,handleBlur:x,handleSubmit:F}=S({fieldsConfig:c,onSubmit:n});return M("form",{className:k(["order-form",$]),onSubmit:F,name:l,ref:p,children:[h(U,{className:$,loading:u,fields:c,onChange:b,onBlur:x,errors:t,values:o}),i]})});export{K as F}; +import{jsx as c,Fragment as R,jsxs as L}from"@dropins/tools/preact-jsx-runtime.js";import{Field as x,Picker as ne,Input as re,InputDate as te,Checkbox as ee,TextArea as se,Price as he,CartItem as ue,Icon as de,Image as P,Incrementer as ie,Button as ce}from"@dropins/tools/components.js";import"@dropins/tools/preact.js";import{useRef as be,useState as g,useEffect as p,useCallback as V}from"@dropins/tools/preact-hooks.js";import{useText as oe}from"@dropins/tools/i18n.js";import*as q from"@dropins/tools/preact-compat.js";import{memo as ae,useCallback as F}from"@dropins/tools/preact-compat.js";import{classes as _,Slot as $e}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const me=s=>q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},q.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"}),q.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"}),q.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"})),Ee=s=>q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),ve=s=>s.reduce((e,{code:v,required:m,defaultValue:d})=>(m&&(e[v]=d),e),{}),ke=({fieldsConfig:s,onSubmit:e})=>{const{requiredFieldError:v}=oe({requiredFieldError:"Order.Form.notifications.requiredFieldError"}),m=be(null),[d,b]=g({}),[$,u]=g({});p(()=>{if(b({}),!s||!s.length)return;const r=ve(s);b(r)},[s==null?void 0:s.length]),p(()=>()=>{var r;b({}),(r=m.current)==null||r.reset()},[]);const E=V((r,a)=>{const h=s.find(l=>l.code===r);return h!=null&&h.required&&!a?v:""},[s,v]),f=V(r=>{const{name:a,value:h,type:i,checked:l}=r==null?void 0:r.target,n=i==="checkbox"?l:h;b(t=>({...t,[a]:n}))},[]),o=V(r=>{const{name:a,value:h,type:i,checked:l}=r==null?void 0:r.target,n=i==="checkbox"?l:h;u(t=>({...t,[a]:E(a,n)}))},[E]),k=V(r=>{r.preventDefault();let a=!0,h={},i=null;for(const[l,n]of Object.entries(d)){const t=E(l,n);t&&(h[l]=t,a=!1,i||(i=l))}if(u(h),i&&m.current){const l=m.current.elements.namedItem(i);l==null||l.focus()}e==null||e(r,a)},[d,E,e]);return{formData:d,errors:$,formRef:m,handleChange:f,handleBlur:o,handleSubmit:k}},ye=ae(({loading:s,values:e,fields:v=[],errors:m,className:d="",onChange:b,onBlur:$})=>{const u=`${d}__item`,E=F((a,h,i)=>{const l=a.options.map(n=>({text:n.label,value:n.value}));return c(x,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:s,children:c(ne,{name:a.id,floatingLabel:`${a.label} ${a.required?"*":""}`,placeholder:a.label,"aria-label":a.label,options:l,onBlur:$,handleSelect:b,value:h||a.defaultValue})},a.id)},[d,s,u,$,b]),f=F((a,h,i)=>{const l=a.id==="email",n=l?c(me,{}):void 0,t=l?"username":"";return c(x,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a==null?void 0:a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:s,children:c(re,{"aria-label":a.label,"aria-required":a.required,autoComplete:t,icon:n,type:"text",name:a.id,value:h||a.defaultValue,placeholder:a.label,floatingLabel:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:b})},a.id)},[d,s,u,$,b]),o=F((a,h,i)=>c(x,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:s,children:c(te,{type:"text",name:a.id,value:h||a.defaultValue,placeholder:a.label,floatingLabel:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:b})},a.id),[d,s,u,$,b]),k=F((a,h,i)=>c(x,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:s,children:c(ee,{name:a.id,checked:h||a.defaultValue,placeholder:a.label,label:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:b})},a.id),[d,s,u,$,b]),r=F((a,h,i)=>c(x,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:s,children:c(se,{type:"text",name:a.id,value:h===void 0?a.defaultValue:h,label:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:b})},a.id),[d,s,u,$,b]);return v.length?c(R,{children:v.map(a=>{var l;const h=(m==null?void 0:m[a.id])??"",i=(e==null?void 0:e[a.id])??"";switch(a.fieldType){case"TEXT":return(l=a==null?void 0:a.options)!=null&&l.length?E(a,i,h):f(a,i,h);case"MULTILINE":return f(a,i,h);case"SELECT":return E(a,i,h);case"DATE":return o(a,i,h);case"BOOLEAN":return k(a,i,h);case"TEXTAREA":return r(a,i,h);default:return null}})}):null}),Re=ae(({name:s,loading:e,children:v,className:m="defaultForm",fieldsConfig:d,onSubmit:b})=>{const{formData:$,errors:u,formRef:E,handleChange:f,handleBlur:o,handleSubmit:k}=ke({fieldsConfig:d,onSubmit:b});return L("form",{className:_(["order-form",m]),onSubmit:k,name:s,ref:E,children:[c(ye,{className:m,loading:e,fields:d,onChange:f,onBlur:o,errors:u,values:$}),v]})}),fe=({loading:s,product:e,itemType:v,taxConfig:m,translations:d,disabledIncrementer:b,showConfigurableOptions:$,onQuantity:u,routeProductDetails:E,isReturnProductList:f})=>{var Q,A,H,Z,z,j,C,U,W,X,I,K,G,J,Y,B,T;const{taxExcluded:o,taxIncluded:k}=m,r=V((w,O,le)=>c(he,{amount:w,currency:O,weight:"normal",...le}),[]);let a={};const h=v==="cancelled",i=(A=(Q=e==null?void 0:e.product)==null?void 0:Q.stockStatus)==null?void 0:A.includes("IN_STOCK"),l=(e==null?void 0:e.giftCard)||{},n=(H=e==null?void 0:e.itemPrices)==null?void 0:H.priceIncludingTax,t=(Z=e==null?void 0:e.itemPrices)==null?void 0:Z.originalPrice,y=(z=e==null?void 0:e.itemPrices)==null?void 0:z.price,S=v==="returned"?e==null?void 0:e.requestQuantity:e==null?void 0:e.totalQuantity,N=e.discounted&&((j=e.price)==null?void 0:j.value)!==(t==null?void 0:t.value)*S,D={..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in l&&(l!=null&&l.senderName)?{[d.sender]:l==null?void 0:l.senderName}:{},..."senderEmail"in l&&(l!=null&&l.senderEmail)?{[d.sender]:l==null?void 0:l.senderEmail}:{},..."recipientName"in l&&(l!=null&&l.recipientName)?{[d.recipient]:l==null?void 0:l.recipientName}:{},..."recipientEmail"in l&&(l!=null&&l.recipientEmail)?{[d.recipient]:l==null?void 0:l.recipientEmail}:{},..."message"in l&&(l!=null&&l.message)?{[d.message]:l==null?void 0:l.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(C=e==null?void 0:e.downloadableLinks)==null?void 0:C.count} ${d.downloadableCount}`]:(U=e==null?void 0:e.downloadableLinks)==null?void 0:U.result}:{}};if(k&&o){const w=N?t==null?void 0:t.value:(n==null?void 0:n.value)*S;a={taxExcluded:!0,taxIncluded:void 0,price:r(t==null?void 0:t.value,t==null?void 0:t.currency),total:L(R,{children:[r(w,t==null?void 0:t.currency,{variant:e.discounted&&(n==null?void 0:n.value)!==w?"strikethrough":"default"}),e.discounted&&(n==null?void 0:n.value)!==w?r(n==null?void 0:n.value,n==null?void 0:n.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:r((y==null?void 0:y.value)*S,y==null?void 0:y.currency)}}else if(!k&&o)a={taxExcluded:void 0,taxIncluded:void 0,price:r(t==null?void 0:t.value,t==null?void 0:t.currency),total:L(R,{children:[r((t==null?void 0:t.value)*S,n==null?void 0:n.currency,{variant:N?"strikethrough":"default"}),N?r((W=e.price)==null?void 0:W.value,(X=e.price)==null?void 0:X.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:r((y==null?void 0:y.value)*(e==null?void 0:e.totalQuantity),y==null?void 0:y.currency)};else if(k&&!o){const w=v==="returned"?e==null?void 0:e.totalQuantity:S,O=N?t.value:n.value*w;a={taxExcluded:void 0,taxIncluded:!0,price:r(n==null?void 0:n.value,n==null?void 0:n.currency),total:L(R,{children:[r(O,n==null?void 0:n.currency,{variant:N?"strikethrough":"default",weight:"bold"}),N?r(n==null?void 0:n.value,n==null?void 0:n.currency,{sale:!0,weight:"bold"}):null]})}}return c(ue,{loading:s,alert:h&&i?L("span",{children:[c(de,{source:Ee}),d.outOfStock]}):c(R,{}),configurations:($==null?void 0:$(D))??D,title:E?c("a",{"data-testid":"product-name",className:_(["cart-summary-item__title",["cart-summary-item__title--strikethrough",h]]),href:E(e),children:(I=e==null?void 0:e.product)==null?void 0:I.name}):c("div",{"data-testid":"product-name",className:_(["cart-summary-item__title",["cart-summary-item__title--strikethrough",h]]),children:(K=e==null?void 0:e.product)==null?void 0:K.name}),sku:c("div",{children:(G=e==null?void 0:e.product)==null?void 0:G.sku}),quantity:e!=null&&e.eligibleForReturn&&(e!=null&&e.returnableQuantity)?(e==null?void 0:e.returnableQuantity)??e.totalQuantity:f?void 0:e.totalQuantity,image:E?c("a",{href:E(e),children:c(P,{src:(J=e==null?void 0:e.product)==null?void 0:J.thumbnail.url,alt:(Y=e==null?void 0:e.product)==null?void 0:Y.thumbnail.label,loading:"lazy",width:"90",height:"120"})}):c(P,{src:(B=e==null?void 0:e.product)==null?void 0:B.thumbnail.url,alt:(T=e==null?void 0:e.product)==null?void 0:T.thumbnail.label,loading:"lazy",width:"90",height:"120"}),...a,footer:u&&!b?c(ie,{value:1,min:1,max:e==null?void 0:e.returnableQuantity,onValue:w=>u==null?void 0:u(Number(w)),name:"quantity"}):void 0})},M=Math.random().toString(36).slice(2)+Date.now().toString(36),Ve=({itemsEligibleForReturn:s,slots:e,loading:v=!1,taxConfig:m,translations:d={},selectedProductList:b,handleSelectedProductList:$,showConfigurableOptions:u,handleSetQuantity:E,handleChangeStep:f})=>L("ul",{className:"order-return-order-product-list",children:[s==null?void 0:s.map((o,k)=>{const r=b.some(a=>(a==null?void 0:a.productSku)===o.productSku&&o.eligibleForReturn&&o.quantityReturned===0);return L("li",{className:_(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",!o.eligibleForReturn]]),children:[c(ee,{"data-testid":`${M}_${k+1}`,name:M+k,checked:r,disabled:!o.eligibleForReturn||o.quantityReturned!==0,onChange:()=>{$({...o,currentReturnOrderQuantity:1})}}),c(fe,{loading:v,product:o,itemType:"",taxConfig:m,translations:d,showConfigurableOptions:u,disabledIncrementer:!r,isReturnProductList:!0,onQuantity:(o==null?void 0:o.returnableQuantity)>1?a=>E(a,o.productSku):void 0}),e!=null&&e.ReturnOrderItem?c($e,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:e==null?void 0:e.ReturnOrderItem,context:{}}):null]},M+k)}),c("li",{className:"order-return-order-product-list__item",children:c(ce,{type:"button",onClick:()=>f("attributes"),disabled:!b.length,children:d.nextStep})})]});export{fe as C,Re as F,Ve as R,Ee as S,ye as a,ke as u}; diff --git a/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js b/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js index 3d4677af97..0f693b9b21 100644 --- a/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js +++ b/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsxs as g,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{InLineAlert as v,Picker as x,Button as F}from"@dropins/tools/components.js";import{F as S}from"./OrderCancel.js";import"@dropins/tools/lib.js";import{useState as n}from"@dropins/tools/preact-hooks.js";import{events as d}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{r as E,c as _}from"./requestGuestOrderCancel.js";import{useText as D,Text as l}from"@dropins/tools/i18n.js";const k=({orderRef:a,pickerProps:m,submitButtonProps:u,cancelReasons:t})=>{const o=D({ErrorHeading:"Order.OrderCancelForm.errorHeading",ErrorDescription:"Order.OrderCancelForm.errorDescription",orderCancellationLabel:"Order.OrderCancelForm.label"}),[i,p]=n(0),[f,O]=n(!1),[b,h]=n(!1);d.on("authenticated",e=>{e&&h(!0)},{eager:!0});const C=e=>{e.preventDefault();const s=Number(e.target.value);p(s)};return g(S,{onSubmit:async e=>(e.preventDefault(),(a.length>20?E:_)(a,t[i].text,c=>{b||(c.status="guest order cancellation requested"),d.emit("order/data",c)},()=>{O(!0)})),"data-testid":"order-order-cancel-reasons-form__text",children:[f&&r(v,{heading:o.ErrorHeading,description:o.ErrorDescription}),r("div",{className:"order-order-cancel-reasons-form__text",children:r(l,{id:"Order.OrderCancelForm.description"})}),r(x,{name:"cancellationReasons",floatingLabel:o.orderCancellationLabel,defaultOption:t[0],variant:"primary",options:t,value:String(i),handleSelect:C,required:!0,"data-testid":"order-cancellation-reasons-selector",...m}),r("div",{className:"order-order-cancel-reasons-form__button-container",children:r(F,{variant:"primary","data-testid":"order-cancel-submit-button",...u,children:r(l,{id:"Order.OrderCancelForm.button"})})})]})};export{k as O}; +import{jsxs as g,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{InLineAlert as v,Picker as x,Button as F}from"@dropins/tools/components.js";import{F as S}from"./OrderCancel.js";import"@dropins/tools/lib.js";import{useState as n}from"@dropins/tools/preact-hooks.js";import{events as d}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{r as E,c as _}from"./requestGuestOrderCancel.js";import{useText as D,Text as l}from"@dropins/tools/i18n.js";const k=({orderRef:a,pickerProps:m,submitButtonProps:u,cancelReasons:t})=>{const o=D({ErrorHeading:"Order.OrderCancelForm.errorHeading",ErrorDescription:"Order.OrderCancelForm.errorDescription",orderCancellationLabel:"Order.OrderCancelForm.label"}),[i,p]=n(0),[f,O]=n(!1),[b,h]=n(!1);d.on("authenticated",e=>{e&&h(!0)},{eager:!0});const C=e=>{e.preventDefault();const s=Number(e.target.value);p(s)};return g(S,{onSubmit:async e=>(e.preventDefault(),(a.length>20?E:_)(a,t[i].text,c=>{b||(c.status="guest order cancellation requested"),d.emit("order/data",c)},()=>{O(!0)})),"data-testid":"order-order-cancel-reasons-form__text",children:[f&&r(v,{heading:o.ErrorHeading,description:o.ErrorDescription}),r("div",{className:"order-order-cancel-reasons-form__text",children:r(l,{id:"Order.OrderCancelForm.description"})}),r(x,{name:"cancellationReasons",floatingLabel:o.orderCancellationLabel,defaultOption:t[0],variant:"primary",options:t,value:String(i),handleSelect:C,required:!0,"data-testid":"order-cancellation-reasons-selector",...m}),r("div",{className:"order-order-cancel-reasons-form__button-container",children:r(F,{variant:"primary","data-testid":"order-cancel-submit-button",...u,children:r(l,{id:"Order.OrderCancelForm.button"})})})]})};export{k as O}; diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index 6f2cdf54c1..20fcbfdba4 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 s,Fragment as o}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as H}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as G}from"@dropins/tools/lib.js";import{IllustratedMessage as K,Icon as y,Card as k,ContentGrid as R,Image as D,Header as I,Pagination as r1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as e1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import{C as O}from"./OrderLoaders.js";import"@dropins/tools/preact.js";import{Text as U}from"@dropins/tools/i18n.js";const q=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"})))),t1=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"})),J=({typeList:L,isEmpty:C,minifiedView:M,message:n})=>{const t=e1(()=>{switch(L){case"orders":return{icon:t1,text:r("p",{children:n}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,n]);return!C||!L||!t.text?null:r(K,{className:W(["order-empty-list",t.className,M?"order-empty-list--minified":""]),message:t.text,icon:r(y,{source:t.icon}),"data-testid":"emptyList"})},Q={size:"32",stroke:"2"},M1=({minifiedViewKey:L,withReturnNumber:C=!1,withOrderNumber:M=!1,slots:n,pageInfo:t,withReturnsListButton:E=!0,isMobile:b=!1,returnsInMinifiedView:X=1,translations:a={},orderReturns:i=[],minifiedView:h=!1,withHeader:Z=!0,withThumbnails:w=!0,selectedPage:$=1,handleSetSelectPage:V,routeReturnDetails:m,routeOrderDetails:p,routeTracking:_,routeReturnsList:g,routeProductDetails:d,loading:N})=>{const A=h?X:i.length,B=d!=null&&d()?"a":"span",f=H(()=>i.slice(0,A).map((e,T)=>{var S,z;return r(k,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${L}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),C?s("p",{children:[a.returnNumber," ",r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,M?s("p",{children:[a.orderNumber," ",r("a",{href:(p==null?void 0:p({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(S=e==null?void 0:e.tracking)==null?void 0:S.map((c,x)=>{var u,v;return s("p",{children:[`${a.carrier} ${(v=(u=c==null?void 0:c.carrier)==null?void 0:u.label)==null?void 0:v.toLocaleUpperCase()}: `,r("a",{href:`${(_==null?void 0:_(c))||"#"}`,target:"_blank",rel:"noreferrer",children:c.trackingNumber})]},`${c.trackingNumber}_${x}`)}),n!=null&&n.ReturnItemsDetails?r(G,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:n==null?void 0:n.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[e.items.length," ",r(U,{id:`Order.Returns.${L}.returnsList.itemText`,plural:e.items.length,fields:{count:e.items.length}})]}):null]}),w?r(R,{maxColumns:b?3:9,emptyGridContent:r(o,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",b]]),children:(z=e==null?void 0:e.items)==null?void 0:z.map((c,x)=>{var j,F;const u=(j=c.thumbnail)==null?void 0:j.label,v=(F=c.thumbnail)==null?void 0:F.url;return r(B,{href:(d==null?void 0:d(c))??"#",children:r(D,{alt:u,src:v,width:85,height:114})},x+c.uid)})}):null,n!=null&&n.DetailsActionParams?r(G,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:n==null?void 0:n.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(y,{source:q,...Q})})]})},T)}),[i,A,L,C,a,m,M,p,n,w,b,d,_,B]),Y=H(()=>s(o,{children:[Z?r(I,{title:a.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,N?r(O,{withCard:!1}):s(o,{children:[f,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:a.emptyOrdersListMessage}),E?r("a",{className:"order-returns-list-content__actions",href:(g==null?void 0:g())??"#",children:r(k,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:a.viewAllOrdersButton}),r(y,{source:q,...Q})]})})}):null]})]}),[g,E,Z,a,f,h,i.length,N]),P=H(()=>s(o,{children:[Z?r(I,{title:a.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,N?r(O,{withCard:!1}):s(o,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:a.emptyOrdersListMessage}),f,(t==null?void 0:t.totalPages)>1?r(r1,{totalPages:t==null?void 0:t.totalPages,currentPage:$,onChange:V}):null]})]}),[f,h,i,a,t,$,V,N,Z]);return r("div",{className:"order-returns-list-content",children:h?Y:P})};export{M1 as R}; +import{jsx as r,jsxs as s,Fragment as o}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as H}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as G}from"@dropins/tools/lib.js";import{IllustratedMessage as I,Icon as y,Card as k,ContentGrid as R,Image as D,Header as O,Pagination as r1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as e1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as q}from"@dropins/tools/i18n.js";const J=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"})))),t1=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"})),P=({typeList:L,isEmpty:C,minifiedView:M,message:n})=>{const t=e1(()=>{switch(L){case"orders":return{icon:t1,text:r("p",{children:n}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,n]);return!C||!L||!t.text?null:r(I,{className:W(["order-empty-list",t.className,M?"order-empty-list--minified":""]),message:t.text,icon:r(y,{source:t.icon}),"data-testid":"emptyList"})},Q={size:"32",stroke:"2"},M1=({minifiedViewKey:L,withReturnNumber:C=!1,withOrderNumber:M=!1,slots:n,pageInfo:t,withReturnsListButton:E=!0,isMobile:b=!1,returnsInMinifiedView:X=1,translations:a={},orderReturns:i=[],minifiedView:h=!1,withHeader:Z=!0,withThumbnails:w=!0,selectedPage:$=1,handleSetSelectPage:V,routeReturnDetails:m,routeOrderDetails:_,routeTracking:p,routeReturnsList:N,routeProductDetails:d,loading:g})=>{const A=h?X:i.length,B=d!=null&&d()?"a":"span",f=H(()=>i.slice(0,A).map((e,K)=>{var S,z;return r(k,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(q,{id:`Order.Returns.${L}.returnsList.returnStatus.${n1(e.returnStatus)}`})}),C?s("p",{children:[a.returnNumber," ",r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,M?s("p",{children:[a.orderNumber," ",r("a",{href:(_==null?void 0:_({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(S=e==null?void 0:e.tracking)==null?void 0:S.map((c,x)=>{var u,v;return s("p",{children:[`${a.carrier} ${(v=(u=c==null?void 0:c.carrier)==null?void 0:u.label)==null?void 0:v.toLocaleUpperCase()}: `,r("a",{href:`${(p==null?void 0:p(c))||"#"}`,target:"_blank",rel:"noreferrer",children:c.trackingNumber})]},`${c.trackingNumber}_${x}`)}),n!=null&&n.ReturnItemsDetails?r(G,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:n==null?void 0:n.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[e.items.length," ",r(q,{id:`Order.Returns.${L}.returnsList.itemText`,plural:e.items.length,fields:{count:e.items.length}})]}):null]}),w?r(R,{maxColumns:b?3:9,emptyGridContent:r(o,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",b]]),children:(z=e==null?void 0:e.items)==null?void 0:z.map((c,x)=>{var j,F;const u=(j=c.thumbnail)==null?void 0:j.label,v=(F=c.thumbnail)==null?void 0:F.url;return r(B,{href:(d==null?void 0:d(c))??"#",children:r(D,{alt:u,src:v,width:85,height:114})},x+c.uid)})}):null,n!=null&&n.DetailsActionParams?r(G,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:n==null?void 0:n.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(y,{source:J,...Q})})]})},K)}),[i,A,L,C,a,m,M,_,n,w,b,d,p,B]),Y=H(()=>s(o,{children:[Z?r(O,{title:a.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,g?r(U,{withCard:!1}):s(o,{children:[f,r(P,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:a.emptyOrdersListMessage}),E?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(k,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:a.viewAllOrdersButton}),r(y,{source:J,...Q})]})})}):null]})]}),[N,E,Z,a,f,h,i.length,g]),T=H(()=>s(o,{children:[Z?r(O,{title:a.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,g?r(U,{withCard:!1}):s(o,{children:[r(P,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:a.emptyOrdersListMessage}),f,(t==null?void 0:t.totalPages)>1?r(r1,{totalPages:t==null?void 0:t.totalPages,currentPage:$,onChange:V}):null]})]}),[f,h,i,a,t==null?void 0:t.totalPages,$,V,g,Z]);return r("div",{className:"order-returns-list-content",children:h?Y:T})};export{M1 as R}; diff --git a/scripts/__dropins__/storefront-order/chunks/convertCase.js b/scripts/__dropins__/storefront-order/chunks/convertCase.js index 7401b56b25..9edffe763d 100644 --- a/scripts/__dropins__/storefront-order/chunks/convertCase.js +++ b/scripts/__dropins__/storefront-order/chunks/convertCase.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -const b=s=>s.replace(/_([a-z])/g,(o,e)=>e.toUpperCase()),c=(s,o,e)=>{const u=["string","boolean","number"],p=b;return Array.isArray(s)?s.map(r=>u.includes(typeof r)||r===null?r:typeof r=="object"?c(r,o,e):r):s!==null&&typeof s=="object"?Object.entries(s).reduce((r,[t,n])=>{const f=e&&e[t]?e[t]:p(t);return r[f]=u.includes(typeof n)||n===null?n:c(n,o,e),r},{}):s};export{c as a,b as c}; +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 new file mode 100644 index 0000000000..99f6b00e1c --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/form.types.js @@ -0,0 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +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 3f61b8c1dd..ea47f8104f 100644 --- a/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js +++ b/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{h as l}from"./network-error.js";import{f as m,h as _}from"./fetch-graphql.js";import{c as f,a as T}from"./convertCase.js";const b=o=>{let e=[];for(const t of o)if(!(t.frontend_input!=="MULTILINE"||t.multiline_count<2))for(let i=2;i<=t.multiline_count;i++){const a={...t,name:`${t.code}_${i}`,code:`${t.code}_${i}`,id:`${t.code}_${i}`};e.push(a)}return e},h=o=>{var u,c,d;const e=((c=(u=o==null?void 0:o.data)==null?void 0:u.attributesForm)==null?void 0:c.items)||[];if(!e.length)return[];const t=(d=e.filter(r=>{var n;return!((n=r.frontend_input)!=null&&n.includes("HIDDEN"))}))==null?void 0:d.map(({code:r,...n})=>{const s=r!=="country_id"?r:"country_code";return{...n,name:s,id:s,code:s}}),i=b(t);return t.concat(i).map(r=>{const n=f(r.code);return T({...r,customUpperCode:n},"camelCase",{frontend_input:"fieldType",frontend_class:"className",is_required:"required",sort_order:"orderNumber"})}).sort((r,n)=>r.orderNumber-n.orderNumber)},E=` +import{h as i}from"./network-error.js";import{f as u,h as s}from"./fetch-graphql.js";import{t as m}from"./transform-attributes-form.js";const n=` query GET_ATTRIBUTES_FORM($formCode: String!) { attributesForm(formCode: $formCode) { items { @@ -32,7 +32,7 @@ import{h as l}from"./network-error.js";import{f as m,h as _}from"./fetch-graphql } } } -`,p=` +`,_=` query GET_ATTRIBUTES_FORM_SHORT { attributesForm(formCode: "customer_register_address") { items { @@ -46,4 +46,4 @@ import{h as l}from"./network-error.js";import{f as m,h as _}from"./fetch-graphql } } } -`,R=async o=>await m(o!=="shortRequest"?E:p,{method:"GET",cache:"force-cache",variables:{formCode:o}}).then(e=>{var t;return(t=e.errors)!=null&&t.length?_(e.errors):h(e)}).catch(l);export{R as g}; +`,T=async r=>await u(r!=="shortRequest"?n:_,{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(t=>{var e,o,a;return(e=t.errors)!=null&&e.length?s(t.errors):m(((a=(o=t==null?void 0:t.data)==null?void 0:o.attributesForm)==null?void 0:a.items)??[])}).catch(i);export{T as g}; diff --git a/scripts/__dropins__/storefront-order/chunks/getCustomer.js b/scripts/__dropins__/storefront-order/chunks/getCustomer.js index 12e7d94435..b6bcf17289 100644 --- a/scripts/__dropins__/storefront-order/chunks/getCustomer.js +++ b/scripts/__dropins__/storefront-order/chunks/getCustomer.js @@ -8,4 +8,4 @@ import{h}from"./network-error.js";import{f,h as i}from"./fetch-graphql.js";impor 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{C as a,B as g,k as t}; +`,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/getFormValues.js b/scripts/__dropins__/storefront-order/chunks/getFormValues.js new file mode 100644 index 0000000000..0d76b6a59d --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/getFormValues.js @@ -0,0 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +const s=n=>{if(!n)return null;const t=new FormData(n);if(n.querySelectorAll('input[type="checkbox"]').forEach(e=>{t.has(e.name)||t.set(e.name,"false"),e.checked&&t.set(e.name,"true")}),t&&typeof t.entries=="function"){const e=t.entries();if(e&&typeof e[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(e)))||{}}return{}};export{s as g}; diff --git a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js index a9383424b9..479d481d2f 100644 --- a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js +++ b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js @@ -69,6 +69,9 @@ fragment AddressesList on OrderAddress { gift_receipt_included available_actions is_virtual + items_eligible_for_return { + ...OrderItemDetails + } returns { ...OrderReturns } @@ -146,11 +149,11 @@ ${s} ${n} ${i} ${d} -`,_=` +`,u=` query GET_GUEST_ORDER($input: OrderInformationInput!) { guestOrder(input:$input) { ...guestOrderData } } ${o} -`;export{i as A,o as G,n as O,_ as a}; +`;export{i as A,o as G,n as O,u as a}; diff --git a/scripts/__dropins__/storefront-order/chunks/requestReturn.js b/scripts/__dropins__/storefront-order/chunks/requestReturn.js new file mode 100644 index 0000000000..f79adecbc6 --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/requestReturn.js @@ -0,0 +1,47 @@ +/*! 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 c}from"./transform-attributes-form.js";import{a as m}from"./convertCase.js";const d=` + 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 + } + } + } +`,E=async u=>await s(d,{method:"GET",cache:"force-cache",variables:{entityType:u}}).then(t=>{var e,r,a;return(e=t.errors)!=null&&e.length?o(t.errors):c(((a=(r=t==null?void 0:t.data)==null?void 0:r.attributesList)==null?void 0:a.items)??[])}).catch(i),l=` +mutation REQUEST_RETURN_ORDER($input: RequestReturnInput!) { + requestReturn(input: $input) { + return { + uid + status + number + created_at + } + } +} +`,f=async u=>{const t=m(u,"snakeCase",{});return await s(l,{method:"POST",variables:{input:t}}).then(e=>{var n;if((n=e.errors)!=null&&n.length)return o(e.errors);const{created_at:r,...a}=e.data.requestReturn.return;return{...a,createdAt:r}}).catch(i)};export{E as g,f as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js b/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js index b4ba3d8a05..8ffb239a78 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. */ -const E={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"},t=e=>typeof e!="string"?"":E[e]??"";export{t as f}; +import{F as c}from"./form.types.js";const p={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"},y=i=>{const n={};return Object.keys(i).forEach(t=>{if(t.match(/_(\d+)$/)){const e=t.replace(/_\d+$/,"");n[e]=i[t]}else n[t]=i[t]}),n},R=(i,n)=>i.map(t=>({...t,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}`})),_=(i,n)=>i==null?void 0:i.flatMap(t=>Array.from({length:n},(a,e)=>({...t,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}`}))),$=i=>{const n=[],t=[];return Object.entries(i).forEach(([a,e])=>{const s=a.lastIndexOf("_"),r=a.slice(0,s),u=a.slice(s+1);u===c.MULTISELECT||u===c.SELECT?n.push({attributeCode:r,value:btoa(e)}):t.push({attributeCode:r,value:e})}),{selectedCustomAttributes:n,enteredCustomAttributes:t}},m=i=>typeof i!="string"?"":p[i]??"",l=["REJECTED","PARTIALLY_REJECTED","DENIED","UNCONFIRMED","CLOSED"],A=i=>{const n=i==null?void 0:i.returns.filter(e=>!l.includes(e.returnStatus));return((i==null?void 0:i.itemsEligibleForReturn)??[]).flatMap(e=>{let s=e.quantityShipped,r={...e,returnableQuantity:s};return e.quantityShipped===0&&(r={...r,eligibleForReturn:!1,returnableQuantity:0}),n.forEach(u=>{u.items.forEach(o=>{if((o==null?void 0:o.id)===(e==null?void 0:e.id)){const d=s-o.requestQuantity;s=Math.max(d,0),r={...r,eligibleForReturn:s!==0,returnableQuantity:s}}})}),r}).sort((e,s)=>Number(s.eligibleForReturn)-Number(e.eligibleForReturn))},C=i=>{var a;let n=[];return((a=i==null?void 0:i.returns)==null?void 0:a.filter(e=>!l.includes(e.returnStatus)).flatMap(e=>e.items||[])).forEach(e=>{if(!n.length)n.push({...e,totalQuantity:e.requestQuantity});else{const s=n.findIndex(r=>r.id===e.id);s!==-1?n[s].totalQuantity+=e.requestQuantity:n.push({...e,totalQuantity:e.requestQuantity})}}),{returnedList:n,modifyOrder:E(i.items,n)}};function E(i,n){return i.map(t=>{const a=n.find(e=>e.id===t.id);if(a){const e=t.totalQuantity-a.totalQuantity;return e===0?null:{...t,totalQuantity:e}}return t}).filter(t=>t!==null)}export{y as c,C as e,m as f,R as m,$ as n,A as o,_ as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js new file mode 100644 index 0000000000..8a0a753928 --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js @@ -0,0 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import{c as d,a as m}from"./convertCase.js";const a=s=>{let o=[];for(const e of s)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let n=2;n<=e.multiline_count;n++){const c={...e,name:`${e.code}_${n}`,code:`${e.code}_${n}`,id:`${e.code}_${n}`};o.push(c)}return o},f=s=>{var u;const o=s||[];if(!o.length)return[];const e=(u=o.filter(t=>{var r;return!((r=t.frontend_input)!=null&&r.includes("HIDDEN"))}))==null?void 0:u.map(({code:t,...r})=>{const i=t!=="country_id"?t:"country_code";return{...r,name:i,id:i,code:i}}),n=a(e);return e.concat(n).map(t=>{const r=d(t.code);return m({...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-order-details.js b/scripts/__dropins__/storefront-order/chunks/transform-order-details.js index b07a982a39..a47b56da9f 100644 --- a/scripts/__dropins__/storefront-order/chunks/transform-order-details.js +++ b/scripts/__dropins__/storefront-order/chunks/transform-order-details.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{a as F}from"./convertCase.js";const J=` +import{a as M}from"./convertCase.js";const J=` fragment ProductDetails on ProductInterface { __typename canonical_url @@ -62,6 +62,8 @@ import{a as F}from"./convertCase.js";const J=` fragment OrderItemDetails on OrderItemInterface { __typename status + product_sku + eligible_for_return product_name product_url_key id @@ -70,7 +72,6 @@ import{a as F}from"./convertCase.js";const J=` quantity_canceled quantity_invoiced quantity_refunded - quantity_returned product_sale_price { value currency @@ -137,4 +138,4 @@ import{a as F}from"./convertCase.js";const J=` } } } -`,B=n=>{var t;if(!((t=n==null?void 0:n.items)!=null&&t.length))return null;const a=n==null?void 0:n.items,s=n==null?void 0:n.page_info;return{ordersReturn:a.map(l=>{var q,v;const{order:i,status:_,number:y,created_at:p}=l,b=((v=(q=l==null?void 0:l.shipping)==null?void 0:q.tracking)==null?void 0:v.map(u=>{const{status:g,carrier:f,tracking_number:e}=u;return{status:g,carrier:f,trackingNumber:e}}))??[],h=l.items.map(u=>{var N;const g=u==null?void 0:u.quantity,f=u==null?void 0:u.status,e=u==null?void 0:u.request_quantity,O=u==null?void 0:u.uid,R=u==null?void 0:u.order_item,E=((N=M([R]))==null?void 0:N.reduce((k,T)=>T,{}))??{};return{uid:O,quantity:g,status:f,requestQuantity:e,...E}});return{createdReturnAt:p,returnStatus:_,token:i==null?void 0:i.token,orderNumber:i==null?void 0:i.number,returnNumber:y,items:h,tracking:b}}).sort((l,i)=>+i.returnNumber-+l.returnNumber),...s?{pageInfo:{pageSize:s.page_size,totalPages:s.total_pages,currentPage:s.current_page}}:{}}},U=n=>n||0,Q=n=>{var a,s,c;return{...n,canonicalUrl:(n==null?void 0:n.canonical_url)||"",urlKey:(n==null?void 0:n.url_key)||"",id:(n==null?void 0:n.uid)||"",name:(n==null?void 0:n.name)||"",sku:(n==null?void 0:n.sku)||"",image:((a=n==null?void 0:n.image)==null?void 0:a.url)||"",productType:(n==null?void 0:n.__typename)||"",thumbnail:{label:((s=n==null?void 0:n.thumbnail)==null?void 0:s.label)||"",url:((c=n==null?void 0:n.thumbnail)==null?void 0:c.url)||""}}},j=n=>{if(!n||!("selected_options"in n))return;const a={};for(const s of n.selected_options)a[s.label]=s.value;return a},w=n=>{const a=n==null?void 0:n.map(c=>({uid:c.uid,label:c.label,values:c.values.map(t=>t.product_name).join(", ")})),s={};return a==null||a.forEach(c=>{s[c.label]=c.values}),Object.keys(s).length>0?s:null},K=n=>(n==null?void 0:n.length)>0?{count:n.length,result:n.map(a=>a.title).join(", ")}:null,M=n=>n==null?void 0:n.filter(a=>a.__typename).map(a=>{var s,c,t,l,i,_,y,p,b,h,q,v,u,g,f,e,O,R,E,N,k,T,C,D,P,A,G,x,S,L;return{type:a==null?void 0:a.__typename,productName:a.product_name,productUrlKey:a.product_url_key,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,id:a==null?void 0:a.id,discounted:((l=(t=(c=(s=a==null?void 0:a.product)==null?void 0:s.price_range)==null?void 0:c.maximum_price)==null?void 0:t.regular_price)==null?void 0:l.value)*(a==null?void 0:a.quantity_ordered)!==((i=a==null?void 0:a.product_sale_price)==null?void 0:i.value)*(a==null?void 0:a.quantity_ordered),total:{value:((_=a==null?void 0:a.product_sale_price)==null?void 0:_.value)*(a==null?void 0:a.quantity_ordered)||0,currency:((y=a==null?void 0:a.product_sale_price)==null?void 0:y.currency)||""},totalInclTax:{value:((p=a==null?void 0:a.product_sale_price)==null?void 0:p.value)*(a==null?void 0:a.quantity_ordered)||0,currency:(b=a==null?void 0:a.product_sale_price)==null?void 0:b.currency},price:{value:((h=a==null?void 0:a.product_sale_price)==null?void 0:h.value)||0,currency:(q=a==null?void 0:a.product_sale_price)==null?void 0:q.currency},priceInclTax:{value:((v=a==null?void 0:a.product_sale_price)==null?void 0:v.value)||0,currency:(u=a==null?void 0:a.product_sale_price)==null?void 0:u.currency},totalQuantity:U(a==null?void 0:a.quantity_ordered),regularPrice:{value:(O=(e=(f=(g=a==null?void 0:a.product)==null?void 0:g.price_range)==null?void 0:f.maximum_price)==null?void 0:e.regular_price)==null?void 0:O.value,currency:(k=(N=(E=(R=a==null?void 0:a.product)==null?void 0:R.price_range)==null?void 0:E.maximum_price)==null?void 0:N.regular_price)==null?void 0:k.currency},product:Q(a==null?void 0:a.product),thumbnail:{label:((C=(T=a==null?void 0:a.product)==null?void 0:T.thumbnail)==null?void 0:C.label)||"",url:((P=(D=a==null?void 0:a.product)==null?void 0:D.thumbnail)==null?void 0:P.url)||""},giftCard:(a==null?void 0:a.__typename)==="GiftCardOrderItem"?{senderName:((A=a.gift_card)==null?void 0:A.sender_name)||"",senderEmail:((G=a.gift_card)==null?void 0:G.sender_email)||"",recipientEmail:((x=a.gift_card)==null?void 0:x.recipient_email)||"",recipientName:((S=a.gift_card)==null?void 0:S.recipient_name)||"",message:((L=a.gift_card)==null?void 0:L.message)||""}:void 0,configurableOptions:j(a),bundleOptions:a.__typename==="BundleOrderItem"?w(a.bundle_options):null,itemPrices:a.prices,downloadableLinks:a.__typename==="DownloadableOrderItem"?K(a==null?void 0:a.downloadable_links):null}}),z=(n,a)=>{var q,v,u,g,f,e;const s=M(n.items),c=((q=B(n==null?void 0:n.returns))==null?void 0:q.ordersReturn)??[],t=a?c.filter(O=>O.returnNumber===a):c,{total:l,...i}=F({...n,items:s,returns:t},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),_=(v=n==null?void 0:n.payment_methods)==null?void 0:v[0],y=(_==null?void 0:_.type)||"",p=(_==null?void 0:_.name)||"",b=(u=i==null?void 0:i.items)==null?void 0:u.reduce((O,R)=>O+(R==null?void 0:R.totalQuantity),0);return{...l,...i,totalQuantity:b,shipping:{amount:((g=i==null?void 0:i.total)==null?void 0:g.totalShipping.value)??0,currency:((e=(f=i.total)==null?void 0:f.totalShipping)==null?void 0:e.currency)||"",code:i.shippingMethod??""},payments:[{code:y,name:p}]}},$=(n,a,s)=>{var c,t,l,i,_,y,p;if((i=(l=(t=(c=a==null?void 0:a.data)==null?void 0:c.customer)==null?void 0:t.orders)==null?void 0:l.items)!=null&&i.length&&n==="orderData"){const b=(p=(y=(_=a==null?void 0:a.data)==null?void 0:_.customer)==null?void 0:y.orders)==null?void 0:p.items[0];return z(b,s)}return null};export{Y as B,W as G,X as O,J as P,Z as R,V as a,z as b,$ as c,B as t}; +`,B=a=>{var y;if(!((y=a==null?void 0:a.items)!=null&&y.length))return null;const n=a==null?void 0:a.items,u=a==null?void 0:a.page_info;return{ordersReturn:n.sort((c,_)=>+_.number-+c.number).map(c=>{var O,N;const{order:_,status:p,number:s,created_at:t}=c,q=((N=(O=c==null?void 0:c.shipping)==null?void 0:O.tracking)==null?void 0:N.map(i=>{const{status:g,carrier:f,tracking_number:b}=i;return{status:g,carrier:f,trackingNumber:b}}))??[],E=c.items.map(i=>{var e;const g=i==null?void 0:i.quantity,f=i==null?void 0:i.status,b=i==null?void 0:i.request_quantity,R=i==null?void 0:i.uid,h=i==null?void 0:i.order_item,v=((e=C([h]))==null?void 0:e.reduce((T,k)=>k,{}))??{};return{uid:R,quantity:g,status:f,requestQuantity:b,...v}});return{createdReturnAt:t,returnStatus:p,token:_==null?void 0:_.token,orderNumber:_==null?void 0:_.number,returnNumber:s,items:E,tracking:q}}),...u?{pageInfo:{pageSize:u.page_size,totalPages:u.total_pages,currentPage:u.current_page}}:{}}},U=a=>a||0,Q=a=>{var n,u,l;return{...a,canonicalUrl:(a==null?void 0:a.canonical_url)||"",urlKey:(a==null?void 0:a.url_key)||"",id:(a==null?void 0:a.uid)||"",name:(a==null?void 0:a.name)||"",sku:(a==null?void 0:a.sku)||"",image:((n=a==null?void 0:a.image)==null?void 0:n.url)||"",productType:(a==null?void 0:a.__typename)||"",thumbnail:{label:((u=a==null?void 0:a.thumbnail)==null?void 0:u.label)||"",url:((l=a==null?void 0:a.thumbnail)==null?void 0:l.url)||""}}},j=a=>{if(!a||!("selected_options"in a))return;const n={};for(const u of a.selected_options)n[u.label]=u.value;return n},w=a=>{const n=a==null?void 0:a.map(l=>({uid:l.uid,label:l.label,values:l.values.map(y=>y.product_name).join(", ")})),u={};return n==null||n.forEach(l=>{u[l.label]=l.values}),Object.keys(u).length>0?u:null},K=a=>(a==null?void 0:a.length)>0?{count:a.length,result:a.map(n=>n.title).join(", ")}:null,C=a=>a==null?void 0:a.filter(n=>n.__typename).map(n=>{var u,l,y,c,_,p,s,t,q,E,O,N,i,g,f,b,R,h,v,e,T,k,P,A,G,S,x,D,F,L;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:(n==null?void 0:n.quantity_canceled)||0,quantityInvoiced:(n==null?void 0:n.quantity_invoiced)||0,quantityOrdered:(n==null?void 0:n.quantity_ordered)||0,quantityRefunded:(n==null?void 0:n.quantity_refunded)||0,quantityReturned:(n==null?void 0:n.quantity_returned)||0,quantityShipped:(n==null?void 0:n.quantity_shipped)||0,id:n==null?void 0:n.id,discounted:((c=(y=(l=(u=n==null?void 0:n.product)==null?void 0:u.price_range)==null?void 0:l.maximum_price)==null?void 0:y.regular_price)==null?void 0:c.value)*(n==null?void 0:n.quantity_ordered)!==((_=n==null?void 0:n.product_sale_price)==null?void 0:_.value)*(n==null?void 0:n.quantity_ordered),total:{value:((p=n==null?void 0:n.product_sale_price)==null?void 0:p.value)*(n==null?void 0:n.quantity_ordered)||0,currency:((s=n==null?void 0:n.product_sale_price)==null?void 0:s.currency)||""},totalInclTax:{value:((t=n==null?void 0:n.product_sale_price)==null?void 0:t.value)*(n==null?void 0:n.quantity_ordered)||0,currency:(q=n==null?void 0:n.product_sale_price)==null?void 0:q.currency},price:{value:((E=n==null?void 0:n.product_sale_price)==null?void 0:E.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:(i=n==null?void 0:n.product_sale_price)==null?void 0:i.currency},totalQuantity:U(n==null?void 0:n.quantity_ordered),regularPrice:{value:(R=(b=(f=(g=n==null?void 0:n.product)==null?void 0:g.price_range)==null?void 0:f.maximum_price)==null?void 0:b.regular_price)==null?void 0:R.value,currency:(T=(e=(v=(h=n==null?void 0:n.product)==null?void 0:h.price_range)==null?void 0:v.maximum_price)==null?void 0:e.regular_price)==null?void 0:T.currency},product:Q(n==null?void 0:n.product),thumbnail:{label:((P=(k=n==null?void 0:n.product)==null?void 0:k.thumbnail)==null?void 0:P.label)||"",url:((G=(A=n==null?void 0:n.product)==null?void 0:A.thumbnail)==null?void 0:G.url)||""},giftCard:(n==null?void 0:n.__typename)==="GiftCardOrderItem"?{senderName:((S=n.gift_card)==null?void 0:S.sender_name)||"",senderEmail:((x=n.gift_card)==null?void 0:x.sender_email)||"",recipientEmail:((D=n.gift_card)==null?void 0:D.recipient_email)||"",recipientName:((F=n.gift_card)==null?void 0:F.recipient_name)||"",message:((L=n.gift_card)==null?void 0:L.message)||""}:void 0,configurableOptions:j(n),bundleOptions:n.__typename==="BundleOrderItem"?w(n.bundle_options):null,itemPrices:n.prices,downloadableLinks:n.__typename==="DownloadableOrderItem"?K(n==null?void 0:n.downloadable_links):null}}),z=(a,n)=>{var i,g,f,b,R,h;const u=C(a.items),l=C(a==null?void 0:a.items_eligible_for_return),y=u,c=((i=B(a==null?void 0:a.returns))==null?void 0:i.ordersReturn)??[],_=n?c.filter(v=>v.returnNumber===n):c,{total:p,...s}=M({...a,items:u,returns:_,itemsEligibleForReturn:y,itemsEligibleForReturn2:l},"camelCase",{applied_coupons:"coupons",__typename:"__typename",firstname:"firstName",middlename:"middleName",lastname:"lastName",postcode:"postCode",payment_methods:"payments"}),t=(g=a==null?void 0:a.payment_methods)==null?void 0:g[0],q=(t==null?void 0:t.type)||"",E=(t==null?void 0:t.name)||"",O=(f=s==null?void 0:s.items)==null?void 0:f.reduce((v,e)=>v+(e==null?void 0:e.totalQuantity),0);return{...p,...s,totalQuantity:O,shipping:{amount:((b=s==null?void 0:s.total)==null?void 0:b.totalShipping.value)??0,currency:((h=(R=s.total)==null?void 0:R.totalShipping)==null?void 0:h.currency)||"",code:s.shippingMethod??""},payments:[{code:q,name:E}]}},$=(a,n,u)=>{var l,y,c,_,p,s,t;if((_=(c=(y=(l=n==null?void 0:n.data)==null?void 0:l.customer)==null?void 0:y.orders)==null?void 0:c.items)!=null&&_.length&&a==="orderData"){const q=(t=(s=(p=n==null?void 0:n.data)==null?void 0:p.customer)==null?void 0:s.orders)==null?void 0:t.items[0];return z(q,u)}return null};export{Y as B,W as G,X as O,J as P,Z as R,V as a,z as b,$ as c,B as t}; diff --git a/scripts/__dropins__/storefront-order/components/ReturnOrderMessage/ReturnOrderMessage.d.ts b/scripts/__dropins__/storefront-order/components/ReturnOrderMessage/ReturnOrderMessage.d.ts new file mode 100644 index 0000000000..c8eed19583 --- /dev/null +++ b/scripts/__dropins__/storefront-order/components/ReturnOrderMessage/ReturnOrderMessage.d.ts @@ -0,0 +1,5 @@ +import { FunctionComponent } from 'preact'; +import { ReturnOrderMessageProps } from '../../types/createReturn.types'; + +export declare const ReturnOrderMessage: FunctionComponent; +//# sourceMappingURL=ReturnOrderMessage.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/components/ReturnOrderMessage/index.d.ts b/scripts/__dropins__/storefront-order/components/ReturnOrderMessage/index.d.ts new file mode 100644 index 0000000000..3f22f19673 --- /dev/null +++ b/scripts/__dropins__/storefront-order/components/ReturnOrderMessage/index.d.ts @@ -0,0 +1,3 @@ +export * from './ReturnOrderMessage'; +export { ReturnOrderMessage as default } from './ReturnOrderMessage'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/components/ReturnOrderProductList/ReturnOrderProductList.d.ts b/scripts/__dropins__/storefront-order/components/ReturnOrderProductList/ReturnOrderProductList.d.ts new file mode 100644 index 0000000000..da048c0ffb --- /dev/null +++ b/scripts/__dropins__/storefront-order/components/ReturnOrderProductList/ReturnOrderProductList.d.ts @@ -0,0 +1,5 @@ +import { FunctionComponent } from 'preact'; +import { ReturnOrderProductListProps } from '../../types/createReturn.types'; + +export declare const ReturnOrderProductList: FunctionComponent; +//# sourceMappingURL=ReturnOrderProductList.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/components/ReturnOrderProductList/index.d.ts b/scripts/__dropins__/storefront-order/components/ReturnOrderProductList/index.d.ts new file mode 100644 index 0000000000..c876e7fe1d --- /dev/null +++ b/scripts/__dropins__/storefront-order/components/ReturnOrderProductList/index.d.ts @@ -0,0 +1,3 @@ +export * from './ReturnOrderProductList'; +export { ReturnOrderProductList as default } from './ReturnOrderProductList'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/components/ReturnReasonForm/ReturnReasonForm.d.ts b/scripts/__dropins__/storefront-order/components/ReturnReasonForm/ReturnReasonForm.d.ts new file mode 100644 index 0000000000..a3b3732d27 --- /dev/null +++ b/scripts/__dropins__/storefront-order/components/ReturnReasonForm/ReturnReasonForm.d.ts @@ -0,0 +1,5 @@ +import { FunctionComponent } from 'preact'; +import { ReturnReasonFormProps } from '../../types/createReturn.types'; + +export declare const ReturnReasonForm: FunctionComponent; +//# sourceMappingURL=ReturnReasonForm.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/components/ReturnReasonForm/index.d.ts b/scripts/__dropins__/storefront-order/components/ReturnReasonForm/index.d.ts new file mode 100644 index 0000000000..fcad1c79c9 --- /dev/null +++ b/scripts/__dropins__/storefront-order/components/ReturnReasonForm/index.d.ts @@ -0,0 +1,3 @@ +export * from './ReturnReasonForm'; +export { ReturnReasonForm as default } from './ReturnReasonForm'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/components/index.d.ts b/scripts/__dropins__/storefront-order/components/index.d.ts index 65eb2118f4..1960b8b54f 100644 --- a/scripts/__dropins__/storefront-order/components/index.d.ts +++ b/scripts/__dropins__/storefront-order/components/index.d.ts @@ -9,6 +9,9 @@ export * from './EmptyList'; export * from './ReturnsListContent'; export * from './OrderProductListContent'; export * from './OrderCostSummaryContent'; +export * from './ReturnOrderProductList'; +export * from './ReturnOrderMessage'; +export * from './ReturnReasonForm'; export * from './OrderCancel'; export * from './Reorder'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/configs/mock.config.d.ts b/scripts/__dropins__/storefront-order/configs/mock.config.d.ts index 2caf144835..5a2bd06c30 100644 --- a/scripts/__dropins__/storefront-order/configs/mock.config.d.ts +++ b/scripts/__dropins__/storefront-order/configs/mock.config.d.ts @@ -1724,4 +1724,1173 @@ export declare const translationsOrderCostSummaryMock: { discountSubtitle: string; total: string; }; +export declare const createReturnOrderMock: { + grandTotal: { + value: number; + currency: string; + }; + totalGiftcard: { + currency: string; + value: number; + }; + subtotal: { + currency: string; + value: number; + }; + taxes: { + amount: { + currency: string; + value: number; + }; + rate: number; + title: string; + }[]; + totalTax: { + currency: string; + value: number; + }; + totalShipping: { + currency: string; + value: number; + }; + discounts: { + amount: { + currency: string; + value: number; + }; + label: string; + }[]; + email: string; + availableActions: string[]; + status: string; + number: string; + id: string; + orderDate: string; + orderStatusChangeDate: string; + carrier: string; + shippingMethod: string; + isVirtual: boolean; + returns: { + createdReturnAt: string; + returnStatus: string; + token: string; + orderNumber: string; + returnNumber: string; + items: ({ + uid: string; + quantity: number; + status: string; + requestQuantity: number; + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Size?: undefined; + Color?: undefined; + }; + bundleOptions: null; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + } | { + uid: string; + quantity: number; + status: string; + requestQuantity: number; + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Size: string; + Color: string; + }; + bundleOptions: null; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + })[]; + tracking: never[]; + }[]; + itemsEligibleForReturn: ({ + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color?: undefined; + Size?: undefined; + }; + bundleOptions: null; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + } | { + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color: string; + Size: string; + }; + bundleOptions: null; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + } | { + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color?: undefined; + Size?: undefined; + }; + bundleOptions: { + 'Sprite Stasis Ball': string; + 'Sprite Foam Yoga Brick': string; + 'Sprite Yoga Strap': string; + 'Sprite Foam Roller': string; + }; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + })[]; + coupons: never[]; + shipments: { + id: string; + number: string; + tracking: never[]; + comments: never[]; + items: { + id: string; + productSku: string; + productName: string; + orderItem: { + __typename: string; + status: string; + productSku: string; + eligibleForReturn: boolean; + productName: string; + productUrlKey: string; + id: string; + quantityOrdered: number; + quantityShipped: number; + quantityCanceled: number; + quantityInvoiced: number; + quantityRefunded: number; + productSalePrice: { + value: number; + currency: string; + }; + selectedOptions: { + label: string; + value: string; + }[]; + product: { + __typename: string; + canonicalUrl: null; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + }; + prices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + }; + }[]; + }[]; + payments: { + code: string; + name: string; + }[]; + shippingAddress: { + city: string; + company: null; + countryCode: string; + fax: null; + firstName: string; + lastName: string; + middleName: null; + postCode: string; + prefix: null; + region: string; + regionId: string; + street: string[]; + suffix: null; + telephone: string; + vatId: string; + }; + billingAddress: { + city: string; + company: null; + countryCode: string; + fax: null; + firstName: string; + lastName: string; + middleName: null; + postCode: string; + prefix: null; + region: string; + regionId: string; + street: string[]; + suffix: null; + telephone: string; + vatId: string; + }; + items: ({ + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color?: undefined; + Size?: undefined; + }; + bundleOptions: null; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + } | { + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color: string; + Size: string; + }; + bundleOptions: null; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + } | { + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color?: undefined; + Size?: undefined; + }; + bundleOptions: { + 'Sprite Stasis Ball': string; + 'Sprite Foam Yoga Brick': string; + 'Sprite Yoga Strap': string; + 'Sprite Foam Roller': string; + }; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + })[]; + itemsEligibleForReturn2: ({ + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color?: undefined; + Size?: undefined; + }; + bundleOptions: null; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + } | { + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color: string; + Size: string; + }; + bundleOptions: null; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + } | { + type: string; + eligibleForReturn: boolean; + productSku: string; + productName: string; + productUrlKey: string; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + id: string; + discounted: boolean; + total: { + value: number; + currency: string; + }; + totalInclTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + priceInclTax: { + value: number; + currency: string; + }; + totalQuantity: number; + regularPrice: { + value: number; + currency: string; + }; + product: { + __typename: string; + canonicalUrl: string; + urlKey: string; + uid: string; + name: string; + sku: string; + onlyXLeftInStock: null; + stockStatus: string; + thumbnail: { + label: string; + url: string; + }; + priceRange: { + maximumPrice: { + regularPrice: { + currency: string; + value: number; + }; + }; + }; + id: string; + image: string; + productType: string; + }; + thumbnail: { + label: string; + url: string; + }; + configurableOptions: { + Color?: undefined; + Size?: undefined; + }; + bundleOptions: { + 'Sprite Stasis Ball': string; + 'Sprite Foam Yoga Brick': string; + 'Sprite Yoga Strap': string; + 'Sprite Foam Roller': string; + }; + itemPrices: { + priceIncludingTax: { + value: number; + currency: string; + }; + originalPrice: { + value: number; + currency: string; + }; + originalPriceIncludingTax: { + value: number; + currency: string; + }; + price: { + value: number; + currency: string; + }; + }; + downloadableLinks: null; + })[]; + totalQuantity: number; + shipping: { + amount: number; + currency: string; + code: string; + }; + returnNumber: string; +}; //# sourceMappingURL=mock.config.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/containers/CreateReturn.d.ts b/scripts/__dropins__/storefront-order/containers/CreateReturn.d.ts new file mode 100644 index 0000000000..7ef9151ae3 --- /dev/null +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn.d.ts @@ -0,0 +1,3 @@ +export * from './CreateReturn/index' +import _default from './CreateReturn/index' +export default _default diff --git a/scripts/__dropins__/storefront-order/containers/CreateReturn.js b/scripts/__dropins__/storefront-order/containers/CreateReturn.js new file mode 100644 index 0000000000..779a14fdd2 --- /dev/null +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn.js @@ -0,0 +1,3 @@ +/*! Copyright 2024 Adobe +All Rights Reserved. */ +import{jsx as a,jsxs as F}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as H,classes as Q}from"@dropins/tools/lib.js";import{Button as M,CartItem as V,Image as W,Header as $,InLineAlert as Z}from"@dropins/tools/components.js";import{S as D,u as z,a as U,R as K}from"../chunks/OrderCancel.js";import{useState as O,useRef as G,useEffect as T,useCallback as A}from"@dropins/tools/preact-hooks.js";import{events as J}from"@dropins/tools/event-bus.js";import{g as X}from"../chunks/getFormValues.js";import{s as Y}from"../chunks/setTaxStatus.js";import{createRef as I,Fragment as ee}from"@dropins/tools/preact.js";import{o as te,c as ne,n as se,r as ae,m as re}from"../chunks/returnOrdersHelper.js";import{g as ie,r as ce}from"../chunks/requestReturn.js";import{g as ue}from"../chunks/getStoreConfig.js";import*as g from"@dropins/tools/preact-compat.js";import{O as oe}from"../chunks/OrderLoaders.js";import{useText as le}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const de=s=>g.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},g.createElement("g",{clipPath:"url(#clip0_841_1324)"},g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),g.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"})),g.createElement("defs",null,g.createElement("clipPath",{id:"clip0_841_1324"},g.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),pe=s=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},g.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"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),he=({onSuccess:s,onError:r,handleSetInLineAlert:i,orderData:l})=>{const[o,h]=O(l),[S,k]=O("products"),[w,R]=O(!0),[f,y]=O([]),[v,x]=O([]),[t,C]=O({taxIncluded:!1,taxExcluded:!1}),[e,d]=O([]),m=G([]);m.current.length!==f.length&&(m.current=f.map((n,c)=>m.current[c]||I())),T(()=>{const n=J.on("order/data",c=>{h(c),d(te(c)),R(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ue().then(n=>{if(n){const c=Y(n==null?void 0:n.shoppingCartDisplayPrice);C(c)}})},[]),T(()=>{ie("RMA_ITEM").then(n=>{n.length&&(x(n),R(!1))})},[]);const _=A(n=>{y(c=>c.findIndex(u=>(u==null?void 0:u.productSku)===(n==null?void 0:n.productSku))>-1?c.filter(u=>(u==null?void 0:u.productSku)!==(n==null?void 0:n.productSku)):[...c,n])},[]),b=A(n=>{k(n),i(),n==="products"&&y([])},[i]),N=A((n,c)=>{const L=f.map(u=>u.productSku===c?{...u,currentReturnOrderQuantity:n}:u);y(L)},[f]),E=A(async(n,c)=>{if(!c)return null;R(!0);const L={orderUid:(o==null?void 0:o.id)??"",contactEmail:(o==null?void 0:o.email)??""},u=[];m.current.length&&m.current.forEach(({current:p})=>{var P;const j=p==null?void 0:p.name.replace(/_\d+$/,""),q=((P=p==null?void 0:p.dataset)==null?void 0:P.quantity)??1,B=ne(X(p));u.push({orderItemUid:j,quantityToReturn:+q,...se(B)})}),ce({...L,items:u}).then(p=>{p&&(s==null||s(p),b("success"),i())}).catch(p=>{r==null||r(p.message),i({type:"error",heading:p.message})}),R(!1)},[b,r,s,i,o]);return{order:o,steps:S,loading:w,formsRef:m,taxConfig:t,attributesList:v,selectedProductList:f,itemsEligibleForReturn:e,handleSelectedProductList:_,handleSetQuantity:N,handleChangeStep:b,onSubmit:E}},me={success:a(pe,{}),warning:a(de,{}),error:a(D,{})},ge=()=>{const[s,r]=O({type:"success",heading:""}),i=A(l=>{if(!(l!=null&&l.type)){r({type:"success",heading:""});return}const o=me[l.type];r({...l,icon:o})},[]);return{inLineAlertProps:s,handleSetInLineAlert:i}},fe=({routeReturnSuccess:s,translations:r,orderData:i})=>{const l=()=>{window.location.href=(s==null?void 0:s(i))??"#"};return F("div",{className:"order-return-order-message",children:[a("p",{className:"order-return-order-message__title",children:r.successTitle}),a("p",{className:"order-return-order-message__subtitle",children:r.successMessage}),a(M,{onClick:l,type:"button",children:r.backStore})]})},be=({slots:s,formsRef:r,selectedProductList:i,loading:l,fieldsConfig:o,translations:h,handleChangeStep:S,onSubmit:k})=>{const{formData:w,errors:R,formRef:f,handleChange:y,handleBlur:v,handleSubmit:x}=z({fieldsConfig:ae(o,i==null?void 0:i.length),onSubmit:k});return F("form",{className:"order-return-reason-form",ref:f,onSubmit:x,name:"returnReasonForm",children:[i.map((t,C)=>{var E,n,c,L,u;const e=(t==null?void 0:t.giftCard)||{},d=t==null?void 0:t.product,m=re(o,C),_=`${t==null?void 0:t.id}_${C}`,b=(t==null?void 0:t.currentReturnOrderQuantity)??1,N={...t!=null&&t.currentReturnOrderQuantity?{Quantity:b}:{},..."configurableOptions"in t?t.configurableOptions:{},..."bundleOptions"in t?t.bundleOptions:{},..."senderName"in e&&(e!=null&&e.senderName)?{[h.sender]:e==null?void 0:e.senderName}:{},..."senderEmail"in e&&(e!=null&&e.senderEmail)?{[h.sender]:e==null?void 0:e.senderEmail}:{},..."recipientName"in e&&(e!=null&&e.recipientName)?{[h.recipient]:e==null?void 0:e.recipientName}:{},..."recipientEmail"in e&&(e!=null&&e.recipientEmail)?{[h.recipient]:e==null?void 0:e.recipientEmail}:{},..."message"in e&&(e!=null&&e.message)?{[h.message]:e==null?void 0:e.message}:{},..."downloadableLinks"in t&&(t!=null&&t.downloadableLinks)?{[`${(E=t==null?void 0:t.downloadableLinks)==null?void 0:E.count} ${h.downloadableCount}`]:(n=t==null?void 0:t.downloadableLinks)==null?void 0:n.result}:{}};return F(ee,{children:[a(V,{loading:l,title:a("div",{"data-testid":"product-name",children:(c=t==null?void 0:t.product)==null?void 0:c.name}),sku:a("div",{children:d==null?void 0:d.sku}),image:a(W,{src:((L=d==null?void 0:d.thumbnail)==null?void 0:L.url)??"",alt:((u=d==null?void 0:d.thumbnail)==null?void 0:u.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:N}),a("form",{name:_,ref:r==null?void 0:r.current[C],"data-quantity":b,children:a(U,{className:"className",loading:l,fields:m,onChange:y,onBlur:v,errors:R,values:w})})]},C)}),s!=null&&s.ReturnFormActions?a(H,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:s==null?void 0:s.ReturnFormActions,context:{handleChangeStep:S}}):F("div",{className:"order-return-reason-form__actions",children:[a(M,{variant:"secondary",type:"button",onClick:()=>{S("products")},children:h.backStep}),a(M,{children:h.submit})]})]})},Be=({className:s,orderData:r,slots:i,onSuccess:l,onError:o,routeReturnSuccess:h,showConfigurableOptions:S})=>{const k=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"}),{inLineAlertProps:w,handleSetInLineAlert:R}=ge(),{order:f,itemsEligibleForReturn:y,formsRef:v,taxConfig:x,attributesList:t,steps:C,loading:e,selectedProductList:d,handleSelectedProductList:m,handleSetQuantity:_,handleChangeStep:b,onSubmit:N}=he({orderData:r,onSuccess:l,onError:o,handleSetInLineAlert:R});if(e)return a("div",{children:a(oe,{})});if(!e&&!t.length)return a("div",{});const E={products:a(K,{itemsEligibleForReturn:y,slots:i,translations:k,loading:e,taxConfig:x,selectedProductList:d,handleSelectedProductList:m,showConfigurableOptions:S,handleSetQuantity:_,handleChangeStep:b}),attributes:a(be,{slots:i,formsRef:v,loading:e,fieldsConfig:t,selectedProductList:d,handleChangeStep:b,translations:k,onSubmit:N}),success:a(fe,{translations:k,routeReturnSuccess:h,orderData:f}),error:null};return F("div",{className:Q(["order-create-return",s]),children:[a($,{title:k.headerText}),w.heading?a(Z,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...w}):null,E[C]]})};export{Be as CreateReturn,Be as default}; diff --git a/scripts/__dropins__/storefront-order/containers/CreateReturn/CreateReturn.d.ts b/scripts/__dropins__/storefront-order/containers/CreateReturn/CreateReturn.d.ts new file mode 100644 index 0000000000..1ccb9ecf3f --- /dev/null +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn/CreateReturn.d.ts @@ -0,0 +1,5 @@ +import { Container } from '@dropins/tools/types/elsie/src/lib'; +import { CreateReturnProps } from '../../types/createReturn.types'; + +export declare const CreateReturn: Container; +//# sourceMappingURL=CreateReturn.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/containers/CreateReturn/index.d.ts b/scripts/__dropins__/storefront-order/containers/CreateReturn/index.d.ts new file mode 100644 index 0000000000..54f99d5c03 --- /dev/null +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn/index.d.ts @@ -0,0 +1,3 @@ +export * from './CreateReturn'; +export { CreateReturn as default } from './CreateReturn'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/containers/CustomerDetails.js b/scripts/__dropins__/storefront-order/containers/CustomerDetails.js index f7640a3db6..980a3365c8 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 i,Fragment as K}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as G,classes as g}from"@dropins/tools/lib.js";import{useState as y,useEffect as H,useCallback as V,useMemo as j}from"@dropins/tools/preact-hooks.js";import{events as J}from"@dropins/tools/event-bus.js";import{c as Q}from"../chunks/convertCase.js";import{g as U}from"../chunks/getAttributesForm.js";import{Icon as X,Price as Y,Card as ee,Header as te}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import*as a from"@dropins/tools/preact-compat.js";import{f as re}from"../chunks/returnOrdersHelper.js";import{f as ne}from"../chunks/formatDateToLocale.js";import{D as se}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact.js";import{Text as ie,useText as oe}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const ce=d=>a.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},a.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"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),ae=d=>a.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},a.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}),a.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}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M3.01465 15.9682H8.40305",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round"}),a.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}),a.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})),de=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],le=({orderData:d})=>{const[t,_]=y(!0),[l,p]=y(d),[u,e]=y([]);H(()=>{const n=J.on("order/data",m=>{p(m)},{eager:!0});return()=>{n==null||n.off()}},[]),H(()=>{U("shortRequest").then(n=>{if(n){const m=n.map(({name:s,orderNumber:C,label:f})=>({name:Q(s),orderNumber:C,label:de.includes(s)?null:f}));e(m)}}).finally(()=>{_(!1)})},[]);const o=V(n=>{if(!u.length||!l||!l[n])return[];const m=Object.fromEntries(Object.entries(l[n]).map(([s,C])=>[s.toLowerCase(),C]));return u.filter(({name:s})=>m[s.toLowerCase()]).map(s=>({name:s.name,orderNumber:s.orderNumber,value:m[s.name.toLowerCase()],label:s.label}))},[u,l]),h=j(()=>({billingAddress:o("billingAddress"),shippingAddress:o("shippingAddress")}),[o]);return{order:l,normalizeAddress:h,loading:t}},me=({loading:d,order:t,withHeader:_=!0,title:l,paymentIconsMap:p={},normalizeAddress:u,translations:e,slots:o})=>{var L,O,E,T,w,S;const h=!!(t!=null&&t.returnNumber),n=(L=t==null?void 0:t.returns)==null?void 0:L[0],m=j(()=>({checkmo:ce,card:ae,...p}),[p]),s=V(q=>{var x;return(x=u[q])==null?void 0:x.map((c,F)=>r("p",{children:c.label?`${c.label}: ${Array.isArray(c.value)?c.value.join(" "):c==null?void 0:c.value}`:Array.isArray(c.value)?c.value.join(" "):c==null?void 0:c.value},F))},[u]);if(!t||d)return r(se,{});const C=(t==null?void 0:t.email)??"",f=(O=t==null?void 0:t.shipping)==null?void 0:O.code,N=(E=t==null?void 0:t.shipping)==null?void 0:E.amount,R=(T=t==null?void 0:t.shipping)==null?void 0:T.currency,v=t==null?void 0:t.payments,k=v&&v.length>0,D=k?(w=v[0])==null?void 0:w.name:"",M=k?(S=v[0])==null?void 0:S.code:"",W=k&&D!=="",b=s("shippingAddress")??[],A=s("billingAddress")??[],I=i("div",{className:"order-customer-details-content__container-email",children:[r("div",{className:"order-customer-details-content__container-title",children:e==null?void 0:e.emailTitle}),r("p",{children:C})]}),P=h?i("div",{className:"order-customer-details-content__container-return-information",children:[r("div",{className:"order-customer-details-content__container-title",children:e==null?void 0:e.returnInformationTitle}),r("div",{className:"order-customer-details-content__container-description",children:o!=null&&o.OrderReturnInformation?r(G,{"data-testid":"OrderReturnInformation",name:"OrderReturnInformation",slot:o==null?void 0:o.OrderReturnInformation,context:n}):i(K,{children:[i("p",{children:[e.createdReturnAt,r("span",{children:ne(n==null?void 0:n.createdReturnAt)})]}),i("p",{children:[e.returnStatusLabel,r(ie,{id:`Order.CustomerDetails.returnStatus.${re(n==null?void 0:n.returnStatus)}`})]}),i("p",{children:[e.orderNumberLabel,r("span",{children:n==null?void 0:n.orderNumber})]})]})})]}):null,Z=b.length?i("div",{className:"order-customer-details-content__container-shipping_address",children:[r("div",{className:"order-customer-details-content__container-title",children:e.shippingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:b})]}):null,$=A.length?i("div",{className:g(["order-customer-details-content__container-billing_address",["order-customer-details-content__container-billing_address--fullwidth",!b.length]]),children:[r("div",{className:"order-customer-details-content__container-title",children:e.billingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:A})]}):null,z=W?i("div",{className:g(["order-customer-details-content__container-payment_methods",["order-customer-details-content__container-payment_methods--fullwidth",!f]]),children:[r("div",{className:"order-customer-details-content__container-title",children:e==null?void 0:e.paymentMethodsTitle}),i("p",{"data-testid":"payment_methods_description",className:g([["order-customer-details-content__container-payment_methods--icon",!!m[M]]]),children:[r(X,{source:m[M]}),D]})]}):null,B=f?i("div",{className:"order-customer-details-content__container-shipping_methods",children:[r("div",{className:"order-customer-details-content__container-title",children:e==null?void 0:e.shippingMethodsTitle}),N?i("p",{"data-testid":"shipping_methods_price",children:[r(Y,{amount:N,currency:R})," ",f]}):r("p",{"data-testid":"shipping_methods_placeholder",children:e==null?void 0:e.freeShipping})]}):null;return i(ee,{"data-testid":"order-details",variant:"secondary",className:g(["order-customer-details-content"]),children:[_?r(te,{title:l??(e==null?void 0:e.headerText)}):null,i("div",{className:g(["order-customer-details-content__container",["order-customer-details-content__container--no-margin",b.length||A.length]]),children:[I,Z,h?P:$,h?null:B,h?null:z]})]})},Oe=({paymentIconsMap:d,orderData:t,title:_,className:l,slots:p})=>{const u=oe({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:e,normalizeAddress:o,loading:h}=le({orderData:t});return r("div",{className:g(["order-customer-details",l]),children:r(me,{slots:p,loading:h,order:e,title:_,paymentIconsMap:d,normalizeAddress:o,translations:u})})};export{Oe as CustomerDetails,Oe as default}; +import{jsx as r,jsxs as s,Fragment as K}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as G,classes as g}from"@dropins/tools/lib.js";import{useState as y,useEffect as H,useCallback as V,useMemo as j}from"@dropins/tools/preact-hooks.js";import{events as J}from"@dropins/tools/event-bus.js";import{c as Q}from"../chunks/convertCase.js";import{g as U}from"../chunks/getAttributesForm.js";import"@dropins/tools/preact.js";import{Icon as X,Price as Y,Card as ee,Header as te}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import*as a from"@dropins/tools/preact-compat.js";import{f as re}from"../chunks/returnOrdersHelper.js";import{f as ne}from"../chunks/formatDateToLocale.js";import{D as ie}from"../chunks/OrderLoaders.js";import{Text as se,useText as oe}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/form.types.js";const ce=d=>a.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},a.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"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),ae=d=>a.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},a.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}),a.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}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M3.01465 15.9682H8.40305",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round"}),a.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}),a.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})),de=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],le=({orderData:d})=>{const[t,_]=y(!0),[l,p]=y(d),[u,e]=y([]);H(()=>{const n=J.on("order/data",m=>{p(m)},{eager:!0});return()=>{n==null||n.off()}},[]),H(()=>{U("shortRequest").then(n=>{if(n){const m=n.map(({name:i,orderNumber:C,label:f})=>({name:Q(i),orderNumber:C,label:de.includes(i)?null:f}));e(m)}}).finally(()=>{_(!1)})},[]);const o=V(n=>{if(!u.length||!l||!l[n])return[];const m=Object.fromEntries(Object.entries(l[n]).map(([i,C])=>[i.toLowerCase(),C]));return u.filter(({name:i})=>m[i.toLowerCase()]).map(i=>({name:i.name,orderNumber:i.orderNumber,value:m[i.name.toLowerCase()],label:i.label}))},[u,l]),h=j(()=>({billingAddress:o("billingAddress"),shippingAddress:o("shippingAddress")}),[o]);return{order:l,normalizeAddress:h,loading:t}},me=({loading:d,order:t,withHeader:_=!0,title:l,paymentIconsMap:p={},normalizeAddress:u,translations:e,slots:o})=>{var L,O,E,T,w,S;const h=!!(t!=null&&t.returnNumber),n=(L=t==null?void 0:t.returns)==null?void 0:L[0],m=j(()=>({checkmo:ce,card:ae,...p}),[p]),i=V(q=>{var x;return(x=u[q])==null?void 0:x.map((c,F)=>r("p",{children:c.label?`${c.label}: ${Array.isArray(c.value)?c.value.join(" "):c==null?void 0:c.value}`:Array.isArray(c.value)?c.value.join(" "):c==null?void 0:c.value},F))},[u]);if(!t||d)return r(ie,{});const C=(t==null?void 0:t.email)??"",f=(O=t==null?void 0:t.shipping)==null?void 0:O.code,N=(E=t==null?void 0:t.shipping)==null?void 0:E.amount,R=(T=t==null?void 0:t.shipping)==null?void 0:T.currency,v=t==null?void 0:t.payments,k=v&&v.length>0,D=k?(w=v[0])==null?void 0:w.name:"",M=k?(S=v[0])==null?void 0:S.code:"",W=k&&D!=="",b=i("shippingAddress")??[],A=i("billingAddress")??[],I=s("div",{className:"order-customer-details-content__container-email",children:[r("div",{className:"order-customer-details-content__container-title",children:e==null?void 0:e.emailTitle}),r("p",{children:C})]}),P=h?s("div",{className:"order-customer-details-content__container-return-information",children:[r("div",{className:"order-customer-details-content__container-title",children:e==null?void 0:e.returnInformationTitle}),r("div",{className:"order-customer-details-content__container-description",children:o!=null&&o.OrderReturnInformation?r(G,{"data-testid":"OrderReturnInformation",name:"OrderReturnInformation",slot:o==null?void 0:o.OrderReturnInformation,context:n}):s(K,{children:[s("p",{children:[e.createdReturnAt,r("span",{children:ne(n==null?void 0:n.createdReturnAt)})]}),s("p",{children:[e.returnStatusLabel,r(se,{id:`Order.CustomerDetails.returnStatus.${re(n==null?void 0:n.returnStatus)}`})]}),s("p",{children:[e.orderNumberLabel,r("span",{children:n==null?void 0:n.orderNumber})]})]})})]}):null,Z=b.length?s("div",{className:"order-customer-details-content__container-shipping_address",children:[r("div",{className:"order-customer-details-content__container-title",children:e.shippingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:b})]}):null,$=A.length?s("div",{className:g(["order-customer-details-content__container-billing_address",["order-customer-details-content__container-billing_address--fullwidth",!b.length]]),children:[r("div",{className:"order-customer-details-content__container-title",children:e.billingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:A})]}):null,z=W?s("div",{className:g(["order-customer-details-content__container-payment_methods",["order-customer-details-content__container-payment_methods--fullwidth",!f]]),children:[r("div",{className:"order-customer-details-content__container-title",children:e==null?void 0:e.paymentMethodsTitle}),s("p",{"data-testid":"payment_methods_description",className:g([["order-customer-details-content__container-payment_methods--icon",!!m[M]]]),children:[r(X,{source:m[M]}),D]})]}):null,B=f?s("div",{className:"order-customer-details-content__container-shipping_methods",children:[r("div",{className:"order-customer-details-content__container-title",children:e==null?void 0:e.shippingMethodsTitle}),N?s("p",{"data-testid":"shipping_methods_price",children:[r(Y,{amount:N,currency:R})," ",f]}):r("p",{"data-testid":"shipping_methods_placeholder",children:e==null?void 0:e.freeShipping})]}):null;return s(ee,{"data-testid":"order-details",variant:"secondary",className:g(["order-customer-details-content"]),children:[_?r(te,{title:l??(e==null?void 0:e.headerText)}):null,s("div",{className:g(["order-customer-details-content__container",["order-customer-details-content__container--no-margin",b.length||A.length]]),children:[I,Z,h?P:$,h?null:B,h?null:z]})]})},Te=({paymentIconsMap:d,orderData:t,title:_,className:l,slots:p})=>{const u=oe({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:e,normalizeAddress:o,loading:h}=le({orderData:t});return r("div",{className:g(["order-customer-details",l]),children:r(me,{slots:p,loading:h,order:e,title:_,paymentIconsMap:d,normalizeAddress:o,translations:u})})};export{Te as CustomerDetails,Te as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js b/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js index aa5ede1190..b34e4ebc05 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js +++ b/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{O as C,O as F}from"../chunks/OrderCancelForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";import"../chunks/getGuestOrder.graphql.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";export{C as OrderCancelForm,F as default}; +import{O as C,O as F}from"../chunks/OrderCancelForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import"@dropins/tools/preact.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";import"../chunks/getGuestOrder.graphql.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";export{C as OrderCancelForm,F as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js b/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js index 05f3f9a4a7..7bae7d4fde 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js +++ b/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsxs as s,jsx as c,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{classes as H}from"@dropins/tools/lib.js";import{useState as g,useEffect as T}from"@dropins/tools/preact-hooks.js";import{events as V}from"@dropins/tools/event-bus.js";import{s as C}from"../chunks/setTaxStatus.js";import{g as N}from"../chunks/getStoreConfig.js";import{Price as d,Icon as f,Accordion as b,AccordionSection as E,Card as D,Header as k}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import*as x from"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{a as z}from"../chunks/OrderLoaders.js";import{useText as B}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const I=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"})),j=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"})),P=({orderData:a})=>{const[e,t]=g(!0),[n,i]=g(a),[l,o]=g(null);return T(()=>{N().then(u=>{if(u){const{shoppingCartDisplayPrice:p,shoppingOrdersDisplayShipping:r,shoppingOrdersDisplaySubtotal:m,...h}=u;o(y=>({...y,...h,shoppingCartDisplayPrice:C(p),shoppingOrdersDisplayShipping:C(r),shoppingOrdersDisplaySubtotal:C(m)}))}}).finally(()=>{t(!1)})},[]),T(()=>{const u=V.on("order/data",p=>{i(p)},{eager:!0});return()=>{u==null||u.off()}},[]),{loading:e,storeConfig:l,order:n}},W=({translations:a,order:e,subTotalValue:t,shoppingOrdersDisplaySubtotal:n})=>{var i,l;return s("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[s("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:(i=e==null?void 0:e.subtotal)==null?void 0:i.currency,amount:t})]}),s("div",{className:"order-cost-summary-content__description--subheader",children:[!n.taxExcluded&&n.taxIncluded?c("span",{children:a.incl}):null,n.taxExcluded&&n.taxIncluded?s(S,{children:[c(d,{currency:(l=e==null?void 0:e.subtotal)==null?void 0:l.currency,amount:t,size:"small"})," ",c("span",{children:a.excl})]}):null]})]})},q=({translations:a,shoppingOrdersDisplayShipping:e,order:t,totalShipping:n})=>{var i,l,o,u;return t!=null&&t.isVirtual?null:s("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--shipping",children:[s("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:a.shipping}),(i=t==null?void 0:t.totalShipping)!=null&&i.value?c(d,{weight:"normal",currency:(l=t==null?void 0:t.totalShipping)==null?void 0:l.currency,amount:n}):c("span",{children:a.freeShipping})]}),s("div",{className:"order-cost-summary-content__description--subheader",children:[e.taxIncluded&&e.taxExcluded?s(S,{children:[c(d,{weight:"normal",currency:(o=t==null?void 0:t.totalShipping)==null?void 0:o.currency,amount:(u=t==null?void 0:t.totalShipping)==null?void 0:u.value,size:"small"}),s("span",{children:[" ",a.excl]})]}):null,e.taxIncluded&&!e.taxExcluded?c("span",{children:a.incl}):null]})]})},F=({translations:a,order:e,totalGiftcardValue:t,totalGiftcardCurrency:n})=>{var l,o,u,p,r;const i=(l=e==null?void 0:e.discounts)==null?void 0:l.every(m=>m.amount.value===0);return!((o=e==null?void 0:e.discounts)!=null&&o.length)&&(i||!t||t<1)||(u=e==null?void 0:e.discounts)!=null&&u.length&&i?null:s("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--discount",children:[s("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:a.discount}),c("span",{children:(p=e==null?void 0:e.discounts)!=null&&p.length?(r=e==null?void 0:e.discounts)==null?void 0:r.map(({amount:m},h)=>{const _=((m==null?void 0:m.value)??0)+t;return _===0?null:c(d,{weight:"normal",sale:!0,currency:m==null?void 0:m.currency,amount:-_},h)}):null})]}),t>0?s("div",{className:"order-cost-summary-content__description--subheader",children:[s("span",{children:[c(f,{source:j,size:"16"}),c("span",{children:a.discountSubtitle.toLocaleUpperCase()})]}),c(d,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},U=({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)=>s("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:t.code}),c("span",{children:"TBD"})]},n))})},R=({translations:a,renderTaxAccordion:e,totalAccordionTaxValue:t,order:n})=>{var o,u,p;const[i,l]=g(!1);return e?c(b,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:I,iconClose:A,children:s(E,{onStateChange:l,title:a.accordionTitle,secondaryText:c(S,{children:i?null:c(d,{weight:"normal",amount:t,currency:(u=n==null?void 0:n.totalTax)==null?void 0:u.currency})}),renderContentWhenClosed:!1,children:[(p=n==null?void 0:n.taxes)==null?void 0:p.map((r,m)=>{var h,y;return s("div",{className:"order-cost-summary-content__accordion-row",children:[c("p",{children:r==null?void 0:r.title}),c("p",{children:c(d,{weight:"normal",amount:(h=r==null?void 0:r.amount)==null?void 0:h.value,currency:(y=r==null?void 0:r.amount)==null?void 0:y.currency})})]},m)}),s("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:s("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:a.tax}),c(d,{currency:(o=n==null?void 0:n.totalTax)==null?void 0:o.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},G=({translations:a,shoppingOrdersDisplaySubtotal:e,order:t})=>{var n,i,l,o;return s("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--total",children:[s("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:(i=t==null?void 0:t.grandTotal)==null?void 0:i.value,weight:"bold",size:"medium"})]}),e.taxExcluded&&e.taxIncluded?s("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:a.totalExcludingTaxes}),c(d,{currency:(l=t==null?void 0:t.grandTotal)==null?void 0:l.currency,amount:((o=t==null?void 0:t.grandTotal)==null?void 0:o.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},J=({translations:a,loading:e,storeConfig:t,order:n,withHeader:i=!0})=>{var h,y,_,O,w,L;if(e||!n)return c(z,{});const l=((h=n==null?void 0:n.totalGiftcard)==null?void 0:h.value)??0,o=((y=n.totalGiftcard)==null?void 0:y.currency)??"",u=((_=n.subtotal)==null?void 0:_.value)??0,p=((O=n.totalShipping)==null?void 0:O.value)??0,r=!!((w=n==null?void 0:n.taxes)!=null&&w.length)&&(t==null?void 0:t.shoppingOrdersDisplayFullSummary),m=r?(L=n==null?void 0:n.taxes)==null?void 0:L.reduce((Z,v)=>{var M;return+((M=v==null?void 0:v.amount)==null?void 0:M.value)+Z},0):0;return s(D,{variant:"secondary",className:H(["order-cost-summary-content"]),children:[i?c(k,{title:a.headerText}):null,s("div",{className:"order-cost-summary-content__wrapper",children:[c(W,{translations:a,order:n,subTotalValue:u,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(q,{translations:a,order:n,totalShipping:p,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(F,{translations:a,order:n,totalGiftcardValue:l,totalGiftcardCurrency:o}),c(U,{order:n}),c(R,{order:n,translations:a,renderTaxAccordion:r,totalAccordionTaxValue:m}),c(G,{translations:a,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})},ut=({withHeader:a,orderData:e,children:t,className:n,...i})=>{const{loading:l,storeConfig:o,order:u}=P({orderData:e}),p=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",{...i,className:H(["order-cost-summary",n]),children:c(J,{order:u,withHeader:a,loading:l,storeConfig:o,translations:p})})};export{ut as OrderCostSummary,ut as default}; +import{jsxs as i,jsx as c,Fragment as C}from"@dropins/tools/preact-jsx-runtime.js";import{classes as H}from"@dropins/tools/lib.js";import{useState as _,useEffect as T}from"@dropins/tools/preact-hooks.js";import{events as V}from"@dropins/tools/event-bus.js";import{s as v}from"../chunks/setTaxStatus.js";import{g as N}from"../chunks/getStoreConfig.js";import"@dropins/tools/preact.js";import{Price as p,Icon as f,Accordion as b,AccordionSection as E,Card as D,Header as k}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import*as x from"@dropins/tools/preact-compat.js";import{a as z}from"../chunks/OrderLoaders.js";import{useText as B}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const I=e=>x.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),A=e=>x.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),j=e=>x.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M22 6.25H22.75C22.75 5.83579 22.4142 5.5 22 5.5V6.25ZM22 9.27L22.2514 9.97663C22.5503 9.87029 22.75 9.58731 22.75 9.27H22ZM20.26 12.92L19.5534 13.1714L19.5539 13.1728L20.26 12.92ZM22 14.66H22.75C22.75 14.3433 22.551 14.0607 22.2528 13.9539L22 14.66ZM22 17.68V18.43C22.4142 18.43 22.75 18.0942 22.75 17.68H22ZM2 17.68H1.25C1.25 18.0942 1.58579 18.43 2 18.43V17.68ZM2 14.66L1.74865 13.9534C1.44969 14.0597 1.25 14.3427 1.25 14.66H2ZM3.74 11.01L4.44663 10.7586L4.44611 10.7572L3.74 11.01ZM2 9.27H1.25C1.25 9.58675 1.44899 9.86934 1.7472 9.97611L2 9.27ZM2 6.25V5.5C1.58579 5.5 1.25 5.83579 1.25 6.25H2ZM21.25 6.25V9.27H22.75V6.25H21.25ZM21.7486 8.56337C19.8706 9.23141 18.8838 11.2889 19.5534 13.1714L20.9666 12.6686C20.5762 11.5711 21.1494 10.3686 22.2514 9.97663L21.7486 8.56337ZM19.5539 13.1728C19.9195 14.1941 20.7259 15.0005 21.7472 15.3661L22.2528 13.9539C21.6541 13.7395 21.1805 13.2659 20.9661 12.6672L19.5539 13.1728ZM21.25 14.66V17.68H22.75V14.66H21.25ZM22 16.93H2V18.43H22V16.93ZM2.75 17.68V14.66H1.25V17.68H2.75ZM2.25135 15.3666C4.12941 14.6986 5.11623 12.6411 4.44663 10.7586L3.03337 11.2614C3.42377 12.3589 2.85059 13.5614 1.74865 13.9534L2.25135 15.3666ZM4.44611 10.7572C4.08045 9.73588 3.27412 8.92955 2.2528 8.56389L1.7472 9.97611C2.34588 10.1905 2.81955 10.6641 3.03389 11.2628L4.44611 10.7572ZM2.75 9.27V6.25H1.25V9.27H2.75ZM2 7H22V5.5H2V7ZM7.31 6.74V18.17H8.81V6.74H7.31ZM17.0997 8.39967L11.0397 14.4597L12.1003 15.5203L18.1603 9.46033L17.0997 8.39967ZM12.57 9.67C12.57 9.87231 12.4159 10 12.27 10V11.5C13.2839 11.5 14.07 10.6606 14.07 9.67H12.57ZM12.27 10C12.1241 10 11.97 9.87231 11.97 9.67H10.47C10.47 10.6606 11.2561 11.5 12.27 11.5V10ZM11.97 9.67C11.97 9.46769 12.1241 9.34 12.27 9.34V7.84C11.2561 7.84 10.47 8.67938 10.47 9.67H11.97ZM12.27 9.34C12.4159 9.34 12.57 9.46769 12.57 9.67H14.07C14.07 8.67938 13.2839 7.84 12.27 7.84V9.34ZM17.22 14.32C17.22 14.5223 17.0659 14.65 16.92 14.65V16.15C17.9339 16.15 18.72 15.3106 18.72 14.32H17.22ZM16.92 14.65C16.7741 14.65 16.62 14.5223 16.62 14.32H15.12C15.12 15.3106 15.9061 16.15 16.92 16.15V14.65ZM16.62 14.32C16.62 14.1177 16.7741 13.99 16.92 13.99V12.49C15.9061 12.49 15.12 13.3294 15.12 14.32H16.62ZM16.92 13.99C17.0659 13.99 17.22 14.1177 17.22 14.32H18.72C18.72 13.3294 17.9339 12.49 16.92 12.49V13.99Z",fill:"#3D3D3D"})),P=({orderData:e})=>{const[a,t]=_(!0),[n,l]=_(e),[r,o]=_(null);return T(()=>{N().then(u=>{if(u){const{shoppingCartDisplayPrice:m,shoppingOrdersDisplayShipping:s,shoppingOrdersDisplaySubtotal:y,...h}=u;o(d=>({...d,...h,shoppingCartDisplayPrice:v(m),shoppingOrdersDisplayShipping:v(s),shoppingOrdersDisplaySubtotal:v(y)}))}}).finally(()=>{t(!1)})},[]),T(()=>{const u=V.on("order/data",m=>{l(m)},{eager:!0});return()=>{u==null||u.off()}},[]),{loading:a,storeConfig:r,order:n}},W=({translations:e,order:a,subTotalValue:t,shoppingOrdersDisplaySubtotal:n})=>{var l,r;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.subtotal}),c(p,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(l=a==null?void 0:a.subtotal)==null?void 0:l.currency,amount:t})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[!n.taxExcluded&&n.taxIncluded?c("span",{children:e.incl}):null,n.taxExcluded&&n.taxIncluded?i(C,{children:[c(p,{currency:(r=a==null?void 0:a.subtotal)==null?void 0:r.currency,amount:t,size:"small"})," ",c("span",{children:e.excl})]}):null]})]})},q=({translations:e,shoppingOrdersDisplayShipping:a,order:t,totalShipping:n})=>{var l,r,o,u;return t!=null&&t.isVirtual?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--shipping",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.shipping}),(l=t==null?void 0:t.totalShipping)!=null&&l.value?c(p,{weight:"normal",currency:(r=t==null?void 0:t.totalShipping)==null?void 0:r.currency,amount:n}):c("span",{children:e.freeShipping})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[a.taxIncluded&&a.taxExcluded?i(C,{children:[c(p,{weight:"normal",currency:(o=t==null?void 0:t.totalShipping)==null?void 0:o.currency,amount:(u=t==null?void 0:t.totalShipping)==null?void 0:u.value,size:"small"}),i("span",{children:[" ",e.excl]})]}):null,a.taxIncluded&&!a.taxExcluded?c("span",{children:e.incl}):null]})]})},F=({translations:e,order:a,totalGiftcardValue:t,totalGiftcardCurrency:n})=>{var r,o,u,m;const l=(r=a==null?void 0:a.discounts)==null?void 0:r.every(s=>s.amount.value===0);return!((o=a==null?void 0:a.discounts)!=null&&o.length)&&(l||!t||t<1)||(u=a==null?void 0:a.discounts)!=null&&u.length&&l?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--discount",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.discount}),c("span",{children:(m=a==null?void 0:a.discounts)==null?void 0:m.map(({amount:s},y)=>{const d=((s==null?void 0:s.value)??0)+t;return d===0?null:c(p,{weight:"normal",sale:!0,currency:s==null?void 0:s.currency,amount:-d},y)})})]}),t>0?i("div",{className:"order-cost-summary-content__description--subheader",children:[i("span",{children:[c(f,{source:j,size:"16"}),c("span",{children:e.discountSubtitle.toLocaleUpperCase()})]}),c(p,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},U=({order:e})=>{var a;return c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--coupon",children:(a=e==null?void 0:e.coupons)==null?void 0:a.map((t,n)=>i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:t.code}),c("span",{children:"TBD"})]},n))})},R=({translations:e,renderTaxAccordion:a,totalAccordionTaxValue:t,order:n})=>{var o,u,m;const[l,r]=_(!1);return a?c(b,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:I,iconClose:A,children:i(E,{onStateChange:r,title:e.accordionTitle,secondaryText:c(C,{children:l?null:c(p,{weight:"normal",amount:t,currency:(u=n==null?void 0:n.totalTax)==null?void 0:u.currency})}),renderContentWhenClosed:!1,children:[(m=n==null?void 0:n.taxes)==null?void 0:m.map((s,y)=>{var h,d;return i("div",{className:"order-cost-summary-content__accordion-row",children:[c("p",{children:s==null?void 0:s.title}),c("p",{children:c(p,{weight:"normal",amount:(h=s==null?void 0:s.amount)==null?void 0:h.value,currency:(d=s==null?void 0:s.amount)==null?void 0:d.currency})})]},y)}),i("div",{className:"order-cost-summary-content__accordion-row order-cost-summary-content__accordion-total",children:[c("p",{children:e.accordionTotalTax}),c("p",{children:c(p,{weight:"normal",amount:t,currency:n.totalTax.currency,size:"medium"})})]})]})}):c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--tax",children:i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.tax}),c(p,{currency:(o=n==null?void 0:n.totalTax)==null?void 0:o.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},G=({translations:e,shoppingOrdersDisplaySubtotal:a,order:t})=>{var n,l,r,o;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--total",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.total}),c(p,{currency:(n=t==null?void 0:t.grandTotal)==null?void 0:n.currency,amount:(l=t==null?void 0:t.grandTotal)==null?void 0:l.value,weight:"bold",size:"medium"})]}),a.taxExcluded&&a.taxIncluded?i("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:e.totalExcludingTaxes}),c(p,{currency:(r=t==null?void 0:t.grandTotal)==null?void 0:r.currency,amount:((o=t==null?void 0:t.grandTotal)==null?void 0:o.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},J=({translations:e,loading:a,storeConfig:t,order:n,withHeader:l=!0})=>{var h,d,S,O,w,L;if(a||!n)return c(z,{});const r=((h=n==null?void 0:n.totalGiftcard)==null?void 0:h.value)??0,o=((d=n.totalGiftcard)==null?void 0:d.currency)??"",u=((S=n.subtotal)==null?void 0:S.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(D,{variant:"secondary",className:H(["order-cost-summary-content"]),children:[l?c(k,{title:e.headerText}):null,i("div",{className:"order-cost-summary-content__wrapper",children:[c(W,{translations:e,order:n,subTotalValue:u,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(q,{translations:e,order:n,totalShipping:m,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(F,{translations:e,order:n,totalGiftcardValue:r,totalGiftcardCurrency:o}),c(U,{order:n}),c(R,{order:n,translations:e,renderTaxAccordion:s,totalAccordionTaxValue:y}),c(G,{translations:e,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})},rt=({withHeader:e,orderData:a,children:t,className:n,...l})=>{const{loading:r,storeConfig:o,order:u}=P({orderData:a}),m=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(J,{order:u,withHeader:e,loading:r,storeConfig:o,translations:m})})};export{rt as OrderCostSummary,rt as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderProductList.js b/scripts/__dropins__/storefront-order/containers/OrderProductList.js index 5b81ee8c84..078de1698c 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderProductList.js +++ b/scripts/__dropins__/storefront-order/containers/OrderProductList.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as r,jsxs as E,Fragment as w}from"@dropins/tools/preact-jsx-runtime.js";import{Card as Y,Header as g,Price as D,CartItem as I,Icon as T,Image as A}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as S}from"@dropins/tools/lib.js";import{useState as N,useEffect as J,useMemo as p,useCallback as ee}from"@dropins/tools/preact-hooks.js";import{events as te}from"@dropins/tools/event-bus.js";import{s as ne}from"../chunks/setTaxStatus.js";import{g as le}from"../chunks/getStoreConfig.js";import*as C from"@dropins/tools/preact-compat.js";import{Fragment as se}from"@dropins/tools/preact.js";import{O as ae}from"../chunks/OrderLoaders.js";import{useText as re}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const ie=v=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...v},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:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),me=({orderData:v})=>{const[e,s]=N(!0),[O,u]=N(v),[y,f]=N({taxIncluded:!1,taxExcluded:!1});return J(()=>{le().then(i=>{i&&f(ne(i==null?void 0:i.shoppingCartDisplayPrice))}).finally(()=>{s(!1)})},[]),J(()=>{const i=te.on("order/data",o=>{u(o)},{eager:!0});return()=>{i==null||i.off()}},[]),{loading:e,taxConfig:y,order:O}},he=({loading:v,taxConfig:e,order:s=null,withHeader:O=!0,showConfigurableOptions:u,routeProductDetails:y})=>{const f=!!(s!=null&&s.returnNumber),i=s==null?void 0:s.returnNumber,o=re({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),h=p(()=>{if(!s)return[];if(!f){const d=(s==null?void 0:s.items)??[],t=d.filter(a=>a.quantityReturned),n=d.filter(a=>a.quantityCanceled),l=d.filter(a=>!a.quantityCanceled);return[{type:"returned",list:t,title:o.returned},{type:"cancelled",list:n,title:o.cancelled},{type:"allItems",list:l,title:o.allOrders}].filter(a=>a.list.length>0)}const m=s.returns.find(d=>d.returnNumber===i);return[{type:"returned",list:(m==null?void 0:m.items)??[],title:o.returned}]},[s,f,o,i]);return s?h.every(m=>m.list.length===0)?null:r(Y,{variant:"secondary",className:"order-order-product-list-content",children:h.map((m,k)=>{var d;return E(se,{children:[O?r(g,{title:`${m.title} (${m.list.length})`}):null,r("ul",{className:"order-order-product-list-content__items",children:(d=m.list)==null?void 0:d.map(t=>r("li",{"data-testid":"order-product-list-content-item",children:r(ue,{loading:v,product:t,itemType:m.type,taxConfig:e,translations:o,showConfigurableOptions:u,routeProductDetails:y})},t.id))})]},k)})}):r(ae,{})},ue=({loading:v,product:e,itemType:s,taxConfig:O,translations:u,showConfigurableOptions:y,routeProductDetails:f})=>{var x,q,H,V,$,M,P,Q,F,G,R,Z,j,z,W,B,K;const{taxExcluded:i,taxIncluded:o}=O,h=ee((c,U,X)=>r(D,{amount:c,currency:U,weight:"normal",...X}),[]);let m={};const k=s==="cancelled",d=(q=(x=e==null?void 0:e.product)==null?void 0:x.stockStatus)==null?void 0:q.includes("IN_STOCK"),t=(e==null?void 0:e.giftCard)||{},n=(H=e==null?void 0:e.itemPrices)==null?void 0:H.priceIncludingTax,l=(V=e==null?void 0:e.itemPrices)==null?void 0:V.originalPrice,a=($=e==null?void 0:e.itemPrices)==null?void 0:$.price,b=s==="returned"?e==null?void 0:e.requestQuantity:e==null?void 0:e.totalQuantity,L=e.discounted&&((M=e.price)==null?void 0:M.value)!==(l==null?void 0:l.value)*b,_={..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in t&&(t!=null&&t.senderName)?{[u.sender]:t==null?void 0:t.senderName}:{},..."senderEmail"in t&&(t!=null&&t.senderEmail)?{[u.sender]:t==null?void 0:t.senderEmail}:{},..."recipientName"in t&&(t!=null&&t.recipientName)?{[u.recipient]:t==null?void 0:t.recipientName}:{},..."recipientEmail"in t&&(t!=null&&t.recipientEmail)?{[u.recipient]:t==null?void 0:t.recipientEmail}:{},..."message"in t&&(t!=null&&t.message)?{[u.message]:t==null?void 0:t.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(P=e==null?void 0:e.downloadableLinks)==null?void 0:P.count} ${u.downloadableCount}`]:(Q=e==null?void 0:e.downloadableLinks)==null?void 0:Q.result}:{}};if(o&&i){const c=L?l==null?void 0:l.value:(n==null?void 0:n.value)*b;m={taxExcluded:!0,taxIncluded:void 0,price:h(l==null?void 0:l.value,l==null?void 0:l.currency),total:E(w,{children:[h(c,l==null?void 0:l.currency,{variant:e.discounted&&(n==null?void 0:n.value)!==c?"strikethrough":"default"}),e.discounted&&(n==null?void 0:n.value)!==c?h(n==null?void 0:n.value,n==null?void 0:n.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:h((a==null?void 0:a.value)*b,a==null?void 0:a.currency)}}else if(!o&&i)m={taxExcluded:void 0,taxIncluded:void 0,price:h(l==null?void 0:l.value,l==null?void 0:l.currency),total:E(w,{children:[h((l==null?void 0:l.value)*b,n==null?void 0:n.currency,{variant:L?"strikethrough":"default"}),L?h((F=e.price)==null?void 0:F.value,(G=e.price)==null?void 0:G.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:h((a==null?void 0:a.value)*(e==null?void 0:e.totalQuantity),a==null?void 0:a.currency)};else if(o&&!i){const c=L?l.value:n.value*b;m={taxExcluded:void 0,taxIncluded:!0,price:h(n==null?void 0:n.value,n==null?void 0:n.currency),total:E(w,{children:[h(c,n==null?void 0:n.currency,{variant:L?"strikethrough":"default",weight:"bold"}),L?h(n==null?void 0:n.value,n==null?void 0:n.currency,{sale:!0,weight:"bold"}):null]})}}return r(I,{loading:v,alert:k&&d?E("span",{children:[r(T,{source:ie}),u.outOfStock]}):r(w,{}),configurations:(y==null?void 0:y(_))??_,title:f?r("a",{"data-testid":"product-name",className:S(["cart-summary-item__title",["cart-summary-item__title--strikethrough",k]]),href:f(e),children:(R=e==null?void 0:e.product)==null?void 0:R.name}):r("div",{"data-testid":"product-name",className:S(["cart-summary-item__title",["cart-summary-item__title--strikethrough",k]]),children:(Z=e==null?void 0:e.product)==null?void 0:Z.name}),sku:r("div",{children:(j=e==null?void 0:e.product)==null?void 0:j.sku}),quantity:b,image:f?r("a",{href:f(e),children:r(A,{src:(z=e==null?void 0:e.product)==null?void 0:z.thumbnail.url,alt:(W=e==null?void 0:e.product)==null?void 0:W.thumbnail.label,loading:"lazy",width:"90",height:"120"})}):r(A,{src:(B=e==null?void 0:e.product)==null?void 0:B.thumbnail.url,alt:(K=e==null?void 0:e.product)==null?void 0:K.thumbnail.label,loading:"lazy",width:"90",height:"120"}),...m})},Ce=({className:v,orderData:e,withHeader:s,showConfigurableOptions:O,routeProductDetails:u})=>{const{loading:y,taxConfig:f,order:i}=me({orderData:e});return r("div",{className:S(["order-order-product-list",v]),children:r(he,{loading:y,taxConfig:f,order:i,withHeader:s,showConfigurableOptions:O,routeProductDetails:u})})};export{Ce as OrderProductList,Ce as default}; +import{jsx as i,jsxs as S}from"@dropins/tools/preact-jsx-runtime.js";import{Card as T,Header as N}from"@dropins/tools/components.js";import{C as b}from"../chunks/OrderCancel.js";import{classes as k}from"@dropins/tools/lib.js";import{useState as O,useEffect as P,useMemo as v}from"@dropins/tools/preact-hooks.js";import{events as G}from"@dropins/tools/event-bus.js";import{s as j}from"../chunks/setTaxStatus.js";import{g as q}from"../chunks/getStoreConfig.js";import{Fragment as w}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as x}from"../chunks/returnOrdersHelper.js";import{O as E}from"../chunks/OrderLoaders.js";import{useText as F}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const _=({orderData:l})=>{const[a,t]=O(!0),[u,c]=O(l),[m,d]=O({taxIncluded:!1,taxExcluded:!1});return P(()=>{q().then(e=>{if(e){const r=j(e==null?void 0:e.shoppingCartDisplayPrice);d(r)}}).finally(()=>{t(!1)})},[]),P(()=>{const e=G.on("order/data",r=>{c(r)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:a,taxConfig:m,order:u}},$=({loading:l,taxConfig:a,order:t=null,withHeader:u=!0,showConfigurableOptions:c,routeProductDetails:m})=>{const d=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,r=F({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),C=v(()=>{var f,p;if(!t)return[];if(!d){const s=((f=x(t))==null?void 0:f.modifyOrder)??[],y=((p=x(t))==null?void 0:p.returnedList)??[],h=s==null?void 0:s.filter(o=>o.quantityCanceled),I=s==null?void 0:s.filter(o=>!o.quantityCanceled);return[{type:"returned",list:y,title:r.returned},{type:"cancelled",list:h,title:r.cancelled},{type:"allItems",list:I,title:r.allOrders}].filter(o=>{var L;return((L=o==null?void 0:o.list)==null?void 0:L.length)>0})}const n=t.returns.find(s=>s.returnNumber===e);return[{type:"returned",list:(n==null?void 0:n.items)??[],title:r.returned}]},[t,d,r,e]);return t?C.every(n=>n.list.length===0)?null:i(T,{variant:"secondary",className:"order-order-product-list-content",children:C.map((n,g)=>{var f;return S(w,{children:[u?i(N,{title:`${n.title} (${n.list.length})`}):null,i("ul",{className:"order-order-product-list-content__items",children:(f=n.list)==null?void 0:f.map(p=>i("li",{"data-testid":"order-product-list-content-item",children:i(b,{loading:l,product:p,itemType:n.type,taxConfig:a,translations:r,showConfigurableOptions:c,routeProductDetails:m})},p.id))})]},g)})}):i(E,{})},tt=({className:l,orderData:a,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})=>{const{loading:m,taxConfig:d,order:e}=_({orderData:a});return i("div",{className:k(["order-order-product-list",l]),children:i($,{loading:m,taxConfig:d,order:e,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})})};export{tt as OrderProductList,tt as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderReturns.js b/scripts/__dropins__/storefront-order/containers/OrderReturns.js index 7443681d7b..4814fc287f 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderReturns.js +++ b/scripts/__dropins__/storefront-order/containers/OrderReturns.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as c}from"@dropins/tools/lib.js";import{useState as d,useEffect as R}from"@dropins/tools/preact-hooks.js";import{events as L}from"@dropins/tools/event-bus.js";import{u as O}from"../chunks/useIsMobile.js";import"@dropins/tools/preact-compat.js";import{R as b}from"../chunks/ReturnsListContent.js";import"@dropins/tools/preact.js";import{useText as g}from"@dropins/tools/i18n.js";import"../chunks/returnOrdersHelper.js";import"../chunks/OrderLoaders.js";const w=({orderData:s})=>{const[i,n]=d(s),[u,o]=d([]);return R(()=>{const t=L.on("order/data",e=>{n(e),o(e==null?void 0:e.returns)},{eager:!0});return()=>{t==null||t.off()}},[]),{order:i,orderReturns:u}},j=({slots:s,className:i,orderData:n,withHeader:u,withThumbnails:o,routeReturnDetails:t,routeProductDetails:e,routeTracking:f})=>{const{orderReturns:m}=w({orderData:n}),l=O(),r="fullSizeView",p=g({minifiedViewTitle:`Order.Returns.${r}.returnsList.minifiedViewTitle`,ariaLabelLink:`Order.Returns.${r}.returnsList.ariaLabelLink`,emptyOrdersListMessage:`Order.Returns.${r}.returnsList.emptyOrdersListMessage`,orderNumber:`Order.Returns.${r}.returnsList.orderNumber`,returnNumber:`Order.Returns.${r}.returnsList.returnNumber`,carrier:`Order.Returns.${r}.returnsList.carrier`});return a("div",{className:c(["order-order-returns",i]),children:m.length?a(b,{pageInfo:{pageSize:1,totalPages:1,currentPage:1},minifiedViewKey:r,slots:s,isMobile:l,withOrderNumber:!1,withReturnNumber:!0,orderReturns:m,translations:p,withHeader:u,withThumbnails:o,minifiedView:!1,routeReturnDetails:t,routeProductDetails:e,routeTracking:f,loading:!1}):null})};export{j as OrderReturns,j as default}; +import{jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as c}from"@dropins/tools/lib.js";import{useState as d,useEffect as R}from"@dropins/tools/preact-hooks.js";import{events as L}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as O}from"../chunks/useIsMobile.js";import"@dropins/tools/preact-compat.js";import{R as b}from"../chunks/ReturnsListContent.js";import{useText as g}from"@dropins/tools/i18n.js";import"../chunks/returnOrdersHelper.js";import"../chunks/form.types.js";import"../chunks/OrderLoaders.js";const w=({orderData:s})=>{const[i,n]=d(s),[u,o]=d([]);return R(()=>{const t=L.on("order/data",e=>{n(e),o(e==null?void 0:e.returns)},{eager:!0});return()=>{t==null||t.off()}},[]),{order:i,orderReturns:u}},v=({slots:s,className:i,orderData:n,withHeader:u,withThumbnails:o,routeReturnDetails:t,routeProductDetails:e,routeTracking:f})=>{const{orderReturns:m}=w({orderData:n}),l=O(),r="fullSizeView",p=g({minifiedViewTitle:`Order.Returns.${r}.returnsList.minifiedViewTitle`,ariaLabelLink:`Order.Returns.${r}.returnsList.ariaLabelLink`,emptyOrdersListMessage:`Order.Returns.${r}.returnsList.emptyOrdersListMessage`,orderNumber:`Order.Returns.${r}.returnsList.orderNumber`,returnNumber:`Order.Returns.${r}.returnsList.returnNumber`,carrier:`Order.Returns.${r}.returnsList.carrier`});return a("div",{className:c(["order-order-returns",i]),children:m.length?a(b,{pageInfo:{pageSize:1,totalPages:1,currentPage:1},minifiedViewKey:r,slots:s,isMobile:l,withOrderNumber:!1,withReturnNumber:!0,orderReturns:m,translations:p,withHeader:u,withThumbnails:o,minifiedView:!1,routeReturnDetails:t,routeProductDetails:e,routeTracking:f,loading:!1}):null})};export{v as OrderReturns,v as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderSearch.js b/scripts/__dropins__/storefront-order/containers/OrderSearch.js index 67f81b4e89..a78fe86b4b 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderSearch.js +++ b/scripts/__dropins__/storefront-order/containers/OrderSearch.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsxs as w,jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as _}from"@dropins/tools/lib.js";import{Card as U,InLineAlert as C,Icon as x,Button as V}from"@dropins/tools/components.js";import{F as L}from"../chunks/OrderCancel.js";import{useState as R,useCallback as D,useEffect as O,useMemo as H}from"@dropins/tools/preact-hooks.js";import{events as g}from"@dropins/tools/event-bus.js";import*as A from"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{Text as N,useText as k}from"@dropins/tools/i18n.js";import{r as d}from"../chunks/redirectTo.js";import{a as I,g as P}from"../chunks/getCustomer.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getGuestOrder.graphql.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";const q=e=>A.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},A.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),X=({onSubmit:e,loading:a,inLineAlert:o,fieldsConfig:t})=>w(U,{variant:"secondary",className:"order-order-search-form",children:[s("h2",{className:"order-order-search-form__title",children:s(N,{id:"Order.OrderSearchForm.title"})}),s("p",{children:s(N,{id:"Order.OrderSearchForm.description"})}),o.text?s(C,{"data-testid":"orderAlert",className:"order-order-search-form__alert",type:o.type,variant:"secondary",heading:o.text,icon:s(x,{source:q})}):null,s(L,{className:"order-order-search-form__wrapper",name:"orderSearchForm",loading:a,fieldsConfig:t,onSubmit:e,children:s("div",{className:"order-order-search-form__button-container",children:s(V,{className:"order-order-search-form__button",size:"medium",variant:"primary",type:"submit",disabled:a,children:s(N,{id:"Order.OrderSearchForm.button"})},"logIn")})})]});var h=(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))(h||{});const B=e=>{if(!e)return null;const a=new FormData(e);if(e.querySelectorAll('input[type="checkbox"]').forEach(t=>{a.has(t.name)||a.set(t.name,"false"),t.checked&&a.set(t.name,"true")}),a&&typeof a.entries=="function"){const t=a.entries();if(t&&typeof t[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(t)))||{}}return{}},M=e=>{try{return new URL(window.location.href).searchParams.get(e)}catch{return null}},G=({onError:e,isAuth:a,renderSignIn:o,routeCustomerOrder:t,routeGuestOrder:m})=>{const[E,p]=R({text:"",type:"success"}),[y,u]=R(!1),i=k({invalidSearch:"Order.Errors.invalidSearch",email:"Order.OrderSearchForm.email",postcode:"Order.OrderSearchForm.postcode",number:"Order.OrderSearchForm.orderNumber"}),S=D(async r=>{const c=M("orderRef"),n=c&&c.length>20;if(!r&&!c||!(r!=null&&r.number)&&!(r!=null&&r.token)&&!c)return null;if(a){const f=await I();(f==null?void 0:f.email)===r.email?d(t,{orderRef:r==null?void 0:r.number}):n||d(m,{orderRef:r.token})}else n||d(m,{orderRef:r==null?void 0:r.token})},[a,t,m]);O(()=>{const r=g.on("order/data",c=>{S(c)},{eager:!0});return()=>{r==null||r.off()}},[S]),O(()=>{const r=M("orderRef"),c=r&&r.length>20?r:null;r&&(c?d(m,{orderRef:r}):a?d(t,{orderRef:r}):o==null||o({render:!0,formValues:{number:r}}))},[a,t,m,o]);const v=H(()=>[{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:i.email,options:[],defaultValue:"",fieldType:h.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:i.postcode,options:[],defaultValue:"",fieldType:h.TEXT,className:"",required:!0,orderNumber:2,name:"postcode",id:"postcode",code:"postcode"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:i.number,options:[],defaultValue:"",fieldType:h.TEXT,className:"",required:!0,orderNumber:3,name:"number",id:"number",code:"number"}],[i]);return{onSubmit:D(async(r,c)=>{if(!c)return null;u(!0);const n=B(r.target);await P(n).then(l=>{l||p({text:i.invalidSearch,type:"warning"}),g.emit("order/data",l)}).catch(async l=>{var b;let f=!0;e==null||e({error:l.message});const T=a?await I():{email:""};(T==null?void 0:T.email)===(n==null?void 0:n.email)?d(t,{orderRef:n.number}):f=o==null?void 0:o({render:T===null||((b=l==null?void 0:l.message)==null?void 0:b.includes("Please login to view the order.")),formValues:n}),f&&p({text:l.message,type:"warning"})}).finally(()=>{u(!1)})},[a,e,o,t,i.invalidSearch]),inLineAlert:E,loading:y,normalizeFieldsConfig:v}},le=({className:e,isAuth:a,renderSignIn:o,routeCustomerOrder:t,routeGuestOrder:m,onError:E})=>{const{onSubmit:p,loading:y,inLineAlert:u,normalizeFieldsConfig:i}=G({onError:E,isAuth:a,renderSignIn:o,routeCustomerOrder:t,routeGuestOrder:m});return s("div",{className:_(["order-order-search",e]),children:s(X,{onSubmit:p,loading:y,inLineAlert:u,fieldsConfig:i})})};export{le as OrderSearch,le as default}; +import{jsxs as V,jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L}from"@dropins/tools/lib.js";import{Card as M,InLineAlert as k,Icon as C,Button as q}from"@dropins/tools/components.js";import{F as D}from"../chunks/OrderCancel.js";import{useState as v,useCallback as w,useEffect as F,useMemo as U}from"@dropins/tools/preact-hooks.js";import{events as _}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import*as N from"@dropins/tools/preact-compat.js";import{Text as g,useText as H}from"@dropins/tools/i18n.js";import{F as T}from"../chunks/form.types.js";import{g as B}from"../chunks/getFormValues.js";import{r as f}from"../chunks/redirectTo.js";import{g as E,a as z}from"../chunks/getCustomer.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getGuestOrder.graphql.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";const P=t=>N.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),X=({onSubmit:t,loading:r,inLineAlert:a,fieldsConfig:o})=>V(M,{variant:"secondary",className:"order-order-search-form",children:[s("h2",{className:"order-order-search-form__title",children:s(g,{id:"Order.OrderSearchForm.title"})}),s("p",{children:s(g,{id:"Order.OrderSearchForm.description"})}),a.text?s(k,{"data-testid":"orderAlert",className:"order-order-search-form__alert",type:a.type,variant:"secondary",heading:a.text,icon:s(C,{source:P})}):null,s(D,{className:"order-order-search-form__wrapper",name:"orderSearchForm",loading:r,fieldsConfig:o,onSubmit:t,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:r,children:s(g,{id:"Order.OrderSearchForm.button"})},"logIn")})})]}),x=t=>{try{return new URL(window.location.href).searchParams.get(t)}catch{return null}},Z=({onError:t,isAuth:r,renderSignIn:a,routeCustomerOrder:o,routeGuestOrder:c})=>{const[y,u]=v({text:"",type:"success"}),[b,p]=v(!1),m=H({invalidSearch:"Order.Errors.invalidSearch",email:"Order.OrderSearchForm.email",postcode:"Order.OrderSearchForm.postcode",number:"Order.OrderSearchForm.orderNumber"}),R=w(async e=>{const i=x("orderRef"),l=i&&i.length>20;if(!e&&!i||!(e!=null&&e.number)&&!(e!=null&&e.token)&&!i)return null;if(r){const d=await E();(d==null?void 0:d.email)===e.email?f(o,{orderRef:e==null?void 0:e.number}):l||f(c,{orderRef:e.token})}else l||f(c,{orderRef:e==null?void 0:e.token})},[r,o,c]);F(()=>{const e=_.on("order/data",i=>{R(i)},{eager:!0});return()=>{e==null||e.off()}},[R]),F(()=>{const e=x("orderRef"),i=e&&e.length>20?e:null;e&&(i?f(c,{orderRef:e}):r?f(o,{orderRef:e}):a==null||a({render:!0,formValues:{number:e}}))},[r,o,c,a]);const O=U(()=>[{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.email,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.postcode,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:2,name:"postcode",id:"postcode",code:"postcode"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.number,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:3,name:"number",id:"number",code:"number"}],[m]);return{onSubmit:w(async(e,i)=>{if(!i)return null;p(!0);const l=B(e.target);await z(l).then(n=>{n||u({text:m.invalidSearch,type:"warning"}),_.emit("order/data",n)}).catch(async n=>{var S;let d=!0;t==null||t({error:n.message});const h=r?await E():{email:""};(h==null?void 0:h.email)===(l==null?void 0:l.email)?f(o,{orderRef:l.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:l}),d&&u({text:n.message,type:"warning"})}).finally(()=>{p(!1)})},[r,t,a,o,m.invalidSearch]),inLineAlert:y,loading:b,normalizeFieldsConfig:O}},ce=({className:t,isAuth:r,renderSignIn:a,routeCustomerOrder:o,routeGuestOrder:c,onError:y})=>{const{onSubmit:u,loading:b,inLineAlert:p,normalizeFieldsConfig:m}=Z({onError:y,isAuth:r,renderSignIn:a,routeCustomerOrder:o,routeGuestOrder:c});return s("div",{className:L(["order-order-search",t]),children:s(X,{onSubmit:u,loading:b,inLineAlert:p,fieldsConfig:m})})};export{ce as OrderSearch,ce as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderStatus.js b/scripts/__dropins__/storefront-order/containers/OrderStatus.js index 951cce66bc..73e1279563 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderStatus.js +++ b/scripts/__dropins__/storefront-order/containers/OrderStatus.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as c,jsxs as N,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{Card as U,Header as F,Button as E,InLineAlert as P,Modal as K}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{f as k}from"../chunks/returnOrdersHelper.js";import{classes as y,Slot as G}from"@dropins/tools/lib.js";import{f as b}from"../chunks/formatDateToLocale.js";import{useState as O,useEffect as I,useCallback as V}from"@dropins/tools/preact-hooks.js";import{events as v}from"@dropins/tools/event-bus.js";import{useMemo as q,useState as H}from"@dropins/tools/preact-compat.js";import{r as x}from"../chunks/redirectTo.js";import"@dropins/tools/preact.js";import{O as W}from"../chunks/OrderCancelForm.js";import{useText as C,Text as L}from"@dropins/tools/i18n.js";import{r as j}from"../chunks/reorderItems.js";import{C as J}from"../chunks/OrderLoaders.js";import{G as z}from"../chunks/getGuestOrder.graphql.js";import{f as B,h as Q}from"../chunks/fetch-graphql.js";import{b as X}from"../chunks/transform-order-details.js";import{g as Y}from"../chunks/getStoreConfig.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";const w={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested"},Z=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:i,onError:s,routeOnSuccess:d})=>{var M;const l=!!(e!=null&&e.returnNumber),a=String(n).toLocaleLowerCase(),o=(M=e==null?void 0:e.returns)==null?void 0:M[0],m=(o==null?void 0:o.returnStatus)??"",p=(o==null?void 0:o.createdReturnAt)??"",g=C(`Order.OrderStatusContent.${w[a]}.title`),h=C(`Order.OrderStatusContent.${w[a]}.message`),R=C(`Order.OrderStatusContent.${w[a]}.messageWithoutDate`),u=C({title:`Order.OrderStatusContent.resturnStatus.${k(m)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return c("div",{});const f=e!=null&&e.orderStatusChangeDate?h==null?void 0:h.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):R.messageWithoutDate,A=(u==null?void 0:u.returnMessage.replace("{ORDER_CREATE_DATE}",b(e==null?void 0:e.orderDate)).replace("{RETURN_CREATE_DATE}",b(p)))??"",T=l?t??u.title:t??g.title;return N(U,{className:"order-order-status-content",variant:"secondary",children:[c(F,{title:T}),N("div",{className:"order-order-status-content__wrapper",children:[c("div",{className:y(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:c("p",{children:l?A:f})}),c(ee,{orderData:e,slots:r,routeCreateReturn:i,routeOnSuccess:d,onError:s})]})]})};var _=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(_||{});const D=({orderData:r})=>{const[t,n]=O(r),[e,i]=O(r==null?void 0:r.status);return I(()=>{const s=v.on("order/data",d=>{n(d),i(d.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},ee=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:i,onError:s})=>{const d=C({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=q(()=>{const a=t==null?void 0:t.availableActions,o=!!(a!=null&&a.length),m=!!(t!=null&&t.returnNumber),p=()=>{x(e,{},t)};return c(S,{children:n!=null&&n.OrderActions?c(G,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):c("div",{"data-testid":"availableActionsList",className:y(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!o]]),children:a==null?void 0:a.map(g=>{switch(g){case _.CANCEL:return c(S,{children:m?null:!!t&&c(se,{orderRef:t.token??atob(t.id)})});case _.RETURN:return c(E,{variant:"secondary",onClick:p,children:m?d.createAnotherReturn:d.createReturn});case _.REORDER:return c(S,{children:m?null:c(oe,{orderData:t,onError:s,routeOnSuccess:i,children:d.reorder})})}})})})},[s,t,i,e,n,d]);return c("div",{className:y(["order-order-actions",r]),children:l})},$=()=>{const[r,t]=O(null);return I(()=>{const n=sessionStorage.getItem("orderStoreConfig"),e=n?JSON.parse(n):null;e?t(e):Y().then(i=>{i&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(i)),t(i))})},[]),r},re=` +import{jsx as c,jsxs as N,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{Card as U,Header as F,Button as E,InLineAlert as P,Modal as K}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{f as k}from"../chunks/returnOrdersHelper.js";import{classes as y,Slot as G}from"@dropins/tools/lib.js";import{f as b}from"../chunks/formatDateToLocale.js";import{useState as O,useEffect as I,useCallback as V}from"@dropins/tools/preact-hooks.js";import{events as v}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{useMemo as q,useState as H}from"@dropins/tools/preact-compat.js";import{r as x}from"../chunks/redirectTo.js";import{O as W}from"../chunks/OrderCancelForm.js";import{useText as C,Text as L}from"@dropins/tools/i18n.js";import{r as j}from"../chunks/reorderItems.js";import{C as J}from"../chunks/OrderLoaders.js";import{G as z}from"../chunks/getGuestOrder.graphql.js";import{f as B,h as Q}from"../chunks/fetch-graphql.js";import{b as X}from"../chunks/transform-order-details.js";import{g as Y}from"../chunks/getStoreConfig.js";import"../chunks/form.types.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";var _=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(_||{});const w={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested"},Z=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:i,onError:s,routeOnSuccess:d})=>{var M;const l=!!(e!=null&&e.returnNumber),a=String(n).toLocaleLowerCase(),o=(M=e==null?void 0:e.returns)==null?void 0:M[0],m=(o==null?void 0:o.returnStatus)??"",p=(o==null?void 0:o.createdReturnAt)??"",g=C(`Order.OrderStatusContent.${w[a]}.title`),h=C(`Order.OrderStatusContent.${w[a]}.message`),R=C(`Order.OrderStatusContent.${w[a]}.messageWithoutDate`),u=C({title:`Order.OrderStatusContent.returnStatus.${k(m)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return c("div",{});const f=e!=null&&e.orderStatusChangeDate?h==null?void 0:h.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):R.messageWithoutDate,A=(u==null?void 0:u.returnMessage.replace("{ORDER_CREATE_DATE}",b(e==null?void 0:e.orderDate)).replace("{RETURN_CREATE_DATE}",b(p)))??"",T=l?t??u.title:t??g.title;return N(U,{className:"order-order-status-content",variant:"secondary",children:[c(F,{title:T}),N("div",{className:"order-order-status-content__wrapper",children:[c("div",{className:y(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:c("p",{children:l?A:f})}),c(ee,{orderData:e,slots:r,routeCreateReturn:i,routeOnSuccess:d,onError:s})]})]})},D=({orderData:r})=>{const[t,n]=O(r),[e,i]=O(r==null?void 0:r.status);return I(()=>{const s=v.on("order/data",d=>{n(d),i(d.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},ee=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:i,onError:s})=>{const d=C({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=q(()=>{const a=t==null?void 0:t.availableActions,o=!!(a!=null&&a.length),m=!!(t!=null&&t.returnNumber),p=()=>{x(e,{},t)};return c(S,{children:n!=null&&n.OrderActions?c(G,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):c("div",{"data-testid":"availableActionsList",className:y(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!o]]),children:a==null?void 0:a.map(g=>{switch(g){case _.CANCEL:return c(S,{children:m?null:!!t&&c(se,{orderRef:t.token??atob(t.id)})});case _.RETURN:return c(E,{variant:"secondary",onClick:p,children:m?d.createAnotherReturn:d.createReturn});case _.REORDER:return c(S,{children:m?null:c(oe,{orderData:t,onError:s,routeOnSuccess:i,children:d.reorder})})}})})})},[s,t,i,e,n,d]);return c("div",{className:y(["order-order-actions",r]),children:l})},$=()=>{const[r,t]=O(null);return I(()=>{const n=sessionStorage.getItem("orderStoreConfig"),e=n?JSON.parse(n):null;e?t(e):Y().then(i=>{i&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(i)),t(i))})},[]),r},re=` mutation CONFIRM_CANCEL_ORDER_MUTATION( $orderId: ID!, $confirmationKey: String! @@ -19,4 +19,4 @@ import{jsx as c,jsxs as N,Fragment as S}from"@dropins/tools/preact-jsx-runtime.j } } ${z} -`,te=async(r,t)=>B(re,{variables:{orderId:r,confirmationKey:t}}).then(async({errors:n,data:e})=>{var d,l,a,o;const i=[...(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(a=e==null?void 0:e.confirmCancelOrder)!=null&&a.order&&(s=X((o=e==null?void 0:e.confirmCancelOrder)==null?void 0:o.order),v.emit("order/data",s)),i.length>0?Q(i):s}),ne=({enableOrderCancellation:r})=>{const t=C({orderCancelled:"Order.OrderStatusContent.orderCanceled.message"}),[n,e]=O({text:"",status:void 0});return I(()=>{if(!r)return;const i=new URLSearchParams(window.location.search),s=i.get("orderId"),d=i.get("confirmationKey");s&&d&&te(atob(s),d).then(()=>{e({text:t.orderCancelled,status:"success"})}).catch(l=>{e({text:l.message,status:"warning"})})},[r,t.orderCancelled]),{confirmOrderCancellation:n}},ve=({slots:r,orderData:t,className:n,statusTitle:e,status:i,routeCreateReturn:s,onError:d,routeOnSuccess:l})=>{const{orderStatus:a,order:o}=D({orderData:t}),[m,p]=H(!1),g=()=>{p(!0);const f=new URL(window.location.href),A=f.searchParams.get("orderId"),T=f.searchParams.get("confirmationKey");A&&T&&(f.searchParams.delete("orderId"),f.searchParams.delete("confirmationKey"),window.history.replaceState({},document.title,f.toString()))},h=C({cancelOrder:"Order.OrderStatusContent.actions.cancel"}),R=$(),{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&&c(P,{heading:h.cancelOrder,onDismiss:g,description:u.text,type:u.status}),o?c(Z,{title:e,status:i||a,slots:r,orderData:o,routeCreateReturn:s,onError:d,routeOnSuccess:l}):c(J,{withCard:!1})]})},se=({orderRef:r})=>{const[t,n]=O(!1),e=()=>{n(!0)},i=()=>{n(!1)},s=$(),d=(s==null?void 0:s.orderCancellationReasons)??[],l=a=>a.map((o,m)=>({text:o==null?void 0:o.description,value:m.toString()}));return v.on("order/data",a=>{const o=String(a.status).toLocaleLowerCase();(o==="guest order cancellation requested"||o==="canceled")&&i()}),N(S,{children:[c(E,{variant:"secondary",onClick:e,"data-testid":"cancel-button",children:c(L,{id:"Order.OrderStatusContent.actions.cancel"})}),t&&c(K,{centered:!0,size:"medium",onClose:i,className:"order-order-cancel__modal",title:c("h2",{className:"order-order-cancel__title",children:c(L,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:c(W,{orderRef:r,cancelReasons:l(d)})})]})},oe=({onError:r,routeOnSuccess:t,orderData:n,children:e})=>{const[i,s]=O(!1),d=V(()=>{s(!0);const l=n==null?void 0:n.number;j(l).then(({success:a,userInputErrors:o})=>{a&&x(t,{}),o.length&&(r==null||r(o))}).catch(a=>{r==null||r(a.message)}).finally(()=>{s(!1)})},[n,t,r]);return c(E,{type:"button",disabled:i,variant:"secondary",className:"order-reorder",onClick:d,children:e})};export{ve as OrderStatus,ve as default}; +`,te=async(r,t)=>B(re,{variables:{orderId:r,confirmationKey:t}}).then(async({errors:n,data:e})=>{var d,l,a,o;const i=[...(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(a=e==null?void 0:e.confirmCancelOrder)!=null&&a.order&&(s=X((o=e==null?void 0:e.confirmCancelOrder)==null?void 0:o.order),v.emit("order/data",s)),i.length>0?Q(i):s}),ne=({enableOrderCancellation:r})=>{const t=C({orderCancelled:"Order.OrderStatusContent.orderCanceled.message"}),[n,e]=O({text:"",status:void 0});return I(()=>{if(!r)return;const i=new URLSearchParams(window.location.search),s=i.get("orderId"),d=i.get("confirmationKey");s&&d&&te(atob(s),d).then(()=>{e({text:t.orderCancelled,status:"success"})}).catch(l=>{e({text:l.message,status:"warning"})})},[r,t.orderCancelled]),{confirmOrderCancellation:n}},Me=({slots:r,orderData:t,className:n,statusTitle:e,status:i,routeCreateReturn:s,onError:d,routeOnSuccess:l})=>{const{orderStatus:a,order:o}=D({orderData:t}),[m,p]=H(!1),g=()=>{p(!0);const f=new URL(window.location.href),A=f.searchParams.get("orderId"),T=f.searchParams.get("confirmationKey");A&&T&&(f.searchParams.delete("orderId"),f.searchParams.delete("confirmationKey"),window.history.replaceState({},document.title,f.toString()))},h=C({cancelOrder:"Order.OrderStatusContent.actions.cancel"}),R=$(),{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&&c(P,{heading:h.cancelOrder,onDismiss:g,description:u.text,type:u.status}),o?c(Z,{title:e,status:i||a,slots:r,orderData:o,routeCreateReturn:s,onError:d,routeOnSuccess:l}):c(J,{withCard:!1})]})},se=({orderRef:r})=>{const[t,n]=O(!1),e=()=>{n(!0)},i=()=>{n(!1)},s=$(),d=(s==null?void 0:s.orderCancellationReasons)??[],l=a=>a.map((o,m)=>({text:o==null?void 0:o.description,value:m.toString()}));return v.on("order/data",a=>{const o=String(a.status).toLocaleLowerCase();(o==="guest order cancellation requested"||o==="canceled")&&i()}),N(S,{children:[c(E,{variant:"secondary",onClick:e,"data-testid":"cancel-button",children:c(L,{id:"Order.OrderStatusContent.actions.cancel"})}),t&&c(K,{centered:!0,size:"medium",onClose:i,className:"order-order-cancel__modal",title:c("h2",{className:"order-order-cancel__title",children:c(L,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:c(W,{orderRef:r,cancelReasons:l(d)})})]})},oe=({onError:r,routeOnSuccess:t,orderData:n,children:e})=>{const[i,s]=O(!1),d=V(()=>{s(!0);const l=n==null?void 0:n.number;j(l).then(({success:a,userInputErrors:o})=>{a&&x(t,{}),o.length&&(r==null||r(o))}).catch(a=>{r==null||r(a.message)}).finally(()=>{s(!1)})},[n,t,r]);return c(E,{type:"button",disabled:i,variant:"secondary",className:"order-reorder",onClick:d,children:e})};export{Me as OrderStatus,Me as default}; diff --git a/scripts/__dropins__/storefront-order/containers/ReturnsList.js b/scripts/__dropins__/storefront-order/containers/ReturnsList.js index 6f63b76398..6c279b51b4 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 c}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as S}from"@dropins/tools/lib.js";import{useState as i,useEffect as $,useCallback as h}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as I}from"../chunks/getCustomerOrdersReturn.js";import{u as y}from"../chunks/useIsMobile.js";import"@dropins/tools/preact-compat.js";import{R as A}from"../chunks/ReturnsListContent.js";import"@dropins/tools/preact.js";import{useText as M}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";import"../chunks/returnOrdersHelper.js";import"../chunks/OrderLoaders.js";const f={totalPages:1,currentPage:1,pageSize:1},T=()=>{const[s,n]=i(!0),[o,t]=i([]),[u,a]=i(f),[m,d]=i(1);$(()=>{I().then(r=>{t((r==null?void 0:r.ordersReturn)??[]),a((r==null?void 0:r.pageInfo)??f)}).finally(()=>{n(!1)})},[]);const l=h(r=>{d(r)},[]);return{pageInfo:u,selectedPage:m,loading:s,orderReturns:o,handleSetSelectPage:l}},W=({slots:s,withReturnsListButton:n,className:o,minifiedView:t,withHeader:u,withThumbnails:a,returnsInMinifiedView:m,routeReturnDetails:d,routeOrderDetails:l,routeTracking:r,routeReturnsList:g,routeProductDetails:L})=>{const{pageInfo:p,selectedPage:R,handleSetSelectPage:O,loading:b,orderReturns:P}=T(),w=y(),e=t?"minifiedView":"fullSizeView",N=M({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 c("div",{className:S(["order-returns-list",o]),children:c(A,{minifiedViewKey:e,withOrderNumber:!0,withReturnNumber:!0,slots:s,selectedPage:R,handleSetSelectPage:O,pageInfo:p,withReturnsListButton:n,isMobile:w,orderReturns:P,translations:N,withHeader:u,returnsInMinifiedView:m,withThumbnails:a,minifiedView:t,routeReturnDetails:d,routeOrderDetails:l,routeTracking:r,routeReturnsList:g,routeProductDetails:L,loading:b})})};export{W as default}; +import{jsx as c}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as S}from"@dropins/tools/lib.js";import{useState as i,useEffect as $,useCallback as h}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as I}from"../chunks/getCustomerOrdersReturn.js";import"@dropins/tools/preact.js";import{u as y}from"../chunks/useIsMobile.js";import"@dropins/tools/preact-compat.js";import{R as A}from"../chunks/ReturnsListContent.js";import{useText as M}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";import"../chunks/returnOrdersHelper.js";import"../chunks/form.types.js";import"../chunks/OrderLoaders.js";const f={totalPages:1,currentPage:1,pageSize:1},T=()=>{const[s,n]=i(!0),[o,t]=i([]),[u,a]=i(f),[m,d]=i(1);$(()=>{I().then(r=>{t((r==null?void 0:r.ordersReturn)??[]),a((r==null?void 0:r.pageInfo)??f)}).finally(()=>{n(!1)})},[]);const l=h(r=>{d(r)},[]);return{pageInfo:u,selectedPage:m,loading:s,orderReturns:o,handleSetSelectPage:l}},X=({slots:s,withReturnsListButton:n,className:o,minifiedView:t,withHeader:u,withThumbnails:a,returnsInMinifiedView:m,routeReturnDetails:d,routeOrderDetails:l,routeTracking:r,routeReturnsList:g,routeProductDetails:p})=>{const{pageInfo:L,selectedPage:R,handleSetSelectPage:O,loading:b,orderReturns:P}=T(),w=y(),e=t?"minifiedView":"fullSizeView",N=M({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 c("div",{className:S(["order-returns-list",o]),children:c(A,{minifiedViewKey:e,withOrderNumber:!0,withReturnNumber:!0,slots:s,selectedPage:R,handleSetSelectPage:O,pageInfo:L,withReturnsListButton:n,isMobile:w,orderReturns:P,translations:N,withHeader:u,returnsInMinifiedView:m,withThumbnails:a,minifiedView:t,routeReturnDetails:d,routeOrderDetails:l,routeTracking:r,routeReturnsList:g,routeProductDetails:p,loading:b})})};export{X as default}; diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index 61e1658aca..a1ac97db38 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{jsxs as u,jsx as n,Fragment as b}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as N,Header as _,Accordion as o,AccordionSection as x,ContentGrid as W,Image as E}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as y,useEffect as J}from"@dropins/tools/preact-hooks.js";import{events as K}from"@dropins/tools/event-bus.js";import{u as Q}from"../chunks/useIsMobile.js";import{Text as $,useText as X}from"@dropins/tools/i18n.js";import{C as Z}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";var R=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(R||{});const Y=({orderData:e})=>{const[r,i]=y(!0),[c,d]=y(e),[m,f]=y(!1);return J(()=>{const a=K.on("order/data",t=>{d(t),f(t==null?void 0:t.isVirtual),i(!1)},{eager:!0});return()=>{a==null||a.off()}},[]),{loading:r,order:c,isVirtualProduct:m}},P=({slots:e,collapseThreshold:r,translations:i,returnData:c,routeTracking:d,routeProductDetails:m})=>{var t;const f=Q(),a=m?"a":"span";return u(N,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(_,{title:i.returnOrderCardTitle}),u("div",{children:[(t=c==null?void 0:c.tracking)==null?void 0:t.map((l,C)=>{var S,p;return u("p",{children:[`${i.carrier} ${(p=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:p.toLocaleUpperCase()}: `,n("a",{href:`${(d==null?void 0:d(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${C}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:c.items}}):null,n(o,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{defaultOpen:r>=c.items.length,title:n($,{id:"Order.ShippingStatusCard.itemText",plural:c.items.length,fields:{count:c.items.length}}),children:n(W,{maxColumns:f?3:9,emptyGridContent:n(b,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",f]]),children:c.items.map((l,C)=>{var I,T;const S=(I=l.thumbnail)==null?void 0:I.label,p=(T=l.thumbnail)==null?void 0:T.url;return n(a,{href:(m==null?void 0:m(l))??"#","data-testid":`${C}${l.uid}`,children:n(E,{alt:S,src:p,width:85,height:114})},`${C}${l.uid}`)})})})})]})]})},k=({translations:e,slots:r,orderData:i,collapseThreshold:c=10,routeProductDetails:d,routeTracking:m})=>{var I,T,w,G,M;const f=!!(i!=null&&i.returnNumber),a=i==null?void 0:i.returnNumber,t=d?"a":"span",l=(I=i==null?void 0:i.status)==null?void 0:I.toLocaleLowerCase(),S=((T=i==null?void 0:i.shipments)==null?void 0:T.length)===1&&(l==null?void 0:l.includes(R.COMPLETE)),p=(w=i==null?void 0:i.items)==null?void 0:w.filter(g=>(g==null?void 0:g.quantityShipped)===0);if(f&&(i!=null&&i.returns.length)){const g=i.returns.find(s=>s.returnNumber===a);return n(b,{children:g&&g.tracking.length>0?n(P,{slots:r,collapseThreshold:c,translations:e,returnData:g,routeTracking:m,routeProductDetails:d}):null})}return!i||l!=null&&l.includes(R.CANCELED)?null:(G=i==null?void 0:i.shipments)!=null&&G.length?u(b,{children:[(M=i==null?void 0:i.shipments)==null?void 0:M.map(({tracking:g,items:s,id:O},z)=>u(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingCardTitle}),g==null?void 0:g.map(h=>{var v;return u("div",{className:"order-shipping-status-card__header",role:"status",children:[u("div",{className:"order-shipping-status-card__header--content",children:[u("p",{children:[e.carrier," ",(v=h==null?void 0:h.carrier)==null?void 0:v.toLocaleUpperCase()," | ",h==null?void 0:h.number]}),n("p",{children:h==null?void 0:h.title})]}),r!=null&&r.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:r==null?void 0:r.DeliveryTrackActions,context:{trackInformation:h}}):null]},h.number)}),S?null:n(o,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{"data-position":z+1,defaultOpen:c>=(s==null?void 0:s.length),title:n(b,{children:n($,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:s==null?void 0:s.length,fields:{count:s==null?void 0:s.length}})}),children:n(W,{maxColumns:6,emptyGridContent:n(b,{}),className:"order-shipping-status-card__images",children:s==null?void 0:s.map(h=>{var V,U,H,j,F,q;const v=(H=(U=(V=h==null?void 0:h.orderItem)==null?void 0:V.product)==null?void 0:U.thumbnail)==null?void 0:H.label,B=(q=(F=(j=h==null?void 0:h.orderItem)==null?void 0:j.product)==null?void 0:F.thumbnail)==null?void 0:q.url;return n(t,{href:(d==null?void 0:d(h))??"#",children:n(E,{alt:v,src:B||"",width:85,height:114})},h.id)})})})}),r!=null&&r.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:r==null?void 0:r.DeliveryTimeLine,context:{}}):null]},O)),p!=null&&p.length?u(N,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(_,{title:e.notYetShippedTitle}),n(o,{actionIconPosition:"right",children:n(x,{defaultOpen:c>=(p==null?void 0:p.length),title:n($,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:p==null?void 0:p.length,fields:{count:p==null?void 0:p.length}}),children:n("div",{className:"order-shipping-status-card__images",children:p==null?void 0:p.map(g=>{var s,O;return n(t,{href:(d==null?void 0:d(g))??"#",children:n(E,{alt:(s=g.thumbnail)==null?void 0:s.label,src:((O=g.thumbnail)==null?void 0:O.url)||"",width:85,height:114})},g.id)})})})})]}):null]}):u(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:u("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},gi=({slots:e,className:r,collapseThreshold:i,orderData:c,routeOrderDetails:d,routeTracking:m,routeProductDetails:f})=>{const{loading:a,order:t,isVirtualProduct:l}=Y({orderData:c}),C=X({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"});return!a&&l?null:n("div",{className:L(["order-shipping-status",r]),children:!a&&t?n(k,{translations:C,routeOrderDetails:d,routeTracking:m,slots:e,orderData:t,collapseThreshold:i,routeProductDetails:f}):n(Z,{withCard:!1})})};export{gi as ShippingStatus,gi as default}; +import{jsxs as u,jsx as n,Fragment as b}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as o}from"@dropins/tools/lib.js";import{Card as v,Header as _,Accordion as A,AccordionSection as x,ContentGrid as E,Image as $}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as y,useEffect as J}from"@dropins/tools/preact-hooks.js";import{events as K}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Q}from"../chunks/useIsMobile.js";import{Text as R,useText as X}from"@dropins/tools/i18n.js";import{C as Z}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var G=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(G||{});const Y=({orderData:e})=>{const[h,i]=y(!0),[c,d]=y(e),[m,f]=y(!1);return J(()=>{const a=K.on("order/data",g=>{d(g),f(g==null?void 0:g.isVirtual),i(!1)},{eager:!0});return()=>{a==null||a.off()}},[]),{loading:h,order:c,isVirtualProduct:m}},P=({slots:e,collapseThreshold:h,translations:i,returnData:c,routeTracking:d,routeProductDetails:m})=>{var g;const f=Q(),a=m?"a":"span";return u(v,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(_,{title:i.returnOrderCardTitle}),u("div",{children:[(g=c==null?void 0:c.tracking)==null?void 0:g.map((l,C)=>{var S,p;return u("p",{children:[`${i.carrier} ${(p=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:p.toLocaleUpperCase()}: `,n("a",{href:`${(d==null?void 0:d(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${C}`)}),e!=null&&e.ReturnItemsDetails?n(o,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:c.items}}):null,n(A,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{defaultOpen:h>=c.items.length,title:n(R,{id:"Order.ShippingStatusCard.itemText",plural:c.items.length,fields:{count:c.items.length}}),children:n(E,{maxColumns:f?3:9,emptyGridContent:n(b,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",f]]),children:c.items.map((l,C)=>{var I,T;const S=(I=l.thumbnail)==null?void 0:I.label,p=(T=l.thumbnail)==null?void 0:T.url;return n(a,{href:(m==null?void 0:m(l))??"#","data-testid":`${C}${l.uid}`,children:n($,{alt:S,src:p,width:85,height:114})},`${C}${l.uid}`)})})})})]})]})},k=({translations:e,slots:h,orderData:i,collapseThreshold:c=10,routeProductDetails:d,routeTracking:m})=>{var I,T,w,M,V;const f=!!(i!=null&&i.returnNumber),a=i==null?void 0:i.returnNumber,g=d?"a":"span",l=(I=i==null?void 0:i.status)==null?void 0:I.toLocaleLowerCase(),S=((T=i==null?void 0:i.shipments)==null?void 0:T.length)===1&&(l==null?void 0:l.includes(G.COMPLETE)),p=(w=i==null?void 0:i.items)==null?void 0:w.filter(t=>(t==null?void 0:t.quantityShipped)===0);if(f&&(i!=null&&i.returns.length)){const t=i.returns.find(s=>s.returnNumber===a);return!t||t.tracking.length===0?null:n(P,{slots:h,collapseThreshold:c,translations:e,returnData:t,routeTracking:m,routeProductDetails:d})}return!i||l!=null&&l.includes(G.CANCELED)?null:(M=i==null?void 0:i.shipments)!=null&&M.length?u(b,{children:[(V=i==null?void 0:i.shipments)==null?void 0:V.map(({tracking:t,items:s,id:O},z)=>u(v,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingCardTitle}),t==null?void 0:t.map(r=>{var N;return u("div",{className:"order-shipping-status-card__header",role:"status",children:[u("div",{className:"order-shipping-status-card__header--content",children:[u("p",{children:[e.carrier," ",(N=r==null?void 0:r.carrier)==null?void 0:N.toLocaleUpperCase()," | ",r==null?void 0:r.number]}),n("p",{children:r==null?void 0:r.title})]}),h!=null&&h.DeliveryTrackActions?n(o,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:h==null?void 0:h.DeliveryTrackActions,context:{trackInformation:r}}):null]},r.number)}),S?null:n(A,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{"data-position":z+1,defaultOpen:c>=(s==null?void 0:s.length),title:n(b,{children:n(R,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:s==null?void 0:s.length,fields:{count:s==null?void 0:s.length}})}),children:n(E,{maxColumns:6,emptyGridContent:n(b,{}),className:"order-shipping-status-card__images",children:s==null?void 0:s.map(r=>{var U,H,j,F,q,W;const N=(j=(H=(U=r==null?void 0:r.orderItem)==null?void 0:U.product)==null?void 0:H.thumbnail)==null?void 0:j.label,B=(W=(q=(F=r==null?void 0:r.orderItem)==null?void 0:F.product)==null?void 0:q.thumbnail)==null?void 0:W.url;return n(g,{href:(d==null?void 0:d(r))??"#",children:n($,{alt:N,src:B||"",width:85,height:114})},r.id)})})})}),h!=null&&h.DeliveryTimeLine?n(o,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:h==null?void 0:h.DeliveryTimeLine,context:{}}):null]},O)),p!=null&&p.length?u(v,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(_,{title:e.notYetShippedTitle}),n(A,{actionIconPosition:"right",children:n(x,{defaultOpen:c>=(p==null?void 0:p.length),title:n(R,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:p==null?void 0:p.length,fields:{count:p==null?void 0:p.length}}),children:n(E,{maxColumns:6,emptyGridContent:n(b,{}),className:"order-shipping-status-card__images",children:p==null?void 0:p.map(t=>{var s,O;return n(g,{href:(d==null?void 0:d(t))??"#",children:n($,{alt:(s=t.thumbnail)==null?void 0:s.label,src:((O=t.thumbnail)==null?void 0:O.url)||"",width:85,height:114})},t.id)})})})})]}):null]}):u(v,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:u("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ti=({slots:e,className:h,collapseThreshold:i,orderData:c,routeOrderDetails:d,routeTracking:m,routeProductDetails:f})=>{const{loading:a,order:g,isVirtualProduct:l}=Y({orderData:c}),C=X({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"});return!a&&l?null:n("div",{className:L(["order-shipping-status",h]),children:!a&&g?n(k,{translations:C,routeOrderDetails:d,routeTracking:m,slots:e,orderData:g,collapseThreshold:i,routeProductDetails:f}):n(Z,{withCard:!1})})};export{ti as ShippingStatus,ti as default}; diff --git a/scripts/__dropins__/storefront-order/containers/index.d.ts b/scripts/__dropins__/storefront-order/containers/index.d.ts index 9779de3123..06da75d995 100644 --- a/scripts/__dropins__/storefront-order/containers/index.d.ts +++ b/scripts/__dropins__/storefront-order/containers/index.d.ts @@ -6,5 +6,6 @@ export * from './ReturnsList'; export * from './OrderProductList'; export * from './OrderCostSummary'; export * from './OrderReturns'; +export * from './CreateReturn'; export * from './OrderCancelForm'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/data/models/attributes-form.d.ts b/scripts/__dropins__/storefront-order/data/models/attributes-form.d.ts index dd7e8ab04b..79e51f662f 100644 --- a/scripts/__dropins__/storefront-order/data/models/attributes-form.d.ts +++ b/scripts/__dropins__/storefront-order/data/models/attributes-form.d.ts @@ -1,24 +1,5 @@ -export declare enum FieldEnumList { - BOOLEAN = "BOOLEAN", - DATE = "DATE", - DATETIME = "DATETIME", - DROPDOWN = "DROPDOWN", - FILE = "FILE", - GALLERY = "GALLERY", - HIDDEN = "HIDDEN", - IMAGE = "IMAGE", - MEDIA_IMAGE = "MEDIA_IMAGE", - MULTILINE = "MULTILINE", - MULTISELECT = "MULTISELECT", - PRICE = "PRICE", - SELECT = "SELECT", - TEXT = "TEXT", - TEXTAREA = "TEXTAREA", - UNDEFINED = "UNDEFINED", - VISUAL = "VISUAL", - WEIGHT = "WEIGHT", - EMPTY = "" -} +import { FieldEnumList } from '../../types'; + export interface AttributesFormItemsProps { code?: string; name?: string; 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 46f864bdda..f308db8e17 100644 --- a/scripts/__dropins__/storefront-order/data/models/order-details.d.ts +++ b/scripts/__dropins__/storefront-order/data/models/order-details.d.ts @@ -19,6 +19,7 @@ export type OrderAddressModel = { }[]; } | null; export type OrderItemProductModel = { + uid: string; __typename: string; stockStatus?: string; canonicalUrl?: string; @@ -35,6 +36,9 @@ export type OrderItemProductModel = { }; }; export type OrderItemModel = { + currentReturnOrderQuantity?: number; + eligibleForReturn: boolean; + productSku?: string; type?: string; discounted?: boolean; id: string; @@ -55,7 +59,7 @@ export type OrderItemModel = { downloadableLinks: { count: number; result: string; - }; + } | null; itemPrices: { priceIncludingTax: MoneyProps; originalPrice: MoneyProps; @@ -124,6 +128,7 @@ export type OrderDataModel = { shippingMethod?: string; carrier?: string; orderDate: string; + itemsEligibleForReturn?: OrderItemModel[]; returns: OrdersReturnPropsModel[]; discounts: { amount: MoneyProps; diff --git a/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts b/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts index 2573cada71..bd92ba7964 100644 --- a/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts +++ b/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts @@ -1,6 +1,7 @@ -import { GetAttributesFormResponse, ResponseAttributesFormItemsProps } from '../../types'; +import { AttributesListItems, ResponseAttributesFormItemsProps } from '../../types'; import { AttributesFormModel } from '../models'; export declare const cloneArrayIfExists: (fields: ResponseAttributesFormItemsProps[]) => any; -export declare const transformAttributesForm: (response: GetAttributesFormResponse) => AttributesFormModel[]; +export declare const transformAttributesForm: (response: ResponseAttributesFormItemsProps[] | AttributesListItems[] | [ +]) => AttributesFormModel[]; //# sourceMappingURL=transform-attributes-form.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/hooks/index.d.ts b/scripts/__dropins__/storefront-order/hooks/index.d.ts index a2d0987177..8edc217cda 100644 --- a/scripts/__dropins__/storefront-order/hooks/index.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/index.d.ts @@ -3,7 +3,9 @@ export * from './containers/useOrderStatus'; export * from './containers/useShippingStatus'; export * from './containers/useCustomerDetails'; export * from './containers/useReturnsList'; -export * from './useIsMobile'; export * from './containers/useOrderProductList'; export * from './containers/useOrderCostSummary'; +export * from './containers/useCreateReturn'; +export * from './useInLineAlert'; +export * from './useIsMobile'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/hooks/useInLineAlert.d.ts b/scripts/__dropins__/storefront-order/hooks/useInLineAlert.d.ts new file mode 100644 index 0000000000..de336f092e --- /dev/null +++ b/scripts/__dropins__/storefront-order/hooks/useInLineAlert.d.ts @@ -0,0 +1,7 @@ +import { InLineAlertProps } from '../types'; + +export declare const useInLineAlert: () => { + inLineAlertProps: InLineAlertProps; + handleSetInLineAlert: (notification: InLineAlertProps | undefined) => void; +}; +//# sourceMappingURL=useInLineAlert.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts b/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts index a97a660953..01104caea2 100644 --- a/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts +++ b/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts @@ -1,5 +1,29 @@ declare const _default: { "Order": { + "CreateReturn": { + "headerText": "Return items", + "downloadableCount": "Files", + "returnedItems": "Returned items:", + "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", @@ -41,7 +65,7 @@ declare const _default: { "one": "item", "many": "items" }, - "resturnStatus": { + "returnStatus": { "pending": "Pending", "authorized": "Authorized", "partiallyAuthorized": "Partially authorized", @@ -71,7 +95,7 @@ declare const _default: { "one": "item", "many": "items" }, - "resturnStatus": { + "returnStatus": { "pending": "Pending", "authorized": "Authorized", "partiallyAuthorized": "Partially authorized", @@ -91,7 +115,7 @@ declare const _default: { "OrderProductListContent": { "cancelledTitle": "Cancelled", "allOrdersTitle": "Your order", - "returnedTitle": "Your return", + "returnedTitle": "Returned", "refundedTitle": "Your refunded", "downloadableCount": "Files", "stockStatus": { @@ -140,7 +164,7 @@ declare const _default: { "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}", - "resturnStatus": { + "returnStatus": { "pending": "Pending", "authorized": "Authorized", "partiallyAuthorized": "Partially authorized", diff --git a/scripts/__dropins__/storefront-order/lib/returnOrdersHelper.d.ts b/scripts/__dropins__/storefront-order/lib/returnOrdersHelper.d.ts index b6e3652630..f6b63670d0 100644 --- a/scripts/__dropins__/storefront-order/lib/returnOrdersHelper.d.ts +++ b/scripts/__dropins__/storefront-order/lib/returnOrdersHelper.d.ts @@ -1,3 +1,5 @@ +import { OrderDataModel, OrderItemModel } from '../data/models'; + declare const returnStatus: { readonly PENDING: "pending"; readonly AUTHORIZED: "authorized"; @@ -14,6 +16,86 @@ declare const returnStatus: { }; type ReturnStatusKey = keyof typeof returnStatus; type ReturnStatusValue = (typeof returnStatus)[ReturnStatusKey]; +type KeyValueObject = { + [key: string]: any; +}; +export declare const cleanObjectKeys: (obj: KeyValueObject) => KeyValueObject; +export declare const modifyFieldsConfig: (fieldsConfig: any, index: number) => any; +export declare const replicateEntries: (objects: any[], n: number) => any[]; +export declare const normalizeAttributes: (obj: Record) => { + selectedCustomAttributes: Array<{ + attributeCode: string; + value: string; + }>; + enteredCustomAttributes: Array<{ + attributeCode: string; + value: string; + }>; +}; export declare const formatReturnStatus: (str: string) => ReturnStatusValue | ''; +export declare const returnStatusList: string[]; +export declare const orderAdjustAndSortArray: (order: OrderDataModel) => { + returnableQuantity: number; + currentReturnOrderQuantity?: number | undefined; + eligibleForReturn: boolean; + productSku?: string | undefined; + type?: string | undefined; + discounted?: boolean | undefined; + id: string; + productName?: string | undefined; + productUrlKey?: string | undefined; + regularPrice?: import('../types').MoneyProps | undefined; + price?: import('../types').MoneyProps | undefined; + product?: import('../data/models').OrderItemProductModel | undefined; + selectedOptions?: { + label: string; + value: any; + }[] | undefined; + totalQuantity?: number | undefined; + thumbnail?: { + label: string; + url: string; + } | undefined; + downloadableLinks: { + count: number; + result: string; + } | null; + itemPrices: { + priceIncludingTax: import('../types').MoneyProps; + originalPrice: import('../types').MoneyProps; + originalPriceIncludingTax: import('../types').MoneyProps; + price: import('../types').MoneyProps; + discounts: [{ + label: string; + amount: { + value: number; + }; + }]; + }; + bundleOptions: Record | null; + totalInclTax: import('../types').MoneyProps; + priceInclTax: import('../types').MoneyProps; + total: import('../types').MoneyProps; + configurableOptions: Record | undefined; + giftCard?: { + senderName: string; + senderEmail: string; + recipientEmail: string; + recipientName: string; + message: string; + } | undefined; + quantityCanceled: number; + quantityInvoiced: number; + quantityOrdered: number; + quantityRefunded: number; + quantityReturned: number; + quantityShipped: number; + requestQuantity: number; +}[]; +export declare const extractFilteredItems: (order: OrderDataModel) => { + returnedList: any; + modifyOrder: [] | OrderItemModel[]; +}; +export declare function updateQuantities(mainArray: any, secondaryArray: any): OrderItemModel[] | []; export {}; //# sourceMappingURL=returnOrdersHelper.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/render.js b/scripts/__dropins__/storefront-order/render.js index 51988a98a5..6c5519ae5c 100644 --- a/scripts/__dropins__/storefront-order/render.js +++ b/scripts/__dropins__/storefront-order/render.js @@ -1,4 +1,4 @@ /*! 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)}})('.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" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:65px;height:65px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-cancel-reasons-form__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-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}',{styleId:"order"}); -import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as n}from"@dropins/tools/lib.js";import{useState as d,useEffect as s}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={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"},resturnStatus:{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"},resturnStatus:{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:"Your return",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",postcode:"Zip Code",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}",resturnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."}},p={Order:u},m={default:p},h=({children:t})=>{const[o,i]=d("en_US");return s(()=>{const e=c.on("locale",a=>{i(a)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},v=new n(r(h,{}));export{v as render}; +(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)}})('.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" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}',{styleId:"order"}); +import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as n}from"@dropins/tools/lib.js";import{useState as s,useEffect as d}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as c}from"@dropins/tools/event-bus.js";const u={CreateReturn:{headerText:"Return items",downloadableCount:"Files",returnedItems:"Returned items:",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",postcode:"Zip Code",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},ShippingStatusCard:{orderNumber:"Order number:",returnNumber:"Return number:",itemText:{none:"",one:"Package contents ({{count}} item)",many:"Package contents ({{count}} items)"},trackButton:"Track package",carrier:"Carrier:",prepositionOf:"of",returnOrderCardTitle:"Package details",shippingCardTitle:"Package details",shippingInfoTitle:"Shipping information",notYetShippedTitle:"Not yet shipped",notYetShippedImagesTitle:{singular:"Package contents ({{count}} item)",plural:"Package contents ({{count}} items)"}},OrderStatusContent:{noInfoTitle:"Check back later for more details.",returnMessage:"The order was placed on {ORDER_CREATE_DATE} and your return process started on {RETURN_CREATE_DATE}",returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."}},p={Order:u},m={default:p},h=({children:t})=>{const[o,i]=s("en_US");return d(()=>{const e=c.on("locale",a=>{i(a)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},T=new n(r(h,{}));export{T as render}; diff --git a/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts b/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts new file mode 100644 index 0000000000..9454fae5bb --- /dev/null +++ b/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts @@ -0,0 +1,69 @@ +import { AttributesFormModel, OrderDataModel, OrderItemModel } from '../data/models'; +import { InLineAlertProps, TaxTypes } from '.'; +import { SlotProps } from '@dropins/tools/types/elsie/src/lib'; +import { RefObject } from 'preact'; +import { MutableRefObject } from 'preact/compat'; + +type options = Record; +export type StepsTypes = 'products' | 'attributes' | 'success' | 'error'; +type onSuccessTypes = { + uid: string; + number: string; + status: string; + createdAt: string; +}; +export interface CreateReturnProps { + orderData?: OrderDataModel; + slots?: { + ReturnOrderItem: SlotProps; + ReturnFormActions: SlotProps<{ + handleChangeStep: (value: StepsTypes) => void; + }>; + }; + className: string; + onSuccess?: (response: onSuccessTypes) => void; + onError?: (message: string) => void; + routeReturnSuccess?: () => string; + showConfigurableOptions?: (options: options | {}) => options; +} +export interface ReturnOrderProductListProps { + slots?: { + ReturnOrderItem: SlotProps; + }; + itemsEligibleForReturn: OrderItemModel[]; + loading: boolean; + taxConfig: TaxTypes; + translations: Record; + selectedProductList: OrderItemModel[] | []; + handleSelectedProductList: (product: any) => void; + showConfigurableOptions?: (options: options | {}) => options; + handleSetQuantity: (value: number, productSku: string) => void; + handleChangeStep: (value: StepsTypes) => void; +} +export interface ReturnReasonFormProps { + slots?: { + ReturnFormActions: SlotProps<{ + handleChangeStep: (value: StepsTypes) => void; + }>; + }; + formsRef: MutableRefObject[]>; + loading: boolean; + translations: Record; + fieldsConfig: AttributesFormModel[] | []; + selectedProductList: OrderItemModel[] | []; + handleChangeStep: (value: StepsTypes) => void; + onSubmit?: (event: SubmitEvent, isValid: boolean) => Promise; +} +export interface ReturnOrderMessageProps { + translations: Record; + routeReturnSuccess?: (orderData?: OrderDataModel) => string; + orderData?: OrderDataModel; +} +export interface UseCreateReturn { + orderData?: OrderDataModel; + onSuccess?: (response: onSuccessTypes) => void; + onError?: (message: string) => void; + handleSetInLineAlert: (value?: InLineAlertProps) => void; +} +export {}; +//# sourceMappingURL=createReturn.types.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/form.types.d.ts b/scripts/__dropins__/storefront-order/types/form.types.d.ts index 2ce2b13d89..273ea23b2f 100644 --- a/scripts/__dropins__/storefront-order/types/form.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/form.types.d.ts @@ -28,7 +28,7 @@ export interface FieldsProps { defaultValue: string | boolean | number; entityType: string; required: boolean; - is_unique: boolean; + isUnique: boolean; label: string; orderNumber: number; options?: { diff --git a/scripts/__dropins__/storefront-order/types/index.d.ts b/scripts/__dropins__/storefront-order/types/index.d.ts index e207247e77..0c1bb08da9 100644 --- a/scripts/__dropins__/storefront-order/types/index.d.ts +++ b/scripts/__dropins__/storefront-order/types/index.d.ts @@ -4,6 +4,8 @@ export * from './api/getGuestOrder.types'; export * from './api/getAttributesForm.types'; export * from './api/getCustomer.types'; export * from './api/getCustomerOrdersReturn.types'; +export * from './api/getAttributesList.types'; +export * from './api/requestReturn.types'; export * from './api/reorderItems.types'; export * from './orderSearch.types'; export * from './form.types'; @@ -15,5 +17,7 @@ export * from './returnsList.types'; export * from './emptyList.types'; export * from './orderProductList.types'; export * from './orderCostSummary.types'; +export * from './createReturn.types'; +export * from './notification.types'; export * from './reorder.types'; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/notification.types.d.ts b/scripts/__dropins__/storefront-order/types/notification.types.d.ts new file mode 100644 index 0000000000..7af9b58b05 --- /dev/null +++ b/scripts/__dropins__/storefront-order/types/notification.types.d.ts @@ -0,0 +1,14 @@ +import { VNode } from 'preact'; +import { HTMLAttributes } from 'preact/compat'; + +export type AdditionalActionsAlertProps = Array<{ + label: string; + onClick: (event: Event) => void; +}>; +export interface InLineAlertProps { + type: 'success' | 'warning' | 'error'; + heading: string; + icon?: VNode>; +} +export type statusTypes = '' | 'success' | 'error' | 'pending'; +//# sourceMappingURL=notification.types.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/orderProductList.types.d.ts b/scripts/__dropins__/storefront-order/types/orderProductList.types.d.ts index 6fa83732bf..3d1fc72634 100644 --- a/scripts/__dropins__/storefront-order/types/orderProductList.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/orderProductList.types.d.ts @@ -18,12 +18,15 @@ export interface OrderProductListContentProps extends Omit; - showConfigurableOptions?: (options: options | {}) => options; itemType: string; + translations: Record; product: OrderItemModel; + taxConfig: TaxTypes; + isReturnProductList?: boolean; + onQuantity?: (value: number) => void; + showConfigurableOptions?: (options: options | {}) => options; routeProductDetails?: (product: any) => string; } export interface UseOrderProductListProps extends Omit { From 6532e25e408d22397959b001a6e9bb61b2f64c25 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 10:48:17 +0200 Subject: [PATCH 03/30] test 1 --- scripts/__dropins__/storefront-order/api.js | 2 -- .../storefront-order/chunks/OrderCancel.js | 4 +-- .../chunks/OrderCancelForm.js | 2 -- .../storefront-order/chunks/OrderLoaders.js | 2 -- .../chunks/ReturnsListContent.js | 4 +-- .../storefront-order/chunks/convertCase.js | 2 -- .../storefront-order/chunks/fetch-graphql.js | 2 -- .../storefront-order/chunks/form.types.js | 2 -- .../chunks/formatDateToLocale.js | 2 -- .../chunks/getAttributesForm.js | 2 -- .../storefront-order/chunks/getCustomer.js | 2 -- .../chunks/getCustomerOrdersReturn.js | 2 -- .../storefront-order/chunks/getFormValues.js | 2 -- .../chunks/getGuestOrder.graphql.js | 2 -- .../storefront-order/chunks/getStoreConfig.js | 2 -- .../storefront-order/chunks/network-error.js | 2 -- .../storefront-order/chunks/redirectTo.js | 2 -- .../storefront-order/chunks/reorderItems.js | 2 -- .../chunks/requestGuestOrderCancel.js | 2 -- .../storefront-order/chunks/requestReturn.js | 2 -- .../chunks/returnOrdersHelper.js | 2 -- .../storefront-order/chunks/setTaxStatus.js | 2 -- .../chunks/transform-attributes-form.js | 2 -- .../chunks/transform-order-details.js | 2 -- .../storefront-order/chunks/useIsMobile.js | 2 -- .../containers/CreateReturn.js | 4 +-- .../containers/CustomerDetails.js | 2 -- .../containers/OrderCancelForm.js | 2 -- .../containers/OrderCostSummary.js | 2 -- .../containers/OrderProductList.js | 4 +-- .../containers/OrderReturns.js | 2 -- .../containers/OrderSearch.js | 2 -- .../containers/OrderStatus.js | 4 +-- .../containers/ReturnsList.js | 2 -- .../containers/ShippingStatus.js | 4 +-- .../hooks/containers/useCreateReturn.d.ts | 19 +++++++++++ .../storefront-order/i18n/en_US.json.d.ts | 12 +++---- scripts/__dropins__/storefront-order/reload | 1 + .../__dropins__/storefront-order/render.js | 6 ++-- .../types/api/getAttributesList.types.d.ts | 28 ++++++++++++++++ .../types/api/requestReturn.types.d.ts | 33 +++++++++++++++++++ .../types/createReturn.types.d.ts | 3 +- 42 files changed, 96 insertions(+), 88 deletions(-) create mode 100644 scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts create mode 100644 scripts/__dropins__/storefront-order/reload create mode 100644 scripts/__dropins__/storefront-order/types/api/getAttributesList.types.d.ts create mode 100644 scripts/__dropins__/storefront-order/types/api/requestReturn.types.d.ts diff --git a/scripts/__dropins__/storefront-order/api.js b/scripts/__dropins__/storefront-order/api.js index 1609d77c30..a86d37ce46 100644 --- a/scripts/__dropins__/storefront-order/api.js +++ b/scripts/__dropins__/storefront-order/api.js @@ -1,5 +1,3 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{Initializer as I}from"@dropins/tools/lib.js";import{events as d}from"@dropins/tools/event-bus.js";import{f as n,h as m}from"./chunks/fetch-graphql.js";import{g as U,r as q,s as z,a as Y,b as Q}from"./chunks/fetch-graphql.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as _,G as p,O as c,B as O,R as D,c as b}from"./chunks/transform-order-details.js";import{O as h,A as R}from"./chunks/getGuestOrder.graphql.js";import{t as f}from"./chunks/getCustomer.js";import{g as K,a as j}from"./chunks/getCustomer.js";import{g as V}from"./chunks/getAttributesForm.js";import{g as X}from"./chunks/getStoreConfig.js";import{g as ee}from"./chunks/getCustomerOrdersReturn.js";import{g as te,r as ae}from"./chunks/requestReturn.js";import{c as de,r as oe}from"./chunks/requestGuestOrderCancel.js";import{r as ne}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";import"./chunks/transform-attributes-form.js";const G=` query ORDER_BY_NUMBER($orderNumber: String!) { customer { diff --git a/scripts/__dropins__/storefront-order/chunks/OrderCancel.js b/scripts/__dropins__/storefront-order/chunks/OrderCancel.js index 3e61b1f999..81cb1bb280 100644 --- a/scripts/__dropins__/storefront-order/chunks/OrderCancel.js +++ b/scripts/__dropins__/storefront-order/chunks/OrderCancel.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{jsx as c,Fragment as R,jsxs as L}from"@dropins/tools/preact-jsx-runtime.js";import{Field as x,Picker as ne,Input as re,InputDate as te,Checkbox as ee,TextArea as se,Price as he,CartItem as ue,Icon as de,Image as P,Incrementer as ie,Button as ce}from"@dropins/tools/components.js";import"@dropins/tools/preact.js";import{useRef as be,useState as g,useEffect as p,useCallback as V}from"@dropins/tools/preact-hooks.js";import{useText as oe}from"@dropins/tools/i18n.js";import*as q from"@dropins/tools/preact-compat.js";import{memo as ae,useCallback as F}from"@dropins/tools/preact-compat.js";import{classes as _,Slot as $e}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const me=s=>q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},q.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"}),q.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"}),q.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"})),Ee=s=>q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),ve=s=>s.reduce((e,{code:v,required:m,defaultValue:d})=>(m&&(e[v]=d),e),{}),ke=({fieldsConfig:s,onSubmit:e})=>{const{requiredFieldError:v}=oe({requiredFieldError:"Order.Form.notifications.requiredFieldError"}),m=be(null),[d,b]=g({}),[$,u]=g({});p(()=>{if(b({}),!s||!s.length)return;const r=ve(s);b(r)},[s==null?void 0:s.length]),p(()=>()=>{var r;b({}),(r=m.current)==null||r.reset()},[]);const E=V((r,a)=>{const h=s.find(l=>l.code===r);return h!=null&&h.required&&!a?v:""},[s,v]),f=V(r=>{const{name:a,value:h,type:i,checked:l}=r==null?void 0:r.target,n=i==="checkbox"?l:h;b(t=>({...t,[a]:n}))},[]),o=V(r=>{const{name:a,value:h,type:i,checked:l}=r==null?void 0:r.target,n=i==="checkbox"?l:h;u(t=>({...t,[a]:E(a,n)}))},[E]),k=V(r=>{r.preventDefault();let a=!0,h={},i=null;for(const[l,n]of Object.entries(d)){const t=E(l,n);t&&(h[l]=t,a=!1,i||(i=l))}if(u(h),i&&m.current){const l=m.current.elements.namedItem(i);l==null||l.focus()}e==null||e(r,a)},[d,E,e]);return{formData:d,errors:$,formRef:m,handleChange:f,handleBlur:o,handleSubmit:k}},ye=ae(({loading:s,values:e,fields:v=[],errors:m,className:d="",onChange:b,onBlur:$})=>{const u=`${d}__item`,E=F((a,h,i)=>{const l=a.options.map(n=>({text:n.label,value:n.value}));return c(x,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:s,children:c(ne,{name:a.id,floatingLabel:`${a.label} ${a.required?"*":""}`,placeholder:a.label,"aria-label":a.label,options:l,onBlur:$,handleSelect:b,value:h||a.defaultValue})},a.id)},[d,s,u,$,b]),f=F((a,h,i)=>{const l=a.id==="email",n=l?c(me,{}):void 0,t=l?"username":"";return c(x,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a==null?void 0:a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:s,children:c(re,{"aria-label":a.label,"aria-required":a.required,autoComplete:t,icon:n,type:"text",name:a.id,value:h||a.defaultValue,placeholder:a.label,floatingLabel:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:b})},a.id)},[d,s,u,$,b]),o=F((a,h,i)=>c(x,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:s,children:c(te,{type:"text",name:a.id,value:h||a.defaultValue,placeholder:a.label,floatingLabel:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:b})},a.id),[d,s,u,$,b]),k=F((a,h,i)=>c(x,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:s,children:c(ee,{name:a.id,checked:h||a.defaultValue,placeholder:a.label,label:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:b})},a.id),[d,s,u,$,b]),r=F((a,h,i)=>c(x,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:s,children:c(se,{type:"text",name:a.id,value:h===void 0?a.defaultValue:h,label:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:b})},a.id),[d,s,u,$,b]);return v.length?c(R,{children:v.map(a=>{var l;const h=(m==null?void 0:m[a.id])??"",i=(e==null?void 0:e[a.id])??"";switch(a.fieldType){case"TEXT":return(l=a==null?void 0:a.options)!=null&&l.length?E(a,i,h):f(a,i,h);case"MULTILINE":return f(a,i,h);case"SELECT":return E(a,i,h);case"DATE":return o(a,i,h);case"BOOLEAN":return k(a,i,h);case"TEXTAREA":return r(a,i,h);default:return null}})}):null}),Re=ae(({name:s,loading:e,children:v,className:m="defaultForm",fieldsConfig:d,onSubmit:b})=>{const{formData:$,errors:u,formRef:E,handleChange:f,handleBlur:o,handleSubmit:k}=ke({fieldsConfig:d,onSubmit:b});return L("form",{className:_(["order-form",m]),onSubmit:k,name:s,ref:E,children:[c(ye,{className:m,loading:e,fields:d,onChange:f,onBlur:o,errors:u,values:$}),v]})}),fe=({loading:s,product:e,itemType:v,taxConfig:m,translations:d,disabledIncrementer:b,showConfigurableOptions:$,onQuantity:u,routeProductDetails:E,isReturnProductList:f})=>{var Q,A,H,Z,z,j,C,U,W,X,I,K,G,J,Y,B,T;const{taxExcluded:o,taxIncluded:k}=m,r=V((w,O,le)=>c(he,{amount:w,currency:O,weight:"normal",...le}),[]);let a={};const h=v==="cancelled",i=(A=(Q=e==null?void 0:e.product)==null?void 0:Q.stockStatus)==null?void 0:A.includes("IN_STOCK"),l=(e==null?void 0:e.giftCard)||{},n=(H=e==null?void 0:e.itemPrices)==null?void 0:H.priceIncludingTax,t=(Z=e==null?void 0:e.itemPrices)==null?void 0:Z.originalPrice,y=(z=e==null?void 0:e.itemPrices)==null?void 0:z.price,S=v==="returned"?e==null?void 0:e.requestQuantity:e==null?void 0:e.totalQuantity,N=e.discounted&&((j=e.price)==null?void 0:j.value)!==(t==null?void 0:t.value)*S,D={..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in l&&(l!=null&&l.senderName)?{[d.sender]:l==null?void 0:l.senderName}:{},..."senderEmail"in l&&(l!=null&&l.senderEmail)?{[d.sender]:l==null?void 0:l.senderEmail}:{},..."recipientName"in l&&(l!=null&&l.recipientName)?{[d.recipient]:l==null?void 0:l.recipientName}:{},..."recipientEmail"in l&&(l!=null&&l.recipientEmail)?{[d.recipient]:l==null?void 0:l.recipientEmail}:{},..."message"in l&&(l!=null&&l.message)?{[d.message]:l==null?void 0:l.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(C=e==null?void 0:e.downloadableLinks)==null?void 0:C.count} ${d.downloadableCount}`]:(U=e==null?void 0:e.downloadableLinks)==null?void 0:U.result}:{}};if(k&&o){const w=N?t==null?void 0:t.value:(n==null?void 0:n.value)*S;a={taxExcluded:!0,taxIncluded:void 0,price:r(t==null?void 0:t.value,t==null?void 0:t.currency),total:L(R,{children:[r(w,t==null?void 0:t.currency,{variant:e.discounted&&(n==null?void 0:n.value)!==w?"strikethrough":"default"}),e.discounted&&(n==null?void 0:n.value)!==w?r(n==null?void 0:n.value,n==null?void 0:n.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:r((y==null?void 0:y.value)*S,y==null?void 0:y.currency)}}else if(!k&&o)a={taxExcluded:void 0,taxIncluded:void 0,price:r(t==null?void 0:t.value,t==null?void 0:t.currency),total:L(R,{children:[r((t==null?void 0:t.value)*S,n==null?void 0:n.currency,{variant:N?"strikethrough":"default"}),N?r((W=e.price)==null?void 0:W.value,(X=e.price)==null?void 0:X.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:r((y==null?void 0:y.value)*(e==null?void 0:e.totalQuantity),y==null?void 0:y.currency)};else if(k&&!o){const w=v==="returned"?e==null?void 0:e.totalQuantity:S,O=N?t.value:n.value*w;a={taxExcluded:void 0,taxIncluded:!0,price:r(n==null?void 0:n.value,n==null?void 0:n.currency),total:L(R,{children:[r(O,n==null?void 0:n.currency,{variant:N?"strikethrough":"default",weight:"bold"}),N?r(n==null?void 0:n.value,n==null?void 0:n.currency,{sale:!0,weight:"bold"}):null]})}}return c(ue,{loading:s,alert:h&&i?L("span",{children:[c(de,{source:Ee}),d.outOfStock]}):c(R,{}),configurations:($==null?void 0:$(D))??D,title:E?c("a",{"data-testid":"product-name",className:_(["cart-summary-item__title",["cart-summary-item__title--strikethrough",h]]),href:E(e),children:(I=e==null?void 0:e.product)==null?void 0:I.name}):c("div",{"data-testid":"product-name",className:_(["cart-summary-item__title",["cart-summary-item__title--strikethrough",h]]),children:(K=e==null?void 0:e.product)==null?void 0:K.name}),sku:c("div",{children:(G=e==null?void 0:e.product)==null?void 0:G.sku}),quantity:e!=null&&e.eligibleForReturn&&(e!=null&&e.returnableQuantity)?(e==null?void 0:e.returnableQuantity)??e.totalQuantity:f?void 0:e.totalQuantity,image:E?c("a",{href:E(e),children:c(P,{src:(J=e==null?void 0:e.product)==null?void 0:J.thumbnail.url,alt:(Y=e==null?void 0:e.product)==null?void 0:Y.thumbnail.label,loading:"lazy",width:"90",height:"120"})}):c(P,{src:(B=e==null?void 0:e.product)==null?void 0:B.thumbnail.url,alt:(T=e==null?void 0:e.product)==null?void 0:T.thumbnail.label,loading:"lazy",width:"90",height:"120"}),...a,footer:u&&!b?c(ie,{value:1,min:1,max:e==null?void 0:e.returnableQuantity,onValue:w=>u==null?void 0:u(Number(w)),name:"quantity"}):void 0})},M=Math.random().toString(36).slice(2)+Date.now().toString(36),Ve=({itemsEligibleForReturn:s,slots:e,loading:v=!1,taxConfig:m,translations:d={},selectedProductList:b,handleSelectedProductList:$,showConfigurableOptions:u,handleSetQuantity:E,handleChangeStep:f})=>L("ul",{className:"order-return-order-product-list",children:[s==null?void 0:s.map((o,k)=>{const r=b.some(a=>(a==null?void 0:a.productSku)===o.productSku&&o.eligibleForReturn&&o.quantityReturned===0);return L("li",{className:_(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",!o.eligibleForReturn]]),children:[c(ee,{"data-testid":`${M}_${k+1}`,name:M+k,checked:r,disabled:!o.eligibleForReturn||o.quantityReturned!==0,onChange:()=>{$({...o,currentReturnOrderQuantity:1})}}),c(fe,{loading:v,product:o,itemType:"",taxConfig:m,translations:d,showConfigurableOptions:u,disabledIncrementer:!r,isReturnProductList:!0,onQuantity:(o==null?void 0:o.returnableQuantity)>1?a=>E(a,o.productSku):void 0}),e!=null&&e.ReturnOrderItem?c($e,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:e==null?void 0:e.ReturnOrderItem,context:{}}):null]},M+k)}),c("li",{className:"order-return-order-product-list__item",children:c(ce,{type:"button",onClick:()=>f("attributes"),disabled:!b.length,children:d.nextStep})})]});export{fe as C,Re as F,Ve as R,Ee as S,ye as a,ke as u}; +import{jsx as c,Fragment as F,jsxs as L}from"@dropins/tools/preact-jsx-runtime.js";import{Field as S,Picker as le,Input as ne,InputDate as te,Checkbox as g,TextArea as re,Price as se,CartItem as he,Icon as ue,Image as B,Incrementer as de,Button as ie}from"@dropins/tools/components.js";import"@dropins/tools/preact.js";import{useRef as ce,useState as T,useEffect as P,useCallback as R}from"@dropins/tools/preact-hooks.js";import{useText as be}from"@dropins/tools/i18n.js";import*as q from"@dropins/tools/preact-compat.js";import{memo as p,useCallback as x}from"@dropins/tools/preact-compat.js";import{classes as _,Slot as oe}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const $e=h=>q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...h},q.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"}),q.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"}),q.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"})),me=h=>q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...h},q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),Ee=h=>h.reduce((e,{code:v,required:m,defaultValue:d})=>(m&&(e[v]=d),e),{}),ve=({fieldsConfig:h,onSubmit:e})=>{const{requiredFieldError:v}=be({requiredFieldError:"Order.Form.notifications.requiredFieldError"}),m=ce(null),[d,o]=T({}),[$,u]=T({});P(()=>{if(o({}),!h||!h.length)return;const r=Ee(h);o(r)},[h==null?void 0:h.length]),P(()=>()=>{var r;o({}),(r=m.current)==null||r.reset()},[]);const E=R((r,a)=>{const t=h.find(l=>l.code===r);return t!=null&&t.required&&!a?v:""},[h,v]),f=R(r=>{const{name:a,value:t,type:i,checked:l}=r==null?void 0:r.target,n=i==="checkbox"?l:t;o(s=>({...s,[a]:n}))},[]),b=R(r=>{const{name:a,value:t,type:i,checked:l}=r==null?void 0:r.target,n=i==="checkbox"?l:t;u(s=>({...s,[a]:E(a,n)}))},[E]),y=R(r=>{r.preventDefault();let a=!0,t={},i=null;for(const[l,n]of Object.entries(d)){const s=E(l,n);s&&(t[l]=s,a=!1,i||(i=l))}if(u(t),i&&m.current){const l=m.current.elements.namedItem(i);l==null||l.focus()}e==null||e(r,a)},[d,E,e]);return{formData:d,errors:$,formRef:m,handleChange:f,handleBlur:b,handleSubmit:y}},ye=p(({loading:h,values:e,fields:v=[],errors:m,className:d="",onChange:o,onBlur:$})=>{const u=`${d}__item`,E=x((a,t,i)=>{const l=a.options.map(n=>({text:n.label,value:n.value}));return c(S,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:h,children:c(le,{name:a.id,floatingLabel:`${a.label} ${a.required?"*":""}`,placeholder:a.label,"aria-label":a.label,options:l,onBlur:$,handleSelect:o,value:t||a.defaultValue})},a.id)},[d,h,u,$,o]),f=x((a,t,i)=>{const l=a.id==="email",n=l?c($e,{}):void 0,s=l?"username":"";return c(S,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a==null?void 0:a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:h,children:c(ne,{"aria-label":a.label,"aria-required":a.required,autoComplete:s,icon:n,type:"text",name:a.id,value:t||a.defaultValue,placeholder:a.label,floatingLabel:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:o})},a.id)},[d,h,u,$,o]),b=x((a,t,i)=>c(S,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:h,children:c(te,{type:"text",name:a.id,value:t||a.defaultValue,placeholder:a.label,floatingLabel:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:o})},a.id),[d,h,u,$,o]),y=x((a,t,i)=>c(S,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:h,children:c(g,{name:a.id,checked:t||a.defaultValue,placeholder:a.label,label:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:o})},a.id),[d,h,u,$,o]),r=x((a,t,i)=>c(S,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:h,children:c(re,{type:"text",name:a.id,value:t===void 0?a.defaultValue:t,label:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:o})},a.id),[d,h,u,$,o]);return v.length?c(F,{children:v.map(a=>{var l;const t=(m==null?void 0:m[a.id])??"",i=(e==null?void 0:e[a.id])??"";switch(a.fieldType){case"TEXT":return(l=a==null?void 0:a.options)!=null&&l.length?E(a,i,t):f(a,i,t);case"MULTILINE":return f(a,i,t);case"SELECT":return E(a,i,t);case"DATE":return b(a,i,t);case"BOOLEAN":return y(a,i,t);case"TEXTAREA":return r(a,i,t);default:return null}})}):null}),Fe=p(({name:h,loading:e,children:v,className:m="defaultForm",fieldsConfig:d,onSubmit:o})=>{const{formData:$,errors:u,formRef:E,handleChange:f,handleBlur:b,handleSubmit:y}=ve({fieldsConfig:d,onSubmit:o});return L("form",{className:_(["order-form",m]),onSubmit:y,name:h,ref:E,children:[c(ye,{className:m,loading:e,fields:d,onChange:f,onBlur:b,errors:u,values:$}),v]})}),ke=({loading:h,product:e,itemType:v,taxConfig:m,translations:d,disabledIncrementer:o,showConfigurableOptions:$,onQuantity:u,routeProductDetails:E,isReturnProductList:f})=>{var Q,M,D,A,H,Z,z,j,C,U,W,X,I,K,G,J,Y;const{taxExcluded:b,taxIncluded:y}=m,r=R((w,ee,ae)=>c(se,{amount:w,currency:ee,weight:"normal",...ae}),[]);let a={};const t=v==="cancelled",i=(M=(Q=e==null?void 0:e.product)==null?void 0:Q.stockStatus)==null?void 0:M.includes("IN_STOCK"),l=(e==null?void 0:e.giftCard)||{},n=(D=e==null?void 0:e.itemPrices)==null?void 0:D.priceIncludingTax,s=(A=e==null?void 0:e.itemPrices)==null?void 0:A.originalPrice,k=(H=e==null?void 0:e.itemPrices)==null?void 0:H.price,N=e.discounted&&((Z=e.price)==null?void 0:Z.value)!==(s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),O={..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in l&&(l!=null&&l.senderName)?{[d.sender]:l==null?void 0:l.senderName}:{},..."senderEmail"in l&&(l!=null&&l.senderEmail)?{[d.sender]:l==null?void 0:l.senderEmail}:{},..."recipientName"in l&&(l!=null&&l.recipientName)?{[d.recipient]:l==null?void 0:l.recipientName}:{},..."recipientEmail"in l&&(l!=null&&l.recipientEmail)?{[d.recipient]:l==null?void 0:l.recipientEmail}:{},..."message"in l&&(l!=null&&l.message)?{[d.message]:l==null?void 0:l.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(z=e==null?void 0:e.downloadableLinks)==null?void 0:z.count} ${d.downloadableCount}`]:(j=e==null?void 0:e.downloadableLinks)==null?void 0:j.result}:{}};if(y&&b){const w=N?s==null?void 0:s.value:(n==null?void 0:n.value)*(e==null?void 0:e.totalQuantity);a={taxExcluded:!0,taxIncluded:void 0,price:r(s==null?void 0:s.value,s==null?void 0:s.currency),total:L(F,{children:[r(w,s==null?void 0:s.currency,{variant:e.discounted&&(n==null?void 0:n.value)!==w?"strikethrough":"default"}),e.discounted&&(n==null?void 0:n.value)!==w?r(n==null?void 0:n.value,n==null?void 0:n.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:r((k==null?void 0:k.value)*e.totalQuantity,k==null?void 0:k.currency)}}else if(!y&&b)a={taxExcluded:void 0,taxIncluded:void 0,price:r(s==null?void 0:s.value,s==null?void 0:s.currency),total:L(F,{children:[r((s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),n==null?void 0:n.currency,{variant:N?"strikethrough":"default"}),N?r((C=e.price)==null?void 0:C.value,(U=e.price)==null?void 0:U.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:r((k==null?void 0:k.value)*(e==null?void 0:e.totalQuantity),k==null?void 0:k.currency)};else if(y&&!b){const w=N?s.value:n.value*e.totalQuantity;a={taxExcluded:void 0,taxIncluded:!0,price:r(n==null?void 0:n.value,n==null?void 0:n.currency),total:L(F,{children:[r(w,n==null?void 0:n.currency,{variant:N?"strikethrough":"default",weight:"bold"}),N?r(n==null?void 0:n.value,n==null?void 0:n.currency,{sale:!0,weight:"bold"}):null]})}}return c(he,{loading:h,alert:t&&i?L("span",{children:[c(ue,{source:me}),d.outOfStock]}):c(F,{}),configurations:($==null?void 0:$(O))??O,title:E?c("a",{"data-testid":"product-name",className:_(["cart-summary-item__title",["cart-summary-item__title--strikethrough",t]]),href:E(e),children:(W=e==null?void 0:e.product)==null?void 0:W.name}):c("div",{"data-testid":"product-name",className:_(["cart-summary-item__title",["cart-summary-item__title--strikethrough",t]]),children:(X=e==null?void 0:e.product)==null?void 0:X.name}),sku:c("div",{children:(I=e==null?void 0:e.product)==null?void 0:I.sku}),quantity:e!=null&&e.eligibleForReturn&&(e!=null&&e.returnableQuantity)?(e==null?void 0:e.returnableQuantity)??e.totalQuantity:f?void 0:e.totalQuantity,image:E?c("a",{href:E(e),children:c(B,{src:(K=e==null?void 0:e.product)==null?void 0:K.thumbnail.url,alt:(G=e==null?void 0:e.product)==null?void 0:G.thumbnail.label,loading:"lazy",width:"90",height:"120"})}):c(B,{src:(J=e==null?void 0:e.product)==null?void 0:J.thumbnail.url,alt:(Y=e==null?void 0:e.product)==null?void 0:Y.thumbnail.label,loading:"lazy",width:"90",height:"120"}),...a,footer:u&&!o?c(de,{value:1,min:1,max:e==null?void 0:e.returnableQuantity,onValue:w=>u==null?void 0:u(Number(w)),name:"quantity"}):void 0})},V=Math.random().toString(36).slice(2)+Date.now().toString(36),Re=({itemsEligibleForReturn:h,slots:e,loading:v=!1,taxConfig:m,translations:d={},selectedProductList:o,handleSelectedProductList:$,showConfigurableOptions:u,handleSetQuantity:E,handleChangeStep:f})=>L("ul",{className:"order-return-order-product-list",children:[h==null?void 0:h.map((b,y)=>{const r=o.some(t=>(t==null?void 0:t.productSku)===b.productSku&&b.eligibleForReturn&&b.quantityReturned===0),a=b.returnableQuantity===0?1:b.returnableQuantity;return L("li",{className:_(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",!b.eligibleForReturn]]),children:[c(g,{"data-testid":`${V}_${y+1}`,name:V+y,checked:r,disabled:!b.eligibleForReturn||b.quantityReturned!==0,onChange:()=>{$({...b,currentReturnOrderQuantity:1})}}),c(ke,{loading:v,product:{...b,totalQuantity:a},itemType:"",taxConfig:m,translations:d,showConfigurableOptions:u,disabledIncrementer:!r,isReturnProductList:!0,onQuantity:(b==null?void 0:b.returnableQuantity)>1?t=>E(t,b.productSku):void 0}),e!=null&&e.ReturnOrderItem?c(oe,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:e==null?void 0:e.ReturnOrderItem,context:{}}):null]},V+y)}),c("li",{className:"order-return-order-product-list__item",children:c(ie,{type:"button",onClick:()=>f("attributes"),disabled:!o.length,children:d.nextStep})})]});export{ke as C,Fe as F,Re as R,me as S,ye as a,ve as u}; diff --git a/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js b/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js index 0f693b9b21..5fd570ab16 100644 --- a/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js +++ b/scripts/__dropins__/storefront-order/chunks/OrderCancelForm.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{jsxs as g,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{InLineAlert as v,Picker as x,Button as F}from"@dropins/tools/components.js";import{F as S}from"./OrderCancel.js";import"@dropins/tools/lib.js";import{useState as n}from"@dropins/tools/preact-hooks.js";import{events as d}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{r as E,c as _}from"./requestGuestOrderCancel.js";import{useText as D,Text as l}from"@dropins/tools/i18n.js";const k=({orderRef:a,pickerProps:m,submitButtonProps:u,cancelReasons:t})=>{const o=D({ErrorHeading:"Order.OrderCancelForm.errorHeading",ErrorDescription:"Order.OrderCancelForm.errorDescription",orderCancellationLabel:"Order.OrderCancelForm.label"}),[i,p]=n(0),[f,O]=n(!1),[b,h]=n(!1);d.on("authenticated",e=>{e&&h(!0)},{eager:!0});const C=e=>{e.preventDefault();const s=Number(e.target.value);p(s)};return g(S,{onSubmit:async e=>(e.preventDefault(),(a.length>20?E:_)(a,t[i].text,c=>{b||(c.status="guest order cancellation requested"),d.emit("order/data",c)},()=>{O(!0)})),"data-testid":"order-order-cancel-reasons-form__text",children:[f&&r(v,{heading:o.ErrorHeading,description:o.ErrorDescription}),r("div",{className:"order-order-cancel-reasons-form__text",children:r(l,{id:"Order.OrderCancelForm.description"})}),r(x,{name:"cancellationReasons",floatingLabel:o.orderCancellationLabel,defaultOption:t[0],variant:"primary",options:t,value:String(i),handleSelect:C,required:!0,"data-testid":"order-cancellation-reasons-selector",...m}),r("div",{className:"order-order-cancel-reasons-form__button-container",children:r(F,{variant:"primary","data-testid":"order-cancel-submit-button",...u,children:r(l,{id:"Order.OrderCancelForm.button"})})})]})};export{k as O}; diff --git a/scripts/__dropins__/storefront-order/chunks/OrderLoaders.js b/scripts/__dropins__/storefront-order/chunks/OrderLoaders.js index abd7886ea4..43667a604f 100644 --- a/scripts/__dropins__/storefront-order/chunks/OrderLoaders.js +++ b/scripts/__dropins__/storefront-order/chunks/OrderLoaders.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{jsx as e,jsxs as a}from"@dropins/tools/preact-jsx-runtime.js";import{Card as n,Skeleton as i,SkeletonRow as r,CartItemSkeleton as t}from"@dropins/tools/components.js";import"./OrderCancel.js";import{classes as o}from"@dropins/tools/lib.js";const z=({testId:s,withCard:d=!0})=>{const l=a(i,{"data-testid":s??"skeletonLoader",children:[e(r,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),e(r,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),e(r,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return d?l:e(n,{variant:"secondary",className:o(["order-order-loaders","order-order-loaders--card-loader"]),children:l})},g=s=>e(n,{variant:"secondary",...s,children:a(i,{"data-testid":"order-details-skeleton",children:[e(r,{variant:"heading",size:"medium",fullWidth:!0}),e(r,{size:"medium"}),e(r,{variant:"empty",size:"medium"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"}),e(r,{size:"xlarge"})]})}),f=()=>a(i,{"data-testid":"order-product-list-skeleton",style:{gridTemplateColumns:"1fr"},children:[e(r,{variant:"heading",fullWidth:!0,size:"medium"}),e(t,{}),e(t,{}),e(t,{}),e(t,{}),e(t,{})]}),v=()=>a(i,{"data-testid":"order-cost-summary-content-skeleton",className:"order-cost-summary-content",children:[e(r,{variant:"heading",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"empty",size:"small"}),e(r,{variant:"heading",size:"small",fullWidth:!0,lines:3})]});export{z as C,g as D,f as O,v as a}; diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index 20fcbfdba4..57380bb68f 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{jsx as r,jsxs as s,Fragment as o}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as H}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as G}from"@dropins/tools/lib.js";import{IllustratedMessage as I,Icon as y,Card as k,ContentGrid as R,Image as D,Header as O,Pagination as r1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as e1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as q}from"@dropins/tools/i18n.js";const J=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"})))),t1=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"})),P=({typeList:L,isEmpty:C,minifiedView:M,message:n})=>{const t=e1(()=>{switch(L){case"orders":return{icon:t1,text:r("p",{children:n}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,n]);return!C||!L||!t.text?null:r(I,{className:W(["order-empty-list",t.className,M?"order-empty-list--minified":""]),message:t.text,icon:r(y,{source:t.icon}),"data-testid":"emptyList"})},Q={size:"32",stroke:"2"},M1=({minifiedViewKey:L,withReturnNumber:C=!1,withOrderNumber:M=!1,slots:n,pageInfo:t,withReturnsListButton:E=!0,isMobile:b=!1,returnsInMinifiedView:X=1,translations:a={},orderReturns:i=[],minifiedView:h=!1,withHeader:Z=!0,withThumbnails:w=!0,selectedPage:$=1,handleSetSelectPage:V,routeReturnDetails:m,routeOrderDetails:_,routeTracking:p,routeReturnsList:N,routeProductDetails:d,loading:g})=>{const A=h?X:i.length,B=d!=null&&d()?"a":"span",f=H(()=>i.slice(0,A).map((e,K)=>{var S,z;return r(k,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(q,{id:`Order.Returns.${L}.returnsList.returnStatus.${n1(e.returnStatus)}`})}),C?s("p",{children:[a.returnNumber," ",r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,M?s("p",{children:[a.orderNumber," ",r("a",{href:(_==null?void 0:_({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(S=e==null?void 0:e.tracking)==null?void 0:S.map((c,x)=>{var u,v;return s("p",{children:[`${a.carrier} ${(v=(u=c==null?void 0:c.carrier)==null?void 0:u.label)==null?void 0:v.toLocaleUpperCase()}: `,r("a",{href:`${(p==null?void 0:p(c))||"#"}`,target:"_blank",rel:"noreferrer",children:c.trackingNumber})]},`${c.trackingNumber}_${x}`)}),n!=null&&n.ReturnItemsDetails?r(G,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:n==null?void 0:n.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[e.items.length," ",r(q,{id:`Order.Returns.${L}.returnsList.itemText`,plural:e.items.length,fields:{count:e.items.length}})]}):null]}),w?r(R,{maxColumns:b?3:9,emptyGridContent:r(o,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",b]]),children:(z=e==null?void 0:e.items)==null?void 0:z.map((c,x)=>{var j,F;const u=(j=c.thumbnail)==null?void 0:j.label,v=(F=c.thumbnail)==null?void 0:F.url;return r(B,{href:(d==null?void 0:d(c))??"#",children:r(D,{alt:u,src:v,width:85,height:114})},x+c.uid)})}):null,n!=null&&n.DetailsActionParams?r(G,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:n==null?void 0:n.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(y,{source:J,...Q})})]})},K)}),[i,A,L,C,a,m,M,_,n,w,b,d,p,B]),Y=H(()=>s(o,{children:[Z?r(O,{title:a.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,g?r(U,{withCard:!1}):s(o,{children:[f,r(P,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:a.emptyOrdersListMessage}),E?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(k,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:a.viewAllOrdersButton}),r(y,{source:J,...Q})]})})}):null]})]}),[N,E,Z,a,f,h,i.length,g]),T=H(()=>s(o,{children:[Z?r(O,{title:a.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,g?r(U,{withCard:!1}):s(o,{children:[r(P,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:a.emptyOrdersListMessage}),f,(t==null?void 0:t.totalPages)>1?r(r1,{totalPages:t==null?void 0:t.totalPages,currentPage:$,onChange:V}):null]})]}),[f,h,i,a,t==null?void 0:t.totalPages,$,V,g,Z]);return r("div",{className:"order-returns-list-content",children:h?Y:T})};export{M1 as R}; +import{jsx as r,jsxs as s,Fragment as C}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as H}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as G}from"@dropins/tools/lib.js";import{IllustratedMessage as I,Icon as y,Card as k,ContentGrid as R,Image as D,Header as O,Pagination as r1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as e1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as q}from"@dropins/tools/i18n.js";const J=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"})))),t1=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"})),P=({typeList:L,isEmpty:M,minifiedView:Z,message:n})=>{const t=e1(()=>{switch(L){case"orders":return{icon:t1,text:r("p",{children:n}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,n]);return!M||!L||!t.text?null:r(I,{className:W(["order-empty-list",t.className,Z?"order-empty-list--minified":""]),message:t.text,icon:r(y,{source:t.icon}),"data-testid":"emptyList"})},Q={size:"32",stroke:"2"},M1=({minifiedViewKey:L,withReturnNumber:M=!1,withOrderNumber:Z=!1,slots:n,pageInfo:t,withReturnsListButton:E=!0,isMobile:b=!1,returnsInMinifiedView:X=1,translations:a={},orderReturns:i=[],minifiedView:h=!1,withHeader:o=!0,withThumbnails:$=!0,selectedPage:w=1,handleSetSelectPage:V,routeReturnDetails:m,routeOrderDetails:_,routeTracking:p,routeReturnsList:N,routeProductDetails:d,loading:g})=>{const A=h?X:i.length,B=d!=null&&d()?"a":"span",f=H(()=>i.slice(0,A).map((e,K)=>{var S,z;return r(k,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(q,{id:`Order.Returns.${L}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),M?s("p",{children:[a.returnNumber," ",r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,Z?s("p",{children:[a.orderNumber," ",r("a",{href:(_==null?void 0:_({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(S=e==null?void 0:e.tracking)==null?void 0:S.map((c,x)=>{var u,v;return s("p",{children:[`${a.carrier} ${(v=(u=c==null?void 0:c.carrier)==null?void 0:u.label)==null?void 0:v.toLocaleUpperCase()}: `,r("a",{href:`${(p==null?void 0:p(c))||"#"}`,target:"_blank",rel:"noreferrer",children:c.trackingNumber})]},`${c.trackingNumber}_${x}`)}),n!=null&&n.ReturnItemsDetails?r(G,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:n==null?void 0:n.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[e.items.length," ",r(q,{id:`Order.Returns.${L}.returnsList.itemText`,plural:e.items.length,fields:{count:e.items.length}})]}):null]}),$?r(R,{maxColumns:b?3:9,emptyGridContent:r(C,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",b]]),children:(z=e==null?void 0:e.items)==null?void 0:z.map((c,x)=>{var j,F;const u=(j=c.thumbnail)==null?void 0:j.label,v=(F=c.thumbnail)==null?void 0:F.url;return r(B,{href:(d==null?void 0:d(c))??"#",children:r(D,{alt:u,src:v,width:85,height:114})},x+c.uid)})}):null,n!=null&&n.DetailsActionParams?r(G,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:n==null?void 0:n.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(y,{source:J,...Q})})]})},K)}),[i,A,L,M,a,m,Z,_,n,$,b,d,p,B]),Y=H(()=>s(C,{children:[o?r(O,{title:a.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,g?r(U,{withCard:!1}):s(C,{children:[f,r(P,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:a.emptyOrdersListMessage}),E?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(k,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:a.viewAllOrdersButton}),r(y,{source:J,...Q})]})})}):null]})]}),[N,E,o,a,f,h,i.length,g]),T=H(()=>s(C,{children:[o?r(O,{title:a.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,g?r(U,{withCard:!1}):s(C,{children:[r(P,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:a.emptyOrdersListMessage}),f,(t==null?void 0:t.totalPages)>1?r(r1,{totalPages:t==null?void 0:t.totalPages,currentPage:w,onChange:V}):null]})]}),[o,f,h,i,a,t==null?void 0:t.totalPages,w,V,g,o]);return r("div",{className:"order-returns-list-content",children:h?Y:T})};export{M1 as R}; diff --git a/scripts/__dropins__/storefront-order/chunks/convertCase.js b/scripts/__dropins__/storefront-order/chunks/convertCase.js index 9edffe763d..c283128a1f 100644 --- a/scripts/__dropins__/storefront-order/chunks/convertCase.js +++ b/scripts/__dropins__/storefront-order/chunks/convertCase.js @@ -1,3 +1 @@ -/*! 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/fetch-graphql.js b/scripts/__dropins__/storefront-order/chunks/fetch-graphql.js index 75489de79e..b405754305 100644 --- a/scripts/__dropins__/storefront-order/chunks/fetch-graphql.js +++ b/scripts/__dropins__/storefront-order/chunks/fetch-graphql.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{FetchGraphQL as s}from"@dropins/tools/fetch-graphql.js";const h=e=>{const r=e.map(a=>a.message).join(" ");throw Error(r)},{setEndpoint:o,setFetchGraphQlHeader:c,removeFetchGraphQlHeader:n,setFetchGraphQlHeaders:p,fetchGraphQl:d,getConfig:g}=new s().getMethods();export{c as a,p as b,d as f,g,h,n as r,o as s}; diff --git a/scripts/__dropins__/storefront-order/chunks/form.types.js b/scripts/__dropins__/storefront-order/chunks/form.types.js index 99f6b00e1c..3525528924 100644 --- a/scripts/__dropins__/storefront-order/chunks/form.types.js +++ b/scripts/__dropins__/storefront-order/chunks/form.types.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ 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/formatDateToLocale.js b/scripts/__dropins__/storefront-order/chunks/formatDateToLocale.js index a6dca51049..dfc1a2e3f8 100644 --- a/scripts/__dropins__/storefront-order/chunks/formatDateToLocale.js +++ b/scripts/__dropins__/storefront-order/chunks/formatDateToLocale.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ const m=(e,a="en-US",o={})=>{const n={...{day:"2-digit",month:"2-digit",year:"numeric"},...o},t=new Date(e);return isNaN(t.getTime())?"Invalid Date":new Intl.DateTimeFormat(a,n).format(t)};export{m as f}; diff --git a/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js b/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js index ea47f8104f..5059874bd8 100644 --- a/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js +++ b/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js @@ -1,5 +1,3 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{h as i}from"./network-error.js";import{f as u,h as s}from"./fetch-graphql.js";import{t as m}from"./transform-attributes-form.js";const n=` query GET_ATTRIBUTES_FORM($formCode: String!) { attributesForm(formCode: $formCode) { diff --git a/scripts/__dropins__/storefront-order/chunks/getCustomer.js b/scripts/__dropins__/storefront-order/chunks/getCustomer.js index b6bcf17289..b0da3be013 100644 --- a/scripts/__dropins__/storefront-order/chunks/getCustomer.js +++ b/scripts/__dropins__/storefront-order/chunks/getCustomer.js @@ -1,5 +1,3 @@ -/*! 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 { diff --git a/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js b/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js index 790ac7bf5e..e5c626a509 100644 --- a/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js +++ b/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js @@ -1,5 +1,3 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{h as R}from"./network-error.js";import{f as e,h as E}from"./fetch-graphql.js";import{R as _,P as T,a as o,G as s,O as c,t as u}from"./transform-order-details.js";const h=` query GET_CUSTOMER_ORDERS_RETURN { customer { diff --git a/scripts/__dropins__/storefront-order/chunks/getFormValues.js b/scripts/__dropins__/storefront-order/chunks/getFormValues.js index 0d76b6a59d..1d284d4fd0 100644 --- a/scripts/__dropins__/storefront-order/chunks/getFormValues.js +++ b/scripts/__dropins__/storefront-order/chunks/getFormValues.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ const s=n=>{if(!n)return null;const t=new FormData(n);if(n.querySelectorAll('input[type="checkbox"]').forEach(e=>{t.has(e.name)||t.set(e.name,"false"),e.checked&&t.set(e.name,"true")}),t&&typeof t.entries=="function"){const e=t.entries();if(e&&typeof e[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(e)))||{}}return{}};export{s as g}; diff --git a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js index 479d481d2f..21f9223939 100644 --- a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js +++ b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js @@ -1,5 +1,3 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{P as e,a as t,G as r,O as a,B as s,R as d}from"./transform-order-details.js";const n=` fragment OrderSummary on OrderTotal { grand_total { diff --git a/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js b/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js index a3e3933f13..da8e0df02d 100644 --- a/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js +++ b/scripts/__dropins__/storefront-order/chunks/getStoreConfig.js @@ -1,5 +1,3 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{f as i,h as s}from"./fetch-graphql.js";function n(p){return p?{orderCancellationEnabled:p.order_cancellation_enabled,orderCancellationReasons:p.order_cancellation_reasons,shoppingCartDisplayPrice:p.shopping_cart_display_price,shoppingOrdersDisplaySubtotal:p.shopping_cart_display_subtotal,shoppingOrdersDisplayShipping:p.shopping_cart_display_shipping,shoppingOrdersDisplayGrandTotal:p.shopping_cart_display_grand_total,shoppingOrdersDisplayTaxGiftWrapping:p.shopping_cart_display_tax_gift_wrapping,shoppingOrdersDisplayFullSummary:p.shopping_cart_display_full_summary,shoppingOrdersDisplayZeroTax:p.shopping_cart_display_zero_tax}:null}const a=` query STORE_CONFIG_QUERY { storeConfig { diff --git a/scripts/__dropins__/storefront-order/chunks/network-error.js b/scripts/__dropins__/storefront-order/chunks/network-error.js index b7780a4913..e796708ca2 100644 --- a/scripts/__dropins__/storefront-order/chunks/network-error.js +++ b/scripts/__dropins__/storefront-order/chunks/network-error.js @@ -1,3 +1 @@ -/*! 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}; diff --git a/scripts/__dropins__/storefront-order/chunks/redirectTo.js b/scripts/__dropins__/storefront-order/chunks/redirectTo.js index 70554833ed..91a4f3eab3 100644 --- a/scripts/__dropins__/storefront-order/chunks/redirectTo.js +++ b/scripts/__dropins__/storefront-order/chunks/redirectTo.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ const a=(e,n,r)=>{if(typeof e!="function")return;const t=e(r);if(!n||Object.keys(n).length===0){window.location.href=t;return}const o=new URLSearchParams;Object.entries(n).forEach(([i,s])=>{o.append(i,String(s))});const c=t.includes("?")?"&":"?";window.location.href=`${t}${c}${o.toString()}`};export{a as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/reorderItems.js b/scripts/__dropins__/storefront-order/chunks/reorderItems.js index 00cd1961a1..69b6cacb84 100644 --- a/scripts/__dropins__/storefront-order/chunks/reorderItems.js +++ b/scripts/__dropins__/storefront-order/chunks/reorderItems.js @@ -1,5 +1,3 @@ -/*! 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) { diff --git a/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js b/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js index e01dd91a6e..31857f9aaa 100644 --- a/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js +++ b/scripts/__dropins__/storefront-order/chunks/requestGuestOrderCancel.js @@ -1,5 +1,3 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{P as c,a as u,G as l,O as E,B as m,b as d}from"./transform-order-details.js";import{O,A as D,G as R}from"./getGuestOrder.graphql.js";import{f as i,h as _}from"./fetch-graphql.js";const T=` mutation CANCEL_ORDER_MUTATION($orderId: ID!, $reason: String!) { cancelOrder(input: { order_id: $orderId, reason: $reason }) { diff --git a/scripts/__dropins__/storefront-order/chunks/requestReturn.js b/scripts/__dropins__/storefront-order/chunks/requestReturn.js index f79adecbc6..bf713ed850 100644 --- a/scripts/__dropins__/storefront-order/chunks/requestReturn.js +++ b/scripts/__dropins__/storefront-order/chunks/requestReturn.js @@ -1,5 +1,3 @@ -/*! 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 c}from"./transform-attributes-form.js";import{a as m}from"./convertCase.js";const d=` query GET_ATTRIBUTES_LIST($entityType: AttributeEntityTypeEnum!) { attributesList(entityType: $entityType) { diff --git a/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js b/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js index 8ffb239a78..7f9f88c15b 100644 --- a/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js +++ b/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{F as c}from"./form.types.js";const p={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"},y=i=>{const n={};return Object.keys(i).forEach(t=>{if(t.match(/_(\d+)$/)){const e=t.replace(/_\d+$/,"");n[e]=i[t]}else n[t]=i[t]}),n},R=(i,n)=>i.map(t=>({...t,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}`})),_=(i,n)=>i==null?void 0:i.flatMap(t=>Array.from({length:n},(a,e)=>({...t,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}`}))),$=i=>{const n=[],t=[];return Object.entries(i).forEach(([a,e])=>{const s=a.lastIndexOf("_"),r=a.slice(0,s),u=a.slice(s+1);u===c.MULTISELECT||u===c.SELECT?n.push({attributeCode:r,value:btoa(e)}):t.push({attributeCode:r,value:e})}),{selectedCustomAttributes:n,enteredCustomAttributes:t}},m=i=>typeof i!="string"?"":p[i]??"",l=["REJECTED","PARTIALLY_REJECTED","DENIED","UNCONFIRMED","CLOSED"],A=i=>{const n=i==null?void 0:i.returns.filter(e=>!l.includes(e.returnStatus));return((i==null?void 0:i.itemsEligibleForReturn)??[]).flatMap(e=>{let s=e.quantityShipped,r={...e,returnableQuantity:s};return e.quantityShipped===0&&(r={...r,eligibleForReturn:!1,returnableQuantity:0}),n.forEach(u=>{u.items.forEach(o=>{if((o==null?void 0:o.id)===(e==null?void 0:e.id)){const d=s-o.requestQuantity;s=Math.max(d,0),r={...r,eligibleForReturn:s!==0,returnableQuantity:s}}})}),r}).sort((e,s)=>Number(s.eligibleForReturn)-Number(e.eligibleForReturn))},C=i=>{var a;let n=[];return((a=i==null?void 0:i.returns)==null?void 0:a.filter(e=>!l.includes(e.returnStatus)).flatMap(e=>e.items||[])).forEach(e=>{if(!n.length)n.push({...e,totalQuantity:e.requestQuantity});else{const s=n.findIndex(r=>r.id===e.id);s!==-1?n[s].totalQuantity+=e.requestQuantity:n.push({...e,totalQuantity:e.requestQuantity})}}),{returnedList:n,modifyOrder:E(i.items,n)}};function E(i,n){return i.map(t=>{const a=n.find(e=>e.id===t.id);if(a){const e=t.totalQuantity-a.totalQuantity;return e===0?null:{...t,totalQuantity:e}}return t}).filter(t=>t!==null)}export{y as c,C as e,m as f,R as m,$ as n,A as o,_ as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/setTaxStatus.js b/scripts/__dropins__/storefront-order/chunks/setTaxStatus.js index afa80511a9..8a463a1e70 100644 --- a/scripts/__dropins__/storefront-order/chunks/setTaxStatus.js +++ b/scripts/__dropins__/storefront-order/chunks/setTaxStatus.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ const s=t=>{let e=!1,a=!1;switch(t){case 1:a=!0;break;case 2:e=!0;break;case 3:e=!0,a=!0;break;default:e=!1,a=!1}return{taxIncluded:e,taxExcluded:a}};export{s}; diff --git a/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js index 8a0a753928..b8ba7c03cf 100644 --- a/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js +++ b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{c as d,a as m}from"./convertCase.js";const a=s=>{let o=[];for(const e of s)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let n=2;n<=e.multiline_count;n++){const c={...e,name:`${e.code}_${n}`,code:`${e.code}_${n}`,id:`${e.code}_${n}`};o.push(c)}return o},f=s=>{var u;const o=s||[];if(!o.length)return[];const e=(u=o.filter(t=>{var r;return!((r=t.frontend_input)!=null&&r.includes("HIDDEN"))}))==null?void 0:u.map(({code:t,...r})=>{const i=t!=="country_id"?t:"country_code";return{...r,name:i,id:i,code:i}}),n=a(e);return e.concat(n).map(t=>{const r=d(t.code);return m({...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-order-details.js b/scripts/__dropins__/storefront-order/chunks/transform-order-details.js index a47b56da9f..689e5682b7 100644 --- a/scripts/__dropins__/storefront-order/chunks/transform-order-details.js +++ b/scripts/__dropins__/storefront-order/chunks/transform-order-details.js @@ -1,5 +1,3 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{a as M}from"./convertCase.js";const J=` fragment ProductDetails on ProductInterface { __typename diff --git a/scripts/__dropins__/storefront-order/chunks/useIsMobile.js b/scripts/__dropins__/storefront-order/chunks/useIsMobile.js index 9f24ca2937..5e8379ccb8 100644 --- a/scripts/__dropins__/storefront-order/chunks/useIsMobile.js +++ b/scripts/__dropins__/storefront-order/chunks/useIsMobile.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{debounce as t}from"@dropins/tools/lib.js";import{useState as o,useCallback as s,useEffect as r}from"@dropins/tools/preact-hooks.js";const w=()=>{const[i,n]=o(window.innerWidth<768),e=s(t(()=>{n(window.innerWidth<768)},1e3),[]);return r(()=>(window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}),[e]),i};export{w as u}; diff --git a/scripts/__dropins__/storefront-order/containers/CreateReturn.js b/scripts/__dropins__/storefront-order/containers/CreateReturn.js index 779a14fdd2..d20bd22150 100644 --- a/scripts/__dropins__/storefront-order/containers/CreateReturn.js +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{jsx as a,jsxs as F}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as H,classes as Q}from"@dropins/tools/lib.js";import{Button as M,CartItem as V,Image as W,Header as $,InLineAlert as Z}from"@dropins/tools/components.js";import{S as D,u as z,a as U,R as K}from"../chunks/OrderCancel.js";import{useState as O,useRef as G,useEffect as T,useCallback as A}from"@dropins/tools/preact-hooks.js";import{events as J}from"@dropins/tools/event-bus.js";import{g as X}from"../chunks/getFormValues.js";import{s as Y}from"../chunks/setTaxStatus.js";import{createRef as I,Fragment as ee}from"@dropins/tools/preact.js";import{o as te,c as ne,n as se,r as ae,m as re}from"../chunks/returnOrdersHelper.js";import{g as ie,r as ce}from"../chunks/requestReturn.js";import{g as ue}from"../chunks/getStoreConfig.js";import*as g from"@dropins/tools/preact-compat.js";import{O as oe}from"../chunks/OrderLoaders.js";import{useText as le}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const de=s=>g.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},g.createElement("g",{clipPath:"url(#clip0_841_1324)"},g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),g.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"})),g.createElement("defs",null,g.createElement("clipPath",{id:"clip0_841_1324"},g.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),pe=s=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},g.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"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),he=({onSuccess:s,onError:r,handleSetInLineAlert:i,orderData:l})=>{const[o,h]=O(l),[S,k]=O("products"),[w,R]=O(!0),[f,y]=O([]),[v,x]=O([]),[t,C]=O({taxIncluded:!1,taxExcluded:!1}),[e,d]=O([]),m=G([]);m.current.length!==f.length&&(m.current=f.map((n,c)=>m.current[c]||I())),T(()=>{const n=J.on("order/data",c=>{h(c),d(te(c)),R(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ue().then(n=>{if(n){const c=Y(n==null?void 0:n.shoppingCartDisplayPrice);C(c)}})},[]),T(()=>{ie("RMA_ITEM").then(n=>{n.length&&(x(n),R(!1))})},[]);const _=A(n=>{y(c=>c.findIndex(u=>(u==null?void 0:u.productSku)===(n==null?void 0:n.productSku))>-1?c.filter(u=>(u==null?void 0:u.productSku)!==(n==null?void 0:n.productSku)):[...c,n])},[]),b=A(n=>{k(n),i(),n==="products"&&y([])},[i]),N=A((n,c)=>{const L=f.map(u=>u.productSku===c?{...u,currentReturnOrderQuantity:n}:u);y(L)},[f]),E=A(async(n,c)=>{if(!c)return null;R(!0);const L={orderUid:(o==null?void 0:o.id)??"",contactEmail:(o==null?void 0:o.email)??""},u=[];m.current.length&&m.current.forEach(({current:p})=>{var P;const j=p==null?void 0:p.name.replace(/_\d+$/,""),q=((P=p==null?void 0:p.dataset)==null?void 0:P.quantity)??1,B=ne(X(p));u.push({orderItemUid:j,quantityToReturn:+q,...se(B)})}),ce({...L,items:u}).then(p=>{p&&(s==null||s(p),b("success"),i())}).catch(p=>{r==null||r(p.message),i({type:"error",heading:p.message})}),R(!1)},[b,r,s,i,o]);return{order:o,steps:S,loading:w,formsRef:m,taxConfig:t,attributesList:v,selectedProductList:f,itemsEligibleForReturn:e,handleSelectedProductList:_,handleSetQuantity:N,handleChangeStep:b,onSubmit:E}},me={success:a(pe,{}),warning:a(de,{}),error:a(D,{})},ge=()=>{const[s,r]=O({type:"success",heading:""}),i=A(l=>{if(!(l!=null&&l.type)){r({type:"success",heading:""});return}const o=me[l.type];r({...l,icon:o})},[]);return{inLineAlertProps:s,handleSetInLineAlert:i}},fe=({routeReturnSuccess:s,translations:r,orderData:i})=>{const l=()=>{window.location.href=(s==null?void 0:s(i))??"#"};return F("div",{className:"order-return-order-message",children:[a("p",{className:"order-return-order-message__title",children:r.successTitle}),a("p",{className:"order-return-order-message__subtitle",children:r.successMessage}),a(M,{onClick:l,type:"button",children:r.backStore})]})},be=({slots:s,formsRef:r,selectedProductList:i,loading:l,fieldsConfig:o,translations:h,handleChangeStep:S,onSubmit:k})=>{const{formData:w,errors:R,formRef:f,handleChange:y,handleBlur:v,handleSubmit:x}=z({fieldsConfig:ae(o,i==null?void 0:i.length),onSubmit:k});return F("form",{className:"order-return-reason-form",ref:f,onSubmit:x,name:"returnReasonForm",children:[i.map((t,C)=>{var E,n,c,L,u;const e=(t==null?void 0:t.giftCard)||{},d=t==null?void 0:t.product,m=re(o,C),_=`${t==null?void 0:t.id}_${C}`,b=(t==null?void 0:t.currentReturnOrderQuantity)??1,N={...t!=null&&t.currentReturnOrderQuantity?{Quantity:b}:{},..."configurableOptions"in t?t.configurableOptions:{},..."bundleOptions"in t?t.bundleOptions:{},..."senderName"in e&&(e!=null&&e.senderName)?{[h.sender]:e==null?void 0:e.senderName}:{},..."senderEmail"in e&&(e!=null&&e.senderEmail)?{[h.sender]:e==null?void 0:e.senderEmail}:{},..."recipientName"in e&&(e!=null&&e.recipientName)?{[h.recipient]:e==null?void 0:e.recipientName}:{},..."recipientEmail"in e&&(e!=null&&e.recipientEmail)?{[h.recipient]:e==null?void 0:e.recipientEmail}:{},..."message"in e&&(e!=null&&e.message)?{[h.message]:e==null?void 0:e.message}:{},..."downloadableLinks"in t&&(t!=null&&t.downloadableLinks)?{[`${(E=t==null?void 0:t.downloadableLinks)==null?void 0:E.count} ${h.downloadableCount}`]:(n=t==null?void 0:t.downloadableLinks)==null?void 0:n.result}:{}};return F(ee,{children:[a(V,{loading:l,title:a("div",{"data-testid":"product-name",children:(c=t==null?void 0:t.product)==null?void 0:c.name}),sku:a("div",{children:d==null?void 0:d.sku}),image:a(W,{src:((L=d==null?void 0:d.thumbnail)==null?void 0:L.url)??"",alt:((u=d==null?void 0:d.thumbnail)==null?void 0:u.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:N}),a("form",{name:_,ref:r==null?void 0:r.current[C],"data-quantity":b,children:a(U,{className:"className",loading:l,fields:m,onChange:y,onBlur:v,errors:R,values:w})})]},C)}),s!=null&&s.ReturnFormActions?a(H,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:s==null?void 0:s.ReturnFormActions,context:{handleChangeStep:S}}):F("div",{className:"order-return-reason-form__actions",children:[a(M,{variant:"secondary",type:"button",onClick:()=>{S("products")},children:h.backStep}),a(M,{children:h.submit})]})]})},Be=({className:s,orderData:r,slots:i,onSuccess:l,onError:o,routeReturnSuccess:h,showConfigurableOptions:S})=>{const k=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"}),{inLineAlertProps:w,handleSetInLineAlert:R}=ge(),{order:f,itemsEligibleForReturn:y,formsRef:v,taxConfig:x,attributesList:t,steps:C,loading:e,selectedProductList:d,handleSelectedProductList:m,handleSetQuantity:_,handleChangeStep:b,onSubmit:N}=he({orderData:r,onSuccess:l,onError:o,handleSetInLineAlert:R});if(e)return a("div",{children:a(oe,{})});if(!e&&!t.length)return a("div",{});const E={products:a(K,{itemsEligibleForReturn:y,slots:i,translations:k,loading:e,taxConfig:x,selectedProductList:d,handleSelectedProductList:m,showConfigurableOptions:S,handleSetQuantity:_,handleChangeStep:b}),attributes:a(be,{slots:i,formsRef:v,loading:e,fieldsConfig:t,selectedProductList:d,handleChangeStep:b,translations:k,onSubmit:N}),success:a(fe,{translations:k,routeReturnSuccess:h,orderData:f}),error:null};return F("div",{className:Q(["order-create-return",s]),children:[a($,{title:k.headerText}),w.heading?a(Z,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...w}):null,E[C]]})};export{Be as CreateReturn,Be as default}; +import{jsx as a,jsxs as A}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as H,classes as Q}from"@dropins/tools/lib.js";import{Button as M,CartItem as V,Image as W,Header as $,InLineAlert as Z}from"@dropins/tools/components.js";import{S as z,u as D,a as U,R as K}from"../chunks/OrderCancel.js";import{useState as O,useRef as G,useEffect as T,useCallback as N}from"@dropins/tools/preact-hooks.js";import{events as J}from"@dropins/tools/event-bus.js";import{g as X}from"../chunks/getFormValues.js";import{s as Y}from"../chunks/setTaxStatus.js";import{createRef as I,Fragment as ee}from"@dropins/tools/preact.js";import{o as te,c as ne,n as se,r as ae,m as re}from"../chunks/returnOrdersHelper.js";import{g as ie,r as ce}from"../chunks/requestReturn.js";import{g as ue}from"../chunks/getStoreConfig.js";import*as f from"@dropins/tools/preact-compat.js";import{O as oe}from"../chunks/OrderLoaders.js";import{useText as le}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const de=s=>f.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},f.createElement("g",{clipPath:"url(#clip0_841_1324)"},f.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),f.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"})),f.createElement("defs",null,f.createElement("clipPath",{id:"clip0_841_1324"},f.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),pe=s=>f.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},f.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"}),f.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),he=({onSuccess:s,onError:r,handleSetInLineAlert:i,orderData:p})=>{const[o,h]=O(p),[S,k]=O("products"),[w,R]=O(!0),[b,y]=O([]),[x,E]=O([]),[t,m]=O({taxIncluded:!1,taxExcluded:!1}),[e,l]=O([]),g=G([]);g.current.length!==b.length&&(g.current=b.map((n,c)=>g.current[c]||I())),T(()=>{const n=J.on("order/data",c=>{h(c),l(te(c)),R(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ue().then(n=>{if(n){const c=Y(n==null?void 0:n.shoppingCartDisplayPrice);m(c)}})},[]),T(()=>{ie("RMA_ITEM").then(n=>{n.length&&(E(n),R(!1))})},[]);const v=N(n=>{y(c=>c.findIndex(u=>(u==null?void 0:u.productSku)===(n==null?void 0:n.productSku))>-1?c.filter(u=>(u==null?void 0:u.productSku)!==(n==null?void 0:n.productSku)):[...c,n])},[]),C=N(n=>{k(n),i(),n==="products"&&y([])},[i]),_=N((n,c)=>{const L=b.map(u=>u.productSku===c?{...u,currentReturnOrderQuantity:n}:u);y(L)},[b]),F=N(async(n,c)=>{if(!c)return null;R(!0);const L={orderUid:(o==null?void 0:o.id)??"",contactEmail:(o==null?void 0:o.email)??""},u=[];g.current.length&&g.current.forEach(({current:d})=>{var P;const j=d==null?void 0:d.name.replace(/_\d+$/,""),q=((P=d==null?void 0:d.dataset)==null?void 0:P.quantity)??1,B=ne(X(d));u.push({orderItemUid:j,quantityToReturn:+q,...se(B)})}),ce({...L,items:u}).then(d=>{d&&(s==null||s(d),C("success"),i())}).catch(d=>{r==null||r(d.message),i({type:"error",heading:d.message})}),R(!1)},[C,r,s,i,o]);return{order:o,steps:S,loading:w,formsRef:g,taxConfig:t,attributesList:x,selectedProductList:b,itemsEligibleForReturn:e,handleSelectedProductList:v,handleSetQuantity:_,handleChangeStep:C,onSubmit:F}},me={success:a(pe,{}),warning:a(de,{}),error:a(z,{})},ge=()=>{const[s,r]=O({type:"success",heading:""}),i=N(p=>{if(!(p!=null&&p.type)){r({type:"success",heading:""});return}const o=me[p.type];r({...p,icon:o})},[]);return{inLineAlertProps:s,handleSetInLineAlert:i}},fe=({routeReturnSuccess:s,translations:r})=>{const i=()=>{window.location.href=(s==null?void 0:s())??""};return A("div",{className:"order-return-order-message",children:[a("p",{className:"order-return-order-message__title",children:r.successTitle}),a("p",{className:"order-return-order-message__subtitle",children:r.successMessage}),a(M,{onClick:i,type:"button",children:r.backStore})]})},be=({slots:s,formsRef:r,selectedProductList:i,loading:p,fieldsConfig:o,translations:h,handleChangeStep:S,onSubmit:k})=>{const{formData:w,errors:R,formRef:b,handleChange:y,handleBlur:x,handleSubmit:E}=D({fieldsConfig:ae(o,i==null?void 0:i.length),onSubmit:k});return A("form",{className:"order-return-reason-form",ref:b,onSubmit:E,name:"returnReasonForm",children:[i.map((t,m)=>{var F,n,c,L,u;const e=(t==null?void 0:t.giftCard)||{},l=t==null?void 0:t.product,g=re(o,m),v=`${t==null?void 0:t.id}_${m}`,C=(t==null?void 0:t.currentReturnOrderQuantity)??1,_={...t!=null&&t.currentReturnOrderQuantity?{Quantity:C}:{},..."configurableOptions"in t?t.configurableOptions:{},..."bundleOptions"in t?t.bundleOptions:{},..."senderName"in e&&(e!=null&&e.senderName)?{[h.sender]:e==null?void 0:e.senderName}:{},..."senderEmail"in e&&(e!=null&&e.senderEmail)?{[h.sender]:e==null?void 0:e.senderEmail}:{},..."recipientName"in e&&(e!=null&&e.recipientName)?{[h.recipient]:e==null?void 0:e.recipientName}:{},..."recipientEmail"in e&&(e!=null&&e.recipientEmail)?{[h.recipient]:e==null?void 0:e.recipientEmail}:{},..."message"in e&&(e!=null&&e.message)?{[h.message]:e==null?void 0:e.message}:{},..."downloadableLinks"in t&&(t!=null&&t.downloadableLinks)?{[`${(F=t==null?void 0:t.downloadableLinks)==null?void 0:F.count} ${h.downloadableCount}`]:(n=t==null?void 0:t.downloadableLinks)==null?void 0:n.result}:{}};return A(ee,{children:[a(V,{loading:p,title:a("div",{"data-testid":"product-name",children:(c=t==null?void 0:t.product)==null?void 0:c.name}),sku:a("div",{children:l==null?void 0:l.sku}),image:a(W,{src:((L=l==null?void 0:l.thumbnail)==null?void 0:L.url)??"",alt:((u=l==null?void 0:l.thumbnail)==null?void 0:u.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:_}),a("form",{name:v,ref:r==null?void 0:r.current[m],"data-quantity":C,children:a(U,{className:"className",loading:p,fields:g,onChange:y,onBlur:x,errors:R,values:w})})]},m)}),s!=null&&s.ReturnFormActions?a(H,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:s==null?void 0:s.ReturnFormActions,context:{handleChangeStep:S}}):A("div",{className:"order-return-reason-form__actions",children:[a(M,{variant:"secondary",type:"button",onClick:()=>{S("products")},children:h.backStep}),a(M,{children:h.submit})]})]})},Be=({className:s,orderData:r,slots:i,onSuccess:p,onError:o,routeReturnSuccess:h,showConfigurableOptions:S})=>{const k=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"}),{inLineAlertProps:w,handleSetInLineAlert:R}=ge(),{itemsEligibleForReturn:b,formsRef:y,taxConfig:x,attributesList:E,steps:t,loading:m,selectedProductList:e,handleSelectedProductList:l,handleSetQuantity:g,handleChangeStep:v,onSubmit:C}=he({orderData:r,onSuccess:p,onError:o,handleSetInLineAlert:R});if(m)return a("div",{children:a(oe,{})});if(!m&&!E.length)return a("div",{});const _={products:a(K,{itemsEligibleForReturn:b,slots:i,translations:k,loading:m,taxConfig:x,selectedProductList:e,handleSelectedProductList:l,showConfigurableOptions:S,handleSetQuantity:g,handleChangeStep:v}),attributes:a(be,{slots:i,formsRef:y,loading:m,fieldsConfig:E,selectedProductList:e,handleChangeStep:v,translations:k,onSubmit:C}),success:a(fe,{translations:k,routeReturnSuccess:h}),error:null};return A("div",{className:Q(["order-create-return",s]),children:[a($,{title:k.headerText}),w.heading?a(Z,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...w}):null,_[t]]})};export{Be as CreateReturn,Be as default}; diff --git a/scripts/__dropins__/storefront-order/containers/CustomerDetails.js b/scripts/__dropins__/storefront-order/containers/CustomerDetails.js index 980a3365c8..be378db949 100644 --- a/scripts/__dropins__/storefront-order/containers/CustomerDetails.js +++ b/scripts/__dropins__/storefront-order/containers/CustomerDetails.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{jsx as r,jsxs as s,Fragment as K}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as G,classes as g}from"@dropins/tools/lib.js";import{useState as y,useEffect as H,useCallback as V,useMemo as j}from"@dropins/tools/preact-hooks.js";import{events as J}from"@dropins/tools/event-bus.js";import{c as Q}from"../chunks/convertCase.js";import{g as U}from"../chunks/getAttributesForm.js";import"@dropins/tools/preact.js";import{Icon as X,Price as Y,Card as ee,Header as te}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import*as a from"@dropins/tools/preact-compat.js";import{f as re}from"../chunks/returnOrdersHelper.js";import{f as ne}from"../chunks/formatDateToLocale.js";import{D as ie}from"../chunks/OrderLoaders.js";import{Text as se,useText as oe}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/form.types.js";const ce=d=>a.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},a.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"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),ae=d=>a.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...d},a.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}),a.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}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M3.01465 15.9682H8.40305",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round"}),a.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}),a.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})),de=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],le=({orderData:d})=>{const[t,_]=y(!0),[l,p]=y(d),[u,e]=y([]);H(()=>{const n=J.on("order/data",m=>{p(m)},{eager:!0});return()=>{n==null||n.off()}},[]),H(()=>{U("shortRequest").then(n=>{if(n){const m=n.map(({name:i,orderNumber:C,label:f})=>({name:Q(i),orderNumber:C,label:de.includes(i)?null:f}));e(m)}}).finally(()=>{_(!1)})},[]);const o=V(n=>{if(!u.length||!l||!l[n])return[];const m=Object.fromEntries(Object.entries(l[n]).map(([i,C])=>[i.toLowerCase(),C]));return u.filter(({name:i})=>m[i.toLowerCase()]).map(i=>({name:i.name,orderNumber:i.orderNumber,value:m[i.name.toLowerCase()],label:i.label}))},[u,l]),h=j(()=>({billingAddress:o("billingAddress"),shippingAddress:o("shippingAddress")}),[o]);return{order:l,normalizeAddress:h,loading:t}},me=({loading:d,order:t,withHeader:_=!0,title:l,paymentIconsMap:p={},normalizeAddress:u,translations:e,slots:o})=>{var L,O,E,T,w,S;const h=!!(t!=null&&t.returnNumber),n=(L=t==null?void 0:t.returns)==null?void 0:L[0],m=j(()=>({checkmo:ce,card:ae,...p}),[p]),i=V(q=>{var x;return(x=u[q])==null?void 0:x.map((c,F)=>r("p",{children:c.label?`${c.label}: ${Array.isArray(c.value)?c.value.join(" "):c==null?void 0:c.value}`:Array.isArray(c.value)?c.value.join(" "):c==null?void 0:c.value},F))},[u]);if(!t||d)return r(ie,{});const C=(t==null?void 0:t.email)??"",f=(O=t==null?void 0:t.shipping)==null?void 0:O.code,N=(E=t==null?void 0:t.shipping)==null?void 0:E.amount,R=(T=t==null?void 0:t.shipping)==null?void 0:T.currency,v=t==null?void 0:t.payments,k=v&&v.length>0,D=k?(w=v[0])==null?void 0:w.name:"",M=k?(S=v[0])==null?void 0:S.code:"",W=k&&D!=="",b=i("shippingAddress")??[],A=i("billingAddress")??[],I=s("div",{className:"order-customer-details-content__container-email",children:[r("div",{className:"order-customer-details-content__container-title",children:e==null?void 0:e.emailTitle}),r("p",{children:C})]}),P=h?s("div",{className:"order-customer-details-content__container-return-information",children:[r("div",{className:"order-customer-details-content__container-title",children:e==null?void 0:e.returnInformationTitle}),r("div",{className:"order-customer-details-content__container-description",children:o!=null&&o.OrderReturnInformation?r(G,{"data-testid":"OrderReturnInformation",name:"OrderReturnInformation",slot:o==null?void 0:o.OrderReturnInformation,context:n}):s(K,{children:[s("p",{children:[e.createdReturnAt,r("span",{children:ne(n==null?void 0:n.createdReturnAt)})]}),s("p",{children:[e.returnStatusLabel,r(se,{id:`Order.CustomerDetails.returnStatus.${re(n==null?void 0:n.returnStatus)}`})]}),s("p",{children:[e.orderNumberLabel,r("span",{children:n==null?void 0:n.orderNumber})]})]})})]}):null,Z=b.length?s("div",{className:"order-customer-details-content__container-shipping_address",children:[r("div",{className:"order-customer-details-content__container-title",children:e.shippingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:b})]}):null,$=A.length?s("div",{className:g(["order-customer-details-content__container-billing_address",["order-customer-details-content__container-billing_address--fullwidth",!b.length]]),children:[r("div",{className:"order-customer-details-content__container-title",children:e.billingAddressTitle}),r("div",{className:"order-customer-details-content__container-description",children:A})]}):null,z=W?s("div",{className:g(["order-customer-details-content__container-payment_methods",["order-customer-details-content__container-payment_methods--fullwidth",!f]]),children:[r("div",{className:"order-customer-details-content__container-title",children:e==null?void 0:e.paymentMethodsTitle}),s("p",{"data-testid":"payment_methods_description",className:g([["order-customer-details-content__container-payment_methods--icon",!!m[M]]]),children:[r(X,{source:m[M]}),D]})]}):null,B=f?s("div",{className:"order-customer-details-content__container-shipping_methods",children:[r("div",{className:"order-customer-details-content__container-title",children:e==null?void 0:e.shippingMethodsTitle}),N?s("p",{"data-testid":"shipping_methods_price",children:[r(Y,{amount:N,currency:R})," ",f]}):r("p",{"data-testid":"shipping_methods_placeholder",children:e==null?void 0:e.freeShipping})]}):null;return s(ee,{"data-testid":"order-details",variant:"secondary",className:g(["order-customer-details-content"]),children:[_?r(te,{title:l??(e==null?void 0:e.headerText)}):null,s("div",{className:g(["order-customer-details-content__container",["order-customer-details-content__container--no-margin",b.length||A.length]]),children:[I,Z,h?P:$,h?null:B,h?null:z]})]})},Te=({paymentIconsMap:d,orderData:t,title:_,className:l,slots:p})=>{const u=oe({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:e,normalizeAddress:o,loading:h}=le({orderData:t});return r("div",{className:g(["order-customer-details",l]),children:r(me,{slots:p,loading:h,order:e,title:_,paymentIconsMap:d,normalizeAddress:o,translations:u})})};export{Te as CustomerDetails,Te as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js b/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js index b34e4ebc05..51fea62824 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js +++ b/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{O as C,O as F}from"../chunks/OrderCancelForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import"@dropins/tools/preact.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";import"../chunks/getGuestOrder.graphql.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";export{C as OrderCancelForm,F as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js b/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js index 7bae7d4fde..6554358d90 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js +++ b/scripts/__dropins__/storefront-order/containers/OrderCostSummary.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{jsxs as i,jsx as c,Fragment as C}from"@dropins/tools/preact-jsx-runtime.js";import{classes as H}from"@dropins/tools/lib.js";import{useState as _,useEffect as T}from"@dropins/tools/preact-hooks.js";import{events as V}from"@dropins/tools/event-bus.js";import{s as v}from"../chunks/setTaxStatus.js";import{g as N}from"../chunks/getStoreConfig.js";import"@dropins/tools/preact.js";import{Price as p,Icon as f,Accordion as b,AccordionSection as E,Card as D,Header as k}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import*as x from"@dropins/tools/preact-compat.js";import{a as z}from"../chunks/OrderLoaders.js";import{useText as B}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const I=e=>x.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),A=e=>x.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),j=e=>x.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M22 6.25H22.75C22.75 5.83579 22.4142 5.5 22 5.5V6.25ZM22 9.27L22.2514 9.97663C22.5503 9.87029 22.75 9.58731 22.75 9.27H22ZM20.26 12.92L19.5534 13.1714L19.5539 13.1728L20.26 12.92ZM22 14.66H22.75C22.75 14.3433 22.551 14.0607 22.2528 13.9539L22 14.66ZM22 17.68V18.43C22.4142 18.43 22.75 18.0942 22.75 17.68H22ZM2 17.68H1.25C1.25 18.0942 1.58579 18.43 2 18.43V17.68ZM2 14.66L1.74865 13.9534C1.44969 14.0597 1.25 14.3427 1.25 14.66H2ZM3.74 11.01L4.44663 10.7586L4.44611 10.7572L3.74 11.01ZM2 9.27H1.25C1.25 9.58675 1.44899 9.86934 1.7472 9.97611L2 9.27ZM2 6.25V5.5C1.58579 5.5 1.25 5.83579 1.25 6.25H2ZM21.25 6.25V9.27H22.75V6.25H21.25ZM21.7486 8.56337C19.8706 9.23141 18.8838 11.2889 19.5534 13.1714L20.9666 12.6686C20.5762 11.5711 21.1494 10.3686 22.2514 9.97663L21.7486 8.56337ZM19.5539 13.1728C19.9195 14.1941 20.7259 15.0005 21.7472 15.3661L22.2528 13.9539C21.6541 13.7395 21.1805 13.2659 20.9661 12.6672L19.5539 13.1728ZM21.25 14.66V17.68H22.75V14.66H21.25ZM22 16.93H2V18.43H22V16.93ZM2.75 17.68V14.66H1.25V17.68H2.75ZM2.25135 15.3666C4.12941 14.6986 5.11623 12.6411 4.44663 10.7586L3.03337 11.2614C3.42377 12.3589 2.85059 13.5614 1.74865 13.9534L2.25135 15.3666ZM4.44611 10.7572C4.08045 9.73588 3.27412 8.92955 2.2528 8.56389L1.7472 9.97611C2.34588 10.1905 2.81955 10.6641 3.03389 11.2628L4.44611 10.7572ZM2.75 9.27V6.25H1.25V9.27H2.75ZM2 7H22V5.5H2V7ZM7.31 6.74V18.17H8.81V6.74H7.31ZM17.0997 8.39967L11.0397 14.4597L12.1003 15.5203L18.1603 9.46033L17.0997 8.39967ZM12.57 9.67C12.57 9.87231 12.4159 10 12.27 10V11.5C13.2839 11.5 14.07 10.6606 14.07 9.67H12.57ZM12.27 10C12.1241 10 11.97 9.87231 11.97 9.67H10.47C10.47 10.6606 11.2561 11.5 12.27 11.5V10ZM11.97 9.67C11.97 9.46769 12.1241 9.34 12.27 9.34V7.84C11.2561 7.84 10.47 8.67938 10.47 9.67H11.97ZM12.27 9.34C12.4159 9.34 12.57 9.46769 12.57 9.67H14.07C14.07 8.67938 13.2839 7.84 12.27 7.84V9.34ZM17.22 14.32C17.22 14.5223 17.0659 14.65 16.92 14.65V16.15C17.9339 16.15 18.72 15.3106 18.72 14.32H17.22ZM16.92 14.65C16.7741 14.65 16.62 14.5223 16.62 14.32H15.12C15.12 15.3106 15.9061 16.15 16.92 16.15V14.65ZM16.62 14.32C16.62 14.1177 16.7741 13.99 16.92 13.99V12.49C15.9061 12.49 15.12 13.3294 15.12 14.32H16.62ZM16.92 13.99C17.0659 13.99 17.22 14.1177 17.22 14.32H18.72C18.72 13.3294 17.9339 12.49 16.92 12.49V13.99Z",fill:"#3D3D3D"})),P=({orderData:e})=>{const[a,t]=_(!0),[n,l]=_(e),[r,o]=_(null);return T(()=>{N().then(u=>{if(u){const{shoppingCartDisplayPrice:m,shoppingOrdersDisplayShipping:s,shoppingOrdersDisplaySubtotal:y,...h}=u;o(d=>({...d,...h,shoppingCartDisplayPrice:v(m),shoppingOrdersDisplayShipping:v(s),shoppingOrdersDisplaySubtotal:v(y)}))}}).finally(()=>{t(!1)})},[]),T(()=>{const u=V.on("order/data",m=>{l(m)},{eager:!0});return()=>{u==null||u.off()}},[]),{loading:a,storeConfig:r,order:n}},W=({translations:e,order:a,subTotalValue:t,shoppingOrdersDisplaySubtotal:n})=>{var l,r;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.subtotal}),c(p,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(l=a==null?void 0:a.subtotal)==null?void 0:l.currency,amount:t})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[!n.taxExcluded&&n.taxIncluded?c("span",{children:e.incl}):null,n.taxExcluded&&n.taxIncluded?i(C,{children:[c(p,{currency:(r=a==null?void 0:a.subtotal)==null?void 0:r.currency,amount:t,size:"small"})," ",c("span",{children:e.excl})]}):null]})]})},q=({translations:e,shoppingOrdersDisplayShipping:a,order:t,totalShipping:n})=>{var l,r,o,u;return t!=null&&t.isVirtual?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--shipping",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.shipping}),(l=t==null?void 0:t.totalShipping)!=null&&l.value?c(p,{weight:"normal",currency:(r=t==null?void 0:t.totalShipping)==null?void 0:r.currency,amount:n}):c("span",{children:e.freeShipping})]}),i("div",{className:"order-cost-summary-content__description--subheader",children:[a.taxIncluded&&a.taxExcluded?i(C,{children:[c(p,{weight:"normal",currency:(o=t==null?void 0:t.totalShipping)==null?void 0:o.currency,amount:(u=t==null?void 0:t.totalShipping)==null?void 0:u.value,size:"small"}),i("span",{children:[" ",e.excl]})]}):null,a.taxIncluded&&!a.taxExcluded?c("span",{children:e.incl}):null]})]})},F=({translations:e,order:a,totalGiftcardValue:t,totalGiftcardCurrency:n})=>{var r,o,u,m;const l=(r=a==null?void 0:a.discounts)==null?void 0:r.every(s=>s.amount.value===0);return!((o=a==null?void 0:a.discounts)!=null&&o.length)&&(l||!t||t<1)||(u=a==null?void 0:a.discounts)!=null&&u.length&&l?null:i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--discount",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.discount}),c("span",{children:(m=a==null?void 0:a.discounts)==null?void 0:m.map(({amount:s},y)=>{const d=((s==null?void 0:s.value)??0)+t;return d===0?null:c(p,{weight:"normal",sale:!0,currency:s==null?void 0:s.currency,amount:-d},y)})})]}),t>0?i("div",{className:"order-cost-summary-content__description--subheader",children:[i("span",{children:[c(f,{source:j,size:"16"}),c("span",{children:e.discountSubtitle.toLocaleUpperCase()})]}),c(p,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},U=({order:e})=>{var a;return c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--coupon",children:(a=e==null?void 0:e.coupons)==null?void 0:a.map((t,n)=>i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:t.code}),c("span",{children:"TBD"})]},n))})},R=({translations:e,renderTaxAccordion:a,totalAccordionTaxValue:t,order:n})=>{var o,u,m;const[l,r]=_(!1);return a?c(b,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:I,iconClose:A,children:i(E,{onStateChange:r,title:e.accordionTitle,secondaryText:c(C,{children:l?null:c(p,{weight:"normal",amount:t,currency:(u=n==null?void 0:n.totalTax)==null?void 0:u.currency})}),renderContentWhenClosed:!1,children:[(m=n==null?void 0:n.taxes)==null?void 0:m.map((s,y)=>{var h,d;return i("div",{className:"order-cost-summary-content__accordion-row",children:[c("p",{children:s==null?void 0:s.title}),c("p",{children:c(p,{weight:"normal",amount:(h=s==null?void 0:s.amount)==null?void 0:h.value,currency:(d=s==null?void 0:s.amount)==null?void 0:d.currency})})]},y)}),i("div",{className:"order-cost-summary-content__accordion-row order-cost-summary-content__accordion-total",children:[c("p",{children:e.accordionTotalTax}),c("p",{children:c(p,{weight:"normal",amount:t,currency:n.totalTax.currency,size:"medium"})})]})]})}):c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--tax",children:i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.tax}),c(p,{currency:(o=n==null?void 0:n.totalTax)==null?void 0:o.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},G=({translations:e,shoppingOrdersDisplaySubtotal:a,order:t})=>{var n,l,r,o;return i("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--total",children:[i("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.total}),c(p,{currency:(n=t==null?void 0:t.grandTotal)==null?void 0:n.currency,amount:(l=t==null?void 0:t.grandTotal)==null?void 0:l.value,weight:"bold",size:"medium"})]}),a.taxExcluded&&a.taxIncluded?i("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:e.totalExcludingTaxes}),c(p,{currency:(r=t==null?void 0:t.grandTotal)==null?void 0:r.currency,amount:((o=t==null?void 0:t.grandTotal)==null?void 0:o.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},J=({translations:e,loading:a,storeConfig:t,order:n,withHeader:l=!0})=>{var h,d,S,O,w,L;if(a||!n)return c(z,{});const r=((h=n==null?void 0:n.totalGiftcard)==null?void 0:h.value)??0,o=((d=n.totalGiftcard)==null?void 0:d.currency)??"",u=((S=n.subtotal)==null?void 0:S.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(D,{variant:"secondary",className:H(["order-cost-summary-content"]),children:[l?c(k,{title:e.headerText}):null,i("div",{className:"order-cost-summary-content__wrapper",children:[c(W,{translations:e,order:n,subTotalValue:u,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(q,{translations:e,order:n,totalShipping:m,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(F,{translations:e,order:n,totalGiftcardValue:r,totalGiftcardCurrency:o}),c(U,{order:n}),c(R,{order:n,translations:e,renderTaxAccordion:s,totalAccordionTaxValue:y}),c(G,{translations:e,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})},rt=({withHeader:e,orderData:a,children:t,className:n,...l})=>{const{loading:r,storeConfig:o,order:u}=P({orderData:a}),m=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(J,{order:u,withHeader:e,loading:r,storeConfig:o,translations:m})})};export{rt as OrderCostSummary,rt as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderProductList.js b/scripts/__dropins__/storefront-order/containers/OrderProductList.js index 078de1698c..089ce23fb5 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderProductList.js +++ b/scripts/__dropins__/storefront-order/containers/OrderProductList.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{jsx as i,jsxs as S}from"@dropins/tools/preact-jsx-runtime.js";import{Card as T,Header as N}from"@dropins/tools/components.js";import{C as b}from"../chunks/OrderCancel.js";import{classes as k}from"@dropins/tools/lib.js";import{useState as O,useEffect as P,useMemo as v}from"@dropins/tools/preact-hooks.js";import{events as G}from"@dropins/tools/event-bus.js";import{s as j}from"../chunks/setTaxStatus.js";import{g as q}from"../chunks/getStoreConfig.js";import{Fragment as w}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as x}from"../chunks/returnOrdersHelper.js";import{O as E}from"../chunks/OrderLoaders.js";import{useText as F}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const _=({orderData:l})=>{const[a,t]=O(!0),[u,c]=O(l),[m,d]=O({taxIncluded:!1,taxExcluded:!1});return P(()=>{q().then(e=>{if(e){const r=j(e==null?void 0:e.shoppingCartDisplayPrice);d(r)}}).finally(()=>{t(!1)})},[]),P(()=>{const e=G.on("order/data",r=>{c(r)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:a,taxConfig:m,order:u}},$=({loading:l,taxConfig:a,order:t=null,withHeader:u=!0,showConfigurableOptions:c,routeProductDetails:m})=>{const d=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,r=F({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),C=v(()=>{var f,p;if(!t)return[];if(!d){const s=((f=x(t))==null?void 0:f.modifyOrder)??[],y=((p=x(t))==null?void 0:p.returnedList)??[],h=s==null?void 0:s.filter(o=>o.quantityCanceled),I=s==null?void 0:s.filter(o=>!o.quantityCanceled);return[{type:"returned",list:y,title:r.returned},{type:"cancelled",list:h,title:r.cancelled},{type:"allItems",list:I,title:r.allOrders}].filter(o=>{var L;return((L=o==null?void 0:o.list)==null?void 0:L.length)>0})}const n=t.returns.find(s=>s.returnNumber===e);return[{type:"returned",list:(n==null?void 0:n.items)??[],title:r.returned}]},[t,d,r,e]);return t?C.every(n=>n.list.length===0)?null:i(T,{variant:"secondary",className:"order-order-product-list-content",children:C.map((n,g)=>{var f;return S(w,{children:[u?i(N,{title:`${n.title} (${n.list.length})`}):null,i("ul",{className:"order-order-product-list-content__items",children:(f=n.list)==null?void 0:f.map(p=>i("li",{"data-testid":"order-product-list-content-item",children:i(b,{loading:l,product:p,itemType:n.type,taxConfig:a,translations:r,showConfigurableOptions:c,routeProductDetails:m})},p.id))})]},g)})}):i(E,{})},tt=({className:l,orderData:a,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})=>{const{loading:m,taxConfig:d,order:e}=_({orderData:a});return i("div",{className:k(["order-order-product-list",l]),children:i($,{loading:m,taxConfig:d,order:e,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})})};export{tt as OrderProductList,tt as default}; +import{jsx as i,jsxs as T}from"@dropins/tools/preact-jsx-runtime.js";import{Card as S,Header as N}from"@dropins/tools/components.js";import{C as b}from"../chunks/OrderCancel.js";import{classes as k}from"@dropins/tools/lib.js";import{useState as C,useEffect as x,useMemo as v}from"@dropins/tools/preact-hooks.js";import{events as G}from"@dropins/tools/event-bus.js";import{s as j}from"../chunks/setTaxStatus.js";import{g as q}from"../chunks/getStoreConfig.js";import{Fragment as w}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as y}from"../chunks/returnOrdersHelper.js";import{O as E}from"../chunks/OrderLoaders.js";import{useText as F}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const _=({orderData:l})=>{const[a,t]=C(!0),[u,c]=C(l),[m,d]=C({taxIncluded:!1,taxExcluded:!1});return x(()=>{q().then(e=>{if(e){const n=j(e==null?void 0:e.shoppingCartDisplayPrice);d(n)}}).finally(()=>{t(!1)})},[]),x(()=>{const e=G.on("order/data",n=>{c(n)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:a,taxConfig:m,order:u}},$=({loading:l,taxConfig:a,order:t=null,withHeader:u=!0,showConfigurableOptions:c,routeProductDetails:m})=>{const d=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,n=F({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),g=v(()=>{var p,f;if(!t)return[];if(!d){const r=((p=y(t))==null?void 0:p.modifyOrder)??[],O=((f=y(t))==null?void 0:f.returnedList)??[],h=r==null?void 0:r.filter(o=>o.quantityCanceled),I=r==null?void 0:r.filter(o=>!o.quantityCanceled);return[{type:"returned",list:O,title:n.returned},{type:"cancelled",list:h,title:n.cancelled},{type:"allItems",list:I,title:n.allOrders}].filter(o=>{var P;return((P=o==null?void 0:o.list)==null?void 0:P.length)>0})}const s=t.returns.find(r=>r.returnNumber===e);return[{type:"returned",list:(s==null?void 0:s.items)??[],title:n.returned}]},[t,d,n,e]);return t?g.every(s=>s.list.length===0)?null:i(S,{variant:"secondary",className:"order-order-product-list-content",children:g.map((s,L)=>{var f;const p=s.list.reduce((r,{totalQuantity:O})=>O+r,0);return T(w,{children:[u?i(N,{title:`${s.title} (${p})`}):null,i("ul",{className:"order-order-product-list-content__items",children:(f=s.list)==null?void 0:f.map(r=>i("li",{"data-testid":"order-product-list-content-item",children:i(b,{loading:l,product:r,itemType:s.type,taxConfig:a,translations:n,showConfigurableOptions:c,routeProductDetails:m})},r.id))})]},L)})}):i(E,{})},tt=({className:l,orderData:a,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})=>{const{loading:m,taxConfig:d,order:e}=_({orderData:a});return i("div",{className:k(["order-order-product-list",l]),children:i($,{loading:m,taxConfig:d,order:e,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})})};export{tt as OrderProductList,tt as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderReturns.js b/scripts/__dropins__/storefront-order/containers/OrderReturns.js index 4814fc287f..4a0d608f37 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderReturns.js +++ b/scripts/__dropins__/storefront-order/containers/OrderReturns.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as c}from"@dropins/tools/lib.js";import{useState as d,useEffect as R}from"@dropins/tools/preact-hooks.js";import{events as L}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as O}from"../chunks/useIsMobile.js";import"@dropins/tools/preact-compat.js";import{R as b}from"../chunks/ReturnsListContent.js";import{useText as g}from"@dropins/tools/i18n.js";import"../chunks/returnOrdersHelper.js";import"../chunks/form.types.js";import"../chunks/OrderLoaders.js";const w=({orderData:s})=>{const[i,n]=d(s),[u,o]=d([]);return R(()=>{const t=L.on("order/data",e=>{n(e),o(e==null?void 0:e.returns)},{eager:!0});return()=>{t==null||t.off()}},[]),{order:i,orderReturns:u}},v=({slots:s,className:i,orderData:n,withHeader:u,withThumbnails:o,routeReturnDetails:t,routeProductDetails:e,routeTracking:f})=>{const{orderReturns:m}=w({orderData:n}),l=O(),r="fullSizeView",p=g({minifiedViewTitle:`Order.Returns.${r}.returnsList.minifiedViewTitle`,ariaLabelLink:`Order.Returns.${r}.returnsList.ariaLabelLink`,emptyOrdersListMessage:`Order.Returns.${r}.returnsList.emptyOrdersListMessage`,orderNumber:`Order.Returns.${r}.returnsList.orderNumber`,returnNumber:`Order.Returns.${r}.returnsList.returnNumber`,carrier:`Order.Returns.${r}.returnsList.carrier`});return a("div",{className:c(["order-order-returns",i]),children:m.length?a(b,{pageInfo:{pageSize:1,totalPages:1,currentPage:1},minifiedViewKey:r,slots:s,isMobile:l,withOrderNumber:!1,withReturnNumber:!0,orderReturns:m,translations:p,withHeader:u,withThumbnails:o,minifiedView:!1,routeReturnDetails:t,routeProductDetails:e,routeTracking:f,loading:!1}):null})};export{v as OrderReturns,v as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderSearch.js b/scripts/__dropins__/storefront-order/containers/OrderSearch.js index a78fe86b4b..881810ccc6 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderSearch.js +++ b/scripts/__dropins__/storefront-order/containers/OrderSearch.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{jsxs as V,jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L}from"@dropins/tools/lib.js";import{Card as M,InLineAlert as k,Icon as C,Button as q}from"@dropins/tools/components.js";import{F as D}from"../chunks/OrderCancel.js";import{useState as v,useCallback as w,useEffect as F,useMemo as U}from"@dropins/tools/preact-hooks.js";import{events as _}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import*as N from"@dropins/tools/preact-compat.js";import{Text as g,useText as H}from"@dropins/tools/i18n.js";import{F as T}from"../chunks/form.types.js";import{g as B}from"../chunks/getFormValues.js";import{r as f}from"../chunks/redirectTo.js";import{g as E,a as z}from"../chunks/getCustomer.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getGuestOrder.graphql.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";const P=t=>N.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},N.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),X=({onSubmit:t,loading:r,inLineAlert:a,fieldsConfig:o})=>V(M,{variant:"secondary",className:"order-order-search-form",children:[s("h2",{className:"order-order-search-form__title",children:s(g,{id:"Order.OrderSearchForm.title"})}),s("p",{children:s(g,{id:"Order.OrderSearchForm.description"})}),a.text?s(k,{"data-testid":"orderAlert",className:"order-order-search-form__alert",type:a.type,variant:"secondary",heading:a.text,icon:s(C,{source:P})}):null,s(D,{className:"order-order-search-form__wrapper",name:"orderSearchForm",loading:r,fieldsConfig:o,onSubmit:t,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:r,children:s(g,{id:"Order.OrderSearchForm.button"})},"logIn")})})]}),x=t=>{try{return new URL(window.location.href).searchParams.get(t)}catch{return null}},Z=({onError:t,isAuth:r,renderSignIn:a,routeCustomerOrder:o,routeGuestOrder:c})=>{const[y,u]=v({text:"",type:"success"}),[b,p]=v(!1),m=H({invalidSearch:"Order.Errors.invalidSearch",email:"Order.OrderSearchForm.email",postcode:"Order.OrderSearchForm.postcode",number:"Order.OrderSearchForm.orderNumber"}),R=w(async e=>{const i=x("orderRef"),l=i&&i.length>20;if(!e&&!i||!(e!=null&&e.number)&&!(e!=null&&e.token)&&!i)return null;if(r){const d=await E();(d==null?void 0:d.email)===e.email?f(o,{orderRef:e==null?void 0:e.number}):l||f(c,{orderRef:e.token})}else l||f(c,{orderRef:e==null?void 0:e.token})},[r,o,c]);F(()=>{const e=_.on("order/data",i=>{R(i)},{eager:!0});return()=>{e==null||e.off()}},[R]),F(()=>{const e=x("orderRef"),i=e&&e.length>20?e:null;e&&(i?f(c,{orderRef:e}):r?f(o,{orderRef:e}):a==null||a({render:!0,formValues:{number:e}}))},[r,o,c,a]);const O=U(()=>[{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.email,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.postcode,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:2,name:"postcode",id:"postcode",code:"postcode"},{entityType:"CUSTOMER_ADDRESS",is_unique:!1,label:m.number,options:[],defaultValue:"",fieldType:T.TEXT,className:"",required:!0,orderNumber:3,name:"number",id:"number",code:"number"}],[m]);return{onSubmit:w(async(e,i)=>{if(!i)return null;p(!0);const l=B(e.target);await z(l).then(n=>{n||u({text:m.invalidSearch,type:"warning"}),_.emit("order/data",n)}).catch(async n=>{var S;let d=!0;t==null||t({error:n.message});const h=r?await E():{email:""};(h==null?void 0:h.email)===(l==null?void 0:l.email)?f(o,{orderRef:l.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:l}),d&&u({text:n.message,type:"warning"})}).finally(()=>{p(!1)})},[r,t,a,o,m.invalidSearch]),inLineAlert:y,loading:b,normalizeFieldsConfig:O}},ce=({className:t,isAuth:r,renderSignIn:a,routeCustomerOrder:o,routeGuestOrder:c,onError:y})=>{const{onSubmit:u,loading:b,inLineAlert:p,normalizeFieldsConfig:m}=Z({onError:y,isAuth:r,renderSignIn:a,routeCustomerOrder:o,routeGuestOrder:c});return s("div",{className:L(["order-order-search",t]),children:s(X,{onSubmit:u,loading:b,inLineAlert:p,fieldsConfig:m})})};export{ce as OrderSearch,ce as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderStatus.js b/scripts/__dropins__/storefront-order/containers/OrderStatus.js index 73e1279563..ea10468291 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderStatus.js +++ b/scripts/__dropins__/storefront-order/containers/OrderStatus.js @@ -1,6 +1,4 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{jsx as c,jsxs as N,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{Card as U,Header as F,Button as E,InLineAlert as P,Modal as K}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{f as k}from"../chunks/returnOrdersHelper.js";import{classes as y,Slot as G}from"@dropins/tools/lib.js";import{f as b}from"../chunks/formatDateToLocale.js";import{useState as O,useEffect as I,useCallback as V}from"@dropins/tools/preact-hooks.js";import{events as v}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{useMemo as q,useState as H}from"@dropins/tools/preact-compat.js";import{r as x}from"../chunks/redirectTo.js";import{O as W}from"../chunks/OrderCancelForm.js";import{useText as C,Text as L}from"@dropins/tools/i18n.js";import{r as j}from"../chunks/reorderItems.js";import{C as J}from"../chunks/OrderLoaders.js";import{G as z}from"../chunks/getGuestOrder.graphql.js";import{f as B,h as Q}from"../chunks/fetch-graphql.js";import{b as X}from"../chunks/transform-order-details.js";import{g as Y}from"../chunks/getStoreConfig.js";import"../chunks/form.types.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";var _=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(_||{});const w={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested"},Z=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:i,onError:s,routeOnSuccess:d})=>{var M;const l=!!(e!=null&&e.returnNumber),a=String(n).toLocaleLowerCase(),o=(M=e==null?void 0:e.returns)==null?void 0:M[0],m=(o==null?void 0:o.returnStatus)??"",p=(o==null?void 0:o.createdReturnAt)??"",g=C(`Order.OrderStatusContent.${w[a]}.title`),h=C(`Order.OrderStatusContent.${w[a]}.message`),R=C(`Order.OrderStatusContent.${w[a]}.messageWithoutDate`),u=C({title:`Order.OrderStatusContent.returnStatus.${k(m)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return c("div",{});const f=e!=null&&e.orderStatusChangeDate?h==null?void 0:h.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):R.messageWithoutDate,A=(u==null?void 0:u.returnMessage.replace("{ORDER_CREATE_DATE}",b(e==null?void 0:e.orderDate)).replace("{RETURN_CREATE_DATE}",b(p)))??"",T=l?t??u.title:t??g.title;return N(U,{className:"order-order-status-content",variant:"secondary",children:[c(F,{title:T}),N("div",{className:"order-order-status-content__wrapper",children:[c("div",{className:y(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:c("p",{children:l?A:f})}),c(ee,{orderData:e,slots:r,routeCreateReturn:i,routeOnSuccess:d,onError:s})]})]})},D=({orderData:r})=>{const[t,n]=O(r),[e,i]=O(r==null?void 0:r.status);return I(()=>{const s=v.on("order/data",d=>{n(d),i(d.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},ee=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:i,onError:s})=>{const d=C({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=q(()=>{const a=t==null?void 0:t.availableActions,o=!!(a!=null&&a.length),m=!!(t!=null&&t.returnNumber),p=()=>{x(e,{},t)};return c(S,{children:n!=null&&n.OrderActions?c(G,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):c("div",{"data-testid":"availableActionsList",className:y(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!o]]),children:a==null?void 0:a.map(g=>{switch(g){case _.CANCEL:return c(S,{children:m?null:!!t&&c(se,{orderRef:t.token??atob(t.id)})});case _.RETURN:return c(E,{variant:"secondary",onClick:p,children:m?d.createAnotherReturn:d.createReturn});case _.REORDER:return c(S,{children:m?null:c(oe,{orderData:t,onError:s,routeOnSuccess:i,children:d.reorder})})}})})})},[s,t,i,e,n,d]);return c("div",{className:y(["order-order-actions",r]),children:l})},$=()=>{const[r,t]=O(null);return I(()=>{const n=sessionStorage.getItem("orderStoreConfig"),e=n?JSON.parse(n):null;e?t(e):Y().then(i=>{i&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(i)),t(i))})},[]),r},re=` +import{jsx as c,jsxs as N,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{Card as U,Header as F,Button as E,InLineAlert as P,Modal as K}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{f as k}from"../chunks/returnOrdersHelper.js";import{classes as y,Slot as G}from"@dropins/tools/lib.js";import{f as b}from"../chunks/formatDateToLocale.js";import{useState as O,useEffect as I,useCallback as V}from"@dropins/tools/preact-hooks.js";import{events as v}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{useMemo as q,useState as H}from"@dropins/tools/preact-compat.js";import{r as x}from"../chunks/redirectTo.js";import{O as W}from"../chunks/OrderCancelForm.js";import{useText as C,Text as L}from"@dropins/tools/i18n.js";import{r as j}from"../chunks/reorderItems.js";import{C as J}from"../chunks/OrderLoaders.js";import{G as z}from"../chunks/getGuestOrder.graphql.js";import{f as B,h as Q}from"../chunks/fetch-graphql.js";import{b as X}from"../chunks/transform-order-details.js";import{g as Y}from"../chunks/getStoreConfig.js";import"../chunks/form.types.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";var _=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(_||{});const w={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested"},Z=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:i,onError:s,routeOnSuccess:d})=>{var M;const l=!!(e!=null&&e.returnNumber),a=String(n).toLocaleLowerCase(),o=(M=e==null?void 0:e.returns)==null?void 0:M[0],m=(o==null?void 0:o.returnStatus)??"",p=(o==null?void 0:o.createdReturnAt)??"",g=C(`Order.OrderStatusContent.${w[a]}.title`),h=C(`Order.OrderStatusContent.${w[a]}.message`),R=C(`Order.OrderStatusContent.${w[a]}.messageWithoutDate`),u=C({title:`Order.OrderStatusContent.resturnStatus.${k(m)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return c("div",{});const f=e!=null&&e.orderStatusChangeDate?h==null?void 0:h.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):R.messageWithoutDate,A=(u==null?void 0:u.returnMessage.replace("{ORDER_CREATE_DATE}",b(e==null?void 0:e.orderDate)).replace("{RETURN_CREATE_DATE}",b(p)))??"",T=l?t??u.title:t??g.title;return N(U,{className:"order-order-status-content",variant:"secondary",children:[c(F,{title:T}),N("div",{className:"order-order-status-content__wrapper",children:[c("div",{className:y(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:c("p",{children:l?A:f})}),c(ee,{orderData:e,slots:r,routeCreateReturn:i,routeOnSuccess:d,onError:s})]})]})},D=({orderData:r})=>{const[t,n]=O(r),[e,i]=O(r==null?void 0:r.status);return I(()=>{const s=v.on("order/data",d=>{n(d),i(d.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},ee=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:i,onError:s})=>{const d=C({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=q(()=>{const a=t==null?void 0:t.availableActions,o=!!(a!=null&&a.length),m=!!(t!=null&&t.returnNumber),p=()=>{x(e,{},t)};return c(S,{children:n!=null&&n.OrderActions?c(G,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):c("div",{"data-testid":"availableActionsList",className:y(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!o]]),children:a==null?void 0:a.map(g=>{switch(g){case _.CANCEL:return c(S,{children:m?null:!!t&&c(se,{orderRef:t.token??atob(t.id)})});case _.RETURN:return c(E,{variant:"secondary",onClick:p,children:m?d.createAnotherReturn:d.createReturn});case _.REORDER:return c(S,{children:m?null:c(oe,{orderData:t,onError:s,routeOnSuccess:i,children:d.reorder})})}})})})},[s,t,i,e,n,d]);return c("div",{className:y(["order-order-actions",r]),children:l})},$=()=>{const[r,t]=O(null);return I(()=>{const n=sessionStorage.getItem("orderStoreConfig"),e=n?JSON.parse(n):null;e?t(e):Y().then(i=>{i&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(i)),t(i))})},[]),r},re=` mutation CONFIRM_CANCEL_ORDER_MUTATION( $orderId: ID!, $confirmationKey: String! diff --git a/scripts/__dropins__/storefront-order/containers/ReturnsList.js b/scripts/__dropins__/storefront-order/containers/ReturnsList.js index 6c279b51b4..3cba825243 100644 --- a/scripts/__dropins__/storefront-order/containers/ReturnsList.js +++ b/scripts/__dropins__/storefront-order/containers/ReturnsList.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ import{jsx as c}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as S}from"@dropins/tools/lib.js";import{useState as i,useEffect as $,useCallback as h}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as I}from"../chunks/getCustomerOrdersReturn.js";import"@dropins/tools/preact.js";import{u as y}from"../chunks/useIsMobile.js";import"@dropins/tools/preact-compat.js";import{R as A}from"../chunks/ReturnsListContent.js";import{useText as M}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";import"../chunks/returnOrdersHelper.js";import"../chunks/form.types.js";import"../chunks/OrderLoaders.js";const f={totalPages:1,currentPage:1,pageSize:1},T=()=>{const[s,n]=i(!0),[o,t]=i([]),[u,a]=i(f),[m,d]=i(1);$(()=>{I().then(r=>{t((r==null?void 0:r.ordersReturn)??[]),a((r==null?void 0:r.pageInfo)??f)}).finally(()=>{n(!1)})},[]);const l=h(r=>{d(r)},[]);return{pageInfo:u,selectedPage:m,loading:s,orderReturns:o,handleSetSelectPage:l}},X=({slots:s,withReturnsListButton:n,className:o,minifiedView:t,withHeader:u,withThumbnails:a,returnsInMinifiedView:m,routeReturnDetails:d,routeOrderDetails:l,routeTracking:r,routeReturnsList:g,routeProductDetails:p})=>{const{pageInfo:L,selectedPage:R,handleSetSelectPage:O,loading:b,orderReturns:P}=T(),w=y(),e=t?"minifiedView":"fullSizeView",N=M({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 c("div",{className:S(["order-returns-list",o]),children:c(A,{minifiedViewKey:e,withOrderNumber:!0,withReturnNumber:!0,slots:s,selectedPage:R,handleSetSelectPage:O,pageInfo:L,withReturnsListButton:n,isMobile:w,orderReturns:P,translations:N,withHeader:u,returnsInMinifiedView:m,withThumbnails:a,minifiedView:t,routeReturnDetails:d,routeOrderDetails:l,routeTracking:r,routeReturnsList:g,routeProductDetails:p,loading:b})})};export{X as default}; diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index a1ac97db38..f3860d79fe 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1,3 +1 @@ -/*! Copyright 2024 Adobe -All Rights Reserved. */ -import{jsxs as u,jsx as n,Fragment as b}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as o}from"@dropins/tools/lib.js";import{Card as v,Header as _,Accordion as A,AccordionSection as x,ContentGrid as E,Image as $}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as y,useEffect as J}from"@dropins/tools/preact-hooks.js";import{events as K}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Q}from"../chunks/useIsMobile.js";import{Text as R,useText as X}from"@dropins/tools/i18n.js";import{C as Z}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var G=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(G||{});const Y=({orderData:e})=>{const[h,i]=y(!0),[c,d]=y(e),[m,f]=y(!1);return J(()=>{const a=K.on("order/data",g=>{d(g),f(g==null?void 0:g.isVirtual),i(!1)},{eager:!0});return()=>{a==null||a.off()}},[]),{loading:h,order:c,isVirtualProduct:m}},P=({slots:e,collapseThreshold:h,translations:i,returnData:c,routeTracking:d,routeProductDetails:m})=>{var g;const f=Q(),a=m?"a":"span";return u(v,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(_,{title:i.returnOrderCardTitle}),u("div",{children:[(g=c==null?void 0:c.tracking)==null?void 0:g.map((l,C)=>{var S,p;return u("p",{children:[`${i.carrier} ${(p=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:p.toLocaleUpperCase()}: `,n("a",{href:`${(d==null?void 0:d(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${C}`)}),e!=null&&e.ReturnItemsDetails?n(o,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:c.items}}):null,n(A,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{defaultOpen:h>=c.items.length,title:n(R,{id:"Order.ShippingStatusCard.itemText",plural:c.items.length,fields:{count:c.items.length}}),children:n(E,{maxColumns:f?3:9,emptyGridContent:n(b,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",f]]),children:c.items.map((l,C)=>{var I,T;const S=(I=l.thumbnail)==null?void 0:I.label,p=(T=l.thumbnail)==null?void 0:T.url;return n(a,{href:(m==null?void 0:m(l))??"#","data-testid":`${C}${l.uid}`,children:n($,{alt:S,src:p,width:85,height:114})},`${C}${l.uid}`)})})})})]})]})},k=({translations:e,slots:h,orderData:i,collapseThreshold:c=10,routeProductDetails:d,routeTracking:m})=>{var I,T,w,M,V;const f=!!(i!=null&&i.returnNumber),a=i==null?void 0:i.returnNumber,g=d?"a":"span",l=(I=i==null?void 0:i.status)==null?void 0:I.toLocaleLowerCase(),S=((T=i==null?void 0:i.shipments)==null?void 0:T.length)===1&&(l==null?void 0:l.includes(G.COMPLETE)),p=(w=i==null?void 0:i.items)==null?void 0:w.filter(t=>(t==null?void 0:t.quantityShipped)===0);if(f&&(i!=null&&i.returns.length)){const t=i.returns.find(s=>s.returnNumber===a);return!t||t.tracking.length===0?null:n(P,{slots:h,collapseThreshold:c,translations:e,returnData:t,routeTracking:m,routeProductDetails:d})}return!i||l!=null&&l.includes(G.CANCELED)?null:(M=i==null?void 0:i.shipments)!=null&&M.length?u(b,{children:[(V=i==null?void 0:i.shipments)==null?void 0:V.map(({tracking:t,items:s,id:O},z)=>u(v,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingCardTitle}),t==null?void 0:t.map(r=>{var N;return u("div",{className:"order-shipping-status-card__header",role:"status",children:[u("div",{className:"order-shipping-status-card__header--content",children:[u("p",{children:[e.carrier," ",(N=r==null?void 0:r.carrier)==null?void 0:N.toLocaleUpperCase()," | ",r==null?void 0:r.number]}),n("p",{children:r==null?void 0:r.title})]}),h!=null&&h.DeliveryTrackActions?n(o,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:h==null?void 0:h.DeliveryTrackActions,context:{trackInformation:r}}):null]},r.number)}),S?null:n(A,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{"data-position":z+1,defaultOpen:c>=(s==null?void 0:s.length),title:n(b,{children:n(R,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:s==null?void 0:s.length,fields:{count:s==null?void 0:s.length}})}),children:n(E,{maxColumns:6,emptyGridContent:n(b,{}),className:"order-shipping-status-card__images",children:s==null?void 0:s.map(r=>{var U,H,j,F,q,W;const N=(j=(H=(U=r==null?void 0:r.orderItem)==null?void 0:U.product)==null?void 0:H.thumbnail)==null?void 0:j.label,B=(W=(q=(F=r==null?void 0:r.orderItem)==null?void 0:F.product)==null?void 0:q.thumbnail)==null?void 0:W.url;return n(g,{href:(d==null?void 0:d(r))??"#",children:n($,{alt:N,src:B||"",width:85,height:114})},r.id)})})})}),h!=null&&h.DeliveryTimeLine?n(o,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:h==null?void 0:h.DeliveryTimeLine,context:{}}):null]},O)),p!=null&&p.length?u(v,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(_,{title:e.notYetShippedTitle}),n(A,{actionIconPosition:"right",children:n(x,{defaultOpen:c>=(p==null?void 0:p.length),title:n(R,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:p==null?void 0:p.length,fields:{count:p==null?void 0:p.length}}),children:n(E,{maxColumns:6,emptyGridContent:n(b,{}),className:"order-shipping-status-card__images",children:p==null?void 0:p.map(t=>{var s,O;return n(g,{href:(d==null?void 0:d(t))??"#",children:n($,{alt:(s=t.thumbnail)==null?void 0:s.label,src:((O=t.thumbnail)==null?void 0:O.url)||"",width:85,height:114})},t.id)})})})})]}):null]}):u(v,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:u("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ti=({slots:e,className:h,collapseThreshold:i,orderData:c,routeOrderDetails:d,routeTracking:m,routeProductDetails:f})=>{const{loading:a,order:g,isVirtualProduct:l}=Y({orderData:c}),C=X({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"});return!a&&l?null:n("div",{className:L(["order-shipping-status",h]),children:!a&&g?n(k,{translations:C,routeOrderDetails:d,routeTracking:m,slots:e,orderData:g,collapseThreshold:i,routeProductDetails:f}):n(Z,{withCard:!1})})};export{ti as ShippingStatus,ti as default}; +import{jsxs as u,jsx as n,Fragment as v}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as N,Header as _,Accordion as o,AccordionSection as x,ContentGrid as W,Image as E}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as y,useEffect as J}from"@dropins/tools/preact-hooks.js";import{events as K}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Q}from"../chunks/useIsMobile.js";import{Text as $,useText as X}from"@dropins/tools/i18n.js";import{C as Z}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var R=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(R||{});const Y=({orderData:e})=>{const[r,i]=y(!0),[c,d]=y(e),[m,f]=y(!1);return J(()=>{const a=K.on("order/data",g=>{d(g),f(g==null?void 0:g.isVirtual),i(!1)},{eager:!0});return()=>{a==null||a.off()}},[]),{loading:r,order:c,isVirtualProduct:m}},P=({slots:e,collapseThreshold:r,translations:i,returnData:c,routeTracking:d,routeProductDetails:m})=>{var g;const f=Q(),a=m?"a":"span";return u(N,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(_,{title:i.returnOrderCardTitle}),u("div",{children:[(g=c==null?void 0:c.tracking)==null?void 0:g.map((l,C)=>{var S,p;return u("p",{children:[`${i.carrier} ${(p=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:p.toLocaleUpperCase()}: `,n("a",{href:`${(d==null?void 0:d(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${C}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:c.items}}):null,n(o,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{defaultOpen:r>=c.items.length,title:n($,{id:"Order.ShippingStatusCard.itemText",plural:c.items.length,fields:{count:c.items.length}}),children:n(W,{maxColumns:f?3:9,emptyGridContent:n(v,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",f]]),children:c.items.map((l,C)=>{var I,T;const S=(I=l.thumbnail)==null?void 0:I.label,p=(T=l.thumbnail)==null?void 0:T.url;return n(a,{href:(m==null?void 0:m(l))??"#","data-testid":`${C}${l.uid}`,children:n(E,{alt:S,src:p,width:85,height:114})},`${C}${l.uid}`)})})})})]})]})},k=({translations:e,slots:r,orderData:i,collapseThreshold:c=10,routeProductDetails:d,routeTracking:m})=>{var I,T,w,G,M;const f=!!(i!=null&&i.returnNumber),a=i==null?void 0:i.returnNumber,g=d?"a":"span",l=(I=i==null?void 0:i.status)==null?void 0:I.toLocaleLowerCase(),S=((T=i==null?void 0:i.shipments)==null?void 0:T.length)===1&&(l==null?void 0:l.includes(R.COMPLETE)),p=(w=i==null?void 0:i.items)==null?void 0:w.filter(t=>(t==null?void 0:t.quantityShipped)===0);if(f&&(i!=null&&i.returns.length)){const t=i.returns.find(s=>s.returnNumber===a);return!t||t.tracking.length===0?null:n(P,{slots:r,collapseThreshold:c,translations:e,returnData:t,routeTracking:m,routeProductDetails:d})}return!i||l!=null&&l.includes(R.CANCELED)?null:(G=i==null?void 0:i.shipments)!=null&&G.length?u(v,{children:[(M=i==null?void 0:i.shipments)==null?void 0:M.map(({tracking:t,items:s,id:b},z)=>u(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingCardTitle}),t==null?void 0:t.map(h=>{var O;return u("div",{className:"order-shipping-status-card__header",role:"status",children:[u("div",{className:"order-shipping-status-card__header--content",children:[u("p",{children:[e.carrier," ",(O=h==null?void 0:h.carrier)==null?void 0:O.toLocaleUpperCase()," | ",h==null?void 0:h.number]}),n("p",{children:h==null?void 0:h.title})]}),r!=null&&r.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:r==null?void 0:r.DeliveryTrackActions,context:{trackInformation:h}}):null]},h.number)}),S?null:n(o,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{"data-position":z+1,defaultOpen:c>=(s==null?void 0:s.length),title:n(v,{children:n($,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:s==null?void 0:s.length,fields:{count:s==null?void 0:s.length}})}),children:n(W,{maxColumns:6,emptyGridContent:n(v,{}),className:"order-shipping-status-card__images",children:s==null?void 0:s.map(h=>{var V,U,H,j,F,q;const O=(H=(U=(V=h==null?void 0:h.orderItem)==null?void 0:V.product)==null?void 0:U.thumbnail)==null?void 0:H.label,B=(q=(F=(j=h==null?void 0:h.orderItem)==null?void 0:j.product)==null?void 0:F.thumbnail)==null?void 0:q.url;return n(g,{href:(d==null?void 0:d(h))??"#",children:n(E,{alt:O,src:B||"",width:85,height:114})},h.id)})})})}),r!=null&&r.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:r==null?void 0:r.DeliveryTimeLine,context:{}}):null]},b)),p!=null&&p.length?u(N,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(_,{title:e.notYetShippedTitle}),n(o,{actionIconPosition:"right",children:n(x,{defaultOpen:c>=(p==null?void 0:p.length),title:n($,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:p==null?void 0:p.length,fields:{count:p==null?void 0:p.length}}),children:n("div",{className:"order-shipping-status-card__images",children:p==null?void 0:p.map(t=>{var s,b;return n(g,{href:(d==null?void 0:d(t))??"#",children:n(E,{alt:(s=t.thumbnail)==null?void 0:s.label,src:((b=t.thumbnail)==null?void 0:b.url)||"",width:85,height:114})},t.id)})})})})]}):null]}):u(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:u("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ti=({slots:e,className:r,collapseThreshold:i,orderData:c,routeOrderDetails:d,routeTracking:m,routeProductDetails:f})=>{const{loading:a,order:g,isVirtualProduct:l}=Y({orderData:c}),C=X({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"});return!a&&l?null:n("div",{className:L(["order-shipping-status",r]),children:!a&&g?n(k,{translations:C,routeOrderDetails:d,routeTracking:m,slots:e,orderData:g,collapseThreshold:i,routeProductDetails:f}):n(Z,{withCard:!1})})};export{ti as ShippingStatus,ti as default}; diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts new file mode 100644 index 0000000000..b24ed10f17 --- /dev/null +++ b/scripts/__dropins__/storefront-order/hooks/containers/useCreateReturn.d.ts @@ -0,0 +1,19 @@ +import { AttributesFormModel, OrderDataModel, OrderItemModel } from '../../data/models'; +import { StepsTypes, TaxTypes, UseCreateReturn } from '../../types'; +import { RefObject } from 'preact'; + +export declare const useCreateReturn: ({ onSuccess, onError, handleSetInLineAlert, orderData, }: UseCreateReturn) => { + order: OrderDataModel | undefined; + steps: StepsTypes; + loading: boolean; + formsRef: import('preact/hooks').MutableRef[]>; + taxConfig: TaxTypes; + attributesList: [] | AttributesFormModel[]; + selectedProductList: [] | OrderItemModel[]; + itemsEligibleForReturn: OrderItemModel[]; + handleSelectedProductList: (orderItem: OrderItemModel) => void; + handleSetQuantity: (value: number, productSku: string) => void; + handleChangeStep: (value: StepsTypes) => void; + onSubmit: (_: SubmitEvent, isValid: boolean) => Promise; +}; +//# sourceMappingURL=useCreateReturn.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts b/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts index 01104caea2..33b8e3a511 100644 --- a/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts +++ b/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts @@ -14,14 +14,14 @@ declare const _default: { "message": "Note" }, "success": { - "title": "Return submitted", - "message": "Your return request has been successfully submitted." + "title": "Success message", + "message": "Success message text goes here" }, "buttons": { "nextStep": "Continue", "backStep": "Back", "submit": "Submit return", - "backStore": "Back to order" + "backStore": "Back to store" } }, "OrderCostSummary": { @@ -65,7 +65,7 @@ declare const _default: { "one": "item", "many": "items" }, - "returnStatus": { + "resturnStatus": { "pending": "Pending", "authorized": "Authorized", "partiallyAuthorized": "Partially authorized", @@ -95,7 +95,7 @@ declare const _default: { "one": "item", "many": "items" }, - "returnStatus": { + "resturnStatus": { "pending": "Pending", "authorized": "Authorized", "partiallyAuthorized": "Partially authorized", @@ -164,7 +164,7 @@ declare const _default: { "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": { + "resturnStatus": { "pending": "Pending", "authorized": "Authorized", "partiallyAuthorized": "Partially authorized", diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload new file mode 100644 index 0000000000..6fb34b13ff --- /dev/null +++ b/scripts/__dropins__/storefront-order/reload @@ -0,0 +1 @@ +{"at":1731314830394} \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/render.js b/scripts/__dropins__/storefront-order/render.js index 6c5519ae5c..b9f51a08d7 100644 --- a/scripts/__dropins__/storefront-order/render.js +++ b/scripts/__dropins__/storefront-order/render.js @@ -1,4 +1,2 @@ -/*! 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)}})('.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" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}',{styleId:"order"}); -import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as n}from"@dropins/tools/lib.js";import{useState as s,useEffect as d}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as c}from"@dropins/tools/event-bus.js";const u={CreateReturn:{headerText:"Return items",downloadableCount:"Files",returnedItems:"Returned items:",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",postcode:"Zip Code",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},ShippingStatusCard:{orderNumber:"Order number:",returnNumber:"Return number:",itemText:{none:"",one:"Package contents ({{count}} item)",many:"Package contents ({{count}} items)"},trackButton:"Track package",carrier:"Carrier:",prepositionOf:"of",returnOrderCardTitle:"Package details",shippingCardTitle:"Package details",shippingInfoTitle:"Shipping information",notYetShippedTitle:"Not yet shipped",notYetShippedImagesTitle:{singular:"Package contents ({{count}} item)",plural:"Package contents ({{count}} items)"}},OrderStatusContent:{noInfoTitle:"Check back later for more details.",returnMessage:"The order was placed on {ORDER_CREATE_DATE} and your return process started on {RETURN_CREATE_DATE}",returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."}},p={Order:u},m={default:p},h=({children:t})=>{const[o,i]=s("en_US");return d(()=>{const e=c.on("locale",a=>{i(a)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},T=new n(r(h,{}));export{T as render}; +(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)}})('.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" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:65px;height:65px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}',{styleId:"order"}); +import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as s}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:",stockStatus:{inStock:"In stock",outOfStock:"Out of stock"},giftCard:{sender:"Sender",recipient:"Recipient",message:"Note"},success:{title:"Success message",message:"Success message text goes here"},buttons:{nextStep:"Continue",backStep:"Back",submit:"Submit return",backStore:"Back to store"}},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"},resturnStatus:{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"},resturnStatus:{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",postcode:"Zip Code",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}",resturnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."}},p={Order:u},m={default:p},h=({children:t})=>{const[o,i]=n("en_US");return d(()=>{const e=c.on("locale",a=>{i(a)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},k=new s(r(h,{}));export{k as render}; diff --git a/scripts/__dropins__/storefront-order/types/api/getAttributesList.types.d.ts b/scripts/__dropins__/storefront-order/types/api/getAttributesList.types.d.ts new file mode 100644 index 0000000000..b9285c104e --- /dev/null +++ b/scripts/__dropins__/storefront-order/types/api/getAttributesList.types.d.ts @@ -0,0 +1,28 @@ +export type AttributesListItems = { + code: string; + sort_order: string; + default_value: null | string; + frontend_class: null | string; + multiline_count: number; + entity_type: string; + frontend_input: string; + is_required: boolean; + is_unique: boolean; + label: string; + options: { + is_default: boolean; + label: string; + value: string; + }[]; +}; +export interface GetAttributesListResponse { + data: { + attributesList: { + items: AttributesListItems[]; + }; + }; + errors?: { + message: string; + }[]; +} +//# sourceMappingURL=getAttributesList.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 new file mode 100644 index 0000000000..ed9233bb5b --- /dev/null +++ b/scripts/__dropins__/storefront-order/types/api/requestReturn.types.d.ts @@ -0,0 +1,33 @@ +export interface RequestReturnProps { + orderUid: string; + contactEmail: string; + items: { + orderItemUid: string; + quantityToReturn: number; + selectedCustomAttributes?: { + attribute_code: string; + value: string; + }[]; + enteredCustomAttributes?: { + attribute_code: string; + value: string; + }[]; + }[]; +} +export interface ReturnProps { + uid: string; + number: string; + status: string; + created_at: string; +} +export interface RequestReturnResponse { + data: { + requestReturn: { + return: ReturnProps; + }; + }; + errors?: { + message: string; + }[]; +} +//# sourceMappingURL=requestReturn.types.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts b/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts index 9454fae5bb..112414f200 100644 --- a/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts @@ -56,8 +56,7 @@ export interface ReturnReasonFormProps { } export interface ReturnOrderMessageProps { translations: Record; - routeReturnSuccess?: (orderData?: OrderDataModel) => string; - orderData?: OrderDataModel; + routeReturnSuccess?: () => string; } export interface UseCreateReturn { orderData?: OrderDataModel; From c61f4d680e0214f42190ebca99ad79c554bc6aa9 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 11:42:24 +0200 Subject: [PATCH 04/30] test 2 --- .../__dropins__/storefront-order/chunks/ReturnsListContent.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index 57380bb68f..517b36a933 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1 +1 @@ -import{jsx as r,jsxs as s,Fragment as C}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as H}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as G}from"@dropins/tools/lib.js";import{IllustratedMessage as I,Icon as y,Card as k,ContentGrid as R,Image as D,Header as O,Pagination as r1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as e1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as q}from"@dropins/tools/i18n.js";const J=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"})))),t1=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"})),P=({typeList:L,isEmpty:M,minifiedView:Z,message:n})=>{const t=e1(()=>{switch(L){case"orders":return{icon:t1,text:r("p",{children:n}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,n]);return!M||!L||!t.text?null:r(I,{className:W(["order-empty-list",t.className,Z?"order-empty-list--minified":""]),message:t.text,icon:r(y,{source:t.icon}),"data-testid":"emptyList"})},Q={size:"32",stroke:"2"},M1=({minifiedViewKey:L,withReturnNumber:M=!1,withOrderNumber:Z=!1,slots:n,pageInfo:t,withReturnsListButton:E=!0,isMobile:b=!1,returnsInMinifiedView:X=1,translations:a={},orderReturns:i=[],minifiedView:h=!1,withHeader:o=!0,withThumbnails:$=!0,selectedPage:w=1,handleSetSelectPage:V,routeReturnDetails:m,routeOrderDetails:_,routeTracking:p,routeReturnsList:N,routeProductDetails:d,loading:g})=>{const A=h?X:i.length,B=d!=null&&d()?"a":"span",f=H(()=>i.slice(0,A).map((e,K)=>{var S,z;return r(k,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(q,{id:`Order.Returns.${L}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),M?s("p",{children:[a.returnNumber," ",r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,Z?s("p",{children:[a.orderNumber," ",r("a",{href:(_==null?void 0:_({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(S=e==null?void 0:e.tracking)==null?void 0:S.map((c,x)=>{var u,v;return s("p",{children:[`${a.carrier} ${(v=(u=c==null?void 0:c.carrier)==null?void 0:u.label)==null?void 0:v.toLocaleUpperCase()}: `,r("a",{href:`${(p==null?void 0:p(c))||"#"}`,target:"_blank",rel:"noreferrer",children:c.trackingNumber})]},`${c.trackingNumber}_${x}`)}),n!=null&&n.ReturnItemsDetails?r(G,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:n==null?void 0:n.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[e.items.length," ",r(q,{id:`Order.Returns.${L}.returnsList.itemText`,plural:e.items.length,fields:{count:e.items.length}})]}):null]}),$?r(R,{maxColumns:b?3:9,emptyGridContent:r(C,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",b]]),children:(z=e==null?void 0:e.items)==null?void 0:z.map((c,x)=>{var j,F;const u=(j=c.thumbnail)==null?void 0:j.label,v=(F=c.thumbnail)==null?void 0:F.url;return r(B,{href:(d==null?void 0:d(c))??"#",children:r(D,{alt:u,src:v,width:85,height:114})},x+c.uid)})}):null,n!=null&&n.DetailsActionParams?r(G,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:n==null?void 0:n.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(y,{source:J,...Q})})]})},K)}),[i,A,L,M,a,m,Z,_,n,$,b,d,p,B]),Y=H(()=>s(C,{children:[o?r(O,{title:a.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,g?r(U,{withCard:!1}):s(C,{children:[f,r(P,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:a.emptyOrdersListMessage}),E?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(k,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:a.viewAllOrdersButton}),r(y,{source:J,...Q})]})})}):null]})]}),[N,E,o,a,f,h,i.length,g]),T=H(()=>s(C,{children:[o?r(O,{title:a.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,g?r(U,{withCard:!1}):s(C,{children:[r(P,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:a.emptyOrdersListMessage}),f,(t==null?void 0:t.totalPages)>1?r(r1,{totalPages:t==null?void 0:t.totalPages,currentPage:w,onChange:V}):null]})]}),[o,f,h,i,a,t==null?void 0:t.totalPages,w,V,g,o]);return r("div",{className:"order-returns-list-content",children:h?Y:T})};export{M1 as R}; +import{jsx as r,jsxs as s,Fragment as M}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as y}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as k}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as E,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as q}from"@dropins/tools/i18n.js";const J=a=>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",...a},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"})))),L1=a=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},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"})),Q=({typeList:a,isEmpty:Z,minifiedView:_,message:t})=>{const n=t1(()=>{switch(a){case"orders":return{icon:L1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[a,t]);return!Z||!a||!n.text?null:r(R,{className:W(["order-empty-list",n.className,_?"order-empty-list--minified":""]),message:n.text,icon:r(E,{source:n.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},_1=({minifiedViewKey:a,withReturnNumber:Z=!1,withOrderNumber:_=!1,slots:t,pageInfo:n,withReturnsListButton:$=!0,isMobile:x=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:o=!0,withThumbnails:w=!0,selectedPage:V=1,handleSetSelectPage:A,routeReturnDetails:m,routeOrderDetails:p,routeTracking:N,routeReturnsList:u,routeProductDetails:d,loading:f})=>{const B=h?X:i.length,S=d!=null&&d()?"a":"span",g=y(()=>i.slice(0,B).map((e,I)=>{var z,j;const H=e.items.reduce((L,{totalQuantity:C})=>C+L,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(q,{id:`Order.Returns.${a}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),Z?s("p",{children:[c.returnNumber," ",r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(p==null?void 0:p({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(z=e==null?void 0:e.tracking)==null?void 0:z.map((L,C)=>{var v,b;return s("p",{children:[`${c.carrier} ${(b=(v=L==null?void 0:L.carrier)==null?void 0:v.label)==null?void 0:b.toLocaleUpperCase()}: `,r("a",{href:`${(N==null?void 0:N(L))||"#"}`,target:"_blank",rel:"noreferrer",children:L.trackingNumber})]},`${L.trackingNumber}_${C}`)}),t!=null&&t.ReturnItemsDetails?r(k,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[H," ",r(q,{id:`Order.Returns.${a}.returnsList.itemText`,plural:H,fields:{count:H}})]}):null]}),w?r(D,{maxColumns:x?3:9,emptyGridContent:r(M,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",x]]),children:(j=e==null?void 0:e.items)==null?void 0:j.map((L,C)=>{var F,G;const v=(F=L.thumbnail)==null?void 0:F.label,b=(G=L.thumbnail)==null?void 0:G.url;return r(S,{href:(d==null?void 0:d(L))??"#",children:r(r1,{alt:v,src:b,width:85,height:114})},C+L.uid)})}):null,t!=null&&t.DetailsActionParams?r(k,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:t==null?void 0:t.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(E,{source:J,...T})})]})},I)}),[i,B,a,Z,c,m,_,p,t,w,x,d,N,S]),Y=y(()=>s(M,{children:[o?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,f?r(U,{withCard:!1}):s(M,{children:[g,r(Q,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(u==null?void 0:u())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(E,{source:J,...T})]})})}):null]})]}),[u,$,o,c,g,h,i.length,f]),K=y(()=>s(M,{children:[o?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,f?r(U,{withCard:!1}):s(M,{children:[r(Q,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),g,(n==null?void 0:n.totalPages)>1?r(e1,{totalPages:n==null?void 0:n.totalPages,currentPage:V,onChange:A}):null]})]}),[o,g,h,i,c,n==null?void 0:n.totalPages,V,A,f,o]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{_1 as R}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 6fb34b13ff..40c55f6670 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731314830394} \ No newline at end of file +{"at":1731318109181} \ No newline at end of file From 4c921880613468ee8545babc0429336ce6998e5d Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 12:02:30 +0200 Subject: [PATCH 05/30] test 3 --- .../__dropins__/storefront-order/chunks/ReturnsListContent.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index 517b36a933..12b0e2d13f 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1 +1 @@ -import{jsx as r,jsxs as s,Fragment as M}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as y}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as k}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as E,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as q}from"@dropins/tools/i18n.js";const J=a=>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",...a},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"})))),L1=a=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},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"})),Q=({typeList:a,isEmpty:Z,minifiedView:_,message:t})=>{const n=t1(()=>{switch(a){case"orders":return{icon:L1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[a,t]);return!Z||!a||!n.text?null:r(R,{className:W(["order-empty-list",n.className,_?"order-empty-list--minified":""]),message:n.text,icon:r(E,{source:n.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},_1=({minifiedViewKey:a,withReturnNumber:Z=!1,withOrderNumber:_=!1,slots:t,pageInfo:n,withReturnsListButton:$=!0,isMobile:x=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:o=!0,withThumbnails:w=!0,selectedPage:V=1,handleSetSelectPage:A,routeReturnDetails:m,routeOrderDetails:p,routeTracking:N,routeReturnsList:u,routeProductDetails:d,loading:f})=>{const B=h?X:i.length,S=d!=null&&d()?"a":"span",g=y(()=>i.slice(0,B).map((e,I)=>{var z,j;const H=e.items.reduce((L,{totalQuantity:C})=>C+L,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(q,{id:`Order.Returns.${a}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),Z?s("p",{children:[c.returnNumber," ",r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(p==null?void 0:p({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(z=e==null?void 0:e.tracking)==null?void 0:z.map((L,C)=>{var v,b;return s("p",{children:[`${c.carrier} ${(b=(v=L==null?void 0:L.carrier)==null?void 0:v.label)==null?void 0:b.toLocaleUpperCase()}: `,r("a",{href:`${(N==null?void 0:N(L))||"#"}`,target:"_blank",rel:"noreferrer",children:L.trackingNumber})]},`${L.trackingNumber}_${C}`)}),t!=null&&t.ReturnItemsDetails?r(k,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[H," ",r(q,{id:`Order.Returns.${a}.returnsList.itemText`,plural:H,fields:{count:H}})]}):null]}),w?r(D,{maxColumns:x?3:9,emptyGridContent:r(M,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",x]]),children:(j=e==null?void 0:e.items)==null?void 0:j.map((L,C)=>{var F,G;const v=(F=L.thumbnail)==null?void 0:F.label,b=(G=L.thumbnail)==null?void 0:G.url;return r(S,{href:(d==null?void 0:d(L))??"#",children:r(r1,{alt:v,src:b,width:85,height:114})},C+L.uid)})}):null,t!=null&&t.DetailsActionParams?r(k,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:t==null?void 0:t.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(m==null?void 0:m({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(E,{source:J,...T})})]})},I)}),[i,B,a,Z,c,m,_,p,t,w,x,d,N,S]),Y=y(()=>s(M,{children:[o?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,f?r(U,{withCard:!1}):s(M,{children:[g,r(Q,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(u==null?void 0:u())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(E,{source:J,...T})]})})}):null]})]}),[u,$,o,c,g,h,i.length,f]),K=y(()=>s(M,{children:[o?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,f?r(U,{withCard:!1}):s(M,{children:[r(Q,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),g,(n==null?void 0:n.totalPages)>1?r(e1,{totalPages:n==null?void 0:n.totalPages,currentPage:V,onChange:A}):null]})]}),[o,g,h,i,c,n==null?void 0:n.totalPages,V,A,f,o]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{_1 as R}; +import{jsx as r,jsxs as s,Fragment as M}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as H}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as k}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as E,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const q=a=>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",...a},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"})))),L1=a=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},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"})),J=({typeList:a,isEmpty:Z,minifiedView:_,message:t})=>{const n=t1(()=>{switch(a){case"orders":return{icon:L1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[a,t]);return!Z||!a||!n.text?null:r(R,{className:W(["order-empty-list",n.className,_?"order-empty-list--minified":""]),message:n.text,icon:r(E,{source:n.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},_1=({minifiedViewKey:a,withReturnNumber:Z=!1,withOrderNumber:_=!1,slots:t,pageInfo:n,withReturnsListButton:$=!0,isMobile:x=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:o=!0,withThumbnails:w=!0,selectedPage:V=1,handleSetSelectPage:A,routeReturnDetails:d,routeOrderDetails:p,routeTracking:u,routeReturnsList:N,routeProductDetails:m,loading:f})=>{const B=h?X:i.length,S=m!=null&&m()?"a":"span",g=H(()=>i.slice(0,B).map((e,I)=>{var z,j;const y=((e==null?void 0:e.items)??[]).reduce((L,C)=>C.totalQuantity??0+L,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${a}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),Z?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(p==null?void 0:p({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(z=e==null?void 0:e.tracking)==null?void 0:z.map((L,C)=>{var v,b;return s("p",{children:[`${c.carrier} ${(b=(v=L==null?void 0:L.carrier)==null?void 0:v.label)==null?void 0:b.toLocaleUpperCase()}: `,r("a",{href:`${(u==null?void 0:u(L))||"#"}`,target:"_blank",rel:"noreferrer",children:L.trackingNumber})]},`${L.trackingNumber}_${C}`)}),t!=null&&t.ReturnItemsDetails?r(k,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[y," ",r(U,{id:`Order.Returns.${a}.returnsList.itemText`,plural:y,fields:{count:y}})]}):null]}),w?r(D,{maxColumns:x?3:9,emptyGridContent:r(M,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",x]]),children:(j=e==null?void 0:e.items)==null?void 0:j.map((L,C)=>{var F,G;const v=(F=L.thumbnail)==null?void 0:F.label,b=(G=L.thumbnail)==null?void 0:G.url;return r(S,{href:(m==null?void 0:m(L))??"#",children:r(r1,{alt:v,src:b,width:85,height:114})},C+L.uid)})}):null,t!=null&&t.DetailsActionParams?r(k,{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(E,{source:q,...T})})]})},I)}),[i,B,a,Z,c,d,_,p,t,w,x,m,u,S]),Y=H(()=>s(M,{children:[o?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,f?r(Q,{withCard:!1}):s(M,{children:[g,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(E,{source:q,...T})]})})}):null]})]}),[N,$,o,c,g,h,i.length,f]),K=H(()=>s(M,{children:[o?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,f?r(Q,{withCard:!1}):s(M,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),g,(n==null?void 0:n.totalPages)>1?r(e1,{totalPages:n==null?void 0:n.totalPages,currentPage:V,onChange:A}):null]})]}),[o,g,h,i,c,n==null?void 0:n.totalPages,V,A,f,o]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{_1 as R}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 40c55f6670..66b7bed85b 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731318109181} \ No newline at end of file +{"at":1731319279064} \ No newline at end of file From a8e51794437f81f6a5fa641cc7249747c42e978c Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 12:21:52 +0200 Subject: [PATCH 06/30] test 4 --- .../__dropins__/storefront-order/containers/ShippingStatus.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index f3860d79fe..4a140b218f 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1 +1 @@ -import{jsxs as u,jsx as n,Fragment as v}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as N,Header as _,Accordion as o,AccordionSection as x,ContentGrid as W,Image as E}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as y,useEffect as J}from"@dropins/tools/preact-hooks.js";import{events as K}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Q}from"../chunks/useIsMobile.js";import{Text as $,useText as X}from"@dropins/tools/i18n.js";import{C as Z}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var R=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(R||{});const Y=({orderData:e})=>{const[r,i]=y(!0),[c,d]=y(e),[m,f]=y(!1);return J(()=>{const a=K.on("order/data",g=>{d(g),f(g==null?void 0:g.isVirtual),i(!1)},{eager:!0});return()=>{a==null||a.off()}},[]),{loading:r,order:c,isVirtualProduct:m}},P=({slots:e,collapseThreshold:r,translations:i,returnData:c,routeTracking:d,routeProductDetails:m})=>{var g;const f=Q(),a=m?"a":"span";return u(N,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(_,{title:i.returnOrderCardTitle}),u("div",{children:[(g=c==null?void 0:c.tracking)==null?void 0:g.map((l,C)=>{var S,p;return u("p",{children:[`${i.carrier} ${(p=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:p.toLocaleUpperCase()}: `,n("a",{href:`${(d==null?void 0:d(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${C}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:c.items}}):null,n(o,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{defaultOpen:r>=c.items.length,title:n($,{id:"Order.ShippingStatusCard.itemText",plural:c.items.length,fields:{count:c.items.length}}),children:n(W,{maxColumns:f?3:9,emptyGridContent:n(v,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",f]]),children:c.items.map((l,C)=>{var I,T;const S=(I=l.thumbnail)==null?void 0:I.label,p=(T=l.thumbnail)==null?void 0:T.url;return n(a,{href:(m==null?void 0:m(l))??"#","data-testid":`${C}${l.uid}`,children:n(E,{alt:S,src:p,width:85,height:114})},`${C}${l.uid}`)})})})})]})]})},k=({translations:e,slots:r,orderData:i,collapseThreshold:c=10,routeProductDetails:d,routeTracking:m})=>{var I,T,w,G,M;const f=!!(i!=null&&i.returnNumber),a=i==null?void 0:i.returnNumber,g=d?"a":"span",l=(I=i==null?void 0:i.status)==null?void 0:I.toLocaleLowerCase(),S=((T=i==null?void 0:i.shipments)==null?void 0:T.length)===1&&(l==null?void 0:l.includes(R.COMPLETE)),p=(w=i==null?void 0:i.items)==null?void 0:w.filter(t=>(t==null?void 0:t.quantityShipped)===0);if(f&&(i!=null&&i.returns.length)){const t=i.returns.find(s=>s.returnNumber===a);return!t||t.tracking.length===0?null:n(P,{slots:r,collapseThreshold:c,translations:e,returnData:t,routeTracking:m,routeProductDetails:d})}return!i||l!=null&&l.includes(R.CANCELED)?null:(G=i==null?void 0:i.shipments)!=null&&G.length?u(v,{children:[(M=i==null?void 0:i.shipments)==null?void 0:M.map(({tracking:t,items:s,id:b},z)=>u(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingCardTitle}),t==null?void 0:t.map(h=>{var O;return u("div",{className:"order-shipping-status-card__header",role:"status",children:[u("div",{className:"order-shipping-status-card__header--content",children:[u("p",{children:[e.carrier," ",(O=h==null?void 0:h.carrier)==null?void 0:O.toLocaleUpperCase()," | ",h==null?void 0:h.number]}),n("p",{children:h==null?void 0:h.title})]}),r!=null&&r.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:r==null?void 0:r.DeliveryTrackActions,context:{trackInformation:h}}):null]},h.number)}),S?null:n(o,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{"data-position":z+1,defaultOpen:c>=(s==null?void 0:s.length),title:n(v,{children:n($,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:s==null?void 0:s.length,fields:{count:s==null?void 0:s.length}})}),children:n(W,{maxColumns:6,emptyGridContent:n(v,{}),className:"order-shipping-status-card__images",children:s==null?void 0:s.map(h=>{var V,U,H,j,F,q;const O=(H=(U=(V=h==null?void 0:h.orderItem)==null?void 0:V.product)==null?void 0:U.thumbnail)==null?void 0:H.label,B=(q=(F=(j=h==null?void 0:h.orderItem)==null?void 0:j.product)==null?void 0:F.thumbnail)==null?void 0:q.url;return n(g,{href:(d==null?void 0:d(h))??"#",children:n(E,{alt:O,src:B||"",width:85,height:114})},h.id)})})})}),r!=null&&r.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:r==null?void 0:r.DeliveryTimeLine,context:{}}):null]},b)),p!=null&&p.length?u(N,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(_,{title:e.notYetShippedTitle}),n(o,{actionIconPosition:"right",children:n(x,{defaultOpen:c>=(p==null?void 0:p.length),title:n($,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:p==null?void 0:p.length,fields:{count:p==null?void 0:p.length}}),children:n("div",{className:"order-shipping-status-card__images",children:p==null?void 0:p.map(t=>{var s,b;return n(g,{href:(d==null?void 0:d(t))??"#",children:n(E,{alt:(s=t.thumbnail)==null?void 0:s.label,src:((b=t.thumbnail)==null?void 0:b.url)||"",width:85,height:114})},t.id)})})})})]}):null]}):u(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:u("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ti=({slots:e,className:r,collapseThreshold:i,orderData:c,routeOrderDetails:d,routeTracking:m,routeProductDetails:f})=>{const{loading:a,order:g,isVirtualProduct:l}=Y({orderData:c}),C=X({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"});return!a&&l?null:n("div",{className:L(["order-shipping-status",r]),children:!a&&g?n(k,{translations:C,routeOrderDetails:d,routeTracking:m,slots:e,orderData:g,collapseThreshold:i,routeProductDetails:f}):n(Z,{withCard:!1})})};export{ti as ShippingStatus,ti as default}; +import{jsxs as u,jsx as n,Fragment as v}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as N,Header as _,Accordion as x,AccordionSection as E,ContentGrid as B,Image as $}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as y,useEffect as Q}from"@dropins/tools/preact-hooks.js";import{events as X}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as R,useText as Y}from"@dropins/tools/i18n.js";import{C as P}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var o=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(o||{});const k=({orderData:e})=>{const[s,i]=y(!0),[c,d]=y(e),[m,C]=y(!1);return Q(()=>{const f=X.on("order/data",t=>{d(t),C(t==null?void 0:t.isVirtual),i(!1)},{eager:!0});return()=>{f==null||f.off()}},[]),{loading:s,order:c,isVirtualProduct:m}},D=({slots:e,collapseThreshold:s,translations:i,returnData:c,routeTracking:d,routeProductDetails:m})=>{var t;const C=Z(),f=m?"a":"span";return console.log("returnData",c),u(N,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(_,{title:i.returnOrderCardTitle}),u("div",{children:[(t=c==null?void 0:c.tracking)==null?void 0:t.map((l,a)=>{var S,I;return u("p",{children:[`${i.carrier} ${(I=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:I.toLocaleUpperCase()}: `,n("a",{href:`${(d==null?void 0:d(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${a}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:c.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:s>=c.items.length,title:n(R,{id:"Order.ShippingStatusCard.itemText",plural:c.items.length,fields:{count:c.items.length}}),children:n(B,{maxColumns:C?3:9,emptyGridContent:n(v,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:c.items.map((l,a)=>{var p,T;const S=(p=l.thumbnail)==null?void 0:p.label,I=(T=l.thumbnail)==null?void 0:T.url;return n(f,{href:(m==null?void 0:m(l))??"#","data-testid":`${a}${l.uid}`,children:n($,{alt:S,src:I,width:85,height:114})},`${a}${l.uid}`)})})})})]})]})},ii=({translations:e,slots:s,orderData:i,collapseThreshold:c=10,routeProductDetails:d,routeTracking:m})=>{var T,w,G,M,V,U;const C=!!(i!=null&&i.returnNumber),f=i==null?void 0:i.returnNumber,t=d?"a":"span",l=(T=i==null?void 0:i.status)==null?void 0:T.toLocaleLowerCase(),S=((w=i==null?void 0:i.shipments)==null?void 0:w.length)===1&&(l==null?void 0:l.includes(o.COMPLETE)),I=(G=i==null?void 0:i.shipments)==null?void 0:G.every(r=>r.tracking.length===0),p=(M=i==null?void 0:i.items)==null?void 0:M.filter(r=>(r==null?void 0:r.quantityShipped)===0);if(C&&(i!=null&&i.returns.length)){const r=i.returns.find(g=>g.returnNumber===f);return!r||r.tracking.length===0?null:n(D,{slots:s,collapseThreshold:c,translations:e,returnData:r,routeTracking:m,routeProductDetails:d})}return!i||l!=null&&l.includes(o.CANCELED)?null:(V=i==null?void 0:i.shipments)!=null&&V.length?I&&!(p!=null&&p.length)&&S?null:u(v,{children:[(U=i==null?void 0:i.shipments)==null?void 0:U.map(({tracking:r,items:g,id:b},J)=>u(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingCardTitle}),r==null?void 0:r.map(h=>{var O;return u("div",{className:"order-shipping-status-card__header",role:"status",children:[u("div",{className:"order-shipping-status-card__header--content",children:[u("p",{children:[e.carrier," ",(O=h==null?void 0:h.carrier)==null?void 0:O.toLocaleUpperCase()," | ",h==null?void 0:h.number]}),n("p",{children:h==null?void 0:h.title})]}),s!=null&&s.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:s==null?void 0:s.DeliveryTrackActions,context:{trackInformation:h}}):null]},h.number)}),S?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":J+1,defaultOpen:c>=(g==null?void 0:g.length),title:n(v,{children:n(R,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:g==null?void 0:g.length,fields:{count:g==null?void 0:g.length}})}),children:n(B,{maxColumns:6,emptyGridContent:n(v,{}),className:"order-shipping-status-card__images",children:g==null?void 0:g.map(h=>{var H,j,F,q,W,z;const O=(F=(j=(H=h==null?void 0:h.orderItem)==null?void 0:H.product)==null?void 0:j.thumbnail)==null?void 0:F.label,K=(z=(W=(q=h==null?void 0:h.orderItem)==null?void 0:q.product)==null?void 0:W.thumbnail)==null?void 0:z.url;return n(t,{href:(d==null?void 0:d(h))??"#",children:n($,{alt:O,src:K||"",width:85,height:114})},h.id)})})})}),s!=null&&s.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:s==null?void 0:s.DeliveryTimeLine,context:{}}):null]},b)),p!=null&&p.length?u(N,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(_,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:c>=(p==null?void 0:p.length),title:n(R,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:p==null?void 0:p.length,fields:{count:p==null?void 0:p.length}}),children:n("div",{className:"order-shipping-status-card__images",children:p==null?void 0:p.map(r=>{var g,b;return n(t,{href:(d==null?void 0:d(r))??"#",children:n($,{alt:(g=r.thumbnail)==null?void 0:g.label,src:((b=r.thumbnail)==null?void 0:b.url)||"",width:85,height:114})},r.id)})})})})]}):null]}):u(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:u("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ui=({slots:e,className:s,collapseThreshold:i,orderData:c,routeOrderDetails:d,routeTracking:m,routeProductDetails:C})=>{const{loading:f,order:t,isVirtualProduct:l}=k({orderData:c}),a=Y({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"});return!f&&l?null:n("div",{className:L(["order-shipping-status",s]),children:!f&&t?n(ii,{translations:a,routeOrderDetails:d,routeTracking:m,slots:e,orderData:t,collapseThreshold:i,routeProductDetails:C}):n(P,{withCard:!1})})};export{ui as ShippingStatus,ui as default}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 66b7bed85b..5a55676ebd 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731319279064} \ No newline at end of file +{"at":1731320472669} \ No newline at end of file From 7c785a5ad37f7b6e2aac12aa48cfbe724dff8873 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 12:34:48 +0200 Subject: [PATCH 07/30] test 5 --- .../storefront-order/chunks/ReturnsListContent.js | 2 +- .../storefront-order/containers/CreateReturn.js | 2 +- .../storefront-order/containers/OrderStatus.js | 2 +- .../storefront-order/containers/ShippingStatus.js | 2 +- .../storefront-order/i18n/en_US.json.d.ts | 12 ++++++------ scripts/__dropins__/storefront-order/reload | 2 +- scripts/__dropins__/storefront-order/render.js | 4 ++-- .../storefront-order/types/createReturn.types.d.ts | 3 ++- 8 files changed, 15 insertions(+), 14 deletions(-) diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index 12b0e2d13f..b7e33df38f 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1 +1 @@ -import{jsx as r,jsxs as s,Fragment as M}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as H}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as k}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as E,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const q=a=>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",...a},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"})))),L1=a=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},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"})),J=({typeList:a,isEmpty:Z,minifiedView:_,message:t})=>{const n=t1(()=>{switch(a){case"orders":return{icon:L1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[a,t]);return!Z||!a||!n.text?null:r(R,{className:W(["order-empty-list",n.className,_?"order-empty-list--minified":""]),message:n.text,icon:r(E,{source:n.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},_1=({minifiedViewKey:a,withReturnNumber:Z=!1,withOrderNumber:_=!1,slots:t,pageInfo:n,withReturnsListButton:$=!0,isMobile:x=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:o=!0,withThumbnails:w=!0,selectedPage:V=1,handleSetSelectPage:A,routeReturnDetails:d,routeOrderDetails:p,routeTracking:u,routeReturnsList:N,routeProductDetails:m,loading:f})=>{const B=h?X:i.length,S=m!=null&&m()?"a":"span",g=H(()=>i.slice(0,B).map((e,I)=>{var z,j;const y=((e==null?void 0:e.items)??[]).reduce((L,C)=>C.totalQuantity??0+L,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${a}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),Z?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(p==null?void 0:p({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(z=e==null?void 0:e.tracking)==null?void 0:z.map((L,C)=>{var v,b;return s("p",{children:[`${c.carrier} ${(b=(v=L==null?void 0:L.carrier)==null?void 0:v.label)==null?void 0:b.toLocaleUpperCase()}: `,r("a",{href:`${(u==null?void 0:u(L))||"#"}`,target:"_blank",rel:"noreferrer",children:L.trackingNumber})]},`${L.trackingNumber}_${C}`)}),t!=null&&t.ReturnItemsDetails?r(k,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[y," ",r(U,{id:`Order.Returns.${a}.returnsList.itemText`,plural:y,fields:{count:y}})]}):null]}),w?r(D,{maxColumns:x?3:9,emptyGridContent:r(M,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",x]]),children:(j=e==null?void 0:e.items)==null?void 0:j.map((L,C)=>{var F,G;const v=(F=L.thumbnail)==null?void 0:F.label,b=(G=L.thumbnail)==null?void 0:G.url;return r(S,{href:(m==null?void 0:m(L))??"#",children:r(r1,{alt:v,src:b,width:85,height:114})},C+L.uid)})}):null,t!=null&&t.DetailsActionParams?r(k,{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(E,{source:q,...T})})]})},I)}),[i,B,a,Z,c,d,_,p,t,w,x,m,u,S]),Y=H(()=>s(M,{children:[o?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,f?r(Q,{withCard:!1}):s(M,{children:[g,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(E,{source:q,...T})]})})}):null]})]}),[N,$,o,c,g,h,i.length,f]),K=H(()=>s(M,{children:[o?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,f?r(Q,{withCard:!1}):s(M,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),g,(n==null?void 0:n.totalPages)>1?r(e1,{totalPages:n==null?void 0:n.totalPages,currentPage:V,onChange:A}):null]})]}),[o,g,h,i,c,n==null?void 0:n.totalPages,V,A,f,o]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{_1 as R}; +import{jsx as r,jsxs as s,Fragment as C}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as y}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as k}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as E,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const q=a=>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",...a},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"})))),L1=a=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},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"})),J=({typeList:a,isEmpty:M,minifiedView:Z,message:t})=>{const n=t1(()=>{switch(a){case"orders":return{icon:L1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[a,t]);return!M||!a||!n.text?null:r(R,{className:W(["order-empty-list",n.className,Z?"order-empty-list--minified":""]),message:n.text,icon:r(E,{source:n.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},_1=({minifiedViewKey:a,withReturnNumber:M=!1,withOrderNumber:Z=!1,slots:t,pageInfo:n,withReturnsListButton:w=!0,isMobile:x=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:_=!0,withThumbnails:$=!0,selectedPage:V=1,handleSetSelectPage:A,routeReturnDetails:d,routeOrderDetails:p,routeTracking:u,routeReturnsList:N,routeProductDetails:m,loading:f})=>{const B=h?X:i.length,S=m!=null&&m()?"a":"span",g=y(()=>i.slice(0,B).map((e,I)=>{var z,j;const H=((e==null?void 0:e.items)??[]).reduce((L,o)=>o.totalQuantity??0+L,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${a}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),M?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,Z?s("p",{children:[c.orderNumber," ",r("a",{href:(p==null?void 0:p({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(z=e==null?void 0:e.tracking)==null?void 0:z.map((L,o)=>{var v,b;return s("p",{children:[`${c.carrier} ${(b=(v=L==null?void 0:L.carrier)==null?void 0:v.label)==null?void 0:b.toLocaleUpperCase()}: `,r("a",{href:`${(u==null?void 0:u(L))||"#"}`,target:"_blank",rel:"noreferrer",children:L.trackingNumber})]},`${L.trackingNumber}_${o}`)}),t!=null&&t.ReturnItemsDetails?r(k,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[H," ",r(U,{id:`Order.Returns.${a}.returnsList.itemText`,plural:H,fields:{count:H}})]}):null]}),$?r(D,{maxColumns:x?3:9,emptyGridContent:r(C,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",x]]),children:(j=e==null?void 0:e.items)==null?void 0:j.map((L,o)=>{var F,G;const v=(F=L.thumbnail)==null?void 0:F.label,b=(G=L.thumbnail)==null?void 0:G.url;return r(S,{href:(m==null?void 0:m(L))??"#",children:r(r1,{alt:v,src:b,width:85,height:114})},o+L.uid)})}):null,t!=null&&t.DetailsActionParams?r(k,{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(E,{source:q,...T})})]})},I)}),[i,B,a,M,c,d,Z,p,t,$,x,m,u,S]),Y=y(()=>s(C,{children:[_?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,f?r(Q,{withCard:!1}):s(C,{children:[g,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),w?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(E,{source:q,...T})]})})}):null]})]}),[N,w,_,c,g,h,i.length,f]),K=y(()=>s(C,{children:[_?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,f?r(Q,{withCard:!1}):s(C,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),g,(n==null?void 0:n.totalPages)>1?r(e1,{totalPages:n==null?void 0:n.totalPages,currentPage:V,onChange:A}):null]})]}),[g,h,i,c,n==null?void 0:n.totalPages,V,A,f,_]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{_1 as R}; diff --git a/scripts/__dropins__/storefront-order/containers/CreateReturn.js b/scripts/__dropins__/storefront-order/containers/CreateReturn.js index d20bd22150..f62e19bb0b 100644 --- a/scripts/__dropins__/storefront-order/containers/CreateReturn.js +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn.js @@ -1 +1 @@ -import{jsx as a,jsxs as A}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as H,classes as Q}from"@dropins/tools/lib.js";import{Button as M,CartItem as V,Image as W,Header as $,InLineAlert as Z}from"@dropins/tools/components.js";import{S as z,u as D,a as U,R as K}from"../chunks/OrderCancel.js";import{useState as O,useRef as G,useEffect as T,useCallback as N}from"@dropins/tools/preact-hooks.js";import{events as J}from"@dropins/tools/event-bus.js";import{g as X}from"../chunks/getFormValues.js";import{s as Y}from"../chunks/setTaxStatus.js";import{createRef as I,Fragment as ee}from"@dropins/tools/preact.js";import{o as te,c as ne,n as se,r as ae,m as re}from"../chunks/returnOrdersHelper.js";import{g as ie,r as ce}from"../chunks/requestReturn.js";import{g as ue}from"../chunks/getStoreConfig.js";import*as f from"@dropins/tools/preact-compat.js";import{O as oe}from"../chunks/OrderLoaders.js";import{useText as le}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const de=s=>f.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},f.createElement("g",{clipPath:"url(#clip0_841_1324)"},f.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),f.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"})),f.createElement("defs",null,f.createElement("clipPath",{id:"clip0_841_1324"},f.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),pe=s=>f.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},f.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"}),f.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),he=({onSuccess:s,onError:r,handleSetInLineAlert:i,orderData:p})=>{const[o,h]=O(p),[S,k]=O("products"),[w,R]=O(!0),[b,y]=O([]),[x,E]=O([]),[t,m]=O({taxIncluded:!1,taxExcluded:!1}),[e,l]=O([]),g=G([]);g.current.length!==b.length&&(g.current=b.map((n,c)=>g.current[c]||I())),T(()=>{const n=J.on("order/data",c=>{h(c),l(te(c)),R(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ue().then(n=>{if(n){const c=Y(n==null?void 0:n.shoppingCartDisplayPrice);m(c)}})},[]),T(()=>{ie("RMA_ITEM").then(n=>{n.length&&(E(n),R(!1))})},[]);const v=N(n=>{y(c=>c.findIndex(u=>(u==null?void 0:u.productSku)===(n==null?void 0:n.productSku))>-1?c.filter(u=>(u==null?void 0:u.productSku)!==(n==null?void 0:n.productSku)):[...c,n])},[]),C=N(n=>{k(n),i(),n==="products"&&y([])},[i]),_=N((n,c)=>{const L=b.map(u=>u.productSku===c?{...u,currentReturnOrderQuantity:n}:u);y(L)},[b]),F=N(async(n,c)=>{if(!c)return null;R(!0);const L={orderUid:(o==null?void 0:o.id)??"",contactEmail:(o==null?void 0:o.email)??""},u=[];g.current.length&&g.current.forEach(({current:d})=>{var P;const j=d==null?void 0:d.name.replace(/_\d+$/,""),q=((P=d==null?void 0:d.dataset)==null?void 0:P.quantity)??1,B=ne(X(d));u.push({orderItemUid:j,quantityToReturn:+q,...se(B)})}),ce({...L,items:u}).then(d=>{d&&(s==null||s(d),C("success"),i())}).catch(d=>{r==null||r(d.message),i({type:"error",heading:d.message})}),R(!1)},[C,r,s,i,o]);return{order:o,steps:S,loading:w,formsRef:g,taxConfig:t,attributesList:x,selectedProductList:b,itemsEligibleForReturn:e,handleSelectedProductList:v,handleSetQuantity:_,handleChangeStep:C,onSubmit:F}},me={success:a(pe,{}),warning:a(de,{}),error:a(z,{})},ge=()=>{const[s,r]=O({type:"success",heading:""}),i=N(p=>{if(!(p!=null&&p.type)){r({type:"success",heading:""});return}const o=me[p.type];r({...p,icon:o})},[]);return{inLineAlertProps:s,handleSetInLineAlert:i}},fe=({routeReturnSuccess:s,translations:r})=>{const i=()=>{window.location.href=(s==null?void 0:s())??""};return A("div",{className:"order-return-order-message",children:[a("p",{className:"order-return-order-message__title",children:r.successTitle}),a("p",{className:"order-return-order-message__subtitle",children:r.successMessage}),a(M,{onClick:i,type:"button",children:r.backStore})]})},be=({slots:s,formsRef:r,selectedProductList:i,loading:p,fieldsConfig:o,translations:h,handleChangeStep:S,onSubmit:k})=>{const{formData:w,errors:R,formRef:b,handleChange:y,handleBlur:x,handleSubmit:E}=D({fieldsConfig:ae(o,i==null?void 0:i.length),onSubmit:k});return A("form",{className:"order-return-reason-form",ref:b,onSubmit:E,name:"returnReasonForm",children:[i.map((t,m)=>{var F,n,c,L,u;const e=(t==null?void 0:t.giftCard)||{},l=t==null?void 0:t.product,g=re(o,m),v=`${t==null?void 0:t.id}_${m}`,C=(t==null?void 0:t.currentReturnOrderQuantity)??1,_={...t!=null&&t.currentReturnOrderQuantity?{Quantity:C}:{},..."configurableOptions"in t?t.configurableOptions:{},..."bundleOptions"in t?t.bundleOptions:{},..."senderName"in e&&(e!=null&&e.senderName)?{[h.sender]:e==null?void 0:e.senderName}:{},..."senderEmail"in e&&(e!=null&&e.senderEmail)?{[h.sender]:e==null?void 0:e.senderEmail}:{},..."recipientName"in e&&(e!=null&&e.recipientName)?{[h.recipient]:e==null?void 0:e.recipientName}:{},..."recipientEmail"in e&&(e!=null&&e.recipientEmail)?{[h.recipient]:e==null?void 0:e.recipientEmail}:{},..."message"in e&&(e!=null&&e.message)?{[h.message]:e==null?void 0:e.message}:{},..."downloadableLinks"in t&&(t!=null&&t.downloadableLinks)?{[`${(F=t==null?void 0:t.downloadableLinks)==null?void 0:F.count} ${h.downloadableCount}`]:(n=t==null?void 0:t.downloadableLinks)==null?void 0:n.result}:{}};return A(ee,{children:[a(V,{loading:p,title:a("div",{"data-testid":"product-name",children:(c=t==null?void 0:t.product)==null?void 0:c.name}),sku:a("div",{children:l==null?void 0:l.sku}),image:a(W,{src:((L=l==null?void 0:l.thumbnail)==null?void 0:L.url)??"",alt:((u=l==null?void 0:l.thumbnail)==null?void 0:u.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:_}),a("form",{name:v,ref:r==null?void 0:r.current[m],"data-quantity":C,children:a(U,{className:"className",loading:p,fields:g,onChange:y,onBlur:x,errors:R,values:w})})]},m)}),s!=null&&s.ReturnFormActions?a(H,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:s==null?void 0:s.ReturnFormActions,context:{handleChangeStep:S}}):A("div",{className:"order-return-reason-form__actions",children:[a(M,{variant:"secondary",type:"button",onClick:()=>{S("products")},children:h.backStep}),a(M,{children:h.submit})]})]})},Be=({className:s,orderData:r,slots:i,onSuccess:p,onError:o,routeReturnSuccess:h,showConfigurableOptions:S})=>{const k=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"}),{inLineAlertProps:w,handleSetInLineAlert:R}=ge(),{itemsEligibleForReturn:b,formsRef:y,taxConfig:x,attributesList:E,steps:t,loading:m,selectedProductList:e,handleSelectedProductList:l,handleSetQuantity:g,handleChangeStep:v,onSubmit:C}=he({orderData:r,onSuccess:p,onError:o,handleSetInLineAlert:R});if(m)return a("div",{children:a(oe,{})});if(!m&&!E.length)return a("div",{});const _={products:a(K,{itemsEligibleForReturn:b,slots:i,translations:k,loading:m,taxConfig:x,selectedProductList:e,handleSelectedProductList:l,showConfigurableOptions:S,handleSetQuantity:g,handleChangeStep:v}),attributes:a(be,{slots:i,formsRef:y,loading:m,fieldsConfig:E,selectedProductList:e,handleChangeStep:v,translations:k,onSubmit:C}),success:a(fe,{translations:k,routeReturnSuccess:h}),error:null};return A("div",{className:Q(["order-create-return",s]),children:[a($,{title:k.headerText}),w.heading?a(Z,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...w}):null,_[t]]})};export{Be as CreateReturn,Be as default}; +import{jsx as a,jsxs as F}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as H,classes as Q}from"@dropins/tools/lib.js";import{Button as M,CartItem as V,Image as W,Header as $,InLineAlert as Z}from"@dropins/tools/components.js";import{S as D,u as z,a as U,R as K}from"../chunks/OrderCancel.js";import{useState as O,useRef as G,useEffect as T,useCallback as A}from"@dropins/tools/preact-hooks.js";import{events as J}from"@dropins/tools/event-bus.js";import{g as X}from"../chunks/getFormValues.js";import{s as Y}from"../chunks/setTaxStatus.js";import{createRef as I,Fragment as ee}from"@dropins/tools/preact.js";import{o as te,c as ne,n as se,r as ae,m as re}from"../chunks/returnOrdersHelper.js";import{g as ie,r as ce}from"../chunks/requestReturn.js";import{g as ue}from"../chunks/getStoreConfig.js";import*as g from"@dropins/tools/preact-compat.js";import{O as oe}from"../chunks/OrderLoaders.js";import{useText as le}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const de=s=>g.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},g.createElement("g",{clipPath:"url(#clip0_841_1324)"},g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),g.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"})),g.createElement("defs",null,g.createElement("clipPath",{id:"clip0_841_1324"},g.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),pe=s=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},g.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"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),he=({onSuccess:s,onError:r,handleSetInLineAlert:i,orderData:l})=>{const[o,h]=O(l),[S,k]=O("products"),[w,R]=O(!0),[f,y]=O([]),[v,x]=O([]),[t,C]=O({taxIncluded:!1,taxExcluded:!1}),[e,d]=O([]),m=G([]);m.current.length!==f.length&&(m.current=f.map((n,c)=>m.current[c]||I())),T(()=>{const n=J.on("order/data",c=>{h(c),d(te(c)),R(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ue().then(n=>{if(n){const c=Y(n==null?void 0:n.shoppingCartDisplayPrice);C(c)}})},[]),T(()=>{ie("RMA_ITEM").then(n=>{n.length&&(x(n),R(!1))})},[]);const _=A(n=>{y(c=>c.findIndex(u=>(u==null?void 0:u.productSku)===(n==null?void 0:n.productSku))>-1?c.filter(u=>(u==null?void 0:u.productSku)!==(n==null?void 0:n.productSku)):[...c,n])},[]),b=A(n=>{k(n),i(),n==="products"&&y([])},[i]),N=A((n,c)=>{const L=f.map(u=>u.productSku===c?{...u,currentReturnOrderQuantity:n}:u);y(L)},[f]),E=A(async(n,c)=>{if(!c)return null;R(!0);const L={orderUid:(o==null?void 0:o.id)??"",contactEmail:(o==null?void 0:o.email)??""},u=[];m.current.length&&m.current.forEach(({current:p})=>{var P;const j=p==null?void 0:p.name.replace(/_\d+$/,""),q=((P=p==null?void 0:p.dataset)==null?void 0:P.quantity)??1,B=ne(X(p));u.push({orderItemUid:j,quantityToReturn:+q,...se(B)})}),ce({...L,items:u}).then(p=>{p&&(s==null||s(p),b("success"),i())}).catch(p=>{r==null||r(p.message),i({type:"error",heading:p.message})}),R(!1)},[b,r,s,i,o]);return{order:o,steps:S,loading:w,formsRef:m,taxConfig:t,attributesList:v,selectedProductList:f,itemsEligibleForReturn:e,handleSelectedProductList:_,handleSetQuantity:N,handleChangeStep:b,onSubmit:E}},me={success:a(pe,{}),warning:a(de,{}),error:a(D,{})},ge=()=>{const[s,r]=O({type:"success",heading:""}),i=A(l=>{if(!(l!=null&&l.type)){r({type:"success",heading:""});return}const o=me[l.type];r({...l,icon:o})},[]);return{inLineAlertProps:s,handleSetInLineAlert:i}},fe=({routeReturnSuccess:s,translations:r,orderData:i})=>{const l=()=>{window.location.href=(s==null?void 0:s(i))??"#"};return F("div",{className:"order-return-order-message",children:[a("p",{className:"order-return-order-message__title",children:r.successTitle}),a("p",{className:"order-return-order-message__subtitle",children:r.successMessage}),a(M,{onClick:l,type:"button",children:r.backStore})]})},be=({slots:s,formsRef:r,selectedProductList:i,loading:l,fieldsConfig:o,translations:h,handleChangeStep:S,onSubmit:k})=>{const{formData:w,errors:R,formRef:f,handleChange:y,handleBlur:v,handleSubmit:x}=z({fieldsConfig:ae(o,i==null?void 0:i.length),onSubmit:k});return F("form",{className:"order-return-reason-form",ref:f,onSubmit:x,name:"returnReasonForm",children:[i.map((t,C)=>{var E,n,c,L,u;const e=(t==null?void 0:t.giftCard)||{},d=t==null?void 0:t.product,m=re(o,C),_=`${t==null?void 0:t.id}_${C}`,b=(t==null?void 0:t.currentReturnOrderQuantity)??1,N={...t!=null&&t.currentReturnOrderQuantity?{Quantity:b}:{},..."configurableOptions"in t?t.configurableOptions:{},..."bundleOptions"in t?t.bundleOptions:{},..."senderName"in e&&(e!=null&&e.senderName)?{[h.sender]:e==null?void 0:e.senderName}:{},..."senderEmail"in e&&(e!=null&&e.senderEmail)?{[h.sender]:e==null?void 0:e.senderEmail}:{},..."recipientName"in e&&(e!=null&&e.recipientName)?{[h.recipient]:e==null?void 0:e.recipientName}:{},..."recipientEmail"in e&&(e!=null&&e.recipientEmail)?{[h.recipient]:e==null?void 0:e.recipientEmail}:{},..."message"in e&&(e!=null&&e.message)?{[h.message]:e==null?void 0:e.message}:{},..."downloadableLinks"in t&&(t!=null&&t.downloadableLinks)?{[`${(E=t==null?void 0:t.downloadableLinks)==null?void 0:E.count} ${h.downloadableCount}`]:(n=t==null?void 0:t.downloadableLinks)==null?void 0:n.result}:{}};return F(ee,{children:[a(V,{loading:l,title:a("div",{"data-testid":"product-name",children:(c=t==null?void 0:t.product)==null?void 0:c.name}),sku:a("div",{children:d==null?void 0:d.sku}),image:a(W,{src:((L=d==null?void 0:d.thumbnail)==null?void 0:L.url)??"",alt:((u=d==null?void 0:d.thumbnail)==null?void 0:u.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:N}),a("form",{name:_,ref:r==null?void 0:r.current[C],"data-quantity":b,children:a(U,{className:"className",loading:l,fields:m,onChange:y,onBlur:v,errors:R,values:w})})]},C)}),s!=null&&s.ReturnFormActions?a(H,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:s==null?void 0:s.ReturnFormActions,context:{handleChangeStep:S}}):F("div",{className:"order-return-reason-form__actions",children:[a(M,{variant:"secondary",type:"button",onClick:()=>{S("products")},children:h.backStep}),a(M,{children:h.submit})]})]})},Be=({className:s,orderData:r,slots:i,onSuccess:l,onError:o,routeReturnSuccess:h,showConfigurableOptions:S})=>{const k=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"}),{inLineAlertProps:w,handleSetInLineAlert:R}=ge(),{order:f,itemsEligibleForReturn:y,formsRef:v,taxConfig:x,attributesList:t,steps:C,loading:e,selectedProductList:d,handleSelectedProductList:m,handleSetQuantity:_,handleChangeStep:b,onSubmit:N}=he({orderData:r,onSuccess:l,onError:o,handleSetInLineAlert:R});if(e)return a("div",{children:a(oe,{})});if(!e&&!t.length)return a("div",{});const E={products:a(K,{itemsEligibleForReturn:y,slots:i,translations:k,loading:e,taxConfig:x,selectedProductList:d,handleSelectedProductList:m,showConfigurableOptions:S,handleSetQuantity:_,handleChangeStep:b}),attributes:a(be,{slots:i,formsRef:v,loading:e,fieldsConfig:t,selectedProductList:d,handleChangeStep:b,translations:k,onSubmit:N}),success:a(fe,{translations:k,routeReturnSuccess:h,orderData:f}),error:null};return F("div",{className:Q(["order-create-return",s]),children:[a($,{title:k.headerText}),w.heading?a(Z,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...w}):null,E[C]]})};export{Be as CreateReturn,Be as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderStatus.js b/scripts/__dropins__/storefront-order/containers/OrderStatus.js index ea10468291..62e0397a1b 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderStatus.js +++ b/scripts/__dropins__/storefront-order/containers/OrderStatus.js @@ -1,4 +1,4 @@ -import{jsx as c,jsxs as N,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{Card as U,Header as F,Button as E,InLineAlert as P,Modal as K}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{f as k}from"../chunks/returnOrdersHelper.js";import{classes as y,Slot as G}from"@dropins/tools/lib.js";import{f as b}from"../chunks/formatDateToLocale.js";import{useState as O,useEffect as I,useCallback as V}from"@dropins/tools/preact-hooks.js";import{events as v}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{useMemo as q,useState as H}from"@dropins/tools/preact-compat.js";import{r as x}from"../chunks/redirectTo.js";import{O as W}from"../chunks/OrderCancelForm.js";import{useText as C,Text as L}from"@dropins/tools/i18n.js";import{r as j}from"../chunks/reorderItems.js";import{C as J}from"../chunks/OrderLoaders.js";import{G as z}from"../chunks/getGuestOrder.graphql.js";import{f as B,h as Q}from"../chunks/fetch-graphql.js";import{b as X}from"../chunks/transform-order-details.js";import{g as Y}from"../chunks/getStoreConfig.js";import"../chunks/form.types.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";var _=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(_||{});const w={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested"},Z=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:i,onError:s,routeOnSuccess:d})=>{var M;const l=!!(e!=null&&e.returnNumber),a=String(n).toLocaleLowerCase(),o=(M=e==null?void 0:e.returns)==null?void 0:M[0],m=(o==null?void 0:o.returnStatus)??"",p=(o==null?void 0:o.createdReturnAt)??"",g=C(`Order.OrderStatusContent.${w[a]}.title`),h=C(`Order.OrderStatusContent.${w[a]}.message`),R=C(`Order.OrderStatusContent.${w[a]}.messageWithoutDate`),u=C({title:`Order.OrderStatusContent.resturnStatus.${k(m)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return c("div",{});const f=e!=null&&e.orderStatusChangeDate?h==null?void 0:h.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):R.messageWithoutDate,A=(u==null?void 0:u.returnMessage.replace("{ORDER_CREATE_DATE}",b(e==null?void 0:e.orderDate)).replace("{RETURN_CREATE_DATE}",b(p)))??"",T=l?t??u.title:t??g.title;return N(U,{className:"order-order-status-content",variant:"secondary",children:[c(F,{title:T}),N("div",{className:"order-order-status-content__wrapper",children:[c("div",{className:y(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:c("p",{children:l?A:f})}),c(ee,{orderData:e,slots:r,routeCreateReturn:i,routeOnSuccess:d,onError:s})]})]})},D=({orderData:r})=>{const[t,n]=O(r),[e,i]=O(r==null?void 0:r.status);return I(()=>{const s=v.on("order/data",d=>{n(d),i(d.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},ee=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:i,onError:s})=>{const d=C({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=q(()=>{const a=t==null?void 0:t.availableActions,o=!!(a!=null&&a.length),m=!!(t!=null&&t.returnNumber),p=()=>{x(e,{},t)};return c(S,{children:n!=null&&n.OrderActions?c(G,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):c("div",{"data-testid":"availableActionsList",className:y(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!o]]),children:a==null?void 0:a.map(g=>{switch(g){case _.CANCEL:return c(S,{children:m?null:!!t&&c(se,{orderRef:t.token??atob(t.id)})});case _.RETURN:return c(E,{variant:"secondary",onClick:p,children:m?d.createAnotherReturn:d.createReturn});case _.REORDER:return c(S,{children:m?null:c(oe,{orderData:t,onError:s,routeOnSuccess:i,children:d.reorder})})}})})})},[s,t,i,e,n,d]);return c("div",{className:y(["order-order-actions",r]),children:l})},$=()=>{const[r,t]=O(null);return I(()=>{const n=sessionStorage.getItem("orderStoreConfig"),e=n?JSON.parse(n):null;e?t(e):Y().then(i=>{i&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(i)),t(i))})},[]),r},re=` +import{jsx as c,jsxs as N,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{Card as U,Header as F,Button as E,InLineAlert as P,Modal as K}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{f as k}from"../chunks/returnOrdersHelper.js";import{classes as y,Slot as G}from"@dropins/tools/lib.js";import{f as b}from"../chunks/formatDateToLocale.js";import{useState as O,useEffect as I,useCallback as V}from"@dropins/tools/preact-hooks.js";import{events as v}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{useMemo as q,useState as H}from"@dropins/tools/preact-compat.js";import{r as x}from"../chunks/redirectTo.js";import{O as W}from"../chunks/OrderCancelForm.js";import{useText as C,Text as L}from"@dropins/tools/i18n.js";import{r as j}from"../chunks/reorderItems.js";import{C as J}from"../chunks/OrderLoaders.js";import{G as z}from"../chunks/getGuestOrder.graphql.js";import{f as B,h as Q}from"../chunks/fetch-graphql.js";import{b as X}from"../chunks/transform-order-details.js";import{g as Y}from"../chunks/getStoreConfig.js";import"../chunks/form.types.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";var _=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(_||{});const w={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested"},Z=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:i,onError:s,routeOnSuccess:d})=>{var M;const l=!!(e!=null&&e.returnNumber),a=String(n).toLocaleLowerCase(),o=(M=e==null?void 0:e.returns)==null?void 0:M[0],m=(o==null?void 0:o.returnStatus)??"",p=(o==null?void 0:o.createdReturnAt)??"",g=C(`Order.OrderStatusContent.${w[a]}.title`),h=C(`Order.OrderStatusContent.${w[a]}.message`),R=C(`Order.OrderStatusContent.${w[a]}.messageWithoutDate`),u=C({title:`Order.OrderStatusContent.returnStatus.${k(m)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return c("div",{});const f=e!=null&&e.orderStatusChangeDate?h==null?void 0:h.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):R.messageWithoutDate,A=(u==null?void 0:u.returnMessage.replace("{ORDER_CREATE_DATE}",b(e==null?void 0:e.orderDate)).replace("{RETURN_CREATE_DATE}",b(p)))??"",T=l?t??u.title:t??g.title;return N(U,{className:"order-order-status-content",variant:"secondary",children:[c(F,{title:T}),N("div",{className:"order-order-status-content__wrapper",children:[c("div",{className:y(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:c("p",{children:l?A:f})}),c(ee,{orderData:e,slots:r,routeCreateReturn:i,routeOnSuccess:d,onError:s})]})]})},D=({orderData:r})=>{const[t,n]=O(r),[e,i]=O(r==null?void 0:r.status);return I(()=>{const s=v.on("order/data",d=>{n(d),i(d.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},ee=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:i,onError:s})=>{const d=C({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=q(()=>{const a=t==null?void 0:t.availableActions,o=!!(a!=null&&a.length),m=!!(t!=null&&t.returnNumber),p=()=>{x(e,{},t)};return c(S,{children:n!=null&&n.OrderActions?c(G,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):c("div",{"data-testid":"availableActionsList",className:y(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!o]]),children:a==null?void 0:a.map(g=>{switch(g){case _.CANCEL:return c(S,{children:m?null:!!t&&c(se,{orderRef:t.token??atob(t.id)})});case _.RETURN:return c(E,{variant:"secondary",onClick:p,children:m?d.createAnotherReturn:d.createReturn});case _.REORDER:return c(S,{children:m?null:c(oe,{orderData:t,onError:s,routeOnSuccess:i,children:d.reorder})})}})})})},[s,t,i,e,n,d]);return c("div",{className:y(["order-order-actions",r]),children:l})},$=()=>{const[r,t]=O(null);return I(()=>{const n=sessionStorage.getItem("orderStoreConfig"),e=n?JSON.parse(n):null;e?t(e):Y().then(i=>{i&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(i)),t(i))})},[]),r},re=` mutation CONFIRM_CANCEL_ORDER_MUTATION( $orderId: ID!, $confirmationKey: String! diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index 4a140b218f..62319ec21d 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1 +1 @@ -import{jsxs as u,jsx as n,Fragment as v}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as N,Header as _,Accordion as x,AccordionSection as E,ContentGrid as B,Image as $}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as y,useEffect as Q}from"@dropins/tools/preact-hooks.js";import{events as X}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as R,useText as Y}from"@dropins/tools/i18n.js";import{C as P}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var o=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(o||{});const k=({orderData:e})=>{const[s,i]=y(!0),[c,d]=y(e),[m,C]=y(!1);return Q(()=>{const f=X.on("order/data",t=>{d(t),C(t==null?void 0:t.isVirtual),i(!1)},{eager:!0});return()=>{f==null||f.off()}},[]),{loading:s,order:c,isVirtualProduct:m}},D=({slots:e,collapseThreshold:s,translations:i,returnData:c,routeTracking:d,routeProductDetails:m})=>{var t;const C=Z(),f=m?"a":"span";return console.log("returnData",c),u(N,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(_,{title:i.returnOrderCardTitle}),u("div",{children:[(t=c==null?void 0:c.tracking)==null?void 0:t.map((l,a)=>{var S,I;return u("p",{children:[`${i.carrier} ${(I=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:I.toLocaleUpperCase()}: `,n("a",{href:`${(d==null?void 0:d(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${a}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:c.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:s>=c.items.length,title:n(R,{id:"Order.ShippingStatusCard.itemText",plural:c.items.length,fields:{count:c.items.length}}),children:n(B,{maxColumns:C?3:9,emptyGridContent:n(v,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:c.items.map((l,a)=>{var p,T;const S=(p=l.thumbnail)==null?void 0:p.label,I=(T=l.thumbnail)==null?void 0:T.url;return n(f,{href:(m==null?void 0:m(l))??"#","data-testid":`${a}${l.uid}`,children:n($,{alt:S,src:I,width:85,height:114})},`${a}${l.uid}`)})})})})]})]})},ii=({translations:e,slots:s,orderData:i,collapseThreshold:c=10,routeProductDetails:d,routeTracking:m})=>{var T,w,G,M,V,U;const C=!!(i!=null&&i.returnNumber),f=i==null?void 0:i.returnNumber,t=d?"a":"span",l=(T=i==null?void 0:i.status)==null?void 0:T.toLocaleLowerCase(),S=((w=i==null?void 0:i.shipments)==null?void 0:w.length)===1&&(l==null?void 0:l.includes(o.COMPLETE)),I=(G=i==null?void 0:i.shipments)==null?void 0:G.every(r=>r.tracking.length===0),p=(M=i==null?void 0:i.items)==null?void 0:M.filter(r=>(r==null?void 0:r.quantityShipped)===0);if(C&&(i!=null&&i.returns.length)){const r=i.returns.find(g=>g.returnNumber===f);return!r||r.tracking.length===0?null:n(D,{slots:s,collapseThreshold:c,translations:e,returnData:r,routeTracking:m,routeProductDetails:d})}return!i||l!=null&&l.includes(o.CANCELED)?null:(V=i==null?void 0:i.shipments)!=null&&V.length?I&&!(p!=null&&p.length)&&S?null:u(v,{children:[(U=i==null?void 0:i.shipments)==null?void 0:U.map(({tracking:r,items:g,id:b},J)=>u(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingCardTitle}),r==null?void 0:r.map(h=>{var O;return u("div",{className:"order-shipping-status-card__header",role:"status",children:[u("div",{className:"order-shipping-status-card__header--content",children:[u("p",{children:[e.carrier," ",(O=h==null?void 0:h.carrier)==null?void 0:O.toLocaleUpperCase()," | ",h==null?void 0:h.number]}),n("p",{children:h==null?void 0:h.title})]}),s!=null&&s.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:s==null?void 0:s.DeliveryTrackActions,context:{trackInformation:h}}):null]},h.number)}),S?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":J+1,defaultOpen:c>=(g==null?void 0:g.length),title:n(v,{children:n(R,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:g==null?void 0:g.length,fields:{count:g==null?void 0:g.length}})}),children:n(B,{maxColumns:6,emptyGridContent:n(v,{}),className:"order-shipping-status-card__images",children:g==null?void 0:g.map(h=>{var H,j,F,q,W,z;const O=(F=(j=(H=h==null?void 0:h.orderItem)==null?void 0:H.product)==null?void 0:j.thumbnail)==null?void 0:F.label,K=(z=(W=(q=h==null?void 0:h.orderItem)==null?void 0:q.product)==null?void 0:W.thumbnail)==null?void 0:z.url;return n(t,{href:(d==null?void 0:d(h))??"#",children:n($,{alt:O,src:K||"",width:85,height:114})},h.id)})})})}),s!=null&&s.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:s==null?void 0:s.DeliveryTimeLine,context:{}}):null]},b)),p!=null&&p.length?u(N,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(_,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:c>=(p==null?void 0:p.length),title:n(R,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:p==null?void 0:p.length,fields:{count:p==null?void 0:p.length}}),children:n("div",{className:"order-shipping-status-card__images",children:p==null?void 0:p.map(r=>{var g,b;return n(t,{href:(d==null?void 0:d(r))??"#",children:n($,{alt:(g=r.thumbnail)==null?void 0:g.label,src:((b=r.thumbnail)==null?void 0:b.url)||"",width:85,height:114})},r.id)})})})})]}):null]}):u(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:u("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ui=({slots:e,className:s,collapseThreshold:i,orderData:c,routeOrderDetails:d,routeTracking:m,routeProductDetails:C})=>{const{loading:f,order:t,isVirtualProduct:l}=k({orderData:c}),a=Y({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"});return!f&&l?null:n("div",{className:L(["order-shipping-status",s]),children:!f&&t?n(ii,{translations:a,routeOrderDetails:d,routeTracking:m,slots:e,orderData:t,collapseThreshold:i,routeProductDetails:C}):n(P,{withCard:!1})})};export{ui as ShippingStatus,ui as default}; +import{jsxs as u,jsx as n,Fragment as b}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as y,Header as N,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as _,useEffect as Q}from"@dropins/tools/preact-hooks.js";import{events as X}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as G,useText as Y}from"@dropins/tools/i18n.js";import{C as P}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var o=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(o||{});const k=({orderData:e})=>{const[s,i]=_(!0),[g,d]=_(e),[m,C]=_(!1);return Q(()=>{const f=X.on("order/data",t=>{d(t),C(t==null?void 0:t.isVirtual),i(!1)},{eager:!0});return()=>{f==null||f.off()}},[]),{loading:s,order:g,isVirtualProduct:m}},D=({slots:e,collapseThreshold:s,translations:i,returnData:g,routeTracking:d,routeProductDetails:m})=>{var t;const C=Z(),f=m?"a":"span";return u(y,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(N,{title:i.returnOrderCardTitle}),u("div",{children:[(t=g==null?void 0:g.tracking)==null?void 0:t.map((l,a)=>{var S,I;return u("p",{children:[`${i.carrier} ${(I=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:I.toLocaleUpperCase()}: `,n("a",{href:`${(d==null?void 0:d(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${a}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:g.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:s>=g.items.length,title:n(G,{id:"Order.ShippingStatusCard.itemText",plural:g.items.length,fields:{count:g.items.length}}),children:n($,{maxColumns:C?3:9,emptyGridContent:n(b,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:g.items.map((l,a)=>{var p,T;const S=(p=l.thumbnail)==null?void 0:p.label,I=(T=l.thumbnail)==null?void 0:T.url;return n(f,{href:(m==null?void 0:m(l))??"#","data-testid":`${a}${l.uid}`,children:n(R,{alt:S,src:I,width:85,height:114})},`${a}${l.uid}`)})})})})]})]})},ii=({translations:e,slots:s,orderData:i,collapseThreshold:g=10,routeProductDetails:d,routeTracking:m})=>{var T,w,M,V,U,H;const C=!!(i!=null&&i.returnNumber),f=i==null?void 0:i.returnNumber,t=d?"a":"span",l=(T=i==null?void 0:i.status)==null?void 0:T.toLocaleLowerCase(),S=((w=i==null?void 0:i.shipments)==null?void 0:w.length)===1&&(l==null?void 0:l.includes(o.COMPLETE)),I=(M=i==null?void 0:i.shipments)==null?void 0:M.every(r=>r.tracking.length===0),p=(V=i==null?void 0:i.items)==null?void 0:V.filter(r=>(r==null?void 0:r.quantityShipped)===0);if(C&&(i!=null&&i.returns.length)){const r=i.returns.find(c=>c.returnNumber===f);return!r||r.tracking.length===0?null:n(D,{slots:s,collapseThreshold:g,translations:e,returnData:r,routeTracking:m,routeProductDetails:d})}return!i||l!=null&&l.includes(o.CANCELED)?null:(U=i==null?void 0:i.shipments)!=null&&U.length?I&&!(p!=null&&p.length)&&S?null:u(b,{children:[(H=i==null?void 0:i.shipments)==null?void 0:H.map(({tracking:r,items:c,id:O},J)=>u(y,{variant:"secondary",className:"order-shipping-status-card",children:[n(N,{title:e.shippingCardTitle}),r==null?void 0:r.map(h=>{var v;return u("div",{className:"order-shipping-status-card__header",role:"status",children:[u("div",{className:"order-shipping-status-card__header--content",children:[u("p",{children:[e.carrier," ",(v=h==null?void 0:h.carrier)==null?void 0:v.toLocaleUpperCase()," | ",h==null?void 0:h.number]}),n("p",{children:h==null?void 0:h.title})]}),s!=null&&s.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:s==null?void 0:s.DeliveryTrackActions,context:{trackInformation:h}}):null]},h.number)}),S?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":J+1,defaultOpen:g>=(c==null?void 0:c.length),title:n(b,{children:n(G,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:c==null?void 0:c.length,fields:{count:c==null?void 0:c.length}})}),children:n($,{maxColumns:6,emptyGridContent:n(b,{}),className:"order-shipping-status-card__images",children:c==null?void 0:c.map(h=>{var j,F,q,W,z,B;const v=(q=(F=(j=h==null?void 0:h.orderItem)==null?void 0:j.product)==null?void 0:F.thumbnail)==null?void 0:q.label,K=(B=(z=(W=h==null?void 0:h.orderItem)==null?void 0:W.product)==null?void 0:z.thumbnail)==null?void 0:B.url;return n(t,{href:(d==null?void 0:d(h))??"#",children:n(R,{alt:v,src:K||"",width:85,height:114})},h.id)})})})}),s!=null&&s.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:s==null?void 0:s.DeliveryTimeLine,context:{}}):null]},O)),p!=null&&p.length?u(y,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(N,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:g>=(p==null?void 0:p.length),title:n(G,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:p==null?void 0:p.length,fields:{count:p==null?void 0:p.length}}),children:n($,{maxColumns:6,emptyGridContent:n(b,{}),className:"order-shipping-status-card__images",children:p==null?void 0:p.map(r=>{var c,O;return n(t,{href:(d==null?void 0:d(r))??"#",children:n(R,{alt:(c=r.thumbnail)==null?void 0:c.label,src:((O=r.thumbnail)==null?void 0:O.url)||"",width:85,height:114})},r.id)})})})})]}):null]}):u(y,{variant:"secondary",className:"order-shipping-status-card",children:[n(N,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:u("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ui=({slots:e,className:s,collapseThreshold:i,orderData:g,routeOrderDetails:d,routeTracking:m,routeProductDetails:C})=>{const{loading:f,order:t,isVirtualProduct:l}=k({orderData:g}),a=Y({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"});return!f&&l?null:n("div",{className:L(["order-shipping-status",s]),children:!f&&t?n(ii,{translations:a,routeOrderDetails:d,routeTracking:m,slots:e,orderData:t,collapseThreshold:i,routeProductDetails:C}):n(P,{withCard:!1})})};export{ui as ShippingStatus,ui as default}; 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 33b8e3a511..01104caea2 100644 --- a/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts +++ b/scripts/__dropins__/storefront-order/i18n/en_US.json.d.ts @@ -14,14 +14,14 @@ declare const _default: { "message": "Note" }, "success": { - "title": "Success message", - "message": "Success message text goes here" + "title": "Return submitted", + "message": "Your return request has been successfully submitted." }, "buttons": { "nextStep": "Continue", "backStep": "Back", "submit": "Submit return", - "backStore": "Back to store" + "backStore": "Back to order" } }, "OrderCostSummary": { @@ -65,7 +65,7 @@ declare const _default: { "one": "item", "many": "items" }, - "resturnStatus": { + "returnStatus": { "pending": "Pending", "authorized": "Authorized", "partiallyAuthorized": "Partially authorized", @@ -95,7 +95,7 @@ declare const _default: { "one": "item", "many": "items" }, - "resturnStatus": { + "returnStatus": { "pending": "Pending", "authorized": "Authorized", "partiallyAuthorized": "Partially authorized", @@ -164,7 +164,7 @@ declare const _default: { "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}", - "resturnStatus": { + "returnStatus": { "pending": "Pending", "authorized": "Authorized", "partiallyAuthorized": "Partially authorized", diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 5a55676ebd..a99a06b2d2 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731320472669} \ No newline at end of file +{"at":1731321219047} \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/render.js b/scripts/__dropins__/storefront-order/render.js index b9f51a08d7..e6717910b4 100644 --- a/scripts/__dropins__/storefront-order/render.js +++ b/scripts/__dropins__/storefront-order/render.js @@ -1,2 +1,2 @@ -(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)}})('.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" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:65px;height:65px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}',{styleId:"order"}); -import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as s}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:",stockStatus:{inStock:"In stock",outOfStock:"Out of stock"},giftCard:{sender:"Sender",recipient:"Recipient",message:"Note"},success:{title:"Success message",message:"Success message text goes here"},buttons:{nextStep:"Continue",backStep:"Back",submit:"Submit return",backStore:"Back to store"}},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"},resturnStatus:{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"},resturnStatus:{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",postcode:"Zip Code",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}",resturnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."}},p={Order:u},m={default:p},h=({children:t})=>{const[o,i]=n("en_US");return d(()=>{const e=c.on("locale",a=>{i(a)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},k=new s(r(h,{}));export{k as render}; +(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)}})('.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" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}',{styleId:"order"}); +import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as n}from"@dropins/tools/lib.js";import{useState as s,useEffect as d}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as c}from"@dropins/tools/event-bus.js";const u={CreateReturn:{headerText:"Return items",downloadableCount:"Files",returnedItems:"Returned items:",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",postcode:"Zip Code",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},ShippingStatusCard:{orderNumber:"Order number:",returnNumber:"Return number:",itemText:{none:"",one:"Package contents ({{count}} item)",many:"Package contents ({{count}} items)"},trackButton:"Track package",carrier:"Carrier:",prepositionOf:"of",returnOrderCardTitle:"Package details",shippingCardTitle:"Package details",shippingInfoTitle:"Shipping information",notYetShippedTitle:"Not yet shipped",notYetShippedImagesTitle:{singular:"Package contents ({{count}} item)",plural:"Package contents ({{count}} items)"}},OrderStatusContent:{noInfoTitle:"Check back later for more details.",returnMessage:"The order was placed on {ORDER_CREATE_DATE} and your return process started on {RETURN_CREATE_DATE}",returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."}},p={Order:u},m={default:p},h=({children:t})=>{const[o,i]=s("en_US");return d(()=>{const e=c.on("locale",a=>{i(a)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},T=new n(r(h,{}));export{T as render}; diff --git a/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts b/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts index 112414f200..9454fae5bb 100644 --- a/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/createReturn.types.d.ts @@ -56,7 +56,8 @@ export interface ReturnReasonFormProps { } export interface ReturnOrderMessageProps { translations: Record; - routeReturnSuccess?: () => string; + routeReturnSuccess?: (orderData?: OrderDataModel) => string; + orderData?: OrderDataModel; } export interface UseCreateReturn { orderData?: OrderDataModel; From 6282addf94cf68650ba7683f6591ec3260297a8c Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 12:41:04 +0200 Subject: [PATCH 08/30] test 5 --- .../__dropins__/storefront-order/chunks/ReturnsListContent.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index b7e33df38f..8bcfbcfe9d 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1 +1 @@ -import{jsx as r,jsxs as s,Fragment as C}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as y}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as k}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as E,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const q=a=>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",...a},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"})))),L1=a=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},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"})),J=({typeList:a,isEmpty:M,minifiedView:Z,message:t})=>{const n=t1(()=>{switch(a){case"orders":return{icon:L1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[a,t]);return!M||!a||!n.text?null:r(R,{className:W(["order-empty-list",n.className,Z?"order-empty-list--minified":""]),message:n.text,icon:r(E,{source:n.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},_1=({minifiedViewKey:a,withReturnNumber:M=!1,withOrderNumber:Z=!1,slots:t,pageInfo:n,withReturnsListButton:w=!0,isMobile:x=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:_=!0,withThumbnails:$=!0,selectedPage:V=1,handleSetSelectPage:A,routeReturnDetails:d,routeOrderDetails:p,routeTracking:u,routeReturnsList:N,routeProductDetails:m,loading:f})=>{const B=h?X:i.length,S=m!=null&&m()?"a":"span",g=y(()=>i.slice(0,B).map((e,I)=>{var z,j;const H=((e==null?void 0:e.items)??[]).reduce((L,o)=>o.totalQuantity??0+L,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${a}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),M?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,Z?s("p",{children:[c.orderNumber," ",r("a",{href:(p==null?void 0:p({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(z=e==null?void 0:e.tracking)==null?void 0:z.map((L,o)=>{var v,b;return s("p",{children:[`${c.carrier} ${(b=(v=L==null?void 0:L.carrier)==null?void 0:v.label)==null?void 0:b.toLocaleUpperCase()}: `,r("a",{href:`${(u==null?void 0:u(L))||"#"}`,target:"_blank",rel:"noreferrer",children:L.trackingNumber})]},`${L.trackingNumber}_${o}`)}),t!=null&&t.ReturnItemsDetails?r(k,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[H," ",r(U,{id:`Order.Returns.${a}.returnsList.itemText`,plural:H,fields:{count:H}})]}):null]}),$?r(D,{maxColumns:x?3:9,emptyGridContent:r(C,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",x]]),children:(j=e==null?void 0:e.items)==null?void 0:j.map((L,o)=>{var F,G;const v=(F=L.thumbnail)==null?void 0:F.label,b=(G=L.thumbnail)==null?void 0:G.url;return r(S,{href:(m==null?void 0:m(L))??"#",children:r(r1,{alt:v,src:b,width:85,height:114})},o+L.uid)})}):null,t!=null&&t.DetailsActionParams?r(k,{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(E,{source:q,...T})})]})},I)}),[i,B,a,M,c,d,Z,p,t,$,x,m,u,S]),Y=y(()=>s(C,{children:[_?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,f?r(Q,{withCard:!1}):s(C,{children:[g,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),w?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(E,{source:q,...T})]})})}):null]})]}),[N,w,_,c,g,h,i.length,f]),K=y(()=>s(C,{children:[_?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,f?r(Q,{withCard:!1}):s(C,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),g,(n==null?void 0:n.totalPages)>1?r(e1,{totalPages:n==null?void 0:n.totalPages,currentPage:V,onChange:A}):null]})]}),[g,h,i,c,n==null?void 0:n.totalPages,V,A,f,_]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{_1 as R}; +import{jsx as r,jsxs as s,Fragment as C}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as y}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as k}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as E,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const q=a=>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",...a},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"})))),L1=a=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},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"})),J=({typeList:a,isEmpty:M,minifiedView:Z,message:t})=>{const n=t1(()=>{switch(a){case"orders":return{icon:L1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[a,t]);return!M||!a||!n.text?null:r(R,{className:W(["order-empty-list",n.className,Z?"order-empty-list--minified":""]),message:n.text,icon:r(E,{source:n.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},_1=({minifiedViewKey:a,withReturnNumber:M=!1,withOrderNumber:Z=!1,slots:t,pageInfo:n,withReturnsListButton:w=!0,isMobile:x=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:_=!0,withThumbnails:$=!0,selectedPage:V=1,handleSetSelectPage:A,routeReturnDetails:d,routeOrderDetails:p,routeTracking:u,routeReturnsList:N,routeProductDetails:m,loading:f})=>{const B=h?X:i.length,S=m!=null&&m()?"a":"span",g=y(()=>i.slice(0,B).map((e,I)=>{var z,j;const H=((e==null?void 0:e.items)??[]).reduce((L,o)=>o.totalQuantity??1+L,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${a}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),M?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,Z?s("p",{children:[c.orderNumber," ",r("a",{href:(p==null?void 0:p({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(z=e==null?void 0:e.tracking)==null?void 0:z.map((L,o)=>{var v,b;return s("p",{children:[`${c.carrier} ${(b=(v=L==null?void 0:L.carrier)==null?void 0:v.label)==null?void 0:b.toLocaleUpperCase()}: `,r("a",{href:`${(u==null?void 0:u(L))||"#"}`,target:"_blank",rel:"noreferrer",children:L.trackingNumber})]},`${L.trackingNumber}_${o}`)}),t!=null&&t.ReturnItemsDetails?r(k,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[H," ",r(U,{id:`Order.Returns.${a}.returnsList.itemText`,plural:H,fields:{count:H}})]}):null]}),$?r(D,{maxColumns:x?3:9,emptyGridContent:r(C,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",x]]),children:(j=e==null?void 0:e.items)==null?void 0:j.map((L,o)=>{var F,G;const v=(F=L.thumbnail)==null?void 0:F.label,b=(G=L.thumbnail)==null?void 0:G.url;return r(S,{href:(m==null?void 0:m(L))??"#",children:r(r1,{alt:v,src:b,width:85,height:114})},o+L.uid)})}):null,t!=null&&t.DetailsActionParams?r(k,{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(E,{source:q,...T})})]})},I)}),[i,B,a,M,c,d,Z,p,t,$,x,m,u,S]),Y=y(()=>s(C,{children:[_?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,f?r(Q,{withCard:!1}):s(C,{children:[g,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),w?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(E,{source:q,...T})]})})}):null]})]}),[N,w,_,c,g,h,i.length,f]),K=y(()=>s(C,{children:[_?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,f?r(Q,{withCard:!1}):s(C,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),g,(n==null?void 0:n.totalPages)>1?r(e1,{totalPages:n==null?void 0:n.totalPages,currentPage:V,onChange:A}):null]})]}),[g,h,i,c,n==null?void 0:n.totalPages,V,A,f,_]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{_1 as R}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index a99a06b2d2..d5743a6cb5 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731321219047} \ No newline at end of file +{"at":1731321613637} \ No newline at end of file From 6233f18330e37e73196167c70f3781f1a5e93a2c Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 12:53:21 +0200 Subject: [PATCH 09/30] test 6 --- .../__dropins__/storefront-order/chunks/ReturnsListContent.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index 8bcfbcfe9d..d3aac0d9b5 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1 +1 @@ -import{jsx as r,jsxs as s,Fragment as C}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as y}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as k}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as E,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const q=a=>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",...a},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"})))),L1=a=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},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"})),J=({typeList:a,isEmpty:M,minifiedView:Z,message:t})=>{const n=t1(()=>{switch(a){case"orders":return{icon:L1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[a,t]);return!M||!a||!n.text?null:r(R,{className:W(["order-empty-list",n.className,Z?"order-empty-list--minified":""]),message:n.text,icon:r(E,{source:n.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},_1=({minifiedViewKey:a,withReturnNumber:M=!1,withOrderNumber:Z=!1,slots:t,pageInfo:n,withReturnsListButton:w=!0,isMobile:x=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:_=!0,withThumbnails:$=!0,selectedPage:V=1,handleSetSelectPage:A,routeReturnDetails:d,routeOrderDetails:p,routeTracking:u,routeReturnsList:N,routeProductDetails:m,loading:f})=>{const B=h?X:i.length,S=m!=null&&m()?"a":"span",g=y(()=>i.slice(0,B).map((e,I)=>{var z,j;const H=((e==null?void 0:e.items)??[]).reduce((L,o)=>o.totalQuantity??1+L,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${a}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),M?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,Z?s("p",{children:[c.orderNumber," ",r("a",{href:(p==null?void 0:p({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(z=e==null?void 0:e.tracking)==null?void 0:z.map((L,o)=>{var v,b;return s("p",{children:[`${c.carrier} ${(b=(v=L==null?void 0:L.carrier)==null?void 0:v.label)==null?void 0:b.toLocaleUpperCase()}: `,r("a",{href:`${(u==null?void 0:u(L))||"#"}`,target:"_blank",rel:"noreferrer",children:L.trackingNumber})]},`${L.trackingNumber}_${o}`)}),t!=null&&t.ReturnItemsDetails?r(k,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[H," ",r(U,{id:`Order.Returns.${a}.returnsList.itemText`,plural:H,fields:{count:H}})]}):null]}),$?r(D,{maxColumns:x?3:9,emptyGridContent:r(C,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",x]]),children:(j=e==null?void 0:e.items)==null?void 0:j.map((L,o)=>{var F,G;const v=(F=L.thumbnail)==null?void 0:F.label,b=(G=L.thumbnail)==null?void 0:G.url;return r(S,{href:(m==null?void 0:m(L))??"#",children:r(r1,{alt:v,src:b,width:85,height:114})},o+L.uid)})}):null,t!=null&&t.DetailsActionParams?r(k,{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(E,{source:q,...T})})]})},I)}),[i,B,a,M,c,d,Z,p,t,$,x,m,u,S]),Y=y(()=>s(C,{children:[_?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,f?r(Q,{withCard:!1}):s(C,{children:[g,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),w?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(E,{source:q,...T})]})})}):null]})]}),[N,w,_,c,g,h,i.length,f]),K=y(()=>s(C,{children:[_?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,f?r(Q,{withCard:!1}):s(C,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),g,(n==null?void 0:n.totalPages)>1?r(e1,{totalPages:n==null?void 0:n.totalPages,currentPage:V,onChange:A}):null]})]}),[g,h,i,c,n==null?void 0:n.totalPages,V,A,f,_]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{_1 as R}; +import{jsx as r,jsxs as s,Fragment as C}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as y}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as P}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as E,Card as k,ContentGrid as D,Image as r1,Header as O,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as T}from"@dropins/tools/i18n.js";const U=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"})))),a1=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"})),q=({typeList:L,isEmpty:M,minifiedView:Z,message:t})=>{const n=t1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,t]);return!M||!L||!n.text?null:r(R,{className:W(["order-empty-list",n.className,Z?"order-empty-list--minified":""]),message:n.text,icon:r(E,{source:n.icon}),"data-testid":"emptyList"})},J={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:M=!1,withOrderNumber:Z=!1,slots:t,pageInfo:n,withReturnsListButton:w=!0,isMobile:H=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:o=!1,withHeader:u=!0,withThumbnails:V=!0,selectedPage:$=1,handleSetSelectPage:A,routeReturnDetails:d,routeOrderDetails:_,routeTracking:p,routeReturnsList:N,routeProductDetails:m,loading:f})=>{const B=o?X:i.length,S=m!=null&&m()?"a":"span",g=y(()=>i.slice(0,B).map((e,I)=>{var z,j;const v=((e==null?void 0:e.items)??[]).reduce((a,h)=>(h.totalQuantity??0)+a,0);return e.returnNumber==="000000104"&&console.log("headerTotalProductValue",v),r(k,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(T,{id:`Order.Returns.${L}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),M?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,Z?s("p",{children:[c.orderNumber," ",r("a",{href:(_==null?void 0:_({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(z=e==null?void 0:e.tracking)==null?void 0:z.map((a,h)=>{var b,x;return s("p",{children:[`${c.carrier} ${(x=(b=a==null?void 0:a.carrier)==null?void 0:b.label)==null?void 0:x.toLocaleUpperCase()}: `,r("a",{href:`${(p==null?void 0:p(a))||"#"}`,target:"_blank",rel:"noreferrer",children:a.trackingNumber})]},`${a.trackingNumber}_${h}`)}),t!=null&&t.ReturnItemsDetails?r(P,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[v," ",r(T,{id:`Order.Returns.${L}.returnsList.itemText`,plural:v,fields:{count:v}})]}):null]}),V?r(D,{maxColumns:H?3:9,emptyGridContent:r(C,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",H]]),children:(j=e==null?void 0:e.items)==null?void 0:j.map((a,h)=>{var F,G;const b=(F=a.thumbnail)==null?void 0:F.label,x=(G=a.thumbnail)==null?void 0:G.url;return r(S,{href:(m==null?void 0:m(a))??"#",children:r(r1,{alt:b,src:x,width:85,height:114})},h+a.uid)})}):null,t!=null&&t.DetailsActionParams?r(P,{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(E,{source:U,...J})})]})},I)}),[i,B,L,M,c,d,Z,_,t,V,H,m,p,S]),Y=y(()=>s(C,{children:[u?r(O,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,f?r(Q,{withCard:!1}):s(C,{children:[g,r(q,{minifiedView:o,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),w?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(k,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(E,{source:U,...J})]})})}):null]})]}),[N,w,u,c,g,o,i.length,f]),K=y(()=>s(C,{children:[u?r(O,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,f?r(Q,{withCard:!1}):s(C,{children:[r(q,{minifiedView:o,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),g,(n==null?void 0:n.totalPages)>1?r(e1,{totalPages:n==null?void 0:n.totalPages,currentPage:$,onChange:A}):null]})]}),[g,o,i,c,n==null?void 0:n.totalPages,$,A,f,u]);return r("div",{className:"order-returns-list-content",children:o?Y:K})};export{u1 as R}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index d5743a6cb5..c56adaa050 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731321613637} \ No newline at end of file +{"at":1731322332127} \ No newline at end of file From 26c52185558b21ddefc836c45f087cf4a6acc695 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 12:55:23 +0200 Subject: [PATCH 10/30] test 7 --- .../__dropins__/storefront-order/chunks/ReturnsListContent.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index d3aac0d9b5..afac95bd12 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1 +1 @@ -import{jsx as r,jsxs as s,Fragment as C}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as y}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as P}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as E,Card as k,ContentGrid as D,Image as r1,Header as O,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as T}from"@dropins/tools/i18n.js";const U=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"})))),a1=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"})),q=({typeList:L,isEmpty:M,minifiedView:Z,message:t})=>{const n=t1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,t]);return!M||!L||!n.text?null:r(R,{className:W(["order-empty-list",n.className,Z?"order-empty-list--minified":""]),message:n.text,icon:r(E,{source:n.icon}),"data-testid":"emptyList"})},J={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:M=!1,withOrderNumber:Z=!1,slots:t,pageInfo:n,withReturnsListButton:w=!0,isMobile:H=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:o=!1,withHeader:u=!0,withThumbnails:V=!0,selectedPage:$=1,handleSetSelectPage:A,routeReturnDetails:d,routeOrderDetails:_,routeTracking:p,routeReturnsList:N,routeProductDetails:m,loading:f})=>{const B=o?X:i.length,S=m!=null&&m()?"a":"span",g=y(()=>i.slice(0,B).map((e,I)=>{var z,j;const v=((e==null?void 0:e.items)??[]).reduce((a,h)=>(h.totalQuantity??0)+a,0);return e.returnNumber==="000000104"&&console.log("headerTotalProductValue",v),r(k,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(T,{id:`Order.Returns.${L}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),M?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,Z?s("p",{children:[c.orderNumber," ",r("a",{href:(_==null?void 0:_({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(z=e==null?void 0:e.tracking)==null?void 0:z.map((a,h)=>{var b,x;return s("p",{children:[`${c.carrier} ${(x=(b=a==null?void 0:a.carrier)==null?void 0:b.label)==null?void 0:x.toLocaleUpperCase()}: `,r("a",{href:`${(p==null?void 0:p(a))||"#"}`,target:"_blank",rel:"noreferrer",children:a.trackingNumber})]},`${a.trackingNumber}_${h}`)}),t!=null&&t.ReturnItemsDetails?r(P,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[v," ",r(T,{id:`Order.Returns.${L}.returnsList.itemText`,plural:v,fields:{count:v}})]}):null]}),V?r(D,{maxColumns:H?3:9,emptyGridContent:r(C,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",H]]),children:(j=e==null?void 0:e.items)==null?void 0:j.map((a,h)=>{var F,G;const b=(F=a.thumbnail)==null?void 0:F.label,x=(G=a.thumbnail)==null?void 0:G.url;return r(S,{href:(m==null?void 0:m(a))??"#",children:r(r1,{alt:b,src:x,width:85,height:114})},h+a.uid)})}):null,t!=null&&t.DetailsActionParams?r(P,{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(E,{source:U,...J})})]})},I)}),[i,B,L,M,c,d,Z,_,t,V,H,m,p,S]),Y=y(()=>s(C,{children:[u?r(O,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,f?r(Q,{withCard:!1}):s(C,{children:[g,r(q,{minifiedView:o,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),w?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(k,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(E,{source:U,...J})]})})}):null]})]}),[N,w,u,c,g,o,i.length,f]),K=y(()=>s(C,{children:[u?r(O,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,f?r(Q,{withCard:!1}):s(C,{children:[r(q,{minifiedView:o,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),g,(n==null?void 0:n.totalPages)>1?r(e1,{totalPages:n==null?void 0:n.totalPages,currentPage:$,onChange:A}):null]})]}),[g,o,i,c,n==null?void 0:n.totalPages,$,A,f,u]);return r("div",{className:"order-returns-list-content",children:o?Y:K})};export{u1 as R}; +import{jsx as r,jsxs as s,Fragment as C}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as y}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as k}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as E,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const q=a=>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",...a},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"})))),L1=a=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},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"})),J=({typeList:a,isEmpty:M,minifiedView:Z,message:t})=>{const n=t1(()=>{switch(a){case"orders":return{icon:L1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[a,t]);return!M||!a||!n.text?null:r(R,{className:W(["order-empty-list",n.className,Z?"order-empty-list--minified":""]),message:n.text,icon:r(E,{source:n.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},_1=({minifiedViewKey:a,withReturnNumber:M=!1,withOrderNumber:Z=!1,slots:t,pageInfo:n,withReturnsListButton:w=!0,isMobile:x=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:_=!0,withThumbnails:$=!0,selectedPage:V=1,handleSetSelectPage:A,routeReturnDetails:d,routeOrderDetails:p,routeTracking:u,routeReturnsList:N,routeProductDetails:m,loading:f})=>{const B=h?X:i.length,S=m!=null&&m()?"a":"span",g=y(()=>i.slice(0,B).map((e,I)=>{var z,j;const H=((e==null?void 0:e.items)??[]).reduce((L,o)=>(o.totalQuantity??0)+L,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${a}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),M?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,Z?s("p",{children:[c.orderNumber," ",r("a",{href:(p==null?void 0:p({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(z=e==null?void 0:e.tracking)==null?void 0:z.map((L,o)=>{var v,b;return s("p",{children:[`${c.carrier} ${(b=(v=L==null?void 0:L.carrier)==null?void 0:v.label)==null?void 0:b.toLocaleUpperCase()}: `,r("a",{href:`${(u==null?void 0:u(L))||"#"}`,target:"_blank",rel:"noreferrer",children:L.trackingNumber})]},`${L.trackingNumber}_${o}`)}),t!=null&&t.ReturnItemsDetails?r(k,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[H," ",r(U,{id:`Order.Returns.${a}.returnsList.itemText`,plural:H,fields:{count:H}})]}):null]}),$?r(D,{maxColumns:x?3:9,emptyGridContent:r(C,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",x]]),children:(j=e==null?void 0:e.items)==null?void 0:j.map((L,o)=>{var F,G;const v=(F=L.thumbnail)==null?void 0:F.label,b=(G=L.thumbnail)==null?void 0:G.url;return r(S,{href:(m==null?void 0:m(L))??"#",children:r(r1,{alt:v,src:b,width:85,height:114})},o+L.uid)})}):null,t!=null&&t.DetailsActionParams?r(k,{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(E,{source:q,...T})})]})},I)}),[i,B,a,M,c,d,Z,p,t,$,x,m,u,S]),Y=y(()=>s(C,{children:[_?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,f?r(Q,{withCard:!1}):s(C,{children:[g,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),w?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(E,{source:q,...T})]})})}):null]})]}),[N,w,_,c,g,h,i.length,f]),K=y(()=>s(C,{children:[_?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,f?r(Q,{withCard:!1}):s(C,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),g,(n==null?void 0:n.totalPages)>1?r(e1,{totalPages:n==null?void 0:n.totalPages,currentPage:V,onChange:A}):null]})]}),[g,h,i,c,n==null?void 0:n.totalPages,V,A,f,_]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{_1 as R}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index c56adaa050..9db3c6c16d 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731322332127} \ No newline at end of file +{"at":1731322480291} \ No newline at end of file From 0f7d94b9889536c131936c8c4c5442d34f84e745 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 14:33:49 +0200 Subject: [PATCH 11/30] test 8 --- .../__dropins__/storefront-order/containers/ShippingStatus.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index 62319ec21d..97eb7b082e 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1 +1 @@ -import{jsxs as u,jsx as n,Fragment as b}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as y,Header as N,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as _,useEffect as Q}from"@dropins/tools/preact-hooks.js";import{events as X}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as G,useText as Y}from"@dropins/tools/i18n.js";import{C as P}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var o=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(o||{});const k=({orderData:e})=>{const[s,i]=_(!0),[g,d]=_(e),[m,C]=_(!1);return Q(()=>{const f=X.on("order/data",t=>{d(t),C(t==null?void 0:t.isVirtual),i(!1)},{eager:!0});return()=>{f==null||f.off()}},[]),{loading:s,order:g,isVirtualProduct:m}},D=({slots:e,collapseThreshold:s,translations:i,returnData:g,routeTracking:d,routeProductDetails:m})=>{var t;const C=Z(),f=m?"a":"span";return u(y,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(N,{title:i.returnOrderCardTitle}),u("div",{children:[(t=g==null?void 0:g.tracking)==null?void 0:t.map((l,a)=>{var S,I;return u("p",{children:[`${i.carrier} ${(I=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:I.toLocaleUpperCase()}: `,n("a",{href:`${(d==null?void 0:d(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${a}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:g.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:s>=g.items.length,title:n(G,{id:"Order.ShippingStatusCard.itemText",plural:g.items.length,fields:{count:g.items.length}}),children:n($,{maxColumns:C?3:9,emptyGridContent:n(b,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:g.items.map((l,a)=>{var p,T;const S=(p=l.thumbnail)==null?void 0:p.label,I=(T=l.thumbnail)==null?void 0:T.url;return n(f,{href:(m==null?void 0:m(l))??"#","data-testid":`${a}${l.uid}`,children:n(R,{alt:S,src:I,width:85,height:114})},`${a}${l.uid}`)})})})})]})]})},ii=({translations:e,slots:s,orderData:i,collapseThreshold:g=10,routeProductDetails:d,routeTracking:m})=>{var T,w,M,V,U,H;const C=!!(i!=null&&i.returnNumber),f=i==null?void 0:i.returnNumber,t=d?"a":"span",l=(T=i==null?void 0:i.status)==null?void 0:T.toLocaleLowerCase(),S=((w=i==null?void 0:i.shipments)==null?void 0:w.length)===1&&(l==null?void 0:l.includes(o.COMPLETE)),I=(M=i==null?void 0:i.shipments)==null?void 0:M.every(r=>r.tracking.length===0),p=(V=i==null?void 0:i.items)==null?void 0:V.filter(r=>(r==null?void 0:r.quantityShipped)===0);if(C&&(i!=null&&i.returns.length)){const r=i.returns.find(c=>c.returnNumber===f);return!r||r.tracking.length===0?null:n(D,{slots:s,collapseThreshold:g,translations:e,returnData:r,routeTracking:m,routeProductDetails:d})}return!i||l!=null&&l.includes(o.CANCELED)?null:(U=i==null?void 0:i.shipments)!=null&&U.length?I&&!(p!=null&&p.length)&&S?null:u(b,{children:[(H=i==null?void 0:i.shipments)==null?void 0:H.map(({tracking:r,items:c,id:O},J)=>u(y,{variant:"secondary",className:"order-shipping-status-card",children:[n(N,{title:e.shippingCardTitle}),r==null?void 0:r.map(h=>{var v;return u("div",{className:"order-shipping-status-card__header",role:"status",children:[u("div",{className:"order-shipping-status-card__header--content",children:[u("p",{children:[e.carrier," ",(v=h==null?void 0:h.carrier)==null?void 0:v.toLocaleUpperCase()," | ",h==null?void 0:h.number]}),n("p",{children:h==null?void 0:h.title})]}),s!=null&&s.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:s==null?void 0:s.DeliveryTrackActions,context:{trackInformation:h}}):null]},h.number)}),S?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":J+1,defaultOpen:g>=(c==null?void 0:c.length),title:n(b,{children:n(G,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:c==null?void 0:c.length,fields:{count:c==null?void 0:c.length}})}),children:n($,{maxColumns:6,emptyGridContent:n(b,{}),className:"order-shipping-status-card__images",children:c==null?void 0:c.map(h=>{var j,F,q,W,z,B;const v=(q=(F=(j=h==null?void 0:h.orderItem)==null?void 0:j.product)==null?void 0:F.thumbnail)==null?void 0:q.label,K=(B=(z=(W=h==null?void 0:h.orderItem)==null?void 0:W.product)==null?void 0:z.thumbnail)==null?void 0:B.url;return n(t,{href:(d==null?void 0:d(h))??"#",children:n(R,{alt:v,src:K||"",width:85,height:114})},h.id)})})})}),s!=null&&s.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:s==null?void 0:s.DeliveryTimeLine,context:{}}):null]},O)),p!=null&&p.length?u(y,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(N,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:g>=(p==null?void 0:p.length),title:n(G,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:p==null?void 0:p.length,fields:{count:p==null?void 0:p.length}}),children:n($,{maxColumns:6,emptyGridContent:n(b,{}),className:"order-shipping-status-card__images",children:p==null?void 0:p.map(r=>{var c,O;return n(t,{href:(d==null?void 0:d(r))??"#",children:n(R,{alt:(c=r.thumbnail)==null?void 0:c.label,src:((O=r.thumbnail)==null?void 0:O.url)||"",width:85,height:114})},r.id)})})})})]}):null]}):u(y,{variant:"secondary",className:"order-shipping-status-card",children:[n(N,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:u("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ui=({slots:e,className:s,collapseThreshold:i,orderData:g,routeOrderDetails:d,routeTracking:m,routeProductDetails:C})=>{const{loading:f,order:t,isVirtualProduct:l}=k({orderData:g}),a=Y({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"});return!f&&l?null:n("div",{className:L(["order-shipping-status",s]),children:!f&&t?n(ii,{translations:a,routeOrderDetails:d,routeTracking:m,slots:e,orderData:t,collapseThreshold:i,routeProductDetails:C}):n(P,{withCard:!1})})};export{ui as ShippingStatus,ui as default}; +import{jsxs as f,jsx as n,Fragment as O}from"@dropins/tools/preact-jsx-runtime.js";import{classes as A,Slot as o}from"@dropins/tools/lib.js";import{Card as N,Header as _,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as L,useEffect as K}from"@dropins/tools/preact-hooks.js";import{events as X}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as G,useText as Y}from"@dropins/tools/i18n.js";import{C as P}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var w=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(w||{});const k=({orderData:e})=>{const[h,i]=L(!0),[d,t]=L(e),[C,S]=L(!1);return K(()=>{const a=X.on("order/data",g=>{t(g),S(g==null?void 0:g.isVirtual),i(!1)},{eager:!0});return()=>{a==null||a.off()}},[]),{loading:h,order:d,isVirtualProduct:C}},D=({slots:e,collapseThreshold:h,translations:i,returnData:d,routeTracking:t,routeProductDetails:C})=>{var u;const S=Z(),a=C?"a":"span",g=d.items.reduce((s,m)=>+(m==null?void 0:m.totalQuantity)+s,0);return f(N,{variant:"secondary",className:A(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(_,{title:i.returnOrderCardTitle}),f("div",{children:[(u=d==null?void 0:d.tracking)==null?void 0:u.map((s,m)=>{var I,l;return f("p",{children:[`${i.carrier} ${(l=(I=s==null?void 0:s.carrier)==null?void 0:I.label)==null?void 0:l.toLocaleUpperCase()}: `,n("a",{href:`${(t==null?void 0:t(s))??"#"}`,rel:"noreferrer",children:s.trackingNumber})]},`${s.trackingNumber}_${m}`)}),e!=null&&e.ReturnItemsDetails?n(o,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:d.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:h>=d.items.length,title:n(G,{id:"Order.ShippingStatusCard.itemText",plural:g,fields:{count:g}}),children:n($,{maxColumns:S?3:9,emptyGridContent:n(O,{}),className:A(["order-shipping-status-card__images",["order-shipping-status-card__images-3",S]]),children:d.items.map((s,m)=>{var T,b;const I=(T=s.thumbnail)==null?void 0:T.label,l=(b=s.thumbnail)==null?void 0:b.url;return n(a,{href:(C==null?void 0:C(s))??"#","data-testid":`${m}${s.uid}`,children:n(R,{alt:I,src:l,width:85,height:114})},`${m}${s.uid}`)})})})})]})]})},ii=({translations:e,slots:h,orderData:i,collapseThreshold:d=10,routeProductDetails:t,routeTracking:C})=>{var T,b,V,M,U,H;const S=!!(i!=null&&i.returnNumber),a=i==null?void 0:i.returnNumber,g=t?"a":"span",u=(T=i==null?void 0:i.status)==null?void 0:T.toLocaleLowerCase(),m=((b=i==null?void 0:i.shipments)==null?void 0:b.length)===1&&(u==null?void 0:u.includes(w.COMPLETE)),I=(V=i==null?void 0:i.shipments)==null?void 0:V.every(r=>r.tracking.length===0),l=(M=i==null?void 0:i.items)==null?void 0:M.filter(r=>(r==null?void 0:r.quantityShipped)===0);if(S&&(i!=null&&i.returns.length)){const r=i.returns.find(c=>c.returnNumber===a);return!r||r.tracking.length===0?null:n(D,{slots:h,collapseThreshold:d,translations:e,returnData:r,routeTracking:C,routeProductDetails:t})}return!i||u!=null&&u.includes(w.CANCELED)?null:(U=i==null?void 0:i.shipments)!=null&&U.length?I&&!(l!=null&&l.length)&&m?null:f(O,{children:[(H=i==null?void 0:i.shipments)==null?void 0:H.map(({tracking:r,items:c,id:v},B)=>f(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingCardTitle}),r==null?void 0:r.map(p=>{var y;return f("div",{className:"order-shipping-status-card__header",role:"status",children:[f("div",{className:"order-shipping-status-card__header--content",children:[f("p",{children:[e.carrier," ",(y=p==null?void 0:p.carrier)==null?void 0:y.toLocaleUpperCase()," | ",p==null?void 0:p.number]}),n("p",{children:p==null?void 0:p.title})]}),h!=null&&h.DeliveryTrackActions?n(o,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:h==null?void 0:h.DeliveryTrackActions,context:{trackInformation:p}}):null]},p.number)}),m?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":B+1,defaultOpen:d>=(c==null?void 0:c.length),title:n(O,{children:n(G,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:c==null?void 0:c.length,fields:{count:c==null?void 0:c.length}})}),children:n($,{maxColumns:6,emptyGridContent:n(O,{}),className:"order-shipping-status-card__images",children:c==null?void 0:c.map(p=>{var j,F,q,Q,W,z;const y=(q=(F=(j=p==null?void 0:p.orderItem)==null?void 0:j.product)==null?void 0:F.thumbnail)==null?void 0:q.label,J=(z=(W=(Q=p==null?void 0:p.orderItem)==null?void 0:Q.product)==null?void 0:W.thumbnail)==null?void 0:z.url;return n(g,{href:(t==null?void 0:t(p))??"#",children:n(R,{alt:y,src:J||"",width:85,height:114})},p.id)})})})}),h!=null&&h.DeliveryTimeLine?n(o,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:h==null?void 0:h.DeliveryTimeLine,context:{}}):null]},v)),l!=null&&l.length?f(N,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(_,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:d>=(l==null?void 0:l.length),title:n(G,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:l==null?void 0:l.length,fields:{count:l==null?void 0:l.length}}),children:n($,{maxColumns:6,emptyGridContent:n(O,{}),className:"order-shipping-status-card__images",children:l==null?void 0:l.map(r=>{var c,v;return n(g,{href:(t==null?void 0:t(r))??"#",children:n(R,{alt:(c=r.thumbnail)==null?void 0:c.label,src:((v=r.thumbnail)==null?void 0:v.url)||"",width:85,height:114})},r.id)})})})})]}):null]}):f(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:f("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ui=({slots:e,className:h,collapseThreshold:i,orderData:d,routeOrderDetails:t,routeTracking:C,routeProductDetails:S})=>{const{loading:a,order:g,isVirtualProduct:u}=k({orderData:d}),s=Y({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"});return!a&&u?null:n("div",{className:A(["order-shipping-status",h]),children:!a&&g?n(ii,{translations:s,routeOrderDetails:t,routeTracking:C,slots:e,orderData:g,collapseThreshold:i,routeProductDetails:S}):n(P,{withCard:!1})})};export{ui as ShippingStatus,ui as default}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 9db3c6c16d..41419966a9 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731322480291} \ No newline at end of file +{"at":1731328387545} \ No newline at end of file From 1cb674bf08b262c043aa64a550d5dc0ed754cbd3 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 14:50:36 +0200 Subject: [PATCH 12/30] test 9 --- .../__dropins__/storefront-order/containers/ShippingStatus.js | 2 +- .../__dropins__/storefront-order/data/models/order-details.d.ts | 2 +- .../__dropins__/storefront-order/lib/returnOrdersHelper.d.ts | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index 97eb7b082e..b401e8245d 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1 +1 @@ -import{jsxs as f,jsx as n,Fragment as O}from"@dropins/tools/preact-jsx-runtime.js";import{classes as A,Slot as o}from"@dropins/tools/lib.js";import{Card as N,Header as _,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as L,useEffect as K}from"@dropins/tools/preact-hooks.js";import{events as X}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as G,useText as Y}from"@dropins/tools/i18n.js";import{C as P}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var w=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(w||{});const k=({orderData:e})=>{const[h,i]=L(!0),[d,t]=L(e),[C,S]=L(!1);return K(()=>{const a=X.on("order/data",g=>{t(g),S(g==null?void 0:g.isVirtual),i(!1)},{eager:!0});return()=>{a==null||a.off()}},[]),{loading:h,order:d,isVirtualProduct:C}},D=({slots:e,collapseThreshold:h,translations:i,returnData:d,routeTracking:t,routeProductDetails:C})=>{var u;const S=Z(),a=C?"a":"span",g=d.items.reduce((s,m)=>+(m==null?void 0:m.totalQuantity)+s,0);return f(N,{variant:"secondary",className:A(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(_,{title:i.returnOrderCardTitle}),f("div",{children:[(u=d==null?void 0:d.tracking)==null?void 0:u.map((s,m)=>{var I,l;return f("p",{children:[`${i.carrier} ${(l=(I=s==null?void 0:s.carrier)==null?void 0:I.label)==null?void 0:l.toLocaleUpperCase()}: `,n("a",{href:`${(t==null?void 0:t(s))??"#"}`,rel:"noreferrer",children:s.trackingNumber})]},`${s.trackingNumber}_${m}`)}),e!=null&&e.ReturnItemsDetails?n(o,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:d.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:h>=d.items.length,title:n(G,{id:"Order.ShippingStatusCard.itemText",plural:g,fields:{count:g}}),children:n($,{maxColumns:S?3:9,emptyGridContent:n(O,{}),className:A(["order-shipping-status-card__images",["order-shipping-status-card__images-3",S]]),children:d.items.map((s,m)=>{var T,b;const I=(T=s.thumbnail)==null?void 0:T.label,l=(b=s.thumbnail)==null?void 0:b.url;return n(a,{href:(C==null?void 0:C(s))??"#","data-testid":`${m}${s.uid}`,children:n(R,{alt:I,src:l,width:85,height:114})},`${m}${s.uid}`)})})})})]})]})},ii=({translations:e,slots:h,orderData:i,collapseThreshold:d=10,routeProductDetails:t,routeTracking:C})=>{var T,b,V,M,U,H;const S=!!(i!=null&&i.returnNumber),a=i==null?void 0:i.returnNumber,g=t?"a":"span",u=(T=i==null?void 0:i.status)==null?void 0:T.toLocaleLowerCase(),m=((b=i==null?void 0:i.shipments)==null?void 0:b.length)===1&&(u==null?void 0:u.includes(w.COMPLETE)),I=(V=i==null?void 0:i.shipments)==null?void 0:V.every(r=>r.tracking.length===0),l=(M=i==null?void 0:i.items)==null?void 0:M.filter(r=>(r==null?void 0:r.quantityShipped)===0);if(S&&(i!=null&&i.returns.length)){const r=i.returns.find(c=>c.returnNumber===a);return!r||r.tracking.length===0?null:n(D,{slots:h,collapseThreshold:d,translations:e,returnData:r,routeTracking:C,routeProductDetails:t})}return!i||u!=null&&u.includes(w.CANCELED)?null:(U=i==null?void 0:i.shipments)!=null&&U.length?I&&!(l!=null&&l.length)&&m?null:f(O,{children:[(H=i==null?void 0:i.shipments)==null?void 0:H.map(({tracking:r,items:c,id:v},B)=>f(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingCardTitle}),r==null?void 0:r.map(p=>{var y;return f("div",{className:"order-shipping-status-card__header",role:"status",children:[f("div",{className:"order-shipping-status-card__header--content",children:[f("p",{children:[e.carrier," ",(y=p==null?void 0:p.carrier)==null?void 0:y.toLocaleUpperCase()," | ",p==null?void 0:p.number]}),n("p",{children:p==null?void 0:p.title})]}),h!=null&&h.DeliveryTrackActions?n(o,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:h==null?void 0:h.DeliveryTrackActions,context:{trackInformation:p}}):null]},p.number)}),m?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":B+1,defaultOpen:d>=(c==null?void 0:c.length),title:n(O,{children:n(G,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:c==null?void 0:c.length,fields:{count:c==null?void 0:c.length}})}),children:n($,{maxColumns:6,emptyGridContent:n(O,{}),className:"order-shipping-status-card__images",children:c==null?void 0:c.map(p=>{var j,F,q,Q,W,z;const y=(q=(F=(j=p==null?void 0:p.orderItem)==null?void 0:j.product)==null?void 0:F.thumbnail)==null?void 0:q.label,J=(z=(W=(Q=p==null?void 0:p.orderItem)==null?void 0:Q.product)==null?void 0:W.thumbnail)==null?void 0:z.url;return n(g,{href:(t==null?void 0:t(p))??"#",children:n(R,{alt:y,src:J||"",width:85,height:114})},p.id)})})})}),h!=null&&h.DeliveryTimeLine?n(o,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:h==null?void 0:h.DeliveryTimeLine,context:{}}):null]},v)),l!=null&&l.length?f(N,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(_,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:d>=(l==null?void 0:l.length),title:n(G,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:l==null?void 0:l.length,fields:{count:l==null?void 0:l.length}}),children:n($,{maxColumns:6,emptyGridContent:n(O,{}),className:"order-shipping-status-card__images",children:l==null?void 0:l.map(r=>{var c,v;return n(g,{href:(t==null?void 0:t(r))??"#",children:n(R,{alt:(c=r.thumbnail)==null?void 0:c.label,src:((v=r.thumbnail)==null?void 0:v.url)||"",width:85,height:114})},r.id)})})})})]}):null]}):f(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:f("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ui=({slots:e,className:h,collapseThreshold:i,orderData:d,routeOrderDetails:t,routeTracking:C,routeProductDetails:S})=>{const{loading:a,order:g,isVirtualProduct:u}=k({orderData:d}),s=Y({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"});return!a&&u?null:n("div",{className:A(["order-shipping-status",h]),children:!a&&g?n(ii,{translations:s,routeOrderDetails:t,routeTracking:C,slots:e,orderData:g,collapseThreshold:i,routeProductDetails:S}):n(P,{withCard:!1})})};export{ui as ShippingStatus,ui as default}; +import{jsxs as a,jsx as n,Fragment as O}from"@dropins/tools/preact-jsx-runtime.js";import{classes as A,Slot as L}from"@dropins/tools/lib.js";import{Card as N,Header as v,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as _,useEffect as X}from"@dropins/tools/preact-hooks.js";import{events as Y}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as G,useText as P}from"@dropins/tools/i18n.js";import{C as k}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var V=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(V||{});const D=({orderData:e})=>{const[r,i]=_(!0),[c,h]=_(e),[f,S]=_(!1);return X(()=>{const C=Y.on("order/data",u=>{h(u),S(u==null?void 0:u.isVirtual),i(!1)},{eager:!0});return()=>{C==null||C.off()}},[]),{loading:r,order:c,isVirtualProduct:f}},ii=({slots:e,collapseThreshold:r,translations:i,returnData:c,routeTracking:h,routeProductDetails:f})=>{var g;const S=Z(),C=f?"a":"span",u=c.items.reduce((s,m)=>+(m==null?void 0:m.totalQuantity)+s,0);return a(N,{variant:"secondary",className:A(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(v,{title:i.returnOrderCardTitle}),a("div",{children:[(g=c==null?void 0:c.tracking)==null?void 0:g.map((s,m)=>{var T,t;return a("p",{children:[`${i.carrier} ${(t=(T=s==null?void 0:s.carrier)==null?void 0:T.label)==null?void 0:t.toLocaleUpperCase()}: `,n("a",{href:`${(h==null?void 0:h(s))??"#"}`,rel:"noreferrer",children:s.trackingNumber})]},`${s.trackingNumber}_${m}`)}),e!=null&&e.ReturnItemsDetails?n(L,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:c.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:r>=c.items.length,title:n(G,{id:"Order.ShippingStatusCard.itemText",plural:u,fields:{count:u}}),children:n($,{maxColumns:S?3:9,emptyGridContent:n(O,{}),className:A(["order-shipping-status-card__images",["order-shipping-status-card__images-3",S]]),children:c.items.map((s,m)=>{var o,b;const T=(o=s.thumbnail)==null?void 0:o.label,t=(b=s.thumbnail)==null?void 0:b.url;return n(C,{href:(f==null?void 0:f(s))??"#","data-testid":`${m}${s.uid}`,children:n(R,{alt:T,src:t,width:85,height:114})},`${m}${s.uid}`)})})})})]})]})},ni=({translations:e,slots:r,orderData:i,collapseThreshold:c=10,routeProductDetails:h,routeTracking:f})=>{var o,b,w,M,Q,U;const S=!!(i!=null&&i.returnNumber),C=i==null?void 0:i.returnNumber,u=h?"a":"span",g=(o=i==null?void 0:i.status)==null?void 0:o.toLocaleLowerCase(),m=((b=i==null?void 0:i.shipments)==null?void 0:b.length)===1&&(g==null?void 0:g.includes(V.COMPLETE)),T=(w=i==null?void 0:i.shipments)==null?void 0:w.every(l=>l.tracking.length===0),t=(M=i==null?void 0:i.items)==null?void 0:M.filter(l=>(l==null?void 0:l.quantityShipped)===0);if(S&&(i!=null&&i.returns.length)){const l=i.returns.find(d=>d.returnNumber===C);return!l||l.tracking.length===0?null:n(ii,{slots:r,collapseThreshold:c,translations:e,returnData:l,routeTracking:f,routeProductDetails:h})}return!i||g!=null&&g.includes(V.CANCELED)?null:(Q=i==null?void 0:i.shipments)!=null&&Q.length?T&&!(t!=null&&t.length)&&m?null:a(O,{children:[(U=i==null?void 0:i.shipments)==null?void 0:U.map(({tracking:l,items:d,id:y},J)=>{const H=d.reduce((p,I)=>+(I==null?void 0:I.orderItem.totalQuantity)+p,0);return a(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingCardTitle}),l==null?void 0:l.map(p=>{var I;return a("div",{className:"order-shipping-status-card__header",role:"status",children:[a("div",{className:"order-shipping-status-card__header--content",children:[a("p",{children:[e.carrier," ",(I=p==null?void 0:p.carrier)==null?void 0:I.toLocaleUpperCase()," | ",p==null?void 0:p.number]}),n("p",{children:p==null?void 0:p.title})]}),r!=null&&r.DeliveryTrackActions?n(L,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:r==null?void 0:r.DeliveryTrackActions,context:{trackInformation:p}}):null]},p.number)}),m?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":J+1,defaultOpen:c>=(d==null?void 0:d.length),title:n(O,{children:n(G,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:H,fields:{count:H}})}),children:n($,{maxColumns:6,emptyGridContent:n(O,{}),className:"order-shipping-status-card__images",children:d==null?void 0:d.map(p=>{var j,F,q,W,z,B;const I=(q=(F=(j=p==null?void 0:p.orderItem)==null?void 0:j.product)==null?void 0:F.thumbnail)==null?void 0:q.label,K=(B=(z=(W=p==null?void 0:p.orderItem)==null?void 0:W.product)==null?void 0:z.thumbnail)==null?void 0:B.url;return n(u,{href:(h==null?void 0:h(p))??"#",children:n(R,{alt:I,src:K||"",width:85,height:114})},p.id)})})})}),r!=null&&r.DeliveryTimeLine?n(L,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:r==null?void 0:r.DeliveryTimeLine,context:{}}):null]},y)}),t!=null&&t.length?a(N,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(v,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:c>=(t==null?void 0:t.length),title:n(G,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:t.reduce((l,d)=>(l.totalQuantity??0)+ +d,0),fields:{count:t.reduce((l,d)=>(l.totalQuantity??0)+d,0)}}),children:n($,{maxColumns:6,emptyGridContent:n(O,{}),className:"order-shipping-status-card__images",children:t==null?void 0:t.map(l=>{var d,y;return n(u,{href:(h==null?void 0:h(l))??"#",children:n(R,{alt:(d=l.thumbnail)==null?void 0:d.label,src:((y=l.thumbnail)==null?void 0:y.url)||"",width:85,height:114})},l.id)})})})})]}):null]}):a(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:a("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},mi=({slots:e,className:r,collapseThreshold:i,orderData:c,routeOrderDetails:h,routeTracking:f,routeProductDetails:S})=>{const{loading:C,order:u,isVirtualProduct:g}=D({orderData:c}),s=P({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"});return!C&&g?null:n("div",{className:A(["order-shipping-status",r]),children:!C&&u?n(ni,{translations:s,routeOrderDetails:h,routeTracking:f,slots:e,orderData:u,collapseThreshold:i,routeProductDetails:S}):n(k,{withCard:!1})})};export{mi as ShippingStatus,mi as default}; diff --git a/scripts/__dropins__/storefront-order/data/models/order-details.d.ts b/scripts/__dropins__/storefront-order/data/models/order-details.d.ts index f308db8e17..d4a784fe70 100644 --- a/scripts/__dropins__/storefront-order/data/models/order-details.d.ts +++ b/scripts/__dropins__/storefront-order/data/models/order-details.d.ts @@ -51,7 +51,6 @@ export type OrderItemModel = { label: string; value: any; }>; - totalQuantity?: number; thumbnail?: { label: string; url: string; @@ -93,6 +92,7 @@ export type OrderItemModel = { quantityReturned: number; quantityShipped: number; requestQuantity: number; + totalQuantity: number; }; export type ShipmentItemsModel = { id: string; diff --git a/scripts/__dropins__/storefront-order/lib/returnOrdersHelper.d.ts b/scripts/__dropins__/storefront-order/lib/returnOrdersHelper.d.ts index f6b63670d0..8cc4606ee3 100644 --- a/scripts/__dropins__/storefront-order/lib/returnOrdersHelper.d.ts +++ b/scripts/__dropins__/storefront-order/lib/returnOrdersHelper.d.ts @@ -51,7 +51,6 @@ export declare const orderAdjustAndSortArray: (order: OrderDataModel) => { label: string; value: any; }[] | undefined; - totalQuantity?: number | undefined; thumbnail?: { label: string; url: string; @@ -91,6 +90,7 @@ export declare const orderAdjustAndSortArray: (order: OrderDataModel) => { quantityReturned: number; quantityShipped: number; requestQuantity: number; + totalQuantity: number; }[]; export declare const extractFilteredItems: (order: OrderDataModel) => { returnedList: any; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 41419966a9..c18c3c3667 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731328387545} \ No newline at end of file +{"at":1731329401582} \ No newline at end of file From 928c050f13fbff376e175c6b392f825a14bfb4b9 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 15:41:21 +0200 Subject: [PATCH 13/30] test 10 --- .../__dropins__/storefront-order/containers/ShippingStatus.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index b401e8245d..42c32b1fc6 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1 +1 @@ -import{jsxs as a,jsx as n,Fragment as O}from"@dropins/tools/preact-jsx-runtime.js";import{classes as A,Slot as L}from"@dropins/tools/lib.js";import{Card as N,Header as v,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as _,useEffect as X}from"@dropins/tools/preact-hooks.js";import{events as Y}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as G,useText as P}from"@dropins/tools/i18n.js";import{C as k}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var V=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(V||{});const D=({orderData:e})=>{const[r,i]=_(!0),[c,h]=_(e),[f,S]=_(!1);return X(()=>{const C=Y.on("order/data",u=>{h(u),S(u==null?void 0:u.isVirtual),i(!1)},{eager:!0});return()=>{C==null||C.off()}},[]),{loading:r,order:c,isVirtualProduct:f}},ii=({slots:e,collapseThreshold:r,translations:i,returnData:c,routeTracking:h,routeProductDetails:f})=>{var g;const S=Z(),C=f?"a":"span",u=c.items.reduce((s,m)=>+(m==null?void 0:m.totalQuantity)+s,0);return a(N,{variant:"secondary",className:A(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(v,{title:i.returnOrderCardTitle}),a("div",{children:[(g=c==null?void 0:c.tracking)==null?void 0:g.map((s,m)=>{var T,t;return a("p",{children:[`${i.carrier} ${(t=(T=s==null?void 0:s.carrier)==null?void 0:T.label)==null?void 0:t.toLocaleUpperCase()}: `,n("a",{href:`${(h==null?void 0:h(s))??"#"}`,rel:"noreferrer",children:s.trackingNumber})]},`${s.trackingNumber}_${m}`)}),e!=null&&e.ReturnItemsDetails?n(L,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:c.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:r>=c.items.length,title:n(G,{id:"Order.ShippingStatusCard.itemText",plural:u,fields:{count:u}}),children:n($,{maxColumns:S?3:9,emptyGridContent:n(O,{}),className:A(["order-shipping-status-card__images",["order-shipping-status-card__images-3",S]]),children:c.items.map((s,m)=>{var o,b;const T=(o=s.thumbnail)==null?void 0:o.label,t=(b=s.thumbnail)==null?void 0:b.url;return n(C,{href:(f==null?void 0:f(s))??"#","data-testid":`${m}${s.uid}`,children:n(R,{alt:T,src:t,width:85,height:114})},`${m}${s.uid}`)})})})})]})]})},ni=({translations:e,slots:r,orderData:i,collapseThreshold:c=10,routeProductDetails:h,routeTracking:f})=>{var o,b,w,M,Q,U;const S=!!(i!=null&&i.returnNumber),C=i==null?void 0:i.returnNumber,u=h?"a":"span",g=(o=i==null?void 0:i.status)==null?void 0:o.toLocaleLowerCase(),m=((b=i==null?void 0:i.shipments)==null?void 0:b.length)===1&&(g==null?void 0:g.includes(V.COMPLETE)),T=(w=i==null?void 0:i.shipments)==null?void 0:w.every(l=>l.tracking.length===0),t=(M=i==null?void 0:i.items)==null?void 0:M.filter(l=>(l==null?void 0:l.quantityShipped)===0);if(S&&(i!=null&&i.returns.length)){const l=i.returns.find(d=>d.returnNumber===C);return!l||l.tracking.length===0?null:n(ii,{slots:r,collapseThreshold:c,translations:e,returnData:l,routeTracking:f,routeProductDetails:h})}return!i||g!=null&&g.includes(V.CANCELED)?null:(Q=i==null?void 0:i.shipments)!=null&&Q.length?T&&!(t!=null&&t.length)&&m?null:a(O,{children:[(U=i==null?void 0:i.shipments)==null?void 0:U.map(({tracking:l,items:d,id:y},J)=>{const H=d.reduce((p,I)=>+(I==null?void 0:I.orderItem.totalQuantity)+p,0);return a(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingCardTitle}),l==null?void 0:l.map(p=>{var I;return a("div",{className:"order-shipping-status-card__header",role:"status",children:[a("div",{className:"order-shipping-status-card__header--content",children:[a("p",{children:[e.carrier," ",(I=p==null?void 0:p.carrier)==null?void 0:I.toLocaleUpperCase()," | ",p==null?void 0:p.number]}),n("p",{children:p==null?void 0:p.title})]}),r!=null&&r.DeliveryTrackActions?n(L,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:r==null?void 0:r.DeliveryTrackActions,context:{trackInformation:p}}):null]},p.number)}),m?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":J+1,defaultOpen:c>=(d==null?void 0:d.length),title:n(O,{children:n(G,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:H,fields:{count:H}})}),children:n($,{maxColumns:6,emptyGridContent:n(O,{}),className:"order-shipping-status-card__images",children:d==null?void 0:d.map(p=>{var j,F,q,W,z,B;const I=(q=(F=(j=p==null?void 0:p.orderItem)==null?void 0:j.product)==null?void 0:F.thumbnail)==null?void 0:q.label,K=(B=(z=(W=p==null?void 0:p.orderItem)==null?void 0:W.product)==null?void 0:z.thumbnail)==null?void 0:B.url;return n(u,{href:(h==null?void 0:h(p))??"#",children:n(R,{alt:I,src:K||"",width:85,height:114})},p.id)})})})}),r!=null&&r.DeliveryTimeLine?n(L,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:r==null?void 0:r.DeliveryTimeLine,context:{}}):null]},y)}),t!=null&&t.length?a(N,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(v,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:c>=(t==null?void 0:t.length),title:n(G,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:t.reduce((l,d)=>(l.totalQuantity??0)+ +d,0),fields:{count:t.reduce((l,d)=>(l.totalQuantity??0)+d,0)}}),children:n($,{maxColumns:6,emptyGridContent:n(O,{}),className:"order-shipping-status-card__images",children:t==null?void 0:t.map(l=>{var d,y;return n(u,{href:(h==null?void 0:h(l))??"#",children:n(R,{alt:(d=l.thumbnail)==null?void 0:d.label,src:((y=l.thumbnail)==null?void 0:y.url)||"",width:85,height:114})},l.id)})})})})]}):null]}):a(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:a("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},mi=({slots:e,className:r,collapseThreshold:i,orderData:c,routeOrderDetails:h,routeTracking:f,routeProductDetails:S})=>{const{loading:C,order:u,isVirtualProduct:g}=D({orderData:c}),s=P({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"});return!C&&g?null:n("div",{className:A(["order-shipping-status",r]),children:!C&&u?n(ni,{translations:s,routeOrderDetails:h,routeTracking:f,slots:e,orderData:u,collapseThreshold:i,routeProductDetails:S}):n(k,{withCard:!1})})};export{mi as ShippingStatus,mi as default}; +import{jsxs as m,jsx as n,Fragment as y}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as o,Header as v,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as _,useEffect as X}from"@dropins/tools/preact-hooks.js";import{events as Y}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as V,useText as P}from"@dropins/tools/i18n.js";import{C as k}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var G=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(G||{});const D=({orderData:e})=>{const[s,i]=_(!0),[t,c]=_(e),[a,C]=_(!1);return X(()=>{const f=Y.on("order/data",u=>{c(u),C(u==null?void 0:u.isVirtual),i(!1)},{eager:!0});return()=>{f==null||f.off()}},[]),{loading:s,order:t,isVirtualProduct:a}},ii=({slots:e,collapseThreshold:s,translations:i,returnData:t,routeTracking:c,routeProductDetails:a})=>{var u;const C=Z(),f=a?"a":"span";return m(o,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(v,{title:i.returnOrderCardTitle}),m("div",{children:[(u=t==null?void 0:t.tracking)==null?void 0:u.map((l,g)=>{var S,I;return m("p",{children:[`${i.carrier} ${(I=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:I.toLocaleUpperCase()}: `,n("a",{href:`${(c==null?void 0:c(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${g}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:t.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:s>=t.items.length,title:n(V,{id:"Order.ShippingStatusCard.itemText",plural:t.items.reduce((l,g)=>l+g.totalQuantity,0),fields:{count:t.items.reduce((l,g)=>l+g.totalQuantity,0)}}),children:n($,{maxColumns:C?3:9,emptyGridContent:n(y,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:t.items.map((l,g)=>{var h,b;const S=(h=l.thumbnail)==null?void 0:h.label,I=(b=l.thumbnail)==null?void 0:b.url;return n(f,{href:(a==null?void 0:a(l))??"#","data-testid":`${g}${l.uid}`,children:n(R,{alt:S,src:I,width:85,height:114})},`${g}${l.uid}`)})})})})]})]})},ni=({translations:e,slots:s,orderData:i,collapseThreshold:t=10,routeProductDetails:c,routeTracking:a})=>{var b,w,M,q,U,H;const C=!!(i!=null&&i.returnNumber),f=i==null?void 0:i.returnNumber,u=c?"a":"span",l=(b=i==null?void 0:i.status)==null?void 0:b.toLocaleLowerCase(),S=((w=i==null?void 0:i.shipments)==null?void 0:w.length)===1&&(l==null?void 0:l.includes(G.COMPLETE)),I=(M=i==null?void 0:i.shipments)==null?void 0:M.every(p=>p.tracking.length===0),h=(q=i==null?void 0:i.items)==null?void 0:q.filter(p=>(p==null?void 0:p.quantityShipped)===0);if(C&&(i!=null&&i.returns.length)){const p=i.returns.find(d=>d.returnNumber===f);return!p||p.tracking.length===0?null:n(ii,{slots:s,collapseThreshold:t,translations:e,returnData:p,routeTracking:a,routeProductDetails:c})}return!i||l!=null&&l.includes(G.CANCELED)?null:(U=i==null?void 0:i.shipments)!=null&&U.length?I&&!(h!=null&&h.length)&&S?null:m(y,{children:[(H=i==null?void 0:i.shipments)==null?void 0:H.map(({tracking:p,items:d,id:N},K)=>{const j=d.reduce((r,T)=>{var O;return(r??0)+(((O=T.orderItem)==null?void 0:O.quantityShipped)??0)},0);return m(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingCardTitle}),p==null?void 0:p.map(r=>{var T;return m("div",{className:"order-shipping-status-card__header",role:"status",children:[m("div",{className:"order-shipping-status-card__header--content",children:[m("p",{children:[e.carrier," ",(T=r==null?void 0:r.carrier)==null?void 0:T.toLocaleUpperCase()," | ",r==null?void 0:r.number]}),n("p",{children:r==null?void 0:r.title})]}),s!=null&&s.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:s==null?void 0:s.DeliveryTrackActions,context:{trackInformation:r}}):null]},r.number)}),S?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":K+1,defaultOpen:t>=(d==null?void 0:d.length),title:n(y,{children:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:j,fields:{count:j}})}),children:n($,{maxColumns:6,emptyGridContent:n(y,{}),className:"order-shipping-status-card__images",children:d==null?void 0:d.map(r=>{var O,Q,W,z,B,J;const T=(W=(Q=(O=r==null?void 0:r.orderItem)==null?void 0:O.product)==null?void 0:Q.thumbnail)==null?void 0:W.label,F=(J=(B=(z=r==null?void 0:r.orderItem)==null?void 0:z.product)==null?void 0:B.thumbnail)==null?void 0:J.url;return n(u,{href:(c==null?void 0:c(r))??"#",children:n(R,{alt:T,src:F||"",width:85,height:114})},r.id)})})})}),s!=null&&s.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:s==null?void 0:s.DeliveryTimeLine,context:{}}):null]},N)}),h!=null&&h.length?m(o,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(v,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:t>=(h==null?void 0:h.length),title:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:h.reduce((p,d)=>p+d.quantityShipped,0),fields:{count:h.reduce((p,d)=>p+d.quantityShipped,0)}}),children:n($,{maxColumns:6,emptyGridContent:n(y,{}),className:"order-shipping-status-card__images",children:h==null?void 0:h.map(p=>{var d,N;return n(u,{href:(c==null?void 0:c(p))??"#",children:n(R,{alt:(d=p.thumbnail)==null?void 0:d.label,src:((N=p.thumbnail)==null?void 0:N.url)||"",width:85,height:114})},p.id)})})})})]}):null]}):m(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:m("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},mi=({slots:e,className:s,collapseThreshold:i,orderData:t,routeOrderDetails:c,routeTracking:a,routeProductDetails:C})=>{const{loading:f,order:u,isVirtualProduct:l}=D({orderData:t}),g=P({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"});return!f&&l?null:n("div",{className:L(["order-shipping-status",s]),children:!f&&u?n(ni,{translations:g,routeOrderDetails:c,routeTracking:a,slots:e,orderData:u,collapseThreshold:i,routeProductDetails:C}):n(k,{withCard:!1})})};export{mi as ShippingStatus,mi as default}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index c18c3c3667..bacf4a523e 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731329401582} \ No newline at end of file +{"at":1731332333524} \ No newline at end of file From 30ad58c6a7e208e9113b2cde62f460669cf23d86 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 15:46:04 +0200 Subject: [PATCH 14/30] test 11 --- .../__dropins__/storefront-order/containers/ShippingStatus.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index 42c32b1fc6..cbb42d7f5b 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1 +1 @@ -import{jsxs as m,jsx as n,Fragment as y}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as o,Header as v,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as _,useEffect as X}from"@dropins/tools/preact-hooks.js";import{events as Y}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as V,useText as P}from"@dropins/tools/i18n.js";import{C as k}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var G=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(G||{});const D=({orderData:e})=>{const[s,i]=_(!0),[t,c]=_(e),[a,C]=_(!1);return X(()=>{const f=Y.on("order/data",u=>{c(u),C(u==null?void 0:u.isVirtual),i(!1)},{eager:!0});return()=>{f==null||f.off()}},[]),{loading:s,order:t,isVirtualProduct:a}},ii=({slots:e,collapseThreshold:s,translations:i,returnData:t,routeTracking:c,routeProductDetails:a})=>{var u;const C=Z(),f=a?"a":"span";return m(o,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(v,{title:i.returnOrderCardTitle}),m("div",{children:[(u=t==null?void 0:t.tracking)==null?void 0:u.map((l,g)=>{var S,I;return m("p",{children:[`${i.carrier} ${(I=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:I.toLocaleUpperCase()}: `,n("a",{href:`${(c==null?void 0:c(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${g}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:t.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:s>=t.items.length,title:n(V,{id:"Order.ShippingStatusCard.itemText",plural:t.items.reduce((l,g)=>l+g.totalQuantity,0),fields:{count:t.items.reduce((l,g)=>l+g.totalQuantity,0)}}),children:n($,{maxColumns:C?3:9,emptyGridContent:n(y,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:t.items.map((l,g)=>{var h,b;const S=(h=l.thumbnail)==null?void 0:h.label,I=(b=l.thumbnail)==null?void 0:b.url;return n(f,{href:(a==null?void 0:a(l))??"#","data-testid":`${g}${l.uid}`,children:n(R,{alt:S,src:I,width:85,height:114})},`${g}${l.uid}`)})})})})]})]})},ni=({translations:e,slots:s,orderData:i,collapseThreshold:t=10,routeProductDetails:c,routeTracking:a})=>{var b,w,M,q,U,H;const C=!!(i!=null&&i.returnNumber),f=i==null?void 0:i.returnNumber,u=c?"a":"span",l=(b=i==null?void 0:i.status)==null?void 0:b.toLocaleLowerCase(),S=((w=i==null?void 0:i.shipments)==null?void 0:w.length)===1&&(l==null?void 0:l.includes(G.COMPLETE)),I=(M=i==null?void 0:i.shipments)==null?void 0:M.every(p=>p.tracking.length===0),h=(q=i==null?void 0:i.items)==null?void 0:q.filter(p=>(p==null?void 0:p.quantityShipped)===0);if(C&&(i!=null&&i.returns.length)){const p=i.returns.find(d=>d.returnNumber===f);return!p||p.tracking.length===0?null:n(ii,{slots:s,collapseThreshold:t,translations:e,returnData:p,routeTracking:a,routeProductDetails:c})}return!i||l!=null&&l.includes(G.CANCELED)?null:(U=i==null?void 0:i.shipments)!=null&&U.length?I&&!(h!=null&&h.length)&&S?null:m(y,{children:[(H=i==null?void 0:i.shipments)==null?void 0:H.map(({tracking:p,items:d,id:N},K)=>{const j=d.reduce((r,T)=>{var O;return(r??0)+(((O=T.orderItem)==null?void 0:O.quantityShipped)??0)},0);return m(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingCardTitle}),p==null?void 0:p.map(r=>{var T;return m("div",{className:"order-shipping-status-card__header",role:"status",children:[m("div",{className:"order-shipping-status-card__header--content",children:[m("p",{children:[e.carrier," ",(T=r==null?void 0:r.carrier)==null?void 0:T.toLocaleUpperCase()," | ",r==null?void 0:r.number]}),n("p",{children:r==null?void 0:r.title})]}),s!=null&&s.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:s==null?void 0:s.DeliveryTrackActions,context:{trackInformation:r}}):null]},r.number)}),S?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":K+1,defaultOpen:t>=(d==null?void 0:d.length),title:n(y,{children:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:j,fields:{count:j}})}),children:n($,{maxColumns:6,emptyGridContent:n(y,{}),className:"order-shipping-status-card__images",children:d==null?void 0:d.map(r=>{var O,Q,W,z,B,J;const T=(W=(Q=(O=r==null?void 0:r.orderItem)==null?void 0:O.product)==null?void 0:Q.thumbnail)==null?void 0:W.label,F=(J=(B=(z=r==null?void 0:r.orderItem)==null?void 0:z.product)==null?void 0:B.thumbnail)==null?void 0:J.url;return n(u,{href:(c==null?void 0:c(r))??"#",children:n(R,{alt:T,src:F||"",width:85,height:114})},r.id)})})})}),s!=null&&s.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:s==null?void 0:s.DeliveryTimeLine,context:{}}):null]},N)}),h!=null&&h.length?m(o,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(v,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:t>=(h==null?void 0:h.length),title:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:h.reduce((p,d)=>p+d.quantityShipped,0),fields:{count:h.reduce((p,d)=>p+d.quantityShipped,0)}}),children:n($,{maxColumns:6,emptyGridContent:n(y,{}),className:"order-shipping-status-card__images",children:h==null?void 0:h.map(p=>{var d,N;return n(u,{href:(c==null?void 0:c(p))??"#",children:n(R,{alt:(d=p.thumbnail)==null?void 0:d.label,src:((N=p.thumbnail)==null?void 0:N.url)||"",width:85,height:114})},p.id)})})})})]}):null]}):m(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:m("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},mi=({slots:e,className:s,collapseThreshold:i,orderData:t,routeOrderDetails:c,routeTracking:a,routeProductDetails:C})=>{const{loading:f,order:u,isVirtualProduct:l}=D({orderData:t}),g=P({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"});return!f&&l?null:n("div",{className:L(["order-shipping-status",s]),children:!f&&u?n(ni,{translations:g,routeOrderDetails:c,routeTracking:a,slots:e,orderData:u,collapseThreshold:i,routeProductDetails:C}):n(k,{withCard:!1})})};export{mi as ShippingStatus,mi as default}; +import{jsxs as m,jsx as n,Fragment as b}from"@dropins/tools/preact-jsx-runtime.js";import{classes as v,Slot as A}from"@dropins/tools/lib.js";import{Card as o,Header as _,Accordion as q,AccordionSection as x,ContentGrid as E,Image as $}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as L,useEffect as X}from"@dropins/tools/preact-hooks.js";import{events as Y}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as R,useText as P}from"@dropins/tools/i18n.js";import{C as k}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var V=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(V||{});const D=({orderData:e})=>{const[d,i]=L(!0),[s,c]=L(e),[a,C]=L(!1);return X(()=>{const f=Y.on("order/data",u=>{c(u),C(u==null?void 0:u.isVirtual),i(!1)},{eager:!0});return()=>{f==null||f.off()}},[]),{loading:d,order:s,isVirtualProduct:a}},ii=({slots:e,collapseThreshold:d,translations:i,returnData:s,routeTracking:c,routeProductDetails:a})=>{var u;const C=Z(),f=a?"a":"span";return m(o,{variant:"secondary",className:v(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(_,{title:i.returnOrderCardTitle}),m("div",{children:[(u=s==null?void 0:s.tracking)==null?void 0:u.map((p,g)=>{var S,y;return m("p",{children:[`${i.carrier} ${(y=(S=p==null?void 0:p.carrier)==null?void 0:S.label)==null?void 0:y.toLocaleUpperCase()}: `,n("a",{href:`${(c==null?void 0:c(p))??"#"}`,rel:"noreferrer",children:p.trackingNumber})]},`${p.trackingNumber}_${g}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:s.items}}):null,n(q,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{defaultOpen:d>=s.items.length,title:n(R,{id:"Order.ShippingStatusCard.itemText",plural:s.items.reduce((p,g)=>p+g.totalQuantity,0),fields:{count:s.items.reduce((p,g)=>p+g.totalQuantity,0)}}),children:n(E,{maxColumns:C?3:9,emptyGridContent:n(b,{}),className:v(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:s.items.map((p,g)=>{var h,I;const S=(h=p.thumbnail)==null?void 0:h.label,y=(I=p.thumbnail)==null?void 0:I.url;return n(f,{href:(a==null?void 0:a(p))??"#","data-testid":`${g}${p.uid}`,children:n($,{alt:S,src:y,width:85,height:114})},`${g}${p.uid}`)})})})})]})]})},ni=({translations:e,slots:d,orderData:i,collapseThreshold:s=10,routeProductDetails:c,routeTracking:a})=>{var I,G,w,M,U,H;const C=!!(i!=null&&i.returnNumber),f=i==null?void 0:i.returnNumber,u=c?"a":"span",p=(I=i==null?void 0:i.status)==null?void 0:I.toLocaleLowerCase(),S=((G=i==null?void 0:i.shipments)==null?void 0:G.length)===1&&(p==null?void 0:p.includes(V.COMPLETE)),y=(w=i==null?void 0:i.shipments)==null?void 0:w.every(t=>t.tracking.length===0),h=(M=i==null?void 0:i.items)==null?void 0:M.filter(t=>(t==null?void 0:t.quantityShipped)===0);if(C&&(i!=null&&i.returns.length)){const t=i.returns.find(r=>r.returnNumber===f);return!t||t.tracking.length===0?null:n(ii,{slots:d,collapseThreshold:s,translations:e,returnData:t,routeTracking:a,routeProductDetails:c})}return!i||p!=null&&p.includes(V.CANCELED)?null:(U=i==null?void 0:i.shipments)!=null&&U.length?y&&!(h!=null&&h.length)&&S?null:m(b,{children:[(H=i==null?void 0:i.shipments)==null?void 0:H.map(({tracking:t,items:r,id:N},K)=>{const j=r.reduce((l,O)=>{var T;return(l??0)+(((T=O.orderItem)==null?void 0:T.quantityShipped)??0)},0);return m(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingCardTitle}),t==null?void 0:t.map(l=>{var O;return m("div",{className:"order-shipping-status-card__header",role:"status",children:[m("div",{className:"order-shipping-status-card__header--content",children:[m("p",{children:[e.carrier," ",(O=l==null?void 0:l.carrier)==null?void 0:O.toLocaleUpperCase()," | ",l==null?void 0:l.number]}),n("p",{children:l==null?void 0:l.title})]}),d!=null&&d.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:d==null?void 0:d.DeliveryTrackActions,context:{trackInformation:l}}):null]},l.number)}),S?null:n(q,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{"data-position":K+1,defaultOpen:s>=(r==null?void 0:r.length),title:n(b,{children:n(R,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:j,fields:{count:j}})}),children:n(E,{maxColumns:6,emptyGridContent:n(b,{}),className:"order-shipping-status-card__images",children:r==null?void 0:r.map(l=>{var T,Q,W,z,B,J;const O=(W=(Q=(T=l==null?void 0:l.orderItem)==null?void 0:T.product)==null?void 0:Q.thumbnail)==null?void 0:W.label,F=(J=(B=(z=l==null?void 0:l.orderItem)==null?void 0:z.product)==null?void 0:B.thumbnail)==null?void 0:J.url;return n(u,{href:(c==null?void 0:c(l))??"#",children:n($,{alt:O,src:F||"",width:85,height:114})},l.id)})})})}),d!=null&&d.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:d==null?void 0:d.DeliveryTimeLine,context:{}}):null]},N)}),h!=null&&h.length?m(o,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(_,{title:e.notYetShippedTitle}),n(q,{actionIconPosition:"right",children:n(x,{defaultOpen:s>=(h==null?void 0:h.length),title:n(R,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:h.reduce((t,r)=>t+(r.quantityOrdered-r.quantityShipped===0?r.quantityOrdered:r.quantityOrdered-r.quantityShipped),0),fields:{count:h.reduce((t,r)=>t+(r.quantityOrdered-r.quantityShipped===0?r.quantityOrdered:r.quantityOrdered-r.quantityShipped),0)}}),children:n(E,{maxColumns:6,emptyGridContent:n(b,{}),className:"order-shipping-status-card__images",children:h==null?void 0:h.map(t=>{var r,N;return n(u,{href:(c==null?void 0:c(t))??"#",children:n($,{alt:(r=t.thumbnail)==null?void 0:r.label,src:((N=t.thumbnail)==null?void 0:N.url)||"",width:85,height:114})},t.id)})})})})]}):null]}):m(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:m("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},mi=({slots:e,className:d,collapseThreshold:i,orderData:s,routeOrderDetails:c,routeTracking:a,routeProductDetails:C})=>{const{loading:f,order:u,isVirtualProduct:p}=D({orderData:s}),g=P({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"});return!f&&p?null:n("div",{className:v(["order-shipping-status",d]),children:!f&&u?n(ni,{translations:g,routeOrderDetails:c,routeTracking:a,slots:e,orderData:u,collapseThreshold:i,routeProductDetails:C}):n(k,{withCard:!1})})};export{mi as ShippingStatus,mi as default}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index bacf4a523e..3714d00aa9 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731332333524} \ No newline at end of file +{"at":1731332747117} \ No newline at end of file From d3d7d32539b1cbcd2721d867ecdce64c405756d1 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 15:49:58 +0200 Subject: [PATCH 15/30] test 12 --- .../__dropins__/storefront-order/containers/ShippingStatus.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index cbb42d7f5b..9e7c8726f6 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1 +1 @@ -import{jsxs as m,jsx as n,Fragment as b}from"@dropins/tools/preact-jsx-runtime.js";import{classes as v,Slot as A}from"@dropins/tools/lib.js";import{Card as o,Header as _,Accordion as q,AccordionSection as x,ContentGrid as E,Image as $}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as L,useEffect as X}from"@dropins/tools/preact-hooks.js";import{events as Y}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as R,useText as P}from"@dropins/tools/i18n.js";import{C as k}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var V=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(V||{});const D=({orderData:e})=>{const[d,i]=L(!0),[s,c]=L(e),[a,C]=L(!1);return X(()=>{const f=Y.on("order/data",u=>{c(u),C(u==null?void 0:u.isVirtual),i(!1)},{eager:!0});return()=>{f==null||f.off()}},[]),{loading:d,order:s,isVirtualProduct:a}},ii=({slots:e,collapseThreshold:d,translations:i,returnData:s,routeTracking:c,routeProductDetails:a})=>{var u;const C=Z(),f=a?"a":"span";return m(o,{variant:"secondary",className:v(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(_,{title:i.returnOrderCardTitle}),m("div",{children:[(u=s==null?void 0:s.tracking)==null?void 0:u.map((p,g)=>{var S,y;return m("p",{children:[`${i.carrier} ${(y=(S=p==null?void 0:p.carrier)==null?void 0:S.label)==null?void 0:y.toLocaleUpperCase()}: `,n("a",{href:`${(c==null?void 0:c(p))??"#"}`,rel:"noreferrer",children:p.trackingNumber})]},`${p.trackingNumber}_${g}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:s.items}}):null,n(q,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{defaultOpen:d>=s.items.length,title:n(R,{id:"Order.ShippingStatusCard.itemText",plural:s.items.reduce((p,g)=>p+g.totalQuantity,0),fields:{count:s.items.reduce((p,g)=>p+g.totalQuantity,0)}}),children:n(E,{maxColumns:C?3:9,emptyGridContent:n(b,{}),className:v(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:s.items.map((p,g)=>{var h,I;const S=(h=p.thumbnail)==null?void 0:h.label,y=(I=p.thumbnail)==null?void 0:I.url;return n(f,{href:(a==null?void 0:a(p))??"#","data-testid":`${g}${p.uid}`,children:n($,{alt:S,src:y,width:85,height:114})},`${g}${p.uid}`)})})})})]})]})},ni=({translations:e,slots:d,orderData:i,collapseThreshold:s=10,routeProductDetails:c,routeTracking:a})=>{var I,G,w,M,U,H;const C=!!(i!=null&&i.returnNumber),f=i==null?void 0:i.returnNumber,u=c?"a":"span",p=(I=i==null?void 0:i.status)==null?void 0:I.toLocaleLowerCase(),S=((G=i==null?void 0:i.shipments)==null?void 0:G.length)===1&&(p==null?void 0:p.includes(V.COMPLETE)),y=(w=i==null?void 0:i.shipments)==null?void 0:w.every(t=>t.tracking.length===0),h=(M=i==null?void 0:i.items)==null?void 0:M.filter(t=>(t==null?void 0:t.quantityShipped)===0);if(C&&(i!=null&&i.returns.length)){const t=i.returns.find(r=>r.returnNumber===f);return!t||t.tracking.length===0?null:n(ii,{slots:d,collapseThreshold:s,translations:e,returnData:t,routeTracking:a,routeProductDetails:c})}return!i||p!=null&&p.includes(V.CANCELED)?null:(U=i==null?void 0:i.shipments)!=null&&U.length?y&&!(h!=null&&h.length)&&S?null:m(b,{children:[(H=i==null?void 0:i.shipments)==null?void 0:H.map(({tracking:t,items:r,id:N},K)=>{const j=r.reduce((l,O)=>{var T;return(l??0)+(((T=O.orderItem)==null?void 0:T.quantityShipped)??0)},0);return m(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingCardTitle}),t==null?void 0:t.map(l=>{var O;return m("div",{className:"order-shipping-status-card__header",role:"status",children:[m("div",{className:"order-shipping-status-card__header--content",children:[m("p",{children:[e.carrier," ",(O=l==null?void 0:l.carrier)==null?void 0:O.toLocaleUpperCase()," | ",l==null?void 0:l.number]}),n("p",{children:l==null?void 0:l.title})]}),d!=null&&d.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:d==null?void 0:d.DeliveryTrackActions,context:{trackInformation:l}}):null]},l.number)}),S?null:n(q,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(x,{"data-position":K+1,defaultOpen:s>=(r==null?void 0:r.length),title:n(b,{children:n(R,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:j,fields:{count:j}})}),children:n(E,{maxColumns:6,emptyGridContent:n(b,{}),className:"order-shipping-status-card__images",children:r==null?void 0:r.map(l=>{var T,Q,W,z,B,J;const O=(W=(Q=(T=l==null?void 0:l.orderItem)==null?void 0:T.product)==null?void 0:Q.thumbnail)==null?void 0:W.label,F=(J=(B=(z=l==null?void 0:l.orderItem)==null?void 0:z.product)==null?void 0:B.thumbnail)==null?void 0:J.url;return n(u,{href:(c==null?void 0:c(l))??"#",children:n($,{alt:O,src:F||"",width:85,height:114})},l.id)})})})}),d!=null&&d.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:d==null?void 0:d.DeliveryTimeLine,context:{}}):null]},N)}),h!=null&&h.length?m(o,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(_,{title:e.notYetShippedTitle}),n(q,{actionIconPosition:"right",children:n(x,{defaultOpen:s>=(h==null?void 0:h.length),title:n(R,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:h.reduce((t,r)=>t+(r.quantityOrdered-r.quantityShipped===0?r.quantityOrdered:r.quantityOrdered-r.quantityShipped),0),fields:{count:h.reduce((t,r)=>t+(r.quantityOrdered-r.quantityShipped===0?r.quantityOrdered:r.quantityOrdered-r.quantityShipped),0)}}),children:n(E,{maxColumns:6,emptyGridContent:n(b,{}),className:"order-shipping-status-card__images",children:h==null?void 0:h.map(t=>{var r,N;return n(u,{href:(c==null?void 0:c(t))??"#",children:n($,{alt:(r=t.thumbnail)==null?void 0:r.label,src:((N=t.thumbnail)==null?void 0:N.url)||"",width:85,height:114})},t.id)})})})})]}):null]}):m(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(_,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:m("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},mi=({slots:e,className:d,collapseThreshold:i,orderData:s,routeOrderDetails:c,routeTracking:a,routeProductDetails:C})=>{const{loading:f,order:u,isVirtualProduct:p}=D({orderData:s}),g=P({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"});return!f&&p?null:n("div",{className:v(["order-shipping-status",d]),children:!f&&u?n(ni,{translations:g,routeOrderDetails:c,routeTracking:a,slots:e,orderData:u,collapseThreshold:i,routeProductDetails:C}):n(k,{withCard:!1})})};export{mi as ShippingStatus,mi as default}; +import{jsxs as m,jsx as n,Fragment as y}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as o,Header as v,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as _,useEffect as X}from"@dropins/tools/preact-hooks.js";import{events as Y}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as V,useText as P}from"@dropins/tools/i18n.js";import{C as k}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var G=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(G||{});const D=({orderData:e})=>{const[t,i]=_(!0),[c,d]=_(e),[a,C]=_(!1);return X(()=>{const f=Y.on("order/data",u=>{d(u),C(u==null?void 0:u.isVirtual),i(!1)},{eager:!0});return()=>{f==null||f.off()}},[]),{loading:t,order:c,isVirtualProduct:a}},ii=({slots:e,collapseThreshold:t,translations:i,returnData:c,routeTracking:d,routeProductDetails:a})=>{var u;const C=Z(),f=a?"a":"span";return m(o,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(v,{title:i.returnOrderCardTitle}),m("div",{children:[(u=c==null?void 0:c.tracking)==null?void 0:u.map((p,g)=>{var S,I;return m("p",{children:[`${i.carrier} ${(I=(S=p==null?void 0:p.carrier)==null?void 0:S.label)==null?void 0:I.toLocaleUpperCase()}: `,n("a",{href:`${(d==null?void 0:d(p))??"#"}`,rel:"noreferrer",children:p.trackingNumber})]},`${p.trackingNumber}_${g}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:c.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:t>=c.items.length,title:n(V,{id:"Order.ShippingStatusCard.itemText",plural:c.items.reduce((p,g)=>p+g.totalQuantity,0),fields:{count:c.items.reduce((p,g)=>p+g.totalQuantity,0)}}),children:n($,{maxColumns:C?3:9,emptyGridContent:n(y,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:c.items.map((p,g)=>{var h,O;const S=(h=p.thumbnail)==null?void 0:h.label,I=(O=p.thumbnail)==null?void 0:O.url;return n(f,{href:(a==null?void 0:a(p))??"#","data-testid":`${g}${p.uid}`,children:n(R,{alt:S,src:I,width:85,height:114})},`${g}${p.uid}`)})})})})]})]})},ni=({translations:e,slots:t,orderData:i,collapseThreshold:c=10,routeProductDetails:d,routeTracking:a})=>{var O,q,w,M,U,H;const C=!!(i!=null&&i.returnNumber),f=i==null?void 0:i.returnNumber,u=d?"a":"span",p=(O=i==null?void 0:i.status)==null?void 0:O.toLocaleLowerCase(),S=((q=i==null?void 0:i.shipments)==null?void 0:q.length)===1&&(p==null?void 0:p.includes(G.COMPLETE)),I=(w=i==null?void 0:i.shipments)==null?void 0:w.every(l=>l.tracking.length===0),h=(M=i==null?void 0:i.items)==null?void 0:M.filter(l=>(l==null?void 0:l.quantityShipped)===0);if(C&&(i!=null&&i.returns.length)){const l=i.returns.find(s=>s.returnNumber===f);return!l||l.tracking.length===0?null:n(ii,{slots:t,collapseThreshold:c,translations:e,returnData:l,routeTracking:a,routeProductDetails:d})}return!i||p!=null&&p.includes(G.CANCELED)?null:(U=i==null?void 0:i.shipments)!=null&&U.length?I&&!(h!=null&&h.length)&&S?null:m(y,{children:[(H=i==null?void 0:i.shipments)==null?void 0:H.map(({tracking:l,items:s,id:N},K)=>{const j=s.reduce((r,T)=>{var b;return(r??0)+(((b=T.orderItem)==null?void 0:b.quantityShipped)??0)},0);return m(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingCardTitle}),l==null?void 0:l.map(r=>{var T;return m("div",{className:"order-shipping-status-card__header",role:"status",children:[m("div",{className:"order-shipping-status-card__header--content",children:[m("p",{children:[e.carrier," ",(T=r==null?void 0:r.carrier)==null?void 0:T.toLocaleUpperCase()," | ",r==null?void 0:r.number]}),n("p",{children:r==null?void 0:r.title})]}),t!=null&&t.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:t==null?void 0:t.DeliveryTrackActions,context:{trackInformation:r}}):null]},r.number)}),S?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":K+1,defaultOpen:c>=(s==null?void 0:s.length),title:n(y,{children:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:j,fields:{count:j}})}),children:n($,{maxColumns:6,emptyGridContent:n(y,{}),className:"order-shipping-status-card__images",children:s==null?void 0:s.map(r=>{var b,Q,W,z,B,J;const T=(W=(Q=(b=r==null?void 0:r.orderItem)==null?void 0:b.product)==null?void 0:Q.thumbnail)==null?void 0:W.label,F=(J=(B=(z=r==null?void 0:r.orderItem)==null?void 0:z.product)==null?void 0:B.thumbnail)==null?void 0:J.url;return n(u,{href:(d==null?void 0:d(r))??"#",children:n(R,{alt:T,src:F||"",width:85,height:114})},r.id)})})})}),t!=null&&t.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:t==null?void 0:t.DeliveryTimeLine,context:{}}):null]},N)}),h!=null&&h.length?m(o,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(v,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:c>=(h==null?void 0:h.length),title:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:h.reduce((l,s)=>l+s.quantityShipped-s.quantityOrdered,0),fields:{count:h.reduce((l,s)=>l+s.quantityShipped-s.quantityOrdered,0)}}),children:n($,{maxColumns:6,emptyGridContent:n(y,{}),className:"order-shipping-status-card__images",children:h==null?void 0:h.map(l=>{var s,N;return n(u,{href:(d==null?void 0:d(l))??"#",children:n(R,{alt:(s=l.thumbnail)==null?void 0:s.label,src:((N=l.thumbnail)==null?void 0:N.url)||"",width:85,height:114})},l.id)})})})})]}):null]}):m(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:m("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},mi=({slots:e,className:t,collapseThreshold:i,orderData:c,routeOrderDetails:d,routeTracking:a,routeProductDetails:C})=>{const{loading:f,order:u,isVirtualProduct:p}=D({orderData:c}),g=P({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"});return!f&&p?null:n("div",{className:L(["order-shipping-status",t]),children:!f&&u?n(ni,{translations:g,routeOrderDetails:d,routeTracking:a,slots:e,orderData:u,collapseThreshold:i,routeProductDetails:C}):n(k,{withCard:!1})})};export{mi as ShippingStatus,mi as default}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 3714d00aa9..f6c6f60a6f 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731332747117} \ No newline at end of file +{"at":1731332971426} \ No newline at end of file From 3a7d24c1bc1310e968c17c8b12aeccb593d042b7 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 15:59:58 +0200 Subject: [PATCH 16/30] test 12 --- .../__dropins__/storefront-order/containers/ShippingStatus.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index 9e7c8726f6..1e5219baea 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1 +1 @@ -import{jsxs as m,jsx as n,Fragment as y}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as o,Header as v,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as _,useEffect as X}from"@dropins/tools/preact-hooks.js";import{events as Y}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as Z}from"../chunks/useIsMobile.js";import{Text as V,useText as P}from"@dropins/tools/i18n.js";import{C as k}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var G=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(G||{});const D=({orderData:e})=>{const[t,i]=_(!0),[c,d]=_(e),[a,C]=_(!1);return X(()=>{const f=Y.on("order/data",u=>{d(u),C(u==null?void 0:u.isVirtual),i(!1)},{eager:!0});return()=>{f==null||f.off()}},[]),{loading:t,order:c,isVirtualProduct:a}},ii=({slots:e,collapseThreshold:t,translations:i,returnData:c,routeTracking:d,routeProductDetails:a})=>{var u;const C=Z(),f=a?"a":"span";return m(o,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(v,{title:i.returnOrderCardTitle}),m("div",{children:[(u=c==null?void 0:c.tracking)==null?void 0:u.map((p,g)=>{var S,I;return m("p",{children:[`${i.carrier} ${(I=(S=p==null?void 0:p.carrier)==null?void 0:S.label)==null?void 0:I.toLocaleUpperCase()}: `,n("a",{href:`${(d==null?void 0:d(p))??"#"}`,rel:"noreferrer",children:p.trackingNumber})]},`${p.trackingNumber}_${g}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:c.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:t>=c.items.length,title:n(V,{id:"Order.ShippingStatusCard.itemText",plural:c.items.reduce((p,g)=>p+g.totalQuantity,0),fields:{count:c.items.reduce((p,g)=>p+g.totalQuantity,0)}}),children:n($,{maxColumns:C?3:9,emptyGridContent:n(y,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:c.items.map((p,g)=>{var h,O;const S=(h=p.thumbnail)==null?void 0:h.label,I=(O=p.thumbnail)==null?void 0:O.url;return n(f,{href:(a==null?void 0:a(p))??"#","data-testid":`${g}${p.uid}`,children:n(R,{alt:S,src:I,width:85,height:114})},`${g}${p.uid}`)})})})})]})]})},ni=({translations:e,slots:t,orderData:i,collapseThreshold:c=10,routeProductDetails:d,routeTracking:a})=>{var O,q,w,M,U,H;const C=!!(i!=null&&i.returnNumber),f=i==null?void 0:i.returnNumber,u=d?"a":"span",p=(O=i==null?void 0:i.status)==null?void 0:O.toLocaleLowerCase(),S=((q=i==null?void 0:i.shipments)==null?void 0:q.length)===1&&(p==null?void 0:p.includes(G.COMPLETE)),I=(w=i==null?void 0:i.shipments)==null?void 0:w.every(l=>l.tracking.length===0),h=(M=i==null?void 0:i.items)==null?void 0:M.filter(l=>(l==null?void 0:l.quantityShipped)===0);if(C&&(i!=null&&i.returns.length)){const l=i.returns.find(s=>s.returnNumber===f);return!l||l.tracking.length===0?null:n(ii,{slots:t,collapseThreshold:c,translations:e,returnData:l,routeTracking:a,routeProductDetails:d})}return!i||p!=null&&p.includes(G.CANCELED)?null:(U=i==null?void 0:i.shipments)!=null&&U.length?I&&!(h!=null&&h.length)&&S?null:m(y,{children:[(H=i==null?void 0:i.shipments)==null?void 0:H.map(({tracking:l,items:s,id:N},K)=>{const j=s.reduce((r,T)=>{var b;return(r??0)+(((b=T.orderItem)==null?void 0:b.quantityShipped)??0)},0);return m(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingCardTitle}),l==null?void 0:l.map(r=>{var T;return m("div",{className:"order-shipping-status-card__header",role:"status",children:[m("div",{className:"order-shipping-status-card__header--content",children:[m("p",{children:[e.carrier," ",(T=r==null?void 0:r.carrier)==null?void 0:T.toLocaleUpperCase()," | ",r==null?void 0:r.number]}),n("p",{children:r==null?void 0:r.title})]}),t!=null&&t.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:t==null?void 0:t.DeliveryTrackActions,context:{trackInformation:r}}):null]},r.number)}),S?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":K+1,defaultOpen:c>=(s==null?void 0:s.length),title:n(y,{children:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:j,fields:{count:j}})}),children:n($,{maxColumns:6,emptyGridContent:n(y,{}),className:"order-shipping-status-card__images",children:s==null?void 0:s.map(r=>{var b,Q,W,z,B,J;const T=(W=(Q=(b=r==null?void 0:r.orderItem)==null?void 0:b.product)==null?void 0:Q.thumbnail)==null?void 0:W.label,F=(J=(B=(z=r==null?void 0:r.orderItem)==null?void 0:z.product)==null?void 0:B.thumbnail)==null?void 0:J.url;return n(u,{href:(d==null?void 0:d(r))??"#",children:n(R,{alt:T,src:F||"",width:85,height:114})},r.id)})})})}),t!=null&&t.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:t==null?void 0:t.DeliveryTimeLine,context:{}}):null]},N)}),h!=null&&h.length?m(o,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(v,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:c>=(h==null?void 0:h.length),title:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:h.reduce((l,s)=>l+s.quantityShipped-s.quantityOrdered,0),fields:{count:h.reduce((l,s)=>l+s.quantityShipped-s.quantityOrdered,0)}}),children:n($,{maxColumns:6,emptyGridContent:n(y,{}),className:"order-shipping-status-card__images",children:h==null?void 0:h.map(l=>{var s,N;return n(u,{href:(d==null?void 0:d(l))??"#",children:n(R,{alt:(s=l.thumbnail)==null?void 0:s.label,src:((N=l.thumbnail)==null?void 0:N.url)||"",width:85,height:114})},l.id)})})})})]}):null]}):m(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:m("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},mi=({slots:e,className:t,collapseThreshold:i,orderData:c,routeOrderDetails:d,routeTracking:a,routeProductDetails:C})=>{const{loading:f,order:u,isVirtualProduct:p}=D({orderData:c}),g=P({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"});return!f&&p?null:n("div",{className:L(["order-shipping-status",t]),children:!f&&u?n(ni,{translations:g,routeOrderDetails:d,routeTracking:a,slots:e,orderData:u,collapseThreshold:i,routeProductDetails:C}):n(k,{withCard:!1})})};export{mi as ShippingStatus,mi as default}; +import{jsxs as m,jsx as n,Fragment as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as N,Header as v,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as _,useEffect as Z}from"@dropins/tools/preact-hooks.js";import{events as Y}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as P}from"../chunks/useIsMobile.js";import{Text as V,useText as k}from"@dropins/tools/i18n.js";import{C as D}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var G=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(G||{});const ii=({orderData:e})=>{const[s,i]=_(!0),[h,c]=_(e),[a,C]=_(!1);return Z(()=>{const f=Y.on("order/data",u=>{c(u),C(u==null?void 0:u.isVirtual),i(!1)},{eager:!0});return()=>{f==null||f.off()}},[]),{loading:s,order:h,isVirtualProduct:a}},ni=({slots:e,collapseThreshold:s,translations:i,returnData:h,routeTracking:c,routeProductDetails:a})=>{var u;const C=P(),f=a?"a":"span";return m(N,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(v,{title:i.returnOrderCardTitle}),m("div",{children:[(u=h==null?void 0:h.tracking)==null?void 0:u.map((l,g)=>{var S,T;return m("p",{children:[`${i.carrier} ${(T=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:T.toLocaleUpperCase()}: `,n("a",{href:`${(c==null?void 0:c(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${g}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:h.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:s>=h.items.length,title:n(V,{id:"Order.ShippingStatusCard.itemText",plural:h.items.reduce((l,g)=>l+g.totalQuantity,0),fields:{count:h.items.reduce((l,g)=>l+g.totalQuantity,0)}}),children:n($,{maxColumns:C?3:9,emptyGridContent:n(o,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:h.items.map((l,g)=>{var t,O;const S=(t=l.thumbnail)==null?void 0:t.label,T=(O=l.thumbnail)==null?void 0:O.url;return n(f,{href:(a==null?void 0:a(l))??"#","data-testid":`${g}${l.uid}`,children:n(R,{alt:S,src:T,width:85,height:114})},`${g}${l.uid}`)})})})})]})]})},ei=({translations:e,slots:s,orderData:i,collapseThreshold:h=10,routeProductDetails:c,routeTracking:a})=>{var w,M,q,U,H,j;const C=!!(i!=null&&i.returnNumber),f=i==null?void 0:i.returnNumber,u=c?"a":"span",l=(w=i==null?void 0:i.status)==null?void 0:w.toLocaleLowerCase(),S=((M=i==null?void 0:i.shipments)==null?void 0:M.length)===1&&(l==null?void 0:l.includes(G.COMPLETE)),T=(q=i==null?void 0:i.shipments)==null?void 0:q.every(r=>r.tracking.length===0),t=(U=i==null?void 0:i.items)==null?void 0:U.filter(r=>(r==null?void 0:r.quantityShipped)===0),O=t==null?void 0:t.reduce((r,d)=>{const I=d.quantityOrdered-d.quantityShipped;return r+(I>0?I:0)},0);if(C&&(i!=null&&i.returns.length)){const r=i.returns.find(d=>d.returnNumber===f);return!r||r.tracking.length===0?null:n(ni,{slots:s,collapseThreshold:h,translations:e,returnData:r,routeTracking:a,routeProductDetails:c})}return!i||l!=null&&l.includes(G.CANCELED)?null:(H=i==null?void 0:i.shipments)!=null&&H.length?T&&!(t!=null&&t.length)&&S?null:m(o,{children:[(j=i==null?void 0:i.shipments)==null?void 0:j.map(({tracking:r,items:d,id:I},X)=>{const F=d.reduce((p,b)=>{var y;return(p??0)+(((y=b.orderItem)==null?void 0:y.quantityShipped)??0)},0);return m(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingCardTitle}),r==null?void 0:r.map(p=>{var b;return m("div",{className:"order-shipping-status-card__header",role:"status",children:[m("div",{className:"order-shipping-status-card__header--content",children:[m("p",{children:[e.carrier," ",(b=p==null?void 0:p.carrier)==null?void 0:b.toLocaleUpperCase()," | ",p==null?void 0:p.number]}),n("p",{children:p==null?void 0:p.title})]}),s!=null&&s.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:s==null?void 0:s.DeliveryTrackActions,context:{trackInformation:p}}):null]},p.number)}),S?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":X+1,defaultOpen:h>=(d==null?void 0:d.length),title:n(o,{children:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:F,fields:{count:F}})}),children:n($,{maxColumns:6,emptyGridContent:n(o,{}),className:"order-shipping-status-card__images",children:d==null?void 0:d.map(p=>{var y,W,z,B,J,K;const b=(z=(W=(y=p==null?void 0:p.orderItem)==null?void 0:y.product)==null?void 0:W.thumbnail)==null?void 0:z.label,Q=(K=(J=(B=p==null?void 0:p.orderItem)==null?void 0:B.product)==null?void 0:J.thumbnail)==null?void 0:K.url;return n(u,{href:(c==null?void 0:c(p))??"#",children:n(R,{alt:b,src:Q||"",width:85,height:114})},p.id)})})})}),s!=null&&s.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:s==null?void 0:s.DeliveryTimeLine,context:{}}):null]},I)}),t!=null&&t.length?m(N,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(v,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:h>=(t==null?void 0:t.length),title:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:O,fields:{count:O}}),children:n($,{maxColumns:6,emptyGridContent:n(o,{}),className:"order-shipping-status-card__images",children:t==null?void 0:t.map(r=>{var d,I;return n(u,{href:(c==null?void 0:c(r))??"#",children:n(R,{alt:(d=r.thumbnail)==null?void 0:d.label,src:((I=r.thumbnail)==null?void 0:I.url)||"",width:85,height:114})},r.id)})})})})]}):null]}):m(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:m("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ai=({slots:e,className:s,collapseThreshold:i,orderData:h,routeOrderDetails:c,routeTracking:a,routeProductDetails:C})=>{const{loading:f,order:u,isVirtualProduct:l}=ii({orderData:h}),g=k({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"});return!f&&l?null:n("div",{className:L(["order-shipping-status",s]),children:!f&&u?n(ei,{translations:g,routeOrderDetails:c,routeTracking:a,slots:e,orderData:u,collapseThreshold:i,routeProductDetails:C}):n(D,{withCard:!1})})};export{ai as ShippingStatus,ai as default}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index f6c6f60a6f..bccfb79a93 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731332971426} \ No newline at end of file +{"at":1731333534941} \ No newline at end of file From e79279a20e829f58d862b3fd3eb2839a07363b80 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 11 Nov 2024 16:16:53 +0200 Subject: [PATCH 17/30] test 12 --- .../__dropins__/storefront-order/containers/ShippingStatus.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index 1e5219baea..34753a8978 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1 +1 @@ -import{jsxs as m,jsx as n,Fragment as o}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as N,Header as v,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as _,useEffect as Z}from"@dropins/tools/preact-hooks.js";import{events as Y}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as P}from"../chunks/useIsMobile.js";import{Text as V,useText as k}from"@dropins/tools/i18n.js";import{C as D}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var G=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(G||{});const ii=({orderData:e})=>{const[s,i]=_(!0),[h,c]=_(e),[a,C]=_(!1);return Z(()=>{const f=Y.on("order/data",u=>{c(u),C(u==null?void 0:u.isVirtual),i(!1)},{eager:!0});return()=>{f==null||f.off()}},[]),{loading:s,order:h,isVirtualProduct:a}},ni=({slots:e,collapseThreshold:s,translations:i,returnData:h,routeTracking:c,routeProductDetails:a})=>{var u;const C=P(),f=a?"a":"span";return m(N,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(v,{title:i.returnOrderCardTitle}),m("div",{children:[(u=h==null?void 0:h.tracking)==null?void 0:u.map((l,g)=>{var S,T;return m("p",{children:[`${i.carrier} ${(T=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:T.toLocaleUpperCase()}: `,n("a",{href:`${(c==null?void 0:c(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${g}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:h.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:s>=h.items.length,title:n(V,{id:"Order.ShippingStatusCard.itemText",plural:h.items.reduce((l,g)=>l+g.totalQuantity,0),fields:{count:h.items.reduce((l,g)=>l+g.totalQuantity,0)}}),children:n($,{maxColumns:C?3:9,emptyGridContent:n(o,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:h.items.map((l,g)=>{var t,O;const S=(t=l.thumbnail)==null?void 0:t.label,T=(O=l.thumbnail)==null?void 0:O.url;return n(f,{href:(a==null?void 0:a(l))??"#","data-testid":`${g}${l.uid}`,children:n(R,{alt:S,src:T,width:85,height:114})},`${g}${l.uid}`)})})})})]})]})},ei=({translations:e,slots:s,orderData:i,collapseThreshold:h=10,routeProductDetails:c,routeTracking:a})=>{var w,M,q,U,H,j;const C=!!(i!=null&&i.returnNumber),f=i==null?void 0:i.returnNumber,u=c?"a":"span",l=(w=i==null?void 0:i.status)==null?void 0:w.toLocaleLowerCase(),S=((M=i==null?void 0:i.shipments)==null?void 0:M.length)===1&&(l==null?void 0:l.includes(G.COMPLETE)),T=(q=i==null?void 0:i.shipments)==null?void 0:q.every(r=>r.tracking.length===0),t=(U=i==null?void 0:i.items)==null?void 0:U.filter(r=>(r==null?void 0:r.quantityShipped)===0),O=t==null?void 0:t.reduce((r,d)=>{const I=d.quantityOrdered-d.quantityShipped;return r+(I>0?I:0)},0);if(C&&(i!=null&&i.returns.length)){const r=i.returns.find(d=>d.returnNumber===f);return!r||r.tracking.length===0?null:n(ni,{slots:s,collapseThreshold:h,translations:e,returnData:r,routeTracking:a,routeProductDetails:c})}return!i||l!=null&&l.includes(G.CANCELED)?null:(H=i==null?void 0:i.shipments)!=null&&H.length?T&&!(t!=null&&t.length)&&S?null:m(o,{children:[(j=i==null?void 0:i.shipments)==null?void 0:j.map(({tracking:r,items:d,id:I},X)=>{const F=d.reduce((p,b)=>{var y;return(p??0)+(((y=b.orderItem)==null?void 0:y.quantityShipped)??0)},0);return m(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingCardTitle}),r==null?void 0:r.map(p=>{var b;return m("div",{className:"order-shipping-status-card__header",role:"status",children:[m("div",{className:"order-shipping-status-card__header--content",children:[m("p",{children:[e.carrier," ",(b=p==null?void 0:p.carrier)==null?void 0:b.toLocaleUpperCase()," | ",p==null?void 0:p.number]}),n("p",{children:p==null?void 0:p.title})]}),s!=null&&s.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:s==null?void 0:s.DeliveryTrackActions,context:{trackInformation:p}}):null]},p.number)}),S?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":X+1,defaultOpen:h>=(d==null?void 0:d.length),title:n(o,{children:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:F,fields:{count:F}})}),children:n($,{maxColumns:6,emptyGridContent:n(o,{}),className:"order-shipping-status-card__images",children:d==null?void 0:d.map(p=>{var y,W,z,B,J,K;const b=(z=(W=(y=p==null?void 0:p.orderItem)==null?void 0:y.product)==null?void 0:W.thumbnail)==null?void 0:z.label,Q=(K=(J=(B=p==null?void 0:p.orderItem)==null?void 0:B.product)==null?void 0:J.thumbnail)==null?void 0:K.url;return n(u,{href:(c==null?void 0:c(p))??"#",children:n(R,{alt:b,src:Q||"",width:85,height:114})},p.id)})})})}),s!=null&&s.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:s==null?void 0:s.DeliveryTimeLine,context:{}}):null]},I)}),t!=null&&t.length?m(N,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(v,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:h>=(t==null?void 0:t.length),title:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:O,fields:{count:O}}),children:n($,{maxColumns:6,emptyGridContent:n(o,{}),className:"order-shipping-status-card__images",children:t==null?void 0:t.map(r=>{var d,I;return n(u,{href:(c==null?void 0:c(r))??"#",children:n(R,{alt:(d=r.thumbnail)==null?void 0:d.label,src:((I=r.thumbnail)==null?void 0:I.url)||"",width:85,height:114})},r.id)})})})})]}):null]}):m(N,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:m("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ai=({slots:e,className:s,collapseThreshold:i,orderData:h,routeOrderDetails:c,routeTracking:a,routeProductDetails:C})=>{const{loading:f,order:u,isVirtualProduct:l}=ii({orderData:h}),g=k({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"});return!f&&l?null:n("div",{className:L(["order-shipping-status",s]),children:!f&&u?n(ei,{translations:g,routeOrderDetails:c,routeTracking:a,slots:e,orderData:u,collapseThreshold:i,routeProductDetails:C}):n(D,{withCard:!1})})};export{ai as ShippingStatus,ai as default}; +import{jsxs as g,jsx as n,Fragment as N}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as o,Header as v,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as _,useEffect as Z}from"@dropins/tools/preact-hooks.js";import{events as P}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as k}from"../chunks/useIsMobile.js";import{Text as V,useText as D}from"@dropins/tools/i18n.js";import{C as ii}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var G=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(G||{});const ni=({orderData:e})=>{const[t,i]=_(!0),[s,h]=_(e),[f,C]=_(!1);return Z(()=>{const a=P.on("order/data",u=>{h(u),C(u==null?void 0:u.isVirtual),i(!1)},{eager:!0});return()=>{a==null||a.off()}},[]),{loading:t,order:s,isVirtualProduct:f}},ei=({slots:e,collapseThreshold:t,translations:i,returnData:s,routeTracking:h,routeProductDetails:f})=>{var u;const C=k(),a=f?"a":"span";return g(o,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(v,{title:i.returnOrderCardTitle}),g("div",{children:[(u=s==null?void 0:s.tracking)==null?void 0:u.map((l,m)=>{var S,T;return g("p",{children:[`${i.carrier} ${(T=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:T.toLocaleUpperCase()}: `,n("a",{href:`${(h==null?void 0:h(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${m}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:s.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:t>=s.items.length,title:n(V,{id:"Order.ShippingStatusCard.itemText",plural:s.items.reduce((l,m)=>l+m.totalQuantity,0),fields:{count:s.items.reduce((l,m)=>l+m.totalQuantity,0)}}),children:n($,{maxColumns:C?3:9,emptyGridContent:n(N,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:s.items.map((l,m)=>{var c,b;const S=(c=l.thumbnail)==null?void 0:c.label,T=(b=l.thumbnail)==null?void 0:b.url;return n(a,{href:(f==null?void 0:f(l))??"#","data-testid":`${m}${l.uid}`,children:n(R,{alt:S,src:T,width:85,height:114})},`${m}${l.uid}`)})})})})]})]})},pi=({translations:e,slots:t,orderData:i,collapseThreshold:s=10,routeProductDetails:h,routeTracking:f})=>{var q,w,M,U,H,j,F;const C=!!(i!=null&&i.returnNumber),a=i==null?void 0:i.returnNumber,u=h?"a":"span",l=(q=i==null?void 0:i.status)==null?void 0:q.toLocaleLowerCase(),S=((w=i==null?void 0:i.shipments)==null?void 0:w.length)===1&&(l==null?void 0:l.includes(G.COMPLETE)),T=(M=i==null?void 0:i.shipments)==null?void 0:M.every(p=>p.tracking.length===0),c=(U=i==null?void 0:i.items)==null?void 0:U.filter(p=>(p==null?void 0:p.quantityShipped)===0||(p==null?void 0:p.quantityShipped)<(p==null?void 0:p.quantityOrdered)),b=(H=i==null?void 0:i.items)==null?void 0:H.reduce((p,d)=>{const I=d.quantityOrdered-d.quantityShipped;return p+(I>0?I:0)},0);if(C&&(i!=null&&i.returns.length)){const p=i.returns.find(d=>d.returnNumber===a);return!p||p.tracking.length===0?null:n(ei,{slots:t,collapseThreshold:s,translations:e,returnData:p,routeTracking:f,routeProductDetails:h})}return!i||l!=null&&l.includes(G.CANCELED)?null:(j=i==null?void 0:i.shipments)!=null&&j.length?T&&!(c!=null&&c.length)&&S?null:g(N,{children:[(F=i==null?void 0:i.shipments)==null?void 0:F.map(({tracking:p,items:d,id:I},X)=>{const Q=d.reduce((r,O)=>{var y;return(r??0)+(((y=O.orderItem)==null?void 0:y.quantityShipped)??0)},0);return g(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingCardTitle}),p==null?void 0:p.map(r=>{var O;return g("div",{className:"order-shipping-status-card__header",role:"status",children:[g("div",{className:"order-shipping-status-card__header--content",children:[g("p",{children:[e.carrier," ",(O=r==null?void 0:r.carrier)==null?void 0:O.toLocaleUpperCase()," | ",r==null?void 0:r.number]}),n("p",{children:r==null?void 0:r.title})]}),t!=null&&t.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:t==null?void 0:t.DeliveryTrackActions,context:{trackInformation:r}}):null]},r.number)}),S?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":X+1,defaultOpen:s>=(d==null?void 0:d.length),title:n(N,{children:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:Q,fields:{count:Q}})}),children:n($,{maxColumns:6,emptyGridContent:n(N,{}),className:"order-shipping-status-card__images",children:d==null?void 0:d.map(r=>{var y,Y,z,B,J,K;const O=(z=(Y=(y=r==null?void 0:r.orderItem)==null?void 0:y.product)==null?void 0:Y.thumbnail)==null?void 0:z.label,W=(K=(J=(B=r==null?void 0:r.orderItem)==null?void 0:B.product)==null?void 0:J.thumbnail)==null?void 0:K.url;return n(u,{href:(h==null?void 0:h(r))??"#",children:n(R,{alt:O,src:W||"",width:85,height:114})},r.id)})})})}),t!=null&&t.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:t==null?void 0:t.DeliveryTimeLine,context:{}}):null]},I)}),c!=null&&c.length?g(o,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(v,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:s>=(c==null?void 0:c.length),title:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:b,fields:{count:b}}),children:n($,{maxColumns:6,emptyGridContent:n(N,{}),className:"order-shipping-status-card__images",children:c==null?void 0:c.map(p=>{var d,I;return n(u,{href:(h==null?void 0:h(p))??"#",children:n(R,{alt:(d=p.thumbnail)==null?void 0:d.label,src:((I=p.thumbnail)==null?void 0:I.url)||"",width:85,height:114})},p.id)})})})})]}):null]}):g(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:g("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ai=({slots:e,className:t,collapseThreshold:i,orderData:s,routeOrderDetails:h,routeTracking:f,routeProductDetails:C})=>{const{loading:a,order:u,isVirtualProduct:l}=ni({orderData:s}),m=D({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"});return!a&&l?null:n("div",{className:L(["order-shipping-status",t]),children:!a&&u?n(pi,{translations:m,routeOrderDetails:h,routeTracking:f,slots:e,orderData:u,collapseThreshold:i,routeProductDetails:C}):n(ii,{withCard:!1})})};export{ai as ShippingStatus,ai as default}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index bccfb79a93..6f5d8c9854 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731333534941} \ No newline at end of file +{"at":1731334555601} \ No newline at end of file From 529008f7a2f428ff84121e9f8057f2d35b0db804 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 12 Nov 2024 20:12:18 +0200 Subject: [PATCH 18/30] test bug? 1 --- scripts/__dropins__/storefront-order/api.js | 14 +++++++------- .../getAttributesList/getAttributesList.d.ts | 3 +-- .../getOrderDetailsById.d.ts | 3 ++- .../api/requestReturn/graphql/fragments.d.ts | 2 ++ .../graphql/requestReturn.graphql.d.ts | 2 +- .../chunks/CartSummaryItem.js | 1 + .../storefront-order/chunks/OrderCancel.js | 2 +- .../chunks/ReturnsListContent.js | 2 +- .../chunks/getAttributesForm.js | 2 +- .../chunks/getGuestOrder.graphql.js | 1 + .../storefront-order/chunks/requestReturn.js | 19 ++++++++++++------- .../chunks/returnOrdersHelper.js | 2 +- .../chunks/transform-attributes-form.js | 2 +- .../containers/CreateReturn.js | 2 +- .../containers/OrderCancelForm.js | 2 +- .../containers/OrderProductList.js | 2 +- .../containers/ShippingStatus.js | 2 +- .../data/models/order-details.d.ts | 1 + .../transforms/transform-attributes-form.d.ts | 3 +-- scripts/__dropins__/storefront-order/reload | 2 +- .../__dropins__/storefront-order/render.js | 3 ++- .../types/api/getOrderDetails.types.d.ts | 8 ++++++++ .../types/returnsList.types.d.ts | 12 +++++++++--- .../types/shippingStatus.types.d.ts | 13 +++++++++---- 24 files changed, 67 insertions(+), 38 deletions(-) create mode 100644 scripts/__dropins__/storefront-order/api/requestReturn/graphql/fragments.d.ts create mode 100644 scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js diff --git a/scripts/__dropins__/storefront-order/api.js b/scripts/__dropins__/storefront-order/api.js index a86d37ce46..45f78abffa 100644 --- a/scripts/__dropins__/storefront-order/api.js +++ b/scripts/__dropins__/storefront-order/api.js @@ -1,5 +1,5 @@ -import{Initializer as I}from"@dropins/tools/lib.js";import{events as d}from"@dropins/tools/event-bus.js";import{f as n,h as m}from"./chunks/fetch-graphql.js";import{g as U,r as q,s as z,a as Y,b as Q}from"./chunks/fetch-graphql.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as _,G as p,O as c,B as O,R as D,c as b}from"./chunks/transform-order-details.js";import{O as h,A as R}from"./chunks/getGuestOrder.graphql.js";import{t as f}from"./chunks/getCustomer.js";import{g as K,a as j}from"./chunks/getCustomer.js";import{g as V}from"./chunks/getAttributesForm.js";import{g as X}from"./chunks/getStoreConfig.js";import{g as ee}from"./chunks/getCustomerOrdersReturn.js";import{g as te,r as ae}from"./chunks/requestReturn.js";import{c as de,r as oe}from"./chunks/requestGuestOrderCancel.js";import{r as ne}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";import"./chunks/transform-attributes-form.js";const G=` -query ORDER_BY_NUMBER($orderNumber: String!) { +import{Initializer as I}from"@dropins/tools/lib.js";import{events as o}from"@dropins/tools/event-bus.js";import{f as n,h as m}from"./chunks/fetch-graphql.js";import{g as U,r as Y,s as q,a as Q,b as H}from"./chunks/fetch-graphql.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as _,G as p,O as c,B as O,R as D,c as b}from"./chunks/transform-order-details.js";import{O as R,A as h}from"./chunks/getGuestOrder.graphql.js";import{t as T}from"./chunks/getCustomer.js";import{g as j,a as J}from"./chunks/getCustomer.js";import{g as W}from"./chunks/getAttributesForm.js";import{g as Z}from"./chunks/getStoreConfig.js";import{g as re}from"./chunks/getCustomerOrdersReturn.js";import{g as ae,r as se}from"./chunks/requestReturn.js";import{c as oe,r as ie}from"./chunks/requestGuestOrderCancel.js";import{r as me}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";import"./chunks/transform-attributes-form.js";const G=` +query ORDER_BY_NUMBER($orderNumber: String!, $pageSize: Int) { customer { orders( filter: { number: { eq: $orderNumber } } @@ -15,7 +15,7 @@ query ORDER_BY_NUMBER($orderNumber: String!) { carrier shipping_method is_virtual - returns(pageSize: 50) { + returns(pageSize: $pageSize) { ...OrderReturns } items_eligible_for_return { @@ -108,10 +108,10 @@ ${_} ${p} ${c} ${O} -${h} ${R} +${h} ${D} -`,T=async(e,r,t)=>await n(G,{method:"GET",cache:"force-cache",variables:{orderNumber:e}}).then(a=>{var s;return(s=a.errors)!=null&&s.length?m(a.errors):b(t??"orderData",a,r)}).catch(l),g=` +`,y=async({orderId:e,returnRef:r,queryType:t,returnsPageSize:a=50})=>await n(G,{method:"GET",cache:"force-cache",variables:{orderNumber:e,pageSize:a}}).then(s=>{var d;return(d=s.errors)!=null&&d.length?m(s.errors):b(t??"orderData",s,r)}).catch(l),f=` query ORDER_BY_TOKEN($token: String!) { guestOrderByToken(input: { token: $token }) { email @@ -205,7 +205,7 @@ ${_} ${p} ${c} ${O} -${h} ${R} +${h} ${D} -`,A=async(e,r)=>await n(g,{method:"GET",cache:"no-cache",variables:{token:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?m(t.errors):f(t,r)}).catch(l),y=async e=>{var i;const r=(e==null?void 0:e.orderRef)??"",t=(e==null?void 0:e.returnRef)??"",a=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((i=e==null?void 0:e.orderRef)==null?void 0:i.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){d.emit("order/data",{...s,returnNumber:t});return}if(!r){console.error("Order Token or number not received.");return}const o=a?await A(r,t):await T(r,t,"orderData");o?d.emit("order/data",{...o,returnNumber:t}):d.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},E=new I({init:async e=>{const r={};E.config.setConfig({...r,...e}),y(e).catch(console.error)},listeners:()=>[]}),v=E.config;export{de as cancelOrder,v as config,n as fetchGraphQl,V as getAttributesForm,te as getAttributesList,U as getConfig,K as getCustomer,ee as getCustomerOrdersReturn,j as getGuestOrder,T as getOrderDetailsById,X as getStoreConfig,A as guestOrderByToken,E as initialize,q as removeFetchGraphQlHeader,ne as reorderItems,oe as requestGuestOrderCancel,ae as requestReturn,z as setEndpoint,Y as setFetchGraphQlHeader,Q as setFetchGraphQlHeaders}; +`,$=async(e,r)=>await n(f,{method:"GET",cache:"no-cache",variables:{token:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?m(t.errors):T(t,r)}).catch(l),A="orderData",C=async e=>{var i;const r=typeof(e==null?void 0:e.orderRef)=="string"?e==null?void 0:e.orderRef:"",t=typeof(e==null?void 0:e.returnRef)=="string"?e==null?void 0:e.returnRef:"",a=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((i=e==null?void 0:e.orderRef)==null?void 0:i.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){o.emit("order/data",{...s,returnNumber:t});return}if(!r){console.error("Order Token or number not received.");return}const d=a?await $(r,t):await y({orderId:r,returnRef:t,queryType:A});d?o.emit("order/data",{...d,returnNumber:t}):o.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},E=new I({init:async e=>{const r={};E.config.setConfig({...r,...e}),C(e).catch(console.error)},listeners:()=>[]}),x=E.config;export{oe as cancelOrder,x as config,n as fetchGraphQl,W as getAttributesForm,ae as getAttributesList,U as getConfig,j as getCustomer,re as getCustomerOrdersReturn,J as getGuestOrder,y as getOrderDetailsById,Z as getStoreConfig,$ as guestOrderByToken,E as initialize,Y as removeFetchGraphQlHeader,me as reorderItems,ie as requestGuestOrderCancel,se as requestReturn,q as setEndpoint,Q as setFetchGraphQlHeader,H as setFetchGraphQlHeaders}; diff --git a/scripts/__dropins__/storefront-order/api/getAttributesList/getAttributesList.d.ts b/scripts/__dropins__/storefront-order/api/getAttributesList/getAttributesList.d.ts index d0a1d0bbec..eaf3e29ac2 100644 --- a/scripts/__dropins__/storefront-order/api/getAttributesList/getAttributesList.d.ts +++ b/scripts/__dropins__/storefront-order/api/getAttributesList/getAttributesList.d.ts @@ -1,5 +1,4 @@ import { AttributesFormModel } from '../../data/models'; -export declare const getAttributesList: (entityType: string) => Promise; +export declare const getAttributesList: (entityType: string) => Promise; //# sourceMappingURL=getAttributesList.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/getOrderDetailsById.d.ts b/scripts/__dropins__/storefront-order/api/getOrderDetailsById/getOrderDetailsById.d.ts index d06579bdaa..c9745a694c 100644 --- a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/getOrderDetailsById.d.ts +++ b/scripts/__dropins__/storefront-order/api/getOrderDetailsById/getOrderDetailsById.d.ts @@ -1,4 +1,5 @@ +import { GetOrderDetailsByIdProps } from '../../types'; import { TransformedData } from '../../data/models'; -export declare const getOrderDetailsById: (orderId?: string, returnRef?: string, queryType?: T | undefined) => Promise>; +export declare const getOrderDetailsById: ({ orderId, returnRef, queryType, returnsPageSize, }: GetOrderDetailsByIdProps) => Promise>; //# sourceMappingURL=getOrderDetailsById.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 new file mode 100644 index 0000000000..1a06f4fcf8 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/requestReturn/graphql/fragments.d.ts @@ -0,0 +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"; +//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts b/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts index e543a059fe..2053c33748 100644 --- a/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts +++ b/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts @@ -1,2 +1,2 @@ -export declare const REQUEST_RETURN_ORDER = "\nmutation REQUEST_RETURN_ORDER($input: RequestReturnInput!) {\n requestReturn(input: $input) {\n return {\n uid\n status\n number\n created_at\n }\n }\n}\n"; +export declare const REQUEST_RETURN_ORDER: string; //# sourceMappingURL=requestReturn.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js b/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js new file mode 100644 index 0000000000..85b40962e3 --- /dev/null +++ b/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js @@ -0,0 +1 @@ +import{jsx as t,jsxs as E,Fragment as w}from"@dropins/tools/preact-jsx-runtime.js";import{Price as u,CartItem as o,Icon as r,Image as U,Incrementer as c}from"@dropins/tools/components.js";import{useCallback as d}from"@dropins/tools/preact-hooks.js";import{classes as X}from"@dropins/tools/lib.js";import*as Q from"@dropins/tools/preact-compat.js";const p=N=>Q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...N},Q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),Q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),ne=({loading:N,product:e,itemType:Y,taxConfig:D,translations:v,disabledIncrementer:C,showConfigurableOptions:_,onQuantity:y,routeProductDetails:b,isReturnProductList:I})=>{var H,M,Z,j,q,x,z,F,O,R,W,$,B,K,A,G,J;const{taxExcluded:S,taxIncluded:f}=D,m=d((h,g,T)=>t(u,{amount:h,currency:g,weight:"normal",...T}),[]);let k={};const L=Y==="cancelled",P=(M=(H=e==null?void 0:e.product)==null?void 0:H.stockStatus)==null?void 0:M.includes("IN_STOCK"),a=(e==null?void 0:e.giftCard)||{},l=(Z=e==null?void 0:e.itemPrices)==null?void 0:Z.priceIncludingTax,s=(j=e==null?void 0:e.itemPrices)==null?void 0:j.originalPrice,n=(q=e==null?void 0:e.itemPrices)==null?void 0:q.price,i=e.discounted&&((x=e.price)==null?void 0:x.value)!==(s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),V={..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in a?{[v.sender]:a==null?void 0:a.senderName}:{},..."senderEmail"in a&&(a!=null&&a.senderEmail)?{[v.sender]:a==null?void 0:a.senderEmail}:{},..."recipientName"in a&&(a!=null&&a.recipientName)?{[v.recipient]:a==null?void 0:a.recipientName}:{},..."recipientEmail"in a&&(a!=null&&a.recipientEmail)?{[v.recipient]:a==null?void 0:a.recipientEmail}:{},..."message"in a&&(a!=null&&a.message)?{[v.message]:a==null?void 0:a.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(z=e==null?void 0:e.downloadableLinks)==null?void 0:z.count} ${v.downloadableCount}`]:(F=e==null?void 0:e.downloadableLinks)==null?void 0:F.result}:{}};if(f&&S){const h=i?s==null?void 0:s.value:(l==null?void 0:l.value)*(e==null?void 0:e.totalQuantity);k={taxExcluded:!0,taxIncluded:void 0,price:m(s==null?void 0:s.value,s==null?void 0:s.currency),total:E(w,{children:[m(h,s==null?void 0:s.currency,{variant:e.discounted&&(l==null?void 0:l.value)!==h?"strikethrough":"default"}),e.discounted&&(l==null?void 0:l.value)!==h?m(l==null?void 0:l.value,l==null?void 0:l.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:m((n==null?void 0:n.value)*e.totalQuantity,n==null?void 0:n.currency)}}else if(!f&&S)k={taxExcluded:void 0,taxIncluded:void 0,price:m(s==null?void 0:s.value,s==null?void 0:s.currency),total:E(w,{children:[m((s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),l==null?void 0:l.currency,{variant:i?"strikethrough":"default"}),i?m((O=e.price)==null?void 0:O.value,(R=e.price)==null?void 0:R.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:m((n==null?void 0:n.value)*(e==null?void 0:e.totalQuantity),n==null?void 0:n.currency)};else if(f&&!S){const h=i?s.value:l.value*e.totalQuantity;k={taxExcluded:void 0,taxIncluded:!0,price:m(l==null?void 0:l.value,l==null?void 0:l.currency),total:E(w,{children:[m(h,l==null?void 0:l.currency,{variant:i?"strikethrough":"default",weight:"bold"}),i?m(l==null?void 0:l.value,l==null?void 0:l.currency,{sale:!0,weight:"bold"}):null]})}}return t(o,{loading:N,alert:L&&P?E("span",{children:[t(r,{source:p}),v.outOfStock]}):t(w,{}),configurations:(_==null?void 0:_(V))??V,title:b?t("a",{"data-testid":"product-name",className:X(["cart-summary-item__title",["cart-summary-item__title--strikethrough",L]]),href:b(e),children:(W=e==null?void 0:e.product)==null?void 0:W.name}):t("div",{"data-testid":"product-name",className:X(["cart-summary-item__title",["cart-summary-item__title--strikethrough",L]]),children:($=e==null?void 0:e.product)==null?void 0:$.name}),sku:t("div",{children:(B=e==null?void 0:e.product)==null?void 0:B.sku}),quantity:e!=null&&e.eligibleForReturn&&(e!=null&&e.returnableQuantity)?(e==null?void 0:e.returnableQuantity)??e.totalQuantity:I?void 0:e.totalQuantity,image:b?t("a",{href:b(e),children:t(U,{src:(K=e==null?void 0:e.product)==null?void 0:K.thumbnail.url,alt:(A=e==null?void 0:e.product)==null?void 0:A.thumbnail.label,loading:"lazy",width:"90",height:"120"})}):t(U,{src:(G=e==null?void 0:e.product)==null?void 0:G.thumbnail.url,alt:(J=e==null?void 0:e.product)==null?void 0:J.thumbnail.label,loading:"lazy",width:"90",height:"120"}),...k,footer:y&&!C?t(c,{value:1,min:1,max:e==null?void 0:e.returnableQuantity,onValue:h=>y==null?void 0:y(Number(h)),name:"quantity"}):void 0})};export{ne as C,p as S}; diff --git a/scripts/__dropins__/storefront-order/chunks/OrderCancel.js b/scripts/__dropins__/storefront-order/chunks/OrderCancel.js index 81cb1bb280..1c5be143c9 100644 --- a/scripts/__dropins__/storefront-order/chunks/OrderCancel.js +++ b/scripts/__dropins__/storefront-order/chunks/OrderCancel.js @@ -1 +1 @@ -import{jsx as c,Fragment as F,jsxs as L}from"@dropins/tools/preact-jsx-runtime.js";import{Field as S,Picker as le,Input as ne,InputDate as te,Checkbox as g,TextArea as re,Price as se,CartItem as he,Icon as ue,Image as B,Incrementer as de,Button as ie}from"@dropins/tools/components.js";import"@dropins/tools/preact.js";import{useRef as ce,useState as T,useEffect as P,useCallback as R}from"@dropins/tools/preact-hooks.js";import{useText as be}from"@dropins/tools/i18n.js";import*as q from"@dropins/tools/preact-compat.js";import{memo as p,useCallback as x}from"@dropins/tools/preact-compat.js";import{classes as _,Slot as oe}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const $e=h=>q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...h},q.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"}),q.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"}),q.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"})),me=h=>q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...h},q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),Ee=h=>h.reduce((e,{code:v,required:m,defaultValue:d})=>(m&&(e[v]=d),e),{}),ve=({fieldsConfig:h,onSubmit:e})=>{const{requiredFieldError:v}=be({requiredFieldError:"Order.Form.notifications.requiredFieldError"}),m=ce(null),[d,o]=T({}),[$,u]=T({});P(()=>{if(o({}),!h||!h.length)return;const r=Ee(h);o(r)},[h==null?void 0:h.length]),P(()=>()=>{var r;o({}),(r=m.current)==null||r.reset()},[]);const E=R((r,a)=>{const t=h.find(l=>l.code===r);return t!=null&&t.required&&!a?v:""},[h,v]),f=R(r=>{const{name:a,value:t,type:i,checked:l}=r==null?void 0:r.target,n=i==="checkbox"?l:t;o(s=>({...s,[a]:n}))},[]),b=R(r=>{const{name:a,value:t,type:i,checked:l}=r==null?void 0:r.target,n=i==="checkbox"?l:t;u(s=>({...s,[a]:E(a,n)}))},[E]),y=R(r=>{r.preventDefault();let a=!0,t={},i=null;for(const[l,n]of Object.entries(d)){const s=E(l,n);s&&(t[l]=s,a=!1,i||(i=l))}if(u(t),i&&m.current){const l=m.current.elements.namedItem(i);l==null||l.focus()}e==null||e(r,a)},[d,E,e]);return{formData:d,errors:$,formRef:m,handleChange:f,handleBlur:b,handleSubmit:y}},ye=p(({loading:h,values:e,fields:v=[],errors:m,className:d="",onChange:o,onBlur:$})=>{const u=`${d}__item`,E=x((a,t,i)=>{const l=a.options.map(n=>({text:n.label,value:n.value}));return c(S,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:h,children:c(le,{name:a.id,floatingLabel:`${a.label} ${a.required?"*":""}`,placeholder:a.label,"aria-label":a.label,options:l,onBlur:$,handleSelect:o,value:t||a.defaultValue})},a.id)},[d,h,u,$,o]),f=x((a,t,i)=>{const l=a.id==="email",n=l?c($e,{}):void 0,s=l?"username":"";return c(S,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a==null?void 0:a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:h,children:c(ne,{"aria-label":a.label,"aria-required":a.required,autoComplete:s,icon:n,type:"text",name:a.id,value:t||a.defaultValue,placeholder:a.label,floatingLabel:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:o})},a.id)},[d,h,u,$,o]),b=x((a,t,i)=>c(S,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:h,children:c(te,{type:"text",name:a.id,value:t||a.defaultValue,placeholder:a.label,floatingLabel:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:o})},a.id),[d,h,u,$,o]),y=x((a,t,i)=>c(S,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:h,children:c(g,{name:a.id,checked:t||a.defaultValue,placeholder:a.label,label:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:o})},a.id),[d,h,u,$,o]),r=x((a,t,i)=>c(S,{error:i,className:_([u,`${u}--${a.id}`,[`${u}--${a.id}-hidden`,a.is_hidden],a.className]),"data-testid":`${d}--${a.id}`,disabled:h,children:c(re,{type:"text",name:a.id,value:t===void 0?a.defaultValue:t,label:`${a.label} ${a.required?"*":""}`,onBlur:$,onChange:o})},a.id),[d,h,u,$,o]);return v.length?c(F,{children:v.map(a=>{var l;const t=(m==null?void 0:m[a.id])??"",i=(e==null?void 0:e[a.id])??"";switch(a.fieldType){case"TEXT":return(l=a==null?void 0:a.options)!=null&&l.length?E(a,i,t):f(a,i,t);case"MULTILINE":return f(a,i,t);case"SELECT":return E(a,i,t);case"DATE":return b(a,i,t);case"BOOLEAN":return y(a,i,t);case"TEXTAREA":return r(a,i,t);default:return null}})}):null}),Fe=p(({name:h,loading:e,children:v,className:m="defaultForm",fieldsConfig:d,onSubmit:o})=>{const{formData:$,errors:u,formRef:E,handleChange:f,handleBlur:b,handleSubmit:y}=ve({fieldsConfig:d,onSubmit:o});return L("form",{className:_(["order-form",m]),onSubmit:y,name:h,ref:E,children:[c(ye,{className:m,loading:e,fields:d,onChange:f,onBlur:b,errors:u,values:$}),v]})}),ke=({loading:h,product:e,itemType:v,taxConfig:m,translations:d,disabledIncrementer:o,showConfigurableOptions:$,onQuantity:u,routeProductDetails:E,isReturnProductList:f})=>{var Q,M,D,A,H,Z,z,j,C,U,W,X,I,K,G,J,Y;const{taxExcluded:b,taxIncluded:y}=m,r=R((w,ee,ae)=>c(se,{amount:w,currency:ee,weight:"normal",...ae}),[]);let a={};const t=v==="cancelled",i=(M=(Q=e==null?void 0:e.product)==null?void 0:Q.stockStatus)==null?void 0:M.includes("IN_STOCK"),l=(e==null?void 0:e.giftCard)||{},n=(D=e==null?void 0:e.itemPrices)==null?void 0:D.priceIncludingTax,s=(A=e==null?void 0:e.itemPrices)==null?void 0:A.originalPrice,k=(H=e==null?void 0:e.itemPrices)==null?void 0:H.price,N=e.discounted&&((Z=e.price)==null?void 0:Z.value)!==(s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),O={..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in l&&(l!=null&&l.senderName)?{[d.sender]:l==null?void 0:l.senderName}:{},..."senderEmail"in l&&(l!=null&&l.senderEmail)?{[d.sender]:l==null?void 0:l.senderEmail}:{},..."recipientName"in l&&(l!=null&&l.recipientName)?{[d.recipient]:l==null?void 0:l.recipientName}:{},..."recipientEmail"in l&&(l!=null&&l.recipientEmail)?{[d.recipient]:l==null?void 0:l.recipientEmail}:{},..."message"in l&&(l!=null&&l.message)?{[d.message]:l==null?void 0:l.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(z=e==null?void 0:e.downloadableLinks)==null?void 0:z.count} ${d.downloadableCount}`]:(j=e==null?void 0:e.downloadableLinks)==null?void 0:j.result}:{}};if(y&&b){const w=N?s==null?void 0:s.value:(n==null?void 0:n.value)*(e==null?void 0:e.totalQuantity);a={taxExcluded:!0,taxIncluded:void 0,price:r(s==null?void 0:s.value,s==null?void 0:s.currency),total:L(F,{children:[r(w,s==null?void 0:s.currency,{variant:e.discounted&&(n==null?void 0:n.value)!==w?"strikethrough":"default"}),e.discounted&&(n==null?void 0:n.value)!==w?r(n==null?void 0:n.value,n==null?void 0:n.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:r((k==null?void 0:k.value)*e.totalQuantity,k==null?void 0:k.currency)}}else if(!y&&b)a={taxExcluded:void 0,taxIncluded:void 0,price:r(s==null?void 0:s.value,s==null?void 0:s.currency),total:L(F,{children:[r((s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),n==null?void 0:n.currency,{variant:N?"strikethrough":"default"}),N?r((C=e.price)==null?void 0:C.value,(U=e.price)==null?void 0:U.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:r((k==null?void 0:k.value)*(e==null?void 0:e.totalQuantity),k==null?void 0:k.currency)};else if(y&&!b){const w=N?s.value:n.value*e.totalQuantity;a={taxExcluded:void 0,taxIncluded:!0,price:r(n==null?void 0:n.value,n==null?void 0:n.currency),total:L(F,{children:[r(w,n==null?void 0:n.currency,{variant:N?"strikethrough":"default",weight:"bold"}),N?r(n==null?void 0:n.value,n==null?void 0:n.currency,{sale:!0,weight:"bold"}):null]})}}return c(he,{loading:h,alert:t&&i?L("span",{children:[c(ue,{source:me}),d.outOfStock]}):c(F,{}),configurations:($==null?void 0:$(O))??O,title:E?c("a",{"data-testid":"product-name",className:_(["cart-summary-item__title",["cart-summary-item__title--strikethrough",t]]),href:E(e),children:(W=e==null?void 0:e.product)==null?void 0:W.name}):c("div",{"data-testid":"product-name",className:_(["cart-summary-item__title",["cart-summary-item__title--strikethrough",t]]),children:(X=e==null?void 0:e.product)==null?void 0:X.name}),sku:c("div",{children:(I=e==null?void 0:e.product)==null?void 0:I.sku}),quantity:e!=null&&e.eligibleForReturn&&(e!=null&&e.returnableQuantity)?(e==null?void 0:e.returnableQuantity)??e.totalQuantity:f?void 0:e.totalQuantity,image:E?c("a",{href:E(e),children:c(B,{src:(K=e==null?void 0:e.product)==null?void 0:K.thumbnail.url,alt:(G=e==null?void 0:e.product)==null?void 0:G.thumbnail.label,loading:"lazy",width:"90",height:"120"})}):c(B,{src:(J=e==null?void 0:e.product)==null?void 0:J.thumbnail.url,alt:(Y=e==null?void 0:e.product)==null?void 0:Y.thumbnail.label,loading:"lazy",width:"90",height:"120"}),...a,footer:u&&!o?c(de,{value:1,min:1,max:e==null?void 0:e.returnableQuantity,onValue:w=>u==null?void 0:u(Number(w)),name:"quantity"}):void 0})},V=Math.random().toString(36).slice(2)+Date.now().toString(36),Re=({itemsEligibleForReturn:h,slots:e,loading:v=!1,taxConfig:m,translations:d={},selectedProductList:o,handleSelectedProductList:$,showConfigurableOptions:u,handleSetQuantity:E,handleChangeStep:f})=>L("ul",{className:"order-return-order-product-list",children:[h==null?void 0:h.map((b,y)=>{const r=o.some(t=>(t==null?void 0:t.productSku)===b.productSku&&b.eligibleForReturn&&b.quantityReturned===0),a=b.returnableQuantity===0?1:b.returnableQuantity;return L("li",{className:_(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",!b.eligibleForReturn]]),children:[c(g,{"data-testid":`${V}_${y+1}`,name:V+y,checked:r,disabled:!b.eligibleForReturn||b.quantityReturned!==0,onChange:()=>{$({...b,currentReturnOrderQuantity:1})}}),c(ke,{loading:v,product:{...b,totalQuantity:a},itemType:"",taxConfig:m,translations:d,showConfigurableOptions:u,disabledIncrementer:!r,isReturnProductList:!0,onQuantity:(b==null?void 0:b.returnableQuantity)>1?t=>E(t,b.productSku):void 0}),e!=null&&e.ReturnOrderItem?c(oe,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:e==null?void 0:e.ReturnOrderItem,context:{}}):null]},V+y)}),c("li",{className:"order-return-order-product-list__item",children:c(ie,{type:"button",onClick:()=>f("attributes"),disabled:!o.length,children:d.nextStep})})]});export{ke as C,Fe as F,Re as R,me as S,ye as a,ve as u}; +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/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index afac95bd12..61691fd202 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1 +1 @@ -import{jsx as r,jsxs as s,Fragment as C}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as y}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as k}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as E,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const q=a=>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",...a},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"})))),L1=a=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},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"})),J=({typeList:a,isEmpty:M,minifiedView:Z,message:t})=>{const n=t1(()=>{switch(a){case"orders":return{icon:L1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[a,t]);return!M||!a||!n.text?null:r(R,{className:W(["order-empty-list",n.className,Z?"order-empty-list--minified":""]),message:n.text,icon:r(E,{source:n.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},_1=({minifiedViewKey:a,withReturnNumber:M=!1,withOrderNumber:Z=!1,slots:t,pageInfo:n,withReturnsListButton:w=!0,isMobile:x=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:_=!0,withThumbnails:$=!0,selectedPage:V=1,handleSetSelectPage:A,routeReturnDetails:d,routeOrderDetails:p,routeTracking:u,routeReturnsList:N,routeProductDetails:m,loading:f})=>{const B=h?X:i.length,S=m!=null&&m()?"a":"span",g=y(()=>i.slice(0,B).map((e,I)=>{var z,j;const H=((e==null?void 0:e.items)??[]).reduce((L,o)=>(o.totalQuantity??0)+L,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${a}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),M?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,Z?s("p",{children:[c.orderNumber," ",r("a",{href:(p==null?void 0:p({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(z=e==null?void 0:e.tracking)==null?void 0:z.map((L,o)=>{var v,b;return s("p",{children:[`${c.carrier} ${(b=(v=L==null?void 0:L.carrier)==null?void 0:v.label)==null?void 0:b.toLocaleUpperCase()}: `,r("a",{href:`${(u==null?void 0:u(L))||"#"}`,target:"_blank",rel:"noreferrer",children:L.trackingNumber})]},`${L.trackingNumber}_${o}`)}),t!=null&&t.ReturnItemsDetails?r(k,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[H," ",r(U,{id:`Order.Returns.${a}.returnsList.itemText`,plural:H,fields:{count:H}})]}):null]}),$?r(D,{maxColumns:x?3:9,emptyGridContent:r(C,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",x]]),children:(j=e==null?void 0:e.items)==null?void 0:j.map((L,o)=>{var F,G;const v=(F=L.thumbnail)==null?void 0:F.label,b=(G=L.thumbnail)==null?void 0:G.url;return r(S,{href:(m==null?void 0:m(L))??"#",children:r(r1,{alt:v,src:b,width:85,height:114})},o+L.uid)})}):null,t!=null&&t.DetailsActionParams?r(k,{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(E,{source:q,...T})})]})},I)}),[i,B,a,M,c,d,Z,p,t,$,x,m,u,S]),Y=y(()=>s(C,{children:[_?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,f?r(Q,{withCard:!1}):s(C,{children:[g,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),w?r("a",{className:"order-returns-list-content__actions",href:(N==null?void 0:N())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(E,{source:q,...T})]})})}):null]})]}),[N,w,_,c,g,h,i.length,f]),K=y(()=>s(C,{children:[_?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,f?r(Q,{withCard:!1}):s(C,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),g,(n==null?void 0:n.totalPages)>1?r(e1,{totalPages:n==null?void 0:n.totalPages,currentPage:V,onChange:A}):null]})]}),[g,h,i,c,n==null?void 0:n.totalPages,V,A,f,_]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{_1 as R}; +import{jsx as r,jsxs as s,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as O}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as V,Card as P,ContentGrid as D,Image as r1,Header as Q,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as k}from"@dropins/tools/i18n.js";const q=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"})))),a1=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"})),J=({typeList:L,isEmpty:p,minifiedView:_,message:t})=>{const a=t1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,t]);return!p||!L||!a.text?null:r(R,{className:W(["order-empty-list",a.className,_?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:p=!1,withOrderNumber:_=!1,slots:t,pageInfo:a,withReturnsListButton:$=!0,isMobile:y=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:N=!0,withThumbnails:A=!0,selectedPage:B=1,handleSetSelectPage:S,routeReturnDetails:d,routeOrderDetails:g,routeTracking:f,routeReturnsList:v,routeProductDetails:m,loading:b})=>{const z=h?X:i.length,j=m!=null&&m()?"a":"span",x=w(()=>i.slice(0,z).map((e,I)=>{var F,G;const E=((e==null?void 0:e.items)??[]).reduce((n,o)=>(o.totalQuantity??0)+n,0);return r(P,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(k,{id:`Order.Returns.${L}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),p?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(g==null?void 0:g({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((n,o)=>{var M,Z;const C={title:"",number:(n==null?void 0:n.trackingNumber)??"",carrier:((M=n==null?void 0:n.carrier)==null?void 0:M.label)??""},H=f==null?void 0:f(C);return s("p",{children:[`${c.carrier} `,`${(Z=C.carrier)==null?void 0:Z.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer",children:n.trackingNumber}):r("span",{children:n.trackingNumber})]},`${C.number}_${o}`)}),t!=null&&t.ReturnItemsDetails?r(O,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[E," ",r(k,{id:`Order.Returns.${L}.returnsList.itemText`,plural:E,fields:{count:E}})]}):null]}),A?r(D,{maxColumns:y?3:9,emptyGridContent:r(u,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",y]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((n,o)=>{var M,Z;const C=(M=n.thumbnail)==null?void 0:M.label,H=(Z=n.thumbnail)==null?void 0:Z.url;return r(j,{href:(m==null?void 0:m(n))??"#",children:r(r1,{alt:C,src:H,width:85,height:114})},o+n.uid)})}):null,t!=null&&t.DetailsActionParams?r(O,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:t==null?void 0:t.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:q,...T})})]})},I)}),[i,z,L,p,c,d,_,g,t,A,y,m,f,j]),Y=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,b?r(U,{withCard:!1}):s(u,{children:[x,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(v==null?void 0:v())??"#",children:r(P,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(V,{source:q,...T})]})})}):null]})]}),[v,$,N,c,x,h,i.length,b]),K=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,b?r(U,{withCard:!1}):s(u,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),x,(a==null?void 0:a.totalPages)>1?r(e1,{totalPages:a==null?void 0:a.totalPages,currentPage:B,onChange:S}):null]})]}),[x,h,i,c,a==null?void 0:a.totalPages,B,S,b,N]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{u1 as R}; diff --git a/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js b/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js index 5059874bd8..ea6549d643 100644 --- a/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js +++ b/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js @@ -44,4 +44,4 @@ import{h as i}from"./network-error.js";import{f as u,h as s}from"./fetch-graphql } } } -`,T=async r=>await u(r!=="shortRequest"?n:_,{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(t=>{var e,o,a;return(e=t.errors)!=null&&e.length?s(t.errors):m(((a=(o=t==null?void 0:t.data)==null?void 0:o.attributesForm)==null?void 0:a.items)??[])}).catch(i);export{T as g}; +`,T=async r=>await u(r!=="shortRequest"?n:_,{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(t=>{var e,o,a;return(e=t.errors)!=null&&e.length?s(t.errors):m((a=(o=t==null?void 0:t.data)==null?void 0:o.attributesForm)==null?void 0:a.items)}).catch(i);export{T as g}; diff --git a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js index 21f9223939..5778d24104 100644 --- a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js +++ b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js @@ -92,6 +92,7 @@ fragment AddressesList on OrderAddress { timestamp } items { + __typename id product_sku product_name diff --git a/scripts/__dropins__/storefront-order/chunks/requestReturn.js b/scripts/__dropins__/storefront-order/chunks/requestReturn.js index bf713ed850..4e63f82b5b 100644 --- a/scripts/__dropins__/storefront-order/chunks/requestReturn.js +++ b/scripts/__dropins__/storefront-order/chunks/requestReturn.js @@ -1,4 +1,4 @@ -import{h as i}from"./network-error.js";import{f as s,h as o}from"./fetch-graphql.js";import{t as c}from"./transform-attributes-form.js";import{a as m}from"./convertCase.js";const d=` +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 { @@ -31,15 +31,20 @@ import{h as i}from"./network-error.js";import{f as s,h as o}from"./fetch-graphql } } } -`,E=async u=>await s(d,{method:"GET",cache:"force-cache",variables:{entityType:u}}).then(t=>{var e,r,a;return(e=t.errors)!=null&&e.length?o(t.errors):c(((a=(r=t==null?void 0:t.data)==null?void 0:r.attributesList)==null?void 0:a.items)??[])}).catch(i),l=` +`,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 { - uid - status - number - created_at + ...OrderReturn } } } -`,f=async u=>{const t=m(u,"snakeCase",{});return await s(l,{method:"POST",variables:{input:t}}).then(e=>{var n;if((n=e.errors)!=null&&n.length)return o(e.errors);const{created_at:r,...a}=e.data.requestReturn.return;return{...a,createdAt:r}}).catch(i)};export{E as g,f as r}; +${_}`,y=async n=>{const t=c(n,"snakeCase",{});return await s(T,{method:"POST",variables:{input:t}}).then(e=>{var u;if((u=e.errors)!=null&&u.length)return o(e.errors);const{created_at:r,...a}=e.data.requestReturn.return;return{...a,createdAt:r}}).catch(i)};export{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 7f9f88c15b..7a0c70015a 100644 --- a/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js +++ b/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js @@ -1 +1 @@ -import{F as c}from"./form.types.js";const p={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"},y=i=>{const n={};return Object.keys(i).forEach(t=>{if(t.match(/_(\d+)$/)){const e=t.replace(/_\d+$/,"");n[e]=i[t]}else n[t]=i[t]}),n},R=(i,n)=>i.map(t=>({...t,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}`})),_=(i,n)=>i==null?void 0:i.flatMap(t=>Array.from({length:n},(a,e)=>({...t,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}`}))),$=i=>{const n=[],t=[];return Object.entries(i).forEach(([a,e])=>{const s=a.lastIndexOf("_"),r=a.slice(0,s),u=a.slice(s+1);u===c.MULTISELECT||u===c.SELECT?n.push({attributeCode:r,value:btoa(e)}):t.push({attributeCode:r,value:e})}),{selectedCustomAttributes:n,enteredCustomAttributes:t}},m=i=>typeof i!="string"?"":p[i]??"",l=["REJECTED","PARTIALLY_REJECTED","DENIED","UNCONFIRMED","CLOSED"],A=i=>{const n=i==null?void 0:i.returns.filter(e=>!l.includes(e.returnStatus));return((i==null?void 0:i.itemsEligibleForReturn)??[]).flatMap(e=>{let s=e.quantityShipped,r={...e,returnableQuantity:s};return e.quantityShipped===0&&(r={...r,eligibleForReturn:!1,returnableQuantity:0}),n.forEach(u=>{u.items.forEach(o=>{if((o==null?void 0:o.id)===(e==null?void 0:e.id)){const d=s-o.requestQuantity;s=Math.max(d,0),r={...r,eligibleForReturn:s!==0,returnableQuantity:s}}})}),r}).sort((e,s)=>Number(s.eligibleForReturn)-Number(e.eligibleForReturn))},C=i=>{var a;let n=[];return((a=i==null?void 0:i.returns)==null?void 0:a.filter(e=>!l.includes(e.returnStatus)).flatMap(e=>e.items||[])).forEach(e=>{if(!n.length)n.push({...e,totalQuantity:e.requestQuantity});else{const s=n.findIndex(r=>r.id===e.id);s!==-1?n[s].totalQuantity+=e.requestQuantity:n.push({...e,totalQuantity:e.requestQuantity})}}),{returnedList:n,modifyOrder:E(i.items,n)}};function E(i,n){return i.map(t=>{const a=n.find(e=>e.id===t.id);if(a){const e=t.totalQuantity-a.totalQuantity;return e===0?null:{...t,totalQuantity:e}}return t}).filter(t=>t!==null)}export{y as c,C as e,m as f,R as m,$ as n,A as o,_ as r}; +import{F as c}from"./form.types.js";const p={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"},y=n=>{const s={};return Object.keys(n).forEach(e=>{if(e.match(/_(\d+)$/)){const t=e.replace(/_\d+$/,"");s[t]=n[e]}else s[e]=n[e]}),s},R=(n,s)=>n.map(e=>({...e,id:`${e.id}_${e.fieldType}_${s+1}`,name:`${e.name}_${e.fieldType}_${s+1}`,code:`${e.code}_${e.fieldType}_${s+1}`,customUpperCode:`${e.customUpperCode}_${e.fieldType}_${s+1}`})),_=(n,s)=>n==null?void 0:n.flatMap(e=>Array.from({length:s},(i,t)=>({...e,id:`${e.id}_${e.fieldType}_${t+1}`,name:`${e.name}_${e.fieldType}_${t+1}`,code:`${e.code}_${e.fieldType}_${t+1}`,customUpperCode:`${e.customUpperCode}_${e.fieldType}_${t+1}`}))),$=n=>{const s=[],e=[];return Object.entries(n).forEach(([i,t])=>{const a=i.lastIndexOf("_"),r=i.slice(0,a),u=i.slice(a+1);u===c.MULTISELECT||u===c.SELECT?s.push({attributeCode:r,value:btoa(t)}):e.push({attributeCode:r,value:t})}),{selectedCustomAttributes:s,enteredCustomAttributes:e}},m=n=>typeof n!="string"?"":p[n]??"",l=["REJECTED","PARTIALLY_REJECTED","DENIED","UNCONFIRMED","CLOSED"],A=n=>{const s=n==null?void 0:n.returns.filter(t=>!l.includes(t.returnStatus));return((n==null?void 0:n.itemsEligibleForReturn)??[]).flatMap(t=>{let a=t.quantityShipped,r={...t,returnableQuantity:a};return t.quantityShipped===0&&(r={...r,eligibleForReturn:!1,returnableQuantity:0}),s.forEach(u=>{u.items.forEach(o=>{if((o==null?void 0:o.id)===(t==null?void 0:t.id)){const d=a-o.requestQuantity;a=Math.max(d,0),r={...r,eligibleForReturn:a!==0,returnableQuantity:a}}})}),r}).sort((t,a)=>Number(a.eligibleForReturn)-Number(t.eligibleForReturn))},C=n=>{var i;let s=[];return((i=n==null?void 0:n.returns)==null?void 0:i.filter(t=>!l.includes(t.returnStatus)).flatMap(t=>t.items||[])).forEach(t=>{if(!s.length)s.push({...t,totalQuantity:t.requestQuantity});else{const a=s.findIndex(r=>r.id===t.id);a!==-1?s[a].totalQuantity+=t.requestQuantity:s.push({...t,totalQuantity:t.requestQuantity})}}),{returnedList:s??[],modifyOrder:E(n.items,s)??[]}};function E(n,s){const e=new Map(s.map(i=>[i.id,i]));return n.map(i=>{const t=e.get(i.id);if(t){const a=i.totalQuantity-t.totalQuantity;return a===0?null:{...i,totalQuantity:a}}return i}).filter(i=>i!==null)}export{y as c,C as e,m as f,R as m,$ as n,A as o,_ as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js index b8ba7c03cf..ce74ed1d52 100644 --- a/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js +++ b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js @@ -1 +1 @@ -import{c as d,a as m}from"./convertCase.js";const a=s=>{let o=[];for(const e of s)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let n=2;n<=e.multiline_count;n++){const c={...e,name:`${e.code}_${n}`,code:`${e.code}_${n}`,id:`${e.code}_${n}`};o.push(c)}return o},f=s=>{var u;const o=s||[];if(!o.length)return[];const e=(u=o.filter(t=>{var r;return!((r=t.frontend_input)!=null&&r.includes("HIDDEN"))}))==null?void 0:u.map(({code:t,...r})=>{const i=t!=="country_id"?t:"country_code";return{...r,name:i,id:i,code:i}}),n=a(e);return e.concat(n).map(t=>{const r=d(t.code);return m({...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"./convertCase.js";const a=n=>{let c=[];for(const e of n)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let o=2;o<=e.multiline_count;o++){const s={...e,name:`${e.code}_${o}`,code:`${e.code}_${o}`,id:`${e.code}_${o}`};c.push(s)}return c},f=(n=[])=>{var s;if(!(n!=null&&n.length))return[];const c=(s=n.filter(t=>{var r;return!((r=t.frontend_input)!=null&&r.includes("HIDDEN"))}))==null?void 0:s.map(({code:t,...r})=>{const u=t!=="country_id"?t:"country_code";return{...r,name:u,id:u,code:u}}),e=a(c);return c.concat(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/containers/CreateReturn.js b/scripts/__dropins__/storefront-order/containers/CreateReturn.js index f62e19bb0b..a39a144815 100644 --- a/scripts/__dropins__/storefront-order/containers/CreateReturn.js +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn.js @@ -1 +1 @@ -import{jsx as a,jsxs as F}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as H,classes as Q}from"@dropins/tools/lib.js";import{Button as M,CartItem as V,Image as W,Header as $,InLineAlert as Z}from"@dropins/tools/components.js";import{S as D,u as z,a as U,R as K}from"../chunks/OrderCancel.js";import{useState as O,useRef as G,useEffect as T,useCallback as A}from"@dropins/tools/preact-hooks.js";import{events as J}from"@dropins/tools/event-bus.js";import{g as X}from"../chunks/getFormValues.js";import{s as Y}from"../chunks/setTaxStatus.js";import{createRef as I,Fragment as ee}from"@dropins/tools/preact.js";import{o as te,c as ne,n as se,r as ae,m as re}from"../chunks/returnOrdersHelper.js";import{g as ie,r as ce}from"../chunks/requestReturn.js";import{g as ue}from"../chunks/getStoreConfig.js";import*as g from"@dropins/tools/preact-compat.js";import{O as oe}from"../chunks/OrderLoaders.js";import{useText as le}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const de=s=>g.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},g.createElement("g",{clipPath:"url(#clip0_841_1324)"},g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),g.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"})),g.createElement("defs",null,g.createElement("clipPath",{id:"clip0_841_1324"},g.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),pe=s=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},g.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"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),he=({onSuccess:s,onError:r,handleSetInLineAlert:i,orderData:l})=>{const[o,h]=O(l),[S,k]=O("products"),[w,R]=O(!0),[f,y]=O([]),[v,x]=O([]),[t,C]=O({taxIncluded:!1,taxExcluded:!1}),[e,d]=O([]),m=G([]);m.current.length!==f.length&&(m.current=f.map((n,c)=>m.current[c]||I())),T(()=>{const n=J.on("order/data",c=>{h(c),d(te(c)),R(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ue().then(n=>{if(n){const c=Y(n==null?void 0:n.shoppingCartDisplayPrice);C(c)}})},[]),T(()=>{ie("RMA_ITEM").then(n=>{n.length&&(x(n),R(!1))})},[]);const _=A(n=>{y(c=>c.findIndex(u=>(u==null?void 0:u.productSku)===(n==null?void 0:n.productSku))>-1?c.filter(u=>(u==null?void 0:u.productSku)!==(n==null?void 0:n.productSku)):[...c,n])},[]),b=A(n=>{k(n),i(),n==="products"&&y([])},[i]),N=A((n,c)=>{const L=f.map(u=>u.productSku===c?{...u,currentReturnOrderQuantity:n}:u);y(L)},[f]),E=A(async(n,c)=>{if(!c)return null;R(!0);const L={orderUid:(o==null?void 0:o.id)??"",contactEmail:(o==null?void 0:o.email)??""},u=[];m.current.length&&m.current.forEach(({current:p})=>{var P;const j=p==null?void 0:p.name.replace(/_\d+$/,""),q=((P=p==null?void 0:p.dataset)==null?void 0:P.quantity)??1,B=ne(X(p));u.push({orderItemUid:j,quantityToReturn:+q,...se(B)})}),ce({...L,items:u}).then(p=>{p&&(s==null||s(p),b("success"),i())}).catch(p=>{r==null||r(p.message),i({type:"error",heading:p.message})}),R(!1)},[b,r,s,i,o]);return{order:o,steps:S,loading:w,formsRef:m,taxConfig:t,attributesList:v,selectedProductList:f,itemsEligibleForReturn:e,handleSelectedProductList:_,handleSetQuantity:N,handleChangeStep:b,onSubmit:E}},me={success:a(pe,{}),warning:a(de,{}),error:a(D,{})},ge=()=>{const[s,r]=O({type:"success",heading:""}),i=A(l=>{if(!(l!=null&&l.type)){r({type:"success",heading:""});return}const o=me[l.type];r({...l,icon:o})},[]);return{inLineAlertProps:s,handleSetInLineAlert:i}},fe=({routeReturnSuccess:s,translations:r,orderData:i})=>{const l=()=>{window.location.href=(s==null?void 0:s(i))??"#"};return F("div",{className:"order-return-order-message",children:[a("p",{className:"order-return-order-message__title",children:r.successTitle}),a("p",{className:"order-return-order-message__subtitle",children:r.successMessage}),a(M,{onClick:l,type:"button",children:r.backStore})]})},be=({slots:s,formsRef:r,selectedProductList:i,loading:l,fieldsConfig:o,translations:h,handleChangeStep:S,onSubmit:k})=>{const{formData:w,errors:R,formRef:f,handleChange:y,handleBlur:v,handleSubmit:x}=z({fieldsConfig:ae(o,i==null?void 0:i.length),onSubmit:k});return F("form",{className:"order-return-reason-form",ref:f,onSubmit:x,name:"returnReasonForm",children:[i.map((t,C)=>{var E,n,c,L,u;const e=(t==null?void 0:t.giftCard)||{},d=t==null?void 0:t.product,m=re(o,C),_=`${t==null?void 0:t.id}_${C}`,b=(t==null?void 0:t.currentReturnOrderQuantity)??1,N={...t!=null&&t.currentReturnOrderQuantity?{Quantity:b}:{},..."configurableOptions"in t?t.configurableOptions:{},..."bundleOptions"in t?t.bundleOptions:{},..."senderName"in e&&(e!=null&&e.senderName)?{[h.sender]:e==null?void 0:e.senderName}:{},..."senderEmail"in e&&(e!=null&&e.senderEmail)?{[h.sender]:e==null?void 0:e.senderEmail}:{},..."recipientName"in e&&(e!=null&&e.recipientName)?{[h.recipient]:e==null?void 0:e.recipientName}:{},..."recipientEmail"in e&&(e!=null&&e.recipientEmail)?{[h.recipient]:e==null?void 0:e.recipientEmail}:{},..."message"in e&&(e!=null&&e.message)?{[h.message]:e==null?void 0:e.message}:{},..."downloadableLinks"in t&&(t!=null&&t.downloadableLinks)?{[`${(E=t==null?void 0:t.downloadableLinks)==null?void 0:E.count} ${h.downloadableCount}`]:(n=t==null?void 0:t.downloadableLinks)==null?void 0:n.result}:{}};return F(ee,{children:[a(V,{loading:l,title:a("div",{"data-testid":"product-name",children:(c=t==null?void 0:t.product)==null?void 0:c.name}),sku:a("div",{children:d==null?void 0:d.sku}),image:a(W,{src:((L=d==null?void 0:d.thumbnail)==null?void 0:L.url)??"",alt:((u=d==null?void 0:d.thumbnail)==null?void 0:u.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:N}),a("form",{name:_,ref:r==null?void 0:r.current[C],"data-quantity":b,children:a(U,{className:"className",loading:l,fields:m,onChange:y,onBlur:v,errors:R,values:w})})]},C)}),s!=null&&s.ReturnFormActions?a(H,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:s==null?void 0:s.ReturnFormActions,context:{handleChangeStep:S}}):F("div",{className:"order-return-reason-form__actions",children:[a(M,{variant:"secondary",type:"button",onClick:()=>{S("products")},children:h.backStep}),a(M,{children:h.submit})]})]})},Be=({className:s,orderData:r,slots:i,onSuccess:l,onError:o,routeReturnSuccess:h,showConfigurableOptions:S})=>{const k=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"}),{inLineAlertProps:w,handleSetInLineAlert:R}=ge(),{order:f,itemsEligibleForReturn:y,formsRef:v,taxConfig:x,attributesList:t,steps:C,loading:e,selectedProductList:d,handleSelectedProductList:m,handleSetQuantity:_,handleChangeStep:b,onSubmit:N}=he({orderData:r,onSuccess:l,onError:o,handleSetInLineAlert:R});if(e)return a("div",{children:a(oe,{})});if(!e&&!t.length)return a("div",{});const E={products:a(K,{itemsEligibleForReturn:y,slots:i,translations:k,loading:e,taxConfig:x,selectedProductList:d,handleSelectedProductList:m,showConfigurableOptions:S,handleSetQuantity:_,handleChangeStep:b}),attributes:a(be,{slots:i,formsRef:v,loading:e,fieldsConfig:t,selectedProductList:d,handleChangeStep:b,translations:k,onSubmit:N}),success:a(fe,{translations:k,routeReturnSuccess:h,orderData:f}),error:null};return F("div",{className:Q(["order-create-return",s]),children:[a($,{title:k.headerText}),w.heading?a(Z,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...w}):null,E[C]]})};export{Be as CreateReturn,Be as default}; +import{jsx as r,jsxs as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as q,Slot as P}from"@dropins/tools/lib.js";import{Checkbox as H,Button as Q,CartItem as V,Image as W,Header as Z,InLineAlert as D}from"@dropins/tools/components.js";import{u as z,a as U}from"../chunks/OrderCancel.js";import{useState as _,useRef as K,useEffect as T,useCallback as F}from"@dropins/tools/preact-hooks.js";import{events as G}from"@dropins/tools/event-bus.js";import{g as J}from"../chunks/getFormValues.js";import{s as X}from"../chunks/setTaxStatus.js";import{createRef as Y,Fragment as I}from"@dropins/tools/preact.js";import{o as ee,c as te,n as ne,r as re,m as ae}from"../chunks/returnOrdersHelper.js";import{g as se,r as ie}from"../chunks/requestReturn.js";import{g as ce}from"../chunks/getStoreConfig.js";import*as y from"@dropins/tools/preact-compat.js";import{S as ue,C as oe}from"../chunks/CartSummaryItem.js";import{O as le}from"../chunks/OrderLoaders.js";import{useText as de}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const pe=a=>y.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},y.createElement("g",{clipPath:"url(#clip0_841_1324)"},y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),y.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"})),y.createElement("defs",null,y.createElement("clipPath",{id:"clip0_841_1324"},y.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),he=a=>y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},y.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"}),y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),me=({onSuccess:a,onError:s,handleSetInLineAlert:c,orderData:d})=>{const[u,p]=_(d),[C,f]=_("products"),[O,b]=_(!0),[i,g]=_([]),[S,w]=_([]),[e,L]=_({taxIncluded:!1,taxExcluded:!1}),[t,h]=_([]),k=K([]);k.current.length!==i.length&&(k.current=i.map((n,o)=>k.current[o]||Y())),T(()=>{const n=G.on("order/data",o=>{p(o),h(ee(o)),b(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ce().then(n=>{if(n){const o=X(n==null?void 0:n.shoppingCartDisplayPrice);L(o)}})},[]),T(()=>{se("RMA_ITEM").then(n=>{n.length&&(w(n),b(!1))})},[]);const N=F(n=>{g(o=>o.findIndex(l=>(l==null?void 0:l.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(l=>(l==null?void 0:l.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),R=F(n=>{f(n),c(),n==="products"&&g([])},[c]),A=F((n,o)=>{const v=i.map(l=>l.productSku===o?{...l,currentReturnOrderQuantity:n}:l);g(v)},[i]),E=F(async(n,o)=>{if(!o)return null;b(!0);const v={orderUid:(u==null?void 0:u.id)??"",contactEmail:(u==null?void 0:u.email)??""},l=[];k.current.length&&k.current.forEach(({current:m})=>{var M;const $=m==null?void 0:m.name.replace(/_\d+$/,""),j=((M=m==null?void 0:m.dataset)==null?void 0:M.quantity)??1,B=te(J(m));l.push({orderItemUid:$,quantityToReturn:+j,...ne(B)})}),ie({...v,items:l}).then(m=>{m&&(a==null||a(m),R("success"),c())}).catch(m=>{s==null||s(m.message),c({type:"error",heading:m.message})}),b(!1)},[R,s,a,c,u]);return{order:u,steps:C,loading:O,formsRef:k,taxConfig:e,attributesList:S,selectedProductList:i,itemsEligibleForReturn:t,handleSelectedProductList:N,handleSetQuantity:A,handleChangeStep:R,onSubmit:E}},ge={success:r(he,{}),warning:r(pe,{}),error:r(ue,{})},fe=()=>{const[a,s]=_({type:"success",heading:""}),c=F(d=>{if(!(d!=null&&d.type)){s({type:"success",heading:""});return}const u=ge[d.type];s({...d,icon:u})},[]);return{inLineAlertProps:a,handleSetInLineAlert:c}},be=({itemsEligibleForReturn:a,slots:s,loading:c=!1,taxConfig:d,translations:u={},selectedProductList:p,handleSelectedProductList:C,showConfigurableOptions:f,handleSetQuantity:O,handleChangeStep:b})=>x("ul",{className:"order-return-order-product-list",children:[a==null?void 0:a.map((i,g)=>{const S=p.some(e=>(e==null?void 0:e.productSku)===i.productSku&&i.eligibleForReturn&&i.quantityReturned===0),w=i.returnableQuantity===0?1:i.returnableQuantity;return x("li",{className:q(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",!i.eligibleForReturn]]),children:[r(H,{"data-testid":`key_${g}`,name:`key_${g+1}`,checked:S,disabled:!i.eligibleForReturn||i.quantityReturned!==0,onChange:()=>{C({...i,currentReturnOrderQuantity:1})}}),r(oe,{loading:c,product:{...i,totalQuantity:w},itemType:"",taxConfig:d,translations:u,showConfigurableOptions:f,disabledIncrementer:!S,isReturnProductList:!0,onQuantity:(i==null?void 0:i.returnableQuantity)>1?e=>O(e,i.productSku):void 0}),s!=null&&s.ReturnOrderItem?r(P,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:s==null?void 0:s.ReturnOrderItem,context:{}}):null]},g)}),r("li",{className:"order-return-order-product-list__item",children:r(Q,{type:"button",onClick:()=>b("attributes"),disabled:!p.length,children:u.nextStep})})]}),ke=({routeReturnSuccess:a,translations:s,orderData:c})=>{const d=()=>{window.location.href=(a==null?void 0:a(c))??"#"};return 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(Q,{onClick:d,type:"button",children:s.backStore})]})},ye=({slots:a,formsRef:s,selectedProductList:c,loading:d,fieldsConfig:u,translations:p,handleChangeStep:C,onSubmit:f})=>{const{formData:O,errors:b,formRef:i,handleChange:g,handleBlur:S,handleSubmit:w}=z({fieldsConfig:re(u,c==null?void 0:c.length),onSubmit:f});return x("form",{className:"order-return-reason-form",ref:i,onSubmit:w,name:"returnReasonForm",children:[c.map((e,L)=>{var E,n,o,v,l;const t=(e==null?void 0:e.giftCard)||{},h=e==null?void 0:e.product,k=ae(u,L),N=`${e==null?void 0:e.id}_${L}`,R=(e==null?void 0:e.currentReturnOrderQuantity)??1,A={...e!=null&&e.currentReturnOrderQuantity?{Quantity:R}:{},..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in t?{[p.sender]:t==null?void 0:t.senderName}:{},..."senderEmail"in t&&(t!=null&&t.senderEmail)?{[p.sender]:t==null?void 0:t.senderEmail}:{},..."recipientName"in t&&(t!=null&&t.recipientName)?{[p.recipient]:t==null?void 0:t.recipientName}:{},..."recipientEmail"in t&&(t!=null&&t.recipientEmail)?{[p.recipient]:t==null?void 0:t.recipientEmail}:{},..."message"in t&&(t!=null&&t.message)?{[p.message]:t==null?void 0:t.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(E=e==null?void 0:e.downloadableLinks)==null?void 0:E.count} ${p.downloadableCount}`]:(n=e==null?void 0:e.downloadableLinks)==null?void 0:n.result}:{}};return x(I,{children:[r(V,{loading:d,title:r("div",{"data-testid":"product-name",children:(o=e==null?void 0:e.product)==null?void 0:o.name}),sku:r("div",{children:h==null?void 0:h.sku}),image:r(W,{src:((v=h==null?void 0:h.thumbnail)==null?void 0:v.url)??"",alt:((l=h==null?void 0:h.thumbnail)==null?void 0:l.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:A}),r("form",{name:N,ref:s==null?void 0:s.current[L],"data-quantity":R,children:r(U,{className:"className",loading:d,fields:k,onChange:g,onBlur:S,errors:b,values:O})})]},L)}),a!=null&&a.ReturnFormActions?r(P,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:a==null?void 0:a.ReturnFormActions,context:{handleChangeStep:C}}):x("div",{className:"order-return-reason-form__actions",children:[r(Q,{variant:"secondary",type:"button",onClick:()=>{C("products")},children:p.backStep}),r(Q,{children:p.submit})]})]})},He=({className:a,orderData:s,slots:c,onSuccess:d,onError:u,routeReturnSuccess:p,showConfigurableOptions:C})=>{const f=de({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"}),{inLineAlertProps:O,handleSetInLineAlert:b}=fe(),{order:i,itemsEligibleForReturn:g,formsRef:S,taxConfig:w,attributesList:e,steps:L,loading:t,selectedProductList:h,handleSelectedProductList:k,handleSetQuantity:N,handleChangeStep:R,onSubmit:A}=me({orderData:s,onSuccess:d,onError:u,handleSetInLineAlert:b});if(t)return r("div",{children:r(le,{})});if(!t&&!e.length)return r("div",{});const E={products:r(be,{itemsEligibleForReturn:g,slots:c,translations:f,loading:t,taxConfig:w,selectedProductList:h,handleSelectedProductList:k,showConfigurableOptions:C,handleSetQuantity:N,handleChangeStep:R}),attributes:r(ye,{slots:c,formsRef:S,loading:t,fieldsConfig:e,selectedProductList:h,handleChangeStep:R,translations:f,onSubmit:A}),success:r(ke,{translations:f,routeReturnSuccess:p,orderData:i}),error:null};return x("div",{className:q(["order-create-return",a]),children:[r(Z,{title:f.headerText}),O.heading?r(D,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...O}):null,E[L]]})};export{He as CreateReturn,He as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js b/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js index 51fea62824..8089b1873f 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js +++ b/scripts/__dropins__/storefront-order/containers/OrderCancelForm.js @@ -1 +1 @@ -import{O as C,O as F}from"../chunks/OrderCancelForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import"@dropins/tools/preact.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";import"../chunks/getGuestOrder.graphql.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";export{C as OrderCancelForm,F as default}; +import{O as C,O as F}from"../chunks/OrderCancelForm.js";import"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/i18n.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";import"../chunks/getGuestOrder.graphql.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";export{C as OrderCancelForm,F as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderProductList.js b/scripts/__dropins__/storefront-order/containers/OrderProductList.js index 089ce23fb5..c2c9411c76 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderProductList.js +++ b/scripts/__dropins__/storefront-order/containers/OrderProductList.js @@ -1 +1 @@ -import{jsx as i,jsxs as T}from"@dropins/tools/preact-jsx-runtime.js";import{Card as S,Header as N}from"@dropins/tools/components.js";import{C as b}from"../chunks/OrderCancel.js";import{classes as k}from"@dropins/tools/lib.js";import{useState as C,useEffect as x,useMemo as v}from"@dropins/tools/preact-hooks.js";import{events as G}from"@dropins/tools/event-bus.js";import{s as j}from"../chunks/setTaxStatus.js";import{g as q}from"../chunks/getStoreConfig.js";import{Fragment as w}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as y}from"../chunks/returnOrdersHelper.js";import{O as E}from"../chunks/OrderLoaders.js";import{useText as F}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const _=({orderData:l})=>{const[a,t]=C(!0),[u,c]=C(l),[m,d]=C({taxIncluded:!1,taxExcluded:!1});return x(()=>{q().then(e=>{if(e){const n=j(e==null?void 0:e.shoppingCartDisplayPrice);d(n)}}).finally(()=>{t(!1)})},[]),x(()=>{const e=G.on("order/data",n=>{c(n)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:a,taxConfig:m,order:u}},$=({loading:l,taxConfig:a,order:t=null,withHeader:u=!0,showConfigurableOptions:c,routeProductDetails:m})=>{const d=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,n=F({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),g=v(()=>{var p,f;if(!t)return[];if(!d){const r=((p=y(t))==null?void 0:p.modifyOrder)??[],O=((f=y(t))==null?void 0:f.returnedList)??[],h=r==null?void 0:r.filter(o=>o.quantityCanceled),I=r==null?void 0:r.filter(o=>!o.quantityCanceled);return[{type:"returned",list:O,title:n.returned},{type:"cancelled",list:h,title:n.cancelled},{type:"allItems",list:I,title:n.allOrders}].filter(o=>{var P;return((P=o==null?void 0:o.list)==null?void 0:P.length)>0})}const s=t.returns.find(r=>r.returnNumber===e);return[{type:"returned",list:(s==null?void 0:s.items)??[],title:n.returned}]},[t,d,n,e]);return t?g.every(s=>s.list.length===0)?null:i(S,{variant:"secondary",className:"order-order-product-list-content",children:g.map((s,L)=>{var f;const p=s.list.reduce((r,{totalQuantity:O})=>O+r,0);return T(w,{children:[u?i(N,{title:`${s.title} (${p})`}):null,i("ul",{className:"order-order-product-list-content__items",children:(f=s.list)==null?void 0:f.map(r=>i("li",{"data-testid":"order-product-list-content-item",children:i(b,{loading:l,product:r,itemType:s.type,taxConfig:a,translations:n,showConfigurableOptions:c,routeProductDetails:m})},r.id))})]},L)})}):i(E,{})},tt=({className:l,orderData:a,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})=>{const{loading:m,taxConfig:d,order:e}=_({orderData:a});return i("div",{className:k(["order-order-product-list",l]),children:i($,{loading:m,taxConfig:d,order:e,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})})};export{tt as OrderProductList,tt as default}; +import{jsx as i,jsxs as h}from"@dropins/tools/preact-jsx-runtime.js";import{Card as T,Header as I}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as S}from"@dropins/tools/lib.js";import{useState as C,useEffect as x,useMemo as N}from"@dropins/tools/preact-hooks.js";import{events as b}from"@dropins/tools/event-bus.js";import{s as k}from"../chunks/setTaxStatus.js";import{g as v}from"../chunks/getStoreConfig.js";import{Fragment as G}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as j}from"../chunks/returnOrdersHelper.js";import{O as q}from"../chunks/OrderLoaders.js";import{C as w}from"../chunks/CartSummaryItem.js";import{useText as E}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const F=({orderData:a})=>{const[u,t]=C(!0),[c,m]=C(a),[f,d]=C({taxIncluded:!1,taxExcluded:!1});return x(()=>{v().then(e=>{if(e){const r=k(e==null?void 0:e.shoppingCartDisplayPrice);d(r)}}).finally(()=>{t(!1)})},[]),x(()=>{const e=b.on("order/data",r=>{m(r)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:u,taxConfig:f,order:c}},_=({loading:a,taxConfig:u,order:t=null,withHeader:c=!0,showConfigurableOptions:m,routeProductDetails:f})=>{const d=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,r=E({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),g=N(()=>{var p;if(!t)return[];if(!d){const{modifyOrder:s,returnedList:l}=j(t),O=s==null?void 0:s.filter(o=>o.quantityCanceled),y=(p=s??[])==null?void 0:p.filter(o=>!o.quantityCanceled);return[{type:"returned",list:l??[],title:r.returned},{type:"cancelled",list:O,title:r.cancelled},{type:"allItems",list:y,title:r.allOrders}].filter(o=>{var P;return((P=o==null?void 0:o.list)==null?void 0:P.length)>0})}const n=t.returns.find(s=>s.returnNumber===e);return[{type:"returned",list:(n==null?void 0:n.items)??[],title:r.returned}]},[t,d,r,e]);return t?g.every(n=>n.list.length===0)?null:i(T,{variant:"secondary",className:"order-order-product-list-content",children:g.map((n,L)=>{var s;const p=n.list.reduce((l,{totalQuantity:O})=>O+l,0);return h(G,{children:[c?i(I,{title:`${n.title} (${p})`}):null,i("ul",{className:"order-order-product-list-content__items",children:(s=n.list)==null?void 0:s.map(l=>i("li",{"data-testid":"order-product-list-content-item",children:i(w,{loading:a,product:l,itemType:n.type,taxConfig:u,translations:r,showConfigurableOptions:m,routeProductDetails:f})},l.id))})]},L)})}):i(q,{})},tt=({className:a,orderData:u,withHeader:t,showConfigurableOptions:c,routeProductDetails:m})=>{const{loading:f,taxConfig:d,order:e}=F({orderData:u});return i("div",{className:S(["order-order-product-list",a]),children:i(_,{loading:f,taxConfig:d,order:e,withHeader:t,showConfigurableOptions:c,routeProductDetails:m})})};export{tt as OrderProductList,tt as default}; diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index 34753a8978..4bd502bb1e 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1 +1 @@ -import{jsxs as g,jsx as n,Fragment as N}from"@dropins/tools/preact-jsx-runtime.js";import{classes as L,Slot as A}from"@dropins/tools/lib.js";import{Card as o,Header as v,Accordion as x,AccordionSection as E,ContentGrid as $,Image as R}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as _,useEffect as Z}from"@dropins/tools/preact-hooks.js";import{events as P}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as k}from"../chunks/useIsMobile.js";import{Text as V,useText as D}from"@dropins/tools/i18n.js";import{C as ii}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var G=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(G||{});const ni=({orderData:e})=>{const[t,i]=_(!0),[s,h]=_(e),[f,C]=_(!1);return Z(()=>{const a=P.on("order/data",u=>{h(u),C(u==null?void 0:u.isVirtual),i(!1)},{eager:!0});return()=>{a==null||a.off()}},[]),{loading:t,order:s,isVirtualProduct:f}},ei=({slots:e,collapseThreshold:t,translations:i,returnData:s,routeTracking:h,routeProductDetails:f})=>{var u;const C=k(),a=f?"a":"span";return g(o,{variant:"secondary",className:L(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[n(v,{title:i.returnOrderCardTitle}),g("div",{children:[(u=s==null?void 0:s.tracking)==null?void 0:u.map((l,m)=>{var S,T;return g("p",{children:[`${i.carrier} ${(T=(S=l==null?void 0:l.carrier)==null?void 0:S.label)==null?void 0:T.toLocaleUpperCase()}: `,n("a",{href:`${(h==null?void 0:h(l))??"#"}`,rel:"noreferrer",children:l.trackingNumber})]},`${l.trackingNumber}_${m}`)}),e!=null&&e.ReturnItemsDetails?n(A,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:s.items}}):null,n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{defaultOpen:t>=s.items.length,title:n(V,{id:"Order.ShippingStatusCard.itemText",plural:s.items.reduce((l,m)=>l+m.totalQuantity,0),fields:{count:s.items.reduce((l,m)=>l+m.totalQuantity,0)}}),children:n($,{maxColumns:C?3:9,emptyGridContent:n(N,{}),className:L(["order-shipping-status-card__images",["order-shipping-status-card__images-3",C]]),children:s.items.map((l,m)=>{var c,b;const S=(c=l.thumbnail)==null?void 0:c.label,T=(b=l.thumbnail)==null?void 0:b.url;return n(a,{href:(f==null?void 0:f(l))??"#","data-testid":`${m}${l.uid}`,children:n(R,{alt:S,src:T,width:85,height:114})},`${m}${l.uid}`)})})})})]})]})},pi=({translations:e,slots:t,orderData:i,collapseThreshold:s=10,routeProductDetails:h,routeTracking:f})=>{var q,w,M,U,H,j,F;const C=!!(i!=null&&i.returnNumber),a=i==null?void 0:i.returnNumber,u=h?"a":"span",l=(q=i==null?void 0:i.status)==null?void 0:q.toLocaleLowerCase(),S=((w=i==null?void 0:i.shipments)==null?void 0:w.length)===1&&(l==null?void 0:l.includes(G.COMPLETE)),T=(M=i==null?void 0:i.shipments)==null?void 0:M.every(p=>p.tracking.length===0),c=(U=i==null?void 0:i.items)==null?void 0:U.filter(p=>(p==null?void 0:p.quantityShipped)===0||(p==null?void 0:p.quantityShipped)<(p==null?void 0:p.quantityOrdered)),b=(H=i==null?void 0:i.items)==null?void 0:H.reduce((p,d)=>{const I=d.quantityOrdered-d.quantityShipped;return p+(I>0?I:0)},0);if(C&&(i!=null&&i.returns.length)){const p=i.returns.find(d=>d.returnNumber===a);return!p||p.tracking.length===0?null:n(ei,{slots:t,collapseThreshold:s,translations:e,returnData:p,routeTracking:f,routeProductDetails:h})}return!i||l!=null&&l.includes(G.CANCELED)?null:(j=i==null?void 0:i.shipments)!=null&&j.length?T&&!(c!=null&&c.length)&&S?null:g(N,{children:[(F=i==null?void 0:i.shipments)==null?void 0:F.map(({tracking:p,items:d,id:I},X)=>{const Q=d.reduce((r,O)=>{var y;return(r??0)+(((y=O.orderItem)==null?void 0:y.quantityShipped)??0)},0);return g(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingCardTitle}),p==null?void 0:p.map(r=>{var O;return g("div",{className:"order-shipping-status-card__header",role:"status",children:[g("div",{className:"order-shipping-status-card__header--content",children:[g("p",{children:[e.carrier," ",(O=r==null?void 0:r.carrier)==null?void 0:O.toLocaleUpperCase()," | ",r==null?void 0:r.number]}),n("p",{children:r==null?void 0:r.title})]}),t!=null&&t.DeliveryTrackActions?n(A,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:t==null?void 0:t.DeliveryTrackActions,context:{trackInformation:r}}):null]},r.number)}),S?null:n(x,{actionIconPosition:"right","data-testid":"dropinAccordion",children:n(E,{"data-position":X+1,defaultOpen:s>=(d==null?void 0:d.length),title:n(N,{children:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:Q,fields:{count:Q}})}),children:n($,{maxColumns:6,emptyGridContent:n(N,{}),className:"order-shipping-status-card__images",children:d==null?void 0:d.map(r=>{var y,Y,z,B,J,K;const O=(z=(Y=(y=r==null?void 0:r.orderItem)==null?void 0:y.product)==null?void 0:Y.thumbnail)==null?void 0:z.label,W=(K=(J=(B=r==null?void 0:r.orderItem)==null?void 0:B.product)==null?void 0:J.thumbnail)==null?void 0:K.url;return n(u,{href:(h==null?void 0:h(r))??"#",children:n(R,{alt:O,src:W||"",width:85,height:114})},r.id)})})})}),t!=null&&t.DeliveryTimeLine?n(A,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:t==null?void 0:t.DeliveryTimeLine,context:{}}):null]},I)}),c!=null&&c.length?g(o,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[n(v,{title:e.notYetShippedTitle}),n(x,{actionIconPosition:"right",children:n(E,{defaultOpen:s>=(c==null?void 0:c.length),title:n(V,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:b,fields:{count:b}}),children:n($,{maxColumns:6,emptyGridContent:n(N,{}),className:"order-shipping-status-card__images",children:c==null?void 0:c.map(p=>{var d,I;return n(u,{href:(h==null?void 0:h(p))??"#",children:n(R,{alt:(d=p.thumbnail)==null?void 0:d.label,src:((I=p.thumbnail)==null?void 0:I.url)||"",width:85,height:114})},p.id)})})})})]}):null]}):g(o,{variant:"secondary",className:"order-shipping-status-card",children:[n(v,{title:e.shippingInfoTitle}),n("div",{className:"order-shipping-status-card__header",children:g("div",{className:"order-shipping-status-card__header--content",children:[i!=null&&i.carrier?n("p",{children:i==null?void 0:i.carrier}):null,n("p",{children:e.noInfoTitle})]})})]})},ai=({slots:e,className:t,collapseThreshold:i,orderData:s,routeOrderDetails:h,routeTracking:f,routeProductDetails:C})=>{const{loading:a,order:u,isVirtualProduct:l}=ni({orderData:s}),m=D({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"});return!a&&l?null:n("div",{className:L(["order-shipping-status",t]),children:!a&&u?n(pi,{translations:m,routeOrderDetails:h,routeTracking:f,slots:e,orderData:u,collapseThreshold:i,routeProductDetails:C}):n(ii,{withCard:!1})})};export{ai as ShippingStatus,ai as default}; +import{jsx as i,jsxs as S,Fragment as _}from"@dropins/tools/preact-jsx-runtime.js";import{classes as $,VComponent as A,Slot as E}from"@dropins/tools/lib.js";import{Card as L,Header as w,Accordion as R,AccordionSection as G,ContentGrid as V,Image as q}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as x,useEffect as k}from"@dropins/tools/preact-hooks.js";import{events as D}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as nn}from"../chunks/useIsMobile.js";import{Text as B,useText as en}from"@dropins/tools/i18n.js";import{C as pn}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var M=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(M||{});const tn=({orderData:e})=>{const[r,n]=x(!0),[t,m]=x(e),[h,o]=x(!1);return k(()=>{const d=D.on("order/data",u=>{m(u),o(u==null?void 0:u.isVirtual),n(!1)},{eager:!0});return()=>{d==null||d.off()}},[]),{loading:r,order:t,isVirtualProduct:h}},Z=({value:e,variant:r="primary",size:n="medium",icon:t,className:m,children:h,disabled:o=!1,active:d=!1,activeChildren:u,activeIcon:p,href:C,...b})=>{let g="dropin-button";(t&&!h||t&&d&&!u||!t&&d&&p)&&(g="dropin-iconButton"),d&&u&&(g="dropin-button"),m=$([g,`${g}--${n}`,`${g}--${r}`,[`${g}--${r}--disabled`,o],h&&t&&`${g}--with-icon`,!h&&u&&t&&`${g}--with-icon`,d&&p&&`${g}--with-icon`,m]);const c=$(["dropin-button-icon",`dropin-button-icon--${r}`,[`dropin-button-icon--${r}--disabled`,o],t==null?void 0:t.props.className]),a=C?{node:i("a",{}),role:"link",href:C,...b,disabled:o,active:d,onKeyDown:y=>{o&&y.preventDefault()},tabIndex:o?-1:0}:{node:i("button",{}),role:"button",...b,value:e,disabled:o,active:d};return S(A,{...a,className:m,children:[t&&!d&&i(A,{node:t,className:c}),p&&d&&i(A,{node:p,className:c}),h&&!d&&(typeof h=="string"?i("span",{children:h}):h),d&&u&&(typeof u=="string"?i("span",{children:u}):u)]})},sn=({slots:e,collapseThreshold:r,translations:n,returnData:t,routeTracking:m,routeProductDetails:h})=>{var u;const o=nn(),d=h?"a":"span";return S(L,{variant:"secondary",className:$(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[i(w,{title:n.returnOrderCardTitle}),S("div",{children:[(u=t==null?void 0:t.tracking)==null?void 0:u.map((p,C)=>{var a,y;const b={title:"",number:(p==null?void 0:p.trackingNumber)??"",carrier:((a=p==null?void 0:p.carrier)==null?void 0:a.label)??""},g=m==null?void 0:m(b),c=g?()=>{window.open(g,"_blank","noreferrer")}:null;return S("div",{className:"order-shipping-status-card__header",children:[S("div",{children:[`${n.carrier} `,`${(y=b.carrier)==null?void 0:y.toLocaleUpperCase()} | `,b.number]}),c?i(Z,{onClick:c,children:n.trackButton}):null]},`${b.number}_${C}`)}),e!=null&&e.ReturnItemsDetails?i(E,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:t.items}}):null,i(R,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(G,{defaultOpen:r>=t.items.length,title:i(B,{id:"Order.ShippingStatusCard.itemText",plural:t.items.reduce((p,C)=>p+C.totalQuantity,0),fields:{count:t.items.reduce((p,C)=>p+C.totalQuantity,0)}}),children:i(V,{maxColumns:o?3:9,emptyGridContent:i(_,{}),className:$(["order-shipping-status-card__images",["order-shipping-status-card__images-3",o]]),children:t.items.map((p,C)=>{var c,a;const b=(c=p.thumbnail)==null?void 0:c.label,g=(a=p.thumbnail)==null?void 0:a.url;return i(d,{href:(h==null?void 0:h(p))??"#","data-testid":`${C}${p.uid}`,children:i(q,{alt:b,src:g,width:85,height:114})},`${C}${p.uid}`)})})})})]})]})},rn=({translations:e,slots:r,orderData:n,collapseThreshold:t=10,routeProductDetails:m,routeTracking:h})=>{var y,U,H,j,v,F,Q;const o=!!(n!=null&&n.returnNumber),d=n==null?void 0:n.returnNumber,u=m?"a":"span",p=(y=n==null?void 0:n.status)==null?void 0:y.toLocaleLowerCase(),b=((U=n==null?void 0:n.shipments)==null?void 0:U.length)===1&&(p==null?void 0:p.includes(M.COMPLETE)),g=(H=n==null?void 0:n.shipments)==null?void 0:H.every(s=>s.tracking.length===0),c=(j=n==null?void 0:n.items)==null?void 0:j.filter(s=>(s==null?void 0:s.quantityShipped)===0||(s==null?void 0:s.quantityShipped)<(s==null?void 0:s.quantityOrdered)),a=(v=n==null?void 0:n.items)==null?void 0:v.reduce((s,f)=>{const I=f.quantityOrdered-f.quantityShipped;return s+(I>0?I:0)},0);if(o&&(n!=null&&n.returns.length)){const s=n.returns.find(f=>f.returnNumber===d);return!s||s.tracking.length===0?null:i(sn,{slots:r,collapseThreshold:t,translations:e,returnData:s,routeTracking:h,routeProductDetails:m})}return!n||p!=null&&p.includes(M.CANCELED)?null:(F=n==null?void 0:n.shipments)!=null&&F.length?g&&!(c!=null&&c.length)&&b?null:S(_,{children:[(Q=n==null?void 0:n.shipments)==null?void 0:Q.map(({tracking:s,items:f,id:I},P)=>{const K=f.reduce((l,N)=>{var O;return l+(((O=N.orderItem)==null?void 0:O.quantityShipped)??0)},0);return S(L,{variant:"secondary",className:"order-shipping-status-card",children:[i(w,{title:e.shippingCardTitle}),s==null?void 0:s.map(l=>{var T;const N=h==null?void 0:h(l),O=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:[e.carrier," ",(T=l==null?void 0:l.carrier)==null?void 0:T.toLocaleUpperCase()," | ",l==null?void 0:l.number]}),i("p",{children:l==null?void 0:l.title})]}),r!=null&&r.DeliveryTrackActions?i(E,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:r==null?void 0:r.DeliveryTrackActions,context:{trackInformation:l}}):O?i(Z,{onClick:O,children:e.trackButton}):null]},l.number)}),b?null:i(R,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(G,{"data-position":P+1,defaultOpen:t>=(f==null?void 0:f.length),title:i(_,{children:i(B,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:K,fields:{count:K}})}),children:i(V,{maxColumns:6,emptyGridContent:i(_,{}),className:"order-shipping-status-card__images",children:f==null?void 0:f.map(l=>{var T,W,Y,z,J,X;const N=(Y=(W=(T=l==null?void 0:l.orderItem)==null?void 0:T.product)==null?void 0:W.thumbnail)==null?void 0:Y.label,O=(X=(J=(z=l==null?void 0:l.orderItem)==null?void 0:z.product)==null?void 0:J.thumbnail)==null?void 0:X.url;return i(u,{href:(m==null?void 0:m(l))??"#",children:i(q,{alt:N,src:O||"",width:85,height:114})},l.id)})})})}),r!=null&&r.DeliveryTimeLine?i(E,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:r==null?void 0:r.DeliveryTimeLine,context:{}}):null]},I)}),c!=null&&c.length?S(L,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[i(w,{title:e.notYetShippedTitle}),i(R,{actionIconPosition:"right",children:i(G,{defaultOpen:t>=(c==null?void 0:c.length),title:i(B,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:a,fields:{count:a}}),children:i(V,{maxColumns:6,emptyGridContent:i(_,{}),className:"order-shipping-status-card__images",children:c==null?void 0:c.map(s=>{var f,I;return i(u,{href:(m==null?void 0:m(s))??"#",children:i(q,{alt:(f=s.thumbnail)==null?void 0:f.label,src:((I=s.thumbnail)==null?void 0:I.url)||"",width:85,height:114})},s.id)})})})})]}):null]}):S(L,{variant:"secondary",className:"order-shipping-status-card",children:[i(w,{title:e.shippingInfoTitle}),i("div",{className:"order-shipping-status-card__header",children:S("div",{className:"order-shipping-status-card__header--content",children:[n!=null&&n.carrier?i("p",{children:n==null?void 0:n.carrier}):null,i("p",{children:e.noInfoTitle})]})})]})},bn=({slots:e,className:r,collapseThreshold:n,orderData:t,routeOrderDetails:m,routeTracking:h,routeProductDetails:o})=>{const{loading:d,order:u,isVirtualProduct:p}=tn({orderData:t}),C=en({carrier:"Order.ShippingStatusCard.carrier",prepositionOf:"Order.ShippingStatusCard.prepositionOf",returnOrderCardTitle:"Order.ShippingStatusCard.returnOrderCardTitle",shippingCardTitle:"Order.ShippingStatusCard.shippingCardTitle",shippingInfoTitle:"Order.ShippingStatusCard.shippingInfoTitle",notYetShippedTitle:"Order.ShippingStatusCard.notYetShippedTitle",noInfoTitle:"Order.ShippingStatusCard.noInfoTitle",returnNumber:"Order.ShippingStatusCard.returnNumber",orderNumber:"Order.ShippingStatusCard.orderNumber",trackButton:"Order.ShippingStatusCard.trackButton"});return!d&&p?null:i("div",{className:$(["order-shipping-status",r]),children:!d&&u?i(rn,{translations:C,routeOrderDetails:m,routeTracking:h,slots:e,orderData:u,collapseThreshold:n,routeProductDetails:o}):i(pn,{withCard:!1})})};export{bn as ShippingStatus,bn as default}; diff --git a/scripts/__dropins__/storefront-order/data/models/order-details.d.ts b/scripts/__dropins__/storefront-order/data/models/order-details.d.ts index d4a784fe70..cab00e9194 100644 --- a/scripts/__dropins__/storefront-order/data/models/order-details.d.ts +++ b/scripts/__dropins__/storefront-order/data/models/order-details.d.ts @@ -93,6 +93,7 @@ export type OrderItemModel = { quantityShipped: number; requestQuantity: number; totalQuantity: number; + returnableQuantity?: number; }; export type ShipmentItemsModel = { id: string; diff --git a/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts b/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts index bd92ba7964..794ed95b2b 100644 --- a/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts +++ b/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts @@ -2,6 +2,5 @@ import { AttributesListItems, ResponseAttributesFormItemsProps } from '../../typ import { AttributesFormModel } from '../models'; export declare const cloneArrayIfExists: (fields: ResponseAttributesFormItemsProps[]) => any; -export declare const transformAttributesForm: (response: ResponseAttributesFormItemsProps[] | AttributesListItems[] | [ -]) => AttributesFormModel[]; +export declare const transformAttributesForm: (items?: ResponseAttributesFormItemsProps[] | AttributesListItems[] | []) => AttributesFormModel[]; //# sourceMappingURL=transform-attributes-form.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 6f5d8c9854..b35ed728f9 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731334555601} \ No newline at end of file +{"at":1731423614901} \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/render.js b/scripts/__dropins__/storefront-order/render.js index e6717910b4..e0fff43820 100644 --- a/scripts/__dropins__/storefront-order/render.js +++ b/scripts/__dropins__/storefront-order/render.js @@ -1,2 +1,3 @@ -(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)}})('.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" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}',{styleId:"order"}); +(function(n,e){try{if(typeof document<"u"){const r=document.createElement("style"),a=e.styleId;for(const t in e.attributes)r.setAttribute(t,e.attributes[t]);r.setAttribute("data-dropin",a),r.appendChild(document.createTextNode(n));const o=document.querySelector('style[data-dropin="sdk"]');if(o)o.after(r);else{const t=document.querySelector('link[rel="stylesheet"], style');t?t.before(r):document.head.append(r)}}}catch(r){console.error("dropin-styles (injectCodeFunction)",r)}})(`.dropin-button,.dropin-iconButton{border:0 none;cursor:pointer;white-space:normal}.dropin-button{border-radius:var(--shape-border-radius-3);font-size:var(--type-button-1-font);font-weight:var(--type-button-1-font);padding:var(--spacing-xsmall) var(--spacing-medium);display:flex;justify-content:center;align-items:center;text-align:left;word-wrap:break-word}.dropin-iconButton{height:var(--spacing-xbig);width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button:disabled,.dropin-iconButton:disabled{pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button:not(:disabled),.dropin-iconButton:not(:disabled){cursor:pointer}.dropin-button:focus,.dropin-iconButton:focus{outline:none}.dropin-button:focus-visible,.dropin-iconButton:focus-visible{outline:var(--spacing-xxsmall) solid var(--color-button-focus)}.dropin-button--primary,a.dropin-button--primary,.dropin-iconButton--primary{border:none;background:var(--color-brand-500) 0 0% no-repeat padding-box;color:var(--color-neutral-50);text-align:left;margin-right:0}.dropin-iconButton--primary{border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button--primary--disabled,a.dropin-button--primary--disabled,.dropin-iconButton--primary--disabled{background:var(--color-neutral-300) 0 0% no-repeat padding-box;color:var(--color-neutral-500);fill:var(--color-neutral-300);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--primary:hover,a.dropin-button--primary:hover,.dropin-iconButton--primary:hover,.dropin-button--primary:focus:hover,.dropin-iconButton--primary:focus:hover{background-color:var(--color-button-hover);text-decoration:none}.dropin-button--primary:focus,.dropin-iconButton--primary:focus{background-color:var(--color-brand-500)}.dropin-button--primary:hover:active,.dropin-iconButton--primary:hover:active{background-color:var(--color-button-active)}.dropin-button--secondary,a.dropin-button--secondary,.dropin-iconButton--secondary{border:var(--shape-border-width-2) solid var(--color-brand-500);background:none 0 0% no-repeat padding-box;color:var(--color-brand-500);padding-top:calc(var(--spacing-xsmall) - var(--shape-border-width-2));padding-left:calc(var(--spacing-medium) - var(--shape-border-width-2))}.dropin-iconButton--secondary{border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall);padding-top:calc(var(--spacing-xsmall) - var(--shape-border-width-2));padding-left:calc(var(--spacing-xsmall) - var(--shape-border-width-2))}.dropin-button--secondary--disabled,a.dropin-button--secondary--disabled,.dropin-iconButton--secondary--disabled{border:var(--shape-border-width-2) solid var(--color-neutral-300);background:none 0 0% no-repeat padding-box;color:var(--color-neutral-500);fill:var(--color-neutral-300);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--secondary:hover,a.dropin-button--secondary:hover,.dropin-iconButton--secondary:hover{border:var(--shape-border-width-2) solid var(--color-button-hover);color:var(--color-button-hover);text-decoration:none}.dropin-button--secondary:active,.dropin-iconButton--secondary:active{border:var(--shape-border-width-2) solid var(--color-button-active);color:var(--color-button-active)}.dropin-button--tertiary,a.dropin-button--tertiary,.dropin-iconButton--tertiary{border:none;background:none 0 0% no-repeat padding-box;color:var(--color-brand-500)}.dropin-iconButton--tertiary{border:none;border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button--tertiary--disabled,a.dropin-button--tertiary--disabled,.dropin-iconButton--tertiary--disabled{border:none;color:var(--color-neutral-500);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--tertiary:hover,a.dropin-button--tertiary:hover,.dropin-iconButton--tertiary:hover{color:var(--color-button-hover);text-decoration:none}.dropin-button--tertiary:active,.dropin-iconButton--tertiary:active{color:var(--color-button-active)}.dropin-button--tertiary:focus-visible,.dropin-iconButton--tertiary:focus-visible{-webkit-box-shadow:inset 0 0 0 2px var(--color-neutral-800);-moz-box-shadow:inset 0 0 0 2px var(--color-neutral-800);box-shadow:inset 0 0 0 2px var(--color-neutral-800)}.dropin-button--large{font:var(--type-button-1-font);letter-spacing:var(--type-button-1-letter-spacing)}.dropin-button--medium{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.dropin-button-icon{height:24px}.dropin-button--with-icon{column-gap:var(--spacing-xsmall);row-gap:var(--spacing-xsmall)} +.order-order-search-form{gap:var(--spacing-small);border-color:transparent}.order-order-search-form .dropin-card__content{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}.order-order-search-form p{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.order-order-search-form__title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin:0}.order-order-search-form__wrapper{display:grid;grid-template-columns:1fr;grid-template-rows:auto;grid-template-areas:"email" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}`,{styleId:"order"}); import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as n}from"@dropins/tools/lib.js";import{useState as s,useEffect as d}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as c}from"@dropins/tools/event-bus.js";const u={CreateReturn:{headerText:"Return items",downloadableCount:"Files",returnedItems:"Returned items:",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",postcode:"Zip Code",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},ShippingStatusCard:{orderNumber:"Order number:",returnNumber:"Return number:",itemText:{none:"",one:"Package contents ({{count}} item)",many:"Package contents ({{count}} items)"},trackButton:"Track package",carrier:"Carrier:",prepositionOf:"of",returnOrderCardTitle:"Package details",shippingCardTitle:"Package details",shippingInfoTitle:"Shipping information",notYetShippedTitle:"Not yet shipped",notYetShippedImagesTitle:{singular:"Package contents ({{count}} item)",plural:"Package contents ({{count}} items)"}},OrderStatusContent:{noInfoTitle:"Check back later for more details.",returnMessage:"The order was placed on {ORDER_CREATE_DATE} and your return process started on {RETURN_CREATE_DATE}",returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."}},p={Order:u},m={default:p},h=({children:t})=>{const[o,i]=s("en_US");return d(()=>{const e=c.on("locale",a=>{i(a)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},T=new n(r(h,{}));export{T as render}; diff --git a/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts b/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts index b3b80df6bf..e7df546ad6 100644 --- a/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts @@ -246,6 +246,14 @@ export interface ErrorProps { message?: string; }[]; } +type GetOrderDetailsByParams = { + orderId?: string; + returnRef?: string; + queryType: T; + returnsPageSize: number; +}; +export interface GetOrderDetailsByIdProps extends GetOrderDetailsByParams { +} export interface OrdersResponse extends ErrorProps { data?: { customer?: { diff --git a/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts b/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts index fef07eaf92..02bc1b5ed4 100644 --- a/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts @@ -1,10 +1,15 @@ import { SlotProps } from '@dropins/tools/types/elsie/src/src/lib'; -import { OrderDataModel, OrderItemModel, OrdersReturnItemsPropsModel, OrdersReturnPropsModel, OrdersReturnTrackingProps, PageInfoProps } from '../data/models'; +import { OrderDataModel, OrderItemModel, OrdersReturnItemsPropsModel, OrdersReturnPropsModel, PageInfoProps } from '../data/models'; export interface IconConfig { size: '12' | '16' | '24' | '32' | '64' | '80' | undefined; stroke: '4' | '1' | '2' | '3' | undefined; } +type routeTrackingProps = { + carrier: string; + title: string; + number: string; +}; export interface ReturnsListProps { slots?: { ReturnItemsDetails?: SlotProps<{ @@ -28,7 +33,7 @@ export interface ReturnsListProps { token: string; orderNumber: string; }) => string; - routeTracking?: (track: OrdersReturnTrackingProps) => string; + routeTracking?: (track: routeTrackingProps) => string; routeReturnsList?: () => string; routeProductDetails?: (orderItem?: OrderItemModel) => string; withThumbnails?: boolean; @@ -65,9 +70,10 @@ export interface OrderReturnsProps { orderNumber: string; }) => string; routeProductDetails?: (product: any) => string; - routeTracking?: (track: OrdersReturnTrackingProps) => string; + routeTracking?: (track: routeTrackingProps) => string; } export interface UseOrderReturnsProps { orderData?: OrderDataModel; } +export {}; //# sourceMappingURL=returnsList.types.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/shippingStatus.types.d.ts b/scripts/__dropins__/storefront-order/types/shippingStatus.types.d.ts index 055870d026..02969c6a2d 100644 --- a/scripts/__dropins__/storefront-order/types/shippingStatus.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/shippingStatus.types.d.ts @@ -1,12 +1,17 @@ import { HTMLAttributes } from 'preact/compat'; import { SlotProps } from '@dropins/tools/types/elsie/src/lib'; -import { OrderDataModel, OrdersReturnPropsModel, OrdersReturnTrackingProps } from '../data/models'; +import { OrderDataModel, OrdersReturnPropsModel } from '../data/models'; -type routeTypes = { +type routeOrderDetailsTypes = { returnNumber?: string; token?: string; orderNumber?: string; }; +type routeTrackingProps = { + carrier: string; + title: string; + number: string; +}; export interface ShippingStatusProps extends HTMLAttributes { orderData?: OrderDataModel; collapseThreshold?: number; @@ -15,8 +20,8 @@ export interface ShippingStatusProps extends HTMLAttributes { DeliveryTrackActions?: SlotProps; ReturnItemsDetails?: SlotProps; }; - routeOrderDetails?: ({ returnNumber, token, orderNumber, }: routeTypes) => string; - routeTracking?: (track: OrdersReturnTrackingProps) => string; + routeOrderDetails?: ({ returnNumber, token, orderNumber, }: routeOrderDetailsTypes) => string; + routeTracking?: (track: routeTrackingProps) => string; routeProductDetails?: (product: any) => string; } export interface UseShippingStatusProps { From 48ca06952324a6be7c16d3c86d31bb203bc4ddfa Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 12 Nov 2024 20:47:20 +0200 Subject: [PATCH 19/30] test bug? 2 --- .../api/getAttributesList/getAttributesList.d.ts | 3 ++- .../__dropins__/storefront-order/chunks/ReturnsListContent.js | 2 +- .../__dropins__/storefront-order/containers/CreateReturn.js | 2 +- .../data/transforms/transform-attributes-form.d.ts | 3 ++- scripts/__dropins__/storefront-order/reload | 2 +- scripts/__dropins__/storefront-order/render.js | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/__dropins__/storefront-order/api/getAttributesList/getAttributesList.d.ts b/scripts/__dropins__/storefront-order/api/getAttributesList/getAttributesList.d.ts index eaf3e29ac2..d0a1d0bbec 100644 --- a/scripts/__dropins__/storefront-order/api/getAttributesList/getAttributesList.d.ts +++ b/scripts/__dropins__/storefront-order/api/getAttributesList/getAttributesList.d.ts @@ -1,4 +1,5 @@ import { AttributesFormModel } from '../../data/models'; -export declare const getAttributesList: (entityType: string) => Promise; +export declare const getAttributesList: (entityType: string) => Promise; //# sourceMappingURL=getAttributesList.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index 61691fd202..eb18628db7 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1 +1 @@ -import{jsx as r,jsxs as s,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as O}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as V,Card as P,ContentGrid as D,Image as r1,Header as Q,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as k}from"@dropins/tools/i18n.js";const q=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"})))),a1=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"})),J=({typeList:L,isEmpty:p,minifiedView:_,message:t})=>{const a=t1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,t]);return!p||!L||!a.text?null:r(R,{className:W(["order-empty-list",a.className,_?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:p=!1,withOrderNumber:_=!1,slots:t,pageInfo:a,withReturnsListButton:$=!0,isMobile:y=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:N=!0,withThumbnails:A=!0,selectedPage:B=1,handleSetSelectPage:S,routeReturnDetails:d,routeOrderDetails:g,routeTracking:f,routeReturnsList:v,routeProductDetails:m,loading:b})=>{const z=h?X:i.length,j=m!=null&&m()?"a":"span",x=w(()=>i.slice(0,z).map((e,I)=>{var F,G;const E=((e==null?void 0:e.items)??[]).reduce((n,o)=>(o.totalQuantity??0)+n,0);return r(P,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(k,{id:`Order.Returns.${L}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),p?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(g==null?void 0:g({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((n,o)=>{var M,Z;const C={title:"",number:(n==null?void 0:n.trackingNumber)??"",carrier:((M=n==null?void 0:n.carrier)==null?void 0:M.label)??""},H=f==null?void 0:f(C);return s("p",{children:[`${c.carrier} `,`${(Z=C.carrier)==null?void 0:Z.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer",children:n.trackingNumber}):r("span",{children:n.trackingNumber})]},`${C.number}_${o}`)}),t!=null&&t.ReturnItemsDetails?r(O,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[E," ",r(k,{id:`Order.Returns.${L}.returnsList.itemText`,plural:E,fields:{count:E}})]}):null]}),A?r(D,{maxColumns:y?3:9,emptyGridContent:r(u,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",y]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((n,o)=>{var M,Z;const C=(M=n.thumbnail)==null?void 0:M.label,H=(Z=n.thumbnail)==null?void 0:Z.url;return r(j,{href:(m==null?void 0:m(n))??"#",children:r(r1,{alt:C,src:H,width:85,height:114})},o+n.uid)})}):null,t!=null&&t.DetailsActionParams?r(O,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:t==null?void 0:t.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:q,...T})})]})},I)}),[i,z,L,p,c,d,_,g,t,A,y,m,f,j]),Y=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,b?r(U,{withCard:!1}):s(u,{children:[x,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(v==null?void 0:v())??"#",children:r(P,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(V,{source:q,...T})]})})}):null]})]}),[v,$,N,c,x,h,i.length,b]),K=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,b?r(U,{withCard:!1}):s(u,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),x,(a==null?void 0:a.totalPages)>1?r(e1,{totalPages:a==null?void 0:a.totalPages,currentPage:B,onChange:S}):null]})]}),[x,h,i,c,a==null?void 0:a.totalPages,B,S,b,N]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{u1 as R}; +import{jsx as r,jsxs as s,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as q}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as V,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as n1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as t1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const k=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"})))),a1=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"})),J=({typeList:L,isEmpty:p,minifiedView:_,message:n})=>{const a=n1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:n}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,n]);return!p||!L||!a.text?null:r(R,{className:W(["order-empty-list",a.className,_?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:p=!1,withOrderNumber:_=!1,slots:n,pageInfo:a,withReturnsListButton:$=!0,isMobile:y=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:o=!1,withHeader:N=!0,withThumbnails:A=!0,selectedPage:B=1,handleSetSelectPage:S,routeReturnDetails:d,routeOrderDetails:g,routeTracking:f,routeReturnsList:v,routeProductDetails:m,loading:b})=>{const z=o?X:i.length;console.log("orderReturns",i);const j=m!=null&&m()?"a":"span",x=w(()=>i.slice(0,z).map((e,I)=>{var F,G;const E=((e==null?void 0:e.items)??[]).reduce((t,h)=>(h.requestQuantity??0)+t,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${L}.returnsList.resturnStatus.${t1(e.returnStatus)}`})}),p?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(g==null?void 0:g({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((t,h)=>{var M,Z;const C={title:"",number:(t==null?void 0:t.trackingNumber)??"",carrier:((M=t==null?void 0:t.carrier)==null?void 0:M.label)??""},H=f==null?void 0:f(C);return s("p",{children:[`${c.carrier} `,`${(Z=C.carrier)==null?void 0:Z.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer",children:t.trackingNumber}):r("span",{children:t.trackingNumber})]},`${C.number}_${h}`)}),n!=null&&n.ReturnItemsDetails?r(q,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:n==null?void 0:n.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[E," ",r(U,{id:`Order.Returns.${L}.returnsList.itemText`,plural:E,fields:{count:E}})]}):null]}),A?r(D,{maxColumns:y?3:9,emptyGridContent:r(u,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",y]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((t,h)=>{var M,Z;const C=(M=t.thumbnail)==null?void 0:M.label,H=(Z=t.thumbnail)==null?void 0:Z.url;return r(j,{href:(m==null?void 0:m(t))??"#",children:r(r1,{alt:C,src:H,width:85,height:114})},h+t.uid)})}):null,n!=null&&n.DetailsActionParams?r(q,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:n==null?void 0:n.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:k,...T})})]})},I)}),[i,z,L,p,c,d,_,g,n,A,y,m,f,j]),Y=w(()=>s(u,{children:[N?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,b?r(Q,{withCard:!1}):s(u,{children:[x,r(J,{minifiedView:o,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(v==null?void 0:v())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(V,{source:k,...T})]})})}):null]})]}),[v,$,N,c,x,o,i.length,b]),K=w(()=>s(u,{children:[N?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,b?r(Q,{withCard:!1}):s(u,{children:[r(J,{minifiedView:o,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),x,(a==null?void 0:a.totalPages)>1?r(e1,{totalPages:a==null?void 0:a.totalPages,currentPage:B,onChange:S}):null]})]}),[x,o,i,c,a==null?void 0:a.totalPages,B,S,b,N]);return r("div",{className:"order-returns-list-content",children:o?Y:K})};export{u1 as R}; diff --git a/scripts/__dropins__/storefront-order/containers/CreateReturn.js b/scripts/__dropins__/storefront-order/containers/CreateReturn.js index a39a144815..1feb8dbebb 100644 --- a/scripts/__dropins__/storefront-order/containers/CreateReturn.js +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn.js @@ -1 +1 @@ -import{jsx as r,jsxs as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as q,Slot as P}from"@dropins/tools/lib.js";import{Checkbox as H,Button as Q,CartItem as V,Image as W,Header as Z,InLineAlert as D}from"@dropins/tools/components.js";import{u as z,a as U}from"../chunks/OrderCancel.js";import{useState as _,useRef as K,useEffect as T,useCallback as F}from"@dropins/tools/preact-hooks.js";import{events as G}from"@dropins/tools/event-bus.js";import{g as J}from"../chunks/getFormValues.js";import{s as X}from"../chunks/setTaxStatus.js";import{createRef as Y,Fragment as I}from"@dropins/tools/preact.js";import{o as ee,c as te,n as ne,r as re,m as ae}from"../chunks/returnOrdersHelper.js";import{g as se,r as ie}from"../chunks/requestReturn.js";import{g as ce}from"../chunks/getStoreConfig.js";import*as y from"@dropins/tools/preact-compat.js";import{S as ue,C as oe}from"../chunks/CartSummaryItem.js";import{O as le}from"../chunks/OrderLoaders.js";import{useText as de}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const pe=a=>y.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},y.createElement("g",{clipPath:"url(#clip0_841_1324)"},y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),y.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"})),y.createElement("defs",null,y.createElement("clipPath",{id:"clip0_841_1324"},y.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),he=a=>y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},y.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"}),y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),me=({onSuccess:a,onError:s,handleSetInLineAlert:c,orderData:d})=>{const[u,p]=_(d),[C,f]=_("products"),[O,b]=_(!0),[i,g]=_([]),[S,w]=_([]),[e,L]=_({taxIncluded:!1,taxExcluded:!1}),[t,h]=_([]),k=K([]);k.current.length!==i.length&&(k.current=i.map((n,o)=>k.current[o]||Y())),T(()=>{const n=G.on("order/data",o=>{p(o),h(ee(o)),b(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ce().then(n=>{if(n){const o=X(n==null?void 0:n.shoppingCartDisplayPrice);L(o)}})},[]),T(()=>{se("RMA_ITEM").then(n=>{n.length&&(w(n),b(!1))})},[]);const N=F(n=>{g(o=>o.findIndex(l=>(l==null?void 0:l.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(l=>(l==null?void 0:l.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),R=F(n=>{f(n),c(),n==="products"&&g([])},[c]),A=F((n,o)=>{const v=i.map(l=>l.productSku===o?{...l,currentReturnOrderQuantity:n}:l);g(v)},[i]),E=F(async(n,o)=>{if(!o)return null;b(!0);const v={orderUid:(u==null?void 0:u.id)??"",contactEmail:(u==null?void 0:u.email)??""},l=[];k.current.length&&k.current.forEach(({current:m})=>{var M;const $=m==null?void 0:m.name.replace(/_\d+$/,""),j=((M=m==null?void 0:m.dataset)==null?void 0:M.quantity)??1,B=te(J(m));l.push({orderItemUid:$,quantityToReturn:+j,...ne(B)})}),ie({...v,items:l}).then(m=>{m&&(a==null||a(m),R("success"),c())}).catch(m=>{s==null||s(m.message),c({type:"error",heading:m.message})}),b(!1)},[R,s,a,c,u]);return{order:u,steps:C,loading:O,formsRef:k,taxConfig:e,attributesList:S,selectedProductList:i,itemsEligibleForReturn:t,handleSelectedProductList:N,handleSetQuantity:A,handleChangeStep:R,onSubmit:E}},ge={success:r(he,{}),warning:r(pe,{}),error:r(ue,{})},fe=()=>{const[a,s]=_({type:"success",heading:""}),c=F(d=>{if(!(d!=null&&d.type)){s({type:"success",heading:""});return}const u=ge[d.type];s({...d,icon:u})},[]);return{inLineAlertProps:a,handleSetInLineAlert:c}},be=({itemsEligibleForReturn:a,slots:s,loading:c=!1,taxConfig:d,translations:u={},selectedProductList:p,handleSelectedProductList:C,showConfigurableOptions:f,handleSetQuantity:O,handleChangeStep:b})=>x("ul",{className:"order-return-order-product-list",children:[a==null?void 0:a.map((i,g)=>{const S=p.some(e=>(e==null?void 0:e.productSku)===i.productSku&&i.eligibleForReturn&&i.quantityReturned===0),w=i.returnableQuantity===0?1:i.returnableQuantity;return x("li",{className:q(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",!i.eligibleForReturn]]),children:[r(H,{"data-testid":`key_${g}`,name:`key_${g+1}`,checked:S,disabled:!i.eligibleForReturn||i.quantityReturned!==0,onChange:()=>{C({...i,currentReturnOrderQuantity:1})}}),r(oe,{loading:c,product:{...i,totalQuantity:w},itemType:"",taxConfig:d,translations:u,showConfigurableOptions:f,disabledIncrementer:!S,isReturnProductList:!0,onQuantity:(i==null?void 0:i.returnableQuantity)>1?e=>O(e,i.productSku):void 0}),s!=null&&s.ReturnOrderItem?r(P,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:s==null?void 0:s.ReturnOrderItem,context:{}}):null]},g)}),r("li",{className:"order-return-order-product-list__item",children:r(Q,{type:"button",onClick:()=>b("attributes"),disabled:!p.length,children:u.nextStep})})]}),ke=({routeReturnSuccess:a,translations:s,orderData:c})=>{const d=()=>{window.location.href=(a==null?void 0:a(c))??"#"};return 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(Q,{onClick:d,type:"button",children:s.backStore})]})},ye=({slots:a,formsRef:s,selectedProductList:c,loading:d,fieldsConfig:u,translations:p,handleChangeStep:C,onSubmit:f})=>{const{formData:O,errors:b,formRef:i,handleChange:g,handleBlur:S,handleSubmit:w}=z({fieldsConfig:re(u,c==null?void 0:c.length),onSubmit:f});return x("form",{className:"order-return-reason-form",ref:i,onSubmit:w,name:"returnReasonForm",children:[c.map((e,L)=>{var E,n,o,v,l;const t=(e==null?void 0:e.giftCard)||{},h=e==null?void 0:e.product,k=ae(u,L),N=`${e==null?void 0:e.id}_${L}`,R=(e==null?void 0:e.currentReturnOrderQuantity)??1,A={...e!=null&&e.currentReturnOrderQuantity?{Quantity:R}:{},..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in t?{[p.sender]:t==null?void 0:t.senderName}:{},..."senderEmail"in t&&(t!=null&&t.senderEmail)?{[p.sender]:t==null?void 0:t.senderEmail}:{},..."recipientName"in t&&(t!=null&&t.recipientName)?{[p.recipient]:t==null?void 0:t.recipientName}:{},..."recipientEmail"in t&&(t!=null&&t.recipientEmail)?{[p.recipient]:t==null?void 0:t.recipientEmail}:{},..."message"in t&&(t!=null&&t.message)?{[p.message]:t==null?void 0:t.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(E=e==null?void 0:e.downloadableLinks)==null?void 0:E.count} ${p.downloadableCount}`]:(n=e==null?void 0:e.downloadableLinks)==null?void 0:n.result}:{}};return x(I,{children:[r(V,{loading:d,title:r("div",{"data-testid":"product-name",children:(o=e==null?void 0:e.product)==null?void 0:o.name}),sku:r("div",{children:h==null?void 0:h.sku}),image:r(W,{src:((v=h==null?void 0:h.thumbnail)==null?void 0:v.url)??"",alt:((l=h==null?void 0:h.thumbnail)==null?void 0:l.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:A}),r("form",{name:N,ref:s==null?void 0:s.current[L],"data-quantity":R,children:r(U,{className:"className",loading:d,fields:k,onChange:g,onBlur:S,errors:b,values:O})})]},L)}),a!=null&&a.ReturnFormActions?r(P,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:a==null?void 0:a.ReturnFormActions,context:{handleChangeStep:C}}):x("div",{className:"order-return-reason-form__actions",children:[r(Q,{variant:"secondary",type:"button",onClick:()=>{C("products")},children:p.backStep}),r(Q,{children:p.submit})]})]})},He=({className:a,orderData:s,slots:c,onSuccess:d,onError:u,routeReturnSuccess:p,showConfigurableOptions:C})=>{const f=de({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"}),{inLineAlertProps:O,handleSetInLineAlert:b}=fe(),{order:i,itemsEligibleForReturn:g,formsRef:S,taxConfig:w,attributesList:e,steps:L,loading:t,selectedProductList:h,handleSelectedProductList:k,handleSetQuantity:N,handleChangeStep:R,onSubmit:A}=me({orderData:s,onSuccess:d,onError:u,handleSetInLineAlert:b});if(t)return r("div",{children:r(le,{})});if(!t&&!e.length)return r("div",{});const E={products:r(be,{itemsEligibleForReturn:g,slots:c,translations:f,loading:t,taxConfig:w,selectedProductList:h,handleSelectedProductList:k,showConfigurableOptions:C,handleSetQuantity:N,handleChangeStep:R}),attributes:r(ye,{slots:c,formsRef:S,loading:t,fieldsConfig:e,selectedProductList:h,handleChangeStep:R,translations:f,onSubmit:A}),success:r(ke,{translations:f,routeReturnSuccess:p,orderData:i}),error:null};return x("div",{className:q(["order-create-return",a]),children:[r(Z,{title:f.headerText}),O.heading?r(D,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...O}):null,E[L]]})};export{He as CreateReturn,He as default}; +import{jsx as r,jsxs as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as q,Slot as P}from"@dropins/tools/lib.js";import{Checkbox as H,Button as Q,CartItem as V,Image as W,Header as Z,InLineAlert as D}from"@dropins/tools/components.js";import{u as z,a as U}from"../chunks/OrderCancel.js";import{useState as _,useRef as K,useEffect as T,useCallback as F}from"@dropins/tools/preact-hooks.js";import{events as G}from"@dropins/tools/event-bus.js";import{g as J}from"../chunks/getFormValues.js";import{s as X}from"../chunks/setTaxStatus.js";import{createRef as Y,Fragment as I}from"@dropins/tools/preact.js";import{o as ee,c as te,n as ne,r as re,m as ae}from"../chunks/returnOrdersHelper.js";import{g as se,r as ie}from"../chunks/requestReturn.js";import{g as ce}from"../chunks/getStoreConfig.js";import*as y from"@dropins/tools/preact-compat.js";import{S as ue,C as oe}from"../chunks/CartSummaryItem.js";import{O as le}from"../chunks/OrderLoaders.js";import{useText as de}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const pe=a=>y.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},y.createElement("g",{clipPath:"url(#clip0_841_1324)"},y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),y.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"})),y.createElement("defs",null,y.createElement("clipPath",{id:"clip0_841_1324"},y.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),he=a=>y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},y.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"}),y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),me=({onSuccess:a,onError:s,handleSetInLineAlert:c,orderData:d})=>{const[u,p]=_(d),[C,f]=_("products"),[O,b]=_(!0),[i,g]=_([]),[S,w]=_([]),[e,L]=_({taxIncluded:!1,taxExcluded:!1}),[t,h]=_([]),k=K([]);k.current.length!==i.length&&(k.current=i.map((n,o)=>k.current[o]||Y())),T(()=>{const n=G.on("order/data",o=>{p(o),h(ee(o)),b(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ce().then(n=>{if(n){const o=X(n==null?void 0:n.shoppingCartDisplayPrice);L(o)}})},[]),T(()=>{se("RMA_ITEM").then(n=>{n.length&&(w(n),b(!1))})},[]);const N=F(n=>{g(o=>o.findIndex(l=>(l==null?void 0:l.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(l=>(l==null?void 0:l.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),R=F(n=>{f(n),c(),n==="products"&&g([])},[c]),A=F((n,o)=>{const v=i.map(l=>l.productSku===o?{...l,currentReturnOrderQuantity:n}:l);g(v)},[i]),E=F(async(n,o)=>{if(!o)return null;b(!0);const v={orderUid:(u==null?void 0:u.id)??"",contactEmail:(u==null?void 0:u.email)??""},l=[];k.current.length&&k.current.forEach(({current:m})=>{var M;const $=m==null?void 0:m.name.replace(/_\d+$/,""),j=((M=m==null?void 0:m.dataset)==null?void 0:M.quantity)??1,B=te(J(m));l.push({orderItemUid:$,quantityToReturn:+j,...ne(B)})}),ie({...v,items:l}).then(m=>{m&&(a==null||a(m),R("success"),c())}).catch(m=>{s==null||s(m.message),c({type:"error",heading:m.message})}),b(!1)},[R,s,a,c,u]);return{order:u,steps:C,loading:O,formsRef:k,taxConfig:e,attributesList:S,selectedProductList:i,itemsEligibleForReturn:t,handleSelectedProductList:N,handleSetQuantity:A,handleChangeStep:R,onSubmit:E}},ge={success:r(he,{}),warning:r(pe,{}),error:r(ue,{})},fe=()=>{const[a,s]=_({type:"success",heading:""}),c=F(d=>{if(!(d!=null&&d.type)){s({type:"success",heading:""});return}const u=ge[d.type];s({...d,icon:u})},[]);return{inLineAlertProps:a,handleSetInLineAlert:c}},be=({itemsEligibleForReturn:a,slots:s,loading:c=!1,taxConfig:d,translations:u={},selectedProductList:p,handleSelectedProductList:C,showConfigurableOptions:f,handleSetQuantity:O,handleChangeStep:b})=>x("ul",{className:"order-return-order-product-list",children:[a==null?void 0:a.map((i,g)=>{const S=p.some(e=>(e==null?void 0:e.productSku)===i.productSku&&i.eligibleForReturn&&i.quantityReturned===0),w=i.returnableQuantity===0?1:i.returnableQuantity;return x("li",{className:q(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",!i.eligibleForReturn]]),children:[r(H,{"data-testid":`key_${g}`,name:`key_${g}`,checked:S,disabled:!i.eligibleForReturn||i.quantityReturned!==0,onChange:()=>{C({...i,currentReturnOrderQuantity:1})}}),r(oe,{loading:c,product:{...i,totalQuantity:w},itemType:"",taxConfig:d,translations:u,showConfigurableOptions:f,disabledIncrementer:!S,isReturnProductList:!0,onQuantity:(i==null?void 0:i.returnableQuantity)>1?e=>O(e,i.productSku):void 0}),s!=null&&s.ReturnOrderItem?r(P,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:s==null?void 0:s.ReturnOrderItem,context:{}}):null]},g)}),r("li",{className:"order-return-order-product-list__item",children:r(Q,{type:"button",onClick:()=>b("attributes"),disabled:!p.length,children:u.nextStep})})]}),ke=({routeReturnSuccess:a,translations:s,orderData:c})=>{const d=()=>{window.location.href=(a==null?void 0:a(c))??"#"};return 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(Q,{onClick:d,type:"button",children:s.backStore})]})},ye=({slots:a,formsRef:s,selectedProductList:c,loading:d,fieldsConfig:u,translations:p,handleChangeStep:C,onSubmit:f})=>{const{formData:O,errors:b,formRef:i,handleChange:g,handleBlur:S,handleSubmit:w}=z({fieldsConfig:re(u,c==null?void 0:c.length),onSubmit:f});return x("form",{className:"order-return-reason-form",ref:i,onSubmit:w,name:"returnReasonForm",children:[c.map((e,L)=>{var E,n,o,v,l;const t=(e==null?void 0:e.giftCard)||{},h=e==null?void 0:e.product,k=ae(u,L),N=`${e==null?void 0:e.id}_${L}`,R=(e==null?void 0:e.currentReturnOrderQuantity)??1,A={...e!=null&&e.currentReturnOrderQuantity?{Quantity:R}:{},..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in t?{[p.sender]:t==null?void 0:t.senderName}:{},..."senderEmail"in t&&(t!=null&&t.senderEmail)?{[p.sender]:t==null?void 0:t.senderEmail}:{},..."recipientName"in t&&(t!=null&&t.recipientName)?{[p.recipient]:t==null?void 0:t.recipientName}:{},..."recipientEmail"in t&&(t!=null&&t.recipientEmail)?{[p.recipient]:t==null?void 0:t.recipientEmail}:{},..."message"in t&&(t!=null&&t.message)?{[p.message]:t==null?void 0:t.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(E=e==null?void 0:e.downloadableLinks)==null?void 0:E.count} ${p.downloadableCount}`]:(n=e==null?void 0:e.downloadableLinks)==null?void 0:n.result}:{}};return x(I,{children:[r(V,{loading:d,title:r("div",{"data-testid":"product-name",children:(o=e==null?void 0:e.product)==null?void 0:o.name}),sku:r("div",{children:h==null?void 0:h.sku}),image:r(W,{src:((v=h==null?void 0:h.thumbnail)==null?void 0:v.url)??"",alt:((l=h==null?void 0:h.thumbnail)==null?void 0:l.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:A}),r("form",{name:N,ref:s==null?void 0:s.current[L],"data-quantity":R,children:r(U,{className:"className",loading:d,fields:k,onChange:g,onBlur:S,errors:b,values:O})})]},L)}),a!=null&&a.ReturnFormActions?r(P,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:a==null?void 0:a.ReturnFormActions,context:{handleChangeStep:C}}):x("div",{className:"order-return-reason-form__actions",children:[r(Q,{variant:"secondary",type:"button",onClick:()=>{C("products")},children:p.backStep}),r(Q,{children:p.submit})]})]})},He=({className:a,orderData:s,slots:c,onSuccess:d,onError:u,routeReturnSuccess:p,showConfigurableOptions:C})=>{const f=de({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"}),{inLineAlertProps:O,handleSetInLineAlert:b}=fe(),{order:i,itemsEligibleForReturn:g,formsRef:S,taxConfig:w,attributesList:e,steps:L,loading:t,selectedProductList:h,handleSelectedProductList:k,handleSetQuantity:N,handleChangeStep:R,onSubmit:A}=me({orderData:s,onSuccess:d,onError:u,handleSetInLineAlert:b});if(t)return r("div",{children:r(le,{})});if(!t&&!e.length)return r("div",{});const E={products:r(be,{itemsEligibleForReturn:g,slots:c,translations:f,loading:t,taxConfig:w,selectedProductList:h,handleSelectedProductList:k,showConfigurableOptions:C,handleSetQuantity:N,handleChangeStep:R}),attributes:r(ye,{slots:c,formsRef:S,loading:t,fieldsConfig:e,selectedProductList:h,handleChangeStep:R,translations:f,onSubmit:A}),success:r(ke,{translations:f,routeReturnSuccess:p,orderData:i}),error:null};return x("div",{className:q(["order-create-return",a]),children:[r(Z,{title:f.headerText}),O.heading?r(D,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...O}):null,E[L]]})};export{He as CreateReturn,He as default}; diff --git a/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts b/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts index 794ed95b2b..fea2010f22 100644 --- a/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts +++ b/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts @@ -2,5 +2,6 @@ import { AttributesListItems, ResponseAttributesFormItemsProps } from '../../typ import { AttributesFormModel } from '../models'; export declare const cloneArrayIfExists: (fields: ResponseAttributesFormItemsProps[]) => any; -export declare const transformAttributesForm: (items?: ResponseAttributesFormItemsProps[] | AttributesListItems[] | []) => AttributesFormModel[]; +export declare const transformAttributesForm: (items?: ResponseAttributesFormItemsProps[] | AttributesListItems[] | [ +]) => AttributesFormModel[]; //# sourceMappingURL=transform-attributes-form.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index b35ed728f9..e08112046f 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731423614901} \ No newline at end of file +{"at":1731437184106} \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/render.js b/scripts/__dropins__/storefront-order/render.js index e0fff43820..c7bace7a0d 100644 --- a/scripts/__dropins__/storefront-order/render.js +++ b/scripts/__dropins__/storefront-order/render.js @@ -1,3 +1,3 @@ (function(n,e){try{if(typeof document<"u"){const r=document.createElement("style"),a=e.styleId;for(const t in e.attributes)r.setAttribute(t,e.attributes[t]);r.setAttribute("data-dropin",a),r.appendChild(document.createTextNode(n));const o=document.querySelector('style[data-dropin="sdk"]');if(o)o.after(r);else{const t=document.querySelector('link[rel="stylesheet"], style');t?t.before(r):document.head.append(r)}}}catch(r){console.error("dropin-styles (injectCodeFunction)",r)}})(`.dropin-button,.dropin-iconButton{border:0 none;cursor:pointer;white-space:normal}.dropin-button{border-radius:var(--shape-border-radius-3);font-size:var(--type-button-1-font);font-weight:var(--type-button-1-font);padding:var(--spacing-xsmall) var(--spacing-medium);display:flex;justify-content:center;align-items:center;text-align:left;word-wrap:break-word}.dropin-iconButton{height:var(--spacing-xbig);width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button:disabled,.dropin-iconButton:disabled{pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button:not(:disabled),.dropin-iconButton:not(:disabled){cursor:pointer}.dropin-button:focus,.dropin-iconButton:focus{outline:none}.dropin-button:focus-visible,.dropin-iconButton:focus-visible{outline:var(--spacing-xxsmall) solid var(--color-button-focus)}.dropin-button--primary,a.dropin-button--primary,.dropin-iconButton--primary{border:none;background:var(--color-brand-500) 0 0% no-repeat padding-box;color:var(--color-neutral-50);text-align:left;margin-right:0}.dropin-iconButton--primary{border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button--primary--disabled,a.dropin-button--primary--disabled,.dropin-iconButton--primary--disabled{background:var(--color-neutral-300) 0 0% no-repeat padding-box;color:var(--color-neutral-500);fill:var(--color-neutral-300);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--primary:hover,a.dropin-button--primary:hover,.dropin-iconButton--primary:hover,.dropin-button--primary:focus:hover,.dropin-iconButton--primary:focus:hover{background-color:var(--color-button-hover);text-decoration:none}.dropin-button--primary:focus,.dropin-iconButton--primary:focus{background-color:var(--color-brand-500)}.dropin-button--primary:hover:active,.dropin-iconButton--primary:hover:active{background-color:var(--color-button-active)}.dropin-button--secondary,a.dropin-button--secondary,.dropin-iconButton--secondary{border:var(--shape-border-width-2) solid var(--color-brand-500);background:none 0 0% no-repeat padding-box;color:var(--color-brand-500);padding-top:calc(var(--spacing-xsmall) - var(--shape-border-width-2));padding-left:calc(var(--spacing-medium) - var(--shape-border-width-2))}.dropin-iconButton--secondary{border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall);padding-top:calc(var(--spacing-xsmall) - var(--shape-border-width-2));padding-left:calc(var(--spacing-xsmall) - var(--shape-border-width-2))}.dropin-button--secondary--disabled,a.dropin-button--secondary--disabled,.dropin-iconButton--secondary--disabled{border:var(--shape-border-width-2) solid var(--color-neutral-300);background:none 0 0% no-repeat padding-box;color:var(--color-neutral-500);fill:var(--color-neutral-300);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--secondary:hover,a.dropin-button--secondary:hover,.dropin-iconButton--secondary:hover{border:var(--shape-border-width-2) solid var(--color-button-hover);color:var(--color-button-hover);text-decoration:none}.dropin-button--secondary:active,.dropin-iconButton--secondary:active{border:var(--shape-border-width-2) solid var(--color-button-active);color:var(--color-button-active)}.dropin-button--tertiary,a.dropin-button--tertiary,.dropin-iconButton--tertiary{border:none;background:none 0 0% no-repeat padding-box;color:var(--color-brand-500)}.dropin-iconButton--tertiary{border:none;border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button--tertiary--disabled,a.dropin-button--tertiary--disabled,.dropin-iconButton--tertiary--disabled{border:none;color:var(--color-neutral-500);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--tertiary:hover,a.dropin-button--tertiary:hover,.dropin-iconButton--tertiary:hover{color:var(--color-button-hover);text-decoration:none}.dropin-button--tertiary:active,.dropin-iconButton--tertiary:active{color:var(--color-button-active)}.dropin-button--tertiary:focus-visible,.dropin-iconButton--tertiary:focus-visible{-webkit-box-shadow:inset 0 0 0 2px var(--color-neutral-800);-moz-box-shadow:inset 0 0 0 2px var(--color-neutral-800);box-shadow:inset 0 0 0 2px var(--color-neutral-800)}.dropin-button--large{font:var(--type-button-1-font);letter-spacing:var(--type-button-1-letter-spacing)}.dropin-button--medium{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.dropin-button-icon{height:24px}.dropin-button--with-icon{column-gap:var(--spacing-xsmall);row-gap:var(--spacing-xsmall)} -.order-order-search-form{gap:var(--spacing-small);border-color:transparent}.order-order-search-form .dropin-card__content{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}.order-order-search-form p{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.order-order-search-form__title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin:0}.order-order-search-form__wrapper{display:grid;grid-template-columns:1fr;grid-template-rows:auto;grid-template-areas:"email" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}`,{styleId:"order"}); +.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" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}.order-return-order-product-list .dropin-incrementer__button-container{margin:0}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}`,{styleId:"order"}); import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as n}from"@dropins/tools/lib.js";import{useState as s,useEffect as d}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as c}from"@dropins/tools/event-bus.js";const u={CreateReturn:{headerText:"Return items",downloadableCount:"Files",returnedItems:"Returned items:",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",postcode:"Zip Code",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},ShippingStatusCard:{orderNumber:"Order number:",returnNumber:"Return number:",itemText:{none:"",one:"Package contents ({{count}} item)",many:"Package contents ({{count}} items)"},trackButton:"Track package",carrier:"Carrier:",prepositionOf:"of",returnOrderCardTitle:"Package details",shippingCardTitle:"Package details",shippingInfoTitle:"Shipping information",notYetShippedTitle:"Not yet shipped",notYetShippedImagesTitle:{singular:"Package contents ({{count}} item)",plural:"Package contents ({{count}} items)"}},OrderStatusContent:{noInfoTitle:"Check back later for more details.",returnMessage:"The order was placed on {ORDER_CREATE_DATE} and your return process started on {RETURN_CREATE_DATE}",returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."}},p={Order:u},m={default:p},h=({children:t})=>{const[o,i]=s("en_US");return d(()=>{const e=c.on("locale",a=>{i(a)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},T=new n(r(h,{}));export{T as render}; From ec63fb414c37c62e46eacc466a535ca762502ec0 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 12 Nov 2024 21:27:46 +0200 Subject: [PATCH 20/30] test bug? 4 --- .../__dropins__/storefront-order/chunks/ReturnsListContent.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index eb18628db7..61691fd202 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1 +1 @@ -import{jsx as r,jsxs as s,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as q}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as V,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as n1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as t1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const k=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"})))),a1=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"})),J=({typeList:L,isEmpty:p,minifiedView:_,message:n})=>{const a=n1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:n}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,n]);return!p||!L||!a.text?null:r(R,{className:W(["order-empty-list",a.className,_?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:p=!1,withOrderNumber:_=!1,slots:n,pageInfo:a,withReturnsListButton:$=!0,isMobile:y=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:o=!1,withHeader:N=!0,withThumbnails:A=!0,selectedPage:B=1,handleSetSelectPage:S,routeReturnDetails:d,routeOrderDetails:g,routeTracking:f,routeReturnsList:v,routeProductDetails:m,loading:b})=>{const z=o?X:i.length;console.log("orderReturns",i);const j=m!=null&&m()?"a":"span",x=w(()=>i.slice(0,z).map((e,I)=>{var F,G;const E=((e==null?void 0:e.items)??[]).reduce((t,h)=>(h.requestQuantity??0)+t,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${L}.returnsList.resturnStatus.${t1(e.returnStatus)}`})}),p?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(g==null?void 0:g({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((t,h)=>{var M,Z;const C={title:"",number:(t==null?void 0:t.trackingNumber)??"",carrier:((M=t==null?void 0:t.carrier)==null?void 0:M.label)??""},H=f==null?void 0:f(C);return s("p",{children:[`${c.carrier} `,`${(Z=C.carrier)==null?void 0:Z.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer",children:t.trackingNumber}):r("span",{children:t.trackingNumber})]},`${C.number}_${h}`)}),n!=null&&n.ReturnItemsDetails?r(q,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:n==null?void 0:n.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[E," ",r(U,{id:`Order.Returns.${L}.returnsList.itemText`,plural:E,fields:{count:E}})]}):null]}),A?r(D,{maxColumns:y?3:9,emptyGridContent:r(u,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",y]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((t,h)=>{var M,Z;const C=(M=t.thumbnail)==null?void 0:M.label,H=(Z=t.thumbnail)==null?void 0:Z.url;return r(j,{href:(m==null?void 0:m(t))??"#",children:r(r1,{alt:C,src:H,width:85,height:114})},h+t.uid)})}):null,n!=null&&n.DetailsActionParams?r(q,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:n==null?void 0:n.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:k,...T})})]})},I)}),[i,z,L,p,c,d,_,g,n,A,y,m,f,j]),Y=w(()=>s(u,{children:[N?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,b?r(Q,{withCard:!1}):s(u,{children:[x,r(J,{minifiedView:o,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(v==null?void 0:v())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(V,{source:k,...T})]})})}):null]})]}),[v,$,N,c,x,o,i.length,b]),K=w(()=>s(u,{children:[N?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,b?r(Q,{withCard:!1}):s(u,{children:[r(J,{minifiedView:o,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),x,(a==null?void 0:a.totalPages)>1?r(e1,{totalPages:a==null?void 0:a.totalPages,currentPage:B,onChange:S}):null]})]}),[x,o,i,c,a==null?void 0:a.totalPages,B,S,b,N]);return r("div",{className:"order-returns-list-content",children:o?Y:K})};export{u1 as R}; +import{jsx as r,jsxs as s,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as O}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as V,Card as P,ContentGrid as D,Image as r1,Header as Q,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as k}from"@dropins/tools/i18n.js";const q=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"})))),a1=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"})),J=({typeList:L,isEmpty:p,minifiedView:_,message:t})=>{const a=t1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,t]);return!p||!L||!a.text?null:r(R,{className:W(["order-empty-list",a.className,_?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:p=!1,withOrderNumber:_=!1,slots:t,pageInfo:a,withReturnsListButton:$=!0,isMobile:y=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:N=!0,withThumbnails:A=!0,selectedPage:B=1,handleSetSelectPage:S,routeReturnDetails:d,routeOrderDetails:g,routeTracking:f,routeReturnsList:v,routeProductDetails:m,loading:b})=>{const z=h?X:i.length,j=m!=null&&m()?"a":"span",x=w(()=>i.slice(0,z).map((e,I)=>{var F,G;const E=((e==null?void 0:e.items)??[]).reduce((n,o)=>(o.totalQuantity??0)+n,0);return r(P,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(k,{id:`Order.Returns.${L}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),p?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(g==null?void 0:g({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((n,o)=>{var M,Z;const C={title:"",number:(n==null?void 0:n.trackingNumber)??"",carrier:((M=n==null?void 0:n.carrier)==null?void 0:M.label)??""},H=f==null?void 0:f(C);return s("p",{children:[`${c.carrier} `,`${(Z=C.carrier)==null?void 0:Z.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer",children:n.trackingNumber}):r("span",{children:n.trackingNumber})]},`${C.number}_${o}`)}),t!=null&&t.ReturnItemsDetails?r(O,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[E," ",r(k,{id:`Order.Returns.${L}.returnsList.itemText`,plural:E,fields:{count:E}})]}):null]}),A?r(D,{maxColumns:y?3:9,emptyGridContent:r(u,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",y]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((n,o)=>{var M,Z;const C=(M=n.thumbnail)==null?void 0:M.label,H=(Z=n.thumbnail)==null?void 0:Z.url;return r(j,{href:(m==null?void 0:m(n))??"#",children:r(r1,{alt:C,src:H,width:85,height:114})},o+n.uid)})}):null,t!=null&&t.DetailsActionParams?r(O,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:t==null?void 0:t.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:q,...T})})]})},I)}),[i,z,L,p,c,d,_,g,t,A,y,m,f,j]),Y=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,b?r(U,{withCard:!1}):s(u,{children:[x,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(v==null?void 0:v())??"#",children:r(P,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(V,{source:q,...T})]})})}):null]})]}),[v,$,N,c,x,h,i.length,b]),K=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,b?r(U,{withCard:!1}):s(u,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),x,(a==null?void 0:a.totalPages)>1?r(e1,{totalPages:a==null?void 0:a.totalPages,currentPage:B,onChange:S}):null]})]}),[x,h,i,c,a==null?void 0:a.totalPages,B,S,b,N]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{u1 as R}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index e08112046f..51fe3c4494 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731437184106} \ No newline at end of file +{"at":1731439642113} \ No newline at end of file From 161945f2f4570d5aa78f99544b99c48078d331e4 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 12 Nov 2024 21:34:57 +0200 Subject: [PATCH 21/30] test bug? 5 --- .../__dropins__/storefront-order/chunks/ReturnsListContent.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index 61691fd202..5890bec61f 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1 +1 @@ -import{jsx as r,jsxs as s,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as O}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as V,Card as P,ContentGrid as D,Image as r1,Header as Q,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as k}from"@dropins/tools/i18n.js";const q=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"})))),a1=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"})),J=({typeList:L,isEmpty:p,minifiedView:_,message:t})=>{const a=t1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,t]);return!p||!L||!a.text?null:r(R,{className:W(["order-empty-list",a.className,_?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:p=!1,withOrderNumber:_=!1,slots:t,pageInfo:a,withReturnsListButton:$=!0,isMobile:y=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:N=!0,withThumbnails:A=!0,selectedPage:B=1,handleSetSelectPage:S,routeReturnDetails:d,routeOrderDetails:g,routeTracking:f,routeReturnsList:v,routeProductDetails:m,loading:b})=>{const z=h?X:i.length,j=m!=null&&m()?"a":"span",x=w(()=>i.slice(0,z).map((e,I)=>{var F,G;const E=((e==null?void 0:e.items)??[]).reduce((n,o)=>(o.totalQuantity??0)+n,0);return r(P,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(k,{id:`Order.Returns.${L}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),p?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(g==null?void 0:g({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((n,o)=>{var M,Z;const C={title:"",number:(n==null?void 0:n.trackingNumber)??"",carrier:((M=n==null?void 0:n.carrier)==null?void 0:M.label)??""},H=f==null?void 0:f(C);return s("p",{children:[`${c.carrier} `,`${(Z=C.carrier)==null?void 0:Z.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer",children:n.trackingNumber}):r("span",{children:n.trackingNumber})]},`${C.number}_${o}`)}),t!=null&&t.ReturnItemsDetails?r(O,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[E," ",r(k,{id:`Order.Returns.${L}.returnsList.itemText`,plural:E,fields:{count:E}})]}):null]}),A?r(D,{maxColumns:y?3:9,emptyGridContent:r(u,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",y]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((n,o)=>{var M,Z;const C=(M=n.thumbnail)==null?void 0:M.label,H=(Z=n.thumbnail)==null?void 0:Z.url;return r(j,{href:(m==null?void 0:m(n))??"#",children:r(r1,{alt:C,src:H,width:85,height:114})},o+n.uid)})}):null,t!=null&&t.DetailsActionParams?r(O,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:t==null?void 0:t.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:q,...T})})]})},I)}),[i,z,L,p,c,d,_,g,t,A,y,m,f,j]),Y=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,b?r(U,{withCard:!1}):s(u,{children:[x,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(v==null?void 0:v())??"#",children:r(P,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(V,{source:q,...T})]})})}):null]})]}),[v,$,N,c,x,h,i.length,b]),K=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,b?r(U,{withCard:!1}):s(u,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),x,(a==null?void 0:a.totalPages)>1?r(e1,{totalPages:a==null?void 0:a.totalPages,currentPage:B,onChange:S}):null]})]}),[x,h,i,c,a==null?void 0:a.totalPages,B,S,b,N]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{u1 as R}; +import{jsx as r,jsxs as s,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as O}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as V,Card as P,ContentGrid as D,Image as r1,Header as Q,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as n1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as t1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as k}from"@dropins/tools/i18n.js";const q=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"})))),a1=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"})),J=({typeList:L,isEmpty:p,minifiedView:_,message:n})=>{const a=n1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:n}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,n]);return!p||!L||!a.text?null:r(R,{className:W(["order-empty-list",a.className,_?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:p=!1,withOrderNumber:_=!1,slots:n,pageInfo:a,withReturnsListButton:$=!0,isMobile:y=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:N=!0,withThumbnails:A=!0,selectedPage:B=1,handleSetSelectPage:S,routeReturnDetails:d,routeOrderDetails:g,routeTracking:f,routeReturnsList:v,routeProductDetails:m,loading:b})=>{const z=h?X:i.length,j=m!=null&&m()?"a":"span",x=w(()=>i.slice(0,z).map((e,I)=>{var F,G;const E=((e==null?void 0:e.items)??[]).reduce((t,o)=>(o.returnableQuantity??0)+t,0);return r(P,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(k,{id:`Order.Returns.${L}.returnsList.resturnStatus.${t1(e.returnStatus)}`})}),p?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(g==null?void 0:g({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((t,o)=>{var M,Z;const C={title:"",number:(t==null?void 0:t.trackingNumber)??"",carrier:((M=t==null?void 0:t.carrier)==null?void 0:M.label)??""},H=f==null?void 0:f(C);return s("p",{children:[`${c.carrier} `,`${(Z=C.carrier)==null?void 0:Z.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer",children:t.trackingNumber}):r("span",{children:t.trackingNumber})]},`${C.number}_${o}`)}),n!=null&&n.ReturnItemsDetails?r(O,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:n==null?void 0:n.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[E," ",r(k,{id:`Order.Returns.${L}.returnsList.itemText`,plural:E,fields:{count:E}})]}):null]}),A?r(D,{maxColumns:y?3:9,emptyGridContent:r(u,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",y]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((t,o)=>{var M,Z;const C=(M=t.thumbnail)==null?void 0:M.label,H=(Z=t.thumbnail)==null?void 0:Z.url;return r(j,{href:(m==null?void 0:m(t))??"#",children:r(r1,{alt:C,src:H,width:85,height:114})},o+t.uid)})}):null,n!=null&&n.DetailsActionParams?r(O,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:n==null?void 0:n.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:q,...T})})]})},I)}),[i,z,L,p,c,d,_,g,n,A,y,m,f,j]),Y=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,b?r(U,{withCard:!1}):s(u,{children:[x,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(v==null?void 0:v())??"#",children:r(P,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(V,{source:q,...T})]})})}):null]})]}),[v,$,N,c,x,h,i.length,b]),K=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,b?r(U,{withCard:!1}):s(u,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),x,(a==null?void 0:a.totalPages)>1?r(e1,{totalPages:a==null?void 0:a.totalPages,currentPage:B,onChange:S}):null]})]}),[x,h,i,c,a==null?void 0:a.totalPages,B,S,b,N]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{u1 as R}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 51fe3c4494..bb3fc75d91 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731439642113} \ No newline at end of file +{"at":1731440059184} \ No newline at end of file From 5c19054588db2803c1cd8c967ca178bb849c534d Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 12 Nov 2024 21:36:44 +0200 Subject: [PATCH 22/30] test bug? 6 --- .../__dropins__/storefront-order/chunks/ReturnsListContent.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index 5890bec61f..d1fe6978de 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1 +1 @@ -import{jsx as r,jsxs as s,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as O}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as V,Card as P,ContentGrid as D,Image as r1,Header as Q,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as n1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as t1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as k}from"@dropins/tools/i18n.js";const q=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"})))),a1=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"})),J=({typeList:L,isEmpty:p,minifiedView:_,message:n})=>{const a=n1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:n}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,n]);return!p||!L||!a.text?null:r(R,{className:W(["order-empty-list",a.className,_?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:p=!1,withOrderNumber:_=!1,slots:n,pageInfo:a,withReturnsListButton:$=!0,isMobile:y=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:N=!0,withThumbnails:A=!0,selectedPage:B=1,handleSetSelectPage:S,routeReturnDetails:d,routeOrderDetails:g,routeTracking:f,routeReturnsList:v,routeProductDetails:m,loading:b})=>{const z=h?X:i.length,j=m!=null&&m()?"a":"span",x=w(()=>i.slice(0,z).map((e,I)=>{var F,G;const E=((e==null?void 0:e.items)??[]).reduce((t,o)=>(o.returnableQuantity??0)+t,0);return r(P,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(k,{id:`Order.Returns.${L}.returnsList.resturnStatus.${t1(e.returnStatus)}`})}),p?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(g==null?void 0:g({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((t,o)=>{var M,Z;const C={title:"",number:(t==null?void 0:t.trackingNumber)??"",carrier:((M=t==null?void 0:t.carrier)==null?void 0:M.label)??""},H=f==null?void 0:f(C);return s("p",{children:[`${c.carrier} `,`${(Z=C.carrier)==null?void 0:Z.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer",children:t.trackingNumber}):r("span",{children:t.trackingNumber})]},`${C.number}_${o}`)}),n!=null&&n.ReturnItemsDetails?r(O,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:n==null?void 0:n.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[E," ",r(k,{id:`Order.Returns.${L}.returnsList.itemText`,plural:E,fields:{count:E}})]}):null]}),A?r(D,{maxColumns:y?3:9,emptyGridContent:r(u,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",y]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((t,o)=>{var M,Z;const C=(M=t.thumbnail)==null?void 0:M.label,H=(Z=t.thumbnail)==null?void 0:Z.url;return r(j,{href:(m==null?void 0:m(t))??"#",children:r(r1,{alt:C,src:H,width:85,height:114})},o+t.uid)})}):null,n!=null&&n.DetailsActionParams?r(O,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:n==null?void 0:n.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:q,...T})})]})},I)}),[i,z,L,p,c,d,_,g,n,A,y,m,f,j]),Y=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,b?r(U,{withCard:!1}):s(u,{children:[x,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(v==null?void 0:v())??"#",children:r(P,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(V,{source:q,...T})]})})}):null]})]}),[v,$,N,c,x,h,i.length,b]),K=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,b?r(U,{withCard:!1}):s(u,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),x,(a==null?void 0:a.totalPages)>1?r(e1,{totalPages:a==null?void 0:a.totalPages,currentPage:B,onChange:S}):null]})]}),[x,h,i,c,a==null?void 0:a.totalPages,B,S,b,N]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{u1 as R}; +import{jsx as r,jsxs as s,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as q}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as V,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as n1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as t1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const k=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"})))),a1=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"})),J=({typeList:L,isEmpty:p,minifiedView:_,message:n})=>{const a=n1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:n}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,n]);return!p||!L||!a.text?null:r(R,{className:W(["order-empty-list",a.className,_?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:p=!1,withOrderNumber:_=!1,slots:n,pageInfo:a,withReturnsListButton:$=!0,isMobile:y=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:N=!0,withThumbnails:A=!0,selectedPage:B=1,handleSetSelectPage:S,routeReturnDetails:d,routeOrderDetails:g,routeTracking:f,routeReturnsList:v,routeProductDetails:m,loading:b})=>{const z=h?X:i.length,j=m!=null&&m()?"a":"span",x=w(()=>i.slice(0,z).map((e,I)=>{var F,G;const E=((e==null?void 0:e.items)??[]).reduce((t,o)=>(o.requestQuantity??0)+t,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${L}.returnsList.resturnStatus.${t1(e.returnStatus)}`})}),p?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(g==null?void 0:g({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((t,o)=>{var M,Z;const C={title:"",number:(t==null?void 0:t.trackingNumber)??"",carrier:((M=t==null?void 0:t.carrier)==null?void 0:M.label)??""},H=f==null?void 0:f(C);return s("p",{children:[`${c.carrier} `,`${(Z=C.carrier)==null?void 0:Z.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer",children:t.trackingNumber}):r("span",{children:t.trackingNumber})]},`${C.number}_${o}`)}),n!=null&&n.ReturnItemsDetails?r(q,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:n==null?void 0:n.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[E," ",r(U,{id:`Order.Returns.${L}.returnsList.itemText`,plural:E,fields:{count:E}})]}):null]}),A?r(D,{maxColumns:y?3:9,emptyGridContent:r(u,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",y]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((t,o)=>{var M,Z;const C=(M=t.thumbnail)==null?void 0:M.label,H=(Z=t.thumbnail)==null?void 0:Z.url;return r(j,{href:(m==null?void 0:m(t))??"#",children:r(r1,{alt:C,src:H,width:85,height:114})},o+t.uid)})}):null,n!=null&&n.DetailsActionParams?r(q,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:n==null?void 0:n.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:k,...T})})]})},I)}),[i,z,L,p,c,d,_,g,n,A,y,m,f,j]),Y=w(()=>s(u,{children:[N?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,b?r(Q,{withCard:!1}):s(u,{children:[x,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(v==null?void 0:v())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(V,{source:k,...T})]})})}):null]})]}),[v,$,N,c,x,h,i.length,b]),K=w(()=>s(u,{children:[N?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,b?r(Q,{withCard:!1}):s(u,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),x,(a==null?void 0:a.totalPages)>1?r(e1,{totalPages:a==null?void 0:a.totalPages,currentPage:B,onChange:S}):null]})]}),[x,h,i,c,a==null?void 0:a.totalPages,B,S,b,N]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{u1 as R}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index bb3fc75d91..4b866a3c44 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731440059184} \ No newline at end of file +{"at":1731440170068} \ No newline at end of file From fca0819cee164146832c2979e20dba544a53aad9 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 12 Nov 2024 21:48:55 +0200 Subject: [PATCH 23/30] test bug? 7 --- scripts/__dropins__/storefront-order/api.js | 14 +++++++------- .../getOrderDetailsById.d.ts | 3 +-- .../api/requestReturn/graphql/fragments.d.ts | 2 -- .../graphql/requestReturn.graphql.d.ts | 2 +- .../chunks/CartSummaryItem.js | 2 +- .../chunks/ReturnsListContent.js | 2 +- .../chunks/getAttributesForm.js | 2 +- .../chunks/getGuestOrder.graphql.js | 1 - .../storefront-order/chunks/requestReturn.js | 19 +++++++------------ .../chunks/returnOrdersHelper.js | 2 +- .../chunks/transform-attributes-form.js | 2 +- .../containers/CreateReturn.js | 2 +- .../containers/OrderProductList.js | 2 +- .../containers/ShippingStatus.js | 2 +- .../transforms/transform-attributes-form.d.ts | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- .../__dropins__/storefront-order/render.js | 2 +- .../types/api/getOrderDetails.types.d.ts | 8 -------- 18 files changed, 27 insertions(+), 44 deletions(-) delete mode 100644 scripts/__dropins__/storefront-order/api/requestReturn/graphql/fragments.d.ts diff --git a/scripts/__dropins__/storefront-order/api.js b/scripts/__dropins__/storefront-order/api.js index 45f78abffa..a86d37ce46 100644 --- a/scripts/__dropins__/storefront-order/api.js +++ b/scripts/__dropins__/storefront-order/api.js @@ -1,5 +1,5 @@ -import{Initializer as I}from"@dropins/tools/lib.js";import{events as o}from"@dropins/tools/event-bus.js";import{f as n,h as m}from"./chunks/fetch-graphql.js";import{g as U,r as Y,s as q,a as Q,b as H}from"./chunks/fetch-graphql.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as _,G as p,O as c,B as O,R as D,c as b}from"./chunks/transform-order-details.js";import{O as R,A as h}from"./chunks/getGuestOrder.graphql.js";import{t as T}from"./chunks/getCustomer.js";import{g as j,a as J}from"./chunks/getCustomer.js";import{g as W}from"./chunks/getAttributesForm.js";import{g as Z}from"./chunks/getStoreConfig.js";import{g as re}from"./chunks/getCustomerOrdersReturn.js";import{g as ae,r as se}from"./chunks/requestReturn.js";import{c as oe,r as ie}from"./chunks/requestGuestOrderCancel.js";import{r as me}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";import"./chunks/transform-attributes-form.js";const G=` -query ORDER_BY_NUMBER($orderNumber: String!, $pageSize: Int) { +import{Initializer as I}from"@dropins/tools/lib.js";import{events as d}from"@dropins/tools/event-bus.js";import{f as n,h as m}from"./chunks/fetch-graphql.js";import{g as U,r as q,s as z,a as Y,b as Q}from"./chunks/fetch-graphql.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as _,G as p,O as c,B as O,R as D,c as b}from"./chunks/transform-order-details.js";import{O as h,A as R}from"./chunks/getGuestOrder.graphql.js";import{t as f}from"./chunks/getCustomer.js";import{g as K,a as j}from"./chunks/getCustomer.js";import{g as V}from"./chunks/getAttributesForm.js";import{g as X}from"./chunks/getStoreConfig.js";import{g as ee}from"./chunks/getCustomerOrdersReturn.js";import{g as te,r as ae}from"./chunks/requestReturn.js";import{c as de,r as oe}from"./chunks/requestGuestOrderCancel.js";import{r as ne}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";import"./chunks/transform-attributes-form.js";const G=` +query ORDER_BY_NUMBER($orderNumber: String!) { customer { orders( filter: { number: { eq: $orderNumber } } @@ -15,7 +15,7 @@ query ORDER_BY_NUMBER($orderNumber: String!, $pageSize: Int) { carrier shipping_method is_virtual - returns(pageSize: $pageSize) { + returns(pageSize: 50) { ...OrderReturns } items_eligible_for_return { @@ -108,10 +108,10 @@ ${_} ${p} ${c} ${O} -${R} ${h} +${R} ${D} -`,y=async({orderId:e,returnRef:r,queryType:t,returnsPageSize:a=50})=>await n(G,{method:"GET",cache:"force-cache",variables:{orderNumber:e,pageSize:a}}).then(s=>{var d;return(d=s.errors)!=null&&d.length?m(s.errors):b(t??"orderData",s,r)}).catch(l),f=` +`,T=async(e,r,t)=>await n(G,{method:"GET",cache:"force-cache",variables:{orderNumber:e}}).then(a=>{var s;return(s=a.errors)!=null&&s.length?m(a.errors):b(t??"orderData",a,r)}).catch(l),g=` query ORDER_BY_TOKEN($token: String!) { guestOrderByToken(input: { token: $token }) { email @@ -205,7 +205,7 @@ ${_} ${p} ${c} ${O} -${R} ${h} +${R} ${D} -`,$=async(e,r)=>await n(f,{method:"GET",cache:"no-cache",variables:{token:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?m(t.errors):T(t,r)}).catch(l),A="orderData",C=async e=>{var i;const r=typeof(e==null?void 0:e.orderRef)=="string"?e==null?void 0:e.orderRef:"",t=typeof(e==null?void 0:e.returnRef)=="string"?e==null?void 0:e.returnRef:"",a=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((i=e==null?void 0:e.orderRef)==null?void 0:i.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){o.emit("order/data",{...s,returnNumber:t});return}if(!r){console.error("Order Token or number not received.");return}const d=a?await $(r,t):await y({orderId:r,returnRef:t,queryType:A});d?o.emit("order/data",{...d,returnNumber:t}):o.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},E=new I({init:async e=>{const r={};E.config.setConfig({...r,...e}),C(e).catch(console.error)},listeners:()=>[]}),x=E.config;export{oe as cancelOrder,x as config,n as fetchGraphQl,W as getAttributesForm,ae as getAttributesList,U as getConfig,j as getCustomer,re as getCustomerOrdersReturn,J as getGuestOrder,y as getOrderDetailsById,Z as getStoreConfig,$ as guestOrderByToken,E as initialize,Y as removeFetchGraphQlHeader,me as reorderItems,ie as requestGuestOrderCancel,se as requestReturn,q as setEndpoint,Q as setFetchGraphQlHeader,H as setFetchGraphQlHeaders}; +`,A=async(e,r)=>await n(g,{method:"GET",cache:"no-cache",variables:{token:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?m(t.errors):f(t,r)}).catch(l),y=async e=>{var i;const r=(e==null?void 0:e.orderRef)??"",t=(e==null?void 0:e.returnRef)??"",a=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((i=e==null?void 0:e.orderRef)==null?void 0:i.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){d.emit("order/data",{...s,returnNumber:t});return}if(!r){console.error("Order Token or number not received.");return}const o=a?await A(r,t):await T(r,t,"orderData");o?d.emit("order/data",{...o,returnNumber:t}):d.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},E=new I({init:async e=>{const r={};E.config.setConfig({...r,...e}),y(e).catch(console.error)},listeners:()=>[]}),v=E.config;export{de as cancelOrder,v as config,n as fetchGraphQl,V as getAttributesForm,te as getAttributesList,U as getConfig,K as getCustomer,ee as getCustomerOrdersReturn,j as getGuestOrder,T as getOrderDetailsById,X as getStoreConfig,A as guestOrderByToken,E as initialize,q as removeFetchGraphQlHeader,ne as reorderItems,oe as requestGuestOrderCancel,ae as requestReturn,z as setEndpoint,Y as setFetchGraphQlHeader,Q as setFetchGraphQlHeaders}; diff --git a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/getOrderDetailsById.d.ts b/scripts/__dropins__/storefront-order/api/getOrderDetailsById/getOrderDetailsById.d.ts index c9745a694c..d06579bdaa 100644 --- a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/getOrderDetailsById.d.ts +++ b/scripts/__dropins__/storefront-order/api/getOrderDetailsById/getOrderDetailsById.d.ts @@ -1,5 +1,4 @@ -import { GetOrderDetailsByIdProps } from '../../types'; import { TransformedData } from '../../data/models'; -export declare const getOrderDetailsById: ({ orderId, returnRef, queryType, returnsPageSize, }: GetOrderDetailsByIdProps) => Promise>; +export declare const getOrderDetailsById: (orderId?: string, returnRef?: string, queryType?: T | undefined) => Promise>; //# sourceMappingURL=getOrderDetailsById.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/graphql/requestReturn.graphql.d.ts b/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts index 2053c33748..e543a059fe 100644 --- a/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts +++ b/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts @@ -1,2 +1,2 @@ -export declare const REQUEST_RETURN_ORDER: string; +export declare const REQUEST_RETURN_ORDER = "\nmutation REQUEST_RETURN_ORDER($input: RequestReturnInput!) {\n requestReturn(input: $input) {\n return {\n uid\n status\n number\n created_at\n }\n }\n}\n"; //# sourceMappingURL=requestReturn.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js b/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js index 85b40962e3..d97f0578f5 100644 --- a/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js +++ b/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js @@ -1 +1 @@ -import{jsx as t,jsxs as E,Fragment as w}from"@dropins/tools/preact-jsx-runtime.js";import{Price as u,CartItem as o,Icon as r,Image as U,Incrementer as c}from"@dropins/tools/components.js";import{useCallback as d}from"@dropins/tools/preact-hooks.js";import{classes as X}from"@dropins/tools/lib.js";import*as Q from"@dropins/tools/preact-compat.js";const p=N=>Q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...N},Q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),Q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),ne=({loading:N,product:e,itemType:Y,taxConfig:D,translations:v,disabledIncrementer:C,showConfigurableOptions:_,onQuantity:y,routeProductDetails:b,isReturnProductList:I})=>{var H,M,Z,j,q,x,z,F,O,R,W,$,B,K,A,G,J;const{taxExcluded:S,taxIncluded:f}=D,m=d((h,g,T)=>t(u,{amount:h,currency:g,weight:"normal",...T}),[]);let k={};const L=Y==="cancelled",P=(M=(H=e==null?void 0:e.product)==null?void 0:H.stockStatus)==null?void 0:M.includes("IN_STOCK"),a=(e==null?void 0:e.giftCard)||{},l=(Z=e==null?void 0:e.itemPrices)==null?void 0:Z.priceIncludingTax,s=(j=e==null?void 0:e.itemPrices)==null?void 0:j.originalPrice,n=(q=e==null?void 0:e.itemPrices)==null?void 0:q.price,i=e.discounted&&((x=e.price)==null?void 0:x.value)!==(s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),V={..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in a?{[v.sender]:a==null?void 0:a.senderName}:{},..."senderEmail"in a&&(a!=null&&a.senderEmail)?{[v.sender]:a==null?void 0:a.senderEmail}:{},..."recipientName"in a&&(a!=null&&a.recipientName)?{[v.recipient]:a==null?void 0:a.recipientName}:{},..."recipientEmail"in a&&(a!=null&&a.recipientEmail)?{[v.recipient]:a==null?void 0:a.recipientEmail}:{},..."message"in a&&(a!=null&&a.message)?{[v.message]:a==null?void 0:a.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(z=e==null?void 0:e.downloadableLinks)==null?void 0:z.count} ${v.downloadableCount}`]:(F=e==null?void 0:e.downloadableLinks)==null?void 0:F.result}:{}};if(f&&S){const h=i?s==null?void 0:s.value:(l==null?void 0:l.value)*(e==null?void 0:e.totalQuantity);k={taxExcluded:!0,taxIncluded:void 0,price:m(s==null?void 0:s.value,s==null?void 0:s.currency),total:E(w,{children:[m(h,s==null?void 0:s.currency,{variant:e.discounted&&(l==null?void 0:l.value)!==h?"strikethrough":"default"}),e.discounted&&(l==null?void 0:l.value)!==h?m(l==null?void 0:l.value,l==null?void 0:l.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:m((n==null?void 0:n.value)*e.totalQuantity,n==null?void 0:n.currency)}}else if(!f&&S)k={taxExcluded:void 0,taxIncluded:void 0,price:m(s==null?void 0:s.value,s==null?void 0:s.currency),total:E(w,{children:[m((s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),l==null?void 0:l.currency,{variant:i?"strikethrough":"default"}),i?m((O=e.price)==null?void 0:O.value,(R=e.price)==null?void 0:R.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:m((n==null?void 0:n.value)*(e==null?void 0:e.totalQuantity),n==null?void 0:n.currency)};else if(f&&!S){const h=i?s.value:l.value*e.totalQuantity;k={taxExcluded:void 0,taxIncluded:!0,price:m(l==null?void 0:l.value,l==null?void 0:l.currency),total:E(w,{children:[m(h,l==null?void 0:l.currency,{variant:i?"strikethrough":"default",weight:"bold"}),i?m(l==null?void 0:l.value,l==null?void 0:l.currency,{sale:!0,weight:"bold"}):null]})}}return t(o,{loading:N,alert:L&&P?E("span",{children:[t(r,{source:p}),v.outOfStock]}):t(w,{}),configurations:(_==null?void 0:_(V))??V,title:b?t("a",{"data-testid":"product-name",className:X(["cart-summary-item__title",["cart-summary-item__title--strikethrough",L]]),href:b(e),children:(W=e==null?void 0:e.product)==null?void 0:W.name}):t("div",{"data-testid":"product-name",className:X(["cart-summary-item__title",["cart-summary-item__title--strikethrough",L]]),children:($=e==null?void 0:e.product)==null?void 0:$.name}),sku:t("div",{children:(B=e==null?void 0:e.product)==null?void 0:B.sku}),quantity:e!=null&&e.eligibleForReturn&&(e!=null&&e.returnableQuantity)?(e==null?void 0:e.returnableQuantity)??e.totalQuantity:I?void 0:e.totalQuantity,image:b?t("a",{href:b(e),children:t(U,{src:(K=e==null?void 0:e.product)==null?void 0:K.thumbnail.url,alt:(A=e==null?void 0:e.product)==null?void 0:A.thumbnail.label,loading:"lazy",width:"90",height:"120"})}):t(U,{src:(G=e==null?void 0:e.product)==null?void 0:G.thumbnail.url,alt:(J=e==null?void 0:e.product)==null?void 0:J.thumbnail.label,loading:"lazy",width:"90",height:"120"}),...k,footer:y&&!C?t(c,{value:1,min:1,max:e==null?void 0:e.returnableQuantity,onValue:h=>y==null?void 0:y(Number(h)),name:"quantity"}):void 0})};export{ne as C,p as S}; +import{jsx as t,jsxs as E,Fragment as w}from"@dropins/tools/preact-jsx-runtime.js";import{Price as u,CartItem as o,Icon as r,Image as U,Incrementer as c}from"@dropins/tools/components.js";import{useCallback as d}from"@dropins/tools/preact-hooks.js";import{classes as X}from"@dropins/tools/lib.js";import*as V from"@dropins/tools/preact-compat.js";const p=N=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...N},V.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"}),V.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"})),ne=({loading:N,product:e,itemType:Y,taxConfig:D,translations:v,disabledIncrementer:C,showConfigurableOptions:_,onQuantity:y,routeProductDetails:b,isReturnProductList:I})=>{var H,M,Z,j,q,x,z,F,O,R,W,$,B,K,A,G,J;const{taxExcluded:S,taxIncluded:L}=D,m=d((h,T,g)=>t(u,{amount:h,currency:T,weight:"normal",...g}),[]);let k={};const Q=Y==="cancelled",P=(M=(H=e==null?void 0:e.product)==null?void 0:H.stockStatus)==null?void 0:M.includes("IN_STOCK"),l=(e==null?void 0:e.giftCard)||{},a=(Z=e==null?void 0:e.itemPrices)==null?void 0:Z.priceIncludingTax,s=(j=e==null?void 0:e.itemPrices)==null?void 0:j.originalPrice,n=(q=e==null?void 0:e.itemPrices)==null?void 0:q.price,i=e.discounted&&((x=e.price)==null?void 0:x.value)!==(s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),f={..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in l&&(l!=null&&l.senderName)?{[v.sender]:l==null?void 0:l.senderName}:{},..."senderEmail"in l&&(l!=null&&l.senderEmail)?{[v.sender]:l==null?void 0:l.senderEmail}:{},..."recipientName"in l&&(l!=null&&l.recipientName)?{[v.recipient]:l==null?void 0:l.recipientName}:{},..."recipientEmail"in l&&(l!=null&&l.recipientEmail)?{[v.recipient]:l==null?void 0:l.recipientEmail}:{},..."message"in l&&(l!=null&&l.message)?{[v.message]:l==null?void 0:l.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(z=e==null?void 0:e.downloadableLinks)==null?void 0:z.count} ${v.downloadableCount}`]:(F=e==null?void 0:e.downloadableLinks)==null?void 0:F.result}:{}};if(L&&S){const h=i?s==null?void 0:s.value:(a==null?void 0:a.value)*(e==null?void 0:e.totalQuantity);k={taxExcluded:!0,taxIncluded:void 0,price:m(s==null?void 0:s.value,s==null?void 0:s.currency),total:E(w,{children:[m(h,s==null?void 0:s.currency,{variant:e.discounted&&(a==null?void 0:a.value)!==h?"strikethrough":"default"}),e.discounted&&(a==null?void 0:a.value)!==h?m(a==null?void 0:a.value,a==null?void 0:a.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:m((n==null?void 0:n.value)*e.totalQuantity,n==null?void 0:n.currency)}}else if(!L&&S)k={taxExcluded:void 0,taxIncluded:void 0,price:m(s==null?void 0:s.value,s==null?void 0:s.currency),total:E(w,{children:[m((s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),a==null?void 0:a.currency,{variant:i?"strikethrough":"default"}),i?m((O=e.price)==null?void 0:O.value,(R=e.price)==null?void 0:R.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:m((n==null?void 0:n.value)*(e==null?void 0:e.totalQuantity),n==null?void 0:n.currency)};else if(L&&!S){const h=i?s.value:a.value*e.totalQuantity;k={taxExcluded:void 0,taxIncluded:!0,price:m(a==null?void 0:a.value,a==null?void 0:a.currency),total:E(w,{children:[m(h,a==null?void 0:a.currency,{variant:i?"strikethrough":"default",weight:"bold"}),i?m(a==null?void 0:a.value,a==null?void 0:a.currency,{sale:!0,weight:"bold"}):null]})}}return t(o,{loading:N,alert:Q&&P?E("span",{children:[t(r,{source:p}),v.outOfStock]}):t(w,{}),configurations:(_==null?void 0:_(f))??f,title:b?t("a",{"data-testid":"product-name",className:X(["cart-summary-item__title",["cart-summary-item__title--strikethrough",Q]]),href:b(e),children:(W=e==null?void 0:e.product)==null?void 0:W.name}):t("div",{"data-testid":"product-name",className:X(["cart-summary-item__title",["cart-summary-item__title--strikethrough",Q]]),children:($=e==null?void 0:e.product)==null?void 0:$.name}),sku:t("div",{children:(B=e==null?void 0:e.product)==null?void 0:B.sku}),quantity:e!=null&&e.eligibleForReturn&&(e!=null&&e.returnableQuantity)?(e==null?void 0:e.returnableQuantity)??e.totalQuantity:I?void 0:e.totalQuantity,image:b?t("a",{href:b(e),children:t(U,{src:(K=e==null?void 0:e.product)==null?void 0:K.thumbnail.url,alt:(A=e==null?void 0:e.product)==null?void 0:A.thumbnail.label,loading:"lazy",width:"90",height:"120"})}):t(U,{src:(G=e==null?void 0:e.product)==null?void 0:G.thumbnail.url,alt:(J=e==null?void 0:e.product)==null?void 0:J.thumbnail.label,loading:"lazy",width:"90",height:"120"}),...k,footer:y&&!C?t(c,{value:1,min:1,max:e==null?void 0:e.returnableQuantity,onValue:h=>y==null?void 0:y(Number(h)),name:"quantity"}):void 0})};export{ne as C,p as S}; diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index d1fe6978de..61691fd202 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1 +1 @@ -import{jsx as r,jsxs as s,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as q}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as V,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as n1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as t1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const k=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"})))),a1=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"})),J=({typeList:L,isEmpty:p,minifiedView:_,message:n})=>{const a=n1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:n}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,n]);return!p||!L||!a.text?null:r(R,{className:W(["order-empty-list",a.className,_?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:p=!1,withOrderNumber:_=!1,slots:n,pageInfo:a,withReturnsListButton:$=!0,isMobile:y=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:N=!0,withThumbnails:A=!0,selectedPage:B=1,handleSetSelectPage:S,routeReturnDetails:d,routeOrderDetails:g,routeTracking:f,routeReturnsList:v,routeProductDetails:m,loading:b})=>{const z=h?X:i.length,j=m!=null&&m()?"a":"span",x=w(()=>i.slice(0,z).map((e,I)=>{var F,G;const E=((e==null?void 0:e.items)??[]).reduce((t,o)=>(o.requestQuantity??0)+t,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${L}.returnsList.resturnStatus.${t1(e.returnStatus)}`})}),p?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(g==null?void 0:g({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((t,o)=>{var M,Z;const C={title:"",number:(t==null?void 0:t.trackingNumber)??"",carrier:((M=t==null?void 0:t.carrier)==null?void 0:M.label)??""},H=f==null?void 0:f(C);return s("p",{children:[`${c.carrier} `,`${(Z=C.carrier)==null?void 0:Z.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer",children:t.trackingNumber}):r("span",{children:t.trackingNumber})]},`${C.number}_${o}`)}),n!=null&&n.ReturnItemsDetails?r(q,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:n==null?void 0:n.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[E," ",r(U,{id:`Order.Returns.${L}.returnsList.itemText`,plural:E,fields:{count:E}})]}):null]}),A?r(D,{maxColumns:y?3:9,emptyGridContent:r(u,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",y]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((t,o)=>{var M,Z;const C=(M=t.thumbnail)==null?void 0:M.label,H=(Z=t.thumbnail)==null?void 0:Z.url;return r(j,{href:(m==null?void 0:m(t))??"#",children:r(r1,{alt:C,src:H,width:85,height:114})},o+t.uid)})}):null,n!=null&&n.DetailsActionParams?r(q,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:n==null?void 0:n.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:k,...T})})]})},I)}),[i,z,L,p,c,d,_,g,n,A,y,m,f,j]),Y=w(()=>s(u,{children:[N?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,b?r(Q,{withCard:!1}):s(u,{children:[x,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(v==null?void 0:v())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(V,{source:k,...T})]})})}):null]})]}),[v,$,N,c,x,h,i.length,b]),K=w(()=>s(u,{children:[N?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,b?r(Q,{withCard:!1}):s(u,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),x,(a==null?void 0:a.totalPages)>1?r(e1,{totalPages:a==null?void 0:a.totalPages,currentPage:B,onChange:S}):null]})]}),[x,h,i,c,a==null?void 0:a.totalPages,B,S,b,N]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{u1 as R}; +import{jsx as r,jsxs as s,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as O}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as V,Card as P,ContentGrid as D,Image as r1,Header as Q,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as k}from"@dropins/tools/i18n.js";const q=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"})))),a1=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"})),J=({typeList:L,isEmpty:p,minifiedView:_,message:t})=>{const a=t1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,t]);return!p||!L||!a.text?null:r(R,{className:W(["order-empty-list",a.className,_?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:p=!1,withOrderNumber:_=!1,slots:t,pageInfo:a,withReturnsListButton:$=!0,isMobile:y=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:N=!0,withThumbnails:A=!0,selectedPage:B=1,handleSetSelectPage:S,routeReturnDetails:d,routeOrderDetails:g,routeTracking:f,routeReturnsList:v,routeProductDetails:m,loading:b})=>{const z=h?X:i.length,j=m!=null&&m()?"a":"span",x=w(()=>i.slice(0,z).map((e,I)=>{var F,G;const E=((e==null?void 0:e.items)??[]).reduce((n,o)=>(o.totalQuantity??0)+n,0);return r(P,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(k,{id:`Order.Returns.${L}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),p?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(g==null?void 0:g({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((n,o)=>{var M,Z;const C={title:"",number:(n==null?void 0:n.trackingNumber)??"",carrier:((M=n==null?void 0:n.carrier)==null?void 0:M.label)??""},H=f==null?void 0:f(C);return s("p",{children:[`${c.carrier} `,`${(Z=C.carrier)==null?void 0:Z.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer",children:n.trackingNumber}):r("span",{children:n.trackingNumber})]},`${C.number}_${o}`)}),t!=null&&t.ReturnItemsDetails?r(O,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[E," ",r(k,{id:`Order.Returns.${L}.returnsList.itemText`,plural:E,fields:{count:E}})]}):null]}),A?r(D,{maxColumns:y?3:9,emptyGridContent:r(u,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",y]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((n,o)=>{var M,Z;const C=(M=n.thumbnail)==null?void 0:M.label,H=(Z=n.thumbnail)==null?void 0:Z.url;return r(j,{href:(m==null?void 0:m(n))??"#",children:r(r1,{alt:C,src:H,width:85,height:114})},o+n.uid)})}):null,t!=null&&t.DetailsActionParams?r(O,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:t==null?void 0:t.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:q,...T})})]})},I)}),[i,z,L,p,c,d,_,g,t,A,y,m,f,j]),Y=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,b?r(U,{withCard:!1}):s(u,{children:[x,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(v==null?void 0:v())??"#",children:r(P,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(V,{source:q,...T})]})})}):null]})]}),[v,$,N,c,x,h,i.length,b]),K=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,b?r(U,{withCard:!1}):s(u,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),x,(a==null?void 0:a.totalPages)>1?r(e1,{totalPages:a==null?void 0:a.totalPages,currentPage:B,onChange:S}):null]})]}),[x,h,i,c,a==null?void 0:a.totalPages,B,S,b,N]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{u1 as R}; diff --git a/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js b/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js index ea6549d643..5059874bd8 100644 --- a/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js +++ b/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js @@ -44,4 +44,4 @@ import{h as i}from"./network-error.js";import{f as u,h as s}from"./fetch-graphql } } } -`,T=async r=>await u(r!=="shortRequest"?n:_,{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(t=>{var e,o,a;return(e=t.errors)!=null&&e.length?s(t.errors):m((a=(o=t==null?void 0:t.data)==null?void 0:o.attributesForm)==null?void 0:a.items)}).catch(i);export{T as g}; +`,T=async r=>await u(r!=="shortRequest"?n:_,{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(t=>{var e,o,a;return(e=t.errors)!=null&&e.length?s(t.errors):m(((a=(o=t==null?void 0:t.data)==null?void 0:o.attributesForm)==null?void 0:a.items)??[])}).catch(i);export{T as g}; diff --git a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js index 5778d24104..21f9223939 100644 --- a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js +++ b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js @@ -92,7 +92,6 @@ fragment AddressesList on OrderAddress { timestamp } items { - __typename id product_sku product_name diff --git a/scripts/__dropins__/storefront-order/chunks/requestReturn.js b/scripts/__dropins__/storefront-order/chunks/requestReturn.js index 4e63f82b5b..bf713ed850 100644 --- a/scripts/__dropins__/storefront-order/chunks/requestReturn.js +++ b/scripts/__dropins__/storefront-order/chunks/requestReturn.js @@ -1,4 +1,4 @@ -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=` +import{h as i}from"./network-error.js";import{f as s,h as o}from"./fetch-graphql.js";import{t as c}from"./transform-attributes-form.js";import{a as m}from"./convertCase.js";const d=` query GET_ATTRIBUTES_LIST($entityType: AttributeEntityTypeEnum!) { attributesList(entityType: $entityType) { items { @@ -31,20 +31,15 @@ import{h as i}from"./network-error.js";import{f as s,h as o}from"./fetch-graphql } } } -`,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=` +`,E=async u=>await s(d,{method:"GET",cache:"force-cache",variables:{entityType:u}}).then(t=>{var e,r,a;return(e=t.errors)!=null&&e.length?o(t.errors):c(((a=(r=t==null?void 0:t.data)==null?void 0:r.attributesList)==null?void 0:a.items)??[])}).catch(i),l=` mutation REQUEST_RETURN_ORDER($input: RequestReturnInput!) { requestReturn(input: $input) { return { - ...OrderReturn + uid + status + number + created_at } } } -${_}`,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}; +`,f=async u=>{const t=m(u,"snakeCase",{});return await s(l,{method:"POST",variables:{input:t}}).then(e=>{var n;if((n=e.errors)!=null&&n.length)return o(e.errors);const{created_at:r,...a}=e.data.requestReturn.return;return{...a,createdAt:r}}).catch(i)};export{E as g,f as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js b/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js index 7a0c70015a..7f9f88c15b 100644 --- a/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js +++ b/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js @@ -1 +1 @@ -import{F as c}from"./form.types.js";const p={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"},y=n=>{const s={};return Object.keys(n).forEach(e=>{if(e.match(/_(\d+)$/)){const t=e.replace(/_\d+$/,"");s[t]=n[e]}else s[e]=n[e]}),s},R=(n,s)=>n.map(e=>({...e,id:`${e.id}_${e.fieldType}_${s+1}`,name:`${e.name}_${e.fieldType}_${s+1}`,code:`${e.code}_${e.fieldType}_${s+1}`,customUpperCode:`${e.customUpperCode}_${e.fieldType}_${s+1}`})),_=(n,s)=>n==null?void 0:n.flatMap(e=>Array.from({length:s},(i,t)=>({...e,id:`${e.id}_${e.fieldType}_${t+1}`,name:`${e.name}_${e.fieldType}_${t+1}`,code:`${e.code}_${e.fieldType}_${t+1}`,customUpperCode:`${e.customUpperCode}_${e.fieldType}_${t+1}`}))),$=n=>{const s=[],e=[];return Object.entries(n).forEach(([i,t])=>{const a=i.lastIndexOf("_"),r=i.slice(0,a),u=i.slice(a+1);u===c.MULTISELECT||u===c.SELECT?s.push({attributeCode:r,value:btoa(t)}):e.push({attributeCode:r,value:t})}),{selectedCustomAttributes:s,enteredCustomAttributes:e}},m=n=>typeof n!="string"?"":p[n]??"",l=["REJECTED","PARTIALLY_REJECTED","DENIED","UNCONFIRMED","CLOSED"],A=n=>{const s=n==null?void 0:n.returns.filter(t=>!l.includes(t.returnStatus));return((n==null?void 0:n.itemsEligibleForReturn)??[]).flatMap(t=>{let a=t.quantityShipped,r={...t,returnableQuantity:a};return t.quantityShipped===0&&(r={...r,eligibleForReturn:!1,returnableQuantity:0}),s.forEach(u=>{u.items.forEach(o=>{if((o==null?void 0:o.id)===(t==null?void 0:t.id)){const d=a-o.requestQuantity;a=Math.max(d,0),r={...r,eligibleForReturn:a!==0,returnableQuantity:a}}})}),r}).sort((t,a)=>Number(a.eligibleForReturn)-Number(t.eligibleForReturn))},C=n=>{var i;let s=[];return((i=n==null?void 0:n.returns)==null?void 0:i.filter(t=>!l.includes(t.returnStatus)).flatMap(t=>t.items||[])).forEach(t=>{if(!s.length)s.push({...t,totalQuantity:t.requestQuantity});else{const a=s.findIndex(r=>r.id===t.id);a!==-1?s[a].totalQuantity+=t.requestQuantity:s.push({...t,totalQuantity:t.requestQuantity})}}),{returnedList:s??[],modifyOrder:E(n.items,s)??[]}};function E(n,s){const e=new Map(s.map(i=>[i.id,i]));return n.map(i=>{const t=e.get(i.id);if(t){const a=i.totalQuantity-t.totalQuantity;return a===0?null:{...i,totalQuantity:a}}return i}).filter(i=>i!==null)}export{y as c,C as e,m as f,R as m,$ as n,A as o,_ as r}; +import{F as c}from"./form.types.js";const p={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"},y=i=>{const n={};return Object.keys(i).forEach(t=>{if(t.match(/_(\d+)$/)){const e=t.replace(/_\d+$/,"");n[e]=i[t]}else n[t]=i[t]}),n},R=(i,n)=>i.map(t=>({...t,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}`})),_=(i,n)=>i==null?void 0:i.flatMap(t=>Array.from({length:n},(a,e)=>({...t,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}`}))),$=i=>{const n=[],t=[];return Object.entries(i).forEach(([a,e])=>{const s=a.lastIndexOf("_"),r=a.slice(0,s),u=a.slice(s+1);u===c.MULTISELECT||u===c.SELECT?n.push({attributeCode:r,value:btoa(e)}):t.push({attributeCode:r,value:e})}),{selectedCustomAttributes:n,enteredCustomAttributes:t}},m=i=>typeof i!="string"?"":p[i]??"",l=["REJECTED","PARTIALLY_REJECTED","DENIED","UNCONFIRMED","CLOSED"],A=i=>{const n=i==null?void 0:i.returns.filter(e=>!l.includes(e.returnStatus));return((i==null?void 0:i.itemsEligibleForReturn)??[]).flatMap(e=>{let s=e.quantityShipped,r={...e,returnableQuantity:s};return e.quantityShipped===0&&(r={...r,eligibleForReturn:!1,returnableQuantity:0}),n.forEach(u=>{u.items.forEach(o=>{if((o==null?void 0:o.id)===(e==null?void 0:e.id)){const d=s-o.requestQuantity;s=Math.max(d,0),r={...r,eligibleForReturn:s!==0,returnableQuantity:s}}})}),r}).sort((e,s)=>Number(s.eligibleForReturn)-Number(e.eligibleForReturn))},C=i=>{var a;let n=[];return((a=i==null?void 0:i.returns)==null?void 0:a.filter(e=>!l.includes(e.returnStatus)).flatMap(e=>e.items||[])).forEach(e=>{if(!n.length)n.push({...e,totalQuantity:e.requestQuantity});else{const s=n.findIndex(r=>r.id===e.id);s!==-1?n[s].totalQuantity+=e.requestQuantity:n.push({...e,totalQuantity:e.requestQuantity})}}),{returnedList:n,modifyOrder:E(i.items,n)}};function E(i,n){return i.map(t=>{const a=n.find(e=>e.id===t.id);if(a){const e=t.totalQuantity-a.totalQuantity;return e===0?null:{...t,totalQuantity:e}}return t}).filter(t=>t!==null)}export{y as c,C as e,m as f,R as m,$ as n,A as o,_ as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js index ce74ed1d52..b8ba7c03cf 100644 --- a/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js +++ b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js @@ -1 +1 @@ -import{c as i,a as d}from"./convertCase.js";const a=n=>{let c=[];for(const e of n)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let o=2;o<=e.multiline_count;o++){const s={...e,name:`${e.code}_${o}`,code:`${e.code}_${o}`,id:`${e.code}_${o}`};c.push(s)}return c},f=(n=[])=>{var s;if(!(n!=null&&n.length))return[];const c=(s=n.filter(t=>{var r;return!((r=t.frontend_input)!=null&&r.includes("HIDDEN"))}))==null?void 0:s.map(({code:t,...r})=>{const u=t!=="country_id"?t:"country_code";return{...r,name:u,id:u,code:u}}),e=a(c);return c.concat(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 d,a as m}from"./convertCase.js";const a=s=>{let o=[];for(const e of s)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let n=2;n<=e.multiline_count;n++){const c={...e,name:`${e.code}_${n}`,code:`${e.code}_${n}`,id:`${e.code}_${n}`};o.push(c)}return o},f=s=>{var u;const o=s||[];if(!o.length)return[];const e=(u=o.filter(t=>{var r;return!((r=t.frontend_input)!=null&&r.includes("HIDDEN"))}))==null?void 0:u.map(({code:t,...r})=>{const i=t!=="country_id"?t:"country_code";return{...r,name:i,id:i,code:i}}),n=a(e);return e.concat(n).map(t=>{const r=d(t.code);return m({...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/containers/CreateReturn.js b/scripts/__dropins__/storefront-order/containers/CreateReturn.js index 1feb8dbebb..c32ec9c37e 100644 --- a/scripts/__dropins__/storefront-order/containers/CreateReturn.js +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn.js @@ -1 +1 @@ -import{jsx as r,jsxs as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as q,Slot as P}from"@dropins/tools/lib.js";import{Checkbox as H,Button as Q,CartItem as V,Image as W,Header as Z,InLineAlert as D}from"@dropins/tools/components.js";import{u as z,a as U}from"../chunks/OrderCancel.js";import{useState as _,useRef as K,useEffect as T,useCallback as F}from"@dropins/tools/preact-hooks.js";import{events as G}from"@dropins/tools/event-bus.js";import{g as J}from"../chunks/getFormValues.js";import{s as X}from"../chunks/setTaxStatus.js";import{createRef as Y,Fragment as I}from"@dropins/tools/preact.js";import{o as ee,c as te,n as ne,r as re,m as ae}from"../chunks/returnOrdersHelper.js";import{g as se,r as ie}from"../chunks/requestReturn.js";import{g as ce}from"../chunks/getStoreConfig.js";import*as y from"@dropins/tools/preact-compat.js";import{S as ue,C as oe}from"../chunks/CartSummaryItem.js";import{O as le}from"../chunks/OrderLoaders.js";import{useText as de}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const pe=a=>y.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},y.createElement("g",{clipPath:"url(#clip0_841_1324)"},y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),y.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"})),y.createElement("defs",null,y.createElement("clipPath",{id:"clip0_841_1324"},y.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),he=a=>y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},y.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"}),y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),me=({onSuccess:a,onError:s,handleSetInLineAlert:c,orderData:d})=>{const[u,p]=_(d),[C,f]=_("products"),[O,b]=_(!0),[i,g]=_([]),[S,w]=_([]),[e,L]=_({taxIncluded:!1,taxExcluded:!1}),[t,h]=_([]),k=K([]);k.current.length!==i.length&&(k.current=i.map((n,o)=>k.current[o]||Y())),T(()=>{const n=G.on("order/data",o=>{p(o),h(ee(o)),b(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ce().then(n=>{if(n){const o=X(n==null?void 0:n.shoppingCartDisplayPrice);L(o)}})},[]),T(()=>{se("RMA_ITEM").then(n=>{n.length&&(w(n),b(!1))})},[]);const N=F(n=>{g(o=>o.findIndex(l=>(l==null?void 0:l.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(l=>(l==null?void 0:l.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),R=F(n=>{f(n),c(),n==="products"&&g([])},[c]),A=F((n,o)=>{const v=i.map(l=>l.productSku===o?{...l,currentReturnOrderQuantity:n}:l);g(v)},[i]),E=F(async(n,o)=>{if(!o)return null;b(!0);const v={orderUid:(u==null?void 0:u.id)??"",contactEmail:(u==null?void 0:u.email)??""},l=[];k.current.length&&k.current.forEach(({current:m})=>{var M;const $=m==null?void 0:m.name.replace(/_\d+$/,""),j=((M=m==null?void 0:m.dataset)==null?void 0:M.quantity)??1,B=te(J(m));l.push({orderItemUid:$,quantityToReturn:+j,...ne(B)})}),ie({...v,items:l}).then(m=>{m&&(a==null||a(m),R("success"),c())}).catch(m=>{s==null||s(m.message),c({type:"error",heading:m.message})}),b(!1)},[R,s,a,c,u]);return{order:u,steps:C,loading:O,formsRef:k,taxConfig:e,attributesList:S,selectedProductList:i,itemsEligibleForReturn:t,handleSelectedProductList:N,handleSetQuantity:A,handleChangeStep:R,onSubmit:E}},ge={success:r(he,{}),warning:r(pe,{}),error:r(ue,{})},fe=()=>{const[a,s]=_({type:"success",heading:""}),c=F(d=>{if(!(d!=null&&d.type)){s({type:"success",heading:""});return}const u=ge[d.type];s({...d,icon:u})},[]);return{inLineAlertProps:a,handleSetInLineAlert:c}},be=({itemsEligibleForReturn:a,slots:s,loading:c=!1,taxConfig:d,translations:u={},selectedProductList:p,handleSelectedProductList:C,showConfigurableOptions:f,handleSetQuantity:O,handleChangeStep:b})=>x("ul",{className:"order-return-order-product-list",children:[a==null?void 0:a.map((i,g)=>{const S=p.some(e=>(e==null?void 0:e.productSku)===i.productSku&&i.eligibleForReturn&&i.quantityReturned===0),w=i.returnableQuantity===0?1:i.returnableQuantity;return x("li",{className:q(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",!i.eligibleForReturn]]),children:[r(H,{"data-testid":`key_${g}`,name:`key_${g}`,checked:S,disabled:!i.eligibleForReturn||i.quantityReturned!==0,onChange:()=>{C({...i,currentReturnOrderQuantity:1})}}),r(oe,{loading:c,product:{...i,totalQuantity:w},itemType:"",taxConfig:d,translations:u,showConfigurableOptions:f,disabledIncrementer:!S,isReturnProductList:!0,onQuantity:(i==null?void 0:i.returnableQuantity)>1?e=>O(e,i.productSku):void 0}),s!=null&&s.ReturnOrderItem?r(P,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:s==null?void 0:s.ReturnOrderItem,context:{}}):null]},g)}),r("li",{className:"order-return-order-product-list__item",children:r(Q,{type:"button",onClick:()=>b("attributes"),disabled:!p.length,children:u.nextStep})})]}),ke=({routeReturnSuccess:a,translations:s,orderData:c})=>{const d=()=>{window.location.href=(a==null?void 0:a(c))??"#"};return 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(Q,{onClick:d,type:"button",children:s.backStore})]})},ye=({slots:a,formsRef:s,selectedProductList:c,loading:d,fieldsConfig:u,translations:p,handleChangeStep:C,onSubmit:f})=>{const{formData:O,errors:b,formRef:i,handleChange:g,handleBlur:S,handleSubmit:w}=z({fieldsConfig:re(u,c==null?void 0:c.length),onSubmit:f});return x("form",{className:"order-return-reason-form",ref:i,onSubmit:w,name:"returnReasonForm",children:[c.map((e,L)=>{var E,n,o,v,l;const t=(e==null?void 0:e.giftCard)||{},h=e==null?void 0:e.product,k=ae(u,L),N=`${e==null?void 0:e.id}_${L}`,R=(e==null?void 0:e.currentReturnOrderQuantity)??1,A={...e!=null&&e.currentReturnOrderQuantity?{Quantity:R}:{},..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in t?{[p.sender]:t==null?void 0:t.senderName}:{},..."senderEmail"in t&&(t!=null&&t.senderEmail)?{[p.sender]:t==null?void 0:t.senderEmail}:{},..."recipientName"in t&&(t!=null&&t.recipientName)?{[p.recipient]:t==null?void 0:t.recipientName}:{},..."recipientEmail"in t&&(t!=null&&t.recipientEmail)?{[p.recipient]:t==null?void 0:t.recipientEmail}:{},..."message"in t&&(t!=null&&t.message)?{[p.message]:t==null?void 0:t.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(E=e==null?void 0:e.downloadableLinks)==null?void 0:E.count} ${p.downloadableCount}`]:(n=e==null?void 0:e.downloadableLinks)==null?void 0:n.result}:{}};return x(I,{children:[r(V,{loading:d,title:r("div",{"data-testid":"product-name",children:(o=e==null?void 0:e.product)==null?void 0:o.name}),sku:r("div",{children:h==null?void 0:h.sku}),image:r(W,{src:((v=h==null?void 0:h.thumbnail)==null?void 0:v.url)??"",alt:((l=h==null?void 0:h.thumbnail)==null?void 0:l.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:A}),r("form",{name:N,ref:s==null?void 0:s.current[L],"data-quantity":R,children:r(U,{className:"className",loading:d,fields:k,onChange:g,onBlur:S,errors:b,values:O})})]},L)}),a!=null&&a.ReturnFormActions?r(P,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:a==null?void 0:a.ReturnFormActions,context:{handleChangeStep:C}}):x("div",{className:"order-return-reason-form__actions",children:[r(Q,{variant:"secondary",type:"button",onClick:()=>{C("products")},children:p.backStep}),r(Q,{children:p.submit})]})]})},He=({className:a,orderData:s,slots:c,onSuccess:d,onError:u,routeReturnSuccess:p,showConfigurableOptions:C})=>{const f=de({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"}),{inLineAlertProps:O,handleSetInLineAlert:b}=fe(),{order:i,itemsEligibleForReturn:g,formsRef:S,taxConfig:w,attributesList:e,steps:L,loading:t,selectedProductList:h,handleSelectedProductList:k,handleSetQuantity:N,handleChangeStep:R,onSubmit:A}=me({orderData:s,onSuccess:d,onError:u,handleSetInLineAlert:b});if(t)return r("div",{children:r(le,{})});if(!t&&!e.length)return r("div",{});const E={products:r(be,{itemsEligibleForReturn:g,slots:c,translations:f,loading:t,taxConfig:w,selectedProductList:h,handleSelectedProductList:k,showConfigurableOptions:C,handleSetQuantity:N,handleChangeStep:R}),attributes:r(ye,{slots:c,formsRef:S,loading:t,fieldsConfig:e,selectedProductList:h,handleChangeStep:R,translations:f,onSubmit:A}),success:r(ke,{translations:f,routeReturnSuccess:p,orderData:i}),error:null};return x("div",{className:q(["order-create-return",a]),children:[r(Z,{title:f.headerText}),O.heading?r(D,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...O}):null,E[L]]})};export{He as CreateReturn,He as default}; +import{jsx as r,jsxs as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as q,Slot as P}from"@dropins/tools/lib.js";import{Checkbox as H,Button as Q,CartItem as V,Image as W,Header as Z,InLineAlert as D}from"@dropins/tools/components.js";import{u as z,a as U}from"../chunks/OrderCancel.js";import{useState as _,useRef as K,useEffect as T,useCallback as F}from"@dropins/tools/preact-hooks.js";import{events as G}from"@dropins/tools/event-bus.js";import{g as J}from"../chunks/getFormValues.js";import{s as X}from"../chunks/setTaxStatus.js";import{createRef as Y,Fragment as I}from"@dropins/tools/preact.js";import{o as ee,c as te,n as ne,r as re,m as ae}from"../chunks/returnOrdersHelper.js";import{g as se,r as ie}from"../chunks/requestReturn.js";import{g as ce}from"../chunks/getStoreConfig.js";import*as R from"@dropins/tools/preact-compat.js";import{S as ue,C as oe}from"../chunks/CartSummaryItem.js";import{O as le}from"../chunks/OrderLoaders.js";import{useText as de}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const pe=a=>R.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},R.createElement("g",{clipPath:"url(#clip0_841_1324)"},R.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),R.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),R.createElement("defs",null,R.createElement("clipPath",{id:"clip0_841_1324"},R.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),he=a=>R.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},R.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),R.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),me=({onSuccess:a,onError:s,handleSetInLineAlert:c,orderData:d})=>{const[u,p]=_(d),[S,b]=_("products"),[L,k]=_(!0),[i,f]=_([]),[C,w]=_([]),[t,h]=_({taxIncluded:!1,taxExcluded:!1}),[e,m]=_([]),y=K([]);y.current.length!==i.length&&(y.current=i.map((n,o)=>y.current[o]||Y())),T(()=>{const n=G.on("order/data",o=>{p(o),m(ee(o)),k(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ce().then(n=>{if(n){const o=X(n==null?void 0:n.shoppingCartDisplayPrice);h(o)}})},[]),T(()=>{se("RMA_ITEM").then(n=>{n.length&&(w(n),k(!1))})},[]);const N=F(n=>{f(o=>o.findIndex(l=>(l==null?void 0:l.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(l=>(l==null?void 0:l.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),O=F(n=>{b(n),c(),n==="products"&&f([])},[c]),A=F((n,o)=>{const v=i.map(l=>l.productSku===o?{...l,currentReturnOrderQuantity:n}:l);f(v)},[i]),E=F(async(n,o)=>{if(!o)return null;k(!0);const v={orderUid:(u==null?void 0:u.id)??"",contactEmail:(u==null?void 0:u.email)??""},l=[];y.current.length&&y.current.forEach(({current:g})=>{var M;const $=g==null?void 0:g.name.replace(/_\d+$/,""),j=((M=g==null?void 0:g.dataset)==null?void 0:M.quantity)??1,B=te(J(g));l.push({orderItemUid:$,quantityToReturn:+j,...ne(B)})}),ie({...v,items:l}).then(g=>{g&&(a==null||a(g),O("success"),c())}).catch(g=>{s==null||s(g.message),c({type:"error",heading:g.message})}),k(!1)},[O,s,a,c,u]);return{order:u,steps:S,loading:L,formsRef:y,taxConfig:t,attributesList:C,selectedProductList:i,itemsEligibleForReturn:e,handleSelectedProductList:N,handleSetQuantity:A,handleChangeStep:O,onSubmit:E}},ge={success:r(he,{}),warning:r(pe,{}),error:r(ue,{})},fe=()=>{const[a,s]=_({type:"success",heading:""}),c=F(d=>{if(!(d!=null&&d.type)){s({type:"success",heading:""});return}const u=ge[d.type];s({...d,icon:u})},[]);return{inLineAlertProps:a,handleSetInLineAlert:c}},be=({itemsEligibleForReturn:a,slots:s,loading:c=!1,taxConfig:d,translations:u={},selectedProductList:p,handleSelectedProductList:S,showConfigurableOptions:b,handleSetQuantity:L,handleChangeStep:k})=>x("ul",{className:"order-return-order-product-list",children:[a==null?void 0:a.map((i,f)=>{const C=Math.random().toString(36),w=p.some(h=>(h==null?void 0:h.productSku)===i.productSku&&i.eligibleForReturn&&i.quantityReturned===0),t=i.returnableQuantity===0?1:i.returnableQuantity;return x("li",{className:q(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",!i.eligibleForReturn]]),children:[r(H,{"data-testid":`${C}_${f+1}`,name:C+f,checked:w,disabled:!i.eligibleForReturn||i.quantityReturned!==0,onChange:()=>{S({...i,currentReturnOrderQuantity:1})}}),r(oe,{loading:c,product:{...i,totalQuantity:t},itemType:"",taxConfig:d,translations:u,showConfigurableOptions:b,disabledIncrementer:!w,isReturnProductList:!0,onQuantity:(i==null?void 0:i.returnableQuantity)>1?h=>L(h,i.productSku):void 0}),s!=null&&s.ReturnOrderItem?r(P,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:s==null?void 0:s.ReturnOrderItem,context:{}}):null]},C+f)}),r("li",{className:"order-return-order-product-list__item",children:r(Q,{type:"button",onClick:()=>k("attributes"),disabled:!p.length,children:u.nextStep})})]}),ke=({routeReturnSuccess:a,translations:s,orderData:c})=>{const d=()=>{window.location.href=(a==null?void 0:a(c))??"#"};return 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(Q,{onClick:d,type:"button",children:s.backStore})]})},ye=({slots:a,formsRef:s,selectedProductList:c,loading:d,fieldsConfig:u,translations:p,handleChangeStep:S,onSubmit:b})=>{const{formData:L,errors:k,formRef:i,handleChange:f,handleBlur:C,handleSubmit:w}=z({fieldsConfig:re(u,c==null?void 0:c.length),onSubmit:b});return x("form",{className:"order-return-reason-form",ref:i,onSubmit:w,name:"returnReasonForm",children:[c.map((t,h)=>{var E,n,o,v,l;const e=(t==null?void 0:t.giftCard)||{},m=t==null?void 0:t.product,y=ae(u,h),N=`${t==null?void 0:t.id}_${h}`,O=(t==null?void 0:t.currentReturnOrderQuantity)??1,A={...t!=null&&t.currentReturnOrderQuantity?{Quantity:O}:{},..."configurableOptions"in t?t.configurableOptions:{},..."bundleOptions"in t?t.bundleOptions:{},..."senderName"in e&&(e!=null&&e.senderName)?{[p.sender]:e==null?void 0:e.senderName}:{},..."senderEmail"in e&&(e!=null&&e.senderEmail)?{[p.sender]:e==null?void 0:e.senderEmail}:{},..."recipientName"in e&&(e!=null&&e.recipientName)?{[p.recipient]:e==null?void 0:e.recipientName}:{},..."recipientEmail"in e&&(e!=null&&e.recipientEmail)?{[p.recipient]:e==null?void 0:e.recipientEmail}:{},..."message"in e&&(e!=null&&e.message)?{[p.message]:e==null?void 0:e.message}:{},..."downloadableLinks"in t&&(t!=null&&t.downloadableLinks)?{[`${(E=t==null?void 0:t.downloadableLinks)==null?void 0:E.count} ${p.downloadableCount}`]:(n=t==null?void 0:t.downloadableLinks)==null?void 0:n.result}:{}};return x(I,{children:[r(V,{loading:d,title:r("div",{"data-testid":"product-name",children:(o=t==null?void 0:t.product)==null?void 0:o.name}),sku:r("div",{children:m==null?void 0:m.sku}),image:r(W,{src:((v=m==null?void 0:m.thumbnail)==null?void 0:v.url)??"",alt:((l=m==null?void 0:m.thumbnail)==null?void 0:l.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:A}),r("form",{name:N,ref:s==null?void 0:s.current[h],"data-quantity":O,children:r(U,{className:"className",loading:d,fields:y,onChange:f,onBlur:C,errors:k,values:L})})]},h)}),a!=null&&a.ReturnFormActions?r(P,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:a==null?void 0:a.ReturnFormActions,context:{handleChangeStep:S}}):x("div",{className:"order-return-reason-form__actions",children:[r(Q,{variant:"secondary",type:"button",onClick:()=>{S("products")},children:p.backStep}),r(Q,{children:p.submit})]})]})},He=({className:a,orderData:s,slots:c,onSuccess:d,onError:u,routeReturnSuccess:p,showConfigurableOptions:S})=>{const b=de({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"}),{inLineAlertProps:L,handleSetInLineAlert:k}=fe(),{order:i,itemsEligibleForReturn:f,formsRef:C,taxConfig:w,attributesList:t,steps:h,loading:e,selectedProductList:m,handleSelectedProductList:y,handleSetQuantity:N,handleChangeStep:O,onSubmit:A}=me({orderData:s,onSuccess:d,onError:u,handleSetInLineAlert:k});if(e)return r("div",{children:r(le,{})});if(!e&&!t.length)return r("div",{});const E={products:r(be,{itemsEligibleForReturn:f,slots:c,translations:b,loading:e,taxConfig:w,selectedProductList:m,handleSelectedProductList:y,showConfigurableOptions:S,handleSetQuantity:N,handleChangeStep:O}),attributes:r(ye,{slots:c,formsRef:C,loading:e,fieldsConfig:t,selectedProductList:m,handleChangeStep:O,translations:b,onSubmit:A}),success:r(ke,{translations:b,routeReturnSuccess:p,orderData:i}),error:null};return x("div",{className:q(["order-create-return",a]),children:[r(Z,{title:b.headerText}),L.heading?r(D,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...L}):null,E[h]]})};export{He as CreateReturn,He as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderProductList.js b/scripts/__dropins__/storefront-order/containers/OrderProductList.js index c2c9411c76..d3c7d3b85a 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderProductList.js +++ b/scripts/__dropins__/storefront-order/containers/OrderProductList.js @@ -1 +1 @@ -import{jsx as i,jsxs as h}from"@dropins/tools/preact-jsx-runtime.js";import{Card as T,Header as I}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as S}from"@dropins/tools/lib.js";import{useState as C,useEffect as x,useMemo as N}from"@dropins/tools/preact-hooks.js";import{events as b}from"@dropins/tools/event-bus.js";import{s as k}from"../chunks/setTaxStatus.js";import{g as v}from"../chunks/getStoreConfig.js";import{Fragment as G}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as j}from"../chunks/returnOrdersHelper.js";import{O as q}from"../chunks/OrderLoaders.js";import{C as w}from"../chunks/CartSummaryItem.js";import{useText as E}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const F=({orderData:a})=>{const[u,t]=C(!0),[c,m]=C(a),[f,d]=C({taxIncluded:!1,taxExcluded:!1});return x(()=>{v().then(e=>{if(e){const r=k(e==null?void 0:e.shoppingCartDisplayPrice);d(r)}}).finally(()=>{t(!1)})},[]),x(()=>{const e=b.on("order/data",r=>{m(r)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:u,taxConfig:f,order:c}},_=({loading:a,taxConfig:u,order:t=null,withHeader:c=!0,showConfigurableOptions:m,routeProductDetails:f})=>{const d=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,r=E({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),g=N(()=>{var p;if(!t)return[];if(!d){const{modifyOrder:s,returnedList:l}=j(t),O=s==null?void 0:s.filter(o=>o.quantityCanceled),y=(p=s??[])==null?void 0:p.filter(o=>!o.quantityCanceled);return[{type:"returned",list:l??[],title:r.returned},{type:"cancelled",list:O,title:r.cancelled},{type:"allItems",list:y,title:r.allOrders}].filter(o=>{var P;return((P=o==null?void 0:o.list)==null?void 0:P.length)>0})}const n=t.returns.find(s=>s.returnNumber===e);return[{type:"returned",list:(n==null?void 0:n.items)??[],title:r.returned}]},[t,d,r,e]);return t?g.every(n=>n.list.length===0)?null:i(T,{variant:"secondary",className:"order-order-product-list-content",children:g.map((n,L)=>{var s;const p=n.list.reduce((l,{totalQuantity:O})=>O+l,0);return h(G,{children:[c?i(I,{title:`${n.title} (${p})`}):null,i("ul",{className:"order-order-product-list-content__items",children:(s=n.list)==null?void 0:s.map(l=>i("li",{"data-testid":"order-product-list-content-item",children:i(w,{loading:a,product:l,itemType:n.type,taxConfig:u,translations:r,showConfigurableOptions:m,routeProductDetails:f})},l.id))})]},L)})}):i(q,{})},tt=({className:a,orderData:u,withHeader:t,showConfigurableOptions:c,routeProductDetails:m})=>{const{loading:f,taxConfig:d,order:e}=F({orderData:u});return i("div",{className:S(["order-order-product-list",a]),children:i(_,{loading:f,taxConfig:d,order:e,withHeader:t,showConfigurableOptions:c,routeProductDetails:m})})};export{tt as OrderProductList,tt as default}; +import{jsx as i,jsxs as T}from"@dropins/tools/preact-jsx-runtime.js";import{Card as S,Header as N}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as b}from"@dropins/tools/lib.js";import{useState as C,useEffect as x,useMemo as k}from"@dropins/tools/preact-hooks.js";import{events as v}from"@dropins/tools/event-bus.js";import{s as G}from"../chunks/setTaxStatus.js";import{g as j}from"../chunks/getStoreConfig.js";import{Fragment as q}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as y}from"../chunks/returnOrdersHelper.js";import{O as w}from"../chunks/OrderLoaders.js";import{C as E}from"../chunks/CartSummaryItem.js";import{useText as F}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const _=({orderData:l})=>{const[a,t]=C(!0),[u,c]=C(l),[m,d]=C({taxIncluded:!1,taxExcluded:!1});return x(()=>{j().then(e=>{if(e){const n=G(e==null?void 0:e.shoppingCartDisplayPrice);d(n)}}).finally(()=>{t(!1)})},[]),x(()=>{const e=v.on("order/data",n=>{c(n)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:a,taxConfig:m,order:u}},$=({loading:l,taxConfig:a,order:t=null,withHeader:u=!0,showConfigurableOptions:c,routeProductDetails:m})=>{const d=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,n=F({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),g=k(()=>{var p,f;if(!t)return[];if(!d){const r=((p=y(t))==null?void 0:p.modifyOrder)??[],O=((f=y(t))==null?void 0:f.returnedList)??[],h=r==null?void 0:r.filter(o=>o.quantityCanceled),I=r==null?void 0:r.filter(o=>!o.quantityCanceled);return[{type:"returned",list:O,title:n.returned},{type:"cancelled",list:h,title:n.cancelled},{type:"allItems",list:I,title:n.allOrders}].filter(o=>{var P;return((P=o==null?void 0:o.list)==null?void 0:P.length)>0})}const s=t.returns.find(r=>r.returnNumber===e);return[{type:"returned",list:(s==null?void 0:s.items)??[],title:n.returned}]},[t,d,n,e]);return t?g.every(s=>s.list.length===0)?null:i(S,{variant:"secondary",className:"order-order-product-list-content",children:g.map((s,L)=>{var f;const p=s.list.reduce((r,{totalQuantity:O})=>O+r,0);return T(q,{children:[u?i(N,{title:`${s.title} (${p})`}):null,i("ul",{className:"order-order-product-list-content__items",children:(f=s.list)==null?void 0:f.map(r=>i("li",{"data-testid":"order-product-list-content-item",children:i(E,{loading:l,product:r,itemType:s.type,taxConfig:a,translations:n,showConfigurableOptions:c,routeProductDetails:m})},r.id))})]},L)})}):i(w,{})},et=({className:l,orderData:a,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})=>{const{loading:m,taxConfig:d,order:e}=_({orderData:a});return i("div",{className:b(["order-order-product-list",l]),children:i($,{loading:m,taxConfig:d,order:e,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})})};export{et as OrderProductList,et as default}; diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index 4bd502bb1e..8700d1112c 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1 +1 @@ -import{jsx as i,jsxs as S,Fragment as _}from"@dropins/tools/preact-jsx-runtime.js";import{classes as $,VComponent as A,Slot as E}from"@dropins/tools/lib.js";import{Card as L,Header as w,Accordion as R,AccordionSection as G,ContentGrid as V,Image as q}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as x,useEffect as k}from"@dropins/tools/preact-hooks.js";import{events as D}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as nn}from"../chunks/useIsMobile.js";import{Text as B,useText as en}from"@dropins/tools/i18n.js";import{C as pn}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var M=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(M||{});const tn=({orderData:e})=>{const[r,n]=x(!0),[t,m]=x(e),[h,o]=x(!1);return k(()=>{const d=D.on("order/data",u=>{m(u),o(u==null?void 0:u.isVirtual),n(!1)},{eager:!0});return()=>{d==null||d.off()}},[]),{loading:r,order:t,isVirtualProduct:h}},Z=({value:e,variant:r="primary",size:n="medium",icon:t,className:m,children:h,disabled:o=!1,active:d=!1,activeChildren:u,activeIcon:p,href:C,...b})=>{let g="dropin-button";(t&&!h||t&&d&&!u||!t&&d&&p)&&(g="dropin-iconButton"),d&&u&&(g="dropin-button"),m=$([g,`${g}--${n}`,`${g}--${r}`,[`${g}--${r}--disabled`,o],h&&t&&`${g}--with-icon`,!h&&u&&t&&`${g}--with-icon`,d&&p&&`${g}--with-icon`,m]);const c=$(["dropin-button-icon",`dropin-button-icon--${r}`,[`dropin-button-icon--${r}--disabled`,o],t==null?void 0:t.props.className]),a=C?{node:i("a",{}),role:"link",href:C,...b,disabled:o,active:d,onKeyDown:y=>{o&&y.preventDefault()},tabIndex:o?-1:0}:{node:i("button",{}),role:"button",...b,value:e,disabled:o,active:d};return S(A,{...a,className:m,children:[t&&!d&&i(A,{node:t,className:c}),p&&d&&i(A,{node:p,className:c}),h&&!d&&(typeof h=="string"?i("span",{children:h}):h),d&&u&&(typeof u=="string"?i("span",{children:u}):u)]})},sn=({slots:e,collapseThreshold:r,translations:n,returnData:t,routeTracking:m,routeProductDetails:h})=>{var u;const o=nn(),d=h?"a":"span";return S(L,{variant:"secondary",className:$(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[i(w,{title:n.returnOrderCardTitle}),S("div",{children:[(u=t==null?void 0:t.tracking)==null?void 0:u.map((p,C)=>{var a,y;const b={title:"",number:(p==null?void 0:p.trackingNumber)??"",carrier:((a=p==null?void 0:p.carrier)==null?void 0:a.label)??""},g=m==null?void 0:m(b),c=g?()=>{window.open(g,"_blank","noreferrer")}:null;return S("div",{className:"order-shipping-status-card__header",children:[S("div",{children:[`${n.carrier} `,`${(y=b.carrier)==null?void 0:y.toLocaleUpperCase()} | `,b.number]}),c?i(Z,{onClick:c,children:n.trackButton}):null]},`${b.number}_${C}`)}),e!=null&&e.ReturnItemsDetails?i(E,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:t.items}}):null,i(R,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(G,{defaultOpen:r>=t.items.length,title:i(B,{id:"Order.ShippingStatusCard.itemText",plural:t.items.reduce((p,C)=>p+C.totalQuantity,0),fields:{count:t.items.reduce((p,C)=>p+C.totalQuantity,0)}}),children:i(V,{maxColumns:o?3:9,emptyGridContent:i(_,{}),className:$(["order-shipping-status-card__images",["order-shipping-status-card__images-3",o]]),children:t.items.map((p,C)=>{var c,a;const b=(c=p.thumbnail)==null?void 0:c.label,g=(a=p.thumbnail)==null?void 0:a.url;return i(d,{href:(h==null?void 0:h(p))??"#","data-testid":`${C}${p.uid}`,children:i(q,{alt:b,src:g,width:85,height:114})},`${C}${p.uid}`)})})})})]})]})},rn=({translations:e,slots:r,orderData:n,collapseThreshold:t=10,routeProductDetails:m,routeTracking:h})=>{var y,U,H,j,v,F,Q;const o=!!(n!=null&&n.returnNumber),d=n==null?void 0:n.returnNumber,u=m?"a":"span",p=(y=n==null?void 0:n.status)==null?void 0:y.toLocaleLowerCase(),b=((U=n==null?void 0:n.shipments)==null?void 0:U.length)===1&&(p==null?void 0:p.includes(M.COMPLETE)),g=(H=n==null?void 0:n.shipments)==null?void 0:H.every(s=>s.tracking.length===0),c=(j=n==null?void 0:n.items)==null?void 0:j.filter(s=>(s==null?void 0:s.quantityShipped)===0||(s==null?void 0:s.quantityShipped)<(s==null?void 0:s.quantityOrdered)),a=(v=n==null?void 0:n.items)==null?void 0:v.reduce((s,f)=>{const I=f.quantityOrdered-f.quantityShipped;return s+(I>0?I:0)},0);if(o&&(n!=null&&n.returns.length)){const s=n.returns.find(f=>f.returnNumber===d);return!s||s.tracking.length===0?null:i(sn,{slots:r,collapseThreshold:t,translations:e,returnData:s,routeTracking:h,routeProductDetails:m})}return!n||p!=null&&p.includes(M.CANCELED)?null:(F=n==null?void 0:n.shipments)!=null&&F.length?g&&!(c!=null&&c.length)&&b?null:S(_,{children:[(Q=n==null?void 0:n.shipments)==null?void 0:Q.map(({tracking:s,items:f,id:I},P)=>{const K=f.reduce((l,N)=>{var O;return l+(((O=N.orderItem)==null?void 0:O.quantityShipped)??0)},0);return S(L,{variant:"secondary",className:"order-shipping-status-card",children:[i(w,{title:e.shippingCardTitle}),s==null?void 0:s.map(l=>{var T;const N=h==null?void 0:h(l),O=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:[e.carrier," ",(T=l==null?void 0:l.carrier)==null?void 0:T.toLocaleUpperCase()," | ",l==null?void 0:l.number]}),i("p",{children:l==null?void 0:l.title})]}),r!=null&&r.DeliveryTrackActions?i(E,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:r==null?void 0:r.DeliveryTrackActions,context:{trackInformation:l}}):O?i(Z,{onClick:O,children:e.trackButton}):null]},l.number)}),b?null:i(R,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(G,{"data-position":P+1,defaultOpen:t>=(f==null?void 0:f.length),title:i(_,{children:i(B,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:K,fields:{count:K}})}),children:i(V,{maxColumns:6,emptyGridContent:i(_,{}),className:"order-shipping-status-card__images",children:f==null?void 0:f.map(l=>{var T,W,Y,z,J,X;const N=(Y=(W=(T=l==null?void 0:l.orderItem)==null?void 0:T.product)==null?void 0:W.thumbnail)==null?void 0:Y.label,O=(X=(J=(z=l==null?void 0:l.orderItem)==null?void 0:z.product)==null?void 0:J.thumbnail)==null?void 0:X.url;return i(u,{href:(m==null?void 0:m(l))??"#",children:i(q,{alt:N,src:O||"",width:85,height:114})},l.id)})})})}),r!=null&&r.DeliveryTimeLine?i(E,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:r==null?void 0:r.DeliveryTimeLine,context:{}}):null]},I)}),c!=null&&c.length?S(L,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[i(w,{title:e.notYetShippedTitle}),i(R,{actionIconPosition:"right",children:i(G,{defaultOpen:t>=(c==null?void 0:c.length),title:i(B,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:a,fields:{count:a}}),children:i(V,{maxColumns:6,emptyGridContent:i(_,{}),className:"order-shipping-status-card__images",children:c==null?void 0:c.map(s=>{var f,I;return i(u,{href:(m==null?void 0:m(s))??"#",children:i(q,{alt:(f=s.thumbnail)==null?void 0:f.label,src:((I=s.thumbnail)==null?void 0:I.url)||"",width:85,height:114})},s.id)})})})})]}):null]}):S(L,{variant:"secondary",className:"order-shipping-status-card",children:[i(w,{title:e.shippingInfoTitle}),i("div",{className:"order-shipping-status-card__header",children:S("div",{className:"order-shipping-status-card__header--content",children:[n!=null&&n.carrier?i("p",{children:n==null?void 0:n.carrier}):null,i("p",{children:e.noInfoTitle})]})})]})},bn=({slots:e,className:r,collapseThreshold:n,orderData:t,routeOrderDetails:m,routeTracking:h,routeProductDetails:o})=>{const{loading:d,order:u,isVirtualProduct:p}=tn({orderData:t}),C=en({carrier:"Order.ShippingStatusCard.carrier",prepositionOf:"Order.ShippingStatusCard.prepositionOf",returnOrderCardTitle:"Order.ShippingStatusCard.returnOrderCardTitle",shippingCardTitle:"Order.ShippingStatusCard.shippingCardTitle",shippingInfoTitle:"Order.ShippingStatusCard.shippingInfoTitle",notYetShippedTitle:"Order.ShippingStatusCard.notYetShippedTitle",noInfoTitle:"Order.ShippingStatusCard.noInfoTitle",returnNumber:"Order.ShippingStatusCard.returnNumber",orderNumber:"Order.ShippingStatusCard.orderNumber",trackButton:"Order.ShippingStatusCard.trackButton"});return!d&&p?null:i("div",{className:$(["order-shipping-status",r]),children:!d&&u?i(rn,{translations:C,routeOrderDetails:m,routeTracking:h,slots:e,orderData:u,collapseThreshold:n,routeProductDetails:o}):i(pn,{withCard:!1})})};export{bn as ShippingStatus,bn as default}; +import{jsx as i,jsxs as S,Fragment as _}from"@dropins/tools/preact-jsx-runtime.js";import{classes as $,VComponent as A,Slot as E}from"@dropins/tools/lib.js";import{Card as L,Header as w,Accordion as R,AccordionSection as V,ContentGrid as G,Image as q}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as x,useEffect as k}from"@dropins/tools/preact-hooks.js";import{events as D}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as nn}from"../chunks/useIsMobile.js";import{Text as B,useText as en}from"@dropins/tools/i18n.js";import{C as pn}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var M=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(M||{});const tn=({orderData:e})=>{const[s,n]=x(!0),[t,m]=x(e),[h,o]=x(!1);return k(()=>{const d=D.on("order/data",u=>{m(u),o(u==null?void 0:u.isVirtual),n(!1)},{eager:!0});return()=>{d==null||d.off()}},[]),{loading:s,order:t,isVirtualProduct:h}},Z=({value:e,variant:s="primary",size:n="medium",icon:t,className:m,children:h,disabled:o=!1,active:d=!1,activeChildren:u,activeIcon:p,href:C,...a})=>{let g="dropin-button";(t&&!h||t&&d&&!u||!t&&d&&p)&&(g="dropin-iconButton"),d&&u&&(g="dropin-button"),m=$([g,`${g}--${n}`,`${g}--${s}`,[`${g}--${s}--disabled`,o],h&&t&&`${g}--with-icon`,!h&&u&&t&&`${g}--with-icon`,d&&p&&`${g}--with-icon`,m]);const c=$(["dropin-button-icon",`dropin-button-icon--${s}`,[`dropin-button-icon--${s}--disabled`,o],t==null?void 0:t.props.className]),b=C?{node:i("a",{}),role:"link",href:C,...a,disabled:o,active:d,onKeyDown:I=>{o&&I.preventDefault()},tabIndex:o?-1:0}:{node:i("button",{}),role:"button",...a,value:e,disabled:o,active:d};return S(A,{...b,className:m,children:[t&&!d&&i(A,{node:t,className:c}),p&&d&&i(A,{node:p,className:c}),h&&!d&&(typeof h=="string"?i("span",{children:h}):h),d&&u&&(typeof u=="string"?i("span",{children:u}):u)]})},ln=({slots:e,collapseThreshold:s,translations:n,returnData:t,routeTracking:m,routeProductDetails:h})=>{var u;const o=nn(),d=h?"a":"span";return S(L,{variant:"secondary",className:$(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[i(w,{title:n.returnOrderCardTitle}),S("div",{children:[(u=t==null?void 0:t.tracking)==null?void 0:u.map((p,C)=>{var b,I;const a={title:"",number:(p==null?void 0:p.trackingNumber)??"",carrier:((b=p==null?void 0:p.carrier)==null?void 0:b.label)??""},g=m==null?void 0:m(a),c=g?()=>{window.open(g,"_blank","noreferrer")}:null;return S("div",{className:"order-shipping-status-card__header",children:[S("div",{children:[`${n.carrier} `,`${(I=a.carrier)==null?void 0:I.toLocaleUpperCase()} | `,a.number]}),c?i(Z,{onClick:c,children:n.trackButton}):null]},`${a.number}_${C}`)}),e!=null&&e.ReturnItemsDetails?i(E,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:t.items}}):null,i(R,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(V,{defaultOpen:s>=t.items.length,title:i(B,{id:"Order.ShippingStatusCard.itemText",plural:t.items.reduce((p,C)=>p+C.totalQuantity,0),fields:{count:t.items.reduce((p,C)=>p+C.totalQuantity,0)}}),children:i(G,{maxColumns:o?3:9,emptyGridContent:i(_,{}),className:$(["order-shipping-status-card__images",["order-shipping-status-card__images-3",o]]),children:t.items.map((p,C)=>{var c,b;const a=(c=p.thumbnail)==null?void 0:c.label,g=(b=p.thumbnail)==null?void 0:b.url;return i(d,{href:(h==null?void 0:h(p))??"#","data-testid":`${C}${p.uid}`,children:i(q,{alt:a,src:g,width:85,height:114})},`${C}${p.uid}`)})})})})]})]})},sn=({translations:e,slots:s,orderData:n,collapseThreshold:t=10,routeProductDetails:m,routeTracking:h})=>{var I,U,H,j,v,F,Q;const o=!!(n!=null&&n.returnNumber),d=n==null?void 0:n.returnNumber,u=m?"a":"span",p=(I=n==null?void 0:n.status)==null?void 0:I.toLocaleLowerCase(),a=((U=n==null?void 0:n.shipments)==null?void 0:U.length)===1&&(p==null?void 0:p.includes(M.COMPLETE)),g=(H=n==null?void 0:n.shipments)==null?void 0:H.every(l=>l.tracking.length===0),c=(j=n==null?void 0:n.items)==null?void 0:j.filter(l=>(l==null?void 0:l.quantityShipped)===0||(l==null?void 0:l.quantityShipped)<(l==null?void 0:l.quantityOrdered)),b=(v=n==null?void 0:n.items)==null?void 0:v.reduce((l,f)=>{const O=f.quantityOrdered-f.quantityShipped;return l+(O>0?O:0)},0);if(o&&(n!=null&&n.returns.length)){const l=n.returns.find(f=>f.returnNumber===d);return!l||l.tracking.length===0?null:i(ln,{slots:s,collapseThreshold:t,translations:e,returnData:l,routeTracking:h,routeProductDetails:m})}return!n||p!=null&&p.includes(M.CANCELED)?null:(F=n==null?void 0:n.shipments)!=null&&F.length?g&&!(c!=null&&c.length)&&a?null:S(_,{children:[(Q=n==null?void 0:n.shipments)==null?void 0:Q.map(({tracking:l,items:f,id:O},P)=>{const K=f.reduce((r,N)=>{var y;return(r??0)+(((y=N.orderItem)==null?void 0:y.quantityShipped)??0)},0);return S(L,{variant:"secondary",className:"order-shipping-status-card",children:[i(w,{title:e.shippingCardTitle}),l==null?void 0:l.map(r=>{var y;const N=h==null?void 0:h(r),T=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:[e.carrier," ",(y=r==null?void 0:r.carrier)==null?void 0:y.toLocaleUpperCase()," | ",r==null?void 0:r.number]}),i("p",{children:r==null?void 0:r.title})]}),s!=null&&s.DeliveryTrackActions?i(E,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:s==null?void 0:s.DeliveryTrackActions,context:{trackInformation:r}}):T?i(Z,{onClick:T,children:e.trackButton}):null]},r.number)}),a?null:i(R,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(V,{"data-position":P+1,defaultOpen:t>=(f==null?void 0:f.length),title:i(_,{children:i(B,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:K,fields:{count:K}})}),children:i(G,{maxColumns:6,emptyGridContent:i(_,{}),className:"order-shipping-status-card__images",children:f==null?void 0:f.map(r=>{var y,W,Y,z,J,X;const N=(Y=(W=(y=r==null?void 0:r.orderItem)==null?void 0:y.product)==null?void 0:W.thumbnail)==null?void 0:Y.label,T=(X=(J=(z=r==null?void 0:r.orderItem)==null?void 0:z.product)==null?void 0:J.thumbnail)==null?void 0:X.url;return i(u,{href:(m==null?void 0:m(r))??"#",children:i(q,{alt:N,src:T||"",width:85,height:114})},r.id)})})})}),s!=null&&s.DeliveryTimeLine?i(E,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:s==null?void 0:s.DeliveryTimeLine,context:{}}):null]},O)}),c!=null&&c.length?S(L,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[i(w,{title:e.notYetShippedTitle}),i(R,{actionIconPosition:"right",children:i(V,{defaultOpen:t>=(c==null?void 0:c.length),title:i(B,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:b,fields:{count:b}}),children:i(G,{maxColumns:6,emptyGridContent:i(_,{}),className:"order-shipping-status-card__images",children:c==null?void 0:c.map(l=>{var f,O;return i(u,{href:(m==null?void 0:m(l))??"#",children:i(q,{alt:(f=l.thumbnail)==null?void 0:f.label,src:((O=l.thumbnail)==null?void 0:O.url)||"",width:85,height:114})},l.id)})})})})]}):null]}):S(L,{variant:"secondary",className:"order-shipping-status-card",children:[i(w,{title:e.shippingInfoTitle}),i("div",{className:"order-shipping-status-card__header",children:S("div",{className:"order-shipping-status-card__header--content",children:[n!=null&&n.carrier?i("p",{children:n==null?void 0:n.carrier}):null,i("p",{children:e.noInfoTitle})]})})]})},an=({slots:e,className:s,collapseThreshold:n,orderData:t,routeOrderDetails:m,routeTracking:h,routeProductDetails:o})=>{const{loading:d,order:u,isVirtualProduct:p}=tn({orderData:t}),C=en({carrier:"Order.ShippingStatusCard.carrier",prepositionOf:"Order.ShippingStatusCard.prepositionOf",returnOrderCardTitle:"Order.ShippingStatusCard.returnOrderCardTitle",shippingCardTitle:"Order.ShippingStatusCard.shippingCardTitle",shippingInfoTitle:"Order.ShippingStatusCard.shippingInfoTitle",notYetShippedTitle:"Order.ShippingStatusCard.notYetShippedTitle",noInfoTitle:"Order.ShippingStatusCard.noInfoTitle",returnNumber:"Order.ShippingStatusCard.returnNumber",orderNumber:"Order.ShippingStatusCard.orderNumber",trackButton:"Order.ShippingStatusCard.trackButton"});return!d&&p?null:i("div",{className:$(["order-shipping-status",s]),children:!d&&u?i(sn,{translations:C,routeOrderDetails:m,routeTracking:h,slots:e,orderData:u,collapseThreshold:n,routeProductDetails:o}):i(pn,{withCard:!1})})};export{an as ShippingStatus,an as default}; diff --git a/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts b/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts index fea2010f22..bd92ba7964 100644 --- a/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts +++ b/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts @@ -2,6 +2,6 @@ import { AttributesListItems, ResponseAttributesFormItemsProps } from '../../typ import { AttributesFormModel } from '../models'; export declare const cloneArrayIfExists: (fields: ResponseAttributesFormItemsProps[]) => any; -export declare const transformAttributesForm: (items?: ResponseAttributesFormItemsProps[] | AttributesListItems[] | [ +export declare const transformAttributesForm: (response: ResponseAttributesFormItemsProps[] | AttributesListItems[] | [ ]) => AttributesFormModel[]; //# sourceMappingURL=transform-attributes-form.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 4b866a3c44..771ec1c623 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731440170068} \ No newline at end of file +{"at":1731440861695} \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/render.js b/scripts/__dropins__/storefront-order/render.js index c7bace7a0d..e0fff43820 100644 --- a/scripts/__dropins__/storefront-order/render.js +++ b/scripts/__dropins__/storefront-order/render.js @@ -1,3 +1,3 @@ (function(n,e){try{if(typeof document<"u"){const r=document.createElement("style"),a=e.styleId;for(const t in e.attributes)r.setAttribute(t,e.attributes[t]);r.setAttribute("data-dropin",a),r.appendChild(document.createTextNode(n));const o=document.querySelector('style[data-dropin="sdk"]');if(o)o.after(r);else{const t=document.querySelector('link[rel="stylesheet"], style');t?t.before(r):document.head.append(r)}}}catch(r){console.error("dropin-styles (injectCodeFunction)",r)}})(`.dropin-button,.dropin-iconButton{border:0 none;cursor:pointer;white-space:normal}.dropin-button{border-radius:var(--shape-border-radius-3);font-size:var(--type-button-1-font);font-weight:var(--type-button-1-font);padding:var(--spacing-xsmall) var(--spacing-medium);display:flex;justify-content:center;align-items:center;text-align:left;word-wrap:break-word}.dropin-iconButton{height:var(--spacing-xbig);width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button:disabled,.dropin-iconButton:disabled{pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button:not(:disabled),.dropin-iconButton:not(:disabled){cursor:pointer}.dropin-button:focus,.dropin-iconButton:focus{outline:none}.dropin-button:focus-visible,.dropin-iconButton:focus-visible{outline:var(--spacing-xxsmall) solid var(--color-button-focus)}.dropin-button--primary,a.dropin-button--primary,.dropin-iconButton--primary{border:none;background:var(--color-brand-500) 0 0% no-repeat padding-box;color:var(--color-neutral-50);text-align:left;margin-right:0}.dropin-iconButton--primary{border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button--primary--disabled,a.dropin-button--primary--disabled,.dropin-iconButton--primary--disabled{background:var(--color-neutral-300) 0 0% no-repeat padding-box;color:var(--color-neutral-500);fill:var(--color-neutral-300);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--primary:hover,a.dropin-button--primary:hover,.dropin-iconButton--primary:hover,.dropin-button--primary:focus:hover,.dropin-iconButton--primary:focus:hover{background-color:var(--color-button-hover);text-decoration:none}.dropin-button--primary:focus,.dropin-iconButton--primary:focus{background-color:var(--color-brand-500)}.dropin-button--primary:hover:active,.dropin-iconButton--primary:hover:active{background-color:var(--color-button-active)}.dropin-button--secondary,a.dropin-button--secondary,.dropin-iconButton--secondary{border:var(--shape-border-width-2) solid var(--color-brand-500);background:none 0 0% no-repeat padding-box;color:var(--color-brand-500);padding-top:calc(var(--spacing-xsmall) - var(--shape-border-width-2));padding-left:calc(var(--spacing-medium) - var(--shape-border-width-2))}.dropin-iconButton--secondary{border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall);padding-top:calc(var(--spacing-xsmall) - var(--shape-border-width-2));padding-left:calc(var(--spacing-xsmall) - var(--shape-border-width-2))}.dropin-button--secondary--disabled,a.dropin-button--secondary--disabled,.dropin-iconButton--secondary--disabled{border:var(--shape-border-width-2) solid var(--color-neutral-300);background:none 0 0% no-repeat padding-box;color:var(--color-neutral-500);fill:var(--color-neutral-300);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--secondary:hover,a.dropin-button--secondary:hover,.dropin-iconButton--secondary:hover{border:var(--shape-border-width-2) solid var(--color-button-hover);color:var(--color-button-hover);text-decoration:none}.dropin-button--secondary:active,.dropin-iconButton--secondary:active{border:var(--shape-border-width-2) solid var(--color-button-active);color:var(--color-button-active)}.dropin-button--tertiary,a.dropin-button--tertiary,.dropin-iconButton--tertiary{border:none;background:none 0 0% no-repeat padding-box;color:var(--color-brand-500)}.dropin-iconButton--tertiary{border:none;border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button--tertiary--disabled,a.dropin-button--tertiary--disabled,.dropin-iconButton--tertiary--disabled{border:none;color:var(--color-neutral-500);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--tertiary:hover,a.dropin-button--tertiary:hover,.dropin-iconButton--tertiary:hover{color:var(--color-button-hover);text-decoration:none}.dropin-button--tertiary:active,.dropin-iconButton--tertiary:active{color:var(--color-button-active)}.dropin-button--tertiary:focus-visible,.dropin-iconButton--tertiary:focus-visible{-webkit-box-shadow:inset 0 0 0 2px var(--color-neutral-800);-moz-box-shadow:inset 0 0 0 2px var(--color-neutral-800);box-shadow:inset 0 0 0 2px var(--color-neutral-800)}.dropin-button--large{font:var(--type-button-1-font);letter-spacing:var(--type-button-1-letter-spacing)}.dropin-button--medium{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.dropin-button-icon{height:24px}.dropin-button--with-icon{column-gap:var(--spacing-xsmall);row-gap:var(--spacing-xsmall)} -.order-order-search-form{gap:var(--spacing-small);border-color:transparent}.order-order-search-form .dropin-card__content{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}.order-order-search-form p{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.order-order-search-form__title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin:0}.order-order-search-form__wrapper{display:grid;grid-template-columns:1fr;grid-template-rows:auto;grid-template-areas:"email" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}.order-return-order-product-list .dropin-incrementer__button-container{margin:0}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}`,{styleId:"order"}); +.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" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}`,{styleId:"order"}); import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as n}from"@dropins/tools/lib.js";import{useState as s,useEffect as d}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as c}from"@dropins/tools/event-bus.js";const u={CreateReturn:{headerText:"Return items",downloadableCount:"Files",returnedItems:"Returned items:",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",postcode:"Zip Code",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},ShippingStatusCard:{orderNumber:"Order number:",returnNumber:"Return number:",itemText:{none:"",one:"Package contents ({{count}} item)",many:"Package contents ({{count}} items)"},trackButton:"Track package",carrier:"Carrier:",prepositionOf:"of",returnOrderCardTitle:"Package details",shippingCardTitle:"Package details",shippingInfoTitle:"Shipping information",notYetShippedTitle:"Not yet shipped",notYetShippedImagesTitle:{singular:"Package contents ({{count}} item)",plural:"Package contents ({{count}} items)"}},OrderStatusContent:{noInfoTitle:"Check back later for more details.",returnMessage:"The order was placed on {ORDER_CREATE_DATE} and your return process started on {RETURN_CREATE_DATE}",returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."}},p={Order:u},m={default:p},h=({children:t})=>{const[o,i]=s("en_US");return d(()=>{const e=c.on("locale",a=>{i(a)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},T=new n(r(h,{}));export{T as render}; diff --git a/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts b/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts index e7df546ad6..b3b80df6bf 100644 --- a/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts @@ -246,14 +246,6 @@ export interface ErrorProps { message?: string; }[]; } -type GetOrderDetailsByParams = { - orderId?: string; - returnRef?: string; - queryType: T; - returnsPageSize: number; -}; -export interface GetOrderDetailsByIdProps extends GetOrderDetailsByParams { -} export interface OrdersResponse extends ErrorProps { data?: { customer?: { From 8cdeb3326f502865eb78292dd304e67abbd3aca4 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 12 Nov 2024 21:52:56 +0200 Subject: [PATCH 24/30] test bug? 8 --- .../__dropins__/storefront-order/chunks/ReturnsListContent.js | 2 +- scripts/__dropins__/storefront-order/containers/CreateReturn.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js index 61691fd202..d1fe6978de 100644 --- a/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js +++ b/scripts/__dropins__/storefront-order/chunks/ReturnsListContent.js @@ -1 +1 @@ -import{jsx as r,jsxs as s,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as O}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as V,Card as P,ContentGrid as D,Image as r1,Header as Q,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as t1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as n1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as U}from"./OrderLoaders.js";import{Text as k}from"@dropins/tools/i18n.js";const q=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"})))),a1=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"})),J=({typeList:L,isEmpty:p,minifiedView:_,message:t})=>{const a=t1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:t}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,t]);return!p||!L||!a.text?null:r(R,{className:W(["order-empty-list",a.className,_?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:p=!1,withOrderNumber:_=!1,slots:t,pageInfo:a,withReturnsListButton:$=!0,isMobile:y=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:N=!0,withThumbnails:A=!0,selectedPage:B=1,handleSetSelectPage:S,routeReturnDetails:d,routeOrderDetails:g,routeTracking:f,routeReturnsList:v,routeProductDetails:m,loading:b})=>{const z=h?X:i.length,j=m!=null&&m()?"a":"span",x=w(()=>i.slice(0,z).map((e,I)=>{var F,G;const E=((e==null?void 0:e.items)??[]).reduce((n,o)=>(o.totalQuantity??0)+n,0);return r(P,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(k,{id:`Order.Returns.${L}.returnsList.resturnStatus.${n1(e.returnStatus)}`})}),p?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(g==null?void 0:g({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((n,o)=>{var M,Z;const C={title:"",number:(n==null?void 0:n.trackingNumber)??"",carrier:((M=n==null?void 0:n.carrier)==null?void 0:M.label)??""},H=f==null?void 0:f(C);return s("p",{children:[`${c.carrier} `,`${(Z=C.carrier)==null?void 0:Z.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer",children:n.trackingNumber}):r("span",{children:n.trackingNumber})]},`${C.number}_${o}`)}),t!=null&&t.ReturnItemsDetails?r(O,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:t==null?void 0:t.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[E," ",r(k,{id:`Order.Returns.${L}.returnsList.itemText`,plural:E,fields:{count:E}})]}):null]}),A?r(D,{maxColumns:y?3:9,emptyGridContent:r(u,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",y]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((n,o)=>{var M,Z;const C=(M=n.thumbnail)==null?void 0:M.label,H=(Z=n.thumbnail)==null?void 0:Z.url;return r(j,{href:(m==null?void 0:m(n))??"#",children:r(r1,{alt:C,src:H,width:85,height:114})},o+n.uid)})}):null,t!=null&&t.DetailsActionParams?r(O,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:t==null?void 0:t.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:q,...T})})]})},I)}),[i,z,L,p,c,d,_,g,t,A,y,m,f,j]),Y=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,b?r(U,{withCard:!1}):s(u,{children:[x,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(v==null?void 0:v())??"#",children:r(P,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(V,{source:q,...T})]})})}):null]})]}),[v,$,N,c,x,h,i.length,b]),K=w(()=>s(u,{children:[N?r(Q,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,b?r(U,{withCard:!1}):s(u,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),x,(a==null?void 0:a.totalPages)>1?r(e1,{totalPages:a==null?void 0:a.totalPages,currentPage:B,onChange:S}):null]})]}),[x,h,i,c,a==null?void 0:a.totalPages,B,S,b,N]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{u1 as R}; +import{jsx as r,jsxs as s,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{useMemo as w}from"@dropins/tools/preact-hooks.js";import{classes as W,Slot as q}from"@dropins/tools/lib.js";import{IllustratedMessage as R,Icon as V,Card as O,ContentGrid as D,Image as r1,Header as P,Pagination as e1}from"@dropins/tools/components.js";import*as l from"@dropins/tools/preact-compat.js";import{useMemo as n1}from"@dropins/tools/preact-compat.js";import"./OrderCancel.js";import{f as t1}from"./returnOrdersHelper.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{C as Q}from"./OrderLoaders.js";import{Text as U}from"@dropins/tools/i18n.js";const k=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"})))),a1=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"})),J=({typeList:L,isEmpty:p,minifiedView:_,message:n})=>{const a=n1(()=>{switch(L){case"orders":return{icon:a1,text:r("p",{children:n}),className:"order-empty-list--empty-box"};default:return{icon:"",text:"",className:""}}},[L,n]);return!p||!L||!a.text?null:r(R,{className:W(["order-empty-list",a.className,_?"order-empty-list--minified":""]),message:a.text,icon:r(V,{source:a.icon}),"data-testid":"emptyList"})},T={size:"32",stroke:"2"},u1=({minifiedViewKey:L,withReturnNumber:p=!1,withOrderNumber:_=!1,slots:n,pageInfo:a,withReturnsListButton:$=!0,isMobile:y=!1,returnsInMinifiedView:X=1,translations:c={},orderReturns:i=[],minifiedView:h=!1,withHeader:N=!0,withThumbnails:A=!0,selectedPage:B=1,handleSetSelectPage:S,routeReturnDetails:d,routeOrderDetails:g,routeTracking:f,routeReturnsList:v,routeProductDetails:m,loading:b})=>{const z=h?X:i.length,j=m!=null&&m()?"a":"span",x=w(()=>i.slice(0,z).map((e,I)=>{var F,G;const E=((e==null?void 0:e.items)??[]).reduce((t,o)=>(o.requestQuantity??0)+t,0);return r(O,{variant:"secondary",className:"order-returns-list-content__cards-list",children:s("div",{className:"order-returns-list-content__cards-grid",children:[s("div",{className:"order-returns-list-content__descriptions",children:[r("p",{className:"order-returns-list-content__return-status",children:r(U,{id:`Order.Returns.${L}.returnsList.resturnStatus.${t1(e.returnStatus)}`})}),p?s("p",{children:[c.returnNumber," ",r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.returnNumber})]}):null,_?s("p",{children:[c.orderNumber," ",r("a",{href:(g==null?void 0:g({orderNumber:e.orderNumber,token:e.token}))??"#",rel:"noreferrer",children:e.orderNumber})]}):null,(F=e==null?void 0:e.tracking)==null?void 0:F.map((t,o)=>{var M,Z;const C={title:"",number:(t==null?void 0:t.trackingNumber)??"",carrier:((M=t==null?void 0:t.carrier)==null?void 0:M.label)??""},H=f==null?void 0:f(C);return s("p",{children:[`${c.carrier} `,`${(Z=C.carrier)==null?void 0:Z.toLocaleUpperCase()} | `,H?r("a",{href:H,target:"_blank",rel:"noreferrer",children:t.trackingNumber}):r("span",{children:t.trackingNumber})]},`${C.number}_${o}`)}),n!=null&&n.ReturnItemsDetails?r(q,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:n==null?void 0:n.ReturnItemsDetails,context:{items:e.items}}):e.items.length?s("p",{children:[E," ",r(U,{id:`Order.Returns.${L}.returnsList.itemText`,plural:E,fields:{count:E}})]}):null]}),A?r(D,{maxColumns:y?3:9,emptyGridContent:r(u,{}),className:W(["order-returns-list-content__images",["order-returns-list-content__images-3",y]]),children:(G=e==null?void 0:e.items)==null?void 0:G.map((t,o)=>{var M,Z;const C=(M=t.thumbnail)==null?void 0:M.label,H=(Z=t.thumbnail)==null?void 0:Z.url;return r(j,{href:(m==null?void 0:m(t))??"#",children:r(r1,{alt:C,src:H,width:85,height:114})},o+t.uid)})}):null,n!=null&&n.DetailsActionParams?r(q,{className:"order-returns-list-content__actions","data-testid":"detailsActionParams",name:"DetailsActionParams",slot:n==null?void 0:n.DetailsActionParams,context:{returnOrderItem:e}}):r("a",{href:(d==null?void 0:d({returnNumber:e.returnNumber,token:e.token,orderNumber:e.orderNumber}))??"#",className:"order-returns-list-content__actions",children:r(V,{source:k,...T})})]})},I)}),[i,z,L,p,c,d,_,g,n,A,y,m,f,j]),Y=w(()=>s(u,{children:[N?r(P,{title:c.minifiedViewTitle,divider:!1,className:"order-returns__header--minified"}):null,b?r(Q,{withCard:!1}):s(u,{children:[x,r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),$?r("a",{className:"order-returns-list-content__actions",href:(v==null?void 0:v())??"#",children:r(O,{variant:"secondary",className:"order-returns-list-content__card",children:s("div",{className:"order-returns-list-content__card-wrapper",children:[r("p",{children:c.viewAllOrdersButton}),r(V,{source:k,...T})]})})}):null]})]}),[v,$,N,c,x,h,i.length,b]),K=w(()=>s(u,{children:[N?r(P,{title:c.minifiedViewTitle,divider:!0,className:"order-returns__header--full-size"}):null,b?r(Q,{withCard:!1}):s(u,{children:[r(J,{minifiedView:h,typeList:"orders",isEmpty:!i.length,message:c.emptyOrdersListMessage}),x,(a==null?void 0:a.totalPages)>1?r(e1,{totalPages:a==null?void 0:a.totalPages,currentPage:B,onChange:S}):null]})]}),[x,h,i,c,a==null?void 0:a.totalPages,B,S,b,N]);return r("div",{className:"order-returns-list-content",children:h?Y:K})};export{u1 as R}; diff --git a/scripts/__dropins__/storefront-order/containers/CreateReturn.js b/scripts/__dropins__/storefront-order/containers/CreateReturn.js index c32ec9c37e..27581466bb 100644 --- a/scripts/__dropins__/storefront-order/containers/CreateReturn.js +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn.js @@ -1 +1 @@ -import{jsx as r,jsxs as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as q,Slot as P}from"@dropins/tools/lib.js";import{Checkbox as H,Button as Q,CartItem as V,Image as W,Header as Z,InLineAlert as D}from"@dropins/tools/components.js";import{u as z,a as U}from"../chunks/OrderCancel.js";import{useState as _,useRef as K,useEffect as T,useCallback as F}from"@dropins/tools/preact-hooks.js";import{events as G}from"@dropins/tools/event-bus.js";import{g as J}from"../chunks/getFormValues.js";import{s as X}from"../chunks/setTaxStatus.js";import{createRef as Y,Fragment as I}from"@dropins/tools/preact.js";import{o as ee,c as te,n as ne,r as re,m as ae}from"../chunks/returnOrdersHelper.js";import{g as se,r as ie}from"../chunks/requestReturn.js";import{g as ce}from"../chunks/getStoreConfig.js";import*as R from"@dropins/tools/preact-compat.js";import{S as ue,C as oe}from"../chunks/CartSummaryItem.js";import{O as le}from"../chunks/OrderLoaders.js";import{useText as de}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const pe=a=>R.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},R.createElement("g",{clipPath:"url(#clip0_841_1324)"},R.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),R.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),R.createElement("defs",null,R.createElement("clipPath",{id:"clip0_841_1324"},R.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),he=a=>R.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},R.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),R.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),me=({onSuccess:a,onError:s,handleSetInLineAlert:c,orderData:d})=>{const[u,p]=_(d),[S,b]=_("products"),[L,k]=_(!0),[i,f]=_([]),[C,w]=_([]),[t,h]=_({taxIncluded:!1,taxExcluded:!1}),[e,m]=_([]),y=K([]);y.current.length!==i.length&&(y.current=i.map((n,o)=>y.current[o]||Y())),T(()=>{const n=G.on("order/data",o=>{p(o),m(ee(o)),k(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ce().then(n=>{if(n){const o=X(n==null?void 0:n.shoppingCartDisplayPrice);h(o)}})},[]),T(()=>{se("RMA_ITEM").then(n=>{n.length&&(w(n),k(!1))})},[]);const N=F(n=>{f(o=>o.findIndex(l=>(l==null?void 0:l.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(l=>(l==null?void 0:l.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),O=F(n=>{b(n),c(),n==="products"&&f([])},[c]),A=F((n,o)=>{const v=i.map(l=>l.productSku===o?{...l,currentReturnOrderQuantity:n}:l);f(v)},[i]),E=F(async(n,o)=>{if(!o)return null;k(!0);const v={orderUid:(u==null?void 0:u.id)??"",contactEmail:(u==null?void 0:u.email)??""},l=[];y.current.length&&y.current.forEach(({current:g})=>{var M;const $=g==null?void 0:g.name.replace(/_\d+$/,""),j=((M=g==null?void 0:g.dataset)==null?void 0:M.quantity)??1,B=te(J(g));l.push({orderItemUid:$,quantityToReturn:+j,...ne(B)})}),ie({...v,items:l}).then(g=>{g&&(a==null||a(g),O("success"),c())}).catch(g=>{s==null||s(g.message),c({type:"error",heading:g.message})}),k(!1)},[O,s,a,c,u]);return{order:u,steps:S,loading:L,formsRef:y,taxConfig:t,attributesList:C,selectedProductList:i,itemsEligibleForReturn:e,handleSelectedProductList:N,handleSetQuantity:A,handleChangeStep:O,onSubmit:E}},ge={success:r(he,{}),warning:r(pe,{}),error:r(ue,{})},fe=()=>{const[a,s]=_({type:"success",heading:""}),c=F(d=>{if(!(d!=null&&d.type)){s({type:"success",heading:""});return}const u=ge[d.type];s({...d,icon:u})},[]);return{inLineAlertProps:a,handleSetInLineAlert:c}},be=({itemsEligibleForReturn:a,slots:s,loading:c=!1,taxConfig:d,translations:u={},selectedProductList:p,handleSelectedProductList:S,showConfigurableOptions:b,handleSetQuantity:L,handleChangeStep:k})=>x("ul",{className:"order-return-order-product-list",children:[a==null?void 0:a.map((i,f)=>{const C=Math.random().toString(36),w=p.some(h=>(h==null?void 0:h.productSku)===i.productSku&&i.eligibleForReturn&&i.quantityReturned===0),t=i.returnableQuantity===0?1:i.returnableQuantity;return x("li",{className:q(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",!i.eligibleForReturn]]),children:[r(H,{"data-testid":`${C}_${f+1}`,name:C+f,checked:w,disabled:!i.eligibleForReturn||i.quantityReturned!==0,onChange:()=>{S({...i,currentReturnOrderQuantity:1})}}),r(oe,{loading:c,product:{...i,totalQuantity:t},itemType:"",taxConfig:d,translations:u,showConfigurableOptions:b,disabledIncrementer:!w,isReturnProductList:!0,onQuantity:(i==null?void 0:i.returnableQuantity)>1?h=>L(h,i.productSku):void 0}),s!=null&&s.ReturnOrderItem?r(P,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:s==null?void 0:s.ReturnOrderItem,context:{}}):null]},C+f)}),r("li",{className:"order-return-order-product-list__item",children:r(Q,{type:"button",onClick:()=>k("attributes"),disabled:!p.length,children:u.nextStep})})]}),ke=({routeReturnSuccess:a,translations:s,orderData:c})=>{const d=()=>{window.location.href=(a==null?void 0:a(c))??"#"};return 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(Q,{onClick:d,type:"button",children:s.backStore})]})},ye=({slots:a,formsRef:s,selectedProductList:c,loading:d,fieldsConfig:u,translations:p,handleChangeStep:S,onSubmit:b})=>{const{formData:L,errors:k,formRef:i,handleChange:f,handleBlur:C,handleSubmit:w}=z({fieldsConfig:re(u,c==null?void 0:c.length),onSubmit:b});return x("form",{className:"order-return-reason-form",ref:i,onSubmit:w,name:"returnReasonForm",children:[c.map((t,h)=>{var E,n,o,v,l;const e=(t==null?void 0:t.giftCard)||{},m=t==null?void 0:t.product,y=ae(u,h),N=`${t==null?void 0:t.id}_${h}`,O=(t==null?void 0:t.currentReturnOrderQuantity)??1,A={...t!=null&&t.currentReturnOrderQuantity?{Quantity:O}:{},..."configurableOptions"in t?t.configurableOptions:{},..."bundleOptions"in t?t.bundleOptions:{},..."senderName"in e&&(e!=null&&e.senderName)?{[p.sender]:e==null?void 0:e.senderName}:{},..."senderEmail"in e&&(e!=null&&e.senderEmail)?{[p.sender]:e==null?void 0:e.senderEmail}:{},..."recipientName"in e&&(e!=null&&e.recipientName)?{[p.recipient]:e==null?void 0:e.recipientName}:{},..."recipientEmail"in e&&(e!=null&&e.recipientEmail)?{[p.recipient]:e==null?void 0:e.recipientEmail}:{},..."message"in e&&(e!=null&&e.message)?{[p.message]:e==null?void 0:e.message}:{},..."downloadableLinks"in t&&(t!=null&&t.downloadableLinks)?{[`${(E=t==null?void 0:t.downloadableLinks)==null?void 0:E.count} ${p.downloadableCount}`]:(n=t==null?void 0:t.downloadableLinks)==null?void 0:n.result}:{}};return x(I,{children:[r(V,{loading:d,title:r("div",{"data-testid":"product-name",children:(o=t==null?void 0:t.product)==null?void 0:o.name}),sku:r("div",{children:m==null?void 0:m.sku}),image:r(W,{src:((v=m==null?void 0:m.thumbnail)==null?void 0:v.url)??"",alt:((l=m==null?void 0:m.thumbnail)==null?void 0:l.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:A}),r("form",{name:N,ref:s==null?void 0:s.current[h],"data-quantity":O,children:r(U,{className:"className",loading:d,fields:y,onChange:f,onBlur:C,errors:k,values:L})})]},h)}),a!=null&&a.ReturnFormActions?r(P,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:a==null?void 0:a.ReturnFormActions,context:{handleChangeStep:S}}):x("div",{className:"order-return-reason-form__actions",children:[r(Q,{variant:"secondary",type:"button",onClick:()=>{S("products")},children:p.backStep}),r(Q,{children:p.submit})]})]})},He=({className:a,orderData:s,slots:c,onSuccess:d,onError:u,routeReturnSuccess:p,showConfigurableOptions:S})=>{const b=de({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"}),{inLineAlertProps:L,handleSetInLineAlert:k}=fe(),{order:i,itemsEligibleForReturn:f,formsRef:C,taxConfig:w,attributesList:t,steps:h,loading:e,selectedProductList:m,handleSelectedProductList:y,handleSetQuantity:N,handleChangeStep:O,onSubmit:A}=me({orderData:s,onSuccess:d,onError:u,handleSetInLineAlert:k});if(e)return r("div",{children:r(le,{})});if(!e&&!t.length)return r("div",{});const E={products:r(be,{itemsEligibleForReturn:f,slots:c,translations:b,loading:e,taxConfig:w,selectedProductList:m,handleSelectedProductList:y,showConfigurableOptions:S,handleSetQuantity:N,handleChangeStep:O}),attributes:r(ye,{slots:c,formsRef:C,loading:e,fieldsConfig:t,selectedProductList:m,handleChangeStep:O,translations:b,onSubmit:A}),success:r(ke,{translations:b,routeReturnSuccess:p,orderData:i}),error:null};return x("div",{className:q(["order-create-return",a]),children:[r(Z,{title:b.headerText}),L.heading?r(D,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...L}):null,E[h]]})};export{He as CreateReturn,He as default}; +import{jsx as r,jsxs as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as q,Slot as P}from"@dropins/tools/lib.js";import{Checkbox as H,Button as Q,CartItem as V,Image as W,Header as Z,InLineAlert as D}from"@dropins/tools/components.js";import{u as z,a as U}from"../chunks/OrderCancel.js";import{useState as _,useRef as K,useEffect as T,useCallback as F}from"@dropins/tools/preact-hooks.js";import{events as G}from"@dropins/tools/event-bus.js";import{g as J}from"../chunks/getFormValues.js";import{s as X}from"../chunks/setTaxStatus.js";import{createRef as Y,Fragment as I}from"@dropins/tools/preact.js";import{o as ee,c as te,n as ne,r as re,m as ae}from"../chunks/returnOrdersHelper.js";import{g as se,r as ie}from"../chunks/requestReturn.js";import{g as ce}from"../chunks/getStoreConfig.js";import*as y from"@dropins/tools/preact-compat.js";import{S as ue,C as oe}from"../chunks/CartSummaryItem.js";import{O as le}from"../chunks/OrderLoaders.js";import{useText as de}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const pe=a=>y.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},y.createElement("g",{clipPath:"url(#clip0_841_1324)"},y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),y.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"})),y.createElement("defs",null,y.createElement("clipPath",{id:"clip0_841_1324"},y.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),he=a=>y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},y.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"}),y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),me=({onSuccess:a,onError:s,handleSetInLineAlert:c,orderData:d})=>{const[u,p]=_(d),[C,f]=_("products"),[O,b]=_(!0),[i,g]=_([]),[S,w]=_([]),[e,L]=_({taxIncluded:!1,taxExcluded:!1}),[t,h]=_([]),k=K([]);k.current.length!==i.length&&(k.current=i.map((n,o)=>k.current[o]||Y())),T(()=>{const n=G.on("order/data",o=>{p(o),h(ee(o)),b(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ce().then(n=>{if(n){const o=X(n==null?void 0:n.shoppingCartDisplayPrice);L(o)}})},[]),T(()=>{se("RMA_ITEM").then(n=>{n.length&&(w(n),b(!1))})},[]);const N=F(n=>{g(o=>o.findIndex(l=>(l==null?void 0:l.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(l=>(l==null?void 0:l.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),R=F(n=>{f(n),c(),n==="products"&&g([])},[c]),A=F((n,o)=>{const v=i.map(l=>l.productSku===o?{...l,currentReturnOrderQuantity:n}:l);g(v)},[i]),E=F(async(n,o)=>{if(!o)return null;b(!0);const v={orderUid:(u==null?void 0:u.id)??"",contactEmail:(u==null?void 0:u.email)??""},l=[];k.current.length&&k.current.forEach(({current:m})=>{var M;const $=m==null?void 0:m.name.replace(/_\d+$/,""),j=((M=m==null?void 0:m.dataset)==null?void 0:M.quantity)??1,B=te(J(m));l.push({orderItemUid:$,quantityToReturn:+j,...ne(B)})}),ie({...v,items:l}).then(m=>{m&&(a==null||a(m),R("success"),c())}).catch(m=>{s==null||s(m.message),c({type:"error",heading:m.message})}),b(!1)},[R,s,a,c,u]);return{order:u,steps:C,loading:O,formsRef:k,taxConfig:e,attributesList:S,selectedProductList:i,itemsEligibleForReturn:t,handleSelectedProductList:N,handleSetQuantity:A,handleChangeStep:R,onSubmit:E}},ge={success:r(he,{}),warning:r(pe,{}),error:r(ue,{})},fe=()=>{const[a,s]=_({type:"success",heading:""}),c=F(d=>{if(!(d!=null&&d.type)){s({type:"success",heading:""});return}const u=ge[d.type];s({...d,icon:u})},[]);return{inLineAlertProps:a,handleSetInLineAlert:c}},be=({itemsEligibleForReturn:a,slots:s,loading:c=!1,taxConfig:d,translations:u={},selectedProductList:p,handleSelectedProductList:C,showConfigurableOptions:f,handleSetQuantity:O,handleChangeStep:b})=>x("ul",{className:"order-return-order-product-list",children:[a==null?void 0:a.map((i,g)=>{const S=p.some(e=>(e==null?void 0:e.productSku)===i.productSku&&i.eligibleForReturn&&i.quantityReturned===0),w=i.returnableQuantity===0?1:i.returnableQuantity;return x("li",{className:q(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",!i.eligibleForReturn]]),children:[r(H,{"data-testid":`key_${g}`,name:`key_${g}`,checked:S,disabled:!i.eligibleForReturn||i.quantityReturned!==0,onChange:()=>{C({...i,currentReturnOrderQuantity:1})}}),r(oe,{loading:c,product:{...i,totalQuantity:w},itemType:"",taxConfig:d,translations:u,showConfigurableOptions:f,disabledIncrementer:!S,isReturnProductList:!0,onQuantity:(i==null?void 0:i.returnableQuantity)>1?e=>O(e,i.productSku):void 0}),s!=null&&s.ReturnOrderItem?r(P,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:s==null?void 0:s.ReturnOrderItem,context:{}}):null]},g)}),r("li",{className:"order-return-order-product-list__item",children:r(Q,{type:"button",onClick:()=>b("attributes"),disabled:!p.length,children:u.nextStep})})]}),ke=({routeReturnSuccess:a,translations:s,orderData:c})=>{const d=()=>{window.location.href=(a==null?void 0:a(c))??"#"};return 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(Q,{onClick:d,type:"button",children:s.backStore})]})},ye=({slots:a,formsRef:s,selectedProductList:c,loading:d,fieldsConfig:u,translations:p,handleChangeStep:C,onSubmit:f})=>{const{formData:O,errors:b,formRef:i,handleChange:g,handleBlur:S,handleSubmit:w}=z({fieldsConfig:re(u,c==null?void 0:c.length),onSubmit:f});return x("form",{className:"order-return-reason-form",ref:i,onSubmit:w,name:"returnReasonForm",children:[c.map((e,L)=>{var E,n,o,v,l;const t=(e==null?void 0:e.giftCard)||{},h=e==null?void 0:e.product,k=ae(u,L),N=`${e==null?void 0:e.id}_${L}`,R=(e==null?void 0:e.currentReturnOrderQuantity)??1,A={...e!=null&&e.currentReturnOrderQuantity?{Quantity:R}:{},..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in t&&(t!=null&&t.senderName)?{[p.sender]:t==null?void 0:t.senderName}:{},..."senderEmail"in t&&(t!=null&&t.senderEmail)?{[p.sender]:t==null?void 0:t.senderEmail}:{},..."recipientName"in t&&(t!=null&&t.recipientName)?{[p.recipient]:t==null?void 0:t.recipientName}:{},..."recipientEmail"in t&&(t!=null&&t.recipientEmail)?{[p.recipient]:t==null?void 0:t.recipientEmail}:{},..."message"in t&&(t!=null&&t.message)?{[p.message]:t==null?void 0:t.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(E=e==null?void 0:e.downloadableLinks)==null?void 0:E.count} ${p.downloadableCount}`]:(n=e==null?void 0:e.downloadableLinks)==null?void 0:n.result}:{}};return x(I,{children:[r(V,{loading:d,title:r("div",{"data-testid":"product-name",children:(o=e==null?void 0:e.product)==null?void 0:o.name}),sku:r("div",{children:h==null?void 0:h.sku}),image:r(W,{src:((v=h==null?void 0:h.thumbnail)==null?void 0:v.url)??"",alt:((l=h==null?void 0:h.thumbnail)==null?void 0:l.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:A}),r("form",{name:N,ref:s==null?void 0:s.current[L],"data-quantity":R,children:r(U,{className:"className",loading:d,fields:k,onChange:g,onBlur:S,errors:b,values:O})})]},L)}),a!=null&&a.ReturnFormActions?r(P,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:a==null?void 0:a.ReturnFormActions,context:{handleChangeStep:C}}):x("div",{className:"order-return-reason-form__actions",children:[r(Q,{variant:"secondary",type:"button",onClick:()=>{C("products")},children:p.backStep}),r(Q,{children:p.submit})]})]})},He=({className:a,orderData:s,slots:c,onSuccess:d,onError:u,routeReturnSuccess:p,showConfigurableOptions:C})=>{const f=de({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"}),{inLineAlertProps:O,handleSetInLineAlert:b}=fe(),{order:i,itemsEligibleForReturn:g,formsRef:S,taxConfig:w,attributesList:e,steps:L,loading:t,selectedProductList:h,handleSelectedProductList:k,handleSetQuantity:N,handleChangeStep:R,onSubmit:A}=me({orderData:s,onSuccess:d,onError:u,handleSetInLineAlert:b});if(t)return r("div",{children:r(le,{})});if(!t&&!e.length)return r("div",{});const E={products:r(be,{itemsEligibleForReturn:g,slots:c,translations:f,loading:t,taxConfig:w,selectedProductList:h,handleSelectedProductList:k,showConfigurableOptions:C,handleSetQuantity:N,handleChangeStep:R}),attributes:r(ye,{slots:c,formsRef:S,loading:t,fieldsConfig:e,selectedProductList:h,handleChangeStep:R,translations:f,onSubmit:A}),success:r(ke,{translations:f,routeReturnSuccess:p,orderData:i}),error:null};return x("div",{className:q(["order-create-return",a]),children:[r(Z,{title:f.headerText}),O.heading?r(D,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...O}):null,E[L]]})};export{He as CreateReturn,He as default}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 771ec1c623..51b2ca093a 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731440861695} \ No newline at end of file +{"at":1731441153786} \ No newline at end of file From cc98b47be0adeb752f309df23fc4db8410becf99 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 12 Nov 2024 22:02:09 +0200 Subject: [PATCH 25/30] test bug? 9 --- scripts/__dropins__/storefront-order/api.js | 14 +++++++------- .../getOrderDetailsById.d.ts | 3 ++- .../api/requestReturn/graphql/fragments.d.ts | 2 ++ .../graphql/requestReturn.graphql.d.ts | 2 +- .../chunks/CartSummaryItem.js | 2 +- .../chunks/getAttributesForm.js | 2 +- .../chunks/getGuestOrder.graphql.js | 1 + .../storefront-order/chunks/requestReturn.js | 19 ++++++++++++------- .../chunks/returnOrdersHelper.js | 2 +- .../chunks/transform-attributes-form.js | 2 +- .../containers/CreateReturn.js | 2 +- .../containers/OrderProductList.js | 2 +- .../containers/ShippingStatus.js | 2 +- .../transforms/transform-attributes-form.d.ts | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- .../__dropins__/storefront-order/render.js | 2 +- .../types/api/getOrderDetails.types.d.ts | 8 ++++++++ 17 files changed, 43 insertions(+), 26 deletions(-) create mode 100644 scripts/__dropins__/storefront-order/api/requestReturn/graphql/fragments.d.ts diff --git a/scripts/__dropins__/storefront-order/api.js b/scripts/__dropins__/storefront-order/api.js index a86d37ce46..45f78abffa 100644 --- a/scripts/__dropins__/storefront-order/api.js +++ b/scripts/__dropins__/storefront-order/api.js @@ -1,5 +1,5 @@ -import{Initializer as I}from"@dropins/tools/lib.js";import{events as d}from"@dropins/tools/event-bus.js";import{f as n,h as m}from"./chunks/fetch-graphql.js";import{g as U,r as q,s as z,a as Y,b as Q}from"./chunks/fetch-graphql.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as _,G as p,O as c,B as O,R as D,c as b}from"./chunks/transform-order-details.js";import{O as h,A as R}from"./chunks/getGuestOrder.graphql.js";import{t as f}from"./chunks/getCustomer.js";import{g as K,a as j}from"./chunks/getCustomer.js";import{g as V}from"./chunks/getAttributesForm.js";import{g as X}from"./chunks/getStoreConfig.js";import{g as ee}from"./chunks/getCustomerOrdersReturn.js";import{g as te,r as ae}from"./chunks/requestReturn.js";import{c as de,r as oe}from"./chunks/requestGuestOrderCancel.js";import{r as ne}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";import"./chunks/transform-attributes-form.js";const G=` -query ORDER_BY_NUMBER($orderNumber: String!) { +import{Initializer as I}from"@dropins/tools/lib.js";import{events as o}from"@dropins/tools/event-bus.js";import{f as n,h as m}from"./chunks/fetch-graphql.js";import{g as U,r as Y,s as q,a as Q,b as H}from"./chunks/fetch-graphql.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as _,G as p,O as c,B as O,R as D,c as b}from"./chunks/transform-order-details.js";import{O as R,A as h}from"./chunks/getGuestOrder.graphql.js";import{t as T}from"./chunks/getCustomer.js";import{g as j,a as J}from"./chunks/getCustomer.js";import{g as W}from"./chunks/getAttributesForm.js";import{g as Z}from"./chunks/getStoreConfig.js";import{g as re}from"./chunks/getCustomerOrdersReturn.js";import{g as ae,r as se}from"./chunks/requestReturn.js";import{c as oe,r as ie}from"./chunks/requestGuestOrderCancel.js";import{r as me}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/convertCase.js";import"./chunks/transform-attributes-form.js";const G=` +query ORDER_BY_NUMBER($orderNumber: String!, $pageSize: Int) { customer { orders( filter: { number: { eq: $orderNumber } } @@ -15,7 +15,7 @@ query ORDER_BY_NUMBER($orderNumber: String!) { carrier shipping_method is_virtual - returns(pageSize: 50) { + returns(pageSize: $pageSize) { ...OrderReturns } items_eligible_for_return { @@ -108,10 +108,10 @@ ${_} ${p} ${c} ${O} -${h} ${R} +${h} ${D} -`,T=async(e,r,t)=>await n(G,{method:"GET",cache:"force-cache",variables:{orderNumber:e}}).then(a=>{var s;return(s=a.errors)!=null&&s.length?m(a.errors):b(t??"orderData",a,r)}).catch(l),g=` +`,y=async({orderId:e,returnRef:r,queryType:t,returnsPageSize:a=50})=>await n(G,{method:"GET",cache:"force-cache",variables:{orderNumber:e,pageSize:a}}).then(s=>{var d;return(d=s.errors)!=null&&d.length?m(s.errors):b(t??"orderData",s,r)}).catch(l),f=` query ORDER_BY_TOKEN($token: String!) { guestOrderByToken(input: { token: $token }) { email @@ -205,7 +205,7 @@ ${_} ${p} ${c} ${O} -${h} ${R} +${h} ${D} -`,A=async(e,r)=>await n(g,{method:"GET",cache:"no-cache",variables:{token:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?m(t.errors):f(t,r)}).catch(l),y=async e=>{var i;const r=(e==null?void 0:e.orderRef)??"",t=(e==null?void 0:e.returnRef)??"",a=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((i=e==null?void 0:e.orderRef)==null?void 0:i.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){d.emit("order/data",{...s,returnNumber:t});return}if(!r){console.error("Order Token or number not received.");return}const o=a?await A(r,t):await T(r,t,"orderData");o?d.emit("order/data",{...o,returnNumber:t}):d.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},E=new I({init:async e=>{const r={};E.config.setConfig({...r,...e}),y(e).catch(console.error)},listeners:()=>[]}),v=E.config;export{de as cancelOrder,v as config,n as fetchGraphQl,V as getAttributesForm,te as getAttributesList,U as getConfig,K as getCustomer,ee as getCustomerOrdersReturn,j as getGuestOrder,T as getOrderDetailsById,X as getStoreConfig,A as guestOrderByToken,E as initialize,q as removeFetchGraphQlHeader,ne as reorderItems,oe as requestGuestOrderCancel,ae as requestReturn,z as setEndpoint,Y as setFetchGraphQlHeader,Q as setFetchGraphQlHeaders}; +`,$=async(e,r)=>await n(f,{method:"GET",cache:"no-cache",variables:{token:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?m(t.errors):T(t,r)}).catch(l),A="orderData",C=async e=>{var i;const r=typeof(e==null?void 0:e.orderRef)=="string"?e==null?void 0:e.orderRef:"",t=typeof(e==null?void 0:e.returnRef)=="string"?e==null?void 0:e.returnRef:"",a=r&&typeof(e==null?void 0:e.orderRef)=="string"&&((i=e==null?void 0:e.orderRef)==null?void 0:i.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){o.emit("order/data",{...s,returnNumber:t});return}if(!r){console.error("Order Token or number not received.");return}const d=a?await $(r,t):await y({orderId:r,returnRef:t,queryType:A});d?o.emit("order/data",{...d,returnNumber:t}):o.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},E=new I({init:async e=>{const r={};E.config.setConfig({...r,...e}),C(e).catch(console.error)},listeners:()=>[]}),x=E.config;export{oe as cancelOrder,x as config,n as fetchGraphQl,W as getAttributesForm,ae as getAttributesList,U as getConfig,j as getCustomer,re as getCustomerOrdersReturn,J as getGuestOrder,y as getOrderDetailsById,Z as getStoreConfig,$ as guestOrderByToken,E as initialize,Y as removeFetchGraphQlHeader,me as reorderItems,ie as requestGuestOrderCancel,se as requestReturn,q as setEndpoint,Q as setFetchGraphQlHeader,H as setFetchGraphQlHeaders}; diff --git a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/getOrderDetailsById.d.ts b/scripts/__dropins__/storefront-order/api/getOrderDetailsById/getOrderDetailsById.d.ts index d06579bdaa..c9745a694c 100644 --- a/scripts/__dropins__/storefront-order/api/getOrderDetailsById/getOrderDetailsById.d.ts +++ b/scripts/__dropins__/storefront-order/api/getOrderDetailsById/getOrderDetailsById.d.ts @@ -1,4 +1,5 @@ +import { GetOrderDetailsByIdProps } from '../../types'; import { TransformedData } from '../../data/models'; -export declare const getOrderDetailsById: (orderId?: string, returnRef?: string, queryType?: T | undefined) => Promise>; +export declare const getOrderDetailsById: ({ orderId, returnRef, queryType, returnsPageSize, }: GetOrderDetailsByIdProps) => Promise>; //# sourceMappingURL=getOrderDetailsById.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 new file mode 100644 index 0000000000..1a06f4fcf8 --- /dev/null +++ b/scripts/__dropins__/storefront-order/api/requestReturn/graphql/fragments.d.ts @@ -0,0 +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"; +//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts b/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts index e543a059fe..2053c33748 100644 --- a/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts +++ b/scripts/__dropins__/storefront-order/api/requestReturn/graphql/requestReturn.graphql.d.ts @@ -1,2 +1,2 @@ -export declare const REQUEST_RETURN_ORDER = "\nmutation REQUEST_RETURN_ORDER($input: RequestReturnInput!) {\n requestReturn(input: $input) {\n return {\n uid\n status\n number\n created_at\n }\n }\n}\n"; +export declare const REQUEST_RETURN_ORDER: string; //# sourceMappingURL=requestReturn.graphql.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js b/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js index d97f0578f5..85b40962e3 100644 --- a/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js +++ b/scripts/__dropins__/storefront-order/chunks/CartSummaryItem.js @@ -1 +1 @@ -import{jsx as t,jsxs as E,Fragment as w}from"@dropins/tools/preact-jsx-runtime.js";import{Price as u,CartItem as o,Icon as r,Image as U,Incrementer as c}from"@dropins/tools/components.js";import{useCallback as d}from"@dropins/tools/preact-hooks.js";import{classes as X}from"@dropins/tools/lib.js";import*as V from"@dropins/tools/preact-compat.js";const p=N=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...N},V.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"}),V.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"})),ne=({loading:N,product:e,itemType:Y,taxConfig:D,translations:v,disabledIncrementer:C,showConfigurableOptions:_,onQuantity:y,routeProductDetails:b,isReturnProductList:I})=>{var H,M,Z,j,q,x,z,F,O,R,W,$,B,K,A,G,J;const{taxExcluded:S,taxIncluded:L}=D,m=d((h,T,g)=>t(u,{amount:h,currency:T,weight:"normal",...g}),[]);let k={};const Q=Y==="cancelled",P=(M=(H=e==null?void 0:e.product)==null?void 0:H.stockStatus)==null?void 0:M.includes("IN_STOCK"),l=(e==null?void 0:e.giftCard)||{},a=(Z=e==null?void 0:e.itemPrices)==null?void 0:Z.priceIncludingTax,s=(j=e==null?void 0:e.itemPrices)==null?void 0:j.originalPrice,n=(q=e==null?void 0:e.itemPrices)==null?void 0:q.price,i=e.discounted&&((x=e.price)==null?void 0:x.value)!==(s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),f={..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in l&&(l!=null&&l.senderName)?{[v.sender]:l==null?void 0:l.senderName}:{},..."senderEmail"in l&&(l!=null&&l.senderEmail)?{[v.sender]:l==null?void 0:l.senderEmail}:{},..."recipientName"in l&&(l!=null&&l.recipientName)?{[v.recipient]:l==null?void 0:l.recipientName}:{},..."recipientEmail"in l&&(l!=null&&l.recipientEmail)?{[v.recipient]:l==null?void 0:l.recipientEmail}:{},..."message"in l&&(l!=null&&l.message)?{[v.message]:l==null?void 0:l.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(z=e==null?void 0:e.downloadableLinks)==null?void 0:z.count} ${v.downloadableCount}`]:(F=e==null?void 0:e.downloadableLinks)==null?void 0:F.result}:{}};if(L&&S){const h=i?s==null?void 0:s.value:(a==null?void 0:a.value)*(e==null?void 0:e.totalQuantity);k={taxExcluded:!0,taxIncluded:void 0,price:m(s==null?void 0:s.value,s==null?void 0:s.currency),total:E(w,{children:[m(h,s==null?void 0:s.currency,{variant:e.discounted&&(a==null?void 0:a.value)!==h?"strikethrough":"default"}),e.discounted&&(a==null?void 0:a.value)!==h?m(a==null?void 0:a.value,a==null?void 0:a.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:m((n==null?void 0:n.value)*e.totalQuantity,n==null?void 0:n.currency)}}else if(!L&&S)k={taxExcluded:void 0,taxIncluded:void 0,price:m(s==null?void 0:s.value,s==null?void 0:s.currency),total:E(w,{children:[m((s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),a==null?void 0:a.currency,{variant:i?"strikethrough":"default"}),i?m((O=e.price)==null?void 0:O.value,(R=e.price)==null?void 0:R.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:m((n==null?void 0:n.value)*(e==null?void 0:e.totalQuantity),n==null?void 0:n.currency)};else if(L&&!S){const h=i?s.value:a.value*e.totalQuantity;k={taxExcluded:void 0,taxIncluded:!0,price:m(a==null?void 0:a.value,a==null?void 0:a.currency),total:E(w,{children:[m(h,a==null?void 0:a.currency,{variant:i?"strikethrough":"default",weight:"bold"}),i?m(a==null?void 0:a.value,a==null?void 0:a.currency,{sale:!0,weight:"bold"}):null]})}}return t(o,{loading:N,alert:Q&&P?E("span",{children:[t(r,{source:p}),v.outOfStock]}):t(w,{}),configurations:(_==null?void 0:_(f))??f,title:b?t("a",{"data-testid":"product-name",className:X(["cart-summary-item__title",["cart-summary-item__title--strikethrough",Q]]),href:b(e),children:(W=e==null?void 0:e.product)==null?void 0:W.name}):t("div",{"data-testid":"product-name",className:X(["cart-summary-item__title",["cart-summary-item__title--strikethrough",Q]]),children:($=e==null?void 0:e.product)==null?void 0:$.name}),sku:t("div",{children:(B=e==null?void 0:e.product)==null?void 0:B.sku}),quantity:e!=null&&e.eligibleForReturn&&(e!=null&&e.returnableQuantity)?(e==null?void 0:e.returnableQuantity)??e.totalQuantity:I?void 0:e.totalQuantity,image:b?t("a",{href:b(e),children:t(U,{src:(K=e==null?void 0:e.product)==null?void 0:K.thumbnail.url,alt:(A=e==null?void 0:e.product)==null?void 0:A.thumbnail.label,loading:"lazy",width:"90",height:"120"})}):t(U,{src:(G=e==null?void 0:e.product)==null?void 0:G.thumbnail.url,alt:(J=e==null?void 0:e.product)==null?void 0:J.thumbnail.label,loading:"lazy",width:"90",height:"120"}),...k,footer:y&&!C?t(c,{value:1,min:1,max:e==null?void 0:e.returnableQuantity,onValue:h=>y==null?void 0:y(Number(h)),name:"quantity"}):void 0})};export{ne as C,p as S}; +import{jsx as t,jsxs as E,Fragment as w}from"@dropins/tools/preact-jsx-runtime.js";import{Price as u,CartItem as o,Icon as r,Image as U,Incrementer as c}from"@dropins/tools/components.js";import{useCallback as d}from"@dropins/tools/preact-hooks.js";import{classes as X}from"@dropins/tools/lib.js";import*as Q from"@dropins/tools/preact-compat.js";const p=N=>Q.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...N},Q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),Q.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),ne=({loading:N,product:e,itemType:Y,taxConfig:D,translations:v,disabledIncrementer:C,showConfigurableOptions:_,onQuantity:y,routeProductDetails:b,isReturnProductList:I})=>{var H,M,Z,j,q,x,z,F,O,R,W,$,B,K,A,G,J;const{taxExcluded:S,taxIncluded:f}=D,m=d((h,g,T)=>t(u,{amount:h,currency:g,weight:"normal",...T}),[]);let k={};const L=Y==="cancelled",P=(M=(H=e==null?void 0:e.product)==null?void 0:H.stockStatus)==null?void 0:M.includes("IN_STOCK"),a=(e==null?void 0:e.giftCard)||{},l=(Z=e==null?void 0:e.itemPrices)==null?void 0:Z.priceIncludingTax,s=(j=e==null?void 0:e.itemPrices)==null?void 0:j.originalPrice,n=(q=e==null?void 0:e.itemPrices)==null?void 0:q.price,i=e.discounted&&((x=e.price)==null?void 0:x.value)!==(s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),V={..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in a?{[v.sender]:a==null?void 0:a.senderName}:{},..."senderEmail"in a&&(a!=null&&a.senderEmail)?{[v.sender]:a==null?void 0:a.senderEmail}:{},..."recipientName"in a&&(a!=null&&a.recipientName)?{[v.recipient]:a==null?void 0:a.recipientName}:{},..."recipientEmail"in a&&(a!=null&&a.recipientEmail)?{[v.recipient]:a==null?void 0:a.recipientEmail}:{},..."message"in a&&(a!=null&&a.message)?{[v.message]:a==null?void 0:a.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(z=e==null?void 0:e.downloadableLinks)==null?void 0:z.count} ${v.downloadableCount}`]:(F=e==null?void 0:e.downloadableLinks)==null?void 0:F.result}:{}};if(f&&S){const h=i?s==null?void 0:s.value:(l==null?void 0:l.value)*(e==null?void 0:e.totalQuantity);k={taxExcluded:!0,taxIncluded:void 0,price:m(s==null?void 0:s.value,s==null?void 0:s.currency),total:E(w,{children:[m(h,s==null?void 0:s.currency,{variant:e.discounted&&(l==null?void 0:l.value)!==h?"strikethrough":"default"}),e.discounted&&(l==null?void 0:l.value)!==h?m(l==null?void 0:l.value,l==null?void 0:l.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:m((n==null?void 0:n.value)*e.totalQuantity,n==null?void 0:n.currency)}}else if(!f&&S)k={taxExcluded:void 0,taxIncluded:void 0,price:m(s==null?void 0:s.value,s==null?void 0:s.currency),total:E(w,{children:[m((s==null?void 0:s.value)*(e==null?void 0:e.totalQuantity),l==null?void 0:l.currency,{variant:i?"strikethrough":"default"}),i?m((O=e.price)==null?void 0:O.value,(R=e.price)==null?void 0:R.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:m((n==null?void 0:n.value)*(e==null?void 0:e.totalQuantity),n==null?void 0:n.currency)};else if(f&&!S){const h=i?s.value:l.value*e.totalQuantity;k={taxExcluded:void 0,taxIncluded:!0,price:m(l==null?void 0:l.value,l==null?void 0:l.currency),total:E(w,{children:[m(h,l==null?void 0:l.currency,{variant:i?"strikethrough":"default",weight:"bold"}),i?m(l==null?void 0:l.value,l==null?void 0:l.currency,{sale:!0,weight:"bold"}):null]})}}return t(o,{loading:N,alert:L&&P?E("span",{children:[t(r,{source:p}),v.outOfStock]}):t(w,{}),configurations:(_==null?void 0:_(V))??V,title:b?t("a",{"data-testid":"product-name",className:X(["cart-summary-item__title",["cart-summary-item__title--strikethrough",L]]),href:b(e),children:(W=e==null?void 0:e.product)==null?void 0:W.name}):t("div",{"data-testid":"product-name",className:X(["cart-summary-item__title",["cart-summary-item__title--strikethrough",L]]),children:($=e==null?void 0:e.product)==null?void 0:$.name}),sku:t("div",{children:(B=e==null?void 0:e.product)==null?void 0:B.sku}),quantity:e!=null&&e.eligibleForReturn&&(e!=null&&e.returnableQuantity)?(e==null?void 0:e.returnableQuantity)??e.totalQuantity:I?void 0:e.totalQuantity,image:b?t("a",{href:b(e),children:t(U,{src:(K=e==null?void 0:e.product)==null?void 0:K.thumbnail.url,alt:(A=e==null?void 0:e.product)==null?void 0:A.thumbnail.label,loading:"lazy",width:"90",height:"120"})}):t(U,{src:(G=e==null?void 0:e.product)==null?void 0:G.thumbnail.url,alt:(J=e==null?void 0:e.product)==null?void 0:J.thumbnail.label,loading:"lazy",width:"90",height:"120"}),...k,footer:y&&!C?t(c,{value:1,min:1,max:e==null?void 0:e.returnableQuantity,onValue:h=>y==null?void 0:y(Number(h)),name:"quantity"}):void 0})};export{ne as C,p as S}; diff --git a/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js b/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js index 5059874bd8..ea6549d643 100644 --- a/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js +++ b/scripts/__dropins__/storefront-order/chunks/getAttributesForm.js @@ -44,4 +44,4 @@ import{h as i}from"./network-error.js";import{f as u,h as s}from"./fetch-graphql } } } -`,T=async r=>await u(r!=="shortRequest"?n:_,{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(t=>{var e,o,a;return(e=t.errors)!=null&&e.length?s(t.errors):m(((a=(o=t==null?void 0:t.data)==null?void 0:o.attributesForm)==null?void 0:a.items)??[])}).catch(i);export{T as g}; +`,T=async r=>await u(r!=="shortRequest"?n:_,{method:"GET",cache:"force-cache",variables:{formCode:r}}).then(t=>{var e,o,a;return(e=t.errors)!=null&&e.length?s(t.errors):m((a=(o=t==null?void 0:t.data)==null?void 0:o.attributesForm)==null?void 0:a.items)}).catch(i);export{T as g}; diff --git a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js index 21f9223939..5778d24104 100644 --- a/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js +++ b/scripts/__dropins__/storefront-order/chunks/getGuestOrder.graphql.js @@ -92,6 +92,7 @@ fragment AddressesList on OrderAddress { timestamp } items { + __typename id product_sku product_name diff --git a/scripts/__dropins__/storefront-order/chunks/requestReturn.js b/scripts/__dropins__/storefront-order/chunks/requestReturn.js index bf713ed850..4e63f82b5b 100644 --- a/scripts/__dropins__/storefront-order/chunks/requestReturn.js +++ b/scripts/__dropins__/storefront-order/chunks/requestReturn.js @@ -1,4 +1,4 @@ -import{h as i}from"./network-error.js";import{f as s,h as o}from"./fetch-graphql.js";import{t as c}from"./transform-attributes-form.js";import{a as m}from"./convertCase.js";const d=` +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 { @@ -31,15 +31,20 @@ import{h as i}from"./network-error.js";import{f as s,h as o}from"./fetch-graphql } } } -`,E=async u=>await s(d,{method:"GET",cache:"force-cache",variables:{entityType:u}}).then(t=>{var e,r,a;return(e=t.errors)!=null&&e.length?o(t.errors):c(((a=(r=t==null?void 0:t.data)==null?void 0:r.attributesList)==null?void 0:a.items)??[])}).catch(i),l=` +`,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 { - uid - status - number - created_at + ...OrderReturn } } } -`,f=async u=>{const t=m(u,"snakeCase",{});return await s(l,{method:"POST",variables:{input:t}}).then(e=>{var n;if((n=e.errors)!=null&&n.length)return o(e.errors);const{created_at:r,...a}=e.data.requestReturn.return;return{...a,createdAt:r}}).catch(i)};export{E as g,f as r}; +${_}`,y=async n=>{const t=c(n,"snakeCase",{});return await s(T,{method:"POST",variables:{input:t}}).then(e=>{var u;if((u=e.errors)!=null&&u.length)return o(e.errors);const{created_at:r,...a}=e.data.requestReturn.return;return{...a,createdAt:r}}).catch(i)};export{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 7f9f88c15b..7a0c70015a 100644 --- a/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js +++ b/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js @@ -1 +1 @@ -import{F as c}from"./form.types.js";const p={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"},y=i=>{const n={};return Object.keys(i).forEach(t=>{if(t.match(/_(\d+)$/)){const e=t.replace(/_\d+$/,"");n[e]=i[t]}else n[t]=i[t]}),n},R=(i,n)=>i.map(t=>({...t,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}`})),_=(i,n)=>i==null?void 0:i.flatMap(t=>Array.from({length:n},(a,e)=>({...t,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}`}))),$=i=>{const n=[],t=[];return Object.entries(i).forEach(([a,e])=>{const s=a.lastIndexOf("_"),r=a.slice(0,s),u=a.slice(s+1);u===c.MULTISELECT||u===c.SELECT?n.push({attributeCode:r,value:btoa(e)}):t.push({attributeCode:r,value:e})}),{selectedCustomAttributes:n,enteredCustomAttributes:t}},m=i=>typeof i!="string"?"":p[i]??"",l=["REJECTED","PARTIALLY_REJECTED","DENIED","UNCONFIRMED","CLOSED"],A=i=>{const n=i==null?void 0:i.returns.filter(e=>!l.includes(e.returnStatus));return((i==null?void 0:i.itemsEligibleForReturn)??[]).flatMap(e=>{let s=e.quantityShipped,r={...e,returnableQuantity:s};return e.quantityShipped===0&&(r={...r,eligibleForReturn:!1,returnableQuantity:0}),n.forEach(u=>{u.items.forEach(o=>{if((o==null?void 0:o.id)===(e==null?void 0:e.id)){const d=s-o.requestQuantity;s=Math.max(d,0),r={...r,eligibleForReturn:s!==0,returnableQuantity:s}}})}),r}).sort((e,s)=>Number(s.eligibleForReturn)-Number(e.eligibleForReturn))},C=i=>{var a;let n=[];return((a=i==null?void 0:i.returns)==null?void 0:a.filter(e=>!l.includes(e.returnStatus)).flatMap(e=>e.items||[])).forEach(e=>{if(!n.length)n.push({...e,totalQuantity:e.requestQuantity});else{const s=n.findIndex(r=>r.id===e.id);s!==-1?n[s].totalQuantity+=e.requestQuantity:n.push({...e,totalQuantity:e.requestQuantity})}}),{returnedList:n,modifyOrder:E(i.items,n)}};function E(i,n){return i.map(t=>{const a=n.find(e=>e.id===t.id);if(a){const e=t.totalQuantity-a.totalQuantity;return e===0?null:{...t,totalQuantity:e}}return t}).filter(t=>t!==null)}export{y as c,C as e,m as f,R as m,$ as n,A as o,_ as r}; +import{F as c}from"./form.types.js";const p={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"},y=n=>{const s={};return Object.keys(n).forEach(e=>{if(e.match(/_(\d+)$/)){const t=e.replace(/_\d+$/,"");s[t]=n[e]}else s[e]=n[e]}),s},R=(n,s)=>n.map(e=>({...e,id:`${e.id}_${e.fieldType}_${s+1}`,name:`${e.name}_${e.fieldType}_${s+1}`,code:`${e.code}_${e.fieldType}_${s+1}`,customUpperCode:`${e.customUpperCode}_${e.fieldType}_${s+1}`})),_=(n,s)=>n==null?void 0:n.flatMap(e=>Array.from({length:s},(i,t)=>({...e,id:`${e.id}_${e.fieldType}_${t+1}`,name:`${e.name}_${e.fieldType}_${t+1}`,code:`${e.code}_${e.fieldType}_${t+1}`,customUpperCode:`${e.customUpperCode}_${e.fieldType}_${t+1}`}))),$=n=>{const s=[],e=[];return Object.entries(n).forEach(([i,t])=>{const a=i.lastIndexOf("_"),r=i.slice(0,a),u=i.slice(a+1);u===c.MULTISELECT||u===c.SELECT?s.push({attributeCode:r,value:btoa(t)}):e.push({attributeCode:r,value:t})}),{selectedCustomAttributes:s,enteredCustomAttributes:e}},m=n=>typeof n!="string"?"":p[n]??"",l=["REJECTED","PARTIALLY_REJECTED","DENIED","UNCONFIRMED","CLOSED"],A=n=>{const s=n==null?void 0:n.returns.filter(t=>!l.includes(t.returnStatus));return((n==null?void 0:n.itemsEligibleForReturn)??[]).flatMap(t=>{let a=t.quantityShipped,r={...t,returnableQuantity:a};return t.quantityShipped===0&&(r={...r,eligibleForReturn:!1,returnableQuantity:0}),s.forEach(u=>{u.items.forEach(o=>{if((o==null?void 0:o.id)===(t==null?void 0:t.id)){const d=a-o.requestQuantity;a=Math.max(d,0),r={...r,eligibleForReturn:a!==0,returnableQuantity:a}}})}),r}).sort((t,a)=>Number(a.eligibleForReturn)-Number(t.eligibleForReturn))},C=n=>{var i;let s=[];return((i=n==null?void 0:n.returns)==null?void 0:i.filter(t=>!l.includes(t.returnStatus)).flatMap(t=>t.items||[])).forEach(t=>{if(!s.length)s.push({...t,totalQuantity:t.requestQuantity});else{const a=s.findIndex(r=>r.id===t.id);a!==-1?s[a].totalQuantity+=t.requestQuantity:s.push({...t,totalQuantity:t.requestQuantity})}}),{returnedList:s??[],modifyOrder:E(n.items,s)??[]}};function E(n,s){const e=new Map(s.map(i=>[i.id,i]));return n.map(i=>{const t=e.get(i.id);if(t){const a=i.totalQuantity-t.totalQuantity;return a===0?null:{...i,totalQuantity:a}}return i}).filter(i=>i!==null)}export{y as c,C as e,m as f,R as m,$ as n,A as o,_ as r}; diff --git a/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js index b8ba7c03cf..ce74ed1d52 100644 --- a/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js +++ b/scripts/__dropins__/storefront-order/chunks/transform-attributes-form.js @@ -1 +1 @@ -import{c as d,a as m}from"./convertCase.js";const a=s=>{let o=[];for(const e of s)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let n=2;n<=e.multiline_count;n++){const c={...e,name:`${e.code}_${n}`,code:`${e.code}_${n}`,id:`${e.code}_${n}`};o.push(c)}return o},f=s=>{var u;const o=s||[];if(!o.length)return[];const e=(u=o.filter(t=>{var r;return!((r=t.frontend_input)!=null&&r.includes("HIDDEN"))}))==null?void 0:u.map(({code:t,...r})=>{const i=t!=="country_id"?t:"country_code";return{...r,name:i,id:i,code:i}}),n=a(e);return e.concat(n).map(t=>{const r=d(t.code);return m({...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"./convertCase.js";const a=n=>{let c=[];for(const e of n)if(!(e.frontend_input!=="MULTILINE"||e.multiline_count<2))for(let o=2;o<=e.multiline_count;o++){const s={...e,name:`${e.code}_${o}`,code:`${e.code}_${o}`,id:`${e.code}_${o}`};c.push(s)}return c},f=(n=[])=>{var s;if(!(n!=null&&n.length))return[];const c=(s=n.filter(t=>{var r;return!((r=t.frontend_input)!=null&&r.includes("HIDDEN"))}))==null?void 0:s.map(({code:t,...r})=>{const u=t!=="country_id"?t:"country_code";return{...r,name:u,id:u,code:u}}),e=a(c);return c.concat(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/containers/CreateReturn.js b/scripts/__dropins__/storefront-order/containers/CreateReturn.js index 27581466bb..1feb8dbebb 100644 --- a/scripts/__dropins__/storefront-order/containers/CreateReturn.js +++ b/scripts/__dropins__/storefront-order/containers/CreateReturn.js @@ -1 +1 @@ -import{jsx as r,jsxs as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as q,Slot as P}from"@dropins/tools/lib.js";import{Checkbox as H,Button as Q,CartItem as V,Image as W,Header as Z,InLineAlert as D}from"@dropins/tools/components.js";import{u as z,a as U}from"../chunks/OrderCancel.js";import{useState as _,useRef as K,useEffect as T,useCallback as F}from"@dropins/tools/preact-hooks.js";import{events as G}from"@dropins/tools/event-bus.js";import{g as J}from"../chunks/getFormValues.js";import{s as X}from"../chunks/setTaxStatus.js";import{createRef as Y,Fragment as I}from"@dropins/tools/preact.js";import{o as ee,c as te,n as ne,r as re,m as ae}from"../chunks/returnOrdersHelper.js";import{g as se,r as ie}from"../chunks/requestReturn.js";import{g as ce}from"../chunks/getStoreConfig.js";import*as y from"@dropins/tools/preact-compat.js";import{S as ue,C as oe}from"../chunks/CartSummaryItem.js";import{O as le}from"../chunks/OrderLoaders.js";import{useText as de}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const pe=a=>y.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},y.createElement("g",{clipPath:"url(#clip0_841_1324)"},y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),y.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"})),y.createElement("defs",null,y.createElement("clipPath",{id:"clip0_841_1324"},y.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),he=a=>y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},y.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"}),y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),me=({onSuccess:a,onError:s,handleSetInLineAlert:c,orderData:d})=>{const[u,p]=_(d),[C,f]=_("products"),[O,b]=_(!0),[i,g]=_([]),[S,w]=_([]),[e,L]=_({taxIncluded:!1,taxExcluded:!1}),[t,h]=_([]),k=K([]);k.current.length!==i.length&&(k.current=i.map((n,o)=>k.current[o]||Y())),T(()=>{const n=G.on("order/data",o=>{p(o),h(ee(o)),b(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ce().then(n=>{if(n){const o=X(n==null?void 0:n.shoppingCartDisplayPrice);L(o)}})},[]),T(()=>{se("RMA_ITEM").then(n=>{n.length&&(w(n),b(!1))})},[]);const N=F(n=>{g(o=>o.findIndex(l=>(l==null?void 0:l.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(l=>(l==null?void 0:l.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),R=F(n=>{f(n),c(),n==="products"&&g([])},[c]),A=F((n,o)=>{const v=i.map(l=>l.productSku===o?{...l,currentReturnOrderQuantity:n}:l);g(v)},[i]),E=F(async(n,o)=>{if(!o)return null;b(!0);const v={orderUid:(u==null?void 0:u.id)??"",contactEmail:(u==null?void 0:u.email)??""},l=[];k.current.length&&k.current.forEach(({current:m})=>{var M;const $=m==null?void 0:m.name.replace(/_\d+$/,""),j=((M=m==null?void 0:m.dataset)==null?void 0:M.quantity)??1,B=te(J(m));l.push({orderItemUid:$,quantityToReturn:+j,...ne(B)})}),ie({...v,items:l}).then(m=>{m&&(a==null||a(m),R("success"),c())}).catch(m=>{s==null||s(m.message),c({type:"error",heading:m.message})}),b(!1)},[R,s,a,c,u]);return{order:u,steps:C,loading:O,formsRef:k,taxConfig:e,attributesList:S,selectedProductList:i,itemsEligibleForReturn:t,handleSelectedProductList:N,handleSetQuantity:A,handleChangeStep:R,onSubmit:E}},ge={success:r(he,{}),warning:r(pe,{}),error:r(ue,{})},fe=()=>{const[a,s]=_({type:"success",heading:""}),c=F(d=>{if(!(d!=null&&d.type)){s({type:"success",heading:""});return}const u=ge[d.type];s({...d,icon:u})},[]);return{inLineAlertProps:a,handleSetInLineAlert:c}},be=({itemsEligibleForReturn:a,slots:s,loading:c=!1,taxConfig:d,translations:u={},selectedProductList:p,handleSelectedProductList:C,showConfigurableOptions:f,handleSetQuantity:O,handleChangeStep:b})=>x("ul",{className:"order-return-order-product-list",children:[a==null?void 0:a.map((i,g)=>{const S=p.some(e=>(e==null?void 0:e.productSku)===i.productSku&&i.eligibleForReturn&&i.quantityReturned===0),w=i.returnableQuantity===0?1:i.returnableQuantity;return x("li",{className:q(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",!i.eligibleForReturn]]),children:[r(H,{"data-testid":`key_${g}`,name:`key_${g}`,checked:S,disabled:!i.eligibleForReturn||i.quantityReturned!==0,onChange:()=>{C({...i,currentReturnOrderQuantity:1})}}),r(oe,{loading:c,product:{...i,totalQuantity:w},itemType:"",taxConfig:d,translations:u,showConfigurableOptions:f,disabledIncrementer:!S,isReturnProductList:!0,onQuantity:(i==null?void 0:i.returnableQuantity)>1?e=>O(e,i.productSku):void 0}),s!=null&&s.ReturnOrderItem?r(P,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:s==null?void 0:s.ReturnOrderItem,context:{}}):null]},g)}),r("li",{className:"order-return-order-product-list__item",children:r(Q,{type:"button",onClick:()=>b("attributes"),disabled:!p.length,children:u.nextStep})})]}),ke=({routeReturnSuccess:a,translations:s,orderData:c})=>{const d=()=>{window.location.href=(a==null?void 0:a(c))??"#"};return 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(Q,{onClick:d,type:"button",children:s.backStore})]})},ye=({slots:a,formsRef:s,selectedProductList:c,loading:d,fieldsConfig:u,translations:p,handleChangeStep:C,onSubmit:f})=>{const{formData:O,errors:b,formRef:i,handleChange:g,handleBlur:S,handleSubmit:w}=z({fieldsConfig:re(u,c==null?void 0:c.length),onSubmit:f});return x("form",{className:"order-return-reason-form",ref:i,onSubmit:w,name:"returnReasonForm",children:[c.map((e,L)=>{var E,n,o,v,l;const t=(e==null?void 0:e.giftCard)||{},h=e==null?void 0:e.product,k=ae(u,L),N=`${e==null?void 0:e.id}_${L}`,R=(e==null?void 0:e.currentReturnOrderQuantity)??1,A={...e!=null&&e.currentReturnOrderQuantity?{Quantity:R}:{},..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in t&&(t!=null&&t.senderName)?{[p.sender]:t==null?void 0:t.senderName}:{},..."senderEmail"in t&&(t!=null&&t.senderEmail)?{[p.sender]:t==null?void 0:t.senderEmail}:{},..."recipientName"in t&&(t!=null&&t.recipientName)?{[p.recipient]:t==null?void 0:t.recipientName}:{},..."recipientEmail"in t&&(t!=null&&t.recipientEmail)?{[p.recipient]:t==null?void 0:t.recipientEmail}:{},..."message"in t&&(t!=null&&t.message)?{[p.message]:t==null?void 0:t.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(E=e==null?void 0:e.downloadableLinks)==null?void 0:E.count} ${p.downloadableCount}`]:(n=e==null?void 0:e.downloadableLinks)==null?void 0:n.result}:{}};return x(I,{children:[r(V,{loading:d,title:r("div",{"data-testid":"product-name",children:(o=e==null?void 0:e.product)==null?void 0:o.name}),sku:r("div",{children:h==null?void 0:h.sku}),image:r(W,{src:((v=h==null?void 0:h.thumbnail)==null?void 0:v.url)??"",alt:((l=h==null?void 0:h.thumbnail)==null?void 0:l.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:A}),r("form",{name:N,ref:s==null?void 0:s.current[L],"data-quantity":R,children:r(U,{className:"className",loading:d,fields:k,onChange:g,onBlur:S,errors:b,values:O})})]},L)}),a!=null&&a.ReturnFormActions?r(P,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:a==null?void 0:a.ReturnFormActions,context:{handleChangeStep:C}}):x("div",{className:"order-return-reason-form__actions",children:[r(Q,{variant:"secondary",type:"button",onClick:()=>{C("products")},children:p.backStep}),r(Q,{children:p.submit})]})]})},He=({className:a,orderData:s,slots:c,onSuccess:d,onError:u,routeReturnSuccess:p,showConfigurableOptions:C})=>{const f=de({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"}),{inLineAlertProps:O,handleSetInLineAlert:b}=fe(),{order:i,itemsEligibleForReturn:g,formsRef:S,taxConfig:w,attributesList:e,steps:L,loading:t,selectedProductList:h,handleSelectedProductList:k,handleSetQuantity:N,handleChangeStep:R,onSubmit:A}=me({orderData:s,onSuccess:d,onError:u,handleSetInLineAlert:b});if(t)return r("div",{children:r(le,{})});if(!t&&!e.length)return r("div",{});const E={products:r(be,{itemsEligibleForReturn:g,slots:c,translations:f,loading:t,taxConfig:w,selectedProductList:h,handleSelectedProductList:k,showConfigurableOptions:C,handleSetQuantity:N,handleChangeStep:R}),attributes:r(ye,{slots:c,formsRef:S,loading:t,fieldsConfig:e,selectedProductList:h,handleChangeStep:R,translations:f,onSubmit:A}),success:r(ke,{translations:f,routeReturnSuccess:p,orderData:i}),error:null};return x("div",{className:q(["order-create-return",a]),children:[r(Z,{title:f.headerText}),O.heading?r(D,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...O}):null,E[L]]})};export{He as CreateReturn,He as default}; +import{jsx as r,jsxs as x}from"@dropins/tools/preact-jsx-runtime.js";import{classes as q,Slot as P}from"@dropins/tools/lib.js";import{Checkbox as H,Button as Q,CartItem as V,Image as W,Header as Z,InLineAlert as D}from"@dropins/tools/components.js";import{u as z,a as U}from"../chunks/OrderCancel.js";import{useState as _,useRef as K,useEffect as T,useCallback as F}from"@dropins/tools/preact-hooks.js";import{events as G}from"@dropins/tools/event-bus.js";import{g as J}from"../chunks/getFormValues.js";import{s as X}from"../chunks/setTaxStatus.js";import{createRef as Y,Fragment as I}from"@dropins/tools/preact.js";import{o as ee,c as te,n as ne,r as re,m as ae}from"../chunks/returnOrdersHelper.js";import{g as se,r as ie}from"../chunks/requestReturn.js";import{g as ce}from"../chunks/getStoreConfig.js";import*as y from"@dropins/tools/preact-compat.js";import{S as ue,C as oe}from"../chunks/CartSummaryItem.js";import{O as le}from"../chunks/OrderLoaders.js";import{useText as de}from"@dropins/tools/i18n.js";import"../chunks/form.types.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-attributes-form.js";import"../chunks/convertCase.js";const pe=a=>y.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},y.createElement("g",{clipPath:"url(#clip0_841_1324)"},y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),y.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"})),y.createElement("defs",null,y.createElement("clipPath",{id:"clip0_841_1324"},y.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),he=a=>y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},y.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"}),y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),me=({onSuccess:a,onError:s,handleSetInLineAlert:c,orderData:d})=>{const[u,p]=_(d),[C,f]=_("products"),[O,b]=_(!0),[i,g]=_([]),[S,w]=_([]),[e,L]=_({taxIncluded:!1,taxExcluded:!1}),[t,h]=_([]),k=K([]);k.current.length!==i.length&&(k.current=i.map((n,o)=>k.current[o]||Y())),T(()=>{const n=G.on("order/data",o=>{p(o),h(ee(o)),b(!1)},{eager:!0});return()=>{n==null||n.off()}},[]),T(()=>{ce().then(n=>{if(n){const o=X(n==null?void 0:n.shoppingCartDisplayPrice);L(o)}})},[]),T(()=>{se("RMA_ITEM").then(n=>{n.length&&(w(n),b(!1))})},[]);const N=F(n=>{g(o=>o.findIndex(l=>(l==null?void 0:l.productSku)===(n==null?void 0:n.productSku))>-1?o.filter(l=>(l==null?void 0:l.productSku)!==(n==null?void 0:n.productSku)):[...o,n])},[]),R=F(n=>{f(n),c(),n==="products"&&g([])},[c]),A=F((n,o)=>{const v=i.map(l=>l.productSku===o?{...l,currentReturnOrderQuantity:n}:l);g(v)},[i]),E=F(async(n,o)=>{if(!o)return null;b(!0);const v={orderUid:(u==null?void 0:u.id)??"",contactEmail:(u==null?void 0:u.email)??""},l=[];k.current.length&&k.current.forEach(({current:m})=>{var M;const $=m==null?void 0:m.name.replace(/_\d+$/,""),j=((M=m==null?void 0:m.dataset)==null?void 0:M.quantity)??1,B=te(J(m));l.push({orderItemUid:$,quantityToReturn:+j,...ne(B)})}),ie({...v,items:l}).then(m=>{m&&(a==null||a(m),R("success"),c())}).catch(m=>{s==null||s(m.message),c({type:"error",heading:m.message})}),b(!1)},[R,s,a,c,u]);return{order:u,steps:C,loading:O,formsRef:k,taxConfig:e,attributesList:S,selectedProductList:i,itemsEligibleForReturn:t,handleSelectedProductList:N,handleSetQuantity:A,handleChangeStep:R,onSubmit:E}},ge={success:r(he,{}),warning:r(pe,{}),error:r(ue,{})},fe=()=>{const[a,s]=_({type:"success",heading:""}),c=F(d=>{if(!(d!=null&&d.type)){s({type:"success",heading:""});return}const u=ge[d.type];s({...d,icon:u})},[]);return{inLineAlertProps:a,handleSetInLineAlert:c}},be=({itemsEligibleForReturn:a,slots:s,loading:c=!1,taxConfig:d,translations:u={},selectedProductList:p,handleSelectedProductList:C,showConfigurableOptions:f,handleSetQuantity:O,handleChangeStep:b})=>x("ul",{className:"order-return-order-product-list",children:[a==null?void 0:a.map((i,g)=>{const S=p.some(e=>(e==null?void 0:e.productSku)===i.productSku&&i.eligibleForReturn&&i.quantityReturned===0),w=i.returnableQuantity===0?1:i.returnableQuantity;return x("li",{className:q(["order-return-order-product-list__item",["order-return-order-product-list__item--blur",!i.eligibleForReturn]]),children:[r(H,{"data-testid":`key_${g}`,name:`key_${g}`,checked:S,disabled:!i.eligibleForReturn||i.quantityReturned!==0,onChange:()=>{C({...i,currentReturnOrderQuantity:1})}}),r(oe,{loading:c,product:{...i,totalQuantity:w},itemType:"",taxConfig:d,translations:u,showConfigurableOptions:f,disabledIncrementer:!S,isReturnProductList:!0,onQuantity:(i==null?void 0:i.returnableQuantity)>1?e=>O(e,i.productSku):void 0}),s!=null&&s.ReturnOrderItem?r(P,{"data-testid":"returnOrderItem",name:"ReturnOrderItem",slot:s==null?void 0:s.ReturnOrderItem,context:{}}):null]},g)}),r("li",{className:"order-return-order-product-list__item",children:r(Q,{type:"button",onClick:()=>b("attributes"),disabled:!p.length,children:u.nextStep})})]}),ke=({routeReturnSuccess:a,translations:s,orderData:c})=>{const d=()=>{window.location.href=(a==null?void 0:a(c))??"#"};return 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(Q,{onClick:d,type:"button",children:s.backStore})]})},ye=({slots:a,formsRef:s,selectedProductList:c,loading:d,fieldsConfig:u,translations:p,handleChangeStep:C,onSubmit:f})=>{const{formData:O,errors:b,formRef:i,handleChange:g,handleBlur:S,handleSubmit:w}=z({fieldsConfig:re(u,c==null?void 0:c.length),onSubmit:f});return x("form",{className:"order-return-reason-form",ref:i,onSubmit:w,name:"returnReasonForm",children:[c.map((e,L)=>{var E,n,o,v,l;const t=(e==null?void 0:e.giftCard)||{},h=e==null?void 0:e.product,k=ae(u,L),N=`${e==null?void 0:e.id}_${L}`,R=(e==null?void 0:e.currentReturnOrderQuantity)??1,A={...e!=null&&e.currentReturnOrderQuantity?{Quantity:R}:{},..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in t?{[p.sender]:t==null?void 0:t.senderName}:{},..."senderEmail"in t&&(t!=null&&t.senderEmail)?{[p.sender]:t==null?void 0:t.senderEmail}:{},..."recipientName"in t&&(t!=null&&t.recipientName)?{[p.recipient]:t==null?void 0:t.recipientName}:{},..."recipientEmail"in t&&(t!=null&&t.recipientEmail)?{[p.recipient]:t==null?void 0:t.recipientEmail}:{},..."message"in t&&(t!=null&&t.message)?{[p.message]:t==null?void 0:t.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(E=e==null?void 0:e.downloadableLinks)==null?void 0:E.count} ${p.downloadableCount}`]:(n=e==null?void 0:e.downloadableLinks)==null?void 0:n.result}:{}};return x(I,{children:[r(V,{loading:d,title:r("div",{"data-testid":"product-name",children:(o=e==null?void 0:e.product)==null?void 0:o.name}),sku:r("div",{children:h==null?void 0:h.sku}),image:r(W,{src:((v=h==null?void 0:h.thumbnail)==null?void 0:v.url)??"",alt:((l=h==null?void 0:h.thumbnail)==null?void 0:l.label)??"",loading:"lazy",width:"90",height:"120"}),configurations:A}),r("form",{name:N,ref:s==null?void 0:s.current[L],"data-quantity":R,children:r(U,{className:"className",loading:d,fields:k,onChange:g,onBlur:S,errors:b,values:O})})]},L)}),a!=null&&a.ReturnFormActions?r(P,{"data-testid":"returnFormActions",name:"ReturnFormActions",slot:a==null?void 0:a.ReturnFormActions,context:{handleChangeStep:C}}):x("div",{className:"order-return-reason-form__actions",children:[r(Q,{variant:"secondary",type:"button",onClick:()=>{C("products")},children:p.backStep}),r(Q,{children:p.submit})]})]})},He=({className:a,orderData:s,slots:c,onSuccess:d,onError:u,routeReturnSuccess:p,showConfigurableOptions:C})=>{const f=de({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"}),{inLineAlertProps:O,handleSetInLineAlert:b}=fe(),{order:i,itemsEligibleForReturn:g,formsRef:S,taxConfig:w,attributesList:e,steps:L,loading:t,selectedProductList:h,handleSelectedProductList:k,handleSetQuantity:N,handleChangeStep:R,onSubmit:A}=me({orderData:s,onSuccess:d,onError:u,handleSetInLineAlert:b});if(t)return r("div",{children:r(le,{})});if(!t&&!e.length)return r("div",{});const E={products:r(be,{itemsEligibleForReturn:g,slots:c,translations:f,loading:t,taxConfig:w,selectedProductList:h,handleSelectedProductList:k,showConfigurableOptions:C,handleSetQuantity:N,handleChangeStep:R}),attributes:r(ye,{slots:c,formsRef:S,loading:t,fieldsConfig:e,selectedProductList:h,handleChangeStep:R,translations:f,onSubmit:A}),success:r(ke,{translations:f,routeReturnSuccess:p,orderData:i}),error:null};return x("div",{className:q(["order-create-return",a]),children:[r(Z,{title:f.headerText}),O.heading?r(D,{className:"order-create-return_notification",variant:"secondary","data-testid":"orderCreateReturnNotification",...O}):null,E[L]]})};export{He as CreateReturn,He as default}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderProductList.js b/scripts/__dropins__/storefront-order/containers/OrderProductList.js index d3c7d3b85a..c2c9411c76 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderProductList.js +++ b/scripts/__dropins__/storefront-order/containers/OrderProductList.js @@ -1 +1 @@ -import{jsx as i,jsxs as T}from"@dropins/tools/preact-jsx-runtime.js";import{Card as S,Header as N}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as b}from"@dropins/tools/lib.js";import{useState as C,useEffect as x,useMemo as k}from"@dropins/tools/preact-hooks.js";import{events as v}from"@dropins/tools/event-bus.js";import{s as G}from"../chunks/setTaxStatus.js";import{g as j}from"../chunks/getStoreConfig.js";import{Fragment as q}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as y}from"../chunks/returnOrdersHelper.js";import{O as w}from"../chunks/OrderLoaders.js";import{C as E}from"../chunks/CartSummaryItem.js";import{useText as F}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const _=({orderData:l})=>{const[a,t]=C(!0),[u,c]=C(l),[m,d]=C({taxIncluded:!1,taxExcluded:!1});return x(()=>{j().then(e=>{if(e){const n=G(e==null?void 0:e.shoppingCartDisplayPrice);d(n)}}).finally(()=>{t(!1)})},[]),x(()=>{const e=v.on("order/data",n=>{c(n)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:a,taxConfig:m,order:u}},$=({loading:l,taxConfig:a,order:t=null,withHeader:u=!0,showConfigurableOptions:c,routeProductDetails:m})=>{const d=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,n=F({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),g=k(()=>{var p,f;if(!t)return[];if(!d){const r=((p=y(t))==null?void 0:p.modifyOrder)??[],O=((f=y(t))==null?void 0:f.returnedList)??[],h=r==null?void 0:r.filter(o=>o.quantityCanceled),I=r==null?void 0:r.filter(o=>!o.quantityCanceled);return[{type:"returned",list:O,title:n.returned},{type:"cancelled",list:h,title:n.cancelled},{type:"allItems",list:I,title:n.allOrders}].filter(o=>{var P;return((P=o==null?void 0:o.list)==null?void 0:P.length)>0})}const s=t.returns.find(r=>r.returnNumber===e);return[{type:"returned",list:(s==null?void 0:s.items)??[],title:n.returned}]},[t,d,n,e]);return t?g.every(s=>s.list.length===0)?null:i(S,{variant:"secondary",className:"order-order-product-list-content",children:g.map((s,L)=>{var f;const p=s.list.reduce((r,{totalQuantity:O})=>O+r,0);return T(q,{children:[u?i(N,{title:`${s.title} (${p})`}):null,i("ul",{className:"order-order-product-list-content__items",children:(f=s.list)==null?void 0:f.map(r=>i("li",{"data-testid":"order-product-list-content-item",children:i(E,{loading:l,product:r,itemType:s.type,taxConfig:a,translations:n,showConfigurableOptions:c,routeProductDetails:m})},r.id))})]},L)})}):i(w,{})},et=({className:l,orderData:a,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})=>{const{loading:m,taxConfig:d,order:e}=_({orderData:a});return i("div",{className:b(["order-order-product-list",l]),children:i($,{loading:m,taxConfig:d,order:e,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})})};export{et as OrderProductList,et as default}; +import{jsx as i,jsxs as h}from"@dropins/tools/preact-jsx-runtime.js";import{Card as T,Header as I}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as S}from"@dropins/tools/lib.js";import{useState as C,useEffect as x,useMemo as N}from"@dropins/tools/preact-hooks.js";import{events as b}from"@dropins/tools/event-bus.js";import{s as k}from"../chunks/setTaxStatus.js";import{g as v}from"../chunks/getStoreConfig.js";import{Fragment as G}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as j}from"../chunks/returnOrdersHelper.js";import{O as q}from"../chunks/OrderLoaders.js";import{C as w}from"../chunks/CartSummaryItem.js";import{useText as E}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const F=({orderData:a})=>{const[u,t]=C(!0),[c,m]=C(a),[f,d]=C({taxIncluded:!1,taxExcluded:!1});return x(()=>{v().then(e=>{if(e){const r=k(e==null?void 0:e.shoppingCartDisplayPrice);d(r)}}).finally(()=>{t(!1)})},[]),x(()=>{const e=b.on("order/data",r=>{m(r)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:u,taxConfig:f,order:c}},_=({loading:a,taxConfig:u,order:t=null,withHeader:c=!0,showConfigurableOptions:m,routeProductDetails:f})=>{const d=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,r=E({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),g=N(()=>{var p;if(!t)return[];if(!d){const{modifyOrder:s,returnedList:l}=j(t),O=s==null?void 0:s.filter(o=>o.quantityCanceled),y=(p=s??[])==null?void 0:p.filter(o=>!o.quantityCanceled);return[{type:"returned",list:l??[],title:r.returned},{type:"cancelled",list:O,title:r.cancelled},{type:"allItems",list:y,title:r.allOrders}].filter(o=>{var P;return((P=o==null?void 0:o.list)==null?void 0:P.length)>0})}const n=t.returns.find(s=>s.returnNumber===e);return[{type:"returned",list:(n==null?void 0:n.items)??[],title:r.returned}]},[t,d,r,e]);return t?g.every(n=>n.list.length===0)?null:i(T,{variant:"secondary",className:"order-order-product-list-content",children:g.map((n,L)=>{var s;const p=n.list.reduce((l,{totalQuantity:O})=>O+l,0);return h(G,{children:[c?i(I,{title:`${n.title} (${p})`}):null,i("ul",{className:"order-order-product-list-content__items",children:(s=n.list)==null?void 0:s.map(l=>i("li",{"data-testid":"order-product-list-content-item",children:i(w,{loading:a,product:l,itemType:n.type,taxConfig:u,translations:r,showConfigurableOptions:m,routeProductDetails:f})},l.id))})]},L)})}):i(q,{})},tt=({className:a,orderData:u,withHeader:t,showConfigurableOptions:c,routeProductDetails:m})=>{const{loading:f,taxConfig:d,order:e}=F({orderData:u});return i("div",{className:S(["order-order-product-list",a]),children:i(_,{loading:f,taxConfig:d,order:e,withHeader:t,showConfigurableOptions:c,routeProductDetails:m})})};export{tt as OrderProductList,tt as default}; diff --git a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js index 8700d1112c..4bd502bb1e 100644 --- a/scripts/__dropins__/storefront-order/containers/ShippingStatus.js +++ b/scripts/__dropins__/storefront-order/containers/ShippingStatus.js @@ -1 +1 @@ -import{jsx as i,jsxs as S,Fragment as _}from"@dropins/tools/preact-jsx-runtime.js";import{classes as $,VComponent as A,Slot as E}from"@dropins/tools/lib.js";import{Card as L,Header as w,Accordion as R,AccordionSection as V,ContentGrid as G,Image as q}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as x,useEffect as k}from"@dropins/tools/preact-hooks.js";import{events as D}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as nn}from"../chunks/useIsMobile.js";import{Text as B,useText as en}from"@dropins/tools/i18n.js";import{C as pn}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var M=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(M||{});const tn=({orderData:e})=>{const[s,n]=x(!0),[t,m]=x(e),[h,o]=x(!1);return k(()=>{const d=D.on("order/data",u=>{m(u),o(u==null?void 0:u.isVirtual),n(!1)},{eager:!0});return()=>{d==null||d.off()}},[]),{loading:s,order:t,isVirtualProduct:h}},Z=({value:e,variant:s="primary",size:n="medium",icon:t,className:m,children:h,disabled:o=!1,active:d=!1,activeChildren:u,activeIcon:p,href:C,...a})=>{let g="dropin-button";(t&&!h||t&&d&&!u||!t&&d&&p)&&(g="dropin-iconButton"),d&&u&&(g="dropin-button"),m=$([g,`${g}--${n}`,`${g}--${s}`,[`${g}--${s}--disabled`,o],h&&t&&`${g}--with-icon`,!h&&u&&t&&`${g}--with-icon`,d&&p&&`${g}--with-icon`,m]);const c=$(["dropin-button-icon",`dropin-button-icon--${s}`,[`dropin-button-icon--${s}--disabled`,o],t==null?void 0:t.props.className]),b=C?{node:i("a",{}),role:"link",href:C,...a,disabled:o,active:d,onKeyDown:I=>{o&&I.preventDefault()},tabIndex:o?-1:0}:{node:i("button",{}),role:"button",...a,value:e,disabled:o,active:d};return S(A,{...b,className:m,children:[t&&!d&&i(A,{node:t,className:c}),p&&d&&i(A,{node:p,className:c}),h&&!d&&(typeof h=="string"?i("span",{children:h}):h),d&&u&&(typeof u=="string"?i("span",{children:u}):u)]})},ln=({slots:e,collapseThreshold:s,translations:n,returnData:t,routeTracking:m,routeProductDetails:h})=>{var u;const o=nn(),d=h?"a":"span";return S(L,{variant:"secondary",className:$(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[i(w,{title:n.returnOrderCardTitle}),S("div",{children:[(u=t==null?void 0:t.tracking)==null?void 0:u.map((p,C)=>{var b,I;const a={title:"",number:(p==null?void 0:p.trackingNumber)??"",carrier:((b=p==null?void 0:p.carrier)==null?void 0:b.label)??""},g=m==null?void 0:m(a),c=g?()=>{window.open(g,"_blank","noreferrer")}:null;return S("div",{className:"order-shipping-status-card__header",children:[S("div",{children:[`${n.carrier} `,`${(I=a.carrier)==null?void 0:I.toLocaleUpperCase()} | `,a.number]}),c?i(Z,{onClick:c,children:n.trackButton}):null]},`${a.number}_${C}`)}),e!=null&&e.ReturnItemsDetails?i(E,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:t.items}}):null,i(R,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(V,{defaultOpen:s>=t.items.length,title:i(B,{id:"Order.ShippingStatusCard.itemText",plural:t.items.reduce((p,C)=>p+C.totalQuantity,0),fields:{count:t.items.reduce((p,C)=>p+C.totalQuantity,0)}}),children:i(G,{maxColumns:o?3:9,emptyGridContent:i(_,{}),className:$(["order-shipping-status-card__images",["order-shipping-status-card__images-3",o]]),children:t.items.map((p,C)=>{var c,b;const a=(c=p.thumbnail)==null?void 0:c.label,g=(b=p.thumbnail)==null?void 0:b.url;return i(d,{href:(h==null?void 0:h(p))??"#","data-testid":`${C}${p.uid}`,children:i(q,{alt:a,src:g,width:85,height:114})},`${C}${p.uid}`)})})})})]})]})},sn=({translations:e,slots:s,orderData:n,collapseThreshold:t=10,routeProductDetails:m,routeTracking:h})=>{var I,U,H,j,v,F,Q;const o=!!(n!=null&&n.returnNumber),d=n==null?void 0:n.returnNumber,u=m?"a":"span",p=(I=n==null?void 0:n.status)==null?void 0:I.toLocaleLowerCase(),a=((U=n==null?void 0:n.shipments)==null?void 0:U.length)===1&&(p==null?void 0:p.includes(M.COMPLETE)),g=(H=n==null?void 0:n.shipments)==null?void 0:H.every(l=>l.tracking.length===0),c=(j=n==null?void 0:n.items)==null?void 0:j.filter(l=>(l==null?void 0:l.quantityShipped)===0||(l==null?void 0:l.quantityShipped)<(l==null?void 0:l.quantityOrdered)),b=(v=n==null?void 0:n.items)==null?void 0:v.reduce((l,f)=>{const O=f.quantityOrdered-f.quantityShipped;return l+(O>0?O:0)},0);if(o&&(n!=null&&n.returns.length)){const l=n.returns.find(f=>f.returnNumber===d);return!l||l.tracking.length===0?null:i(ln,{slots:s,collapseThreshold:t,translations:e,returnData:l,routeTracking:h,routeProductDetails:m})}return!n||p!=null&&p.includes(M.CANCELED)?null:(F=n==null?void 0:n.shipments)!=null&&F.length?g&&!(c!=null&&c.length)&&a?null:S(_,{children:[(Q=n==null?void 0:n.shipments)==null?void 0:Q.map(({tracking:l,items:f,id:O},P)=>{const K=f.reduce((r,N)=>{var y;return(r??0)+(((y=N.orderItem)==null?void 0:y.quantityShipped)??0)},0);return S(L,{variant:"secondary",className:"order-shipping-status-card",children:[i(w,{title:e.shippingCardTitle}),l==null?void 0:l.map(r=>{var y;const N=h==null?void 0:h(r),T=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:[e.carrier," ",(y=r==null?void 0:r.carrier)==null?void 0:y.toLocaleUpperCase()," | ",r==null?void 0:r.number]}),i("p",{children:r==null?void 0:r.title})]}),s!=null&&s.DeliveryTrackActions?i(E,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:s==null?void 0:s.DeliveryTrackActions,context:{trackInformation:r}}):T?i(Z,{onClick:T,children:e.trackButton}):null]},r.number)}),a?null:i(R,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(V,{"data-position":P+1,defaultOpen:t>=(f==null?void 0:f.length),title:i(_,{children:i(B,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:K,fields:{count:K}})}),children:i(G,{maxColumns:6,emptyGridContent:i(_,{}),className:"order-shipping-status-card__images",children:f==null?void 0:f.map(r=>{var y,W,Y,z,J,X;const N=(Y=(W=(y=r==null?void 0:r.orderItem)==null?void 0:y.product)==null?void 0:W.thumbnail)==null?void 0:Y.label,T=(X=(J=(z=r==null?void 0:r.orderItem)==null?void 0:z.product)==null?void 0:J.thumbnail)==null?void 0:X.url;return i(u,{href:(m==null?void 0:m(r))??"#",children:i(q,{alt:N,src:T||"",width:85,height:114})},r.id)})})})}),s!=null&&s.DeliveryTimeLine?i(E,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:s==null?void 0:s.DeliveryTimeLine,context:{}}):null]},O)}),c!=null&&c.length?S(L,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[i(w,{title:e.notYetShippedTitle}),i(R,{actionIconPosition:"right",children:i(V,{defaultOpen:t>=(c==null?void 0:c.length),title:i(B,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:b,fields:{count:b}}),children:i(G,{maxColumns:6,emptyGridContent:i(_,{}),className:"order-shipping-status-card__images",children:c==null?void 0:c.map(l=>{var f,O;return i(u,{href:(m==null?void 0:m(l))??"#",children:i(q,{alt:(f=l.thumbnail)==null?void 0:f.label,src:((O=l.thumbnail)==null?void 0:O.url)||"",width:85,height:114})},l.id)})})})})]}):null]}):S(L,{variant:"secondary",className:"order-shipping-status-card",children:[i(w,{title:e.shippingInfoTitle}),i("div",{className:"order-shipping-status-card__header",children:S("div",{className:"order-shipping-status-card__header--content",children:[n!=null&&n.carrier?i("p",{children:n==null?void 0:n.carrier}):null,i("p",{children:e.noInfoTitle})]})})]})},an=({slots:e,className:s,collapseThreshold:n,orderData:t,routeOrderDetails:m,routeTracking:h,routeProductDetails:o})=>{const{loading:d,order:u,isVirtualProduct:p}=tn({orderData:t}),C=en({carrier:"Order.ShippingStatusCard.carrier",prepositionOf:"Order.ShippingStatusCard.prepositionOf",returnOrderCardTitle:"Order.ShippingStatusCard.returnOrderCardTitle",shippingCardTitle:"Order.ShippingStatusCard.shippingCardTitle",shippingInfoTitle:"Order.ShippingStatusCard.shippingInfoTitle",notYetShippedTitle:"Order.ShippingStatusCard.notYetShippedTitle",noInfoTitle:"Order.ShippingStatusCard.noInfoTitle",returnNumber:"Order.ShippingStatusCard.returnNumber",orderNumber:"Order.ShippingStatusCard.orderNumber",trackButton:"Order.ShippingStatusCard.trackButton"});return!d&&p?null:i("div",{className:$(["order-shipping-status",s]),children:!d&&u?i(sn,{translations:C,routeOrderDetails:m,routeTracking:h,slots:e,orderData:u,collapseThreshold:n,routeProductDetails:o}):i(pn,{withCard:!1})})};export{an as ShippingStatus,an as default}; +import{jsx as i,jsxs as S,Fragment as _}from"@dropins/tools/preact-jsx-runtime.js";import{classes as $,VComponent as A,Slot as E}from"@dropins/tools/lib.js";import{Card as L,Header as w,Accordion as R,AccordionSection as G,ContentGrid as V,Image as q}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{useState as x,useEffect as k}from"@dropins/tools/preact-hooks.js";import{events as D}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{u as nn}from"../chunks/useIsMobile.js";import{Text as B,useText as en}from"@dropins/tools/i18n.js";import{C as pn}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact-compat.js";var M=(e=>(e.PENDING="pending",e.SHIPPING="shipping",e.COMPLETE="complete",e.PROCESSING="processing",e.HOLD="on hold",e.CANCELED="Canceled",e.SUSPECTED_FRAUD="suspected fraud",e.PAYMENT_REVIEW="payment review",e))(M||{});const tn=({orderData:e})=>{const[r,n]=x(!0),[t,m]=x(e),[h,o]=x(!1);return k(()=>{const d=D.on("order/data",u=>{m(u),o(u==null?void 0:u.isVirtual),n(!1)},{eager:!0});return()=>{d==null||d.off()}},[]),{loading:r,order:t,isVirtualProduct:h}},Z=({value:e,variant:r="primary",size:n="medium",icon:t,className:m,children:h,disabled:o=!1,active:d=!1,activeChildren:u,activeIcon:p,href:C,...b})=>{let g="dropin-button";(t&&!h||t&&d&&!u||!t&&d&&p)&&(g="dropin-iconButton"),d&&u&&(g="dropin-button"),m=$([g,`${g}--${n}`,`${g}--${r}`,[`${g}--${r}--disabled`,o],h&&t&&`${g}--with-icon`,!h&&u&&t&&`${g}--with-icon`,d&&p&&`${g}--with-icon`,m]);const c=$(["dropin-button-icon",`dropin-button-icon--${r}`,[`dropin-button-icon--${r}--disabled`,o],t==null?void 0:t.props.className]),a=C?{node:i("a",{}),role:"link",href:C,...b,disabled:o,active:d,onKeyDown:y=>{o&&y.preventDefault()},tabIndex:o?-1:0}:{node:i("button",{}),role:"button",...b,value:e,disabled:o,active:d};return S(A,{...a,className:m,children:[t&&!d&&i(A,{node:t,className:c}),p&&d&&i(A,{node:p,className:c}),h&&!d&&(typeof h=="string"?i("span",{children:h}):h),d&&u&&(typeof u=="string"?i("span",{children:u}):u)]})},sn=({slots:e,collapseThreshold:r,translations:n,returnData:t,routeTracking:m,routeProductDetails:h})=>{var u;const o=nn(),d=h?"a":"span";return S(L,{variant:"secondary",className:$(["order-shipping-status-card","order-shipping-status-card--return-order"]),children:[i(w,{title:n.returnOrderCardTitle}),S("div",{children:[(u=t==null?void 0:t.tracking)==null?void 0:u.map((p,C)=>{var a,y;const b={title:"",number:(p==null?void 0:p.trackingNumber)??"",carrier:((a=p==null?void 0:p.carrier)==null?void 0:a.label)??""},g=m==null?void 0:m(b),c=g?()=>{window.open(g,"_blank","noreferrer")}:null;return S("div",{className:"order-shipping-status-card__header",children:[S("div",{children:[`${n.carrier} `,`${(y=b.carrier)==null?void 0:y.toLocaleUpperCase()} | `,b.number]}),c?i(Z,{onClick:c,children:n.trackButton}):null]},`${b.number}_${C}`)}),e!=null&&e.ReturnItemsDetails?i(E,{"data-testid":"returnItemsDetails",name:"ReturnItemsDetails",slot:e==null?void 0:e.ReturnItemsDetails,context:{items:t.items}}):null,i(R,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(G,{defaultOpen:r>=t.items.length,title:i(B,{id:"Order.ShippingStatusCard.itemText",plural:t.items.reduce((p,C)=>p+C.totalQuantity,0),fields:{count:t.items.reduce((p,C)=>p+C.totalQuantity,0)}}),children:i(V,{maxColumns:o?3:9,emptyGridContent:i(_,{}),className:$(["order-shipping-status-card__images",["order-shipping-status-card__images-3",o]]),children:t.items.map((p,C)=>{var c,a;const b=(c=p.thumbnail)==null?void 0:c.label,g=(a=p.thumbnail)==null?void 0:a.url;return i(d,{href:(h==null?void 0:h(p))??"#","data-testid":`${C}${p.uid}`,children:i(q,{alt:b,src:g,width:85,height:114})},`${C}${p.uid}`)})})})})]})]})},rn=({translations:e,slots:r,orderData:n,collapseThreshold:t=10,routeProductDetails:m,routeTracking:h})=>{var y,U,H,j,v,F,Q;const o=!!(n!=null&&n.returnNumber),d=n==null?void 0:n.returnNumber,u=m?"a":"span",p=(y=n==null?void 0:n.status)==null?void 0:y.toLocaleLowerCase(),b=((U=n==null?void 0:n.shipments)==null?void 0:U.length)===1&&(p==null?void 0:p.includes(M.COMPLETE)),g=(H=n==null?void 0:n.shipments)==null?void 0:H.every(s=>s.tracking.length===0),c=(j=n==null?void 0:n.items)==null?void 0:j.filter(s=>(s==null?void 0:s.quantityShipped)===0||(s==null?void 0:s.quantityShipped)<(s==null?void 0:s.quantityOrdered)),a=(v=n==null?void 0:n.items)==null?void 0:v.reduce((s,f)=>{const I=f.quantityOrdered-f.quantityShipped;return s+(I>0?I:0)},0);if(o&&(n!=null&&n.returns.length)){const s=n.returns.find(f=>f.returnNumber===d);return!s||s.tracking.length===0?null:i(sn,{slots:r,collapseThreshold:t,translations:e,returnData:s,routeTracking:h,routeProductDetails:m})}return!n||p!=null&&p.includes(M.CANCELED)?null:(F=n==null?void 0:n.shipments)!=null&&F.length?g&&!(c!=null&&c.length)&&b?null:S(_,{children:[(Q=n==null?void 0:n.shipments)==null?void 0:Q.map(({tracking:s,items:f,id:I},P)=>{const K=f.reduce((l,N)=>{var O;return l+(((O=N.orderItem)==null?void 0:O.quantityShipped)??0)},0);return S(L,{variant:"secondary",className:"order-shipping-status-card",children:[i(w,{title:e.shippingCardTitle}),s==null?void 0:s.map(l=>{var T;const N=h==null?void 0:h(l),O=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:[e.carrier," ",(T=l==null?void 0:l.carrier)==null?void 0:T.toLocaleUpperCase()," | ",l==null?void 0:l.number]}),i("p",{children:l==null?void 0:l.title})]}),r!=null&&r.DeliveryTrackActions?i(E,{"data-testid":"deliverySlotActions",name:"DeliveryTrackActions",slot:r==null?void 0:r.DeliveryTrackActions,context:{trackInformation:l}}):O?i(Z,{onClick:O,children:e.trackButton}):null]},l.number)}),b?null:i(R,{actionIconPosition:"right","data-testid":"dropinAccordion",children:i(G,{"data-position":P+1,defaultOpen:t>=(f==null?void 0:f.length),title:i(_,{children:i(B,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:K,fields:{count:K}})}),children:i(V,{maxColumns:6,emptyGridContent:i(_,{}),className:"order-shipping-status-card__images",children:f==null?void 0:f.map(l=>{var T,W,Y,z,J,X;const N=(Y=(W=(T=l==null?void 0:l.orderItem)==null?void 0:T.product)==null?void 0:W.thumbnail)==null?void 0:Y.label,O=(X=(J=(z=l==null?void 0:l.orderItem)==null?void 0:z.product)==null?void 0:J.thumbnail)==null?void 0:X.url;return i(u,{href:(m==null?void 0:m(l))??"#",children:i(q,{alt:N,src:O||"",width:85,height:114})},l.id)})})})}),r!=null&&r.DeliveryTimeLine?i(E,{"data-testid":"deliverySlotTimeLine",name:"DeliveryTimeLine",slot:r==null?void 0:r.DeliveryTimeLine,context:{}}):null]},I)}),c!=null&&c.length?S(L,{variant:"secondary",className:"order-shipping-status-card","data-testid":"dropinAccordionNotYetShipped2",children:[i(w,{title:e.notYetShippedTitle}),i(R,{actionIconPosition:"right",children:i(G,{defaultOpen:t>=(c==null?void 0:c.length),title:i(B,{id:"Order.ShippingStatusCard.notYetShippedImagesTitle",plural:a,fields:{count:a}}),children:i(V,{maxColumns:6,emptyGridContent:i(_,{}),className:"order-shipping-status-card__images",children:c==null?void 0:c.map(s=>{var f,I;return i(u,{href:(m==null?void 0:m(s))??"#",children:i(q,{alt:(f=s.thumbnail)==null?void 0:f.label,src:((I=s.thumbnail)==null?void 0:I.url)||"",width:85,height:114})},s.id)})})})})]}):null]}):S(L,{variant:"secondary",className:"order-shipping-status-card",children:[i(w,{title:e.shippingInfoTitle}),i("div",{className:"order-shipping-status-card__header",children:S("div",{className:"order-shipping-status-card__header--content",children:[n!=null&&n.carrier?i("p",{children:n==null?void 0:n.carrier}):null,i("p",{children:e.noInfoTitle})]})})]})},bn=({slots:e,className:r,collapseThreshold:n,orderData:t,routeOrderDetails:m,routeTracking:h,routeProductDetails:o})=>{const{loading:d,order:u,isVirtualProduct:p}=tn({orderData:t}),C=en({carrier:"Order.ShippingStatusCard.carrier",prepositionOf:"Order.ShippingStatusCard.prepositionOf",returnOrderCardTitle:"Order.ShippingStatusCard.returnOrderCardTitle",shippingCardTitle:"Order.ShippingStatusCard.shippingCardTitle",shippingInfoTitle:"Order.ShippingStatusCard.shippingInfoTitle",notYetShippedTitle:"Order.ShippingStatusCard.notYetShippedTitle",noInfoTitle:"Order.ShippingStatusCard.noInfoTitle",returnNumber:"Order.ShippingStatusCard.returnNumber",orderNumber:"Order.ShippingStatusCard.orderNumber",trackButton:"Order.ShippingStatusCard.trackButton"});return!d&&p?null:i("div",{className:$(["order-shipping-status",r]),children:!d&&u?i(rn,{translations:C,routeOrderDetails:m,routeTracking:h,slots:e,orderData:u,collapseThreshold:n,routeProductDetails:o}):i(pn,{withCard:!1})})};export{bn as ShippingStatus,bn as default}; diff --git a/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts b/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts index bd92ba7964..fea2010f22 100644 --- a/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts +++ b/scripts/__dropins__/storefront-order/data/transforms/transform-attributes-form.d.ts @@ -2,6 +2,6 @@ import { AttributesListItems, ResponseAttributesFormItemsProps } from '../../typ import { AttributesFormModel } from '../models'; export declare const cloneArrayIfExists: (fields: ResponseAttributesFormItemsProps[]) => any; -export declare const transformAttributesForm: (response: ResponseAttributesFormItemsProps[] | AttributesListItems[] | [ +export declare const transformAttributesForm: (items?: ResponseAttributesFormItemsProps[] | AttributesListItems[] | [ ]) => AttributesFormModel[]; //# sourceMappingURL=transform-attributes-form.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 51b2ca093a..c5cb1aad20 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731441153786} \ No newline at end of file +{"at":1731441681135} \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/render.js b/scripts/__dropins__/storefront-order/render.js index e0fff43820..8f67b48fa7 100644 --- a/scripts/__dropins__/storefront-order/render.js +++ b/scripts/__dropins__/storefront-order/render.js @@ -1,3 +1,3 @@ (function(n,e){try{if(typeof document<"u"){const r=document.createElement("style"),a=e.styleId;for(const t in e.attributes)r.setAttribute(t,e.attributes[t]);r.setAttribute("data-dropin",a),r.appendChild(document.createTextNode(n));const o=document.querySelector('style[data-dropin="sdk"]');if(o)o.after(r);else{const t=document.querySelector('link[rel="stylesheet"], style');t?t.before(r):document.head.append(r)}}}catch(r){console.error("dropin-styles (injectCodeFunction)",r)}})(`.dropin-button,.dropin-iconButton{border:0 none;cursor:pointer;white-space:normal}.dropin-button{border-radius:var(--shape-border-radius-3);font-size:var(--type-button-1-font);font-weight:var(--type-button-1-font);padding:var(--spacing-xsmall) var(--spacing-medium);display:flex;justify-content:center;align-items:center;text-align:left;word-wrap:break-word}.dropin-iconButton{height:var(--spacing-xbig);width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button:disabled,.dropin-iconButton:disabled{pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button:not(:disabled),.dropin-iconButton:not(:disabled){cursor:pointer}.dropin-button:focus,.dropin-iconButton:focus{outline:none}.dropin-button:focus-visible,.dropin-iconButton:focus-visible{outline:var(--spacing-xxsmall) solid var(--color-button-focus)}.dropin-button--primary,a.dropin-button--primary,.dropin-iconButton--primary{border:none;background:var(--color-brand-500) 0 0% no-repeat padding-box;color:var(--color-neutral-50);text-align:left;margin-right:0}.dropin-iconButton--primary{border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button--primary--disabled,a.dropin-button--primary--disabled,.dropin-iconButton--primary--disabled{background:var(--color-neutral-300) 0 0% no-repeat padding-box;color:var(--color-neutral-500);fill:var(--color-neutral-300);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--primary:hover,a.dropin-button--primary:hover,.dropin-iconButton--primary:hover,.dropin-button--primary:focus:hover,.dropin-iconButton--primary:focus:hover{background-color:var(--color-button-hover);text-decoration:none}.dropin-button--primary:focus,.dropin-iconButton--primary:focus{background-color:var(--color-brand-500)}.dropin-button--primary:hover:active,.dropin-iconButton--primary:hover:active{background-color:var(--color-button-active)}.dropin-button--secondary,a.dropin-button--secondary,.dropin-iconButton--secondary{border:var(--shape-border-width-2) solid var(--color-brand-500);background:none 0 0% no-repeat padding-box;color:var(--color-brand-500);padding-top:calc(var(--spacing-xsmall) - var(--shape-border-width-2));padding-left:calc(var(--spacing-medium) - var(--shape-border-width-2))}.dropin-iconButton--secondary{border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall);padding-top:calc(var(--spacing-xsmall) - var(--shape-border-width-2));padding-left:calc(var(--spacing-xsmall) - var(--shape-border-width-2))}.dropin-button--secondary--disabled,a.dropin-button--secondary--disabled,.dropin-iconButton--secondary--disabled{border:var(--shape-border-width-2) solid var(--color-neutral-300);background:none 0 0% no-repeat padding-box;color:var(--color-neutral-500);fill:var(--color-neutral-300);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--secondary:hover,a.dropin-button--secondary:hover,.dropin-iconButton--secondary:hover{border:var(--shape-border-width-2) solid var(--color-button-hover);color:var(--color-button-hover);text-decoration:none}.dropin-button--secondary:active,.dropin-iconButton--secondary:active{border:var(--shape-border-width-2) solid var(--color-button-active);color:var(--color-button-active)}.dropin-button--tertiary,a.dropin-button--tertiary,.dropin-iconButton--tertiary{border:none;background:none 0 0% no-repeat padding-box;color:var(--color-brand-500)}.dropin-iconButton--tertiary{border:none;border-radius:var(--spacing-xbig);min-height:var(--spacing-xbig);min-width:var(--spacing-xbig);padding:var(--spacing-xsmall)}.dropin-button--tertiary--disabled,a.dropin-button--tertiary--disabled,.dropin-iconButton--tertiary--disabled{border:none;color:var(--color-neutral-500);pointer-events:none;-webkit-user-select:none;user-select:none}.dropin-button--tertiary:hover,a.dropin-button--tertiary:hover,.dropin-iconButton--tertiary:hover{color:var(--color-button-hover);text-decoration:none}.dropin-button--tertiary:active,.dropin-iconButton--tertiary:active{color:var(--color-button-active)}.dropin-button--tertiary:focus-visible,.dropin-iconButton--tertiary:focus-visible{-webkit-box-shadow:inset 0 0 0 2px var(--color-neutral-800);-moz-box-shadow:inset 0 0 0 2px var(--color-neutral-800);box-shadow:inset 0 0 0 2px var(--color-neutral-800)}.dropin-button--large{font:var(--type-button-1-font);letter-spacing:var(--type-button-1-letter-spacing)}.dropin-button--medium{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.dropin-button-icon{height:24px}.dropin-button--with-icon{column-gap:var(--spacing-xsmall);row-gap:var(--spacing-xsmall)} -.order-order-search-form{gap:var(--spacing-small);border-color:transparent}.order-order-search-form .dropin-card__content{padding:var(--spacing-big) var(--spacing-xxbig) var(--spacing-xxbig) var(--spacing-xxbig)}.order-order-search-form p{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.order-order-search-form__title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin:0}.order-order-search-form__wrapper{display:grid;grid-template-columns:1fr;grid-template-rows:auto;grid-template-areas:"email" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}`,{styleId:"order"}); +.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" "postcode" "number" "button";gap:var(--spacing-medium)}.order-order-search-form__wrapper__item--email{grid-area:email}.order-order-search-form__wrapper__item--postcode{grid-area:postcode}.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 postcode" "number number" "button button"}}.order-order-status-content .dropin-card__content{gap:0}.order-order-status-content__wrapper .order-order-status-content__wrapper-description p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-order-status-content__wrapper-description{margin-bottom:var(--spacing-medium)}.order-order-status-content__wrapper-description--actions-slot{margin-bottom:0}.order-shipping-status-card .dropin-card__content{gap:0}.order-shipping-status-card--count-steper{font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-shipping-status-card__header{display:grid;grid-template-columns:1fr auto;justify-items:self-start;align-items:center;margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card__header button{max-height:40px}.order-shipping-status-card__header--content p,.order-shipping-status-card--return-order p{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-xsmall)}.order-shipping-status-card--return-order p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-shipping-status-card--return-order p a:hover{text-decoration:none;color:var(--color-brand-800)}.order-shipping-status-card .order-shipping-status-card__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-shipping-status-card.order-shipping-status-card--return-order .dropin-content-grid.order-shipping-status-card__images{overflow:auto!important}.order-shipping-status-card .order-shipping-status-card__images img{object-fit:contain;width:85px;height:114px}.order-order-loaders--card-loader{margin-bottom:var(--spacing-small)}.order-order-actions__wrapper{display:flex;justify-content:space-between;gap:0 var(--spacing-small);margin-bottom:var(--spacing-small);margin-top:var(--spacing-medium)}.order-order-actions__wrapper button{width:100%;font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing);cursor:pointer}.order-order-actions__wrapper--empty{display:none}.order-customer-details-content .dropin-card__content{gap:0}.order-customer-details-content__container{display:block;flex-direction:column}.order-customer-details-content__container-shipping_address,.order-customer-details-content__container-billing_address{margin:var(--spacing-medium) 0}@media (min-width: 768px){.order-customer-details-content__container{display:grid;grid-template-columns:auto;grid-template-rows:auto auto auto;grid-auto-flow:row}.order-customer-details-content__container-email{grid-area:1 / 1 / 2 / 2}.order-customer-details-content__container--no-margin p{margin-bottom:0}.order-customer-details-content__container-shipping_address{grid-area:2 / 1 / 3 / 2;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address,.order-customer-details-content__container-return-information{grid-area:2 / 2 / 3 / 3;margin:var(--spacing-medium) 0}.order-customer-details-content__container-billing_address--fullwidth{grid-area:2 / 1 / 3 / 3}.order-customer-details-content__container-shipping_methods{grid-area:3 / 1 / 4 / 2}.order-customer-details-content__container-payment_methods{grid-area:3 / 2 / 4 / 3}.order-customer-details-content__container-payment_methods--fullwidth{grid-area:3 / 1 / 4 / 3}}.order-customer-details-content__container-title{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing);margin:0 0 var(--spacing-xsmall) 0}.order-customer-details-content__container p{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:0}.order-customer-details-content__container-payment_methods p{display:grid;gap:0;grid-template-columns:auto 1fr}.order-customer-details-content__container-payment_methods p.order-customer-details-content__container-payment_methods--icon{gap:0 var(--spacing-xsmall)}.order-customer-details-content__container-description p{margin:0 var(--spacing-xsmall) 0 0;line-height:var(--spacing-big);padding:0}.order-customer-details-content__container-description p:nth-child(1),.order-customer-details-content__container-description p:nth-child(3),.order-customer-details-content__container-description p:nth-child(4),.order-customer-details-content__container-description p:nth-child(6){float:left}.order-customer-details-content__container-return-information .order-customer-details-content__container-description p{float:none;display:block}.order-empty-list{margin-bottom:var(--spacing-small)}.order-empty-list.order-empty-list--minified,.order-empty-list .dropin-card{border:none}.order-empty-list .dropin-card__content{gap:0;padding:var(--spacing-xxbig)}.order-empty-list.order-empty-list--minified .dropin-card__content{flex-direction:row;align-items:center;padding:var(--spacing-big) var(--spacing-small)}.order-empty-list .dropin-card__content svg{width:64px;height:64px;margin-bottom:var(--spacing-medium)}.order-empty-list.order-empty-list--minified .dropin-card__content svg{margin:0 var(--spacing-small) 0 0;width:32px;height:32px}.order-empty-list .dropin-card__content svg path{fill:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list--empty-box .dropin-card__content svg path{fill:var(--color-neutral-500)}.order-empty-list .dropin-card__content p{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800)}.order-empty-list.order-empty-list--minified .dropin-card__content p{font:var(--type-body-1-strong-font);color:var(--color-neutral-800)}.order-returns-list-content .order-returns__header--minified{margin-bottom:var(--spacing-small)}.order-returns-list-content .order-returns__header--full-size{margin-bottom:0}.order-returns-list-content__cards-list{margin-bottom:var(--spacing-small)}.order-returns-list-content__cards-list .dropin-card__content{gap:0}.order-returns-list-content__cards-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:0px 0px;grid-template-areas:"descriptions descriptions actions" "images images actions"}.order-returns-list-content__descriptions{grid-area:descriptions}.order-returns-list-content__descriptions p{margin:0 0 var(--spacing-small) 0;padding:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);color:var(--color-neutral-800)}.order-returns-list-content__descriptions p a{display:inline-block;font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing);color:var(--color-brand-800)}.order-returns-list-content__descriptions p a:hover{color:var(--color-brand-800)}.order-returns-list-content__descriptions .order-returns-list-content__return-status{font:var(--type-button-2-font);font-weight:500;color:var(--color-neutral-800)}.order-returns-list-content .order-returns-list-content__actions{margin:0;padding:0;border:none;background-color:transparent;cursor:pointer;text-decoration:none}.order-returns-list-content .order-returns-list-content__actions:hover{text-decoration:none;color:var(--color-brand-500)}.order-returns-list-content__card .dropin-card__content{padding:var(--spacing-small) var(--spacing-medium)}.order-returns-list-content__card .order-returns-list-content__card-wrapper{display:flex;justify-content:space-between;align-items:center;color:var(--color-neutral-800);height:calc(88px - var(--spacing-small) * 2)}.order-returns-list-content__card-wrapper>p{font:var(--type-button-2-font);letter-spacing:var(--type-button-2-letter-spacing)}.order-returns-list-content__card-wrapper svg{color:var(--color-neutral-800)}.order-returns-list-content__images{margin-top:var(--spacing-small);grid-area:images}.order-returns-list-content__actions{grid-area:actions;align-self:center}.order-returns-list-content .order-returns-list-content__images{overflow:auto}.order-returns-list-content .order-returns-list-content__images .dropin-content-grid__content{grid-template-columns:repeat(6,max-content)!important}.order-returns-list-content .order-returns-list-content__images-3 .dropin-content-grid__content{grid-template-columns:repeat(3,max-content)!important}.order-returns-list-content .order-returns-list-content__images img{object-fit:contain;width:85px;height:114px}.order-order-product-list-content__items{display:grid;gap:var(--spacing-medium);list-style:none;margin:0 0 var(--spacing-medium) 0;padding:0}.order-order-product-list-content .dropin-card__content{gap:0}.order-order-product-list-content__items .dropin-card__content{gap:var(--spacing-xsmall)}.order-order-product-list-content .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-order-product-list-content .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}@media only screen and (min-width: 320px) and (max-width: 768px){.order-confirmation-cart-summary-item{margin-bottom:var(--spacing-medium)}}.order-cost-summary-content .dropin-card__content{gap:0}.order-cost-summary-content__description{margin-bottom:var(--spacing-xsmall)}.order-cost-summary-content__description .order-cost-summary-content__description--header,.order-cost-summary-content__description .order-cost-summary-content__description--subheader{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__description .order-cost-summary-content__description--header span{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-cost-summary-content__description--subheader{margin-top:var(--spacing-xxsmall)}.order-cost-summary-content__description--subheader span{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-brand-700)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader{display:flex;justify-content:flex-start;align-items:center;gap:0 var(--spacing-xxsmall)}.order-cost-summary-content__description--subtotal .order-cost-summary-content__description--subheader .dropin-price,.order-cost-summary-content__description--shipping .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-overline-font)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--header span:last-child{color:var(--color-alert-800)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child{display:flex;justify-content:flex-start;align-items:flex-end;gap:0 var(--spacing-xsmall)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader span:first-child span{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-neutral-700)}.order-cost-summary-content__description--discount .order-cost-summary-content__description--subheader .dropin-price{font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);color:var(--color-alert-800)}.order-cost-summary-content__description--total{margin-top:var(--spacing-medium)}.order-cost-summary-content__description--total .order-cost-summary-content__description--header span{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.order-cost-summary-content__accordion .dropin-accordion-section .dropin-accordion-section__content-container{gap:var(--spacing-small);margin:var(--spacing-small) 0}.order-cost-summary-content__accordion-row{display:flex;justify-content:space-between;align-items:center}.order-cost-summary-content__accordion-row p{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.order-cost-summary-content__accordion-row p:first-child{color:var(--color-neutral-700)}.order-cost-summary-content__accordion .order-cost-summary-content__accordion-row.order-cost-summary-content__accordion-total p:first-child{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .order-create-return_notification{margin-bottom:var(--spacing-medium)}.order-return-order-product-list{list-style:none;margin:0;padding:0}.order-return-order-product-list .order-return-order-product-list__item{display:grid;grid-template-columns:auto 1fr;align-items:start;margin-bottom:var(--spacing-medium);position:relative}.order-return-order-product-list__item--blur:before{content:"";position:absolute;width:100%;height:100%;background-color:var(--color-opacity-24);z-index:1}.order-return-order-product-list>.order-return-order-product-list__item:last-child{display:flex;justify-content:flex-end}.order-return-order-product-list>.order-return-order-product-list__item .dropin-cart-item__alert{margin-top:var(--spacing-xsmall)}.order-return-order-product-list>.order-return-order-product-list__item .cart-summary-item__title--strikethrough{text-decoration:line-through;color:var(--color-neutral-500);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.order-create-return .dropin-cart-item__footer .dropin-incrementer.dropin-incrementer--medium{max-width:160px}.order-return-order-product-list .dropin-incrementer__button-container{margin:0}@media only screen and (min-width: 320px) and (max-width: 768px){.order-return-order-product-list>.order-return-order-product-list__item{margin-bottom:var(--spacing-medium)}}.order-return-order-message p{margin:0;padding:0}.order-return-order-message .order-return-order-message__title{font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing);color:var(--color-neutral-800);margin-bottom:var(--spacing-small)}.order-return-order-message .order-return-order-message__subtitle{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-bottom:var(--spacing-xlarge)}.order-return-reason-form .dropin-cart-item,.order-return-reason-form form .dropin-field{margin-bottom:var(--spacing-medium)}.order-return-reason-form .order-return-reason-form__actions{display:flex;gap:0 var(--spacing-medium);justify-content:flex-end;margin-bottom:0}.order-order-cancel-reasons-form__text{text-align:left;color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel-reasons-form__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}.order-order-cancel__modal{margin:auto}.order-order-cancel__modal .dropin-modal__header{display:grid;grid-template-columns:1fr auto}.order-order-cancel__title{color:var(--color-neutral-900);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing)}.order-order-cancel__text{color:var(--color-neutral-800);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);padding-bottom:var(--spacing-xsmall)}.order-order-cancel__modal .dropin-modal__header-close-button{align-self:center}.order-order-cancel__button-container{display:grid;margin-top:var(--spacing-xbig);justify-content:end}@media only screen and (min-width: 768px){.dropin-modal__body--medium.order-order-cancel__modal>.dropin-modal__header-title{margin:0 var(--spacing-xxbig) var(--spacing-medium)}}`,{styleId:"order"}); import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{Render as n}from"@dropins/tools/lib.js";import{useState as s,useEffect as d}from"@dropins/tools/preact-hooks.js";import{UIProvider as l}from"@dropins/tools/components.js";import{events as c}from"@dropins/tools/event-bus.js";const u={CreateReturn:{headerText:"Return items",downloadableCount:"Files",returnedItems:"Returned items:",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",postcode:"Zip Code",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},ShippingStatusCard:{orderNumber:"Order number:",returnNumber:"Return number:",itemText:{none:"",one:"Package contents ({{count}} item)",many:"Package contents ({{count}} items)"},trackButton:"Track package",carrier:"Carrier:",prepositionOf:"of",returnOrderCardTitle:"Package details",shippingCardTitle:"Package details",shippingInfoTitle:"Shipping information",notYetShippedTitle:"Not yet shipped",notYetShippedImagesTitle:{singular:"Package contents ({{count}} item)",plural:"Package contents ({{count}} items)"}},OrderStatusContent:{noInfoTitle:"Check back later for more details.",returnMessage:"The order was placed on {ORDER_CREATE_DATE} and your return process started on {RETURN_CREATE_DATE}",returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},actions:{cancel:"Cancel order",createReturn:"Return or replace",createAnotherReturn:"Start another return",reorder:"Reorder"},orderPending:{title:"Pending",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderProcessing:{title:"Processing",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderOnHold:{title:"On hold",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderReceived:{title:"Order received",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},orderComplete:{title:"Complete",message:"Your order is complete. Need help with your order? Contact us at support@adobe.com"},orderCanceled:{title:"Canceled",message:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days.",messageWithoutDate:"This order was cancelled by you. You should see a refund to your original payment method with 5-7 business days."},orderSuspectedFraud:{title:"Suspected fraud",message:"We’ve run into an issue while processing your order on {DATE}. Please check back later or contact us at support@adobe.com for more information.",messageWithoutDate:"We’ve run into an issue while processing your order. Please check back later or contact us at support@adobe.com for more information."},orderPaymentReview:{title:"Payment Review",message:"The order was successfully placed on {DATE} and your order is processing. Check back for more details when your order ships.",messageWithoutDate:"Your order is processing. Check back for more details when your order ships."},guestOrderCancellationRequested:{title:"cancellation requested",message:"The cancellation has been requested on {DATE}. Check your email for further instructions.",messageWithoutDate:"The cancellation has been requested. Check your email for further instructions."}},CustomerDetails:{headerText:"Customer information",freeShipping:"Free shipping",orderReturnLabels:{createdReturnAt:"Return requested on: ",returnStatusLabel:"Return status: ",orderNumberLabel:"Order number: "},returnStatus:{pending:"Pending",authorized:"Authorized",partiallyAuthorized:"Partially authorized",received:"Received",partiallyReceived:"Partially received",approved:"Approved",partiallyApproved:"Partially approved",rejected:"Rejected",partiallyRejected:"Partially rejected",denied:"Denied",processedAndClosed:"Processed and closed",closed:"Closed"},email:{title:"Contact details"},shippingAddress:{title:"Shipping address"},shippingMethods:{title:"Shipping method"},billingAddress:{title:"Billing address"},paymentMethods:{title:"Payment method"},returnInformation:{title:"Return details"}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details."},OrderCancel:{buttonText:"Cancel Order"},OrderCancelForm:{title:"Cancel order",description:"Select a reason for canceling the order",label:"Reason for cancel",button:"Submit Cancellation",errorHeading:"Error",errorDescription:"There was an error processing your order cancellation."}},p={Order:u},m={default:p},h=({children:t})=>{const[o,i]=s("en_US");return d(()=>{const e=c.on("locale",a=>{i(a)},{eager:!0});return()=>{e==null||e.off()}},[]),r(l,{lang:o,langDefinitions:m,children:t})},T=new n(r(h,{}));export{T as render}; diff --git a/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts b/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts index b3b80df6bf..e7df546ad6 100644 --- a/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/api/getOrderDetails.types.d.ts @@ -246,6 +246,14 @@ export interface ErrorProps { message?: string; }[]; } +type GetOrderDetailsByParams = { + orderId?: string; + returnRef?: string; + queryType: T; + returnsPageSize: number; +}; +export interface GetOrderDetailsByIdProps extends GetOrderDetailsByParams { +} export interface OrdersResponse extends ErrorProps { data?: { customer?: { From 8d93122204a1466b664f475533e91c333ff3648a Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 12 Nov 2024 22:09:04 +0200 Subject: [PATCH 26/30] test bug? 10 --- .../__dropins__/storefront-order/containers/OrderProductList.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/containers/OrderProductList.js b/scripts/__dropins__/storefront-order/containers/OrderProductList.js index c2c9411c76..ddbebf15af 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderProductList.js +++ b/scripts/__dropins__/storefront-order/containers/OrderProductList.js @@ -1 +1 @@ -import{jsx as i,jsxs as h}from"@dropins/tools/preact-jsx-runtime.js";import{Card as T,Header as I}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as S}from"@dropins/tools/lib.js";import{useState as C,useEffect as x,useMemo as N}from"@dropins/tools/preact-hooks.js";import{events as b}from"@dropins/tools/event-bus.js";import{s as k}from"../chunks/setTaxStatus.js";import{g as v}from"../chunks/getStoreConfig.js";import{Fragment as G}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as j}from"../chunks/returnOrdersHelper.js";import{O as q}from"../chunks/OrderLoaders.js";import{C as w}from"../chunks/CartSummaryItem.js";import{useText as E}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const F=({orderData:a})=>{const[u,t]=C(!0),[c,m]=C(a),[f,d]=C({taxIncluded:!1,taxExcluded:!1});return x(()=>{v().then(e=>{if(e){const r=k(e==null?void 0:e.shoppingCartDisplayPrice);d(r)}}).finally(()=>{t(!1)})},[]),x(()=>{const e=b.on("order/data",r=>{m(r)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:u,taxConfig:f,order:c}},_=({loading:a,taxConfig:u,order:t=null,withHeader:c=!0,showConfigurableOptions:m,routeProductDetails:f})=>{const d=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,r=E({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),g=N(()=>{var p;if(!t)return[];if(!d){const{modifyOrder:s,returnedList:l}=j(t),O=s==null?void 0:s.filter(o=>o.quantityCanceled),y=(p=s??[])==null?void 0:p.filter(o=>!o.quantityCanceled);return[{type:"returned",list:l??[],title:r.returned},{type:"cancelled",list:O,title:r.cancelled},{type:"allItems",list:y,title:r.allOrders}].filter(o=>{var P;return((P=o==null?void 0:o.list)==null?void 0:P.length)>0})}const n=t.returns.find(s=>s.returnNumber===e);return[{type:"returned",list:(n==null?void 0:n.items)??[],title:r.returned}]},[t,d,r,e]);return t?g.every(n=>n.list.length===0)?null:i(T,{variant:"secondary",className:"order-order-product-list-content",children:g.map((n,L)=>{var s;const p=n.list.reduce((l,{totalQuantity:O})=>O+l,0);return h(G,{children:[c?i(I,{title:`${n.title} (${p})`}):null,i("ul",{className:"order-order-product-list-content__items",children:(s=n.list)==null?void 0:s.map(l=>i("li",{"data-testid":"order-product-list-content-item",children:i(w,{loading:a,product:l,itemType:n.type,taxConfig:u,translations:r,showConfigurableOptions:m,routeProductDetails:f})},l.id))})]},L)})}):i(q,{})},tt=({className:a,orderData:u,withHeader:t,showConfigurableOptions:c,routeProductDetails:m})=>{const{loading:f,taxConfig:d,order:e}=F({orderData:u});return i("div",{className:S(["order-order-product-list",a]),children:i(_,{loading:f,taxConfig:d,order:e,withHeader:t,showConfigurableOptions:c,routeProductDetails:m})})};export{tt as OrderProductList,tt as default}; +import{jsx as s,jsxs as h}from"@dropins/tools/preact-jsx-runtime.js";import{Card as y,Header as T}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as I}from"@dropins/tools/lib.js";import{useState as g,useEffect as x,useMemo as S}from"@dropins/tools/preact-hooks.js";import{events as N}from"@dropins/tools/event-bus.js";import{s as b}from"../chunks/setTaxStatus.js";import{g as k}from"../chunks/getStoreConfig.js";import{Fragment as v}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as G}from"../chunks/returnOrdersHelper.js";import{O as j}from"../chunks/OrderLoaders.js";import{C as q}from"../chunks/CartSummaryItem.js";import{useText as w}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const E=({orderData:a})=>{const[u,t]=g(!0),[c,m]=g(a),[f,l]=g({taxIncluded:!1,taxExcluded:!1});return x(()=>{k().then(e=>{if(e){const r=b(e==null?void 0:e.shoppingCartDisplayPrice);l(r)}}).finally(()=>{t(!1)})},[]),x(()=>{const e=N.on("order/data",r=>{m(r)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:u,taxConfig:f,order:c}},F=({loading:a,taxConfig:u,order:t=null,withHeader:c=!0,showConfigurableOptions:m,routeProductDetails:f})=>{const l=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,r=w({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),L=S(()=>{if(!t)return[];if(!l){const{modifyOrder:o,returnedList:p}=G(t);console.log("1 ---- returnedList ---- 1",p);const d=o==null?void 0:o.filter(i=>i.quantityCanceled),O=o==null?void 0:o.filter(i=>!i.quantityCanceled);return[{type:"returned",list:p,title:r.returned},{type:"cancelled",list:d,title:r.cancelled},{type:"allItems",list:O,title:r.allOrders}].filter(i=>{var P;return((P=i==null?void 0:i.list)==null?void 0:P.length)>0})}const n=t.returns.find(o=>o.returnNumber===e),C=n==null?void 0:n.items;return console.log("2 ---- returnItems ---- 2",C),[{type:"returned",list:C,title:r.returned}]},[t,l,r,e]);return t?L.every(n=>n.list.length===0)?null:s(y,{variant:"secondary",className:"order-order-product-list-content",children:L.map((n,C)=>{var p;const o=n.list.reduce((d,{totalQuantity:O})=>O+d,0);return h(v,{children:[c?s(T,{title:`${n.title} (${o})`}):null,s("ul",{className:"order-order-product-list-content__items",children:(p=n.list)==null?void 0:p.map(d=>s("li",{"data-testid":"order-product-list-content-item",children:s(q,{loading:a,product:d,itemType:n.type,taxConfig:u,translations:r,showConfigurableOptions:m,routeProductDetails:f})},d.id))})]},C)})}):s(j,{})},Z=({className:a,orderData:u,withHeader:t,showConfigurableOptions:c,routeProductDetails:m})=>{const{loading:f,taxConfig:l,order:e}=E({orderData:u});return s("div",{className:I(["order-order-product-list",a]),children:s(F,{loading:f,taxConfig:l,order:e,withHeader:t,showConfigurableOptions:c,routeProductDetails:m})})};export{Z as OrderProductList,Z as default}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index c5cb1aad20..761c39afbc 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731441681135} \ No newline at end of file +{"at":1731442114792} \ No newline at end of file From f5ebdd056ce01b5549f255f0b2fcdb25a16661ec Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 12 Nov 2024 22:14:06 +0200 Subject: [PATCH 27/30] test bug? 11 --- .../__dropins__/storefront-order/containers/OrderProductList.js | 2 +- scripts/__dropins__/storefront-order/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-order/containers/OrderProductList.js b/scripts/__dropins__/storefront-order/containers/OrderProductList.js index ddbebf15af..7cfd929e74 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderProductList.js +++ b/scripts/__dropins__/storefront-order/containers/OrderProductList.js @@ -1 +1 @@ -import{jsx as s,jsxs as h}from"@dropins/tools/preact-jsx-runtime.js";import{Card as y,Header as T}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as I}from"@dropins/tools/lib.js";import{useState as g,useEffect as x,useMemo as S}from"@dropins/tools/preact-hooks.js";import{events as N}from"@dropins/tools/event-bus.js";import{s as b}from"../chunks/setTaxStatus.js";import{g as k}from"../chunks/getStoreConfig.js";import{Fragment as v}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as G}from"../chunks/returnOrdersHelper.js";import{O as j}from"../chunks/OrderLoaders.js";import{C as q}from"../chunks/CartSummaryItem.js";import{useText as w}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const E=({orderData:a})=>{const[u,t]=g(!0),[c,m]=g(a),[f,l]=g({taxIncluded:!1,taxExcluded:!1});return x(()=>{k().then(e=>{if(e){const r=b(e==null?void 0:e.shoppingCartDisplayPrice);l(r)}}).finally(()=>{t(!1)})},[]),x(()=>{const e=N.on("order/data",r=>{m(r)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:u,taxConfig:f,order:c}},F=({loading:a,taxConfig:u,order:t=null,withHeader:c=!0,showConfigurableOptions:m,routeProductDetails:f})=>{const l=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,r=w({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),L=S(()=>{if(!t)return[];if(!l){const{modifyOrder:o,returnedList:p}=G(t);console.log("1 ---- returnedList ---- 1",p);const d=o==null?void 0:o.filter(i=>i.quantityCanceled),O=o==null?void 0:o.filter(i=>!i.quantityCanceled);return[{type:"returned",list:p,title:r.returned},{type:"cancelled",list:d,title:r.cancelled},{type:"allItems",list:O,title:r.allOrders}].filter(i=>{var P;return((P=i==null?void 0:i.list)==null?void 0:P.length)>0})}const n=t.returns.find(o=>o.returnNumber===e),C=n==null?void 0:n.items;return console.log("2 ---- returnItems ---- 2",C),[{type:"returned",list:C,title:r.returned}]},[t,l,r,e]);return t?L.every(n=>n.list.length===0)?null:s(y,{variant:"secondary",className:"order-order-product-list-content",children:L.map((n,C)=>{var p;const o=n.list.reduce((d,{totalQuantity:O})=>O+d,0);return h(v,{children:[c?s(T,{title:`${n.title} (${o})`}):null,s("ul",{className:"order-order-product-list-content__items",children:(p=n.list)==null?void 0:p.map(d=>s("li",{"data-testid":"order-product-list-content-item",children:s(q,{loading:a,product:d,itemType:n.type,taxConfig:u,translations:r,showConfigurableOptions:m,routeProductDetails:f})},d.id))})]},C)})}):s(j,{})},Z=({className:a,orderData:u,withHeader:t,showConfigurableOptions:c,routeProductDetails:m})=>{const{loading:f,taxConfig:l,order:e}=E({orderData:u});return s("div",{className:I(["order-order-product-list",a]),children:s(F,{loading:f,taxConfig:l,order:e,withHeader:t,showConfigurableOptions:c,routeProductDetails:m})})};export{Z as OrderProductList,Z as default}; +import{jsx as s,jsxs as h}from"@dropins/tools/preact-jsx-runtime.js";import{Card as y,Header as T}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as I}from"@dropins/tools/lib.js";import{useState as g,useEffect as x,useMemo as S}from"@dropins/tools/preact-hooks.js";import{events as N}from"@dropins/tools/event-bus.js";import{s as b}from"../chunks/setTaxStatus.js";import{g as k}from"../chunks/getStoreConfig.js";import{Fragment as v}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as G}from"../chunks/returnOrdersHelper.js";import{O as j}from"../chunks/OrderLoaders.js";import{C as q}from"../chunks/CartSummaryItem.js";import{useText as w}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const E=({orderData:d})=>{const[a,t]=g(!0),[u,c]=g(d),[m,l]=g({taxIncluded:!1,taxExcluded:!1});return x(()=>{k().then(e=>{if(e){const n=b(e==null?void 0:e.shoppingCartDisplayPrice);l(n)}}).finally(()=>{t(!1)})},[]),x(()=>{const e=N.on("order/data",n=>{c(n)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:a,taxConfig:m,order:u}},F=({loading:d,taxConfig:a,order:t=null,withHeader:u=!0,showConfigurableOptions:c,routeProductDetails:m})=>{const l=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,n=w({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),L=S(()=>{if(!t)return[];const{modifyOrder:r,returnedList:f}=G(t);if(!l){console.log("1 ---- returnedList ---- 1",f);const o=r==null?void 0:r.filter(i=>i.quantityCanceled),O=r==null?void 0:r.filter(i=>!i.quantityCanceled);return[{type:"returned",list:f,title:n.returned},{type:"cancelled",list:o,title:n.cancelled},{type:"allItems",list:O,title:n.allOrders}].filter(i=>{var P;return((P=i==null?void 0:i.list)==null?void 0:P.length)>0})}const p=t.returns.find(o=>o.returnNumber===e),C=p==null?void 0:p.items;return console.log("2 ---- returnItems ---- 2",C),[{type:"returned",list:f,title:n.returned}]},[t,l,n,e]);return t?L.every(r=>r.list.length===0)?null:s(y,{variant:"secondary",className:"order-order-product-list-content",children:L.map((r,f)=>{var C;const p=r.list.reduce((o,{totalQuantity:O})=>O+o,0);return h(v,{children:[u?s(T,{title:`${r.title} (${p})`}):null,s("ul",{className:"order-order-product-list-content__items",children:(C=r.list)==null?void 0:C.map(o=>s("li",{"data-testid":"order-product-list-content-item",children:s(q,{loading:d,product:o,itemType:r.type,taxConfig:a,translations:n,showConfigurableOptions:c,routeProductDetails:m})},o.id))})]},f)})}):s(j,{})},Z=({className:d,orderData:a,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})=>{const{loading:m,taxConfig:l,order:e}=E({orderData:a});return s("div",{className:I(["order-order-product-list",d]),children:s(F,{loading:m,taxConfig:l,order:e,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})})};export{Z as OrderProductList,Z as default}; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index 761c39afbc..e5df6d1851 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731442114792} \ No newline at end of file +{"at":1731442315052} \ No newline at end of file From f7c39d6ffe95cb9b306a439ac060213e5897c23a Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 12 Nov 2024 22:47:17 +0200 Subject: [PATCH 28/30] errors link --- blocks/commerce-returns-list/commerce-returns-list.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/blocks/commerce-returns-list/commerce-returns-list.js b/blocks/commerce-returns-list/commerce-returns-list.js index db7f57295e..755bacee7c 100644 --- a/blocks/commerce-returns-list/commerce-returns-list.js +++ b/blocks/commerce-returns-list/commerce-returns-list.js @@ -19,12 +19,17 @@ export default async function decorate(block) { 'minified-view': minifiedViewConfig = 'false', } = readBlockConfig(block); +console.log("21212121"); + if (!checkIsAuthenticated()) { window.location.href = CUSTOMER_LOGIN_PATH; } else { await orderRenderer.render(ReturnsList, { minifiedView: minifiedViewConfig === 'true', - routeReturnDetails: ({ orderNumber, returnNumber }) => `${CUSTOMER_RETURN_DETAILS_PATH}?orderRef=${orderNumber}&returnRef=${returnNumber}`, + routeReturnDetails: (props) => { + console.log('props', props); + return `${CUSTOMER_RETURN_DETAILS_PATH}?orderRef=${props?.orderNumber}&returnRef=${props?.returnNumber}` + }, routeOrderDetails: ({ orderNumber }) => `${CUSTOMER_ORDER_DETAILS_PATH}?orderRef=${orderNumber}`, routeReturnsList: () => CUSTOMER_RETURNS_PATH, routeProductDetails: (productData) => (productData ? `/products/${productData.product.urlKey}/${productData.product.sku}` : '#'), From fe0d224757507e55675b58815299048023b51331 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Tue, 12 Nov 2024 23:13:39 +0200 Subject: [PATCH 29/30] test bug? 13 --- .../getCustomerOrdersReturn.d.ts | 2 +- .../storefront-order/chunks/getCustomerOrdersReturn.js | 10 +++++----- .../storefront-order/containers/OrderProductList.js | 2 +- .../storefront-order/containers/ReturnsList.js | 2 +- .../hooks/containers/useReturnsList.d.ts | 3 ++- scripts/__dropins__/storefront-order/reload | 2 +- .../storefront-order/types/returnsList.types.d.ts | 4 +++- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/scripts/__dropins__/storefront-order/api/getCustomerOrdersReturn/getCustomerOrdersReturn.d.ts b/scripts/__dropins__/storefront-order/api/getCustomerOrdersReturn/getCustomerOrdersReturn.d.ts index d426ae440f..7c1c1f422a 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: () => Promise; +export declare const getCustomerOrdersReturn: (pageSize?: number) => Promise; //# sourceMappingURL=getCustomerOrdersReturn.d.ts.map \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js b/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js index e5c626a509..5397f567da 100644 --- a/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js +++ b/scripts/__dropins__/storefront-order/chunks/getCustomerOrdersReturn.js @@ -1,7 +1,7 @@ -import{h as R}from"./network-error.js";import{f as e,h as E}from"./fetch-graphql.js";import{R as _,P as T,a as o,G as s,O as c,t as u}from"./transform-order-details.js";const h=` -query GET_CUSTOMER_ORDERS_RETURN { +import{h as R}from"./network-error.js";import{f as E,h as _}from"./fetch-graphql.js";import{R as T,P as o,a as s,G as c,O as u,t as h}from"./transform-order-details.js";const n=` +query GET_CUSTOMER_ORDERS_RETURN($pageSize: Int) { customer { - returns { + returns(pageSize: $pageSize) { page_info { page_size total_pages @@ -11,9 +11,9 @@ query GET_CUSTOMER_ORDERS_RETURN { } } } -${_} ${T} ${o} ${s} ${c} -`,A=async()=>await e(h,{method:"GET",cache:"force-cache"}).then(r=>{var t,a;return(t=r.errors)!=null&&t.length?E(r.errors):u((a=r==null?void 0:r.data)==null?void 0:a.customer.returns)}).catch(R);export{A as g}; +${u} +`,G=async(e=50)=>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}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderProductList.js b/scripts/__dropins__/storefront-order/containers/OrderProductList.js index 7cfd929e74..7cf1388d4a 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderProductList.js +++ b/scripts/__dropins__/storefront-order/containers/OrderProductList.js @@ -1 +1 @@ -import{jsx as s,jsxs as h}from"@dropins/tools/preact-jsx-runtime.js";import{Card as y,Header as T}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as I}from"@dropins/tools/lib.js";import{useState as g,useEffect as x,useMemo as S}from"@dropins/tools/preact-hooks.js";import{events as N}from"@dropins/tools/event-bus.js";import{s as b}from"../chunks/setTaxStatus.js";import{g as k}from"../chunks/getStoreConfig.js";import{Fragment as v}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as G}from"../chunks/returnOrdersHelper.js";import{O as j}from"../chunks/OrderLoaders.js";import{C as q}from"../chunks/CartSummaryItem.js";import{useText as w}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const E=({orderData:d})=>{const[a,t]=g(!0),[u,c]=g(d),[m,l]=g({taxIncluded:!1,taxExcluded:!1});return x(()=>{k().then(e=>{if(e){const n=b(e==null?void 0:e.shoppingCartDisplayPrice);l(n)}}).finally(()=>{t(!1)})},[]),x(()=>{const e=N.on("order/data",n=>{c(n)},{eager:!0});return()=>{e==null||e.off()}},[]),{loading:a,taxConfig:m,order:u}},F=({loading:d,taxConfig:a,order:t=null,withHeader:u=!0,showConfigurableOptions:c,routeProductDetails:m})=>{const l=!!(t!=null&&t.returnNumber),e=t==null?void 0:t.returnNumber,n=w({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),L=S(()=>{if(!t)return[];const{modifyOrder:r,returnedList:f}=G(t);if(!l){console.log("1 ---- returnedList ---- 1",f);const o=r==null?void 0:r.filter(i=>i.quantityCanceled),O=r==null?void 0:r.filter(i=>!i.quantityCanceled);return[{type:"returned",list:f,title:n.returned},{type:"cancelled",list:o,title:n.cancelled},{type:"allItems",list:O,title:n.allOrders}].filter(i=>{var P;return((P=i==null?void 0:i.list)==null?void 0:P.length)>0})}const p=t.returns.find(o=>o.returnNumber===e),C=p==null?void 0:p.items;return console.log("2 ---- returnItems ---- 2",C),[{type:"returned",list:f,title:n.returned}]},[t,l,n,e]);return t?L.every(r=>r.list.length===0)?null:s(y,{variant:"secondary",className:"order-order-product-list-content",children:L.map((r,f)=>{var C;const p=r.list.reduce((o,{totalQuantity:O})=>O+o,0);return h(v,{children:[u?s(T,{title:`${r.title} (${p})`}):null,s("ul",{className:"order-order-product-list-content__items",children:(C=r.list)==null?void 0:C.map(o=>s("li",{"data-testid":"order-product-list-content-item",children:s(q,{loading:d,product:o,itemType:r.type,taxConfig:a,translations:n,showConfigurableOptions:c,routeProductDetails:m})},o.id))})]},f)})}):s(j,{})},Z=({className:d,orderData:a,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})=>{const{loading:m,taxConfig:l,order:e}=E({orderData:a});return s("div",{className:I(["order-order-product-list",d]),children:s(F,{loading:m,taxConfig:l,order:e,withHeader:t,showConfigurableOptions:u,routeProductDetails:c})})};export{Z as OrderProductList,Z as default}; +import{jsx as o,jsxs as L}from"@dropins/tools/preact-jsx-runtime.js";import{Card as P,Header as x}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as h}from"@dropins/tools/lib.js";import{useState as O,useEffect as g,useMemo as y}from"@dropins/tools/preact-hooks.js";import{events as T}from"@dropins/tools/event-bus.js";import{s as S}from"../chunks/setTaxStatus.js";import{g as I}from"../chunks/getStoreConfig.js";import{Fragment as k}from"@dropins/tools/preact.js";import"@dropins/tools/preact-compat.js";import{e as N}from"../chunks/returnOrdersHelper.js";import{O as b}from"../chunks/OrderLoaders.js";import{C as v}from"../chunks/CartSummaryItem.js";import{useText as G}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/form.types.js";const j=({orderData:s})=>{const[l,n]=O(!0),[a,c]=O(s),[u,d]=O({taxIncluded:!1,taxExcluded:!1});return g(()=>{I().then(t=>{if(t){const i=S(t==null?void 0:t.shoppingCartDisplayPrice);d(i)}}).finally(()=>{n(!1)})},[]),g(()=>{const t=T.on("order/data",i=>{c(i)},{eager:!0});return()=>{t==null||t.off()}},[]),{loading:l,taxConfig:u,order:a}},q=({loading:s,taxConfig:l,order:n=null,withHeader:a=!0,showConfigurableOptions:c,routeProductDetails:u})=>{const d=!!(n!=null&&n.returnNumber),t=G({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",returned:"Order.OrderProductListContent.returnedTitle",refunded:"Order.OrderProductListContent.refundedTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),i=y(()=>{if(!n)return[];const{modifyOrder:e,returnedList:m}=N(n);if(!d){const C=e==null?void 0:e.filter(r=>r.quantityCanceled),f=e==null?void 0:e.filter(r=>!r.quantityCanceled);return[{type:"returned",list:m,title:t.returned},{type:"cancelled",list:C,title:t.cancelled},{type:"allItems",list:f,title:t.allOrders}].filter(r=>{var p;return((p=r==null?void 0:r.list)==null?void 0:p.length)>0})}return[{type:"returned",list:m,title:t.returned}]},[n,d,t]);return n?i.every(e=>e.list.length===0)?null:o(P,{variant:"secondary",className:"order-order-product-list-content",children:i.map((e,m)=>{var f;const C=e.list.reduce((r,{totalQuantity:p})=>p+r,0);return L(k,{children:[a?o(x,{title:`${e.title} (${C})`}):null,o("ul",{className:"order-order-product-list-content__items",children:(f=e.list)==null?void 0:f.map(r=>o("li",{"data-testid":"order-product-list-content-item",children:o(v,{loading:s,product:r,itemType:e.type,taxConfig:l,translations:t,showConfigurableOptions:c,routeProductDetails:u})},r.id))})]},m)})}):o(b,{})},W=({className:s,orderData:l,withHeader:n,showConfigurableOptions:a,routeProductDetails:c})=>{const{loading:u,taxConfig:d,order:t}=j({orderData:l});return o("div",{className:h(["order-order-product-list",s]),children:o(q,{loading:u,taxConfig:d,order:t,withHeader:n,showConfigurableOptions:a,routeProductDetails:c})})};export{W as OrderProductList,W as default}; diff --git a/scripts/__dropins__/storefront-order/containers/ReturnsList.js b/scripts/__dropins__/storefront-order/containers/ReturnsList.js index 3cba825243..b2722d5fbb 100644 --- a/scripts/__dropins__/storefront-order/containers/ReturnsList.js +++ b/scripts/__dropins__/storefront-order/containers/ReturnsList.js @@ -1 +1 @@ -import{jsx as c}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as S}from"@dropins/tools/lib.js";import{useState as i,useEffect as $,useCallback as h}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as I}from"../chunks/getCustomerOrdersReturn.js";import"@dropins/tools/preact.js";import{u as y}from"../chunks/useIsMobile.js";import"@dropins/tools/preact-compat.js";import{R as A}from"../chunks/ReturnsListContent.js";import{useText as M}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";import"../chunks/returnOrdersHelper.js";import"../chunks/form.types.js";import"../chunks/OrderLoaders.js";const f={totalPages:1,currentPage:1,pageSize:1},T=()=>{const[s,n]=i(!0),[o,t]=i([]),[u,a]=i(f),[m,d]=i(1);$(()=>{I().then(r=>{t((r==null?void 0:r.ordersReturn)??[]),a((r==null?void 0:r.pageInfo)??f)}).finally(()=>{n(!1)})},[]);const l=h(r=>{d(r)},[]);return{pageInfo:u,selectedPage:m,loading:s,orderReturns:o,handleSetSelectPage:l}},X=({slots:s,withReturnsListButton:n,className:o,minifiedView:t,withHeader:u,withThumbnails:a,returnsInMinifiedView:m,routeReturnDetails:d,routeOrderDetails:l,routeTracking:r,routeReturnsList:g,routeProductDetails:p})=>{const{pageInfo:L,selectedPage:R,handleSetSelectPage:O,loading:b,orderReturns:P}=T(),w=y(),e=t?"minifiedView":"fullSizeView",N=M({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 c("div",{className:S(["order-returns-list",o]),children:c(A,{minifiedViewKey:e,withOrderNumber:!0,withReturnNumber:!0,slots:s,selectedPage:R,handleSetSelectPage:O,pageInfo:L,withReturnsListButton:n,isMobile:w,orderReturns:P,translations:N,withHeader:u,returnsInMinifiedView:m,withThumbnails:a,minifiedView:t,routeReturnDetails:d,routeOrderDetails:l,routeTracking:r,routeReturnsList:g,routeProductDetails:p,loading:b})})};export{X as default}; +import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{classes as h}from"@dropins/tools/lib.js";import{useState as n,useEffect as I,useCallback as S}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{g as y}from"../chunks/getCustomerOrdersReturn.js";import"@dropins/tools/preact.js";import{u as A}from"../chunks/useIsMobile.js";import"@dropins/tools/preact-compat.js";import{R as M}from"../chunks/ReturnsListContent.js";import{useText as T}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";import"../chunks/returnOrdersHelper.js";import"../chunks/form.types.js";import"../chunks/OrderLoaders.js";const p={totalPages:1,currentPage:1,pageSize:1},V=({returnPageSize:t})=>{const[o,u]=n(!0),[i,a]=n([]),[m,s]=n(p),[d,l]=n(1);I(()=>{y(t).then(r=>{a((r==null?void 0:r.ordersReturn)??[]),s((r==null?void 0:r.pageInfo)??p)}).finally(()=>{u(!1)})},[t]);const c=S(r=>{l(r)},[]);return{pageInfo:m,selectedPage:d,loading:o,orderReturns:i,handleSetSelectPage:c}},Y=({slots:t,withReturnsListButton:o,className:u,minifiedView:i,withHeader:a,withThumbnails:m,returnPageSize:s,returnsInMinifiedView:d,routeReturnDetails:l,routeOrderDetails:c,routeTracking:r,routeReturnsList:L,routeProductDetails:g})=>{const{pageInfo:R,selectedPage:O,handleSetSelectPage:b,loading:w,orderReturns:N}=V({returnPageSize:s}),P=A(),e=i?"minifiedView":"fullSizeView",$=T({viewAllOrdersButton:`Order.Returns.${e}.returnsList.viewAllOrdersButton`,ariaLabelLink:`Order.Returns.${e}.returnsList.ariaLabelLink`,emptyOrdersListMessage:`Order.Returns.${e}.returnsList.emptyOrdersListMessage`,minifiedViewTitle:`Order.Returns.${e}.returnsList.minifiedViewTitle`,orderNumber:`Order.Returns.${e}.returnsList.orderNumber`,returnNumber:`Order.Returns.${e}.returnsList.returnNumber`,carrier:`Order.Returns.${e}.returnsList.carrier`});return f("div",{className:h(["order-returns-list",u]),children:f(M,{returnPageSize:s,minifiedViewKey:e,withOrderNumber:!0,withReturnNumber:!0,slots:t,selectedPage:O,handleSetSelectPage:b,pageInfo:R,withReturnsListButton:o,isMobile:P,orderReturns:N,translations:$,withHeader:a,returnsInMinifiedView:d,withThumbnails:m,minifiedView:i,routeReturnDetails:l,routeOrderDetails:c,routeTracking:r,routeReturnsList:L,routeProductDetails:g,loading:w})})};export{Y as default}; diff --git a/scripts/__dropins__/storefront-order/hooks/containers/useReturnsList.d.ts b/scripts/__dropins__/storefront-order/hooks/containers/useReturnsList.d.ts index 5d6fff8d0a..1b11a83db8 100644 --- a/scripts/__dropins__/storefront-order/hooks/containers/useReturnsList.d.ts +++ b/scripts/__dropins__/storefront-order/hooks/containers/useReturnsList.d.ts @@ -1,6 +1,7 @@ import { OrdersReturnPropsModel } from '../../data/models'; +import { UseReturnsListProps } from '../../types'; -export declare const useReturnsList: () => { +export declare const useReturnsList: ({ returnPageSize }: UseReturnsListProps) => { pageInfo: { totalPages: number; currentPage: number; diff --git a/scripts/__dropins__/storefront-order/reload b/scripts/__dropins__/storefront-order/reload index e5df6d1851..14a13b5f7b 100644 --- a/scripts/__dropins__/storefront-order/reload +++ b/scripts/__dropins__/storefront-order/reload @@ -1 +1 @@ -{"at":1731442315052} \ No newline at end of file +{"at":1731445995222} \ No newline at end of file diff --git a/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts b/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts index 02bc1b5ed4..17cf40f211 100644 --- a/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts +++ b/scripts/__dropins__/storefront-order/types/returnsList.types.d.ts @@ -19,6 +19,7 @@ export interface ReturnsListProps { returnOrderItem: OrdersReturnPropsModel; }>; }; + returnPageSize?: number; withReturnsListButton?: boolean; returnsInMinifiedView?: number; className?: string; @@ -38,7 +39,7 @@ export interface ReturnsListProps { routeProductDetails?: (orderItem?: OrderItemModel) => string; withThumbnails?: boolean; } -export interface ReturnsListContentProps extends Omit { +export interface ReturnsListContentProps extends Omit { minifiedViewKey: 'minifiedView' | 'fullSizeView'; orderReturns?: OrdersReturnPropsModel[] | []; translations: Record; @@ -51,6 +52,7 @@ export interface ReturnsListContentProps extends Omit Date: Tue, 12 Nov 2024 23:14:11 +0200 Subject: [PATCH 30/30] test bug? 14 --- blocks/commerce-returns-list/commerce-returns-list.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/blocks/commerce-returns-list/commerce-returns-list.js b/blocks/commerce-returns-list/commerce-returns-list.js index 755bacee7c..48dab228ba 100644 --- a/blocks/commerce-returns-list/commerce-returns-list.js +++ b/blocks/commerce-returns-list/commerce-returns-list.js @@ -19,15 +19,12 @@ export default async function decorate(block) { 'minified-view': minifiedViewConfig = 'false', } = readBlockConfig(block); -console.log("21212121"); - if (!checkIsAuthenticated()) { window.location.href = CUSTOMER_LOGIN_PATH; } else { await orderRenderer.render(ReturnsList, { minifiedView: minifiedViewConfig === 'true', routeReturnDetails: (props) => { - console.log('props', props); return `${CUSTOMER_RETURN_DETAILS_PATH}?orderRef=${props?.orderNumber}&returnRef=${props?.returnNumber}` }, routeOrderDetails: ({ orderNumber }) => `${CUSTOMER_ORDER_DETAILS_PATH}?orderRef=${orderNumber}`,