From 29422915feca1c98e44f5ef42c957b98f7b73ef7 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Fri, 6 Dec 2024 14:25:30 +0200 Subject: [PATCH] test 6 --- .../__dropins__/storefront-order/chunks/returnOrdersHelper.js | 2 +- .../__dropins__/storefront-order/containers/OrderStatus.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js b/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js index 8676d96c0..3030f987d 100644 --- a/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js +++ b/scripts/__dropins__/storefront-order/chunks/returnOrdersHelper.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{g as p,F as o}from"./getFormValues.js";const d={PENDING:"pending",AUTHORIZED:"authorized",PARTIALLY_AUTHORIZED:"partiallyAuthorized",RECEIVED:"received",PARTIALLY_RECEIVED:"partiallyReceived",APPROVED:"approved",PARTIALLY_APPROVED:"partiallyApproved",REJECTED:"rejected",PARTIALLY_REJECTED:"partiallyRejected",DENIED:"denied",PROCESSED_AND_CLOSED:"processedAndClosed",CLOSED:"closed"},u=(t,e)=>({id:`${t.id}_${t.fieldType}_${e+1}`,name:`${t.name}_${t.fieldType}_${e+1}`,code:`${t.code}_${t.fieldType}_${e+1}`,customUpperCode:`${t.customUpperCode}_${t.fieldType}_${e+1}`}),E=t=>{const e={};return!t||typeof t!="object"||Object.keys(t).length===0||Object.keys(t).forEach(n=>{if(/_(\d+)$/.exec(n)){const i=n==null?void 0:n.replace(/_\d+$/,"");e[i]=t[n]}else e[n]=t[n]}),e},A=(t,e)=>t.map(n=>({...n,...u(n,e)})),C=(t,e)=>t==null?void 0:t.flatMap(n=>Array.from({length:e},(s,i)=>({...n,...u(n,i)}))),l=t=>{const e=[],n=[];return Object.entries(t).forEach(([s,i])=>{const a=s.lastIndexOf("_"),r=s.slice(0,a),c=s.slice(a+1);c===o.MULTISELECT||c===o.SELECT?e.push({attributeCode:r,value:i}):n.push({attributeCode:r,value:i})}),{selectedCustomAttributes:e,enteredCustomAttributes:n}},_=t=>typeof t!="string"?"":d[t]??"",f=t=>{var n;const e=[];if(t!=null&&t.current.length)for(const{current:s}of t.current){if(!s)continue;const i=s.name.replace(/_\d+$/,""),a=((n=s==null?void 0:s.dataset)==null?void 0:n.quantity)??1,r=p(s),c=E(r);e.push({orderItemUid:i,quantityToReturn:+a,...l(c)})}return e},T=t=>{var e;return(e=t==null?void 0:t.items)!=null&&e.length?[...(t==null?void 0:t.items)??[]].sort((n,s)=>{const i=n.quantityShipped-n.quantityReturnRequested===0,a=s.quantityShipped-s.quantityReturnRequested===0;return i&&!a?1:!i&&a?-1:0}):[]};export{_ as f,A as m,f as p,C as r,T as s}; +import{g as p,F as o}from"./getFormValues.js";const d=t=>t&&t.charAt(0).toLocaleUpperCase()+t.slice(1).toLocaleLowerCase(),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"},u=(t,e)=>({id:`${t.id}_${t.fieldType}_${e+1}`,name:`${t.name}_${t.fieldType}_${e+1}`,code:`${t.code}_${t.fieldType}_${e+1}`,customUpperCode:`${t.customUpperCode}_${t.fieldType}_${e+1}`}),l=t=>{const e={};return!t||typeof t!="object"||Object.keys(t).length===0||Object.keys(t).forEach(n=>{if(/_(\d+)$/.exec(n)){const i=n==null?void 0:n.replace(/_\d+$/,"");e[i]=t[n]}else e[n]=t[n]}),e},A=(t,e)=>t.map(n=>({...n,...u(n,e)})),f=(t,e)=>t==null?void 0:t.flatMap(n=>Array.from({length:e},(s,i)=>({...n,...u(n,i)}))),m=t=>{const e=[],n=[];return Object.entries(t).forEach(([s,i])=>{const a=s.lastIndexOf("_"),c=s.slice(0,a),r=s.slice(a+1);r===o.MULTISELECT||r===o.SELECT?e.push({attributeCode:c,value:i}):n.push({attributeCode:c,value:i})}),{selectedCustomAttributes:e,enteredCustomAttributes:n}},_=t=>typeof t!="string"?"":E[t]??d(t),L=t=>{var n;const e=[];if(t!=null&&t.current.length)for(const{current:s}of t.current){if(!s)continue;const i=s.name.replace(/_\d+$/,""),a=((n=s==null?void 0:s.dataset)==null?void 0:n.quantity)??1,c=p(s),r=l(c);e.push({orderItemUid:i,quantityToReturn:+a,...m(r)})}return e},T=t=>{var e;return(e=t==null?void 0:t.items)!=null&&e.length?[...(t==null?void 0:t.items)??[]].sort((n,s)=>{const i=n.quantityShipped-n.quantityReturnRequested===0,a=s.quantityShipped-s.quantityReturnRequested===0;return i&&!a?1:!i&&a?-1:0}):[]};export{d as c,_ as f,A as m,L as p,f as r,T as s}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderStatus.js b/scripts/__dropins__/storefront-order/containers/OrderStatus.js index 30d2a30cf..35d2bea6a 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 i,Fragment as _,jsxs as N}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as j,classes as A}from"@dropins/tools/lib.js";import{Button as E,InLineAlert as z,Modal as K,Card as q,Header as H}from"@dropins/tools/components.js";import{useState as S,useEffect as U,useCallback as B}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import{useMemo as Q,useState as J}from"@dropins/tools/preact-compat.js";import{u as $}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as P}from"@dropins/tools/event-bus.js";import{G as X}from"../chunks/getGuestOrder.graphql.js";import{f as Y,h as Z}from"../chunks/fetch-graphql.js";import{b as D}from"../chunks/transform-customer-orders-returns.js";import{useText as O,Text as b}from"@dropins/tools/i18n.js";import{C as ee}from"../chunks/OrderLoaders.js";import{f as re}from"../chunks/returnOrdersHelper.js";import{f as v}from"../chunks/formatDateToLocale.js";import{r as k}from"../chunks/redirectTo.js";import{O as te}from"../chunks/OrderCancelForm.js";import{r as ne}from"../chunks/reorderItems.js";import"../chunks/getStoreConfig.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";var y=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(y||{});const se=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:a,onError:s})=>{const d=O({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=Q(()=>{const o=t==null?void 0:t.availableActions,c=!!(o!=null&&o.length),u=!!(t!=null&&t.returnNumber),R=()=>{k(e,{},t)};return i(_,{children:n!=null&&n.OrderActions?i(j,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):i("div",{"data-testid":"availableActionsList",className:A(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!c]]),children:o==null?void 0:o.map(f=>{switch(f){case y.CANCEL:return i(_,{children:u?null:i(ae,{orderRef:(t==null?void 0:t.token)??(t==null?void 0:t.id)})});case y.RETURN:return i(E,{variant:"secondary",onClick:R,children:u?d.createAnotherReturn:d.createReturn});case y.REORDER:return i(_,{children:u?null:i(ue,{orderData:t,onError:s,routeOnSuccess:a,children:d.reorder})})}})})})},[s,t,a,e,n,d]);return i("div",{className:A(["order-order-actions",r]),children:l})},oe=({orderData:r})=>{const[t,n]=S(r),[e,a]=S(r==null?void 0:r.status);return U(()=>{const s=P.on("order/data",d=>{n(d),a(d.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},ce=` +import{jsx as i,Fragment as _,jsxs as N}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as j,classes as A}from"@dropins/tools/lib.js";import{Button as E,InLineAlert as z,Modal as K,Card as q,Header as H}from"@dropins/tools/components.js";import{useState as S,useEffect as $,useCallback as B}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import{useMemo as Q,useState as J}from"@dropins/tools/preact-compat.js";import{u as k}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as P}from"@dropins/tools/event-bus.js";import{G as X}from"../chunks/getGuestOrder.graphql.js";import{f as Y,h as Z}from"../chunks/fetch-graphql.js";import{b as D}from"../chunks/transform-customer-orders-returns.js";import{useText as O,Text as b}from"@dropins/tools/i18n.js";import{C as ee}from"../chunks/OrderLoaders.js";import{f as re,c as x}from"../chunks/returnOrdersHelper.js";import{f as v}from"../chunks/formatDateToLocale.js";import{r as F}from"../chunks/redirectTo.js";import{O as te}from"../chunks/OrderCancelForm.js";import{r as ne}from"../chunks/reorderItems.js";import"../chunks/getStoreConfig.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";var y=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(y||{});const se=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:a,onError:s})=>{const d=O({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=Q(()=>{const o=t==null?void 0:t.availableActions,c=!!(o!=null&&o.length),u=!!(t!=null&&t.returnNumber),R=()=>{F(e,{},t)};return i(_,{children:n!=null&&n.OrderActions?i(j,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):i("div",{"data-testid":"availableActionsList",className:A(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!c]]),children:o==null?void 0:o.map(f=>{switch(f){case y.CANCEL:return i(_,{children:u?null:i(ae,{orderRef:(t==null?void 0:t.token)??(t==null?void 0:t.id)})});case y.RETURN:return i(E,{variant:"secondary",onClick:R,children:u?d.createAnotherReturn:d.createReturn});case y.REORDER:return i(_,{children:u?null:i(ue,{orderData:t,onError:s,routeOnSuccess:a,children:d.reorder})})}})})})},[s,t,a,e,n,d]);return i("div",{className:A(["order-order-actions",r]),children:l})},oe=({orderData:r})=>{const[t,n]=S(r),[e,a]=S(r==null?void 0:r.status);return $(()=>{const s=P.on("order/data",d=>{n(d),a(d.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},ce=` mutation CONFIRM_CANCEL_ORDER_MUTATION( $orderId: ID!, $confirmationKey: String! @@ -19,4 +19,4 @@ import{jsx as i,Fragment as _,jsxs as N}from"@dropins/tools/preact-jsx-runtime.j } } ${X} -`,ie=async(r,t)=>Y(ce,{variables:{orderId:r,confirmationKey:t}}).then(async({errors:n,data:e})=>{var d,l,o,c;const a=[...(d=e==null?void 0:e.confirmCancelOrder)!=null&&d.errorV2?[(l=e==null?void 0:e.confirmCancelOrder)==null?void 0:l.errorV2]:[],...n??[]];let s=null;return(o=e==null?void 0:e.confirmCancelOrder)!=null&&o.order&&(s=D((c=e==null?void 0:e.confirmCancelOrder)==null?void 0:c.order),P.emit("order/data",s)),a.length>0?Z(a):s}),de=({enableOrderCancellation:r})=>{const t=O({orderCancelled:"Order.OrderStatusContent.orderCanceled.message"}),[n,e]=S({text:"",status:void 0});return U(()=>{if(!r)return;const a=new URLSearchParams(window.location.search),s=a.get("order_id"),d=a.get("confirmation_key");s&&d&&ie(s,d).then(()=>{e({text:t.orderCancelled,status:"success"})}).catch(l=>{e({text:l.message,status:"warning"})})},[r,t.orderCancelled]),{confirmOrderCancellation:n}},ke=({slots:r,orderData:t,className:n,statusTitle:e,status:a,routeCreateReturn:s,onError:d,routeOnSuccess:l})=>{const{orderStatus:o,order:c}=oe({orderData:t}),[u,R]=J(!1),f=()=>{R(!0);const p=new URL(window.location.href),T=p.searchParams.get("order_id"),g=p.searchParams.get("confirmation_key");T&&g&&(p.searchParams.delete("order_id"),p.searchParams.delete("confirmation_key"),window.history.replaceState({},document.title,p.toString()))},h=O({cancelOrder:"Order.OrderStatusContent.actions.cancel"}),C=$(),{confirmOrderCancellation:m}=de({enableOrderCancellation:C==null?void 0:C.orderCancellationEnabled});return N("div",{className:A(["order-order-status",n]),children:[!u&&(m==null?void 0:m.status)!==void 0&&i(z,{heading:h.cancelOrder,onDismiss:f,description:m.text,type:m.status}),c?i(le,{title:e,status:a||o,slots:r,orderData:c,routeCreateReturn:s,onError:d,routeOnSuccess:l}):i(ee,{withCard:!1})]})},ae=({orderRef:r})=>{const[t,n]=S(!1),e=()=>{n(!0)},a=()=>{n(!1)},s=$(),d=(s==null?void 0:s.orderCancellationReasons)??[],l=o=>o.map((c,u)=>({text:c==null?void 0:c.description,value:u.toString()}));return P.on("order/data",o=>{const c=String(o.status).toLocaleLowerCase();(c==="guest order cancellation requested"||c==="canceled")&&a()}),N(_,{children:[i(E,{variant:"secondary",onClick:e,"data-testid":"cancel-button",children:i(b,{id:"Order.OrderStatusContent.actions.cancel"})}),t&&i(K,{centered:!0,size:"medium",onClose:a,className:"order-order-cancel__modal",title:i("h2",{className:"order-order-cancel__title",children:i(b,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:i(te,{orderRef:r,cancelReasons:l(d)})})]})},x=r=>r&&r.charAt(0).toLocaleUpperCase()+r.slice(1).toLocaleLowerCase(),w={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested","pending payment":"orderPendingPayment",rejected:"orderRejected",authorized:"orderAuthorized","paypal canceled reversal":"orderPaypalCanceledReversal","pending paypal":"orderPendingPaypal","paypal reversed":"orderPaypalReversed",closed:"orderClosed"},le=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:a,onError:s,routeOnSuccess:d})=>{var L,I,M;const l=!!(e!=null&&e.returnNumber),o=String(n).toLocaleLowerCase(),c=(L=e==null?void 0:e.returns)==null?void 0:L[0],u=(c==null?void 0:c.returnStatus)??"",R=(c==null?void 0:c.createdReturnAt)??"",f=O({message:"Order.OrderStatusContent.orderPlaceholder.message",messageWithoutDate:"Order.OrderStatusContent.orderPlaceholder.messageWithoutDate"}),h=O(`Order.OrderStatusContent.${w[o]}.title`),C=O(`Order.OrderStatusContent.${w[o]}.message`),m=O(`Order.OrderStatusContent.${w[o]}.messageWithoutDate`),p=O({title:`Order.OrderStatusContent.returnStatus.${re(u)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return i("div",{});const T=h!=null&&h.title?h:{title:x(o)},g=C!=null&&C.message?C:f,F=m!=null&&m.messageWithoutDate?m:f,G=e!=null&&e.orderStatusChangeDate?g==null?void 0:g.message.replace("{DATE}",v(e==null?void 0:e.orderStatusChangeDate)):F.messageWithoutDate,V=((M=(I=p==null?void 0:p.returnMessage)==null?void 0:I.replace("{ORDER_CREATE_DATE}",v(e==null?void 0:e.orderDate)))==null?void 0:M.replace("{RETURN_CREATE_DATE}",v(R)))??"",W=l?t??(p.title||x(u)):t??T.title;return N(q,{className:"order-order-status-content",variant:"secondary",children:[i(H,{title:W}),N("div",{className:"order-order-status-content__wrapper",children:[i("div",{className:A(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:i("p",{children:l?V:G})}),i(se,{orderData:e,slots:r,routeCreateReturn:a,routeOnSuccess:d,onError:s})]})]})},ue=({onError:r,routeOnSuccess:t,orderData:n,children:e})=>{const[a,s]=S(!1),d=B(()=>{s(!0);const l=n==null?void 0:n.number;ne(l).then(({success:o,userInputErrors:c})=>{o&&k(t,{}),c.length&&(r==null||r(c))}).catch(o=>{r==null||r(o.message)}).finally(()=>{s(!1)})},[n,t,r]);return i(E,{type:"button",disabled:a,variant:"secondary",className:"order-reorder",onClick:d,children:e})};export{ke as OrderStatus,ke as default}; +`,ie=async(r,t)=>Y(ce,{variables:{orderId:r,confirmationKey:t}}).then(async({errors:n,data:e})=>{var d,l,o,c;const a=[...(d=e==null?void 0:e.confirmCancelOrder)!=null&&d.errorV2?[(l=e==null?void 0:e.confirmCancelOrder)==null?void 0:l.errorV2]:[],...n??[]];let s=null;return(o=e==null?void 0:e.confirmCancelOrder)!=null&&o.order&&(s=D((c=e==null?void 0:e.confirmCancelOrder)==null?void 0:c.order),P.emit("order/data",s)),a.length>0?Z(a):s}),de=({enableOrderCancellation:r})=>{const t=O({orderCancelled:"Order.OrderStatusContent.orderCanceled.message"}),[n,e]=S({text:"",status:void 0});return $(()=>{if(!r)return;const a=new URLSearchParams(window.location.search),s=a.get("order_id"),d=a.get("confirmation_key");s&&d&&ie(s,d).then(()=>{e({text:t.orderCancelled,status:"success"})}).catch(l=>{e({text:l.message,status:"warning"})})},[r,t.orderCancelled]),{confirmOrderCancellation:n}},Fe=({slots:r,orderData:t,className:n,statusTitle:e,status:a,routeCreateReturn:s,onError:d,routeOnSuccess:l})=>{const{orderStatus:o,order:c}=oe({orderData:t}),[u,R]=J(!1),f=()=>{R(!0);const p=new URL(window.location.href),T=p.searchParams.get("order_id"),g=p.searchParams.get("confirmation_key");T&&g&&(p.searchParams.delete("order_id"),p.searchParams.delete("confirmation_key"),window.history.replaceState({},document.title,p.toString()))},h=O({cancelOrder:"Order.OrderStatusContent.actions.cancel"}),C=k(),{confirmOrderCancellation:m}=de({enableOrderCancellation:C==null?void 0:C.orderCancellationEnabled});return N("div",{className:A(["order-order-status",n]),children:[!u&&(m==null?void 0:m.status)!==void 0&&i(z,{heading:h.cancelOrder,onDismiss:f,description:m.text,type:m.status}),c?i(le,{title:e,status:a||o,slots:r,orderData:c,routeCreateReturn:s,onError:d,routeOnSuccess:l}):i(ee,{withCard:!1})]})},ae=({orderRef:r})=>{const[t,n]=S(!1),e=()=>{n(!0)},a=()=>{n(!1)},s=k(),d=(s==null?void 0:s.orderCancellationReasons)??[],l=o=>o.map((c,u)=>({text:c==null?void 0:c.description,value:u.toString()}));return P.on("order/data",o=>{const c=String(o.status).toLocaleLowerCase();(c==="guest order cancellation requested"||c==="canceled")&&a()}),N(_,{children:[i(E,{variant:"secondary",onClick:e,"data-testid":"cancel-button",children:i(b,{id:"Order.OrderStatusContent.actions.cancel"})}),t&&i(K,{centered:!0,size:"medium",onClose:a,className:"order-order-cancel__modal",title:i("h2",{className:"order-order-cancel__title",children:i(b,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:i(te,{orderRef:r,cancelReasons:l(d)})})]})},w={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested","pending payment":"orderPendingPayment",rejected:"orderRejected",authorized:"orderAuthorized","paypal canceled reversal":"orderPaypalCanceledReversal","pending paypal":"orderPendingPaypal","paypal reversed":"orderPaypalReversed",closed:"orderClosed"},le=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:a,onError:s,routeOnSuccess:d})=>{var I,L,M;const l=!!(e!=null&&e.returnNumber),o=String(n).toLocaleLowerCase(),c=(I=e==null?void 0:e.returns)==null?void 0:I[0],u=(c==null?void 0:c.returnStatus)??"",R=(c==null?void 0:c.createdReturnAt)??"",f=O({message:"Order.OrderStatusContent.orderPlaceholder.message",messageWithoutDate:"Order.OrderStatusContent.orderPlaceholder.messageWithoutDate"}),h=O(`Order.OrderStatusContent.${w[o]}.title`),C=O(`Order.OrderStatusContent.${w[o]}.message`),m=O(`Order.OrderStatusContent.${w[o]}.messageWithoutDate`),p=O({title:`Order.OrderStatusContent.returnStatus.${re(u)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return i("div",{});const T=h!=null&&h.title?h:{title:x(o)},g=C!=null&&C.message?C:f,U=m!=null&&m.messageWithoutDate?m:f,G=e!=null&&e.orderStatusChangeDate?g==null?void 0:g.message.replace("{DATE}",v(e==null?void 0:e.orderStatusChangeDate)):U.messageWithoutDate,V=((M=(L=p==null?void 0:p.returnMessage)==null?void 0:L.replace("{ORDER_CREATE_DATE}",v(e==null?void 0:e.orderDate)))==null?void 0:M.replace("{RETURN_CREATE_DATE}",v(R)))??"",W=l?t??(p.title||x(u)):t??T.title;return N(q,{className:"order-order-status-content",variant:"secondary",children:[i(H,{title:W}),N("div",{className:"order-order-status-content__wrapper",children:[i("div",{className:A(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:i("p",{children:l?V:G})}),i(se,{orderData:e,slots:r,routeCreateReturn:a,routeOnSuccess:d,onError:s})]})]})},ue=({onError:r,routeOnSuccess:t,orderData:n,children:e})=>{const[a,s]=S(!1),d=B(()=>{s(!0);const l=n==null?void 0:n.number;ne(l).then(({success:o,userInputErrors:c})=>{o&&F(t,{}),c.length&&(r==null||r(c))}).catch(o=>{r==null||r(o.message)}).finally(()=>{s(!1)})},[n,t,r]);return i(E,{type:"button",disabled:a,variant:"secondary",className:"order-reorder",onClick:d,children:e})};export{Fe as OrderStatus,Fe as default};