@patientos/website-kit 0.2.5 → 0.2.6

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.
@@ -1460,6 +1460,8 @@ export {
1460
1460
  FlowErrorSummary,
1461
1461
  focusField,
1462
1462
  FlowLoading,
1463
+ normalizePortalApiOrigin,
1464
+ encodePortalReturnTarget,
1463
1465
  createPortalClient,
1464
1466
  PatientOSApiError,
1465
1467
  patientos,
@@ -6,7 +6,7 @@ import {
6
6
  PortalAccountClient,
7
7
  PortalPanelClient,
8
8
  StoreClient
9
- } from "./chunk-75FJ5AJB.js";
9
+ } from "./chunk-7ZOQ6UKG.js";
10
10
  import {
11
11
  mountIslandsWith
12
12
  } from "./chunk-THMT43MV.js";
package/dist/index.d.ts CHANGED
@@ -2,9 +2,9 @@ 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, F as FetchLike } from './portal-account-8uQc_Ncx.js';
6
+ export { 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-BdpPIuQ5.js';
8
8
  export { PatientSurfaceTheme, patientSurfaceTheme } from './patient-surface-theme.js';
9
9
  export { Rgb, contrastRatio, deriveForeground, parseHexColor, relativeLuminance } from './contrast.js';
10
10
  export { AnswerValue, Answers, ShowWhenCondition, evaluateShowWhen, visibleQuestions } from './show-when.js';
@@ -210,6 +210,33 @@ interface PortalSession {
210
210
  */
211
211
  declare function usePortalSession(): PortalSession;
212
212
 
213
+ interface StoreClientConfig {
214
+ /** The validated PatientOS patient/API origin. Empty means same-origin. */
215
+ apiOrigin?: string | null;
216
+ /** Injectable browser transport for tests. */
217
+ fetchImpl?: FetchLike;
218
+ }
219
+ type StoreResult<T> = {
220
+ ok: true;
221
+ data: T;
222
+ } | {
223
+ ok: false;
224
+ status: number | null;
225
+ error: string | null;
226
+ message: string | null;
227
+ };
228
+ interface StoreClient {
229
+ readonly apiOrigin: string;
230
+ url(path: string): string;
231
+ get<T>(path: string): Promise<StoreResult<T>>;
232
+ post<T>(path: string, body: unknown, options?: {
233
+ signal?: AbortSignal;
234
+ }): Promise<StoreResult<T>>;
235
+ /** PatientOS magic-link sign-in that returns to this site's checkout. */
236
+ signInHref(returnPath?: string): string;
237
+ }
238
+ declare function createStoreClient(config?: StoreClientConfig): StoreClient;
239
+
213
240
  declare const WEBSITE_KIT_VERSION = "0.1.0";
214
241
 
215
- 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 };
242
+ export { Button, type ButtonProps, type ButtonVariant, Container, type ContainerProps, FAQ, type FAQProps, type FaqItem, FetchLike, 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, type StoreClient, type StoreClientConfig, type StoreResult, TeamGrid, type TeamGridProps, type TeamMember, ThemeProvider, type ThemeProviderProps, WEBSITE_KIT_VERSION, WebsiteShell, type WebsiteShellProps, type WebsiteTheme, WhoAmI, createStoreClient, defaultTheme, resolveTheme, themeToCssVars, usePortalClient, usePortalSession };
package/dist/index.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  ISLANDS,
3
3
  mountIslands
4
- } from "./chunk-7UPUEMXX.js";
4
+ } from "./chunk-ZZFBTLR4.js";
5
5
  import {
6
6
  PortalAccount,
7
7
  PortalPanel,
8
8
  PortalProvider,
9
+ createStoreClient,
9
10
  getAppointmentTypes,
10
11
  getClinic,
11
12
  getPublicApi,
@@ -13,7 +14,7 @@ import {
13
14
  getThemeTokens,
14
15
  usePortalClient,
15
16
  usePortalSession
16
- } from "./chunk-75FJ5AJB.js";
17
+ } from "./chunk-7ZOQ6UKG.js";
17
18
  import {
18
19
  BPOINT_SCRIPT_ORIGIN,
19
20
  BPOINT_SCRIPT_URL,
@@ -35,7 +36,7 @@ import {
35
36
  } from "./chunk-THMT43MV.js";
36
37
  import {
37
38
  createPortalClient
38
- } from "./chunk-FSZ726DM.js";
39
+ } from "./chunk-ZYX4TXBN.js";
39
40
  import {
40
41
  contrastRatio,
41
42
  deriveForeground,
@@ -403,6 +404,8 @@ function BookingBlock({
403
404
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
404
405
  function Store({
405
406
  categoryHandle,
407
+ productHandle,
408
+ storeApiOrigin,
406
409
  title,
407
410
  columns,
408
411
  className
@@ -411,7 +414,7 @@ function Store({
411
414
  Island,
412
415
  {
413
416
  name: "store",
414
- props: { categoryHandle, title, columns },
417
+ props: { categoryHandle, productHandle, storeApiOrigin, title, columns },
415
418
  className: ["sk-store", className].filter(Boolean).join(" "),
416
419
  children: [
417
420
  /* @__PURE__ */ jsx6("h2", { className: "sk-store__heading", children: title ?? "Shop" }),
@@ -423,20 +426,41 @@ function Store({
423
426
 
424
427
  // src/cart-block.tsx
425
428
  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
- ] });
429
+ function Cart({ storeApiOrigin, className }) {
430
+ return /* @__PURE__ */ jsxs6(
431
+ Island,
432
+ {
433
+ name: "cart",
434
+ props: { storeApiOrigin },
435
+ className: ["sk-cart", className].filter(Boolean).join(" "),
436
+ children: [
437
+ /* @__PURE__ */ jsx7("h2", { className: "sk-cart__heading", children: "Your cart" }),
438
+ /* @__PURE__ */ jsx7("p", { className: "sk-cart__placeholder", children: "Your cart needs JavaScript to load." })
439
+ ]
440
+ }
441
+ );
431
442
  }
432
443
 
433
444
  // src/checkout-block.tsx
434
445
  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
- ] });
446
+ function Checkout({
447
+ storeApiOrigin,
448
+ ordersHref,
449
+ completionHref,
450
+ className
451
+ }) {
452
+ return /* @__PURE__ */ jsxs7(
453
+ Island,
454
+ {
455
+ name: "checkout",
456
+ props: { storeApiOrigin, ordersHref, completionHref },
457
+ className: ["sk-checkout", className].filter(Boolean).join(" "),
458
+ children: [
459
+ /* @__PURE__ */ jsx8("h2", { className: "sk-checkout__heading", children: "Checkout" }),
460
+ /* @__PURE__ */ jsx8("p", { className: "sk-checkout__placeholder", children: "Checkout needs JavaScript to load." })
461
+ ]
462
+ }
463
+ );
440
464
  }
441
465
 
442
466
  // src/index.ts
@@ -476,6 +500,7 @@ export {
476
500
  WebsiteShell,
477
501
  contrastRatio,
478
502
  createPortalClient,
503
+ createStoreClient,
479
504
  defaultTheme,
480
505
  deriveForeground,
481
506
  evaluateShowWhen,
@@ -1,5 +1,5 @@
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';
2
+ import { b as BookingBlockProps, h as CertificateFunnelProps, n as StoreProps, e as CartProps, k as CheckoutProps } from './checkout-block-BdpPIuQ5.js';
3
3
  import { j as PortalPanelProps, F as FetchLike } from './portal-account-8uQc_Ncx.js';
4
4
  export { P as PortalAccountClient } from './portal-account.client-BBe_q9yC.js';
5
5
  import '@patientos/public-sdk';
@@ -59,10 +59,10 @@ type PortalPanelClientProps = PortalPanelProps & {
59
59
  };
60
60
  declare function PortalPanelClient({ surface, portalUrl, portalApiOrigin, initialState, fetchImpl, }: PortalPanelClientProps): React.ReactElement;
61
61
 
62
- declare function StoreClient({ categoryHandle, title, columns }: StoreProps): React.ReactElement;
62
+ declare function StoreClient({ categoryHandle, productHandle, storeApiOrigin, title, columns, }: StoreProps): React.ReactElement;
63
63
 
64
- declare function CartClient(_props: CartProps): React.ReactElement;
64
+ declare function CartClient({ storeApiOrigin }: CartProps): React.ReactElement;
65
65
 
66
- declare function CheckoutClient(_props: CheckoutProps): React.ReactElement;
66
+ declare function CheckoutClient({ storeApiOrigin, ordersHref, completionHref, }: CheckoutProps): React.ReactElement;
67
67
 
68
68
  export { BookingBlockClient, CartClient, CertificateFunnelClient, CheckoutClient, PortalPanelClient, StoreClient };
@@ -6,11 +6,11 @@ import {
6
6
  PortalAccountClient,
7
7
  PortalPanelClient,
8
8
  StoreClient
9
- } from "./chunk-75FJ5AJB.js";
9
+ } from "./chunk-7ZOQ6UKG.js";
10
10
  import "./chunk-ZOF22TJA.js";
11
11
  import "./chunk-QDO3SJWR.js";
12
12
  import "./chunk-THMT43MV.js";
13
- import "./chunk-FSZ726DM.js";
13
+ import "./chunk-ZYX4TXBN.js";
14
14
  import "./chunk-MLKGABMK.js";
15
15
  export {
16
16
  BookingBlockClient,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ISLANDS,
3
3
  mountIslands
4
- } from "./chunk-7UPUEMXX.js";
5
- import "./chunk-75FJ5AJB.js";
4
+ } from "./chunk-ZZFBTLR4.js";
5
+ import "./chunk-7ZOQ6UKG.js";
6
6
  import "./chunk-ZOF22TJA.js";
7
7
  import "./chunk-QDO3SJWR.js";
8
8
  import "./chunk-THMT43MV.js";
9
- import "./chunk-FSZ726DM.js";
9
+ import "./chunk-ZYX4TXBN.js";
10
10
  import "./chunk-MLKGABMK.js";
11
11
  export {
12
12
  ISLANDS,
@@ -22,7 +22,7 @@ import {
22
22
  releasePortalHold,
23
23
  rescheduleContextTypeId,
24
24
  reschedulePortalAppointmentAndReload
25
- } from "./chunk-FSZ726DM.js";
25
+ } from "./chunk-ZYX4TXBN.js";
26
26
  import "./chunk-MLKGABMK.js";
27
27
  export {
28
28
  AVAILABILITY_FAILED_COPY,
@@ -2868,7 +2868,9 @@ select.sk-identity__input[data-empty] {
2868
2868
  grid-template-columns: repeat(2, minmax(0, 1fr));
2869
2869
  }
2870
2870
  }
2871
- @media (max-width: 480px) {
2871
+ /* Two catalogue columns fit ordinary 390–430px phones and keep a 54-item shop
2872
+ scannable. Below 380px one column preserves readable product names. */
2873
+ @media (max-width: 379px) {
2872
2874
  .sk-store__grid {
2873
2875
  grid-template-columns: minmax(0, 1fr);
2874
2876
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patientos/website-kit",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "PatientOS clinic website components and patient-facing interactive islands.",
5
5
  "type": "module",
6
6
  "sideEffects": [