1import{a as Me,b as He}from"./chunk-MRAS7XHC.js";import{a as x,b as S,c as Se,d as q,e as Z,f as be,g as je,h as Te,i as we,k as W,l as Ue,m as Ae,n as De}from"./chunk-ILI25QL5.js";import{a as Fe}from"./chunk-CKXXLNOY.js";import{a as Pe}from"./chunk-BDFKBQXW.js";import{e as Oe,h as ge,o as w,p as U,q as J,r as A,s as Ee,t as k,u as Ce,v as ye,w as Re,x as K,y as Ie}from"./chunk-3GQXY7WQ.js";import{B as $,G as he,T as ve,U as G}from"./chunk-SU7S3GV3.js";import"./chunk-LJH5OBMW.js";import{$e as E,Ad as p,Af as H,B as te,Bf as le,Cf as ue,Fd as v,Ge as ae,L as l,Nf as T,Pa as C,Qe as de,Re as D,Rf as me,Sf as u,Uf as L,Ve as F,Ye as P,Z as g,Zg as N,ah as fe,ga as R,ge as ie,he as ne,ie as se,je as ce,ka as Q,lf as O,o as ee,pb as j,qa as c,qf as M,ra as b,rf as pe,sd as oe,ta as d,u as y,ua as s,v as re,zf as f}from"./chunk-PMSJWPYZ.js";import{a as m,b as I}from"./chunk-NIF3MU5U.js";var Je=(()=>{class t{constructor(e){this.converter=e}convert(e,r){return r===void 0&&(r=m({},e)),e.entries&&(r.entries=e.entries.map(o=>this.convertOrderEntry(o,e.code,e.appliedProductPromotions))),e.consignments&&(r.consignments=e.consignments.map(o=>I(m({},o),{entries:o.entries?.map(i=>I(m({},i),{orderEntry:this.convertOrderEntry(i.orderEntry,e.code,e.appliedProductPromotions)}))}))),e.unconsignedEntries&&(r.unconsignedEntries=e.unconsignedEntries.map(o=>this.convertOrderEntry(o,e.code,e.appliedProductPromotions))),r}convertOrderEntry(e,r,o){return I(m({},e),{product:this.converter.convert(e?.product,N),orderCode:r,promotions:this.converter.convert({item:e,promotions:o},G)})}static{this.\u0275fac=function(r){return new(r||t)(d(f))}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),Ke=(()=>{class t{constructor(e){this.converter=e}convert(e,r){return r===void 0&&(r=m({},e)),e.entries&&(r.entries=e.entries.map(o=>I(m({},o),{product:this.converter.convert(o.product,N),promotions:this.converter.convert({item:o,promotions:e.appliedProductPromotions},G)}))),r}static{this.\u0275fac=function(r){return new(r||t)(d(f))}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),We=(()=>{class t{constructor(e){this.converter=e}convert(e,r){return r===void 0&&(r=m({},e)),e.returnEntries&&(r.returnEntries=e.returnEntries.map(o=>I(m({},o),{orderEntry:this.convertOrderEntry(o.orderEntry)}))),r}convertOrderEntry(e){return I(m({},e),{product:this.converter.convert(e?.product,N)})}static{this.\u0275fac=function(r){return new(r||t)(d(f))}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),Xe=(()=>{class t{convert(e,r){return r===void 0&&(r=m({},e)),e.replenishmentStartDate&&(r.replenishmentStartDate=this.convertDate(e.replenishmentStartDate)),r}convertDate(e){let r=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hourCycle:"h23"});return`${e}T${r}:00${me.getLocalTimezoneOffset()}`}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),X={"Content-Type":"application/json"},_=(()=>{class t{constructor(e,r,o){this.http=e,this.occEndpoints=r,this.converter=o,this.logger=s(E),this.occFieldsService=s(fe),this.orderConfig=s(Ie)}load(e,r){let o=this.getOrderDetailUrl(e,r),i=new p;return e===D&&(i=P.createHeader(F,!0,i)),this.http.get(o,{headers:i}).pipe(this.converter.pipeable(w))}loadHistory(e,r,o,i){let n={};r&&(n.pageSize=r.toString()),o&&(n.currentPage=o.toString()),i&&(n.sort=i.toString());let a=this.occEndpoints.buildUrl("orderHistory",{urlParams:{userId:e},queryParams:n});return this.http.get(a).pipe(this.converter.pipeable(A))}getConsignmentTracking(e,r,o=de){let i=this.occEndpoints.buildUrl("consignmentTracking",{urlParams:{userId:o,orderCode:e,consignmentCode:r}});return this.http.get(i).pipe(this.converter.pipeable(Ee))}cancel(e,r,o){let i=this.occEndpoints.buildUrl("cancelOrder",{urlParams:{userId:e,orderId:r}}),n=new p(m({},X));return this.http.post(i,o,{headers:n}).pipe(l(a=>{throw u(a,this.logger)}))}createReturnRequest(e,r){let o=this.occEndpoints.buildUrl("returnOrder",{urlParam
1s:{userId:e}}),i=new p(m({},X));return r=this.converter.convert(r,Ce),this.http.post(o,r,{headers:i}).pipe(l(n=>{throw u(n,this.logger)}),this.converter.pipeable(k))}loadReturnRequestList(e,r,o,i){let n={};r&&(n.pageSize=r.toString()),o&&(n.currentPage=o.toString()),i&&(n.sort=i.toString());let a=this.occEndpoints.buildUrl("orderReturns",{urlParams:{userId:e},queryParams:n});return this.http.get(a).pipe(this.converter.pipeable(ye))}loadReturnRequestDetail(e,r){let o=this.occEndpoints.buildUrl("orderReturnDetail",{urlParams:{userId:e,returnRequestCode:r}});return this.http.get(o).pipe(this.converter.pipeable(k))}cancelReturnRequest(e,r,o){let i=this.occEndpoints.buildUrl("cancelReturn",{urlParams:{userId:e,returnRequestCode:r}}),n=new p(m({},X));return this.http.patch(i,o,{headers:n}).pipe(l(a=>{throw u(a,this.logger)}))}getOrderDetailUrl(e,r){return this.orderConfig.showOrderQuoteLink?(()=>{let i=["orderDetail","quoteCode"].map(a=>({scopedData:{scope:a,userId:e,orderCode:r},url:this.occEndpoints.buildUrl(a,{urlParams:{userId:e,orderId:r}})})),n=this.occFieldsService.getOptimalUrlGroups(i);return Object.keys(n)[0]})():this.occEndpoints.buildUrl("orderDetail",{urlParams:{userId:e,orderId:r}})}static{this.\u0275fac=function(r){return new(r||t)(d(v),d(O),d(f))}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac})}}return t})(),_e=(()=>{class t{constructor(e,r,o){this.http=e,this.occEndpoints=r,this.converter=o,this.logger=s(E)}placeOrder(e,r,o){let i=new p({"Content-Type":"application/x-www-form-urlencoded"});return e===D&&(i=P.createHeader(F,!0,i)),this.http.post(this.getPlaceOrderEndpoint(e,r,o.toString()),{},{headers:i}).pipe(l(n=>{throw u(n,this.logger)}),T({shouldRetry:H}),this.converter.pipeable(w))}placePaymentAuthorizedOrder(e,r,o){let i=new p({"Content-Type":"application/x-www-form-urlencoded"});return e===D&&(i=P.createHeader(F,!0,i)),this.http.post(this.getPlacePaymentAuthorizedOrderEndpoint(e,r,o.toString()),{},{headers:i}).pipe(l(n=>{throw u(n,this.logger)}),T({shouldRetry:H}),T({shouldRetry:le,maxTries:ue}),this.converter.pipeable(w))}getPlaceOrderEndpoint(e,r,o){return this.occEndpoints.buildUrl("placeOrder",{urlParams:{userId:e},queryParams:{cartId:r,termsChecked:o}})}getPlacePaymentAuthorizedOrderEndpoint(e,r,o){return this.occEndpoints.buildUrl("placePaymentAuthorizedOrder",{urlParams:{userId:e},queryParams:{cartId:r,termsChecked:o}})}static{this.\u0275fac=function(r){return new(r||t)(d(v),d(O),d(f))}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac})}}return t})(),er=(()=>{class t{constructor(e,r,o){this.http=e,this.occEndpoints=r,this.converter=o}load(e,r){return this.http.get(this.occEndpoints.buildUrl("replenishmentOrderDetails",{urlParams:{userId:e,replenishmentOrderCode:r}})).pipe(this.converter.pipeable(U))}loadReplenishmentDetailsHistory(e,r,o,i,n){let a={};return o&&(a.pageSize=o.toString()),i&&(a.currentPage=i.toString()),n&&(a.sort=n.toString()),this.http.get(this.occEndpoints.buildUrl("replenishmentOrderDetailsHistory",{urlParams:{userId:e,replenishmentOrderCode:r},queryParams:a})).pipe(this.converter.pipeable(A))}cancelReplenishmentOrder(e,r){let o=new p().set("Content-Type","application/json");return this.http.patch(this.occEndpoints.buildUrl("cancelReplenishmentOrder",{urlParams:{userId:e,replenishmentOrderCode:r}}),{},{headers:o}).pipe(this.converter.pipeable(U))}loadHistory(e,r,o,i){let n={};r&&(n.pageSize=r.toString()),o&&(n.currentPage=o.toString()),i&&(n.sort=i.toString());let a=this.occEndpoints.buildUrl("replenishmentOrderHistory",{urlParams:{userId:e},queryParams:n});return this.http.get(a).pipe(this.converter.pipeable(Re))}static{this.\u0275fac=function(r){return new(r||t)(d(v),d(O),d(f))}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac})}}return t})(),rr=(()=>{class t{constructor(e,r,o){this.http=e,this.occEndpoints=r,this.converter=o,this.logger=s(E)}scheduleReplenishmentOrder(e,r,o,i){r=this.converter.convert(r,K);let n=new p().set("Content-Type","application/json");return this.http.post(this.getScheduleReplenishmentOrderEndpoint(i,e,o.toString()),r,{headers:n}).pipe(l(a=>{throw u(a,this.logger)}),T({shouldRetry:H}),this.converter.pipeable(U))}getScheduleReplenishmentOrderEndpoint(e,r,o){return this.occEndpoints.buildUrl("scheduleReplenishmentOrder",{urlParam
1s:{userId:e},queryParams:{cartId:r,termsChecked:o}})}static{this.\u0275fac=function(r){return new(r||t)(d(v),d(O),d(f))}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac})}}return t})(),tr=(()=>{class t{constructor(){this.logger=s(E),this.http=s(v),this.occEndpoints=s(O),this.converter=s(f)}getOrderAttachments(e,r){let o=new p().set("Content-Type","application/json");return this.http.get(this.getOrderAttachmentsUrl(r,e),{headers:o}).pipe(l(i=>{throw u(i,this.logger)}))}downloadOrderAttachment(e,r,o){let i={responseType:"blob"};return this.http.get(this.getDownloadOrderAttachmentUrl(e,r,o),i).pipe(l(n=>{throw u(n,this.logger)}))}getOrderAttachmentsUrl(e,r){return this.occEndpoints.buildUrl("orderAttachments",{urlParams:{userId:r,orderId:e}})}getDownloadOrderAttachmentUrl(e,r,o){return this.occEndpoints.buildUrl("downloadOrderAttachment",{urlParams:{userId:e,orderId:r,attachmentId:o}})}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac})}}return t})(),or=(()=>{class t{convert(e,r){return r===void 0&&(r=m({},e)),r}static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})(),ir=(()=>{class t{constructor(e,r,o){this.http=e,this.occEndpoints=r,this.converter=o,this.logger=s(E)}reorder(e,r){let o=new p().set("Content-Type","application/json");return this.http.post(this.getReorderOrderEndpoint(e,r),{},{headers:o}).pipe(l(i=>{throw u(i,this.logger)}),this.converter.pipeable(J))}getReorderOrderEndpoint(e,r){return this.occEndpoints.buildUrl("reorder",{urlParams:{userId:r},queryParams:{orderCode:e}})}static{this.\u0275fac=function(r){return new(r||t)(d(v),d(O),d(f))}}static{this.\u0275prov=c({token:t,factory:t.\u0275fac})}}return t})(),nr={backend:{occ:{endpoints:{orderHistory:"users/${userId}/orders",orderDetail:"users/${userId}/orders/${orderId}?fields=FULL",quoteCode:"users/${userId}/orders/${orderId}?fields=sapQuoteCode",consignmentTracking:"users/${userId}/orders/${orderCode}/consignments/${consignmentCode}/tracking",cancelOrder:"users/${userId}/orders/${orderId}/cancellation",returnOrder:"users/${userId}/orderReturns?fields=BASIC,returnEntries(BASIC,refundAmount(formattedValue),orderEntry(basePrice(formattedValue),product(name,code,baseOptions,images(DEFAULT,galleryIndex)))),deliveryCost(formattedValue),totalPrice(formattedValue),subTotal(formattedValue)",orderReturns:"users/${userId}/orderReturns?fields=BASIC",orderReturnDetail:"users/${userId}/orderReturns/${returnRequestCode}?fields=BASIC,returnEntries(BASIC,refundAmount(formattedValue),orderEntry(basePrice(formattedValue),product(name,code,baseOptions,images(DEFAULT,galleryIndex)))),deliveryCost(formattedValue),totalPrice(formattedValue),subTotal(formattedValue)",cancelReturn:"users/${userId}/orderReturns/${returnRequestCode}",replenishmentOrderDetails:"users/${userId}/replenishmentOrders/${replenishmentOrderCode}?fields=FULL,costCenter(FULL),purchaseOrderNumber,paymentType,user",replenishmentOrderDetailsHistory:"users/${userId}/replenishmentOrders/${replenishmentOrderCode}/orders",cancelReplenishmentOrder:"users/${userId}/replenishmentOrders/${replenishmentOrderCode}?fields=FULL,costCenter(FULL),purchaseOrderNumber,paymentType,user",replenishmentOrderHistory:"users/${userId}/replenishmentOrders?fields=FULL,replenishmentOrders(FULL, purchaseOrderNumber)",placeOrder:"users/${userId}/orders?fields=FULL",placePaymentAuthorizedOrder:"users/${userId}/orders/paymentAuthorizedOrderPlacement?fields=FULL",orderAttachments:"users/${userId}/orders/${orderId}/attachments",downloadOrderAttachment:"users/${userId}/orders/${orderId}/attachments/${attachmentId}/download"}}}},Le=(()=>{class t{static{this.\u0275fac=function(r){return new(r||t)}}static{this.\u0275mod=j({type:t})}static{this.\u0275inj=b({providers:[ae(nr),{provide:x,useClass:_},{provide:be,useClass:er},{provide:Se,useClass:_e},{provide:Te,useClass:rr},{provide:q,useClass:ir},{provide:we,useClass:tr},{provide:k,useExisting:We,multi:!0},{provide:w,useExisting:Je,multi:!0},{provide:U,useExisting:Ke,multi:!0},{provide:K,useExisting:Xe,multi:!0},{provide:J,useExisting:or,multi:!0}],imports:[oe]})}}return t})();var z=(()=>{class t{logger=s(E);http=s(v);occEndpoints=s(O);converterService=s(f);applyOrderToCart(e,r){let o=this.occEndpoints.buildUrl(`/users/${r}/orders/${e}`),i=new p({"Content-Type":"application/json"});return this.http.post(o,{},{headers:i}).pipe(l(n=>{throw u(n,this.logger)}),this.converterService.pipeable(ve))}static \u0275fac=function(r){return new(r||t)};static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var Ne=(()=>{class t extends _{loadStagedHistory(e,r,o,i,n){let a={};r&&(a.pageSize=r.toString()),o&&(a.currentPage=o.toString()),i&&(a.sort=i.toString()),n&&(a.stage=n.toString());let Qe=new p({"Content-Type":"application/json"}
1),Ge=this.occEndpoints.buildUrl("orderHistory",{urlParams:{userId:e},queryParams:a});return this.http.get(Ge,{headers:Qe}).pipe(this.converter.pipeable(A))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=C(t)))(o||t)}})();static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var B=(()=>{class t{http=s(v);occEndpoints=s(O);report(e,r,o,i){let n=this.occEndpoints.buildUrl(`users/${r}/orders/${e}/report`),a=new p({"Content-Type":"application/json"});return this.http.post(n,{reason:o,message:i},{headers:a})}static \u0275fac=function(r){return new(r||t)};static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var $e=(()=>{class t{logger=s(E);http=s(v);occEndpoints=s(O);converter=s(f);reorder(e,r){return this.moveOrderToCart(e,r)}moveOrderToCart(e,r){let o=this.occEndpoints.buildUrl(`users/${r}/orders/${e}/reorder`),i=new p().set("Content-Type","application/json");return this.http.post(o,{},{headers:i}).pipe(l(n=>{throw u(n,this.logger)}))}static \u0275fac=function(r){return new(r||t)};static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var ke=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=j({type:t});static \u0275inj=b({providers:[B,z,{provide:x,useClass:Ne},{provide:q,useClass:$e}],imports:[Le]})}return t})();var V=(()=>{class t{orderReportAdapter=s(z);applyOrderToCart(e,r){return this.orderReportAdapter.applyOrderToCart(e,r)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var xe=(()=>{class t extends S{getHistory(e,r,o,i,n){return this.adapter.loadStagedHistory(e,r,o,i,n)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=C(t)))(o||t)}})();static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var Y=(()=>{class t{orderReportAdapter=s(B);report(e,r,o,i){return this.orderReportAdapter.report(e,r,o,i)}static \u0275fac=function(r){return new(r||t)};static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var qe=(()=>{class t extends Z{moveOrderToCart(e,r){return this.adapter.moveOrderToCart(e,r)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=C(t)))(o||t)}})();static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var Ze=(()=>{class t{userIdService=s(L);multiCartFacade=s($);activeCartFacade=s(he);orderEditConnector=s(V);activeCartId$=this.activeCartFacade.getActiveCartId();editOrder(e){e&&this.userIdService.takeUserId().pipe(R(r=>this.orderEditConnector.applyOrderToCart(e,r))).subscribe(r=>this.switchActiveCart(r.code))}cancelOrderEditing(){this.activeCartId$.pipe(g()).subscribe(e=>
1this.deleteCart(e))}deleteCart(e){e&&this.userIdService.takeUserId().pipe(g()).subscribe(r=>this.multiCartFacade.deleteCart(e,r))}switchActiveCart(e){e&&this.activeCartId$.pipe(g()).subscribe(r=>{r!==e&&(this.deleteCart(r),this.loadCart(e))})}loadCart(e){e&&this.userIdService.takeUserId().pipe(g()).subscribe(r=>this.multiCartFacade.loadCart({userId:r,cartId:e,extraData:{active:!0}}))}static \u0275fac=function(r){return new(r||t)};static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var ze=(()=>{class t extends Ue{loadOrderList(e,r,o){this.loadStagedOrderList(e,r,o)}loadStagedOrderList(e,r,o,i){re({userId:this.userIdService.takeUserId(!0),replenishmentOrderCode:this.routingService.getRouterState().pipe(y(n=>n?.state?.params?.replenishmentOrderCode),g())}).pipe(g()).subscribe({next:({userId:n,replenishmentOrderCode:a})=>{this.store.dispatch(new He({userId:n,pageSize:e,currentPage:r,sort:o,replenishmentOrderCode:a,stage:i}))}})}static \u0275fac=(()=>{let e;return function(o){return(e||(e=C(t)))(o||t)}})();static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var Be=(()=>{class t{orderReportConnector=s(Y);commandService=s(pe);userIdService=s(L);reportCommand=this.commandService.create(({orderId:e,reason:r,message:o})=>this.reorderPreconditions().pipe(R(i=>this.orderReportConnector.report(e,i,r,o))),{strategy:M.CancelPrevious});report(e,r,o){return this.reportCommand.execute({orderId:e,reason:r,message:o})}reorderPreconditions(){return this.userIdService.takeUserId().pipe(g(),y(e=>
1{if(!e)throw new Error("Must be logged in to reorder");return e}))}static \u0275fac=function(r){return new(r||t)};static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var Ve=(()=>{class t extends Ae{multiCartService=s($);moveOrderToCartCommand=this.commandService.create(({orderId:e})=>this.reorderPreconditions().pipe(R(r=>this.reorderOrderConnector.moveOrderToCart(e,r))),{strategy:M.CancelPrevious});reorder(e){return this.reorderCommand.execute({orderId:e}).pipe(Q(()=>this.activeCartFacade.reloadActiveCart()))}moveOrderToCart(e){return this.moveOrderToCartCommand.execute({orderId:e}).pipe(Q(r=>this.reloadCart(r)))}reloadCart(e){this.userIdService.takeUserId().pipe(g()).subscribe(r=>{this.multiCartService.loadCart({userId:r,cartId:e.code,extraData:{active:!0}})})}reorderPreconditions(){return this.userIdService.takeUserId().pipe(g(),y(e=>{if(!e)throw new Error("Must be logged in to reorder");return e}))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=C(t)))(o||t)}})();static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var Ye=(()=>{class t{actions$=s(ne);orderConnector=s(S);replenishmentOrderConnector=s(je);logger=s(E);loadUserOrders$=ie(()=>this.actions$.pipe(se(Me),y(e=>e.payload),R(e=>te(()=>!!e.replenishmentOrderCode,this.replenishmentOrderConnector.loadReplenishmentDetailsHistory(e.userId,e.replenishmentOrderCode??"",e.pageSize,e.currentPage,e.sort),this.orderConnector.getHistory(e.userId,e.pageSize,e.currentPage,e.sort,e.stage)).pipe(y(r=>new W.LoadUserOrdersSuccess(r)),l(r=>ee(new W.LoadUserOrdersFail(u(r,this.logger))))))));static \u0275fac=function(r){return new(r||t)};static \u0275prov=c({token:t,factory:t.\u0275fac})}return t})();var eo=(()=>{class t{static \u0275fac=function(r){return new(r||t)};static \u0275mod=j({type:t});static \u0275inj=b({providers:[S,Y,V,{provide:Z,useClass:qe},{provide:S,useClass:xe},{provide:Oe,useClass:ze},{provide:ge,useClass:Ve},{provide:Pe,useClass:Be},{provide:Fe,useClass:Ze}],imports:[De,ke,ce.forFeature([Ye])]})}return t})();export{eo as TrnOrderCoreModule};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.