@etsoo/appscript 1.1.92 → 1.1.96

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.
@@ -102,7 +102,7 @@ class CoreAppTest extends CoreApp<IAppSettings, {}, NotificationCallProps> {
102
102
  },
103
103
  createClient(),
104
104
  container,
105
- new WindowStorage([]),
105
+ new WindowStorage([], (_field, data, _index) => data),
106
106
  'SmartERP'
107
107
  );
108
108
  }
@@ -398,14 +398,6 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
398
398
  */
399
399
  get userData(): IUserData | undefined;
400
400
  protected set userData(value: IUserData | undefined);
401
- /**
402
- * Response token header field name
403
- */
404
- readonly headerTokenField = "SmartERPRefreshToken";
405
- /**
406
- * Serverside device id encrypted field name
407
- */
408
- protected readonly serversideDeviceIdField = "SmartERPServersideDeviceId";
409
401
  private ipDetectCallbacks?;
410
402
  /**
411
403
  * Search input element
@@ -426,14 +418,6 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
426
418
  * Token refresh count down seed
427
419
  */
428
420
  protected refreshCountdownSeed: number;
429
- /**
430
- * Device id field name
431
- */
432
- protected readonly deviceIdField: string;
433
- /**
434
- * Device passphrase field name
435
- */
436
- private readonly devicePassphraseField;
437
421
  /**
438
422
  * Init call Api URL
439
423
  */
@@ -726,3 +710,21 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
726
710
  */
727
711
  warning(message: NotificationContent<N>, align?: NotificationAlign): void;
728
712
  }
713
+ export declare namespace CoreApp {
714
+ /**
715
+ * Response token header field name
716
+ */
717
+ const headerTokenField = "SmartERPRefreshToken";
718
+ /**
719
+ * Serverside device id encrypted field name
720
+ */
721
+ const serversideDeviceIdField = "SmartERPServersideDeviceId";
722
+ /**
723
+ * Device id field name
724
+ */
725
+ const deviceIdField = "SmartERPDeviceId";
726
+ /**
727
+ * Device passphrase field name
728
+ */
729
+ const devicePassphraseField = "SmartERPDevicePassphrase";
730
+ }
@@ -22,14 +22,6 @@ class CoreApp {
22
22
  */
23
23
  constructor(settings, api, notifier, storage, name) {
24
24
  var _a;
25
- /**
26
- * Response token header field name
27
- */
28
- this.headerTokenField = 'SmartERPRefreshToken';
29
- /**
30
- * Serverside device id encrypted field name
31
- */
32
- this.serversideDeviceIdField = 'SmartERPServersideDeviceId';
33
25
  this._authorized = false;
34
26
  this._isTryingLogin = false;
35
27
  /**
@@ -40,14 +32,6 @@ class CoreApp {
40
32
  * Token refresh count down seed
41
33
  */
42
34
  this.refreshCountdownSeed = 0;
43
- /**
44
- * Device id field name
45
- */
46
- this.deviceIdField = 'SmartERPDeviceId';
47
- /**
48
- * Device passphrase field name
49
- */
50
- this.devicePassphraseField = 'SmartERPDevicePassphrase';
51
35
  /**
52
36
  * Init call Api URL
53
37
  */
@@ -62,7 +46,7 @@ class CoreApp {
62
46
  this.storage = storage;
63
47
  this.name = name;
64
48
  // Device id
65
- this._deviceId = (_a = storage.getData(this.deviceIdField)) !== null && _a !== void 0 ? _a : '';
49
+ this._deviceId = (_a = storage.getData(CoreApp.deviceIdField)) !== null && _a !== void 0 ? _a : '';
66
50
  this.setApi(api);
67
51
  const { currentCulture, currentRegion } = settings;
68
52
  this.changeCulture(currentCulture);
@@ -174,7 +158,7 @@ class CoreApp {
174
158
  var _a;
175
159
  // Passphrase exists?
176
160
  // Same session should avoid multiple init calls
177
- const passphraseEncrypted = this.storage.getData(this.devicePassphraseField);
161
+ const passphraseEncrypted = this.storage.getData(CoreApp.devicePassphraseField);
178
162
  if (passphraseEncrypted) {
179
163
  const passphraseDecrypted = this.decrypt(passphraseEncrypted, this.name);
180
164
  if (passphraseDecrypted != null) {
@@ -185,7 +169,7 @@ class CoreApp {
185
169
  }
186
170
  }
187
171
  // Serverside encrypted device id
188
- const identifier = this.storage.getData(this.serversideDeviceIdField);
172
+ const identifier = this.storage.getData(CoreApp.serversideDeviceIdField);
189
173
  // Timestamp
190
174
  const timestamp = new Date().getTime();
191
175
  // Request data
@@ -221,7 +205,7 @@ class CoreApp {
221
205
  if (callback)
222
206
  callback(false);
223
207
  // Clear device id
224
- this.storage.setData(this.deviceIdField, undefined);
208
+ this.storage.setData(CoreApp.deviceIdField, undefined);
225
209
  return;
226
210
  }
227
211
  this.initCallUpdate(result.data, data.timestamp);
@@ -244,10 +228,10 @@ class CoreApp {
244
228
  return;
245
229
  // Update device id and cache it
246
230
  this._deviceId = data.deviceId;
247
- this.storage.setData(this.deviceIdField, this.deviceId);
231
+ this.storage.setData(CoreApp.deviceIdField, this.deviceId);
248
232
  // Current passphrase
249
233
  this.passphrase = passphrase;
250
- this.storage.setData(this.devicePassphraseField, this.encrypt(passphrase, this.name));
234
+ this.storage.setData(CoreApp.devicePassphraseField, this.encrypt(passphrase, this.name));
251
235
  // Previous passphrase
252
236
  if (data.previousPassphrase) {
253
237
  const prev = this.decrypt(data.previousPassphrase, timestamp.toString());
@@ -279,7 +263,7 @@ class CoreApp {
279
263
  * @returns Fields
280
264
  */
281
265
  initCallEncryptedUpdateFields() {
282
- return [this.headerTokenField];
266
+ return [CoreApp.headerTokenField];
283
267
  }
284
268
  /**
285
269
  * Alert action result
@@ -303,7 +287,7 @@ class CoreApp {
303
287
  if (refreshToken !== '') {
304
288
  if (refreshToken != null)
305
289
  refreshToken = this.encrypt(refreshToken);
306
- this.storage.setData(this.headerTokenField, refreshToken);
290
+ this.storage.setData(CoreApp.headerTokenField, refreshToken);
307
291
  }
308
292
  // Reset tryLogin state
309
293
  this._isTryingLogin = false;
@@ -338,7 +322,7 @@ class CoreApp {
338
322
  if (regionItem == null || !this.settings.regions.includes(regionId))
339
323
  return;
340
324
  // Save the id to local storage
341
- shared_1.DomUtils.saveCountry(regionId);
325
+ this.storage.setData(shared_1.DomUtils.CountryField, regionId);
342
326
  // Set the currency and culture
343
327
  this._currency = regionItem.currency;
344
328
  this._region = regionId;
@@ -356,7 +340,7 @@ class CoreApp {
356
340
  if (this._culture === name)
357
341
  return;
358
342
  // Save the cultrue to local storage
359
- shared_1.DomUtils.saveCulture(name);
343
+ this.storage.setData(shared_1.DomUtils.CultureField, name);
360
344
  // Change the API's Content-Language header
361
345
  // .net 5 API, UseRequestLocalization, RequestCultureProviders, ContentLanguageHeaderRequestCultureProvider
362
346
  this.api.setContentLanguage(name);
@@ -375,17 +359,17 @@ class CoreApp {
375
359
  * Clear cache data
376
360
  */
377
361
  clearCacheData() {
378
- this.storage.setData(this.serversideDeviceIdField, undefined);
379
- this.storage.setData(this.deviceIdField, undefined);
380
- this.storage.setData(this.devicePassphraseField, undefined);
381
- this.storage.setData(this.headerTokenField, undefined);
362
+ this.storage.setData(CoreApp.serversideDeviceIdField, undefined);
363
+ this.storage.setData(CoreApp.deviceIdField, undefined);
364
+ this.storage.setData(CoreApp.devicePassphraseField, undefined);
365
+ this.storage.setData(CoreApp.headerTokenField, undefined);
382
366
  }
383
367
  /**
384
368
  * Clear cached token
385
369
  */
386
370
  clearCacheToken() {
387
371
  this.cachedRefreshToken = undefined;
388
- this.storage.setData(this.headerTokenField, undefined);
372
+ this.storage.setData(CoreApp.headerTokenField, undefined);
389
373
  }
390
374
  /**
391
375
  * Decrypt message
@@ -633,7 +617,7 @@ class CoreApp {
633
617
  // Temp refresh token
634
618
  if (this.cachedRefreshToken)
635
619
  return this.cachedRefreshToken;
636
- return this.storage.getData(this.headerTokenField);
620
+ return this.storage.getData(CoreApp.headerTokenField);
637
621
  }
638
622
  /**
639
623
  * Get all regions
@@ -651,7 +635,7 @@ class CoreApp {
651
635
  */
652
636
  getResponseToken(rawResponse) {
653
637
  const response = this.api.transformResponse(rawResponse);
654
- return this.api.getHeaderValue(response.headers, this.headerTokenField);
638
+ return this.api.getHeaderValue(response.headers, CoreApp.headerTokenField);
655
639
  }
656
640
  /**
657
641
  * Get time zone
@@ -851,7 +835,7 @@ class CoreApp {
851
835
  userLogin(user, refreshToken, keep) {
852
836
  this.userData = user;
853
837
  // Cache the encrypted serverside device id
854
- this.storage.setData(this.serversideDeviceIdField, user.deviceId);
838
+ this.storage.setData(CoreApp.serversideDeviceIdField, user.deviceId);
855
839
  if (keep) {
856
840
  this.authorize(user.token, refreshToken);
857
841
  }
@@ -889,3 +873,21 @@ class CoreApp {
889
873
  }
890
874
  }
891
875
  exports.CoreApp = CoreApp;
876
+ (function (CoreApp) {
877
+ /**
878
+ * Response token header field name
879
+ */
880
+ CoreApp.headerTokenField = 'SmartERPRefreshToken';
881
+ /**
882
+ * Serverside device id encrypted field name
883
+ */
884
+ CoreApp.serversideDeviceIdField = 'SmartERPServersideDeviceId';
885
+ /**
886
+ * Device id field name
887
+ */
888
+ CoreApp.deviceIdField = 'SmartERPDeviceId';
889
+ /**
890
+ * Device passphrase field name
891
+ */
892
+ CoreApp.devicePassphraseField = 'SmartERPDevicePassphrase';
893
+ })(CoreApp = exports.CoreApp || (exports.CoreApp = {}));
@@ -398,14 +398,6 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
398
398
  */
399
399
  get userData(): IUserData | undefined;
400
400
  protected set userData(value: IUserData | undefined);
401
- /**
402
- * Response token header field name
403
- */
404
- readonly headerTokenField = "SmartERPRefreshToken";
405
- /**
406
- * Serverside device id encrypted field name
407
- */
408
- protected readonly serversideDeviceIdField = "SmartERPServersideDeviceId";
409
401
  private ipDetectCallbacks?;
410
402
  /**
411
403
  * Search input element
@@ -426,14 +418,6 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
426
418
  * Token refresh count down seed
427
419
  */
428
420
  protected refreshCountdownSeed: number;
429
- /**
430
- * Device id field name
431
- */
432
- protected readonly deviceIdField: string;
433
- /**
434
- * Device passphrase field name
435
- */
436
- private readonly devicePassphraseField;
437
421
  /**
438
422
  * Init call Api URL
439
423
  */
@@ -726,3 +710,21 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
726
710
  */
727
711
  warning(message: NotificationContent<N>, align?: NotificationAlign): void;
728
712
  }
713
+ export declare namespace CoreApp {
714
+ /**
715
+ * Response token header field name
716
+ */
717
+ const headerTokenField = "SmartERPRefreshToken";
718
+ /**
719
+ * Serverside device id encrypted field name
720
+ */
721
+ const serversideDeviceIdField = "SmartERPServersideDeviceId";
722
+ /**
723
+ * Device id field name
724
+ */
725
+ const deviceIdField = "SmartERPDeviceId";
726
+ /**
727
+ * Device passphrase field name
728
+ */
729
+ const devicePassphraseField = "SmartERPDevicePassphrase";
730
+ }
@@ -19,14 +19,6 @@ export class CoreApp {
19
19
  */
20
20
  constructor(settings, api, notifier, storage, name) {
21
21
  var _a;
22
- /**
23
- * Response token header field name
24
- */
25
- this.headerTokenField = 'SmartERPRefreshToken';
26
- /**
27
- * Serverside device id encrypted field name
28
- */
29
- this.serversideDeviceIdField = 'SmartERPServersideDeviceId';
30
22
  this._authorized = false;
31
23
  this._isTryingLogin = false;
32
24
  /**
@@ -37,14 +29,6 @@ export class CoreApp {
37
29
  * Token refresh count down seed
38
30
  */
39
31
  this.refreshCountdownSeed = 0;
40
- /**
41
- * Device id field name
42
- */
43
- this.deviceIdField = 'SmartERPDeviceId';
44
- /**
45
- * Device passphrase field name
46
- */
47
- this.devicePassphraseField = 'SmartERPDevicePassphrase';
48
32
  /**
49
33
  * Init call Api URL
50
34
  */
@@ -59,7 +43,7 @@ export class CoreApp {
59
43
  this.storage = storage;
60
44
  this.name = name;
61
45
  // Device id
62
- this._deviceId = (_a = storage.getData(this.deviceIdField)) !== null && _a !== void 0 ? _a : '';
46
+ this._deviceId = (_a = storage.getData(CoreApp.deviceIdField)) !== null && _a !== void 0 ? _a : '';
63
47
  this.setApi(api);
64
48
  const { currentCulture, currentRegion } = settings;
65
49
  this.changeCulture(currentCulture);
@@ -171,7 +155,7 @@ export class CoreApp {
171
155
  var _a;
172
156
  // Passphrase exists?
173
157
  // Same session should avoid multiple init calls
174
- const passphraseEncrypted = this.storage.getData(this.devicePassphraseField);
158
+ const passphraseEncrypted = this.storage.getData(CoreApp.devicePassphraseField);
175
159
  if (passphraseEncrypted) {
176
160
  const passphraseDecrypted = this.decrypt(passphraseEncrypted, this.name);
177
161
  if (passphraseDecrypted != null) {
@@ -182,7 +166,7 @@ export class CoreApp {
182
166
  }
183
167
  }
184
168
  // Serverside encrypted device id
185
- const identifier = this.storage.getData(this.serversideDeviceIdField);
169
+ const identifier = this.storage.getData(CoreApp.serversideDeviceIdField);
186
170
  // Timestamp
187
171
  const timestamp = new Date().getTime();
188
172
  // Request data
@@ -218,7 +202,7 @@ export class CoreApp {
218
202
  if (callback)
219
203
  callback(false);
220
204
  // Clear device id
221
- this.storage.setData(this.deviceIdField, undefined);
205
+ this.storage.setData(CoreApp.deviceIdField, undefined);
222
206
  return;
223
207
  }
224
208
  this.initCallUpdate(result.data, data.timestamp);
@@ -241,10 +225,10 @@ export class CoreApp {
241
225
  return;
242
226
  // Update device id and cache it
243
227
  this._deviceId = data.deviceId;
244
- this.storage.setData(this.deviceIdField, this.deviceId);
228
+ this.storage.setData(CoreApp.deviceIdField, this.deviceId);
245
229
  // Current passphrase
246
230
  this.passphrase = passphrase;
247
- this.storage.setData(this.devicePassphraseField, this.encrypt(passphrase, this.name));
231
+ this.storage.setData(CoreApp.devicePassphraseField, this.encrypt(passphrase, this.name));
248
232
  // Previous passphrase
249
233
  if (data.previousPassphrase) {
250
234
  const prev = this.decrypt(data.previousPassphrase, timestamp.toString());
@@ -276,7 +260,7 @@ export class CoreApp {
276
260
  * @returns Fields
277
261
  */
278
262
  initCallEncryptedUpdateFields() {
279
- return [this.headerTokenField];
263
+ return [CoreApp.headerTokenField];
280
264
  }
281
265
  /**
282
266
  * Alert action result
@@ -300,7 +284,7 @@ export class CoreApp {
300
284
  if (refreshToken !== '') {
301
285
  if (refreshToken != null)
302
286
  refreshToken = this.encrypt(refreshToken);
303
- this.storage.setData(this.headerTokenField, refreshToken);
287
+ this.storage.setData(CoreApp.headerTokenField, refreshToken);
304
288
  }
305
289
  // Reset tryLogin state
306
290
  this._isTryingLogin = false;
@@ -335,7 +319,7 @@ export class CoreApp {
335
319
  if (regionItem == null || !this.settings.regions.includes(regionId))
336
320
  return;
337
321
  // Save the id to local storage
338
- DomUtils.saveCountry(regionId);
322
+ this.storage.setData(DomUtils.CountryField, regionId);
339
323
  // Set the currency and culture
340
324
  this._currency = regionItem.currency;
341
325
  this._region = regionId;
@@ -353,7 +337,7 @@ export class CoreApp {
353
337
  if (this._culture === name)
354
338
  return;
355
339
  // Save the cultrue to local storage
356
- DomUtils.saveCulture(name);
340
+ this.storage.setData(DomUtils.CultureField, name);
357
341
  // Change the API's Content-Language header
358
342
  // .net 5 API, UseRequestLocalization, RequestCultureProviders, ContentLanguageHeaderRequestCultureProvider
359
343
  this.api.setContentLanguage(name);
@@ -372,17 +356,17 @@ export class CoreApp {
372
356
  * Clear cache data
373
357
  */
374
358
  clearCacheData() {
375
- this.storage.setData(this.serversideDeviceIdField, undefined);
376
- this.storage.setData(this.deviceIdField, undefined);
377
- this.storage.setData(this.devicePassphraseField, undefined);
378
- this.storage.setData(this.headerTokenField, undefined);
359
+ this.storage.setData(CoreApp.serversideDeviceIdField, undefined);
360
+ this.storage.setData(CoreApp.deviceIdField, undefined);
361
+ this.storage.setData(CoreApp.devicePassphraseField, undefined);
362
+ this.storage.setData(CoreApp.headerTokenField, undefined);
379
363
  }
380
364
  /**
381
365
  * Clear cached token
382
366
  */
383
367
  clearCacheToken() {
384
368
  this.cachedRefreshToken = undefined;
385
- this.storage.setData(this.headerTokenField, undefined);
369
+ this.storage.setData(CoreApp.headerTokenField, undefined);
386
370
  }
387
371
  /**
388
372
  * Decrypt message
@@ -630,7 +614,7 @@ export class CoreApp {
630
614
  // Temp refresh token
631
615
  if (this.cachedRefreshToken)
632
616
  return this.cachedRefreshToken;
633
- return this.storage.getData(this.headerTokenField);
617
+ return this.storage.getData(CoreApp.headerTokenField);
634
618
  }
635
619
  /**
636
620
  * Get all regions
@@ -648,7 +632,7 @@ export class CoreApp {
648
632
  */
649
633
  getResponseToken(rawResponse) {
650
634
  const response = this.api.transformResponse(rawResponse);
651
- return this.api.getHeaderValue(response.headers, this.headerTokenField);
635
+ return this.api.getHeaderValue(response.headers, CoreApp.headerTokenField);
652
636
  }
653
637
  /**
654
638
  * Get time zone
@@ -848,7 +832,7 @@ export class CoreApp {
848
832
  userLogin(user, refreshToken, keep) {
849
833
  this.userData = user;
850
834
  // Cache the encrypted serverside device id
851
- this.storage.setData(this.serversideDeviceIdField, user.deviceId);
835
+ this.storage.setData(CoreApp.serversideDeviceIdField, user.deviceId);
852
836
  if (keep) {
853
837
  this.authorize(user.token, refreshToken);
854
838
  }
@@ -885,3 +869,21 @@ export class CoreApp {
885
869
  });
886
870
  }
887
871
  }
872
+ (function (CoreApp) {
873
+ /**
874
+ * Response token header field name
875
+ */
876
+ CoreApp.headerTokenField = 'SmartERPRefreshToken';
877
+ /**
878
+ * Serverside device id encrypted field name
879
+ */
880
+ CoreApp.serversideDeviceIdField = 'SmartERPServersideDeviceId';
881
+ /**
882
+ * Device id field name
883
+ */
884
+ CoreApp.deviceIdField = 'SmartERPDeviceId';
885
+ /**
886
+ * Device passphrase field name
887
+ */
888
+ CoreApp.devicePassphraseField = 'SmartERPDevicePassphrase';
889
+ })(CoreApp || (CoreApp = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.1.92",
3
+ "version": "1.1.96",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "@etsoo/notificationbase": "^1.0.95",
56
56
  "@etsoo/restclient": "^1.0.63",
57
- "@etsoo/shared": "^1.0.83",
57
+ "@etsoo/shared": "^1.0.88",
58
58
  "@types/crypto-js": "^4.0.2",
59
59
  "crypto-js": "^4.1.1"
60
60
  },
@@ -551,16 +551,6 @@ export abstract class CoreApp<
551
551
  this._userData = value;
552
552
  }
553
553
 
554
- /**
555
- * Response token header field name
556
- */
557
- readonly headerTokenField = 'SmartERPRefreshToken';
558
-
559
- /**
560
- * Serverside device id encrypted field name
561
- */
562
- protected readonly serversideDeviceIdField = 'SmartERPServersideDeviceId';
563
-
564
554
  // IP detect ready callbacks
565
555
  private ipDetectCallbacks?: IDetectIPCallback[];
566
556
 
@@ -593,16 +583,6 @@ export abstract class CoreApp<
593
583
  */
594
584
  protected refreshCountdownSeed = 0;
595
585
 
596
- /**
597
- * Device id field name
598
- */
599
- protected readonly deviceIdField: string = 'SmartERPDeviceId';
600
-
601
- /**
602
- * Device passphrase field name
603
- */
604
- private readonly devicePassphraseField: string = 'SmartERPDevicePassphrase';
605
-
606
586
  /**
607
587
  * Init call Api URL
608
588
  */
@@ -637,7 +617,7 @@ export abstract class CoreApp<
637
617
  this.name = name;
638
618
 
639
619
  // Device id
640
- this._deviceId = storage.getData<string>(this.deviceIdField) ?? '';
620
+ this._deviceId = storage.getData<string>(CoreApp.deviceIdField) ?? '';
641
621
 
642
622
  this.setApi(api);
643
623
 
@@ -701,7 +681,7 @@ export abstract class CoreApp<
701
681
  // Passphrase exists?
702
682
  // Same session should avoid multiple init calls
703
683
  const passphraseEncrypted = this.storage.getData<string>(
704
- this.devicePassphraseField
684
+ CoreApp.devicePassphraseField
705
685
  );
706
686
  if (passphraseEncrypted) {
707
687
  const passphraseDecrypted = this.decrypt(
@@ -717,7 +697,7 @@ export abstract class CoreApp<
717
697
 
718
698
  // Serverside encrypted device id
719
699
  const identifier = this.storage.getData<string>(
720
- this.serversideDeviceIdField
700
+ CoreApp.serversideDeviceIdField
721
701
  );
722
702
 
723
703
  // Timestamp
@@ -762,7 +742,7 @@ export abstract class CoreApp<
762
742
  if (callback) callback(false);
763
743
 
764
744
  // Clear device id
765
- this.storage.setData(this.deviceIdField, undefined);
745
+ this.storage.setData(CoreApp.deviceIdField, undefined);
766
746
 
767
747
  return;
768
748
  }
@@ -788,12 +768,12 @@ export abstract class CoreApp<
788
768
 
789
769
  // Update device id and cache it
790
770
  this._deviceId = data.deviceId;
791
- this.storage.setData(this.deviceIdField, this.deviceId);
771
+ this.storage.setData(CoreApp.deviceIdField, this.deviceId);
792
772
 
793
773
  // Current passphrase
794
774
  this.passphrase = passphrase;
795
775
  this.storage.setData(
796
- this.devicePassphraseField,
776
+ CoreApp.devicePassphraseField,
797
777
  this.encrypt(passphrase, this.name)
798
778
  );
799
779
 
@@ -839,7 +819,7 @@ export abstract class CoreApp<
839
819
  * @returns Fields
840
820
  */
841
821
  protected initCallEncryptedUpdateFields(): string[] {
842
- return [this.headerTokenField];
822
+ return [CoreApp.headerTokenField];
843
823
  }
844
824
 
845
825
  /**
@@ -866,7 +846,7 @@ export abstract class CoreApp<
866
846
  // Cover the current value
867
847
  if (refreshToken !== '') {
868
848
  if (refreshToken != null) refreshToken = this.encrypt(refreshToken);
869
- this.storage.setData(this.headerTokenField, refreshToken);
849
+ this.storage.setData(CoreApp.headerTokenField, refreshToken);
870
850
  }
871
851
 
872
852
  // Reset tryLogin state
@@ -904,7 +884,7 @@ export abstract class CoreApp<
904
884
  return;
905
885
 
906
886
  // Save the id to local storage
907
- DomUtils.saveCountry(regionId);
887
+ this.storage.setData(DomUtils.CountryField, regionId);
908
888
 
909
889
  // Set the currency and culture
910
890
  this._currency = regionItem.currency;
@@ -926,7 +906,7 @@ export abstract class CoreApp<
926
906
  if (this._culture === name) return;
927
907
 
928
908
  // Save the cultrue to local storage
929
- DomUtils.saveCulture(name);
909
+ this.storage.setData(DomUtils.CultureField, name);
930
910
 
931
911
  // Change the API's Content-Language header
932
912
  // .net 5 API, UseRequestLocalization, RequestCultureProviders, ContentLanguageHeaderRequestCultureProvider
@@ -953,12 +933,12 @@ export abstract class CoreApp<
953
933
  * Clear cache data
954
934
  */
955
935
  clearCacheData() {
956
- this.storage.setData(this.serversideDeviceIdField, undefined);
936
+ this.storage.setData(CoreApp.serversideDeviceIdField, undefined);
957
937
 
958
- this.storage.setData(this.deviceIdField, undefined);
959
- this.storage.setData(this.devicePassphraseField, undefined);
938
+ this.storage.setData(CoreApp.deviceIdField, undefined);
939
+ this.storage.setData(CoreApp.devicePassphraseField, undefined);
960
940
 
961
- this.storage.setData(this.headerTokenField, undefined);
941
+ this.storage.setData(CoreApp.headerTokenField, undefined);
962
942
  }
963
943
 
964
944
  /**
@@ -966,7 +946,7 @@ export abstract class CoreApp<
966
946
  */
967
947
  clearCacheToken() {
968
948
  this.cachedRefreshToken = undefined;
969
- this.storage.setData(this.headerTokenField, undefined);
949
+ this.storage.setData(CoreApp.headerTokenField, undefined);
970
950
  }
971
951
 
972
952
  /**
@@ -1272,7 +1252,7 @@ export abstract class CoreApp<
1272
1252
  getCacheToken(): string | undefined {
1273
1253
  // Temp refresh token
1274
1254
  if (this.cachedRefreshToken) return this.cachedRefreshToken;
1275
- return this.storage.getData<string>(this.headerTokenField);
1255
+ return this.storage.getData<string>(CoreApp.headerTokenField);
1276
1256
  }
1277
1257
 
1278
1258
  /**
@@ -1292,7 +1272,10 @@ export abstract class CoreApp<
1292
1272
  */
1293
1273
  getResponseToken(rawResponse: any): string | null {
1294
1274
  const response = this.api.transformResponse(rawResponse);
1295
- return this.api.getHeaderValue(response.headers, this.headerTokenField);
1275
+ return this.api.getHeaderValue(
1276
+ response.headers,
1277
+ CoreApp.headerTokenField
1278
+ );
1296
1279
  }
1297
1280
 
1298
1281
  /**
@@ -1521,7 +1504,7 @@ export abstract class CoreApp<
1521
1504
  this.userData = user;
1522
1505
 
1523
1506
  // Cache the encrypted serverside device id
1524
- this.storage.setData(this.serversideDeviceIdField, user.deviceId);
1507
+ this.storage.setData(CoreApp.serversideDeviceIdField, user.deviceId);
1525
1508
 
1526
1509
  if (keep) {
1527
1510
  this.authorize(user.token, refreshToken);
@@ -1568,3 +1551,25 @@ export abstract class CoreApp<
1568
1551
  );
1569
1552
  }
1570
1553
  }
1554
+
1555
+ export namespace CoreApp {
1556
+ /**
1557
+ * Response token header field name
1558
+ */
1559
+ export const headerTokenField = 'SmartERPRefreshToken';
1560
+
1561
+ /**
1562
+ * Serverside device id encrypted field name
1563
+ */
1564
+ export const serversideDeviceIdField = 'SmartERPServersideDeviceId';
1565
+
1566
+ /**
1567
+ * Device id field name
1568
+ */
1569
+ export const deviceIdField = 'SmartERPDeviceId';
1570
+
1571
+ /**
1572
+ * Device passphrase field name
1573
+ */
1574
+ export const devicePassphraseField = 'SmartERPDevicePassphrase';
1575
+ }