@volr/react 0.2.7 → 0.3.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/dist/index.cjs CHANGED
@@ -9342,7 +9342,8 @@ var APIClient = class {
9342
9342
  "/auth/siwe/verify",
9343
9343
  "/auth/email/send-code",
9344
9344
  "/auth/email/verify-code",
9345
- "/auth/social/"
9345
+ "/auth/social/",
9346
+ "/auth/verify"
9346
9347
  ];
9347
9348
  const isPublicAuthEndpoint = publicAuthEndpoints.some(
9348
9349
  (endpoint) => requestUrl.includes(endpoint)
@@ -9561,6 +9562,15 @@ var APIClient = class {
9561
9562
  throw error;
9562
9563
  }
9563
9564
  }
9565
+ /**
9566
+ * Verify the current access token and return decoded claims
9567
+ */
9568
+ async verifyToken() {
9569
+ if (!this.accessToken) {
9570
+ throw new Error("No access token available. Please log in first.");
9571
+ }
9572
+ return this.post("/auth/verify", { accessToken: this.accessToken });
9573
+ }
9564
9574
  /**
9565
9575
  * POST request that returns raw binary (ArrayBuffer)
9566
9576
  * - Uses axios instance with interceptors (auto 401 refresh)
@@ -9797,8 +9807,8 @@ var AUTHENTICATOR_SELECTION_CROSS_DEVICE = {
9797
9807
  residentKey: "required",
9798
9808
  authenticatorAttachment: "cross-platform"
9799
9809
  };
9800
- function getAuthenticatorSelection(options) {
9801
- if (shouldForceCrossDevice() && !options?.allowPlatform) {
9810
+ function getAuthenticatorSelection() {
9811
+ if (shouldForceCrossDevice()) {
9802
9812
  return AUTHENTICATOR_SELECTION_CROSS_DEVICE;
9803
9813
  }
9804
9814
  return AUTHENTICATOR_SELECTION;
@@ -20284,7 +20294,7 @@ async function enrollPasskey(params) {
20284
20294
  };
20285
20295
  const prfSalt = sdkCore.deriveWrapKey(tempPrfInput);
20286
20296
  const displayName = buildDisplayName(userEmail, userEvmAddress, userId);
20287
- const authenticatorSelection = getAuthenticatorSelection({ allowPlatform: true });
20297
+ const authenticatorSelection = getAuthenticatorSelection();
20288
20298
  const hints = getWebAuthnHints();
20289
20299
  const publicKeyCredentialCreationOptions = {
20290
20300
  challenge: challenge2,
@@ -21373,7 +21383,7 @@ async function completeMigration(params) {
21373
21383
  credentialId: tempCredentialId
21374
21384
  };
21375
21385
  const prfSalt = sdkCore.deriveWrapKey(tempPrfInput);
21376
- const authenticatorSelection = getAuthenticatorSelection({ allowPlatform: true });
21386
+ const authenticatorSelection = getAuthenticatorSelection();
21377
21387
  const hints = getWebAuthnHints();
21378
21388
  const publicKeyCredentialCreationOptions = {
21379
21389
  challenge: challenge2,
@@ -21553,6 +21563,74 @@ function detectWalletConnector(provider, providerInfo) {
21553
21563
  if (provider.isPhantom) return "app.phantom";
21554
21564
  return "unknown";
21555
21565
  }
21566
+
21567
+ // src/utils/currency.ts
21568
+ function formatCurrency(amount, currencyCode, locale) {
21569
+ try {
21570
+ return new Intl.NumberFormat(locale ?? navigator?.language ?? "en-US", {
21571
+ style: "currency",
21572
+ currency: currencyCode
21573
+ }).format(amount);
21574
+ } catch (error) {
21575
+ return `${currencyCode} ${amount.toLocaleString()}`;
21576
+ }
21577
+ }
21578
+ function formatCurrencyWithOptions(amount, currencyCode, options) {
21579
+ try {
21580
+ return new Intl.NumberFormat(options?.locale ?? navigator?.language ?? "en-US", {
21581
+ style: "currency",
21582
+ currency: currencyCode,
21583
+ minimumFractionDigits: options?.minimumFractionDigits,
21584
+ maximumFractionDigits: options?.maximumFractionDigits
21585
+ }).format(amount);
21586
+ } catch (error) {
21587
+ return `${currencyCode} ${amount.toLocaleString()}`;
21588
+ }
21589
+ }
21590
+ function getCurrencySymbol(currencyCode, locale) {
21591
+ try {
21592
+ const formatted = new Intl.NumberFormat(locale ?? "en-US", {
21593
+ style: "currency",
21594
+ currency: currencyCode,
21595
+ currencyDisplay: "narrowSymbol"
21596
+ }).format(0);
21597
+ return formatted.replace(/[\d.,\s]/g, "").trim();
21598
+ } catch (error) {
21599
+ return currencyCode;
21600
+ }
21601
+ }
21602
+ function detectPreferredCurrency() {
21603
+ if (typeof navigator === "undefined") return "USD";
21604
+ const locale = navigator.language || "en-US";
21605
+ const region = locale.split("-")[1]?.toUpperCase();
21606
+ const localeToCurrency = {
21607
+ US: "USD",
21608
+ KR: "KRW",
21609
+ JP: "JPY",
21610
+ CN: "CNY",
21611
+ GB: "GBP",
21612
+ DE: "EUR",
21613
+ FR: "EUR",
21614
+ IT: "EUR",
21615
+ ES: "EUR",
21616
+ NL: "EUR",
21617
+ AT: "EUR",
21618
+ BE: "EUR",
21619
+ AU: "AUD",
21620
+ CA: "CAD",
21621
+ CH: "CHF",
21622
+ SG: "SGD",
21623
+ HK: "HKD"
21624
+ };
21625
+ return localeToCurrency[region] || "USD";
21626
+ }
21627
+ function parseCurrency(formattedValue) {
21628
+ const cleaned = formattedValue.replace(/[^\d.,-]/g, "");
21629
+ if (/,\d{2}$/.test(cleaned)) {
21630
+ return parseFloat(cleaned.replace(/\./g, "").replace(",", "."));
21631
+ }
21632
+ return parseFloat(cleaned.replace(/,/g, ""));
21633
+ }
21556
21634
  /*! Bundled license information:
21557
21635
 
21558
21636
  @noble/hashes/esm/utils.js:
@@ -21618,9 +21696,13 @@ exports.createPasskeyAdapter = createPasskeyAdapter;
21618
21696
  exports.debugTransactionFailure = debugTransactionFailure;
21619
21697
  exports.decryptEntropyForMigration = decryptEntropyForMigration;
21620
21698
  exports.defaultIdempotencyKey = defaultIdempotencyKey;
21699
+ exports.detectPreferredCurrency = detectPreferredCurrency;
21621
21700
  exports.detectWalletConnector = detectWalletConnector;
21622
21701
  exports.diagnoseTransactionFailure = diagnoseTransactionFailure;
21702
+ exports.formatCurrency = formatCurrency;
21703
+ exports.formatCurrencyWithOptions = formatCurrencyWithOptions;
21623
21704
  exports.getBrowserVersion = getBrowserVersion;
21705
+ exports.getCurrencySymbol = getCurrencySymbol;
21624
21706
  exports.getERC20Balance = getERC20Balance;
21625
21707
  exports.getIOSVersion = getIOSVersion;
21626
21708
  exports.getPasskeyAuthGuidance = getPasskeyAuthGuidance;
@@ -21637,6 +21719,7 @@ exports.listenForSeedRequests = listenForSeedRequests;
21637
21719
  exports.normalizeHex = normalizeHex;
21638
21720
  exports.normalizeHexArray = normalizeHexArray;
21639
21721
  exports.openMigrationPopup = openMigrationPopup;
21722
+ exports.parseCurrency = parseCurrency;
21640
21723
  exports.requestMigration = requestMigration;
21641
21724
  exports.requestSeedFromOpener = requestSeedFromOpener;
21642
21725
  exports.sendSeedToPopup = sendSeedToPopup;