@capxul/sdk-react 1.0.0-alpha.9 → 1.2.0
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/README.md +60 -0
- package/dist/controllers-BU11km12.mjs +647 -0
- package/dist/controllers-BU11km12.mjs.map +1 -0
- package/dist/controllers-DuHYSiw1.d.mts +207 -0
- package/dist/controllers-DuHYSiw1.d.mts.map +1 -0
- package/dist/index.d.mts +156 -175
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +420 -395
- package/dist/index.mjs.map +1 -1
- package/dist/testing/index.d.mts +21 -0
- package/dist/testing/index.d.mts.map +1 -0
- package/dist/testing/index.mjs +24 -0
- package/dist/testing/index.mjs.map +1 -0
- package/package.json +10 -11
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { A as useCapxulAuth, C as CreateOrganizationSubmission, D as ProfileDetails, E as OrganizationDetails, M as useCapxulIdentity, N as useCapxulSend, O as SendResult, P as useCapxulTransitions, S as CapxulSend, T as InvocationOptions, _ as ReadyDestination, a as AuthenticationSlots, b as Slot, c as ControllerAction, d as OnboardingControllerProps, f as OrgFailure, g as ProfileSlotProps, h as PendingAuthState, i as AuthenticatedState, j as useCapxulDestination, k as entered, l as FaultedState, m as OtpPendingState, n as AccountProgress, o as CapxulAuthenticationController, p as OrgProgress, r as ActionResult, s as CapxulOnboardingController, t as AccountFailure, u as NavigationAction, v as RetryAction, w as Destination, x as CapxulAuth, y as SignedOutState } from "./controllers-DuHYSiw1.mjs";
|
|
1
2
|
import { ReactNode } from "react";
|
|
2
3
|
import { QueryClient, UseMutationResult, UseQueryResult } from "@tanstack/react-query";
|
|
3
|
-
import { Account,
|
|
4
|
+
import { Account, AccountId, AccountRequirement, AssignRoleInput, CapxulClient, CapxulError, CapxulSigner, CreateOrgInput, InviteMemberInput, MemberView, Money, ObservationAdapter, OrgId, OrgView, Payment, PaymentsPayInput, PaymentsPayoutInput, PaymentsWithdrawInput, Profile, RemoveMemberInput, RoleView, SubAccount, SubAccountId, TelemetryPort, TransferInput, TransferResult } from "@capxul/sdk";
|
|
4
5
|
|
|
5
6
|
//#region src/provider.d.ts
|
|
6
7
|
type CapxulProviderSharedProps = {
|
|
@@ -10,7 +11,14 @@ type CapxulProviderSharedProps = {
|
|
|
10
11
|
/** Browser / app path — the provider bootstraps the client from a publishable key. */
|
|
11
12
|
type CapxulProviderPublishableKeyProps = CapxulProviderSharedProps & {
|
|
12
13
|
readonly publishableKey: string;
|
|
13
|
-
readonly client?: never; /**
|
|
14
|
+
readonly client?: never; /** Host-owned observation adapter passed to the core SDK boundary. */
|
|
15
|
+
readonly observation?: ObservationAdapter;
|
|
16
|
+
/**
|
|
17
|
+
* Host success-telemetry sink, typically `telemetryFromPostHog(posthog, …)`.
|
|
18
|
+
* Events from SDK producers wired to this port reach the host's PostHog
|
|
19
|
+
* person after the host calls `identify()`.
|
|
20
|
+
*/
|
|
21
|
+
readonly telemetry?: TelemetryPort; /** Init-time account readiness target. Default `"none"`. */
|
|
14
22
|
readonly requirement?: AccountRequirement;
|
|
15
23
|
/**
|
|
16
24
|
* Optional consumer-held signer for the deploy lane. Omitted in browser apps
|
|
@@ -24,31 +32,15 @@ type CapxulProviderPublishableKeyProps = CapxulProviderSharedProps & {
|
|
|
24
32
|
*/
|
|
25
33
|
type CapxulProviderInjectedClientProps = CapxulProviderSharedProps & {
|
|
26
34
|
readonly client: CapxulClient;
|
|
27
|
-
readonly publishableKey?: never;
|
|
35
|
+
readonly publishableKey?: never; /** Injected clients must be created with observation at their owning factory. */
|
|
36
|
+
readonly observation?: never; /** Injected clients must be created with telemetry at their owning factory. */
|
|
37
|
+
readonly telemetry?: never;
|
|
28
38
|
readonly requirement?: never;
|
|
29
39
|
readonly signer?: never;
|
|
30
40
|
};
|
|
31
41
|
type CapxulProviderProps = CapxulProviderPublishableKeyProps | CapxulProviderInjectedClientProps;
|
|
32
42
|
declare function CapxulProvider(props: CapxulProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
33
43
|
//#endregion
|
|
34
|
-
//#region ../errors/src/errors.d.ts
|
|
35
|
-
declare const CAPXUL_ERROR_CODES: readonly ["NOT_AUTHENTICATED", "EMAIL_DELIVERY_FAILED", "PROFILE_NOT_FOUND", "SMART_ACCOUNT_MISSING", "PLAYER_NOT_FOUND", "ACCOUNT_NOT_FOUND", "PROVIDER_ERROR", "INVALID_INPUT", "ENV_MISSING", "NOT_IMPLEMENTED", "VERIFICATION_REQUIRED", "INSUFFICIENT_BALANCE", "INVALID_RECIPIENT", "ROLE_PERMISSION_DENIED", "TRANSACTION_FAILED", "RATE_LIMITED", "NETWORK_ERROR", "UNKNOWN", "OTP_EXPIRED", "SIGNER_REJECTED", "CANCELLED", "WRONG_STATE"];
|
|
36
|
-
type CapxulErrorCode = (typeof CAPXUL_ERROR_CODES)[number];
|
|
37
|
-
type CapxulErrorDetails = Record<string, unknown>;
|
|
38
|
-
type CapxulErrorOptions = {
|
|
39
|
-
readonly cause?: unknown;
|
|
40
|
-
readonly details?: CapxulErrorDetails;
|
|
41
|
-
readonly correlationId?: string;
|
|
42
|
-
readonly layer?: string;
|
|
43
|
-
};
|
|
44
|
-
declare class CapxulError extends Error {
|
|
45
|
-
readonly code: CapxulErrorCode;
|
|
46
|
-
readonly details?: CapxulErrorDetails;
|
|
47
|
-
readonly correlationId?: string;
|
|
48
|
-
readonly layer?: string;
|
|
49
|
-
constructor(code: CapxulErrorCode, message: string, options?: CapxulErrorOptions);
|
|
50
|
-
}
|
|
51
|
-
//#endregion
|
|
52
44
|
//#region src/internal/capxul-bootstrap-context.d.ts
|
|
53
45
|
type CapxulBootstrapStatus = "bootstrapping" | "ready" | "error";
|
|
54
46
|
interface CapxulBootstrapState {
|
|
@@ -66,27 +58,10 @@ declare function useCapxul(): CapxulBootstrapState;
|
|
|
66
58
|
*/
|
|
67
59
|
declare function useCapxulClientOrNull(): CapxulClient | null;
|
|
68
60
|
//#endregion
|
|
69
|
-
//#region src/hooks/use-capxul-session.d.ts
|
|
70
|
-
type UseCapxulSessionReturn = UseQueryResult<Session | null, CapxulError>;
|
|
71
|
-
declare function useCapxulSession(): UseCapxulSessionReturn;
|
|
72
|
-
//#endregion
|
|
73
61
|
//#region src/hooks/use-capxul-profile.d.ts
|
|
74
62
|
type UseCapxulProfileReturn = UseQueryResult<Profile | null, CapxulError>;
|
|
75
63
|
declare function useCapxulProfile(): UseCapxulProfileReturn;
|
|
76
64
|
//#endregion
|
|
77
|
-
//#region src/hooks/use-capxul-account-lifecycle.d.ts
|
|
78
|
-
interface UseCapxulAccountLifecycleReturn {
|
|
79
|
-
readonly lifecycle: AccountLifecycle;
|
|
80
|
-
readonly isSettingUp: boolean;
|
|
81
|
-
readonly error: CapxulError | null;
|
|
82
|
-
readonly isLoading: boolean;
|
|
83
|
-
readonly isFetching: boolean;
|
|
84
|
-
readonly isError: boolean;
|
|
85
|
-
readonly retry: UseMutationResult<AccountLifecycle, CapxulError, void>["mutateAsync"];
|
|
86
|
-
readonly isRetrying: boolean;
|
|
87
|
-
}
|
|
88
|
-
declare function useCapxulAccountLifecycle(): UseCapxulAccountLifecycleReturn;
|
|
89
|
-
//#endregion
|
|
90
65
|
//#region src/hooks/use-capxul-account-balance.d.ts
|
|
91
66
|
type UseCapxulAccountBalanceReturn = UseQueryResult<Account, CapxulError>;
|
|
92
67
|
type UseCapxulAccountBalanceOptions = {
|
|
@@ -94,93 +69,12 @@ type UseCapxulAccountBalanceOptions = {
|
|
|
94
69
|
};
|
|
95
70
|
declare function useCapxulAccountBalance(options?: UseCapxulAccountBalanceOptions): UseCapxulAccountBalanceReturn;
|
|
96
71
|
//#endregion
|
|
97
|
-
//#region ../types/src/brand.d.ts
|
|
98
|
-
/**
|
|
99
|
-
* Nominal type helper. `Brand<T, B>` is structurally a `T` at runtime but
|
|
100
|
-
* distinct at compile time, preventing accidental swaps between primitives.
|
|
101
|
-
*
|
|
102
|
-
* @internal
|
|
103
|
-
*/
|
|
104
|
-
declare const brand: unique symbol;
|
|
105
|
-
type Brand<T, B extends string> = T & {
|
|
106
|
-
readonly [brand]: B;
|
|
107
|
-
};
|
|
108
|
-
//#endregion
|
|
109
|
-
//#region ../types/src/index.d.ts
|
|
110
|
-
type Money = {
|
|
111
|
-
readonly currency: CurrencyCode;
|
|
112
|
-
readonly value: string;
|
|
113
|
-
readonly decimals: number;
|
|
114
|
-
};
|
|
115
|
-
type Account$1 = {
|
|
116
|
-
readonly id: AccountId;
|
|
117
|
-
readonly balance: Money;
|
|
118
|
-
readonly available: Money;
|
|
119
|
-
};
|
|
120
|
-
/** Named bucket partitioning a logical Account (canon §9). */
|
|
121
|
-
type SubAccount = {
|
|
122
|
-
readonly id: SubAccountId;
|
|
123
|
-
readonly accountId: AccountId;
|
|
124
|
-
readonly name: string;
|
|
125
|
-
readonly balance: Money;
|
|
126
|
-
readonly createdAt: EpochMs;
|
|
127
|
-
};
|
|
128
|
-
type AccountId = Brand<string, "AccountId">;
|
|
129
|
-
type SubAccountId = Brand<string, "SubAccountId">;
|
|
130
|
-
type EpochMs = Brand<number, "EpochMs">;
|
|
131
|
-
type CurrencyCode = Brand<SupportedCurrencyCode, "CurrencyCode">;
|
|
132
|
-
declare const SUPPORTED_CURRENCIES: readonly [{
|
|
133
|
-
readonly code: "USD";
|
|
134
|
-
readonly symbol: "$";
|
|
135
|
-
readonly name: "US Dollar";
|
|
136
|
-
}, {
|
|
137
|
-
readonly code: "NGN";
|
|
138
|
-
readonly symbol: "NGN";
|
|
139
|
-
readonly name: "Nigerian Naira";
|
|
140
|
-
}, {
|
|
141
|
-
readonly code: "GHS";
|
|
142
|
-
readonly symbol: "GHS";
|
|
143
|
-
readonly name: "Ghanaian Cedi";
|
|
144
|
-
}, {
|
|
145
|
-
readonly code: "KES";
|
|
146
|
-
readonly symbol: "KSh";
|
|
147
|
-
readonly name: "Kenyan Shilling";
|
|
148
|
-
}, {
|
|
149
|
-
readonly code: "UGX";
|
|
150
|
-
readonly symbol: "USh";
|
|
151
|
-
readonly name: "Ugandan Shilling";
|
|
152
|
-
}];
|
|
153
|
-
type SupportedCurrencyCode = (typeof SUPPORTED_CURRENCIES)[number]["code"];
|
|
154
|
-
//#endregion
|
|
155
72
|
//#region src/hooks/use-capxul-account-fund.d.ts
|
|
156
73
|
type UseCapxulAccountFundReturn = UseMutationResult<{
|
|
157
74
|
readonly txHash: string;
|
|
158
75
|
}, CapxulError, Money>;
|
|
159
76
|
declare function useCapxulAccountFund(): UseCapxulAccountFundReturn;
|
|
160
77
|
//#endregion
|
|
161
|
-
//#region src/hooks/use-capxul-sign-in.d.ts
|
|
162
|
-
interface SignInInput {
|
|
163
|
-
readonly email: string;
|
|
164
|
-
}
|
|
165
|
-
interface SignInSuccess {
|
|
166
|
-
readonly sessionId: string;
|
|
167
|
-
readonly expiresAt: number;
|
|
168
|
-
}
|
|
169
|
-
type UseCapxulSignInReturn = UseMutationResult<SignInSuccess, CapxulError, SignInInput>;
|
|
170
|
-
declare function useCapxulSignIn(): UseCapxulSignInReturn;
|
|
171
|
-
//#endregion
|
|
172
|
-
//#region src/hooks/use-capxul-verify-otp.d.ts
|
|
173
|
-
interface VerifyOtpInput {
|
|
174
|
-
readonly email: string;
|
|
175
|
-
readonly code: string;
|
|
176
|
-
}
|
|
177
|
-
type UseCapxulVerifyOtpReturn = UseMutationResult<Session, CapxulError, VerifyOtpInput>;
|
|
178
|
-
declare function useCapxulVerifyOtp(): UseCapxulVerifyOtpReturn;
|
|
179
|
-
//#endregion
|
|
180
|
-
//#region src/hooks/use-capxul-sign-out.d.ts
|
|
181
|
-
type UseCapxulSignOutReturn = UseMutationResult<void, CapxulError, void>;
|
|
182
|
-
declare function useCapxulSignOut(): UseCapxulSignOutReturn;
|
|
183
|
-
//#endregion
|
|
184
78
|
//#region src/hooks/use-capxul-sub-accounts.d.ts
|
|
185
79
|
type UseCapxulSubAccountsListOptions = {
|
|
186
80
|
readonly enabled?: boolean;
|
|
@@ -214,6 +108,22 @@ type UseCapxulTransferReturn = UseMutationResult<TransferResult, CapxulError, {
|
|
|
214
108
|
} & TransferInput>;
|
|
215
109
|
declare function useCapxulTransfer(): UseCapxulTransferReturn;
|
|
216
110
|
//#endregion
|
|
111
|
+
//#region src/hooks/use-capxul-money.d.ts
|
|
112
|
+
type UseCapxulPayReturn = UseMutationResult<Payment, CapxulError, PaymentsPayInput>;
|
|
113
|
+
declare function useCapxulPay(): UseCapxulPayReturn;
|
|
114
|
+
type UseCapxulPayoutReturn = UseMutationResult<Payment, CapxulError, PaymentsPayoutInput>;
|
|
115
|
+
declare function useCapxulPayout(): UseCapxulPayoutReturn;
|
|
116
|
+
type UseCapxulWithdrawReturn = UseMutationResult<Payment, CapxulError, PaymentsWithdrawInput>;
|
|
117
|
+
declare function useCapxulWithdraw(): UseCapxulWithdrawReturn;
|
|
118
|
+
type UseCapxulPaymentsReturn = UseQueryResult<readonly Payment[], CapxulError>;
|
|
119
|
+
declare function useCapxulPayments(options?: {
|
|
120
|
+
readonly enabled?: boolean;
|
|
121
|
+
}): UseCapxulPaymentsReturn;
|
|
122
|
+
type UseCapxulPaymentReturn = UseQueryResult<Payment | null, CapxulError>;
|
|
123
|
+
declare function useCapxulPayment(paymentId: string | undefined, options?: {
|
|
124
|
+
readonly enabled?: boolean;
|
|
125
|
+
}): UseCapxulPaymentReturn;
|
|
126
|
+
//#endregion
|
|
217
127
|
//#region src/hooks/use-capxul-orgs.d.ts
|
|
218
128
|
/**
|
|
219
129
|
* List the Orgs you belong to (canon §C1 "Org list" / §C3). Binds directly to
|
|
@@ -232,18 +142,6 @@ type UseCapxulOrgsOptions = {
|
|
|
232
142
|
};
|
|
233
143
|
declare function useCapxulOrgs(options?: UseCapxulOrgsOptions): UseCapxulOrgsReturn;
|
|
234
144
|
//#endregion
|
|
235
|
-
//#region src/hooks/use-capxul-org.d.ts
|
|
236
|
-
type UseCapxulOrgOptions = {
|
|
237
|
-
readonly enabled?: boolean;
|
|
238
|
-
};
|
|
239
|
-
/**
|
|
240
|
-
* A single Org you belong to, resolved from `capxul.orgs()` and narrowed to the
|
|
241
|
-
* requested `orgId` (canon §C3). Returns `null` when the Org is not in your list.
|
|
242
|
-
* Gated by `orgId !== undefined`. RED until S1.
|
|
243
|
-
*/
|
|
244
|
-
type UseCapxulOrgReturn = UseQueryResult<OrgView | null, CapxulError>;
|
|
245
|
-
declare function useCapxulOrg(orgId: OrgId | undefined, options?: UseCapxulOrgOptions): UseCapxulOrgReturn;
|
|
246
|
-
//#endregion
|
|
247
145
|
//#region src/hooks/use-capxul-org-members.d.ts
|
|
248
146
|
type UseCapxulOrgMembersOptions = {
|
|
249
147
|
readonly enabled?: boolean;
|
|
@@ -251,7 +149,8 @@ type UseCapxulOrgMembersOptions = {
|
|
|
251
149
|
/**
|
|
252
150
|
* The members of an Org (canon §C1 "Members" / §C3, D8/D9). Binds directly to
|
|
253
151
|
* the entity-scoped `capxul.org(orgId).members()` (D13). Gated by
|
|
254
|
-
* `orgId !== undefined
|
|
152
|
+
* `orgId !== undefined`; callers may additionally gate on canonical identity
|
|
153
|
+
* readiness through `options.enabled`.
|
|
255
154
|
*/
|
|
256
155
|
type UseCapxulOrgMembersReturn = UseQueryResult<readonly MemberView[], CapxulError>;
|
|
257
156
|
declare function useCapxulOrgMembers(orgId: OrgId | undefined, options?: UseCapxulOrgMembersOptions): UseCapxulOrgMembersReturn;
|
|
@@ -282,7 +181,7 @@ type UseCapxulOrgTreasuryOptions = {
|
|
|
282
181
|
* directly to the entity-scoped `capxul.org(orgId).treasury()` (D13). Gated by
|
|
283
182
|
* `orgId !== undefined`. RED until S1.
|
|
284
183
|
*/
|
|
285
|
-
type UseCapxulOrgTreasuryReturn = UseQueryResult<Account
|
|
184
|
+
type UseCapxulOrgTreasuryReturn = UseQueryResult<Account, CapxulError>;
|
|
286
185
|
declare function useCapxulOrgTreasury(orgId: OrgId | undefined, options?: UseCapxulOrgTreasuryOptions): UseCapxulOrgTreasuryReturn;
|
|
287
186
|
//#endregion
|
|
288
187
|
//#region src/hooks/use-capxul-create-org.d.ts
|
|
@@ -294,31 +193,6 @@ declare function useCapxulOrgTreasury(orgId: OrgId | undefined, options?: UseCap
|
|
|
294
193
|
type UseCapxulCreateOrgReturn = UseMutationResult<OrgView, CapxulError, CreateOrgInput>;
|
|
295
194
|
declare function useCapxulCreateOrg(): UseCapxulCreateOrgReturn;
|
|
296
195
|
//#endregion
|
|
297
|
-
//#region src/hooks/use-capxul-complete-personal-onboarding.d.ts
|
|
298
|
-
/**
|
|
299
|
-
* Complete personal onboarding (D-ONBOARD · #669). Binds to
|
|
300
|
-
* `capxul.onboarding.completePersonal(input)`: persist the user's first identity
|
|
301
|
-
* profile + trigger provisioning, then return the leak-safe `{ lifecycle }`. A
|
|
302
|
-
* mutation, NOT an effect — call `mutateAsync` from a submit handler and route
|
|
303
|
-
* on `lifecycle.status` (see `docs/onboarding.md`). On success it invalidates the
|
|
304
|
-
* identity + account-lifecycle queries so the dashboard/provisioning screen
|
|
305
|
-
* reactively reflects the new state. No effect hooks — a handler + a query.
|
|
306
|
-
*/
|
|
307
|
-
type UseCapxulCompletePersonalOnboardingReturn = UseMutationResult<CompletePersonalOnboardingResult, CapxulError, CompletePersonalOnboardingInput>;
|
|
308
|
-
declare function useCapxulCompletePersonalOnboarding(): UseCapxulCompletePersonalOnboardingReturn;
|
|
309
|
-
//#endregion
|
|
310
|
-
//#region src/hooks/use-capxul-complete-organization-onboarding.d.ts
|
|
311
|
-
/**
|
|
312
|
-
* Complete organization onboarding (D-ONBOARD · #669). Binds to
|
|
313
|
-
* `capxul.onboarding.completeOrganization(input)`: persist the founder's identity
|
|
314
|
-
* profile, create the Org (reusing `createOrg`), trigger provisioning, and return
|
|
315
|
-
* `{ org, lifecycle }`. Scope every later org call via `capxul.org(org.id).*`. A
|
|
316
|
-
* mutation, NOT an effect. On success it invalidates the identity, account-
|
|
317
|
-
* lifecycle, and org-list queries. No effect hooks — a handler + a query.
|
|
318
|
-
*/
|
|
319
|
-
type UseCapxulCompleteOrganizationOnboardingReturn = UseMutationResult<CompleteOrganizationOnboardingResult, CapxulError, CompleteOrganizationOnboardingInput>;
|
|
320
|
-
declare function useCapxulCompleteOrganizationOnboarding(): UseCapxulCompleteOrganizationOnboardingReturn;
|
|
321
|
-
//#endregion
|
|
322
196
|
//#region src/hooks/use-capxul-invite-member.d.ts
|
|
323
197
|
/**
|
|
324
198
|
* Invite a member to an Org by email (canon §C2 J2 virality loop / §C3, S3, D8).
|
|
@@ -354,25 +228,132 @@ declare function useCapxulRemoveMember(orgId: OrgId | undefined): UseCapxulRemov
|
|
|
354
228
|
type UseCapxulAssignRoleReturn = UseMutationResult<MemberView, CapxulError, AssignRoleInput>;
|
|
355
229
|
declare function useCapxulAssignRole(orgId: OrgId | undefined): UseCapxulAssignRoleReturn;
|
|
356
230
|
//#endregion
|
|
357
|
-
//#region src/
|
|
358
|
-
type
|
|
359
|
-
|
|
231
|
+
//#region src/headless/journey/journey-state.d.ts
|
|
232
|
+
type OnboardingIntent = "personal" | "organization";
|
|
233
|
+
type OnboardingStep = "profile" | "organization" | "provisioning";
|
|
234
|
+
type PayoutDraftChain = "evm" | "solana" | "starknet";
|
|
235
|
+
type PayoutDraftEntry = {
|
|
236
|
+
readonly chain: PayoutDraftChain;
|
|
237
|
+
readonly address: string;
|
|
238
|
+
};
|
|
239
|
+
type ProfileDraft = {
|
|
240
|
+
readonly displayName: string;
|
|
241
|
+
readonly country: string;
|
|
242
|
+
readonly withdrawalAddress: string;
|
|
243
|
+
readonly username?: string;
|
|
244
|
+
readonly payoutAddresses?: readonly PayoutDraftEntry[];
|
|
245
|
+
};
|
|
246
|
+
type OrganizationDraft = {
|
|
247
|
+
readonly name: string;
|
|
248
|
+
readonly handle: string;
|
|
249
|
+
readonly country: string;
|
|
250
|
+
readonly bio?: string;
|
|
251
|
+
readonly size?: string;
|
|
252
|
+
};
|
|
253
|
+
type OnboardingOrigin = {
|
|
254
|
+
readonly kind: "personal";
|
|
255
|
+
} | {
|
|
256
|
+
readonly kind: "organization";
|
|
257
|
+
readonly organizationId: string;
|
|
258
|
+
} | {
|
|
259
|
+
readonly kind: "proof";
|
|
260
|
+
readonly organizationId?: string;
|
|
261
|
+
};
|
|
262
|
+
type OnboardingJourney = {
|
|
263
|
+
readonly version: 1;
|
|
264
|
+
readonly ownerId: string;
|
|
265
|
+
readonly journeyId: string;
|
|
266
|
+
readonly intent: OnboardingIntent;
|
|
267
|
+
readonly entryPoint: "signup" | "dashboard";
|
|
268
|
+
readonly origin?: OnboardingOrigin;
|
|
269
|
+
readonly step: OnboardingStep;
|
|
270
|
+
readonly profile?: ProfileDraft;
|
|
271
|
+
readonly organization?: OrganizationDraft;
|
|
272
|
+
readonly stableHandle?: string;
|
|
273
|
+
readonly organizationId?: string;
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* The app-facing projection input: where a resumed journey stands. Consumers
|
|
277
|
+
* map this to their own routes.
|
|
278
|
+
*/
|
|
279
|
+
type OnboardingJourneyPosition = {
|
|
280
|
+
readonly intent: OnboardingIntent;
|
|
281
|
+
readonly step: OnboardingStep;
|
|
282
|
+
readonly organizationId?: string;
|
|
283
|
+
readonly proof: boolean;
|
|
284
|
+
};
|
|
285
|
+
declare function startOnboardingJourney(input: {
|
|
286
|
+
readonly intent: OnboardingIntent;
|
|
287
|
+
readonly ownerId: string;
|
|
288
|
+
readonly entryPoint: "signup" | "dashboard";
|
|
289
|
+
readonly origin?: OnboardingOrigin;
|
|
290
|
+
readonly step?: OnboardingStep;
|
|
291
|
+
}): OnboardingJourney;
|
|
292
|
+
declare function loadOnboardingJourney(expectedOwnerId?: string): OnboardingJourney | null;
|
|
293
|
+
declare function saveOnboardingJourney(journey: OnboardingJourney): void;
|
|
294
|
+
declare function currentOnboardingJourneyId(): string | undefined;
|
|
295
|
+
/** Stop observation attribution while no authenticated owner is established. */
|
|
296
|
+
declare function invalidateOnboardingJourneyObservation(): void;
|
|
297
|
+
/** Where the journey stands — the pure position apps map to their routes. */
|
|
298
|
+
declare function onboardingJourneyPosition(journey: OnboardingJourney): OnboardingJourneyPosition;
|
|
299
|
+
/**
|
|
300
|
+
* The interruption-recovery decision (behavior map §4): a journey that does
|
|
301
|
+
* not match the ready destination the app just rendered must resume; a
|
|
302
|
+
* matching one needs no recovery. Returns the journey to resume, or null.
|
|
303
|
+
*/
|
|
304
|
+
declare function activeOnboardingRecovery(ownerId: string, renderedReadyDestination?: {
|
|
305
|
+
readonly kind: "personal";
|
|
306
|
+
} | {
|
|
307
|
+
readonly kind: "organization";
|
|
308
|
+
readonly organizationId: string;
|
|
309
|
+
}): OnboardingJourney | null;
|
|
310
|
+
declare function acknowledgeOnboardingDestination(destination: {
|
|
311
|
+
readonly kind: "personal";
|
|
312
|
+
} | {
|
|
313
|
+
readonly kind: "organization";
|
|
314
|
+
readonly organizationId: string;
|
|
315
|
+
}, ownerId: string): boolean;
|
|
316
|
+
declare function clearOnboardingJourney(): void;
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/headless/onboarding/use-capxul-username-availability.d.ts
|
|
319
|
+
type UsernameAvailability = {
|
|
320
|
+
readonly available: boolean;
|
|
321
|
+
readonly normalized: string;
|
|
322
|
+
};
|
|
323
|
+
type UseCapxulUsernameAvailabilityReturn = UseQueryResult<UsernameAvailability, CapxulError>;
|
|
324
|
+
/**
|
|
325
|
+
* #1062: debounced availability probe for the username the user is typing.
|
|
326
|
+
* Disabled until the candidate reaches the 3-character floor; a malformed or
|
|
327
|
+
* reserved candidate surfaces as the query's error (INVALID_INPUT with the
|
|
328
|
+
* boundary's message), not as `available: false` — only a username someone
|
|
329
|
+
* else owns is "taken".
|
|
330
|
+
*/
|
|
331
|
+
declare function useCapxulUsernameAvailability(username: string, options?: {
|
|
332
|
+
readonly enabled?: boolean;
|
|
333
|
+
readonly debounceMs?: number;
|
|
334
|
+
}): UseCapxulUsernameAvailabilityReturn;
|
|
335
|
+
//#endregion
|
|
336
|
+
//#region src/headless/media/use-capxul-image-upload.d.ts
|
|
337
|
+
type ImageUploadTarget = {
|
|
338
|
+
readonly kind: "profile";
|
|
339
|
+
} | {
|
|
340
|
+
readonly kind: "orgLogo";
|
|
341
|
+
readonly orgId: string;
|
|
342
|
+
};
|
|
343
|
+
type ImageUploadInput = {
|
|
344
|
+
readonly blob: Blob;
|
|
345
|
+
readonly target: ImageUploadTarget;
|
|
360
346
|
};
|
|
347
|
+
type UseCapxulImageUploadReturn = UseMutationResult<{
|
|
348
|
+
readonly url: string | null;
|
|
349
|
+
}, CapxulError, ImageUploadInput>;
|
|
361
350
|
/**
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
* effect. It exists as the stable mutation seam the headless
|
|
367
|
-
* `CapxulEntitySwitcher` drives; the actual context switch is the consumer's
|
|
368
|
-
* own local state, applied through the component's `onSwitchPersonal` /
|
|
369
|
-
* `onSwitchOrg` callbacks.
|
|
370
|
-
*
|
|
371
|
-
* The legacy `org_entity_switched` telemetry emission was removed when master's
|
|
372
|
-
* unified telemetry pipeline (#402) dropped that event from the Layer 0 spine.
|
|
351
|
+
* #1061 / ADR-0014: the whole upload→record sequence as one mutation —
|
|
352
|
+
* upload the blob, then bind the returned storage id to the profile image or
|
|
353
|
+
* the org logo. The url is the resolved serving URL (re-read from queries,
|
|
354
|
+
* never persisted by consumers).
|
|
373
355
|
*/
|
|
374
|
-
|
|
375
|
-
declare function useCapxulSwitchActingEntity(): UseCapxulSwitchActingEntityReturn;
|
|
356
|
+
declare function useCapxulImageUpload(): UseCapxulImageUploadReturn;
|
|
376
357
|
//#endregion
|
|
377
|
-
export { type CapxulBootstrapState, type CapxulBootstrapStatus, CapxulProvider, type CapxulProviderProps, type
|
|
358
|
+
export { type AccountFailure, type AccountProgress, type ActionResult, type AuthenticatedState, type AuthenticationSlots, type CapxulAuth, CapxulAuthenticationController, type CapxulBootstrapState, type CapxulBootstrapStatus, CapxulOnboardingController, CapxulProvider, type CapxulProviderProps, type CapxulSend, type ControllerAction, type CreateOrganizationSubmission, type Destination, type FaultedState, type ImageUploadInput, type ImageUploadTarget, type InvocationOptions, type NavigationAction, type OnboardingControllerProps, type OnboardingIntent, type OnboardingJourney, type OnboardingJourneyPosition, type OnboardingOrigin, type OnboardingStep, type OrgFailure, type OrgProgress, type OrganizationDetails, type OrganizationDraft, type OtpPendingState, type PayoutDraftChain, type PayoutDraftEntry, type PendingAuthState, type ProfileDetails, type ProfileDraft, type ProfileSlotProps, type ReadyDestination, type RetryAction, type SendResult, type SignedOutState, type Slot, type UseCapxulAccountBalanceOptions, type UseCapxulAccountBalanceReturn, type UseCapxulAccountFundReturn, type UseCapxulAssignRoleReturn, type UseCapxulCreateOrgReturn, type UseCapxulImageUploadReturn, type UseCapxulInviteMemberReturn, type UseCapxulOrgDeployRolesReturn, type UseCapxulOrgMembersOptions, type UseCapxulOrgMembersReturn, type UseCapxulOrgRolesOptions, type UseCapxulOrgRolesReturn, type UseCapxulOrgTreasuryOptions, type UseCapxulOrgTreasuryReturn, type UseCapxulOrgsReturn, type UseCapxulPayReturn, type UseCapxulPaymentReturn, type UseCapxulPaymentsReturn, type UseCapxulPayoutReturn, type UseCapxulProfileReturn, type UseCapxulRemoveMemberReturn, type UseCapxulSubAccountCreateReturn, type UseCapxulSubAccountDeleteReturn, type UseCapxulSubAccountRenameReturn, type UseCapxulSubAccountsListOptions, type UseCapxulSubAccountsListReturn, type UseCapxulTransferReturn, type UseCapxulUsernameAvailabilityReturn, type UseCapxulWithdrawReturn, type UsernameAvailability, acknowledgeOnboardingDestination, activeOnboardingRecovery, clearOnboardingJourney, currentOnboardingJourneyId, entered, invalidateOnboardingJourneyObservation, loadOnboardingJourney, onboardingJourneyPosition, saveOnboardingJourney, startOnboardingJourney, useCapxul, useCapxulAccountBalance, useCapxulAccountFund, useCapxulAssignRole, useCapxulAuth, useCapxulClientOrNull, useCapxulCreateOrg, useCapxulDestination, useCapxulIdentity, useCapxulImageUpload, useCapxulInviteMember, useCapxulOrgDeployRoles, useCapxulOrgMembers, useCapxulOrgRoles, useCapxulOrgTreasury, useCapxulOrgs, useCapxulPay, useCapxulPayment, useCapxulPayments, useCapxulPayout, useCapxulProfile, useCapxulRemoveMember, useCapxulSend, useCapxulSubAccountCreate, useCapxulSubAccountDelete, useCapxulSubAccountRename, useCapxulSubAccountsList, useCapxulTransfer, useCapxulTransitions, useCapxulUsernameAvailability, useCapxulWithdraw };
|
|
378
359
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/provider.tsx","
|
|
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-profile.ts","../src/hooks/use-capxul-account-balance.ts","../src/hooks/use-capxul-account-fund.ts","../src/hooks/use-capxul-sub-accounts.ts","../src/hooks/use-capxul-money.ts","../src/hooks/use-capxul-orgs.ts","../src/hooks/use-capxul-org-members.ts","../src/hooks/use-capxul-org-roles.ts","../src/hooks/use-capxul-org-deploy-roles.ts","../src/hooks/use-capxul-org-treasury.ts","../src/hooks/use-capxul-create-org.ts","../src/hooks/use-capxul-invite-member.ts","../src/hooks/use-capxul-remove-member.ts","../src/hooks/use-capxul-assign-role.ts","../src/headless/journey/journey-state.ts","../src/headless/onboarding/use-capxul-username-availability.ts","../src/headless/media/use-capxul-image-upload.ts"],"mappings":";;;;;;KAwCK,yBAAA;iFAEM,WAAA,GAAc,WAAA;EAAA,SACd,QAAA,EAAU,SAAS;AAAA;;KAIzB,iCAAA,GAAoC,yBAAA;EAAA,SAC9B,cAAA;EAAA,SACA,MAAA,UANA;EAAA,SAQA,WAAA,GAAc,kBAAA;EARK;AAAA;AAAA;;;EAAA,SAcnB,SAAA,GAAY,aAAA,EANE;EAAA,SAQd,WAAA,GAAc,kBAAA;EAAA;;;;EAAA,SAKd,MAAA,G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