@etsoo/appscript 1.2.8 → 1.2.12

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.
@@ -140,32 +140,31 @@ class CoreApp {
140
140
  restore() {
141
141
  // Devices
142
142
  const devices = this.storage.getPersistedData(CoreApp.devicesField, []);
143
- // Current device id, '' means new, or reload (not included) or duplicate (included)
144
143
  if (this.deviceId === '') {
145
- // First vist, restore
146
- this.storage.copyFrom(this.persistedFields, true);
144
+ // First vist, restore and keep the source
145
+ this.storage.copyFrom(this.persistedFields, false);
147
146
  // Reset device id
148
147
  this._deviceId = this.storage.getData(CoreApp.deviceIdField, '');
149
- }
150
- else {
151
- const d = this.getDeviceId();
152
- if (devices.includes(d)) {
153
- // Duplicate tab, session data copied
154
- // Remove the token, deviceId, and passphrase
155
- this.resetKeys();
148
+ // Totally new, no data restored
149
+ if (this._deviceId === '')
156
150
  return false;
157
- }
151
+ }
152
+ // Device exists or not
153
+ const d = this.getDeviceId();
154
+ if (devices.includes(d)) {
155
+ // Duplicate tab, session data copied
156
+ // Remove the token, deviceId, and passphrase
157
+ this.resetKeys();
158
+ return false;
158
159
  }
159
160
  const passphraseEncrypted = this.storage.getData(CoreApp.devicePassphraseField);
160
161
  if (passphraseEncrypted) {
161
162
  const passphraseDecrypted = this.decrypt(passphraseEncrypted, this.name);
162
163
  if (passphraseDecrypted != null) {
164
+ // Add the device to the list
165
+ devices.push(d);
166
+ this.storage.setPersistedData(CoreApp.devicesField, devices);
163
167
  this.passphrase = passphraseDecrypted;
164
- const d = this.getDeviceId();
165
- if (!devices.includes(d)) {
166
- devices.push(d);
167
- this.storage.setPersistedData(CoreApp.devicesField, devices);
168
- }
169
168
  return true;
170
169
  }
171
170
  // Failed, reset keys
@@ -182,6 +181,7 @@ class CoreApp {
182
181
  if (devices != null) {
183
182
  const index = devices.indexOf(this.getDeviceId());
184
183
  if (index !== -1) {
184
+ // Remove current device from the list
185
185
  devices.splice(index, 1);
186
186
  this.storage.setPersistedData(CoreApp.devicesField, devices);
187
187
  }
@@ -21,6 +21,7 @@
21
21
  "expiry": "Expiry",
22
22
  "failed": "Operation failed",
23
23
  "id": "Number#",
24
+ "itemExists": "'{0}' already exists",
24
25
  "loading": "Loading...",
25
26
  "login": "Login",
26
27
  "menuHome": "Home",
@@ -37,6 +38,7 @@
37
38
  "ok": "OK",
38
39
  "open": "Open",
39
40
  "openMenu": "Open menu",
41
+ "operationSucceeded": "Operation succeeded",
40
42
  "pageNotFound": "Page Not Found",
41
43
  "prompt": "Input",
42
44
  "pullToRefresh": "Pull down to refresh",
@@ -46,6 +48,7 @@
46
48
  "reloginTip": "Please enter your password, resubmit the data after successful login",
47
49
  "remove": "Remove",
48
50
  "renew": "Renew",
51
+ "reports": "Reports",
49
52
  "resending": "Resending",
50
53
  "reset": "Reset",
51
54
  "rotateLeft": "Rotate left 90°",
@@ -54,6 +57,7 @@
54
57
  "scrollToTop": "Scroll to top",
55
58
  "send": "Send",
56
59
  "setAsDefault": "Set as default",
60
+ "settings": "Settings",
57
61
  "signout": "Sign out",
58
62
  "smartERP": "SmartERP",
59
63
  "status": "Status",
@@ -21,6 +21,7 @@
21
21
  "expiry": "到期时间",
22
22
  "failed": "操作失败",
23
23
  "id": "编号",
24
+ "itemExists": "'{0}'已经存在",
24
25
  "loading": "正在加载...",
25
26
  "login": "登录",
26
27
  "menuHome": "首页",
@@ -37,6 +38,7 @@
37
38
  "ok": "确定",
38
39
  "open": "打开",
39
40
  "openMenu": "打开菜单",
41
+ "operationSucceeded": "操作成功",
40
42
  "pageNotFound": "找不到页面",
41
43
  "prompt": "输入",
42
44
  "pullToRefresh": "下拉刷新",
@@ -46,6 +48,7 @@
46
48
  "reloginTip": "请输入您的登录密码,登录成功后请重新提交数据",
47
49
  "remove": "移除",
48
50
  "renew": "续费",
51
+ "reports": "统计报表",
49
52
  "resending": "重新发送",
50
53
  "reset": "重置",
51
54
  "rotateLeft": "左旋转90°",
@@ -54,6 +57,7 @@
54
57
  "scrollToTop": "回到顶部",
55
58
  "send": "发送",
56
59
  "setAsDefault": "设为默认",
60
+ "settings": "系统设置",
57
61
  "signout": "退出",
58
62
  "smartERP": "司友云ERP",
59
63
  "status": "状态",
@@ -21,6 +21,7 @@
21
21
  "expiry": "到期時間",
22
22
  "failed": "操作失敗",
23
23
  "id": "編號",
24
+ "itemExists": "'{0}'已经存在",
24
25
  "loading": "正在加載...",
25
26
  "login": "登錄",
26
27
  "menuHome": "首頁",
@@ -37,6 +38,7 @@
37
38
  "ok": "確定",
38
39
  "open": "打開",
39
40
  "openMenu": "打開菜單",
41
+ "operationSucceeded": "操作成功",
40
42
  "pageNotFound": "找不到頁面",
41
43
  "prompt": "輸入",
42
44
  "pullToRefresh": "下拉刷新",
@@ -46,6 +48,7 @@
46
48
  "reloginTip": "請輸入您的登錄密碼,登錄成功後請重新提交數據",
47
49
  "remove": "移除",
48
50
  "renew": "續費",
51
+ "reports": "統計報表",
49
52
  "resending": "重新發送",
50
53
  "reset": "重置",
51
54
  "rotateLeft": "左旋轉90°",
@@ -54,6 +57,7 @@
54
57
  "scrollToTop": "回到頂部",
55
58
  "send": "發送",
56
59
  "setAsDefault": "設為默認",
60
+ "settings": "系統設置",
57
61
  "signout": "退出",
58
62
  "smartERP": "司友雲ERP",
59
63
  "status": "狀態",
@@ -137,32 +137,31 @@ export class CoreApp {
137
137
  restore() {
138
138
  // Devices
139
139
  const devices = this.storage.getPersistedData(CoreApp.devicesField, []);
140
- // Current device id, '' means new, or reload (not included) or duplicate (included)
141
140
  if (this.deviceId === '') {
142
- // First vist, restore
143
- this.storage.copyFrom(this.persistedFields, true);
141
+ // First vist, restore and keep the source
142
+ this.storage.copyFrom(this.persistedFields, false);
144
143
  // Reset device id
145
144
  this._deviceId = this.storage.getData(CoreApp.deviceIdField, '');
146
- }
147
- else {
148
- const d = this.getDeviceId();
149
- if (devices.includes(d)) {
150
- // Duplicate tab, session data copied
151
- // Remove the token, deviceId, and passphrase
152
- this.resetKeys();
145
+ // Totally new, no data restored
146
+ if (this._deviceId === '')
153
147
  return false;
154
- }
148
+ }
149
+ // Device exists or not
150
+ const d = this.getDeviceId();
151
+ if (devices.includes(d)) {
152
+ // Duplicate tab, session data copied
153
+ // Remove the token, deviceId, and passphrase
154
+ this.resetKeys();
155
+ return false;
155
156
  }
156
157
  const passphraseEncrypted = this.storage.getData(CoreApp.devicePassphraseField);
157
158
  if (passphraseEncrypted) {
158
159
  const passphraseDecrypted = this.decrypt(passphraseEncrypted, this.name);
159
160
  if (passphraseDecrypted != null) {
161
+ // Add the device to the list
162
+ devices.push(d);
163
+ this.storage.setPersistedData(CoreApp.devicesField, devices);
160
164
  this.passphrase = passphraseDecrypted;
161
- const d = this.getDeviceId();
162
- if (!devices.includes(d)) {
163
- devices.push(d);
164
- this.storage.setPersistedData(CoreApp.devicesField, devices);
165
- }
166
165
  return true;
167
166
  }
168
167
  // Failed, reset keys
@@ -179,6 +178,7 @@ export class CoreApp {
179
178
  if (devices != null) {
180
179
  const index = devices.indexOf(this.getDeviceId());
181
180
  if (index !== -1) {
181
+ // Remove current device from the list
182
182
  devices.splice(index, 1);
183
183
  this.storage.setPersistedData(CoreApp.devicesField, devices);
184
184
  }
@@ -21,6 +21,7 @@
21
21
  "expiry": "Expiry",
22
22
  "failed": "Operation failed",
23
23
  "id": "Number#",
24
+ "itemExists": "'{0}' already exists",
24
25
  "loading": "Loading...",
25
26
  "login": "Login",
26
27
  "menuHome": "Home",
@@ -37,6 +38,7 @@
37
38
  "ok": "OK",
38
39
  "open": "Open",
39
40
  "openMenu": "Open menu",
41
+ "operationSucceeded": "Operation succeeded",
40
42
  "pageNotFound": "Page Not Found",
41
43
  "prompt": "Input",
42
44
  "pullToRefresh": "Pull down to refresh",
@@ -46,6 +48,7 @@
46
48
  "reloginTip": "Please enter your password, resubmit the data after successful login",
47
49
  "remove": "Remove",
48
50
  "renew": "Renew",
51
+ "reports": "Reports",
49
52
  "resending": "Resending",
50
53
  "reset": "Reset",
51
54
  "rotateLeft": "Rotate left 90°",
@@ -54,6 +57,7 @@
54
57
  "scrollToTop": "Scroll to top",
55
58
  "send": "Send",
56
59
  "setAsDefault": "Set as default",
60
+ "settings": "Settings",
57
61
  "signout": "Sign out",
58
62
  "smartERP": "SmartERP",
59
63
  "status": "Status",
@@ -21,6 +21,7 @@
21
21
  "expiry": "到期时间",
22
22
  "failed": "操作失败",
23
23
  "id": "编号",
24
+ "itemExists": "'{0}'已经存在",
24
25
  "loading": "正在加载...",
25
26
  "login": "登录",
26
27
  "menuHome": "首页",
@@ -37,6 +38,7 @@
37
38
  "ok": "确定",
38
39
  "open": "打开",
39
40
  "openMenu": "打开菜单",
41
+ "operationSucceeded": "操作成功",
40
42
  "pageNotFound": "找不到页面",
41
43
  "prompt": "输入",
42
44
  "pullToRefresh": "下拉刷新",
@@ -46,6 +48,7 @@
46
48
  "reloginTip": "请输入您的登录密码,登录成功后请重新提交数据",
47
49
  "remove": "移除",
48
50
  "renew": "续费",
51
+ "reports": "统计报表",
49
52
  "resending": "重新发送",
50
53
  "reset": "重置",
51
54
  "rotateLeft": "左旋转90°",
@@ -54,6 +57,7 @@
54
57
  "scrollToTop": "回到顶部",
55
58
  "send": "发送",
56
59
  "setAsDefault": "设为默认",
60
+ "settings": "系统设置",
57
61
  "signout": "退出",
58
62
  "smartERP": "司友云ERP",
59
63
  "status": "状态",
@@ -21,6 +21,7 @@
21
21
  "expiry": "到期時間",
22
22
  "failed": "操作失敗",
23
23
  "id": "編號",
24
+ "itemExists": "'{0}'已经存在",
24
25
  "loading": "正在加載...",
25
26
  "login": "登錄",
26
27
  "menuHome": "首頁",
@@ -37,6 +38,7 @@
37
38
  "ok": "確定",
38
39
  "open": "打開",
39
40
  "openMenu": "打開菜單",
41
+ "operationSucceeded": "操作成功",
40
42
  "pageNotFound": "找不到頁面",
41
43
  "prompt": "輸入",
42
44
  "pullToRefresh": "下拉刷新",
@@ -46,6 +48,7 @@
46
48
  "reloginTip": "請輸入您的登錄密碼,登錄成功後請重新提交數據",
47
49
  "remove": "移除",
48
50
  "renew": "續費",
51
+ "reports": "統計報表",
49
52
  "resending": "重新發送",
50
53
  "reset": "重置",
51
54
  "rotateLeft": "左旋轉90°",
@@ -54,6 +57,7 @@
54
57
  "scrollToTop": "回到頂部",
55
58
  "send": "發送",
56
59
  "setAsDefault": "設為默認",
60
+ "settings": "系統設置",
57
61
  "signout": "退出",
58
62
  "smartERP": "司友雲ERP",
59
63
  "status": "狀態",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.2.8",
3
+ "version": "1.2.12",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -52,21 +52,21 @@
52
52
  },
53
53
  "homepage": "https://github.com/ETSOO/AppScript#readme",
54
54
  "dependencies": {
55
- "@etsoo/notificationbase": "^1.0.95",
56
- "@etsoo/restclient": "^1.0.63",
57
- "@etsoo/shared": "^1.0.94",
58
- "@types/crypto-js": "^4.0.2",
55
+ "@etsoo/notificationbase": "^1.0.96",
56
+ "@etsoo/restclient": "^1.0.64",
57
+ "@etsoo/shared": "^1.0.97",
58
+ "@types/crypto-js": "^4.1.0",
59
59
  "crypto-js": "^4.1.1"
60
60
  },
61
61
  "devDependencies": {
62
- "@babel/cli": "^7.16.0",
63
- "@babel/core": "^7.16.5",
64
- "@babel/plugin-transform-runtime": "^7.16.5",
65
- "@babel/preset-env": "^7.16.5",
66
- "@babel/runtime-corejs3": "^7.16.5",
67
- "@types/jest": "^27.0.3",
68
- "@typescript-eslint/eslint-plugin": "^5.8.0",
69
- "@typescript-eslint/parser": "^5.8.0",
62
+ "@babel/cli": "^7.16.7",
63
+ "@babel/core": "^7.16.7",
64
+ "@babel/plugin-transform-runtime": "^7.16.7",
65
+ "@babel/preset-env": "^7.16.7",
66
+ "@babel/runtime-corejs3": "^7.16.7",
67
+ "@types/jest": "^27.4.0",
68
+ "@typescript-eslint/eslint-plugin": "^5.8.1",
69
+ "@typescript-eslint/parser": "^5.8.1",
70
70
  "eslint": "^8.5.0",
71
71
  "eslint-config-airbnb-base": "^15.0.0",
72
72
  "eslint-plugin-import": "^2.25.3",
@@ -676,22 +676,24 @@ export abstract class CoreApp<
676
676
  []
677
677
  );
678
678
 
679
- // Current device id, '' means new, or reload (not included) or duplicate (included)
680
679
  if (this.deviceId === '') {
681
- // First vist, restore
682
- this.storage.copyFrom(this.persistedFields, true);
680
+ // First vist, restore and keep the source
681
+ this.storage.copyFrom(this.persistedFields, false);
683
682
 
684
683
  // Reset device id
685
684
  this._deviceId = this.storage.getData(CoreApp.deviceIdField, '');
686
- } else {
687
- const d = this.getDeviceId();
688
685
 
689
- if (devices.includes(d)) {
690
- // Duplicate tab, session data copied
691
- // Remove the token, deviceId, and passphrase
692
- this.resetKeys();
693
- return false;
694
- }
686
+ // Totally new, no data restored
687
+ if (this._deviceId === '') return false;
688
+ }
689
+
690
+ // Device exists or not
691
+ const d = this.getDeviceId();
692
+ if (devices.includes(d)) {
693
+ // Duplicate tab, session data copied
694
+ // Remove the token, deviceId, and passphrase
695
+ this.resetKeys();
696
+ return false;
695
697
  }
696
698
 
697
699
  const passphraseEncrypted = this.storage.getData<string>(
@@ -703,16 +705,11 @@ export abstract class CoreApp<
703
705
  this.name
704
706
  );
705
707
  if (passphraseDecrypted != null) {
706
- this.passphrase = passphraseDecrypted;
708
+ // Add the device to the list
709
+ devices.push(d);
710
+ this.storage.setPersistedData(CoreApp.devicesField, devices);
707
711
 
708
- const d = this.getDeviceId();
709
- if (!devices.includes(d)) {
710
- devices.push(d);
711
- this.storage.setPersistedData(
712
- CoreApp.devicesField,
713
- devices
714
- );
715
- }
712
+ this.passphrase = passphraseDecrypted;
716
713
 
717
714
  return true;
718
715
  }
@@ -735,6 +732,7 @@ export abstract class CoreApp<
735
732
  if (devices != null) {
736
733
  const index = devices.indexOf(this.getDeviceId());
737
734
  if (index !== -1) {
735
+ // Remove current device from the list
738
736
  devices.splice(index, 1);
739
737
  this.storage.setPersistedData(CoreApp.devicesField, devices);
740
738
  }
@@ -21,6 +21,7 @@
21
21
  "expiry": "Expiry",
22
22
  "failed": "Operation failed",
23
23
  "id": "Number#",
24
+ "itemExists": "'{0}' already exists",
24
25
  "loading": "Loading...",
25
26
  "login": "Login",
26
27
  "menuHome": "Home",
@@ -37,6 +38,7 @@
37
38
  "ok": "OK",
38
39
  "open": "Open",
39
40
  "openMenu": "Open menu",
41
+ "operationSucceeded": "Operation succeeded",
40
42
  "pageNotFound": "Page Not Found",
41
43
  "prompt": "Input",
42
44
  "pullToRefresh": "Pull down to refresh",
@@ -46,6 +48,7 @@
46
48
  "reloginTip": "Please enter your password, resubmit the data after successful login",
47
49
  "remove": "Remove",
48
50
  "renew": "Renew",
51
+ "reports": "Reports",
49
52
  "resending": "Resending",
50
53
  "reset": "Reset",
51
54
  "rotateLeft": "Rotate left 90°",
@@ -54,6 +57,7 @@
54
57
  "scrollToTop": "Scroll to top",
55
58
  "send": "Send",
56
59
  "setAsDefault": "Set as default",
60
+ "settings": "Settings",
57
61
  "signout": "Sign out",
58
62
  "smartERP": "SmartERP",
59
63
  "status": "Status",
@@ -21,6 +21,7 @@
21
21
  "expiry": "到期时间",
22
22
  "failed": "操作失败",
23
23
  "id": "编号",
24
+ "itemExists": "'{0}'已经存在",
24
25
  "loading": "正在加载...",
25
26
  "login": "登录",
26
27
  "menuHome": "首页",
@@ -37,6 +38,7 @@
37
38
  "ok": "确定",
38
39
  "open": "打开",
39
40
  "openMenu": "打开菜单",
41
+ "operationSucceeded": "操作成功",
40
42
  "pageNotFound": "找不到页面",
41
43
  "prompt": "输入",
42
44
  "pullToRefresh": "下拉刷新",
@@ -46,6 +48,7 @@
46
48
  "reloginTip": "请输入您的登录密码,登录成功后请重新提交数据",
47
49
  "remove": "移除",
48
50
  "renew": "续费",
51
+ "reports": "统计报表",
49
52
  "resending": "重新发送",
50
53
  "reset": "重置",
51
54
  "rotateLeft": "左旋转90°",
@@ -54,6 +57,7 @@
54
57
  "scrollToTop": "回到顶部",
55
58
  "send": "发送",
56
59
  "setAsDefault": "设为默认",
60
+ "settings": "系统设置",
57
61
  "signout": "退出",
58
62
  "smartERP": "司友云ERP",
59
63
  "status": "状态",
@@ -21,6 +21,7 @@
21
21
  "expiry": "到期時間",
22
22
  "failed": "操作失敗",
23
23
  "id": "編號",
24
+ "itemExists": "'{0}'已经存在",
24
25
  "loading": "正在加載...",
25
26
  "login": "登錄",
26
27
  "menuHome": "首頁",
@@ -37,6 +38,7 @@
37
38
  "ok": "確定",
38
39
  "open": "打開",
39
40
  "openMenu": "打開菜單",
41
+ "operationSucceeded": "操作成功",
40
42
  "pageNotFound": "找不到頁面",
41
43
  "prompt": "輸入",
42
44
  "pullToRefresh": "下拉刷新",
@@ -46,6 +48,7 @@
46
48
  "reloginTip": "請輸入您的登錄密碼,登錄成功後請重新提交數據",
47
49
  "remove": "移除",
48
50
  "renew": "續費",
51
+ "reports": "統計報表",
49
52
  "resending": "重新發送",
50
53
  "reset": "重置",
51
54
  "rotateLeft": "左旋轉90°",
@@ -54,6 +57,7 @@
54
57
  "scrollToTop": "回到頂部",
55
58
  "send": "發送",
56
59
  "setAsDefault": "設為默認",
60
+ "settings": "系統設置",
57
61
  "signout": "退出",
58
62
  "smartERP": "司友雲ERP",
59
63
  "status": "狀態",