@capxul/sdk-react 4.20.0-beta.36 → 4.20.0-beta.37
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.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { _ as orgKeySegment, a as entered, c as useCapxulIdentity, d as useCapxulTransitions, f as toInvocationControls, g as capxulKeys, h as actingAccount, i as CapxulProvider, l as useCapxulIdentityOrNull, m as accountKey, n as CapxulAuthenticationController, o as useCapxulAuth, p as toInvocationOptions, r as absurd, s as useCapxulDestination, t as CapxulOnboardingController, u as useCapxulSend, v as useCapxulClientOrNull, y as useCapxul } from "./onboarding-controller-
|
|
2
|
+
import { _ as orgKeySegment, a as entered, c as useCapxulIdentity, d as useCapxulTransitions, f as toInvocationControls, g as capxulKeys, h as actingAccount, i as CapxulProvider, l as useCapxulIdentityOrNull, m as accountKey, n as CapxulAuthenticationController, o as useCapxulAuth, p as toInvocationOptions, r as absurd, s as useCapxulDestination, t as CapxulOnboardingController, u as useCapxulSend, v as useCapxulClientOrNull, y as useCapxul } from "./onboarding-controller-BCrkmLxQ.mjs";
|
|
3
3
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
5
5
|
import { CAPXUL_OPERATIONS, CapxulError, EVM_ADDRESS_RE, Errors, HANDLE_RE, PAYMENT_DIRECTIONS, PAYMENT_STATUSES, assetSymbolFor, fingerprintPaymentIntent, formatAssetAmount, formatMoney, isCapxulError, isClaimed, isClaimed as isClaimed$1, isMoneyParseError, isRestoring, isRestoring as isRestoring$1, parseAssetAmount, parseMoney, paymentPhase, requireAsset, resolveIdentityDestination, toAssetId, toCurrencyCode, toEvmAddress, toOrgId, toPartyId, toRaw, valueActivitySummary } from "@capxul/sdk";
|
|
@@ -1204,14 +1204,24 @@ async function storageKey$1(operation, intent) {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
function paymentLockManager() {
|
|
1206
1206
|
const manager = navigator.locks;
|
|
1207
|
-
if (manager === void 0 || typeof manager.query !== "function") throw Errors.
|
|
1207
|
+
if (manager === void 0 || typeof manager.query !== "function") throw Errors.providerUnavailable({
|
|
1208
|
+
provider: "sdk-react",
|
|
1209
|
+
operation: "paymentRequestKey",
|
|
1210
|
+
mode: "no-secure-context",
|
|
1211
|
+
details: { reason: "web-locks-unavailable" }
|
|
1212
|
+
});
|
|
1208
1213
|
return manager;
|
|
1209
1214
|
}
|
|
1210
1215
|
function readState(key) {
|
|
1211
1216
|
const stored = localStorage.getItem(key);
|
|
1212
1217
|
if (stored === null) return null;
|
|
1213
1218
|
const state = JSON.parse(stored);
|
|
1214
|
-
if (!isPaymentRequestKeyState(state)) throw Errors.
|
|
1219
|
+
if (!isPaymentRequestKeyState(state)) throw Errors.providerUnavailable({
|
|
1220
|
+
provider: "sdk-react",
|
|
1221
|
+
operation: "paymentRequestKey",
|
|
1222
|
+
mode: "defect",
|
|
1223
|
+
details: { reason: "invalid-stored-state" }
|
|
1224
|
+
});
|
|
1215
1225
|
return state;
|
|
1216
1226
|
}
|
|
1217
1227
|
async function beginPaymentRequestKey(operation, intent) {
|
|
@@ -1267,7 +1277,12 @@ async function beginPaymentRequestKey(operation, intent) {
|
|
|
1267
1277
|
} catch (cause) {
|
|
1268
1278
|
forgetPagehideRelease?.();
|
|
1269
1279
|
releaseAttemptLock?.();
|
|
1270
|
-
throw Errors.
|
|
1280
|
+
throw Errors.providerUnavailable({
|
|
1281
|
+
provider: "sdk-react",
|
|
1282
|
+
operation: "paymentRequestKey",
|
|
1283
|
+
mode: "unknown",
|
|
1284
|
+
cause
|
|
1285
|
+
});
|
|
1271
1286
|
}
|
|
1272
1287
|
}
|
|
1273
1288
|
async function withPaymentRequestKey(operation, intent, work) {
|
|
@@ -2824,8 +2839,8 @@ function decodeDraft(value, scope) {
|
|
|
2824
2839
|
};
|
|
2825
2840
|
try {
|
|
2826
2841
|
if (toRaw(selectedAmount, selectedAsset).toString() !== net) throw Errors.invalidInput("payrollDraft", "Draft payout units differ from net");
|
|
2827
|
-
} catch {
|
|
2828
|
-
throw Errors.invalidInput("payrollDraft", "Invalid draft payout amount");
|
|
2842
|
+
} catch (cause) {
|
|
2843
|
+
throw Errors.invalidInput("payrollDraft", "Invalid draft payout amount", cause);
|
|
2829
2844
|
}
|
|
2830
2845
|
return {
|
|
2831
2846
|
to: {
|
|
@@ -2882,8 +2897,14 @@ function minorAmount(value) {
|
|
|
2882
2897
|
if (typeof value !== "string" || !/^\d+$/u.test(value) || BigInt(value) <= 0n) throw Errors.invalidInput("payrollDraft", "Invalid draft amount");
|
|
2883
2898
|
return value;
|
|
2884
2899
|
}
|
|
2900
|
+
/** A draft failure that is not already typed: local storage failed, and nothing says how. */
|
|
2885
2901
|
function runDraftError(cause) {
|
|
2886
|
-
return cause instanceof CapxulError ? cause : Errors.
|
|
2902
|
+
return cause instanceof CapxulError ? cause : Errors.providerUnavailable({
|
|
2903
|
+
provider: "sdk-react",
|
|
2904
|
+
operation: "payrollDraft",
|
|
2905
|
+
mode: "unknown",
|
|
2906
|
+
cause
|
|
2907
|
+
});
|
|
2887
2908
|
}
|
|
2888
2909
|
function storageKey(scope) {
|
|
2889
2910
|
return `capxul.payroll.run-draft.v1:${scope}`;
|
|
@@ -2895,8 +2916,8 @@ function readRunDraft(scope) {
|
|
|
2895
2916
|
let value;
|
|
2896
2917
|
try {
|
|
2897
2918
|
value = JSON.parse(raw);
|
|
2898
|
-
} catch {
|
|
2899
|
-
throw Errors.invalidInput("payrollDraft", "Invalid run draft JSON");
|
|
2919
|
+
} catch (cause) {
|
|
2920
|
+
throw Errors.invalidInput("payrollDraft", "Invalid run draft JSON", cause);
|
|
2900
2921
|
}
|
|
2901
2922
|
return decodeDraft(value, scope);
|
|
2902
2923
|
} catch (cause) {
|
|
@@ -859,11 +859,13 @@ function CapxulProvider(props) {
|
|
|
859
859
|
//#endregion
|
|
860
860
|
//#region ../protocol/src/errors/failure-modes.ts
|
|
861
861
|
/**
|
|
862
|
-
* Why an operation failed — the one flat vocabulary. The first
|
|
863
|
-
* auth
|
|
864
|
-
* path. `
|
|
865
|
-
* (
|
|
866
|
-
*
|
|
862
|
+
* Why an operation failed — the one flat vocabulary. The first five are the
|
|
863
|
+
* auth and signer diagnoses that predate this file. The next eleven name the
|
|
864
|
+
* chain path. `refused` and `defect` name a provider refusal and a Capxul
|
|
865
|
+
* fault on any path (ADR-0039 D2). `FailureMode` is derived from this list so
|
|
866
|
+
* a runtime membership check (the SDK's `$exception` projection, the
|
|
867
|
+
* observability schema) and the type can never drift apart. Every word has a
|
|
868
|
+
* failure class in `classes.ts`.
|
|
867
869
|
*/
|
|
868
870
|
const FAILURE_MODES = [
|
|
869
871
|
"auth-origin-mismatch",
|
|
@@ -882,6 +884,8 @@ const FAILURE_MODES = [
|
|
|
882
884
|
"forbidden",
|
|
883
885
|
"bad-request",
|
|
884
886
|
"method-unsupported",
|
|
887
|
+
"refused",
|
|
888
|
+
"defect",
|
|
885
889
|
"unknown"
|
|
886
890
|
];
|
|
887
891
|
function isFailureMode(value) {
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as CapxulProvider, n as CapxulAuthenticationController, t as CapxulOnboardingController } from "../onboarding-controller-
|
|
1
|
+
import { i as CapxulProvider, n as CapxulAuthenticationController, t as CapxulOnboardingController } from "../onboarding-controller-BCrkmLxQ.mjs";
|
|
2
2
|
import "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { createCapxulTestClient } from "@capxul/sdk/testing";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capxul/sdk-react",
|
|
3
|
-
"version": "4.20.0-beta.
|
|
3
|
+
"version": "4.20.0-beta.37",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/Xelmar-tech/infrastructure.git",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@capxul/sdk": "4.20.0-beta.
|
|
59
|
+
"@capxul/sdk": "4.20.0-beta.37"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@tanstack/react-query": "^5.66.9",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"vite": "npm:@voidzero-dev/vite-plus-core@1.0.0",
|
|
76
76
|
"vite-plus": "1.0.0",
|
|
77
77
|
"vitest": "5.0.1",
|
|
78
|
-
"@capxul/protocol": "0.2.0-beta.
|
|
78
|
+
"@capxul/protocol": "0.2.0-beta.8",
|
|
79
79
|
"@capxul/typescript-config": "0.0.0"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|