@yieldfabric/wallet 0.2.6 → 0.2.8

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.cts CHANGED
@@ -1764,7 +1764,6 @@ declare class GlobalNotificationService {
1764
1764
  private handleNewMessage;
1765
1765
  private handleMessageUpdate;
1766
1766
  private handleMessageStatusChange;
1767
- private handleError;
1768
1767
  processSystemNotification(type: 'info' | 'success' | 'warning' | 'error', title: string, message?: string, options?: any): void;
1769
1768
  processApiError(error: Error, context?: string): void;
1770
1769
  processApiSuccess(message: string, context?: string): void;
@@ -2594,8 +2593,13 @@ interface OnboardingWizardProps {
2594
2593
  * linked to. One agreement should be consented to once, on the screen that
2595
2594
  * actually displays it. */
2596
2595
  sponsorshipConsent?: 'wizard' | 'host';
2596
+ /** Host-paid applications never offer personal plans/card capture, including
2597
+ * backend-paid apps whose end-user JWT deliberately has no sponsor tag.
2598
+ * Bank/account opening is deferred to the host's explicit post-consent action.
2599
+ * This controls onboarding UX only; server-side billing gates still apply. */
2600
+ billingMode?: 'automatic' | 'host';
2597
2601
  }
2598
- declare function OnboardingWizard({ initialPathname, chrome, onComplete, branding, invite, platform, onSelectPlatform, sponsorshipConsent, }: OnboardingWizardProps): react_jsx_runtime.JSX.Element;
2602
+ declare function OnboardingWizard({ initialPathname, chrome, onComplete, branding, invite, platform, onSelectPlatform, sponsorshipConsent, billingMode, }: OnboardingWizardProps): react_jsx_runtime.JSX.Element;
2599
2603
 
2600
2604
  /**
2601
2605
  * @file ui/onboarding/OnboardingPolicySection.tsx
package/dist/index.d.ts CHANGED
@@ -1764,7 +1764,6 @@ declare class GlobalNotificationService {
1764
1764
  private handleNewMessage;
1765
1765
  private handleMessageUpdate;
1766
1766
  private handleMessageStatusChange;
1767
- private handleError;
1768
1767
  processSystemNotification(type: 'info' | 'success' | 'warning' | 'error', title: string, message?: string, options?: any): void;
1769
1768
  processApiError(error: Error, context?: string): void;
1770
1769
  processApiSuccess(message: string, context?: string): void;
@@ -2594,8 +2593,13 @@ interface OnboardingWizardProps {
2594
2593
  * linked to. One agreement should be consented to once, on the screen that
2595
2594
  * actually displays it. */
2596
2595
  sponsorshipConsent?: 'wizard' | 'host';
2596
+ /** Host-paid applications never offer personal plans/card capture, including
2597
+ * backend-paid apps whose end-user JWT deliberately has no sponsor tag.
2598
+ * Bank/account opening is deferred to the host's explicit post-consent action.
2599
+ * This controls onboarding UX only; server-side billing gates still apply. */
2600
+ billingMode?: 'automatic' | 'host';
2597
2601
  }
2598
- declare function OnboardingWizard({ initialPathname, chrome, onComplete, branding, invite, platform, onSelectPlatform, sponsorshipConsent, }: OnboardingWizardProps): react_jsx_runtime.JSX.Element;
2602
+ declare function OnboardingWizard({ initialPathname, chrome, onComplete, branding, invite, platform, onSelectPlatform, sponsorshipConsent, billingMode, }: OnboardingWizardProps): react_jsx_runtime.JSX.Element;
2599
2603
 
2600
2604
  /**
2601
2605
  * @file ui/onboarding/OnboardingPolicySection.tsx
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * Source review requires written authorization; see package LICENSE.md and NOTICE.md.
6
6
  * Runtime use requires a separate express license.
7
7
  */
8
- import React55, { createContext, lazy, useContext, useState, useEffect, useRef, useCallback, useMemo, Suspense, useId, Component } from 'react';
8
+ import React39, { createContext, lazy, useContext, useState, useEffect, useRef, useCallback, useMemo, Suspense, useId, Component } from 'react';
9
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
10
10
  import { AvererSdkProvider, useAvererWallet, AvererWebSdk } from '@averer/averer-websdk';
11
11
  import sha3, { keccak256 } from 'js-sha3';
@@ -7519,6 +7519,7 @@ var messagesService = new MessagesService();
7519
7519
  // src/core/websocketChannelManager.ts
7520
7520
  init_jwtPayload();
7521
7521
  init_tokenStore();
7522
+ init_tokenRenewal();
7522
7523
  var WebSocketChannelManager = class {
7523
7524
  constructor(url, getAccessToken = () => defaultTokenStore.getCurrentToken()) {
7524
7525
  this.ws = null;
@@ -7527,6 +7528,9 @@ var WebSocketChannelManager = class {
7527
7528
  this.reconnectAttempts = 0;
7528
7529
  this.reconnectDelay = 1e3;
7529
7530
  this.reconnectTimeout = null;
7531
+ /** The server closed us over the token (expired or missing): renew it
7532
+ * before reconnecting, or the next attempt is refused the same way. */
7533
+ this.renewBeforeReconnect = false;
7530
7534
  // Channel management
7531
7535
  this.channels = /* @__PURE__ */ new Map();
7532
7536
  // entityId -> messageTypes
@@ -7591,6 +7595,12 @@ var WebSocketChannelManager = class {
7591
7595
  try {
7592
7596
  const message = JSON.parse(event.data);
7593
7597
  console.log("\u{1F50C} WebSocket message received:", message);
7598
+ if (message.type === "Error") {
7599
+ const reason = String(message.message ?? message.error_message ?? "");
7600
+ console.warn("\u{1F50C} Live updates refused the connection:", reason);
7601
+ if (/token/i.test(reason)) this.renewBeforeReconnect = true;
7602
+ return;
7603
+ }
7594
7604
  this.routeMessage(message);
7595
7605
  } catch (error) {
7596
7606
  console.error("Failed to parse WebSocket message:", error);
@@ -7761,7 +7771,11 @@ var WebSocketChannelManager = class {
7761
7771
  this.reconnectAttempts++;
7762
7772
  const delay2 = Math.min(this.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1), 3e4);
7763
7773
  console.log(`Reconnecting in ${delay2}ms (attempt ${this.reconnectAttempts})`);
7764
- this.reconnectTimeout = setTimeout(() => {
7774
+ this.reconnectTimeout = setTimeout(async () => {
7775
+ if (this.renewBeforeReconnect) {
7776
+ this.renewBeforeReconnect = false;
7777
+ await tokenRenewalService.refreshToken().catch((error) => console.warn("\u{1F50C} Token renewal before reconnecting failed:", error));
7778
+ }
7765
7779
  this.connect().catch((error) => {
7766
7780
  console.error("Reconnection failed:", error);
7767
7781
  });
@@ -9057,9 +9071,6 @@ var _GlobalNotificationService = class _GlobalNotificationService {
9057
9071
  case "MessageStatusChange":
9058
9072
  this.handleMessageStatusChange(message);
9059
9073
  break;
9060
- case "Error":
9061
- this.handleError(message);
9062
- break;
9063
9074
  default:
9064
9075
  console.log("Unhandled message type:", message.type);
9065
9076
  }
@@ -9119,16 +9130,6 @@ var _GlobalNotificationService = class _GlobalNotificationService {
9119
9130
  });
9120
9131
  }
9121
9132
  }
9122
- handleError(message) {
9123
- const notification = {
9124
- id: `error-${Date.now()}`,
9125
- type: "error",
9126
- title: "Error",
9127
- message: message.error_message || "An error occurred",
9128
- duration: 6e3
9129
- };
9130
- this.callbacks.onNotification(notification);
9131
- }
9132
9133
  processSystemNotification(type, title, message, options) {
9133
9134
  const notification = {
9134
9135
  id: `system-${type}-${Date.now()}`,
@@ -9985,7 +9986,7 @@ function WizardProvider({
9985
9986
  const [planSelection, setPlanSelection] = useState(
9986
9987
  readOnboardingPlanSelectionHint
9987
9988
  );
9988
- const pendingSponsorshipRef = React55.useRef(
9989
+ const pendingSponsorshipRef = React39.useRef(
9989
9990
  pendingSponsorship
9990
9991
  );
9991
9992
  const stageSponsorship = useCallback((groupId, destination) => {
@@ -11199,8 +11200,8 @@ var DynamicCompleter = ({ sdk, action, onError }) => {
11199
11200
  const ctx = sdk.useDynamicContext();
11200
11201
  const wallet = ctx.primaryWallet;
11201
11202
  const dynamicUser = ctx.user;
11202
- const [done, setDone] = React55.useState(false);
11203
- React55.useEffect(() => {
11203
+ const [done, setDone] = React39.useState(false);
11204
+ React39.useEffect(() => {
11204
11205
  if (done || !wallet?.address) return;
11205
11206
  setDone(true);
11206
11207
  (async () => {
@@ -11625,8 +11626,8 @@ var KycFlow3 = ({ onComplete, onError, instanceId }) => {
11625
11626
  const settings = config?.kyc.settings[providerId];
11626
11627
  const publishableKey = settings?.publishable_key;
11627
11628
  const requiredForCompletion = settings?.required_for_completion ?? false;
11628
- const [stage, setStage] = React55.useState({ kind: "idle" });
11629
- React55.useEffect(() => {
11629
+ const [stage, setStage] = React39.useState({ kind: "idle" });
11630
+ React39.useEffect(() => {
11630
11631
  let cancelled = false;
11631
11632
  (async () => {
11632
11633
  try {
@@ -11650,7 +11651,7 @@ var KycFlow3 = ({ onComplete, onError, instanceId }) => {
11650
11651
  cancelled = true;
11651
11652
  };
11652
11653
  }, []);
11653
- React55.useEffect(() => {
11654
+ React39.useEffect(() => {
11654
11655
  if (stage.kind !== "pending-poll") return;
11655
11656
  let cancelled = false;
11656
11657
  const pollOnce = async () => {
@@ -11902,14 +11903,14 @@ function useIdentityStatusPoll(opts) {
11902
11903
  provider,
11903
11904
  credentialType
11904
11905
  } = opts;
11905
- const [stuckHint, setStuckHint] = React55.useState(false);
11906
- const onVerifiedRef = React55.useRef(onVerified);
11907
- const onRejectedRef = React55.useRef(onRejected);
11908
- React55.useEffect(() => {
11906
+ const [stuckHint, setStuckHint] = React39.useState(false);
11907
+ const onVerifiedRef = React39.useRef(onVerified);
11908
+ const onRejectedRef = React39.useRef(onRejected);
11909
+ React39.useEffect(() => {
11909
11910
  onVerifiedRef.current = onVerified;
11910
11911
  onRejectedRef.current = onRejected;
11911
11912
  }, [onVerified, onRejected]);
11912
- React55.useEffect(() => {
11913
+ React39.useEffect(() => {
11913
11914
  if (!active) {
11914
11915
  setStuckHint(false);
11915
11916
  return;
@@ -12047,12 +12048,12 @@ var KycFlow4 = ({ onComplete, onError, instanceId, subject }) => {
12047
12048
  const groupId = subject?.kind === "group" ? subject.id : void 0;
12048
12049
  const configuredLevel = config?.kyc.settings[providerId]?.level_name?.trim();
12049
12050
  const levelName = configuredLevel || "id-and-liveness";
12050
- const [token, setToken] = React55.useState(null);
12051
- const [stage, setStage] = React55.useState({ kind: "init" });
12052
- const [attempt, setAttempt] = React55.useState(0);
12053
- const submittedRef = React55.useRef(false);
12054
- const applicantIdRef = React55.useRef(void 0);
12055
- React55.useEffect(() => {
12051
+ const [token, setToken] = React39.useState(null);
12052
+ const [stage, setStage] = React39.useState({ kind: "init" });
12053
+ const [attempt, setAttempt] = React39.useState(0);
12054
+ const submittedRef = React39.useRef(false);
12055
+ const applicantIdRef = React39.useRef(void 0);
12056
+ React39.useEffect(() => {
12056
12057
  let cancelled = false;
12057
12058
  submittedRef.current = false;
12058
12059
  (async () => {
@@ -16018,7 +16019,7 @@ function Field({
16018
16019
  value,
16019
16020
  copyable
16020
16021
  }) {
16021
- const [copied, setCopied] = React55.useState(false);
16022
+ const [copied, setCopied] = React39.useState(false);
16022
16023
  return /* @__PURE__ */ jsxs("div", { children: [
16023
16024
  /* @__PURE__ */ jsx("p", { className: "text-[10px] uppercase tracking-wider text-text-secondary", children: label }),
16024
16025
  /* @__PURE__ */ jsxs("div", { className: "mt-0.5 flex items-center gap-2", children: [
@@ -16082,14 +16083,16 @@ var STAGE_COPY = {
16082
16083
  not_applicable: { title: "Finishing up", body: "" }
16083
16084
  };
16084
16085
  var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
16085
- const [status, setStatus] = React55.useState(null);
16086
- const [impatient, setImpatient] = React55.useState(false);
16087
- const activationStarted = React55.useRef(false);
16088
- const onContinueRef = React55.useRef(onContinue);
16089
- React55.useEffect(() => {
16086
+ const [status, setStatus] = React39.useState(null);
16087
+ const [impatient, setImpatient] = React39.useState(false);
16088
+ const [unavailable, setUnavailable] = React39.useState(false);
16089
+ const [attempt, setAttempt] = React39.useState(0);
16090
+ const activationStarted = React39.useRef(false);
16091
+ const onContinueRef = React39.useRef(onContinue);
16092
+ React39.useEffect(() => {
16090
16093
  onContinueRef.current = onContinue;
16091
16094
  }, [onContinue]);
16092
- React55.useEffect(() => {
16095
+ React39.useEffect(() => {
16093
16096
  let cancelled = false;
16094
16097
  let timer;
16095
16098
  const startedAt = Date.now();
@@ -16097,8 +16100,9 @@ var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
16097
16100
  if (cancelled) return;
16098
16101
  let terminal = false;
16099
16102
  try {
16100
- const next = await fetchAccountOpeningStatus();
16103
+ const next = await withDeadline(fetchAccountOpeningStatus(), "Account opening status");
16101
16104
  if (cancelled) return;
16105
+ setUnavailable(false);
16102
16106
  setStatus(next);
16103
16107
  if (next.status === "not_started") {
16104
16108
  onContinueRef.current();
@@ -16115,6 +16119,8 @@ var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
16115
16119
  );
16116
16120
  }
16117
16121
  } catch {
16122
+ if (cancelled) return;
16123
+ setUnavailable(true);
16118
16124
  }
16119
16125
  if (cancelled || terminal) return;
16120
16126
  const waited = Date.now() - startedAt;
@@ -16126,8 +16132,20 @@ var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
16126
16132
  cancelled = true;
16127
16133
  if (timer !== void 0) window.clearTimeout(timer);
16128
16134
  };
16129
- }, []);
16130
- if (!status) return null;
16135
+ }, [attempt]);
16136
+ if (unavailable || !status) {
16137
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-4 text-center", role: "status", "aria-live": "polite", children: [
16138
+ /* @__PURE__ */ jsx("p", { children: unavailable ? "We couldn\u2019t check your account right now." : "Checking your account\u2026" }),
16139
+ unavailable && /* @__PURE__ */ jsxs(Fragment, { children: [
16140
+ /* @__PURE__ */ jsx("p", { className: "text-[12px] text-text-secondary", children: "You can try again or continue. Your account details will be available when setup finishes." }),
16141
+ /* @__PURE__ */ jsx("button", { type: "button", className: "min-h-[44px] w-full rounded-lg bg-cta px-4 py-2.5 text-on-cta", onClick: () => {
16142
+ setUnavailable(false);
16143
+ setAttempt((value) => value + 1);
16144
+ }, children: "Try again" }),
16145
+ /* @__PURE__ */ jsx("button", { type: "button", className: "min-h-[44px] w-full", onClick: onContinue, children: continueLabel })
16146
+ ] })
16147
+ ] });
16148
+ }
16131
16149
  if (status.status === "ready" && status.account) {
16132
16150
  return /* @__PURE__ */ jsxs("div", { className: "space-y-4", role: "status", "aria-live": "polite", children: [
16133
16151
  /* @__PURE__ */ jsxs("div", { children: [
@@ -16185,13 +16203,13 @@ var AccountOpeningPanel = ({ onContinue, continueLabel = "Continue" }) => {
16185
16203
  init_authService();
16186
16204
  var WALLET_AWAKENING_MS = 1100;
16187
16205
  var TOTAL_MS = 3e3;
16188
- function OnboardingWelcomeMoment({ chrome } = {}) {
16206
+ function OnboardingWelcomeMoment({ chrome, deferAccountOpening = false } = {}) {
16189
16207
  const navigate = useWizardNavigate();
16190
16208
  const { messages } = useBranding();
16191
16209
  const [name, setName] = useState("");
16192
16210
  const [walletShort, setWalletShort] = useState(null);
16193
16211
  const [phase, setPhase] = useState("wallet");
16194
- const [accountOpened, setAccountOpened] = useState(false);
16212
+ const [accountOpened, setAccountOpened] = useState(deferAccountOpening);
16195
16213
  useEffect(() => {
16196
16214
  let cancelled = false;
16197
16215
  (async () => {
@@ -17363,7 +17381,8 @@ function OnboardingWizard({
17363
17381
  invite,
17364
17382
  platform,
17365
17383
  onSelectPlatform,
17366
- sponsorshipConsent = "wizard"
17384
+ sponsorshipConsent = "wizard",
17385
+ billingMode = "automatic"
17367
17386
  }) {
17368
17387
  return /* @__PURE__ */ jsx(BrandingProvider, { branding, children: /* @__PURE__ */ jsx(
17369
17388
  WizardProvider,
@@ -17377,7 +17396,8 @@ function OnboardingWizard({
17377
17396
  {
17378
17397
  chrome,
17379
17398
  onSelectPlatform,
17380
- sponsorshipConsent
17399
+ sponsorshipConsent,
17400
+ billingMode
17381
17401
  }
17382
17402
  )
17383
17403
  }
@@ -17407,7 +17427,8 @@ function gateToPath(status) {
17407
17427
  function WizardRouter({
17408
17428
  chrome,
17409
17429
  onSelectPlatform,
17410
- sponsorshipConsent = "wizard"
17430
+ sponsorshipConsent = "wizard",
17431
+ billingMode = "automatic"
17411
17432
  }) {
17412
17433
  const pathname = useWizardPathname();
17413
17434
  const { config } = useProviderConfig();
@@ -17416,7 +17437,7 @@ function WizardRouter({
17416
17437
  const effectivePlatform = wizardPlatform ?? config?.platform?.group_id ?? pendingSponsorship?.groupId;
17417
17438
  const primaryKycId = config?.kyc.primary;
17418
17439
  const identityRequired = !!(primaryKycId && config?.kyc.enabled.includes(primaryKycId) && config?.kyc.settings[primaryKycId]?.required_for_completion);
17419
- const planApplicable = !effectivePlatform && !personalSessionHasGroupPayer();
17440
+ const planApplicable = billingMode !== "host" && !effectivePlatform && !personalSessionHasGroupPayer();
17420
17441
  const allowedIdentityProviders = userIdentityStatusScopes(config);
17421
17442
  const gate = useOnboardingState(
17422
17443
  identityRequired,
@@ -17427,11 +17448,14 @@ function WizardRouter({
17427
17448
  identityRequired && primaryKycVerifiesEmail(config)
17428
17449
  );
17429
17450
  const hostOwnsSponsorshipConsent = sponsorshipConsent === "host";
17430
- React55.useEffect(() => {
17451
+ React39.useEffect(() => {
17431
17452
  if (hostOwnsSponsorshipConsent && pendingSponsorship) {
17432
17453
  discardSponsorship();
17433
17454
  }
17434
17455
  }, [hostOwnsSponsorshipConsent, pendingSponsorship, discardSponsorship]);
17456
+ if (!planApplicable && ["/onboarding", "/onboarding/pricing", "/onboarding/plan", "/onboarding/card"].includes(pathname)) {
17457
+ return /* @__PURE__ */ jsx(WizardRedirect, { to: "/onboarding/choose", replace: true });
17458
+ }
17435
17459
  const sponsorshipContext = !hostOwnsSponsorshipConsent && !!effectivePlatform && (pendingSponsorship !== null || authService.isAuthenticated() && !authService.hasExactSponsoredSession(effectivePlatform));
17436
17460
  const exactSponsorship = !!effectivePlatform && authService.hasExactSponsoredSession(effectivePlatform);
17437
17461
  const gateCanAnswer = authService.isAuthenticated() && !!tokenManager.getAccessToken();
@@ -17515,7 +17539,7 @@ function WizardRouter({
17515
17539
  }
17516
17540
  );
17517
17541
  if (pathname === "/onboarding/welcome")
17518
- return /* @__PURE__ */ jsx(OnboardingWelcomeMoment, { chrome });
17542
+ return /* @__PURE__ */ jsx(OnboardingWelcomeMoment, { chrome, deferAccountOpening: billingMode === "host" });
17519
17543
  if (pathname === "/onboarding")
17520
17544
  return /* @__PURE__ */ jsx(SelectPlan, { chrome, platformPlansAvailable: !!onSelectPlatform });
17521
17545
  if (pathname.startsWith("/onboarding/"))
@@ -17643,7 +17667,7 @@ function builtinProviderDisplayName(id) {
17643
17667
  }
17644
17668
  }
17645
17669
  function useProviderDisplayName(config) {
17646
- return React55.useCallback(
17670
+ return React39.useCallback(
17647
17671
  (id) => {
17648
17672
  const labelled = config?.kyc?.settings?.[id]?.label ?? config?.auth?.settings?.[id]?.label;
17649
17673
  const trimmed = typeof labelled === "string" ? labelled.trim() : "";
@@ -17979,7 +18003,7 @@ var OnboardingPolicySection = ({
17979
18003
  )
17980
18004
  ] }) }) : /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
17981
18005
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-2.5 gap-y-1.5 rounded-lg border border-primary/20 bg-primary/[0.04] px-3.5 py-2.5", children: [
17982
- journeySteps.map((step, i) => /* @__PURE__ */ jsxs(React55.Fragment, { children: [
18006
+ journeySteps.map((step, i) => /* @__PURE__ */ jsxs(React39.Fragment, { children: [
17983
18007
  i > 0 && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "text-[12px] text-text-muted/60", children: "\u203A" }),
17984
18008
  /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
17985
18009
  /* @__PURE__ */ jsx("span", { className: "flex h-4 w-4 items-center justify-center rounded-full bg-primary/20 text-[9px] font-bold text-primary", children: i + 1 }),
@@ -21167,11 +21191,11 @@ var SaveButton = ({ onClick, busy, disabled, saved = false, classNames }) => /*
21167
21191
  );
21168
21192
  function useSavedFlash(ms = 1800) {
21169
21193
  const [saved, setSaved] = useState(false);
21170
- const timer = React55.useRef(null);
21194
+ const timer = React39.useRef(null);
21171
21195
  useEffect(() => () => {
21172
21196
  if (timer.current) clearTimeout(timer.current);
21173
21197
  }, []);
21174
- const flash = React55.useCallback(() => {
21198
+ const flash = React39.useCallback(() => {
21175
21199
  setSaved(true);
21176
21200
  if (timer.current) clearTimeout(timer.current);
21177
21201
  timer.current = setTimeout(() => setSaved(false), ms);
@@ -24924,17 +24948,17 @@ function ActiveEnvironmentBadge({
24924
24948
  configuredTestChains
24925
24949
  );
24926
24950
  const canChoose = Boolean(activeChainId && options.length > 1);
24927
- const [busyChainId, setBusyChainId] = React55.useState(null);
24928
- const [pendingLiveChainId, setPendingLiveChainId] = React55.useState(null);
24929
- const [error, setError] = React55.useState(null);
24930
- const switchingRef = React55.useRef(false);
24931
- const confirmLiveRef = React55.useRef(null);
24932
- const liveWarningId = React55.useId();
24951
+ const [busyChainId, setBusyChainId] = React39.useState(null);
24952
+ const [pendingLiveChainId, setPendingLiveChainId] = React39.useState(null);
24953
+ const [error, setError] = React39.useState(null);
24954
+ const switchingRef = React39.useRef(false);
24955
+ const confirmLiveRef = React39.useRef(null);
24956
+ const liveWarningId = React39.useId();
24933
24957
  const label = modeLabel(environment.mode);
24934
24958
  const modeCounts = { test: 0, live: 0, unknown: 0 };
24935
24959
  for (const option of options) modeCounts[option.mode] += 1;
24936
24960
  const pendingLive = options.find((option) => option.chainId === pendingLiveChainId) ?? null;
24937
- React55.useEffect(() => {
24961
+ React39.useEffect(() => {
24938
24962
  if (pendingLiveChainId) confirmLiveRef.current?.focus();
24939
24963
  }, [pendingLiveChainId]);
24940
24964
  async function switchTo(option) {
@@ -25694,7 +25718,7 @@ function WalletMenu({
25694
25718
  const secondaryItems = items.filter((item) => item.placement === "secondary");
25695
25719
  const activeActor = actors.find((actor) => actor.active) ?? actors[0];
25696
25720
  const userName = identity.name ?? "You";
25697
- const renderCard = (cardItems) => /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-[24px] border border-border-light bg-raised shadow-sm", children: cardItems.map((item, index) => /* @__PURE__ */ jsxs(React55.Fragment, { children: [
25721
+ const renderCard = (cardItems) => /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-[24px] border border-border-light bg-raised shadow-sm", children: cardItems.map((item, index) => /* @__PURE__ */ jsxs(React39.Fragment, { children: [
25698
25722
  index > 0 && /* @__PURE__ */ jsx("div", { className: "mx-4 border-t border-border-light" }),
25699
25723
  /* @__PURE__ */ jsx(
25700
25724
  WalletMenuRow,
@@ -25944,7 +25968,7 @@ function ActorsPane({
25944
25968
  error && /* @__PURE__ */ jsx(ErrorBanner, { children: error }),
25945
25969
  /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-[22px] border border-border-light bg-raised", children: actors.map((actor, index) => {
25946
25970
  const ActorIcon = actor.icon;
25947
- return /* @__PURE__ */ jsxs(React55.Fragment, { children: [
25971
+ return /* @__PURE__ */ jsxs(React39.Fragment, { children: [
25948
25972
  index > 0 && /* @__PURE__ */ jsx("div", { className: "mx-4 border-t border-border-light" }),
25949
25973
  /* @__PURE__ */ jsxs(
25950
25974
  "button",
@@ -29768,25 +29792,25 @@ function BusinessVerificationSection({
29768
29792
  initialStatus
29769
29793
  }) {
29770
29794
  const { config } = useProviderConfig();
29771
- const [status, setStatus] = React55.useState(initialStatus ?? "not_required");
29772
- const [flowInstance, setFlowInstance] = React55.useState(null);
29773
- const [error, setError] = React55.useState(null);
29774
- const [busy, setBusy] = React55.useState(false);
29775
- const kybInstances = React55.useMemo(
29795
+ const [status, setStatus] = React39.useState(initialStatus ?? "not_required");
29796
+ const [flowInstance, setFlowInstance] = React39.useState(null);
29797
+ const [error, setError] = React39.useState(null);
29798
+ const [busy, setBusy] = React39.useState(false);
29799
+ const kybInstances = React39.useMemo(
29776
29800
  () => (config?.kyc.enabled ?? []).filter(
29777
29801
  (id) => config?.kyc.settings[id]?.subject === "group"
29778
29802
  ),
29779
29803
  [config]
29780
29804
  );
29781
29805
  const entityDefault = config?.kyc.entity_default_profile ?? null;
29782
- const refreshStatus = React55.useCallback(async () => {
29806
+ const refreshStatus = React39.useCallback(async () => {
29783
29807
  try {
29784
29808
  const s = await getIdentityStatus({ groupId });
29785
29809
  setStatus(s.status === "unverified" ? "unverified" : s.status);
29786
29810
  } catch {
29787
29811
  }
29788
29812
  }, [groupId]);
29789
- React55.useEffect(() => {
29813
+ React39.useEffect(() => {
29790
29814
  if (initialStatus !== void 0) setStatus(initialStatus);
29791
29815
  }, [initialStatus]);
29792
29816
  const startFlow = async (bindFirst) => {
@@ -30974,7 +30998,7 @@ var IncomingPaymentsInbox = ({
30974
30998
  ...hookOptions
30975
30999
  }) => {
30976
31000
  const inbox = useIncomingPayments(hookOptions);
30977
- const allPayments = React55.useMemo(
31001
+ const allPayments = React39.useMemo(
30978
31002
  () => [
30979
31003
  ...inbox.payments,
30980
31004
  ...inbox.contracts.flatMap((c) => c.payments ?? [])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yieldfabric/wallet",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Reusable YieldFabric wallet — login, signing, profile, and key management",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "author": "YieldFabric Technologies Ltd",