1import{a as Z}from"./chunk-WKT2OV7X.js";import{a as X}from"./chunk-OTPSXN5W.js";import"./chunk-HWUAPOG4.js";import{c as L}from"./chunk-CPGQVWDD.js";import"./chunk-IBG7PAGI.js";import"./chunk-3H5UXPSR.js";import{c as H,d as j,f as z,g as B,j as q,l as J,n as K,o as Q,t as W,v as Y}from"./chunk-CROCF34Y.js";import"./chunk-F5HBV2KF.js";import{e as V}from"./chunk-MAHCQHCQ.js";import{s as k}from"./chunk-JO4T6CWA.js";import{$b as A,Ab as m,Eb as x,Ib as w,Jb as $,Kb as _,Ob as b,P as D,Pb as p,Ua as a,V as l,Z as f,_b as v,bb as u,ha as E,ia as S,jb as C,jc as U,kc as N,pb as s,tb as I,ua as h,ub as G,wb as P,xb as F,yb as i,zb as o}from"./chunk-POW3FRHD.js";import{g as O}from"./chunk-OAJD7WE5.js";var ee=r=>(t,e)=>r.createOrUpdateOrderNpsByOrderId(t,e);var c=class r{http=l(V);createOrUpdateOrderNpsByOrderId=(t,e)=>O(this,null,function*(){try{return yield ee(Z(this.http))(t,e);}catch(n){let d=n;throw this.handleOrderNpsError(d),n;}});handleOrderNpsError(t){if(typeof t.error!="string")return;let e=t.error;if(e.includes("ORD01")||e.includes("Order not registered"))throw new R();}static ɵfac=function(e){return new(e||r)();};static ɵprov=D({token:r,factory:r.ɵfac});},R=class extends Error{constructor(){super("Order not registered"),this.name="OrderNotRegisteredError",this.cause="ORD01";}};function ie(r,t){if(r&1&&(i(0,"span",11)(1,"label",14),v(2),o(),m(3,"input",15),o()),r&2){let e=t.$implicit;a(),s("for",e),a(),A(e),a(),s("id",e)("value",e);}}function oe(r,t){if(r&1&&(i(0,"div",12),v(1),o()),r&2){let e=p(2);a(),A(e.errorMessage());}}function ae(r,t){if(r&1){let e=x();i(0,"div",6)(1,"h1",8),w(2,0),m(3,"u"),$(),o(),i(4,"form",9),b("ngSubmit",function(){E(e);let d=p();return S(d.onSubmit());}),i(5,"div",10),P(6,ie,4,4,"span",11,G),o(),C(8,oe,2,1,"div",12),i(9,"button",13),_(10,1),o()()();}if(r&2){let e=p();a(4),s("formGroup",e.form),a(2),F(e.ratingOptions),a(2),I(e.errorMessage()?8:-1),a(),s("disabled",e.form.invalid||e.submitStatus()===e.SubmitStatus.Submitting);}}function de(r,t){if(r&1){let e=x();i(0,"div",7)(1,"div",16),m(2,"img",17),o(),i(3,"h1",18),_(4,2),o(),i(5,"p",19),_(6,3),o(),i(7,"button",20),b("click",function(){E(e);let d=p();return S(d.goToHome());}),_(8,4),o()();}}var re=(n=>(n.Idle="idle",n.Submitting="submitting",n.Completed="completed",n))(re||{}),T=class r{fb=l(W);orderRatingFacadeService=l(c);navigationService=l(X);orderId=h.required();submitStatus=u("idle");errorMessage=u(null);ratingOptions=Array.from({length:5},(t,e)=>e+1);form=this.fb.group({rating:this.fb.control(null,{validators:j.required})});onSubmit(){return O(this,null,function*(){if(this.submitStatus.set("submitting"),this.form.invalid){this.form.markAllAsTouched(),this.submitStatus.set("idle");return;}let t=this.form.value.rating;if(t!==null)try{yield this.orderRatingFacadeService.createOrUpdateOrderNpsByOrderId(t,this.orderId()),this.submitStatus.set("completed");}catch(e){if(e instanceof R){this.errorMessage.set("Ha ocurrido un error al enviar tu valoraci\xF3n. Puedes intentarlo de nuevo.");return;}throw e;}});}goToHome(){this.navigationService.goTo([""]);}SubmitStatus=re;static ɵfac=function(e){return new(e||r)();};static ɵcmp=f({type:r,selectors:[["app-order-rating"]],inputs:{orderId:[1,"orderId"]},standalone:!0,features:[U([c]),N],decls:3,vars:1,consts:()=>{let t;t="En una "+"\uFFFD#3\uFFFD"+"escala de 1 al 5"+"\uFFFD/#3\uFFFD"+", qu\xE9 probabilidad hay de que nos recomiendes a alguien de tu confianza?";let e;e="Valorar";let n;n="\xA1Gracias por tu valoraci\xF3n!";let d;d="Tu opini\xF3n nos ayuda a seguir mejorando.";let M;return M="Volver a la p\xE1gina principal",[t,e,n,d,M,[1,"flex","flex-col","items-center","gap-6","text-center","my-20"],[1,"flex","flex-col","items-center","gap-10","w-full","max-w-xl","rounded-2xl","border","border-gray-200","bg-white","px-8","py-10","shadow-md"],[1,"flex","flex-col","items-center","gap-5","w-full","max-w-xl","rounded-2xl","border","border-gray-200","bg-white","px-8","py-10","shadow-md"],[1,"text-xl","font-medium","w-[90%]","md:w-3/4"],[1,"flex","flex-col","items-center","gap-8","w-full",3,"ngSubmit","formGroup"],[1,"flex","flex-row","flex-wrap","justify-center","gap-3","md:gap-6"],[1,"flex","flex-col","items-center","gap-1"],["role","alert",1,"w-full","max-w-xs","rounded-lg","border","border-red-200","bg-red-50","px-3","py-2","text-sm","font-normal","text-red-700"],["type","submit",1,"button-solid","w-full","max-w-xs",3,"disabled"],[1,"text-base","font-medium","cursor-pointer",3,"for"],["type","radio","formControlName","rating",1,"w-5","h-5","cursor-pointer",3,"id","value"],[1,"flex","items-center","justify-center","w-16","h-16","rounded-full","border","border-[#7a9b49]","shadow-sm"],["src","images/icons/ok-tick-green-icon.svg","alt","","aria-hidden","true",1,"w-9","h-9"],[1,"text-2xl","font-medium"],[1,"text-base","text-center"],["type","button",1,"button-solid","w-full","max-w-xs",3,"click"]];},template:function(e,n){e&1&&(i(0,"div",5),C(1,ae,11,3,"div",6)(2,de,9,0,"div",7),o()),e&2&&(a(),I(n.submitStatus()!==n.SubmitStatus.Completed?1:2));},dependencies:[k,Y,q,H,J,z,B,K,Q],encapsulation:2});};var y=class r{route=l(L);orderId=u(null);
1ngOnInit(){let t=this.route.snapshot.queryParamMap.get("orderId"),e=t!==null?Number(t):null;this.orderId.set(Number.isNaN(e)?null:e);}static ɵfac=function(e){return new(e||r)();};static ɵcmp=f({type:r,selectors:[["app-order-rating-page"]],standalone:!0,features:[N],decls:2,vars:1,consts:[[1,"flex","flex-col","content-max"],[3,"orderId"]],template:function(e,n){e&1&&(i(0,"section",0),m(1,"app-order-rating",1),o()),e&2&&(a(),s("orderId",n.orderId()));},dependencies:[T],encapsulation:2});};export{y as default};/**i18n:823fe18dcb7916ede78f62290696ecc6d1371ad468a3df5ed6bf7ead1dd24313*/
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.