@lumiapassport/ui-kit 1.13.11 → 1.14.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/iframe/index.html +1 -1
- package/dist/iframe/main.js +76 -106
- package/dist/iframe/main.js.map +1 -1
- package/dist/index.cjs +89 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +89 -30
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/iframe/index.html
CHANGED
|
@@ -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.
|
|
18
|
+
<title>Lumia Passport Secure Wallet - iframe version 1.14.0</title>
|
|
19
19
|
|
|
20
20
|
<!-- Styles will be injected by build process -->
|
|
21
21
|
<style>
|
package/dist/iframe/main.js
CHANGED
|
@@ -2786,34 +2786,16 @@ var DKGManager = class extends TokenRefreshApiClient {
|
|
|
2786
2786
|
}
|
|
2787
2787
|
};
|
|
2788
2788
|
|
|
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;
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
|
|
2806
2789
|
// src/iframe/lib/onramp/binance.ts
|
|
2807
2790
|
var API_DOMAIN = "https://api.lumiapassport.com/on-ramp";
|
|
2808
2791
|
var BinanceOnrampAPI = class {
|
|
2809
|
-
|
|
2810
|
-
|
|
2792
|
+
constructor(sendResponseFn) {
|
|
2793
|
+
this.sendResponseFn = sendResponseFn;
|
|
2794
|
+
}
|
|
2795
|
+
async checkIsLumaiAvailableQuery(accessToken) {
|
|
2811
2796
|
const response = await fetch(`${API_DOMAIN}/api/binance/pairs`, {
|
|
2812
2797
|
method: "POST",
|
|
2813
|
-
headers: {
|
|
2814
|
-
"Content-Type": "application/json",
|
|
2815
|
-
...auth && { Authorization: auth }
|
|
2816
|
-
}
|
|
2798
|
+
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } }
|
|
2817
2799
|
});
|
|
2818
2800
|
const data = await response.json();
|
|
2819
2801
|
if (!data.success) {
|
|
@@ -2825,14 +2807,10 @@ var BinanceOnrampAPI = class {
|
|
|
2825
2807
|
}
|
|
2826
2808
|
return !!data.data.cryptoCurrencies.includes("LUMIA");
|
|
2827
2809
|
}
|
|
2828
|
-
async getLumiaNetworkQuery() {
|
|
2829
|
-
const auth = getBearer();
|
|
2810
|
+
async getLumiaNetworkQuery(accessToken) {
|
|
2830
2811
|
const response = await fetch(`${API_DOMAIN}/api/binance/networks`, {
|
|
2831
2812
|
method: "POST",
|
|
2832
|
-
headers: {
|
|
2833
|
-
"Content-Type": "application/json",
|
|
2834
|
-
...auth && { Authorization: auth }
|
|
2835
|
-
}
|
|
2813
|
+
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } }
|
|
2836
2814
|
});
|
|
2837
2815
|
const data = await response.json();
|
|
2838
2816
|
if (!data?.success) {
|
|
@@ -2845,14 +2823,10 @@ var BinanceOnrampAPI = class {
|
|
|
2845
2823
|
}
|
|
2846
2824
|
return lumiaNetwork;
|
|
2847
2825
|
}
|
|
2848
|
-
async getPaymentMethodsQuery(payload) {
|
|
2849
|
-
const auth = getBearer();
|
|
2826
|
+
async getPaymentMethodsQuery(payload, accessToken) {
|
|
2850
2827
|
const response = await fetch(`${API_DOMAIN}/api/binance/modes`, {
|
|
2851
2828
|
method: "POST",
|
|
2852
|
-
headers: {
|
|
2853
|
-
"Content-Type": "application/json",
|
|
2854
|
-
...auth && { Authorization: auth }
|
|
2855
|
-
},
|
|
2829
|
+
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
2856
2830
|
body: JSON.stringify(payload)
|
|
2857
2831
|
});
|
|
2858
2832
|
const data = await response.json();
|
|
@@ -2864,14 +2838,10 @@ var BinanceOnrampAPI = class {
|
|
|
2864
2838
|
}
|
|
2865
2839
|
return data.data.paymentMethods;
|
|
2866
2840
|
}
|
|
2867
|
-
async getQuoteQuery(payload) {
|
|
2868
|
-
const auth = getBearer();
|
|
2841
|
+
async getQuoteQuery(payload, accessToken) {
|
|
2869
2842
|
const response = await fetch(`${API_DOMAIN}/api/binance/quote`, {
|
|
2870
2843
|
method: "POST",
|
|
2871
|
-
headers: {
|
|
2872
|
-
"Content-Type": "application/json",
|
|
2873
|
-
...auth && { Authorization: auth }
|
|
2874
|
-
},
|
|
2844
|
+
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
2875
2845
|
body: JSON.stringify(payload)
|
|
2876
2846
|
});
|
|
2877
2847
|
const data = await response.json();
|
|
@@ -2880,14 +2850,10 @@ var BinanceOnrampAPI = class {
|
|
|
2880
2850
|
}
|
|
2881
2851
|
return data.data;
|
|
2882
2852
|
}
|
|
2883
|
-
async createPreorderMutation(payload) {
|
|
2884
|
-
const auth = getBearer();
|
|
2853
|
+
async createPreorderMutation(payload, accessToken) {
|
|
2885
2854
|
const response = await fetch(`${API_DOMAIN}/api/binance/pre-order`, {
|
|
2886
2855
|
method: "POST",
|
|
2887
|
-
headers: {
|
|
2888
|
-
"Content-Type": "application/json",
|
|
2889
|
-
...auth && { Authorization: auth }
|
|
2890
|
-
},
|
|
2856
|
+
headers: { "Content-Type": "application/json", ...accessToken && { Authorization: `Bearer ${accessToken}` } },
|
|
2891
2857
|
body: JSON.stringify(payload)
|
|
2892
2858
|
});
|
|
2893
2859
|
const data = await response.json();
|
|
@@ -2896,29 +2862,33 @@ var BinanceOnrampAPI = class {
|
|
|
2896
2862
|
}
|
|
2897
2863
|
return data.data;
|
|
2898
2864
|
}
|
|
2899
|
-
async handleMessage(message, origin
|
|
2865
|
+
async handleMessage(message, origin) {
|
|
2900
2866
|
const { type, messageId, data } = message;
|
|
2867
|
+
const { accessToken } = message.data;
|
|
2901
2868
|
console.log("[ BINANCE Received message ]", type, message);
|
|
2902
2869
|
switch (type) {
|
|
2903
2870
|
case "BINANCE_CHECK_IS_LUMIA_AVAILABLE_QUERY":
|
|
2904
|
-
const isLumiaAvalableRes = await this.checkIsLumaiAvailableQuery();
|
|
2905
|
-
sendResponseFn(messageId, isLumiaAvalableRes, origin);
|
|
2871
|
+
const isLumiaAvalableRes = await this.checkIsLumaiAvailableQuery(accessToken);
|
|
2872
|
+
this.sendResponseFn(messageId, isLumiaAvalableRes, origin);
|
|
2906
2873
|
break;
|
|
2907
2874
|
case "BINANCE_GET_LUMIA_NETWORK_QUERY":
|
|
2908
|
-
const lumiaNetworkResponse = await this.getLumiaNetworkQuery();
|
|
2909
|
-
sendResponseFn(messageId, lumiaNetworkResponse, origin);
|
|
2875
|
+
const lumiaNetworkResponse = await this.getLumiaNetworkQuery(accessToken);
|
|
2876
|
+
this.sendResponseFn(messageId, lumiaNetworkResponse, origin);
|
|
2910
2877
|
break;
|
|
2911
2878
|
case "BINANCE_GET_PAYMENT_METHODS_QUERY":
|
|
2912
|
-
const paymentMethodsResponse = await this.getPaymentMethodsQuery(
|
|
2913
|
-
|
|
2879
|
+
const paymentMethodsResponse = await this.getPaymentMethodsQuery(
|
|
2880
|
+
this.ensurePayload(data, "methods"),
|
|
2881
|
+
accessToken
|
|
2882
|
+
);
|
|
2883
|
+
this.sendResponseFn(messageId, paymentMethodsResponse, origin);
|
|
2914
2884
|
break;
|
|
2915
2885
|
case "BINANCE_GET_QUOTE_QUERY":
|
|
2916
|
-
const quoteResponse = await this.getQuoteQuery(this.ensurePayload(data, "quote"));
|
|
2917
|
-
sendResponseFn(messageId, quoteResponse, origin);
|
|
2886
|
+
const quoteResponse = await this.getQuoteQuery(this.ensurePayload(data, "quote"), accessToken);
|
|
2887
|
+
this.sendResponseFn(messageId, quoteResponse, origin);
|
|
2918
2888
|
break;
|
|
2919
2889
|
case "BINANCE_CREATE_PREORDER_MUTATION":
|
|
2920
|
-
const preorderResponse = await this.createPreorderMutation(this.ensurePayload(data, "preorder"));
|
|
2921
|
-
sendResponseFn(messageId, preorderResponse, origin);
|
|
2890
|
+
const preorderResponse = await this.createPreorderMutation(this.ensurePayload(data, "preorder"), accessToken);
|
|
2891
|
+
this.sendResponseFn(messageId, preorderResponse, origin);
|
|
2922
2892
|
break;
|
|
2923
2893
|
default:
|
|
2924
2894
|
throw new Error(`[ BINANCE ]: Unknown message type: ${type}`);
|
|
@@ -2980,22 +2950,23 @@ var BinanceOnrampAPI = class {
|
|
|
2980
2950
|
// src/iframe/lib/onramp/rampnow.ts
|
|
2981
2951
|
var API_DOMAIN2 = "https://api.lumiapassport.com/on-ramp";
|
|
2982
2952
|
var RampnowOnrampAPI = class {
|
|
2983
|
-
|
|
2984
|
-
|
|
2953
|
+
constructor(sendResponseFn) {
|
|
2954
|
+
this.sendResponseFn = sendResponseFn;
|
|
2955
|
+
}
|
|
2956
|
+
async getRampnowConfigQuery(accessToken) {
|
|
2985
2957
|
const response = await fetch(`${API_DOMAIN2}/api/rampnow/cfg`, {
|
|
2986
2958
|
method: "GET",
|
|
2987
|
-
headers: { ...
|
|
2959
|
+
headers: { ...accessToken && { Authorization: accessToken } }
|
|
2988
2960
|
});
|
|
2989
2961
|
const data = await response.json();
|
|
2990
2962
|
return data;
|
|
2991
2963
|
}
|
|
2992
|
-
async getRampOrderQuoteQuery(payload) {
|
|
2993
|
-
const auth = getBearer();
|
|
2964
|
+
async getRampOrderQuoteQuery(payload, accessToken) {
|
|
2994
2965
|
const response = await fetch(`${API_DOMAIN2}/api/rampnow/quote`, {
|
|
2995
2966
|
method: "POST",
|
|
2996
2967
|
headers: {
|
|
2997
2968
|
"Content-Type": "application/json",
|
|
2998
|
-
...
|
|
2969
|
+
...accessToken && { Authorization: accessToken }
|
|
2999
2970
|
},
|
|
3000
2971
|
body: JSON.stringify(payload)
|
|
3001
2972
|
});
|
|
@@ -3021,17 +2992,18 @@ var RampnowOnrampAPI = class {
|
|
|
3021
2992
|
// })
|
|
3022
2993
|
// return checkoutedOrderData
|
|
3023
2994
|
// }
|
|
3024
|
-
async handleMessage(message, origin
|
|
2995
|
+
async handleMessage(message, origin) {
|
|
3025
2996
|
const { type, data, messageId } = message;
|
|
3026
|
-
|
|
2997
|
+
const { accessToken } = message.data;
|
|
2998
|
+
console.log("[ RAMPNOW Received message ]", type, message);
|
|
3027
2999
|
switch (type) {
|
|
3028
3000
|
case "RAMPNOW_GET_CONFIG":
|
|
3029
|
-
const ramnowCfg = await this.getRampnowConfigQuery();
|
|
3030
|
-
sendResponseFn(messageId, ramnowCfg, origin);
|
|
3001
|
+
const ramnowCfg = await this.getRampnowConfigQuery(accessToken);
|
|
3002
|
+
this.sendResponseFn(messageId, ramnowCfg, origin);
|
|
3031
3003
|
break;
|
|
3032
3004
|
case "RAMPNOW_GET_ORDER_QUOTE":
|
|
3033
|
-
const orderQuote = await this.getRampOrderQuoteQuery(this.ensureOrderQuotePayload(data));
|
|
3034
|
-
sendResponseFn(messageId, orderQuote, origin);
|
|
3005
|
+
const orderQuote = await this.getRampOrderQuoteQuery(this.ensureOrderQuotePayload(data), accessToken);
|
|
3006
|
+
this.sendResponseFn(messageId, orderQuote, origin);
|
|
3035
3007
|
break;
|
|
3036
3008
|
default:
|
|
3037
3009
|
throw new Error(`[ RAMPNOW ]: Unknown message type: ${type}`);
|
|
@@ -4258,13 +4230,12 @@ var SigningManager = class extends TokenRefreshApiClient {
|
|
|
4258
4230
|
};
|
|
4259
4231
|
|
|
4260
4232
|
// src/iframe/main.ts
|
|
4261
|
-
var IFRAME_VERSION = "1.
|
|
4233
|
+
var IFRAME_VERSION = "1.14.0";
|
|
4262
4234
|
var IframeWallet = class {
|
|
4263
4235
|
constructor() {
|
|
4264
4236
|
console.log("=".repeat(60));
|
|
4265
4237
|
console.log(` Lumia Passport Secure Wallet - iframe version ${IFRAME_VERSION}`);
|
|
4266
4238
|
console.log("=".repeat(60));
|
|
4267
|
-
this.applyThemeColors();
|
|
4268
4239
|
this.messenger = new SecureMessenger();
|
|
4269
4240
|
this.sessionManager = new SessionManager();
|
|
4270
4241
|
this.dkgManager = new DKGManager();
|
|
@@ -4273,37 +4244,37 @@ var IframeWallet = class {
|
|
|
4273
4244
|
this.storage = new StorageManager();
|
|
4274
4245
|
this.trustedApps = new TrustedAppsManager();
|
|
4275
4246
|
this.backupManager = new BackupManager();
|
|
4276
|
-
this.binance = new BinanceOnrampAPI();
|
|
4277
|
-
this.rampnow = new RampnowOnrampAPI();
|
|
4278
|
-
}
|
|
4279
|
-
applyThemeColors() {
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
}
|
|
4247
|
+
this.binance = new BinanceOnrampAPI(this.messenger.sendResponse.bind(this.messenger));
|
|
4248
|
+
this.rampnow = new RampnowOnrampAPI(this.messenger.sendResponse.bind(this.messenger));
|
|
4249
|
+
}
|
|
4250
|
+
// private applyThemeColors(): void {
|
|
4251
|
+
// try {
|
|
4252
|
+
// const params = new URLSearchParams(window.location.search)
|
|
4253
|
+
// const bg = params.get('bg')
|
|
4254
|
+
// const text = params.get('text')
|
|
4255
|
+
// const textSec = params.get('textSec')
|
|
4256
|
+
// const border = params.get('border')
|
|
4257
|
+
// if (bg || text || textSec || border) {
|
|
4258
|
+
// const root = document.documentElement
|
|
4259
|
+
// if (bg) {
|
|
4260
|
+
// root.style.setProperty('--iframe-bg', bg)
|
|
4261
|
+
// root.style.setProperty('--iframe-modal-bg', bg)
|
|
4262
|
+
// }
|
|
4263
|
+
// if (text) {
|
|
4264
|
+
// root.style.setProperty('--iframe-text', text)
|
|
4265
|
+
// }
|
|
4266
|
+
// if (textSec) {
|
|
4267
|
+
// root.style.setProperty('--iframe-text-secondary', textSec)
|
|
4268
|
+
// }
|
|
4269
|
+
// if (border) {
|
|
4270
|
+
// root.style.setProperty('--iframe-border', border)
|
|
4271
|
+
// }
|
|
4272
|
+
// console.log('[IframeWallet] Applied theme colors:', { bg, text, textSec, border })
|
|
4273
|
+
// }
|
|
4274
|
+
// } catch (error) {
|
|
4275
|
+
// console.warn('[IframeWallet] Failed to apply theme colors:', error)
|
|
4276
|
+
// }
|
|
4277
|
+
// }
|
|
4307
4278
|
async initialize() {
|
|
4308
4279
|
if (window.location.hostname !== "localhost" && window.location.hostname !== "127.0.0.1" && !window.location.hostname.includes("lumiapassport.com")) {
|
|
4309
4280
|
console.warn("[iframe] \u26A0\uFE0F Running on unexpected origin!");
|
|
@@ -4326,14 +4297,13 @@ var IframeWallet = class {
|
|
|
4326
4297
|
}
|
|
4327
4298
|
async handleMessage(message, origin) {
|
|
4328
4299
|
const { type, messageId, projectId } = message;
|
|
4329
|
-
console.log("[IFRAME INTERNAL] message", type, message);
|
|
4330
4300
|
try {
|
|
4331
4301
|
switch (true) {
|
|
4332
4302
|
case type.startsWith("BINANCE_"):
|
|
4333
|
-
await this.binance.handleMessage(message, origin
|
|
4303
|
+
await this.binance.handleMessage(message, origin);
|
|
4334
4304
|
break;
|
|
4335
4305
|
case type.startsWith("RAMPNOW_"):
|
|
4336
|
-
await this.rampnow.handleMessage(message, origin
|
|
4306
|
+
await this.rampnow.handleMessage(message, origin);
|
|
4337
4307
|
break;
|
|
4338
4308
|
case type === "SDK_AUTH":
|
|
4339
4309
|
await this.handleSDKAuth(message, origin);
|