@onekeyfe/cross-inpage-provider-core
Advanced tools
Comparing version 1.1.58-alpha.2 to 2.0.0-alpha.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isInSameOriginIframe = void 0; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
@@ -178,1 +179,17 @@ const icon_1 = require("./icon"); | ||
exports.default = notification; | ||
const isInIframe = () => { | ||
return window.self !== window.top; | ||
}; | ||
const isInSameOriginIframe = () => { | ||
var _a, _b; | ||
if (!isInIframe()) { | ||
return false; | ||
} | ||
try { | ||
return window.self.location.origin === ((_b = (_a = window.top) === null || _a === void 0 ? void 0 : _a.location) === null || _b === void 0 ? void 0 : _b.origin); | ||
} | ||
catch (e) { | ||
return false; | ||
} | ||
}; | ||
exports.isInSameOriginIframe = isInSameOriginIframe; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.switchDefaultWalletNotification = void 0; | ||
const notification_1 = __importDefault(require("./notification")); | ||
const notification_1 = __importStar(require("./notification")); | ||
const icon_1 = require("./icon"); | ||
let instance; | ||
const switchDefaultWalletNotification = (isDefaultWallet) => { | ||
if ((0, notification_1.isInSameOriginIframe)()) { | ||
return; | ||
} | ||
if (instance) { | ||
@@ -12,0 +31,0 @@ instance.hide(); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const version = '1.1.58-alpha.2'; | ||
const version = '2.0.0-alpha.0'; | ||
const versionBuild = '2020-0101-1'; | ||
@@ -5,0 +5,0 @@ exports.default = { |
@@ -25,1 +25,2 @@ interface Options { | ||
export default notification; | ||
export declare const isInSameOriginIframe: () => boolean; |
@@ -176,1 +176,16 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
export default notification; | ||
const isInIframe = () => { | ||
return window.self !== window.top; | ||
}; | ||
export const isInSameOriginIframe = () => { | ||
var _a, _b; | ||
if (!isInIframe()) { | ||
return false; | ||
} | ||
try { | ||
return window.self.location.origin === ((_b = (_a = window.top) === null || _a === void 0 ? void 0 : _a.location) === null || _b === void 0 ? void 0 : _b.origin); | ||
} | ||
catch (e) { | ||
return false; | ||
} | ||
}; |
@@ -1,5 +0,8 @@ | ||
import notification from "./notification"; | ||
import notification, { isInSameOriginIframe } from "./notification"; | ||
import { IconLogo } from './icon'; | ||
let instance; | ||
export const switchDefaultWalletNotification = (isDefaultWallet) => { | ||
if (isInSameOriginIframe()) { | ||
return; | ||
} | ||
if (instance) { | ||
@@ -6,0 +9,0 @@ instance.hide(); |
@@ -1,2 +0,2 @@ | ||
const version = '1.1.58-alpha.2'; | ||
const version = '2.0.0-alpha.0'; | ||
const versionBuild = '2020-0101-1'; | ||
@@ -3,0 +3,0 @@ export default { |
{ | ||
"name": "@onekeyfe/cross-inpage-provider-core", | ||
"version": "1.1.58-alpha.2", | ||
"version": "2.0.0-alpha.0", | ||
"keywords": [ | ||
@@ -32,5 +32,5 @@ "cross-inpage-provider" | ||
"dependencies": { | ||
"@onekeyfe/cross-inpage-provider-errors": "1.1.58-alpha.2", | ||
"@onekeyfe/cross-inpage-provider-events": "1.1.58-alpha.2", | ||
"@onekeyfe/cross-inpage-provider-types": "1.1.58-alpha.2", | ||
"@onekeyfe/cross-inpage-provider-errors": "2.0.0-alpha.0", | ||
"@onekeyfe/cross-inpage-provider-events": "2.0.0-alpha.0", | ||
"@onekeyfe/cross-inpage-provider-types": "2.0.0-alpha.0", | ||
"events": "^3.3.0", | ||
@@ -40,3 +40,3 @@ "lodash": "^4.17.21", | ||
}, | ||
"gitHead": "5e2426bfdaeec2bbb77248dc4518ce7cd4ad5dcf" | ||
"gitHead": "13b0b3342ff68deef9d05bbaedc2416aab93d093" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
188098
4596
+ Added@onekeyfe/cross-inpage-provider-errors@2.0.0-alpha.0(transitive)
+ Added@onekeyfe/cross-inpage-provider-events@2.0.0-alpha.0(transitive)
+ Added@onekeyfe/cross-inpage-provider-types@2.0.0-alpha.0(transitive)
- Removed@onekeyfe/cross-inpage-provider-errors@1.1.58-alpha.2(transitive)
- Removed@onekeyfe/cross-inpage-provider-events@1.1.58-alpha.2(transitive)
- Removed@onekeyfe/cross-inpage-provider-types@1.1.58-alpha.2(transitive)