@capxul/sdk-react 1.0.0-alpha.7 → 1.0.0-alpha.9

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,6 +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, OrgView, Profile, RemoveMemberInput, RoleView, Session, TransferInput, TransferResult } from "@capxul/sdk";
3
+ import { Account, AccountLifecycle, AccountRequirement, AssignRoleInput, CapxulClient, CapxulSigner, CompleteOrganizationOnboardingInput, CompleteOrganizationOnboardingResult, CompletePersonalOnboardingInput, CompletePersonalOnboardingResult, CreateOrgInput, InviteMemberInput, MemberView, OrgId, OrgView, Profile, RemoveMemberInput, RoleView, Session, TransferInput, TransferResult } from "@capxul/sdk";
4
4
 
5
5
  //#region src/provider.d.ts
6
6
  type CapxulProviderSharedProps = {
@@ -294,6 +294,31 @@ declare function useCapxulOrgTreasury(orgId: OrgId | undefined, options?: UseCap
294
294
  type UseCapxulCreateOrgReturn = UseMutationResult<OrgView, CapxulError, CreateOrgInput>;
295
295
  declare function useCapxulCreateOrg(): UseCapxulCreateOrgReturn;
296
296
  //#endregion
297
+ //#region src/hooks/use-capxul-complete-personal-onboarding.d.ts
298
+ /**
299
+ * Complete personal onboarding (D-ONBOARD · #669). Binds to
300
+ * `capxul.onboarding.completePersonal(input)`: persist the user's first identity
301
+ * profile + trigger provisioning, then return the leak-safe `{ lifecycle }`. A
302
+ * mutation, NOT an effect — call `mutateAsync` from a submit handler and route
303
+ * on `lifecycle.status` (see `docs/onboarding.md`). On success it invalidates the
304
+ * identity + account-lifecycle queries so the dashboard/provisioning screen
305
+ * reactively reflects the new state. No effect hooks — a handler + a query.
306
+ */
307
+ type UseCapxulCompletePersonalOnboardingReturn = UseMutationResult<CompletePersonalOnboardingResult, CapxulError, CompletePersonalOnboardingInput>;
308
+ declare function useCapxulCompletePersonalOnboarding(): UseCapxulCompletePersonalOnboardingReturn;
309
+ //#endregion
310
+ //#region src/hooks/use-capxul-complete-organization-onboarding.d.ts
311
+ /**
312
+ * Complete organization onboarding (D-ONBOARD · #669). Binds to
313
+ * `capxul.onboarding.completeOrganization(input)`: persist the founder's identity
314
+ * profile, create the Org (reusing `createOrg`), trigger provisioning, and return
315
+ * `{ org, lifecycle }`. Scope every later org call via `capxul.org(org.id).*`. A
316
+ * mutation, NOT an effect. On success it invalidates the identity, account-
317
+ * lifecycle, and org-list queries. No effect hooks — a handler + a query.
318
+ */
319
+ type UseCapxulCompleteOrganizationOnboardingReturn = UseMutationResult<CompleteOrganizationOnboardingResult, CapxulError, CompleteOrganizationOnboardingInput>;
320
+ declare function useCapxulCompleteOrganizationOnboarding(): UseCapxulCompleteOrganizationOnboardingReturn;
321
+ //#endregion
297
322
  //#region src/hooks/use-capxul-invite-member.d.ts
298
323
  /**
299
324
  * Invite a member to an Org by email (canon §C2 J2 virality loop / §C3, S3, D8).
@@ -349,5 +374,5 @@ type SwitchActingEntityInput = {
349
374
  type UseCapxulSwitchActingEntityReturn = UseMutationResult<void, Error, SwitchActingEntityInput | undefined>;
350
375
  declare function useCapxulSwitchActingEntity(): UseCapxulSwitchActingEntityReturn;
351
376
  //#endregion
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 };
377
+ 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 UseCapxulCompleteOrganizationOnboardingReturn, type UseCapxulCompletePersonalOnboardingReturn, 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, useCapxulCompleteOrganizationOnboarding, useCapxulCompletePersonalOnboarding, useCapxulCreateOrg, useCapxulInviteMember, useCapxulOrg, useCapxulOrgDeployRoles, useCapxulOrgMembers, useCapxulOrgRoles, useCapxulOrgTreasury, useCapxulOrgs, useCapxulProfile, useCapxulRemoveMember, useCapxulSession, useCapxulSignIn, useCapxulSignOut, useCapxulSubAccountCreate, useCapxulSubAccountDelete, useCapxulSubAccountRename, useCapxulSubAccountsList, useCapxulSwitchActingEntity, useCapxulTransfer, useCapxulVerifyOtp };
353
378
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
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,EAAO,WAAW;EAAA,SAClB,KAAA;AAAA;AAAA,iBAgBK,SAAA,CAAA,GAAa,oBAAoB;;;;;;;;iBCAjC,qBAAA,CAAA,GAAyB,YAA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,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"}
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-complete-personal-onboarding.ts","../src/hooks/use-capxul-complete-organization-onboarding.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,EAAO,WAAW;EA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src/hooks/use-capxul-complete-personal-onboarding.ts
708
+ function useCapxulCompletePersonalOnboarding() {
709
+ const client = useCapxulClient();
710
+ const queryClient = useQueryClient();
711
+ return useMutation({
712
+ mutationFn: async (input) => unwrapCapxulResult(await client.onboarding.completePersonal(input), client._internal.telemetry, "mutation"),
713
+ onSuccess: async () => {
714
+ await Promise.all([queryClient.invalidateQueries({ queryKey: capxulKeys.profile }), queryClient.invalidateQueries({ queryKey: capxulKeys.accountLifecycle })]);
715
+ }
716
+ });
717
+ }
718
+ //#endregion
719
+ //#region src/hooks/use-capxul-complete-organization-onboarding.ts
720
+ function useCapxulCompleteOrganizationOnboarding() {
721
+ const client = useCapxulClient();
722
+ const queryClient = useQueryClient();
723
+ return useMutation({
724
+ mutationFn: async (input) => unwrapCapxulResult(await client.onboarding.completeOrganization(input), client._internal.telemetry, "mutation"),
725
+ onSuccess: async () => {
726
+ await Promise.all([
727
+ queryClient.invalidateQueries({ queryKey: capxulKeys.profile }),
728
+ queryClient.invalidateQueries({ queryKey: capxulKeys.accountLifecycle }),
729
+ queryClient.invalidateQueries({ queryKey: capxulKeys.orgs })
730
+ ]);
731
+ }
732
+ });
733
+ }
734
+ //#endregion
707
735
  //#region src/hooks/use-capxul-invite-member.ts
708
736
  function useCapxulInviteMember(orgId) {
709
737
  const client = useCapxulClient();
@@ -757,6 +785,6 @@ function useCapxulSwitchActingEntity() {
757
785
  return useMutation({ mutationFn: async (_input) => void 0 });
758
786
  }
759
787
  //#endregion
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 };
788
+ export { CapxulProvider, useCapxul, useCapxulAccountBalance, useCapxulAccountFund, useCapxulAccountLifecycle, useCapxulAssignRole, useCapxulClientOrNull, useCapxulCompleteOrganizationOnboarding, useCapxulCompletePersonalOnboarding, useCapxulCreateOrg, useCapxulInviteMember, useCapxulOrg, useCapxulOrgDeployRoles, useCapxulOrgMembers, useCapxulOrgRoles, useCapxulOrgTreasury, useCapxulOrgs, useCapxulProfile, useCapxulRemoveMember, useCapxulSession, useCapxulSignIn, useCapxulSignOut, useCapxulSubAccountCreate, useCapxulSubAccountDelete, useCapxulSubAccountRename, useCapxulSubAccountsList, useCapxulSwitchActingEntity, useCapxulTransfer, useCapxulVerifyOtp };
761
789
 
762
790
  //# 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","../../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,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,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E,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"}
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-complete-personal-onboarding.ts","../src/hooks/use-capxul-complete-organization-onboarding.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 type { CapxulError } from \"@capxul/errors\";\nimport type {\n CompletePersonalOnboardingInput,\n CompletePersonalOnboardingResult,\n} 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 * Complete personal onboarding (D-ONBOARD · #669). Binds to\n * `capxul.onboarding.completePersonal(input)`: persist the user's first identity\n * profile + trigger provisioning, then return the leak-safe `{ lifecycle }`. A\n * mutation, NOT an effect — call `mutateAsync` from a submit handler and route\n * on `lifecycle.status` (see `docs/onboarding.md`). On success it invalidates the\n * identity + account-lifecycle queries so the dashboard/provisioning screen\n * reactively reflects the new state. No effect hooks — a handler + a query.\n */\nexport type UseCapxulCompletePersonalOnboardingReturn = UseMutationResult<\n CompletePersonalOnboardingResult,\n CapxulError,\n CompletePersonalOnboardingInput\n>;\n\nexport function useCapxulCompletePersonalOnboarding(): UseCapxulCompletePersonalOnboardingReturn {\n const client = useCapxulClient();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: CompletePersonalOnboardingInput) =>\n unwrapCapxulResult(\n await client.onboarding.completePersonal(input),\n client._internal.telemetry,\n \"mutation\",\n ),\n onSuccess: async () => {\n await Promise.all([\n queryClient.invalidateQueries({ queryKey: capxulKeys.profile }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.accountLifecycle }),\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 {\n CompleteOrganizationOnboardingInput,\n CompleteOrganizationOnboardingResult,\n} 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 * Complete organization onboarding (D-ONBOARD · #669). Binds to\n * `capxul.onboarding.completeOrganization(input)`: persist the founder's identity\n * profile, create the Org (reusing `createOrg`), trigger provisioning, and return\n * `{ org, lifecycle }`. Scope every later org call via `capxul.org(org.id).*`. A\n * mutation, NOT an effect. On success it invalidates the identity, account-\n * lifecycle, and org-list queries. No effect hooks — a handler + a query.\n */\nexport type UseCapxulCompleteOrganizationOnboardingReturn = UseMutationResult<\n CompleteOrganizationOnboardingResult,\n CapxulError,\n CompleteOrganizationOnboardingInput\n>;\n\nexport function useCapxulCompleteOrganizationOnboarding(): UseCapxulCompleteOrganizationOnboardingReturn {\n const client = useCapxulClient();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: CompleteOrganizationOnboardingInput) =>\n unwrapCapxulResult(\n await client.onboarding.completeOrganization(input),\n client._internal.telemetry,\n \"mutation\",\n ),\n onSuccess: async () => {\n await Promise.all([\n queryClient.invalidateQueries({ queryKey: capxulKeys.profile }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.accountLifecycle }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.orgs }),\n ]);\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,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,MAAM,sDAAsD;CAExE,OAAO;AACT;;;ACyBA,SAAS,yBAAsC;CAC7C,OAAO,IAAI,YAAY,EACrB,gBAAgB;EACd,SAAS;GAAE,OAAO;GAA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 -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sdk-react",
3
- "version": "1.0.0-alpha.7",
3
+ "version": "1.0.0-alpha.9",
4
4
  "files": [
5
5
  "dist",
6
6
  "package.json",
@@ -14,10 +14,11 @@
14
14
  }
15
15
  },
16
16
  "publishConfig": {
17
- "access": "public"
17
+ "access": "public",
18
+ "tag": "alpha"
18
19
  },
19
20
  "dependencies": {
20
- "@capxul/sdk": "1.0.0-alpha.7"
21
+ "@capxul/sdk": "1.0.0-alpha.9"
21
22
  },
22
23
  "devDependencies": {
23
24
  "@tanstack/react-query": "^5.66.9",