@capxul/sdk-react 1.0.0-alpha.11 → 1.0.0-alpha.13
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 +103 -65
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +214 -50
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -172,7 +172,7 @@ const CAPXUL_ERROR_CODES = [
|
|
|
172
172
|
"CANCELLED",
|
|
173
173
|
"WRONG_STATE"
|
|
174
174
|
];
|
|
175
|
-
var CapxulError = class extends Error {
|
|
175
|
+
var CapxulError$1 = class extends Error {
|
|
176
176
|
code;
|
|
177
177
|
details;
|
|
178
178
|
correlationId;
|
|
@@ -187,32 +187,32 @@ var CapxulError = class extends Error {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
function isCapxulError(value) {
|
|
190
|
-
return value instanceof CapxulError;
|
|
190
|
+
return value instanceof CapxulError$1;
|
|
191
191
|
}
|
|
192
192
|
const Errors = {
|
|
193
|
-
notAuthenticated: (message, opts) => new CapxulError("NOT_AUTHENTICATED", message ?? "Not authenticated", opts?.failure_mode ? { details: { failure_mode: opts.failure_mode } } : void 0),
|
|
194
|
-
emailDeliveryFailed: (detail) => new CapxulError("EMAIL_DELIVERY_FAILED", "Failed to send email", { details: { detail } }),
|
|
195
|
-
profileNotFound: (authUserId) => new CapxulError("PROFILE_NOT_FOUND", `Profile not found for user ${authUserId}`, { details: { authUserId } }),
|
|
196
|
-
smartAccountMissing: (authUserId) => new CapxulError("SMART_ACCOUNT_MISSING", "Smart account not provisioned", { details: { authUserId } }),
|
|
197
|
-
playerNotFound: (playerId) => new CapxulError("PLAYER_NOT_FOUND", playerId ? `Openfort player ${playerId} not found` : "Openfort player not found", playerId === void 0 ? void 0 : { details: { playerId } }),
|
|
198
|
-
accountNotFound: (accountId) => new CapxulError("ACCOUNT_NOT_FOUND", accountId ? `Openfort account ${accountId} not found` : "Openfort account not found", accountId === void 0 ? void 0 : { details: { accountId } }),
|
|
193
|
+
notAuthenticated: (message, opts) => new CapxulError$1("NOT_AUTHENTICATED", message ?? "Not authenticated", opts?.failure_mode ? { details: { failure_mode: opts.failure_mode } } : void 0),
|
|
194
|
+
emailDeliveryFailed: (detail) => new CapxulError$1("EMAIL_DELIVERY_FAILED", "Failed to send email", { details: { detail } }),
|
|
195
|
+
profileNotFound: (authUserId) => new CapxulError$1("PROFILE_NOT_FOUND", `Profile not found for user ${authUserId}`, { details: { authUserId } }),
|
|
196
|
+
smartAccountMissing: (authUserId) => new CapxulError$1("SMART_ACCOUNT_MISSING", "Smart account not provisioned", { details: { authUserId } }),
|
|
197
|
+
playerNotFound: (playerId) => new CapxulError$1("PLAYER_NOT_FOUND", playerId ? `Openfort player ${playerId} not found` : "Openfort player not found", playerId === void 0 ? void 0 : { details: { playerId } }),
|
|
198
|
+
accountNotFound: (accountId) => new CapxulError$1("ACCOUNT_NOT_FOUND", accountId ? `Openfort account ${accountId} not found` : "Openfort account not found", accountId === void 0 ? void 0 : { details: { accountId } }),
|
|
199
199
|
providerError: (provider, operation, cause, opts) => {
|
|
200
200
|
const details = {
|
|
201
201
|
provider,
|
|
202
202
|
operation
|
|
203
203
|
};
|
|
204
204
|
if (opts?.failure_mode) details.failure_mode = opts.failure_mode;
|
|
205
|
-
return new CapxulError("PROVIDER_ERROR", `Provider error: ${provider} ${operation}`, {
|
|
205
|
+
return new CapxulError$1("PROVIDER_ERROR", `Provider error: ${provider} ${operation}`, {
|
|
206
206
|
cause,
|
|
207
207
|
details
|
|
208
208
|
});
|
|
209
209
|
},
|
|
210
|
-
invalidInput: (field, reason) => new CapxulError("INVALID_INPUT", `Invalid ${field}: ${reason}`, { details: {
|
|
210
|
+
invalidInput: (field, reason) => new CapxulError$1("INVALID_INPUT", `Invalid ${field}: ${reason}`, { details: {
|
|
211
211
|
field,
|
|
212
212
|
reason
|
|
213
213
|
} }),
|
|
214
|
-
envMissing: (name) => new CapxulError("ENV_MISSING", `Environment variable ${name} not configured`, { details: { name } }),
|
|
215
|
-
notImplemented: (domain, method) => new CapxulError("NOT_IMPLEMENTED", `${domain}.${method} is not yet implemented. This feature is planned for a future release.`, { details: {
|
|
214
|
+
envMissing: (name) => new CapxulError$1("ENV_MISSING", `Environment variable ${name} not configured`, { details: { name } }),
|
|
215
|
+
notImplemented: (domain, method) => new CapxulError$1("NOT_IMPLEMENTED", `${domain}.${method} is not yet implemented. This feature is planned for a future release.`, { details: {
|
|
216
216
|
domain,
|
|
217
217
|
method
|
|
218
218
|
} }),
|
|
@@ -225,7 +225,7 @@ const Errors = {
|
|
|
225
225
|
* message string. The redacted message names the timeout budget; the
|
|
226
226
|
* native `cause` carries the same information for `reportError` fidelity.
|
|
227
227
|
*/
|
|
228
|
-
providerTimeout: (provider, operation, timeoutMs) => new CapxulError("PROVIDER_ERROR", `Provider error: ${provider} ${operation} (timeout exceeded ${timeoutMs}ms)`, {
|
|
228
|
+
providerTimeout: (provider, operation, timeoutMs) => new CapxulError$1("PROVIDER_ERROR", `Provider error: ${provider} ${operation} (timeout exceeded ${timeoutMs}ms)`, {
|
|
229
229
|
details: {
|
|
230
230
|
provider,
|
|
231
231
|
operation,
|
|
@@ -234,14 +234,14 @@ const Errors = {
|
|
|
234
234
|
cause: /* @__PURE__ */ new Error(`timeout: ${operation} exceeded ${timeoutMs}ms`)
|
|
235
235
|
}),
|
|
236
236
|
verificationRequired: (details) => {
|
|
237
|
-
return new CapxulError("VERIFICATION_REQUIRED", "rail" in details ? `Verification is required before ${details.rail} can use ${details.currentKind}.` : `Verification tier ${details.requiredTier} is required.`, { details });
|
|
237
|
+
return new CapxulError$1("VERIFICATION_REQUIRED", "rail" in details ? `Verification is required before ${details.rail} can use ${details.currentKind}.` : `Verification tier ${details.requiredTier} is required.`, { details });
|
|
238
238
|
},
|
|
239
|
-
insufficientBalance: (asset, available, required) => new CapxulError("INSUFFICIENT_BALANCE", `Insufficient ${asset} balance`, { details: {
|
|
239
|
+
insufficientBalance: (asset, available, required) => new CapxulError$1("INSUFFICIENT_BALANCE", `Insufficient ${asset} balance`, { details: {
|
|
240
240
|
asset,
|
|
241
241
|
available,
|
|
242
242
|
required
|
|
243
243
|
} }),
|
|
244
|
-
invalidRecipient: (reason) => new CapxulError("INVALID_RECIPIENT", `Invalid recipient: ${reason}`, { details: { reason } }),
|
|
244
|
+
invalidRecipient: (reason) => new CapxulError$1("INVALID_RECIPIENT", `Invalid recipient: ${reason}`, { details: { reason } }),
|
|
245
245
|
/**
|
|
246
246
|
* The org Zodiac Roles modifier REFUSED the spend on-chain (G4 · #547): the
|
|
247
247
|
* member's role condition (per-tx cap, per-day allowance, allowed recipient,
|
|
@@ -252,7 +252,7 @@ const Errors = {
|
|
|
252
252
|
* `disallowed_recipient` / `condition_violation`); leak-safe — no on-chain
|
|
253
253
|
* identifiers ever enter the details.
|
|
254
254
|
*/
|
|
255
|
-
rolePermissionDenied: (details) => new CapxulError("ROLE_PERMISSION_DENIED", `Org role denied this spend on-chain (${details.reason}).`, { details: details.operation === void 0 ? { reason: details.reason } : {
|
|
255
|
+
rolePermissionDenied: (details) => new CapxulError$1("ROLE_PERMISSION_DENIED", `Org role denied this spend on-chain (${details.reason}).`, { details: details.operation === void 0 ? { reason: details.reason } : {
|
|
256
256
|
reason: details.reason,
|
|
257
257
|
operation: details.operation
|
|
258
258
|
} }),
|
|
@@ -263,28 +263,28 @@ const Errors = {
|
|
|
263
263
|
* Roles condition violation) from an inconclusive infra failure. A confirmed
|
|
264
264
|
* revert is the ONLY mode the org spend port may map to a roles denial.
|
|
265
265
|
*/
|
|
266
|
-
transactionFailed: (operation, cause, extra) => new CapxulError("TRANSACTION_FAILED", `Transaction failed: ${operation}`, {
|
|
266
|
+
transactionFailed: (operation, cause, extra) => new CapxulError$1("TRANSACTION_FAILED", `Transaction failed: ${operation}`, {
|
|
267
267
|
cause,
|
|
268
268
|
details: extra?.reason === void 0 ? { operation } : {
|
|
269
269
|
operation,
|
|
270
270
|
reason: extra.reason
|
|
271
271
|
}
|
|
272
272
|
}),
|
|
273
|
-
rateLimited: (details) => new CapxulError("RATE_LIMITED", "Rate limit exceeded", details === void 0 ? void 0 : { details: { ...details } }),
|
|
274
|
-
networkError: (operation, cause) => new CapxulError("NETWORK_ERROR", `Network error during ${operation}`, {
|
|
273
|
+
rateLimited: (details) => new CapxulError$1("RATE_LIMITED", "Rate limit exceeded", details === void 0 ? void 0 : { details: { ...details } }),
|
|
274
|
+
networkError: (operation, cause) => new CapxulError$1("NETWORK_ERROR", `Network error during ${operation}`, {
|
|
275
275
|
cause,
|
|
276
276
|
details: { operation }
|
|
277
277
|
}),
|
|
278
|
-
unknown: (cause) => new CapxulError("UNKNOWN", "Unknown error", { cause }),
|
|
279
|
-
otpExpired: (details) => new CapxulError("OTP_EXPIRED", "Verification code has expired. Request a new one.", details === void 0 ? void 0 : { details: { ...details } }),
|
|
280
|
-
signerRejected: (details) => new CapxulError("SIGNER_REJECTED", "Signer rejected the request.", {
|
|
278
|
+
unknown: (cause) => new CapxulError$1("UNKNOWN", "Unknown error", { cause }),
|
|
279
|
+
otpExpired: (details) => new CapxulError$1("OTP_EXPIRED", "Verification code has expired. Request a new one.", details === void 0 ? void 0 : { details: { ...details } }),
|
|
280
|
+
signerRejected: (details) => new CapxulError$1("SIGNER_REJECTED", "Signer rejected the request.", {
|
|
281
281
|
cause: details.cause,
|
|
282
282
|
details: details.reason === void 0 ? { source: details.source } : {
|
|
283
283
|
source: details.source,
|
|
284
284
|
reason: details.reason
|
|
285
285
|
}
|
|
286
286
|
}),
|
|
287
|
-
cancelled: (details) => new CapxulError("CANCELLED", "Operation was cancelled.", details === void 0 ? void 0 : { details: { ...details } }),
|
|
287
|
+
cancelled: (details) => new CapxulError$1("CANCELLED", "Operation was cancelled.", details === void 0 ? void 0 : { details: { ...details } }),
|
|
288
288
|
/**
|
|
289
289
|
* Method called from a flow state where its precondition fails (TA16). The
|
|
290
290
|
* SDK's method API short-circuits with this error before driving the
|
|
@@ -293,7 +293,7 @@ const Errors = {
|
|
|
293
293
|
* `docs/canon/decisions/state-machine-substrate.md`); `validStates`
|
|
294
294
|
* enumerates the states the method accepts.
|
|
295
295
|
*/
|
|
296
|
-
wrongState: (details) => new CapxulError("WRONG_STATE", `${details.method} called from state '${details.currentState}'; valid states: ${details.validStates.join(", ")}`, { details: {
|
|
296
|
+
wrongState: (details) => new CapxulError$1("WRONG_STATE", `${details.method} called from state '${details.currentState}'; valid states: ${details.validStates.join(", ")}`, { details: {
|
|
297
297
|
...details,
|
|
298
298
|
validStates: [...details.validStates]
|
|
299
299
|
} })
|
|
@@ -319,7 +319,48 @@ function requireBootstrappedClient(client, method) {
|
|
|
319
319
|
//#region src/internal/reactivity-keys.ts
|
|
320
320
|
function actorKey(actor) {
|
|
321
321
|
if (actor === void 0) return ["pending"];
|
|
322
|
-
|
|
322
|
+
if (actor.kind === "account" || actor.kind === "personal") return ["account"];
|
|
323
|
+
if (actor.kind === "org") return ["org", actor.orgId];
|
|
324
|
+
return ["org", actor.organizationId];
|
|
325
|
+
}
|
|
326
|
+
function targetKey(target) {
|
|
327
|
+
if (target === void 0) return "all";
|
|
328
|
+
switch (target.kind) {
|
|
329
|
+
case "handle": return `handle:${target.handle}`;
|
|
330
|
+
case "email": return `email:${target.email}`;
|
|
331
|
+
case "organization": return `organization:${target.handle}`;
|
|
332
|
+
case "orgHandle": return `organization:${target.orgHandle}`;
|
|
333
|
+
case "payee": return `payee:${target.id}`;
|
|
334
|
+
case "payeeId": return `payee:${target.payeeId}`;
|
|
335
|
+
case "destination": return `destination:${target.id}`;
|
|
336
|
+
case "capxulUserId": return `capxulUserId:${target.capxulUserId}`;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
function activityKey(params) {
|
|
340
|
+
if (params === void 0) return "default";
|
|
341
|
+
return JSON.stringify({
|
|
342
|
+
actor: actorKey(params.actor),
|
|
343
|
+
cursor: params.cursor ?? null,
|
|
344
|
+
limit: params.limit ?? null,
|
|
345
|
+
paymentType: params.paymentType ?? null,
|
|
346
|
+
timing: params.timing ?? null
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
function destinationListKey(input) {
|
|
350
|
+
if (input === void 0) return "pending";
|
|
351
|
+
return JSON.stringify({
|
|
352
|
+
actor: actorKey(input.actor),
|
|
353
|
+
target: targetKey(input.target ?? input.ref),
|
|
354
|
+
kind: input.kind ?? null
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
function offrampQuoteKey(input) {
|
|
358
|
+
if (input === void 0) return "pending";
|
|
359
|
+
return JSON.stringify({
|
|
360
|
+
actor: actorKey(input.actor),
|
|
361
|
+
destinationId: input.destinationId,
|
|
362
|
+
amount: input.amount
|
|
363
|
+
});
|
|
323
364
|
}
|
|
324
365
|
const capxulKeys = {
|
|
325
366
|
session: ["capxul", "session"],
|
|
@@ -329,6 +370,7 @@ const capxulKeys = {
|
|
|
329
370
|
provisioning: ["capxul", "provisioning"],
|
|
330
371
|
binding: ["capxul", "binding"],
|
|
331
372
|
accountBalance: ["capxul", "accountBalance"],
|
|
373
|
+
currentUser: ["capxul", "currentUser"],
|
|
332
374
|
subAccounts: (accountId) => [
|
|
333
375
|
"capxul",
|
|
334
376
|
"subAccounts",
|
|
@@ -358,6 +400,18 @@ const capxulKeys = {
|
|
|
358
400
|
orgId ?? "pending",
|
|
359
401
|
"treasury"
|
|
360
402
|
],
|
|
403
|
+
orgAccount: (orgId) => [
|
|
404
|
+
"capxul",
|
|
405
|
+
"org",
|
|
406
|
+
orgId ?? "pending",
|
|
407
|
+
"account"
|
|
408
|
+
],
|
|
409
|
+
orgAuditLog: (orgId) => [
|
|
410
|
+
"capxul",
|
|
411
|
+
"org",
|
|
412
|
+
orgId ?? "pending",
|
|
413
|
+
"auditLog"
|
|
414
|
+
],
|
|
361
415
|
actorAddressBook: (actor) => [
|
|
362
416
|
"capxul",
|
|
363
417
|
"actor",
|
|
@@ -417,6 +471,29 @@ const capxulKeys = {
|
|
|
417
471
|
"destinations",
|
|
418
472
|
refKey ?? "pending"
|
|
419
473
|
],
|
|
474
|
+
destinationsScope: ["capxul", "destinations"],
|
|
475
|
+
destinations: (input) => [
|
|
476
|
+
"capxul",
|
|
477
|
+
"destinations",
|
|
478
|
+
destinationListKey(input)
|
|
479
|
+
],
|
|
480
|
+
activity: (params) => [
|
|
481
|
+
"capxul",
|
|
482
|
+
"activity",
|
|
483
|
+
activityKey(params)
|
|
484
|
+
],
|
|
485
|
+
offrampQuote: (input) => [
|
|
486
|
+
"capxul",
|
|
487
|
+
"offramp",
|
|
488
|
+
"quote",
|
|
489
|
+
offrampQuoteKey(input)
|
|
490
|
+
],
|
|
491
|
+
offrampStatus: (offrampId) => [
|
|
492
|
+
"capxul",
|
|
493
|
+
"offramp",
|
|
494
|
+
"status",
|
|
495
|
+
offrampId ?? "pending"
|
|
496
|
+
],
|
|
420
497
|
payments: ["capxul", "payments"],
|
|
421
498
|
payment: (paymentId) => [
|
|
422
499
|
"capxul",
|
|
@@ -474,6 +551,19 @@ function useCapxulProfile() {
|
|
|
474
551
|
});
|
|
475
552
|
}
|
|
476
553
|
//#endregion
|
|
554
|
+
//#region src/hooks/use-capxul-current-user.ts
|
|
555
|
+
function useCapxulCurrentUser(options) {
|
|
556
|
+
const client = useCapxulClientOrNull();
|
|
557
|
+
return useQuery({
|
|
558
|
+
queryKey: capxulKeys.currentUser,
|
|
559
|
+
queryFn: async () => {
|
|
560
|
+
const bootstrappedClient = requireBootstrappedClient(client, "currentUser.get");
|
|
561
|
+
return unwrapCapxulResult(await bootstrappedClient.currentUser.get(), bootstrappedClient._internal.telemetry);
|
|
562
|
+
},
|
|
563
|
+
enabled: client !== null && (options?.enabled ?? true)
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
//#endregion
|
|
477
567
|
//#region src/internal/is-vitest-runtime.ts
|
|
478
568
|
/** True under Vitest — disables hook polling intervals that fight fake timers. */
|
|
479
569
|
function isVitestRuntime() {
|
|
@@ -711,8 +801,11 @@ async function invalidateMoneyState(queryClient, input) {
|
|
|
711
801
|
queryClient.invalidateQueries({ queryKey: capxulKeys.actorInsightsHistory(input.actor) })
|
|
712
802
|
];
|
|
713
803
|
if (input.payment !== void 0) invalidations.push(queryClient.invalidateQueries({ queryKey: capxulKeys.payment(input.payment.id) }));
|
|
714
|
-
if (input.actor.kind === "account") invalidations.push(queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance }));
|
|
715
|
-
else
|
|
804
|
+
if (input.actor.kind === "account" || input.actor.kind === "personal") invalidations.push(queryClient.invalidateQueries({ queryKey: capxulKeys.accountBalance }));
|
|
805
|
+
else {
|
|
806
|
+
const orgId = input.actor.kind === "org" ? input.actor.orgId : input.actor.organizationId;
|
|
807
|
+
invalidations.push(queryClient.invalidateQueries({ queryKey: capxulKeys.orgAccount(orgId) }), queryClient.invalidateQueries({ queryKey: capxulKeys.orgTreasury(orgId) }));
|
|
808
|
+
}
|
|
716
809
|
if (input.includeAddressBook === true) invalidations.push(queryClient.invalidateQueries({ queryKey: capxulKeys.actorAddressBook(input.actor) }));
|
|
717
810
|
await Promise.all(invalidations);
|
|
718
811
|
}
|
|
@@ -728,7 +821,7 @@ function useCapxulPay() {
|
|
|
728
821
|
},
|
|
729
822
|
onSuccess: async (payment) => {
|
|
730
823
|
await invalidateMoneyState(queryClient, {
|
|
731
|
-
actor: { kind: "
|
|
824
|
+
actor: { kind: "personal" },
|
|
732
825
|
payment,
|
|
733
826
|
includeAddressBook: true
|
|
734
827
|
});
|
|
@@ -745,7 +838,7 @@ function useCapxulPayout() {
|
|
|
745
838
|
},
|
|
746
839
|
onSuccess: async (payment, variables) => {
|
|
747
840
|
await invalidateMoneyState(queryClient, {
|
|
748
|
-
actor: variables.actor ?? { kind: "
|
|
841
|
+
actor: variables.actor ?? { kind: "personal" },
|
|
749
842
|
payment
|
|
750
843
|
});
|
|
751
844
|
}
|
|
@@ -761,7 +854,23 @@ function useCapxulWithdraw() {
|
|
|
761
854
|
},
|
|
762
855
|
onSuccess: async (payment) => {
|
|
763
856
|
await invalidateMoneyState(queryClient, {
|
|
764
|
-
actor: { kind: "
|
|
857
|
+
actor: { kind: "personal" },
|
|
858
|
+
payment
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
function useCapxulCancelPayment() {
|
|
864
|
+
const client = useCapxulClientOrNull();
|
|
865
|
+
const queryClient = useQueryClient();
|
|
866
|
+
return useMutation({
|
|
867
|
+
mutationFn: async (paymentId) => {
|
|
868
|
+
const bootstrappedClient = requireBootstrappedClient(client, "payments.cancel");
|
|
869
|
+
return unwrapCapxulResult(await bootstrappedClient.payments.cancel(paymentId), bootstrappedClient._internal.telemetry, "mutation");
|
|
870
|
+
},
|
|
871
|
+
onSuccess: async (payment) => {
|
|
872
|
+
await invalidateMoneyState(queryClient, {
|
|
873
|
+
actor: { kind: "personal" },
|
|
765
874
|
payment
|
|
766
875
|
});
|
|
767
876
|
}
|
|
@@ -948,24 +1057,12 @@ function useCapxulInsightsHistory(actor, options) {
|
|
|
948
1057
|
}
|
|
949
1058
|
//#endregion
|
|
950
1059
|
//#region src/hooks/use-capxul-destinations.ts
|
|
951
|
-
function refKeyForRef(ref) {
|
|
952
|
-
switch (ref.kind) {
|
|
953
|
-
case "handle": return `handle:${ref.handle}`;
|
|
954
|
-
case "email": return `email:${ref.email}`;
|
|
955
|
-
case "orgHandle": return `orgHandle:${ref.orgHandle}`;
|
|
956
|
-
case "capxulUserId": return `capxulUserId:${ref.capxulUserId}`;
|
|
957
|
-
case "payeeId": return `payeeId:${ref.payeeId}`;
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
function refCacheKey(input) {
|
|
961
|
-
return input === void 0 ? void 0 : refKeyForRef(input.ref);
|
|
962
|
-
}
|
|
963
1060
|
function useCapxulDestinations(input, options) {
|
|
964
1061
|
const client = useCapxulClientOrNull();
|
|
965
1062
|
return useQuery({
|
|
966
|
-
queryKey: capxulKeys.
|
|
1063
|
+
queryKey: capxulKeys.destinations(input),
|
|
967
1064
|
queryFn: async () => {
|
|
968
|
-
if (input === void 0) throw Errors.invalidInput("
|
|
1065
|
+
if (input === void 0) throw Errors.invalidInput("input", "required for destinations.list");
|
|
969
1066
|
const bootstrappedClient = requireBootstrappedClient(client, "destinations.list");
|
|
970
1067
|
return unwrapCapxulResult(await bootstrappedClient.destinations.list(input), bootstrappedClient._internal.telemetry);
|
|
971
1068
|
},
|
|
@@ -981,8 +1078,8 @@ function useCapxulAddDestination() {
|
|
|
981
1078
|
return unwrapCapxulResult(await bootstrappedClient.destinations.add(input), bootstrappedClient._internal.telemetry, "mutation");
|
|
982
1079
|
},
|
|
983
1080
|
onSuccess: async (_value, variables) => {
|
|
984
|
-
await queryClient.invalidateQueries({ queryKey: capxulKeys.
|
|
985
|
-
await queryClient.invalidateQueries({ queryKey: capxulKeys.actorAddressBook(variables.actor ?? { kind: "
|
|
1081
|
+
await queryClient.invalidateQueries({ queryKey: capxulKeys.destinationsScope });
|
|
1082
|
+
await queryClient.invalidateQueries({ queryKey: capxulKeys.actorAddressBook(variables.actor ?? { kind: "personal" }) });
|
|
986
1083
|
}
|
|
987
1084
|
});
|
|
988
1085
|
}
|
|
@@ -994,12 +1091,51 @@ function useCapxulRemoveDestination() {
|
|
|
994
1091
|
const bootstrappedClient = requireBootstrappedClient(client, "destinations.remove");
|
|
995
1092
|
return unwrapCapxulResult(await bootstrappedClient.destinations.remove(input), bootstrappedClient._internal.telemetry, "mutation");
|
|
996
1093
|
},
|
|
997
|
-
onSuccess: async (
|
|
998
|
-
await queryClient.invalidateQueries({ queryKey: capxulKeys.
|
|
1094
|
+
onSuccess: async () => {
|
|
1095
|
+
await queryClient.invalidateQueries({ queryKey: capxulKeys.destinationsScope });
|
|
999
1096
|
}
|
|
1000
1097
|
});
|
|
1001
1098
|
}
|
|
1002
1099
|
//#endregion
|
|
1100
|
+
//#region src/hooks/use-capxul-activity.ts
|
|
1101
|
+
function useCapxulActivity(params, options) {
|
|
1102
|
+
const client = useCapxulClientOrNull();
|
|
1103
|
+
return useQuery({
|
|
1104
|
+
queryKey: capxulKeys.activity(params),
|
|
1105
|
+
queryFn: async () => {
|
|
1106
|
+
const bootstrappedClient = requireBootstrappedClient(client, "activity.list");
|
|
1107
|
+
return unwrapCapxulResult(await bootstrappedClient.activity.list(params), bootstrappedClient._internal.telemetry);
|
|
1108
|
+
},
|
|
1109
|
+
enabled: client !== null && (options?.enabled ?? true)
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
//#endregion
|
|
1113
|
+
//#region src/hooks/use-capxul-offramp.ts
|
|
1114
|
+
function useCapxulOfframpQuote(input, options) {
|
|
1115
|
+
const client = useCapxulClientOrNull();
|
|
1116
|
+
return useQuery({
|
|
1117
|
+
queryKey: capxulKeys.offrampQuote(input),
|
|
1118
|
+
queryFn: async () => {
|
|
1119
|
+
if (input === void 0) throw Errors.invalidInput("input", "required for useCapxulOfframpQuote");
|
|
1120
|
+
const bootstrappedClient = requireBootstrappedClient(client, "offramp.quote");
|
|
1121
|
+
return unwrapCapxulResult(await bootstrappedClient.offramp.quote(input), bootstrappedClient._internal.telemetry);
|
|
1122
|
+
},
|
|
1123
|
+
enabled: client !== null && input !== void 0 && (options?.enabled ?? true)
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
function useCapxulOfframpStatus(offrampId, options) {
|
|
1127
|
+
const client = useCapxulClientOrNull();
|
|
1128
|
+
return useQuery({
|
|
1129
|
+
queryKey: capxulKeys.offrampStatus(offrampId),
|
|
1130
|
+
queryFn: async () => {
|
|
1131
|
+
if (offrampId === void 0) throw Errors.invalidInput("offrampId", "required for useCapxulOfframpStatus");
|
|
1132
|
+
const bootstrappedClient = requireBootstrappedClient(client, "offramp.status");
|
|
1133
|
+
return unwrapCapxulResult(await bootstrappedClient.offramp.status(offrampId), bootstrappedClient._internal.telemetry);
|
|
1134
|
+
},
|
|
1135
|
+
enabled: client !== null && offrampId !== void 0 && (options?.enabled ?? true)
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
//#endregion
|
|
1003
1139
|
//#region src/hooks/use-capxul-payroll.ts
|
|
1004
1140
|
function useCapxulPayrollRoster(orgId, options) {
|
|
1005
1141
|
const client = useCapxulClientOrNull();
|
|
@@ -1133,6 +1269,34 @@ function useCapxulOrgTreasury(orgId, options) {
|
|
|
1133
1269
|
});
|
|
1134
1270
|
}
|
|
1135
1271
|
//#endregion
|
|
1272
|
+
//#region src/hooks/use-capxul-organization-account.ts
|
|
1273
|
+
function useCapxulOrganizationAccount(organizationId, options) {
|
|
1274
|
+
const client = useCapxulClientOrNull();
|
|
1275
|
+
return useQuery({
|
|
1276
|
+
queryKey: capxulKeys.orgAccount(organizationId),
|
|
1277
|
+
queryFn: async () => {
|
|
1278
|
+
if (organizationId === void 0) throw Errors.invalidInput("organizationId", "required for useCapxulOrganizationAccount");
|
|
1279
|
+
const bootstrappedClient = requireBootstrappedClient(client, "org.account.get");
|
|
1280
|
+
return unwrapCapxulResult(await bootstrappedClient.org(organizationId).account.get(), bootstrappedClient._internal.telemetry);
|
|
1281
|
+
},
|
|
1282
|
+
enabled: client !== null && organizationId !== void 0 && (options?.enabled ?? true)
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
//#endregion
|
|
1286
|
+
//#region src/hooks/use-capxul-organization-audit-log.ts
|
|
1287
|
+
function useCapxulOrganizationAuditLog(organizationId, options) {
|
|
1288
|
+
const client = useCapxulClientOrNull();
|
|
1289
|
+
return useQuery({
|
|
1290
|
+
queryKey: capxulKeys.orgAuditLog(organizationId),
|
|
1291
|
+
queryFn: async () => {
|
|
1292
|
+
if (organizationId === void 0) throw Errors.invalidInput("organizationId", "required for useCapxulOrganizationAuditLog");
|
|
1293
|
+
const bootstrappedClient = requireBootstrappedClient(client, "org.auditLog");
|
|
1294
|
+
return unwrapCapxulResult(await bootstrappedClient.org(organizationId).auditLog(), bootstrappedClient._internal.telemetry);
|
|
1295
|
+
},
|
|
1296
|
+
enabled: client !== null && organizationId !== void 0 && (options?.enabled ?? true)
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
//#endregion
|
|
1136
1300
|
//#region src/hooks/use-capxul-create-org.ts
|
|
1137
1301
|
function useCapxulCreateOrg() {
|
|
1138
1302
|
const client = useCapxulClient();
|
|
@@ -1480,6 +1644,6 @@ function Destinations({ input, slots }) {
|
|
|
1480
1644
|
return slots.root?.({ children }) ?? children;
|
|
1481
1645
|
}
|
|
1482
1646
|
//#endregion
|
|
1483
|
-
export { AddressBook, CapxulProvider, Destinations, InsightsSummary, PayrollRoster, RequestInbox, SendMoney, capxulAccountScope, capxulOrgScope, useCapxul, useCapxulAccountBalance, useCapxulAccountFund, useCapxulAccountLifecycle, useCapxulAddAddressBookEntry, useCapxulAddDestination, useCapxulAddPayrollRosterLine, useCapxulAddressBook, useCapxulAddressBookEntry, useCapxulApproveInboxRequest, useCapxulAssignRole, useCapxulCancelRequest, useCapxulClientOrNull, useCapxulCompleteOrganizationOnboarding, useCapxulCompletePersonalOnboarding, useCapxulCreateOrg, useCapxulDeclineInboxRequest, useCapxulDestinations, useCapxulHideAddressBookEntry, useCapxulInbox, useCapxulInsightsHistory, useCapxulInsightsSummary, useCapxulInviteMember, useCapxulIssueRequest, useCapxulLabelAddressBookEntry, useCapxulOrg, useCapxulOrgDeployRoles, useCapxulOrgMembers, useCapxulOrgRoles, useCapxulOrgTreasury, useCapxulOrgs, useCapxulPay, useCapxulPayment, useCapxulPayments, useCapxulPayout, useCapxulPayrollRoster, useCapxulProfile, useCapxulReconcileRequests, useCapxulRemoveDestination, useCapxulRemoveMember, useCapxulRemovePayrollRosterLine, useCapxulRequest, useCapxulRequests, useCapxulRunPayroll, useCapxulSession, useCapxulSignIn, useCapxulSignOut, useCapxulSubAccountCreate, useCapxulSubAccountDelete, useCapxulSubAccountRename, useCapxulSubAccountsList, useCapxulSwitchActingEntity, useCapxulTransfer, useCapxulUnhideAddressBookEntry, useCapxulUpdatePayrollRosterLine, useCapxulVerifyOtp, useCapxulWithdraw };
|
|
1647
|
+
export { AddressBook, CapxulProvider, Destinations, InsightsSummary, PayrollRoster, RequestInbox, SendMoney, capxulAccountScope, capxulOrgScope, useCapxul, useCapxulAccountBalance, useCapxulAccountFund, useCapxulAccountLifecycle, useCapxulActivity, useCapxulAddAddressBookEntry, useCapxulAddDestination, useCapxulAddPayrollRosterLine, useCapxulAddressBook, useCapxulAddressBookEntry, useCapxulApproveInboxRequest, useCapxulAssignRole, useCapxulCancelPayment, useCapxulCancelRequest, useCapxulClientOrNull, useCapxulCompleteOrganizationOnboarding, useCapxulCompletePersonalOnboarding, useCapxulCreateOrg, useCapxulCurrentUser, useCapxulDeclineInboxRequest, useCapxulDestinations, useCapxulHideAddressBookEntry, useCapxulInbox, useCapxulInsightsHistory, useCapxulInsightsSummary, useCapxulInviteMember, useCapxulIssueRequest, useCapxulLabelAddressBookEntry, useCapxulOfframpQuote, useCapxulOfframpStatus, useCapxulOrg, useCapxulOrgDeployRoles, useCapxulOrgMembers, useCapxulOrgRoles, useCapxulOrgTreasury, useCapxulOrganizationAccount, useCapxulOrganizationAuditLog, useCapxulOrgs, useCapxulPay, useCapxulPayment, useCapxulPayments, useCapxulPayout, useCapxulPayrollRoster, useCapxulProfile, useCapxulReconcileRequests, useCapxulRemoveDestination, useCapxulRemoveMember, useCapxulRemovePayrollRosterLine, useCapxulRequest, useCapxulRequests, useCapxulRunPayroll, useCapxulSession, useCapxulSignIn, useCapxulSignOut, useCapxulSubAccountCreate, useCapxulSubAccountDelete, useCapxulSubAccountRename, useCapxulSubAccountsList, useCapxulSwitchActingEntity, useCapxulTransfer, useCapxulUnhideAddressBookEntry, useCapxulUpdatePayrollRosterLine, useCapxulVerifyOtp, useCapxulWithdraw };
|
|
1484
1648
|
|
|
1485
1649
|
//# sourceMappingURL=index.mjs.map
|