@lumiapassport/ui-kit 1.14.13 → 1.14.14

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.
@@ -15,7 +15,7 @@
15
15
  <meta http-equiv="X-Content-Type-Options" content="nosniff" />
16
16
  <meta http-equiv="Referrer-Policy" content="strict-origin-when-cross-origin" />
17
17
 
18
- <title>Lumia Passport Secure Wallet - iframe version 1.14.13</title>
18
+ <title>Lumia Passport Secure Wallet - iframe version 1.14.14</title>
19
19
 
20
20
  <!-- Styles will be injected by build process -->
21
21
  <style>
@@ -3135,6 +3135,30 @@ var RampnowOnrampAPI = class {
3135
3135
  }
3136
3136
  };
3137
3137
 
3138
+ // src/lib/errors.ts
3139
+ var LumiaPassportError = class extends Error {
3140
+ constructor(message, code) {
3141
+ super(message);
3142
+ this.code = code;
3143
+ this.name = "LumiaPassportError";
3144
+ if (Error.captureStackTrace) {
3145
+ Error.captureStackTrace(this, this.constructor);
3146
+ }
3147
+ }
3148
+ };
3149
+ var _UserRejectedError = class _UserRejectedError extends LumiaPassportError {
3150
+ constructor(message = "User rejected transaction") {
3151
+ super(message, _UserRejectedError.CODE);
3152
+ this.name = "UserRejectedError";
3153
+ }
3154
+ };
3155
+ _UserRejectedError.CODE = "USER_REJECTED";
3156
+ var UserRejectedError = _UserRejectedError;
3157
+ var ErrorCodes = {
3158
+ MPC_SIGNING_ERROR: "MPC_SIGNING_ERROR",
3159
+ USER_REJECTED: UserRejectedError.CODE
3160
+ };
3161
+
3138
3162
  // src/iframe/lib/secure-messenger.ts
3139
3163
  var SecureMessenger = class {
3140
3164
  constructor() {
@@ -3256,14 +3280,19 @@ var SecureMessenger = class {
3256
3280
  console.error("[iframe][Messenger] No parent window");
3257
3281
  return;
3258
3282
  }
3283
+ const errorMessage = error instanceof Error ? error.message : error;
3284
+ const errorCode = error instanceof LumiaPassportError ? error.code : void 0;
3259
3285
  const response = {
3260
3286
  type: "LUMIA_PASSPORT_ERROR",
3261
3287
  messageId,
3262
3288
  timestamp: Date.now(),
3263
- error
3289
+ error: errorMessage,
3290
+ code: errorCode
3264
3291
  };
3265
3292
  window.parent.postMessage(response, targetOrigin);
3266
- console.log(`[iframe][Messenger] Sent error to ${targetOrigin}: ${error}`);
3293
+ console.log(
3294
+ `[iframe][Messenger] Sent error to ${targetOrigin}: ${errorMessage}${errorCode ? ` [${errorCode}]` : ""}`
3295
+ );
3267
3296
  }
3268
3297
  /**
3269
3298
  * Add allowed origin
@@ -3866,7 +3895,7 @@ var SigningManager = class extends TokenRefreshApiClient {
3866
3895
  userProfile
3867
3896
  );
3868
3897
  if (!confirmResult.confirmed) {
3869
- throw new Error("User rejected transaction");
3898
+ throw new UserRejectedError("User rejected transaction");
3870
3899
  }
3871
3900
  if (confirmResult.trustApp) {
3872
3901
  this.trustedApps.addTrustedApp(userId, projectId, origin, confirmResult.appName, confirmResult.appLogo);
@@ -4114,7 +4143,7 @@ var SigningManager = class extends TokenRefreshApiClient {
4114
4143
  userProfile
4115
4144
  );
4116
4145
  if (!confirmResult.confirmed) {
4117
- throw new Error("User rejected signature request");
4146
+ throw new UserRejectedError("User rejected signature request");
4118
4147
  }
4119
4148
  if (confirmResult.trustApp) {
4120
4149
  this.trustedApps.addTrustedApp(userId, projectId, origin, confirmResult.appName, confirmResult.appLogo);
@@ -4192,7 +4221,7 @@ var SigningManager = class extends TokenRefreshApiClient {
4192
4221
  };
4193
4222
 
4194
4223
  // src/iframe/main.ts
4195
- var IFRAME_VERSION = "1.14.13";
4224
+ var IFRAME_VERSION = "1.14.14";
4196
4225
  var IframeWallet = class {
4197
4226
  constructor() {
4198
4227
  console.log("=".repeat(60));
@@ -4292,7 +4321,7 @@ var IframeWallet = class {
4292
4321
  }
4293
4322
  } catch (error) {
4294
4323
  console.error(`[iframe] \u274C Error handling ${type}:`, error);
4295
- this.messenger.sendError(messageId, error instanceof Error ? error.message : "Unknown error", origin);
4324
+ this.messenger.sendError(messageId, error instanceof Error ? error : new Error("Unknown error"), origin);
4296
4325
  }
4297
4326
  }
4298
4327
  async handleSDKAuth(message, origin) {