1"use strict";(globalThis.webpackChunkantd_demo_ts||=[]).push([[796],{18348(e,s,a){a.r(s),a.d(s,{default:()=>T});var o=a(65043),t=a(95639),n=a(47419),l=a(11645),c=a(64124),i=a(89421),d=a(57319),r=a(94412),u=a(97929),m=a(46555),p=a(5503),A=a(34256),x=a(68451),g=a(56396),h=a(87243),j=a(93482),_=a(19459);var v=a(32505),N=a(16142),f=a(77850),y=a(61901),C=a(5835),w=a(60388);const b=a.p+"static/media/ticket-descuento.3611dc178a9cad6e0e41.webp";var D=a(70579);const R={valor:0,descuento:0,total:0,porcentaje:0,labelValor:"Valor",labelDescuento:""},S=e=>({COLINA:"COLINA","CORDILLERA PLUS":"CORDILLERA","SOMOS RETENCION":"SOMOS PARTNER",CORDILLERA:"CORDILLERA",VALLE:"SOMOS PARTNER",MONTANA:"MONTA\xd1A"}[e]||e),O=(e,s)=>e?(0,D.jsx)(d.A,{style:{fontSize:"2rem",color:"green"},spin:!0}):(0,y.OY)(s.valor),E=e=>e.labelDescuento,k=(e,s)=>e?(0,D.jsx)(d.A,{style:{fontSize:"2rem",color:"green"},spin:!0}):0!==s.descuento?`-${(0,y.OY)(s.descuento)}`:"",I=(e,s)=>e?(0,D.jsx)(d.A,{style:{fontSize:"2rem",color:"green"},spin:!0}):(0,y.OY)(s.total),M={cuponCard:"styles_cuponCard__rsaMJ",inputRow:"styles_inputRow__dy2yp",detailsRow:"styles_detailsRow__dVZ1d",totalRow:"styles_totalRow__bVp+4",commentRow:"styles_commentRow__dCSxx",headerRow:"styles_headerRow__GGHW2",imgContainer:"styles_imgContainer__Ci1Os",titleContainer:"styles_titleContainer__FNOrs",title:"styles_title__zbs+h",inputGroup:"styles_inputGroup__fm+0i",cuponInput:"styles_cuponInput__-DCNa",applyBtn:"styles_applyBtn__L-tCU",tarifaRow:"styles_tarifaRow__8SJat",discountRow:"styles_discountRow__MDzk1",commentRowAlert:"styles_commentRowAlert__rldx5",cuponCodeRow:"styles_cuponCodeRow__7g2AE",cuponCodeContainer:"styles_cuponCodeContainer__pbB+8",removeButton:"styles_removeButton__XmKBK"}
1,F=e=>{let{cuponValidado:s,formDiscount:a,onFinishDiscount:o,cuponError:n,onChangeDiscount:l,discountCode:c,loadingCupon:r,loadingValor:u,loadingDescuento:m,loadingTotal:p,quote:A,onRemoveDiscount:x,esCuponAutomatico:g}=e;return(0,D.jsxs)("div",{className:M.cuponCard,children:[(0,D.jsxs)("div",{className:M.inputRow,children:[(0,D.jsxs)("div",{className:M.headerRow,children:[(0,D.jsx)("div",{className:M.imgContainer,children:(0,D.jsx)("img",{src:b,alt:"img-cupon"})}),(0,D.jsx)("div",{className:M.titleContainer,children:(0,D.jsx)("span",{className:M.title,children:"Ingresa un cup\xf3n de descuento"})})]}),s?(0,D.jsxs)("div",{className:M.cuponCodeRow,children:[(0,D.jsx)("span",{children:"C\xd3DIGO"}),(0,D.jsxs)("div",{className:M.cuponCodeContainer,children:[(0,D.jsx)("span",{children:c}),x&&(0,D.jsx)("button",{className:M.removeButton,onClick:x,type:"button",children:"X"})]})]}):r?(0,D.jsx)("div",{className:M.loadingContainer,children:(0,D.jsx)(d.A,{style:{fontSize:"2rem",color:"green"},spin:!0})}):(0,D.jsx)(t.A,{form:a,name:"formStepQueEnvias",onFinish:o,autoComplete:"off",className:"w-100",children:(0,D.jsx)(t.A.Item,{name:"cupon",rules:w.tp.cupon,help:n,validateStatus:""!==n?"error":"",children:(0,D.jsxs)(C.A.Group,{compact:!0,className:M.inputGroup,children:[(0,D.jsx)(C.A,{placeholder:"EJ: Aoce202154",autoComplete:"sipe",maxLength:20,onChange:l,value:c,className:M.cuponInput}),(0,D.jsx)(i.A,{id:"emi-aplicar-cupon",className:M.applyBtn,onClick:()=>((e,s)=>{e&&(s.validateFields(["cupon"]),s.submit())})(c,a),type:"primary",children:"Aplicar"})]})})})]}),(0,D.jsxs)("div",{className:M.detailsRow,children:[(0,D.jsxs)("div",{className:M.tarifaRow,children:[(0,D.jsx)("span",{className:M.text,children:A.labelValor}),(0,D.jsx)("span",{className:M.value,children:O(u,A)})]}),(0,D.jsxs)("div",{className:M.discountRow,children:[(0,D.jsx)("span",{className:M.text,children:E(A)}),(0,D.jsx)("span",{className:M.value,children:k(m,A)})]})]}),(0,D.jsxs)("div",{className:M.totalRow,children:[(0,D.jsx)("span",{className:M.totalText,children:"Total"}),(0,D.jsx)("span",{className:M.totalValue,children:I(p,A)})]}),(0,D.jsx)("div",{className:M.commentRow,children:(0,D.jsxs)("div",{className:M.commentRowAlert,children:[(0,D.jsx)("img",{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAB+UExURQAAAP////////////////////////////////////////////////D69IjRpky6eRCjTD20bqXdvOH06C6vYi6vY+H06fD59KXduy6uYofRpZbXsB+pV1vAhNLu3WnFj5fXsbTix6XcvC6uY+Hz6OHz6aXcuzy0bUu6eAAAAGGclXIAAAAMdFJOUwBAkN/PnyAQj6Dg0EppHIcAAAABYktHRACIBR1IAAAACXBIWXMAAABkAAAAZAAPlsXdAAAAB3RJTUUH6gIXEDYHx1sJpAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyNi0wMi0yM1QxNjo1NDowNyswMDowMHfcEqsAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjYtMDItMjNUMTY6NTQ6MDcrMDA6MDAGgaoXAAAAKHRFWHRkYXRlOnRpbWVzdGFtcAAyMDI2LTAyLTIzVDE2OjU0OjA3KzAwOjAwUZSLyAAAAJxJREFUGNM1j9kWgjAMRNNSaMERUlERVFxw+/8vNF2Yp9xpz2RCJFK6AExZUZJ1yHI2ssG27Zj9Tn4Fx6Hfc9ThCEdUAZnFGaCoxinjyDxBk4FPfO6ZOxQECPiLPF5lAJIxzze0nIwGXcy/B/YwpDGF/EfMeaIkhWFc1y6A1Nd4ZWd5y9ZYHZ8v828aUnWyej1O23xvVW+ARqsw/wGhmgzmhiih3QAAAABJRU5ErkJggg==",alt:"Check-icon"}),g?"Tarifa v\xe1lida solo a trav\xe9s de emisi\xf3n www.starken.cl":"Paga ahora y obt\xe9n un mejor precio en tu env\xedo."]})})]})};var U=a(76079);const V=(0,o.forwardRef)(function(e,s){var a,C;let{stepDondeRadioValue:w,userSession:b,currentOF:O,currentStep:E,limpiarPasosHasta:k,setDisableContinuarStep5:I,setCurrentOF:M,discountCode:V,setDiscountCode:T,cuponObtenido:z}=e;const{configStepDesde:L,configStepDestinatario:G,configStepDondeDomicilio:B,configStepDondeAgencia:P,configStepDondeSelectedOption:X,configStepQueEnvias:$,configStepDetalleEnvio:H,setConfigStepDetalleEnvio:J,setConfigStepDestinatario:Y}=(0,m.D)(),[Z,W]=(0,o.useState)(!1),[Q,q]=(0,o.useState)(N.Ez),[K,ee]=(0,o.useState)(!1),[se,ae]=(0,o.useState)(!1),[oe,te]=(0,o.useState)(null),[ne,le]=(0,o.useState)(!1),[ce,ie]=(0,o.useState)(!1),[de,re]=(0,o.useState)(!1),[ue,me]=(0,o.useState)(!1),[pe,Ae]=(0,o.useState)(!1),[xe,ge]=(0,o.useState)(""),[he,je]=(0,o.useState)(R),[_e,ve]=(0,o.useState)(!1),[Ne,fe]=(0,o.useState)(!1),[ye,Ce]=(0,o.useState)(!1),[we,be]=(0,o.useState)(!1),[De,Re]=(0,o.useState)(!1),[Se]=t.A.useForm(),Oe=(0,o.useRef)(null),Ee=()=>{fe(!Ne),ae(!1)},ke=()=>{Ce(!ye),ae(!1)},Ie="AGENCIA"===X.tipo_entrega?"Punto de venta":"Domicilio",Me="Domicilio"===Ie?`${B.direccion_dest} ${B.numeracion_dest}${B.casa_depto_dest&&`, ${B.casa_depto_dest}`}${B.comuna_dest&&`, ${B.comuna_dest}`}`:`${P.agencia_descripcion_dest}, ${P.comuna_dest}`,Fe=(e,s,a,o)=>{const t=e.tipoCliente,n=t&&0!==e.descuento;if(void 0!==s&&s>0){const o=e.tarifaSinDescuento-e.tarifaSinDescuento*(s/100),t=10*Math.round(o/10),n=e.tarifaSinDescuento-t;return{valor:e.tarifaSinDescuento,descuento:n,total:t,porcentaje:s,labelValor:"Valor",labelDescuento:a||`Descuento cup\xf3n ${s}%`}}return o?{valor:e.tarifa,descuento:0,total:e.tarifa,porcentaje:0,labelValor:"Tarifa exclusiva online",labelDescuento:""}:{valor:e.tarifaSinDescuento,descuento:e.tarifaSoloDescuento,total:e.tarifa,porcentaje:e.descuento,labelValor:n?`Tarifa ${S(t)}`:"Valor",labelDescuento:n?`Descuento ${S(t)} ${e.descuento}%`:""}},Ue=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:z,s=arguments.length>1?arguments[1]:void 0;const a=null===e,o=b.run.slice(0,-1),t=U.A.cod.ems.split(",")[0],n=U.A.cod.ems_ctz.split(",")[0],l=!a&&(null==e?void 0:e.codigo_promo)===n,c=!a&&(null==e?void 0:e.codigo_promo)===t,i=l||c;ve(i);let d=G.rut_dest;d=(0,y.J0)(d),d=d.slice(0,-1);const r="DOMICILIO"===w?0:P.agencia_codigo_dest,u="DOMICILIO"===w?B.ciudad_codigo_dest:P.ciudad_codigo_dest,m={entrega:X.tipo_entrega,codigoTipoPago:3,tipoServicio:"NORMAL",codigoCiudadOrigen:L.ciudad_codigo_origen,codigoCiudadDestino:u,codigoAgenciaDestino:r,codigoAgenciaOrigen:L.agencia_codigo_origen,rutCliente:a?o:l?U.A.cod.ems_ctz.split(",")[1]:U.A.cod.ems.split(",")[1],rutDestinatario:d,encargos:[{tipoEncargo:29,alto:Number($.alto),ancho:Number($.ancho),largo:Number($.largo),kilos:Number($.peso)}]};try{const e=await g.A.getTarifaPlus(m);if(201===e.status){const{data:o}=e;if(a&&s){const e=s.descuento;je(Fe(o,e,`Descuento cup\xf3n ${e}%`)),le(!0),T(s.codigo_promo),Oe.current=s,Se.setFieldsValue({cupon:s.co
1digo_promo}),Te()}else je(Fe(o,void 0,void 0,i)),Oe.current=null,Te();q(o),(async(e,s)=>{if(s){const a={...H,descuento_aplicado:!0,cupon_descuento:s,tarifa:e};await J(a)}else{const s={agencia:"",codigo_promo:"",descripcion:"",descuento:0,fecha_expiracion:"",habilitado:!1,nombre_corto:"",tipo_cliente:0,tipo_cliente_original:0,uso_unico:!1},a={...H,descuento_aplicado:!1,cupon_descuento:s,tarifa:e};await J(a)}})(o,s),I(!1)}else I(!0);W(!1)}catch{I(!0)}};(0,o.useEffect)(()=>{if(5===E)if(W(!0),H.descuento_aplicado){const e=H.cupon_descuento;Ue(null,e)}else(0,v.X)().then(e=>{Ue(null!=e?e:z)});ee(!0)},[]);const Ve=async e=>{const s=await(0,f.dc)(e),a={payload:(0,A.i)(h.iv,JSON.stringify(s))},o=await x.A.validar(a);if(200===o.status){const e=(0,A.r)(h.iv,o.data.payload);if(200===e.statusCode){const s=e.payload[0],a=s.descuento;return je(Fe(Q,a,`Descuento cup\xf3n ${a}%`)),ge(""),le(!0),Oe.current=s,J({...H,descuento_aplicado:!0,cupon_descuento:s}),H.descuento_aplicado||Te(),{status:e.statusCode,payload:s}}return ge(e.message[0]),le(!1),ie(!1),J({...H,descuento_aplicado:!1}),{status:e.statusCode,payload:null}}return ge("Cup\xf3n no v\xe1lido o expirado"),ie(!1),J({...H,descuento_aplicado:!1}),{status:o.status,payload:null}},Te=()=>{(0,f.lp)(ie,re,me,Ae)},ze=async()=>{try{if(null!==O&&0!==Number(O))return void be(!1);const s=await(async()=>{be(!0);const e=await(0,v.X)();return await(0,f.Jn)(L,G,$,X,P,B,b,H,ne,V,null!=e?e:z,Oe.current)})(),a=await g.A.createEmision(s);if(201===a.status){var e;const{data:{id:s}}=a,o=await(async e=>await(0,f.Dq)(e,N.Mg.maxIntentos,N.Mg.delay,e=>g.A.getEtiqueta(e)))(s);200===(null==o?void 0:o.status)&&"0"!==(null==o||null===(e=o.data)||void 0===e?void 0:e.of)?M(o.data.of):(M(null),fe(!0),be(!1))}else M(null),fe(!0),be(!1)}catch{M(null),fe(!0),be(!1)}},Le=async()=>Re(!De);return(0,o.useImperativeHandle)(s,()=>({emision:async()=>{await(async()=>{H.descuento_aplicado?200===(await Ve(H.cupon_descuento.codigo_promo)).status?await ze():(Se.setFieldsValue({cupon:""}),Se.validateFields(["cupon"]),ge(""),await Le()):await ze()})()}})),K?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(n.A,{justify:"center",className:"w-100",children:[(0,D.jsx)(l.A,{span:24,className:"w-100 nd-detalle-container",children:(0,D.jsxs)(n.A,{justify:"center",className:"w-100",gutter:[24,24],children:[(0,D.jsx)(l.A,{xs:24,sm:24,md:24,lg:24,xl:16,xxl:16,children:(0,D.jsx)("table",{className:"details-table word-break",children:(0,D.jsxs)("tbody",{children:[(0,D.jsxs)("tr",{className:"txt-overflow-elipsis",children:[(0,D.jsx)("td",{className:"label",children:"Recibe"}),(0,D.jsxs)("td",{children:[G.nombre_dest," ",G.apellido_dest]})]}),(0,D.jsxs)("tr",{className:"txt-overflow-elipsis",children:[(0,D.jsx)("td",{className:"label",children:"Email"}),(0,D.jsx)("td",{children:G.email_dest})]}),(0,D.jsxs)("tr",{className:"txt-overflow-elipsis",children:[(0,D.jsx)("td",{className:"label",children:"Destino"}),(0,D.jsx)("td",{children:Ie})]}),(0,D.jsxs)("tr",{className:"txt-overflow-elipsis",children:[(0,D.jsx)("td",{className:"label",children:Ie}),(0,D.jsx)("td",{children:Me})]}),(0,D.jsxs)("tr",{className:"txt-overflow-elipsis",children:[(0,D.jsx)("td",{className:"label",children:"Valor declarado"}),(0,D.jsxs)("td",{children:["$",$.valor_declarado]})]}),(0,D.jsxs)("tr",{className:"txt-overflow-elipsis",children:[(0,D.jsx)("td",{className:"label",children:"Tama\xf1o"}),(0,D.jsx)("td",{children:"P"===(null===(a=$.medida)||void 0===a?void 0:a.toLocaleUpperCase())?`${$.largo}x${$.ancho}x${$.alto} cm`:`Talla ${null===(C=$.medida)||void 0===C?void 0:C.toLocaleUpperCase()}`})]}),"p"===$.medida?(0,D.jsxs)("tr",{className:"txt-overflow-elipsis",children:[(0,D.jsx)("td",{className:"label",children:"Peso"}),(0,D.jsxs)("td",{children:[$.peso,"kg"]})]}):null]})})}),Z?(0,D.jsx)(l.A,{xs:24,sm:24,md:24,lg:8,xl:8,xxl:8,children:(0,D.jsx)(n.A,{className:"w-100",justify:"center",children:(0,D.jsx)(d.A,{style:{fontSize:50,color:"green"},spin:!0})})}):(0,D.jsx)(l.A,{xs:24,sm:24,md:18,lg:18,xl:8,xxl:8,className:"",style:{paddingRight:0},children:(0,D.jsx)(F,{cuponValidado:ne,formDiscount:Se,onFinishDiscount:async e=>{const s=e.cupon;if(ie(!0),void 0!==s&&""!==s&&null!==s){const e=await Ve(s);200===e.status&&e.payload&&Ue(null,e.payload)}},cuponError:xe,onChangeDiscount:e=>{T(e.target.value.toUpperCase()),Se.setFieldsValue({cupon:e.target.value.toUpperCase()}),Se.validateFields(["cupon"]),""===e.target.value&&(Se.resetFields(),ge(""))},discountCode:V,loadingCupon:ce,loadingValor:de,loadingDescuento:ue,loadingTotal:pe,quote:he,onRemoveDiscount:()=>{le(!1),T(""),ge(""),Oe.current=null,Se.resetFields(),je(Fe(Q)),J({...H,descuento_aplicad
1o:!1}),(0,v.X)().then(e=>{Ue(null!=e?e:z)})},esCuponAutomatico:_e})})]})}),"TUR-CLUB"===b.category||"GENERAL"===b.category||b.category===U.A.cod.ems||b.category===U.A.cod.ems_ctz?(0,D.jsx)("div",{className:"styles_commentRow__qKW4z",children:(0,D.jsxs)("div",{className:"styles_commentRowAlert__9azKv",children:[(0,D.jsx)(r.g,{color:"#ffc107",size:"lg",icon:u.tUE}),"Precio por tiempo limitado enviando por Starken.cl"]})}):null]}),(0,D.jsx)(c.A,{open:ye,onOk:ke,onCancel:ke,footer:null,className:"ant-modal-nlg ant-modal-content-nlg ant-modal-body-nlg",centered:!0,closable:!1,maskClosable:!1,keyboard:!1,children:(0,D.jsxs)("div",{className:"modal-container-nlg",children:[(0,D.jsx)("img",{className:"nlg-modal-icon",src:p,alt:"error-icon"}),(0,D.jsx)("h3",{color:"tomato",children:"Tuvimos un problema"}),(0,D.jsx)("p",{children:"No se pudo crear el env\xedo. Por favor, intenta m\xe1s tarde."}),(0,D.jsx)(n.A,{justify:"center",className:"w-100",gutter:6,children:(0,D.jsx)(l.A,{span:12,children:(0,D.jsx)(i.A,{className:"w-100 btn-modal-double-btn bg-color-stk-alt zoom-effect-btn",onClick:ke,children:"Cerrar"})})})]})}),(0,D.jsx)(c.A,{open:De,onOk:Le,onCancel:Le,footer:null,className:"ant-modal-pudos ant-modal-content-pudos ant-modal-body-pudos",centered:!0,closable:!1,maskClosable:!1,keyboard:!1,children:(0,D.jsx)("div",{className:"modal-container-preemision",children:(0,D.jsxs)("div",{children:[(0,D.jsx)(r.g,{color:"#FE883E",icon:u.tUE,size:"3x"}),(0,D.jsx)("p",{className:"pt-10",children:"El cup\xf3n ya no es v\xe1lido. \xbfQuieres continuar sin de
1scuento?"}),(0,D.jsxs)(n.A,{justify:"center",className:"w-100",gutter:[16,16],children:[(0,D.jsx)(l.A,{xs:20,md:12,children:(0,D.jsx)(i.A,{className:"w-100 btn-modal-double-btn bg-color-stk-alt zoom-effect-btn",onClick:()=>{Le()},children:"Usar\xe9 otro cup\xf3n"})}),(0,D.jsx)(l.A,{xs:20,md:12,children:(0,D.jsx)(i.A,{className:"w-100 btn-modal-double-btn bg-color-stk zoom-effect-btn",onClick:()=>{Re(!1),ze()},children:"Continuar"})})]})]})})}),we?(0,D.jsx)(j.A,{}):null,(0,D.jsx)(c.A,{open:Ne,onOk:Ee,onCancel:Ee,footer:null,className:"ant-modal-nlg ant-modal-content-nlg ant-modal-body-nlg",centered:!0,closable:!1,maskClosable:!1,keyboard:!1,children:(0,D.jsx)("div",{className:"modal-container-nlg",children:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("img",{className:"nlg-modal-icon",src:p,alt:"error-icon"}),(0,D.jsx)("p",{className:"pt-10",children:"No se pudo crear el env\xedo. Por favor, intenta m\xe1s tarde."}),(0,D.jsx)(n.A,{justify:"center",className:"w-100",gutter:[8,8],children:(0,D.jsx)(l.A,{xs:20,md:12,children:(0,D.jsx)(i.A,{className:"w-100 btn-modal-double-btn bg-color-stk-alt zoom-effect-btn",onClick:()=>Ee(),children:"Cerrar"})})})]})})}),(0,D.jsx)(_.A,{nuevaPreemision:se,handleModalDestVolver:()=>{ae(!1),fe(!0)},destinatarios:H.acc_destinatarios||[],crearNueva:()=>{if(fe(!1),0===oe)k(1);else{const e=H.acc_destinatarios[oe-1];Y(e),k(2)}},selectDestinatario:oe,handleChangeSelect:e=>te(e)})]}):(0,D.jsx)("div",{className:"bg-white dynamic-txt txt-center pt-200 txt-15vh",children:(0,D.jsx)(d.A,{style:{fontSize:100},spin:!0})})}),T=V}}]);
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.