@capxul/sdk-react 1.0.0-alpha.6 → 1.0.0-alpha.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.
package/dist/index.d.mts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { ReactNode } from "react";
2
2
  import { QueryClient, UseMutationResult, UseQueryResult } from "@tanstack/react-query";
3
- import { Account, AccountLifecycle, AccountRequirement, AssignRoleInput, CapxulClient, CapxulSigner, CreateOrgInput, InviteMemberInput, MemberView, OrgId, OrgSpendInput, OrgSpendResult, OrgView, Profile, RemoveMemberInput, RoleView, Session, TransferInput, TransferResult } from "@capxul/sdk";
4
- import { CapxulError } from "@capxul/config";
5
- import { Account as Account$1, AccountId, Money, SubAccount, SubAccountId } from "@capxul/types";
3
+ import { Account, AccountLifecycle, AccountRequirement, AssignRoleInput, CapxulClient, CapxulSigner, CreateOrgInput, InviteMemberInput, MemberView, OrgId, OrgView, Profile, RemoveMemberInput, RoleView, Session, TransferInput, TransferResult } from "@capxul/sdk";
6
4
 
7
5
  //#region src/provider.d.ts
8
6
  type CapxulProviderSharedProps = {
@@ -33,6 +31,24 @@ type CapxulProviderInjectedClientProps = CapxulProviderSharedProps & {
33
31
  type CapxulProviderProps = CapxulProviderPublishableKeyProps | CapxulProviderInjectedClientProps;
34
32
  declare function CapxulProvider(props: CapxulProviderProps): import("react/jsx-runtime").JSX.Element;
35
33
  //#endregion
34
+ //#region ../errors/src/errors.d.ts
35
+ declare const CAPXUL_ERROR_CODES: readonly ["NOT_AUTHENTICATED", "EMAIL_DELIVERY_FAILED", "PROFILE_NOT_FOUND", "SMART_ACCOUNT_MISSING", "PLAYER_NOT_FOUND", "ACCOUNT_NOT_FOUND", "PROVIDER_ERROR", "INVALID_INPUT", "ENV_MISSING", "NOT_IMPLEMENTED", "VERIFICATION_REQUIRED", "INSUFFICIENT_BALANCE", "INVALID_RECIPIENT", "ROLE_PERMISSION_DENIED", "TRANSACTION_FAILED", "RATE_LIMITED", "NETWORK_ERROR", "UNKNOWN", "OTP_EXPIRED", "SIGNER_REJECTED", "CANCELLED", "WRONG_STATE"];
36
+ type CapxulErrorCode = (typeof CAPXUL_ERROR_CODES)[number];
37
+ type CapxulErrorDetails = Record<string, unknown>;
38
+ type CapxulErrorOptions = {
39
+ readonly cause?: unknown;
40
+ readonly details?: CapxulErrorDetails;
41
+ readonly correlationId?: string;
42
+ readonly layer?: string;
43
+ };
44
+ declare class CapxulError extends Error {
45
+ readonly code: CapxulErrorCode;
46
+ readonly details?: CapxulErrorDetails;
47
+ readonly correlationId?: string;
48
+ readonly layer?: string;
49
+ constructor(code: CapxulErrorCode, message: string, options?: CapxulErrorOptions);
50
+ }
51
+ //#endregion
36
52
  //#region src/internal/capxul-bootstrap-context.d.ts
37
53
  type CapxulBootstrapStatus = "bootstrapping" | "ready" | "error";
38
54
  interface CapxulBootstrapState {
@@ -42,6 +58,14 @@ interface CapxulBootstrapState {
42
58
  }
43
59
  declare function useCapxul(): CapxulBootstrapState;
44
60
  //#endregion
61
+ //#region src/internal/capxul-client-context.d.ts
62
+ /**
63
+ * Returns the client, or `null` while `<CapxulProvider>` is still bootstrapping.
64
+ * Data hooks use this so they can sit in `isPending` (disabled query) until the
65
+ * client resolves, rather than throwing during bootstrap.
66
+ */
67
+ declare function useCapxulClientOrNull(): CapxulClient | null;
68
+ //#endregion
45
69
  //#region src/hooks/use-capxul-session.d.ts
46
70
  type UseCapxulSessionReturn = UseQueryResult<Session | null, CapxulError>;
47
71
  declare function useCapxulSession(): UseCapxulSessionReturn;
@@ -70,6 +94,64 @@ type UseCapxulAccountBalanceOptions = {
70
94
  };
71
95
  declare function useCapxulAccountBalance(options?: UseCapxulAccountBalanceOptions): UseCapxulAccountBalanceReturn;
72
96
  //#endregion
97
+ //#region ../types/src/brand.d.ts
98
+ /**
99
+ * Nominal type helper. `Brand<T, B>` is structurally a `T` at runtime but
100
+ * distinct at compile time, preventing accidental swaps between primitives.
101
+ *
102
+ * @internal
103
+ */
104
+ declare const brand: unique symbol;
105
+ type Brand<T, B extends string> = T & {
106
+ readonly [brand]: B;
107
+ };
108
+ //#endregion
109
+ //#region ../types/src/index.d.ts
110
+ type Money = {
111
+ readonly currency: CurrencyCode;
112
+ readonly value: string;
113
+ readonly decimals: number;
114
+ };
115
+ type Account$1 = {
116
+ readonly id: AccountId;
117
+ readonly balance: Money;
118
+ readonly available: Money;
119
+ };
120
+ /** Named bucket partitioning a logical Account (canon §9). */
121
+ type SubAccount = {
122
+ readonly id: SubAccountId;
123
+ readonly accountId: AccountId;
124
+ readonly name: string;
125
+ readonly balance: Money;
126
+ readonly createdAt: EpochMs;
127
+ };
128
+ type AccountId = Brand<string, "AccountId">;
129
+ type SubAccountId = Brand<string, "SubAccountId">;
130
+ type EpochMs = Brand<number, "EpochMs">;
131
+ type CurrencyCode = Brand<SupportedCurrencyCode, "CurrencyCode">;
132
+ declare const SUPPORTED_CURRENCIES: readonly [{
133
+ readonly code: "USD";
134
+ readonly symbol: "$";
135
+ readonly name: "US Dollar";
136
+ }, {
137
+ readonly code: "NGN";
138
+ readonly symbol: "NGN";
139
+ readonly name: "Nigerian Naira";
140
+ }, {
141
+ readonly code: "GHS";
142
+ readonly symbol: "GHS";
143
+ readonly name: "Ghanaian Cedi";
144
+ }, {
145
+ readonly code: "KES";
146
+ readonly symbol: "KSh";
147
+ readonly name: "Kenyan Shilling";
148
+ }, {
149
+ readonly code: "UGX";
150
+ readonly symbol: "USh";
151
+ readonly name: "Ugandan Shilling";
152
+ }];
153
+ type SupportedCurrencyCode = (typeof SUPPORTED_CURRENCIES)[number]["code"];
154
+ //#endregion
73
155
  //#region src/hooks/use-capxul-account-fund.d.ts
74
156
  type UseCapxulAccountFundReturn = UseMutationResult<{
75
157
  readonly txHash: string;
@@ -247,17 +329,25 @@ declare function useCapxulRemoveMember(orgId: OrgId | undefined): UseCapxulRemov
247
329
  type UseCapxulAssignRoleReturn = UseMutationResult<MemberView, CapxulError, AssignRoleInput>;
248
330
  declare function useCapxulAssignRole(orgId: OrgId | undefined): UseCapxulAssignRoleReturn;
249
331
  //#endregion
250
- //#region src/hooks/use-capxul-org-spend.d.ts
332
+ //#region src/hooks/use-capxul-switch-acting-entity.d.ts
333
+ type SwitchActingEntityInput = {
334
+ readonly orgId?: OrgId;
335
+ };
251
336
  /**
252
- * Spend from an Org's scoped sub-account (canon §C2 J3+J4 capstone / §C3, S4,
253
- * D5) — two-level gated (Level 1 Zodiac cap + Level 2 envelope scope/balance)
254
- * one-UserOp spend via CapxulPayments. Entity-scoped via the closed-over
255
- * `orgId` (D13). Binds directly to `capxul.org(orgId).spend(input)`. On success,
256
- * invalidates the treasury (balance moved). RED until S4 `mutate` rejects with
257
- * `Errors.notImplemented("org","spend")`.
337
+ * Switch the acting entity (personal Account Organization).
338
+ *
339
+ * Per canon D13 the acting entity is NOT shared mutable SDK state — scoping is
340
+ * explicit per `capxul.org(orgId)` call — so this mutation carries no SDK side
341
+ * effect. It exists as the stable mutation seam the headless
342
+ * `CapxulEntitySwitcher` drives; the actual context switch is the consumer's
343
+ * own local state, applied through the component's `onSwitchPersonal` /
344
+ * `onSwitchOrg` callbacks.
345
+ *
346
+ * The legacy `org_entity_switched` telemetry emission was removed when master's
347
+ * unified telemetry pipeline (#402) dropped that event from the Layer 0 spine.
258
348
  */
259
- type UseCapxulOrgSpendReturn = UseMutationResult<OrgSpendResult, CapxulError, OrgSpendInput>;
260
- declare function useCapxulOrgSpend(orgId: OrgId | undefined): UseCapxulOrgSpendReturn;
349
+ type UseCapxulSwitchActingEntityReturn = UseMutationResult<void, Error, SwitchActingEntityInput | undefined>;
350
+ declare function useCapxulSwitchActingEntity(): UseCapxulSwitchActingEntityReturn;
261
351
  //#endregion
262
- export { type CapxulBootstrapState, type CapxulBootstrapStatus, CapxulProvider, type CapxulProviderProps, type SignInInput, type SignInSuccess, type UseCapxulAccountBalanceOptions, type UseCapxulAccountBalanceReturn, type UseCapxulAccountFundReturn, type UseCapxulAccountLifecycleReturn, type UseCapxulAssignRoleReturn, type UseCapxulCreateOrgReturn, type UseCapxulInviteMemberReturn, type UseCapxulOrgDeployRolesReturn, type UseCapxulOrgMembersOptions, type UseCapxulOrgMembersReturn, type UseCapxulOrgOptions, type UseCapxulOrgReturn, type UseCapxulOrgRolesOptions, type UseCapxulOrgRolesReturn, type UseCapxulOrgSpendReturn, type UseCapxulOrgTreasuryOptions, type UseCapxulOrgTreasuryReturn, type UseCapxulOrgsReturn, type UseCapxulProfileReturn, type UseCapxulRemoveMemberReturn, type UseCapxulSessionReturn, type UseCapxulSignInReturn, type UseCapxulSignOutReturn, type UseCapxulSubAccountCreateReturn, type UseCapxulSubAccountDeleteReturn, type UseCapxulSubAccountRenameReturn, type UseCapxulSubAccountsListOptions, type UseCapxulSubAccountsListReturn, type UseCapxulTransferReturn, type UseCapxulVerifyOtpReturn, type VerifyOtpInput, useCapxul, useCapxulAccountBalance, useCapxulAccountFund, useCapxulAccountLifecycle, useCapxulAssignRole, useCapxulCreateOrg, useCapxulInviteMember, useCapxulOrg, useCapxulOrgDeployRoles, useCapxulOrgMembers, useCapxulOrgRoles, useCapxulOrgSpend, useCapxulOrgTreasury, useCapxulOrgs, useCapxulProfile, useCapxulRemoveMember, useCapxulSession, useCapxulSignIn, useCapxulSignOut, useCapxulSubAccountCreate, useCapxulSubAccountDelete, useCapxulSubAccountRename, useCapxulSubAccountsList, useCapxulTransfer, useCapxulVerifyOtp };
352
+ export { type CapxulBootstrapState, type CapxulBootstrapStatus, CapxulProvider, type CapxulProviderProps, type SignInInput, type SignInSuccess, type SwitchActingEntityInput, type UseCapxulAccountBalanceOptions, type UseCapxulAccountBalanceReturn, type UseCapxulAccountFundReturn, type UseCapxulAccountLifecycleReturn, type UseCapxulAssignRoleReturn, type UseCapxulCreateOrgReturn, type UseCapxulInviteMemberReturn, type UseCapxulOrgDeployRolesReturn, type UseCapxulOrgMembersOptions, type UseCapxulOrgMembersReturn, type UseCapxulOrgOptions, type UseCapxulOrgReturn, type UseCapxulOrgRolesOptions, type UseCapxulOrgRolesReturn, type UseCapxulOrgTreasuryOptions, type UseCapxulOrgTreasuryReturn, type UseCapxulOrgsReturn, type UseCapxulProfileReturn, type UseCapxulRemoveMemberReturn, type UseCapxulSessionReturn, type UseCapxulSignInReturn, type UseCapxulSignOutReturn, type UseCapxulSubAccountCreateReturn, type UseCapxulSubAccountDeleteReturn, type UseCapxulSubAccountRenameReturn, type UseCapxulSubAccountsListOptions, type UseCapxulSubAccountsListReturn, type UseCapxulSwitchActingEntityReturn, type UseCapxulTransferReturn, type UseCapxulVerifyOtpReturn, type VerifyOtpInput, useCapxul, useCapxulAccountBalance, useCapxulAccountFund, useCapxulAccountLifecycle, useCapxulAssignRole, useCapxulClientOrNull, useCapxulCreateOrg, useCapxulInviteMember, useCapxulOrg, useCapxulOrgDeployRoles, useCapxulOrgMembers, useCapxulOrgRoles, useCapxulOrgTreasury, useCapxulOrgs, useCapxulProfile, useCapxulRemoveMember, useCapxulSession, useCapxulSignIn, useCapxulSignOut, useCapxulSubAccountCreate, useCapxulSubAccountDelete, useCapxulSubAccountRename, useCapxulSubAccountsList, useCapxulSwitchActingEntity, useCapxulTransfer, useCapxulVerifyOtp };
263
353
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/provider.tsx","../src/internal/capxul-bootstrap-context.tsx","../src/hooks/use-capxul-session.ts","../src/hooks/use-capxul-profile.ts","../src/hooks/use-capxul-account-lifecycle.ts","../src/hooks/use-capxul-account-balance.ts","../src/hooks/use-capxul-account-fund.ts","../src/hooks/use-capxul-sign-in.ts","../src/hooks/use-capxul-verify-otp.ts","../src/hooks/use-capxul-sign-out.ts","../src/hooks/use-capxul-sub-accounts.ts","../src/hooks/use-capxul-orgs.ts","../src/hooks/use-capxul-org.ts","../src/hooks/use-capxul-org-members.ts","../src/hooks/use-capxul-org-roles.ts","../src/hooks/use-capxul-org-deploy-roles.ts","../src/hooks/use-capxul-org-treasury.ts","../src/hooks/use-capxul-create-org.ts","../src/hooks/use-capxul-invite-member.ts","../src/hooks/use-capxul-remove-member.ts","../src/hooks/use-capxul-assign-role.ts","../src/hooks/use-capxul-org-spend.ts"],"mappings":";;;;;;;KAgCK,yBAAA;iFAEM,WAAA,GAAc,WAAA;EAAA,SACd,QAAA,EAAU,SAAS;AAAA;;KAIzB,iCAAA,GAAoC,yBAAA;EAAA,SAC9B,cAAA;EAAA,SACA,MAAA,UAPc;EAAA,SASd,WAAA,GAAc,kBAAA;EARJ;;AAAS;AAAA;EAAT,SAaV,MAAA,GAAS,YAAA;AAAA;;;;;KAOf,iCAAA,GAAoC,yBAAA;EAAA,SAC9B,MAAA,EAAQ,YAAY;EAAA,SACpB,cAAA;EAAA,SACA,WAAA;EAAA,SACA,MAAA;AAAA;AAAA,KAGC,mBAAA,GACR,iCAAA,GACA,iCAAiC;AAAA,iBAuBrB,cAAA,CAAe,KAAA,EAAO,mBAAmB,+BAAA,GAAA,CAAA,OAAA;;;KCzE7C,qBAAA;AAAA,UAEK,oBAAA;EAAA,SACN,MAAA,EAAQ,qBAAA;EAAA,SACR,KAAA,EAAO,WAAW;EAAA,SAClB,KAAA;AAAA;AAAA,iBAgBK,SAAA,CAAA,GAAa,oBAAoB;;;KCvBrC,sBAAA,GAAyB,cAAA,CAAe,OAAA,SAAgB,WAAA;AAAA,iBAEpD,gBAAA,CAAA,GAAoB,sBAAsB;;;KCF9C,sBAAA,GAAyB,cAAA,CAAe,OAAA,SAAgB,WAAA;AAAA,iBAEpD,gBAAA,CAAA,GAAoB,sBAAsB;;;UCEzC,+BAAA;EAAA,SACN,SAAA,EAAW,gBAAA;EAAA,SACX,WAAA;EAAA,SACA,KAAA,EAAO,WAAA;EAAA,SACP,SAAA;EAAA,SACA,UAAA;EAAA,SACA,OAAA;EAAA,SACA,KAAA,EAAO,iBAAA,CAAkB,gBAAA,EAAkB,WAAA;EAAA,SAC3C,UAAA;AAAA;AAAA,iBAGK,yBAA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gE;;;;;;AAAA,KgBCtE,0BAAA,GAA6B,cAAA,CAAe,SAAA,EAAS,WAAA;AAAA,iBAEjD,oBAAA,CACd,KAAA,EAAO,KAAA,cACP,OAAA,GAAU,2BAAA,GACT,0BAAA;;;;;;;AhBN+E;KiBLtE,wBAAA,GAA2B,iBAAA,CAAkB,OAAA,EAAS,WAAA,EAAa,cAAA;AAAA,iBAE/D,kBAAA,CAAA,GAAsB,wBAAwB;;;;;;;AjBGoB;;KkBJtE,2BAAA,GAA8B,iBAAA,CACxC,UAAA,EACA,WAAA,EACA,iBAAA;AAAA,iBAGc,qBAAA,CAAsB,KAAA,EAAO,KAAA,eAAoB,2BAA2B;;;;;;;AlBFV;;;;KmBFtE,2BAAA,GAA8B,iBAAA,OAAwB,WAAA,EAAa,iBAAA;AAAA,iBAE/D,qBAAA,CAAsB,KAAA,EAAO,KAAA,eAAoB,2BAA2B;;;;;;;AnBAV;;;;;KoBDtE,yBAAA,GAA4B,iBAAA,CAAkB,UAAA,EAAY,WAAA,EAAa,eAAA;AAAA,iBAEnE,mBAAA,CAAoB,KAAA,EAAO,KAAA,eAAoB,yBAAyB;;;;;;;ApBDN;;;;KqBFtE,uBAAA,GAA0B,iBAAA,CAAkB,cAAA,EAAgB,WAAA,EAAa,aAAA;AAAA,iBAErE,iBAAA,CAAkB,KAAA,EAAO,KAAA,eAAoB,uBAAuB"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/provider.tsx","../../errors/src/errors.ts","../src/internal/capxul-bootstrap-context.tsx","../src/internal/capxul-client-context.tsx","../src/hooks/use-capxul-session.ts","../src/hooks/use-capxul-profile.ts","../src/hooks/use-capxul-account-lifecycle.ts","../src/hooks/use-capxul-account-balance.ts","../../types/src/brand.ts","../../types/src/index.ts","../src/hooks/use-capxul-account-fund.ts","../src/hooks/use-capxul-sign-in.ts","../src/hooks/use-capxul-verify-otp.ts","../src/hooks/use-capxul-sign-out.ts","../src/hooks/use-capxul-sub-accounts.ts","../src/hooks/use-capxul-orgs.ts","../src/hooks/use-capxul-org.ts","../src/hooks/use-capxul-org-members.ts","../src/hooks/use-capxul-org-roles.ts","../src/hooks/use-capxul-org-deploy-roles.ts","../src/hooks/use-capxul-org-treasury.ts","../src/hooks/use-capxul-create-org.ts","../src/hooks/use-capxul-invite-member.ts","../src/hooks/use-capxul-remove-member.ts","../src/hooks/use-capxul-assign-role.ts","../src/hooks/use-capxul-switch-acting-entity.ts"],"mappings":";;;;;KAgCK,yBAAA;iFAEM,WAAA,GAAc,WAAA;EAAA,SACd,QAAA,EAAU,SAAS;AAAA;;KAIzB,iCAAA,GAAoC,yBAAA;EAAA,SAC9B,cAAA;EAAA,SACA,MAAA,UANU;EAAA,SAQV,WAAA,GAAc,kBAAA;EARK;AAAA;;;EAAA,SAanB,MAAA,GAAS,YAAA;AAAA;;;;;KAOf,iCAAA,GAAoC,yBAAA;EAAA,SAC9B,MAAA,EAAQ,YAAY;EAAA,SACpB,cAAA;EAAA,SACA,WAAA;EAAA,SACA,MAAA;AAAA;AAAA,KAGC,mBAAA,GACR,iCAAA,GACA,iCAAiC;AAAA,iBAuBrB,cAAA,CAAe,KAAA,EAAO,mBAAmB,+BAAA,GAAA,CAAA,OAAA;;;cClF5C,kBAAA;AAAA,KAyBD,eAAA,WAA0B,kBAAkB;AAAA,KA0B5C,kBAAA,GAAqB,MAAM;AAAA,KAgB3B,kBAAA;EAAA,SACD,KAAA;EAAA,SACA,OAAA,GAAU,kBAAkB;EAAA,SAC5B,aAAA;EAAA,SACA,KAAA;AAAA;AAAA,cAGE,WAAA,SAAoB,KAAA;EAAA,SACtB,IAAA,EAAM,eAAA;EAAA,SACN,OAAA,GAAU,kBAAA;EAAA,SACV,aAAA;EAAA,SACA,KAAA;cAEG,IAAA,EAAM,eAAA,EAAiB,OAAA,UAAiB,OAAA,GAAS,kBAAA;AAAA;;;KCvEnD,qBAAA;AAAA,UAEK,oBAAA;EAAA,SACN,MAAA,EAAQ,qBAAA;EAAA,SACR,KAAA,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;AAAA;;;;;;;KASN,0BAAA,GAA6B,cAAA,CAAe,SAAA,EAAS,WAAA;AAAA,iBAEjD,oBAAA,CACd,KAAA,EAAO,KAAA,cACP,OAAA,GAAU,2BAAA,GACT,0BAAA;;;;;ApBN+E;;;KqBLtE,wBAAA,GAA2B,iBAAA,CAAkB,OAAA,EAAS,WAAA,EAAa,cAAA;AAAA,iBAE/D,kBAAA,CAAA,GAAsB,wBAAwB;;;;;ArBGoB;;;;KsBJtE,2BAAA,GAA8B,iBAAA,CACxC,UAAA,EACA,WAAA,EACA,iBAAA;AAAA,iBAGc,qBAAA,CAAsB,KAAA,EAAO,KAAA,eAAoB,2BAA2B;;;;;AtBFV;;;;;;KuBFtE,2BAAA,GAA8B,iBAAA,OAAwB,WAAA,EAAa,iBAAA;AAAA,iBAE/D,qBAAA,CAAsB,KAAA,EAAO,KAAA,eAAoB,2BAA2B;;;;;AvBAV;;;;;;;KwBDtE,yBAAA,GAA4B,iBAAA,CAAkB,UAAA,EAAY,WAAA,EAAa,eAAA;AAAA,iBAEnE,mBAAA,CAAoB,KAAA,EAAO,KAAA,eAAoB,yBAAyB;;;KChB5E,uBAAA;EAAA,SACD,KAAA,GAAQ,KAAK;AAAA;AzBc0D;;;;;;;;;AAcpD;AAAA;;;AAdoD,KyBEtE,iCAAA,GAAoC,iBAAA,OAE9C,KAAA,EACA,uBAAA;AAAA,iBAGc,2BAAA,CAAA,GAA+B,iCAAiC"}
package/dist/index.mjs CHANGED
@@ -1,9 +1,8 @@
1
1
  "use client";
2
2
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { QueryClient, QueryClientProvider, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
4
- import { createCapxulClient, isSettingUpLifecycle } from "@capxul/sdk";
4
+ import { captureExceptionSync, createCapxulClient, isSettingUpLifecycle } from "@capxul/sdk";
5
5
  import { jsx } from "react/jsx-runtime";
6
- import { Errors } from "@capxul/config";
7
6
  //#region src/internal/capxul-bootstrap-context.tsx
8
7
  const CapxulBootstrapContext = createContext(null);
9
8
  function CapxulBootstrapProvider({ value, children }) {
@@ -148,6 +147,156 @@ function CapxulProvider(props) {
148
147
  });
149
148
  }
150
149
  //#endregion
150
+ //#region ../errors/src/errors.ts
151
+ const CAPXUL_ERROR_CODES = [
152
+ "NOT_AUTHENTICATED",
153
+ "EMAIL_DELIVERY_FAILED",
154
+ "PROFILE_NOT_FOUND",
155
+ "SMART_ACCOUNT_MISSING",
156
+ "PLAYER_NOT_FOUND",
157
+ "ACCOUNT_NOT_FOUND",
158
+ "PROVIDER_ERROR",
159
+ "INVALID_INPUT",
160
+ "ENV_MISSING",
161
+ "NOT_IMPLEMENTED",
162
+ "VERIFICATION_REQUIRED",
163
+ "INSUFFICIENT_BALANCE",
164
+ "INVALID_RECIPIENT",
165
+ "ROLE_PERMISSION_DENIED",
166
+ "TRANSACTION_FAILED",
167
+ "RATE_LIMITED",
168
+ "NETWORK_ERROR",
169
+ "UNKNOWN",
170
+ "OTP_EXPIRED",
171
+ "SIGNER_REJECTED",
172
+ "CANCELLED",
173
+ "WRONG_STATE"
174
+ ];
175
+ var CapxulError = class extends Error {
176
+ code;
177
+ details;
178
+ correlationId;
179
+ layer;
180
+ constructor(code, message, options = {}) {
181
+ super(message, "cause" in options ? { cause: options.cause } : void 0);
182
+ this.name = "CapxulError";
183
+ this.code = code;
184
+ if (options.details !== void 0) this.details = options.details;
185
+ if (options.correlationId !== void 0) this.correlationId = options.correlationId;
186
+ if (options.layer !== void 0) this.layer = options.layer;
187
+ }
188
+ };
189
+ const Errors = {
190
+ notAuthenticated: (message, opts) => new CapxulError("NOT_AUTHENTICATED", message ?? "Not authenticated", opts?.failure_mode ? { details: { failure_mode: opts.failure_mode } } : void 0),
191
+ emailDeliveryFailed: (detail) => new CapxulError("EMAIL_DELIVERY_FAILED", "Failed to send email", { details: { detail } }),
192
+ profileNotFound: (authUserId) => new CapxulError("PROFILE_NOT_FOUND", `Profile not found for user ${authUserId}`, { details: { authUserId } }),
193
+ smartAccountMissing: (authUserId) => new CapxulError("SMART_ACCOUNT_MISSING", "Smart account not provisioned", { details: { authUserId } }),
194
+ playerNotFound: (playerId) => new CapxulError("PLAYER_NOT_FOUND", playerId ? `Openfort player ${playerId} not found` : "Openfort player not found", playerId === void 0 ? void 0 : { details: { playerId } }),
195
+ accountNotFound: (accountId) => new CapxulError("ACCOUNT_NOT_FOUND", accountId ? `Openfort account ${accountId} not found` : "Openfort account not found", accountId === void 0 ? void 0 : { details: { accountId } }),
196
+ providerError: (provider, operation, cause, opts) => {
197
+ const details = {
198
+ provider,
199
+ operation
200
+ };
201
+ if (opts?.failure_mode) details.failure_mode = opts.failure_mode;
202
+ return new CapxulError("PROVIDER_ERROR", `Provider error: ${provider} ${operation}`, {
203
+ cause,
204
+ details
205
+ });
206
+ },
207
+ invalidInput: (field, reason) => new CapxulError("INVALID_INPUT", `Invalid ${field}: ${reason}`, { details: {
208
+ field,
209
+ reason
210
+ } }),
211
+ envMissing: (name) => new CapxulError("ENV_MISSING", `Environment variable ${name} not configured`, { details: { name } }),
212
+ notImplemented: (domain, method) => new CapxulError("NOT_IMPLEMENTED", `${domain}.${method} is not yet implemented. This feature is planned for a future release.`, { details: {
213
+ domain,
214
+ method
215
+ } }),
216
+ /**
217
+ * Sibling factory to {@link Errors.providerError} for the per-state timeout
218
+ * path in flows (initially ProvisioningFlow's mint_openfort / deploy_safe /
219
+ * register_indexer `after:` timers). Same `PROVIDER_ERROR` code as
220
+ * `providerError`, plus a `details.reason: "timeout"` discriminator so
221
+ * downstream observers can distinguish failure modes without parsing the
222
+ * message string. The redacted message names the timeout budget; the
223
+ * native `cause` carries the same information for `reportError` fidelity.
224
+ */
225
+ providerTimeout: (provider, operation, timeoutMs) => new CapxulError("PROVIDER_ERROR", `Provider error: ${provider} ${operation} (timeout exceeded ${timeoutMs}ms)`, {
226
+ details: {
227
+ provider,
228
+ operation,
229
+ reason: "timeout"
230
+ },
231
+ cause: /* @__PURE__ */ new Error(`timeout: ${operation} exceeded ${timeoutMs}ms`)
232
+ }),
233
+ verificationRequired: (details) => {
234
+ return new CapxulError("VERIFICATION_REQUIRED", "rail" in details ? `Verification is required before ${details.rail} can use ${details.currentKind}.` : `Verification tier ${details.requiredTier} is required.`, { details });
235
+ },
236
+ insufficientBalance: (asset, available, required) => new CapxulError("INSUFFICIENT_BALANCE", `Insufficient ${asset} balance`, { details: {
237
+ asset,
238
+ available,
239
+ required
240
+ } }),
241
+ invalidRecipient: (reason) => new CapxulError("INVALID_RECIPIENT", `Invalid recipient: ${reason}`, { details: { reason } }),
242
+ /**
243
+ * The org Zodiac Roles modifier REFUSED the spend on-chain (G4 · #547): the
244
+ * member's role condition (per-tx cap, per-day allowance, allowed recipient,
245
+ * or membership) was violated, so `execTransactionWithRole` reverted. This is
246
+ * a PERMISSION denial — explicitly NOT an `INSUFFICIENT_BALANCE` (the treasury
247
+ * held the funds; the role's authority is what bound). `reason` discriminates
248
+ * the violated condition (`over_cap` / `daily_cap` / `not_member` /
249
+ * `disallowed_recipient` / `condition_violation`); leak-safe — no on-chain
250
+ * identifiers ever enter the details.
251
+ */
252
+ rolePermissionDenied: (details) => new CapxulError("ROLE_PERMISSION_DENIED", `Org role denied this spend on-chain (${details.reason}).`, { details: details.operation === void 0 ? { reason: details.reason } : {
253
+ reason: details.reason,
254
+ operation: details.operation
255
+ } }),
256
+ /**
257
+ * A transaction (or sponsored UserOp) failed. `details.reason` discriminates
258
+ * the failure mode for callers that must distinguish a CONFIRMED on-chain
259
+ * revert (`"onchain_revert"` — the op executed and reverted, e.g. a Zodiac
260
+ * Roles condition violation) from an inconclusive infra failure. A confirmed
261
+ * revert is the ONLY mode the org spend port may map to a roles denial.
262
+ */
263
+ transactionFailed: (operation, cause, extra) => new CapxulError("TRANSACTION_FAILED", `Transaction failed: ${operation}`, {
264
+ cause,
265
+ details: extra?.reason === void 0 ? { operation } : {
266
+ operation,
267
+ reason: extra.reason
268
+ }
269
+ }),
270
+ rateLimited: (details) => new CapxulError("RATE_LIMITED", "Rate limit exceeded", details === void 0 ? void 0 : { details: { ...details } }),
271
+ networkError: (operation, cause) => new CapxulError("NETWORK_ERROR", `Network error during ${operation}`, {
272
+ cause,
273
+ details: { operation }
274
+ }),
275
+ unknown: (cause) => new CapxulError("UNKNOWN", "Unknown error", { cause }),
276
+ otpExpired: (details) => new CapxulError("OTP_EXPIRED", "Verification code has expired. Request a new one.", details === void 0 ? void 0 : { details: { ...details } }),
277
+ signerRejected: (details) => new CapxulError("SIGNER_REJECTED", "Signer rejected the request.", {
278
+ cause: details.cause,
279
+ details: details.reason === void 0 ? { source: details.source } : {
280
+ source: details.source,
281
+ reason: details.reason
282
+ }
283
+ }),
284
+ cancelled: (details) => new CapxulError("CANCELLED", "Operation was cancelled.", details === void 0 ? void 0 : { details: { ...details } }),
285
+ /**
286
+ * Method called from a flow state where its precondition fails (TA16). The
287
+ * SDK's method API short-circuits with this error before driving the
288
+ * internal state machine. `currentState` is the Effect-machine snapshot
289
+ * tag (stringified — substrate is `@effect/experimental/Machine` per
290
+ * `docs/canon/decisions/state-machine-substrate.md`); `validStates`
291
+ * enumerates the states the method accepts.
292
+ */
293
+ wrongState: (details) => new CapxulError("WRONG_STATE", `${details.method} called from state '${details.currentState}'; valid states: ${details.validStates.join(", ")}`, { details: {
294
+ ...details,
295
+ validStates: [...details.validStates]
296
+ } })
297
+ };
298
+ new Set(CAPXUL_ERROR_CODES);
299
+ //#endregion
151
300
  //#region src/internal/require-bootstrapped-client.ts
152
301
  /**
153
302
  * Narrow the bootstrap-nullable client to a ready client inside a query /
@@ -205,9 +354,23 @@ const capxulKeys = {
205
354
  };
206
355
  //#endregion
207
356
  //#region src/internal/unwrap-capxul-result.ts
208
- /** Unwrap a `CapxulResult` for TanStack query/mutation functions — throws into error paths. */
209
- function unwrapCapxulResult(result) {
357
+ /**
358
+ * Unwrap a `CapxulResult` for TanStack query/mutation functions —
359
+ * throws into error paths, optionally reporting the error to telemetry first.
360
+ *
361
+ * When `telemetry` is provided and the result is `{ ok: false }`,
362
+ * `captureExceptionSync` is called (fire-and-forget) before the throw. `operation`
363
+ * tags the telemetry event so query reads and mutation writes stay
364
+ * distinguishable in error tracking (defaults to `"query"`).
365
+ */
366
+ function unwrapCapxulResult(result, telemetry, operation = "query") {
210
367
  if (result.ok) return result.value;
368
+ if (telemetry) try {
369
+ captureExceptionSync(telemetry, result.error, {
370
+ layer: "react-query",
371
+ operation
372
+ });
373
+ } catch {}
211
374
  throw result.error;
212
375
  }
213
376
  //#endregion
@@ -216,7 +379,7 @@ function useCapxulSession() {
216
379
  const client = useCapxulClientOrNull();
217
380
  return useQuery({
218
381
  queryKey: capxulKeys.session,
219
- queryFn: async () => unwrapCapxulResult(await requireBootstrappedClient(client, "auth.getSession").auth.getSession()),
382
+ queryFn: async () => unwrapCapxulResult(await requireBootstrappedClient(client, "auth.getSession").auth.getSession(), client._internal.telemetry),
220
383
  enabled: client !== null
221
384
  });
222
385
  }
@@ -226,7 +389,7 @@ function useCapxulProfile() {
226
389
  const client = useCapxulClientOrNull();
227
390
  return useQuery({
228
391
  queryKey: capxulKeys.profile,
229
- queryFn: async () => unwrapCapxulResult(await requireBootstrappedClient(client, "identity.loadCurrent").identity.loadCurrent()),
392
+ queryFn: async () => unwrapCapxulResult(await requireBootstrappedClient(client, "identity.loadCurrent").identity.loadCurrent(), client._internal.telemetry),
230
393
  enabled: client !== null
231
394
  });
232
395
  }
@@ -265,7 +428,10 @@ function useCapxulAccountLifecycle() {
265
428
  const queryClient = useQueryClient();
266
429
  const query = useQuery({
267
430
  queryKey: capxulKeys.accountLifecycle,
268
- queryFn: async () => unwrapCapxulResult(await requireBootstrappedClient(client, "account.getLifecycle").account.getLifecycle()),
431
+ queryFn: async () => {
432
+ const bootstrappedClient = requireBootstrappedClient(client, "account.getLifecycle");
433
+ return unwrapCapxulResult(await bootstrappedClient.account.getLifecycle(), bootstrappedClient._internal.telemetry);
434
+ },
269
435
  enabled: client !== null,
270
436
  refetchInterval: (q) => {
271
437
  if (isVitestRuntime()) return false;
@@ -276,17 +442,25 @@ function useCapxulAccountLifecycle() {
276
442
  }
277
443
  });
278
444
  const retryMutation = useMutation({
279
- mutationFn: async () => unwrapCapxulResult(await requireBootstrappedClient(client, "account.retrySetup").account.retrySetup()),
445
+ mutationFn: async () => {
446
+ const bootstrappedClient = requireBootstrappedClient(client, "account.retrySetup");
447
+ return unwrapCapxulResult(await bootstrappedClient.account.retrySetup(), bootstrappedClient._internal.telemetry, "mutation");
448
+ },
280
449
  onSuccess: async () => {
281
450
  await invalidateAuthBoundary(queryClient);
282
451
  }
283
452
  });
284
453
  const lifecycle = query.data ?? LOADING_LIFECYCLE;
285
454
  const failedError = lifecycle.status === "failed" ? lifecycle.error : null;
455
+ const queryError = query.isError ? query.error : null;
286
456
  return {
287
- lifecycle,
457
+ lifecycle: queryError !== null && lifecycle.status === "loading" ? {
458
+ status: "failed",
459
+ at: "connecting",
460
+ error: queryError
461
+ } : lifecycle,
288
462
  isSettingUp: isSettingUpLifecycle(lifecycle),
289
- error: failedError ?? (query.isError ? query.error : null),
463
+ error: failedError ?? queryError,
290
464
  isLoading: query.isLoading,
291
465
  isFetching: query.isFetching,
292
466
  isError: query.isError,
@@ -300,7 +474,10 @@ function useCapxulAccountBalance(options) {
300
474
  const client = useCapxulClientOrNull();
301
475
  return useQuery({
302
476
  queryKey: capxulKeys.accountBalance,
303
- queryFn: async () => unwrapCapxulResult(await requireBootstrappedClient(client, "accounts.read").accounts.read()),
477
+ queryFn: async () => {
478
+ const bootstrappedClient = requireBootstrappedClient(client, "accounts.read");
479
+ return unwrapCapxulResult(await bootstrappedClient.accounts.read(), bootstrappedClient._internal.telemetry);
480
+ },
304
481
  enabled: client !== null && (options?.enabled ?? true)
305
482
  });
306
483
  }
@@ -310,7 +487,10 @@ function useCapxulAccountFund() {
310
487
  const client = useCapxulClientOrNull();
311
488
  const queryClient = useQueryClient();
312
489
  return useMutation({
313
- mutationFn: async (amount) => unwrapCapxulResult(await requireBootstrappedClient(client, "_internal.accounts.fund")._internal.accounts.fund(amount)),
490
+ mutationFn: async (amount) => {
491
+ const bootstrappedClient = requireBootstrappedClient(client, "_internal.accounts.fund");
492
+ return unwrapCapxulResult(await bootstrappedClient._internal.accounts.fund(amount), bootstrappedClient._internal.telemetry, "mutation");
493
+ },
314
494
  onSuccess: async () => {
315
495
  await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });
316
496
  }
@@ -320,7 +500,10 @@ function useCapxulAccountFund() {
320
500
  //#region src/hooks/use-capxul-sign-in.ts
321
501
  function useCapxulSignIn() {
322
502
  const client = useCapxulClientOrNull();
323
- return useMutation({ mutationFn: async (input) => unwrapCapxulResult(await requireBootstrappedClient(client, "auth.signIn").auth.signIn(input)) });
503
+ return useMutation({ mutationFn: async (input) => {
504
+ const bootstrappedClient = requireBootstrappedClient(client, "auth.signIn");
505
+ return unwrapCapxulResult(await bootstrappedClient.auth.signIn(input), bootstrappedClient._internal.telemetry, "mutation");
506
+ } });
324
507
  }
325
508
  //#endregion
326
509
  //#region src/hooks/use-capxul-verify-otp.ts
@@ -328,7 +511,10 @@ function useCapxulVerifyOtp() {
328
511
  const client = useCapxulClientOrNull();
329
512
  const queryClient = useQueryClient();
330
513
  return useMutation({
331
- mutationFn: async (input) => unwrapCapxulResult(await requireBootstrappedClient(client, "auth.verifyOtp").auth.verifyOtp(input)),
514
+ mutationFn: async (input) => {
515
+ const bootstrappedClient = requireBootstrappedClient(client, "auth.verifyOtp");
516
+ return unwrapCapxulResult(await bootstrappedClient.auth.verifyOtp(input), bootstrappedClient._internal.telemetry, "mutation");
517
+ },
332
518
  onSuccess: async () => {
333
519
  await invalidateAuthBoundary(queryClient);
334
520
  }
@@ -343,7 +529,10 @@ function useCapxulSignOut() {
343
529
  onMutate: async () => {
344
530
  await queryClient.cancelQueries({ queryKey: capxulKeys.accountBalance });
345
531
  },
346
- mutationFn: async () => unwrapCapxulResult(await requireBootstrappedClient(client, "auth.signOut").auth.signOut()),
532
+ mutationFn: async () => {
533
+ const bootstrappedClient = requireBootstrappedClient(client, "auth.signOut");
534
+ return unwrapCapxulResult(await bootstrappedClient.auth.signOut(), bootstrappedClient._internal.telemetry, "mutation");
535
+ },
347
536
  onSuccess: () => resetAuthBoundary(queryClient)
348
537
  });
349
538
  }
@@ -355,7 +544,8 @@ function useCapxulSubAccountsList(accountId, options) {
355
544
  queryKey: capxulKeys.subAccounts(accountId),
356
545
  queryFn: async () => {
357
546
  if (accountId === void 0) throw Errors.invalidInput("accountId", "required for subAccounts.list");
358
- return unwrapCapxulResult(await requireBootstrappedClient(client, "subAccounts.list").subAccounts.list(accountId));
547
+ const bootstrappedClient = requireBootstrappedClient(client, "subAccounts.list");
548
+ return unwrapCapxulResult(await bootstrappedClient.subAccounts.list(accountId), bootstrappedClient._internal.telemetry);
359
549
  },
360
550
  enabled: client !== null && (options?.enabled ?? true) && accountId !== void 0
361
551
  });
@@ -364,7 +554,10 @@ function useCapxulSubAccountCreate() {
364
554
  const client = useCapxulClientOrNull();
365
555
  const queryClient = useQueryClient();
366
556
  return useMutation({
367
- mutationFn: async (input) => unwrapCapxulResult(await requireBootstrappedClient(client, "subAccounts.create").subAccounts.create(input.accountId, { name: input.name })),
557
+ mutationFn: async (input) => {
558
+ const bootstrappedClient = requireBootstrappedClient(client, "subAccounts.create");
559
+ return unwrapCapxulResult(await bootstrappedClient.subAccounts.create(input.accountId, { name: input.name }), bootstrappedClient._internal.telemetry, "mutation");
560
+ },
368
561
  onSuccess: async (_value, variables) => {
369
562
  await queryClient.invalidateQueries({ queryKey: capxulKeys.subAccounts(variables.accountId) });
370
563
  await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });
@@ -375,7 +568,10 @@ function useCapxulSubAccountRename() {
375
568
  const client = useCapxulClientOrNull();
376
569
  const queryClient = useQueryClient();
377
570
  return useMutation({
378
- mutationFn: async (input) => unwrapCapxulResult(await requireBootstrappedClient(client, "subAccounts.rename").subAccounts.rename(input.subAccountId, input.name)),
571
+ mutationFn: async (input) => {
572
+ const bootstrappedClient = requireBootstrappedClient(client, "subAccounts.rename");
573
+ return unwrapCapxulResult(await bootstrappedClient.subAccounts.rename(input.subAccountId, input.name), bootstrappedClient._internal.telemetry, "mutation");
574
+ },
379
575
  onSuccess: async (_value, variables) => {
380
576
  await queryClient.invalidateQueries({ queryKey: capxulKeys.subAccounts(variables.accountId) });
381
577
  await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });
@@ -386,7 +582,10 @@ function useCapxulSubAccountDelete() {
386
582
  const client = useCapxulClientOrNull();
387
583
  const queryClient = useQueryClient();
388
584
  return useMutation({
389
- mutationFn: async (input) => unwrapCapxulResult(await requireBootstrappedClient(client, "subAccounts.delete").subAccounts.delete(input.subAccountId)),
585
+ mutationFn: async (input) => {
586
+ const bootstrappedClient = requireBootstrappedClient(client, "subAccounts.delete");
587
+ return unwrapCapxulResult(await bootstrappedClient.subAccounts.delete(input.subAccountId), bootstrappedClient._internal.telemetry, "mutation");
588
+ },
390
589
  onSuccess: async (_value, variables) => {
391
590
  await queryClient.invalidateQueries({ queryKey: capxulKeys.subAccounts(variables.accountId) });
392
591
  await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });
@@ -397,11 +596,14 @@ function useCapxulTransfer() {
397
596
  const client = useCapxulClientOrNull();
398
597
  const queryClient = useQueryClient();
399
598
  return useMutation({
400
- mutationFn: async ({ from, to, amount }) => unwrapCapxulResult(await requireBootstrappedClient(client, "subAccounts.transfer").subAccounts.transfer({
401
- from,
402
- to,
403
- amount
404
- })),
599
+ mutationFn: async ({ from, to, amount }) => {
600
+ const bootstrappedClient = requireBootstrappedClient(client, "subAccounts.transfer");
601
+ return unwrapCapxulResult(await bootstrappedClient.subAccounts.transfer({
602
+ from,
603
+ to,
604
+ amount
605
+ }), bootstrappedClient._internal.telemetry, "mutation");
606
+ },
405
607
  onSuccess: async (_value, variables) => {
406
608
  await queryClient.invalidateQueries({ queryKey: capxulKeys.subAccounts(variables.accountId) });
407
609
  await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });
@@ -411,11 +613,14 @@ function useCapxulTransfer() {
411
613
  //#endregion
412
614
  //#region src/hooks/use-capxul-orgs.ts
413
615
  function useCapxulOrgs(options) {
414
- const client = useCapxulClient();
616
+ const client = useCapxulClientOrNull();
415
617
  return useQuery({
416
618
  queryKey: capxulKeys.orgs,
417
- queryFn: async () => unwrapCapxulResult(await client.orgs()),
418
- enabled: options?.enabled ?? true
619
+ queryFn: async () => {
620
+ const bootstrappedClient = requireBootstrappedClient(client, "orgs");
621
+ return unwrapCapxulResult(await bootstrappedClient.orgs(), bootstrappedClient._internal.telemetry);
622
+ },
623
+ enabled: client !== null && (options?.enabled ?? true)
419
624
  });
420
625
  }
421
626
  //#endregion
@@ -426,7 +631,7 @@ function useCapxulOrg(orgId, options) {
426
631
  queryKey: capxulKeys.org(orgId),
427
632
  queryFn: async () => {
428
633
  if (orgId === void 0) throw Errors.invalidInput("orgId", "required for useCapxulOrg");
429
- return unwrapCapxulResult(await client.orgs()).find((org) => org.id === orgId) ?? null;
634
+ return unwrapCapxulResult(await client.orgs(), client._internal.telemetry).find((org) => org.id === orgId) ?? null;
430
635
  },
431
636
  enabled: (options?.enabled ?? true) && orgId !== void 0
432
637
  });
@@ -439,7 +644,7 @@ function useCapxulOrgMembers(orgId, options) {
439
644
  queryKey: capxulKeys.orgMembers(orgId),
440
645
  queryFn: async () => {
441
646
  if (orgId === void 0) throw Errors.invalidInput("orgId", "required for useCapxulOrgMembers");
442
- return unwrapCapxulResult(await client.org(orgId).members());
647
+ return unwrapCapxulResult(await client.org(orgId).members(), client._internal.telemetry);
443
648
  },
444
649
  enabled: (options?.enabled ?? true) && orgId !== void 0
445
650
  });
@@ -452,7 +657,7 @@ function useCapxulOrgRoles(orgId, options) {
452
657
  queryKey: capxulKeys.orgRoles(orgId),
453
658
  queryFn: async () => {
454
659
  if (orgId === void 0) throw Errors.invalidInput("orgId", "required for useCapxulOrgRoles");
455
- return unwrapCapxulResult(await client.org(orgId).roles());
660
+ return unwrapCapxulResult(await client.org(orgId).roles(), client._internal.telemetry);
456
661
  },
457
662
  enabled: (options?.enabled ?? true) && orgId !== void 0
458
663
  });
@@ -464,7 +669,7 @@ function useCapxulOrgDeployRoles() {
464
669
  const queryClient = useQueryClient();
465
670
  return useMutation({
466
671
  mutationFn: async (orgId) => {
467
- return unwrapCapxulResult(await client.org(orgId).deployRoles());
672
+ return unwrapCapxulResult(await client.org(orgId).deployRoles(), client._internal.telemetry, "mutation");
468
673
  },
469
674
  onSuccess: async (_roles, orgId) => {
470
675
  await queryClient.invalidateQueries({ queryKey: capxulKeys.orgRoles(orgId) });
@@ -481,7 +686,7 @@ function useCapxulOrgTreasury(orgId, options) {
481
686
  queryKey: capxulKeys.orgTreasury(orgId),
482
687
  queryFn: async () => {
483
688
  if (orgId === void 0) throw Errors.invalidInput("orgId", "required for useCapxulOrgTreasury");
484
- return unwrapCapxulResult(await client.org(orgId).treasury());
689
+ return unwrapCapxulResult(await client.org(orgId).treasury(), client._internal.telemetry);
485
690
  },
486
691
  enabled: (options?.enabled ?? true) && orgId !== void 0
487
692
  });
@@ -492,7 +697,7 @@ function useCapxulCreateOrg() {
492
697
  const client = useCapxulClient();
493
698
  const queryClient = useQueryClient();
494
699
  return useMutation({
495
- mutationFn: async (input) => unwrapCapxulResult(await client.createOrg(input)),
700
+ mutationFn: async (input) => unwrapCapxulResult(await client.createOrg(input), client._internal.telemetry, "mutation"),
496
701
  onSuccess: async () => {
497
702
  await queryClient.invalidateQueries({ queryKey: capxulKeys.orgs });
498
703
  }
@@ -506,7 +711,7 @@ function useCapxulInviteMember(orgId) {
506
711
  return useMutation({
507
712
  mutationFn: async (input) => {
508
713
  if (orgId === void 0) throw Errors.invalidInput("orgId", "required for useCapxulInviteMember");
509
- return unwrapCapxulResult(await client.org(orgId).invite(input));
714
+ return unwrapCapxulResult(await client.org(orgId).invite(input), client._internal.telemetry, "mutation");
510
715
  },
511
716
  onSuccess: async () => {
512
717
  if (orgId === void 0) return;
@@ -522,7 +727,7 @@ function useCapxulRemoveMember(orgId) {
522
727
  return useMutation({
523
728
  mutationFn: async (input) => {
524
729
  if (orgId === void 0) throw Errors.invalidInput("orgId", "required for useCapxulRemoveMember");
525
- return unwrapCapxulResult(await client.org(orgId).removeMember(input));
730
+ return unwrapCapxulResult(await client.org(orgId).removeMember(input), client._internal.telemetry, "mutation");
526
731
  },
527
732
  onSuccess: async () => {
528
733
  if (orgId === void 0) return;
@@ -538,7 +743,7 @@ function useCapxulAssignRole(orgId) {
538
743
  return useMutation({
539
744
  mutationFn: async (input) => {
540
745
  if (orgId === void 0) throw Errors.invalidInput("orgId", "required for useCapxulAssignRole");
541
- return unwrapCapxulResult(await client.org(orgId).assignRole(input));
746
+ return unwrapCapxulResult(await client.org(orgId).assignRole(input), client._internal.telemetry, "mutation");
542
747
  },
543
748
  onSuccess: async () => {
544
749
  if (orgId === void 0) return;
@@ -547,22 +752,11 @@ function useCapxulAssignRole(orgId) {
547
752
  });
548
753
  }
549
754
  //#endregion
550
- //#region src/hooks/use-capxul-org-spend.ts
551
- function useCapxulOrgSpend(orgId) {
552
- const client = useCapxulClient();
553
- const queryClient = useQueryClient();
554
- return useMutation({
555
- mutationFn: async (input) => {
556
- if (orgId === void 0) throw Errors.invalidInput("orgId", "org is not selected");
557
- return unwrapCapxulResult(await client.org(orgId).spend(input));
558
- },
559
- onSuccess: async () => {
560
- if (orgId === void 0) return;
561
- await queryClient.invalidateQueries({ queryKey: capxulKeys.orgTreasury(orgId) });
562
- }
563
- });
755
+ //#region src/hooks/use-capxul-switch-acting-entity.ts
756
+ function useCapxulSwitchActingEntity() {
757
+ return useMutation({ mutationFn: async (_input) => void 0 });
564
758
  }
565
759
  //#endregion
566
- export { CapxulProvider, useCapxul, useCapxulAccountBalance, useCapxulAccountFund, useCapxulAccountLifecycle, useCapxulAssignRole, useCapxulCreateOrg, useCapxulInviteMember, useCapxulOrg, useCapxulOrgDeployRoles, useCapxulOrgMembers, useCapxulOrgRoles, useCapxulOrgSpend, useCapxulOrgTreasury, useCapxulOrgs, useCapxulProfile, useCapxulRemoveMember, useCapxulSession, useCapxulSignIn, useCapxulSignOut, useCapxulSubAccountCreate, useCapxulSubAccountDelete, useCapxulSubAccountRename, useCapxulSubAccountsList, useCapxulTransfer, useCapxulVerifyOtp };
760
+ export { CapxulProvider, useCapxul, useCapxulAccountBalance, useCapxulAccountFund, useCapxulAccountLifecycle, useCapxulAssignRole, useCapxulClientOrNull, useCapxulCreateOrg, useCapxulInviteMember, useCapxulOrg, useCapxulOrgDeployRoles, useCapxulOrgMembers, useCapxulOrgRoles, useCapxulOrgTreasury, useCapxulOrgs, useCapxulProfile, useCapxulRemoveMember, useCapxulSession, useCapxulSignIn, useCapxulSignOut, useCapxulSubAccountCreate, useCapxulSubAccountDelete, useCapxulSubAccountRename, useCapxulSubAccountsList, useCapxulSwitchActingEntity, useCapxulTransfer, useCapxulVerifyOtp };
567
761
 
568
762
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/internal/capxul-bootstrap-context.tsx","../src/internal/capxul-client-context.tsx","../src/provider.tsx","../src/internal/require-bootstrapped-client.ts","../src/internal/reactivity-keys.ts","../src/internal/unwrap-capxul-result.ts","../src/hooks/use-capxul-session.ts","../src/hooks/use-capxul-profile.ts","../src/internal/is-vitest-runtime.ts","../src/internal/invalidate-auth-boundary.ts","../src/hooks/use-capxul-account-lifecycle.ts","../src/hooks/use-capxul-account-balance.ts","../src/hooks/use-capxul-account-fund.ts","../src/hooks/use-capxul-sign-in.ts","../src/hooks/use-capxul-verify-otp.ts","../src/hooks/use-capxul-sign-out.ts","../src/hooks/use-capxul-sub-accounts.ts","../src/hooks/use-capxul-orgs.ts","../src/hooks/use-capxul-org.ts","../src/hooks/use-capxul-org-members.ts","../src/hooks/use-capxul-org-roles.ts","../src/hooks/use-capxul-org-deploy-roles.ts","../src/hooks/use-capxul-org-treasury.ts","../src/hooks/use-capxul-create-org.ts","../src/hooks/use-capxul-invite-member.ts","../src/hooks/use-capxul-remove-member.ts","../src/hooks/use-capxul-assign-role.ts","../src/hooks/use-capxul-org-spend.ts"],"sourcesContent":["\"use client\";\n\n// Bootstrap-state context (SDK publish readiness · sdk-provider-owned-bootstrap).\n//\n// `<CapxulProvider>` runs the async client bootstrap and publishes its status\n// here. Consumers read it via `useCapxul()` for an opt-in splash / error / retry\n// surface. Data hooks do NOT need it — they sit in `isPending` until the client\n// resolves (see `useCapxulClientOrNull`).\n\nimport * as React from \"react\";\nimport { createContext, useContext, type ReactNode } from \"react\";\n\nimport type { CapxulError } from \"@capxul/config\";\n\nexport type CapxulBootstrapStatus = \"bootstrapping\" | \"ready\" | \"error\";\n\nexport interface CapxulBootstrapState {\n readonly status: CapxulBootstrapStatus;\n readonly error: CapxulError | null;\n readonly retry: () => void;\n}\n\nconst CapxulBootstrapContext = createContext<CapxulBootstrapState | null>(null);\n\nexport interface CapxulBootstrapProviderProps {\n readonly value: CapxulBootstrapState;\n readonly children: ReactNode;\n}\n\nexport function CapxulBootstrapProvider({ value, children }: CapxulBootstrapProviderProps) {\n return (\n <CapxulBootstrapContext.Provider value={value}>{children}</CapxulBootstrapContext.Provider>\n );\n}\n\nexport function useCapxul(): CapxulBootstrapState {\n const state = useContext(CapxulBootstrapContext);\n if (state === null) {\n throw new Error(\"useCapxul must be used within <CapxulProvider>\");\n }\n return state;\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { createContext, useContext, type ReactNode } from \"react\";\n\nimport type { CapxulClient } from \"@capxul/sdk\";\n\nconst MISSING_CAPXUL_CLIENT_PROVIDER = Symbol(\"MISSING_CAPXUL_CLIENT_PROVIDER\");\n\nconst CapxulClientContext = createContext<\n CapxulClient | null | typeof MISSING_CAPXUL_CLIENT_PROVIDER\n>(MISSING_CAPXUL_CLIENT_PROVIDER);\n\nexport interface CapxulClientProviderProps {\n readonly client: CapxulClient | null;\n readonly children: ReactNode;\n}\n\nexport function CapxulClientProvider({ client, children }: CapxulClientProviderProps) {\n return <CapxulClientContext.Provider value={client}>{children}</CapxulClientContext.Provider>;\n}\n\nexport function useCapxulClient(): CapxulClient {\n const client = useCapxulClientOrNull();\n if (client === null) {\n throw new Error(\"useCapxulClient called before <CapxulProvider> bootstrap resolved\");\n }\n return client;\n}\n\n/**\n * Returns the client, or `null` while `<CapxulProvider>` is still bootstrapping.\n * Data hooks use this so they can sit in `isPending` (disabled query) until the\n * client resolves, rather than throwing during bootstrap.\n */\nexport function useCapxulClientOrNull(): CapxulClient | null {\n const client = useContext(CapxulClientContext);\n if (client === MISSING_CAPXUL_CLIENT_PROVIDER) {\n throw new Error(\"useCapxulClient must be used within <CapxulProvider>\");\n }\n return client;\n}\n","\"use client\";\n\n// CapxulProvider — owns the client lifecycle (sdk-provider-owned-bootstrap.md).\n//\n// Two modes:\n// - `publishableKey` (browser/app): the provider runs the async bootstrap via\n// `createCapxulClient`, owns the TanStack QueryClient, exposes status via\n// `useCapxul()`, and closes the client on unmount / re-bootstrap.\n// - `client` (Node/server consumers that bootstrap before React, plus test\n// harnesses): a pre-built client is supplied; the provider is `ready`\n// immediately and leaves that client's lifecycle to the caller.\n//\n// `signer` threads into the deploy lane via `createCapxulClient` when supplied.\n// Browser apps with `requirement: \"deployed\"` omit it — the SDK auto-wires Openfort.\n\nimport * as React from \"react\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/config\";\nimport type { AccountRequirement, CapxulClient, CapxulSigner } from \"@capxul/sdk\";\nimport { createCapxulClient } from \"@capxul/sdk\";\n\nimport {\n CapxulBootstrapProvider,\n type CapxulBootstrapState,\n} from \"./internal/capxul-bootstrap-context\";\nimport { CapxulClientProvider } from \"./internal/capxul-client-context\";\n\nvoid React;\n\ntype CapxulProviderSharedProps = {\n /** Bring your own QueryClient; otherwise the provider creates one. */\n readonly queryClient?: QueryClient;\n readonly children: ReactNode;\n};\n\n/** Browser / app path — the provider bootstraps the client from a publishable key. */\ntype CapxulProviderPublishableKeyProps = CapxulProviderSharedProps & {\n readonly publishableKey: string;\n readonly client?: never;\n /** Init-time account readiness target. Default `\"none\"`. */\n readonly requirement?: AccountRequirement;\n /**\n * Optional consumer-held signer for the deploy lane. Omitted in browser apps\n * with `requirement: \"deployed\"` — the SDK wires Openfort from bootstrap.\n */\n readonly signer?: CapxulSigner;\n};\n\n/**\n * Node / server / test path — a pre-built client is supplied; lifecycle stays\n * with the caller. Mutually exclusive with `publishableKey`.\n */\ntype CapxulProviderInjectedClientProps = CapxulProviderSharedProps & {\n readonly client: CapxulClient;\n readonly publishableKey?: never;\n readonly requirement?: never;\n readonly signer?: never;\n};\n\nexport type CapxulProviderProps =\n | CapxulProviderPublishableKeyProps\n | CapxulProviderInjectedClientProps;\n\nfunction makeDefaultQueryClient(): QueryClient {\n return new QueryClient({\n defaultOptions: {\n queries: { retry: 2, staleTime: 30_000 },\n mutations: { retry: 0 },\n },\n });\n}\n\nfunction isCapxulQueryKey(queryKey: readonly unknown[]): boolean {\n return queryKey[0] === \"capxul\";\n}\n\nfunction clearClientScopedQueries(queryClient: QueryClient, ownsQueryClient: boolean): void {\n if (ownsQueryClient) {\n queryClient.clear();\n return;\n }\n queryClient.removeQueries({ predicate: (query) => isCapxulQueryKey(query.queryKey) });\n}\n\nexport function CapxulProvider(props: CapxulProviderProps) {\n const {\n publishableKey,\n client: injectedClient,\n requirement,\n signer,\n queryClient,\n children,\n } = props;\n\n // The QueryClient is pinned at mount: a later `queryClient` prop swap is\n // ignored (consumers should not swap it mid-tree) — pass your own once, or\n // let the provider create one.\n const [resolvedQueryClient] = useState(() => queryClient ?? makeDefaultQueryClient());\n const [ownsQueryClient] = useState(() => queryClient === undefined);\n\n const [client, setClient] = useState<CapxulClient | null>(injectedClient ?? null);\n const previousClientRef = useRef<CapxulClient | null>(injectedClient ?? null);\n const [status, setStatus] = useState<CapxulBootstrapState[\"status\"]>(\n injectedClient === undefined ? \"bootstrapping\" : \"ready\",\n );\n const [error, setError] = useState<CapxulError | null>(null);\n const [attempt, setAttempt] = useState(0);\n\n const retry = useCallback(() => {\n setAttempt((n) => n + 1);\n }, []);\n\n // Bootstrap path: the provider owns the client it creates and closes it on\n // unmount / re-bootstrap. The `cancelled` guard closes a client that resolves\n // after the effect tears down (StrictMode double-invoke, retry, unmount).\n useEffect(() => {\n if (publishableKey === undefined) return;\n let cancelled = false;\n let created: CapxulClient | null = null;\n setStatus(\"bootstrapping\");\n setError(null);\n setClient(null);\n void (async () => {\n const result = await createCapxulClient({\n publishableKey,\n ...(requirement === undefined ? {} : { requirement }),\n ...(signer === undefined ? {} : { signer }),\n });\n if (cancelled) {\n if (result.ok) await result.value._internal.close?.();\n return;\n }\n if (result.ok) {\n created = result.value;\n setClient(result.value);\n setStatus(\"ready\");\n } else {\n setError(result.error);\n setStatus(\"error\");\n }\n })();\n return () => {\n cancelled = true;\n void created?._internal.close?.();\n };\n }, [publishableKey, requirement, signer, attempt]);\n\n // Injected-client path: track prop identity; lifecycle stays with the caller.\n useEffect(() => {\n if (injectedClient === undefined) return;\n setClient(injectedClient);\n setStatus(\"ready\");\n setError(null);\n }, [injectedClient]);\n\n useEffect(() => {\n const previous = previousClientRef.current;\n if (previous !== null && previous !== client) {\n clearClientScopedQueries(resolvedQueryClient, ownsQueryClient);\n }\n previousClientRef.current = client;\n }, [client, ownsQueryClient, resolvedQueryClient]);\n\n const bootstrapState = useMemo<CapxulBootstrapState>(\n () => ({ status, error, retry }),\n [status, error, retry],\n );\n\n // Validate AFTER the hooks so a publishableKey↔client prop transition never\n // changes the hook count (rules of hooks); the throw aborts render cleanly.\n if ((publishableKey === undefined) === (injectedClient === undefined)) {\n throw new Error(\"CapxulProvider requires exactly one of `publishableKey` or `client`\");\n }\n\n return (\n <QueryClientProvider client={resolvedQueryClient}>\n <CapxulBootstrapProvider value={bootstrapState}>\n <CapxulClientProvider client={client}>{children}</CapxulClientProvider>\n </CapxulBootstrapProvider>\n </QueryClientProvider>\n );\n}\n","import { Errors } from \"@capxul/config\";\nimport type { CapxulClient } from \"@capxul/sdk\";\n\n/**\n * Narrow the bootstrap-nullable client to a ready client inside a query /\n * mutation function (sdk-provider-owned-bootstrap.md). Data hooks gate their\n * queries on `enabled: client !== null`, so this only ever throws for a mutation\n * triggered while `<CapxulProvider>` is still bootstrapping.\n */\nexport function requireBootstrappedClient(\n client: CapxulClient | null,\n method: string,\n): CapxulClient {\n if (client === null) {\n throw Errors.wrongState({ method, currentState: \"bootstrapping\", validStates: [\"ready\"] });\n }\n return client;\n}\n","// Typed query-key catalog (epic #258 · TanStack reactive surface).\n//\n// Auth-boundary mutations (`verifyOtp`, `signOut`) invalidate all three\n// keys on success. `signIn` does not — OTP sent leaves session null.\n\nimport type { AccountId, OrgId } from \"@capxul/types\";\n\nexport const capxulKeys = {\n session: [\"capxul\", \"session\"] as const,\n profile: [\"capxul\", \"profile\"] as const,\n account: [\"capxul\", \"account\"] as const,\n accountLifecycle: [\"capxul\", \"accountLifecycle\"] as const,\n provisioning: [\"capxul\", \"provisioning\"] as const,\n binding: [\"capxul\", \"binding\"] as const,\n accountBalance: [\"capxul\", \"accountBalance\"] as const,\n subAccounts: (accountId: AccountId | undefined) =>\n [\"capxul\", \"subAccounts\", accountId ?? \"pending\"] as const,\n // Organization domain (canon §C3, D13 — entity-scoped, keyed by OrgId).\n orgs: [\"capxul\", \"orgs\"] as const,\n org: (orgId: OrgId | undefined) => [\"capxul\", \"org\", orgId ?? \"pending\"] as const,\n orgMembers: (orgId: OrgId | undefined) =>\n [\"capxul\", \"org\", orgId ?? \"pending\", \"members\"] as const,\n orgRoles: (orgId: OrgId | undefined) => [\"capxul\", \"org\", orgId ?? \"pending\", \"roles\"] as const,\n orgTreasury: (orgId: OrgId | undefined) =>\n [\"capxul\", \"org\", orgId ?? \"pending\", \"treasury\"] as const,\n} satisfies Record<string, readonly unknown[] | ((...args: never[]) => readonly unknown[])>;\n","import type { CapxulResult } from \"@capxul/sdk\";\n\n/** Unwrap a `CapxulResult` for TanStack query/mutation functions — throws into error paths. */\nexport function unwrapCapxulResult<T>(result: CapxulResult<T>): T {\n if (result.ok) {\n return result.value;\n }\n throw result.error;\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/config\";\nimport type { Session } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulSessionReturn = UseQueryResult<Session | null, CapxulError>;\n\nexport function useCapxulSession(): UseCapxulSessionReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.session,\n queryFn: async () =>\n unwrapCapxulResult(\n await requireBootstrappedClient(client, \"auth.getSession\").auth.getSession(),\n ),\n enabled: client !== null,\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/config\";\nimport type { Profile } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulProfileReturn = UseQueryResult<Profile | null, CapxulError>;\n\nexport function useCapxulProfile(): UseCapxulProfileReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.profile,\n queryFn: async () =>\n unwrapCapxulResult(\n await requireBootstrappedClient(client, \"identity.loadCurrent\").identity.loadCurrent(),\n ),\n enabled: client !== null,\n });\n}\n","/** True under Vitest — disables hook polling intervals that fight fake timers. */\nexport function isVitestRuntime(): boolean {\n return typeof process !== \"undefined\" && process.env[\"VITEST\"] === \"true\";\n}\n","import type { QueryClient } from \"@tanstack/react-query\";\n\nimport { capxulKeys } from \"./reactivity-keys\";\n\n/** Background refetch after verifyOtp — avoids hard reset cancel errors in UI. */\nexport async function invalidateAuthBoundary(queryClient: QueryClient): Promise<void> {\n await Promise.all([\n queryClient.invalidateQueries({ queryKey: capxulKeys.session }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.profile }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.accountLifecycle }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance }),\n ]);\n}\n\n/** Hard reset after signOut — drop cached authenticated rows immediately. */\nexport async function resetAuthBoundary(queryClient: QueryClient): Promise<void> {\n await queryClient.cancelQueries({ queryKey: capxulKeys.accountBalance });\n await Promise.all([\n queryClient.resetQueries({ queryKey: capxulKeys.session }),\n queryClient.resetQueries({ queryKey: capxulKeys.profile }),\n queryClient.resetQueries({ queryKey: capxulKeys.accountLifecycle }),\n queryClient.resetQueries({ queryKey: capxulKeys.accountBalance }),\n ]);\n}\n","\"use client\";\n\nimport { useMutation, useQuery, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/config\";\nimport { isSettingUpLifecycle, type AccountLifecycle } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { isVitestRuntime } from \"../internal/is-vitest-runtime\";\nimport { invalidateAuthBoundary } from \"../internal/invalidate-auth-boundary\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nconst LOADING_LIFECYCLE: AccountLifecycle = { status: \"loading\" };\n\nexport interface UseCapxulAccountLifecycleReturn {\n readonly lifecycle: AccountLifecycle;\n readonly isSettingUp: boolean;\n readonly error: CapxulError | null;\n readonly isLoading: boolean;\n readonly isFetching: boolean;\n readonly isError: boolean;\n readonly retry: UseMutationResult<AccountLifecycle, CapxulError, void>[\"mutateAsync\"];\n readonly isRetrying: boolean;\n}\n\nexport function useCapxulAccountLifecycle(): UseCapxulAccountLifecycleReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n\n const query = useQuery<AccountLifecycle, CapxulError>({\n queryKey: capxulKeys.accountLifecycle,\n queryFn: async () =>\n unwrapCapxulResult(\n await requireBootstrappedClient(client, \"account.getLifecycle\").account.getLifecycle(),\n ),\n enabled: client !== null,\n refetchInterval: (q) => {\n if (isVitestRuntime()) return false;\n const data = q.state.data;\n if (data === undefined) return false;\n // Keep polling through `loading` — the first fetch can race verifyOtp/session\n // hydration; without this the hook sticks on loading forever.\n if (data.status === \"loading\" || isSettingUpLifecycle(data)) return 2_000;\n return false;\n },\n });\n\n const retryMutation = useMutation<AccountLifecycle, CapxulError, void>({\n mutationFn: async () =>\n unwrapCapxulResult(\n await requireBootstrappedClient(client, \"account.retrySetup\").account.retrySetup(),\n ),\n onSuccess: async () => {\n await invalidateAuthBoundary(queryClient);\n },\n });\n\n const lifecycle = query.data ?? LOADING_LIFECYCLE;\n const failedError = lifecycle.status === \"failed\" ? lifecycle.error : null;\n\n return {\n lifecycle,\n isSettingUp: isSettingUpLifecycle(lifecycle),\n error: failedError ?? (query.isError ? query.error : null),\n isLoading: query.isLoading,\n isFetching: query.isFetching,\n isError: query.isError,\n retry: retryMutation.mutateAsync,\n isRetrying: retryMutation.isPending,\n };\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/config\";\nimport type { Account } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulAccountBalanceReturn = UseQueryResult<Account, CapxulError>;\n\nexport type UseCapxulAccountBalanceOptions = {\n /** When false, skips the Convex readBalance action until the account ladder is ready. */\n readonly enabled?: boolean;\n};\n\nexport function useCapxulAccountBalance(\n options?: UseCapxulAccountBalanceOptions,\n): UseCapxulAccountBalanceReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.accountBalance,\n queryFn: async () =>\n unwrapCapxulResult(await requireBootstrappedClient(client, \"accounts.read\").accounts.read()),\n enabled: client !== null && (options?.enabled ?? true),\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/config\";\nimport type { Money } from \"@capxul/types\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulAccountFundReturn = UseMutationResult<\n { readonly txHash: string },\n CapxulError,\n Money\n>;\n\nexport function useCapxulAccountFund(): UseCapxulAccountFundReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (amount: Money) =>\n unwrapCapxulResult(\n await requireBootstrappedClient(client, \"_internal.accounts.fund\")._internal.accounts.fund(\n amount,\n ),\n ),\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/config\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport interface SignInInput {\n readonly email: string;\n}\n\nexport interface SignInSuccess {\n readonly sessionId: string;\n readonly expiresAt: number;\n}\n\nexport type UseCapxulSignInReturn = UseMutationResult<SignInSuccess, CapxulError, SignInInput>;\n\nexport function useCapxulSignIn(): UseCapxulSignInReturn {\n const client = useCapxulClientOrNull();\n return useMutation({\n mutationFn: async (input: SignInInput) =>\n unwrapCapxulResult(await requireBootstrappedClient(client, \"auth.signIn\").auth.signIn(input)),\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/config\";\nimport type { Session } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { invalidateAuthBoundary } from \"../internal/invalidate-auth-boundary\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport interface VerifyOtpInput {\n readonly email: string;\n readonly code: string;\n}\n\nexport type UseCapxulVerifyOtpReturn = UseMutationResult<Session, CapxulError, VerifyOtpInput>;\n\nexport function useCapxulVerifyOtp(): UseCapxulVerifyOtpReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: VerifyOtpInput) =>\n unwrapCapxulResult(\n await requireBootstrappedClient(client, \"auth.verifyOtp\").auth.verifyOtp(input),\n ),\n onSuccess: async () => {\n await invalidateAuthBoundary(queryClient);\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/config\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { resetAuthBoundary } from \"../internal/invalidate-auth-boundary\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulSignOutReturn = UseMutationResult<void, CapxulError, void>;\n\nexport function useCapxulSignOut(): UseCapxulSignOutReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n onMutate: async () => {\n await queryClient.cancelQueries({ queryKey: capxulKeys.accountBalance });\n },\n mutationFn: async () =>\n unwrapCapxulResult(await requireBootstrappedClient(client, \"auth.signOut\").auth.signOut()),\n onSuccess: () => resetAuthBoundary(queryClient),\n });\n}\n","\"use client\";\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationResult,\n type UseQueryResult,\n} from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/config\";\nimport type { AccountId, SubAccount, SubAccountId } from \"@capxul/types\";\nimport type { TransferInput, TransferResult } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulSubAccountsListOptions = {\n readonly enabled?: boolean;\n};\n\nexport type UseCapxulSubAccountsListReturn = UseQueryResult<readonly SubAccount[], CapxulError>;\n\nexport function useCapxulSubAccountsList(\n accountId: AccountId | undefined,\n options?: UseCapxulSubAccountsListOptions,\n): UseCapxulSubAccountsListReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.subAccounts(accountId),\n queryFn: async () => {\n if (accountId === undefined) {\n throw Errors.invalidInput(\"accountId\", \"required for subAccounts.list\");\n }\n return unwrapCapxulResult(\n await requireBootstrappedClient(client, \"subAccounts.list\").subAccounts.list(accountId),\n );\n },\n enabled: client !== null && (options?.enabled ?? true) && accountId !== undefined,\n });\n}\n\nexport type UseCapxulSubAccountCreateReturn = UseMutationResult<\n SubAccount,\n CapxulError,\n { readonly accountId: AccountId; readonly name: string }\n>;\n\nexport function useCapxulSubAccountCreate(): UseCapxulSubAccountCreateReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) =>\n unwrapCapxulResult(\n await requireBootstrappedClient(client, \"subAccounts.create\").subAccounts.create(\n input.accountId,\n { name: input.name },\n ),\n ),\n onSuccess: async (_value, variables) => {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.subAccounts(variables.accountId),\n });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });\n },\n });\n}\n\nexport type UseCapxulSubAccountRenameReturn = UseMutationResult<\n SubAccount,\n CapxulError,\n { readonly accountId: AccountId; readonly subAccountId: SubAccountId; readonly name: string }\n>;\n\nexport function useCapxulSubAccountRename(): UseCapxulSubAccountRenameReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) =>\n unwrapCapxulResult(\n await requireBootstrappedClient(client, \"subAccounts.rename\").subAccounts.rename(\n input.subAccountId,\n input.name,\n ),\n ),\n onSuccess: async (_value, variables) => {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.subAccounts(variables.accountId),\n });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });\n },\n });\n}\n\nexport type UseCapxulSubAccountDeleteReturn = UseMutationResult<\n void,\n CapxulError,\n { readonly accountId: AccountId; readonly subAccountId: SubAccountId }\n>;\n\nexport function useCapxulSubAccountDelete(): UseCapxulSubAccountDeleteReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) =>\n unwrapCapxulResult(\n await requireBootstrappedClient(client, \"subAccounts.delete\").subAccounts.delete(\n input.subAccountId,\n ),\n ),\n onSuccess: async (_value, variables) => {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.subAccounts(variables.accountId),\n });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });\n },\n });\n}\n\n/**\n * Move money between two of the SAME Account's balances (canon §5/§12). The\n * consumer-facing labels are \"Add money\" (main → sub) and \"Move money out\"\n * (sub → main), both calling `transfer`. `accountId` is carried only to\n * invalidate the right cache keys; the SDK input itself is `{ from, to, amount }`.\n */\nexport type UseCapxulTransferReturn = UseMutationResult<\n TransferResult,\n CapxulError,\n { readonly accountId: AccountId } & TransferInput\n>;\n\nexport function useCapxulTransfer(): UseCapxulTransferReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async ({ from, to, amount }) =>\n unwrapCapxulResult(\n await requireBootstrappedClient(client, \"subAccounts.transfer\").subAccounts.transfer({\n from,\n to,\n amount,\n }),\n ),\n onSuccess: async (_value, variables) => {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.subAccounts(variables.accountId),\n });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });\n },\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/config\";\nimport type { OrgView } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\n/**\n * List the Orgs you belong to (canon §C1 \"Org list\" / §C3). Binds directly to\n * the locked `capxul.orgs()` SDK method.\n */\nexport type UseCapxulOrgsReturn = UseQueryResult<readonly OrgView[], CapxulError>;\n\nexport type UseCapxulOrgsOptions = {\n /**\n * Gate the query on auth readiness. `client.orgs()` is a session-scoped\n * authenticated read; firing it before the session token settles surfaces a\n * spurious `NOT_AUTHENTICATED`. Consumers pass `enabled: <auth-ready>` (e.g.\n * \"the Organization surface is active\") — mirrors `useCapxulSubAccountsList`.\n * Defaults to `true` to preserve the bare `useCapxulOrgs()` call shape.\n */\n readonly enabled?: boolean;\n};\n\nexport function useCapxulOrgs(options?: UseCapxulOrgsOptions): UseCapxulOrgsReturn {\n const client = useCapxulClient();\n return useQuery({\n queryKey: capxulKeys.orgs,\n queryFn: async () => unwrapCapxulResult(await client.orgs()),\n enabled: options?.enabled ?? true,\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/config\";\nimport type { OrgId, OrgView } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulOrgOptions = {\n readonly enabled?: boolean;\n};\n\n/**\n * A single Org you belong to, resolved from `capxul.orgs()` and narrowed to the\n * requested `orgId` (canon §C3). Returns `null` when the Org is not in your list.\n * Gated by `orgId !== undefined`. RED until S1.\n */\nexport type UseCapxulOrgReturn = UseQueryResult<OrgView | null, CapxulError>;\n\nexport function useCapxulOrg(\n orgId: OrgId | undefined,\n options?: UseCapxulOrgOptions,\n): UseCapxulOrgReturn {\n const client = useCapxulClient();\n return useQuery({\n queryKey: capxulKeys.org(orgId),\n queryFn: async () => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulOrg\");\n }\n const orgs = unwrapCapxulResult(await client.orgs());\n return orgs.find((org) => org.id === orgId) ?? null;\n },\n enabled: (options?.enabled ?? true) && orgId !== undefined,\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/config\";\nimport type { MemberView, OrgId } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulOrgMembersOptions = {\n readonly enabled?: boolean;\n};\n\n/**\n * The members of an Org (canon §C1 \"Members\" / §C3, D8/D9). Binds directly to\n * the entity-scoped `capxul.org(orgId).members()` (D13). Gated by\n * `orgId !== undefined`. RED until S3.\n */\nexport type UseCapxulOrgMembersReturn = UseQueryResult<readonly MemberView[], CapxulError>;\n\nexport function useCapxulOrgMembers(\n orgId: OrgId | undefined,\n options?: UseCapxulOrgMembersOptions,\n): UseCapxulOrgMembersReturn {\n const client = useCapxulClient();\n return useQuery({\n queryKey: capxulKeys.orgMembers(orgId),\n queryFn: async () => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulOrgMembers\");\n }\n return unwrapCapxulResult(await client.org(orgId).members());\n },\n enabled: (options?.enabled ?? true) && orgId !== undefined,\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/config\";\nimport type { OrgId, RoleView } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulOrgRolesOptions = {\n readonly enabled?: boolean;\n};\n\n/**\n * The roles seeded on an Org (canon §C1 \"Roles\" / §C3, D4/D6). Binds directly\n * to the entity-scoped `capxul.org(orgId).roles()` (D13). Gated by\n * `orgId !== undefined`. RED until S2.\n */\nexport type UseCapxulOrgRolesReturn = UseQueryResult<readonly RoleView[], CapxulError>;\n\nexport function useCapxulOrgRoles(\n orgId: OrgId | undefined,\n options?: UseCapxulOrgRolesOptions,\n): UseCapxulOrgRolesReturn {\n const client = useCapxulClient();\n return useQuery({\n queryKey: capxulKeys.orgRoles(orgId),\n queryFn: async () => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulOrgRoles\");\n }\n return unwrapCapxulResult(await client.org(orgId).roles());\n },\n enabled: (options?.enabled ?? true) && orgId !== undefined,\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/config\";\nimport type { OrgId, RoleView } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulOrgDeployRolesReturn = UseMutationResult<\n readonly RoleView[],\n CapxulError,\n OrgId\n>;\n\nexport function useCapxulOrgDeployRoles(): UseCapxulOrgDeployRolesReturn {\n const client = useCapxulClient();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (orgId: OrgId) => {\n return unwrapCapxulResult(await client.org(orgId).deployRoles());\n },\n onSuccess: async (_roles, orgId) => {\n await queryClient.invalidateQueries({ queryKey: capxulKeys.orgRoles(orgId) });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.org(orgId) });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.orgs });\n },\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/config\";\nimport type { OrgId } from \"@capxul/sdk\";\nimport type { Account } from \"@capxul/types\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulOrgTreasuryOptions = {\n readonly enabled?: boolean;\n};\n\n/**\n * The Org treasury — the real M2 `Account` over the Org Safe (canon §C3, D3).\n * NEVER `AccountStatus` (the deploy-readiness ladder, no balance). Binds\n * directly to the entity-scoped `capxul.org(orgId).treasury()` (D13). Gated by\n * `orgId !== undefined`. RED until S1.\n */\nexport type UseCapxulOrgTreasuryReturn = UseQueryResult<Account, CapxulError>;\n\nexport function useCapxulOrgTreasury(\n orgId: OrgId | undefined,\n options?: UseCapxulOrgTreasuryOptions,\n): UseCapxulOrgTreasuryReturn {\n const client = useCapxulClient();\n return useQuery({\n queryKey: capxulKeys.orgTreasury(orgId),\n queryFn: async () => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulOrgTreasury\");\n }\n return unwrapCapxulResult(await client.org(orgId).treasury());\n },\n enabled: (options?.enabled ?? true) && orgId !== undefined,\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/config\";\nimport type { CreateOrgInput, OrgView } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\n/**\n * Create an Org (canon §C2 J1 / §C3, S1). Binds directly to the locked\n * `capxul.createOrg(input)` SDK method. On success, invalidates the org list.\n * RED until S1 — `mutate` rejects with `Errors.notImplemented(\"org\",\"createOrg\")`.\n */\nexport type UseCapxulCreateOrgReturn = UseMutationResult<OrgView, CapxulError, CreateOrgInput>;\n\nexport function useCapxulCreateOrg(): UseCapxulCreateOrgReturn {\n const client = useCapxulClient();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: CreateOrgInput) => unwrapCapxulResult(await client.createOrg(input)),\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: capxulKeys.orgs });\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/config\";\nimport type { InviteMemberInput, MemberView, OrgId } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\n/**\n * Invite a member to an Org by email (canon §C2 J2 virality loop / §C3, S3, D8).\n * Entity-scoped via the closed-over `orgId` (D13). Binds directly to\n * `capxul.org(orgId).invite(input)`. On success, invalidates the member list.\n * RED until S3 — `mutate` rejects with `Errors.notImplemented(\"org\",\"invite\")`.\n */\nexport type UseCapxulInviteMemberReturn = UseMutationResult<\n MemberView,\n CapxulError,\n InviteMemberInput\n>;\n\nexport function useCapxulInviteMember(orgId: OrgId | undefined): UseCapxulInviteMemberReturn {\n const client = useCapxulClient();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: InviteMemberInput) => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulInviteMember\");\n }\n return unwrapCapxulResult(await client.org(orgId).invite(input));\n },\n onSuccess: async () => {\n if (orgId === undefined) return;\n await queryClient.invalidateQueries({ queryKey: capxulKeys.orgMembers(orgId) });\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/config\";\nimport type { OrgId, RemoveMemberInput } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\n/**\n * Remove a member from an Org (canon §C2 J2 / §C3, S3, D7/D8) — drives the\n * on-chain REVOKE + Convex mirror. Keyed on the member's personal Safe address\n * (D7). Entity-scoped via the closed-over `orgId` (D13). Binds directly to\n * `capxul.org(orgId).removeMember(input)`. On success, invalidates the member\n * list. RED until S3 — `mutate` rejects with\n * `Errors.notImplemented(\"org\",\"removeMember\")`.\n */\nexport type UseCapxulRemoveMemberReturn = UseMutationResult<void, CapxulError, RemoveMemberInput>;\n\nexport function useCapxulRemoveMember(orgId: OrgId | undefined): UseCapxulRemoveMemberReturn {\n const client = useCapxulClient();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: RemoveMemberInput) => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulRemoveMember\");\n }\n return unwrapCapxulResult(await client.org(orgId).removeMember(input));\n },\n onSuccess: async () => {\n if (orgId === undefined) return;\n await queryClient.invalidateQueries({ queryKey: capxulKeys.orgMembers(orgId) });\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/config\";\nimport type { AssignRoleInput, MemberView, OrgId } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\n/**\n * Assign a role to a member (canon §C2 J2 / §C3, S3, D7/D9) — drives the\n * on-chain GRANT + Convex mirror. Keyed on the member's personal Safe address\n * (D7); the `role` label maps deterministically to the on-chain `roleKey` (D9).\n * Entity-scoped via the closed-over `orgId` (D13). Binds directly to\n * `capxul.org(orgId).assignRole(input)`. On success, invalidates the member\n * list. RED until S3 — `mutate` rejects with\n * `Errors.notImplemented(\"org\",\"assignRole\")`.\n */\nexport type UseCapxulAssignRoleReturn = UseMutationResult<MemberView, CapxulError, AssignRoleInput>;\n\nexport function useCapxulAssignRole(orgId: OrgId | undefined): UseCapxulAssignRoleReturn {\n const client = useCapxulClient();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: AssignRoleInput) => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulAssignRole\");\n }\n return unwrapCapxulResult(await client.org(orgId).assignRole(input));\n },\n onSuccess: async () => {\n if (orgId === undefined) return;\n await queryClient.invalidateQueries({ queryKey: capxulKeys.orgMembers(orgId) });\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/config\";\nimport type { OrgId, OrgSpendInput, OrgSpendResult } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\n/**\n * Spend from an Org's scoped sub-account (canon §C2 J3+J4 capstone / §C3, S4,\n * D5) — two-level gated (Level 1 Zodiac cap + Level 2 envelope scope/balance)\n * one-UserOp spend via CapxulPayments. Entity-scoped via the closed-over\n * `orgId` (D13). Binds directly to `capxul.org(orgId).spend(input)`. On success,\n * invalidates the treasury (balance moved). RED until S4 — `mutate` rejects with\n * `Errors.notImplemented(\"org\",\"spend\")`.\n */\nexport type UseCapxulOrgSpendReturn = UseMutationResult<OrgSpendResult, CapxulError, OrgSpendInput>;\n\nexport function useCapxulOrgSpend(orgId: OrgId | undefined): UseCapxulOrgSpendReturn {\n const client = useCapxulClient();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: OrgSpendInput) => {\n if (orgId === undefined) throw Errors.invalidInput(\"orgId\", \"org is not selected\");\n return unwrapCapxulResult(await client.org(orgId).spend(input));\n },\n onSuccess: async () => {\n if (orgId === undefined) return;\n await queryClient.invalidateQueries({ queryKey: capxulKeys.orgTreasury(orgId) });\n },\n });\n}\n"],"mappings":";;;;;;;AAsBA,MAAM,yBAAyB,cAA2C,IAAI;AAO9E,SAAgB,wBAAwB,EAAE,OAAO,YAA0C;CACzF,OACE,oBAAC,uBAAuB,UAAxB;EAAwC;EAAQ;CAA0C,CAAA;AAE9F;AAEA,SAAgB,YAAkC;CAChD,MAAM,QAAQ,WAAW,sBAAsB;CAC/C,IAAI,UAAU,MACZ,MAAM,IAAI,MAAM,gDAAgD;CAElE,OAAO;AACT;;;AClCA,MAAM,iCAAiC,OAAO,gCAAgC;AAE9E,MAAM,sBAAsB,cAE1B,8BAA8B;AAOhC,SAAgB,qBAAqB,EAAE,QAAQ,YAAuC;CACpF,OAAO,oBAAC,oBAAoB,UAArB;EAA8B,OAAO;EAAS;CAAuC,CAAA;AAC9F;AAEA,SAAgB,kBAAgC;CAC9C,MAAM,SAAS,sBAAsB;CACrC,IAAI,WAAW,MACb,MAAM,IAAI,MAAM,mEAAmE;CAErF,OAAO;AACT;;;;;;AAOA,SAAgB,wBAA6C;CAC3D,MAAM,SAAS,WAAW,mBAAmB;CAC7C,IAAI,WAAW,gCACb,MAAM,IAAI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ACdA,SAAgB,oBAAoB,OAAqD;CACvF,MAAM,SAAS,gBAAgB;CAC/B,MAAM,cAAc,eAAe;CACnC,OAAO,YAAY;EACjB,YAAY,OAAO,UAA2B;GAC5C,IAAI,UAAU,KAAA,GACZ,MAAM,OAAO,aAAa,SAAS,kCAAkC;GAEvE,OAAO,mBAAmB,MAAM,OAAO,IAAI,KAAK,EAAE,WAAW,KAAK,CAAC;EACrE;EACA,WAAW,YAAY;GACrB,IAAI,UAAU,KAAA,GAAW;GACzB,MAAM,YAAY,kBAAkB,EAAE,UAAU,WAAW,WAAW,KAAK,EAAE,CAAC;EAChF;CACF,CAAC;AACH;;;AChBA,SAAgB,kBAAkB,OAAmD;CACnF,MAAM,SAAS,gBAAgB;CAC/B,MAAM,cAAc,eAAe;CACnC,OAAO,YAAY;EACjB,YAAY,OAAO,UAAyB;GAC1C,IAAI,UAAU,KAAA,GAAW,MAAM,OAAO,aAAa,SAAS,qBAAqB;GACjF,OAAO,mBAAmB,MAAM,OAAO,IAAI,KAAK,EAAE,MAAM,KAAK,CAAC;EAChE;EACA,WAAW,YAAY;GACrB,IAAI,UAAU,KAAA,GAAW;GACzB,MAAM,YAAY,kBAAkB,EAAE,UAAU,WAAW,YAAY,KAAK,EAAE,CAAC;EACjF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/internal/capxul-bootstrap-context.tsx","../src/internal/capxul-client-context.tsx","../src/provider.tsx","../../errors/src/errors.ts","../../errors/src/convex-error-decoding.ts","../src/internal/require-bootstrapped-client.ts","../src/internal/reactivity-keys.ts","../src/internal/unwrap-capxul-result.ts","../src/hooks/use-capxul-session.ts","../src/hooks/use-capxul-profile.ts","../src/internal/is-vitest-runtime.ts","../src/internal/invalidate-auth-boundary.ts","../src/hooks/use-capxul-account-lifecycle.ts","../src/hooks/use-capxul-account-balance.ts","../src/hooks/use-capxul-account-fund.ts","../src/hooks/use-capxul-sign-in.ts","../src/hooks/use-capxul-verify-otp.ts","../src/hooks/use-capxul-sign-out.ts","../src/hooks/use-capxul-sub-accounts.ts","../src/hooks/use-capxul-orgs.ts","../src/hooks/use-capxul-org.ts","../src/hooks/use-capxul-org-members.ts","../src/hooks/use-capxul-org-roles.ts","../src/hooks/use-capxul-org-deploy-roles.ts","../src/hooks/use-capxul-org-treasury.ts","../src/hooks/use-capxul-create-org.ts","../src/hooks/use-capxul-invite-member.ts","../src/hooks/use-capxul-remove-member.ts","../src/hooks/use-capxul-assign-role.ts","../src/hooks/use-capxul-switch-acting-entity.ts"],"sourcesContent":["\"use client\";\n\n// Bootstrap-state context (SDK publish readiness · sdk-provider-owned-bootstrap).\n//\n// `<CapxulProvider>` runs the async client bootstrap and publishes its status\n// here. Consumers read it via `useCapxul()` for an opt-in splash / error / retry\n// surface. Data hooks do NOT need it — they sit in `isPending` until the client\n// resolves (see `useCapxulClientOrNull`).\n\nimport * as React from \"react\";\nimport { createContext, useContext, type ReactNode } from \"react\";\n\nimport type { CapxulError } from \"@capxul/errors\";\n\nexport type CapxulBootstrapStatus = \"bootstrapping\" | \"ready\" | \"error\";\n\nexport interface CapxulBootstrapState {\n readonly status: CapxulBootstrapStatus;\n readonly error: CapxulError | null;\n readonly retry: () => void;\n}\n\nconst CapxulBootstrapContext = createContext<CapxulBootstrapState | null>(null);\n\nexport interface CapxulBootstrapProviderProps {\n readonly value: CapxulBootstrapState;\n readonly children: ReactNode;\n}\n\nexport function CapxulBootstrapProvider({ value, children }: CapxulBootstrapProviderProps) {\n return (\n <CapxulBootstrapContext.Provider value={value}>{children}</CapxulBootstrapContext.Provider>\n );\n}\n\nexport function useCapxul(): CapxulBootstrapState {\n const state = useContext(CapxulBootstrapContext);\n if (state === null) {\n throw new Error(\"useCapxul must be used within <CapxulProvider>\");\n }\n return state;\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { createContext, useContext, type ReactNode } from \"react\";\n\nimport type { CapxulClient } from \"@capxul/sdk\";\n\nconst MISSING_CAPXUL_CLIENT_PROVIDER = Symbol(\"MISSING_CAPXUL_CLIENT_PROVIDER\");\n\nconst CapxulClientContext = createContext<\n CapxulClient | null | typeof MISSING_CAPXUL_CLIENT_PROVIDER\n>(MISSING_CAPXUL_CLIENT_PROVIDER);\n\nexport interface CapxulClientProviderProps {\n readonly client: CapxulClient | null;\n readonly children: ReactNode;\n}\n\nexport function CapxulClientProvider({ client, children }: CapxulClientProviderProps) {\n return <CapxulClientContext.Provider value={client}>{children}</CapxulClientContext.Provider>;\n}\n\nexport function useCapxulClient(): CapxulClient {\n const client = useCapxulClientOrNull();\n if (client === null) {\n throw new Error(\"useCapxulClient called before <CapxulProvider> bootstrap resolved\");\n }\n return client;\n}\n\n/**\n * Returns the client, or `null` while `<CapxulProvider>` is still bootstrapping.\n * Data hooks use this so they can sit in `isPending` (disabled query) until the\n * client resolves, rather than throwing during bootstrap.\n */\nexport function useCapxulClientOrNull(): CapxulClient | null {\n const client = useContext(CapxulClientContext);\n if (client === MISSING_CAPXUL_CLIENT_PROVIDER) {\n throw new Error(\"useCapxulClient must be used within <CapxulProvider>\");\n }\n return client;\n}\n","\"use client\";\n\n// CapxulProvider — owns the client lifecycle (sdk-provider-owned-bootstrap.md).\n//\n// Two modes:\n// - `publishableKey` (browser/app): the provider runs the async bootstrap via\n// `createCapxulClient`, owns the TanStack QueryClient, exposes status via\n// `useCapxul()`, and closes the client on unmount / re-bootstrap.\n// - `client` (Node/server consumers that bootstrap before React, plus test\n// harnesses): a pre-built client is supplied; the provider is `ready`\n// immediately and leaves that client's lifecycle to the caller.\n//\n// `signer` threads into the deploy lane via `createCapxulClient` when supplied.\n// Browser apps with `requirement: \"deployed\"` omit it — the SDK auto-wires Openfort.\n\nimport * as React from \"react\";\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport type { ReactNode } from \"react\";\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/errors\";\nimport type { AccountRequirement, CapxulClient, CapxulSigner } from \"@capxul/sdk\";\nimport { createCapxulClient } from \"@capxul/sdk\";\n\nimport {\n CapxulBootstrapProvider,\n type CapxulBootstrapState,\n} from \"./internal/capxul-bootstrap-context\";\nimport { CapxulClientProvider } from \"./internal/capxul-client-context\";\n\nvoid React;\n\ntype CapxulProviderSharedProps = {\n /** Bring your own QueryClient; otherwise the provider creates one. */\n readonly queryClient?: QueryClient;\n readonly children: ReactNode;\n};\n\n/** Browser / app path — the provider bootstraps the client from a publishable key. */\ntype CapxulProviderPublishableKeyProps = CapxulProviderSharedProps & {\n readonly publishableKey: string;\n readonly client?: never;\n /** Init-time account readiness target. Default `\"none\"`. */\n readonly requirement?: AccountRequirement;\n /**\n * Optional consumer-held signer for the deploy lane. Omitted in browser apps\n * with `requirement: \"deployed\"` — the SDK wires Openfort from bootstrap.\n */\n readonly signer?: CapxulSigner;\n};\n\n/**\n * Node / server / test path — a pre-built client is supplied; lifecycle stays\n * with the caller. Mutually exclusive with `publishableKey`.\n */\ntype CapxulProviderInjectedClientProps = CapxulProviderSharedProps & {\n readonly client: CapxulClient;\n readonly publishableKey?: never;\n readonly requirement?: never;\n readonly signer?: never;\n};\n\nexport type CapxulProviderProps =\n | CapxulProviderPublishableKeyProps\n | CapxulProviderInjectedClientProps;\n\nfunction makeDefaultQueryClient(): QueryClient {\n return new QueryClient({\n defaultOptions: {\n queries: { retry: 2, staleTime: 30_000 },\n mutations: { retry: 0 },\n },\n });\n}\n\nfunction isCapxulQueryKey(queryKey: readonly unknown[]): boolean {\n return queryKey[0] === \"capxul\";\n}\n\nfunction clearClientScopedQueries(queryClient: QueryClient, ownsQueryClient: boolean): void {\n if (ownsQueryClient) {\n queryClient.clear();\n return;\n }\n queryClient.removeQueries({ predicate: (query) => isCapxulQueryKey(query.queryKey) });\n}\n\nexport function CapxulProvider(props: CapxulProviderProps) {\n const {\n publishableKey,\n client: injectedClient,\n requirement,\n signer,\n queryClient,\n children,\n } = props;\n\n // The QueryClient is pinned at mount: a later `queryClient` prop swap is\n // ignored (consumers should not swap it mid-tree) — pass your own once, or\n // let the provider create one.\n const [resolvedQueryClient] = useState(() => queryClient ?? makeDefaultQueryClient());\n const [ownsQueryClient] = useState(() => queryClient === undefined);\n\n const [client, setClient] = useState<CapxulClient | null>(injectedClient ?? null);\n const previousClientRef = useRef<CapxulClient | null>(injectedClient ?? null);\n const [status, setStatus] = useState<CapxulBootstrapState[\"status\"]>(\n injectedClient === undefined ? \"bootstrapping\" : \"ready\",\n );\n const [error, setError] = useState<CapxulError | null>(null);\n const [attempt, setAttempt] = useState(0);\n\n const retry = useCallback(() => {\n setAttempt((n) => n + 1);\n }, []);\n\n // Bootstrap path: the provider owns the client it creates and closes it on\n // unmount / re-bootstrap. The `cancelled` guard closes a client that resolves\n // after the effect tears down (StrictMode double-invoke, retry, unmount).\n useEffect(() => {\n if (publishableKey === undefined) return;\n let cancelled = false;\n let created: CapxulClient | null = null;\n setStatus(\"bootstrapping\");\n setError(null);\n setClient(null);\n void (async () => {\n const result = await createCapxulClient({\n publishableKey,\n ...(requirement === undefined ? {} : { requirement }),\n ...(signer === undefined ? {} : { signer }),\n });\n if (cancelled) {\n if (result.ok) await result.value._internal.close?.();\n return;\n }\n if (result.ok) {\n created = result.value;\n setClient(result.value);\n setStatus(\"ready\");\n } else {\n setError(result.error);\n setStatus(\"error\");\n }\n })();\n return () => {\n cancelled = true;\n void created?._internal.close?.();\n };\n }, [publishableKey, requirement, signer, attempt]);\n\n // Injected-client path: track prop identity; lifecycle stays with the caller.\n useEffect(() => {\n if (injectedClient === undefined) return;\n setClient(injectedClient);\n setStatus(\"ready\");\n setError(null);\n }, [injectedClient]);\n\n useEffect(() => {\n const previous = previousClientRef.current;\n if (previous !== null && previous !== client) {\n clearClientScopedQueries(resolvedQueryClient, ownsQueryClient);\n }\n previousClientRef.current = client;\n }, [client, ownsQueryClient, resolvedQueryClient]);\n\n const bootstrapState = useMemo<CapxulBootstrapState>(\n () => ({ status, error, retry }),\n [status, error, retry],\n );\n\n // Validate AFTER the hooks so a publishableKey↔client prop transition never\n // changes the hook count (rules of hooks); the throw aborts render cleanly.\n if ((publishableKey === undefined) === (injectedClient === undefined)) {\n throw new Error(\"CapxulProvider requires exactly one of `publishableKey` or `client`\");\n }\n\n return (\n <QueryClientProvider client={resolvedQueryClient}>\n <CapxulBootstrapProvider value={bootstrapState}>\n <CapxulClientProvider client={client}>{children}</CapxulClientProvider>\n </CapxulBootstrapProvider>\n </QueryClientProvider>\n );\n}\n","// The canonical error-code catalog as a runtime constant. `CapxulErrorCode`\n// is derived from it so the type and any runtime check that needs to\n// enumerate codes (e.g. the convex-error codec's `KNOWN_CODES`) share a\n// single source of truth — a TypeScript union alone can't be introspected\n// at runtime, which previously forced a hand-maintained duplicate.\nexport const CAPXUL_ERROR_CODES = [\n \"NOT_AUTHENTICATED\",\n \"EMAIL_DELIVERY_FAILED\",\n \"PROFILE_NOT_FOUND\",\n \"SMART_ACCOUNT_MISSING\",\n \"PLAYER_NOT_FOUND\",\n \"ACCOUNT_NOT_FOUND\",\n \"PROVIDER_ERROR\",\n \"INVALID_INPUT\",\n \"ENV_MISSING\",\n \"NOT_IMPLEMENTED\",\n \"VERIFICATION_REQUIRED\",\n \"INSUFFICIENT_BALANCE\",\n \"INVALID_RECIPIENT\",\n \"ROLE_PERMISSION_DENIED\",\n \"TRANSACTION_FAILED\",\n \"RATE_LIMITED\",\n \"NETWORK_ERROR\",\n \"UNKNOWN\",\n \"OTP_EXPIRED\",\n \"SIGNER_REJECTED\",\n \"CANCELLED\",\n \"WRONG_STATE\",\n] as const;\n\nexport type CapxulErrorCode = (typeof CAPXUL_ERROR_CODES)[number];\n\n/**\n * Why an auth/provider call failed — a flat CAUSE enum. The *where* (which\n * OpenFort operation) stays in the separate `operation` detail field; this\n * names the root cause so a single `$exception` can be triaged without\n * parsing the message. Five members, no free strings:\n *\n * - `auth-origin-mismatch`: OTP cookies live on `localhost:PORT` but OpenFort\n * hits the Convex host → no session reaches the provider.\n * - `stale-openfort-cache`: an old `userId` in scoped storage makes the SDK\n * skip re-auth → 401 on `v2/accounts`.\n * - `app-env-allowlist`: missing `VITE_CAPXUL_CONVEX_SITE_URL` / the origin is\n * not allowlisted → 401.\n * - `no-secure-context`: sandboxed/headless browser with no Web Crypto, so\n * `getAddress`/`configure` can never produce an address. Previously vanished\n * into `unknown`; the signer's secure-context probe now names it.\n * - `unknown`: catch-all when no cause could be determined.\n */\nexport type FailureMode =\n | \"auth-origin-mismatch\"\n | \"stale-openfort-cache\"\n | \"app-env-allowlist\"\n | \"no-secure-context\"\n | \"unknown\";\n\nexport type CapxulErrorDetails = Record<string, unknown>;\n\nexport type SignerSource = \"openfort-embedded\" | \"injected-eip1193\" | \"local-private-key\";\n\nexport type VerificationRequiredDetails =\n | { readonly requiredTier: number }\n | { readonly rail: string; readonly currentKind: string };\n\nexport type SerializedCapxulError = {\n readonly code: CapxulErrorCode;\n readonly message: string;\n readonly details?: CapxulErrorDetails;\n readonly correlationId?: string;\n readonly layer?: string;\n};\n\nexport type CapxulErrorOptions = {\n readonly cause?: unknown;\n readonly details?: CapxulErrorDetails;\n readonly correlationId?: string;\n readonly layer?: string;\n};\n\nexport class CapxulError extends Error {\n readonly code: CapxulErrorCode;\n readonly details?: CapxulErrorDetails;\n readonly correlationId?: string;\n readonly layer?: string;\n\n constructor(code: CapxulErrorCode, message: string, options: CapxulErrorOptions = {}) {\n super(message, \"cause\" in options ? { cause: options.cause } : undefined);\n this.name = \"CapxulError\";\n this.code = code;\n if (options.details !== undefined) {\n this.details = options.details;\n }\n if (options.correlationId !== undefined) {\n this.correlationId = options.correlationId;\n }\n if (options.layer !== undefined) {\n this.layer = options.layer;\n }\n }\n}\n\nexport function isCapxulError(value: unknown): value is CapxulError {\n return value instanceof CapxulError;\n}\n\nexport function serializeCapxulError(error: CapxulError): SerializedCapxulError {\n return compactSerialized({\n code: error.code,\n message: error.message,\n details: error.details,\n correlationId: error.correlationId,\n layer: error.layer,\n });\n}\n\nexport function deserializeCapxulError(serialized: SerializedCapxulError): CapxulError {\n return new CapxulError(\n serialized.code,\n serialized.message,\n compactErrorOptions({\n details: serialized.details,\n correlationId: serialized.correlationId,\n layer: serialized.layer,\n }),\n );\n}\n\nfunction compactSerialized(serialized: {\n readonly code: CapxulErrorCode;\n readonly message: string;\n readonly details: CapxulErrorDetails | undefined;\n readonly correlationId: string | undefined;\n readonly layer: string | undefined;\n}): SerializedCapxulError {\n const result: {\n code: CapxulErrorCode;\n message: string;\n details?: CapxulErrorDetails;\n correlationId?: string;\n layer?: string;\n } = {\n code: serialized.code,\n message: serialized.message,\n };\n\n if (serialized.details !== undefined) {\n result.details = serialized.details;\n }\n if (serialized.correlationId !== undefined) {\n result.correlationId = serialized.correlationId;\n }\n if (serialized.layer !== undefined) {\n result.layer = serialized.layer;\n }\n\n return result;\n}\n\nfunction compactErrorOptions(options: {\n readonly cause?: unknown;\n readonly details: CapxulErrorDetails | undefined;\n readonly correlationId: string | undefined;\n readonly layer: string | undefined;\n}): CapxulErrorOptions {\n const result: {\n cause?: unknown;\n details?: CapxulErrorDetails;\n correlationId?: string;\n layer?: string;\n } = {};\n\n if (\"cause\" in options) {\n result.cause = options.cause;\n }\n if (options.details !== undefined) {\n result.details = options.details;\n }\n if (options.correlationId !== undefined) {\n result.correlationId = options.correlationId;\n }\n if (options.layer !== undefined) {\n result.layer = options.layer;\n }\n\n return result;\n}\n\nexport const Errors = {\n notAuthenticated: (message?: string, opts?: { readonly failure_mode?: FailureMode }) =>\n new CapxulError(\n \"NOT_AUTHENTICATED\",\n message ?? \"Not authenticated\",\n opts?.failure_mode ? { details: { failure_mode: opts.failure_mode } } : undefined,\n ),\n emailDeliveryFailed: (detail: string) =>\n new CapxulError(\"EMAIL_DELIVERY_FAILED\", \"Failed to send email\", {\n details: { detail },\n }),\n\n profileNotFound: (authUserId: string) =>\n new CapxulError(\"PROFILE_NOT_FOUND\", `Profile not found for user ${authUserId}`, {\n details: { authUserId },\n }),\n\n smartAccountMissing: (authUserId: string) =>\n new CapxulError(\"SMART_ACCOUNT_MISSING\", \"Smart account not provisioned\", {\n details: { authUserId },\n }),\n\n playerNotFound: (playerId?: string) =>\n new CapxulError(\n \"PLAYER_NOT_FOUND\",\n playerId ? `Openfort player ${playerId} not found` : \"Openfort player not found\",\n playerId === undefined ? undefined : { details: { playerId } },\n ),\n\n accountNotFound: (accountId?: string) =>\n new CapxulError(\n \"ACCOUNT_NOT_FOUND\",\n accountId ? `Openfort account ${accountId} not found` : \"Openfort account not found\",\n accountId === undefined ? undefined : { details: { accountId } },\n ),\n\n providerError: (\n provider: string,\n operation: string,\n cause: unknown,\n opts?: { readonly failure_mode?: FailureMode },\n ) => {\n const details: Record<string, unknown> = { provider, operation };\n if (opts?.failure_mode) {\n details.failure_mode = opts.failure_mode;\n }\n return new CapxulError(\"PROVIDER_ERROR\", `Provider error: ${provider} ${operation}`, {\n cause,\n details,\n });\n },\n\n invalidInput: (field: string, reason: string) =>\n new CapxulError(\"INVALID_INPUT\", `Invalid ${field}: ${reason}`, {\n details: { field, reason },\n }),\n\n envMissing: (name: string) =>\n new CapxulError(\"ENV_MISSING\", `Environment variable ${name} not configured`, {\n details: { name },\n }),\n\n notImplemented: (domain: string, method: string) =>\n new CapxulError(\n \"NOT_IMPLEMENTED\",\n `${domain}.${method} is not yet implemented. This feature is planned for a future release.`,\n { details: { domain, method } },\n ),\n\n /**\n * Sibling factory to {@link Errors.providerError} for the per-state timeout\n * path in flows (initially ProvisioningFlow's mint_openfort / deploy_safe /\n * register_indexer `after:` timers). Same `PROVIDER_ERROR` code as\n * `providerError`, plus a `details.reason: \"timeout\"` discriminator so\n * downstream observers can distinguish failure modes without parsing the\n * message string. The redacted message names the timeout budget; the\n * native `cause` carries the same information for `reportError` fidelity.\n */\n providerTimeout: (provider: string, operation: string, timeoutMs: number) =>\n new CapxulError(\n \"PROVIDER_ERROR\",\n `Provider error: ${provider} ${operation} (timeout exceeded ${timeoutMs}ms)`,\n {\n details: { provider, operation, reason: \"timeout\" },\n cause: new Error(`timeout: ${operation} exceeded ${timeoutMs}ms`),\n },\n ),\n\n verificationRequired: (details: VerificationRequiredDetails) => {\n const message =\n \"rail\" in details\n ? `Verification is required before ${details.rail} can use ${details.currentKind}.`\n : `Verification tier ${details.requiredTier} is required.`;\n\n return new CapxulError(\"VERIFICATION_REQUIRED\", message, {\n details,\n });\n },\n\n insufficientBalance: (asset: string, available: string, required: string) =>\n new CapxulError(\"INSUFFICIENT_BALANCE\", `Insufficient ${asset} balance`, {\n details: { asset, available, required },\n }),\n\n invalidRecipient: (reason: string) =>\n new CapxulError(\"INVALID_RECIPIENT\", `Invalid recipient: ${reason}`, {\n details: { reason },\n }),\n\n /**\n * The org Zodiac Roles modifier REFUSED the spend on-chain (G4 · #547): the\n * member's role condition (per-tx cap, per-day allowance, allowed recipient,\n * or membership) was violated, so `execTransactionWithRole` reverted. This is\n * a PERMISSION denial — explicitly NOT an `INSUFFICIENT_BALANCE` (the treasury\n * held the funds; the role's authority is what bound). `reason` discriminates\n * the violated condition (`over_cap` / `daily_cap` / `not_member` /\n * `disallowed_recipient` / `condition_violation`); leak-safe — no on-chain\n * identifiers ever enter the details.\n */\n rolePermissionDenied: (details: {\n readonly reason:\n | \"over_cap\"\n | \"daily_cap\"\n | \"not_member\"\n | \"disallowed_recipient\"\n | \"condition_violation\";\n readonly operation?: string;\n }) =>\n new CapxulError(\n \"ROLE_PERMISSION_DENIED\",\n `Org role denied this spend on-chain (${details.reason}).`,\n {\n details:\n details.operation === undefined\n ? { reason: details.reason }\n : { reason: details.reason, operation: details.operation },\n },\n ),\n\n /**\n * A transaction (or sponsored UserOp) failed. `details.reason` discriminates\n * the failure mode for callers that must distinguish a CONFIRMED on-chain\n * revert (`\"onchain_revert\"` — the op executed and reverted, e.g. a Zodiac\n * Roles condition violation) from an inconclusive infra failure. A confirmed\n * revert is the ONLY mode the org spend port may map to a roles denial.\n */\n transactionFailed: (operation: string, cause?: unknown, extra?: { readonly reason?: string }) =>\n new CapxulError(\"TRANSACTION_FAILED\", `Transaction failed: ${operation}`, {\n cause,\n details: extra?.reason === undefined ? { operation } : { operation, reason: extra.reason },\n }),\n\n rateLimited: (details?: { readonly retryAfterMs?: number; readonly resource?: string }) =>\n new CapxulError(\n \"RATE_LIMITED\",\n \"Rate limit exceeded\",\n details === undefined ? undefined : { details: { ...details } },\n ),\n\n networkError: (operation: string, cause?: unknown) =>\n new CapxulError(\"NETWORK_ERROR\", `Network error during ${operation}`, {\n cause,\n details: { operation },\n }),\n\n unknown: (cause?: unknown) => new CapxulError(\"UNKNOWN\", \"Unknown error\", { cause }),\n\n otpExpired: (details?: { readonly email?: string; readonly expiredAt?: number }) =>\n new CapxulError(\n \"OTP_EXPIRED\",\n \"Verification code has expired. Request a new one.\",\n details === undefined ? undefined : { details: { ...details } },\n ),\n\n signerRejected: (details: {\n readonly source: SignerSource;\n readonly reason?: string;\n readonly cause?: unknown;\n }) =>\n new CapxulError(\"SIGNER_REJECTED\", \"Signer rejected the request.\", {\n cause: details.cause,\n details:\n details.reason === undefined\n ? { source: details.source }\n : { source: details.source, reason: details.reason },\n }),\n\n cancelled: (details?: { readonly operation?: string; readonly reason?: string }) =>\n new CapxulError(\n \"CANCELLED\",\n \"Operation was cancelled.\",\n details === undefined ? undefined : { details: { ...details } },\n ),\n\n /**\n * Method called from a flow state where its precondition fails (TA16). The\n * SDK's method API short-circuits with this error before driving the\n * internal state machine. `currentState` is the Effect-machine snapshot\n * tag (stringified — substrate is `@effect/experimental/Machine` per\n * `docs/canon/decisions/state-machine-substrate.md`); `validStates`\n * enumerates the states the method accepts.\n */\n wrongState: (details: {\n readonly method: string;\n readonly currentState: string;\n readonly validStates: readonly string[];\n }) =>\n new CapxulError(\n \"WRONG_STATE\",\n `${details.method} called from state '${details.currentState}'; valid states: ${details.validStates.join(\", \")}`,\n { details: { ...details, validStates: [...details.validStates] } },\n ),\n} as const;\n","// Shared `decodeConvexError` helper (TA5) — used by both the SDK's\n// `ConvexCallAdapter.mapToCapxulError` AND the backend `credentials/http.ts`\n// `bootstrapClient` handler. Single source of truth for cross-Convex-boundary\n// error decoding rules.\n//\n// Recognizes the `ConvexError(SerializedCapxulError)` object-shape produced by\n// `withErrorBoundary` (Probe B finding, 2026-05-19):\n//\n// { name: \"ConvexError\", data: { code, message, details?, correlationId?, layer? } }\n//\n// AND the defensive string-shape branch for older Convex versions where\n// `data` is a JSON-serialized string. Pass-through for raw `CapxulError`\n// instances (which arrive directly when the throw happened in the same\n// V8 isolate as the catch). Returns null when the value is not a\n// recognizable shape — the caller falls back to NETWORK_ERROR + reportError.\n\nimport {\n CAPXUL_ERROR_CODES,\n CapxulError,\n type CapxulErrorCode,\n type SerializedCapxulError,\n deserializeCapxulError,\n} from \"./errors.ts\";\n\n// Derived from the canonical catalog in errors.ts — single source of truth,\n// so a new code added to `CAPXUL_ERROR_CODES` is recognized here automatically.\nconst KNOWN_CODES: ReadonlySet<CapxulErrorCode> = new Set(CAPXUL_ERROR_CODES);\n\nfunction isCapxulCode(value: unknown): value is CapxulErrorCode {\n return typeof value === \"string\" && KNOWN_CODES.has(value as CapxulErrorCode);\n}\n\nfunction reconstruct(serialized: Record<string, unknown>): CapxulError | null {\n if (!isCapxulCode(serialized.code)) return null;\n const payload: SerializedCapxulError = {\n code: serialized.code,\n message: typeof serialized.message === \"string\" ? serialized.message : String(serialized.code),\n ...(typeof serialized.details === \"object\" &&\n serialized.details !== null &&\n !Array.isArray(serialized.details)\n ? { details: serialized.details as Record<string, unknown> }\n : {}),\n ...(typeof serialized.correlationId === \"string\"\n ? { correlationId: serialized.correlationId }\n : {}),\n ...(typeof serialized.layer === \"string\" ? { layer: serialized.layer } : {}),\n };\n return deserializeCapxulError(payload);\n}\n\nexport function decodeConvexError(err: unknown): CapxulError | null {\n if (err === null || err === undefined) return null;\n\n // Pass-through: same isolate, real CapxulError instance.\n if (err instanceof CapxulError) return err;\n\n if (typeof err !== \"object\") return null;\n\n // The canonical shape produced by `withErrorBoundary` then crossed by\n // Convex's `ctx.runQuery` / `ConvexHttpClient`: a `ConvexError` whose\n // `data` is the `SerializedCapxulError` object literal.\n const record = err as Record<string, unknown>;\n if (!(\"data\" in record)) return null;\n const data = record.data;\n\n if (typeof data === \"object\" && data !== null) {\n return reconstruct(data as Record<string, unknown>);\n }\n\n // Defensive depth — some Convex versions JSON-stringify the data at\n // the runtime boundary. Probe B confirmed @convex-dev/better-auth 0.10.13\n // + convex 1.39.x do NOT do this, but the cheap parse keeps forward\n // compatibility.\n if (typeof data === \"string\") {\n try {\n const parsed = JSON.parse(data) as unknown;\n if (typeof parsed === \"object\" && parsed !== null) {\n return reconstruct(parsed as Record<string, unknown>);\n }\n } catch {\n // Fall through.\n }\n }\n\n return null;\n}\n","import { Errors } from \"@capxul/errors\";\nimport type { CapxulClient } from \"@capxul/sdk\";\n\n/**\n * Narrow the bootstrap-nullable client to a ready client inside a query /\n * mutation function (sdk-provider-owned-bootstrap.md). Data hooks gate their\n * queries on `enabled: client !== null`, so this only ever throws for a mutation\n * triggered while `<CapxulProvider>` is still bootstrapping.\n */\nexport function requireBootstrappedClient(\n client: CapxulClient | null,\n method: string,\n): CapxulClient {\n if (client === null) {\n throw Errors.wrongState({ method, currentState: \"bootstrapping\", validStates: [\"ready\"] });\n }\n return client;\n}\n","// Typed query-key catalog (epic #258 · TanStack reactive surface).\n//\n// Auth-boundary mutations (`verifyOtp`, `signOut`) invalidate all three\n// keys on success. `signIn` does not — OTP sent leaves session null.\n\nimport type { AccountId, OrgId } from \"@capxul/types\";\n\nexport const capxulKeys = {\n session: [\"capxul\", \"session\"] as const,\n profile: [\"capxul\", \"profile\"] as const,\n account: [\"capxul\", \"account\"] as const,\n accountLifecycle: [\"capxul\", \"accountLifecycle\"] as const,\n provisioning: [\"capxul\", \"provisioning\"] as const,\n binding: [\"capxul\", \"binding\"] as const,\n accountBalance: [\"capxul\", \"accountBalance\"] as const,\n subAccounts: (accountId: AccountId | undefined) =>\n [\"capxul\", \"subAccounts\", accountId ?? \"pending\"] as const,\n // Organization domain (canon §C3, D13 — entity-scoped, keyed by OrgId).\n orgs: [\"capxul\", \"orgs\"] as const,\n org: (orgId: OrgId | undefined) => [\"capxul\", \"org\", orgId ?? \"pending\"] as const,\n orgMembers: (orgId: OrgId | undefined) =>\n [\"capxul\", \"org\", orgId ?? \"pending\", \"members\"] as const,\n orgRoles: (orgId: OrgId | undefined) => [\"capxul\", \"org\", orgId ?? \"pending\", \"roles\"] as const,\n orgTreasury: (orgId: OrgId | undefined) =>\n [\"capxul\", \"org\", orgId ?? \"pending\", \"treasury\"] as const,\n} satisfies Record<string, readonly unknown[] | ((...args: never[]) => readonly unknown[])>;\n","import { captureExceptionSync } from \"@capxul/sdk\";\nimport type { TelemetryPort } from \"@capxul/sdk\";\nimport type { CapxulResult } from \"@capxul/sdk\";\n\n/**\n * Unwrap a `CapxulResult` for TanStack query/mutation functions —\n * throws into error paths, optionally reporting the error to telemetry first.\n *\n * When `telemetry` is provided and the result is `{ ok: false }`,\n * `captureExceptionSync` is called (fire-and-forget) before the throw. `operation`\n * tags the telemetry event so query reads and mutation writes stay\n * distinguishable in error tracking (defaults to `\"query\"`).\n */\nexport function unwrapCapxulResult<T>(\n result: CapxulResult<T>,\n telemetry?: TelemetryPort,\n operation: \"query\" | \"mutation\" = \"query\",\n): T {\n if (result.ok) {\n return result.value;\n }\n if (telemetry) {\n try {\n captureExceptionSync(telemetry, result.error, {\n layer: \"react-query\",\n operation,\n });\n } catch {\n // Telemetry failure never prevents the throw\n }\n }\n throw result.error;\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/errors\";\nimport type { Session } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulSessionReturn = UseQueryResult<Session | null, CapxulError>;\n\nexport function useCapxulSession(): UseCapxulSessionReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.session,\n queryFn: async () =>\n unwrapCapxulResult(\n await requireBootstrappedClient(client, \"auth.getSession\").auth.getSession(),\n client!._internal.telemetry,\n ),\n enabled: client !== null,\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/errors\";\nimport type { Profile } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulProfileReturn = UseQueryResult<Profile | null, CapxulError>;\n\nexport function useCapxulProfile(): UseCapxulProfileReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.profile,\n queryFn: async () =>\n unwrapCapxulResult(\n await requireBootstrappedClient(client, \"identity.loadCurrent\").identity.loadCurrent(),\n client!._internal.telemetry,\n ),\n enabled: client !== null,\n });\n}\n","/** True under Vitest — disables hook polling intervals that fight fake timers. */\nexport function isVitestRuntime(): boolean {\n return typeof process !== \"undefined\" && process.env[\"VITEST\"] === \"true\";\n}\n","import type { QueryClient } from \"@tanstack/react-query\";\n\nimport { capxulKeys } from \"./reactivity-keys\";\n\n/** Background refetch after verifyOtp — avoids hard reset cancel errors in UI. */\nexport async function invalidateAuthBoundary(queryClient: QueryClient): Promise<void> {\n await Promise.all([\n queryClient.invalidateQueries({ queryKey: capxulKeys.session }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.profile }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.accountLifecycle }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance }),\n ]);\n}\n\n/** Hard reset after signOut — drop cached authenticated rows immediately. */\nexport async function resetAuthBoundary(queryClient: QueryClient): Promise<void> {\n await queryClient.cancelQueries({ queryKey: capxulKeys.accountBalance });\n await Promise.all([\n queryClient.resetQueries({ queryKey: capxulKeys.session }),\n queryClient.resetQueries({ queryKey: capxulKeys.profile }),\n queryClient.resetQueries({ queryKey: capxulKeys.accountLifecycle }),\n queryClient.resetQueries({ queryKey: capxulKeys.accountBalance }),\n ]);\n}\n","\"use client\";\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationResult,\n} from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/errors\";\nimport { isSettingUpLifecycle, type AccountLifecycle } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { isVitestRuntime } from \"../internal/is-vitest-runtime\";\nimport { invalidateAuthBoundary } from \"../internal/invalidate-auth-boundary\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nconst LOADING_LIFECYCLE: AccountLifecycle = { status: \"loading\" };\n\nexport interface UseCapxulAccountLifecycleReturn {\n readonly lifecycle: AccountLifecycle;\n readonly isSettingUp: boolean;\n readonly error: CapxulError | null;\n readonly isLoading: boolean;\n readonly isFetching: boolean;\n readonly isError: boolean;\n readonly retry: UseMutationResult<AccountLifecycle, CapxulError, void>[\"mutateAsync\"];\n readonly isRetrying: boolean;\n}\n\nexport function useCapxulAccountLifecycle(): UseCapxulAccountLifecycleReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n\n const query = useQuery<AccountLifecycle, CapxulError>({\n queryKey: capxulKeys.accountLifecycle,\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"account.getLifecycle\");\n return unwrapCapxulResult(\n await bootstrappedClient.account.getLifecycle(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null,\n refetchInterval: (q) => {\n if (isVitestRuntime()) return false;\n const data = q.state.data;\n if (data === undefined) return false;\n // Keep polling through `loading` — the first fetch can race verifyOtp/session\n // hydration; without this the hook sticks on loading forever.\n if (data.status === \"loading\" || isSettingUpLifecycle(data)) return 2_000;\n return false;\n },\n });\n\n const retryMutation = useMutation<AccountLifecycle, CapxulError, void>({\n mutationFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"account.retrySetup\");\n return unwrapCapxulResult(\n await bootstrappedClient.account.retrySetup(),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async () => {\n await invalidateAuthBoundary(queryClient);\n },\n });\n\n const lifecycle = query.data ?? LOADING_LIFECYCLE;\n const failedError = lifecycle.status === \"failed\" ? lifecycle.error : null;\n const queryError = query.isError ? query.error : null;\n\n return {\n lifecycle:\n queryError !== null && lifecycle.status === \"loading\"\n ? {\n status: \"failed\",\n at: \"connecting\",\n error: queryError,\n }\n : lifecycle,\n isSettingUp: isSettingUpLifecycle(lifecycle),\n error: failedError ?? queryError,\n isLoading: query.isLoading,\n isFetching: query.isFetching,\n isError: query.isError,\n retry: retryMutation.mutateAsync,\n isRetrying: retryMutation.isPending,\n };\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/errors\";\nimport type { Account } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulAccountBalanceReturn = UseQueryResult<Account, CapxulError>;\n\nexport type UseCapxulAccountBalanceOptions = {\n /** When false, skips the Convex readBalance action until the account ladder is ready. */\n readonly enabled?: boolean;\n};\n\nexport function useCapxulAccountBalance(\n options?: UseCapxulAccountBalanceOptions,\n): UseCapxulAccountBalanceReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.accountBalance,\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"accounts.read\");\n return unwrapCapxulResult(\n await bootstrappedClient.accounts.read(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && (options?.enabled ?? true),\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/errors\";\nimport type { Money } from \"@capxul/types\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulAccountFundReturn = UseMutationResult<\n { readonly txHash: string },\n CapxulError,\n Money\n>;\n\nexport function useCapxulAccountFund(): UseCapxulAccountFundReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (amount: Money) => {\n const bootstrappedClient = requireBootstrappedClient(client, \"_internal.accounts.fund\");\n return unwrapCapxulResult(\n await bootstrappedClient._internal.accounts.fund(amount),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/errors\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport interface SignInInput {\n readonly email: string;\n}\n\nexport interface SignInSuccess {\n readonly sessionId: string;\n readonly expiresAt: number;\n}\n\nexport type UseCapxulSignInReturn = UseMutationResult<SignInSuccess, CapxulError, SignInInput>;\n\nexport function useCapxulSignIn(): UseCapxulSignInReturn {\n const client = useCapxulClientOrNull();\n return useMutation({\n mutationFn: async (input: SignInInput) => {\n const bootstrappedClient = requireBootstrappedClient(client, \"auth.signIn\");\n return unwrapCapxulResult(\n await bootstrappedClient.auth.signIn(input),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/errors\";\nimport type { Session } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { invalidateAuthBoundary } from \"../internal/invalidate-auth-boundary\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport interface VerifyOtpInput {\n readonly email: string;\n readonly code: string;\n}\n\nexport type UseCapxulVerifyOtpReturn = UseMutationResult<Session, CapxulError, VerifyOtpInput>;\n\nexport function useCapxulVerifyOtp(): UseCapxulVerifyOtpReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: VerifyOtpInput) => {\n const bootstrappedClient = requireBootstrappedClient(client, \"auth.verifyOtp\");\n return unwrapCapxulResult(\n await bootstrappedClient.auth.verifyOtp(input),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async () => {\n await invalidateAuthBoundary(queryClient);\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/errors\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { resetAuthBoundary } from \"../internal/invalidate-auth-boundary\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulSignOutReturn = UseMutationResult<void, CapxulError, void>;\n\nexport function useCapxulSignOut(): UseCapxulSignOutReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n onMutate: async () => {\n await queryClient.cancelQueries({ queryKey: capxulKeys.accountBalance });\n },\n mutationFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"auth.signOut\");\n return unwrapCapxulResult(\n await bootstrappedClient.auth.signOut(),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: () => resetAuthBoundary(queryClient),\n });\n}\n","\"use client\";\n\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationResult,\n type UseQueryResult,\n} from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/errors\";\nimport type { AccountId, SubAccount, SubAccountId } from \"@capxul/types\";\nimport type { TransferInput, TransferResult } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulSubAccountsListOptions = {\n readonly enabled?: boolean;\n};\n\nexport type UseCapxulSubAccountsListReturn = UseQueryResult<readonly SubAccount[], CapxulError>;\n\nexport function useCapxulSubAccountsList(\n accountId: AccountId | undefined,\n options?: UseCapxulSubAccountsListOptions,\n): UseCapxulSubAccountsListReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.subAccounts(accountId),\n queryFn: async () => {\n if (accountId === undefined) {\n throw Errors.invalidInput(\"accountId\", \"required for subAccounts.list\");\n }\n const bootstrappedClient = requireBootstrappedClient(client, \"subAccounts.list\");\n return unwrapCapxulResult(\n await bootstrappedClient.subAccounts.list(accountId),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && (options?.enabled ?? true) && accountId !== undefined,\n });\n}\n\nexport type UseCapxulSubAccountCreateReturn = UseMutationResult<\n SubAccount,\n CapxulError,\n { readonly accountId: AccountId; readonly name: string }\n>;\n\nexport function useCapxulSubAccountCreate(): UseCapxulSubAccountCreateReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) => {\n const bootstrappedClient = requireBootstrappedClient(client, \"subAccounts.create\");\n return unwrapCapxulResult(\n await bootstrappedClient.subAccounts.create(input.accountId, { name: input.name }),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (_value, variables) => {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.subAccounts(variables.accountId),\n });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });\n },\n });\n}\n\nexport type UseCapxulSubAccountRenameReturn = UseMutationResult<\n SubAccount,\n CapxulError,\n { readonly accountId: AccountId; readonly subAccountId: SubAccountId; readonly name: string }\n>;\n\nexport function useCapxulSubAccountRename(): UseCapxulSubAccountRenameReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) => {\n const bootstrappedClient = requireBootstrappedClient(client, \"subAccounts.rename\");\n return unwrapCapxulResult(\n await bootstrappedClient.subAccounts.rename(input.subAccountId, input.name),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (_value, variables) => {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.subAccounts(variables.accountId),\n });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });\n },\n });\n}\n\nexport type UseCapxulSubAccountDeleteReturn = UseMutationResult<\n void,\n CapxulError,\n { readonly accountId: AccountId; readonly subAccountId: SubAccountId }\n>;\n\nexport function useCapxulSubAccountDelete(): UseCapxulSubAccountDeleteReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) => {\n const bootstrappedClient = requireBootstrappedClient(client, \"subAccounts.delete\");\n return unwrapCapxulResult(\n await bootstrappedClient.subAccounts.delete(input.subAccountId),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (_value, variables) => {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.subAccounts(variables.accountId),\n });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });\n },\n });\n}\n\n/**\n * Move money between two of the SAME Account's balances (canon §5/§12). The\n * consumer-facing labels are \"Add money\" (main → sub) and \"Move money out\"\n * (sub → main), both calling `transfer`. `accountId` is carried only to\n * invalidate the right cache keys; the SDK input itself is `{ from, to, amount }`.\n */\nexport type UseCapxulTransferReturn = UseMutationResult<\n TransferResult,\n CapxulError,\n { readonly accountId: AccountId } & TransferInput\n>;\n\nexport function useCapxulTransfer(): UseCapxulTransferReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async ({ from, to, amount }) => {\n const bootstrappedClient = requireBootstrappedClient(client, \"subAccounts.transfer\");\n return unwrapCapxulResult(\n await bootstrappedClient.subAccounts.transfer({ from, to, amount }),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (_value, variables) => {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.subAccounts(variables.accountId),\n });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance });\n },\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/errors\";\nimport type { OrgView } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\n/**\n * List the Orgs you belong to (canon §C1 \"Org list\" / §C3). Binds directly to\n * the locked `capxul.orgs()` SDK method.\n */\nexport type UseCapxulOrgsReturn = UseQueryResult<readonly OrgView[], CapxulError>;\n\nexport type UseCapxulOrgsOptions = {\n /**\n * Gate the query on auth readiness. `client.orgs()` is a session-scoped\n * authenticated read; firing it before the session token settles surfaces a\n * spurious `NOT_AUTHENTICATED`. Consumers pass `enabled: <auth-ready>` (e.g.\n * \"the Organization surface is active\") — mirrors `useCapxulSubAccountsList`.\n * Defaults to `true` to preserve the bare `useCapxulOrgs()` call shape.\n */\n readonly enabled?: boolean;\n};\n\nexport function useCapxulOrgs(options?: UseCapxulOrgsOptions): UseCapxulOrgsReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.orgs,\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"orgs\");\n return unwrapCapxulResult(\n await bootstrappedClient.orgs(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && (options?.enabled ?? true),\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/errors\";\nimport type { OrgId, OrgView } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulOrgOptions = {\n readonly enabled?: boolean;\n};\n\n/**\n * A single Org you belong to, resolved from `capxul.orgs()` and narrowed to the\n * requested `orgId` (canon §C3). Returns `null` when the Org is not in your list.\n * Gated by `orgId !== undefined`. RED until S1.\n */\nexport type UseCapxulOrgReturn = UseQueryResult<OrgView | null, CapxulError>;\n\nexport function useCapxulOrg(\n orgId: OrgId | undefined,\n options?: UseCapxulOrgOptions,\n): UseCapxulOrgReturn {\n const client = useCapxulClient();\n return useQuery({\n queryKey: capxulKeys.org(orgId),\n queryFn: async () => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulOrg\");\n }\n const orgs = unwrapCapxulResult(await client.orgs(), client!._internal.telemetry);\n return orgs.find((org) => org.id === orgId) ?? null;\n },\n enabled: (options?.enabled ?? true) && orgId !== undefined,\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/errors\";\nimport type { MemberView, OrgId } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulOrgMembersOptions = {\n readonly enabled?: boolean;\n};\n\n/**\n * The members of an Org (canon §C1 \"Members\" / §C3, D8/D9). Binds directly to\n * the entity-scoped `capxul.org(orgId).members()` (D13). Gated by\n * `orgId !== undefined`. RED until S3.\n */\nexport type UseCapxulOrgMembersReturn = UseQueryResult<readonly MemberView[], CapxulError>;\n\nexport function useCapxulOrgMembers(\n orgId: OrgId | undefined,\n options?: UseCapxulOrgMembersOptions,\n): UseCapxulOrgMembersReturn {\n const client = useCapxulClient();\n return useQuery({\n queryKey: capxulKeys.orgMembers(orgId),\n queryFn: async () => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulOrgMembers\");\n }\n return unwrapCapxulResult(await client.org(orgId).members(), client!._internal.telemetry);\n },\n enabled: (options?.enabled ?? true) && orgId !== undefined,\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/errors\";\nimport type { OrgId, RoleView } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulOrgRolesOptions = {\n readonly enabled?: boolean;\n};\n\n/**\n * The roles seeded on an Org (canon §C1 \"Roles\" / §C3, D4/D6). Binds directly\n * to the entity-scoped `capxul.org(orgId).roles()` (D13). Gated by\n * `orgId !== undefined`. RED until S2.\n */\nexport type UseCapxulOrgRolesReturn = UseQueryResult<readonly RoleView[], CapxulError>;\n\nexport function useCapxulOrgRoles(\n orgId: OrgId | undefined,\n options?: UseCapxulOrgRolesOptions,\n): UseCapxulOrgRolesReturn {\n const client = useCapxulClient();\n return useQuery({\n queryKey: capxulKeys.orgRoles(orgId),\n queryFn: async () => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulOrgRoles\");\n }\n return unwrapCapxulResult(await client.org(orgId).roles(), client!._internal.telemetry);\n },\n enabled: (options?.enabled ?? true) && orgId !== undefined,\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/errors\";\nimport type { OrgId, RoleView } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulOrgDeployRolesReturn = UseMutationResult<\n readonly RoleView[],\n CapxulError,\n OrgId\n>;\n\nexport function useCapxulOrgDeployRoles(): UseCapxulOrgDeployRolesReturn {\n const client = useCapxulClient();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (orgId: OrgId) => {\n return unwrapCapxulResult(\n await client.org(orgId).deployRoles(),\n client._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (_roles, orgId) => {\n await queryClient.invalidateQueries({ queryKey: capxulKeys.orgRoles(orgId) });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.org(orgId) });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.orgs });\n },\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/errors\";\nimport type { OrgId } from \"@capxul/sdk\";\nimport type { Account } from \"@capxul/types\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulOrgTreasuryOptions = {\n readonly enabled?: boolean;\n};\n\n/**\n * The Org treasury — the real M2 `Account` over the Org Safe (canon §C3, D3).\n * NEVER `AccountStatus` (the deploy-readiness ladder, no balance). Binds\n * directly to the entity-scoped `capxul.org(orgId).treasury()` (D13). Gated by\n * `orgId !== undefined`. RED until S1.\n */\nexport type UseCapxulOrgTreasuryReturn = UseQueryResult<Account, CapxulError>;\n\nexport function useCapxulOrgTreasury(\n orgId: OrgId | undefined,\n options?: UseCapxulOrgTreasuryOptions,\n): UseCapxulOrgTreasuryReturn {\n const client = useCapxulClient();\n return useQuery({\n queryKey: capxulKeys.orgTreasury(orgId),\n queryFn: async () => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulOrgTreasury\");\n }\n return unwrapCapxulResult(await client.org(orgId).treasury(), client!._internal.telemetry);\n },\n enabled: (options?.enabled ?? true) && orgId !== undefined,\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError } from \"@capxul/errors\";\nimport type { CreateOrgInput, OrgView } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\n/**\n * Create an Org (canon §C2 J1 / §C3, S1). Binds directly to the locked\n * `capxul.createOrg(input)` SDK method. On success, invalidates the org list.\n * RED until S1 — `mutate` rejects with `Errors.notImplemented(\"org\",\"createOrg\")`.\n */\nexport type UseCapxulCreateOrgReturn = UseMutationResult<OrgView, CapxulError, CreateOrgInput>;\n\nexport function useCapxulCreateOrg(): UseCapxulCreateOrgReturn {\n const client = useCapxulClient();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: CreateOrgInput) =>\n unwrapCapxulResult(await client.createOrg(input), client._internal.telemetry, \"mutation\"),\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: capxulKeys.orgs });\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/errors\";\nimport type { InviteMemberInput, MemberView, OrgId } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\n/**\n * Invite a member to an Org by email (canon §C2 J2 virality loop / §C3, S3, D8).\n * Entity-scoped via the closed-over `orgId` (D13). Binds directly to\n * `capxul.org(orgId).invite(input)`. On success, invalidates the member list.\n * RED until S3 — `mutate` rejects with `Errors.notImplemented(\"org\",\"invite\")`.\n */\nexport type UseCapxulInviteMemberReturn = UseMutationResult<\n MemberView,\n CapxulError,\n InviteMemberInput\n>;\n\nexport function useCapxulInviteMember(orgId: OrgId | undefined): UseCapxulInviteMemberReturn {\n const client = useCapxulClient();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: InviteMemberInput) => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulInviteMember\");\n }\n return unwrapCapxulResult(\n await client.org(orgId).invite(input),\n client._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async () => {\n if (orgId === undefined) return;\n await queryClient.invalidateQueries({ queryKey: capxulKeys.orgMembers(orgId) });\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/errors\";\nimport type { OrgId, RemoveMemberInput } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\n/**\n * Remove a member from an Org (canon §C2 J2 / §C3, S3, D7/D8) — drives the\n * on-chain REVOKE + Convex mirror. Keyed on the member's personal Safe address\n * (D7). Entity-scoped via the closed-over `orgId` (D13). Binds directly to\n * `capxul.org(orgId).removeMember(input)`. On success, invalidates the member\n * list. RED until S3 — `mutate` rejects with\n * `Errors.notImplemented(\"org\",\"removeMember\")`.\n */\nexport type UseCapxulRemoveMemberReturn = UseMutationResult<void, CapxulError, RemoveMemberInput>;\n\nexport function useCapxulRemoveMember(orgId: OrgId | undefined): UseCapxulRemoveMemberReturn {\n const client = useCapxulClient();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: RemoveMemberInput) => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulRemoveMember\");\n }\n return unwrapCapxulResult(\n await client.org(orgId).removeMember(input),\n client._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async () => {\n if (orgId === undefined) return;\n await queryClient.invalidateQueries({ queryKey: capxulKeys.orgMembers(orgId) });\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport { Errors, type CapxulError } from \"@capxul/errors\";\nimport type { AssignRoleInput, MemberView, OrgId } from \"@capxul/sdk\";\n\nimport { useCapxulClient } from \"../internal/capxul-client-context\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\n/**\n * Assign a role to a member (canon §C2 J2 / §C3, S3, D7/D9) — drives the\n * on-chain GRANT + Convex mirror. Keyed on the member's personal Safe address\n * (D7); the `role` label maps deterministically to the on-chain `roleKey` (D9).\n * Entity-scoped via the closed-over `orgId` (D13). Binds directly to\n * `capxul.org(orgId).assignRole(input)`. On success, invalidates the member\n * list. RED until S3 — `mutate` rejects with\n * `Errors.notImplemented(\"org\",\"assignRole\")`.\n */\nexport type UseCapxulAssignRoleReturn = UseMutationResult<MemberView, CapxulError, AssignRoleInput>;\n\nexport function useCapxulAssignRole(orgId: OrgId | undefined): UseCapxulAssignRoleReturn {\n const client = useCapxulClient();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: AssignRoleInput) => {\n if (orgId === undefined) {\n throw Errors.invalidInput(\"orgId\", \"required for useCapxulAssignRole\");\n }\n return unwrapCapxulResult(\n await client.org(orgId).assignRole(input),\n client._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async () => {\n if (orgId === undefined) return;\n await queryClient.invalidateQueries({ queryKey: capxulKeys.orgMembers(orgId) });\n },\n });\n}\n","\"use client\";\n\nimport { useMutation, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { OrgId } from \"@capxul/sdk\";\n\nexport type SwitchActingEntityInput = {\n readonly orgId?: OrgId;\n};\n\n/**\n * Switch the acting entity (personal Account ↔ Organization).\n *\n * Per canon D13 the acting entity is NOT shared mutable SDK state — scoping is\n * explicit per `capxul.org(orgId)` call — so this mutation carries no SDK side\n * effect. It exists as the stable mutation seam the headless\n * `CapxulEntitySwitcher` drives; the actual context switch is the consumer's\n * own local state, applied through the component's `onSwitchPersonal` /\n * `onSwitchOrg` callbacks.\n *\n * The legacy `org_entity_switched` telemetry emission was removed when master's\n * unified telemetry pipeline (#402) dropped that event from the Layer 0 spine.\n */\nexport type UseCapxulSwitchActingEntityReturn = UseMutationResult<\n void,\n Error,\n SwitchActingEntityInput | undefined\n>;\n\nexport function useCapxulSwitchActingEntity(): UseCapxulSwitchActingEntityReturn {\n return useMutation({\n mutationFn: async (_input?: SwitchActingEntityInput) => undefined,\n });\n}\n"],"mappings":";;;;;;AAsBA,MAAM,yBAAyB,cAA2C,IAAI;AAO9E,SAAgB,wBAAwB,EAAE,OAAO,YAA0C;CACzF,OACE,oBAAC,uBAAuB,UAAxB;EAAwC;EAAQ;CAA0C,CAAA;AAE9F;AAEA,SAAgB,YAAkC;CAChD,MAAM,QAAQ,WAAW,sBAAsB;CAC/C,IAAI,UAAU,MACZ,MAAM,IAAI,MAAM,gDAAgD;CAElE,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C;EAChF;CACF,CAAC;AACH;;;ACrBA,SAAgB,sBAAsB,OAAuD;CAC3F,MAAM,SAAS,gBAAgB;CAC/B,MAAM,cAAc,eAAe;CACnC,OAAO,YAAY;EACjB,YAAY,OAAO,UAA6B;GAC9C,IAAI,UAAU,KAAA,GACZ,MAAM,OAAO,aAAa,SAAS,oCAAoC;GAEzE,OAAO,mBACL,MAAM,OAAO,IAAI,KAAK,EAAE,aAAa,KAAK,GAC1C,OAAO,UAAU,WACjB,UACF;EACF;EACA,WAAW,YAAY;GACrB,IAAI,UAAU,KAAA,GAAW;GACzB,MAAM,YAAY,kBAAkB,EAAE,UAAU,WAAW,WAAW,KAAK,EAAE,CAAC;EAChF;CACF,CAAC;AACH;;;AClBA,SAAgB,oBAAoB,OAAqD;CACvF,MAAM,SAAS,gBAAgB;CAC/B,MAAM,cAAc,eAAe;CACnC,OAAO,YAAY;EACjB,YAAY,OAAO,UAA2B;GAC5C,IAAI,UAAU,KAAA,GACZ,MAAM,OAAO,aAAa,SAAS,kCAAkC;GAEvE,OAAO,mBACL,MAAM,OAAO,IAAI,KAAK,EAAE,WAAW,KAAK,GACxC,OAAO,UAAU,WACjB,UACF;EACF;EACA,WAAW,YAAY;GACrB,IAAI,UAAU,KAAA,GAAW;GACzB,MAAM,YAAY,kBAAkB,EAAE,UAAU,WAAW,WAAW,KAAK,EAAE,CAAC;EAChF;CACF,CAAC;AACH;;;ACZA,SAAgB,8BAAiE;CAC/E,OAAO,YAAY,EACjB,YAAY,OAAO,WAAqC,KAAA,EAC1D,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sdk-react",
3
- "version": "1.0.0-alpha.6",
3
+ "version": "1.0.0-alpha.7",
4
4
  "files": [
5
5
  "dist",
6
6
  "package.json",
@@ -17,9 +17,7 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@capxul/config": "0.0.0",
21
- "@capxul/sdk": "1.0.0-alpha.6",
22
- "@capxul/types": "0.0.0"
20
+ "@capxul/sdk": "1.0.0-alpha.7"
23
21
  },
24
22
  "devDependencies": {
25
23
  "@tanstack/react-query": "^5.66.9",
@@ -35,7 +33,9 @@
35
33
  "react": "^19.2.6",
36
34
  "react-dom": "^19.2.6",
37
35
  "react-test-renderer": "^19.2.6",
38
- "vitest": "npm:@voidzero-dev/vite-plus-test@0.1.23"
36
+ "vitest": "npm:@voidzero-dev/vite-plus-test@0.1.23",
37
+ "@capxul/errors": "0.0.0",
38
+ "@capxul/types": "0.1.0-alpha.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@tanstack/react-query": "^5.66.9",
@@ -47,7 +47,7 @@
47
47
  "scripts": {
48
48
  "check-types": "tsc -p tsconfig.json --noEmit",
49
49
  "lint": "oxlint -c ../../.oxlintrc.json . --deny-warnings",
50
- "build": "vp pack",
50
+ "build": "NODE_OPTIONS=--max-old-space-size=24576 vp pack",
51
51
  "_vp-tasks-allowed": "vp-allowed: `test` + `test:coverage` are vp tasks in vite.config.ts so vitest self-writes don't bust cache (#205).",
52
52
  "test:e2e": "vp test run --config vitest.e2e.config.ts"
53
53
  }