@patientos/website-kit 0.2.5 → 0.2.7

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.
Files changed (43) hide show
  1. package/README.md +86 -0
  2. package/dist/{checkout-block-Cog4H4I4.d.ts → booking-block-D-UOAPx3.d.ts} +1 -49
  3. package/dist/cart-block-B-ytc9us.d.ts +20 -0
  4. package/dist/cart-button-BCLFittB.d.ts +24 -0
  5. package/dist/cart-storage.d.ts +110 -0
  6. package/dist/cart-storage.js +39 -0
  7. package/dist/checkout-block-BeXwpqYe.d.ts +24 -0
  8. package/dist/chunk-2CZFJOKK.js +79 -0
  9. package/dist/{chunk-FSZ726DM.js → chunk-3T7UWKAH.js} +4 -308
  10. package/dist/{chunk-75FJ5AJB.js → chunk-4GKSSM5N.js} +578 -1608
  11. package/dist/chunk-4NF7SSIX.js +367 -0
  12. package/dist/chunk-673YEXAI.js +164 -0
  13. package/dist/chunk-7BUDUYXN.js +80 -0
  14. package/dist/chunk-FZ4WKWIE.js +310 -0
  15. package/dist/{chunk-7UPUEMXX.js → chunk-HYXTDUP2.js} +20 -5
  16. package/dist/chunk-IOC6QLB7.js +159 -0
  17. package/dist/chunk-S3ZQQOQT.js +2057 -0
  18. package/dist/chunk-WQSJ46TP.js +19 -0
  19. package/dist/chunk-ZNH6TSYP.js +167 -0
  20. package/dist/index.d.ts +11 -4
  21. package/dist/index.js +120 -33
  22. package/dist/islands-impl/cart-button.d.ts +19 -0
  23. package/dist/islands-impl/cart-button.js +13 -0
  24. package/dist/islands-impl/cart.d.ts +31 -0
  25. package/dist/islands-impl/cart.js +11 -0
  26. package/dist/islands-impl/checkout.d.ts +6 -0
  27. package/dist/islands-impl/checkout.js +13 -0
  28. package/dist/islands-impl/store.d.ts +22 -0
  29. package/dist/islands-impl/store.js +14 -0
  30. package/dist/islands-impl.d.ts +14 -10
  31. package/dist/islands-impl.js +22 -7
  32. package/dist/islands-registry.js +13 -4
  33. package/dist/{portal-account-8uQc_Ncx.d.ts → portal-account-DRJyr3nz.d.ts} +1 -82
  34. package/dist/{portal-account.client-BBe_q9yC.d.ts → portal-account.client-Bke4NsgW.d.ts} +2 -1
  35. package/dist/portal-booking-client.d.ts +3 -2
  36. package/dist/portal-booking-client.js +2 -1
  37. package/dist/portal-client-my3q5GME.d.ts +83 -0
  38. package/dist/store-block-CFxnsfKU.d.ts +37 -0
  39. package/dist/store-catalog-p7TFOpfk.d.ts +78 -0
  40. package/dist/store-catalog.d.ts +3 -0
  41. package/dist/store-catalog.js +11 -0
  42. package/dist/website-kit.css +196 -1
  43. package/package.json +31 -1
@@ -0,0 +1,19 @@
1
+ // src/store-catalog.ts
2
+ function storeCatalogPath(productHandle) {
3
+ return productHandle ? `/api/store/catalog/${encodeURIComponent(productHandle)}` : "/api/store/catalog";
4
+ }
5
+ function normalizeCatalogResponse(data) {
6
+ return "product" in data ? { products: [data.product], currency: data.currency } : data;
7
+ }
8
+ async function fetchStoreCatalog(client, options = {}) {
9
+ const result = await client.get(
10
+ storeCatalogPath(options.productHandle)
11
+ );
12
+ return result.ok ? normalizeCatalogResponse(result.data) : null;
13
+ }
14
+
15
+ export {
16
+ storeCatalogPath,
17
+ normalizeCatalogResponse,
18
+ fetchStoreCatalog
19
+ };
@@ -0,0 +1,167 @@
1
+ import {
2
+ CartLineList,
3
+ CartProblemList,
4
+ CartTotals,
5
+ UnsupportedCartLineList,
6
+ quoteSourceQuantities,
7
+ useCartQuote
8
+ } from "./chunk-IOC6QLB7.js";
9
+ import {
10
+ createStoreClient
11
+ } from "./chunk-7BUDUYXN.js";
12
+ import {
13
+ cartItemCount,
14
+ readCart,
15
+ subscribeToCart
16
+ } from "./chunk-4NF7SSIX.js";
17
+
18
+ // src/cart-button.client.tsx
19
+ import * as React from "react";
20
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
21
+ var EMPTY_CART = { v: 1, lines: [] };
22
+ function CartButtonClient({
23
+ storeApiOrigin,
24
+ label,
25
+ cartHref,
26
+ checkoutHref
27
+ }) {
28
+ const [count, setCount] = React.useState(0);
29
+ const [open, setOpen] = React.useState(false);
30
+ React.useEffect(() => {
31
+ setCount(cartItemCount(readCart()));
32
+ return subscribeToCart((cart) => setCount(cartItemCount(cart)));
33
+ }, []);
34
+ const text = label ?? "Cart";
35
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
36
+ /* @__PURE__ */ jsxs(
37
+ "button",
38
+ {
39
+ type: "button",
40
+ className: "sk-cart-button__trigger",
41
+ "aria-expanded": open,
42
+ "aria-haspopup": "dialog",
43
+ "aria-label": count > 0 ? `${text} \u2014 ${count} item${count === 1 ? "" : "s"}` : text,
44
+ onClick: () => setOpen((wasOpen) => !wasOpen),
45
+ children: [
46
+ /* @__PURE__ */ jsx("span", { className: "sk-cart-button__label", children: text }),
47
+ count > 0 ? /* @__PURE__ */ jsx("span", { className: "sk-cart-button__badge", "aria-hidden": true, children: count > 99 ? "99+" : count }) : null
48
+ ]
49
+ }
50
+ ),
51
+ /* @__PURE__ */ jsx(
52
+ CartDrawer,
53
+ {
54
+ open,
55
+ onClose: () => setOpen(false),
56
+ storeApiOrigin,
57
+ cartHref,
58
+ checkoutHref
59
+ }
60
+ )
61
+ ] });
62
+ }
63
+ function CartDrawer({
64
+ open,
65
+ onClose,
66
+ storeApiOrigin,
67
+ cartHref,
68
+ checkoutHref
69
+ }) {
70
+ const client = React.useMemo(
71
+ () => createStoreClient({ apiOrigin: storeApiOrigin }),
72
+ [storeApiOrigin]
73
+ );
74
+ const [cart, setCart] = React.useState(EMPTY_CART);
75
+ const [mutationUnavailable, setMutationUnavailable] = React.useState(false);
76
+ const closeRef = React.useRef(null);
77
+ React.useEffect(() => {
78
+ setCart(readCart());
79
+ return subscribeToCart(setCart);
80
+ }, []);
81
+ React.useEffect(() => {
82
+ if (!open) return;
83
+ closeRef.current?.focus();
84
+ const onKeyDown = (event) => {
85
+ if (event.key === "Escape") onClose();
86
+ };
87
+ window.addEventListener("keydown", onKeyDown);
88
+ return () => window.removeEventListener("keydown", onKeyDown);
89
+ }, [open, onClose]);
90
+ const { quote, quoteSourceCart, failed } = useCartQuote(client, cart, open);
91
+ async function runMutation(mutation) {
92
+ const result = await mutation;
93
+ setMutationUnavailable(result.status === "cart_storage_unavailable");
94
+ }
95
+ if (!open) return null;
96
+ const quotedVariantIds = new Set(quote?.lines.map((l) => l.variantId) ?? []);
97
+ const unsupportedLines = cart.lines.filter(
98
+ (line) => line.kind !== "retail" || quote !== null && !quotedVariantIds.has(line.variantId)
99
+ );
100
+ return /* @__PURE__ */ jsxs("div", { className: "sk-cart-drawer", children: [
101
+ /* @__PURE__ */ jsx(
102
+ "div",
103
+ {
104
+ className: "sk-cart-drawer__scrim",
105
+ onClick: onClose,
106
+ "aria-hidden": true
107
+ }
108
+ ),
109
+ /* @__PURE__ */ jsxs(
110
+ "aside",
111
+ {
112
+ className: "sk-cart-drawer__panel",
113
+ role: "dialog",
114
+ "aria-modal": "true",
115
+ "aria-label": "Your cart",
116
+ children: [
117
+ /* @__PURE__ */ jsxs("div", { className: "sk-cart-drawer__head", children: [
118
+ /* @__PURE__ */ jsx("h2", { className: "sk-cart__heading", children: "Your cart" }),
119
+ /* @__PURE__ */ jsx(
120
+ "button",
121
+ {
122
+ type: "button",
123
+ ref: closeRef,
124
+ className: "sk-cart-drawer__close",
125
+ onClick: onClose,
126
+ children: "Close"
127
+ }
128
+ )
129
+ ] }),
130
+ /* @__PURE__ */ jsx("div", { className: "sk-cart-drawer__body", children: cart.lines.length === 0 ? /* @__PURE__ */ jsx("p", { className: "sk-cart__placeholder", role: "status", children: "Your cart is empty." }) : /* @__PURE__ */ jsxs(Fragment, { children: [
131
+ quote ? /* @__PURE__ */ jsx(CartProblemList, { problems: quote.problems }) : null,
132
+ failed ? /* @__PURE__ */ jsx("p", { className: "sk-cart__placeholder", role: "alert", children: "We couldn't price your cart just now. Please try again in a moment." }) : null,
133
+ mutationUnavailable ? /* @__PURE__ */ jsx("p", { className: "sk-cart__placeholder", role: "alert", children: "This browser can\u2019t safely update the cart. Try a supported browser with site storage enabled." }) : null,
134
+ /* @__PURE__ */ jsx(
135
+ UnsupportedCartLineList,
136
+ {
137
+ lines: unsupportedLines,
138
+ onMutate: (m) => void runMutation(m)
139
+ }
140
+ ),
141
+ quote ? /* @__PURE__ */ jsxs(Fragment, { children: [
142
+ /* @__PURE__ */ jsx(
143
+ CartLineList,
144
+ {
145
+ lines: quote.lines,
146
+ sourceQuantities: quoteSourceQuantities(quoteSourceCart),
147
+ onMutate: (m) => void runMutation(m)
148
+ }
149
+ ),
150
+ /* @__PURE__ */ jsx(CartTotals, { quote }),
151
+ quote.requiresShipping ? /* @__PURE__ */ jsx("p", { className: "sk-cart__note", children: "Delivery details are confirmed at checkout." }) : null
152
+ ] }) : failed ? null : /* @__PURE__ */ jsx("p", { className: "sk-cart__placeholder", role: "status", children: "Pricing your cart\u2026" })
153
+ ] }) }),
154
+ /* @__PURE__ */ jsxs("div", { className: "sk-cart-drawer__foot", children: [
155
+ /* @__PURE__ */ jsx("a", { className: "sk-cart__continue", href: cartHref ?? "/cart", children: "View cart" }),
156
+ quote && quote.lines.length > 0 && unsupportedLines.length === 0 ? /* @__PURE__ */ jsx("a", { className: "sk-cart__checkout", href: checkoutHref ?? "/checkout", children: "Checkout" }) : null
157
+ ] })
158
+ ]
159
+ }
160
+ )
161
+ ] });
162
+ }
163
+
164
+ export {
165
+ CartButtonClient,
166
+ CartDrawer
167
+ };
package/dist/index.d.ts CHANGED
@@ -2,9 +2,16 @@ export { BPOINT_SCRIPT_ORIGIN, BPOINT_SCRIPT_URL, CONSULT_CHUNK_PATH, THIRD_PART
2
2
  import * as React from 'react';
3
3
  export { ISLAND_ATTR, ISLAND_PROPS_ATTR, Island, IslandProps, IslandRegistry, mountIslandsWith, readIslandProps } from './islands.js';
4
4
  export { ISLANDS, IslandName, mountIslands } from './islands-registry.js';
5
- import { P as PortalClient, W as WhoAmI, a as PortalPrefill, b as PublicClaim } from './portal-account-8uQc_Ncx.js';
6
- export { F as FetchLike, c as PortalAccount, d as PortalAccountMarkerProps, e as PortalAccountProps, f as PortalAccountSurface, g as PortalClientConfig, h as PortalPanel, i as PortalPanelMarkerProps, j as PortalPanelProps, k as PortalResult, l as PortalSurface, m as createPortalClient } from './portal-account-8uQc_Ncx.js';
7
- export { B as BookingBlock, a as BookingBlockMarkerProps, b as BookingBlockProps, c as BookingTypeOption, C as Cart, d as CartMarkerProps, e as CartProps, f as CertificateFunnel, g as CertificateFunnelMarkerProps, h as CertificateFunnelProps, i as Checkout, j as CheckoutMarkerProps, k as CheckoutProps, F as FunnelPublicApi, l as FunnelServiceOption, S as Store, m as StoreMarkerProps, n as StoreProps } from './checkout-block-Cog4H4I4.js';
5
+ import { P as PortalClient, W as WhoAmI, a as PortalPrefill, b as PublicClaim } from './portal-client-my3q5GME.js';
6
+ export { F as FetchLike, c as PortalClientConfig, d as PortalResult, e as createPortalClient } from './portal-client-my3q5GME.js';
7
+ export { S as StoreCatalog, a as StoreCatalogResponse, b as StoreClient, c as StoreClientConfig, d as StoreProduct, e as StoreResult, f as StoreVariant, g as createStoreClient, h as fetchStoreCatalog, n as normalizeCatalogResponse, s as storeCatalogPath } from './store-catalog-p7TFOpfk.js';
8
+ export { CartLine, CartLineKind, CartMutationResult, Cart as StoredCart, addToCart, adjustCartQuantity, cartItemCount, cartToWireLines, clearCart, mutateCart, readCart, removeFromCart, setCartQuantity, subscribeToCart } from './cart-storage.js';
9
+ export { S as Store, a as StoreMarkerProps, b as StoreProps, f as formatMoney } from './store-block-CFxnsfKU.js';
10
+ export { B as BookingBlock, a as BookingBlockMarkerProps, b as BookingBlockProps, c as BookingTypeOption, C as CertificateFunnel, d as CertificateFunnelMarkerProps, e as CertificateFunnelProps, F as FunnelPublicApi, f as FunnelServiceOption } from './booking-block-D-UOAPx3.js';
11
+ export { P as PortalAccount, a as PortalAccountMarkerProps, b as PortalAccountProps, c as PortalAccountSurface, d as PortalPanel, e as PortalPanelMarkerProps, f as PortalPanelProps, g as PortalSurface } from './portal-account-DRJyr3nz.js';
12
+ export { C as Cart, a as CartMarkerProps, b as CartProps } from './cart-block-B-ytc9us.js';
13
+ export { C as CartButton, a as CartButtonMarkerProps, b as CartButtonProps } from './cart-button-BCLFittB.js';
14
+ export { C as Checkout, a as CheckoutMarkerProps, b as CheckoutProps } from './checkout-block-BeXwpqYe.js';
8
15
  export { PatientSurfaceTheme, patientSurfaceTheme } from './patient-surface-theme.js';
9
16
  export { Rgb, contrastRatio, deriveForeground, parseHexColor, relativeLuminance } from './contrast.js';
10
17
  export { AnswerValue, Answers, ShowWhenCondition, evaluateShowWhen, visibleQuestions } from './show-when.js';
@@ -210,6 +217,6 @@ interface PortalSession {
210
217
  */
211
218
  declare function usePortalSession(): PortalSession;
212
219
 
213
- declare const WEBSITE_KIT_VERSION = "0.1.0";
220
+ declare const WEBSITE_KIT_VERSION = "0.2.7";
214
221
 
215
222
  export { Button, type ButtonProps, type ButtonVariant, Container, type ContainerProps, FAQ, type FAQProps, type FaqItem, Hero, type HeroProps, Hours, type HoursProps, type HoursRow, MapEmbed, type MapEmbedProps, PortalClient, PortalPrefill, PortalProvider, type PortalProviderProps, type PortalSession, type PortalSessionStatus, PublicClaim, Row, type RowProps, Section, type SectionProps, type Service, ServiceGrid, type ServiceGridProps, Stack, type StackProps, TeamGrid, type TeamGridProps, type TeamMember, ThemeProvider, type ThemeProviderProps, WEBSITE_KIT_VERSION, WebsiteShell, type WebsiteShellProps, type WebsiteTheme, WhoAmI, defaultTheme, resolveTheme, themeToCssVars, usePortalClient, usePortalSession };
package/dist/index.js CHANGED
@@ -1,7 +1,17 @@
1
+ import {
2
+ contrastRatio,
3
+ deriveForeground,
4
+ derivePrimaryPair,
5
+ parseHexColor,
6
+ relativeLuminance
7
+ } from "./chunk-LCHW6XF4.js";
8
+ import {
9
+ patientSurfaceTheme
10
+ } from "./chunk-JTZ6GYA7.js";
1
11
  import {
2
12
  ISLANDS,
3
13
  mountIslands
4
- } from "./chunk-7UPUEMXX.js";
14
+ } from "./chunk-HYXTDUP2.js";
5
15
  import {
6
16
  PortalAccount,
7
17
  PortalPanel,
@@ -13,15 +23,8 @@ import {
13
23
  getThemeTokens,
14
24
  usePortalClient,
15
25
  usePortalSession
16
- } from "./chunk-75FJ5AJB.js";
17
- import {
18
- BPOINT_SCRIPT_ORIGIN,
19
- BPOINT_SCRIPT_URL,
20
- CONSULT_CHUNK_PATH,
21
- THIRD_PARTY_SCRIPT_ORIGINS,
22
- TURNSTILE_SCRIPT_ORIGIN,
23
- TURNSTILE_SCRIPT_URL
24
- } from "./chunk-ZOF22TJA.js";
26
+ } from "./chunk-4GKSSM5N.js";
27
+ import "./chunk-3T7UWKAH.js";
25
28
  import {
26
29
  evaluateShowWhen,
27
30
  visibleQuestions
@@ -33,19 +36,43 @@ import {
33
36
  mountIslandsWith,
34
37
  readIslandProps
35
38
  } from "./chunk-THMT43MV.js";
39
+ import "./chunk-2CZFJOKK.js";
40
+ import "./chunk-ZNH6TSYP.js";
41
+ import "./chunk-IOC6QLB7.js";
42
+ import "./chunk-S3ZQQOQT.js";
36
43
  import {
37
- createPortalClient
38
- } from "./chunk-FSZ726DM.js";
44
+ BPOINT_SCRIPT_ORIGIN,
45
+ BPOINT_SCRIPT_URL,
46
+ CONSULT_CHUNK_PATH,
47
+ THIRD_PARTY_SCRIPT_ORIGINS,
48
+ TURNSTILE_SCRIPT_ORIGIN,
49
+ TURNSTILE_SCRIPT_URL
50
+ } from "./chunk-ZOF22TJA.js";
51
+ import "./chunk-673YEXAI.js";
39
52
  import {
40
- contrastRatio,
41
- deriveForeground,
42
- derivePrimaryPair,
43
- parseHexColor,
44
- relativeLuminance
45
- } from "./chunk-LCHW6XF4.js";
53
+ fetchStoreCatalog,
54
+ normalizeCatalogResponse,
55
+ storeCatalogPath
56
+ } from "./chunk-WQSJ46TP.js";
46
57
  import {
47
- patientSurfaceTheme
48
- } from "./chunk-JTZ6GYA7.js";
58
+ createStoreClient,
59
+ formatMoney
60
+ } from "./chunk-7BUDUYXN.js";
61
+ import {
62
+ addToCart,
63
+ adjustCartQuantity,
64
+ cartItemCount,
65
+ cartToWireLines,
66
+ clearCart,
67
+ mutateCart,
68
+ readCart,
69
+ removeFromCart,
70
+ setCartQuantity,
71
+ subscribeToCart
72
+ } from "./chunk-4NF7SSIX.js";
73
+ import {
74
+ createPortalClient
75
+ } from "./chunk-FZ4WKWIE.js";
49
76
  import "./chunk-MLKGABMK.js";
50
77
 
51
78
  // src/tokens.tsx
@@ -403,15 +430,18 @@ function BookingBlock({
403
430
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
404
431
  function Store({
405
432
  categoryHandle,
433
+ productHandle,
434
+ storeApiOrigin,
406
435
  title,
407
436
  columns,
437
+ hideCartLink,
408
438
  className
409
439
  }) {
410
440
  return /* @__PURE__ */ jsxs5(
411
441
  Island,
412
442
  {
413
443
  name: "store",
414
- props: { categoryHandle, title, columns },
444
+ props: { categoryHandle, productHandle, storeApiOrigin, title, columns, hideCartLink },
415
445
  className: ["sk-store", className].filter(Boolean).join(" "),
416
446
  children: [
417
447
  /* @__PURE__ */ jsx6("h2", { className: "sk-store__heading", children: title ?? "Shop" }),
@@ -423,24 +453,65 @@ function Store({
423
453
 
424
454
  // src/cart-block.tsx
425
455
  import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
426
- function Cart({ className }) {
427
- return /* @__PURE__ */ jsxs6(Island, { name: "cart", className: ["sk-cart", className].filter(Boolean).join(" "), children: [
428
- /* @__PURE__ */ jsx7("h2", { className: "sk-cart__heading", children: "Your cart" }),
429
- /* @__PURE__ */ jsx7("p", { className: "sk-cart__placeholder", children: "Your cart needs JavaScript to load." })
430
- ] });
456
+ function Cart({ storeApiOrigin, className }) {
457
+ return /* @__PURE__ */ jsxs6(
458
+ Island,
459
+ {
460
+ name: "cart",
461
+ props: { storeApiOrigin },
462
+ className: ["sk-cart", className].filter(Boolean).join(" "),
463
+ children: [
464
+ /* @__PURE__ */ jsx7("h2", { className: "sk-cart__heading", children: "Your cart" }),
465
+ /* @__PURE__ */ jsx7("p", { className: "sk-cart__placeholder", children: "Your cart needs JavaScript to load." })
466
+ ]
467
+ }
468
+ );
469
+ }
470
+
471
+ // src/cart-button.tsx
472
+ import { jsx as jsx8 } from "react/jsx-runtime";
473
+ function CartButton({
474
+ storeApiOrigin,
475
+ label,
476
+ cartHref,
477
+ checkoutHref,
478
+ className
479
+ }) {
480
+ return /* @__PURE__ */ jsx8(
481
+ Island,
482
+ {
483
+ name: "cart-button",
484
+ props: { storeApiOrigin, label, cartHref, checkoutHref },
485
+ className: ["sk-cart-button", className].filter(Boolean).join(" "),
486
+ children: /* @__PURE__ */ jsx8("a", { className: "sk-cart-button__trigger", href: cartHref ?? "/cart", children: label ?? "Cart" })
487
+ }
488
+ );
431
489
  }
432
490
 
433
491
  // src/checkout-block.tsx
434
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
435
- function Checkout({ className }) {
436
- return /* @__PURE__ */ jsxs7(Island, { name: "checkout", className: ["sk-checkout", className].filter(Boolean).join(" "), children: [
437
- /* @__PURE__ */ jsx8("h2", { className: "sk-checkout__heading", children: "Checkout" }),
438
- /* @__PURE__ */ jsx8("p", { className: "sk-checkout__placeholder", children: "Checkout needs JavaScript to load." })
439
- ] });
492
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
493
+ function Checkout({
494
+ storeApiOrigin,
495
+ ordersHref,
496
+ completionHref,
497
+ className
498
+ }) {
499
+ return /* @__PURE__ */ jsxs7(
500
+ Island,
501
+ {
502
+ name: "checkout",
503
+ props: { storeApiOrigin, ordersHref, completionHref },
504
+ className: ["sk-checkout", className].filter(Boolean).join(" "),
505
+ children: [
506
+ /* @__PURE__ */ jsx9("h2", { className: "sk-checkout__heading", children: "Checkout" }),
507
+ /* @__PURE__ */ jsx9("p", { className: "sk-checkout__placeholder", children: "Checkout needs JavaScript to load." })
508
+ ]
509
+ }
510
+ );
440
511
  }
441
512
 
442
513
  // src/index.ts
443
- var WEBSITE_KIT_VERSION = "0.1.0";
514
+ var WEBSITE_KIT_VERSION = "0.2.7";
444
515
  export {
445
516
  BPOINT_SCRIPT_ORIGIN,
446
517
  BPOINT_SCRIPT_URL,
@@ -448,6 +519,7 @@ export {
448
519
  Button,
449
520
  CONSULT_CHUNK_PATH,
450
521
  Cart,
522
+ CartButton,
451
523
  CertificateFunnel,
452
524
  Checkout,
453
525
  Container,
@@ -474,18 +546,33 @@ export {
474
546
  ThemeProvider,
475
547
  WEBSITE_KIT_VERSION,
476
548
  WebsiteShell,
549
+ addToCart,
550
+ adjustCartQuantity,
551
+ cartItemCount,
552
+ cartToWireLines,
553
+ clearCart,
477
554
  contrastRatio,
478
555
  createPortalClient,
556
+ createStoreClient,
479
557
  defaultTheme,
480
558
  deriveForeground,
481
559
  evaluateShowWhen,
560
+ fetchStoreCatalog,
561
+ formatMoney,
482
562
  mountIslands,
483
563
  mountIslandsWith,
564
+ mutateCart,
565
+ normalizeCatalogResponse,
484
566
  parseHexColor,
485
567
  patientSurfaceTheme,
568
+ readCart,
486
569
  readIslandProps,
487
570
  relativeLuminance,
571
+ removeFromCart,
488
572
  resolveTheme,
573
+ setCartQuantity,
574
+ storeCatalogPath,
575
+ subscribeToCart,
489
576
  themeToCssVars,
490
577
  usePortalClient,
491
578
  usePortalSession,
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import { b as CartButtonProps } from '../cart-button-BCLFittB.js';
3
+
4
+ declare function CartButtonClient({ storeApiOrigin, label, cartHref, checkoutHref, }: CartButtonProps): React.ReactElement;
5
+ type CartDrawerProps = {
6
+ open: boolean;
7
+ onClose: () => void;
8
+ /** PatientOS patient/API origin. Omitted keeps the same-origin contract. */
9
+ storeApiOrigin?: string;
10
+ cartHref?: string;
11
+ checkoutHref?: string;
12
+ };
13
+ /**
14
+ * The slide-over cart. Mounted always, INERT until `open` — that is what keeps the
15
+ * quote request lazy while still letting the hooks run unconditionally.
16
+ */
17
+ declare function CartDrawer({ open, onClose, storeApiOrigin, cartHref, checkoutHref, }: CartDrawerProps): React.ReactElement | null;
18
+
19
+ export { CartButtonClient, CartDrawer, type CartDrawerProps };
@@ -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,11 @@
1
+ import {
2
+ CartClient
3
+ } from "../chunk-2CZFJOKK.js";
4
+ import "../chunk-IOC6QLB7.js";
5
+ import "../chunk-7BUDUYXN.js";
6
+ import "../chunk-4NF7SSIX.js";
7
+ import "../chunk-FZ4WKWIE.js";
8
+ import "../chunk-MLKGABMK.js";
9
+ export {
10
+ CartClient
11
+ };
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import { b as CheckoutProps } from '../checkout-block-BeXwpqYe.js';
3
+
4
+ declare function CheckoutClient({ storeApiOrigin, ordersHref, completionHref, }: CheckoutProps): React.ReactElement;
5
+
6
+ export { CheckoutClient };
@@ -0,0 +1,13 @@
1
+ import {
2
+ CheckoutClient
3
+ } from "../chunk-S3ZQQOQT.js";
4
+ import "../chunk-ZOF22TJA.js";
5
+ import "../chunk-673YEXAI.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,22 @@
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
+ declare function StoreClient({ categoryHandle, productHandle, storeApiOrigin, title, columns, hideCartLink, initialCatalog, }: StoreClientProps): React.ReactElement;
21
+
22
+ export { StoreClient, type StoreClientProps };
@@ -0,0 +1,14 @@
1
+ import {
2
+ StoreClient
3
+ } from "../chunk-673YEXAI.js";
4
+ import "../chunk-WQSJ46TP.js";
5
+ import {
6
+ formatMoney
7
+ } from "../chunk-7BUDUYXN.js";
8
+ import "../chunk-4NF7SSIX.js";
9
+ import "../chunk-FZ4WKWIE.js";
10
+ import "../chunk-MLKGABMK.js";
11
+ export {
12
+ StoreClient,
13
+ formatMoney
14
+ };
@@ -1,8 +1,18 @@
1
1
  import * as React from 'react';
2
- import { b as BookingBlockProps, h as CertificateFunnelProps, n as StoreProps, e as CartProps, k as CheckoutProps } from './checkout-block-Cog4H4I4.js';
3
- import { j as PortalPanelProps, F as FetchLike } from './portal-account-8uQc_Ncx.js';
4
- export { P as PortalAccountClient } from './portal-account.client-BBe_q9yC.js';
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
- declare function StoreClient({ categoryHandle, title, columns }: StoreProps): React.ReactElement;
63
-
64
- declare function CartClient(_props: CartProps): React.ReactElement;
65
-
66
- declare function CheckoutClient(_props: CheckoutProps): React.ReactElement;
67
-
68
- export { BookingBlockClient, CartClient, CertificateFunnelClient, CheckoutClient, PortalPanelClient, StoreClient };
72
+ export { BookingBlockClient, CertificateFunnelClient, PortalPanelClient };
@@ -1,19 +1,34 @@
1
1
  import {
2
2
  BookingBlockClient,
3
- CartClient,
4
3
  CertificateFunnelClient,
5
- CheckoutClient,
6
4
  PortalAccountClient,
7
- PortalPanelClient,
8
- StoreClient
9
- } from "./chunk-75FJ5AJB.js";
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 "./chunk-FSZ726DM.js";
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-673YEXAI.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,