From af4aab6c5855cff4a865a1c6ea0c6d70bb806e24 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Fri, 6 Dec 2024 22:00:02 +0200 Subject: [PATCH] test 6 --- .../storefront-order/chunks/confirmCancelOrder.js | 14 +++++++++----- .../storefront-order/containers/OrderStatus.js | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/__dropins__/storefront-order/chunks/confirmCancelOrder.js b/scripts/__dropins__/storefront-order/chunks/confirmCancelOrder.js index 8b139a39b..1d48dc9ca 100644 --- a/scripts/__dropins__/storefront-order/chunks/confirmCancelOrder.js +++ b/scripts/__dropins__/storefront-order/chunks/confirmCancelOrder.js @@ -1,6 +1,6 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{h as O}from"./network-error.js";import{f as u,h as E}from"./fetch-graphql.js";import{R as f}from"./fragments.js";import{G as a}from"./getGuestOrder.graphql.js";import{events as _}from"@dropins/tools/event-bus.js";import{b as I}from"./transform-customer-orders-returns.js";const d=` +import{h as O}from"./network-error.js";import{f as a,h as d}from"./fetch-graphql.js";import{G as E}from"./getGuestOrder.graphql.js";import{R as I}from"./fragments.js";import{b as _}from"./transform-customer-orders-returns.js";import{events as l}from"@dropins/tools/event-bus.js";const s=` mutation REORDER_ITEMS_MUTATION($orderNumber: String!) { reorderItems(orderNumber: $orderNumber) { cart { @@ -17,7 +17,7 @@ mutation REORDER_ITEMS_MUTATION($orderNumber: String!) { } } } -`,D=async o=>await u(d,{method:"POST",variables:{orderNumber:o}}).then(e=>{var i,n,m,c,s,R;if((i=e.errors)!=null&&i.length)return E(e.errors);const t=!!((c=(m=(n=e==null?void 0:e.data)==null?void 0:n.reorderItems)==null?void 0:m.cart)!=null&&c.itemsV2.items.length),r=((R=(s=e==null?void 0:e.data)==null?void 0:s.reorderItems)==null?void 0:R.userInputErrors)??[];return{success:t,userInputErrors:r}}).catch(O),N=` +`,$=async R=>await a(s,{method:"POST",variables:{orderNumber:R}}).then(t=>{var n,o,i,m,c,u;if((n=t.errors)!=null&&n.length)return d(t.errors);const e=!!((m=(i=(o=t==null?void 0:t.data)==null?void 0:o.reorderItems)==null?void 0:i.cart)!=null&&m.itemsV2.items.length),r=((u=(c=t==null?void 0:t.data)==null?void 0:c.reorderItems)==null?void 0:u.userInputErrors)??[];return{success:e,userInputErrors:r}}).catch(O),N=` mutation CONFIRM_RETURN_GUEST_ORDER( $orderId: ID!, $confirmationKey: String! @@ -28,10 +28,14 @@ mutation CONFIRM_RETURN_GUEST_ORDER( }) { return { ...OrderReturn + order { + ...guestOrderData + } } } } -${f}`,M=async(o,e)=>(sessionStorage.setItem("212121212121",JSON.stringify({orderId:o,confirmationKey:e})),await u(N,{method:"POST",variables:{orderId:o,confirmationKey:e}}).then(t=>{var r;return(r=t.errors)!=null&&r.length?(sessionStorage.setItem("111111111",JSON.stringify(t.errors)),E(t.errors)):t.data}).catch(O)),T=` +${I} +${E}`,M=async(R,t)=>(sessionStorage.setItem("212121212121",JSON.stringify({orderId:R,confirmationKey:t})),await a(N,{method:"POST",variables:{orderId:R,confirmationKey:t}}).then(e=>{var n,o,i,m,c,u,f;if((n=e.errors)!=null&&n.length)return sessionStorage.setItem("111111111",JSON.stringify(e.errors)),d(e.errors);let r=null;return(m=(i=(o=e==null?void 0:e.data)==null?void 0:o.confirmReturn)==null?void 0:i.return)!=null&&m.order&&(r=_((f=(u=(c=e==null?void 0:e.data)==null?void 0:c.confirmReturn)==null?void 0:u.return)==null?void 0:f.order),l.emit("order/data",r)),r}).catch(O)),T=` mutation CONFIRM_CANCEL_ORDER_MUTATION( $orderId: ID!, $confirmationKey: String! @@ -49,5 +53,5 @@ ${f}`,M=async(o,e)=>(sessionStorage.setItem("212121212121",JSON.stringify({order } } } -${a} -`,$=async(o,e)=>u(T,{variables:{orderId:o,confirmationKey:e}}).then(async({errors:t,data:r})=>{var m,c,s,R;const i=[...(m=r==null?void 0:r.confirmCancelOrder)!=null&&m.errorV2?[(c=r==null?void 0:r.confirmCancelOrder)==null?void 0:c.errorV2]:[],...t??[]];let n=null;return(s=r==null?void 0:r.confirmCancelOrder)!=null&&s.order&&(n=I((R=r==null?void 0:r.confirmCancelOrder)==null?void 0:R.order),_.emit("order/data",n)),i.length>0?E(i):n});export{M as a,$ as c,D as r}; +${E} +`,U=async(R,t)=>a(T,{variables:{orderId:R,confirmationKey:t}}).then(async({errors:e,data:r})=>{var i,m,c,u;const n=[...(i=r==null?void 0:r.confirmCancelOrder)!=null&&i.errorV2?[(m=r==null?void 0:r.confirmCancelOrder)==null?void 0:m.errorV2]:[],...e??[]];let o=null;return(c=r==null?void 0:r.confirmCancelOrder)!=null&&c.order&&(o=_((u=r==null?void 0:r.confirmCancelOrder)==null?void 0:u.order),l.emit("order/data",o)),n.length>0?d(n):o});export{M as a,U as c,$ as r}; diff --git a/scripts/__dropins__/storefront-order/containers/OrderStatus.js b/scripts/__dropins__/storefront-order/containers/OrderStatus.js index 46a6e1b07..8c9f67e26 100644 --- a/scripts/__dropins__/storefront-order/containers/OrderStatus.js +++ b/scripts/__dropins__/storefront-order/containers/OrderStatus.js @@ -1,3 +1,3 @@ /*! Copyright 2024 Adobe All Rights Reserved. */ -import{jsx as o,Fragment as S,jsxs as _}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as G,classes as w}from"@dropins/tools/lib.js";import{Button as P,InLineAlert as H,Modal as K,Card as V,Header as B}from"@dropins/tools/components.js";import{useState as O,useEffect as M,useCallback as k}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import{useMemo as J}from"@dropins/tools/preact-compat.js";import{u as q}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as I}from"@dropins/tools/event-bus.js";import{c as Q,a as X,r as Y}from"../chunks/confirmCancelOrder.js";import{useText as p,Text as L}from"@dropins/tools/i18n.js";import{C as Z}from"../chunks/OrderLoaders.js";import{f as D}from"../chunks/returnOrdersHelper.js";import{f as v}from"../chunks/formatDateToLocale.js";import{c as b}from"../chunks/capitalizeFirst.js";import{r as U}from"../chunks/redirectTo.js";import{O as ee}from"../chunks/OrderCancelForm.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/network-error.js";import"../chunks/fragments.js";import"../chunks/getGuestOrder.graphql.js";import"../chunks/transform-customer-orders-returns.js";import"../chunks/convertCase.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";var y=(t=>(t.CANCEL="CANCEL",t.RETURN="RETURN",t.REORDER="REORDER",t))(y||{});const te=({className:t,orderData:e,slots:c,routeCreateReturn:r,routeOnSuccess:u,onError:a})=>{const l=p({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),i=J(()=>{const n=e==null?void 0:e.availableActions,s=!!(n!=null&&n.length),d=!!(e!=null&&e.returnNumber),m=()=>{U(r,{},e)};return o(S,{children:c!=null&&c.OrderActions?o(G,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:c==null?void 0:c.OrderActions,context:e}):o("div",{"data-testid":"availableActionsList",className:w(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!s]]),children:n==null?void 0:n.map(h=>{switch(h){case y.CANCEL:return o(S,{children:d?null:o(se,{orderRef:(e==null?void 0:e.token)??(e==null?void 0:e.id)})});case y.RETURN:return o(P,{variant:"secondary",onClick:m,children:d?l.createAnotherReturn:l.createReturn});case y.REORDER:return o(S,{children:d?null:o(oe,{orderData:e,onError:a,routeOnSuccess:u,children:l.reorder})})}})})})},[a,e,u,r,c,l]);return o("div",{className:w(["order-order-actions",t]),children:i})},re=({orderData:t})=>{const[e,c]=O(t),[r,u]=O(t==null?void 0:t.status);return M(()=>{const a=I.on("order/data",l=>{c(l),u(l.status)},{eager:!0});return()=>{a==null||a.off()}},[]),{orderStatus:r,order:e}},ne=({enableOrderCancellation:t})=>{const e=p({orderCancelled:"Order.OrderStatusContent.orderCanceled.message",guestRequestReturnMessage:"Order.OrderStatusContent.guestOrderCancellationRequested.messageWithoutDate"}),[c,r]=O(!1),[u,a]=O({text:"",status:void 0});M(()=>{const i=new URLSearchParams(window.location.search),n=i.get("order_id")??"",s=i.get("confirmation_key")??"",d=i.get("action")??"";!n||!s||!d||(t&&d==="cancel"&&Q(n,s).then(()=>{a({text:e.orderCancelled,status:"success"})}).catch(m=>{a({text:m.message,status:"warning"})}),d==="return"&&X(n,s).then(()=>{a({text:e.guestRequestReturnMessage,status:"success"})}).catch(m=>{a({text:m.message,status:"warning"})}))},[t,e]);const l=k(()=>{r(!0);const i=new URL(window.location.href),n=i.searchParams.get("order_id"),s=i.searchParams.get("confirmation_key"),d=i.searchParams.get("action")??"";n&&s&&d&&(i.searchParams.delete("order_id"),i.searchParams.delete("confirmation_key"),i.searchParams.delete("action"),window.history.replaceState({},document.title,i.toString()))},[]);return{orderActionStatus:u,isDismissed:c,onDismiss:l}},ke=({slots:t,orderData:e,className:c,statusTitle:r,status:u,routeCreateReturn:a,onError:l,routeOnSuccess:i})=>{const{orderStatus:n,order:s}=re({orderData:e}),d=q(),{orderActionStatus:m,isDismissed:h,onDismiss:g}=ne({enableOrderCancellation:d==null?void 0:d.orderCancellationEnabled}),C=p({cancelOrder:"Order.OrderStatusContent.actions.cancel"});return _("div",{className:w(["order-order-status",c]),children:[!h&&(m==null?void 0:m.status)!==void 0&&o(H,{heading:C.cancelOrder,onDismiss:g,description:m.text,type:m.status}),s?o(ce,{title:r,status:u||n,slots:t,orderData:s,routeCreateReturn:a,onError:l,routeOnSuccess:i}):o(Z,{withCard:!1})]})},se=({orderRef:t})=>{const[e,c]=O(!1),r=()=>{c(!0)},u=()=>{c(!1)},a=q(),l=(a==null?void 0:a.orderCancellationReasons)??[],i=n=>n.map((s,d)=>({text:s==null?void 0:s.description,value:d.toString()}));return I.on("order/data",n=>{const s=String(n.status).toLocaleLowerCase();(s==="guest order cancellation requested"||s==="canceled")&&u()}),_(S,{children:[o(P,{variant:"secondary",onClick:r,"data-testid":"cancel-button",children:o(L,{id:"Order.OrderStatusContent.actions.cancel"})}),e&&o(K,{centered:!0,size:"medium",onClose:u,className:"order-order-cancel__modal",title:o("h2",{className:"order-order-cancel__title",children:o(L,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:o(ee,{orderRef:t,cancelReasons:i(l)})})]})},N={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested","pending payment":"orderPendingPayment",rejected:"orderRejected",authorized:"orderAuthorized","paypal canceled reversal":"orderPaypalCanceledReversal","pending paypal":"orderPendingPaypal","paypal reversed":"orderPaypalReversed",closed:"orderClosed"},ce=({slots:t,title:e,status:c,orderData:r,routeCreateReturn:u,onError:a,routeOnSuccess:l})=>{var T,x,E;const i=!!(r!=null&&r.returnNumber),n=String(c).toLocaleLowerCase(),s=(T=r==null?void 0:r.returns)==null?void 0:T[0],d=(s==null?void 0:s.returnStatus)??"",m=(s==null?void 0:s.createdReturnAt)??"",h=p({message:"Order.OrderStatusContent.orderPlaceholder.message",messageWithoutDate:"Order.OrderStatusContent.orderPlaceholder.messageWithoutDate"}),g=p(`Order.OrderStatusContent.${N[n]}.title`),C=p(`Order.OrderStatusContent.${N[n]}.message`),R=p(`Order.OrderStatusContent.${N[n]}.messageWithoutDate`),f=p({title:`Order.OrderStatusContent.returnStatus.${D(d)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!c)return o("div",{});const W=g!=null&&g.title?g:{title:b(n)},A=C!=null&&C.message?C:h,F=R!=null&&R.messageWithoutDate?R:h,j=r!=null&&r.orderStatusChangeDate?A==null?void 0:A.message.replace("{DATE}",v(r==null?void 0:r.orderStatusChangeDate)):F.messageWithoutDate,z=((E=(x=f==null?void 0:f.returnMessage)==null?void 0:x.replace("{ORDER_CREATE_DATE}",v(r==null?void 0:r.orderDate)))==null?void 0:E.replace("{RETURN_CREATE_DATE}",v(m)))??"",$=i?e??(f.title||b(d)):e??W.title;return _(V,{className:"order-order-status-content",variant:"secondary",children:[o(B,{title:$}),_("div",{className:"order-order-status-content__wrapper",children:[o("div",{className:w(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(t!=null&&t.OrderActions)]]),children:o("p",{children:i?z:j})}),o(te,{orderData:r,slots:t,routeCreateReturn:u,routeOnSuccess:l,onError:a})]})]})},oe=({onError:t,routeOnSuccess:e,orderData:c,children:r})=>{const[u,a]=O(!1),l=k(()=>{a(!0);const i=c==null?void 0:c.number;Y(i).then(({success:n,userInputErrors:s})=>{n&&U(e,{}),s.length&&(t==null||t(s))}).catch(n=>{t==null||t(n.message)}).finally(()=>{a(!1)})},[c,e,t]);return o(P,{type:"button",disabled:u,variant:"secondary",className:"order-reorder",onClick:l,children:r})};export{ke as OrderStatus,ke as default}; +import{jsx as o,Fragment as S,jsxs as _}from"@dropins/tools/preact-jsx-runtime.js";import{Slot as G,classes as w}from"@dropins/tools/lib.js";import{Button as P,InLineAlert as H,Modal as K,Card as V,Header as B}from"@dropins/tools/components.js";import{useState as O,useEffect as M,useCallback as k}from"@dropins/tools/preact-hooks.js";import"../chunks/ShippingStatusCard.js";import{useMemo as J}from"@dropins/tools/preact-compat.js";import{u as q}from"../chunks/useGetStoreConfig.js";import"@dropins/tools/preact.js";import{events as I}from"@dropins/tools/event-bus.js";import{c as Q,a as X,r as Y}from"../chunks/confirmCancelOrder.js";import{useText as p,Text as L}from"@dropins/tools/i18n.js";import{C as Z}from"../chunks/OrderLoaders.js";import{f as D}from"../chunks/returnOrdersHelper.js";import{f as v}from"../chunks/formatDateToLocale.js";import{c as b}from"../chunks/capitalizeFirst.js";import{r as U}from"../chunks/redirectTo.js";import{O as ee}from"../chunks/OrderCancelForm.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/network-error.js";import"../chunks/getGuestOrder.graphql.js";import"../chunks/transform-customer-orders-returns.js";import"../chunks/convertCase.js";import"../chunks/fragments.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";var y=(t=>(t.CANCEL="CANCEL",t.RETURN="RETURN",t.REORDER="REORDER",t))(y||{});const te=({className:t,orderData:e,slots:c,routeCreateReturn:r,routeOnSuccess:u,onError:a})=>{const l=p({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),i=J(()=>{const n=e==null?void 0:e.availableActions,s=!!(n!=null&&n.length),d=!!(e!=null&&e.returnNumber),m=()=>{U(r,{},e)};return o(S,{children:c!=null&&c.OrderActions?o(G,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:c==null?void 0:c.OrderActions,context:e}):o("div",{"data-testid":"availableActionsList",className:w(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!s]]),children:n==null?void 0:n.map(h=>{switch(h){case y.CANCEL:return o(S,{children:d?null:o(se,{orderRef:(e==null?void 0:e.token)??(e==null?void 0:e.id)})});case y.RETURN:return o(P,{variant:"secondary",onClick:m,children:d?l.createAnotherReturn:l.createReturn});case y.REORDER:return o(S,{children:d?null:o(oe,{orderData:e,onError:a,routeOnSuccess:u,children:l.reorder})})}})})})},[a,e,u,r,c,l]);return o("div",{className:w(["order-order-actions",t]),children:i})},re=({orderData:t})=>{const[e,c]=O(t),[r,u]=O(t==null?void 0:t.status);return M(()=>{const a=I.on("order/data",l=>{c(l),u(l.status)},{eager:!0});return()=>{a==null||a.off()}},[]),{orderStatus:r,order:e}},ne=({enableOrderCancellation:t})=>{const e=p({orderCancelled:"Order.OrderStatusContent.orderCanceled.message",guestRequestReturnMessage:"Order.OrderStatusContent.guestOrderCancellationRequested.messageWithoutDate"}),[c,r]=O(!1),[u,a]=O({text:"",status:void 0});M(()=>{const i=new URLSearchParams(window.location.search),n=i.get("order_id")??"",s=i.get("confirmation_key")??"",d=i.get("action")??"";!n||!s||!d||(t&&d==="cancel"&&Q(n,s).then(()=>{a({text:e.orderCancelled,status:"success"})}).catch(m=>{a({text:m.message,status:"warning"})}),d==="return"&&X(n,s).then(()=>{a({text:e.guestRequestReturnMessage,status:"success"})}).catch(m=>{a({text:m.message,status:"warning"})}))},[t,e]);const l=k(()=>{r(!0);const i=new URL(window.location.href),n=i.searchParams.get("order_id"),s=i.searchParams.get("confirmation_key"),d=i.searchParams.get("action")??"";n&&s&&d&&(i.searchParams.delete("order_id"),i.searchParams.delete("confirmation_key"),i.searchParams.delete("action"),window.history.replaceState({},document.title,i.toString()))},[]);return{orderActionStatus:u,isDismissed:c,onDismiss:l}},ke=({slots:t,orderData:e,className:c,statusTitle:r,status:u,routeCreateReturn:a,onError:l,routeOnSuccess:i})=>{const{orderStatus:n,order:s}=re({orderData:e}),d=q(),{orderActionStatus:m,isDismissed:h,onDismiss:g}=ne({enableOrderCancellation:d==null?void 0:d.orderCancellationEnabled}),C=p({cancelOrder:"Order.OrderStatusContent.actions.cancel"});return _("div",{className:w(["order-order-status",c]),children:[!h&&(m==null?void 0:m.status)!==void 0&&o(H,{heading:C.cancelOrder,onDismiss:g,description:m.text,type:m.status}),s?o(ce,{title:r,status:u||n,slots:t,orderData:s,routeCreateReturn:a,onError:l,routeOnSuccess:i}):o(Z,{withCard:!1})]})},se=({orderRef:t})=>{const[e,c]=O(!1),r=()=>{c(!0)},u=()=>{c(!1)},a=q(),l=(a==null?void 0:a.orderCancellationReasons)??[],i=n=>n.map((s,d)=>({text:s==null?void 0:s.description,value:d.toString()}));return I.on("order/data",n=>{const s=String(n.status).toLocaleLowerCase();(s==="guest order cancellation requested"||s==="canceled")&&u()}),_(S,{children:[o(P,{variant:"secondary",onClick:r,"data-testid":"cancel-button",children:o(L,{id:"Order.OrderStatusContent.actions.cancel"})}),e&&o(K,{centered:!0,size:"medium",onClose:u,className:"order-order-cancel__modal",title:o("h2",{className:"order-order-cancel__title",children:o(L,{id:"Order.OrderCancelForm.title"})}),"data-testid":"order-cancellation-reasons-modal",children:o(ee,{orderRef:t,cancelReasons:i(l)})})]})},N={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested","pending payment":"orderPendingPayment",rejected:"orderRejected",authorized:"orderAuthorized","paypal canceled reversal":"orderPaypalCanceledReversal","pending paypal":"orderPendingPaypal","paypal reversed":"orderPaypalReversed",closed:"orderClosed"},ce=({slots:t,title:e,status:c,orderData:r,routeCreateReturn:u,onError:a,routeOnSuccess:l})=>{var T,x,E;const i=!!(r!=null&&r.returnNumber),n=String(c).toLocaleLowerCase(),s=(T=r==null?void 0:r.returns)==null?void 0:T[0],d=(s==null?void 0:s.returnStatus)??"",m=(s==null?void 0:s.createdReturnAt)??"",h=p({message:"Order.OrderStatusContent.orderPlaceholder.message",messageWithoutDate:"Order.OrderStatusContent.orderPlaceholder.messageWithoutDate"}),g=p(`Order.OrderStatusContent.${N[n]}.title`),C=p(`Order.OrderStatusContent.${N[n]}.message`),R=p(`Order.OrderStatusContent.${N[n]}.messageWithoutDate`),f=p({title:`Order.OrderStatusContent.returnStatus.${D(d)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!c)return o("div",{});const W=g!=null&&g.title?g:{title:b(n)},A=C!=null&&C.message?C:h,F=R!=null&&R.messageWithoutDate?R:h,j=r!=null&&r.orderStatusChangeDate?A==null?void 0:A.message.replace("{DATE}",v(r==null?void 0:r.orderStatusChangeDate)):F.messageWithoutDate,z=((E=(x=f==null?void 0:f.returnMessage)==null?void 0:x.replace("{ORDER_CREATE_DATE}",v(r==null?void 0:r.orderDate)))==null?void 0:E.replace("{RETURN_CREATE_DATE}",v(m)))??"",$=i?e??(f.title||b(d)):e??W.title;return _(V,{className:"order-order-status-content",variant:"secondary",children:[o(B,{title:$}),_("div",{className:"order-order-status-content__wrapper",children:[o("div",{className:w(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(t!=null&&t.OrderActions)]]),children:o("p",{children:i?z:j})}),o(te,{orderData:r,slots:t,routeCreateReturn:u,routeOnSuccess:l,onError:a})]})]})},oe=({onError:t,routeOnSuccess:e,orderData:c,children:r})=>{const[u,a]=O(!1),l=k(()=>{a(!0);const i=c==null?void 0:c.number;Y(i).then(({success:n,userInputErrors:s})=>{n&&U(e,{}),s.length&&(t==null||t(s))}).catch(n=>{t==null||t(n.message)}).finally(()=>{a(!1)})},[c,e,t]);return o(P,{type:"button",disabled:u,variant:"secondary",className:"order-reorder",onClick:l,children:r})};export{ke as OrderStatus,ke as default};