@mediquo/elements 0.6.5 → 0.7.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 (118) hide show
  1. package/dist/chunks/action-unavailable-message-CzRDRmk9.js +1 -0
  2. package/dist/chunks/addSeconds-ofMnxlgT.js +1 -0
  3. package/dist/chunks/api-chat-client-BsiZ3A6g.js +1 -0
  4. package/dist/chunks/{apple-pay-outcomes-CnVRvAVS.js → apple-pay-outcomes-B4dOTOhL.js} +1 -1
  5. package/dist/chunks/{appointment-card-skeleton-1c7552Ln.d.ts → appointment-action-unavailable-dialog-ByWsZP0d.d.ts} +2 -86
  6. package/dist/chunks/appointment-card-skeleton-CwIuoOXV.js +1 -0
  7. package/dist/chunks/appointment-card-skeleton-DRWT9q2U.d.ts +91 -0
  8. package/dist/chunks/appointment-details-D7Rw3Hyl.js +1 -0
  9. package/dist/chunks/blob-to-base64-CUL1trde.js +1 -0
  10. package/dist/chunks/{context-consumer-ESdICVAb.js → chunk-6CCJWPGL-DlOpbEYH.js} +1 -1
  11. package/dist/chunks/chunk-BUV4MGML-Bn3JWCAv.js +1 -0
  12. package/dist/chunks/chunk-Y4EKUX25-CqL3lLdx.js +1 -0
  13. package/dist/chunks/consume-BhoQNO_8.js +1 -0
  14. package/dist/chunks/document.model.d-DIzMiOmd.d.ts +6 -0
  15. package/dist/chunks/documentation-view-Mqdp7yKi.js +1 -0
  16. package/dist/chunks/get-appointment-query-lJe75hGS.js +1 -0
  17. package/dist/chunks/get-organization-setup-query-DxHNY0w8.js +1 -0
  18. package/dist/chunks/get-patient-documents-query-D1SfC_k_.js +1 -0
  19. package/dist/chunks/get-patient-profile-query-DiU2f_QH.js +1 -0
  20. package/dist/chunks/get-schedule-services-query-Ckvz9Fqh.js +1 -0
  21. package/dist/chunks/i18n-formats-EgnwLxKt.js +1 -0
  22. package/dist/chunks/index-63zQSBy4.js +1 -0
  23. package/dist/chunks/index-CDBk7hVW.d.ts +28 -0
  24. package/dist/chunks/{index-DNUbmrQl.d.ts → index-CSJzkkRA.d.ts} +1 -4
  25. package/dist/chunks/index-CatvNhwL.js +1 -0
  26. package/dist/chunks/index-DZjrAnPq.js +1 -0
  27. package/dist/chunks/{index-DhfVmF4C.js → index-m_sTPA-8.js} +1 -1
  28. package/dist/chunks/price-DU3YLTpk.js +1 -0
  29. package/dist/chunks/query-controller-D7jBX4X7.js +1 -0
  30. package/dist/chunks/refund-cancel-policy-qaBi5AHH.js +1 -0
  31. package/dist/chunks/{schemas.d-5LR6aN9I.d.ts → schemas.d-D7bCe24u.d.ts} +20 -20
  32. package/dist/chunks/telemetry-client-Bkbn48Dd.js +1 -0
  33. package/dist/env.js +1 -1
  34. package/dist/mq-apple-pay-checkout.js +1 -1
  35. package/dist/mq-appointment-checkout.js +1 -1
  36. package/dist/mq-appointment-documentation.d.ts +2 -1
  37. package/dist/mq-appointment-documentation.js +1 -1
  38. package/dist/mq-chat-room.js +1 -1
  39. package/dist/mq-checkout.js +1 -1
  40. package/dist/mq-dashboard.d.ts +16 -6
  41. package/dist/mq-dashboard.js +1 -1
  42. package/dist/mq-documents.d.ts +2 -1
  43. package/dist/mq-documents.js +1 -1
  44. package/dist/mq-google-pay-checkout.js +1 -1
  45. package/dist/mq-immediate-videocall-checkout.js +1 -1
  46. package/dist/mq-my-appointments.d.ts +6 -5
  47. package/dist/mq-my-appointments.js +1 -1
  48. package/dist/mq-next-appointments.d.ts +88 -0
  49. package/dist/mq-next-appointments.js +1 -0
  50. package/dist/mq-payment-poller.js +1 -1
  51. package/dist/mq-professional-presence-sync.js +1 -1
  52. package/dist/mq-recent-documents.d.ts +60 -0
  53. package/dist/mq-recent-documents.js +1 -0
  54. package/dist/mq-schedule-success.js +2 -2
  55. package/dist/mq-schedule.d.ts +8 -9
  56. package/dist/mq-schedule.js +1 -1
  57. package/dist/mq-session-provider.d.ts +1 -1
  58. package/dist/mq-support-chat.js +1 -1
  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 +2 -1
  62. package/dist/mq-videocall.js +1 -1
  63. package/dist/react/mq-apple-pay-checkout.js +1 -1
  64. package/dist/react/mq-appointment-checkout.js +1 -1
  65. package/dist/react/mq-appointment-documentation.d.ts +2 -1
  66. package/dist/react/mq-appointment-documentation.js +1 -1
  67. package/dist/react/mq-chat-room.js +1 -1
  68. package/dist/react/mq-checkout.js +1 -1
  69. package/dist/react/mq-dashboard.d.ts +8 -6
  70. package/dist/react/mq-dashboard.js +1 -1
  71. package/dist/react/mq-documents-page.d.ts +2 -1
  72. package/dist/react/mq-documents-page.js +1 -1
  73. package/dist/react/mq-documents.d.ts +2 -1
  74. package/dist/react/mq-documents.js +1 -1
  75. package/dist/react/mq-google-pay-checkout.js +1 -1
  76. package/dist/react/mq-immediate-videocall-checkout.js +1 -1
  77. package/dist/react/mq-my-appointments.d.ts +7 -6
  78. package/dist/react/mq-my-appointments.js +1 -1
  79. package/dist/react/mq-next-appointments.d.ts +38 -0
  80. package/dist/react/mq-next-appointments.js +2 -0
  81. package/dist/react/mq-payment-poller.js +1 -1
  82. package/dist/react/mq-professional-presence-sync.js +1 -1
  83. package/dist/react/mq-recent-documents.d.ts +27 -0
  84. package/dist/react/mq-recent-documents.js +2 -0
  85. package/dist/react/mq-schedule-success.js +1 -1
  86. package/dist/react/mq-schedule.d.ts +3 -3
  87. package/dist/react/mq-schedule.js +1 -1
  88. package/dist/react/mq-session-provider.d.ts +1 -1
  89. package/dist/react/mq-support-chat.js +1 -1
  90. package/dist/react/mq-terms-and-conditions.js +1 -1
  91. package/dist/react/mq-unread-count-sync.js +1 -1
  92. package/dist/react/mq-videocall.d.ts +2 -1
  93. package/dist/react/mq-videocall.js +1 -1
  94. package/dist/theme.d.ts +8 -0
  95. package/dist/theme.js +1 -1
  96. package/dist/ui/icons/arrow-right-icon.d.ts +6 -0
  97. package/dist/ui/icons/arrow-right-icon.js +1 -0
  98. package/dist/ui/icons/dots-horizontal-icon.d.ts +6 -0
  99. package/dist/ui/icons/dots-horizontal-icon.js +1 -0
  100. package/dist/ui/mq-clamped-text.js +1 -1
  101. package/package.json +9 -1
  102. package/dist/chunks/api-chat-client-BBL1U9EQ.js +0 -1
  103. package/dist/chunks/appointment-card-skeleton-C8VERHzq.js +0 -1
  104. package/dist/chunks/chunk-GZF3YFSX-DM-GTqxg.js +0 -1
  105. package/dist/chunks/chunk-YMQSBQHL-De_r7BNk.js +0 -1
  106. package/dist/chunks/consume-CovVqBjI.js +0 -1
  107. package/dist/chunks/documentation-view-DJCr5_MN.js +0 -1
  108. package/dist/chunks/get-appointment-query-Ck68BEMg.js +0 -1
  109. package/dist/chunks/get-organization-setup-query-BMbuRi6v.js +0 -1
  110. package/dist/chunks/get-patient-documents-query-DIQH-TMM.js +0 -1
  111. package/dist/chunks/get-patient-profile-query-B0tUDJmT.js +0 -1
  112. package/dist/chunks/i18n-formats-DYS91YEa.js +0 -1
  113. package/dist/chunks/index-KvIw19qY.js +0 -1
  114. package/dist/chunks/index-ShXzd7UZ.js +0 -1
  115. package/dist/chunks/price-LTnCz9kN.js +0 -1
  116. package/dist/chunks/query-controller-BlO1Ax65.js +0 -1
  117. package/dist/chunks/refund-cancel-policy-CXFTrFfo.js +0 -1
  118. package/dist/chunks/telemetry-client-BLJVs9me.js +0 -1
@@ -1 +1 @@
1
- import{_ as e,c as s}from"./chunks/custom-element-D2ziPxYE.js";import{a as t,E as n}from"./chunks/lit-element-DiWJYFwC.js";import{s as r}from"./chunks/context-consumer-ESdICVAb.js";import{Q as c}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{S as o,a as i}from"./chunks/chunk-YTQUGGS3-DmCGIoFy.js";import{g as a}from"./chunks/chunk-YMQSBQHL-De_r7BNk.js";import{g as h,a as l}from"./chunks/api-chat-client-BBL1U9EQ.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/external-CJj32K_p.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";class ProfessionalPresenceSyncController{constructor(e){this.host=e,this.clearTimers=new Map,this._onAbsenceCreated=e=>{if(!e?.professional_hash||!e.finishes_at)return;const{professional_hash:s,id:t,finishes_at:n}=e;this._setActiveAbsence(s,{id:t,finishes_at:n}),this._clearTimer(s);const r=h(n).getTime()-Date.now();r>0&&r<2147483647&&this.clearTimers.set(s,setTimeout(()=>{this.clearTimers.delete(s),this._setActiveAbsence(s,null)},r))},this._onAbsenceCancelled=e=>{e?.professional_hash&&(this._clearTimer(e.professional_hash),this._setActiveAbsence(e.professional_hash,null))},new r(this.host,{context:o,subscribe:!0,callback:e=>{e&&e!==this.socket&&(this.socket=e,this.socket.on(i.absence_created,this._onAbsenceCreated),this.socket.on(i.absence_cancelled,this._onAbsenceCancelled))}}),new r(this.host,{context:c,subscribe:!0,callback:e=>{e&&(this.queryClient=e)}}),this.host.addController(this)}_queryKey(e){return a(l,{hash:e}).queryKey}_setActiveAbsence(e,s){this.queryClient?.setQueryData(this._queryKey(e),e=>e?{...e,active_absence:s}:void 0)}_clearTimer(e){const s=this.clearTimers.get(e);s&&(clearTimeout(s),this.clearTimers.delete(e))}hostConnected(){}hostDisconnected(){this.socket?.off(i.absence_created,this._onAbsenceCreated),this.socket?.off(i.absence_cancelled,this._onAbsenceCancelled);for(const e of this.clearTimers.values())clearTimeout(e);this.clearTimers.clear()}}let m=class MqProfessionalPresenceSync extends t{constructor(){super(...arguments),this._controller=new ProfessionalPresenceSyncController(this)}createRenderRoot(){return this}render(){return n}};m=e([s("mq-professional-presence-sync")],m);export{m as MqProfessionalPresenceSync,ProfessionalPresenceSyncController};
1
+ import{_ as e,c as s}from"./chunks/custom-element-D2ziPxYE.js";import{a as t,E as n}from"./chunks/lit-element-DiWJYFwC.js";import{a as r}from"./chunks/chunk-6CCJWPGL-DlOpbEYH.js";import{Q as c}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{S as o,a as i}from"./chunks/chunk-YTQUGGS3-DmCGIoFy.js";import{g as a}from"./chunks/chunk-BUV4MGML-Bn3JWCAv.js";import{b as h,a as l}from"./chunks/api-chat-client-BsiZ3A6g.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/external-CJj32K_p.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";class ProfessionalPresenceSyncController{constructor(e){this.host=e,this.clearTimers=new Map,this._onAbsenceCreated=e=>{if(!e?.professional_hash||!e.finishes_at)return;const{professional_hash:s,id:t,finishes_at:n}=e;this._setActiveAbsence(s,{id:t,finishes_at:n}),this._clearTimer(s);const r=h(n).getTime()-Date.now();r>0&&r<2147483647&&this.clearTimers.set(s,setTimeout(()=>{this.clearTimers.delete(s),this._setActiveAbsence(s,null)},r))},this._onAbsenceCancelled=e=>{e?.professional_hash&&(this._clearTimer(e.professional_hash),this._setActiveAbsence(e.professional_hash,null))},new r(this.host,{context:o,subscribe:!0,callback:e=>{e&&e!==this.socket&&(this.socket=e,this.socket.on(i.absence_created,this._onAbsenceCreated),this.socket.on(i.absence_cancelled,this._onAbsenceCancelled))}}),new r(this.host,{context:c,subscribe:!0,callback:e=>{e&&(this.queryClient=e)}}),this.host.addController(this)}_queryKey(e){return a(l,{hash:e}).queryKey}_setActiveAbsence(e,s){this.queryClient?.setQueryData(this._queryKey(e),e=>e?{...e,active_absence:s}:void 0)}_clearTimer(e){const s=this.clearTimers.get(e);s&&(clearTimeout(s),this.clearTimers.delete(e))}hostConnected(){}hostDisconnected(){this.socket?.off(i.absence_created,this._onAbsenceCreated),this.socket?.off(i.absence_cancelled,this._onAbsenceCancelled);for(const e of this.clearTimers.values())clearTimeout(e);this.clearTimers.clear()}}let m=class MqProfessionalPresenceSync extends t{constructor(){super(...arguments),this._controller=new ProfessionalPresenceSyncController(this)}createRenderRoot(){return this}render(){return n}};m=e([s("mq-professional-presence-sync")],m);export{m as MqProfessionalPresenceSync,ProfessionalPresenceSyncController};
@@ -0,0 +1,60 @@
1
+ import * as lit_html from 'lit-html';
2
+ import * as lit from 'lit';
3
+ import { LitElement, PropertyValues } from 'lit';
4
+ import { Env } from './env.js';
5
+ import './chunks/index-CDBk7hVW.js';
6
+ import './ui/mq-skeleton.js';
7
+ import { D as DocumentType } from './chunks/document.model.d-DIzMiOmd.js';
8
+ import './ui/mq-button.js';
9
+ export { DownloadFileEvent, MqViewDocumentsEvent } from './events.js';
10
+ import 'zod';
11
+
12
+ declare class RecentDocumentRow extends LitElement {
13
+ static styles: lit.CSSResult;
14
+ documentId: string;
15
+ kind: DocumentType;
16
+ name: string;
17
+ specialty: string;
18
+ date: string;
19
+ downloadUrl: string;
20
+ patientHash: string;
21
+ private isDownloading;
22
+ private formatDate;
23
+ private formatKind;
24
+ private get kindClass();
25
+ private get metaLine();
26
+ private handleDownload;
27
+ render(): lit_html.TemplateResult<1>;
28
+ }
29
+ declare global {
30
+ interface HTMLElementTagNameMap {
31
+ "recent-document-row": RecentDocumentRow;
32
+ }
33
+ }
34
+
35
+ declare class MqRecentDocuments extends LitElement {
36
+ static styles: lit.CSSResult;
37
+ apiKey?: string;
38
+ token?: string;
39
+ locale?: string;
40
+ env?: Env;
41
+ protected willUpdate(changed: PropertyValues<this>): void;
42
+ private loginToken?;
43
+ private getPatientProfileQuery;
44
+ private get patientHash();
45
+ private getPatientDocumentsQuery;
46
+ private getOrganizationSpecialtiesQuery;
47
+ private get isEmpty();
48
+ protected updated(): void;
49
+ private specialtyNameOf;
50
+ private handleViewAll;
51
+ private renderDocuments;
52
+ render(): lit_html.TemplateResult<1>;
53
+ }
54
+ declare global {
55
+ interface HTMLElementTagNameMap {
56
+ "mq-recent-documents": MqRecentDocuments;
57
+ }
58
+ }
59
+
60
+ export { MqRecentDocuments };
@@ -0,0 +1 @@
1
+ import{getLocale as t,isValidLocale as e,setLocale as i,initLocalization as o}from"./i18n.js";import{_ as s,c as n}from"./chunks/custom-element-D2ziPxYE.js";import{c as r}from"./chunks/consume-BhoQNO_8.js";import{m as a}from"./chunks/runtime-Bg1WXVCx.js";import{l as c}from"./chunks/localized-decorator-BlOuLhym.js";import{Q as d}from"./chunks/query-controller-D7jBX4X7.js";import{l}from"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import{g as p,a as m}from"./chunks/i18n-formats-EgnwLxKt.js";import{g as h}from"./chunks/get-patient-documents-query-D1SfC_k_.js";import{g as u}from"./chunks/get-patient-profile-query-DiU2f_QH.js";import{t as g,j as f,r as y}from"./chunks/telemetry-client-Bkbn48Dd.js";import{i as v,a as k,x as b,E as w}from"./chunks/lit-element-DiWJYFwC.js";import{n as x}from"./chunks/property-scuRaFcM.js";import{setEnv as j}from"./env.js";import{DownloadFileEvent as $,MqViewDocumentsEvent as D}from"./events.js";import{a as q,D as S}from"./chunks/api-chat-client-BsiZ3A6g.js";import"./chunks/index-DZjrAnPq.js";import"./ui/mq-skeleton.js";import{b as z}from"./chunks/blob-to-base64-CUL1trde.js";import{r as H}from"./chunks/state-LQivXIgA.js";import{downloadIcon as N}from"./ui/icons/download-icon.js";import"./ui/mq-button.js";import{toast as T}from"./ui/mq-toast.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/external-CJj32K_p.js";import"./chunks/chunk-6CCJWPGL-DlOpbEYH.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/query-Cjvi4_dT.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./ui/icons/calendar-icon.js";import"./ui/icons/types.js";import"./ui/icons/file-icon.js";import"./ui/icons/arrow-right-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/class-map-Co76I6aw.js";const I=v`: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,#3c50ec)}.tag.report{background-color:var(--color-feedback--warning-subtle,#ffebce);color:var(--color-feedback--warning-text,#b45309)}.tag.diagnostic-test-prescription{background-color:var(--color-feedback--success-subtle,#e8f6ec);color:var(--color-feedback--success-text,#1b7a3d)}.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 P=class RecentDocumentRow extends k{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{g.track(f(this.patientHash,this.documentId));const t=await q.flash.downloadDocument({url:this.downloadUrl}),e=await z(t);this.dispatchEvent(new $({url:e,filename:`${this.name}.pdf`}))}catch{T.error(a("No hemos podido descargar el documento."))}finally{this.isDownloading=!1}}}static{this.styles=I}formatDate(){const e=new Date(this.date);if(Number.isNaN(e.getTime()))return"";const i=t().replace("_","-");return new Intl.DateTimeFormat(i,{day:"2-digit",month:"2-digit",year:"2-digit"}).format(e)}formatKind(){switch(this.kind){case S.prescription:return a("Receta");case S.report:return a("Informe");case S.diagnosticTestPrescription:return a("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 b`<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="${a("Descargar documento")}" ?disabled="${this.isDownloading}" @click="${this.handleDownload}">${N({size:24})}</mq-button>`}};s([x({type:String})],P.prototype,"documentId",void 0),s([x({type:String})],P.prototype,"kind",void 0),s([x({type:String})],P.prototype,"name",void 0),s([x({type:String})],P.prototype,"specialty",void 0),s([x({type:String})],P.prototype,"date",void 0),s([x({type:String})],P.prototype,"downloadUrl",void 0),s([x({type:String})],P.prototype,"patientHash",void 0),s([H()],P.prototype,"isDownloading",void 0),P=s([c(),n("recent-document-row")],P);const Q=v`: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;justify-content:flex-start}.card{display:flex;flex-direction:column;justify-content:center;gap:var(--sp-3);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-recent-documents-radius,12px);padding:var(--mq-recent-documents-padding,var(--sp-6))}.divider{height:1px;width:100%;background-color:var(--color-border-subtle,#edecf1);flex-shrink:0}`;let _=class MqRecentDocuments extends k{constructor(){super(...arguments),this.getPatientProfileQuery=new d(this,()=>u(q,{enabled:!this.loginToken})),this.getPatientDocumentsQuery=new d(this,()=>({...h(q,{patient_hash:this.patientHash,page:1,per_page:3}),enabled:!!this.patientHash})),this.getOrganizationSpecialtiesQuery=new d(this,()=>p(q)),this.handleViewAll=()=>{g.track(y(this.patientHash)),this.dispatchEvent(new D)}}static{this.styles=Q}willUpdate(t){t.has("env")&&this.env&&j(this.env),t.has("apiKey")&&this.apiKey&&q.setApiKey(this.apiKey),t.has("token")&&this.token&&q.setAuthToken(this.token),t.has("locale")&&this.locale&&e(this.locale)&&(i(this.locale),q.setLanguage(this.locale))}get patientHash(){return this.loginToken?.patient.hash??this.getPatientProfileQuery.result?.data?.hash??""}get isEmpty(){const t=this.getPatientDocumentsQuery.result;return!0===t?.isSuccess&&0===(t.data?.data?.length??0)}updated(){this.toggleAttribute("empty",this.isEmpty)}specialtyNameOf(e){const i=this.getOrganizationSpecialtiesQuery.result?.data?.find(t=>Number(t.id)===Number(e));return m(i?.code??"",t(),i?.name)}renderDocuments(){return this.getPatientDocumentsQuery.render({complete:t=>0===t.data.length?b`<home-widget-empty-state icon="document" heading="${a("No tienes documentación")}" description="${a("Aquí se mostrarán tus recetas e informes médicos.")}"></home-widget-empty-state>`:b`${t.data.map((e,i)=>b`<recent-document-row documentId="${e.document_id}" kind="${e.document_type}" name="${e.name}" specialty="${this.specialtyNameOf(e.professional.speciality_id)}" date="${e.created_at}" downloadUrl="${e.url}" patientHash="${this.patientHash}"></recent-document-row>${i<t.data.length-1?b`<div class="divider"></div>`:w}`)}`,pending:()=>b`<mq-skeleton height="69px"></mq-skeleton><div class="divider"></div><mq-skeleton height="69px"></mq-skeleton><div class="divider"></div><mq-skeleton height="69px"></mq-skeleton>`,error:()=>b`<home-widget-empty-state icon="document" heading="${a("No hemos podido cargar tu documentación")}" description="${a("Vuelve a intentarlo en unos minutos.")}"></home-widget-empty-state>`})}render(){return b`<section-header heading="${a("Documentos recientes")}" action-label="${a("Ver todas")}" @section-action="${this.handleViewAll}"></section-header><div class="card">${this.renderDocuments()}</div>`}};s([x({type:String,attribute:"api-key"})],_.prototype,"apiKey",void 0),s([x({type:String,attribute:"token"})],_.prototype,"token",void 0),s([x({type:String,attribute:"locale"})],_.prototype,"locale",void 0),s([x({type:String,attribute:"env"})],_.prototype,"env",void 0),s([r({context:l,subscribe:!0})],_.prototype,"loginToken",void 0),_=s([c(),n("mq-recent-documents")],_),o();export{$ as DownloadFileEvent,_ as MqRecentDocuments,D as MqViewDocumentsEvent};
@@ -1,4 +1,4 @@
1
- import{isValidLocale as t,setLocale as e,getLocale as i,initLocalization as o}from"./i18n.js";import{_ as n,c as a}from"./chunks/custom-element-D2ziPxYE.js";import{m as s,s as r}from"./chunks/runtime-Bg1WXVCx.js";import{l as c}from"./chunks/localized-decorator-BlOuLhym.js";import{i as p,a as l,x as d,E as m}from"./chunks/lit-element-DiWJYFwC.js";import{n as u}from"./chunks/property-scuRaFcM.js";import{r as h}from"./chunks/state-LQivXIgA.js";import{setEnv as v}from"./env.js";import{MqViewAppointmentsEvent as g,MqHomeEvent as f}from"./events.js";import{a as k,A as y,g as b,C as x}from"./chunks/api-chat-client-BBL1U9EQ.js";import{checkIcon as j}from"./ui/icons/check-icon.js";import"./ui/mq-callout.js";import"./ui/mq-button.js";import{c as w}from"./chunks/consume-CovVqBjI.js";import{l as $}from"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import"./chunks/professional-overview-C4H_znIJ.js";import{f as q}from"./chunks/price-LTnCz9kN.js";import{Q as C}from"./chunks/query-controller-BlO1Ax65.js";import{g as _}from"./chunks/get-appointment-query-Ck68BEMg.js";import{g as S}from"./chunks/get-organization-setup-query-BMbuRi6v.js";import{g as z}from"./chunks/get-patient-profile-query-B0tUDJmT.js";import{g as I}from"./chunks/chunk-GZF3YFSX-DM-GTqxg.js";import{calendarIcon as O}from"./ui/icons/calendar-icon.js";import{chatbubbleIcon as Q}from"./ui/icons/chat-bubble-icon.js";import{videoIcon as A}from"./ui/icons/video-icon.js";import"./mq-chat-room.js";import"./ui/mq-floating-bubble.js";import"./ui/mq-unread-badge.js";import{g as T,a as P}from"./chunks/i18n-formats-DYS91YEa.js";import"./ui/mq-skeleton.js";import"./ui/mq-card.js";import{Q as E}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{t as N,e as V,a as F,f as H,g as B,h as G}from"./chunks/telemetry-client-BLJVs9me.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/external-CJj32K_p.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./ui/icons/types.js";import"./ui/icons/info-circle-outine-icon.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/if-defined-BYeVdwgd.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./ui/icons/chevron-down-icon.js";import"./ui/mq-text-button.js";import"./ui/mq-avatar.js";import"./ui/icons/briefcase-icon.js";import"./ui/icons/clock-icon.js";import"./ui/icons/message-bubble-icon.js";import"./ui/icons/phone-icon.js";import"./chunks/query-Cjvi4_dT.js";import"./chunks/provide-D2fnEhT2.js";import"./chunks/context-provider--AKuwfs9.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./chunks/chunk-YMQSBQHL-De_r7BNk.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./ui/icons/check-double-icon.js";import"./chunks/chunk-YTQUGGS3-DmCGIoFy.js";import"./chunks/mutation-controller-CR2qcqhH.js";import"./chunks/style-map-CIdqdn7C.js";const K=p`header{padding:var(--sp-6) var(--sp-4);display:flex;align-items:center;gap:var(--sp-2);max-width:var(--content-max-width);margin:0 auto}.summary{padding:var(--sp-6) var(--sp-4);background-color:var(--color-neutrals-background-weak);max-width:var(--content-max-width);margin:0 auto}.summary-content{display:flex;flex-direction:column;gap:var(--sp-4)}.manage-appointment{box-sizing:border-box;max-width:var(--content-max-width);margin:0 auto}`;let M=class MqScheduleSuccessSkeleton extends l{static{this.styles=K}render(){return d`<div><header><mq-skeleton width="220px" height="40px" border-radius="md"></mq-skeleton></header><div class="summary"><div class="summary-content"><mq-skeleton width="280px" height="32px" border-radius="md"></mq-skeleton><mq-skeleton width="100%" height="400px" border-radius="lg"></mq-skeleton><mq-skeleton width="100%" height="80px" border-radius="lg"></mq-skeleton></div></div><div class="manage-appointment"><mq-skeleton width="100%" height="313px" border-radius="lg"></mq-skeleton></div></div>`}};M=n([a("mq-schedule-success-skeleton")],M);const R=p`.success-title{display:flex;align-items:center;gap:var(--sp-2);margin-bottom:var(--sp-4)}header h1{font-family:var(--font-titles);font-size:var(--text-3xl);line-height:var(--text-3xl--line-height);font-weight:var(--font-weight-bold);margin:0}h2{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0;margin-bottom:var(--sp-6)}.summary{padding:var(--sp-6) var(--sp-4)}.professional-card{padding:var(--sp-4)}.appointment-summary{margin-bottom:var(--sp-2);display:flex;flex-direction:column;gap:var(--sp-4)}.add-to-calendar-container{padding-top:var(--sp-4);border-top:1px solid var(--color-neutrals-border-disabled)}.price-breakdown{display:flex;flex-direction:column;gap:var(--sp-2)}.price-row{display:flex;justify-content:space-between;gap:var(--sp-4);font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-default)}.price-row--total{font-weight:var(--font-weight-semibold)}.price-breakdown hr{width:100%;border:none;border-top:1px solid var(--color-neutrals-border-disabled);margin:var(--sp-1) 0}.floating-content{height:100%}.actions{display:flex;flex-direction:column;gap:var(--sp-4)}@media (min-width:768px){.actions{flex-direction:row}}.footer-cta{margin-top:var(--sp-4);padding:var(--sp-6) var(--sp-4)}.footer-cta h2{margin-bottom:var(--sp-2)}.footer-cta .description{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-default);margin:0 0 var(--sp-6)}.footer-cta .actions{display:flex;flex-direction:column;gap:var(--sp-3)}`;class OpenVideocallEvent extends Event{static{this.eventName="open-videocall"}constructor(t){super(OpenVideocallEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}let U=class MqScheduleSuccess extends l{constructor(){super(...arguments),this.kind="schedule",this.showNavCtas=!1,this._trackedPageView=!1,this.getPatientProfileQuery=new C(this,()=>z(k)),this.getAppointmentQuery=new C(this,()=>_(k,{id:this.appointmentId})),this.getCouponQuery=new C(this,()=>{return t=k,e={appointmentId:this.appointmentId},i={enabled:!!this.appointmentId},{queryKey:["appointment-consultation-coupon",e.appointmentId],queryFn:()=>t.payments.getAppointmentConsultationCoupon(e.appointmentId),retry:!1,...i};var t,e,i}),this.getOrganizationSpecialtiesQuery=new C(this,()=>T(k)),this.getOrganizationSetupQuery=new C(this,()=>S(k)),this.isChatOpen=!1,this.unreadQuery=new C(this,()=>I(k,{roomId:Number(this.getAppointmentQuery.result?.data?.room_id)},{enabled:!!this.getAppointmentQuery.result?.data?.room_id})),this._getCalloutText=t=>{switch(t.channel){case y.videocall:return s("Te enviaremos un enlace al email indicado cuando sea el momento de conectarte a la vídeoconsulta. Asegúrate de tener buena conexión a internet y un dispositivo con cámara y micrófono.");case y.phonecall:return s(r`El profesional te llamará al
1
+ import{isValidLocale as t,setLocale as e,getLocale as i,initLocalization as o}from"./i18n.js";import{_ as n,c as a}from"./chunks/custom-element-D2ziPxYE.js";import{m as s,s as r}from"./chunks/runtime-Bg1WXVCx.js";import{l as c}from"./chunks/localized-decorator-BlOuLhym.js";import{i as p,a as l,x as d,E as m}from"./chunks/lit-element-DiWJYFwC.js";import{n as u}from"./chunks/property-scuRaFcM.js";import{r as h}from"./chunks/state-LQivXIgA.js";import{setEnv as v}from"./env.js";import{MqViewAppointmentsEvent as g,MqHomeEvent as f}from"./events.js";import{a as k,A as b,b as y,C as j}from"./chunks/api-chat-client-BsiZ3A6g.js";import{checkIcon as x}from"./ui/icons/check-icon.js";import"./ui/mq-callout.js";import"./ui/mq-button.js";import{c as w}from"./chunks/consume-BhoQNO_8.js";import{l as $}from"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import"./chunks/professional-overview-C4H_znIJ.js";import"./chunks/appointment-details-D7Rw3Hyl.js";import{Q as q}from"./chunks/query-controller-D7jBX4X7.js";import{s as C}from"./chunks/chunk-6CCJWPGL-DlOpbEYH.js";import{g as _}from"./chunks/get-appointment-query-lJe75hGS.js";import{g as z}from"./chunks/get-organization-setup-query-DxHNY0w8.js";import{g as S}from"./chunks/get-patient-profile-query-DiU2f_QH.js";import{g as I}from"./chunks/chunk-Y4EKUX25-CqL3lLdx.js";import{calendarIcon as A}from"./ui/icons/calendar-icon.js";import{chatbubbleIcon as O}from"./ui/icons/chat-bubble-icon.js";import{videoIcon as Q}from"./ui/icons/video-icon.js";import"./mq-chat-room.js";import"./ui/mq-floating-bubble.js";import"./ui/mq-unread-badge.js";import{g as T,a as P}from"./chunks/i18n-formats-EgnwLxKt.js";import{f as E}from"./chunks/price-DU3YLTpk.js";import"./ui/mq-skeleton.js";import"./ui/mq-card.js";import{Q as N}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{t as V,k as H,l as B,m as G,n as K}from"./chunks/telemetry-client-Bkbn48Dd.js";import{a as U}from"./chunks/addSeconds-ofMnxlgT.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/external-CJj32K_p.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./ui/icons/types.js";import"./ui/icons/info-circle-outine-icon.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/if-defined-BYeVdwgd.js";import"./chunks/create-context-DqP79qjF.js";import"./ui/icons/chevron-down-icon.js";import"./ui/mq-text-button.js";import"./ui/mq-avatar.js";import"./ui/icons/briefcase-icon.js";import"./ui/icons/clock-icon.js";import"./ui/icons/message-bubble-icon.js";import"./ui/icons/phone-icon.js";import"./chunks/query-Cjvi4_dT.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/provide-D2fnEhT2.js";import"./chunks/context-provider--AKuwfs9.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./chunks/chunk-BUV4MGML-Bn3JWCAv.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./ui/icons/check-double-icon.js";import"./chunks/chunk-YTQUGGS3-DmCGIoFy.js";import"./chunks/mutation-controller-CR2qcqhH.js";import"./chunks/style-map-CIdqdn7C.js";const M=p`header{padding:var(--sp-6) var(--sp-4);display:flex;align-items:center;gap:var(--sp-2);max-width:var(--content-max-width);margin:0 auto}.summary{padding:var(--sp-6) var(--sp-4);background-color:var(--color-neutrals-background-weak);max-width:var(--content-max-width);margin:0 auto}.summary-content{display:flex;flex-direction:column;gap:var(--sp-4)}.manage-appointment{box-sizing:border-box;max-width:var(--content-max-width);margin:0 auto}`;let R=class MqScheduleSuccessSkeleton extends l{static{this.styles=M}render(){return d`<div><header><mq-skeleton width="220px" height="40px" border-radius="md"></mq-skeleton></header><div class="summary"><div class="summary-content"><mq-skeleton width="280px" height="32px" border-radius="md"></mq-skeleton><mq-skeleton width="100%" height="400px" border-radius="lg"></mq-skeleton><mq-skeleton width="100%" height="80px" border-radius="lg"></mq-skeleton></div></div><div class="manage-appointment"><mq-skeleton width="100%" height="313px" border-radius="lg"></mq-skeleton></div></div>`}};R=n([a("mq-schedule-success-skeleton")],R);const F=p`.success-title{display:flex;align-items:center;gap:var(--sp-2);margin-bottom:var(--sp-4)}header h1{font-family:var(--font-titles);font-size:var(--text-3xl);line-height:var(--text-3xl--line-height);font-weight:var(--font-weight-bold);margin:0}h2{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0;margin-bottom:var(--sp-6)}.summary{padding:var(--sp-6) var(--sp-4)}.professional-card{padding:var(--sp-4)}.appointment-summary{margin-bottom:var(--sp-2);display:flex;flex-direction:column;gap:var(--sp-4)}.add-to-calendar-container{padding-top:var(--sp-4);border-top:1px solid var(--color-neutrals-border-disabled)}.price-breakdown{display:flex;flex-direction:column;gap:var(--sp-2)}.price-row{display:flex;justify-content:space-between;gap:var(--sp-4);font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-default)}.price-row--total{font-weight:var(--font-weight-semibold)}.price-breakdown hr{width:100%;border:none;border-top:1px solid var(--color-neutrals-border-disabled);margin:var(--sp-1) 0}.floating-content{height:100%}.actions{display:flex;flex-direction:column;gap:var(--sp-4)}@media (min-width:768px){.actions{flex-direction:row}}.footer-cta{margin-top:var(--sp-4);padding:var(--sp-6) var(--sp-4)}.footer-cta h2{margin-bottom:var(--sp-2)}.footer-cta .description{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-default);margin:0 0 var(--sp-6)}.footer-cta .actions{display:flex;flex-direction:column;gap:var(--sp-3)}`;class OpenVideocallEvent extends Event{static{this.eventName="open-videocall"}constructor(t){super(OpenVideocallEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}let L=class MqScheduleSuccess extends l{constructor(){super(...arguments),this.kind="schedule",this.showNavCtas=!1,this._trackedPageView=!1,this.getPatientProfileQuery=new q(this,()=>S(k)),this.getAppointmentQuery=new q(this,()=>_(k,{id:this.appointmentId})),this.getCouponQuery=new q(this,()=>{return t=k,e={appointmentId:this.appointmentId},i={enabled:!!this.appointmentId},{queryKey:C(t,"appointment-consultation-coupon",e.appointmentId),queryFn:()=>t.payments.getAppointmentConsultationCoupon(e.appointmentId),retry:!1,...i};var t,e,i}),this.getOrganizationSpecialtiesQuery=new q(this,()=>T(k)),this.getOrganizationSetupQuery=new q(this,()=>z(k)),this.isChatOpen=!1,this.unreadQuery=new q(this,()=>I(k,{roomId:Number(this.getAppointmentQuery.result?.data?.room_id)},{enabled:!!this.getAppointmentQuery.result?.data?.room_id})),this._getCalloutText=t=>{switch(t.channel){case b.videocall:return s("Te enviaremos un enlace al email indicado cuando sea el momento de conectarte a la vídeoconsulta. Asegúrate de tener buena conexión a internet y un dispositivo con cámara y micrófono.");case b.phonecall:return s(r`El profesional te llamará al
2
2
  ${this.getPatientProfileQuery.result?.data?.profile.phone??""} en el horario
3
3
  seleccionado. Asegúrate de tener buena cobertura y poder atender en
4
- el horario elegido.`);case y.chat:return s("El profesional te enviará un mensaje para que podamos coordinar la cita. Asegúrate de tener buena cobertura y poder atender en el horario elegido.");default:return m}}}static{this.styles=R}get _accessToken(){return this.token??this.loginToken?.access_token}get _timezone(){return this.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}willUpdate(i){i.has("env")&&this.env&&v(this.env),i.has("apiKey")&&this.apiKey&&k.setApiKey(this.apiKey),i.has("token")&&this.token&&k.setAuthToken(this.token),i.has("locale")&&this.locale&&t(this.locale)&&(e(this.locale),k.setLanguage(this.locale))}get _patientHash(){return this.getPatientProfileQuery.result?.data?.hash??""}connectedCallback(){super.connectedCallback(),this.queryClientContext?.invalidateQueries()}updated(){!this._trackedPageView&&this._patientHash&&(this._trackedPageView=!0,N.track(V(this._patientHash,this.appointmentId)))}renderPriceBreakdown(t,e,i){const o=t.price;if(null==o||o<=0)return m;const n=t.currency??"EUR",a=t.discount_amount??0,r=a>0,c=o-a,p=this.getCouponQuery.result?.data,l=p?.name??p?.code,u=r?p?.percent_off??Math.round(a/o*100):0,h=l?`${s("Promoción")} ${l}`:s("Promoción");return d`<div class="price-breakdown"><div class="price-row"><span>${i}</span> <span>${q({amount:o,currency:n},e)}</span></div>${r?d`<div class="price-row"><span>${h} (-${u}%)</span> <span>${q({amount:-a,currency:n},e)}</span></div><hr><div class="price-row price-row--total"><span>${s("Total")}</span> <span>${q({amount:c,currency:n},e)}</span></div>`:m}</div>`}render(){return this.getAppointmentQuery.render({pending:()=>d`<mq-schedule-success-skeleton></mq-schedule-success-skeleton>`,complete:t=>{const e=i(),o=b(t.start_date),n=F(o,t.duration),a=this.getOrganizationSpecialtiesQuery.result?.data?.find(e=>e.id===Number(t.speciality_id)),c=P(a?.code??"",e,a?.name),p=t.channel===y.videocall,l=t.channel===y.phonecall,u=!0===this.getOrganizationSetupQuery.result?.data?.appointments?.has_chat_in_appointment,h=(p||l)&&u,v=this._accessToken;return d`<div><header><div class="success-title">${j()}<h1>${"schedule"===this.kind?s("Cita confirmada"):s("Cita modificada")}</h1></div><h2>${s(r`Resumen de la cita para ${t?.to?.name??""}`)}</h2></header><mq-card class="summary" roundness="md"><div class="appointment-summary"><professional-overview .name="${t.from.name??""}" .specialtyName="${c}" .collegiateNumber="${t.from.collegiate_number??void 0}" .description="${t.from.description??""}" .languages="${t.from.languages??[]}" .avatar="${t.from.avatar??""}" always-expanded-on-desktop></professional-overview><appointment-details .startsAt="${o.toISOString()}" .duration="${t.duration}" .channel="${t.channel}" .timezone="${this._timezone}"></appointment-details>${this.renderPriceBreakdown(t,e,c||s("Consulta"))}<div class="add-to-calendar-container"><mq-text-button fontWeight="bold" size="sm" @click="${()=>{N.track(H(this._patientHash,this.appointmentId));const e=function({title:t,description:e,startsAt:i,endsAt:o}){const n=t=>t.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),a=n(i),s=n(o);return`https://www.google.com/calendar/render?${new URLSearchParams({action:"TEMPLATE",text:t,dates:`${a}/${s}`,...e&&{details:e}}).toString()}`}({title:s(r`Cita agendada de ${t.from.speciality??""}`),startsAt:o,endsAt:n,description:p&&t.consultation_short_url?s(r`Enlace a la cita: ${t.consultation_short_url}`):void 0});window.open(e,"_blank")}}">${O({size:24})} ${s("Añadir al calendario")}</mq-text-button></div>${h||p?d`<div class="actions">${h?d`<mq-button variant="primary" fullwidth size="md" @click="${()=>{N.track(B(this._patientHash,this.appointmentId)),this.isChatOpen=!this.isChatOpen}}">${Q({size:24})} ${s("Chatear con el profesional")} ${(this.unreadQuery.result?.data?.unread_count??0)>0?d`<mq-unread-badge></mq-unread-badge>`:m}</mq-button>`:m} ${p?d`<mq-button variant="outline" fullwidth size="md" @click="${()=>{N.track(G(this._patientHash,this.appointmentId)),this.dispatchEvent(new OpenVideocallEvent({appointmentId:this.appointmentId}))}}">${A({size:24})} ${s("Ir a videollamada")}</mq-button>`:m}</div>`:m}</div><mq-callout background="default" variant="info" ?noPadding="${!(h||p)}">${this._getCalloutText(t)}</mq-callout></mq-card>${this.showNavCtas?d`<mq-card class="footer-cta" roundness="md"><h2>${s("Tus citas")}</h2><p class="description">${s("Accede, modifica o anula tus citas.")}</p><div class="actions"><mq-button variant="primary" size="md" fullwidth @click="${()=>{this.dispatchEvent(new g({tab:"next"}))}}">${s("Ver mis citas")}</mq-button><mq-button variant="outline" size="md" fullwidth @click="${()=>{this.dispatchEvent(new f)}}">${s("Volver al inicio")}</mq-button></div></mq-card>`:m}</div><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen&&v?d`<div slot="content" class="floating-content"><mq-chat-room .consultationId="${t.id}" .consultationType="${x.appointment}" .token="${v}" .roomId="${Number(t.room_id)}" .professionalHash="${t.from.hash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}"></mq-chat-room></div>`:m}</mq-floating-bubble>`}})}};n([u({type:String})],U.prototype,"kind",void 0),n([u({type:String})],U.prototype,"appointmentId",void 0),n([u({type:String,attribute:"api-key"})],U.prototype,"apiKey",void 0),n([u({type:String,attribute:"token"})],U.prototype,"token",void 0),n([u({type:String,attribute:"timezone"})],U.prototype,"timezone",void 0),n([u({type:String,attribute:"locale"})],U.prototype,"locale",void 0),n([u({type:String,attribute:"env"})],U.prototype,"env",void 0),n([u({type:Boolean,attribute:"show-nav-ctas"})],U.prototype,"showNavCtas",void 0),n([w({context:E,subscribe:!0})],U.prototype,"queryClientContext",void 0),n([w({context:$})],U.prototype,"loginToken",void 0),n([h()],U.prototype,"isChatOpen",void 0),U=n([c(),a("mq-schedule-success")],U),o();export{U as MqScheduleSuccess,OpenVideocallEvent};
4
+ el horario elegido.`);case b.chat:return s("El profesional te enviará un mensaje para que podamos coordinar la cita. Asegúrate de tener buena cobertura y poder atender en el horario elegido.");default:return m}}}static{this.styles=F}get _accessToken(){return this.token??this.loginToken?.access_token}get _timezone(){return this.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}willUpdate(i){i.has("env")&&this.env&&v(this.env),i.has("apiKey")&&this.apiKey&&k.setApiKey(this.apiKey),i.has("token")&&this.token&&k.setAuthToken(this.token),i.has("locale")&&this.locale&&t(this.locale)&&(e(this.locale),k.setLanguage(this.locale))}get _patientHash(){return this.getPatientProfileQuery.result?.data?.hash??""}connectedCallback(){super.connectedCallback(),this.queryClientContext?.invalidateQueries()}updated(){!this._trackedPageView&&this._patientHash&&(this._trackedPageView=!0,V.track(H(this._patientHash,this.appointmentId)))}renderPriceBreakdown(t,e,i){const o=t.price;if(null==o||o<=0)return m;const n=t.currency??"EUR",a=t.discount_amount??0,r=a>0,c=o-a,p=this.getCouponQuery.result?.data,l=p?.name??p?.code,u=r?p?.percent_off??Math.round(a/o*100):0,h=l?`${s("Promoción")} ${l}`:s("Promoción");return d`<div class="price-breakdown"><div class="price-row"><span>${i}</span> <span>${E({amount:o,currency:n},e)}</span></div>${r?d`<div class="price-row"><span>${h} (-${u}%)</span> <span>${E({amount:-a,currency:n},e)}</span></div><hr><div class="price-row price-row--total"><span>${s("Total")}</span> <span>${E({amount:c,currency:n},e)}</span></div>`:m}</div>`}render(){return this.getAppointmentQuery.render({pending:()=>d`<mq-schedule-success-skeleton></mq-schedule-success-skeleton>`,complete:t=>{const e=i(),o=y(t.start_date),n=U(o,t.duration),a=this.getOrganizationSpecialtiesQuery.result?.data?.find(e=>e.id===Number(t.speciality_id)),c=P(a?.code??"",e,a?.name),p=t.channel===b.videocall,l=t.channel===b.phonecall,u=!0===this.getOrganizationSetupQuery.result?.data?.appointments?.has_chat_in_appointment,h=(p||l)&&u,v=this._accessToken;return d`<div><header><div class="success-title">${x()}<h1>${"schedule"===this.kind?s("Cita confirmada"):s("Cita modificada")}</h1></div><h2>${s(r`Resumen de la cita para ${t?.to?.name??""}`)}</h2></header><mq-card class="summary" roundness="md"><div class="appointment-summary"><professional-overview .name="${t.from.name??""}" .specialtyName="${c}" .collegiateNumber="${t.from.collegiate_number??void 0}" .description="${t.from.description??""}" .languages="${t.from.languages??[]}" .avatar="${t.from.avatar??""}" always-expanded-on-desktop></professional-overview><appointment-details .startsAt="${o.toISOString()}" .duration="${t.duration}" .channel="${t.channel}" .timezone="${this._timezone}"></appointment-details>${this.renderPriceBreakdown(t,e,c||s("Consulta"))}<div class="add-to-calendar-container"><mq-text-button fontWeight="bold" size="sm" @click="${()=>{V.track(B(this._patientHash,this.appointmentId));const e=function({title:t,description:e,startsAt:i,endsAt:o}){const n=t=>t.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),a=n(i),s=n(o);return`https://www.google.com/calendar/render?${new URLSearchParams({action:"TEMPLATE",text:t,dates:`${a}/${s}`,...e&&{details:e}}).toString()}`}({title:s(r`Cita agendada de ${t.from.speciality??""}`),startsAt:o,endsAt:n,description:p&&t.consultation_short_url?s(r`Enlace a la cita: ${t.consultation_short_url}`):void 0});window.open(e,"_blank")}}">${A({size:24})} ${s("Añadir al calendario")}</mq-text-button></div>${h||p?d`<div class="actions">${h?d`<mq-button variant="primary" fullwidth size="md" @click="${()=>{V.track(G(this._patientHash,this.appointmentId)),this.isChatOpen=!this.isChatOpen}}">${O({size:24})} ${s("Chatear con el profesional")} ${(this.unreadQuery.result?.data?.unread_count??0)>0?d`<mq-unread-badge></mq-unread-badge>`:m}</mq-button>`:m} ${p?d`<mq-button variant="outline" fullwidth size="md" @click="${()=>{V.track(K(this._patientHash,this.appointmentId)),this.dispatchEvent(new OpenVideocallEvent({appointmentId:this.appointmentId}))}}">${Q({size:24})} ${s("Ir a videollamada")}</mq-button>`:m}</div>`:m}</div><mq-callout background="default" variant="info" ?noPadding="${!(h||p)}">${this._getCalloutText(t)}</mq-callout></mq-card>${this.showNavCtas?d`<mq-card class="footer-cta" roundness="md"><h2>${s("Tus citas")}</h2><p class="description">${s("Accede, modifica o anula tus citas.")}</p><div class="actions"><mq-button variant="primary" size="md" fullwidth @click="${()=>{this.dispatchEvent(new g({tab:"next"}))}}">${s("Ver mis citas")}</mq-button><mq-button variant="outline" size="md" fullwidth @click="${()=>{this.dispatchEvent(new f)}}">${s("Volver al inicio")}</mq-button></div></mq-card>`:m}</div><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen&&v?d`<div slot="content" class="floating-content"><mq-chat-room .consultationId="${t.id}" .consultationType="${j.appointment}" .token="${v}" .roomId="${Number(t.room_id)}" .professionalHash="${t.from.hash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}"></mq-chat-room></div>`:m}</mq-floating-bubble>`}})}};n([u({type:String})],L.prototype,"kind",void 0),n([u({type:String})],L.prototype,"appointmentId",void 0),n([u({type:String,attribute:"api-key"})],L.prototype,"apiKey",void 0),n([u({type:String,attribute:"token"})],L.prototype,"token",void 0),n([u({type:String,attribute:"timezone"})],L.prototype,"timezone",void 0),n([u({type:String,attribute:"locale"})],L.prototype,"locale",void 0),n([u({type:String,attribute:"env"})],L.prototype,"env",void 0),n([u({type:Boolean,attribute:"show-nav-ctas"})],L.prototype,"showNavCtas",void 0),n([w({context:N,subscribe:!0})],L.prototype,"queryClientContext",void 0),n([w({context:$})],L.prototype,"loginToken",void 0),n([h()],L.prototype,"isChatOpen",void 0),L=n([c(),a("mq-schedule-success")],L),o();export{L as MqScheduleSuccess,OpenVideocallEvent};
@@ -1,8 +1,10 @@
1
- import * as lit_html from 'lit-html';
1
+ import * as lit_html_directive_js from 'lit-html/directive.js';
2
+ import * as lit_html_directives_keyed_js from 'lit-html/directives/keyed.js';
2
3
  import * as lit from 'lit';
3
4
  import { LitElement, PropertyValues, TemplateResult, nothing } from 'lit';
4
5
  import './ui/mq-button.js';
5
6
  import { Env } from './env.js';
7
+ import * as lit_html from 'lit-html';
6
8
  import { A as AppointmentChannel, a as Appointment } from './chunks/appointment.model.d-Dy50gMPg.js';
7
9
  import z, { z as z$1 } from 'zod';
8
10
  import './ui/mq-callout.js';
@@ -627,8 +629,8 @@ declare class PaymentStep extends LitElement {
627
629
  appliedDiscount: AppliedDiscount | null;
628
630
  bookingRequest: CreatePaymentLinkRequest | null;
629
631
  apiKey?: string;
630
- /** Raw integrator token for wallet checkout shells (URL fragment). */
631
- userToken?: string;
632
+ /** Session token, also sent as the wallet checkout shell URL fragment. */
633
+ token?: string;
632
634
  env: string;
633
635
  locale: string;
634
636
  countryCode: string;
@@ -949,11 +951,6 @@ declare class MqSchedule extends LitElement {
949
951
  locale?: string;
950
952
  /** Environment override ("development" | "production"). Optional. */
951
953
  env?: Env;
952
- /**
953
- * Raw integrator user token for Apple Pay checkout URLs (fragment). Distinct
954
- * from `token` (JWT). Required for Apple Pay when used with the hosted shell.
955
- */
956
- userToken?: string;
957
954
  /**
958
955
  * Optional return URL passed to the Apple Pay shell as `success_url`.
959
956
  * Omit when the parent tab polls the payment session (default schedule web flow).
@@ -967,6 +964,8 @@ declare class MqSchedule extends LitElement {
967
964
  protected willUpdate(changed: PropertyValues<this>): void;
968
965
  private _wizard;
969
966
  private _emittedCreated;
967
+ private _organizationChanged;
968
+ private _current;
970
969
  private getAppointmentQuery;
971
970
  private getProfessionalQuery;
972
971
  private getScheduleSlotQuery;
@@ -979,7 +978,7 @@ declare class MqSchedule extends LitElement {
979
978
  private _hostConfig;
980
979
  private _renderStep;
981
980
  private renderReschedulePolicyBlocked;
982
- render(): typeof lit_html.nothing | lit_html.TemplateResult;
981
+ render(): lit_html_directive_js.DirectiveResult<typeof lit_html_directives_keyed_js.Keyed>;
983
982
  }
984
983
  declare global {
985
984
  interface HTMLElementTagNameMap {