@capxul/sdk-react 1.0.0-alpha.14 → 1.0.0-alpha.16

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, AccountId, AccountLifecycle, AccountRequirement, ActivityListParams, ActivityPage, ActorRequest, ActorRequestIssueInput, AddressBookAddInput, AddressBookEntry, AddressBookLabelInput, AssignRoleInput, CapxulClient, CapxulError, CapxulSigner, CompleteOrganizationOnboardingInput, CompleteOrganizationOnboardingResult, CompletePersonalOnboardingInput, CompletePersonalOnboardingResult, CreateOrgInput, CurrentUserContext, Destination, DestinationAddInput, DestinationListInput, DestinationRemoveInput, InboxApproveInput, InboxItem, InsightsSummary as InsightsSummary$1, InviteMemberInput, MemberView, Money, OfframpQuote, OfframpQuoteInput, OfframpStatus, OrgId, OrgView, OrganizationAccount, OrganizationAuditLogItem, Payment, PaymentsPayInput, PaymentsPayoutInput, PaymentsWithdrawInput, PayrollRosterAddInput, PayrollRosterLine, PayrollRunInput, Profile, ReconciliationEntry, RemoveMemberInput, RoleView, Session, SubAccount, SubAccountId, TransferInput, TransferResult } from "@capxul/sdk";
3
+ import { Account, AccountId, AccountLifecycle, AccountRequirement, ActivityListParams, ActivityPage, ActorRequest, ActorRequestIssueInput, AddressBookAddInput, AddressBookEntry, AddressBookLabelInput, AssignRoleInput, CapxulClient, CapxulError, CapxulSigner, CompleteOrganizationOnboardingInput, CompleteOrganizationOnboardingResult, CompletePersonalOnboardingInput, CompletePersonalOnboardingResult, CreateOrgInput, CurrentUserContext, Destination, DestinationAddInput, DestinationListInput, DestinationRemoveInput, InboxApproveInput, InboxItem, InsightsSummary as InsightsSummary$1, InviteMemberInput, MemberView, Money, ObservationAdapter, OfframpQuote, OfframpQuoteInput, OfframpStatus, OrgId, OrgView, OrganizationAccount, OrganizationAuditLogItem, Payment, PaymentsPayInput, PaymentsPayoutInput, PaymentsWithdrawInput, PayrollRosterAddInput, PayrollRosterLine, PayrollRunInput, Profile, ReconciliationEntry, RemoveMemberInput, RoleView, Session, SubAccount, SubAccountId, TransferInput, TransferResult } from "@capxul/sdk";
4
4
 
5
5
  //#region src/provider.d.ts
6
6
  type CapxulProviderSharedProps = {
@@ -10,7 +10,8 @@ type CapxulProviderSharedProps = {
10
10
  /** Browser / app path — the provider bootstraps the client from a publishable key. */
11
11
  type CapxulProviderPublishableKeyProps = CapxulProviderSharedProps & {
12
12
  readonly publishableKey: string;
13
- readonly client?: never; /** Init-time account readiness target. Default `"none"`. */
13
+ readonly client?: never; /** Host-owned observation adapter passed to the core SDK boundary. */
14
+ readonly observation?: ObservationAdapter; /** Init-time account readiness target. Default `"none"`. */
14
15
  readonly requirement?: AccountRequirement;
15
16
  /**
16
17
  * Optional consumer-held signer for the deploy lane. Omitted in browser apps
@@ -24,7 +25,8 @@ type CapxulProviderPublishableKeyProps = CapxulProviderSharedProps & {
24
25
  */
25
26
  type CapxulProviderInjectedClientProps = CapxulProviderSharedProps & {
26
27
  readonly client: CapxulClient;
27
- readonly publishableKey?: never;
28
+ readonly publishableKey?: never; /** Injected clients must be created with observation at their owning factory. */
29
+ readonly observation?: never;
28
30
  readonly requirement?: never;
29
31
  readonly signer?: never;
30
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/provider.tsx","../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-current-user.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-money.ts","../src/internal/reactivity-keys.ts","../src/hooks/use-capxul-actor-scope.ts","../src/hooks/use-capxul-destinations.ts","../src/hooks/use-capxul-activity.ts","../src/hooks/use-capxul-offramp.ts","../src/hooks/use-capxul-payroll.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-organization-account.ts","../src/hooks/use-capxul-organization-audit-log.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","../../errors/src/errors.ts","../src/headless/shared/headless-error-view.ts","../src/headless/shared/types.ts","../../types/src/brand.ts","../../types/src/index.ts","../src/headless/money/SendMoney.tsx","../src/headless/relationship/AddressBook.tsx","../src/headless/relationship/RequestInbox.tsx","../src/headless/relationship/InsightsSummary.tsx","../src/headless/relationship/PayrollRoster.tsx","../src/headless/relationship/Destinations.tsx"],"mappings":";;;;;KA+BK,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,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oB,OAAA,UAAiB,OAAA;IAAA,SAClD,OAAA;IAAA,SACA,QAAA;EAAA;AAAA;AAAA,UAII,kBAAA;EAAA,SACN,KAAA,EAAO,OAAA;EAAA,SACP,KAAA,EAAO,kBAAkB;AAAA;AAAA,iBAGpB,aAAA,CAAA;EAAgB,KAAA;EAAO;AAAA,GAAS,kBAAA,oEAAkB,GAAA,CAAA,OAAA,GAAA,QAAA,iBAAA,SAAA,IAAA,OAAA,sDAAA,WAAA,mBAAA,YAAA,mCAAA,qBAAA,SAAA,QAAA,iBAAA,SAAA;;;KCjBtD,iBAAA;EAAA,SACD,IAAA,GAAO,IAAA;IAAA,SAAgB,QAAA,EAAU,KAAA,CAAM,SAAA;EAAA;EAAA,SACvC,YAAA,GAAe,IAAA,CAAK,cAAA,UAAwB,WAAA;EAAA,SAC5C,OAAA,GAAU,IAAA;IAAA,SACR,GAAA,GAAM,KAAA,EAAO,mBAAA,KAAwB,OAAA,CAAQ,WAAA;IAAA,SAC7C,MAAA,GAAS,KAAA,EAAO,sBAAA,KAA2B,OAAA;MAAA,SAAmB,EAAA;IAAA;IAAA,SAC9D,OAAA;IAAA,SACA,QAAA;EAAA;AAAA;AAAA,UAII,iBAAA;EAAA,SACN,KAAA,EAAO,oBAAA;EAAA,SACP,KAAA,EAAO,iBAAiB;AAAA;AAAA,iBAGnB,YAAA,CAAA;EAAe,KAAA;EAAO;AAAA,GAAS,iBAAA,oEAAiB,GAAA,CAAA,OAAA,GAAA,QAAA,iBAAA,SAAA,IAAA,OAAA,sDAAA,WAAA,mBAAA,YAAA,mCAAA,qBAAA,SAAA,QAAA,iBAAA,SAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/provider.tsx","../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-current-user.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-money.ts","../src/internal/reactivity-keys.ts","../src/hooks/use-capxul-actor-scope.ts","../src/hooks/use-capxul-destinations.ts","../src/hooks/use-capxul-activity.ts","../src/hooks/use-capxul-offramp.ts","../src/hooks/use-capxul-payroll.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-organization-account.ts","../src/hooks/use-capxul-organization-audit-log.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","../../errors/src/errors.ts","../src/headless/shared/headless-error-view.ts","../src/headless/shared/types.ts","../../types/src/brand.ts","../../types/src/index.ts","../src/headless/money/SendMoney.tsx","../src/headless/relationship/AddressBook.tsx","../src/headless/relationship/RequestInbox.tsx","../src/headless/relationship/InsightsSummary.tsx","../src/headless/relationship/PayrollRoster.tsx","../src/headless/relationship/Destinations.tsx"],"mappings":";;;;;KAqCK,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;EAAA,SAUnB,WAAA,GAAc,kBAAA;EANa;;;;EAAA,SAW3B,MAAA,GAAS,YAAA;AAAA;;;;;KAOf,iCAAA,GAAoC,yBAAA;EA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client";
2
2
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { QueryClient, QueryClientProvider, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
4
- import { captureExceptionSync, createCapxulClient, isSettingUpLifecycle } from "@capxul/sdk";
4
+ import { createCapxulClient, isSettingUpLifecycle } from "@capxul/sdk";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/internal/capxul-bootstrap-context.tsx
7
7
  const CapxulBootstrapContext = createContext(null);
@@ -63,7 +63,7 @@ function clearClientScopedQueries(queryClient, ownsQueryClient) {
63
63
  queryClient.removeQueries({ predicate: (query) => isCapxulQueryKey(query.queryKey) });
64
64
  }
65
65
  function CapxulProvider(props) {
66
- const { publishableKey, client: injectedClient, requirement, signer, queryClient, children } = props;
66
+ const { publishableKey, client: injectedClient, requirement, signer, observation, queryClient, children } = props;
67
67
  const [resolvedQueryClient] = useState(() => queryClient ?? makeDefaultQueryClient());
68
68
  const [ownsQueryClient] = useState(() => queryClient === void 0);
69
69
  const [client, setClient] = useState(injectedClient ?? null);
@@ -85,7 +85,8 @@ function CapxulProvider(props) {
85
85
  const result = await createCapxulClient({
86
86
  publishableKey,
87
87
  ...requirement === void 0 ? {} : { requirement },
88
- ...signer === void 0 ? {} : { signer }
88
+ ...signer === void 0 ? {} : { signer },
89
+ ...observation === void 0 ? {} : { observation }
89
90
  });
90
91
  if (cancelled) {
91
92
  if (result.ok) await result.value._internal.close?.();
@@ -108,6 +109,7 @@ function CapxulProvider(props) {
108
109
  publishableKey,
109
110
  requirement,
110
111
  signer,
112
+ observation,
111
113
  attempt
112
114
  ]);
113
115
  useEffect(() => {
@@ -512,22 +514,16 @@ const capxulKeys = {
512
514
  //#endregion
513
515
  //#region src/internal/unwrap-capxul-result.ts
514
516
  /**
515
- * Unwrap a `CapxulResult` for TanStack query/mutation functions
516
- * throws into error paths, optionally reporting the error to telemetry first.
517
+ * Unwrap a `CapxulResult` for TanStack query/mutation functions and throw into
518
+ * React Query's error path.
517
519
  *
518
- * When `telemetry` is provided and the result is `{ ok: false }`,
519
- * `captureExceptionSync` is called (fire-and-forget) before the throw. `operation`
520
- * tags the telemetry event so query reads and mutation writes stay
521
- * distinguishable in error tracking (defaults to `"query"`).
520
+ * Failure observation belongs to the core SDK method boundary. The legacy
521
+ * telemetry/operation arguments remain temporarily source-compatible with the
522
+ * existing hook call sites, but are deliberately ignored so React cannot
523
+ * report the same logical failure a second time.
522
524
  */
523
- function unwrapCapxulResult(result, telemetry, operation = "query") {
525
+ function unwrapCapxulResult(result, _legacyTelemetry, _legacyOperation = "query") {
524
526
  if (result.ok) return result.value;
525
- if (telemetry) try {
526
- captureExceptionSync(telemetry, result.error, {
527
- layer: "react-query",
528
- operation
529
- });
530
- } catch {}
531
527
  throw result.error;
532
528
  }
533
529
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["CapxulError"],"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/hooks/use-capxul-current-user.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/internal/invalidate-money-state.ts","../src/internal/reject-unresolved-actor.ts","../src/hooks/use-capxul-money.ts","../src/hooks/use-capxul-actor-scope.ts","../src/hooks/use-capxul-destinations.ts","../src/hooks/use-capxul-activity.ts","../src/hooks/use-capxul-offramp.ts","../src/hooks/use-capxul-payroll.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-organization-account.ts","../src/hooks/use-capxul-organization-audit-log.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","../src/headless/shared/headless-error-view.ts","../src/headless/shared/types.ts","../../types/src/index.ts","../src/headless/money/SendMoney.tsx","../src/headless/relationship/AddressBook.tsx","../src/headless/relationship/RequestInbox.tsx","../src/headless/relationship/InsightsSummary.tsx","../src/headless/relationship/PayrollRoster.tsx","../src/headless/relationship/Destinations.tsx"],"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\";\nimport type { CapxulError } from \"@capxul/sdk\";\n\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 { AccountRequirement, CapxulClient, CapxulError, 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 {\n ActivityListParams,\n ActorReference,\n DestinationListInput,\n OfframpQuoteInput,\n TargetReference,\n} from \"@capxul/sdk\";\nimport type { AccountId, OrgId } from \"@capxul/sdk\";\n\nexport type ReactActorScope =\n | { readonly kind: \"account\" }\n | { readonly kind: \"org\"; readonly orgId: string };\n\ntype ActorKeyInput = ReactActorScope | ActorReference;\n\nfunction actorKey(\n actor: ActorKeyInput | undefined,\n): readonly [\"account\"] | readonly [\"org\", string] | readonly [\"pending\"] {\n if (actor === undefined) return [\"pending\"];\n if (actor.kind === \"account\" || actor.kind === \"personal\") return [\"account\"];\n if (actor.kind === \"org\") return [\"org\", actor.orgId];\n return [\"org\", actor.organizationId];\n}\n\nfunction targetKey(\n target: DestinationListInput[\"target\"] | DestinationListInput[\"ref\"] | TargetReference | undefined,\n): string {\n if (target === undefined) return \"all\";\n switch (target.kind) {\n case \"handle\":\n return `handle:${target.handle}`;\n case \"email\":\n return `email:${target.email}`;\n case \"organization\":\n return `organization:${target.handle}`;\n case \"orgHandle\":\n return `organization:${target.orgHandle}`;\n case \"payee\":\n return `payee:${target.id}`;\n case \"payeeId\":\n return `payee:${target.payeeId}`;\n case \"destination\":\n return `destination:${target.id}`;\n case \"capxulUserId\":\n return `capxulUserId:${target.capxulUserId}`;\n }\n}\n\nfunction activityKey(params: ActivityListParams | undefined): string {\n if (params === undefined) return \"default\";\n return JSON.stringify({\n actor: actorKey(params.actor),\n cursor: params.cursor ?? null,\n limit: params.limit ?? null,\n paymentType: params.paymentType ?? null,\n timing: params.timing ?? null,\n });\n}\n\nfunction destinationListKey(input: DestinationListInput | undefined): string {\n if (input === undefined) return \"pending\";\n return JSON.stringify({\n actor: actorKey(input.actor),\n target: targetKey(input.target ?? input.ref),\n kind: input.kind ?? null,\n });\n}\n\nfunction offrampQuoteKey(input: OfframpQuoteInput | undefined): string {\n if (input === undefined) return \"pending\";\n return JSON.stringify({\n actor: actorKey(input.actor),\n destinationId: input.destinationId,\n amount: input.amount,\n });\n}\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 currentUser: [\"capxul\", \"currentUser\"] 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 orgAccount: (orgId: OrgId | undefined) =>\n [\"capxul\", \"org\", orgId ?? \"pending\", \"account\"] as const,\n orgAuditLog: (orgId: OrgId | undefined) =>\n [\"capxul\", \"org\", orgId ?? \"pending\", \"auditLog\"] as const,\n actorAddressBook: (actor: ActorKeyInput | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"addressBook\"] as const,\n actorAddressBookEntry: (actor: ActorKeyInput | undefined, entryId: string | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"addressBook\", entryId ?? \"pending\"] as const,\n actorRequests: (actor: ActorKeyInput | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"requests\"] as const,\n actorRequest: (actor: ActorKeyInput | undefined, requestId: string | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"requests\", requestId ?? \"pending\"] as const,\n actorInbox: (actor: ActorKeyInput | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"inbox\"] as const,\n actorInsightsSummary: (actor: ActorKeyInput | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"insights\", \"summary\"] as const,\n actorInsightsHistory: (actor: ActorKeyInput | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"insights\", \"history\"] as const,\n actorDestinationsScope: (actor: ActorKeyInput | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"destinations\"] as const,\n actorDestinations: (actor: ActorKeyInput | undefined, refKey: string | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"destinations\", refKey ?? \"pending\"] as const,\n destinationsScope: [\"capxul\", \"destinations\"] as const,\n destinations: (input: DestinationListInput | undefined) =>\n [\"capxul\", \"destinations\", destinationListKey(input)] as const,\n activity: (params: ActivityListParams | undefined) =>\n [\"capxul\", \"activity\", activityKey(params)] as const,\n offrampQuote: (input: OfframpQuoteInput | undefined) =>\n [\"capxul\", \"offramp\", \"quote\", offrampQuoteKey(input)] as const,\n offrampStatus: (offrampId: string | undefined) =>\n [\"capxul\", \"offramp\", \"status\", offrampId ?? \"pending\"] as const,\n payments: [\"capxul\", \"payments\"] as const,\n payment: (paymentId: string | undefined) =>\n [\"capxul\", \"payments\", paymentId ?? \"pending\"] as const,\n paymentRequests: [\"capxul\", \"paymentRequests\"] as const,\n payrollRoster: (orgId: OrgId | undefined) =>\n [\"capxul\", \"org\", orgId ?? \"pending\", \"payroll\", \"roster\"] 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, 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, 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","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError, CurrentUserContext } 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 UseCapxulCurrentUserReturn = UseQueryResult<CurrentUserContext, CapxulError>;\n\nexport function useCapxulCurrentUser(options?: {\n readonly enabled?: boolean;\n}): UseCapxulCurrentUserReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.currentUser,\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"currentUser.get\");\n return unwrapCapxulResult(\n await bootstrappedClient.currentUser.get(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && (options?.enabled ?? true),\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 { isSettingUpLifecycle, type AccountLifecycle } from \"@capxul/sdk\";\nimport type { CapxulError } 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 { Account, CapxulError } 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\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\";\nimport type { CapxulError, Money } from \"@capxul/sdk\";\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\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\nimport type { CapxulError } from \"@capxul/sdk\";\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, 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\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\";\nimport type { CapxulError } from \"@capxul/sdk\";\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 } from \"@capxul/errors\";\nimport type { AccountId, CapxulError, SubAccount, SubAccountId, 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","import type { QueryClient } from \"@tanstack/react-query\";\n\nimport type { ActorReference, OrgId, Payment } from \"@capxul/sdk\";\n\nimport { capxulKeys, type ReactActorScope } from \"./reactivity-keys\";\n\ntype MoneyActorScope = ReactActorScope | ActorReference;\n\nexport function isPayment(value: unknown): value is Payment {\n if (typeof value !== \"object\" || value === null) return false;\n const record = value as Record<string, unknown>;\n return (\n typeof record.id === \"string\" &&\n typeof record.status === \"string\" &&\n typeof record.paymentType === \"string\" &&\n typeof record.amount === \"object\" &&\n record.amount !== null\n );\n}\n\nexport function paymentsFromValue(value: unknown): readonly Payment[] {\n if (Array.isArray(value)) return value.filter(isPayment);\n if (isPayment(value)) return [value];\n if (typeof value !== \"object\" || value === null) return [];\n const payments = (value as Record<string, unknown>).payments;\n return Array.isArray(payments) ? payments.filter(isPayment) : [];\n}\n\nexport async function invalidateMoneyState(\n queryClient: QueryClient,\n input: {\n readonly actor: MoneyActorScope;\n readonly payment?: Payment;\n readonly includeAddressBook?: boolean;\n },\n): Promise<void> {\n const invalidations = [\n queryClient.invalidateQueries({ queryKey: capxulKeys.payments }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.actorInsightsSummary(input.actor) }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.actorInsightsHistory(input.actor) }),\n ];\n\n if (input.payment !== undefined) {\n invalidations.push(\n queryClient.invalidateQueries({ queryKey: capxulKeys.payment(input.payment.id) }),\n );\n }\n\n if (input.actor.kind === \"account\" || input.actor.kind === \"personal\") {\n invalidations.push(queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance }));\n } else {\n const orgId = (input.actor.kind === \"org\" ? input.actor.orgId : input.actor.organizationId) as OrgId;\n invalidations.push(\n queryClient.invalidateQueries({ queryKey: capxulKeys.orgAccount(orgId) }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.orgTreasury(orgId) }),\n );\n }\n\n if (input.includeAddressBook === true) {\n invalidations.push(\n queryClient.invalidateQueries({ queryKey: capxulKeys.actorAddressBook(input.actor) }),\n );\n }\n\n await Promise.all(invalidations);\n}\n","import { Errors } from \"@capxul/errors\";\n\n/**\n * Guard for mutation hooks whose variables carry an optional `actor` field\n * (`useCapxulPay`, `useCapxulPayout`, `useCapxulAddDestination`,\n * `useCapxulRemoveDestination`). Mirrors `requireActorScope` on the query path:\n * an EXPLICITLY-passed `actor: undefined` (the `capxulOrgScope(notYetLoadedOrgId)`\n * footgun) must fail loudly rather than silently fall back to the personal\n * scope. Omitting the `actor` key entirely keeps the personal-scope default.\n *\n * Throws `CapxulError` code `INVALID_INPUT` with `details.field === \"actor\"`;\n * called inside an async mutationFn it surfaces as `mutation.error: CapxulError`.\n */\nexport function rejectUnresolvedActor(variables: object, operation: string): void {\n if (\n Object.hasOwn(variables, \"actor\") &&\n (variables as { readonly actor?: unknown }).actor === undefined\n ) {\n throw Errors.invalidInput(\n \"actor\",\n `explicitly provided but undefined for ${operation} — actor scope not yet resolved; omit actor for the personal scope`,\n );\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 } from \"@capxul/errors\";\nimport type {\n Payment,\n PaymentsPayInput,\n PaymentsPayoutInput,\n PaymentsWithdrawInput,\n} from \"@capxul/sdk\";\nimport type { CapxulError } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { invalidateMoneyState } from \"../internal/invalidate-money-state\";\nimport { rejectUnresolvedActor } from \"../internal/reject-unresolved-actor\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulPayReturn = UseMutationResult<Payment, CapxulError, PaymentsPayInput>;\nexport function useCapxulPay(): UseCapxulPayReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) => {\n rejectUnresolvedActor(input, \"payments.pay\");\n const bootstrappedClient = requireBootstrappedClient(client, \"payments.pay\");\n return unwrapCapxulResult(\n await bootstrappedClient.payments.pay(input),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (payment) => {\n await invalidateMoneyState(queryClient, {\n actor: { kind: \"personal\" },\n payment,\n includeAddressBook: true,\n });\n },\n });\n}\n\nexport type UseCapxulPayoutReturn = UseMutationResult<Payment, CapxulError, PaymentsPayoutInput>;\nexport function useCapxulPayout(): UseCapxulPayoutReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) => {\n rejectUnresolvedActor(input, \"payments.payout\");\n const bootstrappedClient = requireBootstrappedClient(client, \"payments.payout\");\n return unwrapCapxulResult(\n await bootstrappedClient.payments.payout(input),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (payment, variables) => {\n const actor = variables.actor ?? { kind: \"personal\" as const };\n await invalidateMoneyState(queryClient, { actor, payment });\n },\n });\n}\n\nexport type UseCapxulWithdrawReturn = UseMutationResult<\n Payment,\n CapxulError,\n PaymentsWithdrawInput\n>;\nexport function useCapxulWithdraw(): UseCapxulWithdrawReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) => {\n const bootstrappedClient = requireBootstrappedClient(client, \"payments.withdraw\");\n return unwrapCapxulResult(\n await bootstrappedClient.payments.withdraw(input),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (payment) => {\n await invalidateMoneyState(queryClient, { actor: { kind: \"personal\" }, payment });\n },\n });\n}\n\nexport type UseCapxulCancelPaymentReturn = UseMutationResult<Payment, CapxulError, string>;\nexport function useCapxulCancelPayment(): UseCapxulCancelPaymentReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (paymentId) => {\n const bootstrappedClient = requireBootstrappedClient(client, \"payments.cancel\");\n return unwrapCapxulResult(\n await bootstrappedClient.payments.cancel(paymentId),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (payment) => {\n await invalidateMoneyState(queryClient, { actor: { kind: \"personal\" }, payment });\n },\n });\n}\n\nexport type UseCapxulPaymentsReturn = UseQueryResult<readonly Payment[], CapxulError>;\nexport function useCapxulPayments(options?: {\n readonly enabled?: boolean;\n}): UseCapxulPaymentsReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.payments,\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"payments.list\");\n return unwrapCapxulResult(\n await bootstrappedClient.payments.list(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulPaymentReturn = UseQueryResult<Payment | null, CapxulError>;\nexport function useCapxulPayment(\n paymentId: string | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulPaymentReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.payment(paymentId),\n queryFn: async () => {\n if (paymentId === undefined)\n throw Errors.invalidInput(\"paymentId\", \"required for payments.get\");\n const bootstrappedClient = requireBootstrappedClient(client, \"payments.get\");\n return unwrapCapxulResult(\n await bootstrappedClient.payments.get(paymentId),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && paymentId !== undefined && (options?.enabled ?? true),\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 } from \"@capxul/errors\";\nimport type {\n ActorRelationshipMethods,\n ActorRequest,\n ActorRequestIssueInput,\n AddressBookAddInput,\n AddressBookEntry,\n AddressBookLabelInput,\n InboxApproveInput,\n InboxItem,\n InsightsSummary,\n Payment,\n ReconciliationEntry,\n} from \"@capxul/sdk\";\nimport type { CapxulError, OrgId } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { invalidateMoneyState, isPayment } from \"../internal/invalidate-money-state\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys, type ReactActorScope } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type CapxulActorScope = ReactActorScope;\n\nexport const capxulAccountScope = { kind: \"account\" } as const;\nexport function capxulOrgScope(orgId: OrgId | undefined): CapxulActorScope | undefined {\n return orgId === undefined ? undefined : { kind: \"org\", orgId };\n}\n\nfunction requireActorScope(\n actor: CapxulActorScope | undefined,\n operation: string,\n): CapxulActorScope {\n if (actor === undefined) throw Errors.invalidInput(\"actor\", `required for ${operation}`);\n return actor;\n}\n\nfunction actorMethods(\n client: ReturnType<typeof requireBootstrappedClient>,\n actor: CapxulActorScope,\n): ActorRelationshipMethods {\n return actor.kind === \"account\" ? client.account : client.org(actor.orgId as OrgId);\n}\n\nfunction entryIdFromData(data: unknown): string | undefined {\n if (typeof data !== \"object\" || data === null) return undefined;\n const id = (data as Record<string, unknown>).id;\n return typeof id === \"string\" ? id : undefined;\n}\n\nfunction requestIdFromMutation(data: unknown, variables: unknown): string | undefined {\n if (typeof variables === \"string\") return variables;\n if (typeof variables === \"object\" && variables !== null) {\n const requestId = (variables as Record<string, unknown>).requestId;\n if (typeof requestId === \"string\") return requestId;\n }\n if (isPayment(data)) return undefined;\n return entryIdFromData(data);\n}\n\nexport type UseCapxulAddressBookReturn = UseQueryResult<readonly AddressBookEntry[], CapxulError>;\nexport function useCapxulAddressBook(\n actor: CapxulActorScope | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulAddressBookReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorAddressBook(actor),\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"addressBook.list\");\n return unwrapCapxulResult(\n await actorMethods(\n bootstrappedClient,\n requireActorScope(actor, \"addressBook.list\"),\n ).addressBook.list(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && actor !== undefined && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulAddressBookEntryReturn = UseQueryResult<AddressBookEntry | null, CapxulError>;\nexport function useCapxulAddressBookEntry(\n actor: CapxulActorScope | undefined,\n entryId: string | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulAddressBookEntryReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorAddressBookEntry(actor, entryId),\n queryFn: async () => {\n if (entryId === undefined)\n throw Errors.invalidInput(\"entryId\", \"required for addressBook.get\");\n const bootstrappedClient = requireBootstrappedClient(client, \"addressBook.get\");\n return unwrapCapxulResult(\n await actorMethods(\n bootstrappedClient,\n requireActorScope(actor, \"addressBook.get\"),\n ).addressBook.get(entryId),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled:\n client !== null && actor !== undefined && entryId !== undefined && (options?.enabled ?? true),\n });\n}\n\ntype AddressBookMutation<TData, TVariables> = UseMutationResult<TData, CapxulError, TVariables>;\n\nfunction useAddressBookMutation<TData, TVariables>(\n actor: CapxulActorScope | undefined,\n operation: string,\n run: (\n methods: ActorRelationshipMethods,\n variables: TVariables,\n ) => Promise<{ ok: true; value: TData } | { ok: false; error: CapxulError }>,\n): AddressBookMutation<TData, TVariables> {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (variables) => {\n const bootstrappedClient = requireBootstrappedClient(client, operation);\n return unwrapCapxulResult(\n await run(actorMethods(bootstrappedClient, requireActorScope(actor, operation)), variables),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (data) => {\n await queryClient.invalidateQueries({ queryKey: capxulKeys.actorAddressBook(actor) });\n const entryId = entryIdFromData(data);\n if (entryId !== undefined) {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.actorAddressBookEntry(actor, entryId),\n });\n }\n },\n });\n}\n\nexport type UseCapxulAddAddressBookEntryReturn = AddressBookMutation<\n AddressBookEntry,\n AddressBookAddInput\n>;\nexport const useCapxulAddAddressBookEntry = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) =>\n useAddressBookMutation(actor, \"addressBook.add\", (methods, input: AddressBookAddInput) =>\n methods.addressBook.add(input),\n );\n\nexport type UseCapxulHideAddressBookEntryReturn = AddressBookMutation<AddressBookEntry, string>;\nexport const useCapxulHideAddressBookEntry = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) =>\n useAddressBookMutation(actor, \"addressBook.hide\", (methods, entryId: string) =>\n methods.addressBook.hide(entryId),\n );\n\nexport type UseCapxulUnhideAddressBookEntryReturn = AddressBookMutation<AddressBookEntry, string>;\nexport const useCapxulUnhideAddressBookEntry = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) =>\n useAddressBookMutation(actor, \"addressBook.unhide\", (methods, entryId: string) =>\n methods.addressBook.unhide(entryId),\n );\n\nexport type UseCapxulLabelAddressBookEntryReturn = AddressBookMutation<\n AddressBookEntry,\n AddressBookLabelInput\n>;\nexport const useCapxulLabelAddressBookEntry = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) =>\n useAddressBookMutation(actor, \"addressBook.label\", (methods, input: AddressBookLabelInput) =>\n methods.addressBook.label(input),\n );\n\nexport type UseCapxulRequestsReturn = UseQueryResult<readonly ActorRequest[], CapxulError>;\nexport function useCapxulRequests(\n actor: CapxulActorScope | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulRequestsReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorRequests(actor),\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"requests.list\");\n return unwrapCapxulResult(\n await actorMethods(\n bootstrappedClient,\n requireActorScope(actor, \"requests.list\"),\n ).requests.list(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && actor !== undefined && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulRequestReturn = UseQueryResult<ActorRequest | null, CapxulError>;\nexport function useCapxulRequest(\n actor: CapxulActorScope | undefined,\n requestId: string | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulRequestReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorRequest(actor, requestId),\n queryFn: async () => {\n if (requestId === undefined)\n throw Errors.invalidInput(\"requestId\", \"required for requests.get\");\n const bootstrappedClient = requireBootstrappedClient(client, \"requests.get\");\n return unwrapCapxulResult(\n await actorMethods(\n bootstrappedClient,\n requireActorScope(actor, \"requests.get\"),\n ).requests.get(requestId),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled:\n client !== null &&\n actor !== undefined &&\n requestId !== undefined &&\n (options?.enabled ?? true),\n });\n}\n\nfunction useRequestMutation<TData, TVariables>(\n actor: CapxulActorScope | undefined,\n operation: string,\n run: (\n methods: ActorRelationshipMethods,\n variables: TVariables,\n ) => Promise<{ ok: true; value: TData } | { ok: false; error: CapxulError }>,\n invalidateInbox = false,\n): UseMutationResult<TData, CapxulError, TVariables> {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (variables) => {\n const bootstrappedClient = requireBootstrappedClient(client, operation);\n return unwrapCapxulResult(\n await run(actorMethods(bootstrappedClient, requireActorScope(actor, operation)), variables),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (data, variables) => {\n await queryClient.invalidateQueries({ queryKey: capxulKeys.actorRequests(actor) });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.actorAddressBook(actor) });\n const requestId = requestIdFromMutation(data, variables);\n if (requestId !== undefined) {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.actorRequest(actor, requestId),\n });\n }\n if (invalidateInbox)\n await queryClient.invalidateQueries({ queryKey: capxulKeys.actorInbox(actor) });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.actorInsightsSummary(actor) });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.actorInsightsHistory(actor) });\n if (isPayment(data)) {\n await invalidateMoneyState(queryClient, {\n actor: requireActorScope(actor, operation),\n payment: data,\n });\n }\n },\n });\n}\n\nexport type UseCapxulIssueRequestReturn = UseMutationResult<\n ActorRequest,\n CapxulError,\n ActorRequestIssueInput\n>;\nexport const useCapxulIssueRequest = (actor: CapxulActorScope | undefined = capxulAccountScope) =>\n useRequestMutation(actor, \"requests.issue\", (methods, input: ActorRequestIssueInput) =>\n methods.requests.issue(input),\n );\n\nexport type UseCapxulCancelRequestReturn = UseMutationResult<ActorRequest, CapxulError, string>;\nexport const useCapxulCancelRequest = (actor: CapxulActorScope | undefined = capxulAccountScope) =>\n useRequestMutation(\n actor,\n \"requests.cancel\",\n (methods, requestId: string) => methods.requests.cancel(requestId),\n true,\n );\n\nexport type UseCapxulReconcileRequestsReturn = UseMutationResult<\n readonly ReconciliationEntry[],\n CapxulError,\n void\n>;\nexport const useCapxulReconcileRequests = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) => useRequestMutation(actor, \"requests.reconcile\", (methods) => methods.requests.reconcile());\n\nexport type UseCapxulInboxReturn = UseQueryResult<readonly InboxItem[], CapxulError>;\nexport function useCapxulInbox(\n actor: CapxulActorScope | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulInboxReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorInbox(actor),\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"inbox.list\");\n return unwrapCapxulResult(\n await actorMethods(bootstrappedClient, requireActorScope(actor, \"inbox.list\")).inbox.list(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && actor !== undefined && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulApproveInboxRequestReturn = UseMutationResult<\n Payment,\n CapxulError,\n InboxApproveInput\n>;\nexport const useCapxulApproveInboxRequest = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) =>\n useRequestMutation(\n actor,\n \"inbox.approve\",\n (methods, input: InboxApproveInput) => methods.inbox.approve(input),\n true,\n );\n\nexport type UseCapxulDeclineInboxRequestReturn = UseMutationResult<InboxItem, CapxulError, string>;\nexport const useCapxulDeclineInboxRequest = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) =>\n useRequestMutation(\n actor,\n \"inbox.decline\",\n (methods, requestId: string) => methods.inbox.decline(requestId),\n true,\n );\n\nexport type UseCapxulInsightsSummaryReturn = UseQueryResult<InsightsSummary, CapxulError>;\nexport function useCapxulInsightsSummary(\n actor: CapxulActorScope | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulInsightsSummaryReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorInsightsSummary(actor),\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"insights.summary\");\n return unwrapCapxulResult(\n await actorMethods(\n bootstrappedClient,\n requireActorScope(actor, \"insights.summary\"),\n ).insights.summary(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && actor !== undefined && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulInsightsHistoryReturn = UseQueryResult<readonly Payment[], CapxulError>;\nexport function useCapxulInsightsHistory(\n actor: CapxulActorScope | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulInsightsHistoryReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorInsightsHistory(actor),\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"insights.history\");\n return unwrapCapxulResult(\n await actorMethods(\n bootstrappedClient,\n requireActorScope(actor, \"insights.history\"),\n ).insights.history(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && actor !== undefined && (options?.enabled ?? true),\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 } from \"@capxul/errors\";\nimport type {\n Destination,\n DestinationAddInput,\n DestinationListInput,\n DestinationRemoveInput,\n} from \"@capxul/sdk\";\nimport type { CapxulError } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { rejectUnresolvedActor } from \"../internal/reject-unresolved-actor\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\n\nexport type UseCapxulDestinationsReturn = UseQueryResult<readonly Destination[], CapxulError>;\nexport function useCapxulDestinations(\n input: DestinationListInput | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulDestinationsReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.destinations(input),\n queryFn: async () => {\n if (input === undefined) throw Errors.invalidInput(\"input\", \"required for destinations.list\");\n const bootstrappedClient = requireBootstrappedClient(client, \"destinations.list\");\n return unwrapCapxulResult(\n await bootstrappedClient.destinations.list(input),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && input !== undefined && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulAddDestinationReturn = UseMutationResult<\n Destination,\n CapxulError,\n DestinationAddInput\n>;\nexport function useCapxulAddDestination(): UseCapxulAddDestinationReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) => {\n rejectUnresolvedActor(input, \"destinations.add\");\n const bootstrappedClient = requireBootstrappedClient(client, \"destinations.add\");\n return unwrapCapxulResult(\n await bootstrappedClient.destinations.add(input),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (_value, variables) => {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.destinationsScope,\n });\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.actorAddressBook(variables.actor ?? { kind: \"personal\" }),\n });\n },\n });\n}\n\nexport type UseCapxulRemoveDestinationReturn = UseMutationResult<\n { readonly id: string },\n CapxulError,\n DestinationRemoveInput\n>;\nexport function useCapxulRemoveDestination(): UseCapxulRemoveDestinationReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) => {\n rejectUnresolvedActor(input, \"destinations.remove\");\n const bootstrappedClient = requireBootstrappedClient(client, \"destinations.remove\");\n return unwrapCapxulResult(\n await bootstrappedClient.destinations.remove(input),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async () => {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.destinationsScope,\n });\n },\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { ActivityListParams, ActivityPage, CapxulError } 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 UseCapxulActivityReturn = UseQueryResult<ActivityPage, CapxulError>;\n\nexport function useCapxulActivity(\n params?: ActivityListParams,\n options?: { readonly enabled?: boolean },\n): UseCapxulActivityReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.activity(params),\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"activity.list\");\n return unwrapCapxulResult(\n await bootstrappedClient.activity.list(params),\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 } from \"@capxul/errors\";\nimport type { CapxulError, OfframpQuote, OfframpQuoteInput, OfframpStatus } 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 UseCapxulOfframpQuoteReturn = UseQueryResult<OfframpQuote, CapxulError>;\n\nexport function useCapxulOfframpQuote(\n input: OfframpQuoteInput | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulOfframpQuoteReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.offrampQuote(input),\n queryFn: async () => {\n if (input === undefined) {\n throw Errors.invalidInput(\"input\", \"required for useCapxulOfframpQuote\");\n }\n const bootstrappedClient = requireBootstrappedClient(client, \"offramp.quote\");\n return unwrapCapxulResult(\n await bootstrappedClient.offramp.quote(input),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && input !== undefined && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulOfframpStatusReturn = UseQueryResult<OfframpStatus, CapxulError>;\n\nexport function useCapxulOfframpStatus(\n offrampId: string | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulOfframpStatusReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.offrampStatus(offrampId),\n queryFn: async () => {\n if (offrampId === undefined) {\n throw Errors.invalidInput(\"offrampId\", \"required for useCapxulOfframpStatus\");\n }\n const bootstrappedClient = requireBootstrappedClient(client, \"offramp.status\");\n return unwrapCapxulResult(\n await bootstrappedClient.offramp.status(offrampId),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && offrampId !== undefined && (options?.enabled ?? true),\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 } from \"@capxul/errors\";\nimport type {\n Payment,\n PayrollRosterAddInput,\n PayrollRosterLine,\n PayrollRunInput,\n} from \"@capxul/sdk\";\nimport type { CapxulError, OrgId } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { invalidateMoneyState, paymentsFromValue } from \"../internal/invalidate-money-state\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulPayrollRosterReturn = UseQueryResult<\n readonly PayrollRosterLine[],\n CapxulError\n>;\nexport function useCapxulPayrollRoster(\n orgId: OrgId | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulPayrollRosterReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.payrollRoster(orgId),\n queryFn: async () => {\n if (orgId === undefined)\n throw Errors.invalidInput(\"orgId\", \"required for payroll.roster.list\");\n const bootstrappedClient = requireBootstrappedClient(client, \"payroll.roster.list\");\n return unwrapCapxulResult(\n await bootstrappedClient.org(orgId).payroll.roster.list(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && orgId !== undefined && (options?.enabled ?? true),\n });\n}\n\nfunction usePayrollMutation<TData, TVariables>(\n orgId: OrgId | undefined,\n operation: string,\n run: (\n org: ReturnType<ReturnType<typeof requireBootstrappedClient>[\"org\"]>,\n variables: TVariables,\n ) => Promise<{ ok: true; value: TData } | { ok: false; error: CapxulError }>,\n): UseMutationResult<TData, CapxulError, TVariables> {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (variables) => {\n if (orgId === undefined) throw Errors.invalidInput(\"orgId\", `required for ${operation}`);\n const bootstrappedClient = requireBootstrappedClient(client, operation);\n return unwrapCapxulResult(\n await run(bootstrappedClient.org(orgId), variables),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (data) => {\n await queryClient.invalidateQueries({ queryKey: capxulKeys.payrollRoster(orgId) });\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.actorInsightsSummary(\n orgId === undefined ? undefined : { kind: \"org\", orgId },\n ),\n });\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.actorInsightsHistory(\n orgId === undefined ? undefined : { kind: \"org\", orgId },\n ),\n });\n if (orgId === undefined) return;\n const actor = { kind: \"org\" as const, orgId };\n const payments = paymentsFromValue(data);\n if (payments.length === 0) return;\n await Promise.all(\n payments.map((payment) =>\n invalidateMoneyState(queryClient, { actor, payment, includeAddressBook: true }),\n ),\n );\n },\n });\n}\n\nexport type UseCapxulAddPayrollRosterLineReturn = UseMutationResult<\n PayrollRosterLine,\n CapxulError,\n PayrollRosterAddInput\n>;\nexport const useCapxulAddPayrollRosterLine = (orgId: OrgId | undefined) =>\n usePayrollMutation(orgId, \"payroll.roster.add\", (org, input: PayrollRosterAddInput) =>\n org.payroll.roster.add(input),\n );\n\nexport type UseCapxulUpdatePayrollRosterLineInput = {\n readonly rosterLineId: string;\n readonly input: Partial<PayrollRosterAddInput>;\n};\nexport type UseCapxulUpdatePayrollRosterLineReturn = UseMutationResult<\n PayrollRosterLine,\n CapxulError,\n UseCapxulUpdatePayrollRosterLineInput\n>;\nexport const useCapxulUpdatePayrollRosterLine = (orgId: OrgId | undefined) =>\n usePayrollMutation(\n orgId,\n \"payroll.roster.update\",\n (org, variables: UseCapxulUpdatePayrollRosterLineInput) =>\n org.payroll.roster.update(variables.rosterLineId, variables.input),\n );\n\nexport type UseCapxulRemovePayrollRosterLineReturn = UseMutationResult<\n PayrollRosterLine,\n CapxulError,\n string\n>;\nexport const useCapxulRemovePayrollRosterLine = (orgId: OrgId | undefined) =>\n usePayrollMutation(orgId, \"payroll.roster.remove\", (org, rosterLineId: string) =>\n org.payroll.roster.remove(rosterLineId),\n );\n\nexport type UseCapxulRunPayrollReturn = UseMutationResult<\n readonly Payment[],\n CapxulError,\n PayrollRunInput\n>;\nexport const useCapxulRunPayroll = (orgId: OrgId | undefined) =>\n usePayrollMutation(orgId, \"payroll.run\", (org, input: PayrollRunInput) => org.payroll.run(input));\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError, 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 } from \"@capxul/errors\";\nimport type { CapxulError, 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 } from \"@capxul/errors\";\nimport type { CapxulError, 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 } from \"@capxul/errors\";\nimport type { CapxulError, 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, 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 } from \"@capxul/errors\";\nimport type { Account, CapxulError, 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 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 { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport { Errors } from \"@capxul/errors\";\nimport type { CapxulError, OrgId, OrganizationAccount } 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 UseCapxulOrganizationAccountOptions = {\n readonly enabled?: boolean;\n};\n\nexport type UseCapxulOrganizationAccountReturn = UseQueryResult<OrganizationAccount, CapxulError>;\n\nexport function useCapxulOrganizationAccount(\n organizationId: OrgId | undefined,\n options?: UseCapxulOrganizationAccountOptions,\n): UseCapxulOrganizationAccountReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.orgAccount(organizationId),\n queryFn: async () => {\n if (organizationId === undefined) {\n throw Errors.invalidInput(\"organizationId\", \"required for useCapxulOrganizationAccount\");\n }\n const bootstrappedClient = requireBootstrappedClient(client, \"org.account.get\");\n return unwrapCapxulResult(\n await bootstrappedClient.org(organizationId).account.get(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && organizationId !== undefined && (options?.enabled ?? true),\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport { Errors } from \"@capxul/errors\";\nimport type { CapxulError, OrgId, OrganizationAuditLogItem } 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 UseCapxulOrganizationAuditLogOptions = {\n readonly enabled?: boolean;\n};\n\nexport type UseCapxulOrganizationAuditLogReturn = UseQueryResult<\n readonly OrganizationAuditLogItem[],\n CapxulError\n>;\n\nexport function useCapxulOrganizationAuditLog(\n organizationId: OrgId | undefined,\n options?: UseCapxulOrganizationAuditLogOptions,\n): UseCapxulOrganizationAuditLogReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.orgAuditLog(organizationId),\n queryFn: async () => {\n if (organizationId === undefined) {\n throw Errors.invalidInput(\"organizationId\", \"required for useCapxulOrganizationAuditLog\");\n }\n const bootstrappedClient = requireBootstrappedClient(client, \"org.auditLog\");\n return unwrapCapxulResult(\n await bootstrappedClient.org(organizationId).auditLog(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && organizationId !== undefined && (options?.enabled ?? true),\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError, 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 {\n CompletePersonalOnboardingInput,\n CompletePersonalOnboardingResult,\n} from \"@capxul/sdk\";\nimport type { CapxulError } 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 {\n CompleteOrganizationOnboardingInput,\n CompleteOrganizationOnboardingResult,\n} from \"@capxul/sdk\";\nimport type { CapxulError } 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 } from \"@capxul/errors\";\nimport type { CapxulError, 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 } from \"@capxul/errors\";\nimport type { CapxulError, 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 } from \"@capxul/errors\";\nimport type { AssignRoleInput, CapxulError, 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 { CapxulError, 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 CapxulError,\n SwitchActingEntityInput | undefined\n>;\n\nexport function useCapxulSwitchActingEntity(): UseCapxulSwitchActingEntityReturn {\n return useMutation({\n mutationFn: async (_input?: SwitchActingEntityInput) => undefined,\n });\n}\n","import {\n CapxulError,\n Errors,\n isCapxulError,\n type CapxulErrorCode,\n type FailureMode,\n} from \"@capxul/errors\";\n\n// The canonical five-member `FailureMode` set, for runtime membership checks.\n// Mirrors `@capxul/sdk`'s internal `getFailureMode` (master #402) but kept local\n// so the headless layer reads the structured cause without a cross-package\n// telemetry-surface dependency — the same inline-from-`details` idiom master's\n// own `diagnostic-from-capxul-error.ts` uses.\nconst FAILURE_MODES: ReadonlySet<string> = new Set<FailureMode>([\n \"auth-origin-mismatch\",\n \"stale-openfort-cache\",\n \"app-env-allowlist\",\n \"no-secure-context\",\n \"unknown\",\n]);\n\nfunction isFailureMode(value: unknown): value is FailureMode {\n return typeof value === \"string\" && FAILURE_MODES.has(value);\n}\n\nfunction getFailureMode(error: CapxulError): FailureMode | undefined {\n const candidate = error.details?.failure_mode;\n return isFailureMode(candidate) ? candidate : undefined;\n}\n\nexport type HeadlessSuggestedAction =\n | \"retry\"\n | \"sign_out_and_in\"\n | \"check_configuration\"\n | \"contact_support\";\n\nexport type HeadlessErrorView = {\n readonly code: CapxulErrorCode;\n readonly failureMode: FailureMode | undefined;\n readonly userMessage: string;\n readonly suggestedAction: HeadlessSuggestedAction;\n readonly recoverable: boolean;\n readonly diagnostics: string;\n readonly correlationId: string | undefined;\n};\n\n// Per-FailureMode UX tables, keyed to master's canonical five-member\n// `FailureMode` enum (`@capxul/errors`). These replace alpha-cleanup's old\n// six-member OpenFort-specific taxonomy after the #402 telemetry unification;\n// the recoverable flags carry #377's correction forward (auth-origin and the\n// env/allowlist failures are NOT user-recoverable — only re-auth or a config\n// change clears them).\nconst FAILURE_USER_MESSAGES: Record<FailureMode, string> = {\n \"auth-origin-mismatch\":\n \"Your sign-in session is not visible to the wallet. Sign out and sign in again.\",\n \"stale-openfort-cache\":\n \"Stale wallet data from a previous session is blocking setup. Sign out, then sign in with your current email.\",\n \"app-env-allowlist\":\n \"This app origin is not authorized for the publishable key. Check configuration.\",\n \"no-secure-context\":\n \"Your browser cannot access secure wallet features. Open the app in a standard browser window.\",\n unknown: \"Something went wrong setting up your wallet. Try again or sign out and sign in.\",\n};\n\nconst FAILURE_SUGGESTED_ACTIONS: Record<FailureMode, HeadlessSuggestedAction> = {\n \"auth-origin-mismatch\": \"sign_out_and_in\",\n \"stale-openfort-cache\": \"sign_out_and_in\",\n \"app-env-allowlist\": \"check_configuration\",\n \"no-secure-context\": \"check_configuration\",\n unknown: \"retry\",\n};\n\nconst FAILURE_RECOVERABLE: Record<FailureMode, boolean> = {\n \"auth-origin-mismatch\": false,\n \"stale-openfort-cache\": true,\n \"app-env-allowlist\": false,\n \"no-secure-context\": false,\n unknown: true,\n};\n\nexport function coerceToCapxulError(cause: unknown): CapxulError {\n if (isCapxulError(cause)) {\n return cause;\n }\n if (cause instanceof Error) {\n return Errors.unknown(cause);\n }\n return Errors.unknown(String(cause));\n}\n\nexport function toHeadlessErrorView(error: CapxulError): HeadlessErrorView {\n const failureMode = getFailureMode(error);\n const suggestedAction = failureMode\n ? FAILURE_SUGGESTED_ACTIONS[failureMode]\n : defaultSuggestedAction(error);\n const userMessage = failureMode ? FAILURE_USER_MESSAGES[failureMode] : defaultUserMessage(error);\n const recoverable = failureMode ? FAILURE_RECOVERABLE[failureMode] : defaultRecoverable(error);\n\n return {\n code: error.code,\n failureMode,\n userMessage,\n suggestedAction,\n recoverable,\n diagnostics: buildDiagnostics(error, failureMode),\n correlationId: error.correlationId,\n };\n}\n\nfunction defaultUserMessage(error: CapxulError): string {\n if (error.code === \"OTP_EXPIRED\") {\n return \"Verification code has expired. Request a new one.\";\n }\n if (error.code === \"NOT_AUTHENTICATED\") {\n return \"You are not signed in. Sign in and try again.\";\n }\n if (error.code === \"RATE_LIMITED\") {\n return \"Too many attempts. Wait a moment and try again.\";\n }\n if (error.code === \"NETWORK_ERROR\") {\n return \"Network error. Check your connection and try again.\";\n }\n return error.message;\n}\n\nfunction defaultSuggestedAction(error: CapxulError): HeadlessSuggestedAction {\n switch (error.code) {\n case \"NOT_AUTHENTICATED\":\n case \"OTP_EXPIRED\":\n case \"WRONG_STATE\":\n return \"sign_out_and_in\";\n case \"ENV_MISSING\":\n return \"check_configuration\";\n case \"RATE_LIMITED\":\n case \"NETWORK_ERROR\":\n case \"PROVIDER_ERROR\":\n case \"TRANSACTION_FAILED\":\n return \"retry\";\n default:\n return \"contact_support\";\n }\n}\n\nfunction defaultRecoverable(error: CapxulError): boolean {\n switch (error.code) {\n case \"ENV_MISSING\":\n case \"NOT_IMPLEMENTED\":\n return false;\n default:\n return true;\n }\n}\n\nfunction buildDiagnostics(error: CapxulError, failureMode: FailureMode | undefined): string {\n const parts: string[] = [`code=${error.code}`];\n if (failureMode !== undefined) {\n parts.push(`failure_mode=${failureMode}`);\n }\n if (error.layer !== undefined) {\n parts.push(`layer=${error.layer}`);\n }\n const provider = error.details?.provider;\n if (typeof provider === \"string\") {\n parts.push(`provider=${provider}`);\n }\n const operation = error.details?.operation;\n if (typeof operation === \"string\") {\n parts.push(`operation=${operation}`);\n }\n return parts.join(\" \");\n}\n","import type { CapxulError } from \"@capxul/errors\";\nimport type { ReactNode } from \"react\";\n\nimport { toHeadlessErrorView, type HeadlessErrorView } from \"./headless-error-view\";\n\nexport type Slot<TProps> = (props: TProps) => ReactNode;\n\nexport type QuerySlotState<T> = {\n readonly data: T | undefined;\n readonly isLoading: boolean;\n readonly isFetching: boolean;\n readonly isError: boolean;\n readonly error: HeadlessErrorView | null;\n};\n\nexport function toQuerySlotState<T>(query: {\n readonly data: T | undefined;\n readonly isLoading: boolean;\n readonly isFetching: boolean;\n readonly isError: boolean;\n readonly error: CapxulError | null;\n}): QuerySlotState<T> {\n return {\n data: query.data,\n isLoading: query.isLoading,\n isFetching: query.isFetching,\n isError: query.isError,\n error: query.error === null ? null : toHeadlessErrorView(query.error),\n };\n}\n","import { Errors } from \"@capxul/errors\";\nimport type { Brand } from \"./brand\";\n\nexport type { Brand } from \"./brand\";\n\nexport type Address = Brand<string, \"Address\">;\nexport type Email = Brand<string, \"Email\">;\nexport type Identity = Brand<string, \"Identity\">;\n// `Profile` is the SDK's user-shaped record returned by `IdentityPort`. Pure\n// record of brand-typed fields — not itself a brand. The field-level brands\n// satisfy `IdentityPort` clause I8 at compile time. Hosted here per the\n// canon (`docs/canon/ports/identity.md`).\nexport type Profile = {\n readonly authUserId: AuthUserId;\n readonly email: Email;\n readonly displayName: string | null;\n readonly country: CountryCode | null;\n readonly kycTier: KycTier;\n readonly createdAt: EpochMs;\n readonly updatedAt: EpochMs;\n};\n// `SmartAccount` is the SDK's ERC-4337 record returned by `SmartAccountPort`.\n// Pure record of brand-typed fields — not itself a brand. `deployedAt` is\n// nullable: `null` means the address is counterfactual (derived, not yet\n// on-chain). PRD #462 (derivation v2): `signerAddress` is the CLAIMED owner —\n// `null` until the claim userOp installs the user's signer (`claimedAt`\n// records that event); the address derives from the email alone. Hosted here\n// per the canon (`docs/canon/ports/smart-account.md`).\nexport type SmartAccount = {\n readonly authUserId: AuthUserId;\n readonly signerAddress: Address | null;\n readonly smartAccountAddress: Address;\n readonly chainId: ChainId;\n readonly deployedAt: EpochMs | null;\n readonly claimedAt: EpochMs | null;\n readonly createdAt: EpochMs;\n};\n// `Money` is the SDK's consumer-facing value type (canon\n// `account-balance-model.md` §10). Every public monetary value is a `Money`\n// — never wei, never raw token units. `value` is a major-unit decimal string\n// (e.g. \"1.5\" USD); `decimals` is the on-chain token precision used for the\n// internal `fromWei`/`toWei` round-trip at the SDK boundary (USDX is 6).\n// Pure record of a brand-typed field + primitives — not itself a brand.\nexport type Money = {\n readonly currency: CurrencyCode;\n readonly value: string;\n readonly decimals: number;\n};\n\n// `Account` is the SDK's logical money account (canon §6, §9). `id` is the\n// `account_`-shaped `AccountId` — NOT the Safe address and NOT an Openfort id.\n// `balance` is the Safe's top-line holdings; `available` is money not assigned\n// to any sub-account (canon §5/§12). With no sub-accounts (Slice 1a),\n// `available === balance`. Pure record of brand-typed fields — not a brand.\nexport type Account = {\n readonly id: AccountId;\n readonly balance: Money;\n readonly available: Money;\n};\n\n/** Named bucket partitioning a logical Account (canon §9). */\nexport type SubAccount = {\n readonly id: SubAccountId;\n readonly accountId: AccountId;\n readonly name: string;\n readonly balance: Money;\n readonly createdAt: EpochMs;\n};\n\nexport type AuthUserId = Brand<string, \"AuthUserId\">;\nexport type AnonymousDistinctId = Brand<string, \"AnonymousDistinctId\">;\nexport type PlayerId = Brand<string, \"PlayerId\">;\nexport type AccountId = Brand<string, \"AccountId\">;\nexport type SubAccountId = Brand<string, \"SubAccountId\">;\nexport type OrgId = Brand<string, \"OrgId\">;\nexport type AppId = Brand<string, \"AppId\">;\nexport type AllowedOrigin = Brand<string, \"AllowedOrigin\">;\nexport type PublishableKey = Brand<string, \"PublishableKey\">;\nexport type PublishableKeyId = Brand<string, \"PublishableKeyId\">;\nexport type DurationMs = Brand<number, \"DurationMs\">;\n// `DeveloperApplication` and `PublishableKeyRecord` are the SDK's record\n// shapes returned by `CredentialsPort`. Pure records of brand-typed fields\n// — not themselves brands. The field-level brands satisfy CR13 + the record\n// branding clauses of `credentials.test-d.ts` at compile time. Hosted here\n// per the canon (`docs/canon/ports/credentials.md`).\nexport type DeveloperApplication = {\n readonly id: AppId;\n readonly authUserId: AuthUserId;\n readonly name: string;\n readonly allowedOrigins: readonly AllowedOrigin[];\n readonly createdAt: EpochMs;\n readonly archivedAt: EpochMs | null;\n};\nexport type PublishableKeyRecord = {\n readonly id: PublishableKeyId;\n readonly applicationId: AppId;\n readonly activeFromMs: EpochMs;\n readonly gracePeriodEndsMs: EpochMs | null;\n readonly revokedAt: EpochMs | null;\n};\nexport type TxHash = Brand<string, \"TxHash\">;\nexport type DocumentHash = Brand<string, \"DocumentHash\">;\nexport type EpochMs = Brand<number, \"EpochMs\">;\nexport type EpochSeconds = Brand<number, \"EpochSeconds\">;\nexport type ChainId = Brand<number, \"ChainId\">;\nexport type CountryCode = Brand<string, \"CountryCode\">;\nexport type CurrencyCode = Brand<SupportedCurrencyCode, \"CurrencyCode\">;\nexport type KycTier = Brand<0 | 1 | 2 | 3, \"KycTier\">;\nexport type BlockNumber = Brand<number, \"BlockNumber\">;\nexport type LogIndex = Brand<number, \"LogIndex\">;\nexport type WeiAmount = Brand<string, \"WeiAmount\">;\nexport type SafeAddress = Brand<string, \"SafeAddress\">;\nexport type ModuleAddress = Brand<string, \"ModuleAddress\">;\nexport type RunId = Brand<string, \"RunId\">;\nexport type RoleKey = Brand<string, \"RoleKey\">;\nexport type AllowanceKey = Brand<string, \"AllowanceKey\">;\nexport type SessionToken = Brand<string, \"SessionToken\">;\nexport type JwtToken = Brand<string, \"JwtToken\">;\n\n// `AuthSession` is the record type shared by `AuthClientPort` and\n// `SessionStoragePort`. Hosted here per the canon\n// (`docs/canon/ports/auth-client.md`) so both ports depend on it\n// symmetrically. Every field is branded — field-level brands satisfy the\n// AuthSession branding contract asserted in `auth-client.test-d.ts`.\nexport type AuthSession = {\n readonly authUserId: AuthUserId;\n readonly email: Email;\n readonly token: SessionToken;\n readonly expiresAt: EpochMs;\n};\n\nexport const EVM_ADDRESS_RE = /^0x[0-9a-f]{40}$/i;\nexport const BYTES32_RE = /^0x[0-9a-f]{64}$/i;\nexport const PUBLISHABLE_KEY_PATTERN = /^cap_pk_(test|live)_[0-9A-HJKMNP-TV-Z]{32}$/;\nexport const SUPPORTED_CURRENCIES = [\n { code: \"USD\", symbol: \"$\", name: \"US Dollar\" },\n { code: \"NGN\", symbol: \"NGN\", name: \"Nigerian Naira\" },\n { code: \"GHS\", symbol: \"GHS\", name: \"Ghanaian Cedi\" },\n { code: \"KES\", symbol: \"KSh\", name: \"Kenyan Shilling\" },\n { code: \"UGX\", symbol: \"USh\", name: \"Ugandan Shilling\" },\n] as const;\nexport const SUPPORTED_CURRENCY_CODES = SUPPORTED_CURRENCIES.map((currency) => currency.code);\ntype SupportedCurrencyCode = (typeof SUPPORTED_CURRENCIES)[number][\"code\"];\nexport const CURRENCY_SYMBOLS = Object.fromEntries(\n SUPPORTED_CURRENCIES.map((currency) => [currency.code, currency.symbol]),\n) as Record<SupportedCurrencyCode, string>;\n\nconst EMAIL_RE = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nconst COUNTRY_CODE_RE = /^[A-Z]{2}$/;\nconst ANONYMOUS_DISTINCT_ID_RE = /^anon_[a-zA-Z0-9-]+$/;\n// Canon §6: the logical Account brand is `account_`-shaped. The tail mirrors\n// the `app_` ULID-shape generator (`account_<26 Crockford base32 chars>`) but\n// the brand only enforces the `account_` prefix + a non-empty alphanumeric\n// tail so existing opaque test ids (`account_123`) and generated ULIDs both\n// satisfy it.\nconst ACCOUNT_ID_RE = /^account_[0-9A-Za-z]+$/;\nconst SUBACCOUNT_ID_RE = /^subaccount_[0-9A-Za-z]+$/;\n// Exported so `@capxul/wire`'s `AppIdSchema` can reuse the same regex via\n// `Schema.filter(...)` and stay in lockstep with `toAppId` (Decision 2,\n// 2b parity).\nexport const APP_ID_RE = /^app_[0-7][0-9A-HJKMNP-TV-Z]{25}$/;\nconst TX_HASH_RE = /^0x[0-9a-f]{64}$/i;\nconst DOCUMENT_HASH_HEX_RE = /^[0-9a-fA-F]{64}$/;\nconst WEI_RE = /^[0-9]+$/;\nconst RUN_ID_RE = /^run_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;\nconst MAX_SAFE_EPOCH_SECONDS = Math.floor(Number.MAX_SAFE_INTEGER / 1000);\n\nexport function toAddress(raw: unknown): Address {\n if (typeof raw !== \"string\" || !EVM_ADDRESS_RE.test(raw)) {\n throw Errors.invalidInput(\"address\", invalidValueReason(\"invalid EVM address format\", raw));\n }\n\n return raw.toLowerCase() as Address;\n}\n\nexport function isEvmAddress(raw: unknown): raw is string {\n return typeof raw === \"string\" && EVM_ADDRESS_RE.test(raw);\n}\n\nexport function toEmail(raw: unknown): Email {\n if (typeof raw !== \"string\" || !EMAIL_RE.test(raw)) {\n throw Errors.invalidInput(\"email\", invalidValueReason(\"must look like an email address\", raw));\n }\n\n return raw.toLowerCase() as Email;\n}\n\nexport function toIdentity(raw: unknown): Identity {\n return toNonEmptyStringBrand(raw, \"identity\") as Identity;\n}\n\nexport function toAuthUserId(raw: unknown): AuthUserId {\n return toNonEmptyStringBrand(raw, \"authUserId\") as AuthUserId;\n}\n\nexport function toAnonymousDistinctId(raw: unknown): AnonymousDistinctId {\n if (typeof raw !== \"string\" || !ANONYMOUS_DISTINCT_ID_RE.test(raw)) {\n throw Errors.invalidInput(\n \"anonDistinctId\",\n invalidValueReason(\"must be anon_ plus letters, digits, or hyphens\", raw),\n );\n }\n\n return raw as AnonymousDistinctId;\n}\n\nexport function toPlayerId(raw: unknown): PlayerId {\n return toNonEmptyStringBrand(raw, \"playerId\") as PlayerId;\n}\n\nexport function toAccountId(raw: unknown): AccountId {\n if (typeof raw !== \"string\" || !ACCOUNT_ID_RE.test(raw)) {\n throw Errors.invalidInput(\n \"accountId\",\n invalidValueReason(\"must be account_ plus an alphanumeric id\", raw),\n );\n }\n\n return raw as AccountId;\n}\n\nexport function toSubAccountId(raw: unknown): SubAccountId {\n if (typeof raw !== \"string\" || !SUBACCOUNT_ID_RE.test(raw)) {\n throw Errors.invalidInput(\n \"subAccountId\",\n invalidValueReason(\"must be subaccount_ plus an alphanumeric id\", raw),\n );\n }\n\n return raw as SubAccountId;\n}\n\nexport function toOrgId(raw: unknown): OrgId {\n return toNonEmptyStringBrand(raw, \"orgId\") as OrgId;\n}\n\nexport function toAppId(raw: unknown): AppId {\n if (typeof raw !== \"string\" || !APP_ID_RE.test(raw)) {\n throw Errors.invalidInput(\"appId\", invalidValueReason(\"must be app_ plus a ULID\", raw));\n }\n\n return raw as AppId;\n}\n\nexport function toAllowedOrigin(raw: unknown): AllowedOrigin {\n if (typeof raw !== \"string\") {\n throw Errors.invalidInput(\"allowedOrigin\", \"must be an http or https origin string\");\n }\n\n const normalized = normalizeAllowedOrigin(raw);\n if (normalized === null) {\n throw Errors.invalidInput(\n \"allowedOrigin\",\n invalidValueReason(\"must be an http or https origin\", raw),\n );\n }\n\n return normalized as AllowedOrigin;\n}\n\nexport function toPublishableKeyId(raw: unknown): PublishableKeyId {\n return toNonEmptyStringBrand(raw, \"keyId\") as PublishableKeyId;\n}\n\nexport function toDurationMs(raw: unknown): DurationMs {\n if (typeof raw !== \"number\" || !Number.isSafeInteger(raw) || raw < 0) {\n throw Errors.invalidInput(\n \"duration\",\n invalidValueReason(\"must be a non-negative safe integer\", raw),\n );\n }\n\n return raw as DurationMs;\n}\n\nexport function toPublishableKey(raw: unknown): PublishableKey {\n if (typeof raw !== \"string\" || !PUBLISHABLE_KEY_PATTERN.test(raw)) {\n throw Errors.invalidInput(\n \"publishableKey\",\n invalidValueReason(\"must match cap_pk_(test|live) plus 32 Crockford base32 chars\", raw),\n );\n }\n\n return raw as PublishableKey;\n}\n\nexport function toTxHash(raw: unknown): TxHash {\n if (typeof raw !== \"string\" || !TX_HASH_RE.test(raw)) {\n throw Errors.invalidInput(\"txHash\", invalidValueReason(\"must be 0x + 64 hex chars\", raw));\n }\n\n return raw.toLowerCase() as TxHash;\n}\n\nexport function toDocumentHash(raw: unknown): DocumentHash {\n if (typeof raw !== \"string\") {\n throw Errors.invalidInput(\"documentHash\", \"must be a string\");\n }\n\n const stripped = raw.startsWith(\"0x\") || raw.startsWith(\"0X\") ? raw.slice(2) : raw;\n if (!DOCUMENT_HASH_HEX_RE.test(stripped)) {\n throw Errors.invalidInput(\"documentHash\", \"must be 32 bytes of hex\");\n }\n\n return `0x${stripped.toLowerCase()}` as DocumentHash;\n}\n\nexport function toEpochMs(raw: unknown): EpochMs {\n assertSafeNonNegativeInteger(raw, \"epochMs\");\n return raw as EpochMs;\n}\n\nexport function toEpochSeconds(raw: unknown): EpochSeconds {\n assertSafeNonNegativeInteger(raw, \"epochSeconds\");\n return raw as EpochSeconds;\n}\n\nexport function secondsToMs(seconds: EpochSeconds): EpochMs {\n if (seconds > MAX_SAFE_EPOCH_SECONDS) {\n throw Errors.invalidInput(\"epochSeconds\", `${seconds} would overflow when multiplied by 1000`);\n }\n\n return toEpochMs(seconds * 1000);\n}\n\nexport function epochMsToSeconds(ms: EpochMs): EpochSeconds {\n return toEpochSeconds(Math.floor(ms / 1000));\n}\n\nexport function toChainId(raw: unknown): ChainId {\n if (typeof raw !== \"number\" || !Number.isSafeInteger(raw) || raw <= 0) {\n throw Errors.invalidInput(\n \"chainId\",\n invalidValueReason(\"must be a positive safe integer\", raw),\n );\n }\n\n return raw as ChainId;\n}\n\nexport function toBlockNumber(raw: unknown): BlockNumber {\n assertSafeNonNegativeInteger(raw, \"blockNumber\");\n return raw as BlockNumber;\n}\n\nexport function toLogIndex(raw: unknown): LogIndex {\n assertSafeNonNegativeInteger(raw, \"logIndex\");\n return raw as LogIndex;\n}\n\nexport function toWeiAmount(raw: unknown): WeiAmount {\n if (typeof raw !== \"string\" || !WEI_RE.test(raw)) {\n throw Errors.invalidInput(\n \"weiAmount\",\n invalidValueReason(\"must be a non-negative integer string\", raw),\n );\n }\n\n return raw as WeiAmount;\n}\n\nexport function toCountryCode(raw: unknown): CountryCode {\n if (typeof raw !== \"string\") {\n throw Errors.invalidInput(\"countryCode\", \"must be a string\");\n }\n\n const upper = raw.toUpperCase();\n if (!COUNTRY_CODE_RE.test(upper)) {\n throw Errors.invalidInput(\n \"countryCode\",\n invalidValueReason(\"must be a 2-letter ISO 3166-1 alpha-2 code\", raw),\n );\n }\n\n return upper as CountryCode;\n}\n\nexport function toCurrencyCode(raw: unknown): CurrencyCode {\n if (typeof raw !== \"string\" || !SUPPORTED_CURRENCY_CODES.includes(raw as SupportedCurrencyCode)) {\n throw Errors.invalidInput(\"currencyCode\", invalidValueReason(\"unsupported currency\", raw));\n }\n\n return raw as CurrencyCode;\n}\n\nexport function currencySymbolFor(code: CurrencyCode): string {\n const symbol = CURRENCY_SYMBOLS[code as SupportedCurrencyCode];\n if (symbol === undefined) {\n throw Errors.invalidInput(\"currencyCode\", `no symbol registered for \"${String(code)}\"`);\n }\n\n return symbol;\n}\n\nexport function toKycTier(raw: unknown): KycTier {\n if (typeof raw !== \"number\" || !Number.isInteger(raw) || raw < 0 || raw > 3) {\n throw Errors.invalidInput(\"kycTier\", invalidValueReason(\"must be an integer in [0, 3]\", raw));\n }\n\n return raw as KycTier;\n}\n\nexport function toSafeAddress(raw: unknown): SafeAddress {\n if (typeof raw !== \"string\" || !EVM_ADDRESS_RE.test(raw)) {\n throw Errors.invalidInput(\"safeAddress\", invalidValueReason(\"invalid EVM address format\", raw));\n }\n\n return raw.toLowerCase() as SafeAddress;\n}\n\nexport function toModuleAddress(raw: unknown): ModuleAddress {\n if (typeof raw !== \"string\" || !EVM_ADDRESS_RE.test(raw)) {\n throw Errors.invalidInput(\n \"moduleAddress\",\n invalidValueReason(\"invalid EVM address format\", raw),\n );\n }\n\n return raw.toLowerCase() as ModuleAddress;\n}\n\nexport function toRunId(raw: unknown): RunId {\n if (typeof raw !== \"string\" || !RUN_ID_RE.test(raw)) {\n throw Errors.invalidInput(\"runId\", \"must match the format run_<uuid>\");\n }\n\n return raw as RunId;\n}\n\nexport function toRoleKey(raw: unknown): RoleKey {\n if (typeof raw !== \"string\" || !BYTES32_RE.test(raw)) {\n throw Errors.invalidInput(\"roleKey\", invalidValueReason(\"must be 0x + 64 hex chars\", raw));\n }\n\n return raw.toLowerCase() as RoleKey;\n}\n\nexport function toAllowanceKey(raw: unknown): AllowanceKey {\n if (typeof raw !== \"string\" || !BYTES32_RE.test(raw)) {\n throw Errors.invalidInput(\"allowanceKey\", invalidValueReason(\"must be 0x + 64 hex chars\", raw));\n }\n\n return raw.toLowerCase() as AllowanceKey;\n}\n\nexport function toSessionToken(raw: unknown): SessionToken {\n if (typeof raw !== \"string\" || raw.length === 0) {\n throw Errors.invalidInput(\"token\", \"must be a non-empty string\");\n }\n\n return raw as SessionToken;\n}\n\nexport function toJwtToken(raw: unknown): JwtToken {\n if (typeof raw !== \"string\" || raw.length === 0) {\n throw Errors.invalidInput(\"jwtToken\", \"must be a non-empty string\");\n }\n\n return raw as JwtToken;\n}\n\nfunction toNonEmptyStringBrand(raw: unknown, field: string): string {\n if (typeof raw !== \"string\" || raw.length === 0) {\n throw Errors.invalidInput(field, \"must be a non-empty string\");\n }\n\n return raw;\n}\n\nfunction assertSafeNonNegativeInteger(raw: unknown, field: string): asserts raw is number {\n if (typeof raw !== \"number\" || !Number.isSafeInteger(raw) || raw < 0) {\n throw Errors.invalidInput(\n field,\n invalidValueReason(\"must be a non-negative safe integer\", raw),\n );\n }\n}\n\nfunction normalizeAllowedOrigin(raw: string): string | null {\n let parsed: URL;\n try {\n parsed = new URL(raw);\n } catch {\n return null;\n }\n\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return null;\n }\n\n if (parsed.hostname.includes(\"*\")) {\n return null;\n }\n\n return parsed.origin;\n}\n\nfunction invalidValueReason(prefix: string, raw: unknown): string {\n if (typeof raw === \"string\") {\n return `${prefix}: ${raw.slice(0, 40)}`;\n }\n\n return `${prefix}: ${String(raw)}`;\n}\n","\"use client\";\n\nimport { useState } from \"react\";\n\nimport type { PaymentsPayInput } from \"@capxul/sdk\";\n\nimport { useCapxulPay } from \"../../hooks/use-capxul-money\";\nimport {\n coerceToCapxulError,\n toHeadlessErrorView,\n type HeadlessErrorView,\n} from \"../shared/headless-error-view\";\nimport type { Slot } from \"../shared/types\";\n\nexport type SendMoneySlots = {\n readonly root?: Slot<{ readonly children: React.ReactNode }>;\n readonly form?: Slot<{\n readonly value: PaymentsPayInput | null;\n readonly setValue: (value: PaymentsPayInput | null) => void;\n readonly submit: () => void;\n readonly pending: boolean;\n readonly disabled: boolean;\n readonly succeeded: boolean;\n readonly error: HeadlessErrorView | null;\n }>;\n readonly error?: Slot<HeadlessErrorView>;\n};\n\nexport interface SendMoneyProps {\n readonly initialValue?: PaymentsPayInput | null;\n readonly slots: SendMoneySlots;\n readonly onSent?: () => void;\n}\n\nexport function SendMoney({ initialValue = null, slots, onSent }: SendMoneyProps) {\n const pay = useCapxulPay();\n const [value, setValue] = useState<PaymentsPayInput | null>(initialValue);\n const [error, setError] = useState<HeadlessErrorView | null>(null);\n\n const submit = async () => {\n setError(null);\n if (value === null) return;\n try {\n await pay.mutateAsync(value);\n onSent?.();\n } catch (cause) {\n setError(toHeadlessErrorView(coerceToCapxulError(cause)));\n }\n };\n\n const slot = slots.form?.({\n value,\n setValue,\n submit: () => void submit(),\n pending: pay.isPending,\n disabled: pay.isPending || value === null,\n succeeded: pay.isSuccess,\n error,\n });\n const children = (\n <>\n {slot}\n {error === null ? null : slots.error?.(error)}\n </>\n );\n return slots.root?.({ children }) ?? children;\n}\n","\"use client\";\n\nimport type { AddressBookAddInput, AddressBookEntry, AddressBookLabelInput } from \"@capxul/sdk\";\n\nimport {\n capxulAccountScope,\n type CapxulActorScope,\n useCapxulAddAddressBookEntry,\n useCapxulAddressBook,\n useCapxulHideAddressBookEntry,\n useCapxulLabelAddressBookEntry,\n useCapxulUnhideAddressBookEntry,\n} from \"../../hooks/use-capxul-actor-scope\";\nimport type { QuerySlotState, Slot } from \"../shared/types\";\nimport { toQuerySlotState } from \"../shared/types\";\n\nexport type AddressBookSlots = {\n readonly root?: Slot<{ readonly children: React.ReactNode }>;\n readonly entries?: Slot<QuerySlotState<readonly AddressBookEntry[]>>;\n readonly actions?: Slot<{\n readonly add: (input: AddressBookAddInput) => Promise<AddressBookEntry>;\n readonly hide: (entryId: string) => Promise<AddressBookEntry>;\n readonly unhide: (entryId: string) => Promise<AddressBookEntry>;\n readonly label: (input: AddressBookLabelInput) => Promise<AddressBookEntry>;\n readonly pending: boolean;\n readonly disabled: boolean;\n }>;\n};\n\nexport interface AddressBookProps {\n readonly actor?: CapxulActorScope | undefined;\n readonly slots: AddressBookSlots;\n}\n\nexport function AddressBook(props: AddressBookProps) {\n const { slots } = props;\n const actor = \"actor\" in props ? props.actor : capxulAccountScope;\n const entries = useCapxulAddressBook(actor);\n const add = useCapxulAddAddressBookEntry(actor);\n const hide = useCapxulHideAddressBookEntry(actor);\n const unhide = useCapxulUnhideAddressBookEntry(actor);\n const label = useCapxulLabelAddressBookEntry(actor);\n const pending = add.isPending || hide.isPending || unhide.isPending || label.isPending;\n const children = (\n <>\n {slots.entries?.(toQuerySlotState(entries))}\n {slots.actions?.({\n add: (input) => add.mutateAsync(input),\n hide: (entryId) => hide.mutateAsync(entryId),\n unhide: (entryId) => unhide.mutateAsync(entryId),\n label: (input) => label.mutateAsync(input),\n pending,\n disabled: pending || actor === undefined,\n })}\n </>\n );\n return slots.root?.({ children }) ?? children;\n}\n","\"use client\";\n\nimport type {\n ActorRequest,\n ActorRequestIssueInput,\n InboxApproveInput,\n InboxItem,\n Payment,\n} from \"@capxul/sdk\";\n\nimport {\n capxulAccountScope,\n type CapxulActorScope,\n useCapxulApproveInboxRequest,\n useCapxulCancelRequest,\n useCapxulDeclineInboxRequest,\n useCapxulInbox,\n useCapxulIssueRequest,\n useCapxulRequests,\n} from \"../../hooks/use-capxul-actor-scope\";\nimport type { QuerySlotState, Slot } from \"../shared/types\";\nimport { toQuerySlotState } from \"../shared/types\";\n\nexport type RequestInboxSlots = {\n readonly root?: Slot<{ readonly children: React.ReactNode }>;\n readonly requests?: Slot<QuerySlotState<readonly ActorRequest[]>>;\n readonly inbox?: Slot<QuerySlotState<readonly InboxItem[]>>;\n readonly actions?: Slot<{\n readonly issue: (input: ActorRequestIssueInput) => Promise<ActorRequest>;\n readonly cancel: (requestId: string) => Promise<ActorRequest>;\n readonly approve: (input: InboxApproveInput) => Promise<Payment>;\n readonly decline: (requestId: string) => Promise<InboxItem>;\n readonly pending: boolean;\n readonly disabled: boolean;\n }>;\n};\n\nexport interface RequestInboxProps {\n readonly actor?: CapxulActorScope | undefined;\n readonly slots: RequestInboxSlots;\n}\n\nexport function RequestInbox(props: RequestInboxProps) {\n const { slots } = props;\n const actor = \"actor\" in props ? props.actor : capxulAccountScope;\n const requests = useCapxulRequests(actor);\n const inbox = useCapxulInbox(actor);\n const issue = useCapxulIssueRequest(actor);\n const cancel = useCapxulCancelRequest(actor);\n const approve = useCapxulApproveInboxRequest(actor);\n const decline = useCapxulDeclineInboxRequest(actor);\n const pending = issue.isPending || cancel.isPending || approve.isPending || decline.isPending;\n const children = (\n <>\n {slots.requests?.(toQuerySlotState(requests))}\n {slots.inbox?.(toQuerySlotState(inbox))}\n {slots.actions?.({\n issue: (input) => issue.mutateAsync(input),\n cancel: (requestId) => cancel.mutateAsync(requestId),\n approve: (input) => approve.mutateAsync(input),\n decline: (requestId) => decline.mutateAsync(requestId),\n pending,\n disabled: pending || actor === undefined,\n })}\n </>\n );\n return slots.root?.({ children }) ?? children;\n}\n","\"use client\";\n\nimport type { InsightsSummary as InsightsSummaryRecord } from \"@capxul/sdk\";\n\nimport {\n capxulAccountScope,\n type CapxulActorScope,\n useCapxulInsightsSummary,\n} from \"../../hooks/use-capxul-actor-scope\";\nimport type { QuerySlotState, Slot } from \"../shared/types\";\nimport { toQuerySlotState } from \"../shared/types\";\n\nexport type InsightsSummarySlots = {\n readonly root?: Slot<{ readonly children: React.ReactNode }>;\n readonly summary?: Slot<QuerySlotState<InsightsSummaryRecord>>;\n};\n\nexport interface InsightsSummaryProps {\n readonly actor?: CapxulActorScope | undefined;\n readonly slots: InsightsSummarySlots;\n}\n\nexport function InsightsSummary(props: InsightsSummaryProps) {\n const { slots } = props;\n const actor = \"actor\" in props ? props.actor : capxulAccountScope;\n const summary = useCapxulInsightsSummary(actor);\n const children = slots.summary?.(toQuerySlotState(summary));\n return slots.root?.({ children }) ?? children;\n}\n","\"use client\";\n\nimport type { Payment, PayrollRosterAddInput, PayrollRosterLine, PayrollRunInput } from \"@capxul/sdk\";\nimport type { OrgId } from \"@capxul/types\";\n\nimport {\n useCapxulAddPayrollRosterLine,\n useCapxulPayrollRoster,\n useCapxulRemovePayrollRosterLine,\n useCapxulRunPayroll,\n useCapxulUpdatePayrollRosterLine,\n type UseCapxulUpdatePayrollRosterLineInput,\n} from \"../../hooks/use-capxul-payroll\";\nimport type { QuerySlotState, Slot } from \"../shared/types\";\nimport { toQuerySlotState } from \"../shared/types\";\n\nexport type PayrollRosterSlots = {\n readonly root?: Slot<{ readonly children: React.ReactNode }>;\n readonly roster?: Slot<QuerySlotState<readonly PayrollRosterLine[]>>;\n readonly actions?: Slot<{\n readonly add: (input: PayrollRosterAddInput) => Promise<PayrollRosterLine>;\n readonly update: (input: UseCapxulUpdatePayrollRosterLineInput) => Promise<PayrollRosterLine>;\n readonly remove: (rosterLineId: string) => Promise<PayrollRosterLine>;\n readonly run: (input: PayrollRunInput) => Promise<readonly Payment[]>;\n readonly pending: boolean;\n readonly disabled: boolean;\n }>;\n};\n\nexport interface PayrollRosterProps {\n readonly orgId: OrgId;\n readonly slots: PayrollRosterSlots;\n}\n\nexport function PayrollRoster({ orgId, slots }: PayrollRosterProps) {\n const roster = useCapxulPayrollRoster(orgId);\n const add = useCapxulAddPayrollRosterLine(orgId);\n const update = useCapxulUpdatePayrollRosterLine(orgId);\n const remove = useCapxulRemovePayrollRosterLine(orgId);\n const run = useCapxulRunPayroll(orgId);\n const pending = add.isPending || update.isPending || remove.isPending || run.isPending;\n const children = (\n <>\n {slots.roster?.(toQuerySlotState(roster))}\n {slots.actions?.({\n add: (input) => add.mutateAsync(input),\n update: (input) => update.mutateAsync(input),\n remove: (rosterLineId) => remove.mutateAsync(rosterLineId),\n run: (input) => run.mutateAsync(input),\n pending,\n disabled: pending,\n })}\n </>\n );\n return slots.root?.({ children }) ?? children;\n}\n","\"use client\";\n\nimport type {\n Destination,\n DestinationAddInput,\n DestinationListInput,\n DestinationRemoveInput,\n} from \"@capxul/sdk\";\n\nimport {\n useCapxulAddDestination,\n useCapxulDestinations,\n useCapxulRemoveDestination,\n} from \"../../hooks/use-capxul-destinations\";\nimport type { QuerySlotState, Slot } from \"../shared/types\";\nimport { toQuerySlotState } from \"../shared/types\";\n\nexport type DestinationsSlots = {\n readonly root?: Slot<{ readonly children: React.ReactNode }>;\n readonly destinations?: Slot<QuerySlotState<readonly Destination[]>>;\n readonly actions?: Slot<{\n readonly add: (input: DestinationAddInput) => Promise<Destination>;\n readonly remove: (input: DestinationRemoveInput) => Promise<{ readonly id: string }>;\n readonly pending: boolean;\n readonly disabled: boolean;\n }>;\n};\n\nexport interface DestinationsProps {\n readonly input: DestinationListInput;\n readonly slots: DestinationsSlots;\n}\n\nexport function Destinations({ input, slots }: DestinationsProps) {\n const destinations = useCapxulDestinations(input);\n const add = useCapxulAddDestination();\n const remove = useCapxulRemoveDestination();\n const pending = add.isPending || remove.isPending;\n const children = (\n <>\n {slots.destinations?.(toQuerySlotState(destinations))}\n {slots.actions?.({\n add: (value) => add.mutateAsync(value),\n remove: (value) => remove.mutateAsync(value),\n pending,\n disabled: pending,\n })}\n </>\n );\n return slots.root?.({ children }) ?? children;\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,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AC,CACD,EAAA,CAAA;CAEJ,OAAO,MAAM,OAAO,EAAE,SAAS,CAAC,KAAK;AACvC;;;ACtBA,SAAgB,aAAa,EAAE,OAAO,SAA4B;CAChE,MAAM,eAAe,sBAAsB,KAAK;CAChD,MAAM,MAAM,wBAAwB;CACpC,MAAM,SAAS,2BAA2B;CAC1C,MAAM,UAAU,IAAI,aAAa,OAAO;CACxC,MAAM,WACJ,qBAAA,UAAA,EAAA,UAAA,CACG,MAAM,eAAe,iBAAiB,YAAY,CAAC,GACnD,MAAM,UAAU;EACf,MAAM,UAAU,IAAI,YAAY,KAAK;EACrC,SAAS,UAAU,OAAO,YAAY,KAAK;EAC3C;EACA,UAAU;CACZ,CAAC,CACD,EAAA,CAAA;CAEJ,OAAO,MAAM,OAAO,EAAE,SAAS,CAAC,KAAK;AACvC"}
1
+ {"version":3,"file":"index.mjs","names":["CapxulError"],"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/hooks/use-capxul-current-user.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/internal/invalidate-money-state.ts","../src/internal/reject-unresolved-actor.ts","../src/hooks/use-capxul-money.ts","../src/hooks/use-capxul-actor-scope.ts","../src/hooks/use-capxul-destinations.ts","../src/hooks/use-capxul-activity.ts","../src/hooks/use-capxul-offramp.ts","../src/hooks/use-capxul-payroll.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-organization-account.ts","../src/hooks/use-capxul-organization-audit-log.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","../src/headless/shared/headless-error-view.ts","../src/headless/shared/types.ts","../../types/src/index.ts","../src/headless/money/SendMoney.tsx","../src/headless/relationship/AddressBook.tsx","../src/headless/relationship/RequestInbox.tsx","../src/headless/relationship/InsightsSummary.tsx","../src/headless/relationship/PayrollRoster.tsx","../src/headless/relationship/Destinations.tsx"],"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\";\nimport type { CapxulError } from \"@capxul/sdk\";\n\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 {\n AccountRequirement,\n CapxulClient,\n CapxulError,\n CapxulSigner,\n ObservationAdapter,\n} 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 /** Host-owned observation adapter passed to the core SDK boundary. */\n readonly observation?: ObservationAdapter;\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 /** Injected clients must be created with observation at their owning factory. */\n readonly observation?: 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 observation,\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 ...(observation === undefined ? {} : { observation }),\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, observation, 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 {\n ActivityListParams,\n ActorReference,\n DestinationListInput,\n OfframpQuoteInput,\n TargetReference,\n} from \"@capxul/sdk\";\nimport type { AccountId, OrgId } from \"@capxul/sdk\";\n\nexport type ReactActorScope =\n | { readonly kind: \"account\" }\n | { readonly kind: \"org\"; readonly orgId: string };\n\ntype ActorKeyInput = ReactActorScope | ActorReference;\n\nfunction actorKey(\n actor: ActorKeyInput | undefined,\n): readonly [\"account\"] | readonly [\"org\", string] | readonly [\"pending\"] {\n if (actor === undefined) return [\"pending\"];\n if (actor.kind === \"account\" || actor.kind === \"personal\") return [\"account\"];\n if (actor.kind === \"org\") return [\"org\", actor.orgId];\n return [\"org\", actor.organizationId];\n}\n\nfunction targetKey(\n target: DestinationListInput[\"target\"] | DestinationListInput[\"ref\"] | TargetReference | undefined,\n): string {\n if (target === undefined) return \"all\";\n switch (target.kind) {\n case \"handle\":\n return `handle:${target.handle}`;\n case \"email\":\n return `email:${target.email}`;\n case \"organization\":\n return `organization:${target.handle}`;\n case \"orgHandle\":\n return `organization:${target.orgHandle}`;\n case \"payee\":\n return `payee:${target.id}`;\n case \"payeeId\":\n return `payee:${target.payeeId}`;\n case \"destination\":\n return `destination:${target.id}`;\n case \"capxulUserId\":\n return `capxulUserId:${target.capxulUserId}`;\n }\n}\n\nfunction activityKey(params: ActivityListParams | undefined): string {\n if (params === undefined) return \"default\";\n return JSON.stringify({\n actor: actorKey(params.actor),\n cursor: params.cursor ?? null,\n limit: params.limit ?? null,\n paymentType: params.paymentType ?? null,\n timing: params.timing ?? null,\n });\n}\n\nfunction destinationListKey(input: DestinationListInput | undefined): string {\n if (input === undefined) return \"pending\";\n return JSON.stringify({\n actor: actorKey(input.actor),\n target: targetKey(input.target ?? input.ref),\n kind: input.kind ?? null,\n });\n}\n\nfunction offrampQuoteKey(input: OfframpQuoteInput | undefined): string {\n if (input === undefined) return \"pending\";\n return JSON.stringify({\n actor: actorKey(input.actor),\n destinationId: input.destinationId,\n amount: input.amount,\n });\n}\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 currentUser: [\"capxul\", \"currentUser\"] 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 orgAccount: (orgId: OrgId | undefined) =>\n [\"capxul\", \"org\", orgId ?? \"pending\", \"account\"] as const,\n orgAuditLog: (orgId: OrgId | undefined) =>\n [\"capxul\", \"org\", orgId ?? \"pending\", \"auditLog\"] as const,\n actorAddressBook: (actor: ActorKeyInput | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"addressBook\"] as const,\n actorAddressBookEntry: (actor: ActorKeyInput | undefined, entryId: string | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"addressBook\", entryId ?? \"pending\"] as const,\n actorRequests: (actor: ActorKeyInput | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"requests\"] as const,\n actorRequest: (actor: ActorKeyInput | undefined, requestId: string | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"requests\", requestId ?? \"pending\"] as const,\n actorInbox: (actor: ActorKeyInput | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"inbox\"] as const,\n actorInsightsSummary: (actor: ActorKeyInput | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"insights\", \"summary\"] as const,\n actorInsightsHistory: (actor: ActorKeyInput | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"insights\", \"history\"] as const,\n actorDestinationsScope: (actor: ActorKeyInput | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"destinations\"] as const,\n actorDestinations: (actor: ActorKeyInput | undefined, refKey: string | undefined) =>\n [\"capxul\", \"actor\", ...actorKey(actor), \"destinations\", refKey ?? \"pending\"] as const,\n destinationsScope: [\"capxul\", \"destinations\"] as const,\n destinations: (input: DestinationListInput | undefined) =>\n [\"capxul\", \"destinations\", destinationListKey(input)] as const,\n activity: (params: ActivityListParams | undefined) =>\n [\"capxul\", \"activity\", activityKey(params)] as const,\n offrampQuote: (input: OfframpQuoteInput | undefined) =>\n [\"capxul\", \"offramp\", \"quote\", offrampQuoteKey(input)] as const,\n offrampStatus: (offrampId: string | undefined) =>\n [\"capxul\", \"offramp\", \"status\", offrampId ?? \"pending\"] as const,\n payments: [\"capxul\", \"payments\"] as const,\n payment: (paymentId: string | undefined) =>\n [\"capxul\", \"payments\", paymentId ?? \"pending\"] as const,\n paymentRequests: [\"capxul\", \"paymentRequests\"] as const,\n payrollRoster: (orgId: OrgId | undefined) =>\n [\"capxul\", \"org\", orgId ?? \"pending\", \"payroll\", \"roster\"] as const,\n} satisfies Record<string, readonly unknown[] | ((...args: never[]) => readonly unknown[])>;\n","import type { TelemetryPort } from \"@capxul/sdk\";\nimport type { CapxulResult } from \"@capxul/sdk\";\n\n/**\n * Unwrap a `CapxulResult` for TanStack query/mutation functions and throw into\n * React Query's error path.\n *\n * Failure observation belongs to the core SDK method boundary. The legacy\n * telemetry/operation arguments remain temporarily source-compatible with the\n * existing hook call sites, but are deliberately ignored so React cannot\n * report the same logical failure a second time.\n */\nexport function unwrapCapxulResult<T>(\n result: CapxulResult<T>,\n _legacyTelemetry?: TelemetryPort,\n _legacyOperation: \"query\" | \"mutation\" = \"query\",\n): T {\n if (result.ok) {\n return result.value;\n }\n throw result.error;\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError, 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, 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","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError, CurrentUserContext } 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 UseCapxulCurrentUserReturn = UseQueryResult<CurrentUserContext, CapxulError>;\n\nexport function useCapxulCurrentUser(options?: {\n readonly enabled?: boolean;\n}): UseCapxulCurrentUserReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.currentUser,\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"currentUser.get\");\n return unwrapCapxulResult(\n await bootstrappedClient.currentUser.get(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && (options?.enabled ?? true),\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 { isSettingUpLifecycle, type AccountLifecycle } from \"@capxul/sdk\";\nimport type { CapxulError } 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 { Account, CapxulError } 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\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\";\nimport type { CapxulError, Money } from \"@capxul/sdk\";\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\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\nimport type { CapxulError } from \"@capxul/sdk\";\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, 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\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\";\nimport type { CapxulError } from \"@capxul/sdk\";\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 } from \"@capxul/errors\";\nimport type { AccountId, CapxulError, SubAccount, SubAccountId, 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","import type { QueryClient } from \"@tanstack/react-query\";\n\nimport type { ActorReference, OrgId, Payment } from \"@capxul/sdk\";\n\nimport { capxulKeys, type ReactActorScope } from \"./reactivity-keys\";\n\ntype MoneyActorScope = ReactActorScope | ActorReference;\n\nexport function isPayment(value: unknown): value is Payment {\n if (typeof value !== \"object\" || value === null) return false;\n const record = value as Record<string, unknown>;\n return (\n typeof record.id === \"string\" &&\n typeof record.status === \"string\" &&\n typeof record.paymentType === \"string\" &&\n typeof record.amount === \"object\" &&\n record.amount !== null\n );\n}\n\nexport function paymentsFromValue(value: unknown): readonly Payment[] {\n if (Array.isArray(value)) return value.filter(isPayment);\n if (isPayment(value)) return [value];\n if (typeof value !== \"object\" || value === null) return [];\n const payments = (value as Record<string, unknown>).payments;\n return Array.isArray(payments) ? payments.filter(isPayment) : [];\n}\n\nexport async function invalidateMoneyState(\n queryClient: QueryClient,\n input: {\n readonly actor: MoneyActorScope;\n readonly payment?: Payment;\n readonly includeAddressBook?: boolean;\n },\n): Promise<void> {\n const invalidations = [\n queryClient.invalidateQueries({ queryKey: capxulKeys.payments }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.actorInsightsSummary(input.actor) }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.actorInsightsHistory(input.actor) }),\n ];\n\n if (input.payment !== undefined) {\n invalidations.push(\n queryClient.invalidateQueries({ queryKey: capxulKeys.payment(input.payment.id) }),\n );\n }\n\n if (input.actor.kind === \"account\" || input.actor.kind === \"personal\") {\n invalidations.push(queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance }));\n } else {\n const orgId = (input.actor.kind === \"org\" ? input.actor.orgId : input.actor.organizationId) as OrgId;\n invalidations.push(\n queryClient.invalidateQueries({ queryKey: capxulKeys.orgAccount(orgId) }),\n queryClient.invalidateQueries({ queryKey: capxulKeys.orgTreasury(orgId) }),\n );\n }\n\n if (input.includeAddressBook === true) {\n invalidations.push(\n queryClient.invalidateQueries({ queryKey: capxulKeys.actorAddressBook(input.actor) }),\n );\n }\n\n await Promise.all(invalidations);\n}\n","import { Errors } from \"@capxul/errors\";\n\n/**\n * Guard for mutation hooks whose variables carry an optional `actor` field\n * (`useCapxulPay`, `useCapxulPayout`, `useCapxulAddDestination`,\n * `useCapxulRemoveDestination`). Mirrors `requireActorScope` on the query path:\n * an EXPLICITLY-passed `actor: undefined` (the `capxulOrgScope(notYetLoadedOrgId)`\n * footgun) must fail loudly rather than silently fall back to the personal\n * scope. Omitting the `actor` key entirely keeps the personal-scope default.\n *\n * Throws `CapxulError` code `INVALID_INPUT` with `details.field === \"actor\"`;\n * called inside an async mutationFn it surfaces as `mutation.error: CapxulError`.\n */\nexport function rejectUnresolvedActor(variables: object, operation: string): void {\n if (\n Object.hasOwn(variables, \"actor\") &&\n (variables as { readonly actor?: unknown }).actor === undefined\n ) {\n throw Errors.invalidInput(\n \"actor\",\n `explicitly provided but undefined for ${operation} — actor scope not yet resolved; omit actor for the personal scope`,\n );\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 } from \"@capxul/errors\";\nimport type {\n Payment,\n PaymentsPayInput,\n PaymentsPayoutInput,\n PaymentsWithdrawInput,\n} from \"@capxul/sdk\";\nimport type { CapxulError } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { invalidateMoneyState } from \"../internal/invalidate-money-state\";\nimport { rejectUnresolvedActor } from \"../internal/reject-unresolved-actor\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulPayReturn = UseMutationResult<Payment, CapxulError, PaymentsPayInput>;\nexport function useCapxulPay(): UseCapxulPayReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) => {\n rejectUnresolvedActor(input, \"payments.pay\");\n const bootstrappedClient = requireBootstrappedClient(client, \"payments.pay\");\n return unwrapCapxulResult(\n await bootstrappedClient.payments.pay(input),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (payment) => {\n await invalidateMoneyState(queryClient, {\n actor: { kind: \"personal\" },\n payment,\n includeAddressBook: true,\n });\n },\n });\n}\n\nexport type UseCapxulPayoutReturn = UseMutationResult<Payment, CapxulError, PaymentsPayoutInput>;\nexport function useCapxulPayout(): UseCapxulPayoutReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) => {\n rejectUnresolvedActor(input, \"payments.payout\");\n const bootstrappedClient = requireBootstrappedClient(client, \"payments.payout\");\n return unwrapCapxulResult(\n await bootstrappedClient.payments.payout(input),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (payment, variables) => {\n const actor = variables.actor ?? { kind: \"personal\" as const };\n await invalidateMoneyState(queryClient, { actor, payment });\n },\n });\n}\n\nexport type UseCapxulWithdrawReturn = UseMutationResult<\n Payment,\n CapxulError,\n PaymentsWithdrawInput\n>;\nexport function useCapxulWithdraw(): UseCapxulWithdrawReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) => {\n const bootstrappedClient = requireBootstrappedClient(client, \"payments.withdraw\");\n return unwrapCapxulResult(\n await bootstrappedClient.payments.withdraw(input),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (payment) => {\n await invalidateMoneyState(queryClient, { actor: { kind: \"personal\" }, payment });\n },\n });\n}\n\nexport type UseCapxulCancelPaymentReturn = UseMutationResult<Payment, CapxulError, string>;\nexport function useCapxulCancelPayment(): UseCapxulCancelPaymentReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (paymentId) => {\n const bootstrappedClient = requireBootstrappedClient(client, \"payments.cancel\");\n return unwrapCapxulResult(\n await bootstrappedClient.payments.cancel(paymentId),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (payment) => {\n await invalidateMoneyState(queryClient, { actor: { kind: \"personal\" }, payment });\n },\n });\n}\n\nexport type UseCapxulPaymentsReturn = UseQueryResult<readonly Payment[], CapxulError>;\nexport function useCapxulPayments(options?: {\n readonly enabled?: boolean;\n}): UseCapxulPaymentsReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.payments,\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"payments.list\");\n return unwrapCapxulResult(\n await bootstrappedClient.payments.list(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulPaymentReturn = UseQueryResult<Payment | null, CapxulError>;\nexport function useCapxulPayment(\n paymentId: string | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulPaymentReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.payment(paymentId),\n queryFn: async () => {\n if (paymentId === undefined)\n throw Errors.invalidInput(\"paymentId\", \"required for payments.get\");\n const bootstrappedClient = requireBootstrappedClient(client, \"payments.get\");\n return unwrapCapxulResult(\n await bootstrappedClient.payments.get(paymentId),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && paymentId !== undefined && (options?.enabled ?? true),\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 } from \"@capxul/errors\";\nimport type {\n ActorRelationshipMethods,\n ActorRequest,\n ActorRequestIssueInput,\n AddressBookAddInput,\n AddressBookEntry,\n AddressBookLabelInput,\n InboxApproveInput,\n InboxItem,\n InsightsSummary,\n Payment,\n ReconciliationEntry,\n} from \"@capxul/sdk\";\nimport type { CapxulError, OrgId } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { invalidateMoneyState, isPayment } from \"../internal/invalidate-money-state\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys, type ReactActorScope } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type CapxulActorScope = ReactActorScope;\n\nexport const capxulAccountScope = { kind: \"account\" } as const;\nexport function capxulOrgScope(orgId: OrgId | undefined): CapxulActorScope | undefined {\n return orgId === undefined ? undefined : { kind: \"org\", orgId };\n}\n\nfunction requireActorScope(\n actor: CapxulActorScope | undefined,\n operation: string,\n): CapxulActorScope {\n if (actor === undefined) throw Errors.invalidInput(\"actor\", `required for ${operation}`);\n return actor;\n}\n\nfunction actorMethods(\n client: ReturnType<typeof requireBootstrappedClient>,\n actor: CapxulActorScope,\n): ActorRelationshipMethods {\n return actor.kind === \"account\" ? client.account : client.org(actor.orgId as OrgId);\n}\n\nfunction entryIdFromData(data: unknown): string | undefined {\n if (typeof data !== \"object\" || data === null) return undefined;\n const id = (data as Record<string, unknown>).id;\n return typeof id === \"string\" ? id : undefined;\n}\n\nfunction requestIdFromMutation(data: unknown, variables: unknown): string | undefined {\n if (typeof variables === \"string\") return variables;\n if (typeof variables === \"object\" && variables !== null) {\n const requestId = (variables as Record<string, unknown>).requestId;\n if (typeof requestId === \"string\") return requestId;\n }\n if (isPayment(data)) return undefined;\n return entryIdFromData(data);\n}\n\nexport type UseCapxulAddressBookReturn = UseQueryResult<readonly AddressBookEntry[], CapxulError>;\nexport function useCapxulAddressBook(\n actor: CapxulActorScope | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulAddressBookReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorAddressBook(actor),\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"addressBook.list\");\n return unwrapCapxulResult(\n await actorMethods(\n bootstrappedClient,\n requireActorScope(actor, \"addressBook.list\"),\n ).addressBook.list(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && actor !== undefined && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulAddressBookEntryReturn = UseQueryResult<AddressBookEntry | null, CapxulError>;\nexport function useCapxulAddressBookEntry(\n actor: CapxulActorScope | undefined,\n entryId: string | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulAddressBookEntryReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorAddressBookEntry(actor, entryId),\n queryFn: async () => {\n if (entryId === undefined)\n throw Errors.invalidInput(\"entryId\", \"required for addressBook.get\");\n const bootstrappedClient = requireBootstrappedClient(client, \"addressBook.get\");\n return unwrapCapxulResult(\n await actorMethods(\n bootstrappedClient,\n requireActorScope(actor, \"addressBook.get\"),\n ).addressBook.get(entryId),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled:\n client !== null && actor !== undefined && entryId !== undefined && (options?.enabled ?? true),\n });\n}\n\ntype AddressBookMutation<TData, TVariables> = UseMutationResult<TData, CapxulError, TVariables>;\n\nfunction useAddressBookMutation<TData, TVariables>(\n actor: CapxulActorScope | undefined,\n operation: string,\n run: (\n methods: ActorRelationshipMethods,\n variables: TVariables,\n ) => Promise<{ ok: true; value: TData } | { ok: false; error: CapxulError }>,\n): AddressBookMutation<TData, TVariables> {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (variables) => {\n const bootstrappedClient = requireBootstrappedClient(client, operation);\n return unwrapCapxulResult(\n await run(actorMethods(bootstrappedClient, requireActorScope(actor, operation)), variables),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (data) => {\n await queryClient.invalidateQueries({ queryKey: capxulKeys.actorAddressBook(actor) });\n const entryId = entryIdFromData(data);\n if (entryId !== undefined) {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.actorAddressBookEntry(actor, entryId),\n });\n }\n },\n });\n}\n\nexport type UseCapxulAddAddressBookEntryReturn = AddressBookMutation<\n AddressBookEntry,\n AddressBookAddInput\n>;\nexport const useCapxulAddAddressBookEntry = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) =>\n useAddressBookMutation(actor, \"addressBook.add\", (methods, input: AddressBookAddInput) =>\n methods.addressBook.add(input),\n );\n\nexport type UseCapxulHideAddressBookEntryReturn = AddressBookMutation<AddressBookEntry, string>;\nexport const useCapxulHideAddressBookEntry = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) =>\n useAddressBookMutation(actor, \"addressBook.hide\", (methods, entryId: string) =>\n methods.addressBook.hide(entryId),\n );\n\nexport type UseCapxulUnhideAddressBookEntryReturn = AddressBookMutation<AddressBookEntry, string>;\nexport const useCapxulUnhideAddressBookEntry = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) =>\n useAddressBookMutation(actor, \"addressBook.unhide\", (methods, entryId: string) =>\n methods.addressBook.unhide(entryId),\n );\n\nexport type UseCapxulLabelAddressBookEntryReturn = AddressBookMutation<\n AddressBookEntry,\n AddressBookLabelInput\n>;\nexport const useCapxulLabelAddressBookEntry = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) =>\n useAddressBookMutation(actor, \"addressBook.label\", (methods, input: AddressBookLabelInput) =>\n methods.addressBook.label(input),\n );\n\nexport type UseCapxulRequestsReturn = UseQueryResult<readonly ActorRequest[], CapxulError>;\nexport function useCapxulRequests(\n actor: CapxulActorScope | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulRequestsReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorRequests(actor),\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"requests.list\");\n return unwrapCapxulResult(\n await actorMethods(\n bootstrappedClient,\n requireActorScope(actor, \"requests.list\"),\n ).requests.list(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && actor !== undefined && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulRequestReturn = UseQueryResult<ActorRequest | null, CapxulError>;\nexport function useCapxulRequest(\n actor: CapxulActorScope | undefined,\n requestId: string | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulRequestReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorRequest(actor, requestId),\n queryFn: async () => {\n if (requestId === undefined)\n throw Errors.invalidInput(\"requestId\", \"required for requests.get\");\n const bootstrappedClient = requireBootstrappedClient(client, \"requests.get\");\n return unwrapCapxulResult(\n await actorMethods(\n bootstrappedClient,\n requireActorScope(actor, \"requests.get\"),\n ).requests.get(requestId),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled:\n client !== null &&\n actor !== undefined &&\n requestId !== undefined &&\n (options?.enabled ?? true),\n });\n}\n\nfunction useRequestMutation<TData, TVariables>(\n actor: CapxulActorScope | undefined,\n operation: string,\n run: (\n methods: ActorRelationshipMethods,\n variables: TVariables,\n ) => Promise<{ ok: true; value: TData } | { ok: false; error: CapxulError }>,\n invalidateInbox = false,\n): UseMutationResult<TData, CapxulError, TVariables> {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (variables) => {\n const bootstrappedClient = requireBootstrappedClient(client, operation);\n return unwrapCapxulResult(\n await run(actorMethods(bootstrappedClient, requireActorScope(actor, operation)), variables),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (data, variables) => {\n await queryClient.invalidateQueries({ queryKey: capxulKeys.actorRequests(actor) });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.actorAddressBook(actor) });\n const requestId = requestIdFromMutation(data, variables);\n if (requestId !== undefined) {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.actorRequest(actor, requestId),\n });\n }\n if (invalidateInbox)\n await queryClient.invalidateQueries({ queryKey: capxulKeys.actorInbox(actor) });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.actorInsightsSummary(actor) });\n await queryClient.invalidateQueries({ queryKey: capxulKeys.actorInsightsHistory(actor) });\n if (isPayment(data)) {\n await invalidateMoneyState(queryClient, {\n actor: requireActorScope(actor, operation),\n payment: data,\n });\n }\n },\n });\n}\n\nexport type UseCapxulIssueRequestReturn = UseMutationResult<\n ActorRequest,\n CapxulError,\n ActorRequestIssueInput\n>;\nexport const useCapxulIssueRequest = (actor: CapxulActorScope | undefined = capxulAccountScope) =>\n useRequestMutation(actor, \"requests.issue\", (methods, input: ActorRequestIssueInput) =>\n methods.requests.issue(input),\n );\n\nexport type UseCapxulCancelRequestReturn = UseMutationResult<ActorRequest, CapxulError, string>;\nexport const useCapxulCancelRequest = (actor: CapxulActorScope | undefined = capxulAccountScope) =>\n useRequestMutation(\n actor,\n \"requests.cancel\",\n (methods, requestId: string) => methods.requests.cancel(requestId),\n true,\n );\n\nexport type UseCapxulReconcileRequestsReturn = UseMutationResult<\n readonly ReconciliationEntry[],\n CapxulError,\n void\n>;\nexport const useCapxulReconcileRequests = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) => useRequestMutation(actor, \"requests.reconcile\", (methods) => methods.requests.reconcile());\n\nexport type UseCapxulInboxReturn = UseQueryResult<readonly InboxItem[], CapxulError>;\nexport function useCapxulInbox(\n actor: CapxulActorScope | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulInboxReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorInbox(actor),\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"inbox.list\");\n return unwrapCapxulResult(\n await actorMethods(bootstrappedClient, requireActorScope(actor, \"inbox.list\")).inbox.list(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && actor !== undefined && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulApproveInboxRequestReturn = UseMutationResult<\n Payment,\n CapxulError,\n InboxApproveInput\n>;\nexport const useCapxulApproveInboxRequest = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) =>\n useRequestMutation(\n actor,\n \"inbox.approve\",\n (methods, input: InboxApproveInput) => methods.inbox.approve(input),\n true,\n );\n\nexport type UseCapxulDeclineInboxRequestReturn = UseMutationResult<InboxItem, CapxulError, string>;\nexport const useCapxulDeclineInboxRequest = (\n actor: CapxulActorScope | undefined = capxulAccountScope,\n) =>\n useRequestMutation(\n actor,\n \"inbox.decline\",\n (methods, requestId: string) => methods.inbox.decline(requestId),\n true,\n );\n\nexport type UseCapxulInsightsSummaryReturn = UseQueryResult<InsightsSummary, CapxulError>;\nexport function useCapxulInsightsSummary(\n actor: CapxulActorScope | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulInsightsSummaryReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorInsightsSummary(actor),\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"insights.summary\");\n return unwrapCapxulResult(\n await actorMethods(\n bootstrappedClient,\n requireActorScope(actor, \"insights.summary\"),\n ).insights.summary(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && actor !== undefined && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulInsightsHistoryReturn = UseQueryResult<readonly Payment[], CapxulError>;\nexport function useCapxulInsightsHistory(\n actor: CapxulActorScope | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulInsightsHistoryReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.actorInsightsHistory(actor),\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"insights.history\");\n return unwrapCapxulResult(\n await actorMethods(\n bootstrappedClient,\n requireActorScope(actor, \"insights.history\"),\n ).insights.history(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && actor !== undefined && (options?.enabled ?? true),\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 } from \"@capxul/errors\";\nimport type {\n Destination,\n DestinationAddInput,\n DestinationListInput,\n DestinationRemoveInput,\n} from \"@capxul/sdk\";\nimport type { CapxulError } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { rejectUnresolvedActor } from \"../internal/reject-unresolved-actor\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\n\nexport type UseCapxulDestinationsReturn = UseQueryResult<readonly Destination[], CapxulError>;\nexport function useCapxulDestinations(\n input: DestinationListInput | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulDestinationsReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.destinations(input),\n queryFn: async () => {\n if (input === undefined) throw Errors.invalidInput(\"input\", \"required for destinations.list\");\n const bootstrappedClient = requireBootstrappedClient(client, \"destinations.list\");\n return unwrapCapxulResult(\n await bootstrappedClient.destinations.list(input),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && input !== undefined && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulAddDestinationReturn = UseMutationResult<\n Destination,\n CapxulError,\n DestinationAddInput\n>;\nexport function useCapxulAddDestination(): UseCapxulAddDestinationReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) => {\n rejectUnresolvedActor(input, \"destinations.add\");\n const bootstrappedClient = requireBootstrappedClient(client, \"destinations.add\");\n return unwrapCapxulResult(\n await bootstrappedClient.destinations.add(input),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (_value, variables) => {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.destinationsScope,\n });\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.actorAddressBook(variables.actor ?? { kind: \"personal\" }),\n });\n },\n });\n}\n\nexport type UseCapxulRemoveDestinationReturn = UseMutationResult<\n { readonly id: string },\n CapxulError,\n DestinationRemoveInput\n>;\nexport function useCapxulRemoveDestination(): UseCapxulRemoveDestinationReturn {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input) => {\n rejectUnresolvedActor(input, \"destinations.remove\");\n const bootstrappedClient = requireBootstrappedClient(client, \"destinations.remove\");\n return unwrapCapxulResult(\n await bootstrappedClient.destinations.remove(input),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async () => {\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.destinationsScope,\n });\n },\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { ActivityListParams, ActivityPage, CapxulError } 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 UseCapxulActivityReturn = UseQueryResult<ActivityPage, CapxulError>;\n\nexport function useCapxulActivity(\n params?: ActivityListParams,\n options?: { readonly enabled?: boolean },\n): UseCapxulActivityReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.activity(params),\n queryFn: async () => {\n const bootstrappedClient = requireBootstrappedClient(client, \"activity.list\");\n return unwrapCapxulResult(\n await bootstrappedClient.activity.list(params),\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 } from \"@capxul/errors\";\nimport type { CapxulError, OfframpQuote, OfframpQuoteInput, OfframpStatus } 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 UseCapxulOfframpQuoteReturn = UseQueryResult<OfframpQuote, CapxulError>;\n\nexport function useCapxulOfframpQuote(\n input: OfframpQuoteInput | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulOfframpQuoteReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.offrampQuote(input),\n queryFn: async () => {\n if (input === undefined) {\n throw Errors.invalidInput(\"input\", \"required for useCapxulOfframpQuote\");\n }\n const bootstrappedClient = requireBootstrappedClient(client, \"offramp.quote\");\n return unwrapCapxulResult(\n await bootstrappedClient.offramp.quote(input),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && input !== undefined && (options?.enabled ?? true),\n });\n}\n\nexport type UseCapxulOfframpStatusReturn = UseQueryResult<OfframpStatus, CapxulError>;\n\nexport function useCapxulOfframpStatus(\n offrampId: string | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulOfframpStatusReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.offrampStatus(offrampId),\n queryFn: async () => {\n if (offrampId === undefined) {\n throw Errors.invalidInput(\"offrampId\", \"required for useCapxulOfframpStatus\");\n }\n const bootstrappedClient = requireBootstrappedClient(client, \"offramp.status\");\n return unwrapCapxulResult(\n await bootstrappedClient.offramp.status(offrampId),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && offrampId !== undefined && (options?.enabled ?? true),\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 } from \"@capxul/errors\";\nimport type {\n Payment,\n PayrollRosterAddInput,\n PayrollRosterLine,\n PayrollRunInput,\n} from \"@capxul/sdk\";\nimport type { CapxulError, OrgId } from \"@capxul/sdk\";\n\nimport { useCapxulClientOrNull } from \"../internal/capxul-client-context\";\nimport { invalidateMoneyState, paymentsFromValue } from \"../internal/invalidate-money-state\";\nimport { requireBootstrappedClient } from \"../internal/require-bootstrapped-client\";\nimport { capxulKeys } from \"../internal/reactivity-keys\";\nimport { unwrapCapxulResult } from \"../internal/unwrap-capxul-result\";\n\nexport type UseCapxulPayrollRosterReturn = UseQueryResult<\n readonly PayrollRosterLine[],\n CapxulError\n>;\nexport function useCapxulPayrollRoster(\n orgId: OrgId | undefined,\n options?: { readonly enabled?: boolean },\n): UseCapxulPayrollRosterReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.payrollRoster(orgId),\n queryFn: async () => {\n if (orgId === undefined)\n throw Errors.invalidInput(\"orgId\", \"required for payroll.roster.list\");\n const bootstrappedClient = requireBootstrappedClient(client, \"payroll.roster.list\");\n return unwrapCapxulResult(\n await bootstrappedClient.org(orgId).payroll.roster.list(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && orgId !== undefined && (options?.enabled ?? true),\n });\n}\n\nfunction usePayrollMutation<TData, TVariables>(\n orgId: OrgId | undefined,\n operation: string,\n run: (\n org: ReturnType<ReturnType<typeof requireBootstrappedClient>[\"org\"]>,\n variables: TVariables,\n ) => Promise<{ ok: true; value: TData } | { ok: false; error: CapxulError }>,\n): UseMutationResult<TData, CapxulError, TVariables> {\n const client = useCapxulClientOrNull();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (variables) => {\n if (orgId === undefined) throw Errors.invalidInput(\"orgId\", `required for ${operation}`);\n const bootstrappedClient = requireBootstrappedClient(client, operation);\n return unwrapCapxulResult(\n await run(bootstrappedClient.org(orgId), variables),\n bootstrappedClient._internal.telemetry,\n \"mutation\",\n );\n },\n onSuccess: async (data) => {\n await queryClient.invalidateQueries({ queryKey: capxulKeys.payrollRoster(orgId) });\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.actorInsightsSummary(\n orgId === undefined ? undefined : { kind: \"org\", orgId },\n ),\n });\n await queryClient.invalidateQueries({\n queryKey: capxulKeys.actorInsightsHistory(\n orgId === undefined ? undefined : { kind: \"org\", orgId },\n ),\n });\n if (orgId === undefined) return;\n const actor = { kind: \"org\" as const, orgId };\n const payments = paymentsFromValue(data);\n if (payments.length === 0) return;\n await Promise.all(\n payments.map((payment) =>\n invalidateMoneyState(queryClient, { actor, payment, includeAddressBook: true }),\n ),\n );\n },\n });\n}\n\nexport type UseCapxulAddPayrollRosterLineReturn = UseMutationResult<\n PayrollRosterLine,\n CapxulError,\n PayrollRosterAddInput\n>;\nexport const useCapxulAddPayrollRosterLine = (orgId: OrgId | undefined) =>\n usePayrollMutation(orgId, \"payroll.roster.add\", (org, input: PayrollRosterAddInput) =>\n org.payroll.roster.add(input),\n );\n\nexport type UseCapxulUpdatePayrollRosterLineInput = {\n readonly rosterLineId: string;\n readonly input: Partial<PayrollRosterAddInput>;\n};\nexport type UseCapxulUpdatePayrollRosterLineReturn = UseMutationResult<\n PayrollRosterLine,\n CapxulError,\n UseCapxulUpdatePayrollRosterLineInput\n>;\nexport const useCapxulUpdatePayrollRosterLine = (orgId: OrgId | undefined) =>\n usePayrollMutation(\n orgId,\n \"payroll.roster.update\",\n (org, variables: UseCapxulUpdatePayrollRosterLineInput) =>\n org.payroll.roster.update(variables.rosterLineId, variables.input),\n );\n\nexport type UseCapxulRemovePayrollRosterLineReturn = UseMutationResult<\n PayrollRosterLine,\n CapxulError,\n string\n>;\nexport const useCapxulRemovePayrollRosterLine = (orgId: OrgId | undefined) =>\n usePayrollMutation(orgId, \"payroll.roster.remove\", (org, rosterLineId: string) =>\n org.payroll.roster.remove(rosterLineId),\n );\n\nexport type UseCapxulRunPayrollReturn = UseMutationResult<\n readonly Payment[],\n CapxulError,\n PayrollRunInput\n>;\nexport const useCapxulRunPayroll = (orgId: OrgId | undefined) =>\n usePayrollMutation(orgId, \"payroll.run\", (org, input: PayrollRunInput) => org.payroll.run(input));\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError, 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 } from \"@capxul/errors\";\nimport type { CapxulError, 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 } from \"@capxul/errors\";\nimport type { CapxulError, 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 } from \"@capxul/errors\";\nimport type { CapxulError, 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, 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 } from \"@capxul/errors\";\nimport type { Account, CapxulError, 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 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 { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport { Errors } from \"@capxul/errors\";\nimport type { CapxulError, OrgId, OrganizationAccount } 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 UseCapxulOrganizationAccountOptions = {\n readonly enabled?: boolean;\n};\n\nexport type UseCapxulOrganizationAccountReturn = UseQueryResult<OrganizationAccount, CapxulError>;\n\nexport function useCapxulOrganizationAccount(\n organizationId: OrgId | undefined,\n options?: UseCapxulOrganizationAccountOptions,\n): UseCapxulOrganizationAccountReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.orgAccount(organizationId),\n queryFn: async () => {\n if (organizationId === undefined) {\n throw Errors.invalidInput(\"organizationId\", \"required for useCapxulOrganizationAccount\");\n }\n const bootstrappedClient = requireBootstrappedClient(client, \"org.account.get\");\n return unwrapCapxulResult(\n await bootstrappedClient.org(organizationId).account.get(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && organizationId !== undefined && (options?.enabled ?? true),\n });\n}\n","\"use client\";\n\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\n\nimport { Errors } from \"@capxul/errors\";\nimport type { CapxulError, OrgId, OrganizationAuditLogItem } 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 UseCapxulOrganizationAuditLogOptions = {\n readonly enabled?: boolean;\n};\n\nexport type UseCapxulOrganizationAuditLogReturn = UseQueryResult<\n readonly OrganizationAuditLogItem[],\n CapxulError\n>;\n\nexport function useCapxulOrganizationAuditLog(\n organizationId: OrgId | undefined,\n options?: UseCapxulOrganizationAuditLogOptions,\n): UseCapxulOrganizationAuditLogReturn {\n const client = useCapxulClientOrNull();\n return useQuery({\n queryKey: capxulKeys.orgAuditLog(organizationId),\n queryFn: async () => {\n if (organizationId === undefined) {\n throw Errors.invalidInput(\"organizationId\", \"required for useCapxulOrganizationAuditLog\");\n }\n const bootstrappedClient = requireBootstrappedClient(client, \"org.auditLog\");\n return unwrapCapxulResult(\n await bootstrappedClient.org(organizationId).auditLog(),\n bootstrappedClient._internal.telemetry,\n );\n },\n enabled: client !== null && organizationId !== undefined && (options?.enabled ?? true),\n });\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\n\nimport type { CapxulError, 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 {\n CompletePersonalOnboardingInput,\n CompletePersonalOnboardingResult,\n} from \"@capxul/sdk\";\nimport type { CapxulError } 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 {\n CompleteOrganizationOnboardingInput,\n CompleteOrganizationOnboardingResult,\n} from \"@capxul/sdk\";\nimport type { CapxulError } 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 } from \"@capxul/errors\";\nimport type { CapxulError, 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 } from \"@capxul/errors\";\nimport type { CapxulError, 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 } from \"@capxul/errors\";\nimport type { AssignRoleInput, CapxulError, 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 { CapxulError, 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 CapxulError,\n SwitchActingEntityInput | undefined\n>;\n\nexport function useCapxulSwitchActingEntity(): UseCapxulSwitchActingEntityReturn {\n return useMutation({\n mutationFn: async (_input?: SwitchActingEntityInput) => undefined,\n });\n}\n","import {\n CapxulError,\n Errors,\n isCapxulError,\n type CapxulErrorCode,\n type FailureMode,\n} from \"@capxul/errors\";\n\n// The canonical five-member `FailureMode` set, for runtime membership checks.\n// Mirrors `@capxul/sdk`'s internal `getFailureMode` (master #402) but kept local\n// so the headless layer reads the structured cause without a cross-package\n// telemetry-surface dependency — the same inline-from-`details` idiom master's\n// own `diagnostic-from-capxul-error.ts` uses.\nconst FAILURE_MODES: ReadonlySet<string> = new Set<FailureMode>([\n \"auth-origin-mismatch\",\n \"stale-openfort-cache\",\n \"app-env-allowlist\",\n \"no-secure-context\",\n \"unknown\",\n]);\n\nfunction isFailureMode(value: unknown): value is FailureMode {\n return typeof value === \"string\" && FAILURE_MODES.has(value);\n}\n\nfunction getFailureMode(error: CapxulError): FailureMode | undefined {\n const candidate = error.details?.failure_mode;\n return isFailureMode(candidate) ? candidate : undefined;\n}\n\nexport type HeadlessSuggestedAction =\n | \"retry\"\n | \"sign_out_and_in\"\n | \"check_configuration\"\n | \"contact_support\";\n\nexport type HeadlessErrorView = {\n readonly code: CapxulErrorCode;\n readonly failureMode: FailureMode | undefined;\n readonly userMessage: string;\n readonly suggestedAction: HeadlessSuggestedAction;\n readonly recoverable: boolean;\n readonly diagnostics: string;\n readonly correlationId: string | undefined;\n};\n\n// Per-FailureMode UX tables, keyed to master's canonical five-member\n// `FailureMode` enum (`@capxul/errors`). These replace alpha-cleanup's old\n// six-member OpenFort-specific taxonomy after the #402 telemetry unification;\n// the recoverable flags carry #377's correction forward (auth-origin and the\n// env/allowlist failures are NOT user-recoverable — only re-auth or a config\n// change clears them).\nconst FAILURE_USER_MESSAGES: Record<FailureMode, string> = {\n \"auth-origin-mismatch\":\n \"Your sign-in session is not visible to the wallet. Sign out and sign in again.\",\n \"stale-openfort-cache\":\n \"Stale wallet data from a previous session is blocking setup. Sign out, then sign in with your current email.\",\n \"app-env-allowlist\":\n \"This app origin is not authorized for the publishable key. Check configuration.\",\n \"no-secure-context\":\n \"Your browser cannot access secure wallet features. Open the app in a standard browser window.\",\n unknown: \"Something went wrong setting up your wallet. Try again or sign out and sign in.\",\n};\n\nconst FAILURE_SUGGESTED_ACTIONS: Record<FailureMode, HeadlessSuggestedAction> = {\n \"auth-origin-mismatch\": \"sign_out_and_in\",\n \"stale-openfort-cache\": \"sign_out_and_in\",\n \"app-env-allowlist\": \"check_configuration\",\n \"no-secure-context\": \"check_configuration\",\n unknown: \"retry\",\n};\n\nconst FAILURE_RECOVERABLE: Record<FailureMode, boolean> = {\n \"auth-origin-mismatch\": false,\n \"stale-openfort-cache\": true,\n \"app-env-allowlist\": false,\n \"no-secure-context\": false,\n unknown: true,\n};\n\nexport function coerceToCapxulError(cause: unknown): CapxulError {\n if (isCapxulError(cause)) {\n return cause;\n }\n if (cause instanceof Error) {\n return Errors.unknown(cause);\n }\n return Errors.unknown(String(cause));\n}\n\nexport function toHeadlessErrorView(error: CapxulError): HeadlessErrorView {\n const failureMode = getFailureMode(error);\n const suggestedAction = failureMode\n ? FAILURE_SUGGESTED_ACTIONS[failureMode]\n : defaultSuggestedAction(error);\n const userMessage = failureMode ? FAILURE_USER_MESSAGES[failureMode] : defaultUserMessage(error);\n const recoverable = failureMode ? FAILURE_RECOVERABLE[failureMode] : defaultRecoverable(error);\n\n return {\n code: error.code,\n failureMode,\n userMessage,\n suggestedAction,\n recoverable,\n diagnostics: buildDiagnostics(error, failureMode),\n correlationId: error.correlationId,\n };\n}\n\nfunction defaultUserMessage(error: CapxulError): string {\n if (error.code === \"OTP_EXPIRED\") {\n return \"Verification code has expired. Request a new one.\";\n }\n if (error.code === \"NOT_AUTHENTICATED\") {\n return \"You are not signed in. Sign in and try again.\";\n }\n if (error.code === \"RATE_LIMITED\") {\n return \"Too many attempts. Wait a moment and try again.\";\n }\n if (error.code === \"NETWORK_ERROR\") {\n return \"Network error. Check your connection and try again.\";\n }\n return error.message;\n}\n\nfunction defaultSuggestedAction(error: CapxulError): HeadlessSuggestedAction {\n switch (error.code) {\n case \"NOT_AUTHENTICATED\":\n case \"OTP_EXPIRED\":\n case \"WRONG_STATE\":\n return \"sign_out_and_in\";\n case \"ENV_MISSING\":\n return \"check_configuration\";\n case \"RATE_LIMITED\":\n case \"NETWORK_ERROR\":\n case \"PROVIDER_ERROR\":\n case \"TRANSACTION_FAILED\":\n return \"retry\";\n default:\n return \"contact_support\";\n }\n}\n\nfunction defaultRecoverable(error: CapxulError): boolean {\n switch (error.code) {\n case \"ENV_MISSING\":\n case \"NOT_IMPLEMENTED\":\n return false;\n default:\n return true;\n }\n}\n\nfunction buildDiagnostics(error: CapxulError, failureMode: FailureMode | undefined): string {\n const parts: string[] = [`code=${error.code}`];\n if (failureMode !== undefined) {\n parts.push(`failure_mode=${failureMode}`);\n }\n if (error.layer !== undefined) {\n parts.push(`layer=${error.layer}`);\n }\n const provider = error.details?.provider;\n if (typeof provider === \"string\") {\n parts.push(`provider=${provider}`);\n }\n const operation = error.details?.operation;\n if (typeof operation === \"string\") {\n parts.push(`operation=${operation}`);\n }\n return parts.join(\" \");\n}\n","import type { CapxulError } from \"@capxul/errors\";\nimport type { ReactNode } from \"react\";\n\nimport { toHeadlessErrorView, type HeadlessErrorView } from \"./headless-error-view\";\n\nexport type Slot<TProps> = (props: TProps) => ReactNode;\n\nexport type QuerySlotState<T> = {\n readonly data: T | undefined;\n readonly isLoading: boolean;\n readonly isFetching: boolean;\n readonly isError: boolean;\n readonly error: HeadlessErrorView | null;\n};\n\nexport function toQuerySlotState<T>(query: {\n readonly data: T | undefined;\n readonly isLoading: boolean;\n readonly isFetching: boolean;\n readonly isError: boolean;\n readonly error: CapxulError | null;\n}): QuerySlotState<T> {\n return {\n data: query.data,\n isLoading: query.isLoading,\n isFetching: query.isFetching,\n isError: query.isError,\n error: query.error === null ? null : toHeadlessErrorView(query.error),\n };\n}\n","import { Errors } from \"@capxul/errors\";\nimport type { Brand } from \"./brand\";\n\nexport type { Brand } from \"./brand\";\n\nexport type Address = Brand<string, \"Address\">;\nexport type Email = Brand<string, \"Email\">;\nexport type Identity = Brand<string, \"Identity\">;\n// `Profile` is the SDK's user-shaped record returned by `IdentityPort`. Pure\n// record of brand-typed fields — not itself a brand. The field-level brands\n// satisfy `IdentityPort` clause I8 at compile time. Hosted here per the\n// canon (`docs/canon/ports/identity.md`).\nexport type Profile = {\n readonly authUserId: AuthUserId;\n readonly email: Email;\n readonly displayName: string | null;\n readonly country: CountryCode | null;\n readonly kycTier: KycTier;\n readonly createdAt: EpochMs;\n readonly updatedAt: EpochMs;\n};\n// `SmartAccount` is the SDK's ERC-4337 record returned by `SmartAccountPort`.\n// Pure record of brand-typed fields — not itself a brand. `deployedAt` is\n// nullable: `null` means the address is counterfactual (derived, not yet\n// on-chain). PRD #462 (derivation v2): `signerAddress` is the CLAIMED owner —\n// `null` until the claim userOp installs the user's signer (`claimedAt`\n// records that event); the address derives from the email alone. Hosted here\n// per the canon (`docs/canon/ports/smart-account.md`).\nexport type SmartAccount = {\n readonly authUserId: AuthUserId;\n readonly signerAddress: Address | null;\n readonly smartAccountAddress: Address;\n readonly chainId: ChainId;\n readonly deployedAt: EpochMs | null;\n readonly claimedAt: EpochMs | null;\n readonly createdAt: EpochMs;\n};\n// `Money` is the SDK's consumer-facing value type (canon\n// `account-balance-model.md` §10). Every public monetary value is a `Money`\n// — never wei, never raw token units. `value` is a major-unit decimal string\n// (e.g. \"1.5\" USD); `decimals` is the on-chain token precision used for the\n// internal `fromWei`/`toWei` round-trip at the SDK boundary (USDX is 6).\n// Pure record of a brand-typed field + primitives — not itself a brand.\nexport type Money = {\n readonly currency: CurrencyCode;\n readonly value: string;\n readonly decimals: number;\n};\n\n// `Account` is the SDK's logical money account (canon §6, §9). `id` is the\n// `account_`-shaped `AccountId` — NOT the Safe address and NOT an Openfort id.\n// `balance` is the Safe's top-line holdings; `available` is money not assigned\n// to any sub-account (canon §5/§12). With no sub-accounts (Slice 1a),\n// `available === balance`. Pure record of brand-typed fields — not a brand.\nexport type Account = {\n readonly id: AccountId;\n readonly balance: Money;\n readonly available: Money;\n};\n\n/** Named bucket partitioning a logical Account (canon §9). */\nexport type SubAccount = {\n readonly id: SubAccountId;\n readonly accountId: AccountId;\n readonly name: string;\n readonly balance: Money;\n readonly createdAt: EpochMs;\n};\n\nexport type AuthUserId = Brand<string, \"AuthUserId\">;\nexport type AnonymousDistinctId = Brand<string, \"AnonymousDistinctId\">;\nexport type PlayerId = Brand<string, \"PlayerId\">;\nexport type AccountId = Brand<string, \"AccountId\">;\nexport type SubAccountId = Brand<string, \"SubAccountId\">;\nexport type OrgId = Brand<string, \"OrgId\">;\nexport type AppId = Brand<string, \"AppId\">;\nexport type AllowedOrigin = Brand<string, \"AllowedOrigin\">;\nexport type PublishableKey = Brand<string, \"PublishableKey\">;\nexport type PublishableKeyId = Brand<string, \"PublishableKeyId\">;\nexport type DurationMs = Brand<number, \"DurationMs\">;\n// `DeveloperApplication` and `PublishableKeyRecord` are the SDK's record\n// shapes returned by `CredentialsPort`. Pure records of brand-typed fields\n// — not themselves brands. The field-level brands satisfy CR13 + the record\n// branding clauses of `credentials.test-d.ts` at compile time. Hosted here\n// per the canon (`docs/canon/ports/credentials.md`).\nexport type DeveloperApplication = {\n readonly id: AppId;\n readonly authUserId: AuthUserId;\n readonly name: string;\n readonly allowedOrigins: readonly AllowedOrigin[];\n readonly createdAt: EpochMs;\n readonly archivedAt: EpochMs | null;\n};\nexport type PublishableKeyRecord = {\n readonly id: PublishableKeyId;\n readonly applicationId: AppId;\n readonly activeFromMs: EpochMs;\n readonly gracePeriodEndsMs: EpochMs | null;\n readonly revokedAt: EpochMs | null;\n};\nexport type TxHash = Brand<string, \"TxHash\">;\nexport type DocumentHash = Brand<string, \"DocumentHash\">;\nexport type EpochMs = Brand<number, \"EpochMs\">;\nexport type EpochSeconds = Brand<number, \"EpochSeconds\">;\nexport type ChainId = Brand<number, \"ChainId\">;\nexport type CountryCode = Brand<string, \"CountryCode\">;\nexport type CurrencyCode = Brand<SupportedCurrencyCode, \"CurrencyCode\">;\nexport type KycTier = Brand<0 | 1 | 2 | 3, \"KycTier\">;\nexport type BlockNumber = Brand<number, \"BlockNumber\">;\nexport type LogIndex = Brand<number, \"LogIndex\">;\nexport type WeiAmount = Brand<string, \"WeiAmount\">;\nexport type SafeAddress = Brand<string, \"SafeAddress\">;\nexport type ModuleAddress = Brand<string, \"ModuleAddress\">;\nexport type RunId = Brand<string, \"RunId\">;\nexport type RoleKey = Brand<string, \"RoleKey\">;\nexport type AllowanceKey = Brand<string, \"AllowanceKey\">;\nexport type SessionToken = Brand<string, \"SessionToken\">;\nexport type JwtToken = Brand<string, \"JwtToken\">;\n\n// `AuthSession` is the record type shared by `AuthClientPort` and\n// `SessionStoragePort`. Hosted here per the canon\n// (`docs/canon/ports/auth-client.md`) so both ports depend on it\n// symmetrically. Every field is branded — field-level brands satisfy the\n// AuthSession branding contract asserted in `auth-client.test-d.ts`.\nexport type AuthSession = {\n readonly authUserId: AuthUserId;\n readonly email: Email;\n readonly token: SessionToken;\n readonly expiresAt: EpochMs;\n};\n\nexport const EVM_ADDRESS_RE = /^0x[0-9a-f]{40}$/i;\nexport const BYTES32_RE = /^0x[0-9a-f]{64}$/i;\nexport const PUBLISHABLE_KEY_PATTERN = /^cap_pk_(test|live)_[0-9A-HJKMNP-TV-Z]{32}$/;\nexport const SUPPORTED_CURRENCIES = [\n { code: \"USD\", symbol: \"$\", name: \"US Dollar\" },\n { code: \"NGN\", symbol: \"NGN\", name: \"Nigerian Naira\" },\n { code: \"GHS\", symbol: \"GHS\", name: \"Ghanaian Cedi\" },\n { code: \"KES\", symbol: \"KSh\", name: \"Kenyan Shilling\" },\n { code: \"UGX\", symbol: \"USh\", name: \"Ugandan Shilling\" },\n] as const;\nexport const SUPPORTED_CURRENCY_CODES = SUPPORTED_CURRENCIES.map((currency) => currency.code);\ntype SupportedCurrencyCode = (typeof SUPPORTED_CURRENCIES)[number][\"code\"];\nexport const CURRENCY_SYMBOLS = Object.fromEntries(\n SUPPORTED_CURRENCIES.map((currency) => [currency.code, currency.symbol]),\n) as Record<SupportedCurrencyCode, string>;\n\nconst EMAIL_RE = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nconst COUNTRY_CODE_RE = /^[A-Z]{2}$/;\nconst ANONYMOUS_DISTINCT_ID_RE = /^anon_[a-zA-Z0-9-]+$/;\n// Canon §6: the logical Account brand is `account_`-shaped. The tail mirrors\n// the `app_` ULID-shape generator (`account_<26 Crockford base32 chars>`) but\n// the brand only enforces the `account_` prefix + a non-empty alphanumeric\n// tail so existing opaque test ids (`account_123`) and generated ULIDs both\n// satisfy it.\nconst ACCOUNT_ID_RE = /^account_[0-9A-Za-z]+$/;\nconst SUBACCOUNT_ID_RE = /^subaccount_[0-9A-Za-z]+$/;\n// Exported so `@capxul/wire`'s `AppIdSchema` can reuse the same regex via\n// `Schema.filter(...)` and stay in lockstep with `toAppId` (Decision 2,\n// 2b parity).\nexport const APP_ID_RE = /^app_[0-7][0-9A-HJKMNP-TV-Z]{25}$/;\nconst TX_HASH_RE = /^0x[0-9a-f]{64}$/i;\nconst DOCUMENT_HASH_HEX_RE = /^[0-9a-fA-F]{64}$/;\nconst WEI_RE = /^[0-9]+$/;\nconst RUN_ID_RE = /^run_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;\nconst MAX_SAFE_EPOCH_SECONDS = Math.floor(Number.MAX_SAFE_INTEGER / 1000);\n\nexport function toAddress(raw: unknown): Address {\n if (typeof raw !== \"string\" || !EVM_ADDRESS_RE.test(raw)) {\n throw Errors.invalidInput(\"address\", invalidValueReason(\"invalid EVM address format\", raw));\n }\n\n return raw.toLowerCase() as Address;\n}\n\nexport function isEvmAddress(raw: unknown): raw is string {\n return typeof raw === \"string\" && EVM_ADDRESS_RE.test(raw);\n}\n\nexport function toEmail(raw: unknown): Email {\n if (typeof raw !== \"string\" || !EMAIL_RE.test(raw)) {\n throw Errors.invalidInput(\"email\", invalidValueReason(\"must look like an email address\", raw));\n }\n\n return raw.toLowerCase() as Email;\n}\n\nexport function toIdentity(raw: unknown): Identity {\n return toNonEmptyStringBrand(raw, \"identity\") as Identity;\n}\n\nexport function toAuthUserId(raw: unknown): AuthUserId {\n return toNonEmptyStringBrand(raw, \"authUserId\") as AuthUserId;\n}\n\nexport function toAnonymousDistinctId(raw: unknown): AnonymousDistinctId {\n if (typeof raw !== \"string\" || !ANONYMOUS_DISTINCT_ID_RE.test(raw)) {\n throw Errors.invalidInput(\n \"anonDistinctId\",\n invalidValueReason(\"must be anon_ plus letters, digits, or hyphens\", raw),\n );\n }\n\n return raw as AnonymousDistinctId;\n}\n\nexport function toPlayerId(raw: unknown): PlayerId {\n return toNonEmptyStringBrand(raw, \"playerId\") as PlayerId;\n}\n\nexport function toAccountId(raw: unknown): AccountId {\n if (typeof raw !== \"string\" || !ACCOUNT_ID_RE.test(raw)) {\n throw Errors.invalidInput(\n \"accountId\",\n invalidValueReason(\"must be account_ plus an alphanumeric id\", raw),\n );\n }\n\n return raw as AccountId;\n}\n\nexport function toSubAccountId(raw: unknown): SubAccountId {\n if (typeof raw !== \"string\" || !SUBACCOUNT_ID_RE.test(raw)) {\n throw Errors.invalidInput(\n \"subAccountId\",\n invalidValueReason(\"must be subaccount_ plus an alphanumeric id\", raw),\n );\n }\n\n return raw as SubAccountId;\n}\n\nexport function toOrgId(raw: unknown): OrgId {\n return toNonEmptyStringBrand(raw, \"orgId\") as OrgId;\n}\n\nexport function toAppId(raw: unknown): AppId {\n if (typeof raw !== \"string\" || !APP_ID_RE.test(raw)) {\n throw Errors.invalidInput(\"appId\", invalidValueReason(\"must be app_ plus a ULID\", raw));\n }\n\n return raw as AppId;\n}\n\nexport function toAllowedOrigin(raw: unknown): AllowedOrigin {\n if (typeof raw !== \"string\") {\n throw Errors.invalidInput(\"allowedOrigin\", \"must be an http or https origin string\");\n }\n\n const normalized = normalizeAllowedOrigin(raw);\n if (normalized === null) {\n throw Errors.invalidInput(\n \"allowedOrigin\",\n invalidValueReason(\"must be an http or https origin\", raw),\n );\n }\n\n return normalized as AllowedOrigin;\n}\n\nexport function toPublishableKeyId(raw: unknown): PublishableKeyId {\n return toNonEmptyStringBrand(raw, \"keyId\") as PublishableKeyId;\n}\n\nexport function toDurationMs(raw: unknown): DurationMs {\n if (typeof raw !== \"number\" || !Number.isSafeInteger(raw) || raw < 0) {\n throw Errors.invalidInput(\n \"duration\",\n invalidValueReason(\"must be a non-negative safe integer\", raw),\n );\n }\n\n return raw as DurationMs;\n}\n\nexport function toPublishableKey(raw: unknown): PublishableKey {\n if (typeof raw !== \"string\" || !PUBLISHABLE_KEY_PATTERN.test(raw)) {\n throw Errors.invalidInput(\n \"publishableKey\",\n invalidValueReason(\"must match cap_pk_(test|live) plus 32 Crockford base32 chars\", raw),\n );\n }\n\n return raw as PublishableKey;\n}\n\nexport function toTxHash(raw: unknown): TxHash {\n if (typeof raw !== \"string\" || !TX_HASH_RE.test(raw)) {\n throw Errors.invalidInput(\"txHash\", invalidValueReason(\"must be 0x + 64 hex chars\", raw));\n }\n\n return raw.toLowerCase() as TxHash;\n}\n\nexport function toDocumentHash(raw: unknown): DocumentHash {\n if (typeof raw !== \"string\") {\n throw Errors.invalidInput(\"documentHash\", \"must be a string\");\n }\n\n const stripped = raw.startsWith(\"0x\") || raw.startsWith(\"0X\") ? raw.slice(2) : raw;\n if (!DOCUMENT_HASH_HEX_RE.test(stripped)) {\n throw Errors.invalidInput(\"documentHash\", \"must be 32 bytes of hex\");\n }\n\n return `0x${stripped.toLowerCase()}` as DocumentHash;\n}\n\nexport function toEpochMs(raw: unknown): EpochMs {\n assertSafeNonNegativeInteger(raw, \"epochMs\");\n return raw as EpochMs;\n}\n\nexport function toEpochSeconds(raw: unknown): EpochSeconds {\n assertSafeNonNegativeInteger(raw, \"epochSeconds\");\n return raw as EpochSeconds;\n}\n\nexport function secondsToMs(seconds: EpochSeconds): EpochMs {\n if (seconds > MAX_SAFE_EPOCH_SECONDS) {\n throw Errors.invalidInput(\"epochSeconds\", `${seconds} would overflow when multiplied by 1000`);\n }\n\n return toEpochMs(seconds * 1000);\n}\n\nexport function epochMsToSeconds(ms: EpochMs): EpochSeconds {\n return toEpochSeconds(Math.floor(ms / 1000));\n}\n\nexport function toChainId(raw: unknown): ChainId {\n if (typeof raw !== \"number\" || !Number.isSafeInteger(raw) || raw <= 0) {\n throw Errors.invalidInput(\n \"chainId\",\n invalidValueReason(\"must be a positive safe integer\", raw),\n );\n }\n\n return raw as ChainId;\n}\n\nexport function toBlockNumber(raw: unknown): BlockNumber {\n assertSafeNonNegativeInteger(raw, \"blockNumber\");\n return raw as BlockNumber;\n}\n\nexport function toLogIndex(raw: unknown): LogIndex {\n assertSafeNonNegativeInteger(raw, \"logIndex\");\n return raw as LogIndex;\n}\n\nexport function toWeiAmount(raw: unknown): WeiAmount {\n if (typeof raw !== \"string\" || !WEI_RE.test(raw)) {\n throw Errors.invalidInput(\n \"weiAmount\",\n invalidValueReason(\"must be a non-negative integer string\", raw),\n );\n }\n\n return raw as WeiAmount;\n}\n\nexport function toCountryCode(raw: unknown): CountryCode {\n if (typeof raw !== \"string\") {\n throw Errors.invalidInput(\"countryCode\", \"must be a string\");\n }\n\n const upper = raw.toUpperCase();\n if (!COUNTRY_CODE_RE.test(upper)) {\n throw Errors.invalidInput(\n \"countryCode\",\n invalidValueReason(\"must be a 2-letter ISO 3166-1 alpha-2 code\", raw),\n );\n }\n\n return upper as CountryCode;\n}\n\nexport function toCurrencyCode(raw: unknown): CurrencyCode {\n if (typeof raw !== \"string\" || !SUPPORTED_CURRENCY_CODES.includes(raw as SupportedCurrencyCode)) {\n throw Errors.invalidInput(\"currencyCode\", invalidValueReason(\"unsupported currency\", raw));\n }\n\n return raw as CurrencyCode;\n}\n\nexport function currencySymbolFor(code: CurrencyCode): string {\n const symbol = CURRENCY_SYMBOLS[code as SupportedCurrencyCode];\n if (symbol === undefined) {\n throw Errors.invalidInput(\"currencyCode\", `no symbol registered for \"${String(code)}\"`);\n }\n\n return symbol;\n}\n\nexport function toKycTier(raw: unknown): KycTier {\n if (typeof raw !== \"number\" || !Number.isInteger(raw) || raw < 0 || raw > 3) {\n throw Errors.invalidInput(\"kycTier\", invalidValueReason(\"must be an integer in [0, 3]\", raw));\n }\n\n return raw as KycTier;\n}\n\nexport function toSafeAddress(raw: unknown): SafeAddress {\n if (typeof raw !== \"string\" || !EVM_ADDRESS_RE.test(raw)) {\n throw Errors.invalidInput(\"safeAddress\", invalidValueReason(\"invalid EVM address format\", raw));\n }\n\n return raw.toLowerCase() as SafeAddress;\n}\n\nexport function toModuleAddress(raw: unknown): ModuleAddress {\n if (typeof raw !== \"string\" || !EVM_ADDRESS_RE.test(raw)) {\n throw Errors.invalidInput(\n \"moduleAddress\",\n invalidValueReason(\"invalid EVM address format\", raw),\n );\n }\n\n return raw.toLowerCase() as ModuleAddress;\n}\n\nexport function toRunId(raw: unknown): RunId {\n if (typeof raw !== \"string\" || !RUN_ID_RE.test(raw)) {\n throw Errors.invalidInput(\"runId\", \"must match the format run_<uuid>\");\n }\n\n return raw as RunId;\n}\n\nexport function toRoleKey(raw: unknown): RoleKey {\n if (typeof raw !== \"string\" || !BYTES32_RE.test(raw)) {\n throw Errors.invalidInput(\"roleKey\", invalidValueReason(\"must be 0x + 64 hex chars\", raw));\n }\n\n return raw.toLowerCase() as RoleKey;\n}\n\nexport function toAllowanceKey(raw: unknown): AllowanceKey {\n if (typeof raw !== \"string\" || !BYTES32_RE.test(raw)) {\n throw Errors.invalidInput(\"allowanceKey\", invalidValueReason(\"must be 0x + 64 hex chars\", raw));\n }\n\n return raw.toLowerCase() as AllowanceKey;\n}\n\nexport function toSessionToken(raw: unknown): SessionToken {\n if (typeof raw !== \"string\" || raw.length === 0) {\n throw Errors.invalidInput(\"token\", \"must be a non-empty string\");\n }\n\n return raw as SessionToken;\n}\n\nexport function toJwtToken(raw: unknown): JwtToken {\n if (typeof raw !== \"string\" || raw.length === 0) {\n throw Errors.invalidInput(\"jwtToken\", \"must be a non-empty string\");\n }\n\n return raw as JwtToken;\n}\n\nfunction toNonEmptyStringBrand(raw: unknown, field: string): string {\n if (typeof raw !== \"string\" || raw.length === 0) {\n throw Errors.invalidInput(field, \"must be a non-empty string\");\n }\n\n return raw;\n}\n\nfunction assertSafeNonNegativeInteger(raw: unknown, field: string): asserts raw is number {\n if (typeof raw !== \"number\" || !Number.isSafeInteger(raw) || raw < 0) {\n throw Errors.invalidInput(\n field,\n invalidValueReason(\"must be a non-negative safe integer\", raw),\n );\n }\n}\n\nfunction normalizeAllowedOrigin(raw: string): string | null {\n let parsed: URL;\n try {\n parsed = new URL(raw);\n } catch {\n return null;\n }\n\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n return null;\n }\n\n if (parsed.hostname.includes(\"*\")) {\n return null;\n }\n\n return parsed.origin;\n}\n\nfunction invalidValueReason(prefix: string, raw: unknown): string {\n if (typeof raw === \"string\") {\n return `${prefix}: ${raw.slice(0, 40)}`;\n }\n\n return `${prefix}: ${String(raw)}`;\n}\n","\"use client\";\n\nimport { useState } from \"react\";\n\nimport type { PaymentsPayInput } from \"@capxul/sdk\";\n\nimport { useCapxulPay } from \"../../hooks/use-capxul-money\";\nimport {\n coerceToCapxulError,\n toHeadlessErrorView,\n type HeadlessErrorView,\n} from \"../shared/headless-error-view\";\nimport type { Slot } from \"../shared/types\";\n\nexport type SendMoneySlots = {\n readonly root?: Slot<{ readonly children: React.ReactNode }>;\n readonly form?: Slot<{\n readonly value: PaymentsPayInput | null;\n readonly setValue: (value: PaymentsPayInput | null) => void;\n readonly submit: () => void;\n readonly pending: boolean;\n readonly disabled: boolean;\n readonly succeeded: boolean;\n readonly error: HeadlessErrorView | null;\n }>;\n readonly error?: Slot<HeadlessErrorView>;\n};\n\nexport interface SendMoneyProps {\n readonly initialValue?: PaymentsPayInput | null;\n readonly slots: SendMoneySlots;\n readonly onSent?: () => void;\n}\n\nexport function SendMoney({ initialValue = null, slots, onSent }: SendMoneyProps) {\n const pay = useCapxulPay();\n const [value, setValue] = useState<PaymentsPayInput | null>(initialValue);\n const [error, setError] = useState<HeadlessErrorView | null>(null);\n\n const submit = async () => {\n setError(null);\n if (value === null) return;\n try {\n await pay.mutateAsync(value);\n onSent?.();\n } catch (cause) {\n setError(toHeadlessErrorView(coerceToCapxulError(cause)));\n }\n };\n\n const slot = slots.form?.({\n value,\n setValue,\n submit: () => void submit(),\n pending: pay.isPending,\n disabled: pay.isPending || value === null,\n succeeded: pay.isSuccess,\n error,\n });\n const children = (\n <>\n {slot}\n {error === null ? null : slots.error?.(error)}\n </>\n );\n return slots.root?.({ children }) ?? children;\n}\n","\"use client\";\n\nimport type { AddressBookAddInput, AddressBookEntry, AddressBookLabelInput } from \"@capxul/sdk\";\n\nimport {\n capxulAccountScope,\n type CapxulActorScope,\n useCapxulAddAddressBookEntry,\n useCapxulAddressBook,\n useCapxulHideAddressBookEntry,\n useCapxulLabelAddressBookEntry,\n useCapxulUnhideAddressBookEntry,\n} from \"../../hooks/use-capxul-actor-scope\";\nimport type { QuerySlotState, Slot } from \"../shared/types\";\nimport { toQuerySlotState } from \"../shared/types\";\n\nexport type AddressBookSlots = {\n readonly root?: Slot<{ readonly children: React.ReactNode }>;\n readonly entries?: Slot<QuerySlotState<readonly AddressBookEntry[]>>;\n readonly actions?: Slot<{\n readonly add: (input: AddressBookAddInput) => Promise<AddressBookEntry>;\n readonly hide: (entryId: string) => Promise<AddressBookEntry>;\n readonly unhide: (entryId: string) => Promise<AddressBookEntry>;\n readonly label: (input: AddressBookLabelInput) => Promise<AddressBookEntry>;\n readonly pending: boolean;\n readonly disabled: boolean;\n }>;\n};\n\nexport interface AddressBookProps {\n readonly actor?: CapxulActorScope | undefined;\n readonly slots: AddressBookSlots;\n}\n\nexport function AddressBook(props: AddressBookProps) {\n const { slots } = props;\n const actor = \"actor\" in props ? props.actor : capxulAccountScope;\n const entries = useCapxulAddressBook(actor);\n const add = useCapxulAddAddressBookEntry(actor);\n const hide = useCapxulHideAddressBookEntry(actor);\n const unhide = useCapxulUnhideAddressBookEntry(actor);\n const label = useCapxulLabelAddressBookEntry(actor);\n const pending = add.isPending || hide.isPending || unhide.isPending || label.isPending;\n const children = (\n <>\n {slots.entries?.(toQuerySlotState(entries))}\n {slots.actions?.({\n add: (input) => add.mutateAsync(input),\n hide: (entryId) => hide.mutateAsync(entryId),\n unhide: (entryId) => unhide.mutateAsync(entryId),\n label: (input) => label.mutateAsync(input),\n pending,\n disabled: pending || actor === undefined,\n })}\n </>\n );\n return slots.root?.({ children }) ?? children;\n}\n","\"use client\";\n\nimport type {\n ActorRequest,\n ActorRequestIssueInput,\n InboxApproveInput,\n InboxItem,\n Payment,\n} from \"@capxul/sdk\";\n\nimport {\n capxulAccountScope,\n type CapxulActorScope,\n useCapxulApproveInboxRequest,\n useCapxulCancelRequest,\n useCapxulDeclineInboxRequest,\n useCapxulInbox,\n useCapxulIssueRequest,\n useCapxulRequests,\n} from \"../../hooks/use-capxul-actor-scope\";\nimport type { QuerySlotState, Slot } from \"../shared/types\";\nimport { toQuerySlotState } from \"../shared/types\";\n\nexport type RequestInboxSlots = {\n readonly root?: Slot<{ readonly children: React.ReactNode }>;\n readonly requests?: Slot<QuerySlotState<readonly ActorRequest[]>>;\n readonly inbox?: Slot<QuerySlotState<readonly InboxItem[]>>;\n readonly actions?: Slot<{\n readonly issue: (input: ActorRequestIssueInput) => Promise<ActorRequest>;\n readonly cancel: (requestId: string) => Promise<ActorRequest>;\n readonly approve: (input: InboxApproveInput) => Promise<Payment>;\n readonly decline: (requestId: string) => Promise<InboxItem>;\n readonly pending: boolean;\n readonly disabled: boolean;\n }>;\n};\n\nexport interface RequestInboxProps {\n readonly actor?: CapxulActorScope | undefined;\n readonly slots: RequestInboxSlots;\n}\n\nexport function RequestInbox(props: RequestInboxProps) {\n const { slots } = props;\n const actor = \"actor\" in props ? props.actor : capxulAccountScope;\n const requests = useCapxulRequests(actor);\n const inbox = useCapxulInbox(actor);\n const issue = useCapxulIssueRequest(actor);\n const cancel = useCapxulCancelRequest(actor);\n const approve = useCapxulApproveInboxRequest(actor);\n const decline = useCapxulDeclineInboxRequest(actor);\n const pending = issue.isPending || cancel.isPending || approve.isPending || decline.isPending;\n const children = (\n <>\n {slots.requests?.(toQuerySlotState(requests))}\n {slots.inbox?.(toQuerySlotState(inbox))}\n {slots.actions?.({\n issue: (input) => issue.mutateAsync(input),\n cancel: (requestId) => cancel.mutateAsync(requestId),\n approve: (input) => approve.mutateAsync(input),\n decline: (requestId) => decline.mutateAsync(requestId),\n pending,\n disabled: pending || actor === undefined,\n })}\n </>\n );\n return slots.root?.({ children }) ?? children;\n}\n","\"use client\";\n\nimport type { InsightsSummary as InsightsSummaryRecord } from \"@capxul/sdk\";\n\nimport {\n capxulAccountScope,\n type CapxulActorScope,\n useCapxulInsightsSummary,\n} from \"../../hooks/use-capxul-actor-scope\";\nimport type { QuerySlotState, Slot } from \"../shared/types\";\nimport { toQuerySlotState } from \"../shared/types\";\n\nexport type InsightsSummarySlots = {\n readonly root?: Slot<{ readonly children: React.ReactNode }>;\n readonly summary?: Slot<QuerySlotState<InsightsSummaryRecord>>;\n};\n\nexport interface InsightsSummaryProps {\n readonly actor?: CapxulActorScope | undefined;\n readonly slots: InsightsSummarySlots;\n}\n\nexport function InsightsSummary(props: InsightsSummaryProps) {\n const { slots } = props;\n const actor = \"actor\" in props ? props.actor : capxulAccountScope;\n const summary = useCapxulInsightsSummary(actor);\n const children = slots.summary?.(toQuerySlotState(summary));\n return slots.root?.({ children }) ?? children;\n}\n","\"use client\";\n\nimport type { Payment, PayrollRosterAddInput, PayrollRosterLine, PayrollRunInput } from \"@capxul/sdk\";\nimport type { OrgId } from \"@capxul/types\";\n\nimport {\n useCapxulAddPayrollRosterLine,\n useCapxulPayrollRoster,\n useCapxulRemovePayrollRosterLine,\n useCapxulRunPayroll,\n useCapxulUpdatePayrollRosterLine,\n type UseCapxulUpdatePayrollRosterLineInput,\n} from \"../../hooks/use-capxul-payroll\";\nimport type { QuerySlotState, Slot } from \"../shared/types\";\nimport { toQuerySlotState } from \"../shared/types\";\n\nexport type PayrollRosterSlots = {\n readonly root?: Slot<{ readonly children: React.ReactNode }>;\n readonly roster?: Slot<QuerySlotState<readonly PayrollRosterLine[]>>;\n readonly actions?: Slot<{\n readonly add: (input: PayrollRosterAddInput) => Promise<PayrollRosterLine>;\n readonly update: (input: UseCapxulUpdatePayrollRosterLineInput) => Promise<PayrollRosterLine>;\n readonly remove: (rosterLineId: string) => Promise<PayrollRosterLine>;\n readonly run: (input: PayrollRunInput) => Promise<readonly Payment[]>;\n readonly pending: boolean;\n readonly disabled: boolean;\n }>;\n};\n\nexport interface PayrollRosterProps {\n readonly orgId: OrgId;\n readonly slots: PayrollRosterSlots;\n}\n\nexport function PayrollRoster({ orgId, slots }: PayrollRosterProps) {\n const roster = useCapxulPayrollRoster(orgId);\n const add = useCapxulAddPayrollRosterLine(orgId);\n const update = useCapxulUpdatePayrollRosterLine(orgId);\n const remove = useCapxulRemovePayrollRosterLine(orgId);\n const run = useCapxulRunPayroll(orgId);\n const pending = add.isPending || update.isPending || remove.isPending || run.isPending;\n const children = (\n <>\n {slots.roster?.(toQuerySlotState(roster))}\n {slots.actions?.({\n add: (input) => add.mutateAsync(input),\n update: (input) => update.mutateAsync(input),\n remove: (rosterLineId) => remove.mutateAsync(rosterLineId),\n run: (input) => run.mutateAsync(input),\n pending,\n disabled: pending,\n })}\n </>\n );\n return slots.root?.({ children }) ?? children;\n}\n","\"use client\";\n\nimport type {\n Destination,\n DestinationAddInput,\n DestinationListInput,\n DestinationRemoveInput,\n} from \"@capxul/sdk\";\n\nimport {\n useCapxulAddDestination,\n useCapxulDestinations,\n useCapxulRemoveDestination,\n} from \"../../hooks/use-capxul-destinations\";\nimport type { QuerySlotState, Slot } from \"../shared/types\";\nimport { toQuerySlotState } from \"../shared/types\";\n\nexport type DestinationsSlots = {\n readonly root?: Slot<{ readonly children: React.ReactNode }>;\n readonly destinations?: Slot<QuerySlotState<readonly Destination[]>>;\n readonly actions?: Slot<{\n readonly add: (input: DestinationAddInput) => Promise<Destination>;\n readonly remove: (input: DestinationRemoveInput) => Promise<{ readonly id: string }>;\n readonly pending: boolean;\n readonly disabled: boolean;\n }>;\n};\n\nexport interface DestinationsProps {\n readonly input: DestinationListInput;\n readonly slots: DestinationsSlots;\n}\n\nexport function Destinations({ input, slots }: DestinationsProps) {\n const destinations = useCapxulDestinations(input);\n const add = useCapxulAddDestination();\n const remove = useCapxulRemoveDestination();\n const pending = add.isPending || remove.isPending;\n const children = (\n <>\n {slots.destinations?.(toQuerySlotState(destinations))}\n {slots.actions?.({\n add: (value) => add.mutateAsync(value),\n remove: (value) => remove.mutateAsync(value),\n pending,\n disabled: pending,\n })}\n </>\n );\n return slots.root?.({ children }) ?? children;\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,MAA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CAAC,KAAK;AACvC;;;ACtBA,SAAgB,aAAa,EAAE,OAAO,SAA4B;CAChE,MAAM,eAAe,sBAAsB,KAAK;CAChD,MAAM,MAAM,wBAAwB;CACpC,MAAM,SAAS,2BAA2B;CAC1C,MAAM,UAAU,IAAI,aAAa,OAAO;CACxC,MAAM,WACJ,qBAAA,UAAA,EAAA,UAAA,CACG,MAAM,eAAe,iBAAiB,YAAY,CAAC,GACnD,MAAM,UAAU;EACf,MAAM,UAAU,IAAI,YAAY,KAAK;EACrC,SAAS,UAAU,OAAO,YAAY,KAAK;EAC3C;EACA,UAAU;CACZ,CAAC,CACD,EAAA,CAAA;CAEJ,OAAO,MAAM,OAAO,EAAE,SAAS,CAAC,KAAK;AACvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sdk-react",
3
- "version": "1.0.0-alpha.14",
3
+ "version": "1.0.0-alpha.16",
4
4
  "files": [
5
5
  "dist",
6
6
  "package.json",
@@ -18,7 +18,7 @@
18
18
  "tag": "alpha"
19
19
  },
20
20
  "dependencies": {
21
- "@capxul/sdk": "1.0.0-alpha.14"
21
+ "@capxul/sdk": "1.0.0-alpha.16"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@tanstack/react-query": "^5.66.9",
@@ -49,7 +49,6 @@
49
49
  "check-types": "tsc -p tsconfig.json --noEmit",
50
50
  "lint": "oxlint -c ../../.oxlintrc.json . --deny-warnings",
51
51
  "build": "NODE_OPTIONS=--max-old-space-size=24576 vp pack",
52
- "_vp-tasks-allowed": "vp-allowed: `test` + `test:coverage` are vp tasks in vite.config.ts so vitest self-writes don't bust cache (#205).",
53
- "test:e2e": "vp test run --config vitest.e2e.config.ts"
52
+ "_vp-tasks-allowed": "vp-allowed: `test` + `test:coverage` are vp tasks in vite.config.ts so vitest self-writes don't bust cache (#205)."
54
53
  }
55
54
  }