@mediquo/elements 0.4.0 → 0.5.1
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 +86 -1
- package/dist/chunks/api-chat-client-vbjgaIRV.js +1 -0
- package/dist/chunks/{apple-pay-outcomes-BNkcTbbM.js → apple-pay-outcomes-DxrMPQqB.js} +1 -1
- package/dist/chunks/appointment-card-skeleton-1c7552Ln.d.ts +398 -0
- package/dist/chunks/appointment-card-skeleton-CYFfacro.js +1 -0
- package/dist/chunks/chunk-4FFT6DC2-CVWibomC.js +1 -0
- package/dist/chunks/chunk-GZF3YFSX-BzloXkVp.js +1 -0
- package/dist/chunks/chunk-RCFIJTXZ-C6Ir0-sM.js +1 -0
- package/dist/chunks/chunk-S5RWG6G2-DPesx3Od.js +1 -0
- package/dist/chunks/chunk-YMQSBQHL-De_r7BNk.js +1 -0
- package/dist/chunks/chunk-YTQUGGS3-p18naHsk.js +1 -0
- package/dist/chunks/consume-CovVqBjI.js +1 -0
- package/dist/chunks/context-consumer-ESdICVAb.js +1 -0
- package/dist/chunks/context-provider--AKuwfs9.js +1 -0
- package/dist/chunks/create-context-DqP79qjF.js +1 -0
- package/dist/chunks/documentation-view-CS4Q-UpO.js +1 -0
- package/dist/chunks/external-mrLCXx_f.js +1 -0
- package/dist/chunks/{format-Cm3B1GMy.js → format-CRFiCNHw.js} +1 -1
- package/dist/chunks/get-appointment-query-Ck68BEMg.js +1 -0
- package/dist/chunks/get-patient-documents-query-DIQH-TMM.js +1 -0
- package/dist/chunks/get-patient-profile-query-B0tUDJmT.js +1 -0
- package/dist/chunks/i18n-formats-DYS91YEa.js +1 -0
- package/dist/chunks/index-BJYWtEmT.js +1 -0
- package/dist/chunks/index-CGnPsMVQ.js +1 -0
- package/dist/chunks/index-CvDnN2NR.js +1 -0
- package/dist/chunks/index-DBMxJ4Dp.js +1 -0
- package/dist/chunks/index-DNUbmrQl.d.ts +31 -0
- package/dist/chunks/index-czcKClL3.d.ts +47 -0
- package/dist/chunks/index-yd2JNJSr.js +1 -0
- package/dist/chunks/isBefore-CPpTogxo.js +1 -0
- package/dist/chunks/{isSameDay-DPfclwIL.js → isSameDay-CuhZMy1T.js} +1 -1
- package/dist/chunks/localized-decorator-BlOuLhym.js +1 -0
- package/dist/chunks/mq-layout-CGcdxGMQ.js +1 -0
- package/dist/chunks/mq-professional-presence-sync-cmg6CXhz.d.ts +22 -0
- package/dist/chunks/mq-unread-count-sync-DTn9dfR4.d.ts +22 -0
- package/dist/chunks/mutation-controller-CR2qcqhH.js +1 -0
- package/dist/chunks/parseISO-Dj3qSTG8.js +1 -0
- package/dist/chunks/price-CdF63nRC.js +1 -0
- package/dist/chunks/professional-overview-CfjgnTw4.js +1 -0
- package/dist/chunks/{provide-CfT7g_Zi.js → provide-D2fnEhT2.js} +1 -1
- package/dist/chunks/query-Cjvi4_dT.js +1 -0
- package/dist/chunks/query-controller-BlO1Ax65.js +1 -0
- package/dist/chunks/{refund-cancel-policy-CnbrIqH0.js → refund-cancel-policy-Bl9qE8wD.js} +1 -1
- package/dist/chunks/schemas.d-5LR6aN9I.d.ts +134 -0
- package/dist/chunks/telemetry-client-BLJVs9me.js +1 -0
- package/dist/env.js +1 -1
- package/dist/events.d.ts +11 -1
- 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-apple-pay-checkout.js +1 -1
- package/dist/mq-appointment-checkout.js +1 -1
- package/dist/mq-appointment-documentation.d.ts +48 -0
- package/dist/mq-appointment-documentation.js +1 -0
- package/dist/mq-chat-room.js +1 -1
- package/dist/mq-checkout.js +1 -1
- package/dist/mq-dashboard.d.ts +224 -0
- package/dist/mq-dashboard.js +1 -0
- package/dist/mq-documents.d.ts +46 -0
- package/dist/mq-documents.js +1 -0
- package/dist/mq-google-pay-checkout.js +1 -1
- package/dist/mq-immediate-videocall-checkout.js +1 -1
- package/dist/mq-my-appointments.d.ts +13 -525
- package/dist/mq-my-appointments.js +1 -1
- package/dist/mq-professional-presence-sync.d.ts +30 -0
- package/dist/mq-professional-presence-sync.js +1 -0
- package/dist/mq-query-client-provider.js +1 -1
- package/dist/mq-schedule-success.d.ts +9 -0
- package/dist/mq-schedule-success.js +2 -2
- package/dist/mq-schedule.d.ts +22 -10
- package/dist/mq-schedule.js +1 -1
- package/dist/mq-session-provider.d.ts +28 -0
- package/dist/mq-session-provider.js +1 -0
- package/dist/mq-socket-provider.js +1 -1
- package/dist/mq-support-chat.js +1 -1
- package/dist/mq-terms-and-conditions.d.ts +23 -0
- package/dist/mq-terms-and-conditions.js +1 -0
- package/dist/mq-unread-count-sync.d.ts +21 -0
- package/dist/mq-unread-count-sync.js +1 -0
- package/dist/mq-videocall.d.ts +35 -26
- package/dist/mq-videocall.js +1 -1
- package/dist/react/mq-apple-pay-checkout.d.ts +24 -7
- package/dist/react/mq-apple-pay-checkout.js +1 -1
- package/dist/react/mq-appointment-checkout.d.ts +20 -5
- package/dist/react/mq-appointment-checkout.js +1 -1
- package/dist/react/mq-appointment-documentation.d.ts +39 -0
- package/dist/react/mq-appointment-documentation.js +2 -0
- package/dist/react/mq-chat-room.d.ts +31 -6
- package/dist/react/mq-chat-room.js +1 -1
- package/dist/react/mq-checkout.d.ts +22 -8
- package/dist/react/mq-checkout.js +1 -1
- package/dist/react/mq-dashboard.d.ts +57 -0
- package/dist/react/mq-dashboard.js +2 -0
- package/dist/react/mq-documents.d.ts +27 -0
- package/dist/react/mq-documents.js +2 -0
- package/dist/react/mq-google-pay-checkout.d.ts +29 -7
- package/dist/react/mq-google-pay-checkout.js +1 -1
- package/dist/react/mq-immediate-videocall-checkout.d.ts +15 -5
- package/dist/react/mq-immediate-videocall-checkout.js +1 -1
- package/dist/react/mq-my-appointments.d.ts +27 -6
- package/dist/react/mq-my-appointments.js +1 -1
- package/dist/react/mq-professional-presence-sync.d.ts +13 -0
- package/dist/react/mq-professional-presence-sync.js +2 -0
- package/dist/react/mq-query-client-provider.d.ts +9 -2
- package/dist/react/mq-query-client-provider.js +1 -1
- package/dist/react/mq-schedule-success.d.ts +31 -5
- package/dist/react/mq-schedule-success.js +1 -1
- package/dist/react/mq-schedule.d.ts +47 -6
- package/dist/react/mq-schedule.js +1 -1
- package/dist/react/mq-session-provider.d.ts +19 -0
- package/dist/react/mq-session-provider.js +2 -0
- package/dist/react/mq-socket-provider.d.ts +13 -2
- package/dist/react/mq-socket-provider.js +1 -1
- package/dist/react/mq-support-chat.d.ts +31 -2
- package/dist/react/mq-support-chat.js +1 -1
- package/dist/react/mq-terms-and-conditions.d.ts +30 -0
- package/dist/react/mq-terms-and-conditions.js +2 -0
- package/dist/react/mq-theme-provider.d.ts +13 -2
- package/dist/react/mq-toast-container.d.ts +16 -0
- package/dist/react/mq-toast-container.js +2 -0
- package/dist/react/mq-unread-count-sync.d.ts +13 -0
- package/dist/react/mq-unread-count-sync.js +2 -0
- package/dist/react/mq-videocall.d.ts +33 -3
- package/dist/react/mq-videocall.js +1 -1
- package/dist/toast.d.ts +3 -0
- package/dist/toast.js +1 -0
- package/dist/ui/mq-calendar.js +1 -1
- package/dist/ui/mq-time-slot-picker.js +1 -1
- package/dist/ui/mq-toast.js +1 -1
- package/package.json +33 -1
- package/dist/chunks/api-chat-client-C8SqZtCa.js +0 -1
- package/dist/chunks/chunk-S5RWG6G2-oTcdgk2H.js +0 -1
- package/dist/chunks/chunk-YTQUGGS3-DN-JZpgG.js +0 -1
- package/dist/chunks/context-provider-CiMFpvDA.js +0 -1
- package/dist/chunks/exports-G_7Ih_GH.js +0 -1
- package/dist/chunks/external-zAbuzxDj.js +0 -1
- package/dist/chunks/get-patient-profile-query-C8T8DJ7z.js +0 -1
- package/dist/chunks/index-Bxh8Qfwr.js +0 -1
- package/dist/chunks/index-DiqYAEHW.js +0 -1
- package/dist/chunks/isBefore-Cof0D841.js +0 -1
- package/dist/chunks/mq-layout-CpIZTsV2.js +0 -1
- package/dist/chunks/mutation-controller-OVT8NEt6.js +0 -1
- package/dist/chunks/parseISO-jT42c8Ob.js +0 -1
- package/dist/chunks/price-tImUmtpX.js +0 -1
- package/dist/chunks/query-QJ1INUTG.js +0 -1
- package/dist/chunks/telemetry-client-BRVJU-fZ.js +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { M as MqProfessionalPresenceSync } from './chunks/mq-professional-presence-sync-cmg6CXhz.js';
|
|
2
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Keeps the cached professional's `active_absence` in sync with realtime socket
|
|
6
|
+
* events, so presence indicators flip to "absent" without a refetch:
|
|
7
|
+
*
|
|
8
|
+
* - `absence_created` → set `active_absence`, and schedule a timer to clear it
|
|
9
|
+
* when `finishes_at` is reached (natural expiry emits no event).
|
|
10
|
+
* - `absence_cancelled` → clear `active_absence`.
|
|
11
|
+
*
|
|
12
|
+
* Reads the socket and query client from context, so the host only has to mount
|
|
13
|
+
* it under the socket + query-client providers.
|
|
14
|
+
*/
|
|
15
|
+
declare class ProfessionalPresenceSyncController implements ReactiveController {
|
|
16
|
+
private readonly host;
|
|
17
|
+
private socket;
|
|
18
|
+
private queryClient;
|
|
19
|
+
private readonly clearTimers;
|
|
20
|
+
constructor(host: ReactiveControllerHost);
|
|
21
|
+
private _queryKey;
|
|
22
|
+
private _setActiveAbsence;
|
|
23
|
+
private _onAbsenceCreated;
|
|
24
|
+
private _onAbsenceCancelled;
|
|
25
|
+
private _clearTimer;
|
|
26
|
+
hostConnected(): void;
|
|
27
|
+
hostDisconnected(): void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { ProfessionalPresenceSyncController };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,t as s}from"./chunks/custom-element-DA9Fxvxd.js";import{a as t,E as n}from"./chunks/lit-element-DiWJYFwC.js";import{s as r}from"./chunks/context-consumer-ESdICVAb.js";import{Q as c}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{S as o,a as i}from"./chunks/chunk-YTQUGGS3-p18naHsk.js";import{g as a}from"./chunks/chunk-YMQSBQHL-De_r7BNk.js";import{g as h,a as l}from"./chunks/api-chat-client-vbjgaIRV.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/external-mrLCXx_f.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./env.js";class ProfessionalPresenceSyncController{constructor(e){this.host=e,this.clearTimers=new Map,this._onAbsenceCreated=e=>{if(!e?.professional_hash||!e.finishes_at)return;const{professional_hash:s,id:t,finishes_at:n}=e;this._setActiveAbsence(s,{id:t,finishes_at:n}),this._clearTimer(s);const r=h(n).getTime()-Date.now();r>0&&r<2147483647&&this.clearTimers.set(s,setTimeout(()=>{this.clearTimers.delete(s),this._setActiveAbsence(s,null)},r))},this._onAbsenceCancelled=e=>{e?.professional_hash&&(this._clearTimer(e.professional_hash),this._setActiveAbsence(e.professional_hash,null))},new r(this.host,{context:o,subscribe:!0,callback:e=>{e&&e!==this.socket&&(this.socket=e,this.socket.on(i.absence_created,this._onAbsenceCreated),this.socket.on(i.absence_cancelled,this._onAbsenceCancelled))}}),new r(this.host,{context:c,subscribe:!0,callback:e=>{e&&(this.queryClient=e)}}),this.host.addController(this)}_queryKey(e){return a(l,{hash:e}).queryKey}_setActiveAbsence(e,s){this.queryClient?.setQueryData(this._queryKey(e),e=>e?{...e,active_absence:s}:void 0)}_clearTimer(e){const s=this.clearTimers.get(e);s&&(clearTimeout(s),this.clearTimers.delete(e))}hostConnected(){}hostDisconnected(){this.socket?.off(i.absence_created,this._onAbsenceCreated),this.socket?.off(i.absence_cancelled,this._onAbsenceCancelled);for(const e of this.clearTimers.values())clearTimeout(e);this.clearTimers.clear()}}let m=class MqProfessionalPresenceSync extends t{constructor(){super(...arguments),this._controller=new ProfessionalPresenceSyncController(this)}createRenderRoot(){return this}render(){return n}};m=e([s("mq-professional-presence-sync")],m);export{m as MqProfessionalPresenceSync,ProfessionalPresenceSyncController};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as t,t as e}from"./chunks/custom-element-DA9Fxvxd.js";import{h as s,j as i,k as a,R as r,l as n,g as o,S as u,m as h,n as c,o as l,q as d,u as f,f as y,v as p,a as m,w as g,x as v,y as b,z as C,Q as q}from"./chunks/query-QJ1INUTG.js";import{e as O}from"./chunks/provide-CfT7g_Zi.js";import{x as P,a as w}from"./chunks/lit-element-DiWJYFwC.js";import{r as Q}from"./chunks/state-LQivXIgA.js";import{e as x}from"./chunks/ensure-context-root-DbdqwnKB.js";import"./chunks/context-provider-CiMFpvDA.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/property-scuRaFcM.js";var D=Object.defineProperty;function M(t){return{onFetch:(e,r)=>{const n=e.options,o=e.fetchOptions?.meta?.fetchMore?.direction,u=e.state.data?.pages||[],h=e.state.data?.pageParams||[];let c={pages:[],pageParams:[]},l=0;const d=async()=>{let r=!1;const d=s(e.options,e.fetchOptions),f=async(t,s,n)=>{if(r)return Promise.reject();if(null==s&&t.pages.length)return Promise.resolve(t);const o=(()=>{const t={client:e.client,queryKey:e.queryKey,pageParam:s,direction:n?"backward":"forward",meta:e.options.meta};var i;return i=t,Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(e.signal.aborted?r=!0:e.signal.addEventListener("abort",()=>{r=!0}),e.signal)}),t})(),u=await d(o),{maxPages:h}=e.options,c=n?i:a;return{pages:c(t.pages,u,h),pageParams:c(t.pageParams,s,h)}};if(o&&u.length){const t="backward"===o,e={pages:u,pageParams:h},s=(t?k:A)(n,e);c=await f(e,s,t)}else{const e=t??u.length;do{const t=0===l?h[0]??n.initialPageParam:A(n,c);if(l>0&&null==t)break;c=await f(c,t),l++}while(l<e)}return c};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r):e.fetchFn=d}}}function A(t,{pages:e,pageParams:s}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}function k(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var E=class extends r{#t;#e;#s;constructor(t){super(),this.mutationId=t.mutationId,this.#e=t.mutationCache,this.#t=[],this.state=t.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#e.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#i({type:"continue"})};this.#s=n({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(t,e)=>{this.#i({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#i({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const s="pending"===this.state.status,i=!this.#s.canStart();try{if(s)e();else{this.#i({type:"pending",variables:t,isPaused:i}),await(this.#e.config.onMutate?.(t,this));const e=await(this.options.onMutate?.(t));e!==this.state.context&&this.#i({type:"pending",context:e,variables:t,isPaused:i})}const a=await this.#s.start();return await(this.#e.config.onSuccess?.(a,t,this.state.context,this)),await(this.options.onSuccess?.(a,t,this.state.context)),await(this.#e.config.onSettled?.(a,null,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(a,null,t,this.state.context)),this.#i({type:"success",data:a}),a}catch(e){try{throw await(this.#e.config.onError?.(e,t,this.state.context,this)),await(this.options.onError?.(e,t,this.state.context)),await(this.#e.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(void 0,e,t,this.state.context)),e}finally{this.#i({type:"error",error:e})}}finally{this.#e.runNext(this)}}#i(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),o.batch(()=>{this.#t.forEach(e=>{e.onMutationUpdate(t)}),this.#e.notify({mutation:this,type:"updated",action:t})})}};var K=class extends u{constructor(t={}){super(),this.config=t,this.#a=new Set,this.#r=new Map,this.#n=0}#a;#r;#n;build(t,e,s){const i=new E({mutationCache:this,mutationId:++this.#n,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#a.add(t);const e=j(t);if("string"==typeof e){const s=this.#r.get(e);s?s.push(t):this.#r.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#a.delete(t)){const e=j(t);if("string"==typeof e){const s=this.#r.get(e);if(s)if(s.length>1){const e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#r.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=j(t);if("string"==typeof e){const s=this.#r.get(e),i=s?.find(t=>"pending"===t.state.status);return!i||i===t}return!0}runNext(t){const e=j(t);if("string"==typeof e){const s=this.#r.get(e)?.find(e=>e!==t&&e.state.isPaused);return s?.continue()??Promise.resolve()}return Promise.resolve()}clear(){o.batch(()=>{this.#a.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#a.clear(),this.#r.clear()})}getAll(){return Array.from(this.#a)}find(t){const e={exact:!0,...t};return this.getAll().find(t=>h(e,t))}findAll(t={}){return this.getAll().filter(e=>h(t,e))}notify(t){o.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(t=>t.state.isPaused);return o.batch(()=>Promise.all(t.map(t=>t.continue().catch(c))))}};function j(t){return t.options.scope?.id}var F=class extends u{constructor(t={}){super(),this.config=t,this.#o=new Map}#o;build(t,e,s){const i=e.queryKey,a=e.queryHash??l(i,e);let r=this.get(a);return r||(r=new d({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(r)),r}add(t){this.#o.has(t.queryHash)||(this.#o.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#o.get(t.queryHash);e&&(t.destroy(),e===t&&this.#o.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){o.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#o.get(t)}getAll(){return[...this.#o.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(t=>f(e,t))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(e=>f(t,e)):e}notify(t){o.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){o.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){o.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},S=class{#u;#e;#h;#c;#l;#d;#f;#y;constructor(t={}){this.#u=t.queryCache||new F,this.#e=t.mutationCache||new K,this.#h=t.defaultOptions||{},this.#c=new Map,this.#l=new Map,this.#d=0}mount(){this.#d++,1===this.#d&&(this.#f=y.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#u.onFocus())}),this.#y=p.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#u.onOnline())}))}unmount(){this.#d--,0===this.#d&&(this.#f?.(),this.#f=void 0,this.#y?.(),this.#y=void 0)}isFetching(t){return this.#u.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#u.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=this.#u.build(this,e),i=s.state.data;return void 0===i?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(m(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return this.#u.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){const i=this.defaultQueryOptions({queryKey:t}),a=this.#u.get(i.queryHash),r=a?.state.data,n=g(e,r);if(void 0!==n)return this.#u.build(this,i).setData(n,{...s,manual:!0})}setQueriesData(t,e,s){return o.batch(()=>this.#u.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#u.get(e.queryHash)?.state}removeQueries(t){const e=this.#u;o.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){const s=this.#u;return o.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},i=o.batch(()=>this.#u.findAll(t).map(t=>t.cancel(s)));return Promise.all(i).then(c).catch(c)}invalidateQueries(t,e={}){return o.batch(()=>(this.#u.findAll(t).forEach(t=>{t.invalidate()}),"none"===t?.refetchType?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},i=o.batch(()=>this.#u.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(c)),"paused"===t.state.fetchStatus?Promise.resolve():e}));return Promise.all(i).then(c)}fetchQuery(t){const e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);const s=this.#u.build(this,e);return s.isStaleByTime(m(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(c).catch(c)}fetchInfiniteQuery(t){return t.behavior=M(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(c).catch(c)}ensureInfiniteQueryData(t){return t.behavior=M(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return p.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#u}getMutationCache(){return this.#e}getDefaultOptions(){return this.#h}setDefaultOptions(t){this.#h=t}setQueryDefaults(t,e){this.#c.set(v(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#c.values()],s={};return e.forEach(e=>{b(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#l.set(v(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#l.values()],s={};return e.forEach(e=>{b(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#h.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=l(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===C&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#h.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#u.clear(),this.#e.clear()}},R=t=>{class QueryClientMixinClass extends t{constructor(){super(...arguments),this.queryClient=new S({defaultOptions:{queries:{staleTime:6e4}}})}connectedCallback(){super.connectedCallback(),this.queryClient.mount()}disconnectedCallback(){super.disconnectedCallback(),this.queryClient.unmount()}}return((t,e,s)=>{for(var i,a=void 0,r=t.length-1;r>=0;r--)(i=t[r])&&(a=i(e,s,a)||a);a&&D(e,s,a)})([O({context:q}),Q()],QueryClientMixinClass.prototype,"queryClient"),QueryClientMixinClass};x();let H=class QueryClientProvider extends(R(w)){render(){return P`<slot></slot>`}};H=t([e("mq-query-client-provider")],H);export{H as QueryClientProvider};
|
|
1
|
+
import{_ as t,t as e}from"./chunks/custom-element-DA9Fxvxd.js";import{Q as s}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{e as i}from"./chunks/provide-D2fnEhT2.js";import{h as a,j as r,k as n,R as o,l as u,g as h,S as c,m as l,n as d,o as f,Q as y,q as p,f as m,u as g,a as v,v as b,w as C,x as q,y as O}from"./chunks/query-Cjvi4_dT.js";import{x as P,a as w}from"./chunks/lit-element-DiWJYFwC.js";import{r as Q}from"./chunks/state-LQivXIgA.js";import{e as x}from"./chunks/ensure-context-root-DbdqwnKB.js";import"./chunks/create-context-DqP79qjF.js";import"./chunks/context-provider--AKuwfs9.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/property-scuRaFcM.js";var D=Object.defineProperty;function M(t){return{onFetch:(e,s)=>{const i=e.options,o=e.fetchOptions?.meta?.fetchMore?.direction,u=e.state.data?.pages||[],h=e.state.data?.pageParams||[];let c={pages:[],pageParams:[]},l=0;const d=async()=>{let s=!1;const d=a(e.options,e.fetchOptions),f=async(t,i,a)=>{if(s)return Promise.reject();if(null==i&&t.pages.length)return Promise.resolve(t);const o=(()=>{const t={client:e.client,queryKey:e.queryKey,pageParam:i,direction:a?"backward":"forward",meta:e.options.meta};var r;return r=t,Object.defineProperty(r,"signal",{enumerable:!0,get:()=>(e.signal.aborted?s=!0:e.signal.addEventListener("abort",()=>{s=!0}),e.signal)}),t})(),u=await d(o),{maxPages:h}=e.options,c=a?r:n;return{pages:c(t.pages,u,h),pageParams:c(t.pageParams,i,h)}};if(o&&u.length){const t="backward"===o,e={pages:u,pageParams:h},s=(t?A:k)(i,e);c=await f(e,s,t)}else{const e=t??u.length;do{const t=0===l?h[0]??i.initialPageParam:k(i,c);if(l>0&&null==t)break;c=await f(c,t),l++}while(l<e)}return c};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=d}}}function k(t,{pages:e,pageParams:s}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,s[i],s):void 0}function A(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var j=class extends o{#t;#e;#s;constructor(t){super(),this.mutationId=t.mutationId,this.#e=t.mutationCache,this.#t=[],this.state=t.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#e.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||("pending"===this.state.status?this.scheduleGc():this.#e.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#i({type:"continue"})};this.#s=u({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(t,e)=>{this.#i({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#i({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const s="pending"===this.state.status,i=!this.#s.canStart();try{if(s)e();else{this.#i({type:"pending",variables:t,isPaused:i}),await(this.#e.config.onMutate?.(t,this));const e=await(this.options.onMutate?.(t));e!==this.state.context&&this.#i({type:"pending",context:e,variables:t,isPaused:i})}const a=await this.#s.start();return await(this.#e.config.onSuccess?.(a,t,this.state.context,this)),await(this.options.onSuccess?.(a,t,this.state.context)),await(this.#e.config.onSettled?.(a,null,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(a,null,t,this.state.context)),this.#i({type:"success",data:a}),a}catch(e){try{throw await(this.#e.config.onError?.(e,t,this.state.context,this)),await(this.options.onError?.(e,t,this.state.context)),await(this.#e.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this)),await(this.options.onSettled?.(void 0,e,t,this.state.context)),e}finally{this.#i({type:"error",error:e})}}finally{this.#e.runNext(this)}}#i(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),h.batch(()=>{this.#t.forEach(e=>{e.onMutationUpdate(t)}),this.#e.notify({mutation:this,type:"updated",action:t})})}};var E=class extends c{constructor(t={}){super(),this.config=t,this.#a=new Set,this.#r=new Map,this.#n=0}#a;#r;#n;build(t,e,s){const i=new j({mutationCache:this,mutationId:++this.#n,options:t.defaultMutationOptions(e),state:s});return this.add(i),i}add(t){this.#a.add(t);const e=K(t);if("string"==typeof e){const s=this.#r.get(e);s?s.push(t):this.#r.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#a.delete(t)){const e=K(t);if("string"==typeof e){const s=this.#r.get(e);if(s)if(s.length>1){const e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#r.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=K(t);if("string"==typeof e){const s=this.#r.get(e),i=s?.find(t=>"pending"===t.state.status);return!i||i===t}return!0}runNext(t){const e=K(t);if("string"==typeof e){const s=this.#r.get(e)?.find(e=>e!==t&&e.state.isPaused);return s?.continue()??Promise.resolve()}return Promise.resolve()}clear(){h.batch(()=>{this.#a.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#a.clear(),this.#r.clear()})}getAll(){return Array.from(this.#a)}find(t){const e={exact:!0,...t};return this.getAll().find(t=>l(e,t))}findAll(t={}){return this.getAll().filter(e=>l(t,e))}notify(t){h.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(t=>t.state.isPaused);return h.batch(()=>Promise.all(t.map(t=>t.continue().catch(d))))}};function K(t){return t.options.scope?.id}var F=class extends c{constructor(t={}){super(),this.config=t,this.#o=new Map}#o;build(t,e,s){const i=e.queryKey,a=e.queryHash??f(i,e);let r=this.get(a);return r||(r=new y({client:t,queryKey:i,queryHash:a,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(i)}),this.add(r)),r}add(t){this.#o.has(t.queryHash)||(this.#o.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#o.get(t.queryHash);e&&(t.destroy(),e===t&&this.#o.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){h.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#o.get(t)}getAll(){return[...this.#o.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(t=>p(e,t))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(e=>p(t,e)):e}notify(t){h.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){h.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){h.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},R=class{#u;#e;#h;#c;#l;#d;#f;#y;constructor(t={}){this.#u=t.queryCache||new F,this.#e=t.mutationCache||new E,this.#h=t.defaultOptions||{},this.#c=new Map,this.#l=new Map,this.#d=0}mount(){this.#d++,1===this.#d&&(this.#f=m.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#u.onFocus())}),this.#y=g.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#u.onOnline())}))}unmount(){this.#d--,0===this.#d&&(this.#f?.(),this.#f=void 0,this.#y?.(),this.#y=void 0)}isFetching(t){return this.#u.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#u.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),s=this.#u.build(this,e),i=s.state.data;return void 0===i?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(v(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(t){return this.#u.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){const i=this.defaultQueryOptions({queryKey:t}),a=this.#u.get(i.queryHash),r=a?.state.data,n=b(e,r);if(void 0!==n)return this.#u.build(this,i).setData(n,{...s,manual:!0})}setQueriesData(t,e,s){return h.batch(()=>this.#u.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#u.get(e.queryHash)?.state}removeQueries(t){const e=this.#u;h.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){const s=this.#u;return h.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const s={revert:!0,...e},i=h.batch(()=>this.#u.findAll(t).map(t=>t.cancel(s)));return Promise.all(i).then(d).catch(d)}invalidateQueries(t,e={}){return h.batch(()=>(this.#u.findAll(t).forEach(t=>{t.invalidate()}),"none"===t?.refetchType?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const s={...e,cancelRefetch:e.cancelRefetch??!0},i=h.batch(()=>this.#u.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(d)),"paused"===t.state.fetchStatus?Promise.resolve():e}));return Promise.all(i).then(d)}fetchQuery(t){const e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);const s=this.#u.build(this,e);return s.isStaleByTime(v(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(d).catch(d)}fetchInfiniteQuery(t){return t.behavior=M(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(d).catch(d)}ensureInfiniteQueryData(t){return t.behavior=M(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return g.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#u}getMutationCache(){return this.#e}getDefaultOptions(){return this.#h}setDefaultOptions(t){this.#h=t}setQueryDefaults(t,e){this.#c.set(C(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#c.values()],s={};return e.forEach(e=>{q(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#l.set(C(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#l.values()],s={};return e.forEach(e=>{q(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#h.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=f(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===O&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#h.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#u.clear(),this.#e.clear()}},S=t=>{class QueryClientMixinClass extends t{constructor(){super(...arguments),this.queryClient=new R({defaultOptions:{queries:{staleTime:6e4}}})}connectedCallback(){super.connectedCallback(),this.queryClient.mount()}disconnectedCallback(){super.disconnectedCallback(),this.queryClient.unmount()}}return((t,e,s)=>{for(var i,a=void 0,r=t.length-1;r>=0;r--)(i=t[r])&&(a=i(e,s,a)||a);a&&D(e,s,a)})([i({context:s}),Q()],QueryClientMixinClass.prototype,"queryClient"),QueryClientMixinClass};x();let I=class QueryClientProvider extends(S(w)){render(){return P`<slot></slot>`}};I=t([e("mq-query-client-provider")],I);export{I as QueryClientProvider};
|
|
@@ -38,6 +38,8 @@ declare class OpenVideocallEvent extends Event {
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* @fires open-videocall - Fired when the user wants to join the videocall
|
|
41
|
+
* @fires mq-view-appointments - Fired (when `show-nav-ctas`) to view the appointments list
|
|
42
|
+
* @fires mq-home - Fired (when `show-nav-ctas`) to return to the home screen
|
|
41
43
|
*/
|
|
42
44
|
declare class MqScheduleSuccess extends LitElement {
|
|
43
45
|
static styles: lit.CSSResult;
|
|
@@ -54,6 +56,13 @@ declare class MqScheduleSuccess extends LitElement {
|
|
|
54
56
|
locale?: string;
|
|
55
57
|
/** Environment override ("development" | "production"). Optional. */
|
|
56
58
|
env?: Env;
|
|
59
|
+
/**
|
|
60
|
+
* Show the post-booking navigation CTAs ("view appointments" / "go home").
|
|
61
|
+
* Off by default: standalone hosts opt in when they own those destinations,
|
|
62
|
+
* and the component stays navigation-agnostic otherwise. When on, the CTAs
|
|
63
|
+
* emit `mq-view-appointments` (`{ tab: "next" }`) and `mq-home`.
|
|
64
|
+
*/
|
|
65
|
+
showNavCtas: boolean;
|
|
57
66
|
queryClientContext: QueryClient | undefined;
|
|
58
67
|
/** Available when embedded in mq-router; standalone hosts pass `token` instead. */
|
|
59
68
|
private loginToken?;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{isValidLocale as t,setLocale as e,getLocale as i,initLocalization as
|
|
1
|
+
import{isValidLocale as t,setLocale as e,getLocale as i,initLocalization as o}from"./i18n.js";import{_ as n,t as a}from"./chunks/custom-element-DA9Fxvxd.js";import{m as s,s as r}from"./chunks/runtime-Bg1WXVCx.js";import{l as c}from"./chunks/localized-decorator-BlOuLhym.js";import{i as p,a as l,x as d,E as m}from"./chunks/lit-element-DiWJYFwC.js";import{n as u}from"./chunks/property-scuRaFcM.js";import{r as h}from"./chunks/state-LQivXIgA.js";import{setEnv as v}from"./env.js";import{MqViewAppointmentsEvent as g,MqHomeEvent as f}from"./events.js";import{a as k,A as y,g as b,C as x}from"./chunks/api-chat-client-vbjgaIRV.js";import{checkIcon as j}from"./ui/icons/check-icon.js";import"./ui/mq-callout.js";import"./ui/mq-button.js";import{c as w}from"./chunks/consume-CovVqBjI.js";import{l as $}from"./chunks/chunk-S5RWG6G2-DPesx3Od.js";import"./chunks/professional-overview-CfjgnTw4.js";import{f as q}from"./chunks/price-CdF63nRC.js";import{Q as C}from"./chunks/query-controller-BlO1Ax65.js";import{g as _}from"./chunks/get-appointment-query-Ck68BEMg.js";import{g as S}from"./chunks/get-organization-setup-query-BMbuRi6v.js";import{g as z}from"./chunks/get-patient-profile-query-B0tUDJmT.js";import{g as I}from"./chunks/chunk-GZF3YFSX-BzloXkVp.js";import{calendarIcon as O}from"./ui/icons/calendar-icon.js";import{chatbubbleIcon as Q}from"./ui/icons/chat-bubble-icon.js";import{videoIcon as A}from"./ui/icons/video-icon.js";import"./mq-chat-room.js";import"./ui/mq-floating-bubble.js";import"./ui/mq-unread-badge.js";import{g as T,a as P}from"./chunks/i18n-formats-DYS91YEa.js";import"./ui/mq-skeleton.js";import"./ui/mq-card.js";import{Q as E}from"./chunks/chunk-RCFIJTXZ-C6Ir0-sM.js";import{t as N,e as V,a as F,f as H,g as B,h as G}from"./chunks/telemetry-client-BLJVs9me.js";import"./chunks/chunk-4FFT6DC2-CVWibomC.js";import"./chunks/external-mrLCXx_f.js";import"./chunks/parseISO-Dj3qSTG8.js";import"./chunks/format-CRFiCNHw.js";import"./chunks/isBefore-CPpTogxo.js";import"./ui/icons/types.js";import"./ui/icons/info-circle-outine-icon.js";import"./chunks/class-map-Co76I6aw.js";import"./chunks/directive-2EDmOukv.js";import"./chunks/context-consumer-ESdICVAb.js";import"./chunks/context-request-event-Dfydf1ub.js";import"./chunks/create-context-DqP79qjF.js";import"./ui/icons/chevron-down-icon.js";import"./chunks/if-defined-BYeVdwgd.js";import"./ui/mq-text-button.js";import"./ui/mq-avatar.js";import"./ui/icons/briefcase-icon.js";import"./ui/icons/clock-icon.js";import"./ui/icons/message-bubble-icon.js";import"./ui/icons/phone-icon.js";import"./chunks/query-Cjvi4_dT.js";import"./chunks/provide-D2fnEhT2.js";import"./chunks/context-provider--AKuwfs9.js";import"./theme.js";import"./ui/icons/x-icon.js";import"./chunks/chunk-YMQSBQHL-De_r7BNk.js";import"./ui/icons/chevron-left-icon.js";import"./chunks/query-CeeutdfT.js";import"./ui/icons/check-double-icon.js";import"./chunks/chunk-YTQUGGS3-p18naHsk.js";import"./chunks/mutation-controller-CR2qcqhH.js";import"./chunks/style-map-CIdqdn7C.js";const K=p`header{padding:var(--sp-6) var(--sp-4);display:flex;align-items:center;gap:var(--sp-2);max-width:var(--content-max-width);margin:0 auto}.summary{padding:var(--sp-6) var(--sp-4);background-color:var(--color-neutrals-background-weak);max-width:var(--content-max-width);margin:0 auto}.summary-content{display:flex;flex-direction:column;gap:var(--sp-4)}.manage-appointment{box-sizing:border-box;max-width:var(--content-max-width);margin:0 auto}`;let M=class MqScheduleSuccessSkeleton extends l{static{this.styles=K}render(){return d`<div><header><mq-skeleton width="220px" height="40px" border-radius="md"></mq-skeleton></header><div class="summary"><div class="summary-content"><mq-skeleton width="280px" height="32px" border-radius="md"></mq-skeleton><mq-skeleton width="100%" height="400px" border-radius="lg"></mq-skeleton><mq-skeleton width="100%" height="80px" border-radius="lg"></mq-skeleton></div></div><div class="manage-appointment"><mq-skeleton width="100%" height="313px" border-radius="lg"></mq-skeleton></div></div>`}};M=n([a("mq-schedule-success-skeleton")],M);const R=p`.success-title{display:flex;align-items:center;gap:var(--sp-2);margin-bottom:var(--sp-4)}header h1{font-family:var(--font-titles);font-size:var(--text-3xl);line-height:var(--text-3xl--line-height);font-weight:var(--font-weight-bold);margin:0}h2{font-family:var(--font-titles);font-size:var(--text-2xl);line-height:var(--text-2xl--line-height);font-weight:var(--font-weight-bold);margin:0;margin-bottom:var(--sp-6)}.summary{padding:var(--sp-6) var(--sp-4)}.professional-card{padding:var(--sp-4)}.appointment-summary{margin-bottom:var(--sp-2);display:flex;flex-direction:column;gap:var(--sp-4)}.add-to-calendar-container{padding-top:var(--sp-4);border-top:1px solid var(--color-neutrals-border-disabled)}.price-breakdown{display:flex;flex-direction:column;gap:var(--sp-2)}.price-row{display:flex;justify-content:space-between;gap:var(--sp-4);font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-default)}.price-row--total{font-weight:var(--font-weight-semibold)}.price-breakdown hr{width:100%;border:none;border-top:1px solid var(--color-neutrals-border-disabled);margin:var(--sp-1) 0}.floating-content{height:100%}.actions{display:flex;flex-direction:column;gap:var(--sp-4)}@media (min-width:768px){.actions{flex-direction:row}}.footer-cta{margin-top:var(--sp-4);padding:var(--sp-6) var(--sp-4)}.footer-cta h2{margin-bottom:var(--sp-2)}.footer-cta .description{font-family:var(--font-body);font-size:var(--text-base);line-height:var(--text-base--line-height);color:var(--color-neutrals-text-default);margin:0 0 var(--sp-6)}.footer-cta .actions{display:flex;flex-direction:column;gap:var(--sp-3)}`;class OpenVideocallEvent extends Event{static{this.eventName="open-videocall"}constructor(t){super(OpenVideocallEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}let U=class MqScheduleSuccess extends l{constructor(){super(...arguments),this.kind="schedule",this.showNavCtas=!1,this._trackedPageView=!1,this.getPatientProfileQuery=new C(this,()=>z(k)),this.getAppointmentQuery=new C(this,()=>_(k,{id:this.appointmentId})),this.getCouponQuery=new C(this,()=>{return t=k,e={appointmentId:this.appointmentId},i={enabled:!!this.appointmentId},{queryKey:["appointment-consultation-coupon",e.appointmentId],queryFn:()=>t.payments.getAppointmentConsultationCoupon(e.appointmentId),retry:!1,...i};var t,e,i}),this.getOrganizationSpecialtiesQuery=new C(this,()=>T(k)),this.getOrganizationSetupQuery=new C(this,()=>S(k)),this.isChatOpen=!1,this.unreadQuery=new C(this,()=>I(k,{roomId:Number(this.getAppointmentQuery.result?.data?.room_id)},{enabled:!!this.getAppointmentQuery.result?.data?.room_id})),this._getCalloutText=t=>{switch(t.channel){case y.videocall:return s("Te enviaremos un enlace al email indicado cuando sea el momento de conectarte a la vídeoconsulta. Asegúrate de tener buena conexión a internet y un dispositivo con cámara y micrófono.");case y.phonecall:return s(r`El profesional te llamará al
|
|
2
2
|
${this.getPatientProfileQuery.result?.data?.profile.phone??""} en el horario
|
|
3
3
|
seleccionado. Asegúrate de tener buena cobertura y poder atender en
|
|
4
|
-
el horario elegido.`);case
|
|
4
|
+
el horario elegido.`);case y.chat:return s("El profesional te enviará un mensaje para que podamos coordinar la cita. Asegúrate de tener buena cobertura y poder atender en el horario elegido.");default:return m}}}static{this.styles=R}get _accessToken(){return this.token??this.loginToken?.access_token}get _timezone(){return this.timezone||Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}willUpdate(i){i.has("env")&&this.env&&v(this.env),i.has("apiKey")&&this.apiKey&&k.setApiKey(this.apiKey),i.has("token")&&this.token&&k.setAuthToken(this.token),i.has("locale")&&this.locale&&t(this.locale)&&(e(this.locale),k.setLanguage(this.locale))}get _patientHash(){return this.getPatientProfileQuery.result?.data?.hash??""}connectedCallback(){super.connectedCallback(),this.queryClientContext?.invalidateQueries()}updated(){!this._trackedPageView&&this._patientHash&&(this._trackedPageView=!0,N.track(V(this._patientHash,this.appointmentId)))}renderPriceBreakdown(t,e,i){const o=t.price;if(null==o||o<=0)return m;const n=t.currency??"EUR",a=t.discount_amount??0,r=a>0,c=o-a,p=this.getCouponQuery.result?.data,l=p?.name??p?.code,u=r?p?.percent_off??Math.round(a/o*100):0,h=l?`${s("Promoción")} ${l}`:s("Promoción");return d`<div class="price-breakdown"><div class="price-row"><span>${i}</span> <span>${q({amount:o,currency:n},e)}</span></div>${r?d`<div class="price-row"><span>${h} (-${u}%)</span> <span>${q({amount:-a,currency:n},e)}</span></div><hr><div class="price-row price-row--total"><span>${s("Total")}</span> <span>${q({amount:c,currency:n},e)}</span></div>`:m}</div>`}render(){return this.getAppointmentQuery.render({pending:()=>d`<mq-schedule-success-skeleton></mq-schedule-success-skeleton>`,complete:t=>{const e=i(),o=b(t.start_date),n=F(o,t.duration),a=this.getOrganizationSpecialtiesQuery.result?.data?.find(e=>e.id===Number(t.speciality_id)),c=P(a?.code??"",e,a?.name),p=t.channel===y.videocall,l=t.channel===y.phonecall,u=!0===this.getOrganizationSetupQuery.result?.data?.appointments?.has_chat_in_appointment,h=(p||l)&&u,v=this._accessToken;return d`<div><header><div class="success-title">${j()}<h1>${"schedule"===this.kind?s("Cita confirmada"):s("Cita modificada")}</h1></div><h2>${s(r`Resumen de la cita para ${t?.to?.name??""}`)}</h2></header><mq-card class="summary" roundness="md"><div class="appointment-summary"><professional-overview .name="${t.from.name??""}" .specialtyName="${c}" .collegiateNumber="${t.from.collegiate_number??void 0}" .description="${t.from.description??""}" .languages="${t.from.languages??[]}" .avatar="${t.from.avatar??""}" always-expanded-on-desktop></professional-overview><appointment-details .startsAt="${o.toISOString()}" .duration="${t.duration}" .channel="${t.channel}" .timezone="${this._timezone}"></appointment-details>${this.renderPriceBreakdown(t,e,c||s("Consulta"))}<div class="add-to-calendar-container"><mq-text-button fontWeight="bold" size="sm" @click="${()=>{N.track(H(this._patientHash,this.appointmentId));const e=function({title:t,description:e,startsAt:i,endsAt:o}){const n=t=>t.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),a=n(i),s=n(o);return`https://www.google.com/calendar/render?${new URLSearchParams({action:"TEMPLATE",text:t,dates:`${a}/${s}`,...e&&{details:e}}).toString()}`}({title:s(r`Cita agendada de ${t.from.speciality??""}`),startsAt:o,endsAt:n,description:p&&t.consultation_short_url?s(r`Enlace a la cita: ${t.consultation_short_url}`):void 0});window.open(e,"_blank")}}">${O({size:24})} ${s("Añadir al calendario")}</mq-text-button></div>${h||p?d`<div class="actions">${h?d`<mq-button variant="primary" fullwidth size="md" @click="${()=>{N.track(B(this._patientHash,this.appointmentId)),this.isChatOpen=!this.isChatOpen}}">${Q({size:24})} ${s("Chatear con el profesional")} ${(this.unreadQuery.result?.data?.unread_count??0)>0?d`<mq-unread-badge></mq-unread-badge>`:m}</mq-button>`:m} ${p?d`<mq-button variant="outline" fullwidth size="md" @click="${()=>{N.track(G(this._patientHash,this.appointmentId)),this.dispatchEvent(new OpenVideocallEvent({appointmentId:this.appointmentId}))}}">${A({size:24})} ${s("Ir a videollamada")}</mq-button>`:m}</div>`:m}</div><mq-callout background="default" variant="info" ?noPadding="${!(h||p)}">${this._getCalloutText(t)}</mq-callout></mq-card>${this.showNavCtas?d`<mq-card class="footer-cta" roundness="md"><h2>${s("Tus citas")}</h2><p class="description">${s("Accede, modifica o anula tus citas.")}</p><div class="actions"><mq-button variant="primary" size="md" fullwidth @click="${()=>{this.dispatchEvent(new g({tab:"next"}))}}">${s("Ver mis citas")}</mq-button><mq-button variant="outline" size="md" fullwidth @click="${()=>{this.dispatchEvent(new f)}}">${s("Volver al inicio")}</mq-button></div></mq-card>`:m}</div><mq-floating-bubble ?dismissable="${!1}" .open="${this.isChatOpen}" @mq-close="${()=>{this.isChatOpen=!1}}" hideCloseButton>${this.isChatOpen&&v?d`<div slot="content" class="floating-content"><mq-chat-room .consultationId="${t.id}" .consultationType="${x.appointment}" .token="${v}" .roomId="${Number(t.room_id)}" .professionalHash="${t.from.hash}" @mq-chat-room-close="${()=>{this.isChatOpen=!1}}"></mq-chat-room></div>`:m}</mq-floating-bubble>`}})}};n([u({type:String})],U.prototype,"kind",void 0),n([u({type:String})],U.prototype,"appointmentId",void 0),n([u({type:String,attribute:"api-key"})],U.prototype,"apiKey",void 0),n([u({type:String,attribute:"token"})],U.prototype,"token",void 0),n([u({type:String,attribute:"timezone"})],U.prototype,"timezone",void 0),n([u({type:String,attribute:"locale"})],U.prototype,"locale",void 0),n([u({type:String,attribute:"env"})],U.prototype,"env",void 0),n([u({type:Boolean,attribute:"show-nav-ctas"})],U.prototype,"showNavCtas",void 0),n([w({context:E,subscribe:!0})],U.prototype,"queryClientContext",void 0),n([w({context:$})],U.prototype,"loginToken",void 0),n([h()],U.prototype,"isChatOpen",void 0),U=n([c(),a("mq-schedule-success")],U),o();export{U as MqScheduleSuccess,OpenVideocallEvent};
|
package/dist/mq-schedule.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as lit_html from 'lit-html';
|
|
2
2
|
import * as lit from 'lit';
|
|
3
|
-
import { LitElement, PropertyValues, nothing } from 'lit';
|
|
3
|
+
import { LitElement, PropertyValues, TemplateResult, nothing } from 'lit';
|
|
4
4
|
import './chunks/mq-layout-D8Mak16a.js';
|
|
5
5
|
import './ui/mq-button.js';
|
|
6
6
|
import { Env } from './env.js';
|
|
@@ -601,7 +601,9 @@ declare class PaymentMethodSelector extends LitElement {
|
|
|
601
601
|
private _selected;
|
|
602
602
|
private _select;
|
|
603
603
|
private _confirm;
|
|
604
|
-
|
|
604
|
+
private _renderRow;
|
|
605
|
+
private _renderAction;
|
|
606
|
+
render(): TemplateResult<1>;
|
|
605
607
|
}
|
|
606
608
|
declare global {
|
|
607
609
|
interface HTMLElementTagNameMap {
|
|
@@ -616,6 +618,9 @@ declare global {
|
|
|
616
618
|
* @fires apple-pay-opened - Cancelable. Fired before the Apple Pay popup opens.
|
|
617
619
|
* Call preventDefault() to open the URL yourself (e.g. Safari top-level).
|
|
618
620
|
* detail.url includes #token= (secret — do not log).
|
|
621
|
+
* @fires google-pay-opened - Cancelable. Fired before the Google Pay popup opens.
|
|
622
|
+
* Call preventDefault() to open the checkout URL yourself.
|
|
623
|
+
* detail.url includes #token= (secret — do not log).
|
|
619
624
|
* @fires error - Fired when the polling timeout is reached
|
|
620
625
|
*/
|
|
621
626
|
declare class PaymentStep extends LitElement {
|
|
@@ -632,7 +637,7 @@ declare class PaymentStep extends LitElement {
|
|
|
632
637
|
appliedDiscount: AppliedDiscount | null;
|
|
633
638
|
bookingRequest: CreatePaymentLinkRequest | null;
|
|
634
639
|
apiKey?: string;
|
|
635
|
-
/** Raw integrator token for
|
|
640
|
+
/** Raw integrator token for wallet checkout shells (URL fragment). */
|
|
636
641
|
userToken?: string;
|
|
637
642
|
env: string;
|
|
638
643
|
locale: string;
|
|
@@ -640,14 +645,14 @@ declare class PaymentStep extends LitElement {
|
|
|
640
645
|
successUrl?: string;
|
|
641
646
|
queryClientContext: QueryClient | undefined;
|
|
642
647
|
private _view;
|
|
643
|
-
private
|
|
644
|
-
private
|
|
645
|
-
private
|
|
646
|
-
private
|
|
648
|
+
private _walletWaiting;
|
|
649
|
+
private _walletUrl;
|
|
650
|
+
private _walletPopupBlocked;
|
|
651
|
+
private _walletConfigError;
|
|
647
652
|
private _timedOut;
|
|
648
653
|
private _iframeLoaded;
|
|
649
654
|
private _iframeHeight;
|
|
650
|
-
private
|
|
655
|
+
private _walletPopup;
|
|
651
656
|
private _pollIntervalId?;
|
|
652
657
|
private _pollStartTimeoutId?;
|
|
653
658
|
private _pollDeadline;
|
|
@@ -658,12 +663,19 @@ declare class PaymentStep extends LitElement {
|
|
|
658
663
|
private _paymentCurrency;
|
|
659
664
|
private _paymentAmountLabel;
|
|
660
665
|
private _buildApplePayUrl;
|
|
666
|
+
private _buildGooglePayUrl;
|
|
667
|
+
private _buildWalletCheckoutUrl;
|
|
661
668
|
private _stopPaymentPolling;
|
|
662
669
|
private _startPaymentPolling;
|
|
663
670
|
private _pollOnce;
|
|
671
|
+
private _dispatchWalletOpenedEvent;
|
|
664
672
|
private _onPaymentMethodSelected;
|
|
665
|
-
private
|
|
666
|
-
private
|
|
673
|
+
private _openWalletPopup;
|
|
674
|
+
private _reopenWalletPopup;
|
|
675
|
+
private _walletWaitingTitle;
|
|
676
|
+
private _walletReopenLabel;
|
|
677
|
+
private _walletReopenLinkLabel;
|
|
678
|
+
private _walletReopenAgainLabel;
|
|
667
679
|
private _onHeaderBack;
|
|
668
680
|
updated(changed: PropertyValues): void;
|
|
669
681
|
connectedCallback(): void;
|