@eluvio/elv-client-js 4.2.10 → 4.2.11
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/ElvClient-min.js +1 -1
- package/dist/ElvClient-node-min.js +1 -1
- package/dist/ElvFrameClient-min.js +1 -1
- package/dist/ElvPermissionsClient-min.js +1 -1
- package/dist/ElvWalletClient-min.js +1 -1
- package/dist/ElvWalletClient-node-min.js +1 -1
- package/dist/src/AuthorizationClient.js +723 -710
- package/dist/src/ContentObjectAudit.js +56 -56
- package/dist/src/ContentObjectVerification.js +281 -0
- package/dist/src/Crypto.js +85 -85
- package/dist/src/ElvClient.js +500 -530
- package/dist/src/ElvWallet.js +28 -30
- package/dist/src/EthClient.js +311 -311
- package/dist/src/FrameClient.js +64 -63
- package/dist/src/HttpClient.js +60 -60
- package/dist/src/Id.js +2 -1
- package/dist/src/PermissionsClient.js +487 -499
- package/dist/src/RemoteSigner.js +163 -114
- package/dist/src/UserProfileClient.js +374 -392
- package/dist/src/Utils.js +66 -69
- package/dist/src/Validation.js +10 -10
- package/dist/src/client/ABRPublishing.js +238 -238
- package/dist/src/client/AccessGroups.js +474 -477
- package/dist/src/client/ContentAccess.js +1709 -1705
- package/dist/src/client/ContentManagement.js +871 -871
- package/dist/src/client/Contracts.js +578 -575
- package/dist/src/client/Files.js +684 -700
- package/dist/src/client/LiveConf.js +6 -1
- package/dist/src/client/LiveStream.js +686 -723
- package/dist/src/client/NFT.js +14 -14
- package/dist/src/client/NTP.js +84 -84
- package/dist/src/client/Shares.js +60 -53
- package/dist/src/walletClient/ClientMethods.js +951 -977
- package/dist/src/walletClient/Notifications.js +14 -14
- package/dist/src/walletClient/Profile.js +66 -66
- package/dist/src/walletClient/Utils.js +15 -15
- package/dist/src/walletClient/index.js +581 -579
- package/package.json +1 -1
- package/src/client/LiveConf.js +5 -1
- package/src/client/LiveStream.js +9 -39
|
@@ -24,13 +24,13 @@ var NotificationPath = function NotificationPath(_ref) {
|
|
|
24
24
|
* @param {string=} userAddress - Address of the user to notify. If not specified, it will be sent to the current user.
|
|
25
25
|
*/
|
|
26
26
|
exports.PushNotification = /*#__PURE__*/function () {
|
|
27
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
27
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
28
28
|
var tenantId, eventType, data, userAddress;
|
|
29
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
29
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
30
30
|
while (1) switch (_context.prev = _context.next) {
|
|
31
31
|
case 0:
|
|
32
32
|
tenantId = _ref2.tenantId, eventType = _ref2.eventType, data = _ref2.data, userAddress = _ref2.userAddress;
|
|
33
|
-
_context.next =
|
|
33
|
+
_context.next = 3;
|
|
34
34
|
return this.stateStoreClient.Request({
|
|
35
35
|
method: "POST",
|
|
36
36
|
path: NotificationPath({
|
|
@@ -42,7 +42,7 @@ exports.PushNotification = /*#__PURE__*/function () {
|
|
|
42
42
|
Authorization: "Bearer ".concat(this.AuthToken())
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
-
case
|
|
45
|
+
case 3:
|
|
46
46
|
case "end":
|
|
47
47
|
return _context.stop();
|
|
48
48
|
}
|
|
@@ -62,18 +62,18 @@ exports.PushNotification = /*#__PURE__*/function () {
|
|
|
62
62
|
* @returns {Promise<EventSource>} - An EventSource instance listening for notifications. Use source.close() to close the listener.
|
|
63
63
|
*/
|
|
64
64
|
exports.AddNotificationListener = /*#__PURE__*/function () {
|
|
65
|
-
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref4) {
|
|
65
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref4) {
|
|
66
66
|
var onMessage, url, source;
|
|
67
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
67
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
68
68
|
while (1) switch (_context2.prev = _context2.next) {
|
|
69
69
|
case 0:
|
|
70
70
|
onMessage = _ref4.onMessage;
|
|
71
71
|
if (onMessage) {
|
|
72
|
-
_context2.next =
|
|
72
|
+
_context2.next = 3;
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
75
|
throw Error("Eluvio Wallet Client: No onMessage callback provided to AddNotificationListener");
|
|
76
|
-
case
|
|
76
|
+
case 3:
|
|
77
77
|
url = new URL(this.stateStoreClient.BaseURI().toString());
|
|
78
78
|
url.pathname = NotificationPath({
|
|
79
79
|
network: this.network,
|
|
@@ -89,7 +89,7 @@ exports.AddNotificationListener = /*#__PURE__*/function () {
|
|
|
89
89
|
onMessage(parsedMessage);
|
|
90
90
|
};
|
|
91
91
|
return _context2.abrupt("return", source);
|
|
92
|
-
case
|
|
92
|
+
case 8:
|
|
93
93
|
case "end":
|
|
94
94
|
return _context2.stop();
|
|
95
95
|
}
|
|
@@ -111,7 +111,7 @@ exports.AddNotificationListener = /*#__PURE__*/function () {
|
|
|
111
111
|
*
|
|
112
112
|
* @returns {Promise<Array<Object>>} - A list of notifications for the specified parameters
|
|
113
113
|
*/
|
|
114
|
-
exports.Notifications = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
114
|
+
exports.Notifications = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
115
115
|
var _ref7,
|
|
116
116
|
tenantId,
|
|
117
117
|
types,
|
|
@@ -122,7 +122,7 @@ exports.Notifications = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator
|
|
|
122
122
|
_yield$Utils$Response,
|
|
123
123
|
records,
|
|
124
124
|
_args3 = arguments;
|
|
125
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
125
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
126
126
|
while (1) switch (_context3.prev = _context3.next) {
|
|
127
127
|
case 0:
|
|
128
128
|
_ref7 = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {}, tenantId = _ref7.tenantId, types = _ref7.types, offsetId = _ref7.offsetId, _ref7$limit = _ref7.limit, limit = _ref7$limit === void 0 ? 10 : _ref7$limit;
|
|
@@ -138,7 +138,7 @@ exports.Notifications = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator
|
|
|
138
138
|
if (offsetId) {
|
|
139
139
|
queryParams.offset_by = offsetId;
|
|
140
140
|
}
|
|
141
|
-
_context3.next =
|
|
141
|
+
_context3.next = 7;
|
|
142
142
|
return Utils.ResponseToJson(this.stateStoreClient.Request({
|
|
143
143
|
method: "GET",
|
|
144
144
|
path: NotificationPath({
|
|
@@ -150,7 +150,7 @@ exports.Notifications = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator
|
|
|
150
150
|
Authorization: "Bearer ".concat(this.AuthToken())
|
|
151
151
|
}
|
|
152
152
|
}));
|
|
153
|
-
case
|
|
153
|
+
case 7:
|
|
154
154
|
_yield$Utils$Response = _context3.sent;
|
|
155
155
|
records = _yield$Utils$Response.records;
|
|
156
156
|
return _context3.abrupt("return", records.map(function (record) {
|
|
@@ -160,7 +160,7 @@ exports.Notifications = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator
|
|
|
160
160
|
} catch (error) {}
|
|
161
161
|
return record;
|
|
162
162
|
}));
|
|
163
|
-
case
|
|
163
|
+
case 10:
|
|
164
164
|
case "end":
|
|
165
165
|
return _context3.stop();
|
|
166
166
|
}
|
|
@@ -44,14 +44,14 @@ var UserProfilePath = function UserProfilePath(_ref2) {
|
|
|
44
44
|
* @returns {Promise<Object|String>} - Returns the specified metadata
|
|
45
45
|
*/
|
|
46
46
|
exports.ProfileMetadata = /*#__PURE__*/function () {
|
|
47
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref3) {
|
|
48
|
-
var _ref3$type, type, _ref3$mode, mode, appId, userAddress, key, response
|
|
49
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
47
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref3) {
|
|
48
|
+
var _ref3$type, type, _ref3$mode, mode, appId, userAddress, key, response;
|
|
49
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
50
50
|
while (1) switch (_context.prev = _context.next) {
|
|
51
51
|
case 0:
|
|
52
52
|
_ref3$type = _ref3.type, type = _ref3$type === void 0 ? "app" : _ref3$type, _ref3$mode = _ref3.mode, mode = _ref3$mode === void 0 ? "public" : _ref3$mode, appId = _ref3.appId, userAddress = _ref3.userAddress, key = _ref3.key;
|
|
53
53
|
_context.prev = 1;
|
|
54
|
-
_context.next =
|
|
54
|
+
_context.next = 4;
|
|
55
55
|
return this.stateStoreClient.Request({
|
|
56
56
|
path: UserProfilePath({
|
|
57
57
|
network: this.network,
|
|
@@ -65,34 +65,34 @@ exports.ProfileMetadata = /*#__PURE__*/function () {
|
|
|
65
65
|
Authorization: "Bearer ".concat(this.AuthToken())
|
|
66
66
|
} : undefined
|
|
67
67
|
});
|
|
68
|
-
case
|
|
68
|
+
case 4:
|
|
69
69
|
response = _context.sent;
|
|
70
70
|
if (response.ok) {
|
|
71
|
-
_context.next =
|
|
71
|
+
_context.next = 7;
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
throw response;
|
|
75
|
-
case
|
|
76
|
-
_context.next =
|
|
75
|
+
case 7:
|
|
76
|
+
_context.next = 9;
|
|
77
77
|
return Utils.ResponseToJson(response);
|
|
78
|
-
case
|
|
79
|
-
|
|
80
|
-
return _context.abrupt("return", _context.sent[
|
|
81
|
-
case
|
|
82
|
-
_context.prev =
|
|
83
|
-
|
|
84
|
-
if (!(
|
|
85
|
-
_context.next =
|
|
78
|
+
case 9:
|
|
79
|
+
_context.t0 = key;
|
|
80
|
+
return _context.abrupt("return", _context.sent[_context.t0]);
|
|
81
|
+
case 13:
|
|
82
|
+
_context.prev = 13;
|
|
83
|
+
_context.t1 = _context["catch"](1);
|
|
84
|
+
if (!(_context.t1.status === 404)) {
|
|
85
|
+
_context.next = 17;
|
|
86
86
|
break;
|
|
87
87
|
}
|
|
88
88
|
return _context.abrupt("return", undefined);
|
|
89
|
-
case
|
|
90
|
-
throw
|
|
91
|
-
case
|
|
89
|
+
case 17:
|
|
90
|
+
throw _context.t1;
|
|
91
|
+
case 18:
|
|
92
92
|
case "end":
|
|
93
93
|
return _context.stop();
|
|
94
94
|
}
|
|
95
|
-
}, _callee, this, [[1,
|
|
95
|
+
}, _callee, this, [[1, 13]]);
|
|
96
96
|
}));
|
|
97
97
|
return function (_x) {
|
|
98
98
|
return _ref4.apply(this, arguments);
|
|
@@ -111,13 +111,13 @@ exports.ProfileMetadata = /*#__PURE__*/function () {
|
|
|
111
111
|
* @param {string} value - The metadata value to set
|
|
112
112
|
*/
|
|
113
113
|
exports.SetProfileMetadata = /*#__PURE__*/function () {
|
|
114
|
-
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref5) {
|
|
114
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref5) {
|
|
115
115
|
var _ref5$type, type, _ref5$mode, mode, appId, key, value;
|
|
116
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
116
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
117
117
|
while (1) switch (_context2.prev = _context2.next) {
|
|
118
118
|
case 0:
|
|
119
119
|
_ref5$type = _ref5.type, type = _ref5$type === void 0 ? "app" : _ref5$type, _ref5$mode = _ref5.mode, mode = _ref5$mode === void 0 ? "public" : _ref5$mode, appId = _ref5.appId, key = _ref5.key, value = _ref5.value;
|
|
120
|
-
_context2.next =
|
|
120
|
+
_context2.next = 3;
|
|
121
121
|
return this.stateStoreClient.Request({
|
|
122
122
|
method: "POST",
|
|
123
123
|
path: UserProfilePath({
|
|
@@ -134,7 +134,7 @@ exports.SetProfileMetadata = /*#__PURE__*/function () {
|
|
|
134
134
|
Authorization: "Bearer ".concat(this.AuthToken())
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
|
-
case
|
|
137
|
+
case 3:
|
|
138
138
|
case "end":
|
|
139
139
|
return _context2.stop();
|
|
140
140
|
}
|
|
@@ -156,13 +156,13 @@ exports.SetProfileMetadata = /*#__PURE__*/function () {
|
|
|
156
156
|
* @param {string} key - The metadata key to set
|
|
157
157
|
*/
|
|
158
158
|
exports.RemoveProfileMetadata = /*#__PURE__*/function () {
|
|
159
|
-
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref7) {
|
|
159
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref7) {
|
|
160
160
|
var _ref7$type, type, _ref7$mode, mode, appId, key;
|
|
161
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
161
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
162
162
|
while (1) switch (_context3.prev = _context3.next) {
|
|
163
163
|
case 0:
|
|
164
164
|
_ref7$type = _ref7.type, type = _ref7$type === void 0 ? "app" : _ref7$type, _ref7$mode = _ref7.mode, mode = _ref7$mode === void 0 ? "public" : _ref7$mode, appId = _ref7.appId, key = _ref7.key;
|
|
165
|
-
_context3.next =
|
|
165
|
+
_context3.next = 3;
|
|
166
166
|
return this.stateStoreClient.Request({
|
|
167
167
|
method: "DELETE",
|
|
168
168
|
path: UserProfilePath({
|
|
@@ -177,7 +177,7 @@ exports.RemoveProfileMetadata = /*#__PURE__*/function () {
|
|
|
177
177
|
Authorization: "Bearer ".concat(this.AuthToken())
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
|
-
case
|
|
180
|
+
case 3:
|
|
181
181
|
case "end":
|
|
182
182
|
return _context3.stop();
|
|
183
183
|
}
|
|
@@ -198,51 +198,51 @@ exports.RemoveProfileMetadata = /*#__PURE__*/function () {
|
|
|
198
198
|
* @returns {Promise<Object>} - Profile info of the specified user
|
|
199
199
|
*/
|
|
200
200
|
exports.Profile = /*#__PURE__*/function () {
|
|
201
|
-
var
|
|
201
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref9) {
|
|
202
202
|
var userAddress, userName, imageUrl, badgeData, badges;
|
|
203
|
-
return _regeneratorRuntime.wrap(function (_context4) {
|
|
203
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
204
204
|
while (1) switch (_context4.prev = _context4.next) {
|
|
205
205
|
case 0:
|
|
206
206
|
userAddress = _ref9.userAddress, userName = _ref9.userName;
|
|
207
207
|
if (!userName) {
|
|
208
|
-
_context4.next =
|
|
208
|
+
_context4.next = 5;
|
|
209
209
|
break;
|
|
210
210
|
}
|
|
211
|
-
_context4.next =
|
|
211
|
+
_context4.next = 4;
|
|
212
212
|
return this.UserNameToAddress({
|
|
213
213
|
userName: userName
|
|
214
214
|
});
|
|
215
|
-
case
|
|
215
|
+
case 4:
|
|
216
216
|
userAddress = _context4.sent;
|
|
217
|
-
case
|
|
217
|
+
case 5:
|
|
218
218
|
if (userAddress) {
|
|
219
|
-
_context4.next =
|
|
219
|
+
_context4.next = 7;
|
|
220
220
|
break;
|
|
221
221
|
}
|
|
222
222
|
throw Error("Eluvio Wallet Client: Unable to determine profile - user address not specified");
|
|
223
|
-
case
|
|
223
|
+
case 7:
|
|
224
224
|
if (userName) {
|
|
225
|
-
_context4.next =
|
|
225
|
+
_context4.next = 11;
|
|
226
226
|
break;
|
|
227
227
|
}
|
|
228
|
-
_context4.next =
|
|
228
|
+
_context4.next = 10;
|
|
229
229
|
return this.ProfileMetadata({
|
|
230
230
|
type: "user",
|
|
231
231
|
userAddress: userAddress,
|
|
232
232
|
key: "username"
|
|
233
233
|
});
|
|
234
|
-
case
|
|
234
|
+
case 10:
|
|
235
235
|
userName = _context4.sent;
|
|
236
|
-
case
|
|
237
|
-
_context4.next =
|
|
236
|
+
case 11:
|
|
237
|
+
_context4.next = 13;
|
|
238
238
|
return this.ProfileMetadata({
|
|
239
239
|
type: "user",
|
|
240
240
|
userAddress: userAddress,
|
|
241
241
|
key: "icon_url"
|
|
242
242
|
});
|
|
243
|
-
case
|
|
243
|
+
case 13:
|
|
244
244
|
imageUrl = _context4.sent;
|
|
245
|
-
_context4.next =
|
|
245
|
+
_context4.next = 16;
|
|
246
246
|
return this.ProfileMetadata({
|
|
247
247
|
type: "app",
|
|
248
248
|
mode: "public",
|
|
@@ -250,7 +250,7 @@ exports.Profile = /*#__PURE__*/function () {
|
|
|
250
250
|
userAddress: this.badgerAddress,
|
|
251
251
|
key: "badges_".concat(Utils.FormatAddress(userAddress))
|
|
252
252
|
});
|
|
253
|
-
case
|
|
253
|
+
case 16:
|
|
254
254
|
badgeData = _context4.sent;
|
|
255
255
|
badges = [];
|
|
256
256
|
if (badgeData) {
|
|
@@ -272,25 +272,25 @@ exports.Profile = /*#__PURE__*/function () {
|
|
|
272
272
|
imageUrl: imageUrl,
|
|
273
273
|
badges: badges
|
|
274
274
|
});
|
|
275
|
-
case
|
|
275
|
+
case 20:
|
|
276
276
|
case "end":
|
|
277
277
|
return _context4.stop();
|
|
278
278
|
}
|
|
279
279
|
}, _callee4, this);
|
|
280
280
|
}));
|
|
281
281
|
return function (_x4) {
|
|
282
|
-
return
|
|
282
|
+
return _ref10.apply(this, arguments);
|
|
283
283
|
};
|
|
284
284
|
}();
|
|
285
285
|
exports.UserNameToAddress = /*#__PURE__*/function () {
|
|
286
|
-
var
|
|
287
|
-
var userName, response
|
|
288
|
-
return _regeneratorRuntime.wrap(function (_context5) {
|
|
286
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref11) {
|
|
287
|
+
var userName, response;
|
|
288
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
289
289
|
while (1) switch (_context5.prev = _context5.next) {
|
|
290
290
|
case 0:
|
|
291
|
-
userName =
|
|
291
|
+
userName = _ref11.userName;
|
|
292
292
|
_context5.prev = 1;
|
|
293
|
-
_context5.next =
|
|
293
|
+
_context5.next = 4;
|
|
294
294
|
return this.stateStoreClient.Request({
|
|
295
295
|
method: "GET",
|
|
296
296
|
path: StateStorePath({
|
|
@@ -298,35 +298,35 @@ exports.UserNameToAddress = /*#__PURE__*/function () {
|
|
|
298
298
|
path: UrlJoin("usr", "profile_for_username", userName)
|
|
299
299
|
})
|
|
300
300
|
});
|
|
301
|
-
case
|
|
301
|
+
case 4:
|
|
302
302
|
response = _context5.sent;
|
|
303
303
|
if (response.ok) {
|
|
304
|
-
_context5.next =
|
|
304
|
+
_context5.next = 7;
|
|
305
305
|
break;
|
|
306
306
|
}
|
|
307
307
|
throw response;
|
|
308
|
-
case
|
|
309
|
-
_context5.next =
|
|
308
|
+
case 7:
|
|
309
|
+
_context5.next = 9;
|
|
310
310
|
return Utils.ResponseToJson(response);
|
|
311
|
-
case
|
|
311
|
+
case 9:
|
|
312
312
|
return _context5.abrupt("return", _context5.sent.address);
|
|
313
|
-
case
|
|
314
|
-
_context5.prev =
|
|
315
|
-
|
|
316
|
-
if (!(
|
|
317
|
-
_context5.next =
|
|
313
|
+
case 12:
|
|
314
|
+
_context5.prev = 12;
|
|
315
|
+
_context5.t0 = _context5["catch"](1);
|
|
316
|
+
if (!(_context5.t0.status !== 404)) {
|
|
317
|
+
_context5.next = 16;
|
|
318
318
|
break;
|
|
319
319
|
}
|
|
320
|
-
throw
|
|
321
|
-
case
|
|
320
|
+
throw _context5.t0;
|
|
321
|
+
case 16:
|
|
322
322
|
return _context5.abrupt("return", undefined);
|
|
323
|
-
case
|
|
323
|
+
case 17:
|
|
324
324
|
case "end":
|
|
325
325
|
return _context5.stop();
|
|
326
326
|
}
|
|
327
|
-
}, _callee5, this, [[1,
|
|
327
|
+
}, _callee5, this, [[1, 12]]);
|
|
328
328
|
}));
|
|
329
329
|
return function (_x5) {
|
|
330
|
-
return
|
|
330
|
+
return _ref12.apply(this, arguments);
|
|
331
331
|
};
|
|
332
332
|
}();
|
|
@@ -210,13 +210,13 @@ var Popup = function Popup(_ref) {
|
|
|
210
210
|
return newWindow;
|
|
211
211
|
};
|
|
212
212
|
exports.ActionPopup = /*#__PURE__*/function () {
|
|
213
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
|
|
213
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref2) {
|
|
214
214
|
var _ref2$mode, mode, url, onMessage, onCancel;
|
|
215
|
-
return _regeneratorRuntime.wrap(function (_context3) {
|
|
215
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
216
216
|
while (1) switch (_context3.prev = _context3.next) {
|
|
217
217
|
case 0:
|
|
218
218
|
_ref2$mode = _ref2.mode, mode = _ref2$mode === void 0 ? "tab" : _ref2$mode, url = _ref2.url, onMessage = _ref2.onMessage, onCancel = _ref2.onCancel;
|
|
219
|
-
_context3.next =
|
|
219
|
+
_context3.next = 3;
|
|
220
220
|
return new Promise(function (resolve) {
|
|
221
221
|
var newWindow = mode === "popup" ? Popup({
|
|
222
222
|
url: url,
|
|
@@ -224,41 +224,41 @@ exports.ActionPopup = /*#__PURE__*/function () {
|
|
|
224
224
|
w: 500,
|
|
225
225
|
h: 850
|
|
226
226
|
}) : window.open(url);
|
|
227
|
-
var closeCheck = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
228
|
-
return _regeneratorRuntime.wrap(function (_context) {
|
|
227
|
+
var closeCheck = setInterval( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
228
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
229
229
|
while (1) switch (_context.prev = _context.next) {
|
|
230
230
|
case 0:
|
|
231
231
|
if (!newWindow.closed) {
|
|
232
|
-
_context.next =
|
|
232
|
+
_context.next = 6;
|
|
233
233
|
break;
|
|
234
234
|
}
|
|
235
235
|
clearInterval(closeCheck);
|
|
236
236
|
if (!onCancel) {
|
|
237
|
-
_context.next =
|
|
237
|
+
_context.next = 5;
|
|
238
238
|
break;
|
|
239
239
|
}
|
|
240
|
-
_context.next =
|
|
240
|
+
_context.next = 5;
|
|
241
241
|
return onCancel();
|
|
242
|
-
case
|
|
242
|
+
case 5:
|
|
243
243
|
resolve();
|
|
244
|
-
case
|
|
244
|
+
case 6:
|
|
245
245
|
case "end":
|
|
246
246
|
return _context.stop();
|
|
247
247
|
}
|
|
248
248
|
}, _callee);
|
|
249
249
|
})), 1000);
|
|
250
250
|
window.addEventListener("message", /*#__PURE__*/function () {
|
|
251
|
-
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(event) {
|
|
252
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
251
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(event) {
|
|
252
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
253
253
|
while (1) switch (_context2.prev = _context2.next) {
|
|
254
254
|
case 0:
|
|
255
|
-
_context2.next =
|
|
255
|
+
_context2.next = 2;
|
|
256
256
|
return onMessage(event, function () {
|
|
257
257
|
clearInterval(closeCheck);
|
|
258
258
|
newWindow.close();
|
|
259
259
|
resolve();
|
|
260
260
|
});
|
|
261
|
-
case
|
|
261
|
+
case 2:
|
|
262
262
|
case "end":
|
|
263
263
|
return _context2.stop();
|
|
264
264
|
}
|
|
@@ -269,7 +269,7 @@ exports.ActionPopup = /*#__PURE__*/function () {
|
|
|
269
269
|
};
|
|
270
270
|
}());
|
|
271
271
|
});
|
|
272
|
-
case
|
|
272
|
+
case 3:
|
|
273
273
|
case "end":
|
|
274
274
|
return _context3.stop();
|
|
275
275
|
}
|