@etsoo/appscript 1.1.45 → 1.1.49

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.
@@ -22,10 +22,6 @@ export interface IAppSettings extends IExternalSettings {
22
22
  * Detected culture
23
23
  */
24
24
  readonly detectedCulture: string;
25
- /**
26
- * Service id
27
- */
28
- readonly serviceId?: string;
29
25
  /**
30
26
  * Time zone
31
27
  */
@@ -182,7 +182,7 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
182
182
  * @param refreshToken Refresh token
183
183
  * @param keep Keep in local storage or not
184
184
  */
185
- userLogin(user: IUserData, refreshToken?: string, keep?: boolean): void;
185
+ userLogin(user: IUserData, refreshToken: string, keep?: boolean): void;
186
186
  /**
187
187
  * User logout
188
188
  * @param clearToken Clear refresh token or not
@@ -415,7 +415,7 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
415
415
  * @param refreshToken Refresh token
416
416
  * @param keep Keep in local storage or not
417
417
  */
418
- userLogin(user: IUserData, refreshToken?: string, keep?: boolean): void;
418
+ userLogin(user: IUserData, refreshToken: string, keep?: boolean): void;
419
419
  /**
420
420
  * User logout
421
421
  * @param clearToken Clear refresh token or not
@@ -24,12 +24,11 @@ export interface IExternalSettings {
24
24
  readonly coreApi?: string;
25
25
  }
26
26
  /**
27
- * External settings host
28
- * Usually passed by window global settings property
27
+ * External settings namespace
29
28
  */
30
- export interface IExternalSettingsHost {
29
+ export declare namespace ExternalSettings {
31
30
  /**
32
- * Configurable API settings
31
+ * Create instance
33
32
  */
34
- readonly settings: IExternalSettings;
33
+ function Create(): IExternalSettings | undefined;
35
34
  }
@@ -1,2 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExternalSettings = void 0;
4
+ /**
5
+ * External settings namespace
6
+ */
7
+ var ExternalSettings;
8
+ (function (ExternalSettings) {
9
+ /**
10
+ * Create instance
11
+ */
12
+ function Create() {
13
+ if ('settings' in globalThis) {
14
+ const settings = Reflect.get(globalThis, 'settings');
15
+ if (typeof settings === 'object') {
16
+ if (typeof window !== 'undefined') {
17
+ const hostname = window.location.hostname;
18
+ // replace {hostname}
19
+ for (const key in settings) {
20
+ const value = settings[key];
21
+ if (typeof value === 'string') {
22
+ settings[key] = value.replace('{hostname}', hostname);
23
+ }
24
+ }
25
+ }
26
+ return settings;
27
+ }
28
+ }
29
+ return undefined;
30
+ }
31
+ ExternalSettings.Create = Create;
32
+ })(ExternalSettings = exports.ExternalSettings || (exports.ExternalSettings = {}));
@@ -31,6 +31,7 @@
31
31
  "name": "Name",
32
32
  "no": "No",
33
33
  "noChanges": "No changes yet",
34
+ "noData": "No valid data",
34
35
  "noOptions": "No options",
35
36
  "ok": "OK",
36
37
  "open": "Open",
@@ -31,6 +31,7 @@
31
31
  "name": "姓名",
32
32
  "no": "否",
33
33
  "noChanges": "还没有任何修改",
34
+ "noData": "没有有效数据",
34
35
  "noOptions": "没有选项",
35
36
  "ok": "确定",
36
37
  "open": "打开",
@@ -31,6 +31,7 @@
31
31
  "name": "姓名",
32
32
  "no": "否",
33
33
  "noChanges": "還沒有任何修改",
34
+ "noData": "沒有有效數據",
34
35
  "noOptions": "沒有選項",
35
36
  "ok": "確定",
36
37
  "open": "打開",
@@ -22,10 +22,6 @@ export interface IAppSettings extends IExternalSettings {
22
22
  * Detected culture
23
23
  */
24
24
  readonly detectedCulture: string;
25
- /**
26
- * Service id
27
- */
28
- readonly serviceId?: string;
29
25
  /**
30
26
  * Time zone
31
27
  */
@@ -182,7 +182,7 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
182
182
  * @param refreshToken Refresh token
183
183
  * @param keep Keep in local storage or not
184
184
  */
185
- userLogin(user: IUserData, refreshToken?: string, keep?: boolean): void;
185
+ userLogin(user: IUserData, refreshToken: string, keep?: boolean): void;
186
186
  /**
187
187
  * User logout
188
188
  * @param clearToken Clear refresh token or not
@@ -415,7 +415,7 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
415
415
  * @param refreshToken Refresh token
416
416
  * @param keep Keep in local storage or not
417
417
  */
418
- userLogin(user: IUserData, refreshToken?: string, keep?: boolean): void;
418
+ userLogin(user: IUserData, refreshToken: string, keep?: boolean): void;
419
419
  /**
420
420
  * User logout
421
421
  * @param clearToken Clear refresh token or not
@@ -24,12 +24,11 @@ export interface IExternalSettings {
24
24
  readonly coreApi?: string;
25
25
  }
26
26
  /**
27
- * External settings host
28
- * Usually passed by window global settings property
27
+ * External settings namespace
29
28
  */
30
- export interface IExternalSettingsHost {
29
+ export declare namespace ExternalSettings {
31
30
  /**
32
- * Configurable API settings
31
+ * Create instance
33
32
  */
34
- readonly settings: IExternalSettings;
33
+ function Create(): IExternalSettings | undefined;
35
34
  }
@@ -1 +1,29 @@
1
- export {};
1
+ /**
2
+ * External settings namespace
3
+ */
4
+ export var ExternalSettings;
5
+ (function (ExternalSettings) {
6
+ /**
7
+ * Create instance
8
+ */
9
+ function Create() {
10
+ if ('settings' in globalThis) {
11
+ const settings = Reflect.get(globalThis, 'settings');
12
+ if (typeof settings === 'object') {
13
+ if (typeof window !== 'undefined') {
14
+ const hostname = window.location.hostname;
15
+ // replace {hostname}
16
+ for (const key in settings) {
17
+ const value = settings[key];
18
+ if (typeof value === 'string') {
19
+ settings[key] = value.replace('{hostname}', hostname);
20
+ }
21
+ }
22
+ }
23
+ return settings;
24
+ }
25
+ }
26
+ return undefined;
27
+ }
28
+ ExternalSettings.Create = Create;
29
+ })(ExternalSettings || (ExternalSettings = {}));
@@ -31,6 +31,7 @@
31
31
  "name": "Name",
32
32
  "no": "No",
33
33
  "noChanges": "No changes yet",
34
+ "noData": "No valid data",
34
35
  "noOptions": "No options",
35
36
  "ok": "OK",
36
37
  "open": "Open",
@@ -31,6 +31,7 @@
31
31
  "name": "姓名",
32
32
  "no": "否",
33
33
  "noChanges": "还没有任何修改",
34
+ "noData": "没有有效数据",
34
35
  "noOptions": "没有选项",
35
36
  "ok": "确定",
36
37
  "open": "打开",
@@ -31,6 +31,7 @@
31
31
  "name": "姓名",
32
32
  "no": "否",
33
33
  "noChanges": "還沒有任何修改",
34
+ "noData": "沒有有效數據",
34
35
  "noOptions": "沒有選項",
35
36
  "ok": "確定",
36
37
  "open": "打開",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.1.45",
3
+ "version": "1.1.49",
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.93",
56
56
  "@etsoo/restclient": "^1.0.62",
57
- "@etsoo/shared": "^1.0.73"
57
+ "@etsoo/shared": "^1.0.75"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@babel/cli": "^7.16.0",
@@ -62,14 +62,14 @@
62
62
  "@babel/plugin-transform-runtime": "^7.16.4",
63
63
  "@babel/preset-env": "^7.16.4",
64
64
  "@babel/runtime-corejs3": "^7.16.3",
65
- "@types/jest": "^27.0.2",
65
+ "@types/jest": "^27.0.3",
66
66
  "@typescript-eslint/eslint-plugin": "^5.4.0",
67
67
  "@typescript-eslint/parser": "^5.4.0",
68
- "eslint": "^8.2.0",
68
+ "eslint": "^8.3.0",
69
69
  "eslint-config-airbnb-base": "^15.0.0",
70
70
  "eslint-plugin-import": "^2.25.3",
71
71
  "jest": "^27.3.1",
72
72
  "ts-jest": "^27.0.7",
73
- "typescript": "^4.4.4"
73
+ "typescript": "^4.5.2"
74
74
  }
75
75
  }
@@ -27,11 +27,6 @@ export interface IAppSettings extends IExternalSettings {
27
27
  */
28
28
  readonly detectedCulture: string;
29
29
 
30
- /**
31
- * Service id
32
- */
33
- readonly serviceId?: string;
34
-
35
30
  /**
36
31
  * Time zone
37
32
  */
@@ -244,7 +244,7 @@ export interface ICoreApp<
244
244
  * @param refreshToken Refresh token
245
245
  * @param keep Keep in local storage or not
246
246
  */
247
- userLogin(user: IUserData, refreshToken?: string, keep?: boolean): void;
247
+ userLogin(user: IUserData, refreshToken: string, keep?: boolean): void;
248
248
 
249
249
  /**
250
250
  * User logout
@@ -829,7 +829,7 @@ export abstract class CoreApp<
829
829
  * @param refreshToken Refresh token
830
830
  * @param keep Keep in local storage or not
831
831
  */
832
- userLogin(user: IUserData, refreshToken?: string, keep: boolean = false) {
832
+ userLogin(user: IUserData, refreshToken: string, keep: boolean = false) {
833
833
  this.userData = user;
834
834
  this.authorize(user.token, refreshToken, keep);
835
835
  }
@@ -29,12 +29,33 @@ export interface IExternalSettings {
29
29
  }
30
30
 
31
31
  /**
32
- * External settings host
33
- * Usually passed by window global settings property
32
+ * External settings namespace
34
33
  */
35
- export interface IExternalSettingsHost {
34
+ export namespace ExternalSettings {
36
35
  /**
37
- * Configurable API settings
36
+ * Create instance
38
37
  */
39
- readonly settings: IExternalSettings;
38
+ export function Create(): IExternalSettings | undefined {
39
+ if ('settings' in globalThis) {
40
+ const settings = Reflect.get(globalThis, 'settings');
41
+ if (typeof settings === 'object') {
42
+ if (typeof window !== 'undefined') {
43
+ const hostname = window.location.hostname;
44
+ // replace {hostname}
45
+ for (const key in settings) {
46
+ const value = settings[key];
47
+ if (typeof value === 'string') {
48
+ settings[key] = value.replace(
49
+ '{hostname}',
50
+ hostname
51
+ );
52
+ }
53
+ }
54
+ }
55
+
56
+ return settings as IExternalSettings;
57
+ }
58
+ }
59
+ return undefined;
60
+ }
40
61
  }
@@ -31,6 +31,7 @@
31
31
  "name": "Name",
32
32
  "no": "No",
33
33
  "noChanges": "No changes yet",
34
+ "noData": "No valid data",
34
35
  "noOptions": "No options",
35
36
  "ok": "OK",
36
37
  "open": "Open",
@@ -31,6 +31,7 @@
31
31
  "name": "姓名",
32
32
  "no": "否",
33
33
  "noChanges": "还没有任何修改",
34
+ "noData": "没有有效数据",
34
35
  "noOptions": "没有选项",
35
36
  "ok": "确定",
36
37
  "open": "打开",
@@ -31,6 +31,7 @@
31
31
  "name": "姓名",
32
32
  "no": "否",
33
33
  "noChanges": "還沒有任何修改",
34
+ "noData": "沒有有效數據",
34
35
  "noOptions": "沒有選項",
35
36
  "ok": "確定",
36
37
  "open": "打開",