@capxul/sdk-react 0.1.0-alpha.9 → 0.2.0-alpha.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,124 @@
1
1
  # @capxul/sdk-react
2
2
 
3
+ ## 0.2.0-alpha.4
4
+
5
+ ### Minor Changes
6
+
7
+ - b6c1f94: Complete the auth dogfooding epic around the canonical auth surface.
8
+
9
+ The SDK now carries the guarded OTP proof path, bootstrap continuation states,
10
+ canonical auth service behavior, and final funnel proof support needed for
11
+ first-run auth dogfooding. The React SDK aligns its auth hooks and provider
12
+ state with that canonical flow, including signout cleanup, bootstrap-required
13
+ continuations, and funnel telemetry integration.
14
+
15
+ ### Patch Changes
16
+
17
+ - 50d3c55: Bundle the internal Safe derivation package into the SDK artifact instead of
18
+ publishing it as a runtime dependency, and add a packaging guard that fails when
19
+ publishable packages leak private `@repo/*` runtime dependencies.
20
+ - Updated dependencies [b6c1f94]
21
+ - Updated dependencies [50d3c55]
22
+ - @capxul/sdk@0.2.0-alpha.4
23
+
24
+ ## 0.2.0-alpha.3
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [5b99a9b]
29
+ - @capxul/sdk@0.2.0-alpha.3
30
+
31
+ ## 0.2.0-alpha.2
32
+
33
+ ### Minor Changes
34
+
35
+ - 995383f: Epic 660: Unified auth surface
36
+ - Introduces AuthService promise-based auth API replacing the imperative capxul.auth.\* tuple interface
37
+ - Adds SignerProvisioner for deterministic Safe v1.4.1 address derivation from viem signers
38
+ - Adds useAuth() React hook with reactive state + promise-based methods
39
+ - Deprecates useAuthFlow and useAuthBootstrapFlow in favor of useAuth()
40
+ - Migrates reference CLI auth commands (send-otp, verify-otp, signout) to useAuth()
41
+ - Migrates test surfaces: walkthroughs, type tests, e2e harness signup, lazy-dx provider
42
+ - Adds @repo/safe-derive workspace package for Safe address derivation utilities
43
+ - Aligns CapxulConfig.data to \_data with internal SDK transport ownership (Epic 652)
44
+ - Pins esbuild to 0.25.12 to fix binary-version skew in fresh worktrees
45
+
46
+ - 2ef4ee3: Reshape the organizations members surface around a single Membership entity
47
+ with a status lifecycle (`pending | active | revoked | expired`).
48
+ - Replaces the prior invitation/membership split (which produced a phantom
49
+ `MemberInvitation` type that never compiled) with a single `Member` type
50
+ exposing `status`, `email`, `acceptedAt`, `expiresAt`, and `resentCount`.
51
+ - New methods on `organizations.members.*`: `accept(token)`, `revoke(memberId)`,
52
+ `resend(memberId)`. `invite()` now returns a `MemberInviteResponse`
53
+ containing the raw invite token (returned once).
54
+ - Auto-accepts pending invitations on first sign-in for the matching email
55
+ via a BetterAuth post-signup hook.
56
+ - Nightly Convex cron expires overdue pending invitations.
57
+
58
+ Public type changes:
59
+ - Removed: `MemberInvitation` (was never exported; type didn't compile).
60
+ - Added: `MembershipStatus`, `MemberInviteResponse`.
61
+ - Updated: `Member` shape — see SDK reference for the full delta.
62
+
63
+ React hooks:
64
+ - New: `useAcceptInvitation`, `useRevokeMember`, `useResendInvitation`.
65
+ - Updated: `useInviteMember` returns `MemberInviteResponse` (was returning a
66
+ type that didn't exist).
67
+
68
+ Reference CLI:
69
+ - New commands: `org members invite`, `org members list`, `org members retrieve`,
70
+ `org members accept`, `org members updateRole`, `org members revoke`,
71
+ `org members remove`, `org members resend`.
72
+
73
+ - c7146bf: **Transport ownership (#656):** The SDK now owns construction of the
74
+ authenticated `ConvexHttpClient`. Consumers no longer wire `data` manually
75
+ or provide `auth.createDataClient`. After `verifyOtp` exchanges a Convex
76
+ JWT, the SDK builds the default data client internally via
77
+ `createDefaultDataClient` and stores it on `config._data`.
78
+ - `CapxulConfig.data` renamed to `_data` (internal test seam).
79
+ - `CapxulAuthConfig.createDataClient` removed from public types.
80
+ - `convex` moved from `peerDependencies` to `dependencies`.
81
+
82
+ ### Patch Changes
83
+
84
+ - d252aa7: Widen the published React peer dependency to `>=18.2.0 <20` so React 18 consumers, including the Ink reference proof app, can install the alpha SDK without peer conflicts.
85
+ - Updated dependencies [995383f]
86
+ - Updated dependencies [2ef4ee3]
87
+ - Updated dependencies [c7146bf]
88
+ - @capxul/sdk@0.2.0-alpha.2
89
+
90
+ ## 0.2.0-alpha.1
91
+
92
+ ### Minor Changes
93
+
94
+ - **Transport ownership (#656):** Remove the `auth.createDataClient`
95
+ callback from `CapxulProvider`. The React provider now passes its
96
+ singleton data client via `CapxulConfig._data` and lets the SDK own
97
+ runtime construction after OTP verification.
98
+
99
+ ### Patch Changes
100
+
101
+ - Updated dependencies
102
+ - @capxul/sdk@0.2.0-alpha.1
103
+
104
+ ## 0.1.0-alpha.12
105
+
106
+ ### Minor Changes
107
+
108
+ - Publish the post-alpha.11 SDK and React SDK surface: funds v1 sub-account
109
+ runtime coverage, React hook wiring, payments list support, and the latest
110
+ generated Convex API snapshots used by current alpha consumers.
111
+
112
+ Note: alpha.10 and alpha.11 were intermediate runner artifacts from the
113
+ prior release pipeline (manual `package.json` bumps that were never folded
114
+ back into the repo). alpha.12 reconciles `package.json`, the changesets
115
+ state, and npm to a single consistent version.
116
+
117
+ ### Patch Changes
118
+
119
+ - Updated dependencies
120
+ - @capxul/sdk@0.1.0-alpha.12
121
+
3
122
  ## 0.1.0-alpha.9
4
123
 
5
124
  ### Minor Changes
package/README.md CHANGED
@@ -68,29 +68,23 @@ function Header() {
68
68
  }
69
69
  ```
70
70
 
71
- Drive an OTP sign-in flow with `useAuthFlow()` — a
72
- [`useActor`](https://stately.ai/docs/xstate-react#useactor) observer
73
- over the canonical XState v5 machine in `@capxul/sdk`:
71
+ Drive an OTP sign-in flow with `useAuth()` — the canonical React auth
72
+ wrapper over `AuthService`:
74
73
 
75
74
  ```tsx
76
- import { useAuthFlow } from "@capxul/sdk-react";
77
- import { toEmail } from "@capxul/sdk";
75
+ import { useAuth } from "@capxul/sdk-react";
78
76
 
79
77
  function SignIn() {
80
- const { snapshot, send } = useAuthFlow();
78
+ const auth = useAuth();
81
79
 
82
- if (snapshot.matches("idle")) {
80
+ if (auth.state === "idle") {
83
81
  return (
84
- <button
85
- onClick={() =>
86
- send({ type: "REQUEST_OTP", email: toEmail("alice@example.com") })
87
- }
88
- >
82
+ <button onClick={() => auth.signIn("alice@example.com")}>
89
83
  Send code
90
84
  </button>
91
85
  );
92
86
  }
93
- // … handle "sending_otp", "otp_requested", "verifying", "authenticated"
87
+ // … handle "sendingOtp", "awaitingOtp", "bootstrapping", "authenticated"
94
88
  }
95
89
  ```
96
90
 
@@ -106,11 +100,11 @@ function Banner() {
106
100
  const status = useCapxulStatus();
107
101
 
108
102
  switch (status.status) {
109
- case "idle": // no network call yet
110
- case "bootstrapping": // /v1/client/bootstrap in flight
103
+ case "idle": // no network call yet
104
+ case "bootstrapping": // /v1/client/bootstrap in flight
111
105
  return <Spinner />;
112
- case "ready": // bootstrapped, no session
113
- case "authenticated": // bootstrapped + session live
106
+ case "ready": // bootstrapped, no session
107
+ case "authenticated": // bootstrapped + session live
114
108
  return null;
115
109
  case "error":
116
110
  return <ErrorBanner error={status.error} />;
@@ -129,11 +123,11 @@ itself never re-renders.
129
123
  The publishable-key path is runtime-proven where the repo can run it
130
124
  without secrets:
131
125
 
132
- | Surface | Runtime proof | Expected safe signal |
133
- |---|---|---|
134
- | Provider + `useMe()` | `corepack pnpm --filter @capxul/sdk-react check-types` plus the headless proof tests under `packages/sdk-react/ops/proof` | provider reaches `useCapxulStatus().status === "ready"` after one bootstrap request |
135
- | Reference CLI mock | `corepack pnpm --filter @capxul/reference-cli build && node apps/reference-cli/dist/cli.js bootstrap probe --mock --json` | `ok:true`, `mode:"publishable-key"`, `bootstrapRequests:1`, `authRequests:1`, `keyLengthClass:"provided"` |
136
- | Reference CLI live | same command without `--mock`, with `CAPXUL_REF_PUBLISHABLE_KEY` and optional `CAPXUL_REF_BOOTSTRAP_URL` set locally | success only when the key/origin/runtime are valid; otherwise sanitized SDK error JSON |
126
+ | Surface | Runtime proof | Expected safe signal |
127
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
128
+ | Provider + `useMe()` | `corepack pnpm --filter @capxul/sdk-react check-types` plus the headless proof tests under `packages/sdk-react/ops/proof` | provider reaches `useCapxulStatus().status === "ready"` after one bootstrap request |
129
+ | Reference CLI mock | `corepack pnpm --filter @capxul/reference-cli build && node apps/reference-cli/dist/cli.js bootstrap probe --mock --json` | `ok:true`, `mode:"publishable-key"`, `bootstrapRequests:1`, `authRequests:1`, `keyLengthClass:"provided"` |
130
+ | Reference CLI live | same command without `--mock`, with `CAPXUL_REF_PUBLISHABLE_KEY` and optional `CAPXUL_REF_BOOTSTRAP_URL` set locally | success only when the key/origin/runtime are valid; otherwise sanitized SDK error JSON |
137
131
 
138
132
  Do not paste or commit publishable keys, session tokens, Convex JWTs,
139
133
  cookies, or provider payloads. Proof output reports only
@@ -141,22 +135,22 @@ cookies, or provider payloads. Proof output reports only
141
135
 
142
136
  ## Hooks catalogue
143
137
 
144
- | Surface | Hook |
145
- |---|---|
146
- | Imperative client | `useCapxul()` |
147
- | Identity | `useMe`, `useAccount` |
148
- | Organizations | `useOrganization`, `useOrganizations`, `useMember`, `useMembers` |
149
- | Payments | `usePayment`, `usePayments`, `useOrgPayments` |
150
- | Transfers | `useTransfer`, `useTransfers`, `useOrgTransfers` |
151
- | Withdrawals | `useWithdrawal`, `useWithdrawals`, `useOrgWithdrawals` |
152
- | Documents | `useDocument`, `useDocuments`, `useOrgDocuments` |
153
- | Sub-accounts / virtual | `useSubAccount`, `useSubAccounts`, `useVirtualAccount`, `useVirtualAccounts`, `useVirtualCard`, `useVirtualCards` |
154
- | Settings | `useApiKey`, `useApiKeys`, `useWebhookEndpoint`, `useWebhookEndpoints`, `useWebhookEvent`, `useExternalAccount`, `useExternalAccounts`, `useBalanceLedgerEntry`, `useBalanceLedger` |
155
- | KYC / KYB | `useKycProfile`, `useKybProfile` |
156
- | Treasury | `useTreasury`, `useSafe` |
157
- | Operations | `useOperation` (correlation join key per CANON.md §3.3) |
158
- | Lifecycle | `useCapxulStatus` |
159
- | Flows | `useAuthFlow`, `useOnboardingFlow`, `useProvisioningFlow` |
138
+ | Surface | Hook |
139
+ | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
140
+ | Imperative client | `useCapxul()` |
141
+ | Identity | `useMe`, `useAccount` |
142
+ | Organizations | `useOrganization`, `useOrganizations`, `useMember`, `useMembers` |
143
+ | Payments | `usePayment`, `usePayments`, `useOrgPayments` |
144
+ | Transfers | `useTransfer`, `useTransfers`, `useOrgTransfers` |
145
+ | Withdrawals | `useWithdrawal`, `useWithdrawals`, `useOrgWithdrawals` |
146
+ | Documents | `useDocument`, `useDocuments`, `useOrgDocuments` |
147
+ | Sub-accounts / virtual | `useSubAccount`, `useSubAccounts`, `useVirtualAccount`, `useVirtualAccounts`, `useVirtualCard`, `useVirtualCards` |
148
+ | Settings | `useApiKey`, `useApiKeys`, `useWebhookEndpoint`, `useWebhookEndpoints`, `useWebhookEvent`, `useExternalAccount`, `useExternalAccounts`, `useBalanceLedgerEntry`, `useBalanceLedger` |
149
+ | KYC / KYB | `useKycProfile` |
150
+ | Treasury | `useTreasury`, `useSafe` |
151
+ | Operations | `useOperation` (correlation join key per CANON.md §3.3) |
152
+ | Lifecycle | `useCapxulStatus` |
153
+ | Flows | `useOnboardingFlow`, `useProvisioningFlow` |
160
154
 
161
155
  Most "not-yet-implemented" verticals return a `QueryResult<T>` in the
162
156
  `error` state with `code: "NOT_IMPLEMENTED"` — they compile, render
@@ -169,7 +163,7 @@ Read hooks return a discriminated union:
169
163
  ```ts
170
164
  type QueryResult<T> =
171
165
  | { readonly status: "loading" }
172
- | { readonly status: "data"; readonly data: T }
166
+ | { readonly status: "data"; readonly data: T }
173
167
  | { readonly status: "error"; readonly error: CapxulError };
174
168
  ```
175
169