@mediquo/elements 0.6.5 → 0.8.0-rc.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 (127) hide show
  1. package/dist/chunks/action-unavailable-message-DPH7oOl_.js +1 -0
  2. package/dist/chunks/addSeconds-ofMnxlgT.js +1 -0
  3. package/dist/chunks/api-chat-client-DLOZVIkT.js +1 -0
  4. package/dist/chunks/{apple-pay-outcomes-CnVRvAVS.js → apple-pay-outcomes-BMxr7x7j.js} +1 -1
  5. package/dist/chunks/{appointment-card-skeleton-1c7552Ln.d.ts → appointment-action-unavailable-dialog-Da2IATYj.d.ts} +9 -86
  6. package/dist/chunks/appointment-card-skeleton-B5b-O2Fh.js +1 -0
  7. package/dist/chunks/appointment-card-skeleton-B7dKtGv0.d.ts +91 -0
  8. package/dist/chunks/{appointment-details-DpzdYLjq.d.ts → appointment-details-CVEDe_k0.d.ts} +1 -1
  9. package/dist/chunks/appointment-details-Czlj6VHq.js +1 -0
  10. package/dist/chunks/{appointment.model.d-Dy50gMPg.d.ts → appointment.model.d-BWwBLaEL.d.ts} +3 -0
  11. package/dist/chunks/blob-to-base64-CUL1trde.js +1 -0
  12. package/dist/chunks/{context-consumer-ESdICVAb.js → chunk-6CCJWPGL-DlOpbEYH.js} +1 -1
  13. package/dist/chunks/chunk-BUV4MGML-Bn3JWCAv.js +1 -0
  14. package/dist/chunks/chunk-Y4EKUX25-CqL3lLdx.js +1 -0
  15. package/dist/chunks/consume-BhoQNO_8.js +1 -0
  16. package/dist/chunks/document.model.d-DIzMiOmd.d.ts +6 -0
  17. package/dist/chunks/documentation-view-BwT9Ol66.js +1 -0
  18. package/dist/chunks/get-appointment-query-lJe75hGS.js +1 -0
  19. package/dist/chunks/get-organization-setup-query-DxHNY0w8.js +1 -0
  20. package/dist/chunks/get-patient-documents-query-D1SfC_k_.js +1 -0
  21. package/dist/chunks/get-patient-profile-query-DiU2f_QH.js +1 -0
  22. package/dist/chunks/get-schedule-services-query-Ckvz9Fqh.js +1 -0
  23. package/dist/chunks/i18n-formats-EgnwLxKt.js +1 -0
  24. package/dist/chunks/index-63zQSBy4.js +1 -0
  25. package/dist/chunks/index-BgnerXfH.js +1 -0
  26. package/dist/chunks/{index-DhfVmF4C.js → index-C195MGA_.js} +1 -1
  27. package/dist/chunks/index-CDBk7hVW.d.ts +28 -0
  28. package/dist/chunks/{index-DNUbmrQl.d.ts → index-CSJzkkRA.d.ts} +1 -4
  29. package/dist/chunks/index-DZjrAnPq.js +1 -0
  30. package/dist/chunks/{mq-chat-room-DuG4RuIp.d.ts → mq-chat-room-CRPruRJD.d.ts} +1 -1
  31. package/dist/chunks/price-DU3YLTpk.js +1 -0
  32. package/dist/chunks/query-controller-D7jBX4X7.js +1 -0
  33. package/dist/chunks/refund-cancel-policy-DhD6jEtp.js +1 -0
  34. package/dist/chunks/{schemas.d-5LR6aN9I.d.ts → schemas.d-D7bCe24u.d.ts} +20 -20
  35. package/dist/chunks/telemetry-client-Bkbn48Dd.js +1 -0
  36. package/dist/env.js +1 -1
  37. package/dist/mq-apple-pay-checkout.js +1 -1
  38. package/dist/mq-appointment-checkout.js +1 -1
  39. package/dist/mq-appointment-documentation.d.ts +4 -3
  40. package/dist/mq-appointment-documentation.js +1 -1
  41. package/dist/mq-chat-room.d.ts +2 -2
  42. package/dist/mq-chat-room.js +1 -1
  43. package/dist/mq-checkout.js +1 -1
  44. package/dist/mq-dashboard.d.ts +23 -13
  45. package/dist/mq-dashboard.js +1 -1
  46. package/dist/mq-documents.d.ts +2 -1
  47. package/dist/mq-documents.js +1 -1
  48. package/dist/mq-google-pay-checkout.js +1 -1
  49. package/dist/mq-immediate-videocall-checkout.js +1 -1
  50. package/dist/mq-my-appointments.d.ts +9 -8
  51. package/dist/mq-my-appointments.js +1 -1
  52. package/dist/mq-next-appointments.d.ts +88 -0
  53. package/dist/mq-next-appointments.js +1 -0
  54. package/dist/mq-payment-poller.js +1 -1
  55. package/dist/mq-professional-presence-sync.js +1 -1
  56. package/dist/mq-recent-documents.d.ts +60 -0
  57. package/dist/mq-recent-documents.js +1 -0
  58. package/dist/mq-schedule-success.d.ts +3 -4
  59. package/dist/mq-schedule-success.js +2 -2
  60. package/dist/mq-schedule.d.ts +10 -11
  61. package/dist/mq-schedule.js +1 -1
  62. package/dist/mq-session-provider.d.ts +1 -1
  63. package/dist/mq-support-chat.d.ts +2 -2
  64. package/dist/mq-support-chat.js +1 -1
  65. package/dist/mq-terms-and-conditions.js +1 -1
  66. package/dist/mq-unread-count-sync.js +1 -1
  67. package/dist/mq-videocall.d.ts +4 -3
  68. package/dist/mq-videocall.js +1 -1
  69. package/dist/react/mq-apple-pay-checkout.js +1 -1
  70. package/dist/react/mq-appointment-checkout.js +1 -1
  71. package/dist/react/mq-appointment-documentation.d.ts +4 -3
  72. package/dist/react/mq-appointment-documentation.js +1 -1
  73. package/dist/react/mq-chat-room.d.ts +2 -2
  74. package/dist/react/mq-chat-room.js +1 -1
  75. package/dist/react/mq-checkout.js +1 -1
  76. package/dist/react/mq-dashboard.d.ts +11 -9
  77. package/dist/react/mq-dashboard.js +1 -1
  78. package/dist/react/mq-documents-page.d.ts +2 -1
  79. package/dist/react/mq-documents-page.js +1 -1
  80. package/dist/react/mq-documents.d.ts +2 -1
  81. package/dist/react/mq-documents.js +1 -1
  82. package/dist/react/mq-google-pay-checkout.js +1 -1
  83. package/dist/react/mq-immediate-videocall-checkout.js +1 -1
  84. package/dist/react/mq-my-appointments.d.ts +10 -9
  85. package/dist/react/mq-my-appointments.js +1 -1
  86. package/dist/react/mq-next-appointments.d.ts +38 -0
  87. package/dist/react/mq-next-appointments.js +2 -0
  88. package/dist/react/mq-payment-poller.js +1 -1
  89. package/dist/react/mq-professional-presence-sync.js +1 -1
  90. package/dist/react/mq-recent-documents.d.ts +27 -0
  91. package/dist/react/mq-recent-documents.js +2 -0
  92. package/dist/react/mq-schedule-success.d.ts +3 -3
  93. package/dist/react/mq-schedule-success.js +1 -1
  94. package/dist/react/mq-schedule.d.ts +5 -5
  95. package/dist/react/mq-schedule.js +1 -1
  96. package/dist/react/mq-session-provider.d.ts +1 -1
  97. package/dist/react/mq-support-chat.d.ts +2 -2
  98. package/dist/react/mq-support-chat.js +1 -1
  99. package/dist/react/mq-terms-and-conditions.js +1 -1
  100. package/dist/react/mq-unread-count-sync.js +1 -1
  101. package/dist/react/mq-videocall.d.ts +4 -3
  102. package/dist/react/mq-videocall.js +1 -1
  103. package/dist/theme.d.ts +8 -0
  104. package/dist/theme.js +1 -1
  105. package/dist/ui/icons/arrow-right-icon.d.ts +6 -0
  106. package/dist/ui/icons/arrow-right-icon.js +1 -0
  107. package/dist/ui/icons/dots-horizontal-icon.d.ts +6 -0
  108. package/dist/ui/icons/dots-horizontal-icon.js +1 -0
  109. package/dist/ui/mq-clamped-text.js +1 -1
  110. package/package.json +10 -2
  111. package/dist/chunks/api-chat-client-BBL1U9EQ.js +0 -1
  112. package/dist/chunks/appointment-card-skeleton-C8VERHzq.js +0 -1
  113. package/dist/chunks/chunk-GZF3YFSX-DM-GTqxg.js +0 -1
  114. package/dist/chunks/chunk-YMQSBQHL-De_r7BNk.js +0 -1
  115. package/dist/chunks/consume-CovVqBjI.js +0 -1
  116. package/dist/chunks/documentation-view-DJCr5_MN.js +0 -1
  117. package/dist/chunks/get-appointment-query-Ck68BEMg.js +0 -1
  118. package/dist/chunks/get-organization-setup-query-BMbuRi6v.js +0 -1
  119. package/dist/chunks/get-patient-documents-query-DIQH-TMM.js +0 -1
  120. package/dist/chunks/get-patient-profile-query-B0tUDJmT.js +0 -1
  121. package/dist/chunks/i18n-formats-DYS91YEa.js +0 -1
  122. package/dist/chunks/index-KvIw19qY.js +0 -1
  123. package/dist/chunks/index-ShXzd7UZ.js +0 -1
  124. package/dist/chunks/price-LTnCz9kN.js +0 -1
  125. package/dist/chunks/query-controller-BlO1Ax65.js +0 -1
  126. package/dist/chunks/refund-cancel-policy-CXFTrFfo.js +0 -1
  127. package/dist/chunks/telemetry-client-BLJVs9me.js +0 -1
@@ -1 +1 @@
1
- import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{m as a}from"./chunks/runtime-Bg1WXVCx.js";import{l as n}from"./chunks/localized-decorator-BlOuLhym.js";import{L as o}from"./chunks/login-token-task-BI-L2zSV.js";import{l as i}from"./chunks/chunk-4FFT6DC2-CVWibomC.js";import{i as s,a as r,x as l}from"./chunks/lit-element-DiWJYFwC.js";import{n as c}from"./chunks/property-scuRaFcM.js";import{r as h}from"./chunks/state-LQivXIgA.js";import{setEnv as u}from"./env.js";import{initLocalization as p,isValidLocale as y,setLocale as d}from"./i18n.js";import{e as m,a as g}from"./chunks/api-chat-client-BBL1U9EQ.js";import{r as v}from"./chunks/apple-pay-outcomes-CnVRvAVS.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/external-CJj32K_p.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";function b(){return"undefined"!=typeof google&&"function"==typeof google.payments?.api?.PaymentsClient}const _=["PAN_ONLY","CRYPTOGRAM_3DS"],k=["VISA","MASTERCARD","AMEX"];function f(t){return{type:"PAYMENT_GATEWAY",parameters:{gateway:"globalpayments",gatewayMerchantId:t}}}function C(t){return{type:"CARD",parameters:{allowedAuthMethods:[..._],allowedCardNetworks:[...k]},tokenizationSpecification:f(t)}}function w(t){return[C(t)]}function E(t,e){return"test"===e?"TEST":"production"===e?"PRODUCTION":"development"===t?"TEST":"PRODUCTION"}function P(t,e){return function(t,e){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:w(t.gatewayMerchantId),merchantInfo:{merchantId:t.merchantId,merchantName:t.merchantName},transactionInfo:{totalPriceStatus:"FINAL",totalPrice:e.amount,currencyCode:e.currencyCode,countryCode:e.countryCode}}}(t,e)}async function I(t,e,a,n={}){if("undefined"==typeof window||!window.isSecureContext)return i.warn("google-pay: unavailable outside a secure context"),{available:!1,reason:"unsupported"};if(!t.trim())return i.warn("google-pay: missing merchant id"),{available:!1,reason:"merchant-id-missing"};if(!e.trim())return i.warn("google-pay: missing gateway merchant id"),{available:!1,reason:"gateway-merchant-id-missing"};if(!await function(t=8e3,e){return b()?Promise.resolve(!0):t<=0||e?.aborted?Promise.resolve(!1):new Promise(a=>{const n=Date.now()+t,o=t=>{clearInterval(s),e?.removeEventListener("abort",i),a(t)},i=()=>o(!1),s=setInterval(()=>{b()?o(!0):Date.now()>=n&&o(!1)},100);e?.addEventListener("abort",i,{once:!0})})}(n.sdkWaitTimeoutMs,n.signal))return i.warn("google-pay: pay.js was not loaded by the host page"),{available:!1,reason:"sdk-missing"};const o=E(a,n.gatewayEnvironment);try{const t=new google.payments.api.PaymentsClient({environment:o}),a=await t.isReadyToPay(function(t){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:w(t)}}(e));return a.result?{available:!0}:(i.warn("google-pay: isReadyToPay returned false",{environment:o}),{available:!1,reason:"unsupported"})}catch(t){return i.warn("google-pay: isReadyToPay threw",{environment:o,error:t instanceof Error?t.message:String(t)}),{available:!1,reason:"unsupported"}}}function G(t,e){return function(t){if(function(t){return"object"==typeof t&&null!==t&&"statusCode"in t&&"string"==typeof t.statusCode}(t)){const e=t.statusCode.toUpperCase();if("CANCELED"===e||"CANCELLED"===e)return!0}if(t instanceof Error){const e=t.message.toLowerCase();return e.includes("cancel")||e.includes("closed")||e.includes("abort")}return!1}(t)?{kind:"cancelled"}:m(t)&&400===t.response?.status?{kind:"denied",sessionId:e}:{kind:"authorize"}}function S(t){if(null!==t&&"object"==typeof t){const e=t.paymentMethodData?.tokenizationData,a=e?.token;if("string"==typeof a&&a.length>0)return a}throw new Error("Invalid Google Pay payment data: missing tokenizationData.token")}try{p()}catch{}const T=s`:host{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:12px;width:100%;min-height:48px}.pay-row{display:block;width:100%}.pay-row--paying{opacity:.55;pointer-events:none}::slotted([slot=google-pay-button]){display:block;width:100%;height:var(--mq-google-pay-button-height,48px)}.state{text-align:center;font-family:system-ui,sans-serif;font-size:15px;color:#86868b;margin:0}`;class GooglePayCheckoutSuccessEvent extends Event{static{this.eventName="payment-success"}constructor(t){super(GooglePayCheckoutSuccessEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}class GooglePayCheckoutDeniedEvent extends Event{static{this.eventName="payment-denied"}constructor(t){super(GooglePayCheckoutDeniedEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}class GooglePayCheckoutErrorEvent extends Event{static{this.eventName="payment-error"}constructor(t){super(GooglePayCheckoutErrorEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}const A=new Set(["sdk-missing","unsupported"]);function j(t,e){i.warn(t,{error:e instanceof Error?e.message:String(e)})}let D=class MqGooglePayCheckout extends r{constructor(){super(...arguments),this._availabilityPhase="checking",this._unavailableReason=null,this._paying=!1,this._paymentsClient=null,this._paymentsClientEnvironment=null,this._buttonHost=null,this._availabilityGeneration=0,this._availabilityAbortController=null,this._terminalErrorDispatched=!1,this._loginTokenTask=new o(this,g,{args:()=>[this.apiKey,this.token],onComplete:t=>{g.setAuthToken(t.access_token),this._refreshAvailability()},onError:()=>{this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"auth"}))}}),this._onPayClick=()=>{this._paying||"ready"!==this._availabilityPhase||this._processPayment()}}static{this.styles=T}willUpdate(t){if(t.has("env")&&(this.env&&u(this.env),this._resetPaymentsClient()),t.has("gatewayEnvironment")&&this._resetPaymentsClient(),t.has("apiKey")&&g.setApiKey(this.apiKey),t.has("locale")){const t=y(this.locale)?this.locale:"es_ES";d(t),g.setLanguage(t)}(t.has("merchantId")||t.has("gatewayMerchantId")||t.has("env")||t.has("gatewayEnvironment"))&&this._loginTokenTask.value&&this._refreshAvailability()}connectedCallback(){super.connectedCallback(),this._availabilityAbortController=new AbortController,this._terminalErrorDispatched=!1}disconnectedCallback(){this._availabilityAbortController?.abort(),this._availabilityAbortController=null,this._resetPaymentsClient(),super.disconnectedCallback()}_dispatchTerminalError(){this._terminalErrorDispatched||(this._terminalErrorDispatched=!0,this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"unsupported"})))}_resetPaymentsClient(){this._paymentsClient=null,this._paymentsClientEnvironment=null,this._removeButtonHost()}_getPaymentsClient(){const t=E(this.env,this.gatewayEnvironment);return this._paymentsClient&&this._paymentsClientEnvironment===t||(this._paymentsClient=new google.payments.api.PaymentsClient({environment:t}),this._paymentsClientEnvironment=t,this._buttonHost=null),this._paymentsClient}async _refreshAvailability(){const t=++this._availabilityGeneration;this._availabilityPhase="checking",this._unavailableReason=null,this._removeButtonHost();const e=await I(this.merchantId??"",this.gatewayMerchantId??"",this.env,{signal:this._availabilityAbortController?.signal,gatewayEnvironment:this.gatewayEnvironment});if(t===this._availabilityGeneration&&this.isConnected){if(!e.available)return this._availabilityPhase="unavailable",this._unavailableReason=e.reason,void(A.has(e.reason)&&this._dispatchTerminalError());this._availabilityPhase="ready",this._unavailableReason=null}}_ensureButtonHost(){const t=this.querySelector(':scope > [slot="google-pay-button"]');if(t)return t;const e=document.createElement("div");return e.slot="google-pay-button",this.appendChild(e),e}_removeButtonHost(){this.querySelector(':scope > [slot="google-pay-button"]')?.remove(),this._buttonHost=null}_mountGooglePayButton(){if(this._buttonHost||"ready"!==this._availabilityPhase)return;const t=this._ensureButtonHost();try{const e=this._getPaymentsClient().createButton({onClick:this._onPayClick,buttonColor:"black",buttonType:"pay",buttonSizeMode:"fill"});t.replaceChildren(e),this._buttonHost=t}catch(t){j("mq-google-pay-checkout: failed to create Google Pay button",t),this._removeButtonHost(),this._availabilityPhase="unavailable",this._unavailableReason="unsupported",this._dispatchTerminalError()}}updated(t){super.updated(t),"ready"===this._availabilityPhase&&this._mountGooglePayButton()}async _processPayment(){this._paying=!0;try{const t=await this._getPaymentsClient().loadPaymentData(P({merchantId:this.merchantId,gatewayMerchantId:this.gatewayMerchantId,merchantName:this.merchantName||this.label},{amount:this.amount,currencyCode:this.currency,countryCode:this.country})),e=await g.payments.authorizeGooglePay({order_id:this.sessionId,token:S(t)}),{status:a,consultation_id:n}=e.data,o=v(a,n,this.sessionId);switch(o.kind){case"success":this.dispatchEvent(new GooglePayCheckoutSuccessEvent({sessionId:o.sessionId,reference:o.reference}));break;case"denied":this.dispatchEvent(new GooglePayCheckoutDeniedEvent({sessionId:o.sessionId}));break;case"error":this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:o.reason}))}}catch(t){const e=G(t,this.sessionId);switch(e.kind){case"cancelled":this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"cancelled"}));break;case"denied":this.dispatchEvent(new GooglePayCheckoutDeniedEvent({sessionId:e.sessionId}));break;case"authorize":j("mq-google-pay-checkout: authorize failed",t),this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"authorize"}))}}finally{this._paying=!1}}_renderUnavailable(){switch(this._unavailableReason){case"merchant-id-missing":return l`<p class="state">${a("Falta el identificador de comercio de Google Pay")}</p>`;case"gateway-merchant-id-missing":return l`<p class="state">${a("Falta el identificador de pasarela de Google Pay")}</p>`;case"sdk-missing":return l`<p class="state">${a("No se ha podido cargar Google Pay. Comprueba la configuración del sitio e inténtalo de nuevo.")}</p>`;default:return l`<p class="state">${a("Google Pay no está disponible. Prueba con tarjeta u otro método de pago.")}</p>`}}render(){return this._loginTokenTask.render({pending:()=>l`<p class="state">${a("Preparando Google Pay…")}</p>`,error:()=>l`<p class="state">${a("No hemos podido iniciar el pago")}</p>`,complete:()=>"checking"===this._availabilityPhase?l`<p class="state">${a("Comprobando Google Pay…")}</p>`:"unavailable"===this._availabilityPhase?this._renderUnavailable():l`<div class="pay-row ${this._paying?"pay-row--paying":""}"><slot name="google-pay-button"></slot></div>`})}};t([c({type:String,attribute:"env"})],D.prototype,"env",void 0),t([c({type:String,attribute:"gateway-environment"})],D.prototype,"gatewayEnvironment",void 0),t([c({type:String,attribute:"api-key"})],D.prototype,"apiKey",void 0),t([c({type:String,attribute:"token"})],D.prototype,"token",void 0),t([c({type:String,attribute:"locale",reflect:!0})],D.prototype,"locale",void 0),t([c({type:String,attribute:"merchant-id"})],D.prototype,"merchantId",void 0),t([c({type:String,attribute:"gateway-merchant-id"})],D.prototype,"gatewayMerchantId",void 0),t([c({type:String,attribute:"merchant-name"})],D.prototype,"merchantName",void 0),t([c({type:String,attribute:"session-id"})],D.prototype,"sessionId",void 0),t([c({type:String,attribute:"amount"})],D.prototype,"amount",void 0),t([c({type:String,attribute:"currency"})],D.prototype,"currency",void 0),t([c({type:String,attribute:"country"})],D.prototype,"country",void 0),t([c({type:String,attribute:"label"})],D.prototype,"label",void 0),t([h()],D.prototype,"_availabilityPhase",void 0),t([h()],D.prototype,"_unavailableReason",void 0),t([h()],D.prototype,"_paying",void 0),D=t([n(),e("mq-google-pay-checkout")],D);export{GooglePayCheckoutDeniedEvent,GooglePayCheckoutErrorEvent,GooglePayCheckoutSuccessEvent,D as MqGooglePayCheckout};
1
+ import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{m as a}from"./chunks/runtime-Bg1WXVCx.js";import{l as n}from"./chunks/localized-decorator-BlOuLhym.js";import{L as o}from"./chunks/login-token-task-BI-L2zSV.js";import{l as i}from"./chunks/chunk-4FFT6DC2-CVWibomC.js";import{i as s,a as r,x as l}from"./chunks/lit-element-DiWJYFwC.js";import{n as c}from"./chunks/property-scuRaFcM.js";import{r as h}from"./chunks/state-LQivXIgA.js";import{setEnv as u}from"./env.js";import{initLocalization as p,isValidLocale as y,setLocale as d}from"./i18n.js";import{e as m,a as g}from"./chunks/api-chat-client-DLOZVIkT.js";import{r as v}from"./chunks/apple-pay-outcomes-BMxr7x7j.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/external-CJj32K_p.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";function b(){return"undefined"!=typeof google&&"function"==typeof google.payments?.api?.PaymentsClient}const _=["PAN_ONLY","CRYPTOGRAM_3DS"],k=["VISA","MASTERCARD","AMEX"];function f(t){return{type:"PAYMENT_GATEWAY",parameters:{gateway:"globalpayments",gatewayMerchantId:t}}}function C(t){return{type:"CARD",parameters:{allowedAuthMethods:[..._],allowedCardNetworks:[...k]},tokenizationSpecification:f(t)}}function w(t){return[C(t)]}function E(t,e){return"test"===e?"TEST":"production"===e?"PRODUCTION":"development"===t?"TEST":"PRODUCTION"}function P(t,e){return function(t,e){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:w(t.gatewayMerchantId),merchantInfo:{merchantId:t.merchantId,merchantName:t.merchantName},transactionInfo:{totalPriceStatus:"FINAL",totalPrice:e.amount,currencyCode:e.currencyCode,countryCode:e.countryCode}}}(t,e)}async function I(t,e,a,n={}){if("undefined"==typeof window||!window.isSecureContext)return i.warn("google-pay: unavailable outside a secure context"),{available:!1,reason:"unsupported"};if(!t.trim())return i.warn("google-pay: missing merchant id"),{available:!1,reason:"merchant-id-missing"};if(!e.trim())return i.warn("google-pay: missing gateway merchant id"),{available:!1,reason:"gateway-merchant-id-missing"};if(!await function(t=8e3,e){return b()?Promise.resolve(!0):t<=0||e?.aborted?Promise.resolve(!1):new Promise(a=>{const n=Date.now()+t,o=t=>{clearInterval(s),e?.removeEventListener("abort",i),a(t)},i=()=>o(!1),s=setInterval(()=>{b()?o(!0):Date.now()>=n&&o(!1)},100);e?.addEventListener("abort",i,{once:!0})})}(n.sdkWaitTimeoutMs,n.signal))return i.warn("google-pay: pay.js was not loaded by the host page"),{available:!1,reason:"sdk-missing"};const o=E(a,n.gatewayEnvironment);try{const t=new google.payments.api.PaymentsClient({environment:o}),a=await t.isReadyToPay(function(t){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:w(t)}}(e));return a.result?{available:!0}:(i.warn("google-pay: isReadyToPay returned false",{environment:o}),{available:!1,reason:"unsupported"})}catch(t){return i.warn("google-pay: isReadyToPay threw",{environment:o,error:t instanceof Error?t.message:String(t)}),{available:!1,reason:"unsupported"}}}function G(t,e){return function(t){if(function(t){return"object"==typeof t&&null!==t&&"statusCode"in t&&"string"==typeof t.statusCode}(t)){const e=t.statusCode.toUpperCase();if("CANCELED"===e||"CANCELLED"===e)return!0}if(t instanceof Error){const e=t.message.toLowerCase();return e.includes("cancel")||e.includes("closed")||e.includes("abort")}return!1}(t)?{kind:"cancelled"}:m(t)&&400===t.response?.status?{kind:"denied",sessionId:e}:{kind:"authorize"}}function S(t){if(null!==t&&"object"==typeof t){const e=t.paymentMethodData?.tokenizationData,a=e?.token;if("string"==typeof a&&a.length>0)return a}throw new Error("Invalid Google Pay payment data: missing tokenizationData.token")}try{p()}catch{}const T=s`:host{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:12px;width:100%;min-height:48px}.pay-row{display:block;width:100%}.pay-row--paying{opacity:.55;pointer-events:none}::slotted([slot=google-pay-button]){display:block;width:100%;height:var(--mq-google-pay-button-height,48px)}.state{text-align:center;font-family:system-ui,sans-serif;font-size:15px;color:#86868b;margin:0}`;class GooglePayCheckoutSuccessEvent extends Event{static{this.eventName="payment-success"}constructor(t){super(GooglePayCheckoutSuccessEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}class GooglePayCheckoutDeniedEvent extends Event{static{this.eventName="payment-denied"}constructor(t){super(GooglePayCheckoutDeniedEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}class GooglePayCheckoutErrorEvent extends Event{static{this.eventName="payment-error"}constructor(t){super(GooglePayCheckoutErrorEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}const A=new Set(["sdk-missing","unsupported"]);function j(t,e){i.warn(t,{error:e instanceof Error?e.message:String(e)})}let D=class MqGooglePayCheckout extends r{constructor(){super(...arguments),this._availabilityPhase="checking",this._unavailableReason=null,this._paying=!1,this._paymentsClient=null,this._paymentsClientEnvironment=null,this._buttonHost=null,this._availabilityGeneration=0,this._availabilityAbortController=null,this._terminalErrorDispatched=!1,this._loginTokenTask=new o(this,g,{args:()=>[this.apiKey,this.token],onComplete:t=>{g.setAuthToken(t.access_token),this._refreshAvailability()},onError:()=>{this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"auth"}))}}),this._onPayClick=()=>{this._paying||"ready"!==this._availabilityPhase||this._processPayment()}}static{this.styles=T}willUpdate(t){if(t.has("env")&&(this.env&&u(this.env),this._resetPaymentsClient()),t.has("gatewayEnvironment")&&this._resetPaymentsClient(),t.has("apiKey")&&g.setApiKey(this.apiKey),t.has("locale")){const t=y(this.locale)?this.locale:"es_ES";d(t),g.setLanguage(t)}(t.has("merchantId")||t.has("gatewayMerchantId")||t.has("env")||t.has("gatewayEnvironment"))&&this._loginTokenTask.value&&this._refreshAvailability()}connectedCallback(){super.connectedCallback(),this._availabilityAbortController=new AbortController,this._terminalErrorDispatched=!1}disconnectedCallback(){this._availabilityAbortController?.abort(),this._availabilityAbortController=null,this._resetPaymentsClient(),super.disconnectedCallback()}_dispatchTerminalError(){this._terminalErrorDispatched||(this._terminalErrorDispatched=!0,this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"unsupported"})))}_resetPaymentsClient(){this._paymentsClient=null,this._paymentsClientEnvironment=null,this._removeButtonHost()}_getPaymentsClient(){const t=E(this.env,this.gatewayEnvironment);return this._paymentsClient&&this._paymentsClientEnvironment===t||(this._paymentsClient=new google.payments.api.PaymentsClient({environment:t}),this._paymentsClientEnvironment=t,this._buttonHost=null),this._paymentsClient}async _refreshAvailability(){const t=++this._availabilityGeneration;this._availabilityPhase="checking",this._unavailableReason=null,this._removeButtonHost();const e=await I(this.merchantId??"",this.gatewayMerchantId??"",this.env,{signal:this._availabilityAbortController?.signal,gatewayEnvironment:this.gatewayEnvironment});if(t===this._availabilityGeneration&&this.isConnected){if(!e.available)return this._availabilityPhase="unavailable",this._unavailableReason=e.reason,void(A.has(e.reason)&&this._dispatchTerminalError());this._availabilityPhase="ready",this._unavailableReason=null}}_ensureButtonHost(){const t=this.querySelector(':scope > [slot="google-pay-button"]');if(t)return t;const e=document.createElement("div");return e.slot="google-pay-button",this.appendChild(e),e}_removeButtonHost(){this.querySelector(':scope > [slot="google-pay-button"]')?.remove(),this._buttonHost=null}_mountGooglePayButton(){if(this._buttonHost||"ready"!==this._availabilityPhase)return;const t=this._ensureButtonHost();try{const e=this._getPaymentsClient().createButton({onClick:this._onPayClick,buttonColor:"black",buttonType:"pay",buttonSizeMode:"fill"});t.replaceChildren(e),this._buttonHost=t}catch(t){j("mq-google-pay-checkout: failed to create Google Pay button",t),this._removeButtonHost(),this._availabilityPhase="unavailable",this._unavailableReason="unsupported",this._dispatchTerminalError()}}updated(t){super.updated(t),"ready"===this._availabilityPhase&&this._mountGooglePayButton()}async _processPayment(){this._paying=!0;try{const t=await this._getPaymentsClient().loadPaymentData(P({merchantId:this.merchantId,gatewayMerchantId:this.gatewayMerchantId,merchantName:this.merchantName||this.label},{amount:this.amount,currencyCode:this.currency,countryCode:this.country})),e=await g.payments.authorizeGooglePay({order_id:this.sessionId,token:S(t)}),{status:a,consultation_id:n}=e.data,o=v(a,n,this.sessionId);switch(o.kind){case"success":this.dispatchEvent(new GooglePayCheckoutSuccessEvent({sessionId:o.sessionId,reference:o.reference}));break;case"denied":this.dispatchEvent(new GooglePayCheckoutDeniedEvent({sessionId:o.sessionId}));break;case"error":this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:o.reason}))}}catch(t){const e=G(t,this.sessionId);switch(e.kind){case"cancelled":this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"cancelled"}));break;case"denied":this.dispatchEvent(new GooglePayCheckoutDeniedEvent({sessionId:e.sessionId}));break;case"authorize":j("mq-google-pay-checkout: authorize failed",t),this.dispatchEvent(new GooglePayCheckoutErrorEvent({reason:"authorize"}))}}finally{this._paying=!1}}_renderUnavailable(){switch(this._unavailableReason){case"merchant-id-missing":return l`<p class="state">${a("Falta el identificador de comercio de Google Pay")}</p>`;case"gateway-merchant-id-missing":return l`<p class="state">${a("Falta el identificador de pasarela de Google Pay")}</p>`;case"sdk-missing":return l`<p class="state">${a("No se ha podido cargar Google Pay. Comprueba la configuración del sitio e inténtalo de nuevo.")}</p>`;default:return l`<p class="state">${a("Google Pay no está disponible. Prueba con tarjeta u otro método de pago.")}</p>`}}render(){return this._loginTokenTask.render({pending:()=>l`<p class="state">${a("Preparando Google Pay…")}</p>`,error:()=>l`<p class="state">${a("No hemos podido iniciar el pago")}</p>`,complete:()=>"checking"===this._availabilityPhase?l`<p class="state">${a("Comprobando Google Pay…")}</p>`:"unavailable"===this._availabilityPhase?this._renderUnavailable():l`<div class="pay-row ${this._paying?"pay-row--paying":""}"><slot name="google-pay-button"></slot></div>`})}};t([c({type:String,attribute:"env"})],D.prototype,"env",void 0),t([c({type:String,attribute:"gateway-environment"})],D.prototype,"gatewayEnvironment",void 0),t([c({type:String,attribute:"api-key"})],D.prototype,"apiKey",void 0),t([c({type:String,attribute:"token"})],D.prototype,"token",void 0),t([c({type:String,attribute:"locale",reflect:!0})],D.prototype,"locale",void 0),t([c({type:String,attribute:"merchant-id"})],D.prototype,"merchantId",void 0),t([c({type:String,attribute:"gateway-merchant-id"})],D.prototype,"gatewayMerchantId",void 0),t([c({type:String,attribute:"merchant-name"})],D.prototype,"merchantName",void 0),t([c({type:String,attribute:"session-id"})],D.prototype,"sessionId",void 0),t([c({type:String,attribute:"amount"})],D.prototype,"amount",void 0),t([c({type:String,attribute:"currency"})],D.prototype,"currency",void 0),t([c({type:String,attribute:"country"})],D.prototype,"country",void 0),t([c({type:String,attribute:"label"})],D.prototype,"label",void 0),t([h()],D.prototype,"_availabilityPhase",void 0),t([h()],D.prototype,"_unavailableReason",void 0),t([h()],D.prototype,"_paying",void 0),D=t([n(),e("mq-google-pay-checkout")],D);export{GooglePayCheckoutDeniedEvent,GooglePayCheckoutErrorEvent,GooglePayCheckoutSuccessEvent,D as MqGooglePayCheckout};
@@ -1 +1 @@
1
- import{_ as e,c as t}from"./chunks/custom-element-D2ziPxYE.js";import{a as i,x as s}from"./chunks/lit-element-DiWJYFwC.js";import{n as o}from"./chunks/property-scuRaFcM.js";import{o as n}from"./chunks/if-defined-BYeVdwgd.js";import{a as r}from"./chunks/api-chat-client-BBL1U9EQ.js";import"./mq-checkout.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";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/localized-decorator-BlOuLhym.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/login-token-task-BI-L2zSV.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 ImmediateVideocallPaidEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(ImmediateVideocallPaidEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}let a=class MqImmediateVideocallCheckout extends i{constructor(){super(...arguments),this._provideSession=async()=>{const e=await r.payments.createImmediateVideocallPaymentLink({video_call_schedule_id:this.videoCallScheduleId});return{sessionId:e.session_id,paymentUrl:e.payment_link}},this._onSuccess=e=>{e.stopPropagation(),this.dispatchEvent(new ImmediateVideocallPaidEvent({videoCallId:e.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>`}};e([o({type:String,attribute:"env"})],a.prototype,"env",void 0),e([o({type:String,attribute:"api-key"})],a.prototype,"apiKey",void 0),e([o({type:String,attribute:"token"})],a.prototype,"token",void 0),e([o({type:String,attribute:"locale",reflect:!0})],a.prototype,"locale",void 0),e([o({type:String,attribute:"video-call-schedule-id"})],a.prototype,"videoCallScheduleId",void 0),a=e([t("mq-immediate-videocall-checkout")],a);export{ImmediateVideocallPaidEvent,a as MqImmediateVideocallCheckout};
1
+ import{_ as e,c as t}from"./chunks/custom-element-D2ziPxYE.js";import{a as i,x as s}from"./chunks/lit-element-DiWJYFwC.js";import{n as o}from"./chunks/property-scuRaFcM.js";import{o as n}from"./chunks/if-defined-BYeVdwgd.js";import{a as r}from"./chunks/api-chat-client-DLOZVIkT.js";import"./mq-checkout.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/runtime-Bg1WXVCx.js";import"./chunks/localized-decorator-BlOuLhym.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/login-token-task-BI-L2zSV.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 ImmediateVideocallPaidEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(ImmediateVideocallPaidEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}let a=class MqImmediateVideocallCheckout extends i{constructor(){super(...arguments),this._provideSession=async()=>{const e=await r.payments.createImmediateVideocallPaymentLink({video_call_schedule_id:this.videoCallScheduleId});return{sessionId:e.session_id,paymentUrl:e.payment_link}},this._onSuccess=e=>{e.stopPropagation(),this.dispatchEvent(new ImmediateVideocallPaidEvent({videoCallId:e.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>`}};e([o({type:String,attribute:"env"})],a.prototype,"env",void 0),e([o({type:String,attribute:"api-key"})],a.prototype,"apiKey",void 0),e([o({type:String,attribute:"token"})],a.prototype,"token",void 0),e([o({type:String,attribute:"locale",reflect:!0})],a.prototype,"locale",void 0),e([o({type:String,attribute:"video-call-schedule-id"})],a.prototype,"videoCallScheduleId",void 0),a=e([t("mq-immediate-videocall-checkout")],a);export{ImmediateVideocallPaidEvent,a as MqImmediateVideocallCheckout};
@@ -1,23 +1,24 @@
1
- export { A as AppointmentDetails } from './chunks/appointment-details-DpzdYLjq.js';
1
+ export { A as AppointmentDetails } from './chunks/appointment-details-CVEDe_k0.js';
2
2
  import * as lit_html from 'lit-html';
3
3
  import * as lit from 'lit';
4
4
  import { LitElement } from 'lit';
5
5
  import { z } from 'zod';
6
6
  import { MqTabsSelectEvent } from './ui/mq-tabs.js';
7
- import './chunks/appointment-card-skeleton-1c7552Ln.js';
7
+ import './chunks/appointment-card-skeleton-B7dKtGv0.js';
8
8
  import './ui/mq-button.js';
9
9
  import './ui/mq-page-title.js';
10
10
  export { P as ProfessionalOverview } from './chunks/professional-overview-mO3tuMuH.js';
11
- import './chunks/appointment.model.d-Dy50gMPg.js';
11
+ import './chunks/appointment.model.d-BWwBLaEL.js';
12
+ import './chunks/appointment-action-unavailable-dialog-Da2IATYj.js';
13
+ import './chunks/price.d-CwLosdAN.js';
14
+ import './ui/mq-dialog.js';
15
+ import '@tanstack/query-core';
12
16
  import './ui/mq-card.js';
13
- import './chunks/schemas.d-5LR6aN9I.js';
14
- import './chunks/mq-chat-room-DuG4RuIp.js';
17
+ import './chunks/schemas.d-D7bCe24u.js';
18
+ import './chunks/mq-chat-room-CRPruRJD.js';
15
19
  import './ui/mq-avatar.js';
16
20
  import './ui/mq-skeleton.js';
17
- import '@tanstack/query-core';
18
21
  import './ui/mq-floating-bubble.js';
19
- import './chunks/price.d-CwLosdAN.js';
20
- import './ui/mq-dialog.js';
21
22
  import './ui/mq-unread-badge.js';
22
23
  import './ui/mq-text-button.js';
23
24
 
@@ -1 +1 @@
1
- export{A as AppointmentDetails}from"./chunks/price-LTnCz9kN.js";import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{m as i}from"./chunks/runtime-Bg1WXVCx.js";import{l as s}from"./chunks/localized-decorator-BlOuLhym.js";import{a as n,i as o,x as a}from"./chunks/lit-element-DiWJYFwC.js";import{n as r}from"./chunks/property-scuRaFcM.js";import{e as p}from"./chunks/external-CJj32K_p.js";import{MqHomeEvent as c}from"./events.js";import"./ui/mq-tabs.js";import{d as m,a as l}from"./chunks/api-chat-client-BBL1U9EQ.js";import{g as d}from"./chunks/appointment-card-skeleton-C8VERHzq.js";import"./ui/mq-button.js";import{Q as u}from"./chunks/query-controller-BlO1Ax65.js";import"./ui/mq-page-title.js";export{P as ProfessionalOverview}from"./chunks/professional-overview-C4H_znIJ.js";import"./chunks/telemetry-client-BLJVs9me.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./i18n.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./ui/icons/briefcase-icon.js";import"./ui/icons/types.js";import"./ui/icons/calendar-icon.js";import"./ui/icons/clock-icon.js";import"./ui/icons/message-bubble-icon.js";import"./ui/icons/phone-icon.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/consume-CovVqBjI.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/get-organization-setup-query-BMbuRi6v.js";import"./chunks/i18n-formats-DYS91YEa.js";import"./chunks/refund-cancel-policy-CXFTrFfo.js";import"./chunks/chunk-GZF3YFSX-DM-GTqxg.js";import"./chunks/state-LQivXIgA.js";import"./ui/mq-card.js";import"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import"./chunks/create-context-DqP79qjF.js";import"./mq-chat-room.js";import"./chunks/provide-D2fnEhT2.js";import"./chunks/context-provider--AKuwfs9.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./ui/mq-avatar.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/chunk-YMQSBQHL-De_r7BNk.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./ui/icons/check-double-icon.js";import"./ui/icons/check-icon.js";import"./chunks/chunk-YTQUGGS3-DmCGIoFy.js";import"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import"./chunks/mutation-controller-CR2qcqhH.js";import"./chunks/query-Cjvi4_dT.js";import"./ui/mq-floating-bubble.js";import"./ui/mq-dialog.js";import"./ui/icons/video-icon.js";import"./ui/mq-unread-badge.js";import"./ui/mq-toast.js";import"./ui/icons/arrow-narrow-left-icon.js";import"./ui/icons/chevron-down-icon.js";import"./ui/mq-text-button.js";const h=p(["next","history"]).enum;class MqMyAppointmentsSelectEvent extends Event{static{this.eventName="ontabchange"}constructor(t){super(MqMyAppointmentsSelectEvent.eventName,{bubbles:!0,composed:!0}),this.value=t}}let v=class EmptyState extends n{static{this.styles=o`.container{border-radius:var(--border-radius-md);background-color:var(--color-neutrals-background-weak);padding:var(--sp-10) var(--sp-6)}.card{border-radius:var(--border-radius-md);max-width:512px;margin:0 auto;background-color:var(--color-neutrals-background-extraWeak);padding:var(--sp-6);display:flex;flex-direction:column;align-items:center;gap:var(--sp-3)}.card>*{max-width:323px;margin:0 auto}.title{font-family:var(--font-body);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0}.description{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-normal);text-align:center;color:var(--color-neutrals-text-default);margin:0}@media (min-width:768px){.container{padding:var(--sp-6)}mq-button{max-width:323px}}`}handleRequestAppointment(){this.dispatchEvent(new CustomEvent("request-appointment",{bubbles:!0,composed:!0}))}render(){return a`<div class="container"><div class="card">${function({color:t="currentColor"}){return a`<svg width="31" height="32" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M29.6 2.4H23.2V0H21.6V2.4H18.4V0H16.8V2.4H13.6V0H12V2.4H8.8V0H7.2V2.4H0.8C0.587827 2.4 0.384344 2.48429 0.234315 2.63431C0.0842855 2.78434 0 2.98783 0 3.2V31.2C0 31.4122 0.0842855 31.6157 0.234315 31.7657C0.384344 31.9157 0.587827 32 0.8 32H29.6C29.8122 32 30.0157 31.9157 30.1657 31.7657C30.3157 31.6157 30.4 31.4122 30.4 31.2V3.2C30.4 2.98783 30.3157 2.78434 30.1657 2.63431C30.0157 2.48429 29.8122 2.4 29.6 2.4ZM28.8 30.4H1.6V10.4H27.2V8.8H1.6V4H7.2V7.2H8.8V4H12V7.2H13.6V4H16.8V7.2H18.4V4H21.6V7.2H23.2V4H28.8V30.4ZM3.2 19.2H9.6V12.8H3.2V19.2ZM4.8 14.4H8V17.6H4.8V14.4ZM20.8 19.2H27.2V12.8H20.8V19.2ZM22.4 14.4H25.6V17.6H22.4V14.4ZM12 19.2H18.4V12.8H12V19.2ZM13.6 14.4H16.8V17.6H13.6V14.4ZM3.2 28H9.6V21.6H3.2V28ZM4.8 23.2H8V26.4H4.8V23.2ZM20.8 28H27.2V21.6H20.8V28ZM22.4 23.2H25.6V26.4H22.4V23.2ZM12 28H18.4V21.6H12V28ZM13.6 23.2H16.8V26.4H13.6V23.2Z" fill="${t}"/></svg>`}({color:"var(--color-primary)"})}<p class="title">${this.title}</p><p class="description">${this.description}</p><mq-button variant="primary" size="md" fullwidth @click="${this.handleRequestAppointment}">${i("Pedir cita")}</mq-button></div></div>`}};t([r({type:String})],v.prototype,"title",void 0),t([r({type:String})],v.prototype,"description",void 0),v=t([e("empty-state")],v);const g=[m.pending,m.accepted],b=o`.appointments-list{display:grid;grid-template-columns:1fr;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}`;let x=class NextAppointmentsTab extends n{constructor(){super(...arguments),this.getAppointmentsQuery=new u(this,()=>d(l,{status:g,order:{field:"starts_at",direction:"asc"}}))}static{this.styles=b}render(){return this.getAppointmentsQuery.render({complete:t=>a`${t.data.length>0?a`<div class="appointments-list">${t.data.map(t=>a`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}"></appointment-card>`)}</div>`:a`<empty-state title="${i("No tienes próximas citas")}" description="${i("Agenda una consulta médica cuando la necesites. Aquí verás todos los detalles y podrás gestionar tus próximas citas.")}"></empty-state>`}`,pending:()=>a`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};x=t([s(),e("next-appointments-tab")],x);const f=[m.finished,m.reporting];let k=class AppointmentsHistoryTab extends n{constructor(){super(...arguments),this.getAppointmentsQuery=new u(this,()=>d(l,{status:f,order:{field:"starts_at",direction:"desc"}}))}static{this.styles=o`.appointments-list{display:grid;grid-template-columns:1fr;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}`}render(){return this.getAppointmentsQuery.render({complete:t=>a`${t.data.length>0?a`<div class="appointments-list">${t.data.map(t=>a`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}" variant="history"></appointment-card>`)}</div>`:a`<empty-state title="${i("No tienes citas en el historial")}" description="${i("Aquí verás todas las citas que has tenido. Puedes acceder a los documentos de cada consulta y reagendar una cita si es necesario.")}"></empty-state>`}`,pending:()=>a`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};k=t([s(),e("appointments-history-tab")],k);const y=o`.container{display:flex;flex-direction:column;gap:var(--size-3)}@media (min-width:768px){mq-tabs-list{max-width:435px}}`;let j=class MqMyAppointments extends n{constructor(){super(...arguments),this.tab=h.next}static{this.styles=y}handleSelect(t){this.dispatchEvent(new MqMyAppointmentsSelectEvent(t.value))}render(){return a`<div class="container"><mq-page-title .title="${i("Mis citas")}" @mq-back="${t=>{t.stopPropagation(),this.dispatchEvent(new c)}}"></mq-page-title><mq-tabs .value="${this.tab}" @onvaluechange="${this.handleSelect}"><mq-tabs-list><mq-tabs-trigger value="${h.next}">${i("Próximas citas")}</mq-tabs-trigger><mq-tabs-trigger value="${h.history}">${i("Histórico")}</mq-tabs-trigger></mq-tabs-list><mq-tabs-content value="${h.next}"><next-appointments-tab></next-appointments-tab></mq-tabs-content><mq-tabs-content value="${h.history}"><appointments-history-tab></appointments-history-tab></mq-tabs-content></mq-tabs></div>`}};t([r({type:String,reflect:!0})],j.prototype,"tab",void 0),j=t([s(),e("mq-my-appointments")],j);const q=o`:host{display:block}.request-appointment-cta{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:var(--sp-12) var(--sp-4);background:var(--color-card);gap:var(--sp-4)}.title-body{display:flex;flex-direction:column;gap:var(--sp-2);flex:1}.title{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0;text-align:center}.subtitle{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);margin:0;display:none}mq-button{width:100%}.button-text-desktop{display:none}.button-text-mobile{display:inline}@media (min-width:768px){.request-appointment-cta{flex-direction:row;padding:var(--sp-12) var(--sp-20);gap:var(--sp-2)}.title-body{align-items:flex-start;flex:1;max-width:843px}.title{font-size:var(--text-3xl);line-height:var(--text-3xl--line-height);font-weight:var(--font-weight-extrabold);text-align:left}.subtitle{display:block}mq-button{width:auto;flex-shrink:0;--button-height-md:var(--button-height-lg);--text-sm:var(--text-base);--text-sm--line-height:var(--text-base--line-height)}.button-text-desktop{display:inline}.button-text-mobile{display:none}}`;class RequestAppointmentEvent extends Event{static{this.eventName="request-appointment"}constructor(){super(RequestAppointmentEvent.eventName,{bubbles:!0,composed:!0})}}let H=class RequestAppointmentCta extends n{static{this.styles=q}handleRequestAppointment(){this.dispatchEvent(new RequestAppointmentEvent)}render(){return a`<div class="request-appointment-cta"><div class="title-body"><h2 class="title">${i("Nueva cita de especialidades digitales")}</h2><p class="subtitle">${i("Realiza la búsqueda en tu cuadro médico digital")}</p></div><mq-button variant="primary" size="md" fullwidth @click="${this.handleRequestAppointment}"><span class="button-text-mobile">${i("Pedir cita")}</span> <span class="button-text-desktop">${i("Pedir una nueva cita")}</span></mq-button></div>`}};H=t([s(),e("request-appointment-cta")],H);export{j as MqMyAppointments,MqMyAppointmentsSelectEvent,H as RequestAppointmentCta,RequestAppointmentEvent};
1
+ export{A as AppointmentDetails}from"./chunks/appointment-details-Czlj6VHq.js";import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{m as i}from"./chunks/runtime-Bg1WXVCx.js";import{l as s}from"./chunks/localized-decorator-BlOuLhym.js";import{a as n,i as o,x as a}from"./chunks/lit-element-DiWJYFwC.js";import{n as r}from"./chunks/property-scuRaFcM.js";import{e as p}from"./chunks/external-CJj32K_p.js";import{MqHomeEvent as c}from"./events.js";import"./ui/mq-tabs.js";import{c as m,a as l}from"./chunks/api-chat-client-DLOZVIkT.js";import"./chunks/appointment-card-skeleton-B5b-O2Fh.js";import"./ui/mq-button.js";import{Q as d}from"./chunks/query-controller-D7jBX4X7.js";import{a as u}from"./chunks/action-unavailable-message-DPH7oOl_.js";import"./ui/mq-page-title.js";export{P as ProfessionalOverview}from"./chunks/professional-overview-C4H_znIJ.js";import"./chunks/addSeconds-ofMnxlgT.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./i18n.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./ui/icons/briefcase-icon.js";import"./ui/icons/types.js";import"./ui/icons/calendar-icon.js";import"./ui/icons/clock-icon.js";import"./ui/icons/message-bubble-icon.js";import"./ui/icons/phone-icon.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/consume-BhoQNO_8.js";import"./chunks/chunk-6CCJWPGL-DlOpbEYH.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/get-organization-setup-query-DxHNY0w8.js";import"./chunks/i18n-formats-EgnwLxKt.js";import"./chunks/get-schedule-services-query-Ckvz9Fqh.js";import"./chunks/chunk-Y4EKUX25-CqL3lLdx.js";import"./chunks/state-LQivXIgA.js";import"./ui/mq-card.js";import"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import"./chunks/create-context-DqP79qjF.js";import"./mq-chat-room.js";import"./chunks/provide-D2fnEhT2.js";import"./chunks/context-provider--AKuwfs9.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./ui/mq-avatar.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/chunk-BUV4MGML-Bn3JWCAv.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./ui/icons/check-double-icon.js";import"./ui/icons/check-icon.js";import"./chunks/chunk-YTQUGGS3-DmCGIoFy.js";import"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import"./chunks/mutation-controller-CR2qcqhH.js";import"./chunks/query-Cjvi4_dT.js";import"./ui/mq-floating-bubble.js";import"./chunks/telemetry-client-Bkbn48Dd.js";import"./ui/icons/video-icon.js";import"./ui/mq-unread-badge.js";import"./chunks/refund-cancel-policy-DhD6jEtp.js";import"./ui/mq-toast.js";import"./chunks/price-DU3YLTpk.js";import"./ui/mq-dialog.js";import"./ui/icons/arrow-narrow-left-icon.js";import"./ui/icons/chevron-down-icon.js";import"./ui/mq-text-button.js";const h=p(["next","history"]).enum;class MqMyAppointmentsSelectEvent extends Event{static{this.eventName="ontabchange"}constructor(t){super(MqMyAppointmentsSelectEvent.eventName,{bubbles:!0,composed:!0}),this.value=t}}let v=class EmptyState extends n{static{this.styles=o`.container{border-radius:var(--border-radius-md);background-color:var(--color-neutrals-background-weak);padding:var(--sp-10) var(--sp-6)}.card{border-radius:var(--border-radius-md);max-width:512px;margin:0 auto;background-color:var(--color-neutrals-background-extraWeak);padding:var(--sp-6);display:flex;flex-direction:column;align-items:center;gap:var(--sp-3)}.card>*{max-width:323px;margin:0 auto}.title{font-family:var(--font-body);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0}.description{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-normal);text-align:center;color:var(--color-neutrals-text-default);margin:0}@media (min-width:768px){.container{padding:var(--sp-6)}mq-button{max-width:323px}}`}handleRequestAppointment(){this.dispatchEvent(new CustomEvent("request-appointment",{bubbles:!0,composed:!0}))}render(){return a`<div class="container"><div class="card">${function({color:t="currentColor"}){return a`<svg width="31" height="32" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M29.6 2.4H23.2V0H21.6V2.4H18.4V0H16.8V2.4H13.6V0H12V2.4H8.8V0H7.2V2.4H0.8C0.587827 2.4 0.384344 2.48429 0.234315 2.63431C0.0842855 2.78434 0 2.98783 0 3.2V31.2C0 31.4122 0.0842855 31.6157 0.234315 31.7657C0.384344 31.9157 0.587827 32 0.8 32H29.6C29.8122 32 30.0157 31.9157 30.1657 31.7657C30.3157 31.6157 30.4 31.4122 30.4 31.2V3.2C30.4 2.98783 30.3157 2.78434 30.1657 2.63431C30.0157 2.48429 29.8122 2.4 29.6 2.4ZM28.8 30.4H1.6V10.4H27.2V8.8H1.6V4H7.2V7.2H8.8V4H12V7.2H13.6V4H16.8V7.2H18.4V4H21.6V7.2H23.2V4H28.8V30.4ZM3.2 19.2H9.6V12.8H3.2V19.2ZM4.8 14.4H8V17.6H4.8V14.4ZM20.8 19.2H27.2V12.8H20.8V19.2ZM22.4 14.4H25.6V17.6H22.4V14.4ZM12 19.2H18.4V12.8H12V19.2ZM13.6 14.4H16.8V17.6H13.6V14.4ZM3.2 28H9.6V21.6H3.2V28ZM4.8 23.2H8V26.4H4.8V23.2ZM20.8 28H27.2V21.6H20.8V28ZM22.4 23.2H25.6V26.4H22.4V23.2ZM12 28H18.4V21.6H12V28ZM13.6 23.2H16.8V26.4H13.6V23.2Z" fill="${t}"/></svg>`}({color:"var(--color-primary)"})}<p class="title">${this.title}</p><p class="description">${this.description}</p><mq-button variant="primary" size="md" fullwidth @click="${this.handleRequestAppointment}">${i("Pedir cita")}</mq-button></div></div>`}};t([r({type:String})],v.prototype,"title",void 0),t([r({type:String})],v.prototype,"description",void 0),v=t([e("empty-state")],v);const g=[m.pending,m.accepted],b=o`.appointments-list{display:grid;grid-template-columns:1fr;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}`;let x=class NextAppointmentsTab extends n{constructor(){super(...arguments),this.getAppointmentsQuery=new d(this,()=>u(l,{status:g,order:{field:"starts_at",direction:"asc"}}))}static{this.styles=b}render(){return this.getAppointmentsQuery.render({complete:t=>a`${t.data.length>0?a`<div class="appointments-list">${t.data.map(t=>a`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}"></appointment-card>`)}</div>`:a`<empty-state title="${i("No tienes próximas citas")}" description="${i("Agenda una consulta médica cuando la necesites. Aquí verás todos los detalles y podrás gestionar tus próximas citas.")}"></empty-state>`}`,pending:()=>a`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};x=t([s(),e("next-appointments-tab")],x);const f=[m.finished,m.reporting];let k=class AppointmentsHistoryTab extends n{constructor(){super(...arguments),this.getAppointmentsQuery=new d(this,()=>u(l,{status:f,order:{field:"starts_at",direction:"desc"}}))}static{this.styles=o`.appointments-list{display:grid;grid-template-columns:1fr;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}`}render(){return this.getAppointmentsQuery.render({complete:t=>a`${t.data.length>0?a`<div class="appointments-list">${t.data.map(t=>a`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}" variant="history"></appointment-card>`)}</div>`:a`<empty-state title="${i("No tienes citas en el historial")}" description="${i("Aquí verás todas las citas que has tenido. Puedes acceder a los documentos de cada consulta y reagendar una cita si es necesario.")}"></empty-state>`}`,pending:()=>a`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};k=t([s(),e("appointments-history-tab")],k);const y=o`.container{display:flex;flex-direction:column;gap:var(--size-3)}@media (min-width:768px){mq-tabs-list{max-width:435px}}`;let j=class MqMyAppointments extends n{constructor(){super(...arguments),this.tab=h.next}static{this.styles=y}handleSelect(t){this.dispatchEvent(new MqMyAppointmentsSelectEvent(t.value))}render(){return a`<div class="container"><mq-page-title .title="${i("Mis citas")}" @mq-back="${t=>{t.stopPropagation(),this.dispatchEvent(new c)}}"></mq-page-title><mq-tabs .value="${this.tab}" @onvaluechange="${this.handleSelect}"><mq-tabs-list><mq-tabs-trigger value="${h.next}">${i("Próximas citas")}</mq-tabs-trigger><mq-tabs-trigger value="${h.history}">${i("Histórico")}</mq-tabs-trigger></mq-tabs-list><mq-tabs-content value="${h.next}"><next-appointments-tab></next-appointments-tab></mq-tabs-content><mq-tabs-content value="${h.history}"><appointments-history-tab></appointments-history-tab></mq-tabs-content></mq-tabs></div>`}};t([r({type:String,reflect:!0})],j.prototype,"tab",void 0),j=t([s(),e("mq-my-appointments")],j);const q=o`:host{display:block}.request-appointment-cta{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:var(--sp-12) var(--sp-4);background:var(--color-card);gap:var(--sp-4)}.title-body{display:flex;flex-direction:column;gap:var(--sp-2);flex:1}.title{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-neutrals-text-default);margin:0;text-align:center}.subtitle{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);margin:0;display:none}mq-button{width:100%}.button-text-desktop{display:none}.button-text-mobile{display:inline}@media (min-width:768px){.request-appointment-cta{flex-direction:row;padding:var(--sp-12) var(--sp-20);gap:var(--sp-2)}.title-body{align-items:flex-start;flex:1;max-width:843px}.title{font-size:var(--text-3xl);line-height:var(--text-3xl--line-height);font-weight:var(--font-weight-extrabold);text-align:left}.subtitle{display:block}mq-button{width:auto;flex-shrink:0;--button-height-md:var(--button-height-lg);--text-sm:var(--text-base);--text-sm--line-height:var(--text-base--line-height)}.button-text-desktop{display:inline}.button-text-mobile{display:none}}`;class RequestAppointmentEvent extends Event{static{this.eventName="request-appointment"}constructor(){super(RequestAppointmentEvent.eventName,{bubbles:!0,composed:!0})}}let H=class RequestAppointmentCta extends n{static{this.styles=q}handleRequestAppointment(){this.dispatchEvent(new RequestAppointmentEvent)}render(){return a`<div class="request-appointment-cta"><div class="title-body"><h2 class="title">${i("Nueva cita de especialidades digitales")}</h2><p class="subtitle">${i("Realiza la búsqueda en tu cuadro médico digital")}</p></div><mq-button variant="primary" size="md" fullwidth @click="${this.handleRequestAppointment}"><span class="button-text-mobile">${i("Pedir cita")}</span> <span class="button-text-desktop">${i("Pedir una nueva cita")}</span></mq-button></div>`}};H=t([s(),e("request-appointment-cta")],H);export{j as MqMyAppointments,MqMyAppointmentsSelectEvent,H as RequestAppointmentCta,RequestAppointmentEvent};
@@ -0,0 +1,88 @@
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 { G as GetAppointmentsResponse } from './chunks/appointment-action-unavailable-dialog-Da2IATYj.js';
8
+ import './chunks/mq-chat-room-CRPruRJD.js';
9
+ import './chunks/professional-overview-mO3tuMuH.js';
10
+ import './ui/mq-button.js';
11
+ import './ui/mq-floating-bubble.js';
12
+ export { MqAppointmentJoinVideocallEvent, MqAppointmentRescheduleEvent, MqViewAppointmentsEvent } from './events.js';
13
+ import 'zod';
14
+ import './chunks/price.d-CwLosdAN.js';
15
+ import './ui/mq-dialog.js';
16
+ import '@tanstack/query-core';
17
+ import './ui/mq-avatar.js';
18
+ import './chunks/appointment.model.d-BWwBLaEL.js';
19
+ import './ui/mq-text-button.js';
20
+
21
+ declare class NextAppointmentCard extends LitElement {
22
+ static styles: lit.CSSResult;
23
+ appointmentResource: GetAppointmentsResponse["data"][number];
24
+ specialtyName: string;
25
+ token: string;
26
+ patientHash: string;
27
+ timezone?: string;
28
+ hasChatSupport: boolean;
29
+ isExpired: boolean;
30
+ isModifyUnavailable: boolean;
31
+ isCancelUnavailable: boolean;
32
+ modifyUnavailableMessage: string;
33
+ cancelUnavailableMessage: string;
34
+ private isChatOpen;
35
+ private isMenuOpen;
36
+ private isCancelDialogOpen;
37
+ private openDialog;
38
+ private closeMenuOnOutsideClick;
39
+ private closeMenuOnEscape;
40
+ connectedCallback(): void;
41
+ disconnectedCallback(): void;
42
+ private get appointmentId();
43
+ private get channel();
44
+ private channelIcon;
45
+ private channelLabel;
46
+ private formatWhen;
47
+ private handleJoinVideocall;
48
+ private handleToggleChat;
49
+ private handleModify;
50
+ private handleCancel;
51
+ private renderActions;
52
+ render(): lit_html.TemplateResult<1>;
53
+ }
54
+ declare global {
55
+ interface HTMLElementTagNameMap {
56
+ "next-appointment-card": NextAppointmentCard;
57
+ }
58
+ }
59
+
60
+ declare class MqNextAppointments extends LitElement {
61
+ static styles: lit.CSSResult;
62
+ apiKey?: string;
63
+ token?: string;
64
+ locale?: string;
65
+ env?: Env;
66
+ timezone?: string;
67
+ private loginToken?;
68
+ protected willUpdate(changed: PropertyValues<this>): void;
69
+ private getPatientProfileQuery;
70
+ private getAppointmentsQuery;
71
+ private getOrganizationSetupQuery;
72
+ private getOrganizationSpecialtiesQuery;
73
+ private get patientHash();
74
+ private get accessToken();
75
+ private get patientTimezone();
76
+ private get isEmpty();
77
+ protected updated(): void;
78
+ private handleViewAll;
79
+ private renderAppointment;
80
+ render(): lit_html.TemplateResult<1>;
81
+ }
82
+ declare global {
83
+ interface HTMLElementTagNameMap {
84
+ "mq-next-appointments": MqNextAppointments;
85
+ }
86
+ }
87
+
88
+ export { MqNextAppointments };
@@ -0,0 +1 @@
1
+ import{getLocale as t,isValidLocale as e,setLocale as i,initLocalization as n}from"./i18n.js";import{_ as o,c as a}from"./chunks/custom-element-D2ziPxYE.js";import{c as s}from"./chunks/consume-BhoQNO_8.js";import{m as r,s as p}from"./chunks/runtime-Bg1WXVCx.js";import{l as c}from"./chunks/localized-decorator-BlOuLhym.js";import{Q as l}from"./chunks/query-controller-D7jBX4X7.js";import{l as m}from"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import{A as h,c as d,a as u,i as g}from"./chunks/api-chat-client-DLOZVIkT.js";import{a as v,g as f}from"./chunks/action-unavailable-message-DPH7oOl_.js";import{g as y}from"./chunks/get-organization-setup-query-DxHNY0w8.js";import{g as b,a as k}from"./chunks/i18n-formats-EgnwLxKt.js";import{g as x}from"./chunks/get-patient-profile-query-DiU2f_QH.js";import{c as $}from"./chunks/refund-cancel-policy-DhD6jEtp.js";import{i as j,a as w,E as C,x as O}from"./chunks/lit-element-DiWJYFwC.js";import{n as q}from"./chunks/property-scuRaFcM.js";import{setEnv as M}from"./env.js";import{MqAppointmentJoinVideocallEvent as z,MqAppointmentRescheduleEvent as S,MqViewAppointmentsEvent as U}from"./events.js";import"./chunks/index-DZjrAnPq.js";import"./ui/mq-skeleton.js";import{t as I,g as E,i as A,c as D,e as T}from"./chunks/telemetry-client-Bkbn48Dd.js";import{r as _}from"./chunks/state-LQivXIgA.js";import{calendarIcon as N}from"./ui/icons/calendar-icon.js";import{dotsHorizontalIcon as R}from"./ui/icons/dots-horizontal-icon.js";import{messageBubbleIcon as H}from"./ui/icons/message-bubble-icon.js";import{phoneIcon as Q}from"./ui/icons/phone-icon.js";import{videoIcon as P}from"./ui/icons/video-icon.js";import"./mq-chat-room.js";import"./chunks/professional-overview-C4H_znIJ.js";import"./ui/mq-button.js";import"./ui/mq-floating-bubble.js";import{toast as L}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"./chunks/mutation-controller-CR2qcqhH.js";import"./chunks/price-DU3YLTpk.js";import"./ui/mq-dialog.js";import"./ui/icons/x-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/provide-D2fnEhT2.js";import"./chunks/context-provider--AKuwfs9.js";import"./theme.js";import"./ui/mq-avatar.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/chunk-BUV4MGML-Bn3JWCAv.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./chunks/chunk-Y4EKUX25-CqL3lLdx.js";import"./ui/icons/check-double-icon.js";import"./ui/icons/check-icon.js";import"./chunks/chunk-YTQUGGS3-DmCGIoFy.js";import"./ui/icons/chevron-down-icon.js";import"./ui/mq-text-button.js";const B=j`: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;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}@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 V=class NextAppointmentCard extends w{constructor(){super(...arguments),this.specialtyName="",this.token="",this.patientHash="",this.hasChatSupport=!1,this.isExpired=!1,this.isModifyUnavailable=!1,this.isCancelUnavailable=!1,this.modifyUnavailableMessage="",this.cancelUnavailableMessage="",this.isChatOpen=!1,this.isMenuOpen=!1,this.isCancelDialogOpen=!1,this.openDialog=null,this.closeMenuOnOutsideClick=t=>{t.composedPath().includes(this)||(this.isMenuOpen=!1)},this.closeMenuOnEscape=t=>{"Escape"===t.key&&(this.isMenuOpen=!1)},this.handleJoinVideocall=()=>{I.track(E(this.patientHash,this.appointmentId)),this.dispatchEvent(new z({appointmentId:this.appointmentId}))},this.handleToggleChat=()=>{this.isChatOpen=!this.isChatOpen,this.isChatOpen&&I.track(A(this.patientHash,this.appointmentId))},this.handleModify=()=>{this.isMenuOpen=!1,this.isModifyUnavailable?this.openDialog="modify":(I.track(D(this.patientHash,this.appointmentId)),this.dispatchEvent(new S({appointmentId:this.appointmentId})))},this.handleCancel=()=>{this.isMenuOpen=!1,this.isCancelUnavailable?this.openDialog="cancel":(I.track(T(this.patientHash,this.appointmentId)),this.isCancelDialogOpen=!0)}}static{this.styles=B}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}channelIcon(){switch(this.channel){case h.videocall:return P({size:20});case h.phonecall:return Q({size:20});default:return H({size:20})}}channelLabel(){switch(this.channel){case h.videocall:return r("Videoconsulta");case h.phonecall:return r("Consulta telefónica");default:return r("Chat")}}formatWhen(){const e=t().replace("_","-"),i=this.timezone?{timeZone:this.timezone}:{},n=new Date(this.appointmentResource.appointment.starts_at);if(Number.isNaN(n.getTime()))return"";const o=new Intl.DateTimeFormat(e,{weekday:"long",day:"numeric",month:"long",year:"numeric",...i}).format(n),a=new Intl.DateTimeFormat(e,{timeStyle:"short",...i}).format(n);return r(p`${o}, ${a} h`)}renderActions(){const t=this.channel===h.videocall;return O`<div class="actions">${this.hasChatSupport?O`<mq-button variant="outline" @click="${this.handleToggleChat}">${r("Ir a chat")}</mq-button>`:C} ${t?O`<mq-button class="join" variant="primary" @click="${this.handleJoinVideocall}">${r("Unirse a la videoconsulta")}</mq-button>`:C}<div class="overflow"><mq-button variant="outline" size="icon-lg" aria-label="${r("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}">${r("Modificar cita")}</button> <button class="menu-item negative" type="button" role="menuitem" @click="${this.handleCancel}">${r("Anular cita")}</button></div>`:C}</div></div>`}render(){const{professional:t}=this.appointmentResource,e=this.formatWhen();return O`<professional-overview .name="${t.name}" .specialtyName="${this.specialtyName}" .collegiateNumber="${t.collegiate_number??void 0}" .description="${t.description??""}" .languages="${t.languages??[]}" .avatar="${t.avatar??""}"></professional-overview><div class="details">${e?O`<div class="detail-row">${N({size:20})} <span>${e}</span></div>`:C}<div class="detail-row">${this.channelIcon()} <span>${this.channelLabel()}</span></div></div><div class="footer"><p class="reminder">${r("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.token}" .roomId="${this.appointmentResource.room.id}" .professionalHash="${t.hash}" ?readonly="${this.isExpired}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}"></mq-chat-room>`:C}</mq-floating-bubble><appointment-action-unavailable-dialog .open="${"modify"===this.openDialog}" .heading="${r("Modificar cita")}" .message="${this.modifyUnavailableMessage}" @close="${()=>{this.openDialog=null}}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"cancel"===this.openDialog}" .heading="${r("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,L.success(r("Consulta anulada correctamente")),this.dispatchEvent(new CustomEvent("appointment-cancel-confirmed",{bubbles:!0,composed:!0,detail:{id:this.appointmentId}}))}}"></cancel-appointment-confirmation-dialog>`}};o([q({type:Object})],V.prototype,"appointmentResource",void 0),o([q({type:String})],V.prototype,"specialtyName",void 0),o([q({type:String})],V.prototype,"token",void 0),o([q({type:String})],V.prototype,"patientHash",void 0),o([q({type:String})],V.prototype,"timezone",void 0),o([q({type:Boolean})],V.prototype,"hasChatSupport",void 0),o([q({type:Boolean})],V.prototype,"isExpired",void 0),o([q({type:Boolean})],V.prototype,"isModifyUnavailable",void 0),o([q({type:Boolean})],V.prototype,"isCancelUnavailable",void 0),o([q({type:String})],V.prototype,"modifyUnavailableMessage",void 0),o([q({type:String})],V.prototype,"cancelUnavailableMessage",void 0),o([_()],V.prototype,"isChatOpen",void 0),o([_()],V.prototype,"isMenuOpen",void 0),o([_()],V.prototype,"isCancelDialogOpen",void 0),o([_()],V.prototype,"openDialog",void 0),V=o([c(),a("next-appointment-card")],V);const G=[d.pending,d.accepted],K=j`: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 F=class MqNextAppointments extends w{constructor(){super(...arguments),this.getPatientProfileQuery=new l(this,()=>x(u,{enabled:!this.loginToken})),this.getAppointmentsQuery=new l(this,()=>v(u,{status:G,order:{field:"starts_at",direction:"asc"},page:1,per_page:1})),this.getOrganizationSetupQuery=new l(this,()=>y(u)),this.getOrganizationSpecialtiesQuery=new l(this,()=>b(u)),this.handleViewAll=()=>{this.dispatchEvent(new U({tab:"next"}))}}static{this.styles=K}willUpdate(t){t.has("env")&&this.env&&M(this.env),t.has("apiKey")&&this.apiKey&&u.setApiKey(this.apiKey),t.has("token")&&this.token&&u.setAuthToken(this.token),t.has("locale")&&this.locale&&e(this.locale)&&(i(this.locale),u.setLanguage(this.locale))}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:e=>{const i=e.data?.[0];if(!i)return O`<home-widget-empty-state icon="calendar" heading="${r("No tienes próximas citas")}" description="${r("Cuando agendes una cita, aparecerá aquí para que puedas consultarla, modificarla o cancelarla.")}"></home-widget-empty-state>`;const n=this.getOrganizationSetupQuery.result?.data,o=n?.appointments?.seconds_before_start_to_refund_on_cancel,a=$({startsAtIso:i.appointment.starts_at,refundPolicySeconds:o}),s=g(i.appointment.expires_at),p=0===i.slots.length,c=this.getOrganizationSpecialtiesQuery.result?.data?.find(t=>t.id===i.speciality.id);return O`<next-appointment-card .appointmentResource="${i}" .specialtyName="${k(c?.code??"",t(),c?.name??i.speciality.name)}" .token="${this.accessToken}" .patientHash="${this.patientHash}" .timezone="${this.patientTimezone}" .hasChatSupport="${!0===n?.appointments?.has_chat_in_appointment}" .isExpired="${s}" .isModifyUnavailable="${s||p||!a}" .isCancelUnavailable="${s||!a}" .modifyUnavailableMessage="${f({action:"modify",refundPolicySeconds:o})}" .cancelUnavailableMessage="${f({action:"cancel",refundPolicySeconds:o})}"></next-appointment-card>`},pending:()=>O`<mq-skeleton height="257px"></mq-skeleton>`,error:()=>O`<home-widget-empty-state icon="calendar" heading="${r("No hemos podido cargar tu próxima cita")}" description="${r("Vuelve a intentarlo en unos minutos.")}"></home-widget-empty-state>`})}render(){return O`<section-header heading="${r("Próxima cita")}" action-label="${r("Ver todas")}" @section-action="${this.handleViewAll}"></section-header><div class="card">${this.renderAppointment()}</div>`}};o([q({type:String,attribute:"api-key"})],F.prototype,"apiKey",void 0),o([q({type:String,attribute:"token"})],F.prototype,"token",void 0),o([q({type:String,attribute:"locale"})],F.prototype,"locale",void 0),o([q({type:String,attribute:"env"})],F.prototype,"env",void 0),o([q({type:String,attribute:"timezone"})],F.prototype,"timezone",void 0),o([s({context:m,subscribe:!0})],F.prototype,"loginToken",void 0),F=o([c(),a("mq-next-appointments")],F),n();export{z as MqAppointmentJoinVideocallEvent,S as MqAppointmentRescheduleEvent,F as MqNextAppointments,U as MqViewAppointmentsEvent};
@@ -1 +1 @@
1
- import{isValidLocale as t,setLocale as e,initLocalization as i}from"./i18n.js";import{_ as s,c as o}from"./chunks/custom-element-D2ziPxYE.js";import{m as r}from"./chunks/runtime-Bg1WXVCx.js";import{l as a}from"./chunks/localized-decorator-BlOuLhym.js";import{a as n,P as l}from"./chunks/api-chat-client-BBL1U9EQ.js";import{i as c,a as d,x as p}from"./chunks/lit-element-DiWJYFwC.js";import{n as h}from"./chunks/property-scuRaFcM.js";import{r as u}from"./chunks/state-LQivXIgA.js";import{setEnv as m}from"./env.js";import{MqBackEvent as v,MqPaymentSucceededEvent as f}from"./events.js";import{spinnerIcon as g}from"./ui/icons/spinner-icon.js";import"./ui/mq-button.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"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/if-defined-BYeVdwgd.js";const y="support@mediquo.com",_=c`:host{display:flex;flex-direction:column;align-items:center;justify-content:center;flex:1;min-height:320px;padding:var(--sp-6);box-sizing:border-box}.card{width:100%;max-width:460px;box-sizing:border-box;padding:var(--sp-10);background:var(--color-card);border-radius:var(--border-radius-lg);box-shadow:var(--shadow-lg)}.verifying{display:flex;flex-direction:column;align-items:center;gap:var(--sp-4);text-align:center}.outcome{display:flex;flex-direction:column;gap:var(--sp-4)}.title{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-negative);margin:0}.verifying .title{font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-semibold);color:var(--color-neutrals-text-default)}.message{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-subtle);margin:0}.support a{color:var(--color-primary-text-link);font-weight:var(--font-weight-medium);text-decoration:none}.support a:hover{text-decoration:underline}.actions{display:flex;flex-direction:column;gap:var(--sp-3);margin-top:var(--sp-2)}`;let b=class MqPaymentPoller extends d{constructor(){super(...arguments),this.timeoutMs=9e4,this._view="verifying",this._deadline=0,this._settled=!1,this._onRetry=()=>{this._restart()},this._onBack=()=>{this.dispatchEvent(new v({source:"payment-poller"}))}}static{this.styles=_}willUpdate(i){i.has("env")&&this.env&&m(this.env),i.has("apiKey")&&this.apiKey&&n.setApiKey(this.apiKey),i.has("token")&&this.token&&n.setAuthToken(this.token),i.has("locale")&&this.locale&&t(this.locale)&&(e(this.locale),n.setLanguage(this.locale))}updated(t){t.has("sessionId")&&this._restart()}disconnectedCallback(){this._stop(),super.disconnectedCallback()}_restart(){this._stop(),this._settled=!1,this._view="verifying",this.sessionId&&(this._deadline=Date.now()+this.timeoutMs,this._pollOnce(),this._intervalId=setInterval(()=>{this._pollOnce()},2e3))}_stop(){void 0!==this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0)}_settle(t){this._stop(),this._settled=!0,this._view=t}async _pollOnce(){const t=this.sessionId;if(this._settled||!t)return;if(Date.now()>=this._deadline)return void this._settle("timeout");let e;try{e=await n.payments.getPaymentSession(t)}catch{return}return this._settled||t!==this.sessionId?void 0:e.status===l.Paid?(this._stop(),this._settled=!0,void this.dispatchEvent(new f({appointmentId:e.consultation_id,consultationType:e.consultation_type}))):void(e.status===l.Denied&&this._settle("denied"))}_renderVerifying(){return p`<div class="card"><div class="verifying" role="status" aria-live="polite">${g({size:28,color:"var(--color-primary)"})}<p class="title">${r("Confirmando tu pago")}</p><p class="message">${r("No cierres, vuelvas atrás ni actualices la ventana; esto puede tardar unos momentos.")}</p></div></div>`}_renderDenied(){return p`<div class="card"><div class="outcome" role="alert"><p class="title">${r("Tu pago no se ha completado")}</p><p class="message">${r("El pago ha sido rechazado y no hemos creado la cita. No se te ha cobrado nada: vuelve a intentarlo con otro método de pago.")}</p><div class="actions"><mq-button variant="primary" size="lg" fullwidth @click="${this._onBack}">${r("Volver")}</mq-button></div></div></div>`}_renderTimeout(){return p`<div class="card"><div class="outcome" role="alert"><p class="title">${r("Ha ocurrido un error")}</p><p class="message">${r("No hemos podido confirmar tu pago. Por favor, inténtalo de nuevo más tarde.")}</p><p class="message support">${r("Si se te ha cobrado sin una cita confirmada, contacta con nuestro equipo en")} <a href="mailto:${y}">${y}</a></p><div class="actions"><mq-button variant="primary" size="lg" fullwidth @click="${this._onRetry}">${r("Reintentar verificación")}</mq-button><mq-button variant="secondary" size="lg" fullwidth @click="${this._onBack}">${r("Volver")}</mq-button></div></div></div>`}render(){switch(this._view){case"denied":return this._renderDenied();case"timeout":return this._renderTimeout();default:return this._renderVerifying()}}};s([h({type:String,attribute:"session-id"})],b.prototype,"sessionId",void 0),s([h({type:String,attribute:"api-key"})],b.prototype,"apiKey",void 0),s([h({type:String,attribute:"token"})],b.prototype,"token",void 0),s([h({type:String,attribute:"locale"})],b.prototype,"locale",void 0),s([h({type:String,attribute:"env"})],b.prototype,"env",void 0),s([h({type:Number,attribute:"timeout-ms"})],b.prototype,"timeoutMs",void 0),s([u()],b.prototype,"_view",void 0),b=s([a(),o("mq-payment-poller")],b),i();export{b as MqPaymentPoller,f as MqPaymentSucceededEvent};
1
+ import{isValidLocale as t,setLocale as e,initLocalization as i}from"./i18n.js";import{_ as s,c as o}from"./chunks/custom-element-D2ziPxYE.js";import{m as r}from"./chunks/runtime-Bg1WXVCx.js";import{l as a}from"./chunks/localized-decorator-BlOuLhym.js";import{a as n,P as l}from"./chunks/api-chat-client-DLOZVIkT.js";import{i as c,a as d,x as p}from"./chunks/lit-element-DiWJYFwC.js";import{n as h}from"./chunks/property-scuRaFcM.js";import{r as u}from"./chunks/state-LQivXIgA.js";import{setEnv as m}from"./env.js";import{MqBackEvent as v,MqPaymentSucceededEvent as f}from"./events.js";import{spinnerIcon as g}from"./ui/icons/spinner-icon.js";import"./ui/mq-button.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"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/if-defined-BYeVdwgd.js";const y="support@mediquo.com",_=c`:host{display:flex;flex-direction:column;align-items:center;justify-content:center;flex:1;min-height:320px;padding:var(--sp-6);box-sizing:border-box}.card{width:100%;max-width:460px;box-sizing:border-box;padding:var(--sp-10);background:var(--color-card);border-radius:var(--border-radius-lg);box-shadow:var(--shadow-lg)}.verifying{display:flex;flex-direction:column;align-items:center;gap:var(--sp-4);text-align:center}.outcome{display:flex;flex-direction:column;gap:var(--sp-4)}.title{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);color:var(--color-negative);margin:0}.verifying .title{font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-semibold);color:var(--color-neutrals-text-default)}.message{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-subtle);margin:0}.support a{color:var(--color-primary-text-link);font-weight:var(--font-weight-medium);text-decoration:none}.support a:hover{text-decoration:underline}.actions{display:flex;flex-direction:column;gap:var(--sp-3);margin-top:var(--sp-2)}`;let b=class MqPaymentPoller extends d{constructor(){super(...arguments),this.timeoutMs=9e4,this._view="verifying",this._deadline=0,this._settled=!1,this._onRetry=()=>{this._restart()},this._onBack=()=>{this.dispatchEvent(new v({source:"payment-poller"}))}}static{this.styles=_}willUpdate(i){i.has("env")&&this.env&&m(this.env),i.has("apiKey")&&this.apiKey&&n.setApiKey(this.apiKey),i.has("token")&&this.token&&n.setAuthToken(this.token),i.has("locale")&&this.locale&&t(this.locale)&&(e(this.locale),n.setLanguage(this.locale))}updated(t){t.has("sessionId")&&this._restart()}disconnectedCallback(){this._stop(),super.disconnectedCallback()}_restart(){this._stop(),this._settled=!1,this._view="verifying",this.sessionId&&(this._deadline=Date.now()+this.timeoutMs,this._pollOnce(),this._intervalId=setInterval(()=>{this._pollOnce()},2e3))}_stop(){void 0!==this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0)}_settle(t){this._stop(),this._settled=!0,this._view=t}async _pollOnce(){const t=this.sessionId;if(this._settled||!t)return;if(Date.now()>=this._deadline)return void this._settle("timeout");let e;try{e=await n.payments.getPaymentSession(t)}catch{return}return this._settled||t!==this.sessionId?void 0:e.status===l.Paid?(this._stop(),this._settled=!0,void this.dispatchEvent(new f({appointmentId:e.consultation_id,consultationType:e.consultation_type}))):void(e.status===l.Denied&&this._settle("denied"))}_renderVerifying(){return p`<div class="card"><div class="verifying" role="status" aria-live="polite">${g({size:28,color:"var(--color-primary)"})}<p class="title">${r("Confirmando tu pago")}</p><p class="message">${r("No cierres, vuelvas atrás ni actualices la ventana; esto puede tardar unos momentos.")}</p></div></div>`}_renderDenied(){return p`<div class="card"><div class="outcome" role="alert"><p class="title">${r("Tu pago no se ha completado")}</p><p class="message">${r("El pago ha sido rechazado y no hemos creado la cita. No se te ha cobrado nada: vuelve a intentarlo con otro método de pago.")}</p><div class="actions"><mq-button variant="primary" size="lg" fullwidth @click="${this._onBack}">${r("Volver")}</mq-button></div></div></div>`}_renderTimeout(){return p`<div class="card"><div class="outcome" role="alert"><p class="title">${r("Ha ocurrido un error")}</p><p class="message">${r("No hemos podido confirmar tu pago. Por favor, inténtalo de nuevo más tarde.")}</p><p class="message support">${r("Si se te ha cobrado sin una cita confirmada, contacta con nuestro equipo en")} <a href="mailto:${y}">${y}</a></p><div class="actions"><mq-button variant="primary" size="lg" fullwidth @click="${this._onRetry}">${r("Reintentar verificación")}</mq-button><mq-button variant="secondary" size="lg" fullwidth @click="${this._onBack}">${r("Volver")}</mq-button></div></div></div>`}render(){switch(this._view){case"denied":return this._renderDenied();case"timeout":return this._renderTimeout();default:return this._renderVerifying()}}};s([h({type:String,attribute:"session-id"})],b.prototype,"sessionId",void 0),s([h({type:String,attribute:"api-key"})],b.prototype,"apiKey",void 0),s([h({type:String,attribute:"token"})],b.prototype,"token",void 0),s([h({type:String,attribute:"locale"})],b.prototype,"locale",void 0),s([h({type:String,attribute:"env"})],b.prototype,"env",void 0),s([h({type:Number,attribute:"timeout-ms"})],b.prototype,"timeoutMs",void 0),s([u()],b.prototype,"_view",void 0),b=s([a(),o("mq-payment-poller")],b),i();export{b as MqPaymentPoller,f as MqPaymentSucceededEvent};
@@ -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-DLOZVIkT.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-DLOZVIkT.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 P=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 I=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=P}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})],I.prototype,"documentId",void 0),s([x({type:String})],I.prototype,"kind",void 0),s([x({type:String})],I.prototype,"name",void 0),s([x({type:String})],I.prototype,"specialty",void 0),s([x({type:String})],I.prototype,"date",void 0),s([x({type:String})],I.prototype,"downloadUrl",void 0),s([x({type:String})],I.prototype,"patientHash",void 0),s([H()],I.prototype,"isDownloading",void 0),I=s([c(),n("recent-document-row")],I);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};
@@ -5,8 +5,8 @@ import { Env } from './env.js';
5
5
  import './ui/mq-callout.js';
6
6
  import './ui/mq-button.js';
7
7
  import './chunks/professional-overview-mO3tuMuH.js';
8
- import './chunks/appointment-details-DpzdYLjq.js';
9
- import './chunks/mq-chat-room-DuG4RuIp.js';
8
+ import './chunks/appointment-details-CVEDe_k0.js';
9
+ import './chunks/mq-chat-room-CRPruRJD.js';
10
10
  import './ui/mq-floating-bubble.js';
11
11
  import './ui/mq-unread-badge.js';
12
12
  import './ui/mq-skeleton.js';
@@ -14,7 +14,7 @@ import './ui/mq-card.js';
14
14
  import { QueryClient } from '@tanstack/query-core';
15
15
  import './ui/mq-text-button.js';
16
16
  import './ui/mq-avatar.js';
17
- import './chunks/appointment.model.d-Dy50gMPg.js';
17
+ import './chunks/appointment.model.d-BWwBLaEL.js';
18
18
  import 'zod';
19
19
 
20
20
  declare class MqScheduleSuccessSkeleton extends LitElement {
@@ -74,7 +74,6 @@ declare class MqScheduleSuccess extends LitElement {
74
74
  private getAppointmentQuery;
75
75
  private getCouponQuery;
76
76
  private getOrganizationSpecialtiesQuery;
77
- private getOrganizationSetupQuery;
78
77
  private isChatOpen;
79
78
  private unreadQuery;
80
79
  private get _patientHash();
@@ -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-DLOZVIkT.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-Czlj6VHq.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 S}from"./chunks/get-patient-profile-query-DiU2f_QH.js";import{g as z}from"./chunks/chunk-Y4EKUX25-CqL3lLdx.js";import{calendarIcon as I}from"./ui/icons/calendar-icon.js";import{chatbubbleIcon as A}from"./ui/icons/chat-bubble-icon.js";import{videoIcon as T}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 O,a as Q}from"./chunks/i18n-formats-EgnwLxKt.js";import{f as P}from"./chunks/price-DU3YLTpk.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,k as V,l as H,m as B,n as G}from"./chunks/telemetry-client-Bkbn48Dd.js";import{a as K}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 U=p`header{padding:var(--sp-6) var(--sp-4);display:flex;align-items:center;gap:var(--sp-2);max-width:var(--content-max-width);margin:0 auto}.summary{padding:var(--sp-6) var(--sp-4);background-color:var(--color-neutrals-background-weak);max-width:var(--content-max-width);margin:0 auto}.summary-content{display:flex;flex-direction:column;gap:var(--sp-4)}.manage-appointment{box-sizing:border-box;max-width:var(--content-max-width);margin:0 auto}`;let M=class MqScheduleSuccessSkeleton extends l{static{this.styles=U}render(){return d`<div><header><mq-skeleton width="220px" height="40px" border-radius="md"></mq-skeleton></header><div class="summary"><div class="summary-content"><mq-skeleton width="280px" height="32px" border-radius="md"></mq-skeleton><mq-skeleton width="100%" height="400px" border-radius="lg"></mq-skeleton><mq-skeleton width="100%" height="80px" border-radius="lg"></mq-skeleton></div></div><div class="manage-appointment"><mq-skeleton width="100%" height="313px" border-radius="lg"></mq-skeleton></div></div>`}};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 F=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,()=>O(k)),this.isChatOpen=!1,this.unreadQuery=new q(this,()=>z(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=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>${P({amount:o,currency:n},e)}</span></div>${r?d`<div class="price-row"><span>${h} (-${u}%)</span> <span>${P({amount:-a,currency:n},e)}</span></div><hr><div class="price-row price-row--total"><span>${s("Total")}</span> <span>${P({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=K(o,t.duration),a=this.getOrganizationSpecialtiesQuery.result?.data?.find(e=>e.id===Number(t.speciality_id)),c=Q(a?.code??"",e,a?.name),p=t.channel===b.videocall,l=t.channel===b.phonecall,u=!0===t.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="${()=>{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")}}">${I({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}}">${A({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}))}}">${T({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})],F.prototype,"kind",void 0),n([u({type:String})],F.prototype,"appointmentId",void 0),n([u({type:String,attribute:"api-key"})],F.prototype,"apiKey",void 0),n([u({type:String,attribute:"token"})],F.prototype,"token",void 0),n([u({type:String,attribute:"timezone"})],F.prototype,"timezone",void 0),n([u({type:String,attribute:"locale"})],F.prototype,"locale",void 0),n([u({type:String,attribute:"env"})],F.prototype,"env",void 0),n([u({type:Boolean,attribute:"show-nav-ctas"})],F.prototype,"showNavCtas",void 0),n([w({context:E,subscribe:!0})],F.prototype,"queryClientContext",void 0),n([w({context:$})],F.prototype,"loginToken",void 0),n([h()],F.prototype,"isChatOpen",void 0),F=n([c(),a("mq-schedule-success")],F),o();export{F as MqScheduleSuccess,OpenVideocallEvent};