@lumiapassport/ui-kit 1.13.11 → 1.14.1

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/README.md CHANGED
@@ -138,46 +138,13 @@ That's it! The `ConnectWalletButton` provides a complete authentication UI with
138
138
  title: 'Welcome to MyApp',
139
139
  subtitle: 'Sign in to continue',
140
140
 
141
- // beta
142
- dialogClassName: 'string',
141
+ dialogClassName: 'string', // beta
143
142
 
144
143
  authOrder: ['email', 'passkey', 'social'],
145
144
 
146
145
  branding: {
147
146
  tagline: 'Powered by MPC',
148
- link: { text: 'Learn More', url: 'https://example.com/docs' },
149
- },
150
-
151
- // TO BE DEPRECATED, cssv is used
152
- colors: {
153
- dark: {
154
- background: '#060117',
155
- text: '#fefdff',
156
- textSecondary: '#c4c2c7',
157
- textMuted: '#8a8890',
158
- border: '#2a1a3a',
159
- buttonBackground: '#ff6b35',
160
- buttonBackgroundEnd: '#f7931e',
161
- buttonText: '#ffffff',
162
- buttonBackgroundHover: '#e55a2b',
163
- buttonBackgroundHoverEnd: '#d67d1a',
164
- connectedButtonBackground: 'rgba(27, 90, 226, 0.6)',
165
- connectedButtonBorder: '#4a5568'
166
- },
167
- light: {
168
- background: '#fefdff',
169
- text: '#060117',
170
- textSecondary: '#4a4754',
171
- textMuted: '#6b6a70',
172
- border: '#e0dde6',
173
- buttonBackground: '#9333ea',
174
- buttonBackgroundEnd: '#2563eb',
175
- buttonText: '#fefdff',
176
- buttonBackgroundHover: '#7e22ce',
177
- buttonBackgroundHoverEnd: '#1d4ed8',
178
- connectedButtonBackground: '#f3f4f6',
179
- connectedButtonBorder: '#d1d5db'
180
- }
147
+ link: { text: 'Learn More', url: \'https\:\/\/example.com/docs\' },
181
148
  },
182
149
  },
183
150
 
@@ -234,8 +201,8 @@ That's it! The `ConnectWalletButton` provides a complete authentication UI with
234
201
  name: 'Lumia Beam',
235
202
  symbol: 'LUMIA',
236
203
  chainId: 2030232745,
237
- rpcUrl: 'https://beam-rpc.lumia.org',
238
- explorerUrl: 'https://beam-explorer.lumia.org',
204
+ rpcUrl: 'https\:\/\/beam-rpc.lumia.org',
205
+ explorerUrl: 'https\:\/\/beam-explorer.lumia.org',
239
206
  testnet: true,
240
207
  },
241
208
  }}
@@ -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.13.11</title>
18
+ <title>Lumia Passport Secure Wallet - iframe version 1.14.1</title>
19
19
 
20
20
  <!-- Styles will be injected by build process -->
21
21
  <style>
@@ -120,7 +120,6 @@
120
120
  display: flex;
121
121
  align-items: center;
122
122
  justify-content: center;
123
-
124
123
  font-size: 20px;
125
124
  font-weight: 600;
126
125
  width: 64px;
@@ -248,11 +247,11 @@
248
247
  left: 0;
249
248
  right: 0;
250
249
  bottom: 0;
251
- /* background: rgba(0, 0, 0, 0.8); */
252
250
  display: flex;
253
251
  align-items: center;
254
252
  justify-content: center;
255
253
  z-index: 10000;
254
+ backdrop-filter: blur(10px);
256
255
  }
257
256
 
258
257
  .modal-content {
@@ -2787,33 +2787,24 @@ var DKGManager = class extends TokenRefreshApiClient {
2787
2787
  };
2788
2788
 
2789
2789
  // src/iframe/lib/onramp/utils.ts
2790
- var LP_JWT_TOKENS_LS_KEY = "lumia-passport-jwt-tokens";
2791
- function getBearer() {
2792
- try {
2793
- const sessionString = localStorage.getItem(LP_JWT_TOKENS_LS_KEY);
2794
- if (!sessionString) return null;
2795
- const session = JSON.parse(sessionString);
2796
- if (session && typeof session.accessToken === "string" && typeof session.userId === "string") {
2797
- return `Bearer ${session.accessToken}`;
2798
- }
2799
- return null;
2800
- } catch (error) {
2801
- console.error("Failed to parse Lumia Passport session:", error);
2802
- return null;
2790
+ function omit(object, ...keys) {
2791
+ const result = { ...object };
2792
+ for (const key of keys) {
2793
+ delete result[key];
2803
2794
  }
2795
+ return result;
2804
2796
  }
2805
2797
 
2806
2798
  // src/iframe/lib/onramp/binance.ts
2807
2799
  var API_DOMAIN = "https://api.lumiapassport.com/on-ramp";
2808
2800
  var BinanceOnrampAPI = class {
2809
- async checkIsLumaiAvailableQuery() {
2810
- const auth = getBearer();
2801
+ constructor(sendResponseFn) {
2802
+ this.sendResponseFn = sendResponseFn;
2803
+ }
2804
+ async checkIsLumaiAvailableQuery(accessToken) {
2811
2805
  const response = await fetch(`${API_DOMAIN}/api/binance/pairs`, {
2812
2806
  method: "POST",
2813
- headers: {
2814
- "Content-Type": "application/json",
2815
- ...auth && { Authorization: auth }
2816
- }
2807
+ headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } }
2817
2808
  });
2818
2809
  const data = await response.json();
2819
2810
  if (!data.success) {
@@ -2825,14 +2816,10 @@ var BinanceOnrampAPI = class {
2825
2816
  }
2826
2817
  return !!data.data.cryptoCurrencies.includes("LUMIA");
2827
2818
  }
2828
- async getLumiaNetworkQuery() {
2829
- const auth = getBearer();
2819
+ async getLumiaNetworkQuery(accessToken) {
2830
2820
  const response = await fetch(`${API_DOMAIN}/api/binance/networks`, {
2831
2821
  method: "POST",
2832
- headers: {
2833
- "Content-Type": "application/json",
2834
- ...auth && { Authorization: auth }
2835
- }
2822
+ headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } }
2836
2823
  });
2837
2824
  const data = await response.json();
2838
2825
  if (!data?.success) {
@@ -2845,14 +2832,10 @@ var BinanceOnrampAPI = class {
2845
2832
  }
2846
2833
  return lumiaNetwork;
2847
2834
  }
2848
- async getPaymentMethodsQuery(payload) {
2849
- const auth = getBearer();
2835
+ async getPaymentMethodsQuery(payload, accessToken) {
2850
2836
  const response = await fetch(`${API_DOMAIN}/api/binance/modes`, {
2851
2837
  method: "POST",
2852
- headers: {
2853
- "Content-Type": "application/json",
2854
- ...auth && { Authorization: auth }
2855
- },
2838
+ headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
2856
2839
  body: JSON.stringify(payload)
2857
2840
  });
2858
2841
  const data = await response.json();
@@ -2864,14 +2847,10 @@ var BinanceOnrampAPI = class {
2864
2847
  }
2865
2848
  return data.data.paymentMethods;
2866
2849
  }
2867
- async getQuoteQuery(payload) {
2868
- const auth = getBearer();
2850
+ async getQuoteQuery(payload, accessToken) {
2869
2851
  const response = await fetch(`${API_DOMAIN}/api/binance/quote`, {
2870
2852
  method: "POST",
2871
- headers: {
2872
- "Content-Type": "application/json",
2873
- ...auth && { Authorization: auth }
2874
- },
2853
+ headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
2875
2854
  body: JSON.stringify(payload)
2876
2855
  });
2877
2856
  const data = await response.json();
@@ -2880,14 +2859,10 @@ var BinanceOnrampAPI = class {
2880
2859
  }
2881
2860
  return data.data;
2882
2861
  }
2883
- async createPreorderMutation(payload) {
2884
- const auth = getBearer();
2862
+ async createPreorderMutation(payload, accessToken) {
2885
2863
  const response = await fetch(`${API_DOMAIN}/api/binance/pre-order`, {
2886
2864
  method: "POST",
2887
- headers: {
2888
- "Content-Type": "application/json",
2889
- ...auth && { Authorization: auth }
2890
- },
2865
+ headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
2891
2866
  body: JSON.stringify(payload)
2892
2867
  });
2893
2868
  const data = await response.json();
@@ -2896,29 +2871,33 @@ var BinanceOnrampAPI = class {
2896
2871
  }
2897
2872
  return data.data;
2898
2873
  }
2899
- async handleMessage(message, origin, sendResponseFn) {
2874
+ async handleMessage(message, origin) {
2900
2875
  const { type, messageId, data } = message;
2876
+ const { accessToken } = message.data;
2901
2877
  console.log("[ BINANCE Received message ]", type, message);
2902
2878
  switch (type) {
2903
2879
  case "BINANCE_CHECK_IS_LUMIA_AVAILABLE_QUERY":
2904
- const isLumiaAvalableRes = await this.checkIsLumaiAvailableQuery();
2905
- sendResponseFn(messageId, isLumiaAvalableRes, origin);
2880
+ const isLumiaAvalableRes = await this.checkIsLumaiAvailableQuery(accessToken);
2881
+ this.sendResponseFn(messageId, isLumiaAvalableRes, origin);
2906
2882
  break;
2907
2883
  case "BINANCE_GET_LUMIA_NETWORK_QUERY":
2908
- const lumiaNetworkResponse = await this.getLumiaNetworkQuery();
2909
- sendResponseFn(messageId, lumiaNetworkResponse, origin);
2884
+ const lumiaNetworkResponse = await this.getLumiaNetworkQuery(accessToken);
2885
+ this.sendResponseFn(messageId, lumiaNetworkResponse, origin);
2910
2886
  break;
2911
2887
  case "BINANCE_GET_PAYMENT_METHODS_QUERY":
2912
- const paymentMethodsResponse = await this.getPaymentMethodsQuery(this.ensurePayload(data, "methods"));
2913
- sendResponseFn(messageId, paymentMethodsResponse, origin);
2888
+ const paymentMethodsResponse = await this.getPaymentMethodsQuery(
2889
+ this.ensurePayload(data, "methods"),
2890
+ accessToken
2891
+ );
2892
+ this.sendResponseFn(messageId, paymentMethodsResponse, origin);
2914
2893
  break;
2915
2894
  case "BINANCE_GET_QUOTE_QUERY":
2916
- const quoteResponse = await this.getQuoteQuery(this.ensurePayload(data, "quote"));
2917
- sendResponseFn(messageId, quoteResponse, origin);
2895
+ const quoteResponse = await this.getQuoteQuery(this.ensurePayload(data, "quote"), accessToken);
2896
+ this.sendResponseFn(messageId, quoteResponse, origin);
2918
2897
  break;
2919
2898
  case "BINANCE_CREATE_PREORDER_MUTATION":
2920
- const preorderResponse = await this.createPreorderMutation(this.ensurePayload(data, "preorder"));
2921
- sendResponseFn(messageId, preorderResponse, origin);
2899
+ const preorderResponse = await this.createPreorderMutation(this.ensurePayload(data, "preorder"), accessToken);
2900
+ this.sendResponseFn(messageId, preorderResponse, origin);
2922
2901
  break;
2923
2902
  default:
2924
2903
  throw new Error(`[ BINANCE ]: Unknown message type: ${type}`);
@@ -2928,7 +2907,7 @@ var BinanceOnrampAPI = class {
2928
2907
  if (!data || typeof data !== "object") {
2929
2908
  throw new Error(`Invalid payload: expected object, got ${typeof data}`);
2930
2909
  }
2931
- const payload = data;
2910
+ const payload = omit(data, "accessToken");
2932
2911
  switch (type) {
2933
2912
  case "methods":
2934
2913
  if (typeof payload.totalAmount !== "string") {
@@ -2980,23 +2959,21 @@ var BinanceOnrampAPI = class {
2980
2959
  // src/iframe/lib/onramp/rampnow.ts
2981
2960
  var API_DOMAIN2 = "https://api.lumiapassport.com/on-ramp";
2982
2961
  var RampnowOnrampAPI = class {
2983
- async getRampnowConfigQuery() {
2984
- const auth = getBearer();
2962
+ constructor(sendResponseFn) {
2963
+ this.sendResponseFn = sendResponseFn;
2964
+ }
2965
+ async getRampnowConfigQuery(accessToken) {
2985
2966
  const response = await fetch(`${API_DOMAIN2}/api/rampnow/cfg`, {
2986
2967
  method: "GET",
2987
- headers: { ...auth && { Authorization: auth } }
2968
+ headers: { ...accessToken && { Authorization: `Bearer ${accessToken}` } }
2988
2969
  });
2989
2970
  const data = await response.json();
2990
2971
  return data;
2991
2972
  }
2992
- async getRampOrderQuoteQuery(payload) {
2993
- const auth = getBearer();
2973
+ async getRampOrderQuoteQuery(payload, accessToken) {
2994
2974
  const response = await fetch(`${API_DOMAIN2}/api/rampnow/quote`, {
2995
2975
  method: "POST",
2996
- headers: {
2997
- "Content-Type": "application/json",
2998
- ...auth && { Authorization: auth }
2999
- },
2976
+ headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
3000
2977
  body: JSON.stringify(payload)
3001
2978
  });
3002
2979
  const data = await response.json();
@@ -3009,7 +2986,7 @@ var RampnowOnrampAPI = class {
3009
2986
  if (typeof payload !== "object" || payload === null || typeof payload?.paymentMode !== "string" || typeof payload?.srcAmount !== "number" || typeof payload?.walletAddress !== "string") {
3010
2987
  throw new Error("Invalid Ramp order quote payload");
3011
2988
  }
3012
- return payload;
2989
+ return omit(payload, "accessToken");
3013
2990
  }
3014
2991
  // UNUSED due to Rampnow APP redirect order flow
3015
2992
  // async ctreateChekoutOrderMutation(payload: CreateCheckoutOrderMutationPayload) {
@@ -3021,17 +2998,18 @@ var RampnowOnrampAPI = class {
3021
2998
  // })
3022
2999
  // return checkoutedOrderData
3023
3000
  // }
3024
- async handleMessage(message, origin, sendResponseFn) {
3001
+ async handleMessage(message, origin) {
3025
3002
  const { type, data, messageId } = message;
3026
- console.log("[ BINANCE Received message ]", type, message);
3003
+ const { accessToken } = message.data;
3004
+ console.log("[ RAMPNOW Received message ]", type, message);
3027
3005
  switch (type) {
3028
3006
  case "RAMPNOW_GET_CONFIG":
3029
- const ramnowCfg = await this.getRampnowConfigQuery();
3030
- sendResponseFn(messageId, ramnowCfg, origin);
3007
+ const ramnowCfg = await this.getRampnowConfigQuery(accessToken);
3008
+ this.sendResponseFn(messageId, ramnowCfg, origin);
3031
3009
  break;
3032
3010
  case "RAMPNOW_GET_ORDER_QUOTE":
3033
- const orderQuote = await this.getRampOrderQuoteQuery(this.ensureOrderQuotePayload(data));
3034
- sendResponseFn(messageId, orderQuote, origin);
3011
+ const orderQuote = await this.getRampOrderQuoteQuery(this.ensureOrderQuotePayload(data), accessToken);
3012
+ this.sendResponseFn(messageId, orderQuote, origin);
3035
3013
  break;
3036
3014
  default:
3037
3015
  throw new Error(`[ RAMPNOW ]: Unknown message type: ${type}`);
@@ -4258,13 +4236,12 @@ var SigningManager = class extends TokenRefreshApiClient {
4258
4236
  };
4259
4237
 
4260
4238
  // src/iframe/main.ts
4261
- var IFRAME_VERSION = "1.13.11";
4239
+ var IFRAME_VERSION = "1.14.1";
4262
4240
  var IframeWallet = class {
4263
4241
  constructor() {
4264
4242
  console.log("=".repeat(60));
4265
4243
  console.log(` Lumia Passport Secure Wallet - iframe version ${IFRAME_VERSION}`);
4266
4244
  console.log("=".repeat(60));
4267
- this.applyThemeColors();
4268
4245
  this.messenger = new SecureMessenger();
4269
4246
  this.sessionManager = new SessionManager();
4270
4247
  this.dkgManager = new DKGManager();
@@ -4273,36 +4250,8 @@ var IframeWallet = class {
4273
4250
  this.storage = new StorageManager();
4274
4251
  this.trustedApps = new TrustedAppsManager();
4275
4252
  this.backupManager = new BackupManager();
4276
- this.binance = new BinanceOnrampAPI();
4277
- this.rampnow = new RampnowOnrampAPI();
4278
- }
4279
- applyThemeColors() {
4280
- try {
4281
- const params = new URLSearchParams(window.location.search);
4282
- const bg = params.get("bg");
4283
- const text = params.get("text");
4284
- const textSec = params.get("textSec");
4285
- const border = params.get("border");
4286
- if (bg || text || textSec || border) {
4287
- const root = document.documentElement;
4288
- if (bg) {
4289
- root.style.setProperty("--iframe-bg", bg);
4290
- root.style.setProperty("--iframe-modal-bg", bg);
4291
- }
4292
- if (text) {
4293
- root.style.setProperty("--iframe-text", text);
4294
- }
4295
- if (textSec) {
4296
- root.style.setProperty("--iframe-text-secondary", textSec);
4297
- }
4298
- if (border) {
4299
- root.style.setProperty("--iframe-border", border);
4300
- }
4301
- console.log("[IframeWallet] Applied theme colors:", { bg, text, textSec, border });
4302
- }
4303
- } catch (error) {
4304
- console.warn("[IframeWallet] Failed to apply theme colors:", error);
4305
- }
4253
+ this.binance = new BinanceOnrampAPI(this.messenger.sendResponse.bind(this.messenger));
4254
+ this.rampnow = new RampnowOnrampAPI(this.messenger.sendResponse.bind(this.messenger));
4306
4255
  }
4307
4256
  async initialize() {
4308
4257
  if (window.location.hostname !== "localhost" && window.location.hostname !== "127.0.0.1" && !window.location.hostname.includes("lumiapassport.com")) {
@@ -4326,14 +4275,13 @@ var IframeWallet = class {
4326
4275
  }
4327
4276
  async handleMessage(message, origin) {
4328
4277
  const { type, messageId, projectId } = message;
4329
- console.log("[IFRAME INTERNAL] message", type, message);
4330
4278
  try {
4331
4279
  switch (true) {
4332
4280
  case type.startsWith("BINANCE_"):
4333
- await this.binance.handleMessage(message, origin, this.messenger.sendResponse.bind(this.messenger));
4281
+ await this.binance.handleMessage(message, origin);
4334
4282
  break;
4335
4283
  case type.startsWith("RAMPNOW_"):
4336
- await this.rampnow.handleMessage(message, origin, this.messenger.sendResponse.bind(this.messenger));
4284
+ await this.rampnow.handleMessage(message, origin);
4337
4285
  break;
4338
4286
  case type === "SDK_AUTH":
4339
4287
  await this.handleSDKAuth(message, origin);