@mediquo/elements 0.3.1 → 0.3.2

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 CHANGED
@@ -1,22 +1,173 @@
1
- # @mediquo/elements
1
+ <div align="center">
2
+ <img src="https://cdn.prod.website-files.com/6784cf58154b9286f2dfca2e/67f517824ab7067c273b400b_apppat.svg" alt="Mediquo" width="200" />
3
+ <h1>@mediquo/elements</h1>
4
+ <p>Framework-agnostic Lit web components for Mediquo patient experiences.</p>
5
+ </div>
2
6
 
3
- Web components package built on top of `@mediquo/core` (shared queries, DI,
4
- utils). It owns its own theme, copy and assets, independent from
5
- `@mediquo/web-components`.
7
+ ---
6
8
 
7
- ## Exports
9
+ Lit custom elements for scheduling, video consultations, chat, and payments. Each feature ships as its own entry point — import only what you need. Components are routing-agnostic: they emit semantic events and leave navigation to the host.
8
10
 
9
- - `.` — registers and exports all elements.
10
- - `./mq-theme-provider` — theme provider (defaults to `default`).
11
- - `./theme` — theme tokens.
12
-
13
- ## Develop
11
+ ## Installation
14
12
 
15
13
  ```bash
16
- npm run build -w @mediquo/elements
17
- npm run test -w @mediquo/elements
18
- npm run test:arch -w @mediquo/elements
19
- npm run health -w @mediquo/elements
14
+ npm install @mediquo/elements
15
+ ```
16
+
17
+ ## Quick start
18
+
19
+ Wrap features with the providers they need, then mount the element:
20
+
21
+ ```html
22
+ <script type="module">
23
+ import "@mediquo/elements/mq-theme-provider";
24
+ import "@mediquo/elements/mq-query-client-provider";
25
+ import "@mediquo/elements/mq-schedule";
26
+ </script>
27
+
28
+ <mq-theme-provider theme="mediquo">
29
+ <mq-query-client-provider>
30
+ <mq-schedule
31
+ api-key="YOUR_API_KEY"
32
+ token="YOUR_ACCESS_TOKEN"
33
+ locale="es_ES"
34
+ env="production"
35
+ ></mq-schedule>
36
+ </mq-query-client-provider>
37
+ </mq-theme-provider>
38
+ ```
39
+
40
+ ```ts
41
+ const schedule = document.querySelector("mq-schedule");
42
+
43
+ schedule?.addEventListener("appointment-created", (event) => {
44
+ const { appointmentId } = (event as CustomEvent).detail;
45
+ // host decides where to go next
46
+ });
47
+
48
+ schedule?.addEventListener("back", () => {
49
+ // user left the wizard
50
+ });
51
+ ```
52
+
53
+ ## Components
54
+
55
+ | Element | Import | Description |
56
+ | --- | --- | --- |
57
+ | `mq-schedule` | `@mediquo/elements/mq-schedule` | Multi-step appointment booking / reschedule |
58
+ | `mq-schedule-success` | `@mediquo/elements/mq-schedule-success` | Post-booking confirmation screen |
59
+ | `mq-my-appointments` | `@mediquo/elements/mq-my-appointments` | Upcoming and past appointments |
60
+ | `mq-videocall` | `@mediquo/elements/mq-videocall` | Video consultation session |
61
+ | `mq-chat-room` | `@mediquo/elements/mq-chat-room` | Chat with a professional |
62
+ | `mq-support-chat` | `@mediquo/elements/mq-support-chat` | Support chat bubble |
63
+ | `mq-checkout` | `@mediquo/elements/mq-checkout` | Generic payment checkout |
64
+ | `mq-appointment-checkout` | `@mediquo/elements/mq-appointment-checkout` | Appointment payment |
65
+ | `mq-immediate-videocall-checkout` | `@mediquo/elements/mq-immediate-videocall-checkout` | Immediate videocall payment |
66
+ | `mq-apple-pay-checkout` | `@mediquo/elements/mq-apple-pay-checkout` | Apple Pay button |
67
+ | `mq-google-pay-checkout` | `@mediquo/elements/mq-google-pay-checkout` | Google Pay button |
68
+
69
+ Most features accept `api-key`, `token`, `locale`, and `env` when used standalone. See the [documentation](https://wc-showcase.mediquo.com) for per-component attributes and events.
70
+
71
+ ## Providers
72
+
73
+ Mount these as ancestors of the features that need them:
74
+
75
+ | Provider | Import | When |
76
+ | --- | --- | --- |
77
+ | `mq-theme-provider` | `@mediquo/elements/mq-theme-provider` | Always — design tokens |
78
+ | `mq-query-client-provider` | `@mediquo/elements/mq-query-client-provider` | Data-fetching features (`mq-schedule`, `mq-chat-room`, …) |
79
+ | `mq-socket-provider` | `@mediquo/elements/mq-socket-provider` | Realtime features (`mq-chat-room`) |
80
+
81
+ ```html
82
+ <mq-theme-provider theme="mediquo">
83
+ <mq-query-client-provider>
84
+ <mq-socket-provider>
85
+ <!-- feature elements -->
86
+ </mq-socket-provider>
87
+ </mq-query-client-provider>
88
+ </mq-theme-provider>
20
89
  ```
21
90
 
22
- Architecture standards live in [`tests/architecture/`](./tests/architecture/).
91
+ ## Theming
92
+
93
+ `mq-theme-provider` ships two built-in themes: `default` and `mediquo`. Override tokens with `custom-tokens`, or build a typed theme via `@mediquo/elements/theme`:
94
+
95
+ ```html
96
+ <mq-theme-provider
97
+ theme="custom"
98
+ custom-tokens="--color-primary: #0b6e4f; --color-background: #f7faf8;"
99
+ >
100
+ <!-- … -->
101
+ </mq-theme-provider>
102
+ ```
103
+
104
+ ```ts
105
+ import { createTheme } from "@mediquo/elements/theme";
106
+
107
+ const theme = createTheme({
108
+ "--color-primary": "#0b6e4f",
109
+ });
110
+ ```
111
+
112
+ ## Events
113
+
114
+ Components describe **what the user did**, never **where to navigate**. Listen for the actions you care about and own routing in the host.
115
+
116
+ Shared contract (also exported from `@mediquo/elements/events`):
117
+
118
+ | Event | Detail | Meaning |
119
+ | --- | --- | --- |
120
+ | `mq-back` | `{ source?: string }` | Generic back chrome |
121
+ | `mq-home` | — | Go to home |
122
+ | `mq-view-appointments` | `{ tab: "next" \| "history" }` | Open appointments list |
123
+ | `mq-appointment-book` | `{ specialty?, service?, professional? }` | Start booking |
124
+ | `mq-appointment-reschedule` | `{ appointmentId }` | Reschedule |
125
+ | `mq-appointment-join-videocall` | `{ appointmentId }` | Join videocall |
126
+ | `mq-appointment-view-documentation` | `{ appointmentId }` | Open documentation |
127
+ | `mq-download-file` | `{ url, filename }` | Host should persist / download a file |
128
+
129
+ Feature-specific events (e.g. `appointment-created` on `mq-schedule`) are documented per component.
130
+
131
+ ```ts
132
+ import { DownloadFileEvent } from "@mediquo/elements/events";
133
+
134
+ el.addEventListener(DownloadFileEvent.eventName, (event) => {
135
+ const { url, filename } = event.detail;
136
+ // save or trigger a download
137
+ });
138
+ ```
139
+
140
+ ## Locale and environment
141
+
142
+ Supported locales: `es_ES`, `en_US`, `pt_PT`, `de_DE`, `ca_ES`.
143
+
144
+ Pass `locale` as an attribute on the feature element, or call `setLocale` from `@mediquo/elements/i18n`.
145
+
146
+ For non-production backends:
147
+
148
+ ```ts
149
+ import { setEnv } from "@mediquo/elements/env";
150
+
151
+ setEnv("development"); // or "production"
152
+ ```
153
+
154
+ You can also set `env="development"` / `env="production"` on elements that expose it.
155
+
156
+ ## TypeScript
157
+
158
+ Entry points ship with `.d.ts` files. For modern package exports, prefer:
159
+
160
+ ```json
161
+ {
162
+ "compilerOptions": {
163
+ "moduleResolution": "bundler",
164
+ "module": "ESNext"
165
+ }
166
+ }
167
+ ```
168
+
169
+ Custom elements work in any framework that can render HTML. In React / Next.js, dynamic-import the entry points in a client component and attach listeners with `addEventListener`.
170
+
171
+ ## License
172
+
173
+ ISC
package/dist/env.js CHANGED
@@ -1 +1 @@
1
- const E="https://mediquo-landing.s3.eu-central-1.amazonaws.com/sdk-web/elements",o="production",e="0.3.1",n={development:{MODE:"development",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"47836441",ASSETS_BASE_URL:E},production:{MODE:"production",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"46655102",ASSETS_BASE_URL:E}};let t=o;const _=new Proxy({},{get:(E,o)=>n[t??"production"][o]});function S(E){t=E}export{E as ASSETS_BASE_URL,_ as env,S as setEnv};
1
+ const E="https://mediquo-landing.s3.eu-central-1.amazonaws.com/sdk-web/elements",o="production",e="0.3.2",n={development:{MODE:"development",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"47836441",ASSETS_BASE_URL:E},production:{MODE:"production",MQ_DEFAULT_ENV:o,MQ_ELEMENTS_VERSION:e,OPENTOK_API_KEY:"46655102",ASSETS_BASE_URL:E}};let t=o;const _=new Proxy({},{get:(E,o)=>n[t??"production"][o]});function S(E){t=E}export{E as ASSETS_BASE_URL,_ as env,S as setEnv};
@@ -58,11 +58,11 @@ declare const LoginTokenResponseSchema: z.ZodObject<{
58
58
  }>;
59
59
  }, "strip", z.ZodTypeAny, {
60
60
  hash: string;
61
+ name: string;
61
62
  country_code: string;
62
63
  timezone: string;
63
64
  first_name: string;
64
65
  last_name: string;
65
- name: string;
66
66
  birth_date: string;
67
67
  email: string;
68
68
  language_code: string;
@@ -79,11 +79,11 @@ declare const LoginTokenResponseSchema: z.ZodObject<{
79
79
  };
80
80
  }, {
81
81
  hash: string;
82
+ name: string;
82
83
  country_code: string;
83
84
  timezone: string;
84
85
  first_name: string;
85
86
  last_name: string;
86
- name: string;
87
87
  birth_date: string;
88
88
  email: string;
89
89
  language_code: string;
@@ -100,14 +100,13 @@ declare const LoginTokenResponseSchema: z.ZodObject<{
100
100
  };
101
101
  }>;
102
102
  }, "strip", z.ZodTypeAny, {
103
- access_token: string;
104
103
  patient: {
105
104
  hash: string;
105
+ name: string;
106
106
  country_code: string;
107
107
  timezone: string;
108
108
  first_name: string;
109
109
  last_name: string;
110
- name: string;
111
110
  birth_date: string;
112
111
  email: string;
113
112
  language_code: string;
@@ -123,15 +122,15 @@ declare const LoginTokenResponseSchema: z.ZodObject<{
123
122
  organization_name: string;
124
123
  };
125
124
  };
126
- }, {
127
125
  access_token: string;
126
+ }, {
128
127
  patient: {
129
128
  hash: string;
129
+ name: string;
130
130
  country_code: string;
131
131
  timezone: string;
132
132
  first_name: string;
133
133
  last_name: string;
134
- name: string;
135
134
  birth_date: string;
136
135
  email: string;
137
136
  language_code: string;
@@ -147,6 +146,7 @@ declare const LoginTokenResponseSchema: z.ZodObject<{
147
146
  organization_name: string;
148
147
  };
149
148
  };
149
+ access_token: string;
150
150
  }>;
151
151
  type LoginTokenResponse = z.infer<typeof LoginTokenResponseSchema>;
152
152
 
@@ -763,7 +763,7 @@ declare class ProfessionalsList extends LitElement {
763
763
  private getOrganizationSpecialtiesQuery;
764
764
  private getScheduleServicesQuery;
765
765
  private getProfessionalsBySpecialtyAndServiceQuery;
766
- render(): lit_html.TemplateResult<1> | typeof nothing | null;
766
+ render(): typeof nothing | lit_html.TemplateResult<1> | null;
767
767
  }
768
768
  declare global {
769
769
  interface HTMLElementTagNameMap {
@@ -75,7 +75,7 @@ declare class MqSupportChat extends LitElement {
75
75
  private _open;
76
76
  private _onKeydown;
77
77
  private _close;
78
- render(): lit_html.TemplateResult<1> | typeof nothing;
78
+ render(): typeof nothing | lit_html.TemplateResult<1>;
79
79
  }
80
80
  declare global {
81
81
  interface HTMLElementTagNameMap {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mediquo/elements",
3
3
  "private": false,
4
- "version": "0.3.1",
4
+ "version": "0.3.2",
5
5
  "type": "module",
6
6
  "description": "Mediquo elements web components",
7
7
  "license": "ISC",