@capxul/sdk-react 0.1.0-alpha.10 → 0.1.0-alpha.12

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,10 +1,18 @@
1
1
  # @capxul/sdk-react
2
2
 
3
- ## 0.1.0-alpha.10
3
+ ## 0.1.0-alpha.12
4
+
5
+ ### Minor Changes
6
+
7
+ - f497aef: Publish the post-alpha.11 SDK and React SDK surface: funds v1 sub-account
8
+ runtime coverage, React hook wiring, payments list support, and the latest
9
+ generated Convex API snapshots used by current alpha consumers.
4
10
 
5
11
  ### Patch Changes
6
12
 
7
13
  - 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.
14
+ - Updated dependencies [f497aef]
15
+ - @capxul/sdk@0.1.0-alpha.12
8
16
 
9
17
  ## 0.1.0-alpha.9
10
18
 
package/dist/index.cjs CHANGED
@@ -81,10 +81,16 @@ var Errors = {
81
81
  `Shield API error (${status}): ${detail}`,
82
82
  { details: { provider: "shield", status } }
83
83
  ),
84
- providerError: (provider, operation, cause) => new CapxulError(
85
- "PROVIDER_ERROR",
86
- `${provider} ${operation} failed: ${cause instanceof Error ? cause.message : String(cause)}`,
87
- { cause, details: { provider, operation } }
84
+ providerError: (provider, operation, cause) => (
85
+ // Public `message` is redacted to a fixed shape so provider-side
86
+ // exception text never leaks to the client. The original `cause`
87
+ // is preserved on `Error.cause` for server-side debugging via
88
+ // observability sinks (Sentry, console traces).
89
+ new CapxulError(
90
+ "PROVIDER_ERROR",
91
+ `Provider error: ${provider} ${operation}`,
92
+ { cause, details: { provider, operation } }
93
+ )
88
94
  ),
89
95
  invalidInput: (field, reason) => new CapxulError(
90
96
  "INVALID_INPUT",
@@ -473,8 +479,12 @@ function useExternalAccount(args) {
473
479
  [capxul, args.ownerKind, args.ownerId, args.externalAccountId]
474
480
  );
475
481
  }
476
- function useSubAccount(_subAccountId) {
477
- return notImplementedQuery("useSubAccount");
482
+ function useSubAccount(subAccountId) {
483
+ const capxul = useCapxul();
484
+ return useSdkQuery(
485
+ () => capxul.subAccounts.retrieve(subAccountId),
486
+ [capxul, subAccountId]
487
+ );
478
488
  }
479
489
  function useVirtualAccount(_virtualAccountId) {
480
490
  return notImplementedQuery("useVirtualAccount");
@@ -538,8 +548,14 @@ function useExternalAccounts(args) {
538
548
  [capxul, args.ownerKind, args.ownerId]
539
549
  );
540
550
  }
541
- function useSubAccounts(_args) {
542
- return notImplementedQuery("useSubAccounts");
551
+ function useSubAccounts(args) {
552
+ const capxul = useCapxul();
553
+ return useSdkQuery(
554
+ () => args.ownerKind === "account" ? capxul.accounts.subAccounts.list({ accountId: args.ownerId }) : capxul.organizations.subAccounts.list({
555
+ organizationId: args.ownerId
556
+ }),
557
+ [capxul, args.ownerKind, args.ownerId]
558
+ );
543
559
  }
544
560
  function useVirtualAccounts(_filters) {
545
561
  return notImplementedQuery("useVirtualAccounts");
package/dist/index.d.cts CHANGED
@@ -270,7 +270,19 @@ declare function useKybProfile(_organizationId: OrganizationId): QueryResult<Kyb
270
270
  * differ but the wire shape is identical.
271
271
  */
272
272
  declare function useExternalAccount(args: UseExternalAccountArgs): QueryResult<ExternalAccount>;
273
- declare function useSubAccount(_subAccountId: SubAccountId): QueryResult<SubAccount>;
273
+ /**
274
+ * Funds v1 PR-2b (#421) — wired through `capxul.subAccounts.retrieve`.
275
+ *
276
+ * The top-level `subAccounts.retrieve` resolves to the same Convex
277
+ * query handler as `accounts.subAccounts.retrieve` /
278
+ * `organizations.subAccounts.retrieve`; visibility is gated server-side
279
+ * (canon §sub_account read contract — cross-scope reads surface as
280
+ * `NOT_FOUND` rather than a distinct permission code). The SDK has
281
+ * already branded the wire shape via `tryBrandSubAccount`, so the hook
282
+ * receives a fully-branded `SubAccount` (`SubAccountId`, `Money`,
283
+ * `TimestampIso`).
284
+ */
285
+ declare function useSubAccount(subAccountId: SubAccountId): QueryResult<SubAccount>;
274
286
  declare function useVirtualAccount(_virtualAccountId: VirtualAccountId): QueryResult<VirtualAccount>;
275
287
  declare function useVirtualCard(_virtualCardId: VirtualCardId): QueryResult<VirtualCard>;
276
288
  declare function usePayment(_paymentId: PaymentId): QueryResult<Payment>;
@@ -392,7 +404,24 @@ declare function useMembers(_organizationId: OrganizationId): QueryResult<List<M
392
404
  * `pending_verification` rows visible (D5).
393
405
  */
394
406
  declare function useExternalAccounts(args: OwnerRef): QueryResult<List<ExternalAccount>>;
395
- declare function useSubAccounts(_args: OwnerRef): QueryResult<List<SubAccount>>;
407
+ /**
408
+ * Funds v1 PR-2b (#421) — wired through the SDK.
409
+ *
410
+ * Branches on `args.ownerKind`: `account` scope reads through
411
+ * `capxul.accounts.subAccounts.list({ accountId })`; `organization`
412
+ * scope reads through `capxul.organizations.subAccounts.list({
413
+ * organizationId })`. Both resolve to the same Convex domain (server
414
+ * derives the writer scope per Pattern A — see `sdk.md`). The SDK
415
+ * has already branded each row via `tryBrandSubAccount`, so consumers
416
+ * receive `List<SubAccount>` with `SubAccountId`, `Money`, and
417
+ * `TimestampIso` in place.
418
+ *
419
+ * Note: `OwnerRef` admits only `"account" | "organization"`. A
420
+ * `sub_account` owner is a type error at the call site — not a runtime
421
+ * not-supported branch — because there is no `listChildSubAccounts`
422
+ * backend endpoint.
423
+ */
424
+ declare function useSubAccounts(args: OwnerRef): QueryResult<List<SubAccount>>;
396
425
  declare function useVirtualAccounts(_filters?: VirtualAccountsFilters): QueryResult<List<VirtualAccount>>;
397
426
  declare function useVirtualCards(_filters?: VirtualCardsFilters): QueryResult<List<VirtualCard>>;
398
427
  /**
package/dist/index.d.ts CHANGED
@@ -270,7 +270,19 @@ declare function useKybProfile(_organizationId: OrganizationId): QueryResult<Kyb
270
270
  * differ but the wire shape is identical.
271
271
  */
272
272
  declare function useExternalAccount(args: UseExternalAccountArgs): QueryResult<ExternalAccount>;
273
- declare function useSubAccount(_subAccountId: SubAccountId): QueryResult<SubAccount>;
273
+ /**
274
+ * Funds v1 PR-2b (#421) — wired through `capxul.subAccounts.retrieve`.
275
+ *
276
+ * The top-level `subAccounts.retrieve` resolves to the same Convex
277
+ * query handler as `accounts.subAccounts.retrieve` /
278
+ * `organizations.subAccounts.retrieve`; visibility is gated server-side
279
+ * (canon §sub_account read contract — cross-scope reads surface as
280
+ * `NOT_FOUND` rather than a distinct permission code). The SDK has
281
+ * already branded the wire shape via `tryBrandSubAccount`, so the hook
282
+ * receives a fully-branded `SubAccount` (`SubAccountId`, `Money`,
283
+ * `TimestampIso`).
284
+ */
285
+ declare function useSubAccount(subAccountId: SubAccountId): QueryResult<SubAccount>;
274
286
  declare function useVirtualAccount(_virtualAccountId: VirtualAccountId): QueryResult<VirtualAccount>;
275
287
  declare function useVirtualCard(_virtualCardId: VirtualCardId): QueryResult<VirtualCard>;
276
288
  declare function usePayment(_paymentId: PaymentId): QueryResult<Payment>;
@@ -392,7 +404,24 @@ declare function useMembers(_organizationId: OrganizationId): QueryResult<List<M
392
404
  * `pending_verification` rows visible (D5).
393
405
  */
394
406
  declare function useExternalAccounts(args: OwnerRef): QueryResult<List<ExternalAccount>>;
395
- declare function useSubAccounts(_args: OwnerRef): QueryResult<List<SubAccount>>;
407
+ /**
408
+ * Funds v1 PR-2b (#421) — wired through the SDK.
409
+ *
410
+ * Branches on `args.ownerKind`: `account` scope reads through
411
+ * `capxul.accounts.subAccounts.list({ accountId })`; `organization`
412
+ * scope reads through `capxul.organizations.subAccounts.list({
413
+ * organizationId })`. Both resolve to the same Convex domain (server
414
+ * derives the writer scope per Pattern A — see `sdk.md`). The SDK
415
+ * has already branded each row via `tryBrandSubAccount`, so consumers
416
+ * receive `List<SubAccount>` with `SubAccountId`, `Money`, and
417
+ * `TimestampIso` in place.
418
+ *
419
+ * Note: `OwnerRef` admits only `"account" | "organization"`. A
420
+ * `sub_account` owner is a type error at the call site — not a runtime
421
+ * not-supported branch — because there is no `listChildSubAccounts`
422
+ * backend endpoint.
423
+ */
424
+ declare function useSubAccounts(args: OwnerRef): QueryResult<List<SubAccount>>;
396
425
  declare function useVirtualAccounts(_filters?: VirtualAccountsFilters): QueryResult<List<VirtualAccount>>;
397
426
  declare function useVirtualCards(_filters?: VirtualCardsFilters): QueryResult<List<VirtualCard>>;
398
427
  /**
package/dist/index.js CHANGED
@@ -79,10 +79,16 @@ var Errors = {
79
79
  `Shield API error (${status}): ${detail}`,
80
80
  { details: { provider: "shield", status } }
81
81
  ),
82
- providerError: (provider, operation, cause) => new CapxulError(
83
- "PROVIDER_ERROR",
84
- `${provider} ${operation} failed: ${cause instanceof Error ? cause.message : String(cause)}`,
85
- { cause, details: { provider, operation } }
82
+ providerError: (provider, operation, cause) => (
83
+ // Public `message` is redacted to a fixed shape so provider-side
84
+ // exception text never leaks to the client. The original `cause`
85
+ // is preserved on `Error.cause` for server-side debugging via
86
+ // observability sinks (Sentry, console traces).
87
+ new CapxulError(
88
+ "PROVIDER_ERROR",
89
+ `Provider error: ${provider} ${operation}`,
90
+ { cause, details: { provider, operation } }
91
+ )
86
92
  ),
87
93
  invalidInput: (field, reason) => new CapxulError(
88
94
  "INVALID_INPUT",
@@ -471,8 +477,12 @@ function useExternalAccount(args) {
471
477
  [capxul, args.ownerKind, args.ownerId, args.externalAccountId]
472
478
  );
473
479
  }
474
- function useSubAccount(_subAccountId) {
475
- return notImplementedQuery("useSubAccount");
480
+ function useSubAccount(subAccountId) {
481
+ const capxul = useCapxul();
482
+ return useSdkQuery(
483
+ () => capxul.subAccounts.retrieve(subAccountId),
484
+ [capxul, subAccountId]
485
+ );
476
486
  }
477
487
  function useVirtualAccount(_virtualAccountId) {
478
488
  return notImplementedQuery("useVirtualAccount");
@@ -536,8 +546,14 @@ function useExternalAccounts(args) {
536
546
  [capxul, args.ownerKind, args.ownerId]
537
547
  );
538
548
  }
539
- function useSubAccounts(_args) {
540
- return notImplementedQuery("useSubAccounts");
549
+ function useSubAccounts(args) {
550
+ const capxul = useCapxul();
551
+ return useSdkQuery(
552
+ () => args.ownerKind === "account" ? capxul.accounts.subAccounts.list({ accountId: args.ownerId }) : capxul.organizations.subAccounts.list({
553
+ organizationId: args.ownerId
554
+ }),
555
+ [capxul, args.ownerKind, args.ownerId]
556
+ );
541
557
  }
542
558
  function useVirtualAccounts(_filters) {
543
559
  return notImplementedQuery("useVirtualAccounts");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sdk-react",
3
- "version": "0.1.0-alpha.10",
3
+ "version": "0.1.0-alpha.12",
4
4
  "description": "React provider + hooks for the @capxul/sdk headless client.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -46,7 +46,7 @@
46
46
  "access": "public"
47
47
  },
48
48
  "dependencies": {
49
- "@capxul/sdk": "0.1.0-alpha.9"
49
+ "@capxul/sdk": "0.1.0-alpha.12"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@tanstack/react-query": "^5",
@@ -70,10 +70,10 @@
70
70
  "typescript": "5.9.2",
71
71
  "viem": "2.47.10",
72
72
  "vitest": "^4.1.2",
73
- "@repo/observability": "0.0.0",
74
73
  "@repo/config": "0.0.0",
75
- "@repo/typescript-config": "0.0.0",
76
- "@repo/platform-kernel": "0.0.0"
74
+ "@repo/observability": "0.0.0",
75
+ "@repo/platform-kernel": "0.0.0",
76
+ "@repo/typescript-config": "0.0.0"
77
77
  },
78
78
  "scripts": {
79
79
  "build": "tsup",