@patientos/website-kit 0.2.6 → 0.2.8
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 +54 -2
- package/dist/booking-block-D-UOAPx3.d.ts +74 -0
- package/dist/cart-block-B-ytc9us.d.ts +20 -0
- package/dist/cart-button-BCLFittB.d.ts +24 -0
- package/dist/cart-storage.d.ts +110 -0
- package/dist/cart-storage.js +39 -0
- package/dist/checkout-block-BeXwpqYe.d.ts +24 -0
- package/dist/chunk-2CZFJOKK.js +79 -0
- package/dist/{chunk-ZYX4TXBN.js → chunk-3T7UWKAH.js} +4 -310
- package/dist/{chunk-7ZOQ6UKG.js → chunk-4GKSSM5N.js} +578 -3163
- package/dist/chunk-4NF7SSIX.js +367 -0
- package/dist/chunk-7BUDUYXN.js +80 -0
- package/dist/chunk-FZ4WKWIE.js +310 -0
- package/dist/{chunk-ZZFBTLR4.js → chunk-HTVKKLWI.js} +20 -5
- package/dist/chunk-IOC6QLB7.js +159 -0
- package/dist/chunk-S3ZQQOQT.js +2057 -0
- package/dist/chunk-UTAMB2SK.js +214 -0
- package/dist/chunk-WQSJ46TP.js +19 -0
- package/dist/chunk-ZNH6TSYP.js +167 -0
- package/dist/index.d.ts +12 -32
- package/dist/index.js +88 -26
- package/dist/islands-impl/cart-button.d.ts +19 -0
- package/dist/islands-impl/cart-button.js +13 -0
- package/dist/islands-impl/cart.d.ts +31 -0
- package/dist/islands-impl/cart.js +11 -0
- package/dist/islands-impl/checkout.d.ts +6 -0
- package/dist/islands-impl/checkout.js +13 -0
- package/dist/islands-impl/store.d.ts +30 -0
- package/dist/islands-impl/store.js +16 -0
- package/dist/islands-impl.d.ts +14 -10
- package/dist/islands-impl.js +22 -7
- package/dist/islands-registry.js +13 -4
- package/dist/{portal-account-8uQc_Ncx.d.ts → portal-account-DRJyr3nz.d.ts} +1 -82
- package/dist/{portal-account.client-BBe_q9yC.d.ts → portal-account.client-Bke4NsgW.d.ts} +2 -1
- package/dist/portal-booking-client.d.ts +3 -2
- package/dist/portal-booking-client.js +2 -1
- package/dist/portal-client-my3q5GME.d.ts +83 -0
- package/dist/store-block-CFxnsfKU.d.ts +37 -0
- package/dist/store-catalog-p7TFOpfk.d.ts +78 -0
- package/dist/store-catalog.d.ts +3 -0
- package/dist/store-catalog.js +11 -0
- package/dist/website-kit.css +193 -0
- package/package.json +31 -1
- package/dist/checkout-block-BdpPIuQ5.d.ts +0 -136
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CartButtonClient,
|
|
3
|
+
CartDrawer
|
|
4
|
+
} from "../chunk-ZNH6TSYP.js";
|
|
5
|
+
import "../chunk-IOC6QLB7.js";
|
|
6
|
+
import "../chunk-7BUDUYXN.js";
|
|
7
|
+
import "../chunk-4NF7SSIX.js";
|
|
8
|
+
import "../chunk-FZ4WKWIE.js";
|
|
9
|
+
import "../chunk-MLKGABMK.js";
|
|
10
|
+
export {
|
|
11
|
+
CartButtonClient,
|
|
12
|
+
CartDrawer
|
|
13
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { b as CartProps } from '../cart-block-B-ytc9us.js';
|
|
3
|
+
|
|
4
|
+
/** One server-priced line. Note: the quote carries NO image URL — only the catalogue does. */
|
|
5
|
+
type QuoteLine = {
|
|
6
|
+
variantId: string;
|
|
7
|
+
productHandle: string;
|
|
8
|
+
title: string;
|
|
9
|
+
quantity: number;
|
|
10
|
+
unitPrice: string;
|
|
11
|
+
lineTotal: string;
|
|
12
|
+
gstApplicable: boolean;
|
|
13
|
+
};
|
|
14
|
+
type QuoteProblem = {
|
|
15
|
+
code: string;
|
|
16
|
+
variantId?: string;
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
type Quote = {
|
|
20
|
+
lines: QuoteLine[];
|
|
21
|
+
subtotal: string;
|
|
22
|
+
taxTotal: string;
|
|
23
|
+
shippingTotal: string;
|
|
24
|
+
total: string;
|
|
25
|
+
problems: QuoteProblem[];
|
|
26
|
+
requiresShipping: boolean;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
declare function CartClient({ storeApiOrigin }: CartProps): React.ReactElement;
|
|
30
|
+
|
|
31
|
+
export { CartClient, type Quote, type QuoteLine, type QuoteProblem };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CheckoutClient
|
|
3
|
+
} from "../chunk-S3ZQQOQT.js";
|
|
4
|
+
import "../chunk-ZOF22TJA.js";
|
|
5
|
+
import "../chunk-UTAMB2SK.js";
|
|
6
|
+
import "../chunk-WQSJ46TP.js";
|
|
7
|
+
import "../chunk-7BUDUYXN.js";
|
|
8
|
+
import "../chunk-4NF7SSIX.js";
|
|
9
|
+
import "../chunk-FZ4WKWIE.js";
|
|
10
|
+
import "../chunk-MLKGABMK.js";
|
|
11
|
+
export {
|
|
12
|
+
CheckoutClient
|
|
13
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { b as StoreProps } from '../store-block-CFxnsfKU.js';
|
|
3
|
+
export { f as formatMoney } from '../store-block-CFxnsfKU.js';
|
|
4
|
+
import { S as StoreCatalog } from '../store-catalog-p7TFOpfk.js';
|
|
5
|
+
import '../portal-client-my3q5GME.js';
|
|
6
|
+
import '@patientos/public-sdk';
|
|
7
|
+
|
|
8
|
+
/** Runtime props: the island config plus the seams only a real host can supply. */
|
|
9
|
+
type StoreClientProps = StoreProps & {
|
|
10
|
+
/**
|
|
11
|
+
* A catalogue fetched by the host's PER-REQUEST route loader, rendered immediately
|
|
12
|
+
* (server included) instead of a skeleton.
|
|
13
|
+
*
|
|
14
|
+
* Deliberately NOT a marker prop: `<Store/>` must never carry prices into the
|
|
15
|
+
* edge-cached static artifact. Supplying it suppresses the loading state; the
|
|
16
|
+
* component still refreshes in the background.
|
|
17
|
+
*/
|
|
18
|
+
initialCatalog?: StoreCatalog | null;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The inline script rendered into SERVER HTML beside a seeded grid.
|
|
22
|
+
*
|
|
23
|
+
* Deliberately tiny, dependency-free and idempotent (several store islands can share
|
|
24
|
+
* one page). It only records — it never writes the cart, because the cart writer is
|
|
25
|
+
* async, lock-serialised, and lives in the bundle that has not arrived yet.
|
|
26
|
+
*/
|
|
27
|
+
declare const STORE_PREHYDRATION_SCRIPT = "(function(){\nif(window.__skStoreArmed)return;window.__skStoreArmed=1;\ndocument.addEventListener('click',function(e){\nvar t=e.target;if(!t||!t.closest)return;\nvar b=t.closest('button[data-sk-store-add]');if(!b||b.disabled)return;\nvar c=b.closest('.sk-store__card');var s=c?c.querySelector('select'):null;\nvar v=(s&&s.value)||b.getAttribute('data-sk-store-variant');if(!v)return;\n(b.__skStoreQueue||(b.__skStoreQueue=[])).push({variantId:v,event:e});\n},true);\n})();";
|
|
28
|
+
declare function StoreClient({ categoryHandle, productHandle, storeApiOrigin, title, columns, hideCartLink, initialCatalog, }: StoreClientProps): React.ReactElement;
|
|
29
|
+
|
|
30
|
+
export { STORE_PREHYDRATION_SCRIPT, StoreClient, type StoreClientProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
STORE_PREHYDRATION_SCRIPT,
|
|
3
|
+
StoreClient
|
|
4
|
+
} from "../chunk-UTAMB2SK.js";
|
|
5
|
+
import "../chunk-WQSJ46TP.js";
|
|
6
|
+
import {
|
|
7
|
+
formatMoney
|
|
8
|
+
} from "../chunk-7BUDUYXN.js";
|
|
9
|
+
import "../chunk-4NF7SSIX.js";
|
|
10
|
+
import "../chunk-FZ4WKWIE.js";
|
|
11
|
+
import "../chunk-MLKGABMK.js";
|
|
12
|
+
export {
|
|
13
|
+
STORE_PREHYDRATION_SCRIPT,
|
|
14
|
+
StoreClient,
|
|
15
|
+
formatMoney
|
|
16
|
+
};
|
package/dist/islands-impl.d.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { b as BookingBlockProps,
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { b as BookingBlockProps, e as CertificateFunnelProps } from './booking-block-D-UOAPx3.js';
|
|
3
|
+
import { f as PortalPanelProps } from './portal-account-DRJyr3nz.js';
|
|
4
|
+
import { F as FetchLike } from './portal-client-my3q5GME.js';
|
|
5
|
+
export { P as PortalAccountClient } from './portal-account.client-Bke4NsgW.js';
|
|
6
|
+
export { StoreClient } from './islands-impl/store.js';
|
|
7
|
+
export { CartClient } from './islands-impl/cart.js';
|
|
8
|
+
export { CartButtonClient } from './islands-impl/cart-button.js';
|
|
9
|
+
export { CheckoutClient } from './islands-impl/checkout.js';
|
|
5
10
|
import '@patientos/public-sdk';
|
|
11
|
+
import './store-block-CFxnsfKU.js';
|
|
12
|
+
import './store-catalog-p7TFOpfk.js';
|
|
13
|
+
import './cart-block-B-ytc9us.js';
|
|
14
|
+
import './cart-button-BCLFittB.js';
|
|
15
|
+
import './checkout-block-BeXwpqYe.js';
|
|
6
16
|
|
|
7
17
|
declare function BookingBlockClient(props: BookingBlockProps): React.ReactElement;
|
|
8
18
|
|
|
@@ -59,10 +69,4 @@ type PortalPanelClientProps = PortalPanelProps & {
|
|
|
59
69
|
};
|
|
60
70
|
declare function PortalPanelClient({ surface, portalUrl, portalApiOrigin, initialState, fetchImpl, }: PortalPanelClientProps): React.ReactElement;
|
|
61
71
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
declare function CartClient({ storeApiOrigin }: CartProps): React.ReactElement;
|
|
65
|
-
|
|
66
|
-
declare function CheckoutClient({ storeApiOrigin, ordersHref, completionHref, }: CheckoutProps): React.ReactElement;
|
|
67
|
-
|
|
68
|
-
export { BookingBlockClient, CartClient, CertificateFunnelClient, CheckoutClient, PortalPanelClient, StoreClient };
|
|
72
|
+
export { BookingBlockClient, CertificateFunnelClient, PortalPanelClient };
|
package/dist/islands-impl.js
CHANGED
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BookingBlockClient,
|
|
3
|
-
CartClient,
|
|
4
3
|
CertificateFunnelClient,
|
|
5
|
-
CheckoutClient,
|
|
6
4
|
PortalAccountClient,
|
|
7
|
-
PortalPanelClient
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import "./chunk-ZOF22TJA.js";
|
|
5
|
+
PortalPanelClient
|
|
6
|
+
} from "./chunk-4GKSSM5N.js";
|
|
7
|
+
import "./chunk-3T7UWKAH.js";
|
|
11
8
|
import "./chunk-QDO3SJWR.js";
|
|
12
9
|
import "./chunk-THMT43MV.js";
|
|
13
|
-
import
|
|
10
|
+
import {
|
|
11
|
+
CartClient
|
|
12
|
+
} from "./chunk-2CZFJOKK.js";
|
|
13
|
+
import {
|
|
14
|
+
CartButtonClient
|
|
15
|
+
} from "./chunk-ZNH6TSYP.js";
|
|
16
|
+
import "./chunk-IOC6QLB7.js";
|
|
17
|
+
import {
|
|
18
|
+
CheckoutClient
|
|
19
|
+
} from "./chunk-S3ZQQOQT.js";
|
|
20
|
+
import "./chunk-ZOF22TJA.js";
|
|
21
|
+
import {
|
|
22
|
+
StoreClient
|
|
23
|
+
} from "./chunk-UTAMB2SK.js";
|
|
24
|
+
import "./chunk-WQSJ46TP.js";
|
|
25
|
+
import "./chunk-7BUDUYXN.js";
|
|
26
|
+
import "./chunk-4NF7SSIX.js";
|
|
27
|
+
import "./chunk-FZ4WKWIE.js";
|
|
14
28
|
import "./chunk-MLKGABMK.js";
|
|
15
29
|
export {
|
|
16
30
|
BookingBlockClient,
|
|
31
|
+
CartButtonClient,
|
|
17
32
|
CartClient,
|
|
18
33
|
CertificateFunnelClient,
|
|
19
34
|
CheckoutClient,
|
package/dist/islands-registry.js
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ISLANDS,
|
|
3
3
|
mountIslands
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-HTVKKLWI.js";
|
|
5
|
+
import "./chunk-4GKSSM5N.js";
|
|
6
|
+
import "./chunk-3T7UWKAH.js";
|
|
7
7
|
import "./chunk-QDO3SJWR.js";
|
|
8
8
|
import "./chunk-THMT43MV.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-2CZFJOKK.js";
|
|
10
|
+
import "./chunk-ZNH6TSYP.js";
|
|
11
|
+
import "./chunk-IOC6QLB7.js";
|
|
12
|
+
import "./chunk-S3ZQQOQT.js";
|
|
13
|
+
import "./chunk-ZOF22TJA.js";
|
|
14
|
+
import "./chunk-UTAMB2SK.js";
|
|
15
|
+
import "./chunk-WQSJ46TP.js";
|
|
16
|
+
import "./chunk-7BUDUYXN.js";
|
|
17
|
+
import "./chunk-4NF7SSIX.js";
|
|
18
|
+
import "./chunk-FZ4WKWIE.js";
|
|
10
19
|
import "./chunk-MLKGABMK.js";
|
|
11
20
|
export {
|
|
12
21
|
ISLANDS,
|
|
@@ -1,86 +1,5 @@
|
|
|
1
|
-
import { ApplicationRun } from '@patientos/public-sdk';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
|
|
4
|
-
/** The injectable browser transport. */
|
|
5
|
-
type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
6
|
-
interface PortalClientConfig {
|
|
7
|
-
/** The validated app API origin, e.g. https://my.pocketdoc.com.au. */
|
|
8
|
-
apiOrigin?: string | null;
|
|
9
|
-
/** The app origin used only to verify whether relative portal API calls belong here. */
|
|
10
|
-
portalOrigin?: string | null;
|
|
11
|
-
/** Where to send a patient who cannot use the client at all. */
|
|
12
|
-
portalUrl?: string | null;
|
|
13
|
-
/** Injectable for tests. */
|
|
14
|
-
fetchImpl?: FetchLike;
|
|
15
|
-
}
|
|
16
|
-
/** Who the app says is signed in on this origin. */
|
|
17
|
-
type WhoAmI = {
|
|
18
|
-
signedIn: false;
|
|
19
|
-
} | {
|
|
20
|
-
signedIn: true;
|
|
21
|
-
givenName: string;
|
|
22
|
-
familyName: string;
|
|
23
|
-
email: string;
|
|
24
|
-
};
|
|
25
|
-
/** The patient's own details, for prefill. Every field is independently nullable. */
|
|
26
|
-
interface PortalPrefill {
|
|
27
|
-
givenName: string | null;
|
|
28
|
-
familyName: string | null;
|
|
29
|
-
email: string | null;
|
|
30
|
-
phone: string | null;
|
|
31
|
-
dateOfBirth: string | null;
|
|
32
|
-
}
|
|
33
|
-
/** A claim token minted for the signed-in patient's corroborated-identity path. */
|
|
34
|
-
interface PublicClaim {
|
|
35
|
-
contactId: string;
|
|
36
|
-
claimToken: string;
|
|
37
|
-
expiresAt: string;
|
|
38
|
-
}
|
|
39
|
-
/** A portal call is always a value, never a thrown transport failure. */
|
|
40
|
-
type PortalResult<T> = {
|
|
41
|
-
ok: true;
|
|
42
|
-
data: T;
|
|
43
|
-
} | {
|
|
44
|
-
ok: false;
|
|
45
|
-
status: number | null;
|
|
46
|
-
error: string | null;
|
|
47
|
-
body?: unknown;
|
|
48
|
-
};
|
|
49
|
-
interface PortalClient {
|
|
50
|
-
/** Whether this client can honestly offer an inline portal interaction. */
|
|
51
|
-
readonly available: boolean;
|
|
52
|
-
/** The validated app origin, or '' for relative same-origin calls. */
|
|
53
|
-
readonly apiOrigin: string;
|
|
54
|
-
/** The configured outbound fallback, or ''. */
|
|
55
|
-
readonly portalHref: string;
|
|
56
|
-
/** Resolve a constant path against this client's one configured origin. */
|
|
57
|
-
url(path: string): string;
|
|
58
|
-
/** The transport bound when this client was created; injectable for tests. */
|
|
59
|
-
readonly fetch: FetchLike;
|
|
60
|
-
/** Who is signed in; unhealthy/unavailable is indistinguishable from signed out. */
|
|
61
|
-
whoAmI(): Promise<WhoAmI>;
|
|
62
|
-
/** Ask for an oracle-free magic link. */
|
|
63
|
-
requestMagicLink(email: string, redirect?: string): Promise<boolean>;
|
|
64
|
-
/** Read the signed-in patient's details. */
|
|
65
|
-
prefill(): Promise<PortalPrefill | null>;
|
|
66
|
-
/** Mint a public claim only for the signed-in patient. */
|
|
67
|
-
mintPublicClaim(): Promise<PublicClaim | null>;
|
|
68
|
-
/** Redeem a single-use magic-link continuation after patient sign-in. */
|
|
69
|
-
redeemApplicationRunHandoff(handoffId: string): Promise<{
|
|
70
|
-
run: ApplicationRun;
|
|
71
|
-
capabilityToken: string;
|
|
72
|
-
} | null>;
|
|
73
|
-
/** Page callback, using the app-side return hop when cross-origin. */
|
|
74
|
-
returnPath(targetUrl?: string): string;
|
|
75
|
-
/** Back-compat account-surface transport; callers still use constant paths. */
|
|
76
|
-
get<T>(path: string): Promise<PortalResult<T>>;
|
|
77
|
-
/** Back-compat account-surface JSON write; callers still use constant paths. */
|
|
78
|
-
send<T>(path: string, method: 'POST' | 'PUT', body: unknown): Promise<PortalResult<T>>;
|
|
79
|
-
/** Back-compat account-surface body-less delete. */
|
|
80
|
-
delete<T>(path: string): Promise<PortalResult<T>>;
|
|
81
|
-
}
|
|
82
|
-
declare function createPortalClient(config?: PortalClientConfig): PortalClient;
|
|
83
|
-
|
|
84
3
|
/** Which portal surface this panel shows. */
|
|
85
4
|
type PortalSurface = 'appointments' | 'documents' | 'orders' | 'profile';
|
|
86
5
|
/** JSON-safe island configuration. Crosses the build→runtime boundary — see `./islands`. */
|
|
@@ -212,4 +131,4 @@ type PortalAccountMarkerProps = PortalAccountProps & {
|
|
|
212
131
|
*/
|
|
213
132
|
declare function PortalAccount({ surface, portalUrl, bookHref, appointmentsHref, funnelHref, portalApiOrigin, className, }: PortalAccountMarkerProps): React.ReactElement;
|
|
214
133
|
|
|
215
|
-
export {
|
|
134
|
+
export { PortalAccount as P, type PortalAccountMarkerProps as a, type PortalAccountProps as b, type PortalAccountSurface as c, PortalPanel as d, type PortalPanelMarkerProps as e, type PortalPanelProps as f, type PortalSurface as g };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { F as FetchLike } from './portal-client-my3q5GME.js';
|
|
3
|
+
import { b as PortalAccountProps } from './portal-account-DRJyr3nz.js';
|
|
3
4
|
|
|
4
5
|
type PortalAddress = {
|
|
5
6
|
id: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { F as FetchLike,
|
|
3
|
-
import { a as PortalAppointment, b as PortalAppointmentsBody } from './portal-account.client-
|
|
2
|
+
import { F as FetchLike, d as PortalResult } from './portal-client-my3q5GME.js';
|
|
3
|
+
import { a as PortalAppointment, b as PortalAppointmentsBody } from './portal-account.client-Bke4NsgW.js';
|
|
4
4
|
import '@patientos/public-sdk';
|
|
5
|
+
import './portal-account-DRJyr3nz.js';
|
|
5
6
|
|
|
6
7
|
/** One bookable instant, collapsing the practitioners free at the same time. */
|
|
7
8
|
interface TimeSlot {
|
|
@@ -22,7 +22,8 @@ import {
|
|
|
22
22
|
releasePortalHold,
|
|
23
23
|
rescheduleContextTypeId,
|
|
24
24
|
reschedulePortalAppointmentAndReload
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-3T7UWKAH.js";
|
|
26
|
+
import "./chunk-FZ4WKWIE.js";
|
|
26
27
|
import "./chunk-MLKGABMK.js";
|
|
27
28
|
export {
|
|
28
29
|
AVAILABILITY_FAILED_COPY,
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ApplicationRun } from '@patientos/public-sdk';
|
|
2
|
+
|
|
3
|
+
/** The injectable browser transport. */
|
|
4
|
+
type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
5
|
+
interface PortalClientConfig {
|
|
6
|
+
/** The validated app API origin, e.g. https://my.pocketdoc.com.au. */
|
|
7
|
+
apiOrigin?: string | null;
|
|
8
|
+
/** The app origin used only to verify whether relative portal API calls belong here. */
|
|
9
|
+
portalOrigin?: string | null;
|
|
10
|
+
/** Where to send a patient who cannot use the client at all. */
|
|
11
|
+
portalUrl?: string | null;
|
|
12
|
+
/** Injectable for tests. */
|
|
13
|
+
fetchImpl?: FetchLike;
|
|
14
|
+
}
|
|
15
|
+
/** Who the app says is signed in on this origin. */
|
|
16
|
+
type WhoAmI = {
|
|
17
|
+
signedIn: false;
|
|
18
|
+
} | {
|
|
19
|
+
signedIn: true;
|
|
20
|
+
givenName: string;
|
|
21
|
+
familyName: string;
|
|
22
|
+
email: string;
|
|
23
|
+
};
|
|
24
|
+
/** The patient's own details, for prefill. Every field is independently nullable. */
|
|
25
|
+
interface PortalPrefill {
|
|
26
|
+
givenName: string | null;
|
|
27
|
+
familyName: string | null;
|
|
28
|
+
email: string | null;
|
|
29
|
+
phone: string | null;
|
|
30
|
+
dateOfBirth: string | null;
|
|
31
|
+
}
|
|
32
|
+
/** A claim token minted for the signed-in patient's corroborated-identity path. */
|
|
33
|
+
interface PublicClaim {
|
|
34
|
+
contactId: string;
|
|
35
|
+
claimToken: string;
|
|
36
|
+
expiresAt: string;
|
|
37
|
+
}
|
|
38
|
+
/** A portal call is always a value, never a thrown transport failure. */
|
|
39
|
+
type PortalResult<T> = {
|
|
40
|
+
ok: true;
|
|
41
|
+
data: T;
|
|
42
|
+
} | {
|
|
43
|
+
ok: false;
|
|
44
|
+
status: number | null;
|
|
45
|
+
error: string | null;
|
|
46
|
+
body?: unknown;
|
|
47
|
+
};
|
|
48
|
+
interface PortalClient {
|
|
49
|
+
/** Whether this client can honestly offer an inline portal interaction. */
|
|
50
|
+
readonly available: boolean;
|
|
51
|
+
/** The validated app origin, or '' for relative same-origin calls. */
|
|
52
|
+
readonly apiOrigin: string;
|
|
53
|
+
/** The configured outbound fallback, or ''. */
|
|
54
|
+
readonly portalHref: string;
|
|
55
|
+
/** Resolve a constant path against this client's one configured origin. */
|
|
56
|
+
url(path: string): string;
|
|
57
|
+
/** The transport bound when this client was created; injectable for tests. */
|
|
58
|
+
readonly fetch: FetchLike;
|
|
59
|
+
/** Who is signed in; unhealthy/unavailable is indistinguishable from signed out. */
|
|
60
|
+
whoAmI(): Promise<WhoAmI>;
|
|
61
|
+
/** Ask for an oracle-free magic link. */
|
|
62
|
+
requestMagicLink(email: string, redirect?: string): Promise<boolean>;
|
|
63
|
+
/** Read the signed-in patient's details. */
|
|
64
|
+
prefill(): Promise<PortalPrefill | null>;
|
|
65
|
+
/** Mint a public claim only for the signed-in patient. */
|
|
66
|
+
mintPublicClaim(): Promise<PublicClaim | null>;
|
|
67
|
+
/** Redeem a single-use magic-link continuation after patient sign-in. */
|
|
68
|
+
redeemApplicationRunHandoff(handoffId: string): Promise<{
|
|
69
|
+
run: ApplicationRun;
|
|
70
|
+
capabilityToken: string;
|
|
71
|
+
} | null>;
|
|
72
|
+
/** Page callback, using the app-side return hop when cross-origin. */
|
|
73
|
+
returnPath(targetUrl?: string): string;
|
|
74
|
+
/** Back-compat account-surface transport; callers still use constant paths. */
|
|
75
|
+
get<T>(path: string): Promise<PortalResult<T>>;
|
|
76
|
+
/** Back-compat account-surface JSON write; callers still use constant paths. */
|
|
77
|
+
send<T>(path: string, method: 'POST' | 'PUT', body: unknown): Promise<PortalResult<T>>;
|
|
78
|
+
/** Back-compat account-surface body-less delete. */
|
|
79
|
+
delete<T>(path: string): Promise<PortalResult<T>>;
|
|
80
|
+
}
|
|
81
|
+
declare function createPortalClient(config?: PortalClientConfig): PortalClient;
|
|
82
|
+
|
|
83
|
+
export { type FetchLike as F, type PortalClient as P, type WhoAmI as W, type PortalPrefill as a, type PublicClaim as b, type PortalClientConfig as c, type PortalResult as d, createPortalClient as e };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/** `$12.50` — AUD, GST-inclusive, from the numeric(12,2) string the server sends. */
|
|
4
|
+
declare function formatMoney(value: string): string;
|
|
5
|
+
|
|
6
|
+
/** JSON-safe island configuration. Crosses the build→runtime boundary — see `./islands`. */
|
|
7
|
+
type StoreProps = {
|
|
8
|
+
/** Show one category only. Omitted ⇒ the whole published catalogue. */
|
|
9
|
+
categoryHandle?: string;
|
|
10
|
+
/** Show exactly one product by its stable handle. Takes precedence over category. */
|
|
11
|
+
productHandle?: string;
|
|
12
|
+
/** PatientOS patient/API origin. Omitted keeps the original same-origin contract. */
|
|
13
|
+
storeApiOrigin?: string;
|
|
14
|
+
/** Heading rendered above the grid. */
|
|
15
|
+
title?: string;
|
|
16
|
+
/** Grid columns at the widest breakpoint. */
|
|
17
|
+
columns?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Suppress the block's own inline `Cart (n)` link.
|
|
20
|
+
*
|
|
21
|
+
* For a site that already carries a persistent header cart (`<CartButton/>`) — two
|
|
22
|
+
* cart affordances on one screen is a worse shop, not a more helpful one.
|
|
23
|
+
*/
|
|
24
|
+
hideCartLink?: boolean;
|
|
25
|
+
};
|
|
26
|
+
/** Marker-only props: the island config plus presentation the page controls. */
|
|
27
|
+
type StoreMarkerProps = StoreProps & {
|
|
28
|
+
className?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* BUILD-TIME marker. Emits the mount point plus a static no-JS fallback — the catalogue
|
|
32
|
+
* itself is fetched at runtime (prices and stock must not be baked into a cached static
|
|
33
|
+
* artifact), so the fallback is a prompt, not a product list.
|
|
34
|
+
*/
|
|
35
|
+
declare function Store({ categoryHandle, productHandle, storeApiOrigin, title, columns, hideCartLink, className, }: StoreMarkerProps): React.ReactElement;
|
|
36
|
+
|
|
37
|
+
export { Store as S, type StoreMarkerProps as a, type StoreProps as b, formatMoney as f };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { F as FetchLike } from './portal-client-my3q5GME.js';
|
|
2
|
+
|
|
3
|
+
interface StoreClientConfig {
|
|
4
|
+
/** The validated PatientOS patient/API origin. Empty means same-origin. */
|
|
5
|
+
apiOrigin?: string | null;
|
|
6
|
+
/** Injectable browser transport for tests. */
|
|
7
|
+
fetchImpl?: FetchLike;
|
|
8
|
+
}
|
|
9
|
+
type StoreResult<T> = {
|
|
10
|
+
ok: true;
|
|
11
|
+
data: T;
|
|
12
|
+
} | {
|
|
13
|
+
ok: false;
|
|
14
|
+
status: number | null;
|
|
15
|
+
error: string | null;
|
|
16
|
+
message: string | null;
|
|
17
|
+
};
|
|
18
|
+
interface StoreClient {
|
|
19
|
+
readonly apiOrigin: string;
|
|
20
|
+
url(path: string): string;
|
|
21
|
+
get<T>(path: string): Promise<StoreResult<T>>;
|
|
22
|
+
post<T>(path: string, body: unknown, options?: {
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}): Promise<StoreResult<T>>;
|
|
25
|
+
/** PatientOS magic-link sign-in that returns to this site's checkout. */
|
|
26
|
+
signInHref(returnPath?: string): string;
|
|
27
|
+
}
|
|
28
|
+
declare function createStoreClient(config?: StoreClientConfig): StoreClient;
|
|
29
|
+
|
|
30
|
+
type StoreVariant = {
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
price: string;
|
|
34
|
+
options: string[];
|
|
35
|
+
inStock: boolean;
|
|
36
|
+
};
|
|
37
|
+
type StoreProduct = {
|
|
38
|
+
id: string;
|
|
39
|
+
handle: string;
|
|
40
|
+
title: string;
|
|
41
|
+
description: string | null;
|
|
42
|
+
thumbnailUrl: string | null;
|
|
43
|
+
images: {
|
|
44
|
+
url: string;
|
|
45
|
+
alt: string | null;
|
|
46
|
+
}[];
|
|
47
|
+
categories: {
|
|
48
|
+
handle: string;
|
|
49
|
+
name: string;
|
|
50
|
+
}[];
|
|
51
|
+
gstApplicable: boolean;
|
|
52
|
+
variants: StoreVariant[];
|
|
53
|
+
};
|
|
54
|
+
/** JSON-safe: this is what crosses a route loader into `StoreClient.initialCatalog`. */
|
|
55
|
+
type StoreCatalog = {
|
|
56
|
+
products: StoreProduct[];
|
|
57
|
+
currency: string;
|
|
58
|
+
};
|
|
59
|
+
/** What the two catalogue endpoints answer with. */
|
|
60
|
+
type StoreCatalogResponse = StoreCatalog | {
|
|
61
|
+
product: StoreProduct;
|
|
62
|
+
currency: string;
|
|
63
|
+
};
|
|
64
|
+
/** The exact path the store island reads. Kept here so a loader cannot drift from it. */
|
|
65
|
+
declare function storeCatalogPath(productHandle?: string): string;
|
|
66
|
+
/** Collapse the single-product response into the same shape as the whole catalogue. */
|
|
67
|
+
declare function normalizeCatalogResponse(data: StoreCatalogResponse): StoreCatalog;
|
|
68
|
+
/**
|
|
69
|
+
* Fetch the published catalogue — usable from a SERVER route loader or the browser.
|
|
70
|
+
*
|
|
71
|
+
* Returns `null` on any failure so a loader can render the store island with no seed
|
|
72
|
+
* (it falls back to its own client fetch) rather than failing the page.
|
|
73
|
+
*/
|
|
74
|
+
declare function fetchStoreCatalog(client: StoreClient, options?: {
|
|
75
|
+
productHandle?: string;
|
|
76
|
+
}): Promise<StoreCatalog | null>;
|
|
77
|
+
|
|
78
|
+
export { type StoreCatalog as S, type StoreCatalogResponse as a, type StoreClient as b, type StoreClientConfig as c, type StoreProduct as d, type StoreResult as e, type StoreVariant as f, createStoreClient as g, fetchStoreCatalog as h, normalizeCatalogResponse as n, storeCatalogPath as s };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { S as StoreCatalog, a as StoreCatalogResponse, d as StoreProduct, f as StoreVariant, h as fetchStoreCatalog, n as normalizeCatalogResponse, s as storeCatalogPath } from './store-catalog-p7TFOpfk.js';
|
|
2
|
+
import './portal-client-my3q5GME.js';
|
|
3
|
+
import '@patientos/public-sdk';
|