@volr/react 0.1.118 → 0.1.120

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
@@ -20425,6 +20425,15 @@ function detectPlatform2() {
20425
20425
  function detectBrowser() {
20426
20426
  if (typeof navigator === "undefined") return "Unknown";
20427
20427
  const ua = navigator.userAgent;
20428
+ if (/KAKAOTALK/i.test(ua)) return "KakaoTalk-InApp";
20429
+ if (/NAVER\(/i.test(ua)) return "Naver-InApp";
20430
+ if (/Line\//i.test(ua)) return "Line-InApp";
20431
+ if (/MetaMaskMobile/i.test(ua)) return "MetaMask-InApp";
20432
+ if (/FB_IAB|FBAN/i.test(ua)) return "Facebook-InApp";
20433
+ if (/Instagram/i.test(ua)) return "Instagram-InApp";
20434
+ if (/Telegram/i.test(ua)) return "Telegram-InApp";
20435
+ if (/SamsungBrowser/i.test(ua)) return "Samsung";
20436
+ if (/Whale/i.test(ua)) return "Whale";
20428
20437
  if (/Edg/.test(ua)) return "Edge";
20429
20438
  if (/Chrome/.test(ua) && !/Chromium/.test(ua)) return "Chrome";
20430
20439
  if (/Safari/.test(ua) && !/Chrome/.test(ua)) return "Safari";
@@ -20432,6 +20441,36 @@ function detectBrowser() {
20432
20441
  if (/Opera|OPR/.test(ua)) return "Opera";
20433
20442
  return "Unknown";
20434
20443
  }
20444
+ function isInAppBrowser() {
20445
+ const browser = detectBrowser();
20446
+ return browser.includes("-InApp");
20447
+ }
20448
+ function getBrowserVersion() {
20449
+ if (typeof navigator === "undefined") return { browser: "Unknown", version: 0 };
20450
+ const ua = navigator.userAgent;
20451
+ const edgeMatch = ua.match(/Edg\/(\d+)/);
20452
+ if (edgeMatch) return { browser: "Edge", version: parseInt(edgeMatch[1]) };
20453
+ const samsungMatch = ua.match(/SamsungBrowser\/(\d+)/);
20454
+ if (samsungMatch) return { browser: "Samsung", version: parseInt(samsungMatch[1]) };
20455
+ const chromeMatch = ua.match(/Chrome\/(\d+)/);
20456
+ if (chromeMatch && !/Edg/.test(ua)) return { browser: "Chrome", version: parseInt(chromeMatch[1]) };
20457
+ const safariMatch = ua.match(/Version\/(\d+)\.(\d+)/);
20458
+ if (safariMatch && /Safari/.test(ua) && !/Chrome/.test(ua)) {
20459
+ return { browser: "Safari", version: parseFloat(`${safariMatch[1]}.${safariMatch[2]}`) };
20460
+ }
20461
+ const firefoxMatch = ua.match(/Firefox\/(\d+)/);
20462
+ if (firefoxMatch) return { browser: "Firefox", version: parseInt(firefoxMatch[1]) };
20463
+ return { browser: "Unknown", version: 0 };
20464
+ }
20465
+ function getIOSVersion() {
20466
+ if (typeof navigator === "undefined") return null;
20467
+ const ua = navigator.userAgent;
20468
+ const match = ua.match(/OS (\d+)_(\d+)/);
20469
+ if (match) {
20470
+ return parseFloat(`${match[1]}.${match[2]}`);
20471
+ }
20472
+ return null;
20473
+ }
20435
20474
  function checkPrfSupport() {
20436
20475
  const platform = detectPlatform2();
20437
20476
  const browser = detectBrowser();
@@ -20549,6 +20588,139 @@ async function checkPrfExtensionAvailable() {
20549
20588
  const { prfSupported } = checkPrfSupport();
20550
20589
  return prfSupported;
20551
20590
  }
20591
+ var MIN_BROWSER_VERSIONS = {
20592
+ Chrome: 109,
20593
+ Edge: 109,
20594
+ Safari: 17.4,
20595
+ Samsung: 21
20596
+ // Samsung Internet 21+ is based on Chromium 109+
20597
+ };
20598
+ var MIN_IOS_VERSION = 17.4;
20599
+ function checkPrfCompatibility() {
20600
+ const platform = detectPlatform2();
20601
+ const browser = detectBrowser();
20602
+ const { browser: browserName, version: browserVersion } = getBrowserVersion();
20603
+ const baseResult = {
20604
+ platform,
20605
+ browser,
20606
+ browserVersion
20607
+ };
20608
+ if (isInAppBrowser()) {
20609
+ return {
20610
+ ...baseResult,
20611
+ supported: false,
20612
+ reason: "inapp-browser",
20613
+ messageKey: "passkey.compatibility.inAppBrowser",
20614
+ action: "use-external-browser"
20615
+ };
20616
+ }
20617
+ if (browserName === "Firefox") {
20618
+ return {
20619
+ ...baseResult,
20620
+ supported: false,
20621
+ reason: "unsupported-browser",
20622
+ messageKey: "passkey.compatibility.firefoxNotSupported",
20623
+ action: "use-chrome"
20624
+ };
20625
+ }
20626
+ if (browser === "Whale") {
20627
+ return {
20628
+ ...baseResult,
20629
+ supported: false,
20630
+ reason: "unsupported-browser",
20631
+ messageKey: "passkey.compatibility.whaleNotSupported",
20632
+ action: "use-chrome"
20633
+ };
20634
+ }
20635
+ if (browserName === "Chrome" && browserVersion < MIN_BROWSER_VERSIONS.Chrome) {
20636
+ return {
20637
+ ...baseResult,
20638
+ supported: false,
20639
+ reason: "outdated-browser",
20640
+ messageKey: "passkey.compatibility.outdatedChrome",
20641
+ action: "update-browser"
20642
+ };
20643
+ }
20644
+ if (browserName === "Edge" && browserVersion < MIN_BROWSER_VERSIONS.Edge) {
20645
+ return {
20646
+ ...baseResult,
20647
+ supported: false,
20648
+ reason: "outdated-browser",
20649
+ messageKey: "passkey.compatibility.outdatedEdge",
20650
+ action: "update-browser"
20651
+ };
20652
+ }
20653
+ if (browserName === "Safari" && browserVersion < MIN_BROWSER_VERSIONS.Safari) {
20654
+ return {
20655
+ ...baseResult,
20656
+ supported: false,
20657
+ reason: "outdated-browser",
20658
+ messageKey: "passkey.compatibility.outdatedSafari",
20659
+ action: "update-browser"
20660
+ };
20661
+ }
20662
+ if (browserName === "Samsung" && browserVersion < MIN_BROWSER_VERSIONS.Samsung) {
20663
+ return {
20664
+ ...baseResult,
20665
+ supported: false,
20666
+ reason: "outdated-browser",
20667
+ messageKey: "passkey.compatibility.outdatedSamsung",
20668
+ action: "update-browser"
20669
+ };
20670
+ }
20671
+ if (platform === "iOS") {
20672
+ const iosVersion = getIOSVersion();
20673
+ if (iosVersion && iosVersion < MIN_IOS_VERSION) {
20674
+ return {
20675
+ ...baseResult,
20676
+ supported: false,
20677
+ reason: "outdated-os",
20678
+ messageKey: "passkey.compatibility.outdatedIOS",
20679
+ action: "update-os"
20680
+ };
20681
+ }
20682
+ }
20683
+ if (browserName === "Unknown") {
20684
+ return {
20685
+ ...baseResult,
20686
+ supported: true,
20687
+ messageKey: "passkey.compatibility.unknownBrowser"
20688
+ };
20689
+ }
20690
+ return {
20691
+ ...baseResult,
20692
+ supported: true
20693
+ };
20694
+ }
20695
+ function getPlatformHint(platform) {
20696
+ switch (platform) {
20697
+ case "macOS":
20698
+ return {
20699
+ hintKey: "passkey.hint.macOS",
20700
+ noteKey: "passkey.hint.note"
20701
+ };
20702
+ case "iOS":
20703
+ return {
20704
+ hintKey: "passkey.hint.iOS",
20705
+ noteKey: "passkey.hint.note"
20706
+ };
20707
+ case "Android":
20708
+ return {
20709
+ hintKey: "passkey.hint.android",
20710
+ noteKey: "passkey.hint.note"
20711
+ };
20712
+ case "Windows":
20713
+ return {
20714
+ hintKey: "passkey.hint.windows",
20715
+ noteKey: "passkey.hint.note"
20716
+ };
20717
+ default:
20718
+ return {
20719
+ hintKey: "passkey.hint.default",
20720
+ noteKey: "passkey.hint.note"
20721
+ };
20722
+ }
20723
+ }
20552
20724
  function blobToBase642(blob) {
20553
20725
  return new Promise((resolve, reject) => {
20554
20726
  const reader = new FileReader();
@@ -20926,6 +21098,7 @@ exports.VolrProvider = VolrProvider;
20926
21098
  exports.analyzeContractForEIP7702 = analyzeContractForEIP7702;
20927
21099
  exports.buildCall = buildCall;
20928
21100
  exports.buildCalls = buildCalls;
21101
+ exports.checkPrfCompatibility = checkPrfCompatibility;
20929
21102
  exports.checkPrfExtensionAvailable = checkPrfExtensionAvailable;
20930
21103
  exports.checkPrfSupport = checkPrfSupport;
20931
21104
  exports.compareERC20Balances = compareERC20Balances;
@@ -20937,11 +21110,15 @@ exports.debugTransactionFailure = debugTransactionFailure;
20937
21110
  exports.defaultIdempotencyKey = defaultIdempotencyKey;
20938
21111
  exports.detectWalletConnector = detectWalletConnector;
20939
21112
  exports.diagnoseTransactionFailure = diagnoseTransactionFailure;
21113
+ exports.getBrowserVersion = getBrowserVersion;
20940
21114
  exports.getERC20Balance = getERC20Balance;
21115
+ exports.getIOSVersion = getIOSVersion;
20941
21116
  exports.getPasskeyAuthGuidance = getPasskeyAuthGuidance;
21117
+ exports.getPlatformHint = getPlatformHint;
20942
21118
  exports.getUserCredentials = getUserCredentials;
20943
21119
  exports.getWalletState = getWalletState;
20944
21120
  exports.isEIP7702Delegated = isEIP7702Delegated;
21121
+ exports.isInAppBrowser = isInAppBrowser;
20945
21122
  exports.isUserCancelledError = isUserCancelledError;
20946
21123
  exports.listenForSeedRequests = listenForSeedRequests;
20947
21124
  exports.normalizeHex = normalizeHex;