@farthershore/farthershore-js 0.1.0 → 0.1.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.
Files changed (125) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +95 -5
  3. package/dist/client.d.ts +73 -1
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +64 -1
  6. package/dist/client.js.map +1 -1
  7. package/dist/components/_internal.d.ts +8 -0
  8. package/dist/components/_internal.d.ts.map +1 -0
  9. package/dist/components/_internal.js +16 -0
  10. package/dist/components/_internal.js.map +1 -0
  11. package/dist/components/app.d.ts +27 -0
  12. package/dist/components/app.d.ts.map +1 -0
  13. package/dist/components/app.js +84 -0
  14. package/dist/components/app.js.map +1 -0
  15. package/dist/components/auth.d.ts +66 -0
  16. package/dist/components/auth.d.ts.map +1 -0
  17. package/dist/components/auth.js +260 -0
  18. package/dist/components/auth.js.map +1 -0
  19. package/dist/components/billing.d.ts +6 -0
  20. package/dist/components/billing.d.ts.map +1 -0
  21. package/dist/components/billing.js +32 -0
  22. package/dist/components/billing.js.map +1 -0
  23. package/dist/components/chrome.d.ts +19 -0
  24. package/dist/components/chrome.d.ts.map +1 -0
  25. package/dist/components/chrome.js +27 -0
  26. package/dist/components/chrome.js.map +1 -0
  27. package/dist/components/credit.d.ts +12 -0
  28. package/dist/components/credit.d.ts.map +1 -0
  29. package/dist/components/credit.js +20 -0
  30. package/dist/components/credit.js.map +1 -0
  31. package/dist/components/docs.d.ts +12 -0
  32. package/dist/components/docs.d.ts.map +1 -0
  33. package/dist/components/docs.js +25 -0
  34. package/dist/components/docs.js.map +1 -0
  35. package/dist/components/feature.d.ts +15 -0
  36. package/dist/components/feature.d.ts.map +1 -0
  37. package/dist/components/feature.js +40 -0
  38. package/dist/components/feature.js.map +1 -0
  39. package/dist/components/index.d.ts +26 -0
  40. package/dist/components/index.d.ts.map +1 -0
  41. package/dist/components/index.js +39 -0
  42. package/dist/components/index.js.map +1 -0
  43. package/dist/components/keys.d.ts +6 -0
  44. package/dist/components/keys.d.ts.map +1 -0
  45. package/dist/components/keys.js +45 -0
  46. package/dist/components/keys.js.map +1 -0
  47. package/dist/components/plans-table.d.ts +9 -0
  48. package/dist/components/plans-table.d.ts.map +1 -0
  49. package/dist/components/plans-table.js +68 -0
  50. package/dist/components/plans-table.js.map +1 -0
  51. package/dist/components/root.d.ts +24 -0
  52. package/dist/components/root.d.ts.map +1 -0
  53. package/dist/components/root.js +41 -0
  54. package/dist/components/root.js.map +1 -0
  55. package/dist/components/sign-in.d.ts +8 -0
  56. package/dist/components/sign-in.d.ts.map +1 -0
  57. package/dist/components/sign-in.js +52 -0
  58. package/dist/components/sign-in.js.map +1 -0
  59. package/dist/components/styles.css +403 -0
  60. package/dist/components/theme.d.ts +34 -0
  61. package/dist/components/theme.d.ts.map +1 -0
  62. package/dist/components/theme.js +65 -0
  63. package/dist/components/theme.js.map +1 -0
  64. package/dist/components/usage.d.ts +12 -0
  65. package/dist/components/usage.d.ts.map +1 -0
  66. package/dist/components/usage.js +36 -0
  67. package/dist/components/usage.js.map +1 -0
  68. package/dist/config.d.ts +6 -1
  69. package/dist/config.d.ts.map +1 -1
  70. package/dist/config.js +16 -3
  71. package/dist/config.js.map +1 -1
  72. package/dist/errors.d.ts +31 -2
  73. package/dist/errors.d.ts.map +1 -1
  74. package/dist/errors.js +37 -2
  75. package/dist/errors.js.map +1 -1
  76. package/dist/http.d.ts +3 -0
  77. package/dist/http.d.ts.map +1 -1
  78. package/dist/http.js +12 -1
  79. package/dist/http.js.map +1 -1
  80. package/dist/index.d.ts +4 -3
  81. package/dist/index.d.ts.map +1 -1
  82. package/dist/index.js +2 -2
  83. package/dist/index.js.map +1 -1
  84. package/dist/react/hooks.d.ts +44 -1
  85. package/dist/react/hooks.d.ts.map +1 -1
  86. package/dist/react/hooks.js +60 -5
  87. package/dist/react/hooks.js.map +1 -1
  88. package/dist/react/index.d.ts +3 -2
  89. package/dist/react/index.d.ts.map +1 -1
  90. package/dist/react/index.js +5 -1
  91. package/dist/react/index.js.map +1 -1
  92. package/dist/react/provider.d.ts.map +1 -1
  93. package/dist/react/provider.js +3 -3
  94. package/dist/react/provider.js.map +1 -1
  95. package/dist/react/use-async.d.ts +4 -2
  96. package/dist/react/use-async.d.ts.map +1 -1
  97. package/dist/react/use-async.js +11 -2
  98. package/dist/react/use-async.js.map +1 -1
  99. package/dist/resources/account.d.ts +51 -0
  100. package/dist/resources/account.d.ts.map +1 -0
  101. package/dist/resources/account.js +136 -0
  102. package/dist/resources/account.js.map +1 -0
  103. package/dist/resources/auth.d.ts +18 -3
  104. package/dist/resources/auth.d.ts.map +1 -1
  105. package/dist/resources/auth.js +75 -1
  106. package/dist/resources/auth.js.map +1 -1
  107. package/dist/resources/billing.d.ts +30 -3
  108. package/dist/resources/billing.d.ts.map +1 -1
  109. package/dist/resources/billing.js +57 -2
  110. package/dist/resources/billing.js.map +1 -1
  111. package/dist/resources/keys.d.ts +5 -1
  112. package/dist/resources/keys.d.ts.map +1 -1
  113. package/dist/resources/keys.js +2 -1
  114. package/dist/resources/keys.js.map +1 -1
  115. package/dist/resources/plans.d.ts +6 -1
  116. package/dist/resources/plans.d.ts.map +1 -1
  117. package/dist/resources/plans.js +24 -0
  118. package/dist/resources/plans.js.map +1 -1
  119. package/dist/resources/usage.d.ts +9 -3
  120. package/dist/resources/usage.d.ts.map +1 -1
  121. package/dist/resources/usage.js +8 -7
  122. package/dist/resources/usage.js.map +1 -1
  123. package/dist/types.d.ts +98 -0
  124. package/dist/types.d.ts.map +1 -1
  125. package/package.json +29 -7
package/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@farthershore/farthershore-js` are documented here.
4
+ This project adheres to Semantic Versioning (pre-1.0: minors may break).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [0.1.1] - 2026-06-09
9
+
10
+ ### Added
11
+
12
+ - `createServerClient()` — a documented SSR/server entry point (explicit `portalHost` + injectable `fetch` + per-request `getToken`; no `window`/`location` assumption).
13
+ - Request cancellation: the read methods (`auth.getSession`, `keys.list`, `usage.*`, `billing.subscription`/`creditBalance`) accept `{ signal }`, and the React hooks abort the in-flight request on unmount / dep-change.
14
+ - `FartherShoreAbortError` — mapped from a fetch `AbortError`; ignored by the hooks (a cancelled read is never a user-facing error).
15
+ - `FartherShoreConfigError` for construction/misconfiguration; an ESLint guard on `src/**` ensures every failure stays a typed `FartherShore*` error.
16
+ - Contract **drift-detection** test that guards the SDK's mapped shapes against `@farthershore/contracts` (compile-time + runtime), plus exhaustive unit coverage (35 → 65 tests) and a tree-shaking verification test.
17
+ - Docs: Getting Started, Versioning & stability sections, and this CHANGELOG.
18
+
19
+ ## [0.1.0] - 2026-06-08
20
+
21
+ ### Added
22
+
23
+ - Initial public release: a framework-agnostic client + `/react` hooks + `catalog.ts` display helpers; the `auth` (Clerk `setToken` + persona `signIn`), `keys`, `usage`, `billing`, `plans`, `product`, and Gateway `feature()` resources. ESM, tree-shakeable (`sideEffects: false`), with the domain types re-exported from the `/react` subpath.
package/README.md CHANGED
@@ -4,11 +4,16 @@ The **Farther Shore Frontend SDK** — the canonical browser integration layer
4
4
  between a static frontend artifact (the default dev-portal template, generated
5
5
  frontends, managed components, custom frontends) and the Farther Shore platform.
6
6
 
7
- > **Internal & experimental.** Not published to npm yet (`private: true`).
8
- > Breaking changes are expected while we validate the API against the dev portal,
9
- > managed components, and a real builder-defined feature. The eventual public
10
- > name is `@farthershore/farthershore-js` (the `@stripe/stripe-js` analog to the
11
- > server-side `@farthershore/sdk`).
7
+ > **Status: `0.1.0` (early release).** Published to npm. Pre-1.0, so minor
8
+ > versions may include breaking changes while the API stabilizes against the dev
9
+ > portal, managed template, and real builder features. See [`PUBLISHING.md`](./PUBLISHING.md)
10
+ > for the gates to `1.0.0` (wire-contract lock, browser token exchange, gateway
11
+ > CORS, stage e2e). The `@stripe/stripe-js` analog to the server-side
12
+ > `@farthershore/sdk`.
13
+
14
+ ```bash
15
+ pnpm add @farthershore/farthershore-js # React is an optional peer (for /react)
16
+ ```
12
17
 
13
18
  ## Philosophy
14
19
 
@@ -31,6 +36,45 @@ The SDK decides **where** each request goes (Core for platform concerns, the
31
36
  Gateway for builder features), **how** it's authenticated, and the host/env
32
37
  scoping headers Core needs.
33
38
 
39
+ ## Getting started
40
+
41
+ ```bash
42
+ pnpm add @farthershore/farthershore-js
43
+ ```
44
+
45
+ ```ts
46
+ import { createFartherShoreClient } from "@farthershore/farthershore-js";
47
+
48
+ // 1. Create the client. In the browser, `coreUrl` is usually the only required
49
+ // field — `portalHost` defaults to `window.location.host`.
50
+ const fs = createFartherShoreClient({
51
+ coreUrl: "https://core.farthershore.com",
52
+ });
53
+
54
+ // 2. Discover the product/env/plans for this host (memoized; safe to re-call).
55
+ const { product, plans } = await fs.bootstrap();
56
+
57
+ // 3. Authenticate. In a preview/test env, exchange a persona access key for a
58
+ // session (Clerk envs instead pass `getToken` to the config / `setToken`).
59
+ await fs.auth.signIn({ apiKey: "fsk_test_…" });
60
+
61
+ // 4. Read platform state through the typed resources (→ Core).
62
+ const keys = await fs.keys.list(); // ApiKey[]
63
+ const usage = await fs.usage.snapshot(); // { summary, events, billingBasis }
64
+
65
+ // 5. Call a builder-defined feature (→ Gateway). Set the consumer API key once,
66
+ // then express intent by feature name + path — no Gateway URL in app code.
67
+ fs.setApiKey("fsk_live_…");
68
+ const forecast = await fs.feature("weather").json("/forecast?city=NYC");
69
+ ```
70
+
71
+ In React, the same calls are hooks that return `{ data, loading, error, refresh }`
72
+ (plus mutations) — see [React](#react-farthershorefarthershore-jsreact) below:
73
+
74
+ ```tsx
75
+ const { data, loading, error, refresh } = useApiKeys();
76
+ ```
77
+
34
78
  ## Surface
35
79
 
36
80
  | Namespace | Routes to | Methods |
@@ -41,6 +85,7 @@ scoping headers Core needs.
41
85
  | `fs.keys` | Core | `list()`, `create()`, `revoke()`, `rotate()` |
42
86
  | `fs.usage` | Core | `summary()`, `events()`, `snapshot()` |
43
87
  | `fs.billing` | Core | `subscription()`, `openBillingPortal()`, `creditBalance()` |
88
+ | `fs.plans` | Core / (bootstrap) | `list()`, `subscribe()` |
44
89
  | `fs.feature(name)` / `fs.invoke(path)` | **Gateway** | `fetch(path)`, `json(path)` |
45
90
 
46
91
  ## Auth
@@ -71,6 +116,29 @@ createFartherShoreClient({
71
116
  });
72
117
  ```
73
118
 
119
+ ## SSR / server usage
120
+
121
+ On a server there is no `window`/`location` to infer the portal host from and no
122
+ ambient browser session — so use `createServerClient`, a documented alias for
123
+ `createFartherShoreClient` that makes that contract explicit. Pass `portalHost`
124
+ and `fetch` instead of relying on globals, and resolve the per-request session
125
+ via `getToken` (each request authenticates as a different user). Behaviour is
126
+ identical to the browser client — the config already guards `globalThis.location`
127
+ and requires an injectable `fetch` — so this is purely a discoverable entry point.
128
+
129
+ ```ts
130
+ import { createServerClient } from "@farthershore/farthershore-js";
131
+
132
+ const fs = createServerClient({
133
+ coreUrl: process.env.FS_CORE_URL!,
134
+ portalHost: "weather.farthershore.com", // no window.location on the server
135
+ getToken: () => sessionTokenForThisRequest, // per-request bearer
136
+ fetch, // Node 18+ global, or an injected impl
137
+ });
138
+
139
+ const sub = await fs.billing.subscription();
140
+ ```
141
+
74
142
  ## React (`@farthershore/farthershore-js/react`)
75
143
 
76
144
  The hooks live in a **subpath** of the same package — `react` is an _optional_
@@ -117,6 +185,28 @@ client. They're thin wrappers over the client — no duplicated logic.
117
185
  - A browser-safe **short-lived gateway token** (vs. a long-lived `fsk_` key in the
118
186
  page) — the platform's `fsc_` context token is server-minted today.
119
187
 
188
+ ## Versioning & stability
189
+
190
+ This package is **pre-1.0 (`0.x`)**. Under SemVer's 0.x rules a **minor** bump
191
+ (`0.1.x` → `0.2.0`) may include **breaking changes**, so the usual caret range is
192
+ unsafe here:
193
+
194
+ - ❌ `^0.1` / `^0.1.0` — caret does **not** lock the minor across `0.x`; it would
195
+ silently accept a breaking `0.2.0`.
196
+ - ✅ Pin **exact** (`0.1.0`) or use a patch-only tilde (`~0.1.0`) until `1.0.0`.
197
+
198
+ Breaking changes within `0.x` are recorded in [`CHANGELOG.md`](./CHANGELOG.md)
199
+ (Keep a Changelog format) — read it before bumping.
200
+
201
+ **Path to `1.0.0`:** the API graduates to a stable major once the
202
+ [`PUBLISHING.md`](./PUBLISHING.md) gates clear — wire-contract lock (generated
203
+ from / pinned to `@farthershore/contracts`), the browser-safe gateway token
204
+ exchange, gateway CORS for product origins, and a live-stage e2e. At `1.0.0`,
205
+ caret ranges become safe again.
206
+
207
+ The `/react` subpath ships in the same package and version; **`react` is an
208
+ _optional_ peer dependency**, so non-React consumers never pull it in.
209
+
120
210
  ## Scripts
121
211
 
122
212
  ```bash
package/dist/client.d.ts CHANGED
@@ -6,8 +6,9 @@ import { type KeysResource } from "./resources/keys.js";
6
6
  import { type UsageResource } from "./resources/usage.js";
7
7
  import { type BillingResource } from "./resources/billing.js";
8
8
  import { type PlansResource } from "./resources/plans.js";
9
+ import { type AuditLogsResource, type OrganizationsResource, type TeamResource } from "./resources/account.js";
9
10
  import { type FeatureHandle, type GatewayRequestInit } from "./resources/feature.js";
10
- import type { Bootstrap } from "./types.js";
11
+ import type { Bootstrap, SubscriberContext } from "./types.js";
11
12
  export interface FartherShoreClient {
12
13
  /** Resolve + cache the product/env/gateway for the current portal host. Safe
13
14
  * to call repeatedly (memoized). */
@@ -16,13 +17,38 @@ export interface FartherShoreClient {
16
17
  setApiKey(key: string | null): void;
17
18
  /** Set the Core session bearer directly (e.g. from the Clerk browser SDK). */
18
19
  setSessionToken(token: string | null): void;
20
+ /** Install/replace a live token source resolved per request (short-lived
21
+ * Clerk JWTs). `<FartherShoreRoot>` wires this automatically in Clerk
22
+ * environments; pass null to uninstall. */
23
+ setTokenProvider(provider: (() => string | null | Promise<string | null>) | null): void;
24
+ /** Rescope subsequent Core calls to an owning org (the multi-org
25
+ * subscription-context switcher) — sets the `x-fs-organization-id` header.
26
+ * Pass null to return to the user's default subscription. */
27
+ setOrganizationId(organizationId: string | null): void;
28
+ /** The product this frontend runs for (resolved via bootstrap). */
19
29
  readonly product: ProductResource;
30
+ /** Consumer session: persona/Clerk sign-in, the current session, sign-out. */
20
31
  readonly auth: AuthResource;
32
+ /** The consumer's API keys (list / create / revoke / rotate). */
21
33
  readonly keys: KeysResource;
34
+ /** Per-dimension usage totals + recent events for this product. */
22
35
  readonly usage: UsageResource;
36
+ /** The consumer's subscription, the Stripe billing portal, and credit balance. */
23
37
  readonly billing: BillingResource;
24
38
  /** The product's plan catalog + the subscribe/checkout flow. */
25
39
  readonly plans: PlansResource;
40
+ /** Full subscriber context (`GET /me`): lifecycle, trial, scheduled
41
+ * transition, eligibility-scoped plans. Null when signed out / no
42
+ * subscriber. */
43
+ me(opts?: {
44
+ signal?: AbortSignal;
45
+ }): Promise<SubscriberContext | null>;
46
+ /** Multi-org subscription contexts (the org switcher's data). */
47
+ readonly organizations: OrganizationsResource;
48
+ /** Team management on the current subscription. */
49
+ readonly team: TeamResource;
50
+ /** The subscriber-side audit log (cursor-paged). */
51
+ readonly auditLogs: AuditLogsResource;
26
52
  /** A handle to a builder-defined feature, routed through the Gateway. */
27
53
  feature(name: string): FeatureHandle;
28
54
  /** Generic Gateway call (alias for `feature("…").fetch`). */
@@ -38,5 +64,51 @@ export interface FartherShoreClient {
38
64
  */
39
65
  core<T>(req: CoreRequest): Promise<T>;
40
66
  }
67
+ /**
68
+ * SSR / server-side entry point. A thin, documented alias for
69
+ * {@link createFartherShoreClient} that makes the server contract explicit:
70
+ * there is **no `window`/`location`** to fall back on, so a server caller must
71
+ * supply what the browser would otherwise provide implicitly —
72
+ *
73
+ * - `portalHost` — the product/env host (no `globalThis.location.host` default
74
+ * exists on the server);
75
+ * - `fetch` — an injectable fetch (the platform doesn't assume a global one);
76
+ * - `getToken` — the per-request session bearer (each request authenticates as a
77
+ * different user, so resolve the token per call rather than via the browser's
78
+ * ambient session).
79
+ *
80
+ * Behaviour is identical to {@link createFartherShoreClient} — `buildContext`
81
+ * already guards `globalThis.location` and requires an injectable `fetch` — so
82
+ * this adds no runtime behaviour; it's a discoverable, self-documenting entry
83
+ * point for SSR/server usage.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const fs = createServerClient({
88
+ * coreUrl: process.env.FS_CORE_URL!,
89
+ * portalHost: "weather.farthershore.com",
90
+ * getToken: () => sessionTokenForThisRequest,
91
+ * fetch, // Node 18+ global, or an injected impl
92
+ * });
93
+ * const sub = await fs.billing.subscription();
94
+ * ```
95
+ */
96
+ export declare function createServerClient(config: FartherShoreConfig): FartherShoreClient;
97
+ /**
98
+ * Create a {@link FartherShoreClient}. In the browser the minimal config is
99
+ * `{ coreUrl }` — the platform Core base URL; `portalHost` defaults to
100
+ * `window.location.host` and the product is discovered at {@link
101
+ * FartherShoreClient.bootstrap}. The returned client owns all routing (Core vs
102
+ * Gateway), auth, and host/env scoping; app code only expresses intent via its
103
+ * typed resources (`fs.usage`, `fs.keys`, `fs.feature(…)`, …). For SSR/server
104
+ * use, prefer {@link createServerClient}.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * const fs = createFartherShoreClient({ coreUrl: "https://core.farthershore.com" });
109
+ * const { product } = await fs.bootstrap();
110
+ * const keys = await fs.keys.list();
111
+ * ```
112
+ */
41
113
  export declare function createFartherShoreClient(config: FartherShoreConfig): FartherShoreClient;
42
114
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,kBAAkB,EAGxB,MAAM,aAAa,CAAC;AAErB,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC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-6,14 +6,66 @@ import { buildContext, } from "./config.js";
6
6
  import { resolveBootstrap } from "./bootstrap.js";
7
7
  import { coreFetch, gatewayFetch } from "./http.js";
8
8
  import { createProductResource, } from "./resources/product.js";
9
- import { createAuthResource } from "./resources/auth.js";
9
+ import { createAuthResource, primePersistedPersona, } from "./resources/auth.js";
10
10
  import { createKeysResource } from "./resources/keys.js";
11
11
  import { createUsageResource } from "./resources/usage.js";
12
12
  import { createBillingResource, } from "./resources/billing.js";
13
13
  import { createPlansResource } from "./resources/plans.js";
14
+ import { createAccountSurface, } from "./resources/account.js";
14
15
  import { createFeature, } from "./resources/feature.js";
16
+ /**
17
+ * SSR / server-side entry point. A thin, documented alias for
18
+ * {@link createFartherShoreClient} that makes the server contract explicit:
19
+ * there is **no `window`/`location`** to fall back on, so a server caller must
20
+ * supply what the browser would otherwise provide implicitly —
21
+ *
22
+ * - `portalHost` — the product/env host (no `globalThis.location.host` default
23
+ * exists on the server);
24
+ * - `fetch` — an injectable fetch (the platform doesn't assume a global one);
25
+ * - `getToken` — the per-request session bearer (each request authenticates as a
26
+ * different user, so resolve the token per call rather than via the browser's
27
+ * ambient session).
28
+ *
29
+ * Behaviour is identical to {@link createFartherShoreClient} — `buildContext`
30
+ * already guards `globalThis.location` and requires an injectable `fetch` — so
31
+ * this adds no runtime behaviour; it's a discoverable, self-documenting entry
32
+ * point for SSR/server usage.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const fs = createServerClient({
37
+ * coreUrl: process.env.FS_CORE_URL!,
38
+ * portalHost: "weather.farthershore.com",
39
+ * getToken: () => sessionTokenForThisRequest,
40
+ * fetch, // Node 18+ global, or an injected impl
41
+ * });
42
+ * const sub = await fs.billing.subscription();
43
+ * ```
44
+ */
45
+ export function createServerClient(config) {
46
+ return createFartherShoreClient(config);
47
+ }
48
+ /**
49
+ * Create a {@link FartherShoreClient}. In the browser the minimal config is
50
+ * `{ coreUrl }` — the platform Core base URL; `portalHost` defaults to
51
+ * `window.location.host` and the product is discovered at {@link
52
+ * FartherShoreClient.bootstrap}. The returned client owns all routing (Core vs
53
+ * Gateway), auth, and host/env scoping; app code only expresses intent via its
54
+ * typed resources (`fs.usage`, `fs.keys`, `fs.feature(…)`, …). For SSR/server
55
+ * use, prefer {@link createServerClient}.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const fs = createFartherShoreClient({ coreUrl: "https://core.farthershore.com" });
60
+ * const { product } = await fs.bootstrap();
61
+ * const keys = await fs.keys.list();
62
+ * ```
63
+ */
15
64
  export function createFartherShoreClient(config) {
16
65
  const ctx = buildContext(config);
66
+ // Self-managed persona sessions: restore a persisted (unexpired) session so
67
+ // reloads stay signed in without any host wiring. No-op outside the browser.
68
+ primePersistedPersona(ctx);
17
69
  let cached = null;
18
70
  let inflight = null;
19
71
  function ensureBootstrap() {
@@ -33,6 +85,7 @@ export function createFartherShoreClient(config) {
33
85
  }
34
86
  return inflight;
35
87
  }
88
+ const account = createAccountSurface(ctx);
36
89
  return {
37
90
  bootstrap: ensureBootstrap,
38
91
  setApiKey(key) {
@@ -41,12 +94,22 @@ export function createFartherShoreClient(config) {
41
94
  setSessionToken(token) {
42
95
  ctx.sessionToken = token;
43
96
  },
97
+ setTokenProvider(provider) {
98
+ ctx.tokenProvider = provider;
99
+ },
100
+ setOrganizationId(organizationId) {
101
+ ctx.organizationId = organizationId;
102
+ },
44
103
  product: createProductResource(ensureBootstrap),
45
104
  auth: createAuthResource(ctx),
46
105
  keys: createKeysResource(ctx),
47
106
  usage: createUsageResource(ctx),
48
107
  billing: createBillingResource(ctx),
49
108
  plans: createPlansResource(ctx, ensureBootstrap),
109
+ me: account.me,
110
+ organizations: account.organizations,
111
+ team: account.team,
112
+ auditLogs: account.auditLogs,
50
113
  feature: (name) => createFeature(ctx, name),
51
114
  invoke: (path, init) => gatewayFetch(ctx, path, init),
52
115
  core: (req) => coreFetch(ctx, req),
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names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AAM,OAAO,GAAmB,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAE1D,OAAO;QACL,SAAS,EAAE,eAAe;QAC1B,SAAS,CAAC,GAAG;YACX,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC;QACnB,CAAC;QACD,eAAe,CAAC,KAAK;YACnB,GAAG,CAAC,YAAY,GAAG,KAAK,CAAC;QAC3B,CAAC;QACD,gBAAgB,CAAC,QAAQ;YACvB,GAAG,CAAC,aAAa,GAAG,QAAQ,CAAC;QAC/B,CAAC;QACD,iBAAiB,CAAC,cAAc;YAC9B,GAAG,CAAC,cAAc,GAAG,cAAc,CAAC;QACtC,CAAC;QACD,OAAO,EAAE,qBAAqB,CAAC,eAAe,CAAC;QAC/C,IAAI,EAAE,kBAAkB,CAAC,GAAG,CAAC;QAC7B,IAAI,EAAE,kBAAkB,CAAC,GAAG,CAAC;QAC7B,KAAK,EAAE,mBAAmB,CAAC,GAAG,CAAC;QAC/B,OAAO,EAAE,qBAAqB,CAAC,GAAG,CAAC;QACnC,KAAK,EAAE,mBAAmB,CAAC,GAAG,EAAE,eAAe,CAAC;QAChD,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC;QAC3C,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC;QACrD,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC;KACnC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ /** Join class names, skipping falsy — the host-extension contract: every
2
+ * public component accepts `className` and appends it to its root. */
3
+ export declare function cx(...parts: Array<string | null | undefined | false>): string;
4
+ export declare function ArrowIcon(): import("react/jsx-runtime").JSX.Element;
5
+ export declare function CheckIcon({ className }: {
6
+ className?: string;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=_internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_internal.d.ts","sourceRoot":"","sources":["../../src/components/_internal.tsx"],"names":[],"mappings":"AAIA;uEACuE;AACvE,wBAAgB,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG,MAAM,CAE7E;AAED,wBAAgB,SAAS,4CAMxB;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,2CAM9D"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // Internal shared bits for the components package — NOT exported from the
3
+ // package. Public components live one-per-file; this holds the tiny pieces
4
+ // several of them share.
5
+ /** Join class names, skipping falsy — the host-extension contract: every
6
+ * public component accepts `className` and appends it to its root. */
7
+ export function cx(...parts) {
8
+ return parts.filter(Boolean).join(" ");
9
+ }
10
+ export function ArrowIcon() {
11
+ return (_jsx("svg", { className: "fs-btn__arrow", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2.5, stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3" }) }));
12
+ }
13
+ export function CheckIcon({ className }) {
14
+ return (_jsx("svg", { className: className, fill: "none", viewBox: "0 0 24 24", strokeWidth: 2.5, stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }) }));
15
+ }
16
+ //# sourceMappingURL=_internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_internal.js","sourceRoot":"","sources":["../../src/components/_internal.tsx"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,2EAA2E;AAC3E,yBAAyB;AAEzB;uEACuE;AACvE,MAAM,UAAU,EAAE,CAAC,GAAG,KAA+C;IACnE,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,CACL,cAAK,SAAS,EAAC,eAAe,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW,EAAC,WAAW,EAAE,GAAG,EAAE,MAAM,EAAC,cAAc,YACpG,eAAM,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,EAAC,CAAC,EAAC,sCAAsC,GAAG,GAC1F,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,EAAE,SAAS,EAA0B;IAC7D,OAAO,CACL,cAAK,SAAS,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,WAAW,EAAC,WAAW,EAAE,GAAG,EAAE,MAAM,EAAC,cAAc,YAChG,eAAM,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,EAAC,CAAC,EAAC,uBAAuB,GAAG,GAC3E,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { type ReactNode } from "react";
2
+ import type { Bootstrap } from "../types.js";
3
+ import { type FsAppearance } from "./theme.js";
4
+ import { type FsClerkConfig } from "./auth.js";
5
+ /**
6
+ * The entire portal in one tag. Resolves the product, mounts theme + managed
7
+ * auth, and renders the marketing landing (signed-out) or the account
8
+ * dashboard (signed-in). Pass `appearance` to retheme; drop to the standalone
9
+ * components for custom layouts.
10
+ *
11
+ * `renderDashboard` is the chrome escape hatch: when authenticated, the app
12
+ * renders this instead of the built-in card stack (the default template
13
+ * supplies its full sidebar app shell this way), still inside the resolved
14
+ * bootstrap + theme + auth context.
15
+ */
16
+ export declare function FartherShoreApp({ appearance, clerk, renderDashboard, }: {
17
+ appearance?: FsAppearance;
18
+ /** Clerk connection config (public values) for clerk-strategy environments. */
19
+ clerk?: FsClerkConfig;
20
+ renderDashboard?: (boot: Bootstrap) => ReactNode;
21
+ }): import("react/jsx-runtime").JSX.Element;
22
+ /** The landing's pricing section: heading chrome around the standalone
23
+ * `<PlansTable/>`. */
24
+ export declare function FsPricing({ className }?: {
25
+ className?: string;
26
+ }): import("react/jsx-runtime").JSX.Element;
27
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/components/app.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAa/D;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,KAAK,EACL,eAAe,GAChB,EAAE;IACD,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,+EAA+E;IAC/E,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,SAAS,CAAC;CAClD,2CAoBA;AAyKD;uBACuB;AACvB,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,2CAWnE"}
@@ -0,0 +1,84 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useBootstrap, useSession } from "../react/index.js";
3
+ import { FsThemeProvider } from "./theme.js";
4
+ import { FsAuthProvider } from "./auth.js";
5
+ import { PlansTable } from "./plans-table.js";
6
+ import { FsSignIn } from "./sign-in.js";
7
+ import { FsBranding, FsThemeToggle, FsFooter } from "./chrome.js";
8
+ import { ApiKeysPanel } from "./keys.js";
9
+ import { UsageCard } from "./usage.js";
10
+ import { BillingSummary } from "./billing.js";
11
+ import { CreditBalance } from "./credit.js";
12
+ import { DocsLegal } from "./docs.js";
13
+ import { ArrowIcon } from "./_internal.js";
14
+ /* ── Composite ─────────────────────────────────────────────────── */
15
+ /**
16
+ * The entire portal in one tag. Resolves the product, mounts theme + managed
17
+ * auth, and renders the marketing landing (signed-out) or the account
18
+ * dashboard (signed-in). Pass `appearance` to retheme; drop to the standalone
19
+ * components for custom layouts.
20
+ *
21
+ * `renderDashboard` is the chrome escape hatch: when authenticated, the app
22
+ * renders this instead of the built-in card stack (the default template
23
+ * supplies its full sidebar app shell this way), still inside the resolved
24
+ * bootstrap + theme + auth context.
25
+ */
26
+ export function FartherShoreApp({ appearance, clerk, renderDashboard, }) {
27
+ const boot = useBootstrap();
28
+ if (boot.loading)
29
+ return _jsx(FsSplash, { label: "Loading\u2026" });
30
+ if (boot.error || !boot.data) {
31
+ return _jsx(FsSplash, { label: boot.error?.message ?? "Portal unavailable" });
32
+ }
33
+ const merged = {
34
+ brandColor: boot.data.branding.primaryColor ?? undefined,
35
+ ...appearance,
36
+ };
37
+ return (_jsx(FsThemeProvider, { appearance: merged, children: _jsx(FsAuthProvider, { strategy: boot.data.environment?.authStrategy ?? "clerk", clerk: clerk, children: _jsx(AppBody, { boot: boot.data, renderDashboard: renderDashboard }) }) }));
38
+ }
39
+ function AppBody({ boot, renderDashboard, }) {
40
+ const session = useSession();
41
+ const authenticated = Boolean(session.data?.authenticated);
42
+ if (!authenticated) {
43
+ return (_jsxs("main", { className: "fs-anim-in", children: [_jsx(FsHeader, {}), _jsx(FsHero, { boot: boot }), _jsx(FsPricing, {}), _jsx(FsSignIn, { onSignedIn: session.refresh }), _jsx(FsBottomCta, {}), _jsx(FsFooter, { boot: boot })] }));
44
+ }
45
+ if (renderDashboard)
46
+ return _jsx(_Fragment, { children: renderDashboard(boot) });
47
+ return _jsx(FsDefaultDashboard, { boot: boot, onSignOut: () => void session.signOut() });
48
+ }
49
+ /** The built-in signed-in view: a centered stack of the standalone data
50
+ * components. Used when no `renderDashboard` is supplied. */
51
+ function FsDefaultDashboard({ boot, onSignOut }) {
52
+ return (_jsxs("main", { className: "fs-anim-in", children: [_jsx(FsHeader, { authenticated: true, onSignOut: onSignOut }), _jsxs("div", { className: "fs-container", style: { padding: "32px 24px", display: "flex", flexDirection: "column", gap: 18 }, children: [_jsxs("div", { children: [_jsx("h1", { style: { fontSize: 30, fontWeight: 300, letterSpacing: "-0.02em", margin: 0 }, children: boot.branding.displayName }), _jsx("p", { className: "fs-muted", style: { marginTop: 4, fontSize: 14 }, children: "Your account" })] }), _jsx(ApiKeysPanel, {}), _jsx(UsageCard, {}), _jsx(BillingSummary, {}), _jsx(CreditBalance, {}), _jsx(DocsLegal, {})] }), _jsx(FsFooter, { boot: boot })] }));
53
+ }
54
+ /* ── Composite-private sections ────────────────────────────────── */
55
+ function FsHeader({ authenticated, onSignOut, }) {
56
+ return (_jsx("header", { className: "fs-header", children: _jsxs("div", { className: "fs-header__inner", children: [_jsx(FsBranding, {}), _jsxs("nav", { className: "fs-header__nav", children: [!authenticated && (_jsx("a", { href: "#pricing", className: "fs-btn fs-btn--ghost fs-btn--sm", children: "Pricing" })), _jsx(FsThemeToggle, {}), authenticated ? (_jsx("button", { className: "fs-btn fs-btn--outline fs-btn--sm", onClick: onSignOut, children: "Sign out" })) : (_jsx("a", { href: "#signin", className: "fs-btn fs-btn--cta fs-btn--sm", children: "Sign in" }))] })] }) }));
57
+ }
58
+ function FsHero({ boot }) {
59
+ const brand = boot.branding;
60
+ const product = boot.product;
61
+ const authHeaderName = product.authHeaderName ?? "x-api-key";
62
+ const baseUrl = product.runtimeHostname
63
+ ? `https://${product.runtimeHostname}`
64
+ : "https://api.example.com";
65
+ return (_jsxs("section", { className: "fs-hero", children: [_jsx("div", { className: "fs-hero__glow" }), _jsxs("div", { className: "fs-hero__grid", children: [_jsxs("div", { style: { textAlign: "left" }, children: [_jsxs("span", { className: "fs-hero__pill", children: [_jsx("span", { className: "fs-dot fs-dot--pulse" }), "API Available"] }), _jsx("h1", { className: "fs-hero__title", children: brand.displayName }), _jsx("p", { className: "fs-hero__sub", children: brand.description ||
66
+ "Build powerful integrations with our API. Get your key and start making requests in minutes." }), _jsxs("div", { className: "fs-hero__actions", children: [_jsxs("a", { href: "#pricing", className: "fs-btn fs-btn--cta", children: ["Start Building Free", _jsx(ArrowIcon, {})] }), _jsx("a", { href: "#pricing", className: "fs-btn fs-btn--outline", children: "See Pricing" })] })] }), _jsx(FsCodeSample, { baseUrl: baseUrl, authHeaderName: authHeaderName })] })] }));
67
+ }
68
+ function FsCodeSample({ baseUrl, authHeaderName }) {
69
+ const name = authHeaderName.trim() || "x-api-key";
70
+ const value = name.toLowerCase() === "authorization" ? "Bearer fsk_..." : "fsk_...";
71
+ return (_jsxs("div", { className: "fs-code", children: [_jsxs("div", { className: "fs-code__bar", children: [_jsx("span", { className: "fs-code__dot" }), _jsx("span", { className: "fs-code__dot" }), _jsx("span", { className: "fs-code__dot" }), _jsx("span", { className: "fs-code__name", children: "quickstart.sh" })] }), _jsxs("pre", { className: "fs-code__body", children: [_jsx("span", { className: "fs-code__c", children: "# Make your first request" }), "\n", _jsx("span", { className: "fs-code__ok", children: "$" }), " ", _jsx("span", { className: "fs-code__m", children: `curl ${baseUrl}/v1/hello` }), "\n ", _jsx("span", { className: "fs-code__m", children: `-H "${name}: ${value}"` }), "\n\n", _jsx("span", { className: "fs-code__c", children: "// Response" }), "\n", _jsx("span", { className: "fs-code__c", children: "{" }), "\n ", _jsx("span", { className: "fs-code__m", children: "\"status\": " }), _jsx("span", { className: "fs-code__ok", children: "\"ok\"" }), _jsx("span", { className: "fs-code__c", children: "," }), "\n ", _jsx("span", { className: "fs-code__m", children: "\"message\": " }), _jsx("span", { className: "fs-code__warn", children: "\"Hello, developer!\"" }), "\n", _jsx("span", { className: "fs-code__c", children: "}" })] })] }));
72
+ }
73
+ /** The landing's pricing section: heading chrome around the standalone
74
+ * `<PlansTable/>`. */
75
+ export function FsPricing({ className } = {}) {
76
+ return (_jsxs("section", { id: "pricing", className: "fs-section fs-section--surface" + (className ? ` ${className}` : ""), children: [_jsxs("div", { className: "fs-section__head", children: [_jsx("p", { className: "fs-eyebrow", children: "Pricing" }), _jsx("h2", { className: "fs-section__title", children: "Simple, transparent pricing" }), _jsx("p", { className: "fs-section__sub", children: "Start free. Scale as you grow. No hidden fees." })] }), _jsx(PlansTable, {})] }));
77
+ }
78
+ function FsBottomCta() {
79
+ return (_jsx("section", { className: "fs-section", children: _jsxs("div", { className: "fs-cta", children: [_jsx("h2", { className: "fs-section__title", children: "Ready to get started?" }), _jsx("p", { className: "fs-section__sub", style: { fontSize: 16 }, children: "Create your free account and start making API calls in under a minute." }), _jsx("div", { style: { marginTop: 32 }, children: _jsxs("a", { href: "#signin", className: "fs-btn fs-btn--cta", style: { padding: "0 40px" }, children: ["Create Free Account", _jsx(ArrowIcon, {})] }) })] }) }));
80
+ }
81
+ function FsSplash({ label }) {
82
+ return _jsx("div", { className: "fs-app fs-splash", children: label });
83
+ }
84
+ //# sourceMappingURL=app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/components/app.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAqB,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,cAAc,EAAsB,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,YAAY,EA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AK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,oCAE3E,KAAC,SAAS,KAAG,IACX,GACA,IACF,GACE,CACX,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,EAAE,KAAK,EAAqB;IAC5C,OAAO,cAAK,SAAS,EAAC,kBAAkB,YAAE,KAAK,GAAO,CAAC;AACzD,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { type ReactNode } from "react";
2
+ import type { AuthStrategy } from "../types.js";
3
+ /** Clerk connection config — public values, baked per environment (e.g. from
4
+ * VITE_CLERK_* vars). `satelliteDomain` defaults to the current host minus its
5
+ * first label (`aurora.farthershore.io` → `farthershore.io`). Satellite mode
6
+ * engages only when the full trio resolves; otherwise single-domain Clerk. */
7
+ export interface FsClerkConfig {
8
+ publishableKey: string;
9
+ signInUrl?: string;
10
+ satelliteDomain?: string;
11
+ }
12
+ export interface FsAuth {
13
+ strategy: AuthStrategy;
14
+ /** False while auth is initializing (Clerk JS loading / first session read). */
15
+ loaded: boolean;
16
+ signedIn: boolean;
17
+ /** Clerk → redirect to the primary hosted sign-in (returning here);
18
+ * persona → no-op (render a persona sign-in form via `useSession().signIn`). */
19
+ signIn(): void;
20
+ signOut(): Promise<void>;
21
+ /** Clerk user object (or the persisted persona view user), when signed in. */
22
+ user: unknown;
23
+ /** Re-read the session (persona only; Clerk pushes its own state). */
24
+ refresh(): void;
25
+ }
26
+ export declare function useFsAuth(): FsAuth;
27
+ /** Like {@link useFsAuth} but null outside the managed auth layer — lets
28
+ * components degrade instead of throwing when mounted without a Root. */
29
+ export declare function useOptionalFsAuth(): FsAuth | null;
30
+ /** Renders children only when a user is signed in. */
31
+ export declare function SignedIn({ children }: {
32
+ children: ReactNode;
33
+ }): import("react/jsx-runtime").JSX.Element | null;
34
+ /** Renders children only when signed out (and auth has finished loading —
35
+ * nothing flashes during init). */
36
+ export declare function SignedOut({ children }: {
37
+ children: ReactNode;
38
+ }): import("react/jsx-runtime").JSX.Element | null;
39
+ /** Renders children only while the auth layer is initializing. */
40
+ export declare function AuthLoading({ children }: {
41
+ children: ReactNode;
42
+ }): import("react/jsx-runtime").JSX.Element | null;
43
+ /** A managed sign-in button: Clerk → redirect to the primary-domain hosted
44
+ * sign-in (returning to the current page); persona → scrolls to the sign-in
45
+ * form. Style with className (defaults to the SDK CTA button). */
46
+ export declare function FsSignInButton({ className, children, }: {
47
+ className?: string;
48
+ children?: ReactNode;
49
+ }): import("react/jsx-runtime").JSX.Element;
50
+ /** A managed sign-out button (any strategy). */
51
+ export declare function FsSignOutButton({ className, children, }: {
52
+ className?: string;
53
+ children?: ReactNode;
54
+ }): import("react/jsx-runtime").JSX.Element;
55
+ /** The managed auth layer — mounted by `<FartherShoreRoot>`; mountable directly
56
+ * by custom roots. Picks the implementation from the environment's strategy. */
57
+ export declare function FsAuthProvider({ strategy, clerk, children, }: {
58
+ strategy: AuthStrategy;
59
+ clerk?: FsClerkConfig;
60
+ children: ReactNode;
61
+ }): import("react/jsx-runtime").JSX.Element;
62
+ /** The signed-in account control. Clerk mode → Clerk's <UserButton/> (avatar
63
+ * menu with manage-account + sign-out) behind a loading skeleton; persona
64
+ * mode → null (persona chrome is host-routed — render your own pill). */
65
+ export declare function FsUserButton(): import("react/jsx-runtime").JSX.Element | null;
66
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/components/auth.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD;;;+EAG+E;AAC/E,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,YAAY,CAAC;IACvB,gFA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