@lumiapassport/ui-kit 1.4.7 → 1.4.9

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
@@ -784,7 +784,11 @@ async function ensureDkgAndGetOwner(userId, _clientSeedHex) {
784
784
  ownerAddress
785
785
  };
786
786
  } catch (error) {
787
- console.error("[IframeMPC][DKG] Error in ensureDkgAndGetOwner:", error);
787
+ (0, import_error_tracking.logSdkError)(
788
+ error instanceof Error ? error : new Error("DKG failed"),
789
+ { userId },
790
+ "iframe-mpc"
791
+ );
788
792
  throw error;
789
793
  }
790
794
  }
@@ -816,7 +820,11 @@ async function signDigestWithMpc(userId, digest32, userOpDetails) {
816
820
  currentSigningStats.totalDurationMs = endTime - startTime;
817
821
  return signature;
818
822
  } catch (error) {
819
- console.error("[IframeMPC][Sign] Error in signDigestWithMpc:", error);
823
+ (0, import_error_tracking.logSdkError)(
824
+ error instanceof Error ? error : new Error("MPC signing failed"),
825
+ { userId, hasUserOpDetails: !!userOpDetails },
826
+ "iframe-mpc"
827
+ );
820
828
  const endTime = performance.now();
821
829
  if (currentSigningStats) {
822
830
  currentSigningStats.endTime = endTime;
@@ -834,10 +842,11 @@ async function checkKeyshare(userId) {
834
842
  return { hasKeyshare: false };
835
843
  }
836
844
  }
837
- var currentSigningStats;
845
+ var import_error_tracking, currentSigningStats;
838
846
  var init_iframe_mpc_client = __esm({
839
847
  "src/internal/lib/iframe-mpc-client.ts"() {
840
848
  init_iframe_manager();
849
+ import_error_tracking = require("@lumiapassport/core/internal/error-tracking");
841
850
  currentSigningStats = null;
842
851
  }
843
852
  });
@@ -846,12 +855,13 @@ var init_iframe_mpc_client = __esm({
846
855
  function createHttpClient(baseUrl) {
847
856
  return new HttpClient(baseUrl);
848
857
  }
849
- var HttpClient, _tssClient, _vaultClient, tssClient, vaultClient;
858
+ var import_error_tracking2, HttpClient, _tssClient, _vaultClient, tssClient, vaultClient;
850
859
  var init_httpClient = __esm({
851
860
  "src/internal/clients/httpClient.ts"() {
852
861
  init_auth();
853
862
  init_base();
854
863
  init_projectId();
864
+ import_error_tracking2 = require("@lumiapassport/core/internal/error-tracking");
855
865
  HttpClient = class {
856
866
  constructor(baseUrl) {
857
867
  this.baseUrl = baseUrl.replace(/\/$/, "");
@@ -903,7 +913,11 @@ var init_httpClient = __esm({
903
913
  }
904
914
  return await this.processResponse(response);
905
915
  } catch (error) {
906
- console.error(`[HttpClient] Request failed:`, error);
916
+ (0, import_error_tracking2.logSdkError)(
917
+ error instanceof Error ? error : new Error("Network error"),
918
+ { url, method },
919
+ "http-client"
920
+ );
907
921
  return {
908
922
  success: false,
909
923
  error: error instanceof Error ? error.message : "Network error",
@@ -929,7 +943,11 @@ var init_httpClient = __esm({
929
943
  status
930
944
  };
931
945
  } catch (parseError) {
932
- console.error("[HttpClient] Failed to parse response:", parseError);
946
+ (0, import_error_tracking2.logSdkError)(
947
+ parseError instanceof Error ? parseError : new Error("Failed to parse response"),
948
+ { status },
949
+ "http-client"
950
+ );
933
951
  return {
934
952
  success: false,
935
953
  error: "Invalid response format",
@@ -1318,7 +1336,11 @@ async function deriveKEKFromPasskey(userId, requiredCredentialId) {
1318
1336
  const kekBytes = await crypto.subtle.deriveBits({ name: "HKDF", hash: "SHA-256", salt: challenge, info: new TextEncoder().encode("client-share") }, keyMaterial, 256);
1319
1337
  return kekBytes;
1320
1338
  } catch (error) {
1321
- console.error("[deriveKEKFromPasskey] Error during passkey operation:", error);
1339
+ (0, import_error_tracking3.logSdkError)(
1340
+ error instanceof Error ? error : new Error("Passkey operation failed"),
1341
+ { userId },
1342
+ "vault"
1343
+ );
1322
1344
  throw error;
1323
1345
  }
1324
1346
  }
@@ -1559,7 +1581,11 @@ async function envelopeDecryptKeyshare(envelope, userId) {
1559
1581
  const result = JSON.parse(plaintext);
1560
1582
  return result;
1561
1583
  } catch (error) {
1562
- console.error("[envelopeDecryptKeyshare] Decryption failed:", error);
1584
+ (0, import_error_tracking3.logSdkError)(
1585
+ error instanceof Error ? error : new Error("Envelope decryption failed"),
1586
+ { hasCredentialId: !!envelope.credentialId },
1587
+ "vault"
1588
+ );
1563
1589
  if (error instanceof Error && error.name === "OperationError") {
1564
1590
  const credentialHint = envelope.credentialId ? `The backup requires a specific passkey (ID: ${envelope.credentialId.slice(-8)}...)` : "The backup was encrypted with a different passkey than the one you selected";
1565
1591
  throw new Error(`Passkey mismatch: ${credentialHint}. If you have multiple passkeys, please try again and select the correct passkey that was used when creating this backup.`);
@@ -1584,7 +1610,11 @@ async function envelopeDecryptKeyshareWithPassword(envelope, password) {
1584
1610
  const result = JSON.parse(plaintext);
1585
1611
  return result;
1586
1612
  } catch (error) {
1587
- console.error("[envelopeDecryptKeyshareWithPassword] Decryption failed:", error);
1613
+ (0, import_error_tracking3.logSdkError)(
1614
+ error instanceof Error ? error : new Error("Password decryption failed"),
1615
+ { errorName: error instanceof Error ? error.name : "unknown" },
1616
+ "vault"
1617
+ );
1588
1618
  if (error instanceof Error && error.name === "OperationError") {
1589
1619
  throw new Error("Incorrect password: Unable to decrypt the backup with the provided password.");
1590
1620
  }
@@ -1658,7 +1688,11 @@ function getCurrentKeyshareBackupData(userId) {
1658
1688
  version: BACKUP_VERSION
1659
1689
  };
1660
1690
  } catch (error) {
1661
- console.error("[BACKUP] Error getting keyshare data:", error);
1691
+ (0, import_error_tracking3.logSdkError)(
1692
+ error instanceof Error ? error : new Error("Failed to get keyshare data"),
1693
+ { userId },
1694
+ "vault"
1695
+ );
1662
1696
  return null;
1663
1697
  }
1664
1698
  }
@@ -1740,9 +1774,12 @@ async function backupToCloud(userId, password, providerId, usePrivateStorage = t
1740
1774
  console.info(`[BACKUP] Uploading backup to ${provider.name}`);
1741
1775
  const fileId = await provider.upload(fileName, fileContent, usePrivateStorage);
1742
1776
  updateBackupStatus(userId, "cloud", { enabled: true, lastBackup: timestamp, error: void 0 });
1743
- console.info(`[BACKUP] Successfully uploaded backup to ${provider.name}, file ID: ${fileId}`);
1744
1777
  } catch (error) {
1745
- console.error(`[BACKUP] Cloud backup failed:`, error);
1778
+ (0, import_error_tracking3.logSdkError)(
1779
+ error instanceof Error ? error : new Error("Cloud backup failed"),
1780
+ { userId, providerId },
1781
+ "vault"
1782
+ );
1746
1783
  const errorMsg = error instanceof Error ? error.message : "Cloud backup failed";
1747
1784
  updateBackupStatus(userId, "cloud", { error: errorMsg });
1748
1785
  throw new Error(errorMsg);
@@ -1763,12 +1800,13 @@ async function getAvailableCloudProviders2() {
1763
1800
  return [];
1764
1801
  }
1765
1802
  }
1766
- var PasswordValidationError, BACKUP_MAGIC, BACKUP_VERSION;
1803
+ var import_error_tracking3, PasswordValidationError, BACKUP_MAGIC, BACKUP_VERSION;
1767
1804
  var init_vaultClient = __esm({
1768
1805
  "src/internal/vaultClient.ts"() {
1769
1806
  init_base();
1770
1807
  init_httpClient();
1771
1808
  init_passkey();
1809
+ import_error_tracking3 = require("@lumiapassport/core/internal/error-tracking");
1772
1810
  PasswordValidationError = class extends Error {
1773
1811
  constructor(message) {
1774
1812
  super(message);
@@ -2871,13 +2909,14 @@ var init_iframe_manager = __esm({
2871
2909
  });
2872
2910
 
2873
2911
  // src/context/LumiaPassportContext.tsx
2874
- var import_react, import_jsx_runtime3, LumiaPassportContext, LumiaPassportProvider, useLumiaPassportConfig;
2912
+ var import_react, import_error_tracking4, import_jsx_runtime3, LumiaPassportContext, LumiaPassportProvider, useLumiaPassportConfig;
2875
2913
  var init_LumiaPassportContext = __esm({
2876
2914
  "src/context/LumiaPassportContext.tsx"() {
2877
2915
  import_react = require("react");
2878
2916
  init_lumiaPassport();
2879
2917
  init_WagmiContext();
2880
2918
  init_iframe_manager();
2919
+ import_error_tracking4 = require("@lumiapassport/core/internal/error-tracking");
2881
2920
  import_jsx_runtime3 = require("react/jsx-runtime");
2882
2921
  LumiaPassportContext = (0, import_react.createContext)(void 0);
2883
2922
  LumiaPassportProvider = ({
@@ -2937,6 +2976,13 @@ var init_LumiaPassportContext = __esm({
2937
2976
  }
2938
2977
  } catch {
2939
2978
  }
2979
+ try {
2980
+ (0, import_error_tracking4.initSdkErrorTracking)();
2981
+ } catch (error) {
2982
+ if (process.env.NODE_ENV === "development") {
2983
+ console.warn("[LumiaPassport] Failed to initialize SDK error tracking:", error);
2984
+ }
2985
+ }
2940
2986
  return merged;
2941
2987
  });
2942
2988
  const updateConfig = (0, import_react.useCallback)((updates) => {
@@ -8492,7 +8538,7 @@ function useLumiaPassportLinkedProfiles() {
8492
8538
  // package.json
8493
8539
  var package_default = {
8494
8540
  name: "@lumiapassport/ui-kit",
8495
- version: "1.4.7",
8541
+ version: "1.4.9",
8496
8542
  description: "React UI components and hooks for Lumia Passport authentication and Account Abstraction",
8497
8543
  type: "module",
8498
8544
  main: "./dist/index.cjs",
@@ -8543,6 +8589,7 @@ var package_default = {
8543
8589
  dependencies: {
8544
8590
  "@lumiapassport/core": "workspace:*",
8545
8591
  "@rainbow-me/rainbowkit": "^2.2.8",
8592
+ "@sentry/browser": "^10.22.0",
8546
8593
  "lucide-react": "^0.454.0",
8547
8594
  qrcode: "^1.5.0"
8548
8595
  },