32 lines
1.4 KiB
JavaScript
32 lines
1.4 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.getMobileLinkRegistry = exports.getMobileRegistryEntry = exports.saveMobileLinkInfo = exports.formatIOSMobile = exports.mobileLinkChoiceKey = void 0;
|
|
const local_1 = require("./local");
|
|
exports.mobileLinkChoiceKey = "WALLETCONNECT_DEEPLINK_CHOICE";
|
|
function formatIOSMobile(uri, entry) {
|
|
const encodedUri = encodeURIComponent(uri);
|
|
return entry.universalLink
|
|
? `${entry.universalLink}/wc?uri=${encodedUri}`
|
|
: entry.deepLink
|
|
? `${entry.deepLink}${entry.deepLink.endsWith(":") ? "//" : "/"}wc?uri=${encodedUri}`
|
|
: "";
|
|
}
|
|
exports.formatIOSMobile = formatIOSMobile;
|
|
function saveMobileLinkInfo(data) {
|
|
const focusUri = data.href.split("?")[0];
|
|
(0, local_1.setLocal)(exports.mobileLinkChoiceKey, Object.assign(Object.assign({}, data), { href: focusUri }));
|
|
}
|
|
exports.saveMobileLinkInfo = saveMobileLinkInfo;
|
|
function getMobileRegistryEntry(registry, name) {
|
|
return registry.filter((entry) => entry.name.toLowerCase().includes(name.toLowerCase()))[0];
|
|
}
|
|
exports.getMobileRegistryEntry = getMobileRegistryEntry;
|
|
function getMobileLinkRegistry(registry, whitelist) {
|
|
let links = registry;
|
|
if (whitelist) {
|
|
links = whitelist.map((name) => getMobileRegistryEntry(registry, name)).filter(Boolean);
|
|
}
|
|
return links;
|
|
}
|
|
exports.getMobileLinkRegistry = getMobileLinkRegistry;
|
|
//# sourceMappingURL=mobile.js.map
|