@patientos/website-kit 0.1.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.
@@ -0,0 +1,19 @@
1
+ // src/script-sources.ts
2
+ var CONSULT_CHUNK_PATH = "assets/portal-consult.js";
3
+ var TURNSTILE_SCRIPT_ORIGIN = "https://challenges.cloudflare.com";
4
+ var BPOINT_SCRIPT_ORIGIN = "https://www.bpoint.com.au";
5
+ var THIRD_PARTY_SCRIPT_ORIGINS = [
6
+ TURNSTILE_SCRIPT_ORIGIN,
7
+ BPOINT_SCRIPT_ORIGIN
8
+ ];
9
+ var TURNSTILE_SCRIPT_URL = `${TURNSTILE_SCRIPT_ORIGIN}/turnstile/v0/api.js`;
10
+ var BPOINT_SCRIPT_URL = `${BPOINT_SCRIPT_ORIGIN}/rest/clientscripts/api.js`;
11
+
12
+ export {
13
+ CONSULT_CHUNK_PATH,
14
+ TURNSTILE_SCRIPT_ORIGIN,
15
+ BPOINT_SCRIPT_ORIGIN,
16
+ THIRD_PARTY_SCRIPT_ORIGINS,
17
+ TURNSTILE_SCRIPT_URL,
18
+ BPOINT_SCRIPT_URL
19
+ };
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+
3
+ /** The injectable fetch, same shape the portal islands use. */
4
+ type ConsultFetchLike = (input: string, init?: RequestInit) => Promise<Response>;
5
+
6
+ interface ConsultRoomProps {
7
+ appointmentId: string;
8
+ /** The patient left, or the call ended and they dismissed it. */
9
+ onLeave: () => void;
10
+ fetchImpl?: ConsultFetchLike;
11
+ }
12
+ /**
13
+ * The whole surface: connect, paint, leave.
14
+ *
15
+ * Exported for completeness, but NOTE the boundary — the island mounts this through
16
+ * `mountPortalConsult` (the default export), never as an element, because the island's
17
+ * React copy and this chunk's are different instances.
18
+ */
19
+ declare function ConsultRoom({ appointmentId, onLeave, fetchImpl, }: ConsultRoomProps): React.ReactElement;
20
+ /**
21
+ * THE CHUNK CONTRACT — the only thing `main.js` is allowed to know about this file.
22
+ *
23
+ * Makes its OWN React root on `el` (this chunk's React copy, isolated from the island's
24
+ * by construction) and returns the teardown. The teardown unmounts that root, which runs
25
+ * the connect effect's cleanup — disconnecting the room and releasing the camera and
26
+ * microphone. Idempotent: calling it twice is a no-op.
27
+ */
28
+ declare function mountPortalConsult(el: HTMLElement, opts: {
29
+ appointmentId: string;
30
+ onLeave: () => void;
31
+ /** Test seam. */
32
+ fetchImpl?: ConsultFetchLike;
33
+ }): () => void;
34
+
35
+ export { ConsultRoom, type ConsultRoomProps, mountPortalConsult as default };