@mediquo/elements 0.11.0 → 0.12.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.
- package/README.md +7 -18
- package/dist/chunks/api-chat-client-Dx-sFrf2.js +1 -0
- package/dist/chunks/{apple-pay-outcomes-SIvDJWN_.js → apple-pay-outcomes--uAwZeLE.js} +1 -1
- package/dist/chunks/appointment-details-BM8peAHH.js +1 -0
- package/dist/chunks/{appointment-details-CVEDe_k0.d.ts → appointment-details-KL9fK6vG.d.ts} +1 -2
- package/dist/chunks/ca_ES-DYhnenv6.js +1 -0
- package/dist/chunks/checkout-bridge-BFpVxNww.js +1 -0
- package/dist/chunks/{chunk-Y4EKUX25-Bix9r5ry.js → chunk-Y4EKUX25-Bdei04iw.js} +1 -1
- package/dist/chunks/{chunk-YTQUGGS3-DH0H7ld7.js → chunk-YTQUGGS3-sBILRfPo.js} +1 -1
- package/dist/chunks/de_DE-Dw0iVZNb.js +1 -0
- package/dist/chunks/{documentation-view-BSt0gtCR.js → documentation-view-BcA4Vbhp.js} +1 -1
- package/dist/chunks/en_US-DONnbI9l.js +1 -0
- package/dist/chunks/{external-JLtsAfi6.js → external-cM_kgYO_.js} +1 -1
- package/dist/chunks/{index-CUirgiWh.d.ts → index-BEPyJrJL.d.ts} +1 -1
- package/dist/chunks/{index-B3rs7SlM.d.ts → index-BKjqWyIs.d.ts} +1 -1
- package/dist/chunks/{index-B6OMnYjW.js → index-CGWd3FWG.js} +1 -1
- package/dist/chunks/index-Djkwyh_M.js +1 -0
- package/dist/chunks/{index-CCWMMqiq.js → index-Dw4Aeoyg.js} +1 -1
- package/dist/chunks/{appointment.model.d-BWwBLaEL.d.ts → index-DwlJg2um.d.ts} +13 -0
- package/dist/chunks/{index-D2yqKnpP.js → index-VQqG1eyA.js} +1 -1
- package/dist/chunks/{index-DFaKhE7Q.d.ts → index-fut7tm1R.d.ts} +1 -1
- package/dist/chunks/{index.d-ByhRBSb1.d.ts → index.d-DHMNq1lu.d.ts} +2 -7
- package/dist/chunks/{login-token-task-Yib__6a9.js → login-token-task-NQJ77O_q.js} +1 -1
- package/dist/chunks/mq-chat-room-BkXGHzrd.js +1 -0
- package/dist/chunks/{mq-chat-room-C8wCADp2.d.ts → mq-chat-room-C0dJCvpV.d.ts} +2 -2
- package/dist/chunks/{mq-next-appointments-CbjNpG1H.js → mq-next-appointments-BngkXupq.js} +1 -1
- package/dist/chunks/{mq-recent-documents-DNqh_8J0.js → mq-recent-documents-Ee-JRTdl.js} +1 -1
- package/dist/chunks/mq-schedule-DAKftQ3D.js +1 -0
- package/dist/chunks/{mq-support-chat-tdev5LC-.js → mq-support-chat-Bzj5LYHb.js} +1 -1
- package/dist/chunks/{mq-videocall-CwYtlPu6.js → mq-videocall-Cp7LSoDs.js} +1 -1
- package/dist/chunks/{next-appointment-card-DLU7-wIv.js → next-appointment-card-BE0KW2vv.js} +1 -1
- package/dist/chunks/{next-appointment-card-CPg9FuOI.d.ts → next-appointment-card-Z5G1jqtz.d.ts} +4 -4
- package/dist/chunks/professional-overview-Ck_SPivX.js +1 -0
- package/dist/chunks/{professional-overview-mO3tuMuH.d.ts → professional-overview-QVHl_ITk.d.ts} +1 -0
- package/dist/chunks/pt_PT-dELUeDqB.js +1 -0
- package/dist/chunks/task-CqjSKFwZ.js +1 -0
- package/dist/chunks/{telemetry-client-K37KMdy_.js → telemetry-client-DA2_SZBC.js} +1 -1
- package/dist/env.js +1 -1
- package/dist/events.d.ts +1 -22
- package/dist/events.js +1 -1
- package/dist/i18n.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mq-api-client-provider.d.ts +1 -1
- package/dist/mq-api-client-provider.js +1 -1
- package/dist/mq-apple-pay-checkout.d.ts +1 -1
- package/dist/mq-apple-pay-checkout.js +1 -1
- package/dist/mq-appointment-checkout.d.ts +20 -14
- package/dist/mq-appointment-checkout.js +1 -1
- package/dist/mq-appointment-documentation.d.ts +4 -4
- package/dist/mq-appointment-documentation.js +1 -1
- package/dist/mq-chat-room.d.ts +3 -3
- package/dist/mq-chat-room.js +1 -1
- package/dist/mq-checkout.d.ts +44 -61
- package/dist/mq-checkout.js +1 -1
- package/dist/mq-dashboard.d.ts +6 -6
- package/dist/mq-dashboard.js +1 -1
- package/dist/mq-documents.d.ts +2 -2
- package/dist/mq-documents.js +1 -1
- package/dist/mq-google-pay-checkout.d.ts +1 -1
- package/dist/mq-google-pay-checkout.js +1 -1
- package/dist/mq-immediate-videocall-checkout.d.ts +10 -9
- package/dist/mq-immediate-videocall-checkout.js +1 -1
- package/dist/mq-my-appointments.d.ts +6 -6
- package/dist/mq-my-appointments.js +1 -1
- package/dist/mq-next-appointments.d.ts +5 -5
- package/dist/mq-next-appointments.js +1 -1
- package/dist/mq-payment-poller.d.ts +2 -2
- package/dist/mq-payment-poller.js +1 -1
- package/dist/mq-professional-presence-sync.js +1 -1
- package/dist/mq-recent-documents.d.ts +2 -2
- package/dist/mq-recent-documents.js +1 -1
- package/dist/mq-schedule-success.d.ts +5 -5
- package/dist/mq-schedule-success.js +2 -2
- package/dist/mq-schedule.d.ts +52 -98
- package/dist/mq-schedule.js +1 -1
- package/dist/mq-socket-provider.js +1 -1
- package/dist/mq-support-chat.d.ts +3 -3
- package/dist/mq-support-chat.js +1 -1
- package/dist/mq-terms-and-conditions.d.ts +2 -2
- package/dist/mq-terms-and-conditions.js +1 -1
- package/dist/mq-unread-count-sync.js +1 -1
- package/dist/mq-videocall.d.ts +5 -5
- package/dist/mq-videocall.js +1 -1
- package/dist/react/mq-api-client-provider.d.ts +1 -1
- package/dist/react/mq-api-client-provider.js +1 -1
- package/dist/react/mq-apple-pay-checkout.d.ts +1 -1
- package/dist/react/mq-apple-pay-checkout.js +1 -1
- package/dist/react/mq-appointment-checkout.d.ts +12 -8
- package/dist/react/mq-appointment-checkout.js +1 -1
- package/dist/react/mq-appointment-documentation.d.ts +4 -4
- package/dist/react/mq-appointment-documentation.js +1 -1
- package/dist/react/mq-chat-room.d.ts +3 -3
- package/dist/react/mq-chat-room.js +1 -1
- package/dist/react/mq-checkout.d.ts +11 -8
- package/dist/react/mq-checkout.js +1 -1
- package/dist/react/mq-dashboard.d.ts +6 -6
- package/dist/react/mq-dashboard.js +1 -1
- package/dist/react/mq-documents-page.d.ts +2 -2
- package/dist/react/mq-documents-page.js +1 -1
- package/dist/react/mq-documents.d.ts +2 -2
- package/dist/react/mq-documents.js +1 -1
- package/dist/react/mq-google-pay-checkout.d.ts +1 -1
- package/dist/react/mq-google-pay-checkout.js +1 -1
- package/dist/react/mq-immediate-videocall-checkout.d.ts +4 -2
- package/dist/react/mq-immediate-videocall-checkout.js +1 -1
- package/dist/react/mq-my-appointments.d.ts +6 -6
- package/dist/react/mq-my-appointments.js +1 -1
- package/dist/react/mq-next-appointments.d.ts +5 -5
- package/dist/react/mq-next-appointments.js +1 -1
- package/dist/react/mq-payment-poller.d.ts +1 -1
- package/dist/react/mq-payment-poller.js +1 -1
- package/dist/react/mq-professional-presence-sync.js +1 -1
- package/dist/react/mq-recent-documents.d.ts +2 -2
- package/dist/react/mq-recent-documents.js +1 -1
- package/dist/react/mq-schedule-success.d.ts +5 -5
- package/dist/react/mq-schedule-success.js +1 -1
- package/dist/react/mq-schedule.d.ts +4 -14
- package/dist/react/mq-schedule.js +1 -1
- package/dist/react/mq-socket-provider.js +1 -1
- package/dist/react/mq-support-chat.d.ts +3 -3
- package/dist/react/mq-support-chat.js +1 -1
- package/dist/react/mq-terms-and-conditions.d.ts +2 -2
- package/dist/react/mq-terms-and-conditions.js +1 -1
- package/dist/react/mq-unread-count-sync.js +1 -1
- package/dist/react/mq-videocall.d.ts +5 -5
- package/dist/react/mq-videocall.js +1 -1
- package/dist/ui/mq-calendar.js +1 -1
- package/dist/ui/mq-tabs.js +49 -22
- package/package.json +1 -1
- package/dist/chunks/api-chat-client-s45J7LKB.js +0 -1
- package/dist/chunks/appointment-details-BYGwLfww.js +0 -1
- package/dist/chunks/ca_ES-BOvS9ayb.js +0 -1
- package/dist/chunks/de_DE-B-4V4SgD.js +0 -1
- package/dist/chunks/en_US-CgxjeeCm.js +0 -1
- package/dist/chunks/mq-chat-room-B_WgeuXn.js +0 -1
- package/dist/chunks/mq-schedule-BfW7y8uG.js +0 -1
- package/dist/chunks/professional-overview-B4E05rLd.js +0 -1
- package/dist/chunks/pt_PT-Vb6hoo2l.js +0 -1
- package/dist/chunks/task-Bj8p7kJX.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as lit_html from 'lit-html';
|
|
2
|
-
import { M as MediquoApiChatClient } from './chunks/index.d-
|
|
2
|
+
import { M as MediquoApiChatClient } from './chunks/index.d-DHMNq1lu.js';
|
|
3
3
|
import { LitElement, PropertyValues } from 'lit';
|
|
4
4
|
import { Env } from './env.js';
|
|
5
5
|
import 'axios';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{e as o}from"./chunks/provide-BwI4DDGF.js";import{A as i}from"./chunks/api-client-context-BXGqBAlO.js";import{a as s,x as r}from"./chunks/lit-element-DiWJYFwC.js";import{n}from"./chunks/property-scuRaFcM.js";import{r as p}from"./chunks/state-LQivXIgA.js";import{setEnv as c}from"./env.js";import{c as a,n as m}from"./chunks/api-chat-client-
|
|
1
|
+
import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{e as o}from"./chunks/provide-BwI4DDGF.js";import{A as i}from"./chunks/api-client-context-BXGqBAlO.js";import{a as s,x as r}from"./chunks/lit-element-DiWJYFwC.js";import{n}from"./chunks/property-scuRaFcM.js";import{r as p}from"./chunks/state-LQivXIgA.js";import{setEnv as c}from"./env.js";import{c as a,n as m}from"./chunks/api-chat-client-Dx-sFrf2.js";import{e as u}from"./chunks/ensure-context-root-DbdqwnKB.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/chunk-NIAGR3ZC-BDlNUZa1.js";import"./chunks/parseISO-CEksKisk.js";import"./chunks/external-cM_kgYO_.js";import"./chunks/isBefore-DBi1CiNR.js";u();let h=class MqApiClientProvider extends s{constructor(){super(...arguments),this.apiClient=a()}willUpdate(t){t.has("env")&&this.env&&c(this.env);const e=m(t,{env:this.env,apiKey:this.apiKey,token:this.token,locale:this.locale});e&&(this.apiClient=e)}render(){return r`<slot></slot>`}};t([n({type:String,attribute:"api-key"})],h.prototype,"apiKey",void 0),t([n({type:String,attribute:"token"})],h.prototype,"token",void 0),t([n({type:String,attribute:"locale"})],h.prototype,"locale",void 0),t([n({type:String,attribute:"env"})],h.prototype,"env",void 0),t([o({context:i}),p()],h.prototype,"apiClient",void 0),h=t([e("mq-api-client-provider")],h);export{h as MqApiClientProvider};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement, PropertyValues } from 'lit';
|
|
3
|
-
import { M as MediquoApiChatClient } from './chunks/index.d-
|
|
3
|
+
import { M as MediquoApiChatClient } from './chunks/index.d-DHMNq1lu.js';
|
|
4
4
|
import { Env } from './env.js';
|
|
5
5
|
import { Locale } from './i18n.js';
|
|
6
6
|
import 'axios';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,c as t}from"./chunks/custom-element-D2ziPxYE.js";import{e as a}from"./chunks/provide-BwI4DDGF.js";import{c as
|
|
1
|
+
import{_ as e,c as t}from"./chunks/custom-element-D2ziPxYE.js";import{e as a}from"./chunks/provide-BwI4DDGF.js";import{c as s}from"./chunks/consume-CovVqBjI.js";import{m as i}from"./chunks/runtime-Bg1WXVCx.js";import{l as n}from"./chunks/localized-decorator-BlOuLhym.js";import{A as o}from"./chunks/api-client-context-BXGqBAlO.js";import{L as r}from"./chunks/login-token-task-NQJ77O_q.js";import{l as p}from"./chunks/chunk-FUCSYDW7-Duj5hy8S.js";import{i as l,a as c,x as h}from"./chunks/lit-element-DiWJYFwC.js";import{n as u}from"./chunks/property-scuRaFcM.js";import{r as y}from"./chunks/state-LQivXIgA.js";import{setEnv as d}from"./env.js";import{initLocalization as m,setLocale as v,isValidLocale as k}from"./i18n.js";import{c as b,n as f}from"./chunks/api-chat-client-Dx-sFrf2.js";import{u as P,s as _,r as E}from"./chunks/apple-pay-outcomes--uAwZeLE.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/task-CqjSKFwZ.js";import"./chunks/external-cM_kgYO_.js";import"./chunks/chunk-NIAGR3ZC-BDlNUZa1.js";import"./chunks/parseISO-CEksKisk.js";import"./chunks/isBefore-DBi1CiNR.js";function g(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent;return/Safari/i.test(e)&&!/Chrome|Chromium|Edg|OPR|Firefox|FxiOS/i.test(e)}async function A(e){if("undefined"==typeof window||!window.isSecureContext)return{available:!1,reason:"unsupported"};if(!function(){if("undefined"==typeof window)return!1;const e="undefined"!=typeof ApplePaySession&&"function"==typeof ApplePaySession.canMakePayments,t="undefined"!=typeof customElements&&void 0!==customElements.get("apple-pay-button");return e&&t}())return{available:!1,reason:"sdk-missing"};if(!e.trim())return{available:!1,reason:"merchant-id-missing"};const t=ApplePaySession;if(function(e){return"function"==typeof e.applePayCapabilities}(t))try{return function(e){switch(e){case"applePayUnsupported":return{available:!1,reason:"unsupported"};case"paymentCredentialsUnavailable":case"paymentCredentialsAvailable":case"paymentCredentialStatusUnknown":return{available:!0,usesQrFlow:!g()}}}((await t.applePayCapabilities(e)).paymentCredentialStatus)}catch{return t.canMakePayments()?{available:!0,usesQrFlow:!g()}:{available:!1,reason:"unsupported"}}return t.canMakePayments()?{available:!0,usesQrFlow:!g()}:{available:!1,reason:"unsupported"}}const C={es_ES:"es-ES",en_US:"en-US",pt_PT:"pt-PT",de_DE:"de-DE",ca_ES:"ca-ES"};try{m()}catch{}const S=["visa","masterCard","amex"],w=["supports3DS"],x=l`:host{display:flex;flex-direction:column;align-items:stretch;justify-content:center;gap:12px;width:100%;min-height:48px}.helper{margin:0;text-align:start;font-family:system-ui,sans-serif;font-size:12px;line-height:1.4;color:#6e6e73}.pay-row{display:block;width:100%}.pay-row--paying{opacity:.55;pointer-events:none}apple-pay-button{--apple-pay-button-width:100%;--apple-pay-button-height:48px;--apple-pay-button-border-radius:10px;--apple-pay-button-padding:0;display:block;width:100%;min-height:48px;cursor:pointer}.state{text-align:center;font-family:system-ui,sans-serif;font-size:15px;color:#86868b;margin:0}`;class ApplePayCheckoutSuccessEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(ApplePayCheckoutSuccessEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class ApplePayCheckoutDeniedEvent extends Event{static{this.eventName="payment-denied"}constructor(e){super(ApplePayCheckoutDeniedEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class ApplePayCheckoutErrorEvent extends Event{static{this.eventName="payment-error"}constructor(e){super(ApplePayCheckoutErrorEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}function j(e,t){p.warn(e,{error:t instanceof Error?t.message:String(t)})}let T=class MqApplePayCheckout extends c{constructor(){super(...arguments),this._availabilityPhase="checking",this._showQrHelper=!1,this._paying=!1,this._suppressCancelEvent=!1,this._availabilityGeneration=0,this.apiClient=b(),this._loginTokenTask=new r(this,()=>this.apiClient,{args:()=>[this.apiKey,this.token],onComplete:e=>{this._sessionToken=e.access_token,this.apiClient.setAuthToken(e.access_token),this._refreshAvailability()},onError:()=>{this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"auth"}))}}),this._onPayClick=()=>{if(this._paying||"ready"!==this._availabilityPhase)return;let e;try{e=new ApplePaySession(3,this._buildPaymentRequest())}catch(e){return j("mq-apple-pay-checkout: failed to create ApplePaySession",e),void this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"unsupported"}))}this._paying=!0,this._suppressCancelEvent=!1,e.onvalidatemerchant=async t=>{try{const a=await this.apiClient.payments.validateApplePayMerchant({order_id:this.sessionId,validation_url:t.validationURL});e.completeMerchantValidation(P(a))}catch(t){j("mq-apple-pay-checkout: validate-merchant failed",t),this._suppressCancelEvent=!0,this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"merchant"})),e.abort(),this._paying=!1}},e.onpaymentauthorized=async t=>{try{const a=await this.apiClient.payments.authorizeApplePay({order_id:this.sessionId,token:_(t.payment.token)}),{status:s,consultation_id:i}=a.data,n=E(s,i,this.sessionId);switch(n.kind){case"success":e.completePayment(ApplePaySession.STATUS_SUCCESS),this.dispatchEvent(new ApplePayCheckoutSuccessEvent({sessionId:n.sessionId,reference:n.reference}));break;case"denied":e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutDeniedEvent({sessionId:n.sessionId}));break;case"error":e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:n.reason}))}}catch(t){j("mq-apple-pay-checkout: authorize failed",t),e.completePayment(ApplePaySession.STATUS_FAILURE),this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"authorize"}))}finally{this._paying=!1}},e.oncancel=()=>{this._paying=!1,this._suppressCancelEvent?this._suppressCancelEvent=!1:this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"cancelled"}))};try{e.begin()}catch(e){j("mq-apple-pay-checkout: session.begin() failed",e),this._paying=!1,this.dispatchEvent(new ApplePayCheckoutErrorEvent({reason:"unsupported"}))}}}static{this.styles=x}willUpdate(e){e.has("env")&&this.env&&d(this.env),e.has("locale")&&v(k(this.locale)?this.locale:"es_ES");const t=f(e,{env:this.env,apiKey:this.apiKey,token:this._sessionToken,locale:k(this.locale)?this.locale:"es_ES"},this.inheritedApiClient);t&&(this.apiClient=t),e.has("merchantId")&&this._loginTokenTask.value&&this._refreshAvailability()}async _refreshAvailability(){const e=++this._availabilityGeneration;this._availabilityPhase="checking",this._showQrHelper=!1;const t=await A(this.merchantId??"");e===this._availabilityGeneration&&(t.available?(this._availabilityPhase="ready",this._showQrHelper=t.usesQrFlow):this._availabilityPhase="unavailable")}get _resolvedLocale(){return k(this.locale)?this.locale:"es_ES"}_buildPaymentRequest(){return{countryCode:this.country,currencyCode:this.currency,supportedNetworks:[...S],merchantCapabilities:[...w],total:{label:this.label,amount:this.amount}}}_renderUnavailable(){return this.merchantId?.trim()?"undefined"==typeof ApplePaySession?h`<p class="state">${i("No se ha podido cargar Apple Pay. Comprueba la configuración del sitio e inténtalo de nuevo.")}</p>`:h`<p class="state">${i("Apple Pay no está disponible")}</p>`:h`<p class="state">${i("Falta el identificador de comercio de Apple Pay")}</p>`}render(){return this._loginTokenTask.render({pending:()=>h`<p class="state">${i("Preparando Apple Pay…")}</p>`,error:()=>h`<p class="state">${i("No hemos podido iniciar el pago")}</p>`,complete:()=>{return"checking"===this._availabilityPhase?h`<p class="state">${i("Comprobando Apple Pay…")}</p>`:"unavailable"===this._availabilityPhase?this._renderUnavailable():h`<div class="pay-row ${this._paying?"pay-row--paying":""}"><apple-pay-button buttonstyle="black" type="pay" locale="${e=this._resolvedLocale,C[e]??"es-ES"}" aria-label="${i("Pagar con Apple Pay")}" @click="${this._onPayClick}"></apple-pay-button></div>${this._showQrHelper?h`<p class="helper">${i("Para pagar con Apple Pay, escanea el código QR con tu iPhone (iOS 18 o posterior) y confirma el pago.")}</p>`:null}`;var e}})}};e([u({type:String,attribute:"env"})],T.prototype,"env",void 0),e([u({type:String,attribute:"api-key"})],T.prototype,"apiKey",void 0),e([u({type:String,attribute:"token"})],T.prototype,"token",void 0),e([u({type:String,attribute:"locale",reflect:!0})],T.prototype,"locale",void 0),e([u({type:String,attribute:"merchant-id"})],T.prototype,"merchantId",void 0),e([u({type:String,attribute:"session-id"})],T.prototype,"sessionId",void 0),e([u({type:String,attribute:"amount"})],T.prototype,"amount",void 0),e([u({type:String,attribute:"currency"})],T.prototype,"currency",void 0),e([u({type:String,attribute:"country"})],T.prototype,"country",void 0),e([u({type:String,attribute:"label"})],T.prototype,"label",void 0),e([y()],T.prototype,"_availabilityPhase",void 0),e([y()],T.prototype,"_showQrHelper",void 0),e([y()],T.prototype,"_paying",void 0),e([s({context:o,subscribe:!0}),y()],T.prototype,"inheritedApiClient",void 0),e([a({context:o}),y()],T.prototype,"apiClient",void 0),T=e([n(),t("mq-apple-pay-checkout")],T);export{ApplePayCheckoutDeniedEvent,ApplePayCheckoutErrorEvent,ApplePayCheckoutSuccessEvent,T as MqApplePayCheckout};
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import * as lit_html from 'lit-html';
|
|
2
|
-
import { C as CreatePaymentLinkRequest } from './chunks/index.d-ByhRBSb1.js';
|
|
3
2
|
import { LitElement } from 'lit';
|
|
4
3
|
import { Env } from './env.js';
|
|
5
4
|
import { Locale } from './i18n.js';
|
|
6
5
|
import './mq-checkout.js';
|
|
7
|
-
import 'axios';
|
|
8
6
|
import 'zod';
|
|
7
|
+
import './chunks/index.d-DHMNq1lu.js';
|
|
8
|
+
import 'axios';
|
|
9
9
|
import './chunks/schemas.d-b6_AekBb.js';
|
|
10
10
|
import './ui/mq-skeleton.js';
|
|
11
11
|
|
|
12
|
-
type PreconsultationDocument =
|
|
12
|
+
type PreconsultationDocument = {
|
|
13
|
+
file_path: string;
|
|
14
|
+
file_name: string;
|
|
15
|
+
};
|
|
13
16
|
declare class AppointmentPaidEvent extends Event {
|
|
14
17
|
readonly detail: {
|
|
15
18
|
appointmentId: string;
|
|
@@ -20,33 +23,36 @@ declare class AppointmentPaidEvent extends Event {
|
|
|
20
23
|
});
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
|
-
* Appointment-specific checkout.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
26
|
+
* Appointment-specific checkout. Passes the signed `payable-reference` of the
|
|
27
|
+
* selected slot (plus the reason and an optional coupon) to the agnostic
|
|
28
|
+
* `<mq-checkout>`, which embeds the hosted checkout: it creates the payment and
|
|
29
|
+
* takes the patient through it, whichever way the organization charges.
|
|
27
30
|
*
|
|
28
31
|
* Must be rendered inside `<mq-theme-provider>`.
|
|
29
32
|
*
|
|
30
33
|
* @fires payment-success - Payment confirmed. Detail: `{ appointmentId }`.
|
|
31
34
|
* @fires payment-denied - Payment rejected. Bubbles from `<mq-checkout>`. Detail: `{ sessionId }`.
|
|
32
|
-
* @fires payment-error -
|
|
35
|
+
* @fires payment-error - The payment cannot go on. Bubbles from `<mq-checkout>`. Detail: `{ reason }`.
|
|
36
|
+
* `reason: "expired"` means the slot offer lapsed: let the patient pick a slot again.
|
|
33
37
|
*/
|
|
34
38
|
declare class MqAppointmentCheckout extends LitElement {
|
|
35
39
|
env?: Env;
|
|
36
40
|
apiKey: string;
|
|
37
41
|
token: string;
|
|
38
42
|
locale: Locale;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
/** @deprecated Not sent any more: the signed `payable-reference` already carries it. */
|
|
44
|
+
slotId?: string;
|
|
45
|
+
/** @deprecated Not sent any more: the signed `payable-reference` already carries it. */
|
|
46
|
+
serviceId?: string;
|
|
47
|
+
/** @deprecated Not sent any more: the signed `payable-reference` already carries it. */
|
|
48
|
+
specialtyId?: string;
|
|
42
49
|
consultationReason?: string;
|
|
43
50
|
/** Discount coupon code applied to the booking. The coupon UI lives in the host app. */
|
|
44
51
|
discountCode?: string;
|
|
45
|
-
/**
|
|
52
|
+
/** Signed `appt_…` reference from the slot listing. Hosts that skip the wizard pass it themselves. */
|
|
46
53
|
payableReference?: string;
|
|
47
|
-
/**
|
|
54
|
+
/** @deprecated Not forwarded: the hosted checkout does not take pre-consultation documents. */
|
|
48
55
|
preconsultationDocuments?: PreconsultationDocument[];
|
|
49
|
-
private _provideSession;
|
|
50
56
|
private _onSuccess;
|
|
51
57
|
render(): lit_html.TemplateResult<1>;
|
|
52
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{a as o,x as
|
|
1
|
+
import{_ as t,c as e}from"./chunks/custom-element-D2ziPxYE.js";import{a as o,x as i}from"./chunks/lit-element-DiWJYFwC.js";import{n as s}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-CqjSKFwZ.js";import"./chunks/api-client-context-BXGqBAlO.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/login-token-task-NQJ77O_q.js";import"./chunks/state-LQivXIgA.js";import"./chunks/query-CeeutdfT.js";import"./env.js";import"./theme.js";import"./i18n.js";import"./chunks/chunk-FUCSYDW7-Duj5hy8S.js";import"./chunks/external-cM_kgYO_.js";import"./chunks/api-chat-client-Dx-sFrf2.js";import"./chunks/chunk-NIAGR3ZC-BDlNUZa1.js";import"./chunks/parseISO-CEksKisk.js";import"./chunks/isBefore-DBi1CiNR.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/checkout-bridge-BFpVxNww.js";class AppointmentPaidEvent extends Event{static{this.eventName="payment-success"}constructor(t){super(AppointmentPaidEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}let r=class MqAppointmentCheckout extends o{constructor(){super(...arguments),this._onSuccess=t=>{t.stopPropagation(),this.dispatchEvent(new AppointmentPaidEvent({appointmentId:t.detail.reference}))}}render(){return i`<mq-checkout env="${n(this.env)}" api-key="${n(this.apiKey)}" token="${n(this.token)}" locale="${n(this.locale)}" payable-reference="${n(this.payableReference)}" discount-code="${n(this.discountCode)}" consultation-reason="${n(this.consultationReason)}" @payment-success="${this._onSuccess}"></mq-checkout>`}};t([s({type:String,attribute:"env"})],r.prototype,"env",void 0),t([s({type:String,attribute:"api-key"})],r.prototype,"apiKey",void 0),t([s({type:String,attribute:"token"})],r.prototype,"token",void 0),t([s({type:String,attribute:"locale",reflect:!0})],r.prototype,"locale",void 0),t([s({type:String,attribute:"slot-id"})],r.prototype,"slotId",void 0),t([s({type:String,attribute:"service-id"})],r.prototype,"serviceId",void 0),t([s({type:String,attribute:"specialty-id"})],r.prototype,"specialtyId",void 0),t([s({type:String,attribute:"consultation-reason"})],r.prototype,"consultationReason",void 0),t([s({type:String,attribute:"discount-code"})],r.prototype,"discountCode",void 0),t([s({type:String,attribute:"payable-reference"})],r.prototype,"payableReference",void 0),t([s({attribute:!1})],r.prototype,"preconsultationDocuments",void 0),r=t([e("mq-appointment-checkout")],r);export{AppointmentPaidEvent,r as MqAppointmentCheckout};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import * as lit_html from 'lit-html';
|
|
2
|
-
import { M as MediquoApiChatClient } from './chunks/index.d-
|
|
2
|
+
import { M as MediquoApiChatClient } from './chunks/index.d-DHMNq1lu.js';
|
|
3
3
|
import { LitElement, PropertyValues } from 'lit';
|
|
4
4
|
import { Env } from './env.js';
|
|
5
5
|
import './ui/mq-button.js';
|
|
6
|
-
import './chunks/mq-chat-room-
|
|
6
|
+
import './chunks/mq-chat-room-C0dJCvpV.js';
|
|
7
7
|
import './ui/mq-floating-bubble.js';
|
|
8
8
|
import './ui/mq-card.js';
|
|
9
9
|
import './ui/mq-unread-badge.js';
|
|
10
10
|
import './ui/mq-page-title.js';
|
|
11
|
-
import './chunks/index-
|
|
11
|
+
import './chunks/index-BKjqWyIs.js';
|
|
12
12
|
import './chunks/mq-layout-D8Mak16a.js';
|
|
13
13
|
import 'axios';
|
|
14
14
|
import 'zod';
|
|
15
15
|
import './chunks/schemas.d-b6_AekBb.js';
|
|
16
16
|
import './ui/mq-avatar.js';
|
|
17
17
|
import './ui/mq-skeleton.js';
|
|
18
|
-
import './chunks/
|
|
18
|
+
import './chunks/index-DwlJg2um.js';
|
|
19
19
|
import '@tanstack/query-core';
|
|
20
20
|
import './chunks/document.model.d-DIzMiOmd.js';
|
|
21
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isValidLocale as t,setLocale as e,initLocalization as i}from"./i18n.js";import{_ as o,c as s}from"./chunks/custom-element-D2ziPxYE.js";import{e as
|
|
1
|
+
import{isValidLocale as t,setLocale as e,initLocalization as i}from"./i18n.js";import{_ as o,c as s}from"./chunks/custom-element-D2ziPxYE.js";import{e as n}from"./chunks/provide-BwI4DDGF.js";import{c as r}from"./chunks/consume-CovVqBjI.js";import{Q as a}from"./chunks/query-controller-B1byDHlF.js";import{A as c}from"./chunks/api-client-context-BXGqBAlO.js";import{g as d}from"./chunks/get-appointment-query-DuHrjd8L.js";import{a as p,i as l,x as m}from"./chunks/lit-element-DiWJYFwC.js";import{n as u}from"./chunks/property-scuRaFcM.js";import{r as h}from"./chunks/state-LQivXIgA.js";import{setEnv as k}from"./env.js";import{c as v,n as b}from"./chunks/api-chat-client-Dx-sFrf2.js";import"./chunks/documentation-view-BcA4Vbhp.js";import"./ui/mq-card.js";import"./chunks/mq-layout-BndHxkbb.js";import"./chunks/runtime-Bg1WXVCx.js";import"./chunks/chunk-FUCSYDW7-Duj5hy8S.js";import"./chunks/external-cM_kgYO_.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import"./chunks/create-context-DqP79qjF.js";import"@tanstack/query-core";import"./chunks/chunk-6CCJWPGL-TiaqZaPV.js";import"./chunks/chunk-5EJXDIGT-Bb4_pfDr.js";import"./chunks/chunk-NIAGR3ZC-BDlNUZa1.js";import"./chunks/parseISO-CEksKisk.js";import"./chunks/isBefore-DBi1CiNR.js";import"./chunks/localized-decorator-BlOuLhym.js";import"./chunks/task-CqjSKFwZ.js";import"./chunks/addSeconds-fO5orJrt.js";import"./ui/icons/calendar-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/types.js";import"./ui/icons/clock-icon.js";import"./ui/icons/info-circle-outine-icon.js";import"./ui/mq-button.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/chunk-S5RWG6G2-CQJ38pW6.js";import"./ui/icons/message-bubble-icon.js";import"./chunks/mq-chat-room-BkXGHzrd.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./ui/mq-avatar.js";import"./ui/mq-skeleton.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/chunk-BUV4MGML-CkhBbfUu.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./events.js";import"./chunks/chunk-Y4EKUX25-Bdei04iw.js";import"./ui/icons/check-double-icon.js";import"./ui/icons/check-icon.js";import"./chunks/addDays-CdyO-PRI.js";import"./chunks/chunk-YTQUGGS3-sBILRfPo.js";import"./chunks/index-Djkwyh_M.js";import"./chunks/mutation-controller-CR2qcqhH.js";import"./ui/mq-floating-bubble.js";import"./ui/mq-unread-badge.js";import"./ui/mq-page-title.js";import"./ui/icons/arrow-narrow-left-icon.js";import"./ui/icons/download-icon.js";import"./chunks/blob-to-base64-CUL1trde.js";import"./chunks/telemetry-client-DA2_SZBC.js";let j=class DocumentationViewSkeleton extends p{static{this.styles=l`.skeleton{border-radius:var(--border-radius-md);background-color:#f0f0f0;animation:skeleton-pulse 1.5s infinite}.page-title-skeleton{display:flex;align-items:center;gap:var(--sp-3);margin-bottom:var(--size-3)}.back-button-skeleton{width:var(--size-10);height:var(--size-10);border-radius:var(--border-radius-full);flex-shrink:0}.title-bar-skeleton{width:120px;height:24px;border-radius:var(--border-radius-sm)}@media (min-width:768px){.page-title-skeleton{gap:var(--sp-6)}.title-bar-skeleton{width:200px;height:32px}}.description-skeleton{width:100%;height:16px;border-radius:var(--border-radius-sm);margin-bottom:var(--size-2)}.description-skeleton:last-of-type{width:70%;margin-bottom:var(--size-5)}.professional-card{padding:var(--size-4);margin-bottom:var(--size-4)}.professional-name-skeleton{width:180px;height:24px;border-radius:var(--border-radius-sm);margin-bottom:var(--size-1)}.professional-speciality-skeleton{width:140px;height:16px;border-radius:var(--border-radius-sm);margin-bottom:var(--size-4)}.description-list{display:flex;flex-direction:column;gap:var(--size-4)}.description-list-item{display:flex;flex-direction:row;align-items:center;gap:var(--size-2);font-family:var(--font-body)}.icon-skeleton{width:20px;height:20px;border-radius:var(--border-radius-sm)}.text-skeleton{width:120px;height:16px;border-radius:var(--border-radius-sm)}.documents-card{padding:var(--size-4);margin-bottom:var(--size-6)}.documents-card .skeleton{background-color:var(--color-muted)}.documents-card-title-skeleton{width:150px;height:24px;border-radius:var(--border-radius-sm);margin-bottom:var(--size-4)}.button-skeleton{width:100%;height:44px;border-radius:var(--border-radius-md);margin-top:var(--size-4)}@keyframes skeleton-pulse{0%{opacity:1}50%{opacity:.6}100%{opacity:1}}`}render(){return m`<div class="page-title-skeleton"><div class="skeleton back-button-skeleton"></div><div class="skeleton title-bar-skeleton"></div></div><div class="skeleton description-skeleton"></div><div class="skeleton description-skeleton"></div><mq-card class="professional-card" roundness="md"><div><div class="skeleton professional-name-skeleton"></div><div class="skeleton professional-speciality-skeleton"></div></div><dl class="description-list"><div class="description-list-item"><div class="skeleton icon-skeleton"></div><div class="skeleton text-skeleton"></div></div><div class="description-list-item"><div class="skeleton icon-skeleton"></div><div class="skeleton text-skeleton"></div></div></dl></mq-card><mq-card class="documents-card" roundness="md"><div class="skeleton documents-card-title-skeleton"></div><div class="skeleton button-skeleton"></div></mq-card>`}};j=o([s("documentation-view-skeleton")],j);let g=class MqAppointmentDocumentation extends p{constructor(){super(...arguments),this.showMediquoBranding=!0,this.getAppointmentQuery=new a(this,()=>d(this.apiClient,{id:this.appointmentId})),this.apiClient=v()}willUpdate(i){i.has("env")&&this.env&&k(this.env),i.has("locale")&&this.locale&&t(this.locale)&&e(this.locale);const o=b(i,{env:this.env,apiKey:this.apiKey,token:this.token,locale:this.locale},this.inheritedApiClient);o&&(this.apiClient=o)}render(){return m`<mq-layout background="transparent" .showMediquoBranding="${this.showMediquoBranding}">${this.getAppointmentQuery.render({complete:t=>m`<documentation-view .token="${this.token}" .appointment="${t}"></documentation-view>`,error:()=>m``,pending:()=>m`<documentation-view-skeleton></documentation-view-skeleton>`})}</mq-layout>`}};o([u({type:String,attribute:"appointment-id"})],g.prototype,"appointmentId",void 0),o([u({type:String,attribute:"token"})],g.prototype,"token",void 0),o([u({type:String,attribute:"api-key"})],g.prototype,"apiKey",void 0),o([u({type:String,attribute:"locale"})],g.prototype,"locale",void 0),o([u({type:String,attribute:"env"})],g.prototype,"env",void 0),o([u({type:Boolean,attribute:"show-mediquo-branding",converter:{fromAttribute:t=>null===t||"false"!==t&&"0"!==t,toAttribute:t=>t?"":"false"}})],g.prototype,"showMediquoBranding",void 0),o([r({context:c,subscribe:!0}),h()],g.prototype,"inheritedApiClient",void 0),o([n({context:c}),h()],g.prototype,"apiClient",void 0),g=o([s("mq-appointment-documentation")],g),i();export{g as MqAppointmentDocumentation};
|
package/dist/mq-chat-room.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export { M as MqChatRoom } from './chunks/mq-chat-room-
|
|
1
|
+
export { M as MqChatRoom } from './chunks/mq-chat-room-C0dJCvpV.js';
|
|
2
2
|
import 'lit-html';
|
|
3
3
|
import 'lit';
|
|
4
|
-
import './chunks/index.d-
|
|
4
|
+
import './chunks/index.d-DHMNq1lu.js';
|
|
5
5
|
import 'axios';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import './chunks/schemas.d-b6_AekBb.js';
|
|
8
8
|
import './ui/mq-avatar.js';
|
|
9
9
|
import './ui/mq-button.js';
|
|
10
10
|
import './ui/mq-skeleton.js';
|
|
11
|
-
import './chunks/
|
|
11
|
+
import './chunks/index-DwlJg2um.js';
|
|
12
12
|
import '@tanstack/query-core';
|
|
13
13
|
|
|
14
14
|
declare class MqChatRoomCloseEvent extends Event {
|
package/dist/mq-chat-room.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{M as MqChatRoom,a as MqChatRoomCloseEvent,b as MqChatRoomProfileEvent}from"./chunks/mq-chat-room-
|
|
1
|
+
export{M as MqChatRoom,a as MqChatRoomCloseEvent,b as MqChatRoomProfileEvent}from"./chunks/mq-chat-room-BkXGHzrd.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/runtime-Bg1WXVCx.js";import"./chunks/api-client-context-BXGqBAlO.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/lit-element-DiWJYFwC.js";import"./chunks/property-scuRaFcM.js";import"./chunks/state-LQivXIgA.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/icons/types.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/query-controller-B1byDHlF.js";import"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import"@tanstack/query-core";import"./chunks/chunk-BUV4MGML-CkhBbfUu.js";import"./chunks/chunk-6CCJWPGL-TiaqZaPV.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/chunk-S5RWG6G2-CQJ38pW6.js";import"./chunks/chunk-NIAGR3ZC-BDlNUZa1.js";import"./chunks/parseISO-CEksKisk.js";import"./chunks/query-CeeutdfT.js";import"./chunks/chunk-FUCSYDW7-Duj5hy8S.js";import"./events.js";import"./chunks/api-chat-client-Dx-sFrf2.js";import"./chunks/external-cM_kgYO_.js";import"./chunks/isBefore-DBi1CiNR.js";import"./env.js";import"./chunks/chunk-Y4EKUX25-Bdei04iw.js";import"./ui/icons/check-double-icon.js";import"./ui/icons/check-icon.js";import"./i18n.js";import"./chunks/addDays-CdyO-PRI.js";import"./chunks/chunk-YTQUGGS3-sBILRfPo.js";import"./chunks/index-Djkwyh_M.js";import"./chunks/mutation-controller-CR2qcqhH.js";
|
package/dist/mq-checkout.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as lit_html from 'lit-html';
|
|
2
2
|
import * as lit from 'lit';
|
|
3
3
|
import { LitElement, PropertyValues } from 'lit';
|
|
4
|
-
import { M as MediquoApiChatClient } from './chunks/index.d-
|
|
4
|
+
import { M as MediquoApiChatClient } from './chunks/index.d-DHMNq1lu.js';
|
|
5
5
|
import { Env } from './env.js';
|
|
6
6
|
import { Locale } from './i18n.js';
|
|
7
7
|
import './ui/mq-skeleton.js';
|
|
@@ -9,23 +9,11 @@ import 'axios';
|
|
|
9
9
|
import 'zod';
|
|
10
10
|
import './chunks/schemas.d-b6_AekBb.js';
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
paymentUrl: string;
|
|
18
|
-
}
|
|
19
|
-
/** Async factory the host supplies to create (and re-create, on retry) a session. */
|
|
20
|
-
/**
|
|
21
|
-
* Creates the payment session this checkout should show.
|
|
22
|
-
*
|
|
23
|
-
* Receives the client this checkout authenticated with, so a caller that needs
|
|
24
|
-
* to reach the API for the session speaks for the same organization and the
|
|
25
|
-
* same patient session. Building your own client here would send the call with
|
|
26
|
-
* no bearer.
|
|
27
|
-
*/
|
|
28
|
-
type ProvideSession = (client: MediquoApiChatClient) => Promise<CheckoutSession>;
|
|
12
|
+
/** Why a payment ended without being charged, as seen by the host. */
|
|
13
|
+
type CheckoutErrorReason = "auth" | "session" | "timeout" | "unavailable" | "unsupported"
|
|
14
|
+
/** The signed reference is stale or invalid: the patient has to pick again. */
|
|
15
|
+
| "expired";
|
|
16
|
+
|
|
29
17
|
declare class CheckoutSuccessEvent extends Event {
|
|
30
18
|
readonly detail: {
|
|
31
19
|
sessionId: string;
|
|
@@ -46,7 +34,10 @@ declare class CheckoutDeniedEvent extends Event {
|
|
|
46
34
|
sessionId: string;
|
|
47
35
|
});
|
|
48
36
|
}
|
|
49
|
-
|
|
37
|
+
declare class CheckoutGrantedEvent extends Event {
|
|
38
|
+
static eventName: string;
|
|
39
|
+
constructor();
|
|
40
|
+
}
|
|
50
41
|
declare class CheckoutErrorEvent extends Event {
|
|
51
42
|
readonly detail: {
|
|
52
43
|
reason: CheckoutErrorReason;
|
|
@@ -56,67 +47,59 @@ declare class CheckoutErrorEvent extends Event {
|
|
|
56
47
|
reason: CheckoutErrorReason;
|
|
57
48
|
});
|
|
58
49
|
}
|
|
59
|
-
declare class CheckoutRetryEvent extends Event {
|
|
60
|
-
static eventName: string;
|
|
61
|
-
constructor();
|
|
62
|
-
}
|
|
63
50
|
/**
|
|
64
|
-
* Use-case agnostic payment gateway. Embeds the Mediquo
|
|
65
|
-
* iframe
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
51
|
+
* Use-case agnostic payment gateway. Embeds the hosted Mediquo checkout in an
|
|
52
|
+
* iframe and surfaces the outcome it reports through generic events. The
|
|
53
|
+
* checkout creates the payment session and takes the patient through payment
|
|
54
|
+
* itself, so integrators configure nothing payment-related: they only say what
|
|
55
|
+
* is being paid (`payable-reference`) and, optionally, a coupon already
|
|
56
|
+
* validated on their side.
|
|
70
57
|
*
|
|
71
58
|
* Must be rendered inside `<mq-theme-provider>`.
|
|
72
59
|
*
|
|
73
|
-
* @fires payment-success - Payment confirmed
|
|
74
|
-
* @fires payment-denied - Payment rejected
|
|
75
|
-
* @fires payment-
|
|
76
|
-
* @fires payment-
|
|
60
|
+
* @fires payment-success - Payment confirmed. Detail: `{ sessionId, reference }`.
|
|
61
|
+
* @fires payment-denied - Payment rejected; the checkout lets the patient try again. Detail: `{ sessionId }`.
|
|
62
|
+
* @fires payment-granted - Nothing to pay: the patient may already consult for free.
|
|
63
|
+
* @fires payment-error - The payment cannot go on. Detail: `{ reason }`.
|
|
77
64
|
*/
|
|
78
65
|
declare class MqCheckout extends LitElement {
|
|
79
66
|
static styles: lit.CSSResult[];
|
|
80
|
-
/**
|
|
81
|
-
* Backend environment. Applied before authentication, so set it once at
|
|
82
|
-
* mount — changing it later rebuilds the API client and drops the session.
|
|
83
|
-
*/
|
|
67
|
+
/** Backend environment. Defaults to the one this build targets. */
|
|
84
68
|
env?: Env;
|
|
85
69
|
apiKey: string;
|
|
70
|
+
/** Raw integrator user token; exchanged here for the session token the checkout sends. */
|
|
86
71
|
token: string;
|
|
87
72
|
locale: Locale;
|
|
88
|
-
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
private _iframeLoaded;
|
|
94
|
-
private _iframeHeight;
|
|
95
|
-
private _sessionEpoch;
|
|
96
|
-
private _currentSessionId;
|
|
97
|
-
private _paymentOrigin;
|
|
73
|
+
/** Signed reference of what is being paid: `appt_…`, `chat_…` or `vc_…`. */
|
|
74
|
+
payableReference?: string;
|
|
75
|
+
/** Discount coupon already validated by the host; reloads the checkout when it changes. */
|
|
76
|
+
discountCode?: string;
|
|
77
|
+
consultationReason?: string;
|
|
98
78
|
/** The organization scope this element was mounted under, if any. */
|
|
99
79
|
private inheritedApiClient?;
|
|
100
|
-
/**
|
|
101
|
-
* This element's own transport, bound to its `api-key` and provided to every
|
|
102
|
-
* descendant. Never shared with another element.
|
|
103
|
-
*/
|
|
80
|
+
/** This element's own transport, bound to its `api-key` and provided to every descendant. */
|
|
104
81
|
apiClient: MediquoApiChatClient;
|
|
105
|
-
|
|
106
|
-
private
|
|
82
|
+
private _iframe?;
|
|
83
|
+
private _iframeLoaded;
|
|
84
|
+
private _iframeHeight;
|
|
85
|
+
private _reportedReason;
|
|
86
|
+
private _renderedUrl;
|
|
107
87
|
private _loginTokenTask;
|
|
108
|
-
private _sessionTask;
|
|
109
|
-
private _paymentPoll;
|
|
110
|
-
get _timedOut(): boolean;
|
|
111
88
|
connectedCallback(): void;
|
|
112
89
|
disconnectedCallback(): void;
|
|
113
90
|
protected willUpdate(changed: PropertyValues<this>): void;
|
|
91
|
+
protected updated(): void;
|
|
92
|
+
/** The element's own `api-key`, or the organization it was mounted under. */
|
|
93
|
+
private get _apiKey();
|
|
94
|
+
/** Why the checkout cannot even be opened, when the host left something out. */
|
|
95
|
+
private get _missingInput();
|
|
96
|
+
private get _url();
|
|
114
97
|
private _onIframeLoad;
|
|
115
98
|
private _onMessage;
|
|
116
99
|
private _renderState;
|
|
117
|
-
private
|
|
118
|
-
private
|
|
119
|
-
render(): lit_html.TemplateResult<1
|
|
100
|
+
private _renderMissingInput;
|
|
101
|
+
private _renderSkeleton;
|
|
102
|
+
render(): lit_html.TemplateResult<1>;
|
|
120
103
|
}
|
|
121
104
|
declare global {
|
|
122
105
|
interface HTMLElementTagNameMap {
|
|
@@ -124,5 +107,5 @@ declare global {
|
|
|
124
107
|
}
|
|
125
108
|
}
|
|
126
109
|
|
|
127
|
-
export { CheckoutDeniedEvent, CheckoutErrorEvent,
|
|
128
|
-
export type { CheckoutErrorReason
|
|
110
|
+
export { CheckoutDeniedEvent, CheckoutErrorEvent, CheckoutGrantedEvent, CheckoutSuccessEvent, MqCheckout };
|
|
111
|
+
export type { CheckoutErrorReason };
|
package/dist/mq-checkout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as
|
|
1
|
+
import{_ as e,c as t}from"./chunks/custom-element-D2ziPxYE.js";import{e as s}from"./chunks/provide-BwI4DDGF.js";import{c as i}from"./chunks/consume-CovVqBjI.js";import{m as n}from"./chunks/runtime-Bg1WXVCx.js";import{l as o}from"./chunks/localized-decorator-BlOuLhym.js";import{s as r}from"./chunks/task-CqjSKFwZ.js";import{A as a}from"./chunks/api-client-context-BXGqBAlO.js";import{L as c}from"./chunks/login-token-task-NQJ77O_q.js";import{i as h,a as l,x as d}from"./chunks/lit-element-DiWJYFwC.js";import{n as p}from"./chunks/property-scuRaFcM.js";import{r as u}from"./chunks/state-LQivXIgA.js";import{e as m}from"./chunks/query-CeeutdfT.js";import{env as v}from"./env.js";import{tokens as f}from"./theme.js";import{initLocalization as k,setLocale as g,isValidLocale as y}from"./i18n.js";import{c as _,n as b}from"./chunks/api-chat-client-Dx-sFrf2.js";import"./ui/mq-skeleton.js";import{i as E,p as x,b as C}from"./chunks/checkout-bridge-BFpVxNww.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/chunk-FUCSYDW7-Duj5hy8S.js";import"./chunks/external-cM_kgYO_.js";import"./chunks/chunk-NIAGR3ZC-BDlNUZa1.js";import"./chunks/parseISO-CEksKisk.js";import"./chunks/isBefore-DBi1CiNR.js";import"./chunks/style-map-CIdqdn7C.js";import"./chunks/directive-2EDmOukv.js";try{k()}catch{}const j=h`:host{height:100%;min-height:0;display:flex;flex-direction:column;flex:1}.payment-frame{position:relative;width:100%;min-width:0;display:flex;flex-direction:column;flex:1;min-height:0}.payment-frame iframe:not(.loaded){position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;border:none}.payment-frame iframe.loaded{flex:none;display:block;width:100%;border:none;min-height:400px}.state{display:flex;flex-direction:column;align-items:center;justify-content:center;flex:1;gap:var(--sp-4);padding:var(--sp-8);text-align:center}.state-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}.state-message{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}`;class CheckoutSuccessEvent extends Event{static{this.eventName="payment-success"}constructor(e){super(CheckoutSuccessEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class CheckoutDeniedEvent extends Event{static{this.eventName="payment-denied"}constructor(e){super(CheckoutDeniedEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class CheckoutGrantedEvent extends Event{static{this.eventName="payment-granted"}constructor(){super(CheckoutGrantedEvent.eventName,{bubbles:!0,composed:!0})}}class CheckoutErrorEvent extends Event{static{this.eventName="payment-error"}constructor(e){super(CheckoutErrorEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}let w=class MqCheckout extends l{constructor(){super(...arguments),this.apiClient=_(),this._iframeLoaded=!1,this._iframeHeight=null,this._reportedReason=null,this._renderedUrl=null,this._loginTokenTask=new c(this,()=>this.apiClient,{args:()=>[this._apiKey,this.token]}),this._onMessage=e=>{if(!E(e,this._iframe?.contentWindow))return;const t=x(e.data);switch(t?.type){case"resize":return void(this._iframeHeight=t.height);case"success":return void this.dispatchEvent(new CheckoutSuccessEvent({sessionId:t.sessionId,reference:t.reference}));case"denied":return void this.dispatchEvent(new CheckoutDeniedEvent({sessionId:t.sessionId}));case"granted":return void this.dispatchEvent(new CheckoutGrantedEvent);case"error":return void this.dispatchEvent(new CheckoutErrorEvent({reason:t.reason}))}}}static{this.styles=[f,j]}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this._onMessage)}disconnectedCallback(){window.removeEventListener("message",this._onMessage),super.disconnectedCallback()}willUpdate(e){const t=b(e,{env:this.env,apiKey:this.apiKey},this.inheritedApiClient);t&&(this.apiClient=t),e.has("locale")&&g(y(this.locale)?this.locale:"es_ES"),this._url!==this._renderedUrl&&(this._renderedUrl=this._url,this._iframeLoaded=!1,this._iframeHeight=null)}updated(){const e=this._missingInput;e&&e!==this._reportedReason&&this.dispatchEvent(new CheckoutErrorEvent({reason:e})),this._reportedReason=e}get _apiKey(){return this.apiKey||this.inheritedApiClient?.getApiKey()}get _missingInput(){return this.payableReference?this._apiKey&&this.token?this._loginTokenTask.status===r.ERROR?"auth":null:"auth":"unsupported"}get _url(){const e=this._loginTokenTask.status===r.COMPLETE?this._loginTokenTask.value?.access_token:void 0;return this._missingInput||!e?null:C({apiKey:this._apiKey,token:e,payableReference:this.payableReference,env:this.env??v.MODE,locale:y(this.locale)?this.locale:"es_ES",discountCode:this.discountCode,consultationReason:this.consultationReason,methods:["card"]})}_onIframeLoad(){this._iframeLoaded=!0}_renderState(e,t){return d`<div class="state"><p class="state-title">${e}</p><p class="state-message">${t}</p></div>`}_renderMissingInput(e){return"unsupported"===e?this._renderState(n("Esta consulta no se puede pagar aquí"),n("Por favor, contacta con soporte para poder continuar.")):this._renderState(n("No hemos podido iniciar el pago"),n("Por favor, inténtalo de nuevo más tarde."))}_renderSkeleton(){return d`<mq-skeleton width="100%" height="400px" border-radius="md" role="status" aria-live="polite" aria-label="${n("Cargando portal de pago")}"></mq-skeleton>`}render(){const e=this._missingInput,t=this._url;return e?this._renderMissingInput(e):t?d`<div class="payment-frame">${this._iframeLoaded?null:this._renderSkeleton()}<iframe class="${this._iframeLoaded?"loaded":""}" src="${t}" title="${n("Portal de pago")}" allow="payment" style="${null!==this._iframeHeight?`height: ${this._iframeHeight}px;`:""}" @load="${this._onIframeLoad}"></iframe></div>`:d`<div class="payment-frame">${this._renderSkeleton()}</div>`}};e([p({type:String,attribute:"env"})],w.prototype,"env",void 0),e([p({type:String,attribute:"api-key"})],w.prototype,"apiKey",void 0),e([p({type:String,attribute:"token"})],w.prototype,"token",void 0),e([p({type:String,attribute:"locale",reflect:!0})],w.prototype,"locale",void 0),e([p({type:String,attribute:"payable-reference"})],w.prototype,"payableReference",void 0),e([p({type:String,attribute:"discount-code"})],w.prototype,"discountCode",void 0),e([p({type:String,attribute:"consultation-reason"})],w.prototype,"consultationReason",void 0),e([i({context:a,subscribe:!0}),u()],w.prototype,"inheritedApiClient",void 0),e([s({context:a}),u()],w.prototype,"apiClient",void 0),e([m("iframe")],w.prototype,"_iframe",void 0),e([u()],w.prototype,"_iframeLoaded",void 0),e([u()],w.prototype,"_iframeHeight",void 0),w=e([o(),t("mq-checkout")],w);export{CheckoutDeniedEvent,CheckoutErrorEvent,CheckoutGrantedEvent,CheckoutSuccessEvent,w as MqCheckout};
|
package/dist/mq-dashboard.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as lit_html from 'lit-html';
|
|
2
2
|
import * as lit from 'lit';
|
|
3
3
|
import { LitElement, nothing, PropertyValues } from 'lit';
|
|
4
|
-
import { M as MediquoApiChatClient, b as GetOrganizationSetupResponse } from './chunks/index.d-
|
|
4
|
+
import { M as MediquoApiChatClient, b as GetOrganizationSetupResponse } from './chunks/index.d-DHMNq1lu.js';
|
|
5
5
|
import { L as LoginTokenResponse } from './chunks/schemas.d-b6_AekBb.js';
|
|
6
6
|
import { Env } from './env.js';
|
|
7
7
|
import './mq-next-appointments.js';
|
|
@@ -15,17 +15,17 @@ import 'axios';
|
|
|
15
15
|
import 'zod';
|
|
16
16
|
import './chunks/index-Nf3nZ9O3.js';
|
|
17
17
|
import './chunks/index-DTEtqjQF.js';
|
|
18
|
-
import './chunks/next-appointment-card-
|
|
19
|
-
import './chunks/mq-chat-room-
|
|
20
|
-
import './chunks/
|
|
18
|
+
import './chunks/next-appointment-card-Z5G1jqtz.js';
|
|
19
|
+
import './chunks/mq-chat-room-C0dJCvpV.js';
|
|
20
|
+
import './chunks/index-DwlJg2um.js';
|
|
21
21
|
import '@tanstack/query-core';
|
|
22
22
|
import './ui/mq-dialog.js';
|
|
23
23
|
import './chunks/price.d-CwLosdAN.js';
|
|
24
|
-
import './chunks/professional-overview-
|
|
24
|
+
import './chunks/professional-overview-QVHl_ITk.js';
|
|
25
25
|
import './ui/mq-text-button.js';
|
|
26
26
|
import './ui/mq-floating-bubble.js';
|
|
27
27
|
import './ui/mq-unread-badge.js';
|
|
28
|
-
import './chunks/index-
|
|
28
|
+
import './chunks/index-fut7tm1R.js';
|
|
29
29
|
import './chunks/document.model.d-DIzMiOmd.js';
|
|
30
30
|
|
|
31
31
|
declare class SupportChatBanner extends LitElement {
|