@mediquo/elements 0.9.3 → 0.10.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 (109) hide show
  1. package/dist/chunks/api-chat-client-BhxUWldC.js +1 -0
  2. package/dist/chunks/{apple-pay-outcomes-DbuQ2LI3.js → apple-pay-outcomes-BU_PyQdT.js} +1 -1
  3. package/dist/chunks/{chunk-Y4EKUX25-CWAZgcgw.js → chunk-Y4EKUX25-QqMl3eiq.js} +1 -1
  4. package/dist/chunks/{chunk-YTQUGGS3-DJR1Yoyy.js → chunk-YTQUGGS3-DmCGIoFy.js} +1 -1
  5. package/dist/chunks/documentation-view-CEfoq9vD.js +1 -0
  6. package/dist/chunks/{external-BXLaKy9c.js → external-CJj32K_p.js} +1 -1
  7. package/dist/chunks/{index-Dbbpnw8f.d.ts → index-Bv4Mk1Ch.d.ts} +1 -1
  8. package/dist/chunks/{index-ClLOggjQ.js → index-CYBd3XL2.js} +1 -1
  9. package/dist/chunks/{index-CFlNQLy2.d.ts → index-Cgni0Is9.d.ts} +1 -1
  10. package/dist/chunks/{index-DdkeWQrh.d.ts → index-D0njwg5o.d.ts} +1 -1
  11. package/dist/chunks/{index-BLxNeTVi.js → index-DjD-3x4f.js} +1 -1
  12. package/dist/chunks/{index.d-XSe7Hy-Q.d.ts → index.d-DeJP_xib.d.ts} +13 -22
  13. package/dist/chunks/{mq-chat-room-jeDvIF1Z.d.ts → mq-chat-room-B3ant6md.d.ts} +1 -1
  14. package/dist/chunks/{mq-next-appointments-5tvQaSba.js → mq-next-appointments-BdsRyXJB.js} +1 -1
  15. package/dist/chunks/{mq-recent-documents-DzsyvBjW.js → mq-recent-documents-CNweIX5U.js} +1 -1
  16. package/dist/chunks/{next-appointment-card-DBXsY3Sp.d.ts → next-appointment-card-CWz0tef1.d.ts} +2 -2
  17. package/dist/chunks/{next-appointment-card-DQE7dNXw.js → next-appointment-card-KXLkEJDg.js} +1 -1
  18. package/dist/chunks/professional-overview-B4E05rLd.js +1 -0
  19. package/dist/env.js +1 -1
  20. package/dist/events.d.ts +3 -44
  21. package/dist/i18n.js +1 -1
  22. package/dist/mq-api-client-provider.d.ts +1 -1
  23. package/dist/mq-api-client-provider.js +1 -1
  24. package/dist/mq-apple-pay-checkout.d.ts +1 -1
  25. package/dist/mq-apple-pay-checkout.js +1 -1
  26. package/dist/mq-appointment-checkout.d.ts +1 -1
  27. package/dist/mq-appointment-checkout.js +1 -1
  28. package/dist/mq-appointment-documentation.d.ts +4 -3
  29. package/dist/mq-appointment-documentation.js +1 -1
  30. package/dist/mq-chat-room.d.ts +2 -2
  31. package/dist/mq-chat-room.js +1 -1
  32. package/dist/mq-checkout.d.ts +1 -1
  33. package/dist/mq-checkout.js +1 -1
  34. package/dist/mq-dashboard.d.ts +4 -4
  35. package/dist/mq-dashboard.js +1 -1
  36. package/dist/mq-documents.d.ts +2 -2
  37. package/dist/mq-documents.js +1 -1
  38. package/dist/mq-google-pay-checkout.d.ts +1 -1
  39. package/dist/mq-google-pay-checkout.js +1 -1
  40. package/dist/mq-immediate-videocall-checkout.d.ts +1 -1
  41. package/dist/mq-immediate-videocall-checkout.js +1 -1
  42. package/dist/mq-my-appointments.d.ts +3 -3
  43. package/dist/mq-my-appointments.js +1 -1
  44. package/dist/mq-next-appointments.d.ts +3 -3
  45. package/dist/mq-next-appointments.js +1 -1
  46. package/dist/mq-payment-poller.d.ts +15 -23
  47. package/dist/mq-payment-poller.js +1 -1
  48. package/dist/mq-professional-presence-sync.js +1 -1
  49. package/dist/mq-recent-documents.d.ts +2 -2
  50. package/dist/mq-recent-documents.js +1 -1
  51. package/dist/mq-schedule-success.d.ts +2 -2
  52. package/dist/mq-schedule-success.js +1 -1
  53. package/dist/mq-schedule.d.ts +1 -1
  54. package/dist/mq-schedule.js +1 -1
  55. package/dist/mq-socket-provider.js +1 -1
  56. package/dist/mq-support-chat.d.ts +2 -2
  57. package/dist/mq-support-chat.js +1 -1
  58. package/dist/mq-terms-and-conditions.d.ts +2 -2
  59. package/dist/mq-terms-and-conditions.js +1 -1
  60. package/dist/mq-unread-count-sync.js +1 -1
  61. package/dist/mq-videocall.d.ts +3 -3
  62. package/dist/mq-videocall.js +1 -1
  63. package/dist/react/mq-api-client-provider.d.ts +1 -1
  64. package/dist/react/mq-api-client-provider.js +1 -1
  65. package/dist/react/mq-apple-pay-checkout.d.ts +1 -1
  66. package/dist/react/mq-apple-pay-checkout.js +1 -1
  67. package/dist/react/mq-appointment-checkout.d.ts +1 -1
  68. package/dist/react/mq-appointment-checkout.js +1 -1
  69. package/dist/react/mq-appointment-documentation.d.ts +4 -3
  70. package/dist/react/mq-appointment-documentation.js +1 -1
  71. package/dist/react/mq-chat-room.d.ts +2 -2
  72. package/dist/react/mq-chat-room.js +1 -1
  73. package/dist/react/mq-checkout.d.ts +1 -1
  74. package/dist/react/mq-checkout.js +1 -1
  75. package/dist/react/mq-dashboard.d.ts +4 -4
  76. package/dist/react/mq-dashboard.js +1 -1
  77. package/dist/react/mq-documents-page.d.ts +2 -2
  78. package/dist/react/mq-documents-page.js +1 -1
  79. package/dist/react/mq-documents.d.ts +2 -2
  80. package/dist/react/mq-documents.js +1 -1
  81. package/dist/react/mq-google-pay-checkout.d.ts +1 -1
  82. package/dist/react/mq-google-pay-checkout.js +1 -1
  83. package/dist/react/mq-immediate-videocall-checkout.d.ts +1 -1
  84. package/dist/react/mq-immediate-videocall-checkout.js +1 -1
  85. package/dist/react/mq-my-appointments.d.ts +3 -3
  86. package/dist/react/mq-my-appointments.js +1 -1
  87. package/dist/react/mq-next-appointments.d.ts +3 -3
  88. package/dist/react/mq-next-appointments.js +1 -1
  89. package/dist/react/mq-payment-poller.d.ts +6 -13
  90. package/dist/react/mq-payment-poller.js +1 -1
  91. package/dist/react/mq-professional-presence-sync.js +1 -1
  92. package/dist/react/mq-recent-documents.d.ts +2 -2
  93. package/dist/react/mq-recent-documents.js +1 -1
  94. package/dist/react/mq-schedule-success.d.ts +2 -2
  95. package/dist/react/mq-schedule-success.js +1 -1
  96. package/dist/react/mq-schedule.d.ts +1 -1
  97. package/dist/react/mq-schedule.js +1 -1
  98. package/dist/react/mq-socket-provider.js +1 -1
  99. package/dist/react/mq-support-chat.d.ts +2 -2
  100. package/dist/react/mq-support-chat.js +1 -1
  101. package/dist/react/mq-terms-and-conditions.d.ts +2 -2
  102. package/dist/react/mq-terms-and-conditions.js +1 -1
  103. package/dist/react/mq-unread-count-sync.js +1 -1
  104. package/dist/react/mq-videocall.d.ts +3 -3
  105. package/dist/react/mq-videocall.js +1 -1
  106. package/package.json +1 -1
  107. package/dist/chunks/api-chat-client-fYDIH220.js +0 -1
  108. package/dist/chunks/documentation-view-DywQ1MfS.js +0 -1
  109. package/dist/chunks/professional-overview-C4H_znIJ.js +0 -1
@@ -1 +1 @@
1
- import{s as t}from"./chunk-6CCJWPGL-TiaqZaPV.js";import{_ as e,c as o}from"./custom-element-D2ziPxYE.js";import{t as i,d as r,a}from"./telemetry-client-DEIuDZfA.js";import{i as s,a as n,x as d,E as l}from"./lit-element-DiWJYFwC.js";import{n as c}from"./property-scuRaFcM.js";import{c as p}from"./consume-CovVqBjI.js";import{m}from"./runtime-Bg1WXVCx.js";import{l as h}from"./localized-decorator-BlOuLhym.js";import{A as f}from"./api-client-context-V1UAGtKW.js";import{D as u}from"./api-chat-client-fYDIH220.js";import{b as g}from"./blob-to-base64-CUL1trde.js";import{r as y}from"./state-LQivXIgA.js";import{DownloadFileEvent as v}from"../events.js";import{getLocale as w}from"../i18n.js";import{download02Icon as b}from"../ui/icons/download-02-icon.js";import"../ui/mq-button.js";import{toast as x}from"../ui/mq-toast.js";import"../ui/mq-skeleton.js";function k(e,o){return{queryKey:t(e,"patient-documents",o),queryFn:()=>e.flash.getPatientDocuments(o)}}const $=s`:host{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-1) 0;width:100%;min-width:0;box-sizing:border-box}.details{display:flex;flex-direction:column;align-items:flex-start;gap:6px;flex:1;min-width:0}.tag{display:inline-flex;align-items:center;border-radius:var(--border-radius-sm);padding:var(--sp-1) var(--sp-2);font-family:var(--font-body);font-size:var(--text-xs);line-height:1.35;font-weight:var(--font-weight-normal)}.tag.prescription{background-color:var(--color-feedback--info-subtle,#eceefd);color:var(--color-feedback--info-text,#4a1ea7)}.tag.report{background-color:var(--color-feedback--warning-subtle,#ffebce);color:var(--color-feedback--warning-text,#8f4700)}.tag.diagnostic-test-prescription{background-color:var(--color-feedback--success-subtle,#e8f6ec);color:var(--color-feedback--success-text,#16653a)}.text{display:flex;flex-direction:column;gap:var(--sp-1);width:100%;min-width:0}.name{font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;font-weight:var(--font-weight-normal);color:var(--color-text-icons--primary,#0a0a22);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.meta{font-family:var(--font-body);font-size:var(--text-xs);line-height:1.35;font-weight:var(--font-weight-normal);color:var(--color-text-icons--secondary,#6d658b);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}`;let j=class DocumentRow extends n{constructor(){super(...arguments),this.documentId="",this.name="",this.specialty="",this.date="",this.downloadUrl="",this.patientHash="",this.isDownloading=!1,this.handleDownload=async()=>{this.isDownloading=!0;try{i.track(r(this.patientHash,this.documentId));const t=await this.apiClient.flash.downloadDocument({url:this.downloadUrl}),e=await g(t);this.dispatchEvent(new v({url:e,filename:`${this.name}.pdf`}))}catch{x.error(m("No hemos podido descargar el documento."))}finally{this.isDownloading=!1}}}static{this.styles=$}formatDate(){const t=new Date(this.date);if(Number.isNaN(t.getTime()))return"";const e=w().replace("_","-");return new Intl.DateTimeFormat(e,{day:"2-digit",month:"2-digit",year:"2-digit"}).format(t)}formatKind(){switch(this.kind){case u.prescription:return m("Receta");case u.report:return m("Informe");case u.diagnosticTestPrescription:return m("Orden médica")}}get kindClass(){return(this.kind??"").replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}get metaLine(){return[this.formatDate(),this.specialty].filter(Boolean).join(" - ")}render(){return d`<div class="details"><span class="tag ${this.kindClass}">${this.formatKind()}</span><div class="text"><span class="name" title="${this.name}">${this.name}</span> <span class="meta">${this.metaLine}</span></div></div><mq-button variant="outline" size="icon-lg" aria-label="${m("Descargar documento")}" ?disabled="${this.isDownloading}" @click="${this.handleDownload}">${b({size:24})}</mq-button>`}};function D(t,e,o){return t.map(t=>{const i=e?.find(e=>Number(e.id)===Number(t.professional.speciality_id));return{documentId:t.document_id,kind:t.document_type,name:t.name,specialty:a(i?.code??"",o,i?.name??t.professional.speciality_name),date:t.created_at,downloadUrl:t.url}})}e([p({context:f,subscribe:!0})],j.prototype,"apiClient",void 0),e([c({type:String})],j.prototype,"documentId",void 0),e([c({type:String})],j.prototype,"kind",void 0),e([c({type:String})],j.prototype,"name",void 0),e([c({type:String})],j.prototype,"specialty",void 0),e([c({type:String})],j.prototype,"date",void 0),e([c({type:String})],j.prototype,"downloadUrl",void 0),e([c({type:String})],j.prototype,"patientHash",void 0),e([y()],j.prototype,"isDownloading",void 0),j=e([h(),o("document-row")],j);const q=s`:host{display:flex;flex-direction:column;gap:var(--sp-3);width:100%;min-width:0;box-sizing:border-box}.divider{height:1px;width:100%;background-color:var(--color-border-subtle,#edecf1);flex-shrink:0}`;let z=class DocumentList extends n{constructor(){super(...arguments),this.documents=[],this.patientHash="",this.placeholders=0}static{this.styles=q}get rows(){return this.placeholders>0?Array.from({length:this.placeholders},()=>d`<mq-skeleton height="${"77px"}"></mq-skeleton>`):this.documents.map(t=>d`<document-row documentId="${t.documentId}" kind="${t.kind}" name="${t.name}" specialty="${t.specialty}" date="${t.date}" downloadUrl="${t.downloadUrl}" patientHash="${this.patientHash}"></document-row>`)}render(){const t=this.rows;return t.map((e,o)=>d`${e} ${o<t.length-1?d`<div class="divider"></div>`:l}`)}};e([c({type:Array})],z.prototype,"documents",void 0),e([c({type:String})],z.prototype,"patientHash",void 0),e([c({type:Number})],z.prototype,"placeholders",void 0),z=e([o("document-list")],z);export{k as g,D as t};
1
+ import{s as t}from"./chunk-6CCJWPGL-TiaqZaPV.js";import{_ as e,c as o}from"./custom-element-D2ziPxYE.js";import{t as i,d as r,a}from"./telemetry-client-DEIuDZfA.js";import{i as s,a as n,x as d,E as l}from"./lit-element-DiWJYFwC.js";import{n as c}from"./property-scuRaFcM.js";import{c as p}from"./consume-CovVqBjI.js";import{m}from"./runtime-Bg1WXVCx.js";import{l as h}from"./localized-decorator-BlOuLhym.js";import{A as f}from"./api-client-context-V1UAGtKW.js";import{D as u}from"./api-chat-client-BhxUWldC.js";import{b as g}from"./blob-to-base64-CUL1trde.js";import{r as y}from"./state-LQivXIgA.js";import{DownloadFileEvent as v}from"../events.js";import{getLocale as w}from"../i18n.js";import{download02Icon as b}from"../ui/icons/download-02-icon.js";import"../ui/mq-button.js";import{toast as x}from"../ui/mq-toast.js";import"../ui/mq-skeleton.js";function k(e,o){return{queryKey:t(e,"patient-documents",o),queryFn:()=>e.flash.getPatientDocuments(o)}}const $=s`:host{display:flex;align-items:center;gap:var(--sp-3);padding:var(--sp-1) 0;width:100%;min-width:0;box-sizing:border-box}.details{display:flex;flex-direction:column;align-items:flex-start;gap:6px;flex:1;min-width:0}.tag{display:inline-flex;align-items:center;border-radius:var(--border-radius-sm);padding:var(--sp-1) var(--sp-2);font-family:var(--font-body);font-size:var(--text-xs);line-height:1.35;font-weight:var(--font-weight-normal)}.tag.prescription{background-color:var(--color-feedback--info-subtle,#eceefd);color:var(--color-feedback--info-text,#4a1ea7)}.tag.report{background-color:var(--color-feedback--warning-subtle,#ffebce);color:var(--color-feedback--warning-text,#8f4700)}.tag.diagnostic-test-prescription{background-color:var(--color-feedback--success-subtle,#e8f6ec);color:var(--color-feedback--success-text,#16653a)}.text{display:flex;flex-direction:column;gap:var(--sp-1);width:100%;min-width:0}.name{font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;font-weight:var(--font-weight-normal);color:var(--color-text-icons--primary,#0a0a22);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.meta{font-family:var(--font-body);font-size:var(--text-xs);line-height:1.35;font-weight:var(--font-weight-normal);color:var(--color-text-icons--secondary,#6d658b);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}`;let j=class DocumentRow extends n{constructor(){super(...arguments),this.documentId="",this.name="",this.specialty="",this.date="",this.downloadUrl="",this.patientHash="",this.isDownloading=!1,this.handleDownload=async()=>{this.isDownloading=!0;try{i.track(r(this.patientHash,this.documentId));const t=await this.apiClient.flash.downloadDocument({url:this.downloadUrl}),e=await g(t);this.dispatchEvent(new v({url:e,filename:`${this.name}.pdf`}))}catch{x.error(m("No hemos podido descargar el documento."))}finally{this.isDownloading=!1}}}static{this.styles=$}formatDate(){const t=new Date(this.date);if(Number.isNaN(t.getTime()))return"";const e=w().replace("_","-");return new Intl.DateTimeFormat(e,{day:"2-digit",month:"2-digit",year:"2-digit"}).format(t)}formatKind(){switch(this.kind){case u.prescription:return m("Receta");case u.report:return m("Informe");case u.diagnosticTestPrescription:return m("Orden médica")}}get kindClass(){return(this.kind??"").replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}get metaLine(){return[this.formatDate(),this.specialty].filter(Boolean).join(" - ")}render(){return d`<div class="details"><span class="tag ${this.kindClass}">${this.formatKind()}</span><div class="text"><span class="name" title="${this.name}">${this.name}</span> <span class="meta">${this.metaLine}</span></div></div><mq-button variant="outline" size="icon-lg" aria-label="${m("Descargar documento")}" ?disabled="${this.isDownloading}" @click="${this.handleDownload}">${b({size:24})}</mq-button>`}};function D(t,e,o){return t.map(t=>{const i=e?.find(e=>Number(e.id)===Number(t.professional.speciality_id));return{documentId:t.document_id,kind:t.document_type,name:t.name,specialty:a(i?.code??"",o,i?.name??t.professional.speciality_name),date:t.created_at,downloadUrl:t.url}})}e([p({context:f,subscribe:!0})],j.prototype,"apiClient",void 0),e([c({type:String})],j.prototype,"documentId",void 0),e([c({type:String})],j.prototype,"kind",void 0),e([c({type:String})],j.prototype,"name",void 0),e([c({type:String})],j.prototype,"specialty",void 0),e([c({type:String})],j.prototype,"date",void 0),e([c({type:String})],j.prototype,"downloadUrl",void 0),e([c({type:String})],j.prototype,"patientHash",void 0),e([y()],j.prototype,"isDownloading",void 0),j=e([h(),o("document-row")],j);const q=s`:host{display:flex;flex-direction:column;gap:var(--sp-3);width:100%;min-width:0;box-sizing:border-box}.divider{height:1px;width:100%;background-color:var(--color-border-subtle,#edecf1);flex-shrink:0}`;let z=class DocumentList extends n{constructor(){super(...arguments),this.documents=[],this.patientHash="",this.placeholders=0}static{this.styles=q}get rows(){return this.placeholders>0?Array.from({length:this.placeholders},()=>d`<mq-skeleton height="${"77px"}"></mq-skeleton>`):this.documents.map(t=>d`<document-row documentId="${t.documentId}" kind="${t.kind}" name="${t.name}" specialty="${t.specialty}" date="${t.date}" downloadUrl="${t.downloadUrl}" patientHash="${this.patientHash}"></document-row>`)}render(){const t=this.rows;return t.map((e,o)=>d`${e} ${o<t.length-1?d`<div class="divider"></div>`:l}`)}};e([c({type:Array})],z.prototype,"documents",void 0),e([c({type:String})],z.prototype,"patientHash",void 0),e([c({type:Number})],z.prototype,"placeholders",void 0),z=e([o("document-list")],z);export{k as g,D as t};
@@ -1220,7 +1220,6 @@ type GetOrganizationSetupResponse = z$1.infer<typeof GetOrganizationSetupRespons
1220
1220
  declare const CreatePaymentLinkRequestSchema: z.ZodObject<{
1221
1221
  slot_id: z.ZodString;
1222
1222
  service_id: z.ZodString;
1223
- /** ID of the medical specialty the booking belongs to. */
1224
1223
  specialty_id: z.ZodString;
1225
1224
  consultation_reason: z.ZodOptional<z.ZodString>;
1226
1225
  preconsultation_documents: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -1233,7 +1232,6 @@ declare const CreatePaymentLinkRequestSchema: z.ZodObject<{
1233
1232
  file_path: string;
1234
1233
  file_name: string;
1235
1234
  }>, "many">>;
1236
- /** Discount coupon code applied to the booking, if any. */
1237
1235
  discount_code: z.ZodOptional<z.ZodString>;
1238
1236
  return_url: z.ZodOptional<z.ZodString>;
1239
1237
  }, "strip", z.ZodTypeAny, {
@@ -1278,7 +1276,6 @@ declare const GetConsultationCouponResponseSchema: z.ZodObject<{
1278
1276
  }>;
1279
1277
  type GetConsultationCouponResponse = z.infer<typeof GetConsultationCouponResponseSchema>;
1280
1278
  /**
1281
- * Coupon applied to a booked appointment, for the confirmation view.
1282
1279
  * `GET /payments/v1/appointment/{appointmentId}/consultation-coupon`; 404 when
1283
1280
  * the appointment has no coupon. `name` is optional, so the UI falls back to `code`.
1284
1281
  */
@@ -1321,10 +1318,6 @@ declare const CreatePaymentLinkResponseSchema: z.ZodObject<{
1321
1318
  provider?: "addon" | "stripe" | undefined;
1322
1319
  }>;
1323
1320
  type CreatePaymentLinkResponse = z.infer<typeof CreatePaymentLinkResponseSchema>;
1324
- /**
1325
- * Request for `POST /payments/v1/immediate-videocall`. Addon Payments only; no
1326
- * coupons, slot or service apply — just the videocall schedule to charge for.
1327
- */
1328
1321
  declare const CreateImmediateVideocallPaymentLinkRequestSchema: z.ZodObject<{
1329
1322
  video_call_schedule_id: z.ZodString;
1330
1323
  }, "strip", z.ZodTypeAny, {
@@ -1333,11 +1326,6 @@ declare const CreateImmediateVideocallPaymentLinkRequestSchema: z.ZodObject<{
1333
1326
  video_call_schedule_id: string;
1334
1327
  }>;
1335
1328
  type CreateImmediateVideocallPaymentLinkRequest = z.infer<typeof CreateImmediateVideocallPaymentLinkRequestSchema>;
1336
- /**
1337
- * Response for `POST /payments/v1/immediate-videocall`. Same `{ session_id,
1338
- * payment_link }` shape as `POST /payments/v1/schedule`, so the `mq-checkout`
1339
- * polling of `GET /payments/v1/session/{sessionId}` and iframe work unchanged.
1340
- */
1341
1329
  declare const CreateImmediateVideocallPaymentLinkResponseSchema: z.ZodObject<{
1342
1330
  session_id: z.ZodString;
1343
1331
  payment_link: z.ZodString;
@@ -1385,15 +1373,16 @@ declare const GetPaymentSessionResponseSchema: z.ZodObject<{
1385
1373
  readonly Paid: "paid";
1386
1374
  readonly Unpaid: "unpaid";
1387
1375
  readonly Denied: "denied";
1376
+ readonly Refunded: "refunded";
1388
1377
  }>;
1389
1378
  consultation_id: z.ZodString;
1390
1379
  consultation_type: z.ZodString;
1391
1380
  }, "strip", z.ZodTypeAny, {
1392
- status: "unpaid" | "paid" | "denied";
1381
+ status: "unpaid" | "paid" | "denied" | "refunded";
1393
1382
  consultation_id: string;
1394
1383
  consultation_type: string;
1395
1384
  }, {
1396
- status: "unpaid" | "paid" | "denied";
1385
+ status: "unpaid" | "paid" | "denied" | "refunded";
1397
1386
  consultation_id: string;
1398
1387
  consultation_type: string;
1399
1388
  }>;
@@ -1430,27 +1419,28 @@ declare const AuthorizeApplePayResponseSchema: z.ZodObject<{
1430
1419
  readonly Paid: "paid";
1431
1420
  readonly Unpaid: "unpaid";
1432
1421
  readonly Denied: "denied";
1422
+ readonly Refunded: "refunded";
1433
1423
  }>;
1434
1424
  consultation_id: z.ZodString;
1435
1425
  consultation_type: z.ZodOptional<z.ZodString>;
1436
1426
  }, "strip", z.ZodTypeAny, {
1437
- status: "unpaid" | "paid" | "denied";
1427
+ status: "unpaid" | "paid" | "denied" | "refunded";
1438
1428
  consultation_id: string;
1439
1429
  consultation_type?: string | undefined;
1440
1430
  }, {
1441
- status: "unpaid" | "paid" | "denied";
1431
+ status: "unpaid" | "paid" | "denied" | "refunded";
1442
1432
  consultation_id: string;
1443
1433
  consultation_type?: string | undefined;
1444
1434
  }>;
1445
1435
  }, "strip", z.ZodTypeAny, {
1446
1436
  data: {
1447
- status: "unpaid" | "paid" | "denied";
1437
+ status: "unpaid" | "paid" | "denied" | "refunded";
1448
1438
  consultation_id: string;
1449
1439
  consultation_type?: string | undefined;
1450
1440
  };
1451
1441
  }, {
1452
1442
  data: {
1453
- status: "unpaid" | "paid" | "denied";
1443
+ status: "unpaid" | "paid" | "denied" | "refunded";
1454
1444
  consultation_id: string;
1455
1445
  consultation_type?: string | undefined;
1456
1446
  };
@@ -1474,27 +1464,28 @@ declare const AuthorizeGooglePayResponseSchema: z.ZodObject<{
1474
1464
  readonly Paid: "paid";
1475
1465
  readonly Unpaid: "unpaid";
1476
1466
  readonly Denied: "denied";
1467
+ readonly Refunded: "refunded";
1477
1468
  }>;
1478
1469
  consultation_id: z.ZodString;
1479
1470
  consultation_type: z.ZodOptional<z.ZodString>;
1480
1471
  }, "strip", z.ZodTypeAny, {
1481
- status: "unpaid" | "paid" | "denied";
1472
+ status: "unpaid" | "paid" | "denied" | "refunded";
1482
1473
  consultation_id: string;
1483
1474
  consultation_type?: string | undefined;
1484
1475
  }, {
1485
- status: "unpaid" | "paid" | "denied";
1476
+ status: "unpaid" | "paid" | "denied" | "refunded";
1486
1477
  consultation_id: string;
1487
1478
  consultation_type?: string | undefined;
1488
1479
  }>;
1489
1480
  }, "strip", z.ZodTypeAny, {
1490
1481
  data: {
1491
- status: "unpaid" | "paid" | "denied";
1482
+ status: "unpaid" | "paid" | "denied" | "refunded";
1492
1483
  consultation_id: string;
1493
1484
  consultation_type?: string | undefined;
1494
1485
  };
1495
1486
  }, {
1496
1487
  data: {
1497
- status: "unpaid" | "paid" | "denied";
1488
+ status: "unpaid" | "paid" | "denied" | "refunded";
1498
1489
  consultation_id: string;
1499
1490
  consultation_type?: string | undefined;
1500
1491
  };
@@ -1,7 +1,7 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
3
  import { LitElement, PropertyValues } from 'lit';
4
- import { M as MediquoApiChatClient, a as Message, I as ImageMessage, F as FileMessage } from './index.d-XSe7Hy-Q.js';
4
+ import { M as MediquoApiChatClient, a as Message, I as ImageMessage, F as FileMessage } from './index.d-DeJP_xib.js';
5
5
  import '../ui/mq-avatar.js';
6
6
  import '../ui/mq-button.js';
7
7
  import '../ui/mq-skeleton.js';
@@ -1 +1 @@
1
- import{_ as t,c as e}from"./custom-element-D2ziPxYE.js";import{e as i}from"./provide-BwI4DDGF.js";import{c as o}from"./consume-CovVqBjI.js";import{m as n}from"./runtime-Bg1WXVCx.js";import{l as r}from"./localized-decorator-BlOuLhym.js";import{Q as s}from"./query-controller-BlO1Ax65.js";import{A as a}from"./api-client-context-V1UAGtKW.js";import{l as p}from"./chunk-S5RWG6G2-DPesx3Od.js";import{A as l,c as m,n as d}from"./api-chat-client-fYDIH220.js";import{g as c}from"./next-appointment-card-DQE7dNXw.js";import{g as h}from"./get-patient-profile-query-4AO6xvVn.js";import{i as u,a as g,x as y}from"./lit-element-DiWJYFwC.js";import{n as f}from"./property-scuRaFcM.js";import{r as x}from"./state-LQivXIgA.js";import{setEnv as v}from"../env.js";import{MqViewAppointmentsEvent as b}from"../events.js";import{isValidLocale as j,setLocale as k}from"../i18n.js";import"./index-DEEAEB_4.js";import"./index-Bw-MbGKw.js";import"../ui/mq-skeleton.js";const w=[l.pending,l.accepted],A=u`:host{display:flex;flex-direction:column;gap:var(--sp-4);width:100%;min-width:0;box-sizing:border-box}:host([empty]){align-self:start}:host([empty]) .card{flex:0 0 auto}.card{display:flex;flex-direction:column;flex:1;min-width:0;box-sizing:border-box;background-color:var(--color-card,#fff);border:1px solid var(--color-border-subtle,#edecf1);border-radius:var(--mq-next-appointments-radius,12px);padding:var(--mq-next-appointments-padding,var(--sp-6))}`;let $=class MqNextAppointments extends g{constructor(){super(...arguments),this.apiClient=m(),this.getPatientProfileQuery=new s(this,()=>h(this.apiClient,{enabled:!this.loginToken})),this.getAppointmentsQuery=new s(this,()=>c(this.apiClient,{status:w,order:{field:"starts_at",direction:"asc"},page:1,per_page:1})),this.handleViewAll=()=>{this.dispatchEvent(new b({tab:"next"}))}}static{this.styles=A}willUpdate(t){t.has("env")&&this.env&&v(this.env),t.has("locale")&&this.locale&&j(this.locale)&&k(this.locale);const e=d(t,{env:this.env,apiKey:this.apiKey,token:this.token,locale:this.locale},this.inheritedApiClient);e&&(this.apiClient=e)}get patientHash(){return this.loginToken?.patient.hash??this.getPatientProfileQuery.result?.data?.hash??""}get accessToken(){return this.token||this.loginToken?.access_token||""}get patientTimezone(){return this.timezone??this.loginToken?.patient.timezone}get isEmpty(){const t=this.getAppointmentsQuery.result;return!0===t?.isSuccess&&!t.data?.data?.[0]}updated(){this.toggleAttribute("empty",this.isEmpty)}renderAppointment(){return this.getAppointmentsQuery.render({complete:t=>{const e=t.data?.[0];return e?y`<next-appointment-card .appointmentResource="${e}" .token="${this.accessToken}" .patientHash="${this.patientHash}" .timezone="${this.patientTimezone}"></next-appointment-card>`:y`<widget-empty-state icon="calendar" heading="${n("No tienes próximas citas")}" description="${n("Cuando agendes una cita, aparecerá aquí para que puedas consultarla, modificarla o cancelarla.")}"></widget-empty-state>`},pending:()=>y`<mq-skeleton height="257px"></mq-skeleton>`,error:()=>y`<widget-empty-state icon="calendar" heading="${n("No hemos podido cargar tu próxima cita")}" description="${n("Vuelve a intentarlo en unos minutos.")}"></widget-empty-state>`})}render(){return y`<section-header heading="${n("Próxima cita")}" action-label="${n("Ver todas")}" @section-action="${this.handleViewAll}"></section-header><div class="card">${this.renderAppointment()}</div>`}};t([f({type:String,attribute:"api-key"})],$.prototype,"apiKey",void 0),t([f({type:String,attribute:"token"})],$.prototype,"token",void 0),t([f({type:String,attribute:"locale"})],$.prototype,"locale",void 0),t([f({type:String,attribute:"env"})],$.prototype,"env",void 0),t([f({type:String,attribute:"timezone"})],$.prototype,"timezone",void 0),t([o({context:p,subscribe:!0})],$.prototype,"loginToken",void 0),t([o({context:a,subscribe:!0}),x()],$.prototype,"inheritedApiClient",void 0),t([i({context:a}),x()],$.prototype,"apiClient",void 0),$=t([r(),e("mq-next-appointments")],$);export{$ as M};
1
+ import{_ as t,c as e}from"./custom-element-D2ziPxYE.js";import{e as i}from"./provide-BwI4DDGF.js";import{c as o}from"./consume-CovVqBjI.js";import{m as n}from"./runtime-Bg1WXVCx.js";import{l as r}from"./localized-decorator-BlOuLhym.js";import{Q as s}from"./query-controller-BlO1Ax65.js";import{A as a}from"./api-client-context-V1UAGtKW.js";import{l as p}from"./chunk-S5RWG6G2-DPesx3Od.js";import{A as l,c as m,n as d}from"./api-chat-client-BhxUWldC.js";import{g as c}from"./next-appointment-card-KXLkEJDg.js";import{g as h}from"./get-patient-profile-query-4AO6xvVn.js";import{i as u,a as g,x as y}from"./lit-element-DiWJYFwC.js";import{n as f}from"./property-scuRaFcM.js";import{r as x}from"./state-LQivXIgA.js";import{setEnv as v}from"../env.js";import{MqViewAppointmentsEvent as b}from"../events.js";import{isValidLocale as j,setLocale as k}from"../i18n.js";import"./index-DEEAEB_4.js";import"./index-Bw-MbGKw.js";import"../ui/mq-skeleton.js";const w=[l.pending,l.accepted],A=u`:host{display:flex;flex-direction:column;gap:var(--sp-4);width:100%;min-width:0;box-sizing:border-box}:host([empty]){align-self:start}:host([empty]) .card{flex:0 0 auto}.card{display:flex;flex-direction:column;flex:1;min-width:0;box-sizing:border-box;background-color:var(--color-card,#fff);border:1px solid var(--color-border-subtle,#edecf1);border-radius:var(--mq-next-appointments-radius,12px);padding:var(--mq-next-appointments-padding,var(--sp-6))}`;let $=class MqNextAppointments extends g{constructor(){super(...arguments),this.apiClient=m(),this.getPatientProfileQuery=new s(this,()=>h(this.apiClient,{enabled:!this.loginToken})),this.getAppointmentsQuery=new s(this,()=>c(this.apiClient,{status:w,order:{field:"starts_at",direction:"asc"},page:1,per_page:1})),this.handleViewAll=()=>{this.dispatchEvent(new b({tab:"next"}))}}static{this.styles=A}willUpdate(t){t.has("env")&&this.env&&v(this.env),t.has("locale")&&this.locale&&j(this.locale)&&k(this.locale);const e=d(t,{env:this.env,apiKey:this.apiKey,token:this.token,locale:this.locale},this.inheritedApiClient);e&&(this.apiClient=e)}get patientHash(){return this.loginToken?.patient.hash??this.getPatientProfileQuery.result?.data?.hash??""}get accessToken(){return this.token||this.loginToken?.access_token||""}get patientTimezone(){return this.timezone??this.loginToken?.patient.timezone}get isEmpty(){const t=this.getAppointmentsQuery.result;return!0===t?.isSuccess&&!t.data?.data?.[0]}updated(){this.toggleAttribute("empty",this.isEmpty)}renderAppointment(){return this.getAppointmentsQuery.render({complete:t=>{const e=t.data?.[0];return e?y`<next-appointment-card .appointmentResource="${e}" .token="${this.accessToken}" .patientHash="${this.patientHash}" .timezone="${this.patientTimezone}"></next-appointment-card>`:y`<widget-empty-state icon="calendar" heading="${n("No tienes próximas citas")}" description="${n("Cuando agendes una cita, aparecerá aquí para que puedas consultarla, modificarla o cancelarla.")}"></widget-empty-state>`},pending:()=>y`<mq-skeleton height="257px"></mq-skeleton>`,error:()=>y`<widget-empty-state icon="calendar" heading="${n("No hemos podido cargar tu próxima cita")}" description="${n("Vuelve a intentarlo en unos minutos.")}"></widget-empty-state>`})}render(){return y`<section-header heading="${n("Próxima cita")}" action-label="${n("Ver todas")}" @section-action="${this.handleViewAll}"></section-header><div class="card">${this.renderAppointment()}</div>`}};t([f({type:String,attribute:"api-key"})],$.prototype,"apiKey",void 0),t([f({type:String,attribute:"token"})],$.prototype,"token",void 0),t([f({type:String,attribute:"locale"})],$.prototype,"locale",void 0),t([f({type:String,attribute:"env"})],$.prototype,"env",void 0),t([f({type:String,attribute:"timezone"})],$.prototype,"timezone",void 0),t([o({context:p,subscribe:!0})],$.prototype,"loginToken",void 0),t([o({context:a,subscribe:!0}),x()],$.prototype,"inheritedApiClient",void 0),t([i({context:a}),x()],$.prototype,"apiClient",void 0),$=t([r(),e("mq-next-appointments")],$);export{$ as M};
@@ -1 +1 @@
1
- import{_ as t,c as e}from"./custom-element-D2ziPxYE.js";import{e as i}from"./provide-BwI4DDGF.js";import{c as r}from"./consume-CovVqBjI.js";import{m as o}from"./runtime-Bg1WXVCx.js";import{l as s}from"./localized-decorator-BlOuLhym.js";import{Q as n}from"./query-controller-BlO1Ax65.js";import{A as a}from"./api-client-context-V1UAGtKW.js";import{l as p}from"./chunk-S5RWG6G2-DPesx3Od.js";import{g as l,t as d,r as c}from"./telemetry-client-DEIuDZfA.js";import{g as m,t as h}from"./index-BLxNeTVi.js";import{g as u}from"./get-patient-profile-query-4AO6xvVn.js";import{i as g,a as y,x as f}from"./lit-element-DiWJYFwC.js";import{n as v}from"./property-scuRaFcM.js";import{r as b}from"./state-LQivXIgA.js";import{setEnv as j}from"../env.js";import{MqViewDocumentsEvent as x}from"../events.js";import{isValidLocale as k,setLocale as w,getLocale as S}from"../i18n.js";import{c as $,n as P}from"./api-chat-client-fYDIH220.js";import"./index-Bw-MbGKw.js";import"./index-DEEAEB_4.js";const Q=g`:host{display:flex;flex-direction:column;align-self:start;gap:var(--sp-4);width:100%;min-width:0;box-sizing:border-box}.card{display:flex;flex-direction:column;gap:var(--sp-3);min-width:0;box-sizing:border-box;background-color:var(--color-card,#fff);border:1px solid var(--color-border-subtle,#edecf1);border-radius:var(--mq-recent-documents-radius,12px);padding:var(--mq-recent-documents-padding,var(--sp-6))}`;let C=class MqRecentDocuments extends y{constructor(){super(...arguments),this.apiClient=$(),this.getPatientProfileQuery=new n(this,()=>u(this.apiClient,{enabled:!this.loginToken})),this.getPatientDocumentsQuery=new n(this,()=>({...m(this.apiClient,{patient_hash:this.patientHash,page:1,per_page:3}),enabled:!!this.patientHash})),this.getOrganizationSpecialtiesQuery=new n(this,()=>l(this.apiClient)),this.handleViewAll=()=>{d.track(c(this.patientHash)),this.dispatchEvent(new x)}}static{this.styles=Q}willUpdate(t){t.has("env")&&this.env&&j(this.env),t.has("locale")&&this.locale&&k(this.locale)&&w(this.locale);const e=P(t,{env:this.env,apiKey:this.apiKey,token:this.token,locale:this.locale},this.inheritedApiClient);e&&(this.apiClient=e)}get patientHash(){return this.loginToken?.patient.hash??this.getPatientProfileQuery.result?.data?.hash??""}renderEmptyState(){return f`<widget-empty-state icon="document" heading="${o("No tienes documentación")}" description="${o("Aquí se mostrarán tus recetas e informes médicos.")}"></widget-empty-state>`}renderSkeleton(){return f`<document-list placeholders="${3}"></document-list>`}renderError(){return f`<widget-empty-state icon="document" heading="${o("No hemos podido cargar tu documentación")}" description="${o("Vuelve a intentarlo en unos minutos.")}"></widget-empty-state>`}renderDocuments(){return this.getPatientDocumentsQuery.render({complete:t=>0===t.data.length?this.renderEmptyState():f`<document-list .documents="${h(t.data,this.getOrganizationSpecialtiesQuery.result?.data,S())}" patientHash="${this.patientHash}"></document-list>`,initial:()=>this.getPatientProfileQuery.result?.isError?this.renderError():this.renderSkeleton(),pending:()=>this.renderSkeleton(),error:()=>this.renderError()})}render(){return f`<section-header heading="${o("Documentos recientes")}" action-label="${o("Ver todas")}" @section-action="${this.handleViewAll}"></section-header><div class="card">${this.renderDocuments()}</div>`}};t([v({type:String,attribute:"api-key"})],C.prototype,"apiKey",void 0),t([v({type:String,attribute:"token"})],C.prototype,"token",void 0),t([v({type:String,attribute:"locale"})],C.prototype,"locale",void 0),t([v({type:String,attribute:"env"})],C.prototype,"env",void 0),t([r({context:a,subscribe:!0}),b()],C.prototype,"inheritedApiClient",void 0),t([i({context:a}),b()],C.prototype,"apiClient",void 0),t([r({context:p,subscribe:!0})],C.prototype,"loginToken",void 0),C=t([s(),e("mq-recent-documents")],C);export{C as M};
1
+ import{_ as t,c as e}from"./custom-element-D2ziPxYE.js";import{e as i}from"./provide-BwI4DDGF.js";import{c as r}from"./consume-CovVqBjI.js";import{m as o}from"./runtime-Bg1WXVCx.js";import{l as s}from"./localized-decorator-BlOuLhym.js";import{Q as n}from"./query-controller-BlO1Ax65.js";import{A as a}from"./api-client-context-V1UAGtKW.js";import{l as p}from"./chunk-S5RWG6G2-DPesx3Od.js";import{g as l,t as d,r as c}from"./telemetry-client-DEIuDZfA.js";import{g as m,t as h}from"./index-DjD-3x4f.js";import{g as u}from"./get-patient-profile-query-4AO6xvVn.js";import{i as g,a as y,x as f}from"./lit-element-DiWJYFwC.js";import{n as v}from"./property-scuRaFcM.js";import{r as b}from"./state-LQivXIgA.js";import{setEnv as j}from"../env.js";import{MqViewDocumentsEvent as x}from"../events.js";import{isValidLocale as k,setLocale as w,getLocale as S}from"../i18n.js";import{c as $,n as P}from"./api-chat-client-BhxUWldC.js";import"./index-Bw-MbGKw.js";import"./index-DEEAEB_4.js";const Q=g`:host{display:flex;flex-direction:column;align-self:start;gap:var(--sp-4);width:100%;min-width:0;box-sizing:border-box}.card{display:flex;flex-direction:column;gap:var(--sp-3);min-width:0;box-sizing:border-box;background-color:var(--color-card,#fff);border:1px solid var(--color-border-subtle,#edecf1);border-radius:var(--mq-recent-documents-radius,12px);padding:var(--mq-recent-documents-padding,var(--sp-6))}`;let C=class MqRecentDocuments extends y{constructor(){super(...arguments),this.apiClient=$(),this.getPatientProfileQuery=new n(this,()=>u(this.apiClient,{enabled:!this.loginToken})),this.getPatientDocumentsQuery=new n(this,()=>({...m(this.apiClient,{patient_hash:this.patientHash,page:1,per_page:3}),enabled:!!this.patientHash})),this.getOrganizationSpecialtiesQuery=new n(this,()=>l(this.apiClient)),this.handleViewAll=()=>{d.track(c(this.patientHash)),this.dispatchEvent(new x)}}static{this.styles=Q}willUpdate(t){t.has("env")&&this.env&&j(this.env),t.has("locale")&&this.locale&&k(this.locale)&&w(this.locale);const e=P(t,{env:this.env,apiKey:this.apiKey,token:this.token,locale:this.locale},this.inheritedApiClient);e&&(this.apiClient=e)}get patientHash(){return this.loginToken?.patient.hash??this.getPatientProfileQuery.result?.data?.hash??""}renderEmptyState(){return f`<widget-empty-state icon="document" heading="${o("No tienes documentación")}" description="${o("Aquí se mostrarán tus recetas e informes médicos.")}"></widget-empty-state>`}renderSkeleton(){return f`<document-list placeholders="${3}"></document-list>`}renderError(){return f`<widget-empty-state icon="document" heading="${o("No hemos podido cargar tu documentación")}" description="${o("Vuelve a intentarlo en unos minutos.")}"></widget-empty-state>`}renderDocuments(){return this.getPatientDocumentsQuery.render({complete:t=>0===t.data.length?this.renderEmptyState():f`<document-list .documents="${h(t.data,this.getOrganizationSpecialtiesQuery.result?.data,S())}" patientHash="${this.patientHash}"></document-list>`,initial:()=>this.getPatientProfileQuery.result?.isError?this.renderError():this.renderSkeleton(),pending:()=>this.renderSkeleton(),error:()=>this.renderError()})}render(){return f`<section-header heading="${o("Documentos recientes")}" action-label="${o("Ver todas")}" @section-action="${this.handleViewAll}"></section-header><div class="card">${this.renderDocuments()}</div>`}};t([v({type:String,attribute:"api-key"})],C.prototype,"apiKey",void 0),t([v({type:String,attribute:"token"})],C.prototype,"token",void 0),t([v({type:String,attribute:"locale"})],C.prototype,"locale",void 0),t([v({type:String,attribute:"env"})],C.prototype,"env",void 0),t([r({context:a,subscribe:!0}),b()],C.prototype,"inheritedApiClient",void 0),t([i({context:a}),b()],C.prototype,"apiClient",void 0),t([r({context:p,subscribe:!0})],C.prototype,"loginToken",void 0),C=t([s(),e("mq-recent-documents")],C);export{C as M};
@@ -1,9 +1,9 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
3
  import { LitElement } from 'lit';
4
- import { M as MediquoApiChatClient, G as GetAppointmentsResponse } from './index.d-XSe7Hy-Q.js';
4
+ import { M as MediquoApiChatClient, G as GetAppointmentsResponse } from './index.d-DeJP_xib.js';
5
5
  import { L as LoginTokenResponse } from './schemas.d-b6_AekBb.js';
6
- import './mq-chat-room-jeDvIF1Z.js';
6
+ import './mq-chat-room-B3ant6md.js';
7
7
  import '../ui/mq-button.js';
8
8
  import '../ui/mq-dialog.js';
9
9
  import { P as PriceInCents } from './price.d-CwLosdAN.js';
@@ -1 +1 @@
1
- import{s as e}from"./chunk-6CCJWPGL-TiaqZaPV.js";import{_ as t,c as i}from"./custom-element-D2ziPxYE.js";import{c as n}from"./consume-CovVqBjI.js";import{m as o,s as a}from"./runtime-Bg1WXVCx.js";import{l as s}from"./localized-decorator-BlOuLhym.js";import{Q as r}from"./query-controller-BlO1Ax65.js";import{A as l}from"./api-client-context-V1UAGtKW.js";import{l as p}from"./chunk-S5RWG6G2-DPesx3Od.js";import{i as c,a as d}from"./api-chat-client-fYDIH220.js";import{g as m,a as h}from"./chunk-2TKJJNS7-BGwxtEg7.js";import{g as u}from"./get-organization-setup-query-Dr1cXnHl.js";import{g,t as f,f as v,i as b,j as y,k as $,a as x}from"./telemetry-client-DEIuDZfA.js";import{g as C}from"./chunk-Y4EKUX25-CWAZgcgw.js";import{c as w}from"./refund-cancel-policy-QG_OE6g5.js";import{a as k,i as q,x as O,E as j}from"./lit-element-DiWJYFwC.js";import{n as M}from"./property-scuRaFcM.js";import{r as z}from"./state-LQivXIgA.js";import{MqAppointmentJoinVideocallEvent as S,MqAppointmentRescheduleEvent as E}from"../events.js";import{getLocale as I}from"../i18n.js";import{calendarIcon as D}from"../ui/icons/calendar-icon.js";import{dotsHorizontalIcon as R}from"../ui/icons/dots-horizontal-icon.js";import{messageBubbleIcon as _}from"../ui/icons/message-bubble-icon.js";import{phoneIcon as A}from"../ui/icons/phone-icon.js";import{videoIcon as P}from"../ui/icons/video-icon.js";import"../mq-chat-room.js";import"../ui/mq-button.js";import"../ui/mq-dialog.js";import{Q as T}from"./chunk-RCFIJTXZ-C6Ir0-sM.js";import{M as U}from"./mutation-controller-CR2qcqhH.js";import{h as N,f as L}from"./price-DU3YLTpk.js";import"./professional-overview-C4H_znIJ.js";import"../ui/mq-floating-bubble.js";import"../ui/mq-unread-badge.js";import{toast as H}from"../ui/mq-toast.js";function Q(t,i){return{queryKey:e(t,"appointments",i),queryFn:()=>t.appointments.getAppointments(i)}}function J(e){const{action:t,refundPolicySeconds:i}=e,n=null!=i&&i<3600,s=Math.ceil((i??0)/60),r=Math.ceil((i??0)/3600);return o(0===(n?s:r)?"modify"===t?"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"===t?n?a`Lo sentimos, como faltan menos de ${s} minutos para tu cita no podemos modificarla.`:a`Lo sentimos, como faltan menos de ${r} horas para tu cita no podemos modificarla.`:n?a`Lo sentimos, como faltan menos de ${s} minutos para tu cita no podemos anularla.`:a`Lo sentimos, como faltan menos de ${r} horas para tu cita no podemos anularla.`)}let F=class AppointmentActionUnavailableDialog extends k{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=q`: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 O`<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}">${o("Volver")}</mq-button></div></mq-dialog>`}};t([M({type:Boolean,reflect:!0})],F.prototype,"open",void 0),t([M({type:String})],F.prototype,"heading",void 0),t([M({type:String})],F.prototype,"message",void 0),F=t([s(),i("appointment-action-unavailable-dialog")],F);let V=class CancelAppointmentConfirmationDialog extends k{constructor(){super(...arguments),this.open=!1,this.cancelAppointmentMutation=new U(this,{mutationFn:async e=>this.apiClient.appointments.cancelAppointment(e),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=q`: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 e=I(),t=this.price,i=N(t),n=this.cancelAppointmentMutation.isPending;if(i){const i=L(t,e),a=`-${i}`;return O`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${o("Confirmar cancelación")}</h2><p slot="subheading" class="subheading-payable">${o("¿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>${o("Importe pagado")}</span> <span>${i}</span></div><div class="price-row"><span>${o("Importe a devolver")}</span> <span>${a}</span></div></div><div class="actions"><mq-button variant="outline" ?disabled="${n}" @click="${this.handleDismissClick}">${o("Volver")}</mq-button><mq-button variant="primary" ?disabled="${n}" @click="${this.handleConfirmClick}">${o("Confirmar")}</mq-button></div></div></mq-dialog>`}return O`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${o("Confirmar cancelación")}</h2><p slot="subheading">${o("¿Seguro que quieres cancelar esta cita?")}</p><div><div class="actions"><mq-button variant="outline" ?disabled="${n}" @click="${this.handleDismissClick}">${o("Cancelar")}</mq-button><mq-button variant="primary" ?disabled="${n}" @click="${this.handleConfirmClick}">${o("Confirmar")}</mq-button></div></div></mq-dialog>`}};t([n({context:l,subscribe:!0})],V.prototype,"apiClient",void 0),t([M({type:Boolean,reflect:!0})],V.prototype,"open",void 0),t([n({context:T,subscribe:!0})],V.prototype,"queryClientContext",void 0),t([M({type:String})],V.prototype,"appointmentId",void 0),t([M({type:Object})],V.prototype,"price",void 0),V=t([s(),i("cancel-appointment-confirmation-dialog")],V);const W=q`:host{display:flex;flex-direction:column;justify-content:space-between;gap:var(--sp-6);flex:1;width:100%;min-width:0;box-sizing:border-box;color:var(--color-text-icons--primary,#0a0a22)}professional-overview{--avatar-size-lg:66px;--text-lg--line-height:1.35;display:block}.details{display:flex;flex-direction:column;align-items:flex-start;gap:var(--sp-3)}.detail-row{display:inline-flex;align-items:center;gap:var(--sp-2);font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;font-weight:var(--font-weight-normal)}.detail-row svg{flex-shrink:0}.detail-row span::first-letter{text-transform:uppercase}.footer{display:flex;flex-direction:column;gap:var(--sp-4)}.reminder{font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;font-weight:var(--font-weight-normal);color:var(--color-text-icons--secondary,#6d658b);margin:0}.actions{--button-height-md:2.75rem;display:flex;align-items:stretch;gap:10px}.actions>mq-button{flex:1;min-width:0}.overflow{position:relative;flex:0 0 auto}.chat-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-badge{--mq-unread-badge-size:8px;flex-shrink:0}@media (max-width:767px){.actions{flex-wrap:wrap}.actions>mq-button.join{order:1;flex:1 0 100%}}.menu{position:absolute;right:0;bottom:calc(100% + var(--sp-2));z-index:2;display:flex;flex-direction:column;min-width:176px;padding:var(--sp-1);background-color:var(--color-card,#fff);border:1px solid var(--color-border-subtle,#edecf1);border-radius:var(--border-radius-lg);box-shadow:var(--shadow-lg)}.menu-item{display:block;width:100%;background:0 0;border:none;border-radius:var(--border-radius-sm);padding:var(--sp-2) var(--sp-3);cursor:pointer;text-align:left;font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;color:var(--color-text-icons--primary,#0a0a22)}.menu-item:hover{background-color:var(--color-muted)}.menu-item.negative{color:var(--color-negative)}`;let B=class NextAppointmentCard extends k{constructor(){super(...arguments),this.token="",this.patientHash="",this.isChatOpen=!1,this.isMenuOpen=!1,this.isCancelDialogOpen=!1,this.openDialog=null,this.getUnreadMessagesQuery=new r(this,()=>({...C(this.apiClient,{roomId:this.appointmentResource?.room?.id}),enabled:!!this.appointmentResource?.room?.id})),this.getOrganizationSetupQuery=new r(this,()=>u(this.apiClient)),this.getOrganizationSpecialtiesQuery=new r(this,()=>g(this.apiClient,{enabled:!!this.appointmentResource?.speciality?.id})),this.closeMenuOnOutsideClick=e=>{e.composedPath().includes(this)||(this.isMenuOpen=!1)},this.closeMenuOnEscape=e=>{"Escape"===e.key&&(this.isMenuOpen=!1)},this.handleJoinVideocall=()=>{f.track(v(this.sessionPatientHash,this.appointmentId)),this.dispatchEvent(new S({appointmentId:this.appointmentId}))},this.handleToggleChat=()=>{this.isChatOpen=!this.isChatOpen,this.isChatOpen&&f.track(b(this.sessionPatientHash,this.appointmentId))},this.handleModify=()=>{this.isMenuOpen=!1,this.isModifyUnavailable?this.openDialog="modify":(f.track(y(this.sessionPatientHash,this.appointmentId)),this.dispatchEvent(new E({appointmentId:this.appointmentId})))},this.handleCancel=()=>{this.isMenuOpen=!1,this.isCancelUnavailable?this.openDialog="cancel":(f.track($(this.sessionPatientHash,this.appointmentId)),this.isCancelDialogOpen=!0)}}static{this.styles=W}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.closeMenuOnOutsideClick),document.addEventListener("keydown",this.closeMenuOnEscape)}disconnectedCallback(){document.removeEventListener("click",this.closeMenuOnOutsideClick),document.removeEventListener("keydown",this.closeMenuOnEscape),super.disconnectedCallback()}get appointmentId(){return this.appointmentResource.appointment.id??""}get channel(){return this.appointmentResource.appointment.channel}get sessionToken(){return this.token||this.loginToken?.access_token||""}get sessionPatientHash(){return this.patientHash||this.loginToken?.patient?.hash||""}get sessionTimezone(){return this.timezone??this.loginToken?.patient?.timezone}get unreadCount(){return this.getUnreadMessagesQuery.result?.data?.unread_count??0}get specialtyName(){const e=this.getOrganizationSpecialtiesQuery.result?.data?.find(e=>Number(e.id)===Number(this.appointmentResource.speciality?.id));return x(e?.code??"",I(),e?.name??this.appointmentResource.speciality?.name)}get hasChatSupport(){return this.appointmentResource.appointment.has_chat_in_appointment??this.getOrganizationSetupQuery.result?.data?.appointments?.has_chat_in_appointment??!1}get isExpired(){return c(this.appointmentResource.appointment.expires_at)}get refundPolicySeconds(){return this.getOrganizationSetupQuery.result?.data?.appointments?.seconds_before_start_to_refund_on_cancel}get policyAllowsModifyOrCancel(){return w({startsAtIso:this.appointmentResource.appointment.starts_at,refundPolicySeconds:this.refundPolicySeconds})}get isModifyUnavailable(){return this.isExpired||0===this.appointmentResource.slots.length||!this.policyAllowsModifyOrCancel}get isCancelUnavailable(){return this.isExpired||!this.policyAllowsModifyOrCancel}get modifyUnavailableMessage(){return J({action:"modify",refundPolicySeconds:this.refundPolicySeconds})}get cancelUnavailableMessage(){return J({action:"cancel",refundPolicySeconds:this.refundPolicySeconds})}channelIcon(){switch(this.channel){case d.videocall:return P({size:20});case d.phonecall:return A({size:20});default:return _({size:20})}}channelLabel(){switch(this.channel){case d.videocall:return o("Videoconsulta");case d.phonecall:return o("Consulta telefónica");default:return o("Chat")}}formatWhen(){const e=I().replace("_","-"),t=m(this.sessionTimezone),i=t?{timeZone:t}:{},n=new Date(this.appointmentResource.appointment.starts_at);if(Number.isNaN(n.getTime()))return"";const s=new Intl.DateTimeFormat(e,{weekday:"long",day:"numeric",month:"long",year:"numeric",...i}).format(n),r=new Intl.DateTimeFormat(e,{timeStyle:"short",hourCycle:"h23",...i}).format(n),l=t?h(t,n):"";return o(a`${s}, ${r} h${l?` (${l})`:""}`)}renderActions(){const e=this.channel===d.videocall;return O`<div class="actions">${this.hasChatSupport?O`<mq-button variant="outline" @click="${this.handleToggleChat}"><span class="chat-label">${o("Ir a chat")}</span> ${this.unreadCount>0?O`<mq-unread-badge class="chat-badge"></mq-unread-badge>`:j}</mq-button>`:j} ${e?O`<mq-button class="join" variant="primary" @click="${this.handleJoinVideocall}">${o("Unirse a la videoconsulta")}</mq-button>`:j}<div class="overflow"><mq-button variant="outline" size="icon-lg" aria-label="${o("Más opciones")}" aria-haspopup="menu" aria-expanded="${this.isMenuOpen}" @click="${()=>{this.isMenuOpen=!this.isMenuOpen}}">${R({size:16})}</mq-button>${this.isMenuOpen?O`<div class="menu" role="menu"><button class="menu-item" type="button" role="menuitem" @click="${this.handleModify}">${o("Modificar cita")}</button> <button class="menu-item negative" type="button" role="menuitem" @click="${this.handleCancel}">${o("Anular cita")}</button></div>`:j}</div></div>`}render(){const{professional:e}=this.appointmentResource,t=this.formatWhen();return O`<professional-overview .name="${e.name}" .specialtyName="${this.specialtyName}" .collegiateNumber="${e.collegiate_number??void 0}" .description="${e.description??""}" .languages="${e.languages??[]}" .avatar="${e.avatar??""}"></professional-overview><div class="details">${t?O`<div class="detail-row">${D({size:20})} <span>${t}</span></div>`:j}<div class="detail-row">${this.channelIcon()} <span>${this.channelLabel()}</span></div></div><div class="footer"><p class="reminder">${o("Recibirás un recordatorio 15 minutos antes de la consulta")}</p>${this.renderActions()}</div><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" hideCloseButton @mq-close="${()=>{this.isChatOpen=!1}}">${this.isChatOpen?O`<mq-chat-room slot="content" .consultationId="${this.appointmentResource.appointment.id}" consultation-type="appointment" token="${this.sessionToken}" .roomId="${this.appointmentResource.room.id}" .professionalHash="${e.hash}" ?readonly="${this.isExpired}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}"></mq-chat-room>`:j}</mq-floating-bubble><appointment-action-unavailable-dialog .open="${"modify"===this.openDialog}" .heading="${o("Modificar cita")}" .message="${this.modifyUnavailableMessage}" @close="${()=>{this.openDialog=null}}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"cancel"===this.openDialog}" .heading="${o("Anular cita")}" .message="${this.cancelUnavailableMessage}" @close="${()=>{this.openDialog=null}}"></appointment-action-unavailable-dialog><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,H.success(o("Consulta anulada correctamente")),this.dispatchEvent(new CustomEvent("appointment-cancel-confirmed",{bubbles:!0,composed:!0,detail:{id:this.appointmentId}}))}}"></cancel-appointment-confirmation-dialog>`}};t([n({context:l,subscribe:!0})],B.prototype,"apiClient",void 0),t([n({context:p,subscribe:!0})],B.prototype,"loginToken",void 0),t([M({type:Object})],B.prototype,"appointmentResource",void 0),t([M({type:String})],B.prototype,"token",void 0),t([M({type:String})],B.prototype,"patientHash",void 0),t([M({type:String})],B.prototype,"timezone",void 0),t([z()],B.prototype,"isChatOpen",void 0),t([z()],B.prototype,"isMenuOpen",void 0),t([z()],B.prototype,"isCancelDialogOpen",void 0),t([z()],B.prototype,"openDialog",void 0),B=t([s(),i("next-appointment-card")],B);export{J as a,Q as g};
1
+ import{s as e}from"./chunk-6CCJWPGL-TiaqZaPV.js";import{_ as t,c as i}from"./custom-element-D2ziPxYE.js";import{c as n}from"./consume-CovVqBjI.js";import{m as o,s as a}from"./runtime-Bg1WXVCx.js";import{l as s}from"./localized-decorator-BlOuLhym.js";import{Q as r}from"./query-controller-BlO1Ax65.js";import{A as l}from"./api-client-context-V1UAGtKW.js";import{l as p}from"./chunk-S5RWG6G2-DPesx3Od.js";import{d as c,e as d}from"./api-chat-client-BhxUWldC.js";import{g as m,a as h}from"./chunk-2TKJJNS7-BGwxtEg7.js";import{g as u}from"./get-organization-setup-query-Dr1cXnHl.js";import{g,t as f,f as v,i as b,j as y,k as $,a as x}from"./telemetry-client-DEIuDZfA.js";import{g as C}from"./chunk-Y4EKUX25-QqMl3eiq.js";import{c as w}from"./refund-cancel-policy-QG_OE6g5.js";import{a as k,i as q,x as O,E as j}from"./lit-element-DiWJYFwC.js";import{n as M}from"./property-scuRaFcM.js";import{r as z}from"./state-LQivXIgA.js";import{MqAppointmentJoinVideocallEvent as S,MqAppointmentRescheduleEvent as E}from"../events.js";import{getLocale as I}from"../i18n.js";import{calendarIcon as D}from"../ui/icons/calendar-icon.js";import{dotsHorizontalIcon as R}from"../ui/icons/dots-horizontal-icon.js";import{messageBubbleIcon as _}from"../ui/icons/message-bubble-icon.js";import{phoneIcon as A}from"../ui/icons/phone-icon.js";import{videoIcon as P}from"../ui/icons/video-icon.js";import"../mq-chat-room.js";import"../ui/mq-button.js";import"../ui/mq-dialog.js";import{Q as T}from"./chunk-RCFIJTXZ-C6Ir0-sM.js";import{M as U}from"./mutation-controller-CR2qcqhH.js";import{h as N,f as L}from"./price-DU3YLTpk.js";import"./professional-overview-B4E05rLd.js";import"../ui/mq-floating-bubble.js";import"../ui/mq-unread-badge.js";import{toast as H}from"../ui/mq-toast.js";function Q(t,i){return{queryKey:e(t,"appointments",i),queryFn:()=>t.appointments.getAppointments(i)}}function J(e){const{action:t,refundPolicySeconds:i}=e,n=null!=i&&i<3600,s=Math.ceil((i??0)/60),r=Math.ceil((i??0)/3600);return o(0===(n?s:r)?"modify"===t?"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"===t?n?a`Lo sentimos, como faltan menos de ${s} minutos para tu cita no podemos modificarla.`:a`Lo sentimos, como faltan menos de ${r} horas para tu cita no podemos modificarla.`:n?a`Lo sentimos, como faltan menos de ${s} minutos para tu cita no podemos anularla.`:a`Lo sentimos, como faltan menos de ${r} horas para tu cita no podemos anularla.`)}let F=class AppointmentActionUnavailableDialog extends k{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=q`: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 O`<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}">${o("Volver")}</mq-button></div></mq-dialog>`}};t([M({type:Boolean,reflect:!0})],F.prototype,"open",void 0),t([M({type:String})],F.prototype,"heading",void 0),t([M({type:String})],F.prototype,"message",void 0),F=t([s(),i("appointment-action-unavailable-dialog")],F);let V=class CancelAppointmentConfirmationDialog extends k{constructor(){super(...arguments),this.open=!1,this.cancelAppointmentMutation=new U(this,{mutationFn:async e=>this.apiClient.appointments.cancelAppointment(e),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=q`: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 e=I(),t=this.price,i=N(t),n=this.cancelAppointmentMutation.isPending;if(i){const i=L(t,e),a=`-${i}`;return O`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${o("Confirmar cancelación")}</h2><p slot="subheading" class="subheading-payable">${o("¿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>${o("Importe pagado")}</span> <span>${i}</span></div><div class="price-row"><span>${o("Importe a devolver")}</span> <span>${a}</span></div></div><div class="actions"><mq-button variant="outline" ?disabled="${n}" @click="${this.handleDismissClick}">${o("Volver")}</mq-button><mq-button variant="primary" ?disabled="${n}" @click="${this.handleConfirmClick}">${o("Confirmar")}</mq-button></div></div></mq-dialog>`}return O`<mq-dialog .open="${this.open}" @mq-close="${this.handleClose}" dismissable><h2 slot="heading">${o("Confirmar cancelación")}</h2><p slot="subheading">${o("¿Seguro que quieres cancelar esta cita?")}</p><div><div class="actions"><mq-button variant="outline" ?disabled="${n}" @click="${this.handleDismissClick}">${o("Cancelar")}</mq-button><mq-button variant="primary" ?disabled="${n}" @click="${this.handleConfirmClick}">${o("Confirmar")}</mq-button></div></div></mq-dialog>`}};t([n({context:l,subscribe:!0})],V.prototype,"apiClient",void 0),t([M({type:Boolean,reflect:!0})],V.prototype,"open",void 0),t([n({context:T,subscribe:!0})],V.prototype,"queryClientContext",void 0),t([M({type:String})],V.prototype,"appointmentId",void 0),t([M({type:Object})],V.prototype,"price",void 0),V=t([s(),i("cancel-appointment-confirmation-dialog")],V);const W=q`:host{display:flex;flex-direction:column;justify-content:space-between;gap:var(--sp-6);flex:1;width:100%;min-width:0;box-sizing:border-box;color:var(--color-text-icons--primary,#0a0a22)}professional-overview{--avatar-size-lg:66px;--text-lg--line-height:1.35;display:block}.details{display:flex;flex-direction:column;align-items:flex-start;gap:var(--sp-3)}.detail-row{display:inline-flex;align-items:center;gap:var(--sp-2);font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;font-weight:var(--font-weight-normal)}.detail-row svg{flex-shrink:0}.detail-row span::first-letter{text-transform:uppercase}.footer{display:flex;flex-direction:column;gap:var(--sp-4)}.reminder{font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;font-weight:var(--font-weight-normal);color:var(--color-text-icons--secondary,#6d658b);margin:0}.actions{--button-height-md:2.75rem;display:flex;align-items:stretch;gap:10px}.actions>mq-button{flex:1;min-width:0}.overflow{position:relative;flex:0 0 auto}.chat-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-badge{--mq-unread-badge-size:8px;flex-shrink:0}@media (max-width:767px){.actions{flex-wrap:wrap}.actions>mq-button.join{order:1;flex:1 0 100%}}.menu{position:absolute;right:0;bottom:calc(100% + var(--sp-2));z-index:2;display:flex;flex-direction:column;min-width:176px;padding:var(--sp-1);background-color:var(--color-card,#fff);border:1px solid var(--color-border-subtle,#edecf1);border-radius:var(--border-radius-lg);box-shadow:var(--shadow-lg)}.menu-item{display:block;width:100%;background:0 0;border:none;border-radius:var(--border-radius-sm);padding:var(--sp-2) var(--sp-3);cursor:pointer;text-align:left;font-family:var(--font-body);font-size:var(--text-sm);line-height:1.35;color:var(--color-text-icons--primary,#0a0a22)}.menu-item:hover{background-color:var(--color-muted)}.menu-item.negative{color:var(--color-negative)}`;let B=class NextAppointmentCard extends k{constructor(){super(...arguments),this.token="",this.patientHash="",this.isChatOpen=!1,this.isMenuOpen=!1,this.isCancelDialogOpen=!1,this.openDialog=null,this.getUnreadMessagesQuery=new r(this,()=>({...C(this.apiClient,{roomId:this.appointmentResource?.room?.id}),enabled:!!this.appointmentResource?.room?.id})),this.getOrganizationSetupQuery=new r(this,()=>u(this.apiClient)),this.getOrganizationSpecialtiesQuery=new r(this,()=>g(this.apiClient,{enabled:!!this.appointmentResource?.speciality?.id})),this.closeMenuOnOutsideClick=e=>{e.composedPath().includes(this)||(this.isMenuOpen=!1)},this.closeMenuOnEscape=e=>{"Escape"===e.key&&(this.isMenuOpen=!1)},this.handleJoinVideocall=()=>{f.track(v(this.sessionPatientHash,this.appointmentId)),this.dispatchEvent(new S({appointmentId:this.appointmentId}))},this.handleToggleChat=()=>{this.isChatOpen=!this.isChatOpen,this.isChatOpen&&f.track(b(this.sessionPatientHash,this.appointmentId))},this.handleModify=()=>{this.isMenuOpen=!1,this.isModifyUnavailable?this.openDialog="modify":(f.track(y(this.sessionPatientHash,this.appointmentId)),this.dispatchEvent(new E({appointmentId:this.appointmentId})))},this.handleCancel=()=>{this.isMenuOpen=!1,this.isCancelUnavailable?this.openDialog="cancel":(f.track($(this.sessionPatientHash,this.appointmentId)),this.isCancelDialogOpen=!0)}}static{this.styles=W}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.closeMenuOnOutsideClick),document.addEventListener("keydown",this.closeMenuOnEscape)}disconnectedCallback(){document.removeEventListener("click",this.closeMenuOnOutsideClick),document.removeEventListener("keydown",this.closeMenuOnEscape),super.disconnectedCallback()}get appointmentId(){return this.appointmentResource.appointment.id??""}get channel(){return this.appointmentResource.appointment.channel}get sessionToken(){return this.token||this.loginToken?.access_token||""}get sessionPatientHash(){return this.patientHash||this.loginToken?.patient?.hash||""}get sessionTimezone(){return this.timezone??this.loginToken?.patient?.timezone}get unreadCount(){return this.getUnreadMessagesQuery.result?.data?.unread_count??0}get specialtyName(){const e=this.getOrganizationSpecialtiesQuery.result?.data?.find(e=>Number(e.id)===Number(this.appointmentResource.speciality?.id));return x(e?.code??"",I(),e?.name??this.appointmentResource.speciality?.name)}get hasChatSupport(){return this.appointmentResource.appointment.has_chat_in_appointment??this.getOrganizationSetupQuery.result?.data?.appointments?.has_chat_in_appointment??!1}get isExpired(){return c(this.appointmentResource.appointment.expires_at)}get refundPolicySeconds(){return this.getOrganizationSetupQuery.result?.data?.appointments?.seconds_before_start_to_refund_on_cancel}get policyAllowsModifyOrCancel(){return w({startsAtIso:this.appointmentResource.appointment.starts_at,refundPolicySeconds:this.refundPolicySeconds})}get isModifyUnavailable(){return this.isExpired||0===this.appointmentResource.slots.length||!this.policyAllowsModifyOrCancel}get isCancelUnavailable(){return this.isExpired||!this.policyAllowsModifyOrCancel}get modifyUnavailableMessage(){return J({action:"modify",refundPolicySeconds:this.refundPolicySeconds})}get cancelUnavailableMessage(){return J({action:"cancel",refundPolicySeconds:this.refundPolicySeconds})}channelIcon(){switch(this.channel){case d.videocall:return P({size:20});case d.phonecall:return A({size:20});default:return _({size:20})}}channelLabel(){switch(this.channel){case d.videocall:return o("Videoconsulta");case d.phonecall:return o("Consulta telefónica");default:return o("Chat")}}formatWhen(){const e=I().replace("_","-"),t=m(this.sessionTimezone),i=t?{timeZone:t}:{},n=new Date(this.appointmentResource.appointment.starts_at);if(Number.isNaN(n.getTime()))return"";const s=new Intl.DateTimeFormat(e,{weekday:"long",day:"numeric",month:"long",year:"numeric",...i}).format(n),r=new Intl.DateTimeFormat(e,{timeStyle:"short",hourCycle:"h23",...i}).format(n),l=t?h(t,n):"";return o(a`${s}, ${r} h${l?` (${l})`:""}`)}renderActions(){const e=this.channel===d.videocall;return O`<div class="actions">${this.hasChatSupport?O`<mq-button variant="outline" @click="${this.handleToggleChat}"><span class="chat-label">${o("Ir a chat")}</span> ${this.unreadCount>0?O`<mq-unread-badge class="chat-badge"></mq-unread-badge>`:j}</mq-button>`:j} ${e?O`<mq-button class="join" variant="primary" @click="${this.handleJoinVideocall}">${o("Unirse a la videoconsulta")}</mq-button>`:j}<div class="overflow"><mq-button variant="outline" size="icon-lg" aria-label="${o("Más opciones")}" aria-haspopup="menu" aria-expanded="${this.isMenuOpen}" @click="${()=>{this.isMenuOpen=!this.isMenuOpen}}">${R({size:16})}</mq-button>${this.isMenuOpen?O`<div class="menu" role="menu"><button class="menu-item" type="button" role="menuitem" @click="${this.handleModify}">${o("Modificar cita")}</button> <button class="menu-item negative" type="button" role="menuitem" @click="${this.handleCancel}">${o("Anular cita")}</button></div>`:j}</div></div>`}render(){const{professional:e}=this.appointmentResource,t=this.formatWhen();return O`<professional-overview .name="${e.name}" .specialtyName="${this.specialtyName}" .collegiateNumber="${e.collegiate_number??void 0}" .description="${e.description??""}" .languages="${e.languages??[]}" .avatar="${e.avatar??""}"></professional-overview><div class="details">${t?O`<div class="detail-row">${D({size:20})} <span>${t}</span></div>`:j}<div class="detail-row">${this.channelIcon()} <span>${this.channelLabel()}</span></div></div><div class="footer"><p class="reminder">${o("Recibirás un recordatorio 15 minutos antes de la consulta")}</p>${this.renderActions()}</div><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" hideCloseButton @mq-close="${()=>{this.isChatOpen=!1}}">${this.isChatOpen?O`<mq-chat-room slot="content" .consultationId="${this.appointmentResource.appointment.id}" consultation-type="appointment" token="${this.sessionToken}" .roomId="${this.appointmentResource.room.id}" .professionalHash="${e.hash}" ?readonly="${this.isExpired}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}"></mq-chat-room>`:j}</mq-floating-bubble><appointment-action-unavailable-dialog .open="${"modify"===this.openDialog}" .heading="${o("Modificar cita")}" .message="${this.modifyUnavailableMessage}" @close="${()=>{this.openDialog=null}}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"cancel"===this.openDialog}" .heading="${o("Anular cita")}" .message="${this.cancelUnavailableMessage}" @close="${()=>{this.openDialog=null}}"></appointment-action-unavailable-dialog><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,H.success(o("Consulta anulada correctamente")),this.dispatchEvent(new CustomEvent("appointment-cancel-confirmed",{bubbles:!0,composed:!0,detail:{id:this.appointmentId}}))}}"></cancel-appointment-confirmation-dialog>`}};t([n({context:l,subscribe:!0})],B.prototype,"apiClient",void 0),t([n({context:p,subscribe:!0})],B.prototype,"loginToken",void 0),t([M({type:Object})],B.prototype,"appointmentResource",void 0),t([M({type:String})],B.prototype,"token",void 0),t([M({type:String})],B.prototype,"patientHash",void 0),t([M({type:String})],B.prototype,"timezone",void 0),t([z()],B.prototype,"isChatOpen",void 0),t([z()],B.prototype,"isMenuOpen",void 0),t([z()],B.prototype,"isCancelDialogOpen",void 0),t([z()],B.prototype,"openDialog",void 0),B=t([s(),i("next-appointment-card")],B);export{J as a,Q as g};
@@ -0,0 +1 @@
1
+ import{_ as t,c as e}from"./custom-element-D2ziPxYE.js";import{m as a,s as i}from"./runtime-Bg1WXVCx.js";import{l as o}from"./localized-decorator-BlOuLhym.js";import{i as s,a as r,x as n,E as l}from"./lit-element-DiWJYFwC.js";import{n as d}from"./property-scuRaFcM.js";import{r as p}from"./state-LQivXIgA.js";import{getLocale as m}from"../i18n.js";import{chevronDownIcon as c}from"../ui/icons/chevron-down-icon.js";import"../ui/mq-text-button.js";import"../ui/mq-avatar.js";const f=s`.header{display:flex;align-items:center;gap:var(--sp-4);margin-bottom:0}.header.expanded{margin-bottom:var(--sp-4)}@media (max-width:768px){.header{--avatar-size-lg:var(--avatar-size-md)}}.professional-info{flex:1}.professional-name{font-family:var(--font-titles);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}.professional-specialty{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);margin:0}.collegiate-number{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);color:var(--color-neutrals-text-medium);margin:0;text-transform:uppercase}.languages{display:flex;flex-wrap:wrap;gap:var(--sp-3)}.language-pill{display:inline-block;background-color:var(--color-background-light,#f8f7fa);color:var(--color-neutrals-text-medium);font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-medium);padding:var(--sp-1) var(--sp-2);min-width:64px;text-align:center;border-radius:26px;text-transform:capitalize;letter-spacing:1px}.description{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);margin-bottom:0;color:var(--color-neutrals-text-default)}.icon{transition:transform .1s ease-in-out}.rotate-180{transform:rotate(180deg)}.details{display:grid;grid-template-rows:0fr;transition:grid-template-rows .2s ease-out;overflow:hidden}.details[data-expanded=true]{grid-template-rows:1fr}.details-content{overflow:hidden}.details-content>:not(:first-child){margin-top:var(--sp-3)}@media (min-width:769px){:host([always-expanded-on-desktop]) .details{grid-template-rows:1fr}:host([always-expanded-on-desktop]) mq-text-button{display:none}:host([always-expanded-on-desktop]) .header{margin-bottom:var(--sp-4)}}`;let g=class ProfessionalOverview extends r{constructor(){super(...arguments),this.alwaysExpandedOnDesktop=!1,this.detailsExpanded=!1}static{this.styles=f}render(){const t=m().replace("_","-"),e=this.languages.map(e=>n`<span class="language-pill">${new Intl.DisplayNames(t,{type:"language"}).of(e)}</span>`);return n`<div class="header ${this.detailsExpanded?"expanded":""}"><mq-avatar src="${this.avatar}" fallback="${this.name}" alt="${this.name}" size="lg"></mq-avatar><div class="professional-info"><h2 class="professional-name">${this.name}</h2>${this.specialtyName?n`<p class="professional-specialty">${this.specialtyName}</p>`:l}<mq-text-button type="button" size="sm" fontWeight="bold" @click="${()=>{this.detailsExpanded=!this.detailsExpanded}}">${this.detailsExpanded?a("Ocultar detalles"):a("Ver detalles")} ${c({size:24,className:"icon "+(this.detailsExpanded?"rotate-180":"")})}</mq-text-button></div></div><div class="details" data-expanded="${this.detailsExpanded}"><div class="details-content"><div class="languages">${e}</div>${this.collegiateNumber?n`<p class="collegiate-number">${a(i`Nº COL. ${this.collegiateNumber}`)}</p>`:l}<p class="description">${this.description}</p></div></div>`}};t([d({type:String})],g.prototype,"name",void 0),t([d({type:String})],g.prototype,"specialtyName",void 0),t([d({type:String})],g.prototype,"collegiateNumber",void 0),t([d({type:String})],g.prototype,"description",void 0),t([d({type:Array})],g.prototype,"languages",void 0),t([d({type:String})],g.prototype,"avatar",void 0),t([d({type:Boolean,reflect:!0,attribute:"always-expanded-on-desktop"})],g.prototype,"alwaysExpandedOnDesktop",void 0),t([p()],g.prototype,"detailsExpanded",void 0),g=t([o(),e("professional-overview")],g);export{g as P};
package/dist/env.js CHANGED
@@ -1 +1 @@
1
- const E="https://mediquo-landing.s3.eu-central-1.amazonaws.com/sdk-web/elements",o="production",e="0.9.3",n={development:{MODE:"development",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"47836441",ASSETS_BASE_URL:E},production:{MODE:"production",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"46655102",ASSETS_BASE_URL:E}};let t=o;const _=new Proxy({},{get:(E,o)=>n[t??"production"][o]});function S(E){t=E}export{E as ASSETS_BASE_URL,_ as env,S as setEnv};
1
+ const E="https://mediquo-landing.s3.eu-central-1.amazonaws.com/sdk-web/elements",o="production",e="0.10.0",n={development:{MODE:"development",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"47836441",ASSETS_BASE_URL:E},production:{MODE:"production",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"46655102",ASSETS_BASE_URL:E}};let t=o;const _=new Proxy({},{get:(E,o)=>n[t??"production"][o]});function S(E){t=E}export{E as ASSETS_BASE_URL,_ as env,S as setEnv};
package/dist/events.d.ts CHANGED
@@ -10,12 +10,7 @@
10
10
  * Convention (matches `@mediquo/web-components`): a class extending `Event`,
11
11
  * with a `static eventName`, dispatched `{ bubbles: true, composed: true }`.
12
12
  * All names are `mq-*` prefixed to keep the published contract collision-free.
13
- *
14
- * The `HTMLElementEventMap` augmentation at the bottom gives hosts a single
15
- * typed surface (autocomplete + checking on `addEventListener`), recovering the
16
- * type-safety the discarded discriminated-union event used to provide.
17
13
  */
18
- /** Which tab of the appointments list the host should land on. */
19
14
  type MqAppointmentsTab = "next" | "history";
20
15
  /**
21
16
  * Generic "back" chrome, emitted by the presentational `back-link` primitive.
@@ -36,18 +31,14 @@ declare class MqBackEvent extends Event {
36
31
  source?: string;
37
32
  });
38
33
  }
39
- /** The user asked to return to the home screen (from `mq-my-appointments`). */
40
34
  declare class MqHomeEvent extends Event {
41
35
  static eventName: string;
42
36
  constructor();
43
37
  }
44
38
  /**
45
- * The user asked to view their appointments list on a specific tab.
46
- *
47
39
  * Carries `tab` on purpose: the discriminator (finished consultation → history,
48
40
  * upcoming → next) is only known at the emitting call-site and cannot be
49
- * reconstructed by the host afterwards. Mirrors the existing
50
- * `ViewAppointmentsEvent { tab }` precedent in `@mediquo/web-components`.
41
+ * reconstructed by the host afterwards.
51
42
  */
52
43
  declare class MqViewAppointmentsEvent extends Event {
53
44
  readonly detail: {
@@ -58,7 +49,6 @@ declare class MqViewAppointmentsEvent extends Event {
58
49
  tab: MqAppointmentsTab;
59
50
  });
60
51
  }
61
- /** The user asked to reschedule an appointment. */
62
52
  declare class MqAppointmentRescheduleEvent extends Event {
63
53
  readonly detail: {
64
54
  appointmentId: string;
@@ -68,7 +58,6 @@ declare class MqAppointmentRescheduleEvent extends Event {
68
58
  appointmentId: string;
69
59
  });
70
60
  }
71
- /** The user asked to book a new appointment (optionally pre-filtered). */
72
61
  declare class MqAppointmentBookEvent extends Event {
73
62
  readonly detail: {
74
63
  specialty?: string;
@@ -82,7 +71,6 @@ declare class MqAppointmentBookEvent extends Event {
82
71
  professional?: string;
83
72
  });
84
73
  }
85
- /** The user asked to join the videocall of an appointment. */
86
74
  declare class MqAppointmentJoinVideocallEvent extends Event {
87
75
  readonly detail: {
88
76
  appointmentId: string;
@@ -92,13 +80,6 @@ declare class MqAppointmentJoinVideocallEvent extends Event {
92
80
  appointmentId: string;
93
81
  });
94
82
  }
95
- /**
96
- * The user asked to open an appointment's documentation.
97
- *
98
- * Folded into the `mq-appointment-*` family (was `goto-documentation` in
99
- * `@mediquo/web-components`) so the action inventory is complete and the
100
- * naming is consistent across the contract.
101
- */
102
83
  declare class MqAppointmentViewDocumentationEvent extends Event {
103
84
  readonly detail: {
104
85
  appointmentId: string;
@@ -108,11 +89,6 @@ declare class MqAppointmentViewDocumentationEvent extends Event {
108
89
  appointmentId: string;
109
90
  });
110
91
  }
111
- /**
112
- * Request to download a file (url + filename). Shared across the package
113
- * (emitted by chat-room / videocall), so it lives in the events contract
114
- * rather than colocated in a single feature.
115
- */
116
92
  declare class DownloadFileEvent extends Event {
117
93
  readonly detail: {
118
94
  url: string;
@@ -124,23 +100,10 @@ declare class DownloadFileEvent extends Event {
124
100
  filename: string;
125
101
  });
126
102
  }
127
- /**
128
- * The user asked to see their full documents list (from the dashboard's
129
- * "recent documents" widget). No payload — the destination is a top-level
130
- * screen the host owns.
131
- */
132
103
  declare class MqViewDocumentsEvent extends Event {
133
104
  static eventName: string;
134
105
  constructor();
135
106
  }
136
- /**
137
- * A payment session was confirmed as paid (emitted by `mq-payment-poller`).
138
- *
139
- * The poller only reports the *happy* terminal state: rejected and
140
- * unconfirmable payments are rendered by the poller itself, because the host
141
- * has no better screen to show for them and nothing to decide. Success is the
142
- * one outcome where the host owns the destination, so it is the one event.
143
- */
144
107
  declare class MqPaymentSucceededEvent extends Event {
145
108
  readonly detail: {
146
109
  appointmentId: string;
@@ -153,14 +116,10 @@ declare class MqPaymentSucceededEvent extends Event {
153
116
  });
154
117
  }
155
118
  /**
156
- * The user is about to be handed over to an off-site payment gateway.
157
- *
158
119
  * Unlike the rest of the contract this event is **cancelable and has a default
159
120
  * action**: the emitting component navigates the top-level document to `url`
160
- * unless a listener calls `preventDefault()`. Hosts that render in a plain
161
- * browser tab need no listener at all; the escape hatch exists for webviews and
162
- * in-app shells that must open the gateway some other way — the same reason
163
- * `apple-pay-opened` / `google-pay-opened` are cancelable.
121
+ * unless a listener calls `preventDefault()`. The escape hatch exists for
122
+ * webviews and in-app shells that must open the gateway some other way.
164
123
  *
165
124
  * `url` is a single-use gateway checkout URL — treat it as a secret and do not
166
125
  * log it.
package/dist/i18n.js CHANGED
@@ -1 +1 @@
1
- import{c as e}from"./chunks/runtime-Bg1WXVCx.js";import{l as n}from"./chunks/chunk-4FFT6DC2-CVWibomC.js";import{z as t}from"./chunks/external-BXLaKy9c.js";const c=["ca_ES","de_DE","en_US","pt_PT"],s=t.enum(["en_US","pt_PT","de_DE","es_ES","ca_ES"]);function a(e){return s.safeParse(e).success}const o="__mqElementsLocalization__";function i(){const e=globalThis;return e[o]||(e[o]={initialized:!1}),e[o]}function r(){const t=i();if(!t.initialized){t.initialized=!0;try{const{setLocale:n,getLocale:s}=e({sourceLocale:"es_ES",targetLocales:c,loadLocale:async e=>{switch(e){case"en_US":default:return import("./chunks/en_US-C2zY9QiH.js");case"pt_PT":return import("./chunks/pt_PT-DUs_Ox73.js");case"de_DE":return import("./chunks/de_DE-BTPGM932.js");case"ca_ES":return import("./chunks/ca_ES-OHfUU0MP.js")}}});t.setLocale=n,t.getLocale=s}catch(e){n.warn("Localization was already configured on this page.",e)}}}const u="Localization not initialized yet.";async function l(e){const{setLocale:t}=i();if(t)return t(e);n.warn(u)}function _(){const{getLocale:e}=i();return e?e():(n.warn(u),"es_ES")}export{_ as getLocale,r as initLocalization,a as isValidLocale,l as setLocale};
1
+ import{c as e}from"./chunks/runtime-Bg1WXVCx.js";import{l as n}from"./chunks/chunk-4FFT6DC2-CVWibomC.js";import{z as t}from"./chunks/external-CJj32K_p.js";const c=["ca_ES","de_DE","en_US","pt_PT"],s=t.enum(["en_US","pt_PT","de_DE","es_ES","ca_ES"]);function a(e){return s.safeParse(e).success}const o="__mqElementsLocalization__";function i(){const e=globalThis;return e[o]||(e[o]={initialized:!1}),e[o]}function r(){const t=i();if(!t.initialized){t.initialized=!0;try{const{setLocale:n,getLocale:s}=e({sourceLocale:"es_ES",targetLocales:c,loadLocale:async e=>{switch(e){case"en_US":default:return import("./chunks/en_US-C2zY9QiH.js");case"pt_PT":return import("./chunks/pt_PT-DUs_Ox73.js");case"de_DE":return import("./chunks/de_DE-BTPGM932.js");case"ca_ES":return import("./chunks/ca_ES-OHfUU0MP.js")}}});t.setLocale=n,t.getLocale=s}catch(e){n.warn("Localization was already configured on this page.",e)}}}const u="Localization not initialized yet.";async function l(e){const{setLocale:t}=i();if(t)return t(e);n.warn(u)}function _(){const{getLocale:e}=i();return e?e():(n.warn(u),"es_ES")}export{_ as getLocale,r as initLocalization,a as isValidLocale,l as setLocale};
@@ -1,5 +1,5 @@
1
1
  import * as lit_html from 'lit-html';
2
- import { M as MediquoApiChatClient } from './chunks/index.d-XSe7Hy-Q.js';
2
+ import { M as MediquoApiChatClient } from './chunks/index.d-DeJP_xib.js';
3
3
  import { LitElement, PropertyValues } from 'lit';
4
4
  import { Env } from './env.js';
5
5
  import 'axios';
@@ -1 +1 @@
1
- import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{e as o}from"./chunks/provide-BwI4DDGF.js";import{A as i}from"./chunks/api-client-context-V1UAGtKW.js";import{a as r,x as s}from"./chunks/lit-element-DiWJYFwC.js";import{n}from"./chunks/property-scuRaFcM.js";import{r as p}from"./chunks/state-LQivXIgA.js";import{setEnv as c}from"./env.js";import{c as a,n as m}from"./chunks/api-chat-client-fYDIH220.js";import{e as h}from"./chunks/ensure-context-root-DbdqwnKB.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/external-BXLaKy9c.js";import"./chunks/isBefore-CPpTogxo.js";h();let u=class MqApiClientProvider extends r{constructor(){super(...arguments),this.apiClient=a()}willUpdate(t){t.has("env")&&this.env&&c(this.env);const e=m(t,{env:this.env,apiKey:this.apiKey,token:this.token,locale:this.locale});e&&(this.apiClient=e)}render(){return s`<slot></slot>`}};t([n({type:String,attribute:"api-key"})],u.prototype,"apiKey",void 0),t([n({type:String,attribute:"token"})],u.prototype,"token",void 0),t([n({type:String,attribute:"locale"})],u.prototype,"locale",void 0),t([n({type:String,attribute:"env"})],u.prototype,"env",void 0),t([o({context:i}),p()],u.prototype,"apiClient",void 0),u=t([e("mq-api-client-provider")],u);export{u as MqApiClientProvider};
1
+ import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{e as o}from"./chunks/provide-BwI4DDGF.js";import{A as i}from"./chunks/api-client-context-V1UAGtKW.js";import{a as r,x as s}from"./chunks/lit-element-DiWJYFwC.js";import{n}from"./chunks/property-scuRaFcM.js";import{r as p}from"./chunks/state-LQivXIgA.js";import{setEnv as c}from"./env.js";import{c as a,n as m}from"./chunks/api-chat-client-BhxUWldC.js";import{e as h}from"./chunks/ensure-context-root-DbdqwnKB.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/external-CJj32K_p.js";import"./chunks/isBefore-CPpTogxo.js";h();let u=class MqApiClientProvider extends r{constructor(){super(...arguments),this.apiClient=a()}willUpdate(t){t.has("env")&&this.env&&c(this.env);const e=m(t,{env:this.env,apiKey:this.apiKey,token:this.token,locale:this.locale});e&&(this.apiClient=e)}render(){return s`<slot></slot>`}};t([n({type:String,attribute:"api-key"})],u.prototype,"apiKey",void 0),t([n({type:String,attribute:"token"})],u.prototype,"token",void 0),t([n({type:String,attribute:"locale"})],u.prototype,"locale",void 0),t([n({type:String,attribute:"env"})],u.prototype,"env",void 0),t([o({context:i}),p()],u.prototype,"apiClient",void 0),u=t([e("mq-api-client-provider")],u);export{u as MqApiClientProvider};
@@ -1,6 +1,6 @@
1
1
  import * as lit from 'lit';
2
2
  import { LitElement, PropertyValues } from 'lit';
3
- import { M as MediquoApiChatClient } from './chunks/index.d-XSe7Hy-Q.js';
3
+ import { M as MediquoApiChatClient } from './chunks/index.d-DeJP_xib.js';
4
4
  import { Env } from './env.js';
5
5
  import { Locale } from './i18n.js';
6
6
  import 'axios';
@@ -1 +1 @@
1
- import{_ as e,c as t}from"./chunks/custom-element-D2ziPxYE.js";import{e as a}from"./chunks/provide-BwI4DDGF.js";import{c as i}from"./chunks/consume-CovVqBjI.js";import{m as s}from"./chunks/runtime-Bg1WXVCx.js";import{l as n}from"./chunks/localized-decorator-BlOuLhym.js";import{A as o}from"./chunks/api-client-context-V1UAGtKW.js";import{L as r}from"./chunks/login-token-task-Yib__6a9.js";import{l as p}from"./chunks/chunk-4FFT6DC2-CVWibomC.js";import{i as l,a as c,x as h}from"./chunks/lit-element-DiWJYFwC.js";import{n as u}from"./chunks/property-scuRaFcM.js";import{r as y}from"./chunks/state-LQivXIgA.js";import{setEnv as d}from"./env.js";import{initLocalization as m,setLocale as v,isValidLocale as k}from"./i18n.js";import{c as b,n as f}from"./chunks/api-chat-client-fYDIH220.js";import{u as P,s as _,r as E}from"./chunks/apple-pay-outcomes-DbuQ2LI3.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/external-BXLaKy9c.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";function g(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent;return/Safari/i.test(e)&&!/Chrome|Chromium|Edg|OPR|Firefox|FxiOS/i.test(e)}async function S(e){if("undefined"==typeof window||!window.isSecureContext)return{available:!1,reason:"unsupported"};if(!function(){if("undefined"==typeof window)return!1;const e="undefined"!=typeof ApplePaySession&&"function"==typeof ApplePaySession.canMakePayments,t="undefined"!=typeof customElements&&void 0!==customElements.get("apple-pay-button");return e&&t}())return{available:!1,reason:"sdk-missing"};if(!e.trim())return{available:!1,reason:"merchant-id-missing"};const t=ApplePaySession;if(function(e){return"function"==typeof e.applePayCapabilities}(t))try{return function(e){switch(e){case"applePayUnsupported":return{available:!1,reason:"unsupported"};case"paymentCredentialsUnavailable":case"paymentCredentialsAvailable":case"paymentCredentialStatusUnknown":return{available:!0,usesQrFlow:!g()}}}((await t.applePayCapabilities(e)).paymentCredentialStatus)}catch{return t.canMakePayments()?{available:!0,usesQrFlow:!g()}:{available:!1,reason:"unsupported"}}return t.canMakePayments()?{available:!0,usesQrFlow:!g()}:{available:!1,reason:"unsupported"}}const A={es_ES:"es-ES",en_US:"en-US",pt_PT:"pt-PT",de_DE:"de-DE",ca_ES:"ca-ES"};try{m()}catch{}const C=["visa","masterCard","amex"],w=["supports3DS"],x=l`:host{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:12px;width:100%;min-height:48px}.helper{margin:0;text-align:center;font-family:system-ui,sans-serif;font-size:13px;line-height:1.4;color:#6e6e73}.pay-row{display:block;width:100%}.pay-row--paying{opacity:.55;pointer-events:none}apple-pay-button{--apple-pay-button-width:100%;--apple-pay-button-height:48px;--apple-pay-button-border-radius:10px;--apple-pay-button-padding:0;display:block;width:100%;min-height:48px;cursor:pointer}.state{text-align:center;font-family:system-ui,sans-serif;font-size:15px;color:#86868b;margin:0}`;class ApplePayCheckoutSuccessEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(ApplePayCheckoutSuccessEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class ApplePayCheckoutDeniedEvent extends Event{static{this.eventName="payment-denied"}constructor(e){super(ApplePayCheckoutDeniedEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class ApplePayCheckoutErrorEvent extends Event{static{this.eventName="payment-error"}constructor(e){super(ApplePayCheckoutErrorEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}function j(e,t){p.warn(e,{error:t instanceof Error?t.message:String(t)})}let T=class MqApplePayCheckout extends c{constructor(){super(...arguments),this._availabilityPhase="checking",this._showQrHelper=!1,this._paying=!1,this._suppressCancelEvent=!1,this._availabilityGeneration=0,this.apiClient=b(),this._loginTokenTask=new r(this,()=>this.apiClient,{args:()=>[this.apiKey,this.token],onComplete:e=>{this._sessionToken=e.access_token,this.apiClient.setAuthToken(e.access_token),this._refreshAvailability()},onError:()=>{this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"auth"}))}}),this._onPayClick=()=>{if(this._paying||"ready"!==this._availabilityPhase)return;let e;try{e=new ApplePaySession(3,this._buildPaymentRequest())}catch(e){return j("mq-apple-pay-checkout: failed to create ApplePaySession",e),void this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"unsupported"}))}this._paying=!0,this._suppressCancelEvent=!1,e.onvalidatemerchant=async t=>{try{const a=await this.apiClient.payments.validateApplePayMerchant({order_id:this.sessionId,validation_url:t.validationURL});e.completeMerchantValidation(P(a))}catch(t){j("mq-apple-pay-checkout: validate-merchant failed",t),this._suppressCancelEvent=!0,this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"merchant"})),e.abort(),this._paying=!1}},e.onpaymentauthorized=async t=>{try{const a=await this.apiClient.payments.authorizeApplePay({order_id:this.sessionId,token:_(t.payment.token)}),{status:i,consultation_id:s}=a.data,n=E(i,s,this.sessionId);switch(n.kind){case"success":e.completePayment(ApplePaySession.STATUS_SUCCESS),this.dispatchEvent(new ApplePayCheckoutSuccessEvent({sessionId:n.sessionId,reference:n.reference}));break;case"denied":e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutDeniedEvent({sessionId:n.sessionId}));break;case"error":e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:n.reason}))}}catch(t){j("mq-apple-pay-checkout: authorize failed",t),e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"authorize"}))}finally{this._paying=!1}},e.oncancel=()=>{this._paying=!1,this._suppressCancelEvent?this._suppressCancelEvent=!1:this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"cancelled"}))};try{e.begin()}catch(e){j("mq-apple-pay-checkout: session.begin() failed",e),this._paying=!1,this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"unsupported"}))}}}static{this.styles=x}willUpdate(e){e.has("env")&&this.env&&d(this.env),e.has("locale")&&v(k(this.locale)?this.locale:"es_ES");const t=f(e,{env:this.env,apiKey:this.apiKey,token:this._sessionToken,locale:k(this.locale)?this.locale:"es_ES"},this.inheritedApiClient);t&&(this.apiClient=t),e.has("merchantId")&&this._loginTokenTask.value&&this._refreshAvailability()}async _refreshAvailability(){const e=++this._availabilityGeneration;this._availabilityPhase="checking",this._showQrHelper=!1;const t=await S(this.merchantId??"");e===this._availabilityGeneration&&(t.available?(this._availabilityPhase="ready",this._showQrHelper=t.usesQrFlow):this._availabilityPhase="unavailable")}get _resolvedLocale(){return k(this.locale)?this.locale:"es_ES"}_buildPaymentRequest(){return{countryCode:this.country,currencyCode:this.currency,supportedNetworks:[...C],merchantCapabilities:[...w],total:{label:this.label,amount:this.amount}}}_renderUnavailable(){return this.merchantId?.trim()?"undefined"==typeof ApplePaySession?h`<p class="state">${s("No se ha podido cargar Apple Pay. Comprueba la configuración del sitio e inténtalo de nuevo.")}</p>`:h`<p class="state">${s("Apple Pay no está disponible")}</p>`:h`<p class="state">${s("Falta el identificador de comercio de Apple Pay")}</p>`}render(){return this._loginTokenTask.render({pending:()=>h`<p class="state">${s("Preparando Apple Pay…")}</p>`,error:()=>h`<p class="state">${s("No hemos podido iniciar el pago")}</p>`,complete:()=>{return"checking"===this._availabilityPhase?h`<p class="state">${s("Comprobando Apple Pay…")}</p>`:"unavailable"===this._availabilityPhase?this._renderUnavailable():h`${this._showQrHelper?h`<p class="helper">${s("Para pagar con Apple Pay, escanea el código QR con tu iPhone (iOS 18 o posterior) y confirma el pago.")}</p>`:null}<div class="pay-row ${this._paying?"pay-row--paying":""}"><apple-pay-button buttonstyle="black" type="pay" locale="${e=this._resolvedLocale,A[e]??"es-ES"}" aria-label="${s("Pagar con Apple Pay")}" @click="${this._onPayClick}"></apple-pay-button></div>`;var e}})}};e([u({type:String,attribute:"env"})],T.prototype,"env",void 0),e([u({type:String,attribute:"api-key"})],T.prototype,"apiKey",void 0),e([u({type:String,attribute:"token"})],T.prototype,"token",void 0),e([u({type:String,attribute:"locale",reflect:!0})],T.prototype,"locale",void 0),e([u({type:String,attribute:"merchant-id"})],T.prototype,"merchantId",void 0),e([u({type:String,attribute:"session-id"})],T.prototype,"sessionId",void 0),e([u({type:String,attribute:"amount"})],T.prototype,"amount",void 0),e([u({type:String,attribute:"currency"})],T.prototype,"currency",void 0),e([u({type:String,attribute:"country"})],T.prototype,"country",void 0),e([u({type:String,attribute:"label"})],T.prototype,"label",void 0),e([y()],T.prototype,"_availabilityPhase",void 0),e([y()],T.prototype,"_showQrHelper",void 0),e([y()],T.prototype,"_paying",void 0),e([i({context:o,subscribe:!0}),y()],T.prototype,"inheritedApiClient",void 0),e([a({context:o}),y()],T.prototype,"apiClient",void 0),T=e([n(),t("mq-apple-pay-checkout")],T);export{ApplePayCheckoutDeniedEvent,ApplePayCheckoutErrorEvent,ApplePayCheckoutSuccessEvent,T as MqApplePayCheckout};
1
+ import{_ as e,c as t}from"./chunks/custom-element-D2ziPxYE.js";import{e as a}from"./chunks/provide-BwI4DDGF.js";import{c as i}from"./chunks/consume-CovVqBjI.js";import{m as s}from"./chunks/runtime-Bg1WXVCx.js";import{l as n}from"./chunks/localized-decorator-BlOuLhym.js";import{A as o}from"./chunks/api-client-context-V1UAGtKW.js";import{L as r}from"./chunks/login-token-task-Yib__6a9.js";import{l as p}from"./chunks/chunk-4FFT6DC2-CVWibomC.js";import{i as l,a as c,x as h}from"./chunks/lit-element-DiWJYFwC.js";import{n as u}from"./chunks/property-scuRaFcM.js";import{r as y}from"./chunks/state-LQivXIgA.js";import{setEnv as d}from"./env.js";import{initLocalization as m,setLocale as v,isValidLocale as k}from"./i18n.js";import{c as b,n as f}from"./chunks/api-chat-client-BhxUWldC.js";import{u as P,s as _,r as E}from"./chunks/apple-pay-outcomes-BU_PyQdT.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/external-CJj32K_p.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";function g(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent;return/Safari/i.test(e)&&!/Chrome|Chromium|Edg|OPR|Firefox|FxiOS/i.test(e)}async function S(e){if("undefined"==typeof window||!window.isSecureContext)return{available:!1,reason:"unsupported"};if(!function(){if("undefined"==typeof window)return!1;const e="undefined"!=typeof ApplePaySession&&"function"==typeof ApplePaySession.canMakePayments,t="undefined"!=typeof customElements&&void 0!==customElements.get("apple-pay-button");return e&&t}())return{available:!1,reason:"sdk-missing"};if(!e.trim())return{available:!1,reason:"merchant-id-missing"};const t=ApplePaySession;if(function(e){return"function"==typeof e.applePayCapabilities}(t))try{return function(e){switch(e){case"applePayUnsupported":return{available:!1,reason:"unsupported"};case"paymentCredentialsUnavailable":case"paymentCredentialsAvailable":case"paymentCredentialStatusUnknown":return{available:!0,usesQrFlow:!g()}}}((await t.applePayCapabilities(e)).paymentCredentialStatus)}catch{return t.canMakePayments()?{available:!0,usesQrFlow:!g()}:{available:!1,reason:"unsupported"}}return t.canMakePayments()?{available:!0,usesQrFlow:!g()}:{available:!1,reason:"unsupported"}}const A={es_ES:"es-ES",en_US:"en-US",pt_PT:"pt-PT",de_DE:"de-DE",ca_ES:"ca-ES"};try{m()}catch{}const C=["visa","masterCard","amex"],w=["supports3DS"],x=l`:host{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:12px;width:100%;min-height:48px}.helper{margin:0;text-align:center;font-family:system-ui,sans-serif;font-size:13px;line-height:1.4;color:#6e6e73}.pay-row{display:block;width:100%}.pay-row--paying{opacity:.55;pointer-events:none}apple-pay-button{--apple-pay-button-width:100%;--apple-pay-button-height:48px;--apple-pay-button-border-radius:10px;--apple-pay-button-padding:0;display:block;width:100%;min-height:48px;cursor:pointer}.state{text-align:center;font-family:system-ui,sans-serif;font-size:15px;color:#86868b;margin:0}`;class ApplePayCheckoutSuccessEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(ApplePayCheckoutSuccessEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class ApplePayCheckoutDeniedEvent extends Event{static{this.eventName="payment-denied"}constructor(e){super(ApplePayCheckoutDeniedEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class ApplePayCheckoutErrorEvent extends Event{static{this.eventName="payment-error"}constructor(e){super(ApplePayCheckoutErrorEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}function j(e,t){p.warn(e,{error:t instanceof Error?t.message:String(t)})}let T=class MqApplePayCheckout extends c{constructor(){super(...arguments),this._availabilityPhase="checking",this._showQrHelper=!1,this._paying=!1,this._suppressCancelEvent=!1,this._availabilityGeneration=0,this.apiClient=b(),this._loginTokenTask=new r(this,()=>this.apiClient,{args:()=>[this.apiKey,this.token],onComplete:e=>{this._sessionToken=e.access_token,this.apiClient.setAuthToken(e.access_token),this._refreshAvailability()},onError:()=>{this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"auth"}))}}),this._onPayClick=()=>{if(this._paying||"ready"!==this._availabilityPhase)return;let e;try{e=new ApplePaySession(3,this._buildPaymentRequest())}catch(e){return j("mq-apple-pay-checkout: failed to create ApplePaySession",e),void this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"unsupported"}))}this._paying=!0,this._suppressCancelEvent=!1,e.onvalidatemerchant=async t=>{try{const a=await this.apiClient.payments.validateApplePayMerchant({order_id:this.sessionId,validation_url:t.validationURL});e.completeMerchantValidation(P(a))}catch(t){j("mq-apple-pay-checkout: validate-merchant failed",t),this._suppressCancelEvent=!0,this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"merchant"})),e.abort(),this._paying=!1}},e.onpaymentauthorized=async t=>{try{const a=await this.apiClient.payments.authorizeApplePay({order_id:this.sessionId,token:_(t.payment.token)}),{status:i,consultation_id:s}=a.data,n=E(i,s,this.sessionId);switch(n.kind){case"success":e.completePayment(ApplePaySession.STATUS_SUCCESS),this.dispatchEvent(new ApplePayCheckoutSuccessEvent({sessionId:n.sessionId,reference:n.reference}));break;case"denied":e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutDeniedEvent({sessionId:n.sessionId}));break;case"error":e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:n.reason}))}}catch(t){j("mq-apple-pay-checkout: authorize failed",t),e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"authorize"}))}finally{this._paying=!1}},e.oncancel=()=>{this._paying=!1,this._suppressCancelEvent?this._suppressCancelEvent=!1:this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"cancelled"}))};try{e.begin()}catch(e){j("mq-apple-pay-checkout: session.begin() failed",e),this._paying=!1,this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"unsupported"}))}}}static{this.styles=x}willUpdate(e){e.has("env")&&this.env&&d(this.env),e.has("locale")&&v(k(this.locale)?this.locale:"es_ES");const t=f(e,{env:this.env,apiKey:this.apiKey,token:this._sessionToken,locale:k(this.locale)?this.locale:"es_ES"},this.inheritedApiClient);t&&(this.apiClient=t),e.has("merchantId")&&this._loginTokenTask.value&&this._refreshAvailability()}async _refreshAvailability(){const e=++this._availabilityGeneration;this._availabilityPhase="checking",this._showQrHelper=!1;const t=await S(this.merchantId??"");e===this._availabilityGeneration&&(t.available?(this._availabilityPhase="ready",this._showQrHelper=t.usesQrFlow):this._availabilityPhase="unavailable")}get _resolvedLocale(){return k(this.locale)?this.locale:"es_ES"}_buildPaymentRequest(){return{countryCode:this.country,currencyCode:this.currency,supportedNetworks:[...C],merchantCapabilities:[...w],total:{label:this.label,amount:this.amount}}}_renderUnavailable(){return this.merchantId?.trim()?"undefined"==typeof ApplePaySession?h`<p class="state">${s("No se ha podido cargar Apple Pay. Comprueba la configuración del sitio e inténtalo de nuevo.")}</p>`:h`<p class="state">${s("Apple Pay no está disponible")}</p>`:h`<p class="state">${s("Falta el identificador de comercio de Apple Pay")}</p>`}render(){return this._loginTokenTask.render({pending:()=>h`<p class="state">${s("Preparando Apple Pay…")}</p>`,error:()=>h`<p class="state">${s("No hemos podido iniciar el pago")}</p>`,complete:()=>{return"checking"===this._availabilityPhase?h`<p class="state">${s("Comprobando Apple Pay…")}</p>`:"unavailable"===this._availabilityPhase?this._renderUnavailable():h`${this._showQrHelper?h`<p class="helper">${s("Para pagar con Apple Pay, escanea el código QR con tu iPhone (iOS 18 o posterior) y confirma el pago.")}</p>`:null}<div class="pay-row ${this._paying?"pay-row--paying":""}"><apple-pay-button buttonstyle="black" type="pay" locale="${e=this._resolvedLocale,A[e]??"es-ES"}" aria-label="${s("Pagar con Apple Pay")}" @click="${this._onPayClick}"></apple-pay-button></div>`;var e}})}};e([u({type:String,attribute:"env"})],T.prototype,"env",void 0),e([u({type:String,attribute:"api-key"})],T.prototype,"apiKey",void 0),e([u({type:String,attribute:"token"})],T.prototype,"token",void 0),e([u({type:String,attribute:"locale",reflect:!0})],T.prototype,"locale",void 0),e([u({type:String,attribute:"merchant-id"})],T.prototype,"merchantId",void 0),e([u({type:String,attribute:"session-id"})],T.prototype,"sessionId",void 0),e([u({type:String,attribute:"amount"})],T.prototype,"amount",void 0),e([u({type:String,attribute:"currency"})],T.prototype,"currency",void 0),e([u({type:String,attribute:"country"})],T.prototype,"country",void 0),e([u({type:String,attribute:"label"})],T.prototype,"label",void 0),e([y()],T.prototype,"_availabilityPhase",void 0),e([y()],T.prototype,"_showQrHelper",void 0),e([y()],T.prototype,"_paying",void 0),e([i({context:o,subscribe:!0}),y()],T.prototype,"inheritedApiClient",void 0),e([a({context:o}),y()],T.prototype,"apiClient",void 0),T=e([n(),t("mq-apple-pay-checkout")],T);export{ApplePayCheckoutDeniedEvent,ApplePayCheckoutErrorEvent,ApplePayCheckoutSuccessEvent,T as MqApplePayCheckout};
@@ -1,5 +1,5 @@
1
1
  import * as lit_html from 'lit-html';
2
- import { C as CreatePaymentLinkRequest } from './chunks/index.d-XSe7Hy-Q.js';
2
+ import { C as CreatePaymentLinkRequest } from './chunks/index.d-DeJP_xib.js';
3
3
  import { LitElement } from 'lit';
4
4
  import { Env } from './env.js';
5
5
  import { Locale } from './i18n.js';
@@ -1 +1 @@
1
- import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{a as o,x as s}from"./chunks/lit-element-DiWJYFwC.js";import{n as i}from"./chunks/property-scuRaFcM.js";import{o as n}from"./chunks/if-defined-BYeVdwgd.js";import"./mq-checkout.js";import"./chunks/provide-BwI4DDGF.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/consume-CovVqBjI.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/localized-decorator-BlOuLhym.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/api-chat-client-fYDIH220.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/external-BXLaKy9c.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/api-client-context-V1UAGtKW.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/login-token-task-Yib__6a9.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/state-LQivXIgA.js";import"./theme.js";import"./i18n.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/directive-2EDmOukv.js";class AppointmentPaidEvent extends Event{static{this.eventName="payment-success"}constructor(t){super(AppointmentPaidEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}let r=class MqAppointmentCheckout extends o{constructor(){super(...arguments),this._provideSession=async t=>{const e=await t.payments.createPaymentLink({slot_id:this.slotId,service_id:this.serviceId,specialty_id:this.specialtyId,consultation_reason:this.consultationReason,discount_code:this.discountCode,preconsultation_documents:this.preconsultationDocuments});return{sessionId:e.session_id,paymentUrl:e.payment_link}},this._onSuccess=t=>{t.stopPropagation(),this.dispatchEvent(new AppointmentPaidEvent({appointmentId:t.detail.reference}))}}render(){return s`<mq-checkout env="${n(this.env)}" api-key="${this.apiKey}" token="${this.token}" locale="${this.locale}" .provideSession="${this._provideSession}" @payment-success="${this._onSuccess}"></mq-checkout>`}};t([i({type:String,attribute:"env"})],r.prototype,"env",void 0),t([i({type:String,attribute:"api-key"})],r.prototype,"apiKey",void 0),t([i({type:String,attribute:"token"})],r.prototype,"token",void 0),t([i({type:String,attribute:"locale",reflect:!0})],r.prototype,"locale",void 0),t([i({type:String,attribute:"slot-id"})],r.prototype,"slotId",void 0),t([i({type:String,attribute:"service-id"})],r.prototype,"serviceId",void 0),t([i({type:String,attribute:"specialty-id"})],r.prototype,"specialtyId",void 0),t([i({type:String,attribute:"consultation-reason"})],r.prototype,"consultationReason",void 0),t([i({type:String,attribute:"discount-code"})],r.prototype,"discountCode",void 0),t([i({attribute:!1})],r.prototype,"preconsultationDocuments",void 0),r=t([e("mq-appointment-checkout")],r);export{AppointmentPaidEvent,r as MqAppointmentCheckout};
1
+ import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{a as o,x as s}from"./chunks/lit-element-DiWJYFwC.js";import{n as i}from"./chunks/property-scuRaFcM.js";import{o as n}from"./chunks/if-defined-BYeVdwgd.js";import"./mq-checkout.js";import"./chunks/provide-BwI4DDGF.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/consume-CovVqBjI.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/localized-decorator-BlOuLhym.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/api-chat-client-BhxUWldC.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/external-CJj32K_p.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/api-client-context-V1UAGtKW.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/login-token-task-Yib__6a9.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/state-LQivXIgA.js";import"./theme.js";import"./i18n.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/directive-2EDmOukv.js";class AppointmentPaidEvent extends Event{static{this.eventName="payment-success"}constructor(t){super(AppointmentPaidEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}let r=class MqAppointmentCheckout extends o{constructor(){super(...arguments),this._provideSession=async t=>{const e=await t.payments.createPaymentLink({slot_id:this.slotId,service_id:this.serviceId,specialty_id:this.specialtyId,consultation_reason:this.consultationReason,discount_code:this.discountCode,preconsultation_documents:this.preconsultationDocuments});return{sessionId:e.session_id,paymentUrl:e.payment_link}},this._onSuccess=t=>{t.stopPropagation(),this.dispatchEvent(new AppointmentPaidEvent({appointmentId:t.detail.reference}))}}render(){return s`<mq-checkout env="${n(this.env)}" api-key="${this.apiKey}" token="${this.token}" locale="${this.locale}" .provideSession="${this._provideSession}" @payment-success="${this._onSuccess}"></mq-checkout>`}};t([i({type:String,attribute:"env"})],r.prototype,"env",void 0),t([i({type:String,attribute:"api-key"})],r.prototype,"apiKey",void 0),t([i({type:String,attribute:"token"})],r.prototype,"token",void 0),t([i({type:String,attribute:"locale",reflect:!0})],r.prototype,"locale",void 0),t([i({type:String,attribute:"slot-id"})],r.prototype,"slotId",void 0),t([i({type:String,attribute:"service-id"})],r.prototype,"serviceId",void 0),t([i({type:String,attribute:"specialty-id"})],r.prototype,"specialtyId",void 0),t([i({type:String,attribute:"consultation-reason"})],r.prototype,"consultationReason",void 0),t([i({type:String,attribute:"discount-code"})],r.prototype,"discountCode",void 0),t([i({attribute:!1})],r.prototype,"preconsultationDocuments",void 0),r=t([e("mq-appointment-checkout")],r);export{AppointmentPaidEvent,r as MqAppointmentCheckout};