@mediquo/elements 0.9.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/chunks/api-chat-client-BhxUWldC.js +1 -0
  2. package/dist/chunks/{apple-pay-outcomes-DbuQ2LI3.js → apple-pay-outcomes-BU_PyQdT.js} +1 -1
  3. package/dist/chunks/{chunk-Y4EKUX25-CWAZgcgw.js → chunk-Y4EKUX25-QqMl3eiq.js} +1 -1
  4. package/dist/chunks/{chunk-YTQUGGS3-DJR1Yoyy.js → chunk-YTQUGGS3-DmCGIoFy.js} +1 -1
  5. package/dist/chunks/documentation-view-CEfoq9vD.js +1 -0
  6. package/dist/chunks/{external-BXLaKy9c.js → external-CJj32K_p.js} +1 -1
  7. package/dist/chunks/{index-Dbbpnw8f.d.ts → index-Bv4Mk1Ch.d.ts} +1 -1
  8. package/dist/chunks/{index-ClLOggjQ.js → index-CYBd3XL2.js} +1 -1
  9. package/dist/chunks/{index-CFlNQLy2.d.ts → index-Cgni0Is9.d.ts} +1 -1
  10. package/dist/chunks/{index-DdkeWQrh.d.ts → index-D0njwg5o.d.ts} +1 -1
  11. package/dist/chunks/{index-BLxNeTVi.js → index-DjD-3x4f.js} +1 -1
  12. package/dist/chunks/{index.d-XSe7Hy-Q.d.ts → index.d-DeJP_xib.d.ts} +13 -22
  13. package/dist/chunks/{mq-chat-room-jeDvIF1Z.d.ts → mq-chat-room-B3ant6md.d.ts} +1 -1
  14. package/dist/chunks/{mq-next-appointments-5tvQaSba.js → mq-next-appointments-BdsRyXJB.js} +1 -1
  15. package/dist/chunks/{mq-recent-documents-DzsyvBjW.js → mq-recent-documents-CNweIX5U.js} +1 -1
  16. package/dist/chunks/{next-appointment-card-DBXsY3Sp.d.ts → next-appointment-card-CWz0tef1.d.ts} +2 -2
  17. package/dist/chunks/{next-appointment-card-DQE7dNXw.js → next-appointment-card-KXLkEJDg.js} +1 -1
  18. package/dist/chunks/professional-overview-B4E05rLd.js +1 -0
  19. package/dist/env.js +1 -1
  20. package/dist/events.d.ts +3 -44
  21. package/dist/i18n.js +1 -1
  22. package/dist/mq-api-client-provider.d.ts +1 -1
  23. package/dist/mq-api-client-provider.js +1 -1
  24. package/dist/mq-apple-pay-checkout.d.ts +1 -1
  25. package/dist/mq-apple-pay-checkout.js +1 -1
  26. package/dist/mq-appointment-checkout.d.ts +1 -1
  27. package/dist/mq-appointment-checkout.js +1 -1
  28. package/dist/mq-appointment-documentation.d.ts +4 -3
  29. package/dist/mq-appointment-documentation.js +1 -1
  30. package/dist/mq-chat-room.d.ts +2 -2
  31. package/dist/mq-chat-room.js +1 -1
  32. package/dist/mq-checkout.d.ts +1 -1
  33. package/dist/mq-checkout.js +1 -1
  34. package/dist/mq-dashboard.d.ts +4 -4
  35. package/dist/mq-dashboard.js +1 -1
  36. package/dist/mq-documents.d.ts +2 -2
  37. package/dist/mq-documents.js +1 -1
  38. package/dist/mq-google-pay-checkout.d.ts +1 -1
  39. package/dist/mq-google-pay-checkout.js +1 -1
  40. package/dist/mq-immediate-videocall-checkout.d.ts +1 -1
  41. package/dist/mq-immediate-videocall-checkout.js +1 -1
  42. package/dist/mq-my-appointments.d.ts +3 -3
  43. package/dist/mq-my-appointments.js +1 -1
  44. package/dist/mq-next-appointments.d.ts +3 -3
  45. package/dist/mq-next-appointments.js +1 -1
  46. package/dist/mq-payment-poller.d.ts +15 -23
  47. package/dist/mq-payment-poller.js +1 -1
  48. package/dist/mq-professional-presence-sync.js +1 -1
  49. package/dist/mq-recent-documents.d.ts +2 -2
  50. package/dist/mq-recent-documents.js +1 -1
  51. package/dist/mq-schedule-success.d.ts +2 -2
  52. package/dist/mq-schedule-success.js +1 -1
  53. package/dist/mq-schedule.d.ts +1 -1
  54. package/dist/mq-schedule.js +1 -1
  55. package/dist/mq-socket-provider.js +1 -1
  56. package/dist/mq-support-chat.d.ts +2 -2
  57. package/dist/mq-support-chat.js +1 -1
  58. package/dist/mq-terms-and-conditions.d.ts +2 -2
  59. package/dist/mq-terms-and-conditions.js +1 -1
  60. package/dist/mq-unread-count-sync.js +1 -1
  61. package/dist/mq-videocall.d.ts +3 -3
  62. package/dist/mq-videocall.js +1 -1
  63. package/dist/react/mq-api-client-provider.d.ts +1 -1
  64. package/dist/react/mq-api-client-provider.js +1 -1
  65. package/dist/react/mq-apple-pay-checkout.d.ts +1 -1
  66. package/dist/react/mq-apple-pay-checkout.js +1 -1
  67. package/dist/react/mq-appointment-checkout.d.ts +1 -1
  68. package/dist/react/mq-appointment-checkout.js +1 -1
  69. package/dist/react/mq-appointment-documentation.d.ts +4 -3
  70. package/dist/react/mq-appointment-documentation.js +1 -1
  71. package/dist/react/mq-chat-room.d.ts +2 -2
  72. package/dist/react/mq-chat-room.js +1 -1
  73. package/dist/react/mq-checkout.d.ts +1 -1
  74. package/dist/react/mq-checkout.js +1 -1
  75. package/dist/react/mq-dashboard.d.ts +4 -4
  76. package/dist/react/mq-dashboard.js +1 -1
  77. package/dist/react/mq-documents-page.d.ts +2 -2
  78. package/dist/react/mq-documents-page.js +1 -1
  79. package/dist/react/mq-documents.d.ts +2 -2
  80. package/dist/react/mq-documents.js +1 -1
  81. package/dist/react/mq-google-pay-checkout.d.ts +1 -1
  82. package/dist/react/mq-google-pay-checkout.js +1 -1
  83. package/dist/react/mq-immediate-videocall-checkout.d.ts +1 -1
  84. package/dist/react/mq-immediate-videocall-checkout.js +1 -1
  85. package/dist/react/mq-my-appointments.d.ts +3 -3
  86. package/dist/react/mq-my-appointments.js +1 -1
  87. package/dist/react/mq-next-appointments.d.ts +3 -3
  88. package/dist/react/mq-next-appointments.js +1 -1
  89. package/dist/react/mq-payment-poller.d.ts +6 -13
  90. package/dist/react/mq-payment-poller.js +1 -1
  91. package/dist/react/mq-professional-presence-sync.js +1 -1
  92. package/dist/react/mq-recent-documents.d.ts +2 -2
  93. package/dist/react/mq-recent-documents.js +1 -1
  94. package/dist/react/mq-schedule-success.d.ts +2 -2
  95. package/dist/react/mq-schedule-success.js +1 -1
  96. package/dist/react/mq-schedule.d.ts +1 -1
  97. package/dist/react/mq-schedule.js +1 -1
  98. package/dist/react/mq-socket-provider.js +1 -1
  99. package/dist/react/mq-support-chat.d.ts +2 -2
  100. package/dist/react/mq-support-chat.js +1 -1
  101. package/dist/react/mq-terms-and-conditions.d.ts +2 -2
  102. package/dist/react/mq-terms-and-conditions.js +1 -1
  103. package/dist/react/mq-unread-count-sync.js +1 -1
  104. package/dist/react/mq-videocall.d.ts +3 -3
  105. package/dist/react/mq-videocall.js +1 -1
  106. package/package.json +1 -1
  107. package/dist/chunks/api-chat-client-fYDIH220.js +0 -1
  108. package/dist/chunks/documentation-view-DywQ1MfS.js +0 -1
  109. package/dist/chunks/professional-overview-C4H_znIJ.js +0 -1
@@ -1 +1 @@
1
- import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{e as n}from"./chunks/provide-BwI4DDGF.js";import{c as a}from"./chunks/consume-CovVqBjI.js";import{m as o}from"./chunks/runtime-Bg1WXVCx.js";import{l as i}from"./chunks/localized-decorator-BlOuLhym.js";import{A as s}from"./chunks/api-client-context-V1UAGtKW.js";import{L as r}from"./chunks/login-token-task-Yib__6a9.js";import{l}from"./chunks/chunk-4FFT6DC2-CVWibomC.js";import{i as c,a as h,x as u}from"./chunks/lit-element-DiWJYFwC.js";import{n as p}from"./chunks/property-scuRaFcM.js";import{r as y}from"./chunks/state-LQivXIgA.js";import{setEnv as d}from"./env.js";import{initLocalization as m,setLocale as g,isValidLocale as v}from"./i18n.js";import{b,c as k,n as _}from"./chunks/api-chat-client-fYDIH220.js";import{r as C}from"./chunks/apple-pay-outcomes-DbuQ2LI3.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/external-BXLaKy9c.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";function f(){return"undefined"!=typeof google&&"function"==typeof google.payments?.api?.PaymentsClient}const E=["PAN_ONLY","CRYPTOGRAM_3DS"],w=["VISA","MASTERCARD","AMEX"];function P(t){return{type:"PAYMENT_GATEWAY",parameters:{gateway:"globalpayments",gatewayMerchantId:t}}}function I(t){return{type:"CARD",parameters:{allowedAuthMethods:[...E],allowedCardNetworks:[...w]},tokenizationSpecification:P(t)}}function S(t){return[I(t)]}function G(t,e){return"test"===e?"TEST":"production"===e?"PRODUCTION":"development"===t?"TEST":"PRODUCTION"}function j(t,e){return function(t,e){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:S(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 T(t,e,n,a={}){if("undefined"==typeof window||!window.isSecureContext)return l.warn("google-pay: unavailable outside a secure context"),{available:!1,reason:"unsupported"};if(!t.trim())return l.warn("google-pay: missing merchant id"),{available:!1,reason:"merchant-id-missing"};if(!e.trim())return l.warn("google-pay: missing gateway merchant id"),{available:!1,reason:"gateway-merchant-id-missing"};if(!await function(t=8e3,e){return f()?Promise.resolve(!0):t<=0||e?.aborted?Promise.resolve(!1):new Promise(n=>{const a=Date.now()+t,o=t=>{clearInterval(s),e?.removeEventListener("abort",i),n(t)},i=()=>o(!1),s=setInterval(()=>{f()?o(!0):Date.now()>=a&&o(!1)},100);e?.addEventListener("abort",i,{once:!0})})}(a.sdkWaitTimeoutMs,a.signal))return l.warn("google-pay: pay.js was not loaded by the host page"),{available:!1,reason:"sdk-missing"};const o=G(n,a.gatewayEnvironment);try{const t=new google.payments.api.PaymentsClient({environment:o}),n=await t.isReadyToPay(function(t){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:S(t)}}(e));return n.result?{available:!0}:(l.warn("google-pay: isReadyToPay returned false",{environment:o}),{available:!1,reason:"unsupported"})}catch(t){return l.warn("google-pay: isReadyToPay threw",{environment:o,error:t instanceof Error?t.message:String(t)}),{available:!1,reason:"unsupported"}}}function A(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"}:b(t)&&400===t.response?.status?{kind:"denied",sessionId:e}:{kind:"authorize"}}function D(t){if(null!==t&&"object"==typeof t){const e=t.paymentMethodData?.tokenizationData,n=e?.token;if("string"==typeof n&&n.length>0)return n}throw new Error("Invalid Google Pay payment data: missing tokenizationData.token")}try{m()}catch{}const N=c`: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 x=new Set(["sdk-missing","unsupported"]);function M(t,e){l.warn(t,{error:e instanceof Error?e.message:String(e)})}let R=class MqGooglePayCheckout extends h{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.apiClient=k(),this._loginTokenTask=new r(this,()=>this.apiClient,{args:()=>[this.apiKey,this.token],onComplete:t=>{this._sessionToken=t.access_token,this.apiClient.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=N}willUpdate(t){t.has("env")&&(this.env&&d(this.env),this._resetPaymentsClient()),t.has("gatewayEnvironment")&&this._resetPaymentsClient(),t.has("locale")&&g(v(this.locale)?this.locale:"es_ES");const e=_(t,{env:this.env,apiKey:this.apiKey,token:this._sessionToken,locale:v(this.locale)?this.locale:"es_ES"},this.inheritedApiClient);e&&(this.apiClient=e),(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=G(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 T(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(x.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){M("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(j({merchantId:this.merchantId,gatewayMerchantId:this.gatewayMerchantId,merchantName:this.merchantName||this.label},{amount:this.amount,currencyCode:this.currency,countryCode:this.country})),e=await this.apiClient.payments.authorizeGooglePay({order_id:this.sessionId,token:D(t)}),{status:n,consultation_id:a}=e.data,o=C(n,a,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=A(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":M("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 u`<p class="state">${o("Falta el identificador de comercio de Google Pay")}</p>`;case"gateway-merchant-id-missing":return u`<p class="state">${o("Falta el identificador de pasarela de Google Pay")}</p>`;case"sdk-missing":return u`<p class="state">${o("No se ha podido cargar Google Pay. Comprueba la configuración del sitio e inténtalo de nuevo.")}</p>`;default:return u`<p class="state">${o("Google Pay no está disponible. Prueba con tarjeta u otro método de pago.")}</p>`}}render(){return this._loginTokenTask.render({pending:()=>u`<p class="state">${o("Preparando Google Pay…")}</p>`,error:()=>u`<p class="state">${o("No hemos podido iniciar el pago")}</p>`,complete:()=>"checking"===this._availabilityPhase?u`<p class="state">${o("Comprobando Google Pay…")}</p>`:"unavailable"===this._availabilityPhase?this._renderUnavailable():u`<div class="pay-row ${this._paying?"pay-row--paying":""}"><slot name="google-pay-button"></slot></div>`})}};t([p({type:String,attribute:"env"})],R.prototype,"env",void 0),t([p({type:String,attribute:"gateway-environment"})],R.prototype,"gatewayEnvironment",void 0),t([p({type:String,attribute:"api-key"})],R.prototype,"apiKey",void 0),t([p({type:String,attribute:"token"})],R.prototype,"token",void 0),t([p({type:String,attribute:"locale",reflect:!0})],R.prototype,"locale",void 0),t([p({type:String,attribute:"merchant-id"})],R.prototype,"merchantId",void 0),t([p({type:String,attribute:"gateway-merchant-id"})],R.prototype,"gatewayMerchantId",void 0),t([p({type:String,attribute:"merchant-name"})],R.prototype,"merchantName",void 0),t([p({type:String,attribute:"session-id"})],R.prototype,"sessionId",void 0),t([p({type:String,attribute:"amount"})],R.prototype,"amount",void 0),t([p({type:String,attribute:"currency"})],R.prototype,"currency",void 0),t([p({type:String,attribute:"country"})],R.prototype,"country",void 0),t([p({type:String,attribute:"label"})],R.prototype,"label",void 0),t([y()],R.prototype,"_availabilityPhase",void 0),t([y()],R.prototype,"_unavailableReason",void 0),t([y()],R.prototype,"_paying",void 0),t([a({context:s,subscribe:!0}),y()],R.prototype,"inheritedApiClient",void 0),t([n({context:s}),y()],R.prototype,"apiClient",void 0),R=t([i(),e("mq-google-pay-checkout")],R);export{GooglePayCheckoutDeniedEvent,GooglePayCheckoutErrorEvent,GooglePayCheckoutSuccessEvent,R as MqGooglePayCheckout};
1
+ import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{e as n}from"./chunks/provide-BwI4DDGF.js";import{c as a}from"./chunks/consume-CovVqBjI.js";import{m as o}from"./chunks/runtime-Bg1WXVCx.js";import{l as i}from"./chunks/localized-decorator-BlOuLhym.js";import{A as s}from"./chunks/api-client-context-V1UAGtKW.js";import{L as r}from"./chunks/login-token-task-Yib__6a9.js";import{l}from"./chunks/chunk-4FFT6DC2-CVWibomC.js";import{i as c,a as h,x as u}from"./chunks/lit-element-DiWJYFwC.js";import{n as p}from"./chunks/property-scuRaFcM.js";import{r as y}from"./chunks/state-LQivXIgA.js";import{setEnv as d}from"./env.js";import{initLocalization as m,setLocale as g,isValidLocale as v}from"./i18n.js";import{i as b,c as k,n as _}from"./chunks/api-chat-client-BhxUWldC.js";import{r as C}from"./chunks/apple-pay-outcomes-BU_PyQdT.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/external-CJj32K_p.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";function f(){return"undefined"!=typeof google&&"function"==typeof google.payments?.api?.PaymentsClient}const E=["PAN_ONLY","CRYPTOGRAM_3DS"],w=["VISA","MASTERCARD","AMEX"];function P(t){return{type:"PAYMENT_GATEWAY",parameters:{gateway:"globalpayments",gatewayMerchantId:t}}}function I(t){return{type:"CARD",parameters:{allowedAuthMethods:[...E],allowedCardNetworks:[...w]},tokenizationSpecification:P(t)}}function S(t){return[I(t)]}function G(t,e){return"test"===e?"TEST":"production"===e?"PRODUCTION":"development"===t?"TEST":"PRODUCTION"}function j(t,e){return function(t,e){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:S(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 T(t,e,n,a={}){if("undefined"==typeof window||!window.isSecureContext)return l.warn("google-pay: unavailable outside a secure context"),{available:!1,reason:"unsupported"};if(!t.trim())return l.warn("google-pay: missing merchant id"),{available:!1,reason:"merchant-id-missing"};if(!e.trim())return l.warn("google-pay: missing gateway merchant id"),{available:!1,reason:"gateway-merchant-id-missing"};if(!await function(t=8e3,e){return f()?Promise.resolve(!0):t<=0||e?.aborted?Promise.resolve(!1):new Promise(n=>{const a=Date.now()+t,o=t=>{clearInterval(s),e?.removeEventListener("abort",i),n(t)},i=()=>o(!1),s=setInterval(()=>{f()?o(!0):Date.now()>=a&&o(!1)},100);e?.addEventListener("abort",i,{once:!0})})}(a.sdkWaitTimeoutMs,a.signal))return l.warn("google-pay: pay.js was not loaded by the host page"),{available:!1,reason:"sdk-missing"};const o=G(n,a.gatewayEnvironment);try{const t=new google.payments.api.PaymentsClient({environment:o}),n=await t.isReadyToPay(function(t){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:S(t)}}(e));return n.result?{available:!0}:(l.warn("google-pay: isReadyToPay returned false",{environment:o}),{available:!1,reason:"unsupported"})}catch(t){return l.warn("google-pay: isReadyToPay threw",{environment:o,error:t instanceof Error?t.message:String(t)}),{available:!1,reason:"unsupported"}}}function A(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"}:b(t)&&400===t.response?.status?{kind:"denied",sessionId:e}:{kind:"authorize"}}function D(t){if(null!==t&&"object"==typeof t){const e=t.paymentMethodData?.tokenizationData,n=e?.token;if("string"==typeof n&&n.length>0)return n}throw new Error("Invalid Google Pay payment data: missing tokenizationData.token")}try{m()}catch{}const N=c`: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 x=new Set(["sdk-missing","unsupported"]);function M(t,e){l.warn(t,{error:e instanceof Error?e.message:String(e)})}let R=class MqGooglePayCheckout extends h{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.apiClient=k(),this._loginTokenTask=new r(this,()=>this.apiClient,{args:()=>[this.apiKey,this.token],onComplete:t=>{this._sessionToken=t.access_token,this.apiClient.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=N}willUpdate(t){t.has("env")&&(this.env&&d(this.env),this._resetPaymentsClient()),t.has("gatewayEnvironment")&&this._resetPaymentsClient(),t.has("locale")&&g(v(this.locale)?this.locale:"es_ES");const e=_(t,{env:this.env,apiKey:this.apiKey,token:this._sessionToken,locale:v(this.locale)?this.locale:"es_ES"},this.inheritedApiClient);e&&(this.apiClient=e),(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=G(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 T(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(x.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){M("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(j({merchantId:this.merchantId,gatewayMerchantId:this.gatewayMerchantId,merchantName:this.merchantName||this.label},{amount:this.amount,currencyCode:this.currency,countryCode:this.country})),e=await this.apiClient.payments.authorizeGooglePay({order_id:this.sessionId,token:D(t)}),{status:n,consultation_id:a}=e.data,o=C(n,a,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=A(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":M("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 u`<p class="state">${o("Falta el identificador de comercio de Google Pay")}</p>`;case"gateway-merchant-id-missing":return u`<p class="state">${o("Falta el identificador de pasarela de Google Pay")}</p>`;case"sdk-missing":return u`<p class="state">${o("No se ha podido cargar Google Pay. Comprueba la configuración del sitio e inténtalo de nuevo.")}</p>`;default:return u`<p class="state">${o("Google Pay no está disponible. Prueba con tarjeta u otro método de pago.")}</p>`}}render(){return this._loginTokenTask.render({pending:()=>u`<p class="state">${o("Preparando Google Pay…")}</p>`,error:()=>u`<p class="state">${o("No hemos podido iniciar el pago")}</p>`,complete:()=>"checking"===this._availabilityPhase?u`<p class="state">${o("Comprobando Google Pay…")}</p>`:"unavailable"===this._availabilityPhase?this._renderUnavailable():u`<div class="pay-row ${this._paying?"pay-row--paying":""}"><slot name="google-pay-button"></slot></div>`})}};t([p({type:String,attribute:"env"})],R.prototype,"env",void 0),t([p({type:String,attribute:"gateway-environment"})],R.prototype,"gatewayEnvironment",void 0),t([p({type:String,attribute:"api-key"})],R.prototype,"apiKey",void 0),t([p({type:String,attribute:"token"})],R.prototype,"token",void 0),t([p({type:String,attribute:"locale",reflect:!0})],R.prototype,"locale",void 0),t([p({type:String,attribute:"merchant-id"})],R.prototype,"merchantId",void 0),t([p({type:String,attribute:"gateway-merchant-id"})],R.prototype,"gatewayMerchantId",void 0),t([p({type:String,attribute:"merchant-name"})],R.prototype,"merchantName",void 0),t([p({type:String,attribute:"session-id"})],R.prototype,"sessionId",void 0),t([p({type:String,attribute:"amount"})],R.prototype,"amount",void 0),t([p({type:String,attribute:"currency"})],R.prototype,"currency",void 0),t([p({type:String,attribute:"country"})],R.prototype,"country",void 0),t([p({type:String,attribute:"label"})],R.prototype,"label",void 0),t([y()],R.prototype,"_availabilityPhase",void 0),t([y()],R.prototype,"_unavailableReason",void 0),t([y()],R.prototype,"_paying",void 0),t([a({context:s,subscribe:!0}),y()],R.prototype,"inheritedApiClient",void 0),t([n({context:s}),y()],R.prototype,"apiClient",void 0),R=t([i(),e("mq-google-pay-checkout")],R);export{GooglePayCheckoutDeniedEvent,GooglePayCheckoutErrorEvent,GooglePayCheckoutSuccessEvent,R as MqGooglePayCheckout};
@@ -4,7 +4,7 @@ import { Env } from './env.js';
4
4
  import { Locale } from './i18n.js';
5
5
  import './mq-checkout.js';
6
6
  import 'zod';
7
- import './chunks/index.d-XSe7Hy-Q.js';
7
+ import './chunks/index.d-DeJP_xib.js';
8
8
  import 'axios';
9
9
  import './chunks/schemas.d-b6_AekBb.js';
10
10
  import './ui/mq-skeleton.js';
@@ -1 +1 @@
1
- import{_ as e,c as t}from"./chunks/custom-element-D2ziPxYE.js";import{a as s,x as i}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"./mq-checkout.js";import"./chunks/provide-BwI4DDGF.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/consume-CovVqBjI.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/localized-decorator-BlOuLhym.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/api-chat-client-fYDIH220.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/external-BXLaKy9c.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/api-client-context-V1UAGtKW.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/login-token-task-Yib__6a9.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/state-LQivXIgA.js";import"./theme.js";import"./i18n.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/directive-2EDmOukv.js";class ImmediateVideocallPaidEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(ImmediateVideocallPaidEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}let c=class MqImmediateVideocallCheckout extends s{constructor(){super(...arguments),this._provideSession=async e=>{const t=await e.payments.createImmediateVideocallPaymentLink({video_call_schedule_id:this.videoCallScheduleId});return{sessionId:t.session_id,paymentUrl:t.payment_link}},this._onSuccess=e=>{e.stopPropagation(),this.dispatchEvent(new ImmediateVideocallPaidEvent({videoCallId:e.detail.reference}))}}render(){return i`<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"})],c.prototype,"env",void 0),e([o({type:String,attribute:"api-key"})],c.prototype,"apiKey",void 0),e([o({type:String,attribute:"token"})],c.prototype,"token",void 0),e([o({type:String,attribute:"locale",reflect:!0})],c.prototype,"locale",void 0),e([o({type:String,attribute:"video-call-schedule-id"})],c.prototype,"videoCallScheduleId",void 0),c=e([t("mq-immediate-videocall-checkout")],c);export{ImmediateVideocallPaidEvent,c as MqImmediateVideocallCheckout};
1
+ import{_ as e,c as t}from"./chunks/custom-element-D2ziPxYE.js";import{a as s,x as i}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"./mq-checkout.js";import"./chunks/provide-BwI4DDGF.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/consume-CovVqBjI.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/localized-decorator-BlOuLhym.js";import"./chunks/task-Bj8p7kJX.js";import"./chunks/api-chat-client-BhxUWldC.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/external-CJj32K_p.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/api-client-context-V1UAGtKW.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/login-token-task-Yib__6a9.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/state-LQivXIgA.js";import"./theme.js";import"./i18n.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/directive-2EDmOukv.js";class ImmediateVideocallPaidEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(ImmediateVideocallPaidEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}let c=class MqImmediateVideocallCheckout extends s{constructor(){super(...arguments),this._provideSession=async e=>{const t=await e.payments.createImmediateVideocallPaymentLink({video_call_schedule_id:this.videoCallScheduleId});return{sessionId:t.session_id,paymentUrl:t.payment_link}},this._onSuccess=e=>{e.stopPropagation(),this.dispatchEvent(new ImmediateVideocallPaidEvent({videoCallId:e.detail.reference}))}}render(){return i`<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"})],c.prototype,"env",void 0),e([o({type:String,attribute:"api-key"})],c.prototype,"apiKey",void 0),e([o({type:String,attribute:"token"})],c.prototype,"token",void 0),e([o({type:String,attribute:"locale",reflect:!0})],c.prototype,"locale",void 0),e([o({type:String,attribute:"video-call-schedule-id"})],c.prototype,"videoCallScheduleId",void 0),c=e([t("mq-immediate-videocall-checkout")],c);export{ImmediateVideocallPaidEvent,c as MqImmediateVideocallCheckout};
@@ -4,13 +4,13 @@ import * as lit from 'lit';
4
4
  import { LitElement, PropertyValues } from 'lit';
5
5
  import { MqTabsSelectEvent } from './ui/mq-tabs.js';
6
6
  import { z } from 'zod';
7
- import { M as MediquoApiChatClient, G as GetAppointmentsResponse } from './chunks/index.d-XSe7Hy-Q.js';
7
+ import { M as MediquoApiChatClient, G as GetAppointmentsResponse } from './chunks/index.d-DeJP_xib.js';
8
8
  import './ui/mq-button.js';
9
- import './chunks/next-appointment-card-DBXsY3Sp.js';
9
+ import './chunks/next-appointment-card-CWz0tef1.js';
10
10
  import './ui/mq-card.js';
11
11
  export { P as ProfessionalOverview } from './chunks/professional-overview-mO3tuMuH.js';
12
12
  import { L as LoginTokenResponse } from './chunks/schemas.d-b6_AekBb.js';
13
- import './chunks/mq-chat-room-jeDvIF1Z.js';
13
+ import './chunks/mq-chat-room-B3ant6md.js';
14
14
  import './ui/mq-floating-bubble.js';
15
15
  import './ui/mq-unread-badge.js';
16
16
  import './chunks/appointment.model.d-BWwBLaEL.js';
@@ -1 +1 @@
1
- import{getLocale as t,isValidLocale as e,setLocale as i,initLocalization as n}from"./i18n.js";export{A as AppointmentDetails}from"./chunks/appointment-details-BriSqXWj.js";import{_ as a,c as o}from"./chunks/custom-element-D2ziPxYE.js";import{m as s}from"./chunks/runtime-Bg1WXVCx.js";import{l as r}from"./chunks/localized-decorator-BlOuLhym.js";import{a as p,i as l,x as c,E as d}from"./chunks/lit-element-DiWJYFwC.js";import{n as m}from"./chunks/property-scuRaFcM.js";import{e as h}from"./chunks/external-BXLaKy9c.js";import"./ui/mq-tabs.js";import{c as u}from"./chunks/consume-CovVqBjI.js";import{A as v}from"./chunks/api-client-context-V1UAGtKW.js";import{A as g,a as b,i as f}from"./chunks/api-chat-client-fYDIH220.js";import"./ui/mq-button.js";import{g as y,a as x}from"./chunks/next-appointment-card-DQE7dNXw.js";import{Q as k}from"./chunks/query-controller-BlO1Ax65.js";import{g as $}from"./chunks/get-organization-setup-query-Dr1cXnHl.js";import{t as q,j as C,k as j,q as w,f as H,s as V,g as R,a as M,i as S}from"./chunks/telemetry-client-DEIuDZfA.js";import{g as E}from"./chunks/get-schedule-services-query-Fzvb9ug9.js";import{g as D}from"./chunks/chunk-Y4EKUX25-CWAZgcgw.js";import{r as z}from"./chunks/state-LQivXIgA.js";import"./ui/mq-card.js";export{P as ProfessionalOverview}from"./chunks/professional-overview-C4H_znIJ.js";import{l as O}from"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import"./mq-chat-room.js";import"./ui/mq-floating-bubble.js";import{e as I}from"./chunks/class-map-Co76I6aw.js";import{MqAppointmentRescheduleEvent as N,MqAppointmentBookEvent as U,MqAppointmentJoinVideocallEvent as _,MqAppointmentViewDocumentationEvent as T}from"./events.js";import{messageBubbleIcon as Z}from"./ui/icons/message-bubble-icon.js";import{videoIcon as Q}from"./ui/icons/video-icon.js";import"./ui/mq-unread-badge.js";import{c as B}from"./chunks/refund-cancel-policy-QG_OE6g5.js";import{toast as G}from"./ui/mq-toast.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/addSeconds-ofMnxlgT.js";import"./ui/icons/briefcase-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/types.js";import"./ui/icons/calendar-icon.js";import"./ui/icons/clock-icon.js";import"./ui/icons/phone-icon.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/chunk-6CCJWPGL-TiaqZaPV.js";import"./ui/icons/dots-horizontal-icon.js";import"./ui/mq-dialog.js";import"./ui/icons/x-icon.js";import"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import"./chunks/mutation-controller-CR2qcqhH.js";import"./chunks/price-DU3YLTpk.js";import"./chunks/query-Cjvi4_dT.js";import"./ui/icons/chevron-down-icon.js";import"./ui/mq-text-button.js";import"./ui/mq-avatar.js";import"./chunks/provide-BwI4DDGF.js";import"./theme.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/chunk-BUV4MGML-CkhBbfUu.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-DJR1Yoyy.js";const J=h(["next","history"]).enum;class MqMyAppointmentsSelectEvent extends Event{static{this.eventName="ontabchange"}constructor(t){super(MqMyAppointmentsSelectEvent.eventName,{bubbles:!0,composed:!0}),this.value=t}}let F=class AppointmentCardSkeleton extends p{static{this.styles=l`div{border-radius:var(--border-radius-md);background:color-mix(in srgb,var(--color-neutrals-background-disabled) 50%,#fff 50%);height:337px;width:100%}`}render(){return c`<div></div>`}};F=a([o("appointment-card-skeleton")],F);let L=class EmptyState extends p{static{this.styles=l`.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 c`<div class="container"><div class="card">${function({color:t="currentColor"}){return c`<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}">${s("Pedir cita")}</mq-button></div></div>`}};a([m({type:String})],L.prototype,"title",void 0),a([m({type:String})],L.prototype,"description",void 0),L=a([o("empty-state")],L);const W=[g.pending,g.accepted],K=l`.appointments-list{display:grid;grid-template-columns:1fr;align-items:start;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}.card{display:flex;flex-direction:column;min-width:0;box-sizing:border-box;background-color:var(--color-card,#fff);border:1px solid var(--color-border-subtle,#edecf1);border-radius:12px;padding:var(--sp-6)}`;let X=class NextAppointmentsTab extends p{constructor(){super(...arguments),this.getAppointmentsQuery=new k(this,()=>y(this.apiClient,{status:W,order:{field:"starts_at",direction:"asc"}}))}static{this.styles=K}render(){return this.getAppointmentsQuery.render({complete:t=>c`${t.data.length>0?c`<div class="appointments-list">${t.data.map(t=>c`<div class="card"><next-appointment-card .appointmentResource="${t}"></next-appointment-card></div>`)}</div>`:c`<empty-state title="${s("No tienes próximas citas")}" description="${s("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:()=>c`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};a([u({context:v,subscribe:!0})],X.prototype,"apiClient",void 0),X=a([r(),o("next-appointments-tab")],X);let Y=class AppointmentCardActions extends p{constructor(){super(...arguments),this.variant="next",this.isVideocall=!1,this.hasChatSupport=!1,this.unreadCount=0,this.isModifyUnavailable=!1,this.isCancelUnavailable=!1,this.hasNoSlots=!1,this.modifyUnavailableMessage="",this.cancelUnavailableMessage="",this.repeatTarget=null,this.professionalHash="",this.openDialog=null,this.handleModifyClick=()=>{this.isModifyUnavailable?this.openDialog="modify":(q.track(C(this.patientHash,this.appointmentId)),this.dispatchEvent(new N({appointmentId:this.appointmentId})))},this.handleCancelClick=()=>{this.isCancelUnavailable?this.openDialog="cancel":(q.track(j(this.patientHash,this.appointmentId)),this.dispatchEvent(new CustomEvent("request-cancel",{bubbles:!0,composed:!0})))},this.handleRepeatClick=()=>{this.hasNoSlots?this.openDialog="repeat-no-slots":this.repeatTarget?(q.track(w(this.patientHash,this.appointmentId)),this.dispatchEvent(new U({specialty:this.repeatTarget.specialty,service:this.repeatTarget.service,professional:this.professionalHash}))):this.openDialog="repeat-error"},this.handleDialogClose=()=>{this.openDialog=null}}static{this.styles=l`:host{display:contents}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-2)}.actions.next{flex-direction:column}.actions-secondary{display:flex;gap:var(--sp-3)}.actions mq-button{flex:1}`}get patientHash(){return this.loginToken.patient.hash}renderChatButton(){return c`<mq-button variant="primary" fullwidth noPadding @click="${()=>{this.dispatchEvent(new CustomEvent("toggle-chat",{bubbles:!0,composed:!0}))}}">${Z({size:24})} ${s("Chat")} ${this.unreadCount>0?c`<mq-unread-badge></mq-unread-badge>`:d}</mq-button>`}renderNextActions(){return c`${this.isVideocall?c`<mq-button variant="outline" fullwidth noPadding @click="${()=>{q.track(H(this.patientHash,this.appointmentId)),this.dispatchEvent(new _({appointmentId:this.appointmentId}))}}">${Q({size:24})} ${s("Ir a videollamada")}</mq-button>`:d}<div class="actions-secondary">${this.hasChatSupport?this.renderChatButton():d}<mq-button variant="outline" fullwidth noPadding @click="${this.handleModifyClick}">${s("Modificar")}</mq-button><mq-button variant="outline-negative" fullwidth noPadding @click="${this.handleCancelClick}">${s("Cancelar")}</mq-button></div>`}renderHistoryActions(){return c`${this.hasChatSupport?this.renderChatButton():d}<mq-button variant="outline" fullwidth noPadding @click="${()=>{q.track(V(this.patientHash,this.appointmentId)),this.dispatchEvent(new T({appointmentId:this.appointmentId}))}}">${s("Documentos")}</mq-button><mq-button variant="outline" fullwidth noPadding @click="${this.handleRepeatClick}">${s("Repetir")}</mq-button>`}render(){return c`<div class="${I({actions:!0,next:"next"===this.variant})}">${"next"===this.variant?this.renderNextActions():this.renderHistoryActions()}</div><appointment-action-unavailable-dialog .open="${"modify"===this.openDialog}" .heading="${s("Modificar cita")}" .message="${this.modifyUnavailableMessage}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"cancel"===this.openDialog}" .heading="${s("Anular cita")}" .message="${this.cancelUnavailableMessage}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"repeat-no-slots"===this.openDialog}" .heading="${s("Repetir cita")}" .message="${s("Este profesional no tiene horarios disponibles")}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"repeat-error"===this.openDialog}" .heading="${s("Repetir cita")}" .message="${s("Lo sentimos, no hemos podido repetir tu cita. Por favor, contacta con soporte.")}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog>`}};a([u({context:O})],Y.prototype,"loginToken",void 0),a([m({type:String})],Y.prototype,"variant",void 0),a([m({type:String})],Y.prototype,"appointmentId",void 0),a([m({type:Boolean})],Y.prototype,"isVideocall",void 0),a([m({type:Boolean})],Y.prototype,"hasChatSupport",void 0),a([m({type:Number})],Y.prototype,"unreadCount",void 0),a([m({type:Boolean})],Y.prototype,"isModifyUnavailable",void 0),a([m({type:Boolean})],Y.prototype,"isCancelUnavailable",void 0),a([m({type:Boolean})],Y.prototype,"hasNoSlots",void 0),a([m({type:String})],Y.prototype,"modifyUnavailableMessage",void 0),a([m({type:String})],Y.prototype,"cancelUnavailableMessage",void 0),a([m({type:Object})],Y.prototype,"repeatTarget",void 0),a([m({type:String})],Y.prototype,"professionalHash",void 0),a([z()],Y.prototype,"openDialog",void 0),Y=a([r(),o("appointment-card-actions")],Y);let tt=class AppointmentCard extends p{constructor(){super(...arguments),this.variant="next",this.detailsVariant="wide",this.isChatOpen=!1,this.isCancelDialogOpen=!1,this.unreadQuery=new k(this,()=>D(this.apiClient,{roomId:this.appointmentResource?.room?.id})),this.getOrganizationSpecialtiesQuery=new k(this,()=>R(this.apiClient,{enabled:!!this.appointmentResource?.speciality?.id})),this.getOrganizationSetupQuery=new k(this,()=>$(this.apiClient)),this.getScheduleServicesQuery=new k(this,()=>E(this.apiClient))}static{this.styles=l`:host{display:flex}.card{width:100%;padding:var(--sp-6);display:flex;flex-direction:column;gap:var(--sp-4);justify-content:space-between}.card-top-content{display:flex;flex-direction:column;gap:var(--sp-6)}.see-details{color:var(--color-primary-link-default);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-bold)}.see-details:hover{text-decoration:underline}.chevron-down{width:16px;height:16px;transition:transform .2s ease}.appointment-details{display:flex;flex-direction:column;gap:12px}.clock-icon-wrapper{width:24px;height:24px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.clock-icon-wrapper svg{width:100%;height:100%}.appointment-type{display:flex;align-items:center;gap:12px;font-size:18px;color:#2c3e50}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-2)}.actions.next{flex-direction:column}.actions-secondary{display:flex;gap:var(--sp-3)}.actions mq-button{flex:1}`}render(){const e=this.appointmentResource.appointment.channel===b.videocall,i=this.appointmentResource.appointment.channel===b.phonecall,n=!0===this.appointmentResource.appointment.has_chat_in_appointment,a=(e||i)&&n,o=t(),r=f(this.appointmentResource.appointment.expires_at),p=0===this.appointmentResource.slots.length,l=this.getOrganizationSetupQuery.result?.data?.appointments?.seconds_before_start_to_refund_on_cancel,m=B({startsAtIso:this.appointmentResource.appointment.starts_at,refundPolicySeconds:l}),h=r||p||!m,u=r||!m,v=x({action:"modify",refundPolicySeconds:l}),g=x({action:"cancel",refundPolicySeconds:l}),y=this.getOrganizationSpecialtiesQuery.result?.data?.find(t=>Number(t.id)===Number(this.appointmentResource.speciality.id)),k=M(y?.code??"",o,y?.name??this.appointmentResource.speciality.name),$=this.getScheduleServicesQuery.result?.data?.find(t=>t.id===this.appointmentResource.appointment.service_id)?.code,C=y?.code&&$?{specialty:y.code,service:$}:null;return c`<mq-card class="card" roundness="md"><div class="card-top-content"><professional-overview .specialtyName="${k??""}" .collegiateNumber="${this.appointmentResource.professional.collegiate_number??void 0}" .description="${this.appointmentResource.professional.description??""}" .languages="${this.appointmentResource.professional.languages}" .avatar="${this.appointmentResource.professional.avatar??""}" .name="${this.appointmentResource.professional.name}"></professional-overview><appointment-details .startsAt="${this.appointmentResource.appointment.starts_at}" .duration="${this.appointmentResource.appointment.duration}" .channel="${this.appointmentResource.appointment.channel}" .timezone="${this.loginToken?.patient?.timezone}" variant="${this.detailsVariant}"></appointment-details></div><appointment-card-actions .variant="${this.variant}" .appointmentId="${this.appointmentResource.appointment.id??""}" .isVideocall="${e}" .hasChatSupport="${a}" .unreadCount="${this.unreadQuery.result?.data?.unread_count??0}" .isModifyUnavailable="${h}" .isCancelUnavailable="${u}" .hasNoSlots="${p}" .modifyUnavailableMessage="${v}" .cancelUnavailableMessage="${g}" .repeatTarget="${C}" .professionalHash="${this.appointmentResource.professional.hash}" @toggle-chat="${()=>{this.isChatOpen=!this.isChatOpen,this.isChatOpen&&q.track(S(this.loginToken.patient.hash,this.appointmentResource.appointment.id??""))}}" @request-cancel="${()=>{this.isCancelDialogOpen=!0}}"></appointment-card-actions><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen?c`<mq-chat-room slot="content" .consultationId="${this.appointmentResource.appointment.id}" consultation-type="appointment" token="${this.loginToken.access_token}" .roomId="${this.appointmentResource.room.id}" .professionalHash="${this.appointmentResource.professional.hash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}" ?readonly="${r}"></mq-chat-room>`:d}</mq-floating-bubble><cancel-appointment-confirmation-dialog .appointmentId="${this.appointmentResource.appointment.id}" .price="${this.appointmentResource.price??void 0}" .open="${this.isCancelDialogOpen}" @cancel="${()=>{this.isCancelDialogOpen=!1}}" @success="${()=>{this.isCancelDialogOpen=!1,G.success(s("Consulta anulada correctamente")),this.dispatchEvent(new CustomEvent("appointment-cancel-confirmed",{bubbles:!0,composed:!0,detail:{id:this.appointmentResource.appointment.id}}))}}"></cancel-appointment-confirmation-dialog></mq-card>`}};a([u({context:v,subscribe:!0})],tt.prototype,"apiClient",void 0),a([m({type:Object})],tt.prototype,"appointmentResource",void 0),a([m({type:Number})],tt.prototype,"specialtyId",void 0),a([m({type:String})],tt.prototype,"variant",void 0),a([m({type:String})],tt.prototype,"detailsVariant",void 0),a([u({context:O})],tt.prototype,"loginToken",void 0),a([z()],tt.prototype,"isChatOpen",void 0),a([z()],tt.prototype,"isCancelDialogOpen",void 0),tt=a([r(),o("appointment-card")],tt);const et=[g.finished,g.reporting];let it=class AppointmentsHistoryTab extends p{constructor(){super(...arguments),this.getAppointmentsQuery=new k(this,()=>y(this.apiClient,{status:et,order:{field:"starts_at",direction:"desc"}}))}static{this.styles=l`.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=>c`${t.data.length>0?c`<div class="appointments-list">${t.data.map(t=>c`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}" variant="history"></appointment-card>`)}</div>`:c`<empty-state title="${s("No tienes citas en el historial")}" description="${s("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:()=>c`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};a([u({context:v,subscribe:!0})],it.prototype,"apiClient",void 0),it=a([r(),o("appointments-history-tab")],it);const nt=l`.container{display:flex;flex-direction:column;gap:var(--size-3)}`;let at=class MqMyAppointments extends p{constructor(){super(...arguments),this.tab=J.next}static{this.styles=nt}willUpdate(t){t.has("locale")&&this.locale&&e(this.locale)&&i(this.locale)}handleSelect(t){this.dispatchEvent(new MqMyAppointmentsSelectEvent(t.value))}render(){return c`<div class="container"><mq-tabs .value="${this.tab}" @onvaluechange="${this.handleSelect}"><mq-tabs-list label="${s("Mis citas")}"><mq-tabs-trigger value="${J.next}">${s("Próximas citas")}</mq-tabs-trigger><mq-tabs-trigger value="${J.history}">${s("Histórico")}</mq-tabs-trigger></mq-tabs-list><mq-tabs-content value="${J.next}"><next-appointments-tab></next-appointments-tab></mq-tabs-content><mq-tabs-content value="${J.history}"><appointments-history-tab></appointments-history-tab></mq-tabs-content></mq-tabs></div>`}};a([m({type:String,reflect:!0})],at.prototype,"tab",void 0),a([m({type:String,attribute:"locale"})],at.prototype,"locale",void 0),at=a([r(),o("mq-my-appointments")],at);const ot=l`: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 st=class RequestAppointmentCta extends p{static{this.styles=ot}handleRequestAppointment(){this.dispatchEvent(new RequestAppointmentEvent)}render(){return c`<div class="request-appointment-cta"><div class="title-body"><h2 class="title">${s("Nueva cita de especialidades digitales")}</h2><p class="subtitle">${s("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">${s("Pedir cita")}</span> <span class="button-text-desktop">${s("Pedir una nueva cita")}</span></mq-button></div>`}};st=a([r(),o("request-appointment-cta")],st),n();export{at as MqMyAppointments,MqMyAppointmentsSelectEvent,st as RequestAppointmentCta,RequestAppointmentEvent};
1
+ import{getLocale as t,isValidLocale as e,setLocale as i,initLocalization as n}from"./i18n.js";export{A as AppointmentDetails}from"./chunks/appointment-details-BriSqXWj.js";import{_ as a,c as o}from"./chunks/custom-element-D2ziPxYE.js";import{m as s}from"./chunks/runtime-Bg1WXVCx.js";import{l as r}from"./chunks/localized-decorator-BlOuLhym.js";import{a as p,i as l,x as c,E as d}from"./chunks/lit-element-DiWJYFwC.js";import{n as m}from"./chunks/property-scuRaFcM.js";import{e as h}from"./chunks/external-CJj32K_p.js";import"./ui/mq-tabs.js";import{c as u}from"./chunks/consume-CovVqBjI.js";import{A as v}from"./chunks/api-client-context-V1UAGtKW.js";import{A as g,e as b,d as f}from"./chunks/api-chat-client-BhxUWldC.js";import"./ui/mq-button.js";import{g as y,a as x}from"./chunks/next-appointment-card-KXLkEJDg.js";import{Q as k}from"./chunks/query-controller-BlO1Ax65.js";import{g as $}from"./chunks/get-organization-setup-query-Dr1cXnHl.js";import{t as q,j as C,k as j,q as w,f as H,s as V,g as R,a as M,i as S}from"./chunks/telemetry-client-DEIuDZfA.js";import{g as E}from"./chunks/get-schedule-services-query-Fzvb9ug9.js";import{g as D}from"./chunks/chunk-Y4EKUX25-QqMl3eiq.js";import{r as z}from"./chunks/state-LQivXIgA.js";import"./ui/mq-card.js";export{P as ProfessionalOverview}from"./chunks/professional-overview-B4E05rLd.js";import{l as O}from"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import"./mq-chat-room.js";import"./ui/mq-floating-bubble.js";import{e as I}from"./chunks/class-map-Co76I6aw.js";import{MqAppointmentRescheduleEvent as N,MqAppointmentBookEvent as U,MqAppointmentJoinVideocallEvent as _,MqAppointmentViewDocumentationEvent as T}from"./events.js";import{messageBubbleIcon as Z}from"./ui/icons/message-bubble-icon.js";import{videoIcon as Q}from"./ui/icons/video-icon.js";import"./ui/mq-unread-badge.js";import{c as B}from"./chunks/refund-cancel-policy-QG_OE6g5.js";import{toast as G}from"./ui/mq-toast.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/addSeconds-ofMnxlgT.js";import"./ui/icons/briefcase-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/types.js";import"./ui/icons/calendar-icon.js";import"./ui/icons/clock-icon.js";import"./ui/icons/phone-icon.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/chunk-6CCJWPGL-TiaqZaPV.js";import"./ui/icons/dots-horizontal-icon.js";import"./ui/mq-dialog.js";import"./ui/icons/x-icon.js";import"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import"./chunks/mutation-controller-CR2qcqhH.js";import"./chunks/price-DU3YLTpk.js";import"./chunks/query-Cjvi4_dT.js";import"./ui/icons/chevron-down-icon.js";import"./ui/mq-text-button.js";import"./ui/mq-avatar.js";import"./chunks/provide-BwI4DDGF.js";import"./theme.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/chunk-BUV4MGML-CkhBbfUu.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";const J=h(["next","history"]).enum;class MqMyAppointmentsSelectEvent extends Event{static{this.eventName="ontabchange"}constructor(t){super(MqMyAppointmentsSelectEvent.eventName,{bubbles:!0,composed:!0}),this.value=t}}let F=class AppointmentCardSkeleton extends p{static{this.styles=l`div{border-radius:var(--border-radius-md);background:color-mix(in srgb,var(--color-neutrals-background-disabled) 50%,#fff 50%);height:337px;width:100%}`}render(){return c`<div></div>`}};F=a([o("appointment-card-skeleton")],F);let L=class EmptyState extends p{static{this.styles=l`.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 c`<div class="container"><div class="card">${function({color:t="currentColor"}){return c`<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}">${s("Pedir cita")}</mq-button></div></div>`}};a([m({type:String})],L.prototype,"title",void 0),a([m({type:String})],L.prototype,"description",void 0),L=a([o("empty-state")],L);const W=[g.pending,g.accepted],K=l`.appointments-list{display:grid;grid-template-columns:1fr;align-items:start;gap:var(--sp-6);margin-bottom:var(--sp-6)}@media (min-width:768px){.appointments-list{grid-template-columns:repeat(2,1fr)}}.card{display:flex;flex-direction:column;min-width:0;box-sizing:border-box;background-color:var(--color-card,#fff);border:1px solid var(--color-border-subtle,#edecf1);border-radius:12px;padding:var(--sp-6)}`;let X=class NextAppointmentsTab extends p{constructor(){super(...arguments),this.getAppointmentsQuery=new k(this,()=>y(this.apiClient,{status:W,order:{field:"starts_at",direction:"asc"}}))}static{this.styles=K}render(){return this.getAppointmentsQuery.render({complete:t=>c`${t.data.length>0?c`<div class="appointments-list">${t.data.map(t=>c`<div class="card"><next-appointment-card .appointmentResource="${t}"></next-appointment-card></div>`)}</div>`:c`<empty-state title="${s("No tienes próximas citas")}" description="${s("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:()=>c`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};a([u({context:v,subscribe:!0})],X.prototype,"apiClient",void 0),X=a([r(),o("next-appointments-tab")],X);let Y=class AppointmentCardActions extends p{constructor(){super(...arguments),this.variant="next",this.isVideocall=!1,this.hasChatSupport=!1,this.unreadCount=0,this.isModifyUnavailable=!1,this.isCancelUnavailable=!1,this.hasNoSlots=!1,this.modifyUnavailableMessage="",this.cancelUnavailableMessage="",this.repeatTarget=null,this.professionalHash="",this.openDialog=null,this.handleModifyClick=()=>{this.isModifyUnavailable?this.openDialog="modify":(q.track(C(this.patientHash,this.appointmentId)),this.dispatchEvent(new N({appointmentId:this.appointmentId})))},this.handleCancelClick=()=>{this.isCancelUnavailable?this.openDialog="cancel":(q.track(j(this.patientHash,this.appointmentId)),this.dispatchEvent(new CustomEvent("request-cancel",{bubbles:!0,composed:!0})))},this.handleRepeatClick=()=>{this.hasNoSlots?this.openDialog="repeat-no-slots":this.repeatTarget?(q.track(w(this.patientHash,this.appointmentId)),this.dispatchEvent(new U({specialty:this.repeatTarget.specialty,service:this.repeatTarget.service,professional:this.professionalHash}))):this.openDialog="repeat-error"},this.handleDialogClose=()=>{this.openDialog=null}}static{this.styles=l`:host{display:contents}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-2)}.actions.next{flex-direction:column}.actions-secondary{display:flex;gap:var(--sp-3)}.actions mq-button{flex:1}`}get patientHash(){return this.loginToken.patient.hash}renderChatButton(){return c`<mq-button variant="primary" fullwidth noPadding @click="${()=>{this.dispatchEvent(new CustomEvent("toggle-chat",{bubbles:!0,composed:!0}))}}">${Z({size:24})} ${s("Chat")} ${this.unreadCount>0?c`<mq-unread-badge></mq-unread-badge>`:d}</mq-button>`}renderNextActions(){return c`${this.isVideocall?c`<mq-button variant="outline" fullwidth noPadding @click="${()=>{q.track(H(this.patientHash,this.appointmentId)),this.dispatchEvent(new _({appointmentId:this.appointmentId}))}}">${Q({size:24})} ${s("Ir a videollamada")}</mq-button>`:d}<div class="actions-secondary">${this.hasChatSupport?this.renderChatButton():d}<mq-button variant="outline" fullwidth noPadding @click="${this.handleModifyClick}">${s("Modificar")}</mq-button><mq-button variant="outline-negative" fullwidth noPadding @click="${this.handleCancelClick}">${s("Cancelar")}</mq-button></div>`}renderHistoryActions(){return c`${this.hasChatSupport?this.renderChatButton():d}<mq-button variant="outline" fullwidth noPadding @click="${()=>{q.track(V(this.patientHash,this.appointmentId)),this.dispatchEvent(new T({appointmentId:this.appointmentId}))}}">${s("Documentos")}</mq-button><mq-button variant="outline" fullwidth noPadding @click="${this.handleRepeatClick}">${s("Repetir")}</mq-button>`}render(){return c`<div class="${I({actions:!0,next:"next"===this.variant})}">${"next"===this.variant?this.renderNextActions():this.renderHistoryActions()}</div><appointment-action-unavailable-dialog .open="${"modify"===this.openDialog}" .heading="${s("Modificar cita")}" .message="${this.modifyUnavailableMessage}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"cancel"===this.openDialog}" .heading="${s("Anular cita")}" .message="${this.cancelUnavailableMessage}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"repeat-no-slots"===this.openDialog}" .heading="${s("Repetir cita")}" .message="${s("Este profesional no tiene horarios disponibles")}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog><appointment-action-unavailable-dialog .open="${"repeat-error"===this.openDialog}" .heading="${s("Repetir cita")}" .message="${s("Lo sentimos, no hemos podido repetir tu cita. Por favor, contacta con soporte.")}" @close="${this.handleDialogClose}"></appointment-action-unavailable-dialog>`}};a([u({context:O})],Y.prototype,"loginToken",void 0),a([m({type:String})],Y.prototype,"variant",void 0),a([m({type:String})],Y.prototype,"appointmentId",void 0),a([m({type:Boolean})],Y.prototype,"isVideocall",void 0),a([m({type:Boolean})],Y.prototype,"hasChatSupport",void 0),a([m({type:Number})],Y.prototype,"unreadCount",void 0),a([m({type:Boolean})],Y.prototype,"isModifyUnavailable",void 0),a([m({type:Boolean})],Y.prototype,"isCancelUnavailable",void 0),a([m({type:Boolean})],Y.prototype,"hasNoSlots",void 0),a([m({type:String})],Y.prototype,"modifyUnavailableMessage",void 0),a([m({type:String})],Y.prototype,"cancelUnavailableMessage",void 0),a([m({type:Object})],Y.prototype,"repeatTarget",void 0),a([m({type:String})],Y.prototype,"professionalHash",void 0),a([z()],Y.prototype,"openDialog",void 0),Y=a([r(),o("appointment-card-actions")],Y);let tt=class AppointmentCard extends p{constructor(){super(...arguments),this.variant="next",this.detailsVariant="wide",this.isChatOpen=!1,this.isCancelDialogOpen=!1,this.unreadQuery=new k(this,()=>D(this.apiClient,{roomId:this.appointmentResource?.room?.id})),this.getOrganizationSpecialtiesQuery=new k(this,()=>R(this.apiClient,{enabled:!!this.appointmentResource?.speciality?.id})),this.getOrganizationSetupQuery=new k(this,()=>$(this.apiClient)),this.getScheduleServicesQuery=new k(this,()=>E(this.apiClient))}static{this.styles=l`:host{display:flex}.card{width:100%;padding:var(--sp-6);display:flex;flex-direction:column;gap:var(--sp-4);justify-content:space-between}.card-top-content{display:flex;flex-direction:column;gap:var(--sp-6)}.see-details{color:var(--color-primary-link-default);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-bold)}.see-details:hover{text-decoration:underline}.chevron-down{width:16px;height:16px;transition:transform .2s ease}.appointment-details{display:flex;flex-direction:column;gap:12px}.clock-icon-wrapper{width:24px;height:24px;display:flex;align-items:center;justify-content:center;flex-shrink:0}.clock-icon-wrapper svg{width:100%;height:100%}.appointment-type{display:flex;align-items:center;gap:12px;font-size:18px;color:#2c3e50}.actions{display:flex;gap:var(--sp-3);margin-top:var(--sp-2)}.actions.next{flex-direction:column}.actions-secondary{display:flex;gap:var(--sp-3)}.actions mq-button{flex:1}`}render(){const e=this.appointmentResource.appointment.channel===b.videocall,i=this.appointmentResource.appointment.channel===b.phonecall,n=!0===this.appointmentResource.appointment.has_chat_in_appointment,a=(e||i)&&n,o=t(),r=f(this.appointmentResource.appointment.expires_at),p=0===this.appointmentResource.slots.length,l=this.getOrganizationSetupQuery.result?.data?.appointments?.seconds_before_start_to_refund_on_cancel,m=B({startsAtIso:this.appointmentResource.appointment.starts_at,refundPolicySeconds:l}),h=r||p||!m,u=r||!m,v=x({action:"modify",refundPolicySeconds:l}),g=x({action:"cancel",refundPolicySeconds:l}),y=this.getOrganizationSpecialtiesQuery.result?.data?.find(t=>Number(t.id)===Number(this.appointmentResource.speciality.id)),k=M(y?.code??"",o,y?.name??this.appointmentResource.speciality.name),$=this.getScheduleServicesQuery.result?.data?.find(t=>t.id===this.appointmentResource.appointment.service_id)?.code,C=y?.code&&$?{specialty:y.code,service:$}:null;return c`<mq-card class="card" roundness="md"><div class="card-top-content"><professional-overview .specialtyName="${k??""}" .collegiateNumber="${this.appointmentResource.professional.collegiate_number??void 0}" .description="${this.appointmentResource.professional.description??""}" .languages="${this.appointmentResource.professional.languages}" .avatar="${this.appointmentResource.professional.avatar??""}" .name="${this.appointmentResource.professional.name}"></professional-overview><appointment-details .startsAt="${this.appointmentResource.appointment.starts_at}" .duration="${this.appointmentResource.appointment.duration}" .channel="${this.appointmentResource.appointment.channel}" .timezone="${this.loginToken?.patient?.timezone}" variant="${this.detailsVariant}"></appointment-details></div><appointment-card-actions .variant="${this.variant}" .appointmentId="${this.appointmentResource.appointment.id??""}" .isVideocall="${e}" .hasChatSupport="${a}" .unreadCount="${this.unreadQuery.result?.data?.unread_count??0}" .isModifyUnavailable="${h}" .isCancelUnavailable="${u}" .hasNoSlots="${p}" .modifyUnavailableMessage="${v}" .cancelUnavailableMessage="${g}" .repeatTarget="${C}" .professionalHash="${this.appointmentResource.professional.hash}" @toggle-chat="${()=>{this.isChatOpen=!this.isChatOpen,this.isChatOpen&&q.track(S(this.loginToken.patient.hash,this.appointmentResource.appointment.id??""))}}" @request-cancel="${()=>{this.isCancelDialogOpen=!0}}"></appointment-card-actions><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen?c`<mq-chat-room slot="content" .consultationId="${this.appointmentResource.appointment.id}" consultation-type="appointment" token="${this.loginToken.access_token}" .roomId="${this.appointmentResource.room.id}" .professionalHash="${this.appointmentResource.professional.hash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}" ?readonly="${r}"></mq-chat-room>`:d}</mq-floating-bubble><cancel-appointment-confirmation-dialog .appointmentId="${this.appointmentResource.appointment.id}" .price="${this.appointmentResource.price??void 0}" .open="${this.isCancelDialogOpen}" @cancel="${()=>{this.isCancelDialogOpen=!1}}" @success="${()=>{this.isCancelDialogOpen=!1,G.success(s("Consulta anulada correctamente")),this.dispatchEvent(new CustomEvent("appointment-cancel-confirmed",{bubbles:!0,composed:!0,detail:{id:this.appointmentResource.appointment.id}}))}}"></cancel-appointment-confirmation-dialog></mq-card>`}};a([u({context:v,subscribe:!0})],tt.prototype,"apiClient",void 0),a([m({type:Object})],tt.prototype,"appointmentResource",void 0),a([m({type:Number})],tt.prototype,"specialtyId",void 0),a([m({type:String})],tt.prototype,"variant",void 0),a([m({type:String})],tt.prototype,"detailsVariant",void 0),a([u({context:O})],tt.prototype,"loginToken",void 0),a([z()],tt.prototype,"isChatOpen",void 0),a([z()],tt.prototype,"isCancelDialogOpen",void 0),tt=a([r(),o("appointment-card")],tt);const et=[g.finished,g.reporting];let it=class AppointmentsHistoryTab extends p{constructor(){super(...arguments),this.getAppointmentsQuery=new k(this,()=>y(this.apiClient,{status:et,order:{field:"starts_at",direction:"desc"}}))}static{this.styles=l`.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=>c`${t.data.length>0?c`<div class="appointments-list">${t.data.map(t=>c`<appointment-card .appointmentResource="${t}" .specialtyId="${t.speciality?.id}" variant="history"></appointment-card>`)}</div>`:c`<empty-state title="${s("No tienes citas en el historial")}" description="${s("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:()=>c`<div class="appointments-list"><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton><appointment-card-skeleton></appointment-card-skeleton></div>`})}};a([u({context:v,subscribe:!0})],it.prototype,"apiClient",void 0),it=a([r(),o("appointments-history-tab")],it);const nt=l`.container{display:flex;flex-direction:column;gap:var(--size-3)}`;let at=class MqMyAppointments extends p{constructor(){super(...arguments),this.tab=J.next}static{this.styles=nt}willUpdate(t){t.has("locale")&&this.locale&&e(this.locale)&&i(this.locale)}handleSelect(t){this.dispatchEvent(new MqMyAppointmentsSelectEvent(t.value))}render(){return c`<div class="container"><mq-tabs .value="${this.tab}" @onvaluechange="${this.handleSelect}"><mq-tabs-list label="${s("Mis citas")}"><mq-tabs-trigger value="${J.next}">${s("Próximas citas")}</mq-tabs-trigger><mq-tabs-trigger value="${J.history}">${s("Histórico")}</mq-tabs-trigger></mq-tabs-list><mq-tabs-content value="${J.next}"><next-appointments-tab></next-appointments-tab></mq-tabs-content><mq-tabs-content value="${J.history}"><appointments-history-tab></appointments-history-tab></mq-tabs-content></mq-tabs></div>`}};a([m({type:String,reflect:!0})],at.prototype,"tab",void 0),a([m({type:String,attribute:"locale"})],at.prototype,"locale",void 0),at=a([r(),o("mq-my-appointments")],at);const ot=l`: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 st=class RequestAppointmentCta extends p{static{this.styles=ot}handleRequestAppointment(){this.dispatchEvent(new RequestAppointmentEvent)}render(){return c`<div class="request-appointment-cta"><div class="title-body"><h2 class="title">${s("Nueva cita de especialidades digitales")}</h2><p class="subtitle">${s("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">${s("Pedir cita")}</span> <span class="button-text-desktop">${s("Pedir una nueva cita")}</span></mq-button></div>`}};st=a([r(),o("request-appointment-cta")],st),n();export{at as MqMyAppointments,MqMyAppointmentsSelectEvent,st as RequestAppointmentCta,RequestAppointmentEvent};
@@ -1,17 +1,17 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
3
  import { LitElement, PropertyValues } from 'lit';
4
- import { M as MediquoApiChatClient } from './chunks/index.d-XSe7Hy-Q.js';
4
+ import { M as MediquoApiChatClient } from './chunks/index.d-DeJP_xib.js';
5
5
  import { Env } from './env.js';
6
6
  import './chunks/index-Nf3nZ9O3.js';
7
7
  import './chunks/index-DTEtqjQF.js';
8
8
  import './ui/mq-skeleton.js';
9
- import './chunks/next-appointment-card-DBXsY3Sp.js';
9
+ import './chunks/next-appointment-card-CWz0tef1.js';
10
10
  export { MqAppointmentJoinVideocallEvent, MqAppointmentRescheduleEvent, MqViewAppointmentsEvent } from './events.js';
11
11
  import 'axios';
12
12
  import 'zod';
13
13
  import './chunks/schemas.d-b6_AekBb.js';
14
- import './chunks/mq-chat-room-jeDvIF1Z.js';
14
+ import './chunks/mq-chat-room-B3ant6md.js';
15
15
  import './ui/mq-avatar.js';
16
16
  import './ui/mq-button.js';
17
17
  import './chunks/appointment.model.d-BWwBLaEL.js';
@@ -1 +1 @@
1
- import{initLocalization as i}from"./i18n.js";export{M as MqNextAppointments}from"./chunks/mq-next-appointments-5tvQaSba.js";export{MqAppointmentJoinVideocallEvent,MqAppointmentRescheduleEvent,MqViewAppointmentsEvent}from"./events.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/external-BXLaKy9c.js";import"./chunks/custom-element-D2ziPxYE.js";import"./chunks/provide-BwI4DDGF.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/consume-CovVqBjI.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/localized-decorator-BlOuLhym.js";import"./chunks/query-controller-BlO1Ax65.js";import"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/query-Cjvi4_dT.js";import"./chunks/api-client-context-V1UAGtKW.js";import"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import"./chunks/api-chat-client-fYDIH220.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/next-appointment-card-DQE7dNXw.js";import"./chunks/chunk-6CCJWPGL-TiaqZaPV.js";import"./chunks/get-organization-setup-query-Dr1cXnHl.js";import"./chunks/telemetry-client-DEIuDZfA.js";import"./chunks/chunk-Y4EKUX25-CWAZgcgw.js";import"./chunks/refund-cancel-policy-QG_OE6g5.js";import"./chunks/lit-element-DiWJYFwC.js";import"./chunks/property-scuRaFcM.js";import"./chunks/state-LQivXIgA.js";import"./ui/icons/calendar-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/types.js";import"./ui/icons/dots-horizontal-icon.js";import"./ui/icons/message-bubble-icon.js";import"./ui/icons/phone-icon.js";import"./ui/icons/video-icon.js";import"./mq-chat-room.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./ui/mq-avatar.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-button.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/chunk-BUV4MGML-CkhBbfUu.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-DJR1Yoyy.js";import"./chunks/mutation-controller-CR2qcqhH.js";import"./ui/mq-dialog.js";import"./chunks/price-DU3YLTpk.js";import"./chunks/professional-overview-C4H_znIJ.js";import"./ui/icons/chevron-down-icon.js";import"./ui/mq-text-button.js";import"./ui/mq-floating-bubble.js";import"./ui/mq-unread-badge.js";import"./ui/mq-toast.js";import"./chunks/get-patient-profile-query-4AO6xvVn.js";import"./chunks/index-DEEAEB_4.js";import"./ui/icons/file-icon.js";import"./chunks/index-Bw-MbGKw.js";import"./ui/icons/arrow-right-icon.js";i();
1
+ import{initLocalization as i}from"./i18n.js";export{M as MqNextAppointments}from"./chunks/mq-next-appointments-BdsRyXJB.js";export{MqAppointmentJoinVideocallEvent,MqAppointmentRescheduleEvent,MqViewAppointmentsEvent}from"./events.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/external-CJj32K_p.js";import"./chunks/custom-element-D2ziPxYE.js";import"./chunks/provide-BwI4DDGF.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/consume-CovVqBjI.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/localized-decorator-BlOuLhym.js";import"./chunks/query-controller-BlO1Ax65.js";import"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/query-Cjvi4_dT.js";import"./chunks/api-client-context-V1UAGtKW.js";import"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import"./chunks/api-chat-client-BhxUWldC.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/next-appointment-card-KXLkEJDg.js";import"./chunks/chunk-6CCJWPGL-TiaqZaPV.js";import"./chunks/get-organization-setup-query-Dr1cXnHl.js";import"./chunks/telemetry-client-DEIuDZfA.js";import"./chunks/chunk-Y4EKUX25-QqMl3eiq.js";import"./chunks/refund-cancel-policy-QG_OE6g5.js";import"./chunks/lit-element-DiWJYFwC.js";import"./chunks/property-scuRaFcM.js";import"./chunks/state-LQivXIgA.js";import"./ui/icons/calendar-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/types.js";import"./ui/icons/dots-horizontal-icon.js";import"./ui/icons/message-bubble-icon.js";import"./ui/icons/phone-icon.js";import"./ui/icons/video-icon.js";import"./mq-chat-room.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./ui/mq-avatar.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-button.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/chunk-BUV4MGML-CkhBbfUu.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/mutation-controller-CR2qcqhH.js";import"./ui/mq-dialog.js";import"./chunks/price-DU3YLTpk.js";import"./chunks/professional-overview-B4E05rLd.js";import"./ui/icons/chevron-down-icon.js";import"./ui/mq-text-button.js";import"./ui/mq-floating-bubble.js";import"./ui/mq-unread-badge.js";import"./ui/mq-toast.js";import"./chunks/get-patient-profile-query-4AO6xvVn.js";import"./chunks/index-DEEAEB_4.js";import"./ui/icons/file-icon.js";import"./chunks/index-Bw-MbGKw.js";import"./ui/icons/arrow-right-icon.js";i();
@@ -1,13 +1,13 @@
1
- import * as lit_html from 'lit-html';
2
1
  import * as lit from 'lit';
3
- import { LitElement, PropertyValues } from 'lit';
4
- import { M as MediquoApiChatClient } from './chunks/index.d-XSe7Hy-Q.js';
2
+ import { LitElement, PropertyValues, TemplateResult } from 'lit';
3
+ import { M as MediquoApiChatClient } from './chunks/index.d-DeJP_xib.js';
5
4
  import { Env } from './env.js';
6
5
  import './ui/mq-button.js';
7
- export { MqPaymentSucceededEvent } from './events.js';
6
+ export { MqHomeEvent, MqPaymentSucceededEvent } from './events.js';
8
7
  import 'axios';
9
8
  import 'zod';
10
9
  import './chunks/schemas.d-b6_AekBb.js';
10
+ import 'lit-html';
11
11
 
12
12
  /**
13
13
  * Resolves a payment session started elsewhere, on a screen of its own.
@@ -18,34 +18,25 @@ import './chunks/schemas.d-b6_AekBb.js';
18
18
  * session id and it polls `GET /payments/v1/session/{id}` until the session
19
19
  * reaches a terminal state.
20
20
  *
21
- * It deliberately emits **only** `mq-payment-succeeded`. Rejected and
22
- * unconfirmable payments stay here and are rendered in place — the host has no
23
- * better screen for them and no decision to make — so the integrator wires one
24
- * listener and, on success, navigates to `mq-schedule-success` with the
25
- * appointment id it receives.
21
+ * Failure is rendered here rather than handed back, because none of the
22
+ * outcomes is a decision the host can make and none is retryable — the booking
23
+ * cannot be brought back by asking again.
26
24
  *
27
25
  * @fires mq-payment-succeeded - The session reached `paid`. Carries the created
28
- * appointment id, so the host can route straight to the confirmation screen.
29
- * @fires mq-back - The user asked to leave a terminal error screen (the "Volver"
30
- * action on the rejected / unconfirmable states). Purely a navigation hint —
31
- * the host decides where "back" goes; hosts that render the poller as a
32
- * dedicated return page can ignore it.
26
+ * appointment id.
27
+ * @fires mq-home - "Volver al inicio" on a terminal error screen. Same event
28
+ * `mq-schedule-success` emits, so one listener covers both ends of the flow.
33
29
  */
34
30
  declare class MqPaymentPoller extends LitElement {
35
31
  static styles: lit.CSSResult;
36
- /** Session to resolve, as returned when the payment was started. */
37
32
  sessionId?: string;
38
- /** Organization API key. Standalone hosts only. */
39
33
  apiKey?: string;
40
- /** Patient session token. Standalone hosts only. */
41
34
  token?: string;
42
- /** Locale override ("es_ES" | "en_GB" | …). Optional. */
43
35
  locale?: string;
44
- /** Environment override ("development" | "production"). Optional. */
45
36
  env?: Env;
46
- /** How long to keep polling before showing the timeout screen. */
47
37
  timeoutMs: number;
48
38
  private _view;
39
+ private _refunded;
49
40
  private _intervalId?;
50
41
  private _deadline;
51
42
  private _settled;
@@ -63,12 +54,13 @@ declare class MqPaymentPoller extends LitElement {
63
54
  private _stop;
64
55
  private _settle;
65
56
  private _pollOnce;
66
- private _onRetry;
67
- private _onBack;
57
+ private _onHome;
68
58
  private _renderVerifying;
59
+ private _renderOutcome;
69
60
  private _renderDenied;
61
+ private _renderUnavailable;
70
62
  private _renderTimeout;
71
- render(): lit_html.TemplateResult<1>;
63
+ render(): TemplateResult<1>;
72
64
  }
73
65
  declare global {
74
66
  interface HTMLElementTagNameMap {
@@ -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{e as r}from"./chunks/provide-BwI4DDGF.js";import{c as n}from"./chunks/consume-CovVqBjI.js";import{m as a}from"./chunks/runtime-Bg1WXVCx.js";import{l}from"./chunks/localized-decorator-BlOuLhym.js";import{c,n as d,P as p}from"./chunks/api-chat-client-fYDIH220.js";import{A as h}from"./chunks/api-client-context-V1UAGtKW.js";import{i as m,a as u,x as v}from"./chunks/lit-element-DiWJYFwC.js";import{n as f}from"./chunks/property-scuRaFcM.js";import{r as g}from"./chunks/state-LQivXIgA.js";import{setEnv as y}from"./env.js";import{MqBackEvent as _,MqPaymentSucceededEvent as x}from"./events.js";import{spinnerIcon as k}from"./ui/icons/spinner-icon.js";import"./ui/mq-button.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/external-BXLaKy9c.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./chunks/create-context-DqP79qjF.js";import"./ui/icons/types.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/if-defined-BYeVdwgd.js";const b="support@mediquo.com",j=m`: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 w=class MqPaymentPoller extends u{constructor(){super(...arguments),this.timeoutMs=9e4,this._view="verifying",this._deadline=0,this._settled=!1,this.apiClient=c(),this._onRetry=()=>{this._restart()},this._onBack=()=>{this.dispatchEvent(new _({source:"payment-poller"}))}}static{this.styles=j}willUpdate(i){i.has("env")&&this.env&&y(this.env),i.has("locale")&&this.locale&&t(this.locale)&&e(this.locale);const s=d(i,{env:this.env,apiKey:this.apiKey,token:this.token,locale:this.locale},this.inheritedApiClient);s&&(this.apiClient=s)}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 this.apiClient.payments.getPaymentSession(t)}catch{return}return this._settled||t!==this.sessionId?void 0:e.status===p.Paid?(this._stop(),this._settled=!0,void this.dispatchEvent(new x({appointmentId:e.consultation_id,consultationType:e.consultation_type}))):void(e.status===p.Denied&&this._settle("denied"))}_renderVerifying(){return v`<div class="card"><div class="verifying" role="status" aria-live="polite">${k({size:28,color:"var(--color-primary)"})}<p class="title">${a("Confirmando tu pago")}</p><p class="message">${a("No cierres, vuelvas atrás ni actualices la ventana; esto puede tardar unos momentos.")}</p></div></div>`}_renderDenied(){return v`<div class="card"><div class="outcome" role="alert"><p class="title">${a("Tu pago no se ha completado")}</p><p class="message">${a("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}">${a("Volver")}</mq-button></div></div></div>`}_renderTimeout(){return v`<div class="card"><div class="outcome" role="alert"><p class="title">${a("Ha ocurrido un error")}</p><p class="message">${a("No hemos podido confirmar tu pago. Por favor, inténtalo de nuevo más tarde.")}</p><p class="message support">${a("Si se te ha cobrado sin una cita confirmada, contacta con nuestro equipo en")} <a href="mailto:${b}">${b}</a></p><div class="actions"><mq-button variant="primary" size="lg" fullwidth @click="${this._onRetry}">${a("Reintentar verificación")}</mq-button><mq-button variant="secondary" size="lg" fullwidth @click="${this._onBack}">${a("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([f({type:String,attribute:"session-id"})],w.prototype,"sessionId",void 0),s([f({type:String,attribute:"api-key"})],w.prototype,"apiKey",void 0),s([f({type:String,attribute:"token"})],w.prototype,"token",void 0),s([f({type:String,attribute:"locale"})],w.prototype,"locale",void 0),s([f({type:String,attribute:"env"})],w.prototype,"env",void 0),s([f({type:Number,attribute:"timeout-ms"})],w.prototype,"timeoutMs",void 0),s([g()],w.prototype,"_view",void 0),s([n({context:h,subscribe:!0}),g()],w.prototype,"inheritedApiClient",void 0),s([r({context:h}),g()],w.prototype,"apiClient",void 0),w=s([l(),o("mq-payment-poller")],w),i();export{w as MqPaymentPoller,x as MqPaymentSucceededEvent};
1
+ import{isValidLocale as e,setLocale as t,initLocalization as i}from"./i18n.js";import{_ as s,c as o}from"./chunks/custom-element-D2ziPxYE.js";import{e as r}from"./chunks/provide-BwI4DDGF.js";import{c as a}from"./chunks/consume-CovVqBjI.js";import{m as n}from"./chunks/runtime-Bg1WXVCx.js";import{l}from"./chunks/localized-decorator-BlOuLhym.js";import{i as d,a as c,b as p,c as u,n as h,P as m}from"./chunks/api-chat-client-BhxUWldC.js";import{A as v}from"./chunks/api-client-context-V1UAGtKW.js";import{i as f,a as g,x as _}from"./chunks/lit-element-DiWJYFwC.js";import{n as y}from"./chunks/property-scuRaFcM.js";import{r as b}from"./chunks/state-LQivXIgA.js";import{setEnv as x}from"./env.js";import{MqHomeEvent as k,MqPaymentSucceededEvent as j}from"./events.js";import{spinnerIcon as w}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/context-request-event-Dfydf1ub.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./chunks/create-context-DqP79qjF.js";import"./ui/icons/types.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/if-defined-BYeVdwgd.js";const $="support@mediquo.com",I=f`: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 C=class MqPaymentPoller extends g{constructor(){super(...arguments),this.timeoutMs=9e4,this._view="verifying",this._refunded=!1,this._deadline=0,this._settled=!1,this.apiClient=u(),this._onHome=()=>{this.dispatchEvent(new k)}}static{this.styles=I}willUpdate(i){i.has("env")&&this.env&&x(this.env),i.has("locale")&&this.locale&&e(this.locale)&&t(this.locale);const s=h(i,{env:this.env,apiKey:this.apiKey,token:this.token,locale:this.locale},this.inheritedApiClient);s&&(this.apiClient=s)}updated(e){e.has("sessionId")&&this._restart()}disconnectedCallback(){this._stop(),super.disconnectedCallback()}_restart(){this._stop(),this._settled=!1,this._refunded=!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(e){this._stop(),this._settled=!0,this._view=e}async _pollOnce(){const e=this.sessionId;if(this._settled||!e)return;if(Date.now()>=this._deadline)return void this._settle("timeout");let t;try{t=await this.apiClient.payments.getPaymentSession(e)}catch(t){const i=function(e){if(!d(e)||e.response?.status!==c.SlotUnavailable)return{kind:"retry"};const t=p.safeParse(e.response.data);return{kind:"unavailable",refunded:!0===t.data?.refunded}}(t);return void("unavailable"!==i.kind||this._settled||e!==this.sessionId||(this._refunded=i.refunded,this._settle("unavailable")))}return this._settled||e!==this.sessionId?void 0:t.status===m.Paid?(this._stop(),this._settled=!0,void this.dispatchEvent(new j({appointmentId:t.consultation_id,consultationType:t.consultation_type}))):t.status===m.Refunded?(this._refunded=!0,void this._settle("unavailable")):void(t.status===m.Denied&&this._settle("denied"))}_renderVerifying(){return _`<div class="card"><div class="verifying" role="status" aria-live="polite">${w({size:28,color:"var(--color-primary)"})}<p class="title">${n("Confirmando tu pago")}</p><p class="message">${n("No cierres, vuelvas atrás ni actualices la ventana; esto puede tardar unos momentos.")}</p></div></div>`}_renderOutcome(e,t){return _`<div class="card"><div class="outcome" role="alert"><p class="title">${e}</p>${t}<div class="actions"><mq-button variant="primary" size="lg" fullwidth @click="${this._onHome}">${n("Volver al inicio")}</mq-button></div></div></div>`}_renderDenied(){return this._renderOutcome(n("Tu pago no se ha completado"),_`<p class="message">${n("El pago ha sido rechazado y no hemos creado la cita. No se te ha cobrado nada: puedes volver a reservar desde el inicio.")}</p>`)}_renderUnavailable(){return this._renderOutcome(n("Ese horario ya no está disponible"),_`<p class="message">${n("Otro paciente ha reservado esa cita mientras completabas el pago, así que no hemos podido crearla.")}</p>${this._refunded?_`<p class="message">${n("Te hemos devuelto el importe automáticamente; puede tardar unos días en reflejarse en tu cuenta.")}</p>`:_`<p class="message support">${n("No hemos podido devolverte el importe automáticamente. Escríbenos y lo resolvemos:")} <a href="mailto:${$}">${$}</a></p>`}`)}_renderTimeout(){return this._renderOutcome(n("Ha ocurrido un error"),_`<p class="message">${n("No hemos podido confirmar tu pago. Por favor, inténtalo de nuevo más tarde.")}</p><p class="message support">${n("Si se te ha cobrado sin una cita confirmada, contacta con nuestro equipo en")} <a href="mailto:${$}">${$}</a></p>`)}render(){switch(this._view){case"denied":return this._renderDenied();case"unavailable":return this._renderUnavailable();case"timeout":return this._renderTimeout();default:return this._renderVerifying()}}};s([y({type:String,attribute:"session-id"})],C.prototype,"sessionId",void 0),s([y({type:String,attribute:"api-key"})],C.prototype,"apiKey",void 0),s([y({type:String,attribute:"token"})],C.prototype,"token",void 0),s([y({type:String,attribute:"locale"})],C.prototype,"locale",void 0),s([y({type:String,attribute:"env"})],C.prototype,"env",void 0),s([y({type:Number,attribute:"timeout-ms"})],C.prototype,"timeoutMs",void 0),s([b()],C.prototype,"_view",void 0),s([b()],C.prototype,"_refunded",void 0),s([a({context:v,subscribe:!0}),b()],C.prototype,"inheritedApiClient",void 0),s([r({context:v}),b()],C.prototype,"apiClient",void 0),C=s([l(),o("mq-payment-poller")],C),i();export{k as MqHomeEvent,C as MqPaymentPoller,j 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 c}from"./chunks/context-consumer-ESdICVAb.js";import{Q as r}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{A as i}from"./chunks/api-client-context-V1UAGtKW.js";import{S as o,a}from"./chunks/chunk-YTQUGGS3-DJR1Yoyy.js";import{g as h}from"./chunks/chunk-BUV4MGML-CkhBbfUu.js";import{b as l}from"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/external-BXLaKy9c.js";import"./chunks/chunk-6CCJWPGL-TiaqZaPV.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.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 c=l(n).getTime()-Date.now();c>0&&c<2147483647&&this.clearTimers.set(s,setTimeout(()=>{this.clearTimers.delete(s),this._setActiveAbsence(s,null)},c))},this._onAbsenceCancelled=e=>{e?.professional_hash&&(this._clearTimer(e.professional_hash),this._setActiveAbsence(e.professional_hash,null))},new c(this.host,{context:o,subscribe:!0,callback:e=>{e&&e!==this.socket&&(this.socket=e,this.socket.on(a.absence_created,this._onAbsenceCreated),this.socket.on(a.absence_cancelled,this._onAbsenceCancelled))}}),new c(this.host,{context:r,subscribe:!0,callback:e=>{e&&(this.queryClient=e)}}),new c(this.host,{context:i,subscribe:!0,callback:e=>{this.apiClient=e}}),this.host.addController(this)}_queryKey(e){if(this.apiClient)return h(this.apiClient,{hash:e}).queryKey}_setActiveAbsence(e,s){const t=this._queryKey(e);t&&this.queryClient?.setQueryData(t,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(a.absence_created,this._onAbsenceCreated),this.socket?.off(a.absence_cancelled,this._onAbsenceCancelled);for(const e of this.clearTimers.values())clearTimeout(e);this.clearTimers.clear()}}let u=class MqProfessionalPresenceSync extends t{constructor(){super(...arguments),this._controller=new ProfessionalPresenceSyncController(this)}createRenderRoot(){return this}render(){return n}};u=e([s("mq-professional-presence-sync")],u);export{u 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{s as c}from"./chunks/context-consumer-ESdICVAb.js";import{Q as r}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{A as i}from"./chunks/api-client-context-V1UAGtKW.js";import{S as o,a}from"./chunks/chunk-YTQUGGS3-DmCGIoFy.js";import{g as h}from"./chunks/chunk-BUV4MGML-CkhBbfUu.js";import{b as l}from"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/external-CJj32K_p.js";import"./chunks/chunk-6CCJWPGL-TiaqZaPV.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.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 c=l(n).getTime()-Date.now();c>0&&c<2147483647&&this.clearTimers.set(s,setTimeout(()=>{this.clearTimers.delete(s),this._setActiveAbsence(s,null)},c))},this._onAbsenceCancelled=e=>{e?.professional_hash&&(this._clearTimer(e.professional_hash),this._setActiveAbsence(e.professional_hash,null))},new c(this.host,{context:o,subscribe:!0,callback:e=>{e&&e!==this.socket&&(this.socket=e,this.socket.on(a.absence_created,this._onAbsenceCreated),this.socket.on(a.absence_cancelled,this._onAbsenceCancelled))}}),new c(this.host,{context:r,subscribe:!0,callback:e=>{e&&(this.queryClient=e)}}),new c(this.host,{context:i,subscribe:!0,callback:e=>{this.apiClient=e}}),this.host.addController(this)}_queryKey(e){if(this.apiClient)return h(this.apiClient,{hash:e}).queryKey}_setActiveAbsence(e,s){const t=this._queryKey(e);t&&this.queryClient?.setQueryData(t,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(a.absence_created,this._onAbsenceCreated),this.socket?.off(a.absence_cancelled,this._onAbsenceCancelled);for(const e of this.clearTimers.values())clearTimeout(e);this.clearTimers.clear()}}let u=class MqProfessionalPresenceSync extends t{constructor(){super(...arguments),this._controller=new ProfessionalPresenceSyncController(this)}createRenderRoot(){return this}render(){return n}};u=e([s("mq-professional-presence-sync")],u);export{u as MqProfessionalPresenceSync,ProfessionalPresenceSyncController};
@@ -1,9 +1,9 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
3
  import { LitElement, PropertyValues } from 'lit';
4
- import { M as MediquoApiChatClient } from './chunks/index.d-XSe7Hy-Q.js';
4
+ import { M as MediquoApiChatClient } from './chunks/index.d-DeJP_xib.js';
5
5
  import { Env } from './env.js';
6
- import './chunks/index-DdkeWQrh.js';
6
+ import './chunks/index-D0njwg5o.js';
7
7
  import './chunks/index-DTEtqjQF.js';
8
8
  import './chunks/index-Nf3nZ9O3.js';
9
9
  export { DownloadFileEvent, MqViewDocumentsEvent } from './events.js';
@@ -1 +1 @@
1
- import{initLocalization as s}from"./i18n.js";export{M as MqRecentDocuments}from"./chunks/mq-recent-documents-DzsyvBjW.js";export{DownloadFileEvent,MqViewDocumentsEvent}from"./events.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/external-BXLaKy9c.js";import"./chunks/custom-element-D2ziPxYE.js";import"./chunks/provide-BwI4DDGF.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/consume-CovVqBjI.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/localized-decorator-BlOuLhym.js";import"./chunks/query-controller-BlO1Ax65.js";import"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/query-Cjvi4_dT.js";import"./chunks/api-client-context-V1UAGtKW.js";import"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import"./chunks/telemetry-client-DEIuDZfA.js";import"./chunks/chunk-6CCJWPGL-TiaqZaPV.js";import"./chunks/index-BLxNeTVi.js";import"./chunks/lit-element-DiWJYFwC.js";import"./chunks/property-scuRaFcM.js";import"./chunks/api-chat-client-fYDIH220.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/blob-to-base64-CUL1trde.js";import"./chunks/state-LQivXIgA.js";import"./ui/icons/download-02-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/types.js";import"./ui/mq-button.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-toast.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/get-patient-profile-query-4AO6xvVn.js";import"./chunks/index-Bw-MbGKw.js";import"./ui/icons/arrow-right-icon.js";import"./chunks/index-DEEAEB_4.js";import"./ui/icons/calendar-icon.js";import"./ui/icons/file-icon.js";s();
1
+ import{initLocalization as s}from"./i18n.js";export{M as MqRecentDocuments}from"./chunks/mq-recent-documents-CNweIX5U.js";export{DownloadFileEvent,MqViewDocumentsEvent}from"./events.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/external-CJj32K_p.js";import"./chunks/custom-element-D2ziPxYE.js";import"./chunks/provide-BwI4DDGF.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/consume-CovVqBjI.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/localized-decorator-BlOuLhym.js";import"./chunks/query-controller-BlO1Ax65.js";import"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/query-Cjvi4_dT.js";import"./chunks/api-client-context-V1UAGtKW.js";import"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import"./chunks/telemetry-client-DEIuDZfA.js";import"./chunks/chunk-6CCJWPGL-TiaqZaPV.js";import"./chunks/index-DjD-3x4f.js";import"./chunks/lit-element-DiWJYFwC.js";import"./chunks/property-scuRaFcM.js";import"./chunks/api-chat-client-BhxUWldC.js";import"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";import"./chunks/blob-to-base64-CUL1trde.js";import"./chunks/state-LQivXIgA.js";import"./ui/icons/download-02-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/types.js";import"./ui/mq-button.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./ui/mq-toast.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/get-patient-profile-query-4AO6xvVn.js";import"./chunks/index-Bw-MbGKw.js";import"./ui/icons/arrow-right-icon.js";import"./chunks/index-DEEAEB_4.js";import"./ui/icons/calendar-icon.js";import"./ui/icons/file-icon.js";s();
@@ -1,13 +1,13 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
3
  import { LitElement, PropertyValues } from 'lit';
4
- import { M as MediquoApiChatClient } from './chunks/index.d-XSe7Hy-Q.js';
4
+ import { M as MediquoApiChatClient } from './chunks/index.d-DeJP_xib.js';
5
5
  import { Env } from './env.js';
6
6
  import './ui/mq-callout.js';
7
7
  import './ui/mq-button.js';
8
8
  import './chunks/professional-overview-mO3tuMuH.js';
9
9
  import './chunks/appointment-details-CVEDe_k0.js';
10
- import './chunks/mq-chat-room-jeDvIF1Z.js';
10
+ import './chunks/mq-chat-room-B3ant6md.js';
11
11
  import './ui/mq-floating-bubble.js';
12
12
  import './ui/mq-unread-badge.js';
13
13
  import './ui/mq-skeleton.js';
@@ -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{A as p}from"./chunks/api-client-context-V1UAGtKW.js";import{i as l,a as d,x as m,E as u}from"./chunks/lit-element-DiWJYFwC.js";import{n as h}from"./chunks/property-scuRaFcM.js";import{r as v}from"./chunks/state-LQivXIgA.js";import{setEnv as g}from"./env.js";import{MqViewAppointmentsEvent as f,MqHomeEvent as k}from"./events.js";import{c as b,a as y,n as x,C as j}from"./chunks/api-chat-client-fYDIH220.js";import{checkIcon as w}from"./ui/icons/check-icon.js";import"./ui/mq-callout.js";import"./ui/mq-button.js";import{e as $}from"./chunks/provide-BwI4DDGF.js";import{c as q}from"./chunks/consume-CovVqBjI.js";import{l as C}from"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import"./chunks/professional-overview-C4H_znIJ.js";import"./chunks/appointment-details-BriSqXWj.js";import{Q as _}from"./chunks/query-controller-BlO1Ax65.js";import{s as S}from"./chunks/chunk-6CCJWPGL-TiaqZaPV.js";import{g as z}from"./chunks/get-appointment-query-C-gTTuiQ.js";import{g as I}from"./chunks/get-patient-profile-query-4AO6xvVn.js";import{g as A}from"./chunks/chunk-Y4EKUX25-CWAZgcgw.js";import{b as O}from"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import{calendarIcon as P}from"./ui/icons/calendar-icon.js";import{chatbubbleIcon as T}from"./ui/icons/chat-bubble-icon.js";import{videoIcon as Q}from"./ui/icons/video-icon.js";import"./mq-chat-room.js";import"./ui/mq-floating-bubble.js";import"./ui/mq-unread-badge.js";import{g as E,t as N,l as V,a as H,n as B,o as U,p as F}from"./chunks/telemetry-client-DEIuDZfA.js";import{f as G}from"./chunks/price-DU3YLTpk.js";import"./ui/mq-skeleton.js";import"./ui/mq-card.js";import{Q as K}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{a as M}from"./chunks/addSeconds-ofMnxlgT.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/external-BXLaKy9c.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/isBefore-CPpTogxo.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/types.js";import"./ui/icons/info-circle-outine-icon.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-consumer-ESdICVAb.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/format-CRFiCNHw.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./chunks/chunk-BUV4MGML-CkhBbfUu.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./ui/icons/check-double-icon.js";import"./chunks/chunk-YTQUGGS3-DJR1Yoyy.js";import"./chunks/mutation-controller-CR2qcqhH.js";import"./chunks/style-map-CIdqdn7C.js";const R=l`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 J=class MqScheduleSuccessSkeleton extends d{static{this.styles=R}render(){return m`<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>`}};J=n([a("mq-schedule-success-skeleton")],J);const L=l`.success-title{display:flex;align-items:center;gap:var(--sp-3);margin-bottom:var(--sp-4)}.success-title .check{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:40px;height:40px;border-radius:50%;background:var(--color-primary-background-extraWeak);color:var(--color-primary-icon-link)}header h1{font-family:var(--font-titles);font-size:var(--text-3xl);line-height:var(--text-3xl--line-height);font-weight:var(--font-weight-semibold);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 W=class MqScheduleSuccess extends d{constructor(){super(...arguments),this.kind="schedule",this.showNavCtas=!1,this._trackedPageView=!1,this.apiClient=b(),this.getPatientProfileQuery=new _(this,()=>I(this.apiClient)),this.getAppointmentQuery=new _(this,()=>z(this.apiClient,{id:this.appointmentId})),this.getCouponQuery=new _(this,()=>{return t=this.apiClient,e={appointmentId:this.appointmentId},i={enabled:!!this.appointmentId},{queryKey:S(t,"appointment-consultation-coupon",e.appointmentId),queryFn:()=>t.payments.getAppointmentConsultationCoupon(e.appointmentId),retry:!1,...i};var t,e,i}),this.getOrganizationSpecialtiesQuery=new _(this,()=>E(this.apiClient)),this.isChatOpen=!1,this.unreadQuery=new _(this,()=>A(this.apiClient,{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{A as p}from"./chunks/api-client-context-V1UAGtKW.js";import{i as l,a as d,x as m,E as u}from"./chunks/lit-element-DiWJYFwC.js";import{n as h}from"./chunks/property-scuRaFcM.js";import{r as v}from"./chunks/state-LQivXIgA.js";import{setEnv as g}from"./env.js";import{MqViewAppointmentsEvent as f,MqHomeEvent as k}from"./events.js";import{c as b,e as y,n as x,C as j}from"./chunks/api-chat-client-BhxUWldC.js";import{checkIcon as w}from"./ui/icons/check-icon.js";import"./ui/mq-callout.js";import"./ui/mq-button.js";import{e as $}from"./chunks/provide-BwI4DDGF.js";import{c as q}from"./chunks/consume-CovVqBjI.js";import{l as C}from"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import"./chunks/professional-overview-B4E05rLd.js";import"./chunks/appointment-details-BriSqXWj.js";import{Q as _}from"./chunks/query-controller-BlO1Ax65.js";import{s as S}from"./chunks/chunk-6CCJWPGL-TiaqZaPV.js";import{g as z}from"./chunks/get-appointment-query-C-gTTuiQ.js";import{g as I}from"./chunks/get-patient-profile-query-4AO6xvVn.js";import{g as A}from"./chunks/chunk-Y4EKUX25-QqMl3eiq.js";import{b as O}from"./chunks/chunk-2TKJJNS7-BGwxtEg7.js";import{calendarIcon as P}from"./ui/icons/calendar-icon.js";import{chatbubbleIcon as T}from"./ui/icons/chat-bubble-icon.js";import{videoIcon as Q}from"./ui/icons/video-icon.js";import"./mq-chat-room.js";import"./ui/mq-floating-bubble.js";import"./ui/mq-unread-badge.js";import{g as E,t as N,l as V,a as H,n as B,o as U,p as F}from"./chunks/telemetry-client-DEIuDZfA.js";import{f as G}from"./chunks/price-DU3YLTpk.js";import"./ui/mq-skeleton.js";import"./ui/mq-card.js";import{Q as K}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{a as M}from"./chunks/addSeconds-ofMnxlgT.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/external-CJj32K_p.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/isBefore-CPpTogxo.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/types.js";import"./ui/icons/info-circle-outine-icon.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-consumer-ESdICVAb.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/format-CRFiCNHw.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./chunks/chunk-BUV4MGML-CkhBbfUu.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 R=l`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 J=class MqScheduleSuccessSkeleton extends d{static{this.styles=R}render(){return m`<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>`}};J=n([a("mq-schedule-success-skeleton")],J);const L=l`.success-title{display:flex;align-items:center;gap:var(--sp-3);margin-bottom:var(--sp-4)}.success-title .check{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:40px;height:40px;border-radius:50%;background:var(--color-primary-background-extraWeak);color:var(--color-primary-icon-link)}header h1{font-family:var(--font-titles);font-size:var(--text-3xl);line-height:var(--text-3xl--line-height);font-weight:var(--font-weight-semibold);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 W=class MqScheduleSuccess extends d{constructor(){super(...arguments),this.kind="schedule",this.showNavCtas=!1,this._trackedPageView=!1,this.apiClient=b(),this.getPatientProfileQuery=new _(this,()=>I(this.apiClient)),this.getAppointmentQuery=new _(this,()=>z(this.apiClient,{id:this.appointmentId})),this.getCouponQuery=new _(this,()=>{return t=this.apiClient,e={appointmentId:this.appointmentId},i={enabled:!!this.appointmentId},{queryKey:S(t,"appointment-consultation-coupon",e.appointmentId),queryFn:()=>t.payments.getAppointmentConsultationCoupon(e.appointmentId),retry:!1,...i};var t,e,i}),this.getOrganizationSpecialtiesQuery=new _(this,()=>E(this.apiClient)),this.isChatOpen=!1,this.unreadQuery=new _(this,()=>A(this.apiClient,{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
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
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 u}}}static{this.styles=L}get _accessToken(){return this.token??this.loginToken?.access_token}get _timezone(){return this.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}willUpdate(i){i.has("env")&&this.env&&g(this.env),i.has("locale")&&this.locale&&t(this.locale)&&e(this.locale);const o=x(i,{env:this.env,apiKey:this.apiKey,token:this.token,locale:this.locale},this.inheritedApiClient);o&&(this.apiClient=o)}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 u;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,d=r?p?.percent_off??Math.round(a/o*100):0,h=l?`${s("Promoción")} ${l}`:s("Promoción");return m`<div class="price-breakdown"><div class="price-row"><span>${i}</span> <span>${G({amount:o,currency:n},e)}</span></div>${r?m`<div class="price-row"><span>${h} (-${d}%)</span> <span>${G({amount:-a,currency:n},e)}</span></div><hr><div class="price-row price-row--total"><span>${s("Total")}</span> <span>${G({amount:c,currency:n},e)}</span></div>`:u}</div>`}render(){return this.getAppointmentQuery.render({pending:()=>m`<mq-schedule-success-skeleton></mq-schedule-success-skeleton>`,complete:t=>{const e=i(),o=O(t.start_date),n=M(o,t.duration),a=this.getOrganizationSpecialtiesQuery.result?.data?.find(e=>e.id===Number(t.speciality_id)),c=H(a?.code??"",e,a?.name),p=t.channel===y.videocall,l=t.channel===y.phonecall,d=!0===t.has_chat_in_appointment,h=(p||l)&&d,v=this._accessToken;return m`<div><header><div class="success-title"><span class="check">${w()}</span><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(B(this._patientHash,this.appointmentId));const e=function({title:t,description:e,startsAt:i,endsAt:o}){const n=t=>t.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),a=n(i),s=n(o);return`https://www.google.com/calendar/render?${new URLSearchParams({action:"TEMPLATE",text:t,dates:`${a}/${s}`,...e&&{details:e}}).toString()}`}({title:s(r`Cita agendada de ${t.from.speciality??""}`),startsAt:o,endsAt:n,description:p&&t.consultation_short_url?s(r`Enlace a la cita: ${t.consultation_short_url}`):void 0});window.open(e,"_blank")}}">${P({size:24})} ${s("Añadir al calendario")}</mq-text-button></div>${h||p?m`<div class="actions">${h?m`<mq-button variant="primary" fullwidth size="md" @click="${()=>{N.track(U(this._patientHash,this.appointmentId)),this.isChatOpen=!this.isChatOpen}}">${T({size:24})} ${s("Chatear con el profesional")} ${(this.unreadQuery.result?.data?.unread_count??0)>0?m`<mq-unread-badge></mq-unread-badge>`:u}</mq-button>`:u} ${p?m`<mq-button variant="outline" fullwidth size="md" @click="${()=>{N.track(F(this._patientHash,this.appointmentId)),this.dispatchEvent(new OpenVideocallEvent({appointmentId:this.appointmentId}))}}">${Q({size:24})} ${s("Ir a videollamada")}</mq-button>`:u}</div>`:u}</div><mq-callout background="default" variant="info" ?noPadding="${!(h||p)}">${this._getCalloutText(t)}</mq-callout></mq-card>${this.showNavCtas?m`<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 f({tab:"next"}))}}">${s("Ver mis citas")}</mq-button><mq-button variant="outline" size="md" fullwidth @click="${()=>{this.dispatchEvent(new k)}}">${s("Volver al inicio")}</mq-button></div></mq-card>`:u}</div><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen&&v?m`<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>`:u}</mq-floating-bubble>`}})}};n([h({type:String})],W.prototype,"kind",void 0),n([h({type:String})],W.prototype,"appointmentId",void 0),n([h({type:String,attribute:"api-key"})],W.prototype,"apiKey",void 0),n([h({type:String,attribute:"token"})],W.prototype,"token",void 0),n([h({type:String,attribute:"timezone"})],W.prototype,"timezone",void 0),n([h({type:String,attribute:"locale"})],W.prototype,"locale",void 0),n([h({type:String,attribute:"env"})],W.prototype,"env",void 0),n([h({type:Boolean,attribute:"show-nav-ctas"})],W.prototype,"showNavCtas",void 0),n([q({context:K,subscribe:!0})],W.prototype,"queryClientContext",void 0),n([q({context:C})],W.prototype,"loginToken",void 0),n([q({context:p,subscribe:!0}),v()],W.prototype,"inheritedApiClient",void 0),n([$({context:p}),v()],W.prototype,"apiClient",void 0),n([v()],W.prototype,"isChatOpen",void 0),W=n([c(),a("mq-schedule-success")],W),o();export{W as MqScheduleSuccess,OpenVideocallEvent};
@@ -2,7 +2,7 @@ import * as lit_html_directive_js from 'lit-html/directive.js';
2
2
  import * as lit_html_directives_keyed_js from 'lit-html/directives/keyed.js';
3
3
  import * as lit from 'lit';
4
4
  import { LitElement, PropertyValues, TemplateResult, nothing } from 'lit';
5
- import { M as MediquoApiChatClient, c as GetScheduleServicesResponse, C as CreatePaymentLinkRequest, P as PaymentProvider, d as GetProfessionalsBySpecialtyAndServiceResponse } from './chunks/index.d-XSe7Hy-Q.js';
5
+ import { M as MediquoApiChatClient, c as GetScheduleServicesResponse, C as CreatePaymentLinkRequest, P as PaymentProvider, d as GetProfessionalsBySpecialtyAndServiceResponse } from './chunks/index.d-DeJP_xib.js';
6
6
  import './ui/mq-button.js';
7
7
  import { Env } from './env.js';
8
8
  import * as lit_html from 'lit-html';