@mediquo/elements 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +166 -15
  2. package/dist/chunks/{api-chat-client-BTBtu01T.js → api-chat-client-C8SqZtCa.js} +1 -1
  3. package/dist/chunks/{apple-pay-outcomes-BlytM6W-.js → apple-pay-outcomes-BNkcTbbM.js} +1 -1
  4. package/dist/chunks/create-component-BB-6Gu6l.js +1 -0
  5. package/dist/chunks/exports-G_7Ih_GH.js +1 -0
  6. package/dist/chunks/{index-B9iWdvW3.js → index-BJcdB5MT.js} +1 -1
  7. package/dist/chunks/index-DiqYAEHW.js +1 -0
  8. package/dist/chunks/{mq-layout-DpzeL9_i.js → mq-layout-CpIZTsV2.js} +1 -1
  9. package/dist/chunks/{price-Dtdjx70D.js → price-tImUmtpX.js} +1 -1
  10. package/dist/chunks/{refund-cancel-policy-Bm5djPds.js → refund-cancel-policy-CnbrIqH0.js} +1 -1
  11. package/dist/chunks/{telemetry-client-CKCb9Gnf.js → telemetry-client-BRVJU-fZ.js} +1 -1
  12. package/dist/env.js +1 -1
  13. package/dist/i18n.js +1 -1
  14. package/dist/mq-apple-pay-checkout.js +1 -1
  15. package/dist/mq-appointment-checkout.js +1 -1
  16. package/dist/mq-chat-room.js +1 -1
  17. package/dist/mq-checkout.js +1 -1
  18. package/dist/mq-google-pay-checkout.js +1 -1
  19. package/dist/mq-immediate-videocall-checkout.js +1 -1
  20. package/dist/mq-my-appointments.d.ts +6 -6
  21. package/dist/mq-my-appointments.js +1 -1
  22. package/dist/mq-schedule-success.js +2 -2
  23. package/dist/mq-schedule.d.ts +3 -3
  24. package/dist/mq-schedule.js +1 -1
  25. package/dist/mq-socket-provider.js +1 -1
  26. package/dist/mq-support-chat.d.ts +1 -1
  27. package/dist/mq-support-chat.js +1 -1
  28. package/dist/mq-videocall.js +1 -1
  29. package/dist/react/mq-apple-pay-checkout.d.ts +15 -0
  30. package/dist/react/mq-apple-pay-checkout.js +2 -0
  31. package/dist/react/mq-appointment-checkout.d.ts +17 -0
  32. package/dist/react/mq-appointment-checkout.js +2 -0
  33. package/dist/react/mq-chat-room.d.ts +19 -0
  34. package/dist/react/mq-chat-room.js +2 -0
  35. package/dist/react/mq-checkout.d.ts +18 -0
  36. package/dist/react/mq-checkout.js +2 -0
  37. package/dist/react/mq-google-pay-checkout.d.ts +15 -0
  38. package/dist/react/mq-google-pay-checkout.js +2 -0
  39. package/dist/react/mq-immediate-videocall-checkout.d.ts +16 -0
  40. package/dist/react/mq-immediate-videocall-checkout.js +2 -0
  41. package/dist/react/mq-my-appointments.d.ts +29 -0
  42. package/dist/react/mq-my-appointments.js +2 -0
  43. package/dist/react/mq-query-client-provider.d.ts +8 -0
  44. package/dist/react/mq-query-client-provider.js +2 -0
  45. package/dist/react/mq-schedule-success.d.ts +26 -0
  46. package/dist/react/mq-schedule-success.js +2 -0
  47. package/dist/react/mq-schedule.d.ts +31 -0
  48. package/dist/react/mq-schedule.js +2 -0
  49. package/dist/react/mq-socket-provider.d.ts +9 -0
  50. package/dist/react/mq-socket-provider.js +2 -0
  51. package/dist/react/mq-support-chat.d.ts +15 -0
  52. package/dist/react/mq-support-chat.js +2 -0
  53. package/dist/react/mq-theme-provider.d.ts +8 -0
  54. package/dist/react/mq-theme-provider.js +2 -0
  55. package/dist/react/mq-videocall.d.ts +25 -0
  56. package/dist/react/mq-videocall.js +2 -0
  57. package/dist/ui/mq-calendar.js +1 -1
  58. package/dist/ui/mq-clamped-text.js +1 -1
  59. package/dist/ui/mq-toast.js +1 -1
  60. package/package.json +25 -4
  61. package/dist/chunks/exports-XZaVrMLd.js +0 -1
  62. package/dist/chunks/index-BYHKNPG2.js +0 -1
@@ -1 +1 @@
1
- import{h as t,f as e}from"./chunks/price-Dtdjx70D.js";export{A as AppointmentDetails}from"./chunks/price-Dtdjx70D.js";import{_ as i,t as n}from"./chunks/custom-element-DA9Fxvxd.js";import{M as a,c as o,Q as s}from"./chunks/mutation-controller-OVT8NEt6.js";import{m as r,s as p}from"./chunks/runtime-Bg1WXVCx.js";import{l}from"./chunks/parseISO-jT42c8Ob.js";import{l as c}from"./chunks/chunk-S5RWG6G2-oTcdgk2H.js";import{a as d,i as m,x as h,E as u}from"./chunks/lit-element-DiWJYFwC.js";import{n as v}from"./chunks/property-scuRaFcM.js";import{e as g}from"./chunks/external-zAbuzxDj.js";import{MqAppointmentRescheduleEvent as f,MqAppointmentBookEvent as b,MqAppointmentJoinVideocallEvent as y,MqAppointmentViewDocumentationEvent as x,MqHomeEvent as $}from"./events.js";import"./ui/mq-tabs.js";import{a as k,A as q,d as w,e as C}from"./chunks/api-chat-client-BTBtu01T.js";import{g as j}from"./chunks/get-organization-setup-query-BMbuRi6v.js";import{t as H,h as V,i as S,j as M,k as R,l as E,g as z,c as D,m as I}from"./chunks/telemetry-client-CKCb9Gnf.js";export{P as ProfessionalOverview}from"./chunks/telemetry-client-CKCb9Gnf.js";import{g as O,c as N}from"./chunks/refund-cancel-policy-Bm5djPds.js";import{a as _}from"./chunks/exports-XZaVrMLd.js";import{r as U}from"./chunks/state-LQivXIgA.js";import{getLocale as Q}from"./i18n.js";import"./ui/mq-card.js";import"./ui/mq-floating-bubble.js";import{Q as T}from"./chunks/query-QJ1INUTG.js";import"./ui/mq-button.js";import"./ui/mq-dialog.js";import{e as B}from"./chunks/class-map-Co76I6aw.js";import{messageBubbleIcon as Z}from"./ui/icons/message-bubble-icon.js";import{videoIcon as L}from"./ui/icons/video-icon.js";import"./ui/mq-unread-badge.js";import{toast as G}from"./ui/mq-toast.js";import"./ui/back-link.js";import"./ui/icons/briefcase-icon.js";import"./ui/icons/types.js";import"./ui/icons/calendar-icon.js";import"./ui/icons/clock-icon.js";import"./ui/icons/phone-icon.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-provider-CiMFpvDA.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";import"./env.js";import"./ui/icons/chevron-down-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/mq-text-button.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-avatar.js";import"./chunks/provide-CfT7g_Zi.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./ui/icons/check-double-icon.js";import"./ui/icons/check-icon.js";import"./chunks/chunk-YTQUGGS3-DN-JZpgG.js";const F=g(["next","history"]).enum;class MqMyAppointmentsSelectEvent extends Event{static{this.eventName="ontabchange"}constructor(t){super(MqMyAppointmentsSelectEvent.eventName,{bubbles:!0,composed:!0}),this.value=t}}let W=class CancelAppointmentConfirmationDialog extends d{constructor(){super(...arguments),this.open=!1,this.cancelAppointmentMutation=new a(this,{mutationFn:async t=>k.appointments.cancelAppointment(t),onSuccess:()=>{this.queryClientContext?.invalidateQueries(),this.dispatchEvent(new CustomEvent("success",{bubbles:!0,composed:!0}))}}),this.handleClose=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))},this.handleDismissClick=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))},this.handleConfirmClick=()=>{this.cancelAppointmentMutation.run({id:this.appointmentId})}}static{this.styles=m`:host{display:contents}h2{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0}p{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);margin:0}.subheading-payable{font-size:var(--text-base);line-height:22px}.price-rows{display:flex;flex-direction:column;font-family:var(--font-body);font-size:var(--text-sm);font-weight:var(--font-weight-medium);line-height:var(--text-sm--line-height);color:var(--color-card-foreground);width:100%;margin-bottom:var(--sp-4)}.price-row{display:flex;align-items:center;justify-content:space-between;min-height:34px;gap:var(--sp-2)}.price-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-4);justify-content:flex-end;flex-wrap:wrap}`}render(){const i=Q(),n=this.price,a=t(n),o=this.cancelAppointmentMutation.isPending;if(a){const t=e(n,i),a=`-${t}`;return h`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${r("Confirmar cancelación")}</h2><p slot="subheading" class="subheading-payable">${r("¿Seguro que quieres cancelar esta cita? Se te devolverá el importe pagado en un plazo de 5-10 días hábiles.")}</p><div><div class="price-rows"><div class="price-row"><span>${r("Importe pagado")}</span> <span>${t}</span></div><div class="price-row"><span>${r("Importe a devolver")}</span> <span>${a}</span></div></div><div class="actions"><mq-button variant="outline" ?disabled="${o}" @click="${this.handleDismissClick}">${r("Volver")}</mq-button><mq-button variant="primary" ?disabled="${o}" @click="${this.handleConfirmClick}">${r("Confirmar")}</mq-button></div></div></mq-dialog>`}return h`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${r("Confirmar cancelación")}</h2><p slot="subheading">${r("¿Seguro que quieres cancelar esta cita?")}</p><div><div class="actions"><mq-button variant="outline" ?disabled="${o}" @click="${this.handleDismissClick}">${r("Cancelar")}</mq-button><mq-button variant="primary" ?disabled="${o}" @click="${this.handleConfirmClick}">${r("Confirmar")}</mq-button></div></div></mq-dialog>`}};i([v({type:Boolean,reflect:!0})],W.prototype,"open",void 0),i([o({context:T,subscribe:!0})],W.prototype,"queryClientContext",void 0),i([v({type:String})],W.prototype,"appointmentId",void 0),i([v({type:Object})],W.prototype,"price",void 0),W=i([l(),n("cancel-appointment-confirmation-dialog")],W);let K=class AppointmentActionUnavailableDialog extends d{constructor(){super(...arguments),this.open=!1,this.heading="",this.message="",this.handleClose=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}}static{this.styles=m`:host{display:contents}mq-dialog::part(dialog){max-width:343px;min-width:0}h2{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0}p{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);margin:0}.actions{display:flex;margin-top:var(--sp-4)}`}render(){return h`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${this.heading}</h2><p slot="subheading">${this.message}</p><div class="actions"><mq-button variant="primary" fullwidth @click="${this.handleClose}">${r("Volver")}</mq-button></div></mq-dialog>`}};i([v({type:Boolean,reflect:!0})],K.prototype,"open",void 0),i([v({type:String})],K.prototype,"heading",void 0),i([v({type:String})],K.prototype,"message",void 0),K=i([l(),n("appointment-action-unavailable-dialog")],K);let Y=class AppointmentCardActions extends d{constructor(){super(...arguments),this.variant="next",this.isVideocall=!1,this.hasChatSupport=!1,this.unreadCount=0,this.isModifyUnavailable=!1,this.isCancelUnavailable=!1,this.hasNoSlots=!1,this.modifyUnavailableMessage="",this.cancelUnavailableMessage="",this.repeatTarget=null,this.professionalHash="",this.openDialog=null,this.handleModifyClick=()=>{this.isModifyUnavailable?this.openDialog="modify":(H.track(V(this.patientHash,this.appointmentId)),this.dispatchEvent(new f({appointmentId:this.appointmentId})))},this.handleCancelClick=()=>{this.isCancelUnavailable?this.openDialog="cancel":(H.track(S(this.patientHash,this.appointmentId)),this.dispatchEvent(new CustomEvent("request-cancel",{bubbles:!0,composed:!0})))},this.handleRepeatClick=()=>{this.hasNoSlots?this.openDialog="repeat-no-slots":this.repeatTarget?(H.track(M(this.patientHash,this.appointmentId)),this.dispatchEvent(new b({specialty:this.repeatTarget.specialty,service:this.repeatTarget.service,professional:this.professionalHash}))):this.openDialog="repeat-error"},this.handleDialogClose=()=>{this.openDialog=null}}static{this.styles=m`:host{display:contents}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-2)}.actions.next{flex-direction:column}.actions-secondary{display:flex;gap:var(--sp-3)}.actions mq-button{flex:1}`}get patientHash(){return this.loginToken.patient.hash}renderChatButton(){return h`<mq-button variant="primary" fullwidth noPadding @click="${()=>{this.dispatchEvent(new CustomEvent("toggle-chat",{bubbles:!0,composed:!0}))}}">${Z({size:24})} ${r("Chat")} ${this.unreadCount>0?h`<mq-unread-badge></mq-unread-badge>`:u}</mq-button>`}renderNextActions(){return h`${this.isVideocall?h`<mq-button variant="outline" fullwidth noPadding @click="${()=>{H.track(R(this.patientHash,this.appointmentId)),this.dispatchEvent(new y({appointmentId:this.appointmentId}))}}">${L({size:24})} ${r("Ir a videollamada")}</mq-button>`:u}<div class="actions-secondary">${this.hasChatSupport?this.renderChatButton():u}<mq-button variant="outline" fullwidth noPadding @click="${this.handleModifyClick}">${r("Modificar")}</mq-button><mq-button variant="outline-negative" fullwidth noPadding @click="${this.handleCancelClick}">${r("Cancelar")}</mq-button></div>`}renderHistoryActions(){return h`${this.hasChatSupport?this.renderChatButton():u}<mq-button variant="outline" fullwidth noPadding @click="${()=>{H.track(E(this.patientHash,this.appointmentId)),this.dispatchEvent(new x({appointmentId:this.appointmentId}))}}">${r("Documentos")}</mq-button><mq-button variant="outline" fullwidth noPadding @click="${this.handleRepeatClick}">${r("Repetir")}</mq-button>`}render(){return h`<div class="${B({actions:!0,next:"next"===this.variant})}">${"next"===this.variant?this.renderNextActions():this.renderHistoryActions()}</div><appointment-action-unavailable-dialog .open="${"modify"===this.openDialog}" .heading="${r("Modificar cita")}" .message="${this.modifyUnavailableMessage}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"cancel"===this.openDialog}" .heading="${r("Anular cita")}" .message="${this.cancelUnavailableMessage}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"repeat-no-slots"===this.openDialog}" .heading="${r("Repetir cita")}" .message="${r("Este profesional no tiene horarios disponibles")}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"repeat-error"===this.openDialog}" .heading="${r("Repetir cita")}" .message="${r("Lo sentimos, no hemos podido repetir tu cita. Por favor, contacta con soporte.")}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog>`}};function J(t){const{action:e,refundPolicySeconds:i}=t,n=null!=i&&i<3600,a=Math.ceil((i??0)/60),o=Math.ceil((i??0)/3600);return r(0===(n?a:o)?"modify"===e?"Esta cita ya ha pasado, por lo que no se puede modificar.":"Esta cita ya ha pasado, por lo que no se puede anular.":"modify"===e?n?p`Lo sentimos, como faltan menos de ${a} minutos para tu cita no podemos modificarla.`:p`Lo sentimos, como faltan menos de ${o} horas para tu cita no podemos modificarla.`:n?p`Lo sentimos, como faltan menos de ${a} minutos para tu cita no podemos anularla.`:p`Lo sentimos, como faltan menos de ${o} horas para tu cita no podemos anularla.`)}i([o({context:c})],Y.prototype,"loginToken",void 0),i([v({type:String})],Y.prototype,"variant",void 0),i([v({type:String})],Y.prototype,"appointmentId",void 0),i([v({type:Boolean})],Y.prototype,"isVideocall",void 0),i([v({type:Boolean})],Y.prototype,"hasChatSupport",void 0),i([v({type:Number})],Y.prototype,"unreadCount",void 0),i([v({type:Boolean})],Y.prototype,"isModifyUnavailable",void 0),i([v({type:Boolean})],Y.prototype,"isCancelUnavailable",void 0),i([v({type:Boolean})],Y.prototype,"hasNoSlots",void 0),i([v({type:String})],Y.prototype,"modifyUnavailableMessage",void 0),i([v({type:String})],Y.prototype,"cancelUnavailableMessage",void 0),i([v({type:Object})],Y.prototype,"repeatTarget",void 0),i([v({type:String})],Y.prototype,"professionalHash",void 0),i([U()],Y.prototype,"openDialog",void 0),Y=i([l(),n("appointment-card-actions")],Y);let X=class AppointmentCard extends d{constructor(){super(...arguments),this.variant="next",this.detailsVariant="wide",this.isChatOpen=!1,this.isCancelDialogOpen=!1,this.unreadQuery=new s(this,()=>_(k,{roomId:this.appointmentResource?.room?.id})),this.getOrganizationSpecialtiesQuery=new s(this,()=>z(k,{enabled:!!this.appointmentResource?.speciality?.id})),this.getOrganizationSetupQuery=new s(this,()=>j(k)),this.getScheduleServicesQuery=new s(this,()=>O(k))}static{this.styles=m`:host{display:flex}.card{width:100%;padding:var(--sp-6);display:flex;flex-direction:column;gap:var(--sp-4);justify-content:space-between}.card-top-content{display:flex;flex-direction:column;gap:var(--sp-6)}.see-details{color:var(--color-primary-link-default);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-bold)}.see-details:hover{text-decoration:underline}.chevron-down{width:16px;height:16px;transition:transform .2s ease}.appointment-details{display:flex;flex-direction:column;gap:12px}.clock-icon-wrapper{width:24px;height:24px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.clock-icon-wrapper svg{width:100%;height:100%}.appointment-type{display:flex;align-items:center;gap:12px;font-size:18px;color:#2c3e50}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-2)}.actions.next{flex-direction:column}.actions-secondary{display:flex;gap:var(--sp-3)}.actions mq-button{flex:1}`}render(){const t=this.appointmentResource.appointment.channel===q.videocall,e=this.appointmentResource.appointment.channel===q.phonecall,i=!0===this.getOrganizationSetupQuery.result?.data?.appointments?.has_chat_in_appointment,n=(t||e)&&i,a=Q(),o=w(this.appointmentResource.appointment.expires_at),s=0===this.appointmentResource.slots.length,p=this.getOrganizationSetupQuery.result?.data?.appointments?.seconds_before_start_to_refund_on_cancel,l=N({startsAtIso:this.appointmentResource.appointment.starts_at,refundPolicySeconds:p}),c=o||s||!l,d=o||!l,m=J({action:"modify",refundPolicySeconds:p}),v=J({action:"cancel",refundPolicySeconds:p}),g=this.getOrganizationSpecialtiesQuery.result?.data?.find(t=>Number(t.id)===Number(this.appointmentResource.speciality.id)),f=D(g?.code??"",a,g?.name??this.appointmentResource.speciality.name),b=this.getScheduleServicesQuery.result?.data?.find(t=>t.id===this.appointmentResource.appointment.service_id)?.code,y=g?.code&&b?{specialty:g.code,service:b}:null;return h`<mq-card class="card" roundness="md"><div class="card-top-content"><professional-overview .specialtyName="${f??""}" .collegiateNumber="${this.appointmentResource.professional.collegiate_number??void 0}" .description="${this.appointmentResource.professional.description??""}" .languages="${this.appointmentResource.professional.languages}" .avatar="${this.appointmentResource.professional.avatar??""}" .name="${this.appointmentResource.professional.name}"></professional-overview><appointment-details .startsAt="${this.appointmentResource.appointment.starts_at}" .duration="${this.appointmentResource.appointment.duration}" .channel="${this.appointmentResource.appointment.channel}" .timezone="${this.loginToken?.patient?.timezone}" variant="${this.detailsVariant}"></appointment-details></div><appointment-card-actions .variant="${this.variant}" .appointmentId="${this.appointmentResource.appointment.id??""}" .isVideocall="${t}" .hasChatSupport="${n}" .unreadCount="${this.unreadQuery.result?.data?.unread_count??0}" .isModifyUnavailable="${c}" .isCancelUnavailable="${d}" .hasNoSlots="${s}" .modifyUnavailableMessage="${m}" .cancelUnavailableMessage="${v}" .repeatTarget="${y}" .professionalHash="${this.appointmentResource.professional.hash}" @toggle-chat="${()=>{this.isChatOpen=!this.isChatOpen,this.isChatOpen&&H.track(I(this.loginToken.patient.hash,this.appointmentResource.appointment.id??""))}}" @request-cancel="${()=>{this.isCancelDialogOpen=!0}}"></appointment-card-actions><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen?h`<mq-chat-room slot="content" .consultationId="${this.appointmentResource.appointment.id}" consultation-type="appointment" token="${this.loginToken.access_token}" .roomId="${this.appointmentResource.room.id}" .professionalHash="${this.appointmentResource.professional.hash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}" ?readonly="${o}"></mq-chat-room>`:u}</mq-floating-bubble><cancel-appointment-confirmation-dialog .appointmentId="${this.appointmentResource.appointment.id}" .price="${this.appointmentResource.price??void 0}" .open="${this.isCancelDialogOpen}" @cancel="${()=>{this.isCancelDialogOpen=!1}}" @success="${()=>{this.isCancelDialogOpen=!1,G.success(r("Consulta anulada correctamente")),this.dispatchEvent(new CustomEvent("appointment-cancel-confirmed",{bubbles:!0,composed:!0,detail:{id:this.appointmentResource.appointment.id}}))}}"></cancel-appointment-confirmation-dialog></mq-card>`}};i([v({type:Object})],X.prototype,"appointmentResource",void 0),i([v({type:Number})],X.prototype,"specialtyId",void 0),i([v({type:String})],X.prototype,"variant",void 0),i([v({type:String})],X.prototype,"detailsVariant",void 0),i([o({context:c})],X.prototype,"loginToken",void 0),i([U()],X.prototype,"isChatOpen",void 0),i([U()],X.prototype,"isCancelDialogOpen",void 0),X=i([l(),n("appointment-card")],X);let tt=class AppointmentCardSkeleton extends d{static{this.styles=m`div{border-radius:var(--border-radius-md);background:color-mix(in srgb,var(--color-neutrals-background-disabled) 50%,#fff 50%);height:337px;width:100%}`}render(){return h`<div></div>`}};tt=i([n("appointment-card-skeleton")],tt);let et=class EmptyState extends d{static{this.styles=m`.container{border-radius:var(--border-radius-md);background-color:var(--color-neutrals-background-weak);padding:var(--sp-10) var(--sp-6)}.card{border-radius:var(--border-radius-md);max-width:512px;margin:0 auto;background-color:var(--color-neutrals-background-extraWeak);padding:var(--sp-6);display:flex;flex-direction:column;align-items:center;gap:var(--sp-3)}.card>*{max-width:323px;margin:0 auto}.title{font-family:var(--font-body);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0}.description{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-normal);text-align:center;color:var(--color-neutrals-text-default);margin:0}@media (min-width:768px){.container{padding:var(--sp-6)}mq-button{max-width:323px}}`}handleRequestAppointment(){this.dispatchEvent(new CustomEvent("request-appointment",{bubbles:!0,composed:!0}))}render(){return h`<div class="container"><div class="card">${function({color:t="currentColor"}){return h`<svg width="31" height="32" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M29.6 2.4H23.2V0H21.6V2.4H18.4V0H16.8V2.4H13.6V0H12V2.4H8.8V0H7.2V2.4H0.8C0.587827 2.4 0.384344 2.48429 0.234315 2.63431C0.0842855 2.78434 0 2.98783 0 3.2V31.2C0 31.4122 0.0842855 31.6157 0.234315 31.7657C0.384344 31.9157 0.587827 32 0.8 32H29.6C29.8122 32 30.0157 31.9157 30.1657 31.7657C30.3157 31.6157 30.4 31.4122 30.4 31.2V3.2C30.4 2.98783 30.3157 2.78434 30.1657 2.63431C30.0157 2.48429 29.8122 2.4 29.6 2.4ZM28.8 30.4H1.6V10.4H27.2V8.8H1.6V4H7.2V7.2H8.8V4H12V7.2H13.6V4H16.8V7.2H18.4V4H21.6V7.2H23.2V4H28.8V30.4ZM3.2 19.2H9.6V12.8H3.2V19.2ZM4.8 14.4H8V17.6H4.8V14.4ZM20.8 19.2H27.2V12.8H20.8V19.2ZM22.4 14.4H25.6V17.6H22.4V14.4ZM12 19.2H18.4V12.8H12V19.2ZM13.6 14.4H16.8V17.6H13.6V14.4ZM3.2 28H9.6V21.6H3.2V28ZM4.8 23.2H8V26.4H4.8V23.2ZM20.8 28H27.2V21.6H20.8V28ZM22.4 23.2H25.6V26.4H22.4V23.2ZM12 28H18.4V21.6H12V28ZM13.6 23.2H16.8V26.4H13.6V23.2Z" fill="${t}"/></svg>`}({color:"var(--color-primary)"})}<p class="title">${this.title}</p><p class="description">${this.description}</p><mq-button variant="primary" size="md" fullwidth @click="${this.handleRequestAppointment}">${r("Pedir cita")}</mq-button></div></div>`}};function it(t,e){return{queryKey:["appointments",e],queryFn:()=>t.appointments.getAppointments(e)}}i([v({type:String})],et.prototype,"title",void 0),i([v({type:String})],et.prototype,"description",void 0),et=i([n("empty-state")],et);const nt=[C.pending,C.accepted],at=m`.appointments-list{display:grid;grid-template-columns:1fr;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}`;let ot=class NextAppointmentsTab extends d{constructor(){super(...arguments),this.getAppointmentsQuery=new s(this,()=>it(k,{status:nt,order:{field:"starts_at",direction:"asc"}}))}static{this.styles=at}render(){return this.getAppointmentsQuery.render({complete:t=>h`${t.data.length>0?h`<div class="appointments-list">${t.data.map(t=>h`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}"></appointment-card>`)}</div>`:h`<empty-state title="${r("No tienes próximas citas")}" description="${r("Agenda una consulta médica cuando la necesites. Aquí verás todos los detalles y podrás gestionar tus próximas citas.")}"></empty-state>`}`,pending:()=>h`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};ot=i([l(),n("next-appointments-tab")],ot);const st=[C.finished,C.reporting];let rt=class AppointmentsHistoryTab extends d{constructor(){super(...arguments),this.getAppointmentsQuery=new s(this,()=>it(k,{status:st,order:{field:"starts_at",direction:"desc"}}))}static{this.styles=m`.appointments-list{display:grid;grid-template-columns:1fr;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}`}render(){return this.getAppointmentsQuery.render({complete:t=>h`${t.data.length>0?h`<div class="appointments-list">${t.data.map(t=>h`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}" variant="history"></appointment-card>`)}</div>`:h`<empty-state title="${r("No tienes citas en el historial")}" description="${r("Aquí verás todas las citas que has tenido. Puedes acceder a los documentos de cada consulta y reagendar una cita si es necesario.")}"></empty-state>`}`,pending:()=>h`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};rt=i([l(),n("appointments-history-tab")],rt);const pt=m`.container{display:flex;flex-direction:column;gap:var(--size-3)}h1{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutral-link-dark);margin:0}p{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutral-link-dark);margin:0}.user-info{display:flex;align-items:center;justify-content:space-between}@media (min-width:768px){h1{font-size:var(--text-3xl);line-height:var(--text-3xl--line-height)}mq-tabs-list{max-width:435px}}`;let lt=class MqMyAppointments extends d{constructor(){super(...arguments),this.tab=F.next}static{this.styles=pt}handleSelect(t){this.dispatchEvent(new MqMyAppointmentsSelectEvent(t.value))}render(){return h`<div class="container"><back-link @mq-back="${t=>{t.stopPropagation(),this.dispatchEvent(new $)}}">${r("Volver al inicio")}</back-link><h1>${r("Mis citas")}</h1><div class="user-info"><p>${r(p`Para: ${this.loginToken.patient.name}`)}</p></div><mq-tabs .value="${this.tab}" @onvaluechange="${this.handleSelect}"><mq-tabs-list><mq-tabs-trigger value="${F.next}">${r("Próximas citas")}</mq-tabs-trigger><mq-tabs-trigger value="${F.history}">${r("Histórico")}</mq-tabs-trigger></mq-tabs-list><mq-tabs-content value="${F.next}"><next-appointments-tab></next-appointments-tab></mq-tabs-content><mq-tabs-content value="${F.history}"><appointments-history-tab></appointments-history-tab></mq-tabs-content></mq-tabs></div>`}};i([o({context:c})],lt.prototype,"loginToken",void 0),i([v({type:String,reflect:!0})],lt.prototype,"tab",void 0),lt=i([l(),n("mq-my-appointments")],lt);const ct=m`:host{display:block}.request-appointment-cta{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:var(--sp-12) var(--sp-4);background:var(--color-card);gap:var(--sp-4)}.title-body{display:flex;flex-direction:column;gap:var(--sp-2);flex:1}.title{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0;text-align:center}.subtitle{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);margin:0;display:none}mq-button{width:100%}.button-text-desktop{display:none}.button-text-mobile{display:inline}@media (min-width:768px){.request-appointment-cta{flex-direction:row;padding:var(--sp-12) var(--sp-20);gap:var(--sp-2)}.title-body{align-items:flex-start;flex:1;max-width:843px}.title{font-size:var(--text-3xl);line-height:var(--text-3xl--line-height);font-weight:var(--font-weight-extrabold);text-align:left}.subtitle{display:block}mq-button{width:auto;flex-shrink:0;--button-height-md:var(--button-height-lg);--text-sm:var(--text-base);--text-sm--line-height:var(--text-base--line-height)}.button-text-desktop{display:inline}.button-text-mobile{display:none}}`;class RequestAppointmentEvent extends Event{static{this.eventName="request-appointment"}constructor(){super(RequestAppointmentEvent.eventName,{bubbles:!0,composed:!0})}}let dt=class RequestAppointmentCta extends d{static{this.styles=ct}handleRequestAppointment(){this.dispatchEvent(new RequestAppointmentEvent)}render(){return h`<div class="request-appointment-cta"><div class="title-body"><h2 class="title">${r("Nueva cita de especialidades digitales")}</h2><p class="subtitle">${r("Realiza la búsqueda en tu cuadro médico digital")}</p></div><mq-button variant="primary" size="md" fullwidth @click="${this.handleRequestAppointment}"><span class="button-text-mobile">${r("Pedir cita")}</span> <span class="button-text-desktop">${r("Pedir una nueva cita")}</span></mq-button></div>`}};dt=i([l(),n("request-appointment-cta")],dt);export{lt as MqMyAppointments,MqMyAppointmentsSelectEvent,dt as RequestAppointmentCta,RequestAppointmentEvent};
1
+ import{h as t,f as e}from"./chunks/price-tImUmtpX.js";export{A as AppointmentDetails}from"./chunks/price-tImUmtpX.js";import{_ as i,t as n}from"./chunks/custom-element-DA9Fxvxd.js";import{M as a,c as o,Q as s}from"./chunks/mutation-controller-OVT8NEt6.js";import{m as r,s as p}from"./chunks/runtime-Bg1WXVCx.js";import{l}from"./chunks/parseISO-jT42c8Ob.js";import{l as c}from"./chunks/chunk-S5RWG6G2-oTcdgk2H.js";import{a as d,i as m,x as h,E as u}from"./chunks/lit-element-DiWJYFwC.js";import{n as v}from"./chunks/property-scuRaFcM.js";import{e as g}from"./chunks/external-zAbuzxDj.js";import{MqAppointmentRescheduleEvent as f,MqAppointmentBookEvent as b,MqAppointmentJoinVideocallEvent as y,MqAppointmentViewDocumentationEvent as x,MqHomeEvent as $}from"./events.js";import"./ui/mq-tabs.js";import{b as k,A as q,c as w,d as C}from"./chunks/api-chat-client-C8SqZtCa.js";import{g as j}from"./chunks/get-organization-setup-query-BMbuRi6v.js";import{t as H,h as V,i as S,j as M,k as R,l as E,g as z,c as D,m as I}from"./chunks/telemetry-client-BRVJU-fZ.js";export{P as ProfessionalOverview}from"./chunks/telemetry-client-BRVJU-fZ.js";import{g as O,c as N}from"./chunks/refund-cancel-policy-CnbrIqH0.js";import{g as _}from"./chunks/exports-G_7Ih_GH.js";import{r as U}from"./chunks/state-LQivXIgA.js";import{getLocale as Q}from"./i18n.js";import"./ui/mq-card.js";import"./ui/mq-floating-bubble.js";import{Q as T}from"./chunks/query-QJ1INUTG.js";import"./ui/mq-button.js";import"./ui/mq-dialog.js";import{e as Z}from"./chunks/class-map-Co76I6aw.js";import{messageBubbleIcon as B}from"./ui/icons/message-bubble-icon.js";import{videoIcon as L}from"./ui/icons/video-icon.js";import"./ui/mq-unread-badge.js";import{toast as G}from"./ui/mq-toast.js";import"./ui/back-link.js";import"./ui/icons/briefcase-icon.js";import"./ui/icons/types.js";import"./ui/icons/calendar-icon.js";import"./ui/icons/clock-icon.js";import"./ui/icons/phone-icon.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-provider-CiMFpvDA.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";import"./env.js";import"./ui/icons/chevron-down-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/mq-text-button.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-avatar.js";import"./chunks/provide-CfT7g_Zi.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./ui/icons/check-double-icon.js";import"./ui/icons/check-icon.js";import"./chunks/chunk-YTQUGGS3-DN-JZpgG.js";const F=g(["next","history"]).enum;class MqMyAppointmentsSelectEvent extends Event{static{this.eventName="ontabchange"}constructor(t){super(MqMyAppointmentsSelectEvent.eventName,{bubbles:!0,composed:!0}),this.value=t}}let W=class CancelAppointmentConfirmationDialog extends d{constructor(){super(...arguments),this.open=!1,this.cancelAppointmentMutation=new a(this,{mutationFn:async t=>k.appointments.cancelAppointment(t),onSuccess:()=>{this.queryClientContext?.invalidateQueries(),this.dispatchEvent(new CustomEvent("success",{bubbles:!0,composed:!0}))}}),this.handleClose=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))},this.handleDismissClick=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))},this.handleConfirmClick=()=>{this.cancelAppointmentMutation.run({id:this.appointmentId})}}static{this.styles=m`:host{display:contents}h2{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0}p{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);margin:0}.subheading-payable{font-size:var(--text-base);line-height:22px}.price-rows{display:flex;flex-direction:column;font-family:var(--font-body);font-size:var(--text-sm);font-weight:var(--font-weight-medium);line-height:var(--text-sm--line-height);color:var(--color-card-foreground);width:100%;margin-bottom:var(--sp-4)}.price-row{display:flex;align-items:center;justify-content:space-between;min-height:34px;gap:var(--sp-2)}.price-row span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-4);justify-content:flex-end;flex-wrap:wrap}`}render(){const i=Q(),n=this.price,a=t(n),o=this.cancelAppointmentMutation.isPending;if(a){const t=e(n,i),a=`-${t}`;return h`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${r("Confirmar cancelación")}</h2><p slot="subheading" class="subheading-payable">${r("¿Seguro que quieres cancelar esta cita? Se te devolverá el importe pagado en un plazo de 5-10 días hábiles.")}</p><div><div class="price-rows"><div class="price-row"><span>${r("Importe pagado")}</span> <span>${t}</span></div><div class="price-row"><span>${r("Importe a devolver")}</span> <span>${a}</span></div></div><div class="actions"><mq-button variant="outline" ?disabled="${o}" @click="${this.handleDismissClick}">${r("Volver")}</mq-button><mq-button variant="primary" ?disabled="${o}" @click="${this.handleConfirmClick}">${r("Confirmar")}</mq-button></div></div></mq-dialog>`}return h`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${r("Confirmar cancelación")}</h2><p slot="subheading">${r("¿Seguro que quieres cancelar esta cita?")}</p><div><div class="actions"><mq-button variant="outline" ?disabled="${o}" @click="${this.handleDismissClick}">${r("Cancelar")}</mq-button><mq-button variant="primary" ?disabled="${o}" @click="${this.handleConfirmClick}">${r("Confirmar")}</mq-button></div></div></mq-dialog>`}};i([v({type:Boolean,reflect:!0})],W.prototype,"open",void 0),i([o({context:T,subscribe:!0})],W.prototype,"queryClientContext",void 0),i([v({type:String})],W.prototype,"appointmentId",void 0),i([v({type:Object})],W.prototype,"price",void 0),W=i([l(),n("cancel-appointment-confirmation-dialog")],W);let K=class AppointmentActionUnavailableDialog extends d{constructor(){super(...arguments),this.open=!1,this.heading="",this.message="",this.handleClose=()=>{this.open=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}}static{this.styles=m`:host{display:contents}mq-dialog::part(dialog){max-width:343px;min-width:0}h2{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0}p{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);margin:0}.actions{display:flex;margin-top:var(--sp-4)}`}render(){return h`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${this.heading}</h2><p slot="subheading">${this.message}</p><div class="actions"><mq-button variant="primary" fullwidth @click="${this.handleClose}">${r("Volver")}</mq-button></div></mq-dialog>`}};i([v({type:Boolean,reflect:!0})],K.prototype,"open",void 0),i([v({type:String})],K.prototype,"heading",void 0),i([v({type:String})],K.prototype,"message",void 0),K=i([l(),n("appointment-action-unavailable-dialog")],K);let Y=class AppointmentCardActions extends d{constructor(){super(...arguments),this.variant="next",this.isVideocall=!1,this.hasChatSupport=!1,this.unreadCount=0,this.isModifyUnavailable=!1,this.isCancelUnavailable=!1,this.hasNoSlots=!1,this.modifyUnavailableMessage="",this.cancelUnavailableMessage="",this.repeatTarget=null,this.professionalHash="",this.openDialog=null,this.handleModifyClick=()=>{this.isModifyUnavailable?this.openDialog="modify":(H.track(V(this.patientHash,this.appointmentId)),this.dispatchEvent(new f({appointmentId:this.appointmentId})))},this.handleCancelClick=()=>{this.isCancelUnavailable?this.openDialog="cancel":(H.track(S(this.patientHash,this.appointmentId)),this.dispatchEvent(new CustomEvent("request-cancel",{bubbles:!0,composed:!0})))},this.handleRepeatClick=()=>{this.hasNoSlots?this.openDialog="repeat-no-slots":this.repeatTarget?(H.track(M(this.patientHash,this.appointmentId)),this.dispatchEvent(new b({specialty:this.repeatTarget.specialty,service:this.repeatTarget.service,professional:this.professionalHash}))):this.openDialog="repeat-error"},this.handleDialogClose=()=>{this.openDialog=null}}static{this.styles=m`:host{display:contents}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-2)}.actions.next{flex-direction:column}.actions-secondary{display:flex;gap:var(--sp-3)}.actions mq-button{flex:1}`}get patientHash(){return this.loginToken.patient.hash}renderChatButton(){return h`<mq-button variant="primary" fullwidth noPadding @click="${()=>{this.dispatchEvent(new CustomEvent("toggle-chat",{bubbles:!0,composed:!0}))}}">${B({size:24})} ${r("Chat")} ${this.unreadCount>0?h`<mq-unread-badge></mq-unread-badge>`:u}</mq-button>`}renderNextActions(){return h`${this.isVideocall?h`<mq-button variant="outline" fullwidth noPadding @click="${()=>{H.track(R(this.patientHash,this.appointmentId)),this.dispatchEvent(new y({appointmentId:this.appointmentId}))}}">${L({size:24})} ${r("Ir a videollamada")}</mq-button>`:u}<div class="actions-secondary">${this.hasChatSupport?this.renderChatButton():u}<mq-button variant="outline" fullwidth noPadding @click="${this.handleModifyClick}">${r("Modificar")}</mq-button><mq-button variant="outline-negative" fullwidth noPadding @click="${this.handleCancelClick}">${r("Cancelar")}</mq-button></div>`}renderHistoryActions(){return h`${this.hasChatSupport?this.renderChatButton():u}<mq-button variant="outline" fullwidth noPadding @click="${()=>{H.track(E(this.patientHash,this.appointmentId)),this.dispatchEvent(new x({appointmentId:this.appointmentId}))}}">${r("Documentos")}</mq-button><mq-button variant="outline" fullwidth noPadding @click="${this.handleRepeatClick}">${r("Repetir")}</mq-button>`}render(){return h`<div class="${Z({actions:!0,next:"next"===this.variant})}">${"next"===this.variant?this.renderNextActions():this.renderHistoryActions()}</div><appointment-action-unavailable-dialog .open="${"modify"===this.openDialog}" .heading="${r("Modificar cita")}" .message="${this.modifyUnavailableMessage}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"cancel"===this.openDialog}" .heading="${r("Anular cita")}" .message="${this.cancelUnavailableMessage}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"repeat-no-slots"===this.openDialog}" .heading="${r("Repetir cita")}" .message="${r("Este profesional no tiene horarios disponibles")}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"repeat-error"===this.openDialog}" .heading="${r("Repetir cita")}" .message="${r("Lo sentimos, no hemos podido repetir tu cita. Por favor, contacta con soporte.")}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog>`}};function J(t){const{action:e,refundPolicySeconds:i}=t,n=null!=i&&i<3600,a=Math.ceil((i??0)/60),o=Math.ceil((i??0)/3600);return r(0===(n?a:o)?"modify"===e?"Esta cita ya ha pasado, por lo que no se puede modificar.":"Esta cita ya ha pasado, por lo que no se puede anular.":"modify"===e?n?p`Lo sentimos, como faltan menos de ${a} minutos para tu cita no podemos modificarla.`:p`Lo sentimos, como faltan menos de ${o} horas para tu cita no podemos modificarla.`:n?p`Lo sentimos, como faltan menos de ${a} minutos para tu cita no podemos anularla.`:p`Lo sentimos, como faltan menos de ${o} horas para tu cita no podemos anularla.`)}i([o({context:c})],Y.prototype,"loginToken",void 0),i([v({type:String})],Y.prototype,"variant",void 0),i([v({type:String})],Y.prototype,"appointmentId",void 0),i([v({type:Boolean})],Y.prototype,"isVideocall",void 0),i([v({type:Boolean})],Y.prototype,"hasChatSupport",void 0),i([v({type:Number})],Y.prototype,"unreadCount",void 0),i([v({type:Boolean})],Y.prototype,"isModifyUnavailable",void 0),i([v({type:Boolean})],Y.prototype,"isCancelUnavailable",void 0),i([v({type:Boolean})],Y.prototype,"hasNoSlots",void 0),i([v({type:String})],Y.prototype,"modifyUnavailableMessage",void 0),i([v({type:String})],Y.prototype,"cancelUnavailableMessage",void 0),i([v({type:Object})],Y.prototype,"repeatTarget",void 0),i([v({type:String})],Y.prototype,"professionalHash",void 0),i([U()],Y.prototype,"openDialog",void 0),Y=i([l(),n("appointment-card-actions")],Y);let X=class AppointmentCard extends d{constructor(){super(...arguments),this.variant="next",this.detailsVariant="wide",this.isChatOpen=!1,this.isCancelDialogOpen=!1,this.unreadQuery=new s(this,()=>_(k,{roomId:this.appointmentResource?.room?.id})),this.getOrganizationSpecialtiesQuery=new s(this,()=>z(k,{enabled:!!this.appointmentResource?.speciality?.id})),this.getOrganizationSetupQuery=new s(this,()=>j(k)),this.getScheduleServicesQuery=new s(this,()=>O(k))}static{this.styles=m`:host{display:flex}.card{width:100%;padding:var(--sp-6);display:flex;flex-direction:column;gap:var(--sp-4);justify-content:space-between}.card-top-content{display:flex;flex-direction:column;gap:var(--sp-6)}.see-details{color:var(--color-primary-link-default);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-bold)}.see-details:hover{text-decoration:underline}.chevron-down{width:16px;height:16px;transition:transform .2s ease}.appointment-details{display:flex;flex-direction:column;gap:12px}.clock-icon-wrapper{width:24px;height:24px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.clock-icon-wrapper svg{width:100%;height:100%}.appointment-type{display:flex;align-items:center;gap:12px;font-size:18px;color:#2c3e50}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-2)}.actions.next{flex-direction:column}.actions-secondary{display:flex;gap:var(--sp-3)}.actions mq-button{flex:1}`}render(){const t=this.appointmentResource.appointment.channel===q.videocall,e=this.appointmentResource.appointment.channel===q.phonecall,i=!0===this.getOrganizationSetupQuery.result?.data?.appointments?.has_chat_in_appointment,n=(t||e)&&i,a=Q(),o=w(this.appointmentResource.appointment.expires_at),s=0===this.appointmentResource.slots.length,p=this.getOrganizationSetupQuery.result?.data?.appointments?.seconds_before_start_to_refund_on_cancel,l=N({startsAtIso:this.appointmentResource.appointment.starts_at,refundPolicySeconds:p}),c=o||s||!l,d=o||!l,m=J({action:"modify",refundPolicySeconds:p}),v=J({action:"cancel",refundPolicySeconds:p}),g=this.getOrganizationSpecialtiesQuery.result?.data?.find(t=>Number(t.id)===Number(this.appointmentResource.speciality.id)),f=D(g?.code??"",a,g?.name??this.appointmentResource.speciality.name),b=this.getScheduleServicesQuery.result?.data?.find(t=>t.id===this.appointmentResource.appointment.service_id)?.code,y=g?.code&&b?{specialty:g.code,service:b}:null;return h`<mq-card class="card" roundness="md"><div class="card-top-content"><professional-overview .specialtyName="${f??""}" .collegiateNumber="${this.appointmentResource.professional.collegiate_number??void 0}" .description="${this.appointmentResource.professional.description??""}" .languages="${this.appointmentResource.professional.languages}" .avatar="${this.appointmentResource.professional.avatar??""}" .name="${this.appointmentResource.professional.name}"></professional-overview><appointment-details .startsAt="${this.appointmentResource.appointment.starts_at}" .duration="${this.appointmentResource.appointment.duration}" .channel="${this.appointmentResource.appointment.channel}" .timezone="${this.loginToken?.patient?.timezone}" variant="${this.detailsVariant}"></appointment-details></div><appointment-card-actions .variant="${this.variant}" .appointmentId="${this.appointmentResource.appointment.id??""}" .isVideocall="${t}" .hasChatSupport="${n}" .unreadCount="${this.unreadQuery.result?.data?.unread_count??0}" .isModifyUnavailable="${c}" .isCancelUnavailable="${d}" .hasNoSlots="${s}" .modifyUnavailableMessage="${m}" .cancelUnavailableMessage="${v}" .repeatTarget="${y}" .professionalHash="${this.appointmentResource.professional.hash}" @toggle-chat="${()=>{this.isChatOpen=!this.isChatOpen,this.isChatOpen&&H.track(I(this.loginToken.patient.hash,this.appointmentResource.appointment.id??""))}}" @request-cancel="${()=>{this.isCancelDialogOpen=!0}}"></appointment-card-actions><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen?h`<mq-chat-room slot="content" .consultationId="${this.appointmentResource.appointment.id}" consultation-type="appointment" token="${this.loginToken.access_token}" .roomId="${this.appointmentResource.room.id}" .professionalHash="${this.appointmentResource.professional.hash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}" ?readonly="${o}"></mq-chat-room>`:u}</mq-floating-bubble><cancel-appointment-confirmation-dialog .appointmentId="${this.appointmentResource.appointment.id}" .price="${this.appointmentResource.price??void 0}" .open="${this.isCancelDialogOpen}" @cancel="${()=>{this.isCancelDialogOpen=!1}}" @success="${()=>{this.isCancelDialogOpen=!1,G.success(r("Consulta anulada correctamente")),this.dispatchEvent(new CustomEvent("appointment-cancel-confirmed",{bubbles:!0,composed:!0,detail:{id:this.appointmentResource.appointment.id}}))}}"></cancel-appointment-confirmation-dialog></mq-card>`}};i([v({type:Object})],X.prototype,"appointmentResource",void 0),i([v({type:Number})],X.prototype,"specialtyId",void 0),i([v({type:String})],X.prototype,"variant",void 0),i([v({type:String})],X.prototype,"detailsVariant",void 0),i([o({context:c})],X.prototype,"loginToken",void 0),i([U()],X.prototype,"isChatOpen",void 0),i([U()],X.prototype,"isCancelDialogOpen",void 0),X=i([l(),n("appointment-card")],X);let tt=class AppointmentCardSkeleton extends d{static{this.styles=m`div{border-radius:var(--border-radius-md);background:color-mix(in srgb,var(--color-neutrals-background-disabled) 50%,#fff 50%);height:337px;width:100%}`}render(){return h`<div></div>`}};tt=i([n("appointment-card-skeleton")],tt);let et=class EmptyState extends d{static{this.styles=m`.container{border-radius:var(--border-radius-md);background-color:var(--color-neutrals-background-weak);padding:var(--sp-10) var(--sp-6)}.card{border-radius:var(--border-radius-md);max-width:512px;margin:0 auto;background-color:var(--color-neutrals-background-extraWeak);padding:var(--sp-6);display:flex;flex-direction:column;align-items:center;gap:var(--sp-3)}.card>*{max-width:323px;margin:0 auto}.title{font-family:var(--font-body);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0}.description{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-normal);text-align:center;color:var(--color-neutrals-text-default);margin:0}@media (min-width:768px){.container{padding:var(--sp-6)}mq-button{max-width:323px}}`}handleRequestAppointment(){this.dispatchEvent(new CustomEvent("request-appointment",{bubbles:!0,composed:!0}))}render(){return h`<div class="container"><div class="card">${function({color:t="currentColor"}){return h`<svg width="31" height="32" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M29.6 2.4H23.2V0H21.6V2.4H18.4V0H16.8V2.4H13.6V0H12V2.4H8.8V0H7.2V2.4H0.8C0.587827 2.4 0.384344 2.48429 0.234315 2.63431C0.0842855 2.78434 0 2.98783 0 3.2V31.2C0 31.4122 0.0842855 31.6157 0.234315 31.7657C0.384344 31.9157 0.587827 32 0.8 32H29.6C29.8122 32 30.0157 31.9157 30.1657 31.7657C30.3157 31.6157 30.4 31.4122 30.4 31.2V3.2C30.4 2.98783 30.3157 2.78434 30.1657 2.63431C30.0157 2.48429 29.8122 2.4 29.6 2.4ZM28.8 30.4H1.6V10.4H27.2V8.8H1.6V4H7.2V7.2H8.8V4H12V7.2H13.6V4H16.8V7.2H18.4V4H21.6V7.2H23.2V4H28.8V30.4ZM3.2 19.2H9.6V12.8H3.2V19.2ZM4.8 14.4H8V17.6H4.8V14.4ZM20.8 19.2H27.2V12.8H20.8V19.2ZM22.4 14.4H25.6V17.6H22.4V14.4ZM12 19.2H18.4V12.8H12V19.2ZM13.6 14.4H16.8V17.6H13.6V14.4ZM3.2 28H9.6V21.6H3.2V28ZM4.8 23.2H8V26.4H4.8V23.2ZM20.8 28H27.2V21.6H20.8V28ZM22.4 23.2H25.6V26.4H22.4V23.2ZM12 28H18.4V21.6H12V28ZM13.6 23.2H16.8V26.4H13.6V23.2Z" fill="${t}"/></svg>`}({color:"var(--color-primary)"})}<p class="title">${this.title}</p><p class="description">${this.description}</p><mq-button variant="primary" size="md" fullwidth @click="${this.handleRequestAppointment}">${r("Pedir cita")}</mq-button></div></div>`}};function it(t,e){return{queryKey:["appointments",e],queryFn:()=>t.appointments.getAppointments(e)}}i([v({type:String})],et.prototype,"title",void 0),i([v({type:String})],et.prototype,"description",void 0),et=i([n("empty-state")],et);const nt=[C.pending,C.accepted],at=m`.appointments-list{display:grid;grid-template-columns:1fr;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}`;let ot=class NextAppointmentsTab extends d{constructor(){super(...arguments),this.getAppointmentsQuery=new s(this,()=>it(k,{status:nt,order:{field:"starts_at",direction:"asc"}}))}static{this.styles=at}render(){return this.getAppointmentsQuery.render({complete:t=>h`${t.data.length>0?h`<div class="appointments-list">${t.data.map(t=>h`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}"></appointment-card>`)}</div>`:h`<empty-state title="${r("No tienes próximas citas")}" description="${r("Agenda una consulta médica cuando la necesites. Aquí verás todos los detalles y podrás gestionar tus próximas citas.")}"></empty-state>`}`,pending:()=>h`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};ot=i([l(),n("next-appointments-tab")],ot);const st=[C.finished,C.reporting];let rt=class AppointmentsHistoryTab extends d{constructor(){super(...arguments),this.getAppointmentsQuery=new s(this,()=>it(k,{status:st,order:{field:"starts_at",direction:"desc"}}))}static{this.styles=m`.appointments-list{display:grid;grid-template-columns:1fr;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}`}render(){return this.getAppointmentsQuery.render({complete:t=>h`${t.data.length>0?h`<div class="appointments-list">${t.data.map(t=>h`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}" variant="history"></appointment-card>`)}</div>`:h`<empty-state title="${r("No tienes citas en el historial")}" description="${r("Aquí verás todas las citas que has tenido. Puedes acceder a los documentos de cada consulta y reagendar una cita si es necesario.")}"></empty-state>`}`,pending:()=>h`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};rt=i([l(),n("appointments-history-tab")],rt);const pt=m`.container{display:flex;flex-direction:column;gap:var(--size-3)}h1{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutral-link-dark);margin:0}p{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutral-link-dark);margin:0}.user-info{display:flex;align-items:center;justify-content:space-between}@media (min-width:768px){h1{font-size:var(--text-3xl);line-height:var(--text-3xl--line-height)}mq-tabs-list{max-width:435px}}`;let lt=class MqMyAppointments extends d{constructor(){super(...arguments),this.tab=F.next}static{this.styles=pt}handleSelect(t){this.dispatchEvent(new MqMyAppointmentsSelectEvent(t.value))}render(){return h`<div class="container"><back-link @mq-back="${t=>{t.stopPropagation(),this.dispatchEvent(new $)}}">${r("Volver al inicio")}</back-link><h1>${r("Mis citas")}</h1><div class="user-info"><p>${r(p`Para: ${this.loginToken.patient.name}`)}</p></div><mq-tabs .value="${this.tab}" @onvaluechange="${this.handleSelect}"><mq-tabs-list><mq-tabs-trigger value="${F.next}">${r("Próximas citas")}</mq-tabs-trigger><mq-tabs-trigger value="${F.history}">${r("Histórico")}</mq-tabs-trigger></mq-tabs-list><mq-tabs-content value="${F.next}"><next-appointments-tab></next-appointments-tab></mq-tabs-content><mq-tabs-content value="${F.history}"><appointments-history-tab></appointments-history-tab></mq-tabs-content></mq-tabs></div>`}};i([o({context:c})],lt.prototype,"loginToken",void 0),i([v({type:String,reflect:!0})],lt.prototype,"tab",void 0),lt=i([l(),n("mq-my-appointments")],lt);const ct=m`:host{display:block}.request-appointment-cta{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:var(--sp-12) var(--sp-4);background:var(--color-card);gap:var(--sp-4)}.title-body{display:flex;flex-direction:column;gap:var(--sp-2);flex:1}.title{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0;text-align:center}.subtitle{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);margin:0;display:none}mq-button{width:100%}.button-text-desktop{display:none}.button-text-mobile{display:inline}@media (min-width:768px){.request-appointment-cta{flex-direction:row;padding:var(--sp-12) var(--sp-20);gap:var(--sp-2)}.title-body{align-items:flex-start;flex:1;max-width:843px}.title{font-size:var(--text-3xl);line-height:var(--text-3xl--line-height);font-weight:var(--font-weight-extrabold);text-align:left}.subtitle{display:block}mq-button{width:auto;flex-shrink:0;--button-height-md:var(--button-height-lg);--text-sm:var(--text-base);--text-sm--line-height:var(--text-base--line-height)}.button-text-desktop{display:inline}.button-text-mobile{display:none}}`;class RequestAppointmentEvent extends Event{static{this.eventName="request-appointment"}constructor(){super(RequestAppointmentEvent.eventName,{bubbles:!0,composed:!0})}}let dt=class RequestAppointmentCta extends d{static{this.styles=ct}handleRequestAppointment(){this.dispatchEvent(new RequestAppointmentEvent)}render(){return h`<div class="request-appointment-cta"><div class="title-body"><h2 class="title">${r("Nueva cita de especialidades digitales")}</h2><p class="subtitle">${r("Realiza la búsqueda en tu cuadro médico digital")}</p></div><mq-button variant="primary" size="md" fullwidth @click="${this.handleRequestAppointment}"><span class="button-text-mobile">${r("Pedir cita")}</span> <span class="button-text-desktop">${r("Pedir una nueva cita")}</span></mq-button></div>`}};dt=i([l(),n("request-appointment-cta")],dt);export{lt as MqMyAppointments,MqMyAppointmentsSelectEvent,dt as RequestAppointmentCta,RequestAppointmentEvent};
@@ -1,4 +1,4 @@
1
- import{isValidLocale as t,setLocale as e,getLocale as i,initLocalization as n}from"./i18n.js";import{_ as o,t as a}from"./chunks/custom-element-DA9Fxvxd.js";import{m as s,s as r}from"./chunks/runtime-Bg1WXVCx.js";import{l as c}from"./chunks/parseISO-jT42c8Ob.js";import{i as p,a as l,x as d,E as m}from"./chunks/lit-element-DiWJYFwC.js";import{n as u}from"./chunks/property-scuRaFcM.js";import{r as h}from"./chunks/state-LQivXIgA.js";import{setEnv as g}from"./env.js";import{a as v,A as f,c as y,C as b}from"./chunks/api-chat-client-BTBtu01T.js";import{checkIcon as k}from"./ui/icons/check-icon.js";import"./ui/mq-callout.js";import"./ui/mq-button.js";import{Q as x,c as w}from"./chunks/mutation-controller-OVT8NEt6.js";import{l as j}from"./chunks/chunk-S5RWG6G2-oTcdgk2H.js";import{g as $,t as q,b as _,a as C,c as S,d as z,e as I,f as O}from"./chunks/telemetry-client-CKCb9Gnf.js";import{f as A}from"./chunks/price-Dtdjx70D.js";import{g as Q,a as P}from"./chunks/get-patient-profile-query-C8T8DJ7z.js";import{g as T}from"./chunks/get-organization-setup-query-BMbuRi6v.js";import{a as E}from"./chunks/exports-XZaVrMLd.js";import{calendarIcon as H}from"./ui/icons/calendar-icon.js";import{chatbubbleIcon as N}from"./ui/icons/chat-bubble-icon.js";import{videoIcon as V}from"./ui/icons/video-icon.js";import"./ui/mq-floating-bubble.js";import"./ui/mq-unread-badge.js";import"./ui/mq-skeleton.js";import"./ui/mq-card.js";import{Q as K}from"./chunks/query-QJ1INUTG.js";import"./chunks/external-zAbuzxDj.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";import"./ui/icons/types.js";import"./ui/icons/info-circle-outine-icon.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-provider-CiMFpvDA.js";import"./ui/icons/chevron-down-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/mq-text-button.js";import"./ui/mq-avatar.js";import"./ui/icons/briefcase-icon.js";import"./ui/icons/clock-icon.js";import"./ui/icons/message-bubble-icon.js";import"./ui/icons/phone-icon.js";import"./chunks/provide-CfT7g_Zi.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./events.js";import"./ui/icons/check-double-icon.js";import"./chunks/chunk-YTQUGGS3-DN-JZpgG.js";import"./chunks/style-map-CIdqdn7C.js";const B=p`header{padding:var(--sp-6) var(--sp-4);display:flex;align-items:center;gap:var(--sp-2);max-width:var(--content-max-width);margin:0 auto}.summary{padding:var(--sp-6) var(--sp-4);background-color:var(--color-neutrals-background-weak);max-width:var(--content-max-width);margin:0 auto}.summary-content{display:flex;flex-direction:column;gap:var(--sp-4)}.manage-appointment{box-sizing:border-box;max-width:var(--content-max-width);margin:0 auto}`;let U=class MqScheduleSuccessSkeleton extends l{static{this.styles=B}render(){return d`<div><header><mq-skeleton width="220px" height="40px" border-radius="md"></mq-skeleton></header><div class="summary"><div class="summary-content"><mq-skeleton width="280px" height="32px" border-radius="md"></mq-skeleton><mq-skeleton width="100%" height="400px" border-radius="lg"></mq-skeleton><mq-skeleton width="100%" height="80px" border-radius="lg"></mq-skeleton></div></div><div class="manage-appointment"><mq-skeleton width="100%" height="313px" border-radius="lg"></mq-skeleton></div></div>`}};U=o([a("mq-schedule-success-skeleton")],U);const G=p`.success-title{display:flex;align-items:center;gap:var(--sp-2);margin-bottom:var(--sp-4)}header h1{font-family:var(--font-titles);font-size:var(--text-3xl);line-height:var(--text-3xl--line-height);font-weight:var(--font-weight-bold);margin:0}h2{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0;margin-bottom:var(--sp-6)}.summary{padding:var(--sp-6) var(--sp-4)}.professional-card{padding:var(--sp-4)}.appointment-summary{margin-bottom:var(--sp-2);display:flex;flex-direction:column;gap:var(--sp-4)}.add-to-calendar-container{padding-top:var(--sp-4);border-top:1px solid var(--color-neutrals-border-disabled)}.price-breakdown{display:flex;flex-direction:column;gap:var(--sp-2)}.price-row{display:flex;justify-content:space-between;gap:var(--sp-4);font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-default)}.price-row--total{font-weight:var(--font-weight-semibold)}.price-breakdown hr{width:100%;border:none;border-top:1px solid var(--color-neutrals-border-disabled);margin:var(--sp-1) 0}.floating-content{height:100%}.actions{display:flex;flex-direction:column;gap:var(--sp-4)}@media (min-width:768px){.actions{flex-direction:row}}`;class OpenVideocallEvent extends Event{static{this.eventName="open-videocall"}constructor(t){super(OpenVideocallEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}let M=class MqScheduleSuccess extends l{constructor(){super(...arguments),this.kind="schedule",this._trackedPageView=!1,this.getPatientProfileQuery=new x(this,()=>Q(v)),this.getAppointmentQuery=new x(this,()=>P(v,{id:this.appointmentId})),this.getCouponQuery=new x(this,()=>{return t=v,e={appointmentId:this.appointmentId},i={enabled:!!this.appointmentId},{queryKey:["appointment-consultation-coupon",e.appointmentId],queryFn:()=>t.payments.getAppointmentConsultationCoupon(e.appointmentId),retry:!1,...i};var t,e,i}),this.getOrganizationSpecialtiesQuery=new x(this,()=>$(v)),this.getOrganizationSetupQuery=new x(this,()=>T(v)),this.isChatOpen=!1,this.unreadQuery=new x(this,()=>E(v,{roomId:Number(this.getAppointmentQuery.result?.data?.room_id)},{enabled:!!this.getAppointmentQuery.result?.data?.room_id})),this._getCalloutText=t=>{switch(t.channel){case f.videocall:return s("Te enviaremos un enlace al email indicado cuando sea el momento de conectarte a la vídeoconsulta. Asegúrate de tener buena conexión a internet y un dispositivo con cámara y micrófono.");case f.phonecall:return s(r`El profesional te llamará al
1
+ import{isValidLocale as t,setLocale as e,getLocale as i,initLocalization as n}from"./i18n.js";import{_ as o,t as a}from"./chunks/custom-element-DA9Fxvxd.js";import{m as s,s as r}from"./chunks/runtime-Bg1WXVCx.js";import{l as c}from"./chunks/parseISO-jT42c8Ob.js";import{i as p,a as l,x as d,E as m}from"./chunks/lit-element-DiWJYFwC.js";import{n as u}from"./chunks/property-scuRaFcM.js";import{r as h}from"./chunks/state-LQivXIgA.js";import{setEnv as g}from"./env.js";import{b as v,A as f,a as b,C as y}from"./chunks/api-chat-client-C8SqZtCa.js";import{checkIcon as k}from"./ui/icons/check-icon.js";import"./ui/mq-callout.js";import"./ui/mq-button.js";import{Q as x,c as w}from"./chunks/mutation-controller-OVT8NEt6.js";import{l as $}from"./chunks/chunk-S5RWG6G2-oTcdgk2H.js";import{g as j,t as q,b as _,a as C,c as S,d as z,e as I,f as O}from"./chunks/telemetry-client-BRVJU-fZ.js";import{f as Q}from"./chunks/price-tImUmtpX.js";import{g as A,a as P}from"./chunks/get-patient-profile-query-C8T8DJ7z.js";import{g as T}from"./chunks/get-organization-setup-query-BMbuRi6v.js";import{g as E}from"./chunks/exports-G_7Ih_GH.js";import{calendarIcon as H}from"./ui/icons/calendar-icon.js";import{chatbubbleIcon as N}from"./ui/icons/chat-bubble-icon.js";import{videoIcon as V}from"./ui/icons/video-icon.js";import"./ui/mq-floating-bubble.js";import"./ui/mq-unread-badge.js";import"./ui/mq-skeleton.js";import"./ui/mq-card.js";import{Q as K}from"./chunks/query-QJ1INUTG.js";import"./chunks/external-zAbuzxDj.js";import"./chunks/format-Cm3B1GMy.js";import"./chunks/isBefore-Cof0D841.js";import"./ui/icons/types.js";import"./ui/icons/info-circle-outine-icon.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-provider-CiMFpvDA.js";import"./ui/icons/chevron-down-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/mq-text-button.js";import"./ui/mq-avatar.js";import"./ui/icons/briefcase-icon.js";import"./ui/icons/clock-icon.js";import"./ui/icons/message-bubble-icon.js";import"./ui/icons/phone-icon.js";import"./chunks/provide-CfT7g_Zi.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./events.js";import"./ui/icons/check-double-icon.js";import"./chunks/chunk-YTQUGGS3-DN-JZpgG.js";import"./chunks/style-map-CIdqdn7C.js";const U=p`header{padding:var(--sp-6) var(--sp-4);display:flex;align-items:center;gap:var(--sp-2);max-width:var(--content-max-width);margin:0 auto}.summary{padding:var(--sp-6) var(--sp-4);background-color:var(--color-neutrals-background-weak);max-width:var(--content-max-width);margin:0 auto}.summary-content{display:flex;flex-direction:column;gap:var(--sp-4)}.manage-appointment{box-sizing:border-box;max-width:var(--content-max-width);margin:0 auto}`;let B=class MqScheduleSuccessSkeleton extends l{static{this.styles=U}render(){return d`<div><header><mq-skeleton width="220px" height="40px" border-radius="md"></mq-skeleton></header><div class="summary"><div class="summary-content"><mq-skeleton width="280px" height="32px" border-radius="md"></mq-skeleton><mq-skeleton width="100%" height="400px" border-radius="lg"></mq-skeleton><mq-skeleton width="100%" height="80px" border-radius="lg"></mq-skeleton></div></div><div class="manage-appointment"><mq-skeleton width="100%" height="313px" border-radius="lg"></mq-skeleton></div></div>`}};B=o([a("mq-schedule-success-skeleton")],B);const G=p`.success-title{display:flex;align-items:center;gap:var(--sp-2);margin-bottom:var(--sp-4)}header h1{font-family:var(--font-titles);font-size:var(--text-3xl);line-height:var(--text-3xl--line-height);font-weight:var(--font-weight-bold);margin:0}h2{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0;margin-bottom:var(--sp-6)}.summary{padding:var(--sp-6) var(--sp-4)}.professional-card{padding:var(--sp-4)}.appointment-summary{margin-bottom:var(--sp-2);display:flex;flex-direction:column;gap:var(--sp-4)}.add-to-calendar-container{padding-top:var(--sp-4);border-top:1px solid var(--color-neutrals-border-disabled)}.price-breakdown{display:flex;flex-direction:column;gap:var(--sp-2)}.price-row{display:flex;justify-content:space-between;gap:var(--sp-4);font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-default)}.price-row--total{font-weight:var(--font-weight-semibold)}.price-breakdown hr{width:100%;border:none;border-top:1px solid var(--color-neutrals-border-disabled);margin:var(--sp-1) 0}.floating-content{height:100%}.actions{display:flex;flex-direction:column;gap:var(--sp-4)}@media (min-width:768px){.actions{flex-direction:row}}`;class OpenVideocallEvent extends Event{static{this.eventName="open-videocall"}constructor(t){super(OpenVideocallEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}let M=class MqScheduleSuccess extends l{constructor(){super(...arguments),this.kind="schedule",this._trackedPageView=!1,this.getPatientProfileQuery=new x(this,()=>A(v)),this.getAppointmentQuery=new x(this,()=>P(v,{id:this.appointmentId})),this.getCouponQuery=new x(this,()=>{return t=v,e={appointmentId:this.appointmentId},i={enabled:!!this.appointmentId},{queryKey:["appointment-consultation-coupon",e.appointmentId],queryFn:()=>t.payments.getAppointmentConsultationCoupon(e.appointmentId),retry:!1,...i};var t,e,i}),this.getOrganizationSpecialtiesQuery=new x(this,()=>j(v)),this.getOrganizationSetupQuery=new x(this,()=>T(v)),this.isChatOpen=!1,this.unreadQuery=new x(this,()=>E(v,{roomId:Number(this.getAppointmentQuery.result?.data?.room_id)},{enabled:!!this.getAppointmentQuery.result?.data?.room_id})),this._getCalloutText=t=>{switch(t.channel){case f.videocall:return s("Te enviaremos un enlace al email indicado cuando sea el momento de conectarte a la vídeoconsulta. Asegúrate de tener buena conexión a internet y un dispositivo con cámara y micrófono.");case f.phonecall:return s(r`El profesional te llamará al
2
2
  ${this.getPatientProfileQuery.result?.data?.profile.phone??""} en el horario
3
3
  seleccionado. Asegúrate de tener buena cobertura y poder atender en
4
- el horario elegido.`);case f.chat:return s("El profesional te enviará un mensaje para que podamos coordinar la cita. Asegúrate de tener buena cobertura y poder atender en el horario elegido.");default:return m}}}static{this.styles=G}get _accessToken(){return this.token??this.loginToken?.access_token}get _timezone(){return this.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}willUpdate(i){i.has("env")&&this.env&&g(this.env),i.has("apiKey")&&this.apiKey&&v.setApiKey(this.apiKey),i.has("token")&&this.token&&v.setAuthToken(this.token),i.has("locale")&&this.locale&&t(this.locale)&&(e(this.locale),v.setLanguage(this.locale))}get _patientHash(){return this.getPatientProfileQuery.result?.data?.hash??""}connectedCallback(){super.connectedCallback(),this.queryClientContext?.invalidateQueries()}updated(){!this._trackedPageView&&this._patientHash&&(this._trackedPageView=!0,q.track(_(this._patientHash,this.appointmentId)))}renderPriceBreakdown(t,e,i){const n=t.price;if(null==n||n<=0)return m;const o=t.currency??"EUR",a=t.discount_amount??0,r=a>0,c=n-a,p=this.getCouponQuery.result?.data,l=p?.name??p?.code,u=r?p?.percent_off??Math.round(a/n*100):0,h=l?`${s("Promoción")} ${l}`:s("Promoción");return d`<div class="price-breakdown"><div class="price-row"><span>${i}</span> <span>${A({amount:n,currency:o},e)}</span></div>${r?d`<div class="price-row"><span>${h} (-${u}%)</span> <span>${A({amount:-a,currency:o},e)}</span></div><hr><div class="price-row price-row--total"><span>${s("Total")}</span> <span>${A({amount:c,currency:o},e)}</span></div>`:m}</div>`}render(){return this.getAppointmentQuery.render({pending:()=>d`<mq-schedule-success-skeleton></mq-schedule-success-skeleton>`,complete:t=>{const e=i(),n=y(t.start_date),o=C(n,t.duration),a=this.getOrganizationSpecialtiesQuery.result?.data?.find(e=>e.id===Number(t.speciality_id)),c=S(a?.code??"",e,a?.name),p=t.channel===f.videocall,l=t.channel===f.phonecall,u=!0===this.getOrganizationSetupQuery.result?.data?.appointments?.has_chat_in_appointment,h=(p||l)&&u,g=this._accessToken;return d`<div><header><div class="success-title">${k()}<h1>${"schedule"===this.kind?s("Cita confirmada"):s("Cita modificada")}</h1></div><h2>${s(r`Resumen de la cita para ${t?.to?.name??""}`)}</h2></header><mq-card class="summary" roundness="md"><div class="appointment-summary"><professional-overview .name="${t.from.name??""}" .specialtyName="${c}" .collegiateNumber="${t.from.collegiate_number??void 0}" .description="${t.from.description??""}" .languages="${t.from.languages??[]}" .avatar="${t.from.avatar??""}" always-expanded-on-desktop></professional-overview><appointment-details .startsAt="${n.toISOString()}" .duration="${t.duration}" .channel="${t.channel}" .timezone="${this._timezone}"></appointment-details>${this.renderPriceBreakdown(t,e,c||s("Consulta"))}<div class="add-to-calendar-container"><mq-text-button fontWeight="bold" size="sm" @click="${()=>{q.track(z(this._patientHash,this.appointmentId));const e=function({title:t,description:e,startsAt:i,endsAt:n}){const o=t=>t.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),a=o(i),s=o(n);return`https://www.google.com/calendar/render?${new URLSearchParams({action:"TEMPLATE",text:t,dates:`${a}/${s}`,...e&&{details:e}}).toString()}`}({title:s(r`Cita agendada de ${t.from.speciality??""}`),startsAt:n,endsAt:o,description:p&&t.consultation_short_url?s(r`Enlace a la cita: ${t.consultation_short_url}`):void 0});window.open(e,"_blank")}}">${H({size:24})} ${s("Añadir al calendario")}</mq-text-button></div>${h||p?d`<div class="actions">${h?d`<mq-button variant="primary" fullwidth size="md" @click="${()=>{q.track(I(this._patientHash,this.appointmentId)),this.isChatOpen=!this.isChatOpen}}">${N({size:24})} ${s("Chatear con el profesional")} ${(this.unreadQuery.result?.data?.unread_count??0)>0?d`<mq-unread-badge></mq-unread-badge>`:m}</mq-button>`:m} ${p?d`<mq-button variant="outline" fullwidth size="md" @click="${()=>{q.track(O(this._patientHash,this.appointmentId)),this.dispatchEvent(new OpenVideocallEvent({appointmentId:this.appointmentId}))}}">${V({size:24})} ${s("Ir a videollamada")}</mq-button>`:m}</div>`:m}</div><mq-callout background="default" variant="info" ?noPadding="${!(h||p)}">${this._getCalloutText(t)}</mq-callout></mq-card></div><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen&&g?d`<div slot="content" class="floating-content"><mq-chat-room .consultationId="${t.id}" .consultationType="${b.appointment}" .token="${g}" .roomId="${Number(t.room_id)}" .professionalHash="${t.from.hash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}"></mq-chat-room></div>`:m}</mq-floating-bubble>`}})}};o([u({type:String})],M.prototype,"kind",void 0),o([u({type:String})],M.prototype,"appointmentId",void 0),o([u({type:String,attribute:"api-key"})],M.prototype,"apiKey",void 0),o([u({type:String,attribute:"token"})],M.prototype,"token",void 0),o([u({type:String,attribute:"timezone"})],M.prototype,"timezone",void 0),o([u({type:String,attribute:"locale"})],M.prototype,"locale",void 0),o([u({type:String,attribute:"env"})],M.prototype,"env",void 0),o([w({context:K,subscribe:!0})],M.prototype,"queryClientContext",void 0),o([w({context:j})],M.prototype,"loginToken",void 0),o([h()],M.prototype,"isChatOpen",void 0),M=o([c(),a("mq-schedule-success")],M),n();export{M as MqScheduleSuccess,OpenVideocallEvent};
4
+ el horario elegido.`);case f.chat:return s("El profesional te enviará un mensaje para que podamos coordinar la cita. Asegúrate de tener buena cobertura y poder atender en el horario elegido.");default:return m}}}static{this.styles=G}get _accessToken(){return this.token??this.loginToken?.access_token}get _timezone(){return this.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}willUpdate(i){i.has("env")&&this.env&&g(this.env),i.has("apiKey")&&this.apiKey&&v.setApiKey(this.apiKey),i.has("token")&&this.token&&v.setAuthToken(this.token),i.has("locale")&&this.locale&&t(this.locale)&&(e(this.locale),v.setLanguage(this.locale))}get _patientHash(){return this.getPatientProfileQuery.result?.data?.hash??""}connectedCallback(){super.connectedCallback(),this.queryClientContext?.invalidateQueries()}updated(){!this._trackedPageView&&this._patientHash&&(this._trackedPageView=!0,q.track(_(this._patientHash,this.appointmentId)))}renderPriceBreakdown(t,e,i){const n=t.price;if(null==n||n<=0)return m;const o=t.currency??"EUR",a=t.discount_amount??0,r=a>0,c=n-a,p=this.getCouponQuery.result?.data,l=p?.name??p?.code,u=r?p?.percent_off??Math.round(a/n*100):0,h=l?`${s("Promoción")} ${l}`:s("Promoción");return d`<div class="price-breakdown"><div class="price-row"><span>${i}</span> <span>${Q({amount:n,currency:o},e)}</span></div>${r?d`<div class="price-row"><span>${h} (-${u}%)</span> <span>${Q({amount:-a,currency:o},e)}</span></div><hr><div class="price-row price-row--total"><span>${s("Total")}</span> <span>${Q({amount:c,currency:o},e)}</span></div>`:m}</div>`}render(){return this.getAppointmentQuery.render({pending:()=>d`<mq-schedule-success-skeleton></mq-schedule-success-skeleton>`,complete:t=>{const e=i(),n=b(t.start_date),o=C(n,t.duration),a=this.getOrganizationSpecialtiesQuery.result?.data?.find(e=>e.id===Number(t.speciality_id)),c=S(a?.code??"",e,a?.name),p=t.channel===f.videocall,l=t.channel===f.phonecall,u=!0===this.getOrganizationSetupQuery.result?.data?.appointments?.has_chat_in_appointment,h=(p||l)&&u,g=this._accessToken;return d`<div><header><div class="success-title">${k()}<h1>${"schedule"===this.kind?s("Cita confirmada"):s("Cita modificada")}</h1></div><h2>${s(r`Resumen de la cita para ${t?.to?.name??""}`)}</h2></header><mq-card class="summary" roundness="md"><div class="appointment-summary"><professional-overview .name="${t.from.name??""}" .specialtyName="${c}" .collegiateNumber="${t.from.collegiate_number??void 0}" .description="${t.from.description??""}" .languages="${t.from.languages??[]}" .avatar="${t.from.avatar??""}" always-expanded-on-desktop></professional-overview><appointment-details .startsAt="${n.toISOString()}" .duration="${t.duration}" .channel="${t.channel}" .timezone="${this._timezone}"></appointment-details>${this.renderPriceBreakdown(t,e,c||s("Consulta"))}<div class="add-to-calendar-container"><mq-text-button fontWeight="bold" size="sm" @click="${()=>{q.track(z(this._patientHash,this.appointmentId));const e=function({title:t,description:e,startsAt:i,endsAt:n}){const o=t=>t.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),a=o(i),s=o(n);return`https://www.google.com/calendar/render?${new URLSearchParams({action:"TEMPLATE",text:t,dates:`${a}/${s}`,...e&&{details:e}}).toString()}`}({title:s(r`Cita agendada de ${t.from.speciality??""}`),startsAt:n,endsAt:o,description:p&&t.consultation_short_url?s(r`Enlace a la cita: ${t.consultation_short_url}`):void 0});window.open(e,"_blank")}}">${H({size:24})} ${s("Añadir al calendario")}</mq-text-button></div>${h||p?d`<div class="actions">${h?d`<mq-button variant="primary" fullwidth size="md" @click="${()=>{q.track(I(this._patientHash,this.appointmentId)),this.isChatOpen=!this.isChatOpen}}">${N({size:24})} ${s("Chatear con el profesional")} ${(this.unreadQuery.result?.data?.unread_count??0)>0?d`<mq-unread-badge></mq-unread-badge>`:m}</mq-button>`:m} ${p?d`<mq-button variant="outline" fullwidth size="md" @click="${()=>{q.track(O(this._patientHash,this.appointmentId)),this.dispatchEvent(new OpenVideocallEvent({appointmentId:this.appointmentId}))}}">${V({size:24})} ${s("Ir a videollamada")}</mq-button>`:m}</div>`:m}</div><mq-callout background="default" variant="info" ?noPadding="${!(h||p)}">${this._getCalloutText(t)}</mq-callout></mq-card></div><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen&&g?d`<div slot="content" class="floating-content"><mq-chat-room .consultationId="${t.id}" .consultationType="${y.appointment}" .token="${g}" .roomId="${Number(t.room_id)}" .professionalHash="${t.from.hash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}"></mq-chat-room></div>`:m}</mq-floating-bubble>`}})}};o([u({type:String})],M.prototype,"kind",void 0),o([u({type:String})],M.prototype,"appointmentId",void 0),o([u({type:String,attribute:"api-key"})],M.prototype,"apiKey",void 0),o([u({type:String,attribute:"token"})],M.prototype,"token",void 0),o([u({type:String,attribute:"timezone"})],M.prototype,"timezone",void 0),o([u({type:String,attribute:"locale"})],M.prototype,"locale",void 0),o([u({type:String,attribute:"env"})],M.prototype,"env",void 0),o([w({context:K,subscribe:!0})],M.prototype,"queryClientContext",void 0),o([w({context:$})],M.prototype,"loginToken",void 0),o([h()],M.prototype,"isChatOpen",void 0),M=o([c(),a("mq-schedule-success")],M),n();export{M as MqScheduleSuccess,OpenVideocallEvent};
@@ -165,16 +165,16 @@ declare const CompleteProfileFormSchema: z.ZodObject<{
165
165
  birth_date: z.ZodString;
166
166
  tax_id: z.ZodString;
167
167
  }, "strip", z.ZodTypeAny, {
168
- email: string;
169
168
  first_name: string;
170
169
  last_name: string;
170
+ email: string;
171
171
  phone: string;
172
172
  birth_date: string;
173
173
  tax_id: string;
174
174
  }, {
175
- email: string;
176
175
  first_name: string;
177
176
  last_name: string;
177
+ email: string;
178
178
  phone: string;
179
179
  birth_date: string;
180
180
  tax_id: string;
@@ -763,7 +763,7 @@ declare class ProfessionalsList extends LitElement {
763
763
  private getOrganizationSpecialtiesQuery;
764
764
  private getScheduleServicesQuery;
765
765
  private getProfessionalsBySpecialtyAndServiceQuery;
766
- render(): lit_html.TemplateResult<1> | typeof nothing | null;
766
+ render(): typeof nothing | lit_html.TemplateResult<1> | null;
767
767
  }
768
768
  declare global {
769
769
  interface HTMLElementTagNameMap {