1 // [AIV_SHORT] Build version: 2.2.0 - Thursday, June 4th, 2020, 2:31:20 PM
5 /***/ (function(module, __webpack_exports__, __webpack_require__) {
8 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return apis; });
9 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__ = __webpack_require__(26);
10 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__);
13 var swallow = function swallow(fn) {
19 var ApiGenerator = function ApiGenerator() {
22 __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default()(this, ApiGenerator);
24 ['app', 'storage', 'extension', 'runtime', 'windows'].map(function (api) {
25 if (typeof chrome !== 'undefined') swallow(function () {
26 if (chrome[api]) _this[api] = chrome[api];
28 if (typeof browser !== 'undefined') swallow(function () {
29 if (browser[api]) _this[api] = browser[api];
33 if (typeof browser !== 'undefined') swallow(function () {
34 if (browser && browser.runtime) _this.runtime = browser.runtime;
38 var apis = new ApiGenerator();
43 /***/ (function(module, __webpack_exports__, __webpack_require__) {
46 /* unused harmony export ErrorCodes */
47 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__ = __webpack_require__(26);
48 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__);
49 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass__ = __webpack_require__(36);
50 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass__);
51 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ErrorTypes__ = __webpack_require__(535);
61 TOO_MANY_REQUESTS: 429,
66 var Error = function () {
67 function Error(_type, _message) {
68 var _code = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ErrorCodes.LOCKED;
70 __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default()(this, Error);
73 this.message = _message;
78 __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_createClass___default()(Error, null, [{
80 value: function locked() {
81 return new Error(__WEBPACK_IMPORTED_MODULE_2__ErrorTypes__["a" /* LOCKED */], "The user's Bytom is locked. They have been notified and should unlock before continuing.");
85 value: function duplicate(_type) {
86 return new Error(__WEBPACK_IMPORTED_MODULE_2__ErrorTypes__["d" /* TYPE_DUPLICATED */], "The current value has been set to '" + _type + "', please select another parameter.", ErrorCodes.TYPE_DUPLICATE);
89 key: "promptClosedWithoutAction",
90 value: function promptClosedWithoutAction() {
91 return new Error(__WEBPACK_IMPORTED_MODULE_2__ErrorTypes__["c" /* PROMPT_CLOSED */], "The user closed the prompt without any action.", ErrorCodes.TIMED_OUT);
94 key: "signatureError",
95 value: function signatureError(_type, _message) {
96 return new Error(_type, _message, ErrorCodes.NO_SIGNATURE);
100 value: function typeMissed(_type) {
101 return new Error(__WEBPACK_IMPORTED_MODULE_2__ErrorTypes__["e" /* TYPE_MISSED */], "Parameter '" + _type + "' is missing, please add the Parameter '" + _type + "'.");
104 key: "identityMissing",
105 value: function identityMissing() {
106 return this.signatureError("identity_missing", "Identity no longer exists on the user's keychain");
109 key: "signatureAccountMissing",
110 value: function signatureAccountMissing() {
111 return this.signatureError("account_missing", "Missing required accounts, repull the identity");
114 key: "malformedRequiredFields",
115 value: function malformedRequiredFields() {
116 return this.signatureError("malformed_requirements", "The requiredFields you passed in were malformed");
119 key: "usedKeyProvider",
120 value: function usedKeyProvider() {
121 return new Error(__WEBPACK_IMPORTED_MODULE_2__ErrorTypes__["b" /* MALICIOUS */], "Do not use a `keyProvider` with a Bytom. Use a `signProvider` and return only signatures to this object. A malicious person could retrieve your keys otherwise.", ErrorCodes.NO_SIGNATURE);
128 /* harmony default export */ __webpack_exports__["a"] = (Error);
133 /***/ (function(module, __webpack_exports__, __webpack_require__) {
136 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_json_stringify__ = __webpack_require__(144);
137 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_json_stringify___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_json_stringify__);
138 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator__ = __webpack_require__(138);
139 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator__);
140 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_asyncToGenerator__ = __webpack_require__(139);
141 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_asyncToGenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_asyncToGenerator__);
142 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_classCallCheck__ = __webpack_require__(26);
143 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_classCallCheck__);
144 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_createClass__ = __webpack_require__(36);
145 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_createClass___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_createClass__);
146 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_errors_Error__ = __webpack_require__(530);
147 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_BrowserApis__ = __webpack_require__(529);
148 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__messages_internal__ = __webpack_require__(267);
149 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__messages_types__ = __webpack_require__(129);
160 var openWindow = null;
162 var NotificationService = function () {
163 function NotificationService() {
164 __WEBPACK_IMPORTED_MODULE_3_babel_runtime_helpers_classCallCheck___default()(this, NotificationService);
167 __WEBPACK_IMPORTED_MODULE_4_babel_runtime_helpers_createClass___default()(NotificationService, null, [{
172 * Opens a prompt window outside of the extension
173 * @param notification
176 var _ref = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_asyncToGenerator___default()( /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator___default.a.mark(function _callee2(notification) {
179 var height, width, middleX, middleY, getPopup, popup;
180 return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator___default.a.wrap(function _callee2$(_context2) {
182 switch (_context2.prev = _context2.next) {
185 // For now we're just going to close the window to get rid of the error
186 // that is caused by already open windows swallowing all further requests
190 // Alternatively we could focus the old window, but this would cause
191 // urgent 1-time messages to be lost, such as after dying in a game and
192 // uploading a high-score. That message will be lost.
193 // openWindow.focus();
196 // A third option would be to add a queue, but this could cause
197 // virus-like behavior as apps overflow the queue causing the user
198 // to have to quit the browser to regain control.
203 middleX = window.screen.availWidth / 2 - width / 2;
204 middleY = window.screen.availHeight / 2 - height / 2;
206 getPopup = function () {
207 var _ref2 = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_asyncToGenerator___default()( /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator___default.a.mark(function _callee() {
209 return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator___default.a.wrap(function _callee$(_context) {
211 switch (_context.prev = _context.next) {
214 url = __WEBPACK_IMPORTED_MODULE_6__utils_BrowserApis__["a" /* apis */].runtime.getURL('pages/prompt.html') + '#' + notification.routeName();
216 // Notifications get bound differently depending on browser
217 // as Firefox does not support opening windows from background.
219 if (!(typeof chrome !== 'undefined')) {
224 window.notification = notification;
225 __WEBPACK_IMPORTED_MODULE_6__utils_BrowserApis__["a" /* apis */].windows.create({
230 }, function (_window) {
231 __WEBPACK_IMPORTED_MODULE_6__utils_BrowserApis__["a" /* apis */].windows.onRemoved.addListener(function (windowId) {
232 if (windowId === _window.id) {
233 notification.responder(__WEBPACK_IMPORTED_MODULE_5__utils_errors_Error__["a" /* default */].promptClosedWithoutAction());
243 win = window.open(url, 'BytomPrompt', 'width=' + width + ',height=' + height + ',resizable=0,top=' + middleY + ',left=' + middleX + ',titlebar=0');
245 win.data = notification;
247 return _context.abrupt('return', win);
255 _context.t0 = _context['catch'](0);
257 console.log('notification error', _context.t0);
258 return _context.abrupt('return', null);
262 return _context.stop();
265 }, _callee, _this, [[0, 13]]);
268 return function getPopup() {
269 return _ref2.apply(this, arguments);
274 return __WEBPACK_IMPORTED_MODULE_7__messages_internal__["a" /* default */].payload(__WEBPACK_IMPORTED_MODULE_8__messages_types__["l" /* SET_PROMPT */], __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_json_stringify___default()(notification)).send();
281 popup = _context2.sent;
285 popup.onbeforeunload = function () {
286 notification.responder(__WEBPACK_IMPORTED_MODULE_5__utils_errors_Error__["a" /* default */].promptClosedWithoutAction());
288 // https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload
289 // Must return undefined to bypass form protection
297 return _context2.stop();
304 return _ref.apply(this, arguments);
311 * Always use this method for closing notification popups.
312 * Otherwise you will double send responses and one will always be null.
318 var _ref3 = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_asyncToGenerator___default()( /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator___default.a.mark(function _callee3() {
321 return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_regenerator___default.a.wrap(function _callee3$(_context3) {
323 switch (_context3.prev = _context3.next) {
325 if (!(typeof browser !== 'undefined')) {
331 return __WEBPACK_IMPORTED_MODULE_6__utils_BrowserApis__["a" /* apis */].windows.getCurrent();
334 _ref4 = _context3.sent;
337 __WEBPACK_IMPORTED_MODULE_6__utils_BrowserApis__["a" /* apis */].windows.remove(windowId);
342 window.onbeforeunload = function () {};
347 return _context3.stop();
354 return _ref3.apply(this, arguments);
361 return NotificationService;
364 /* harmony default export */ __webpack_exports__["a"] = (NotificationService);
369 /***/ (function(module, __webpack_exports__, __webpack_require__) {
372 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MALICIOUS; });
373 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LOCKED; });
374 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return PROMPT_CLOSED; });
375 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return TYPE_MISSED; });
376 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return TYPE_DUPLICATED; });
377 var MALICIOUS = 'malicious';
378 var LOCKED = 'locked';
379 var PROMPT_CLOSED = 'prompt_closed';
380 var TYPE_MISSED = 'type_missed';
381 var TYPE_DUPLICATED = 'type_duplicated';
386 /***/ (function(module, __webpack_exports__, __webpack_require__) {
389 Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
390 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_authentication_vue__ = __webpack_require__(608);
391 /* empty harmony namespace reexport */
392 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_a2806a68_hasScoped_true_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_authentication_vue__ = __webpack_require__(675);
393 function injectStyle (ssrContext) {
394 __webpack_require__(673)
396 var normalizeComponent = __webpack_require__(266)
402 /* template functional */
403 var __vue_template_functional__ = false
405 var __vue_styles__ = injectStyle
407 var __vue_scopeId__ = "data-v-a2806a68"
408 /* moduleIdentifier (server only) */
409 var __vue_module_identifier__ = null
410 var Component = normalizeComponent(
411 __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_authentication_vue__["a" /* default */],
412 __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_a2806a68_hasScoped_true_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_authentication_vue__["a" /* default */],
413 __vue_template_functional__,
416 __vue_module_identifier__
419 /* harmony default export */ __webpack_exports__["default"] = (Component.exports);
425 /***/ (function(module, __webpack_exports__, __webpack_require__) {
428 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_constants__ = __webpack_require__(268);
429 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_BrowserApis__ = __webpack_require__(529);
430 /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__services_NotificationService__ = __webpack_require__(534);
529 /* harmony default export */ __webpack_exports__["a"] = ({
530 data: function data() {
539 accepted: function accepted() {
540 this.prompt.responder(true);
541 __WEBPACK_IMPORTED_MODULE_2__services_NotificationService__["a" /* default */].close();
543 denied: function denied() {
544 this.prompt.responder(false);
545 __WEBPACK_IMPORTED_MODULE_2__services_NotificationService__["a" /* default */].close();
547 }, mounted: function mounted() {
548 this.prompt = window.data || __WEBPACK_IMPORTED_MODULE_1__utils_BrowserApis__["a" /* apis */].extension.getBackgroundPage().notification || null;
555 /***/ (function(module, exports, __webpack_require__) {
557 // style-loader: Adds some css to the DOM by adding a <style> tag
560 var content = __webpack_require__(674);
561 if(typeof content === 'string') content = [[module.i, content, '']];
562 if(content.locals) module.exports = content.locals;
563 // add the styles to the DOM
564 var update = __webpack_require__(84)("4a645650", content, true, {});
569 /***/ (function(module, exports, __webpack_require__) {
571 exports = module.exports = __webpack_require__(83)(false);
576 exports.push([module.i, ".warp[data-v-a2806a68]{position:absolute;top:0;left:0;right:0;height:600px;z-index:2;overflow:scroll}.header[data-v-a2806a68]{display:flex}.header p[data-v-a2806a68]{text-align:center;width:280px;padding-top:17px}.content[data-v-a2806a68]{margin:20px;padding:20px;overflow:hidden;border-radius:4px;width:280px}.btn-inline .btn[data-v-a2806a68]{margin:10px 15px}.row[data-v-a2806a68]{word-break:break-all}.col[data-v-a2806a68]{font-size:14px;width:35%}.label[data-v-a2806a68]{color:#7b7b7b}.message[data-v-a2806a68]{font-size:14px;color:#7b7b7b}.value[data-v-a2806a68]{color:#282828;width:60%}table[data-v-a2806a68]{width:100%}.form-item[data-v-a2806a68]{padding:0;margin:0;margin-bottom:10px}.btn-container .btn[data-v-a2806a68]{margin-top:20px;height:48px;width:320px}", ""]);
584 /***/ (function(module, __webpack_exports__, __webpack_require__) {
587 var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"warp bg-gray"},[_c('section',{staticClass:"header bg-header"},[_c('i',{staticClass:"iconfont icon-back",on:{"click":_vm.denied}}),_vm._v(" "),_c('p',[_vm._v(_vm._s(_vm.$t('enable.title')))])]),_vm._v(" "),_c('section',{staticClass:"content bg-white"},[_c('table',[_c('tbody',[_c('tr',{staticClass:"row"},[_c('td',{staticClass:"col label"},[_vm._v(_vm._s(_vm.$t('enable.domain')))]),_vm._v(" "),_c('td',{staticClass:"col value"},[_vm._v(_vm._s(_vm.prompt.domain))])])])])]),_vm._v(" "),_c('section',{staticClass:"content bg-white"},[_c('div',{staticClass:"message"},[_vm._v(_vm._s(_vm.$t('enable.message')))])]),_vm._v(" "),_c('div',{staticClass:"row btn-container",staticStyle:{"bottom":"20px","left":"20px","position":"absolute"}},[_c('div',{staticClass:"btn",on:{"click":_vm.denied}},[_vm._v(_vm._s(_vm.$t('enable.cancel')))]),_vm._v(" "),_c('div',{staticClass:"btn bg-green",on:{"click":_vm.accepted}},[_vm._v(_vm._s(_vm.$t('enable.confirm')))])])])}
588 var staticRenderFns = []
589 var esExports = { render: render, staticRenderFns: staticRenderFns }
590 /* harmony default export */ __webpack_exports__["a"] = (esExports);
595 //# sourceMappingURL=15.js.map