https://www.mercadodeflores.pe/component---src-pages-proceso-compra-index-js-d1b87bdf87b171d2b85d.js
1"use strict";(self.webpackChunkmf_web_gatsby=self.webpackChunkmf_web_gatsby||[]).push([[3708],{780:function(e,t,a){var r=a(6540),n=a(7256);t.A=function(e){let{width:t=200,color:a="#A3B932"}=e;return r.createElement("div",{className:"flex h-full w-full items-center justify-center bg-white "},r.createElement(n.ZY,{width:t,color:a}))}},1476:function(e,t,a){var r=a(6540);t.A=e=>{let{disabled:t=!1,onClick:a,text:n}=e;return r.createElement("button",{className:"btn btn-success w-full transform rounded-full py-3 font-bold normal-case text-white drop-shadow-sm transition-all duration-500 hover:scale-105 hover:bg-green-700 "+(t?"btn-disabled":"btn-active"),disabled:t,onClick:()=>a()},n)}},1758:function(e,t,a){a.d(t,{A:function(){return i}});var r=a(6540),n=a(2644);const o=[{id:"extras",label:"Detalles extra"},{id:"delivery",label:"Datos de entrega"},{id:"payment",label:"Pago"}];function l(e){let{step:t="delivery"}=e;const a=o.findIndex((e=>e.id===t));return r.createElement("header",{className:"purchase-header"},r.createElement("div",{className:"purchase-header__inner"},r.createElement("img",{className:"purchase-header__logo",src:"https://cdn.mercadodeflores.pe/mercado-de-flores.png",alt:"Mercado de flores",width:"144"}),r.createElement("ol",{className:"purchase-steps","aria-label":"Progreso de tu compra"},o.map(((e,t)=>r.createElement("li",{key:e.id,"aria-current":t===a?"step":void 0,className:t<a?"is-complete":""},r.createElement("span",{className:"purchase-steps__number","aria-hidden":"true"},t<a?r.createElement(n.YrT,null):t+1),r.createElement("span",null,e.label))))),r.createElement("a",{className:"purchase-header__help",href:"https://wa.link/flores",target:"_blank",rel:"noopener noreferrer","aria-label":"¿Necesitas ayuda? Abrir WhatsApp en otra pestaña"},r.createElement(n.X6_,{"aria-hidden":"true"})," Ayuda")))}function c(){return r.createElement("footer",{className:"purchase-footer"},r.createElement("p",null,"Mercado de flores · Un detalle, muchas emociones."),r.createElement("nav",{"aria-label":"Información legal de la compra"},r.createElement("a",{href:"/terminos/",target:"_blank",rel:"noopener noreferrer","aria-label":"Términos y condiciones (abre otra pestaña)"},"Términos y condiciones"),r.createElement("a",{href:"/privacidad/",target:"_blank",rel:"noopener noreferrer","aria-label":"Privacidad (abre otra pestaña)"},"Privacidad"),r.createElement("a",{href:"/reclamaciones/",target:"_blank",rel:"noopener noreferrer","aria-label":"Libro de reclamaciones (abre otra pestaña)"},"Libro de reclamaciones")))}function i(e){let{children:t,step:a="delivery",stickyAction:n=!1}=e;return r.createElement("div",{className:"purchase-layout"+(n?" purchase-layout--sticky-action":"")},r.createElement("a",{className:"purchase-skip",href:"#purchase-content"},"Ir al contenido de la compra"),r.createElement(l,{step:a}),r.createElement("main",{id:"purchase-content",className:"purchase-content",tabIndex:-1},t),r.createElement(c,null))}},4044:function(e,t,a){a.d(t,{$:function(){return i},Bs:function(){return r},MS:function(){return l},kA:function(){return c},m_:function(){return o}});const r=e=>{let t=e.personalization;if("string"==typeof t)try{t=JSON.parse(t)}catch{t=[]}return Array.isArray(t)?t:[]},n=e=>{const t=Number(e.cantidad);return Number.isInteger(t)&&t>0?t:1},o=e=>{const t=r(e);return Array.from({length:n(e)},((a,r)=>{var n,o;const l=t.find((e=>Number(e.key)===r+1))||{};return{key:r+1,mensaje:"string"==typeof l.mensaje?l.mensaje:"",frase_globo:"string"==typeof l.frase_globo?l.frase_globo:"",url_imagen_dedicatoria:Array.isArray(l.url_imagen_dedicatoria)?l.url_imagen_dedicatoria.filter((e=>"string"==typeof e&&e.trim())).slice(0,1):[],is_mensaje_qr:null!==(n=null!==(o=l.is_mensaje_qr)&&void 0!==o?o:e.is_mensaje_qr)&&void 0!==n?n:0}}))},l=(e,t)=>{const a=[];return t.mensaje.trim()||a.push("el mensaje de dedicatoria"),t.mensaje.length>450&&a.push("un mensaje de hasta 450 caracteres"),1!==Number(e.globo)||t.frase_globo.trim()||a.push("la frase del globo"),1===Number(e.globo)&&t.frase_globo.length>30&&a.push("una frase de hasta 30 caracteres"),1!==Number(e.solicita_foto)||t.url_imagen_dedicatoria.length||a.push("la foto"),a},c=e=>{if(!e)return"";const t=e.replace(/^(?:https?:)?\/\/[^/]+/i,"").replace(/(^|\/)mf-app(?=\/|$)/g,"$1").replace(/^\/+/,"");return`${"https://cdn.mercadodeflores.pe/".replace(/\/+$/,"")}/${t}`},i=e=>e.map((e=>({id_producto:e.id_producto,personalization:e.personalization.map((t=>({key:t.key,mensaje:t.mensaje.trim(),...1===Number(e.globo)?{frase_globo:t.frase_globo.trim()}:{},...1===Number(e.es_tienda_con_qr)?{is_mensaje_qr:t.is_mensaje_qr}:{},url_imagen_dedicatoria:1===Number(e.solicita_foto)?t.url_imagen_dedicatoria:[]})))}
1)))},5194:function(e,t,a){a.d(t,{A:function(){return o}});var r=a(6540),n=a(2644);function o(e){let{open:t,className:a="",onClose:o,icon:l,eyebrow:c,title:i,description:s,children:m,primaryAction:d,secondaryAction:u}=e;const p=(0,r.useRef)(null),_=(0,r.useRef)(null),E=(0,r.useId)(),h=(0,r.useId)();return(0,r.useEffect)((()=>{var e;if(!t)return;const a=p.current,r=document.activeElement,n=document.body.style.overflow;return a.showModal(),document.body.style.overflow="hidden",null===(e=_.current)||void 0===e||e.focus({preventScroll:!0}),()=>{a.close(),document.body.style.overflow=n,null!=r&&r.isConnected&&r.focus()}}),[t]),r.createElement("dialog",{ref:p,className:`confirmation-modal ${a}`,"aria-labelledby":E,"aria-describedby":s?h:void 0,onCancel:e=>{e.preventDefault(),o()}},r.createElement("div",{className:"confirmation-modal__content"},r.createElement("button",{type:"button",className:"confirmation-modal__close",onClick:o,"aria-label":"Cerrar ventana"},r.createElement(n.yGN,{"aria-hidden":"true",size:22})),l&&r.createElement("div",{className:"confirmation-modal__icon","aria-hidden":"true"},l),c&&r.createElement("p",{className:"confirmation-modal__eyebrow"},c),r.createElement("h2",{id:E},i),s&&r.createElement("p",{id:h,className:"confirmation-modal__description"},s),m&&r.createElement("div",{className:"confirmation-modal__body"},m),r.createElement("div",{className:"confirmation-modal__actions"},r.createElement("button",{ref:_,type:"button",className:"confirmation-modal__primary",disabled:d.disabled,onClick:d.onClick},d.label),u&&r.createElement("button",{type:"button",className:"confirmation-modal__secondary",disabled:u.disabled,onClick:u.onClick},u.label))))}},6344:function(e,t,a){a.d(t,{A:function(){return l}});var r=a(6540),n=a(4794),o=a(5194);function l(e){let{disabled:t=!1}=e;const{0:a,1:l}=(0,r.useState)(!1);return r.createElement(r.Fragment,null,r.createElement("button",{type:"button",className:"checkout-back",disabled:t,"aria-haspopup":"dialog",onClick:()=>l(!0)},"â Volver al carrito"),r.createElement(o.A,{open:a,onClose:()=>l(!1),icon:"ð",title:"Estás a un paso de completar tu detalle ð",description:"Tu compra aún no está terminada. Si sales, podrás volver después, pero tu detalle podrÃa no estar disponible luego.",primaryAction:{label:"Quiero continuar",onClick:()=>l(!1)},secondaryAction:{label:"Salir por ahora",disabled:t,onClick:()=>{t||(l(!1),(0,n.navigate)("/carrito/"))}}}))}},7092:function(e,t,a){a.d(t,{G:function(){return o}});var r=a(6540),n=a(4794);const o=e=>{let{title:t,description:a,pathname:o,image_url:l="",link_url:c=""}=e;const{title:i,description:s,image:m,siteUrl:d,twitterUsername:u}=(0,n.useStaticQuery)("1865044719").site.siteMetadata,p={title:t||i,description:a||s,image:""==l?"https://cdn.mercadodeflores.pe/mercado-de-flores-logo-cuadrado.png":l,url:""==c?"https://cdn.mercadodeflores.pe/":c,twitterUsername:u};return r.createElement(r.Fragment,null,r.createElement("html",{lang:"es"}),r.createElement("title",null,p.title),r.createElement("meta",{name:"description",content:p.description}),r.createElement("meta",{name:"image",content:p.image}),r.createElement("meta",{property:"og:title",content:p.title}),r.createElement("meta",{property:"og:url",content:p.url}),r.createElement("meta",{property:"og:description",content:p.description}),r.createElement("meta",{property:"og:image",content:p.image}),r.createElement("meta",{property:"og:site_name",content:p.url}),r.createElement("meta",{property:"og:type",content:"marketplace"}),r.createElement("meta",{name:"keywords",content:"Mercado de flores acho, Mercado de flores, Mercado flores, Mercado de flores de acho, EnvÃo de flores, Delivery rosas"}),r.createElement("script",{src:"https://cdn.pagesense.io/js/mercdefloressac/d9bdc5a6b15846f591d4566939ea8297.js"}))}},7790:function(e,t,a){a.r(t),a.d(t,{Head:function(){return _}});var r=a(6540),n=a(5005),o=a(1758),l=a(6344),c=a(7092),i=a(1476),s=a(4794),m=a(544),d=a(780),u=a(4044),p=a(7586);t.default=()=>{const e=(0,r.useContext)(n.l),{isAuthenticated:t,user:a}=e,{0:c,1:_}=(0,r.useState)([]),{0:E,1:h}=(0,r.useState)({}),{0:f,1:g}=(0,r.useState)({}),{0:b,1:v}=(0,r.useState)([]),{0:k,1:y}=(0,r.useState)(0),{0:N,1:C}=(0,r.useState)(!0),{0:A,1:w}=(0,r.useState)(!1),{0:S,1:j}=(0,r.useState)(!1),{0:$,1:I}=(0,r.useState)("Boleta simple"),{0:M,1:F}=(0,r.useState)(null),P=(0,r.useRef)(null);(0,r.useEffect)((()=>{var e;M&&(null===(e=P.current)||void 0===e||e.showModal())}),[M]),(0,r.useEffect)((()=>{x()}),[a.id_user]);const R=!("Invitado"!==E.nombre_emisor&&!A&&!S&&E.id_tipo_envio>0),T=R?"Completa los datos":"Proceder con el pago",x=async()=>
1{if(t){const e=await(0,m.K)("get-info-cart",{id_usuario:a.id_user});e.status&&"success"==e.status&&(h(e.data.info_carrito),v(e.data.productos_carrito),g(e.data.ubicacion),_(e.data.cupon),e.data.cupon.codigo_cupon?y(parseInt(e.data.total_carrito)-parseInt(e.data.cupon.monto_descuento)):y(e.data.total_carrito),j(e.data.productos_carrito.some((e=>{var t;return"Detalle"===(null===(t=e.tipo)||void 0===t?void 0:t.trim())&&e.sku>0&&(0,u.m_)(e).some((t=>(0,u.MS)(e,t).length>0))}))),""!=e.data.info_carrito.nombre_receptor&&""!=e.data.info_carrito.telefono_receptor&&""!=e.data.info_carrito.distrito_receptor&&""!=e.data.info_carrito.direccion_receptor||w(!0),C(!1));const t=await(0,m.K)("get-comprobante-guardado",{id_usuario:a.id_user});t.status&&"success"==t.status&&I(t.data.descripcion)}else C(!1)};if(N)return r.createElement(o.A,null,r.createElement(d.A,null));const q=["Invitado"===E.nombre_emisor&&{label:"Datos del emisor",path:"emisor"},A&&{label:"Datos del receptor",path:"receptor"},S&&{label:"Dedicatorias",path:"dedicatoria"},!(E.id_tipo_envio>0)&&{label:"Fecha y horario",path:"horarios"}].filter(Boolean),D=e=>`S/ ${Number(e||0).toFixed(2)}`,U=b.filter((e=>{var t;return"Detalle"===(null===(t=e.tipo)||void 0===t?void 0:t.trim())&&e.sku>0})),L=(e,t,a,n)=>r.createElement("section",{className:"checkout-card"},r.createElement("div",{className:"checkout-card-heading"},r.createElement("h2",null,e),r.createElement("span",{className:"checkout-badge "+(a?"is-pending":"")},a?"Pendiente":"Completo")),r.createElement("div",{className:"checkout-card-content"},n),"horarios"===t&&A?r.createElement("p",{className:"checkout-help"},"Completa los ",r.createElement(s.Link,{to:"/proceso-compra/receptor"},"datos del receptor")," para elegir el horario."):r.createElement(s.Link,{className:"checkout-edit",to:`/proceso-compra/${t}`},a?"Completar":"Editar"," ",e.toLowerCase()," ",r.createElement("span",{"aria-hidden":"true"},"â")));return r.createElement(o.A,null,r.createElement("div",{className:"checkout-overview"},r.createElement(l.A,null),r.createElement("header",{className:"checkout-intro"},r.createElement("p",{className:"checkout-eyebrow"},"PREPARA TU SORPRESA"),r.createElement("h1",null,"Completa tu pedido")),r.createElement("div",{className:"checkout-grid"},r.createElement("div",{className:"checkout-details"},r.createElement("div",{className:"checkout-notice "+(q.length?"is-pending":""),role:"status"},r.createElement("strong",null,q.length?`Falta completar ${q.length} de 4 secciones`:"Todo listo para continuar al pago"),r.createElement("progress",{value:4-q.length,max:"4","aria-label":"Secciones completas"}),q.length?r.createElement("p",null,"Completa las secciones pendientes. Puedes revisar tus datos antes de pagar."):null),L("Emisor","emisor","Invitado"===E.nombre_emisor,"Invitado"===E.nombre_emisor?r.createElement("p",null,"Indica tus datos para que podamos contactarte sobre tu pedido."):r.createElement(r.Fragment,null,r.createElement("p",null,r.createElement("strong",null,E.nombre_emisor)),r.createElement("p",null,E.telefono_emisor),r.createElement("p",null,E.correo_emisor),1==E.es_anonimo&&r.createElement("p",{className:"checkout-help"},"Elegiste un envÃo anónimo."))),L("Receptor","receptor",A,A?r.createElement("p",null,"Agrega los datos de quien recibirá el regalo y su dirección."):r.createElement(r.Fragment,null,r.createElement("p",null,r.createElement("strong",null,E.nombre_receptor)),r.createElement("p",null,E.telefono_receptor),3!=E.id_tipo_envio&&r.createElement("p",null,E.direccion_receptor,", ",E.distrito_receptor))),L("Dedicatorias","dedicatoria",S,r.createElement(r.Fragment,null,S&&r.createElement("p",null,"Hay regalos que aún necesitan completar su dedicatoria, frase o foto."),0===U.length&&r.createElement("p",null,"Tu pedido no requiere dedicatorias."),U.map(((e,t)=>(0,u.m_)(e).map((a=>r.createElement("div",{className:"checkout-message",key:`${t}-${a.key}`},r.createElement("strong",null,"Regalo SKU ",e.sku," · Unidad ",a.key," de"," ",(0,u.m_)(e).length),r.createElement("p",null,a.mensaje||"Mensaje pendiente"),a.frase_globo&&r.createElement("p",null,"Globo: ",a.frase_globo),a.url_imagen_dedicatoria[0]&&r.createElement("button",{type:"button",onClick:()=>F({src:(0,u.kA)(a.url_imagen_dedicatoria[0]),label:`Foto del regalo ${e.sku}, unidad ${a.key}`}),"aria-label":`Ampliar foto del regalo ${e.sku}, unidad ${a.key}`,"aria-haspopup":"dialog",className:"dedication-summary-photo"},r.createElement("img",{src:(0,u.kA)(a.url_imagen_dedicatoria[0]),alt:`Foto del regalo ${e.sku}, unidad ${a.key}`}),r.createElement("span",null,"Ampliar foto")),(0,u.MS)(e,a).length>0&&r.createElement("p",{className:"checkout-help"},"Pendiente: ",(0,u.MS)(e,a).join(", "),".")))))))),L("Fecha y horario","horarios",!(E.id_tipo_envio>0),E.id_tipo_envio>0?r.createElement(r.Fragment,null,r.createElement("p",null,r.createElement("strong",null,E.fecha_envio)),r.createElement("p",null,E.tipo_envio," · ",E.horario_cliente),3==E.id_tipo_envio&&r.createElement("p",{className:"checkout-help"},"Recogerás tu pedido en: ",f.direccion),E.mensaje_hora_compra&&r.createElement("p",{className:"checkout-help"},E.mensaje_hora_compra)):r.createElement("p",null,"Elige la modalidad de entrega y un horario disponible.")),r.createElement("section",{className:"checkout-card"},r.createElement("div",{className:"checkout-card-heading"},r.createElement("h2",null,"Comprobante"),r.createElement(s.Link,{className:"checkout-edit",to:"/proceso-compra/comprobante"},"Editar")),r.createElement("p",null,$))),r.createElement("aside",{className:"checkout-summary","aria-label":"Resumen del pedido"},r.createElement("h2",null,"Tu pedido"),b.map(((e,t)=>r.createElement("div",{className:"checkout-price-row",key:t},r.createElement("span",null,-1!=e.sku?`${e.tipo} SKU ${e.sku}`:"Tarjeta virtual QR",r.createElement("small",null,"Cantidad: ",e.cantidad)),r.createElement("strong",null,D(e.total))))),r.createElement("div",{className:"checkout-price-row"},r.createElement("span",null,E.tipo_envio||"Entrega"),r.createElement("strong",null,E.id_tipo_envio>0?3==E.id_tipo_envio&&0==parseInt(E.precio_envio)?"Gratis":D(E.precio_envio):"Por definir")),c.monto_descuento?r.createElement("div",{className:"checkout-price-row checkout-discount"},r.createElement("span",null,"Cupón ",c.codigo_cupon),r.createElement("strong",null,"â ",D(c.monto_descuento))):r.createElement(s.Link,{className:"checkout-edit",to:"/proceso-compra/cupon"},"¿Tienes un cupón de descuento?"),r.createElement("div",{className:"checkout-price-row checkout-total"},r.createElement("span",null,"Total"),r.createElement("strong",null,D(parseInt(k)+parseInt(E.precio_envio||0)))),!(E.id_tipo_envio>0)&&r.createElement("p",{className:"checkout-help"},"El costo de entrega se añadirá al elegir tu horario."),r.createElement("div",{"aria-describedby":q.length?"checkout-pending":void 0},r.createElement(i.A,{disabled:R,onClick:()=>
1{(0,p.u4)("delivery_details_completed",{revenue:Number(k||0)+Number(E.precio_envio||0),currency:"PEN",properties:{delivery_type:E.tipo_envio,receipt_type:$}}),(0,s.navigate)("/proceso-compra/pago")},text:T})),r.createElement("p",{className:"checkout-help"},"En el siguiente paso elegirás cómo pagar.")))),r.createElement("dialog",{ref:P,className:"dedication-modal","aria-label":"Vista ampliada de la foto",onClose:()=>F(null),onClick:e=>{e.target===e.currentTarget&&P.current.close()}},r.createElement("button",{type:"button",autoFocus:!0,onClick:()=>P.current.close(),"aria-label":"Cerrar foto ampliada"},"Cerrar â"),M&&r.createElement("img",{src:M.src,alt:M.label})))};const _=()=>r.createElement(c.G,{title:"Carrito de compras - Mercado de flores"})}}]); 2//# sourceMappingURL=component---src-pages-proceso-compra-index-js-d1b87bdf87b171d2b85d.js.map
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.