@iobroker/adapter-react-v5 4.0.8 → 4.0.10

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.
Files changed (72) hide show
  1. package/Components/404.js.map +1 -1
  2. package/Components/FileBrowser.js.map +1 -1
  3. package/Components/IconSelector.js.map +1 -1
  4. package/Components/JsonConfigComponent/ConfigCRON.js +13 -15
  5. package/Components/JsonConfigComponent/ConfigCRON.js.map +1 -1
  6. package/Components/JsonConfigComponent/ConfigCertificateSelect.js +39 -41
  7. package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
  8. package/Components/JsonConfigComponent/ConfigCheckLicense.js +314 -322
  9. package/Components/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
  10. package/Components/JsonConfigComponent/ConfigCustom.js +138 -144
  11. package/Components/JsonConfigComponent/ConfigCustom.js.map +1 -1
  12. package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
  13. package/Components/JsonConfigComponent/ConfigFileSelector.js +95 -99
  14. package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
  15. package/Components/JsonConfigComponent/ConfigFunc.js +13 -7
  16. package/Components/JsonConfigComponent/ConfigFunc.js.map +1 -1
  17. package/Components/JsonConfigComponent/ConfigGeneric.js +4 -6
  18. package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -1
  19. package/Components/JsonConfigComponent/ConfigIP.js +1 -1
  20. package/Components/JsonConfigComponent/ConfigIP.js.map +1 -1
  21. package/Components/JsonConfigComponent/ConfigImageUpload.js +21 -23
  22. package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
  23. package/Components/JsonConfigComponent/ConfigInstanceSelect.js +69 -71
  24. package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
  25. package/Components/JsonConfigComponent/ConfigJsonEditor.js +17 -19
  26. package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
  27. package/Components/JsonConfigComponent/ConfigLanguage.js +2 -2
  28. package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -1
  29. package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -1
  30. package/Components/JsonConfigComponent/ConfigObjectId.js +14 -16
  31. package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -1
  32. package/Components/JsonConfigComponent/ConfigPattern.js +1 -1
  33. package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -1
  34. package/Components/JsonConfigComponent/ConfigRoom.js +12 -6
  35. package/Components/JsonConfigComponent/ConfigRoom.js.map +1 -1
  36. package/Components/JsonConfigComponent/ConfigSelect.js +1 -1
  37. package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -1
  38. package/Components/JsonConfigComponent/ConfigSendto.js +54 -41
  39. package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
  40. package/Components/JsonConfigComponent/ConfigSetState.js +70 -76
  41. package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -1
  42. package/Components/JsonConfigComponent/ConfigTable.js +21 -23
  43. package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
  44. package/Components/JsonConfigComponent/ConfigTextSendTo.js +2 -2
  45. package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +1 -1
  46. package/Components/JsonConfigComponent/ConfigUUID.js +13 -15
  47. package/Components/JsonConfigComponent/ConfigUUID.js.map +1 -1
  48. package/Components/JsonConfigComponent/ConfigUser.js +2 -2
  49. package/Components/JsonConfigComponent/ConfigUser.js.map +1 -1
  50. package/Components/ObjectBrowser.js +198 -204
  51. package/Components/ObjectBrowser.js.map +1 -1
  52. package/Components/Schedule.js.map +1 -1
  53. package/Components/Utils.js +1 -1
  54. package/Components/Utils.js.map +1 -1
  55. package/Dialogs/SelectFile.js.map +1 -1
  56. package/Dialogs/SelectID.js.map +1 -1
  57. package/LICENSE +1 -1
  58. package/README.md +10 -2
  59. package/_Connection.js +23 -25
  60. package/_Connection.js.map +1 -1
  61. package/i18n/de.json +3 -1
  62. package/i18n/en.json +3 -1
  63. package/i18n/es.json +3 -1
  64. package/i18n/fr.json +3 -1
  65. package/i18n/it.json +3 -1
  66. package/i18n/nl.json +3 -1
  67. package/i18n/pl.json +3 -1
  68. package/i18n/pt.json +3 -1
  69. package/i18n/ru.json +3 -1
  70. package/i18n/uk.json +3 -1
  71. package/i18n/zh-cn.json +3 -1
  72. package/package.json +7 -7
@@ -67,22 +67,20 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
67
67
  value: function () {
68
68
  var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
69
69
  return _regenerator["default"].wrap(function _callee$(_context) {
70
- while (1) {
71
- switch (_context.prev = _context.next) {
72
- case 0:
73
- (0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigCheckLicense.prototype), "componentDidMount", this).call(this);
74
- this.setState({
75
- _error: '',
76
- running: false,
77
- showLicenseData: null,
78
- foundSuitableLicense: false,
79
- licenseOfflineCheck: false,
80
- result: null
81
- });
82
- case 2:
83
- case "end":
84
- return _context.stop();
85
- }
70
+ while (1) switch (_context.prev = _context.next) {
71
+ case 0:
72
+ (0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigCheckLicense.prototype), "componentDidMount", this).call(this);
73
+ this.setState({
74
+ _error: '',
75
+ running: false,
76
+ showLicenseData: null,
77
+ foundSuitableLicense: false,
78
+ licenseOfflineCheck: false,
79
+ result: null
80
+ });
81
+ case 2:
82
+ case "end":
83
+ return _context.stop();
86
84
  }
87
85
  }, _callee, this);
88
86
  }));
@@ -152,55 +150,53 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
152
150
  var _licenses$native, _licenses$native$lice;
153
151
  var licenses, _useLicense, useLicense, now, uuid, _uuidObj$native, uuidObj, version, _aObj$common, aObj;
154
152
  return _regenerator["default"].wrap(function _callee2$(_context2) {
155
- while (1) {
156
- switch (_context2.prev = _context2.next) {
157
- case 0:
158
- _context2.next = 2;
159
- return this.props.socket.getObject('system.licenses');
160
- case 2:
161
- licenses = _context2.sent;
162
- if (!(licenses !== null && licenses !== void 0 && (_licenses$native = licenses["native"]) !== null && _licenses$native !== void 0 && (_licenses$native$lice = _licenses$native.licenses) !== null && _licenses$native$lice !== void 0 && _licenses$native$lice.length)) {
163
- _context2.next = 19;
164
- break;
165
- }
166
- // enable license manager
167
- now = Date.now();
168
- if (!this.props.schema.uuid) {
169
- _context2.next = 10;
170
- break;
171
- }
172
- _context2.next = 8;
173
- return this.props.socket.getObject('system.meta.uuid');
174
- case 8:
175
- uuidObj = _context2.sent;
176
- uuid = uuidObj === null || uuidObj === void 0 ? void 0 : (_uuidObj$native = uuidObj["native"]) === null || _uuidObj$native === void 0 ? void 0 : _uuidObj$native.uuid;
177
- case 10:
178
- if (!this.props.schema.version) {
179
- _context2.next = 15;
180
- break;
181
- }
182
- _context2.next = 13;
183
- return this.props.socket.getObject("system.adapter.".concat(adapterName));
184
- case 13:
185
- aObj = _context2.sent;
186
- version = aObj === null || aObj === void 0 ? void 0 : (_aObj$common = aObj.common) === null || _aObj$common === void 0 ? void 0 : _aObj$common.version;
187
- case 15:
188
- // find license for vis
189
- licenses["native"].licenses.forEach(function (license) {
190
- if (!license.validTill || license.validTill === '0000-00-00 00:00:00' || new Date(license.validTill).getTime() > now) {
191
- var parts = (license.product || '').split('.');
192
- if (parts[1] === adapterName && (!useLicense || license.invoice !== 'free') && (!uuid || !license.uuid || license.uuid === uuid) && ConfigCheckLicense.isVersionValid(version, license.version, license.invoice, adapterName)) {
193
- useLicense = license;
194
- }
153
+ while (1) switch (_context2.prev = _context2.next) {
154
+ case 0:
155
+ _context2.next = 2;
156
+ return this.props.socket.getObject('system.licenses');
157
+ case 2:
158
+ licenses = _context2.sent;
159
+ if (!(licenses !== null && licenses !== void 0 && (_licenses$native = licenses["native"]) !== null && _licenses$native !== void 0 && (_licenses$native$lice = _licenses$native.licenses) !== null && _licenses$native$lice !== void 0 && _licenses$native$lice.length)) {
160
+ _context2.next = 19;
161
+ break;
162
+ }
163
+ // enable license manager
164
+ now = Date.now();
165
+ if (!this.props.schema.uuid) {
166
+ _context2.next = 10;
167
+ break;
168
+ }
169
+ _context2.next = 8;
170
+ return this.props.socket.getObject('system.meta.uuid');
171
+ case 8:
172
+ uuidObj = _context2.sent;
173
+ uuid = uuidObj === null || uuidObj === void 0 ? void 0 : (_uuidObj$native = uuidObj["native"]) === null || _uuidObj$native === void 0 ? void 0 : _uuidObj$native.uuid;
174
+ case 10:
175
+ if (!this.props.schema.version) {
176
+ _context2.next = 15;
177
+ break;
178
+ }
179
+ _context2.next = 13;
180
+ return this.props.socket.getObject("system.adapter.".concat(adapterName));
181
+ case 13:
182
+ aObj = _context2.sent;
183
+ version = aObj === null || aObj === void 0 ? void 0 : (_aObj$common = aObj.common) === null || _aObj$common === void 0 ? void 0 : _aObj$common.version;
184
+ case 15:
185
+ // find license for vis
186
+ licenses["native"].licenses.forEach(function (license) {
187
+ if (!license.validTill || license.validTill === '0000-00-00 00:00:00' || new Date(license.validTill).getTime() > now) {
188
+ var parts = (license.product || '').split('.');
189
+ if (parts[1] === adapterName && (!useLicense || license.invoice !== 'free') && (!uuid || !license.uuid || license.uuid === uuid) && ConfigCheckLicense.isVersionValid(version, license.version, license.invoice, adapterName)) {
190
+ useLicense = license;
195
191
  }
196
- });
197
- return _context2.abrupt("return", (_useLicense = useLicense) === null || _useLicense === void 0 ? void 0 : _useLicense.json);
198
- case 19:
199
- return _context2.abrupt("return", false);
200
- case 20:
201
- case "end":
202
- return _context2.stop();
203
- }
192
+ }
193
+ });
194
+ return _context2.abrupt("return", (_useLicense = useLicense) === null || _useLicense === void 0 ? void 0 : _useLicense.json);
195
+ case 19:
196
+ return _context2.abrupt("return", false);
197
+ case 20:
198
+ case "end":
199
+ return _context2.stop();
204
200
  }
205
201
  }, _callee2, this);
206
202
  }));
@@ -215,233 +211,231 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
215
211
  var _checkLicense = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(license, adapterName) {
216
212
  var uuid, _uuidObj$native2, uuidObj, version, _aObj$common2, aObj, _data, response, data, _data2, showLicenseData, validTill, parts, _error$response, _data3, _parts;
217
213
  return _regenerator["default"].wrap(function _callee3$(_context3) {
218
- while (1) {
219
- switch (_context3.prev = _context3.next) {
220
- case 0:
221
- if (!this.props.schema.uuid) {
222
- _context3.next = 5;
223
- break;
224
- }
225
- _context3.next = 3;
226
- return this.props.socket.getObject('system.meta.uuid');
227
- case 3:
228
- uuidObj = _context3.sent;
229
- uuid = uuidObj === null || uuidObj === void 0 ? void 0 : (_uuidObj$native2 = uuidObj["native"]) === null || _uuidObj$native2 === void 0 ? void 0 : _uuidObj$native2.uuid;
230
- case 5:
231
- if (!this.props.schema.version) {
232
- _context3.next = 10;
233
- break;
234
- }
235
- _context3.next = 8;
236
- return this.props.socket.getObject("system.adapter.".concat(adapterName));
237
- case 8:
238
- aObj = _context3.sent;
239
- version = aObj === null || aObj === void 0 ? void 0 : (_aObj$common2 = aObj.common) === null || _aObj$common2 === void 0 ? void 0 : _aObj$common2.version;
240
- case 10:
241
- _context3.prev = 10;
242
- _context3.next = 13;
243
- return window.fetch('https://iobroker.net/api/v1/public/cert/', {
244
- method: 'POST',
245
- body: JSON.stringify({
246
- json: license,
247
- uuid: uuid
248
- }),
249
- headers: {
250
- 'Content-Type': 'text/plain'
251
- }
252
- });
253
- case 13:
254
- response = _context3.sent;
255
- _context3.next = 16;
256
- return response.text();
257
- case 16:
258
- data = _context3.sent;
259
- try {
260
- data = JSON.parse(data);
261
- } catch (e) {
262
- // ignore
263
- }
264
- if (!((_data = data) !== null && _data !== void 0 && _data.error)) {
265
- _context3.next = 30;
266
- break;
267
- }
268
- _context3.prev = 19;
269
- _data2 = ConfigCheckLicense.parseJwt(license);
270
- return _context3.abrupt("return", this.setState({
271
- _error: _data2.error,
272
- showLicenseData: _data2,
273
- result: false,
274
- running: false
275
- }));
276
- case 24:
277
- _context3.prev = 24;
278
- _context3.t0 = _context3["catch"](19);
279
- console.log('Cannot parse license');
280
- return _context3.abrupt("return", this.setState({
281
- _error: data.error,
282
- result: false,
283
- running: false
284
- }));
285
- case 28:
286
- _context3.next = 49;
214
+ while (1) switch (_context3.prev = _context3.next) {
215
+ case 0:
216
+ if (!this.props.schema.uuid) {
217
+ _context3.next = 5;
287
218
  break;
288
- case 30:
289
- showLicenseData = null;
290
- try {
291
- showLicenseData = ConfigCheckLicense.parseJwt(license);
292
- } catch (e) {}
293
- if (!data) {
294
- _context3.next = 48;
295
- break;
296
- }
297
- validTill = data.validTill || data.valid_till;
298
- if (!(validTill && validTill !== '0000-00-00 00:00:00' && new Date(validTill).getTime() < Date.now())) {
299
- _context3.next = 36;
300
- break;
301
- }
302
- return _context3.abrupt("return", this.setState({
303
- _error: _i18n["default"].t('ra_License expired on %s', new Date(validTill).toLocaleString()),
304
- licenseOfflineCheck: true,
305
- showLicenseData: showLicenseData,
306
- result: false,
307
- running: false
308
- }));
309
- case 36:
310
- parts = (data.name || '').split('.');
311
- if (!(parts[1] === adapterName)) {
312
- _context3.next = 45;
313
- break;
314
- }
315
- if (!(uuid && data.uuid && data.uuid !== uuid)) {
316
- _context3.next = 40;
317
- break;
318
- }
319
- return _context3.abrupt("return", this.setState({
320
- _error: _i18n["default"].t('ra_Serial number (UUID) "%s" in license is for other device.', data.uuid),
321
- licenseOfflineCheck: true,
322
- showLicenseData: showLicenseData,
323
- result: false,
324
- running: false
325
- }));
326
- case 40:
327
- if (ConfigCheckLicense.isVersionValid(version, data.version, data.invoice, adapterName)) {
328
- _context3.next = 42;
329
- break;
219
+ }
220
+ _context3.next = 3;
221
+ return this.props.socket.getObject('system.meta.uuid');
222
+ case 3:
223
+ uuidObj = _context3.sent;
224
+ uuid = uuidObj === null || uuidObj === void 0 ? void 0 : (_uuidObj$native2 = uuidObj["native"]) === null || _uuidObj$native2 === void 0 ? void 0 : _uuidObj$native2.uuid;
225
+ case 5:
226
+ if (!this.props.schema.version) {
227
+ _context3.next = 10;
228
+ break;
229
+ }
230
+ _context3.next = 8;
231
+ return this.props.socket.getObject("system.adapter.".concat(adapterName));
232
+ case 8:
233
+ aObj = _context3.sent;
234
+ version = aObj === null || aObj === void 0 ? void 0 : (_aObj$common2 = aObj.common) === null || _aObj$common2 === void 0 ? void 0 : _aObj$common2.version;
235
+ case 10:
236
+ _context3.prev = 10;
237
+ _context3.next = 13;
238
+ return window.fetch('https://iobroker.net/api/v1/public/cert/', {
239
+ method: 'POST',
240
+ body: JSON.stringify({
241
+ json: license,
242
+ uuid: uuid
243
+ }),
244
+ headers: {
245
+ 'Content-Type': 'text/plain'
330
246
  }
331
- return _context3.abrupt("return", this.setState({
332
- _error: _i18n["default"].t('ra_License is for version %s, but required version is %s', data.version, this.props.schema.version),
333
- licenseOfflineCheck: true,
334
- showLicenseData: showLicenseData,
335
- result: false,
336
- running: false
337
- }));
338
- case 42:
339
- return _context3.abrupt("return", this.setState({
340
- licenseOfflineCheck: true,
341
- showLicenseData: showLicenseData,
342
- result: true,
343
- running: false
344
- }));
345
- case 45:
346
- return _context3.abrupt("return", this.setState({
347
- _error: _i18n["default"].t('ra_License for other product "%s"', data.name),
348
- licenseOfflineCheck: true,
349
- showLicenseData: showLicenseData,
350
- result: false,
351
- running: false
352
- }));
353
- case 46:
354
- _context3.next = 49;
247
+ });
248
+ case 13:
249
+ response = _context3.sent;
250
+ _context3.next = 16;
251
+ return response.text();
252
+ case 16:
253
+ data = _context3.sent;
254
+ try {
255
+ data = JSON.parse(data);
256
+ } catch (e) {
257
+ // ignore
258
+ }
259
+ if (!((_data = data) !== null && _data !== void 0 && _data.error)) {
260
+ _context3.next = 30;
355
261
  break;
356
- case 48:
357
- throw new Error('ra_Invalid answer from server');
358
- case 49:
359
- _context3.next = 74;
262
+ }
263
+ _context3.prev = 19;
264
+ _data2 = ConfigCheckLicense.parseJwt(license);
265
+ return _context3.abrupt("return", this.setState({
266
+ _error: _data2.error,
267
+ showLicenseData: _data2,
268
+ result: false,
269
+ running: false
270
+ }));
271
+ case 24:
272
+ _context3.prev = 24;
273
+ _context3.t0 = _context3["catch"](19);
274
+ console.log('Cannot parse license');
275
+ return _context3.abrupt("return", this.setState({
276
+ _error: data.error,
277
+ result: false,
278
+ running: false
279
+ }));
280
+ case 28:
281
+ _context3.next = 49;
282
+ break;
283
+ case 30:
284
+ showLicenseData = null;
285
+ try {
286
+ showLicenseData = ConfigCheckLicense.parseJwt(license);
287
+ } catch (e) {}
288
+ if (!data) {
289
+ _context3.next = 48;
360
290
  break;
361
- case 51:
362
- _context3.prev = 51;
363
- _context3.t1 = _context3["catch"](10);
364
- if (!((_context3.t1 === null || _context3.t1 === void 0 ? void 0 : (_error$response = _context3.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 404)) {
365
- _context3.next = 55;
366
- break;
367
- }
368
- return _context3.abrupt("return", this.setState({
369
- _error: _i18n["default"].t('ra_License does not exist'),
370
- result: false,
371
- running: false
372
- }));
373
- case 55:
374
- _context3.prev = 55;
375
- _data3 = ConfigCheckLicense.parseJwt(license);
376
- _parts = (_data3.name || '').split('.');
377
- if (!(_data3.valid_till && _data3.valid_till !== '0000-00-00 00:00:00' && new Date(_data3.valid_till).getTime() < Date.now())) {
378
- _context3.next = 60;
379
- break;
380
- }
381
- return _context3.abrupt("return", this.setState({
382
- _error: _i18n["default"].t('ra_License expired on %s', new Date(_data3.valid_till).toLocaleString()),
383
- showLicenseData: _data3,
384
- licenseOfflineCheck: true,
385
- running: false,
386
- result: false
387
- }));
388
- case 60:
389
- if (!(_parts[1] === adapterName)) {
390
- _context3.next = 68;
391
- break;
392
- }
393
- if (!(uuid && _data3.uuid && _data3.uuid !== uuid)) {
394
- _context3.next = 63;
395
- break;
396
- }
397
- return _context3.abrupt("return", this.setState({
398
- _error: _i18n["default"].t('ra_Serial number (UUID) "%s" in license is for other device.', _data3.uuid),
399
- showLicenseData: _data3,
400
- licenseOfflineCheck: true,
401
- result: false,
402
- running: false
403
- }));
404
- case 63:
405
- if (ConfigCheckLicense.isVersionValid(version, _data3.version, _data3.invoice, adapterName)) {
406
- _context3.next = 65;
407
- break;
408
- }
409
- return _context3.abrupt("return", this.setState({
410
- _error: _i18n["default"].t('ra_License is for version %s, but required version is %s', _data3.version, this.props.schema.version),
411
- licenseOfflineCheck: true,
412
- showLicenseData: _data3,
413
- result: false,
414
- running: false
415
- }));
416
- case 65:
417
- return _context3.abrupt("return", this.setState({
418
- result: true,
419
- licenseOfflineCheck: true
420
- }));
421
- case 68:
422
- return _context3.abrupt("return", this.setState({
423
- _error: _i18n["default"].t('ra_License for other product "%s"', _data3.name),
424
- licenseOfflineCheck: true,
425
- showLicenseData: _data3,
426
- result: false,
427
- running: false
428
- }));
429
- case 69:
430
- _context3.next = 74;
291
+ }
292
+ validTill = data.validTill || data.valid_till;
293
+ if (!(validTill && validTill !== '0000-00-00 00:00:00' && new Date(validTill).getTime() < Date.now())) {
294
+ _context3.next = 36;
295
+ break;
296
+ }
297
+ return _context3.abrupt("return", this.setState({
298
+ _error: _i18n["default"].t('ra_License expired on %s', new Date(validTill).toLocaleString()),
299
+ licenseOfflineCheck: true,
300
+ showLicenseData: showLicenseData,
301
+ result: false,
302
+ running: false
303
+ }));
304
+ case 36:
305
+ parts = (data.name || '').split('.');
306
+ if (!(parts[1] === adapterName)) {
307
+ _context3.next = 45;
308
+ break;
309
+ }
310
+ if (!(uuid && data.uuid && data.uuid !== uuid)) {
311
+ _context3.next = 40;
431
312
  break;
432
- case 71:
433
- _context3.prev = 71;
434
- _context3.t2 = _context3["catch"](55);
435
- return _context3.abrupt("return", this.setState({
436
- _error: _i18n["default"].t('ra_Cannot decode license'),
437
- result: false,
438
- licenseOfflineCheck: true,
439
- running: false
440
- }));
441
- case 74:
442
- case "end":
443
- return _context3.stop();
444
- }
313
+ }
314
+ return _context3.abrupt("return", this.setState({
315
+ _error: _i18n["default"].t('ra_Serial number (UUID) "%s" in license is for other device.', data.uuid),
316
+ licenseOfflineCheck: true,
317
+ showLicenseData: showLicenseData,
318
+ result: false,
319
+ running: false
320
+ }));
321
+ case 40:
322
+ if (ConfigCheckLicense.isVersionValid(version, data.version, data.invoice, adapterName)) {
323
+ _context3.next = 42;
324
+ break;
325
+ }
326
+ return _context3.abrupt("return", this.setState({
327
+ _error: _i18n["default"].t('ra_License is for version %s, but required version is %s', data.version, this.props.schema.version),
328
+ licenseOfflineCheck: true,
329
+ showLicenseData: showLicenseData,
330
+ result: false,
331
+ running: false
332
+ }));
333
+ case 42:
334
+ return _context3.abrupt("return", this.setState({
335
+ licenseOfflineCheck: true,
336
+ showLicenseData: showLicenseData,
337
+ result: true,
338
+ running: false
339
+ }));
340
+ case 45:
341
+ return _context3.abrupt("return", this.setState({
342
+ _error: _i18n["default"].t('ra_License for other product "%s"', data.name),
343
+ licenseOfflineCheck: true,
344
+ showLicenseData: showLicenseData,
345
+ result: false,
346
+ running: false
347
+ }));
348
+ case 46:
349
+ _context3.next = 49;
350
+ break;
351
+ case 48:
352
+ throw new Error('ra_Invalid answer from server');
353
+ case 49:
354
+ _context3.next = 74;
355
+ break;
356
+ case 51:
357
+ _context3.prev = 51;
358
+ _context3.t1 = _context3["catch"](10);
359
+ if (!((_context3.t1 === null || _context3.t1 === void 0 ? void 0 : (_error$response = _context3.t1.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 404)) {
360
+ _context3.next = 55;
361
+ break;
362
+ }
363
+ return _context3.abrupt("return", this.setState({
364
+ _error: _i18n["default"].t('ra_License does not exist'),
365
+ result: false,
366
+ running: false
367
+ }));
368
+ case 55:
369
+ _context3.prev = 55;
370
+ _data3 = ConfigCheckLicense.parseJwt(license);
371
+ _parts = (_data3.name || '').split('.');
372
+ if (!(_data3.valid_till && _data3.valid_till !== '0000-00-00 00:00:00' && new Date(_data3.valid_till).getTime() < Date.now())) {
373
+ _context3.next = 60;
374
+ break;
375
+ }
376
+ return _context3.abrupt("return", this.setState({
377
+ _error: _i18n["default"].t('ra_License expired on %s', new Date(_data3.valid_till).toLocaleString()),
378
+ showLicenseData: _data3,
379
+ licenseOfflineCheck: true,
380
+ running: false,
381
+ result: false
382
+ }));
383
+ case 60:
384
+ if (!(_parts[1] === adapterName)) {
385
+ _context3.next = 68;
386
+ break;
387
+ }
388
+ if (!(uuid && _data3.uuid && _data3.uuid !== uuid)) {
389
+ _context3.next = 63;
390
+ break;
391
+ }
392
+ return _context3.abrupt("return", this.setState({
393
+ _error: _i18n["default"].t('ra_Serial number (UUID) "%s" in license is for other device.', _data3.uuid),
394
+ showLicenseData: _data3,
395
+ licenseOfflineCheck: true,
396
+ result: false,
397
+ running: false
398
+ }));
399
+ case 63:
400
+ if (ConfigCheckLicense.isVersionValid(version, _data3.version, _data3.invoice, adapterName)) {
401
+ _context3.next = 65;
402
+ break;
403
+ }
404
+ return _context3.abrupt("return", this.setState({
405
+ _error: _i18n["default"].t('ra_License is for version %s, but required version is %s', _data3.version, this.props.schema.version),
406
+ licenseOfflineCheck: true,
407
+ showLicenseData: _data3,
408
+ result: false,
409
+ running: false
410
+ }));
411
+ case 65:
412
+ return _context3.abrupt("return", this.setState({
413
+ result: true,
414
+ licenseOfflineCheck: true
415
+ }));
416
+ case 68:
417
+ return _context3.abrupt("return", this.setState({
418
+ _error: _i18n["default"].t('ra_License for other product "%s"', _data3.name),
419
+ licenseOfflineCheck: true,
420
+ showLicenseData: _data3,
421
+ result: false,
422
+ running: false
423
+ }));
424
+ case 69:
425
+ _context3.next = 74;
426
+ break;
427
+ case 71:
428
+ _context3.prev = 71;
429
+ _context3.t2 = _context3["catch"](55);
430
+ return _context3.abrupt("return", this.setState({
431
+ _error: _i18n["default"].t('ra_Cannot decode license'),
432
+ result: false,
433
+ licenseOfflineCheck: true,
434
+ running: false
435
+ }));
436
+ case 74:
437
+ case "end":
438
+ return _context3.stop();
445
439
  }
446
440
  }, _callee3, this, [[10, 51], [19, 24], [55, 71]]);
447
441
  }));
@@ -456,44 +450,42 @@ var ConfigCheckLicense = /*#__PURE__*/function (_ConfigGeneric) {
456
450
  var _onClick2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
457
451
  var license;
458
452
  return _regenerator["default"].wrap(function _callee4$(_context4) {
459
- while (1) {
460
- switch (_context4.prev = _context4.next) {
461
- case 0:
462
- this.setState({
463
- running: true
464
- });
465
- if (!this.props.data.useLicenseManager) {
466
- _context4.next = 7;
467
- break;
468
- }
469
- _context4.next = 4;
470
- return this.findInLicenseManager(this.props.adapterName);
471
- case 4:
472
- license = _context4.sent;
473
- _context4.next = 8;
453
+ while (1) switch (_context4.prev = _context4.next) {
454
+ case 0:
455
+ this.setState({
456
+ running: true
457
+ });
458
+ if (!this.props.data.useLicenseManager) {
459
+ _context4.next = 7;
474
460
  break;
475
- case 7:
476
- license = this.props.data.license;
477
- case 8:
478
- if (!license) {
479
- _context4.next = 13;
480
- break;
481
- }
482
- _context4.next = 11;
483
- return this.checkLicense(license, this.props.adapterName, this.props.schema.uuid);
484
- case 11:
485
- _context4.next = 14;
461
+ }
462
+ _context4.next = 4;
463
+ return this.findInLicenseManager(this.props.adapterName);
464
+ case 4:
465
+ license = _context4.sent;
466
+ _context4.next = 8;
467
+ break;
468
+ case 7:
469
+ license = this.props.data.license;
470
+ case 8:
471
+ if (!license) {
472
+ _context4.next = 13;
486
473
  break;
487
- case 13:
488
- this.setState({
489
- _error: _i18n["default"].t('ra_Suitable license not found in license manager'),
490
- result: false,
491
- running: false
492
- });
493
- case 14:
494
- case "end":
495
- return _context4.stop();
496
- }
474
+ }
475
+ _context4.next = 11;
476
+ return this.checkLicense(license, this.props.adapterName, this.props.schema.uuid);
477
+ case 11:
478
+ _context4.next = 14;
479
+ break;
480
+ case 13:
481
+ this.setState({
482
+ _error: _i18n["default"].t('ra_Suitable license not found in license manager'),
483
+ result: false,
484
+ running: false
485
+ });
486
+ case 14:
487
+ case "end":
488
+ return _context4.stop();
497
489
  }
498
490
  }, _callee4, this);
499
491
  }));