@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.
- package/lib/cjs/app/AppSettings.d.ts +0 -4
- package/lib/cjs/app/CoreApp.d.ts +2 -2
- package/lib/cjs/app/ExternalSettings.d.ts +4 -5
- package/lib/cjs/app/ExternalSettings.js +30 -0
- package/lib/cjs/i18n/en-US.json +1 -0
- package/lib/cjs/i18n/zh-CN.json +1 -0
- package/lib/cjs/i18n/zh-HK.json +1 -0
- package/lib/mjs/app/AppSettings.d.ts +0 -4
- package/lib/mjs/app/CoreApp.d.ts +2 -2
- package/lib/mjs/app/ExternalSettings.d.ts +4 -5
- package/lib/mjs/app/ExternalSettings.js +29 -1
- package/lib/mjs/i18n/en-US.json +1 -0
- package/lib/mjs/i18n/zh-CN.json +1 -0
- package/lib/mjs/i18n/zh-HK.json +1 -0
- package/package.json +5 -5
- package/src/app/AppSettings.ts +0 -5
- package/src/app/CoreApp.ts +2 -2
- package/src/app/ExternalSettings.ts +26 -5
- package/src/i18n/en-US.json +1 -0
- package/src/i18n/zh-CN.json +1 -0
- package/src/i18n/zh-HK.json +1 -0
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
28
|
-
* Usually passed by window global settings property
|
|
27
|
+
* External settings namespace
|
|
29
28
|
*/
|
|
30
|
-
export
|
|
29
|
+
export declare namespace ExternalSettings {
|
|
31
30
|
/**
|
|
32
|
-
*
|
|
31
|
+
* Create instance
|
|
33
32
|
*/
|
|
34
|
-
|
|
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 = {}));
|
package/lib/cjs/i18n/en-US.json
CHANGED
package/lib/cjs/i18n/zh-CN.json
CHANGED
package/lib/cjs/i18n/zh-HK.json
CHANGED
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
28
|
-
* Usually passed by window global settings property
|
|
27
|
+
* External settings namespace
|
|
29
28
|
*/
|
|
30
|
-
export
|
|
29
|
+
export declare namespace ExternalSettings {
|
|
31
30
|
/**
|
|
32
|
-
*
|
|
31
|
+
* Create instance
|
|
33
32
|
*/
|
|
34
|
-
|
|
33
|
+
function Create(): IExternalSettings | undefined;
|
|
35
34
|
}
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
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 = {}));
|
package/lib/mjs/i18n/en-US.json
CHANGED
package/lib/mjs/i18n/zh-CN.json
CHANGED
package/lib/mjs/i18n/zh-HK.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/appscript",
|
|
3
|
-
"version": "1.1.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
73
|
+
"typescript": "^4.5.2"
|
|
74
74
|
}
|
|
75
75
|
}
|
package/src/app/AppSettings.ts
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
33
|
-
* Usually passed by window global settings property
|
|
32
|
+
* External settings namespace
|
|
34
33
|
*/
|
|
35
|
-
export
|
|
34
|
+
export namespace ExternalSettings {
|
|
36
35
|
/**
|
|
37
|
-
*
|
|
36
|
+
* Create instance
|
|
38
37
|
*/
|
|
39
|
-
|
|
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
|
}
|
package/src/i18n/en-US.json
CHANGED
package/src/i18n/zh-CN.json
CHANGED