@etsoo/react 1.3.76 → 1.3.80
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/app/ReactApp.d.ts +2 -1
- package/lib/app/ReactApp.js +15 -3
- package/lib/app/ServiceApp.d.ts +2 -1
- package/lib/app/ServiceApp.js +4 -3
- package/package.json +3 -3
- package/src/app/ReactApp.ts +33 -7
- package/src/app/ServiceApp.ts +4 -3
package/lib/app/ReactApp.d.ts
CHANGED
|
@@ -85,8 +85,9 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser, P extends
|
|
|
85
85
|
* Constructor
|
|
86
86
|
* @param settings Settings
|
|
87
87
|
* @param name Application name
|
|
88
|
+
* @param globalFields Global fields
|
|
88
89
|
*/
|
|
89
|
-
constructor(settings: S, name: string);
|
|
90
|
+
constructor(settings: S, name: string, globalFields: string[]);
|
|
90
91
|
/**
|
|
91
92
|
* Change culture
|
|
92
93
|
* @param culture New culture definition
|
package/lib/app/ReactApp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CoreApp, createClient } from '@etsoo/appscript';
|
|
2
|
-
import { WindowStorage } from '@etsoo/shared';
|
|
2
|
+
import { DomUtils, StorageUtils, WindowStorage } from '@etsoo/shared';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { NotifierMU } from '../mu/NotifierMU';
|
|
5
5
|
import { ProgressCount } from '../mu/ProgressCount';
|
|
@@ -54,13 +54,25 @@ export class ReactApp extends CoreApp {
|
|
|
54
54
|
* Constructor
|
|
55
55
|
* @param settings Settings
|
|
56
56
|
* @param name Application name
|
|
57
|
+
* @param globalFields Global fields
|
|
57
58
|
*/
|
|
58
|
-
constructor(settings, name) {
|
|
59
|
+
constructor(settings, name, globalFields) {
|
|
59
60
|
super(settings, ReactApp.createApi(settings), ReactApp.createNotifier(), new WindowStorage([
|
|
61
|
+
...globalFields,
|
|
62
|
+
DomUtils.CountryField,
|
|
63
|
+
DomUtils.CultureField,
|
|
60
64
|
CoreApp.deviceIdField,
|
|
61
65
|
CoreApp.headerTokenField,
|
|
62
66
|
CoreApp.serversideDeviceIdField
|
|
63
|
-
]
|
|
67
|
+
], (field, data, index) => {
|
|
68
|
+
if (index > 0 && field === CoreApp.headerTokenField) {
|
|
69
|
+
// Clear passphrase to regenerate the device id
|
|
70
|
+
StorageUtils.setSessionData(CoreApp.devicePassphraseField, undefined);
|
|
71
|
+
// Clear token
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
return data;
|
|
75
|
+
}), name);
|
|
64
76
|
/**
|
|
65
77
|
* User state
|
|
66
78
|
*/
|
package/lib/app/ServiceApp.d.ts
CHANGED
|
@@ -30,8 +30,9 @@ export declare class ServiceApp<P extends IServicePageData = IServicePageData, U
|
|
|
30
30
|
* Constructor
|
|
31
31
|
* @param settings Settings
|
|
32
32
|
* @param name Application name
|
|
33
|
+
* @param globalFields Global fields
|
|
33
34
|
*/
|
|
34
|
-
constructor(settings: S, name: string);
|
|
35
|
+
constructor(settings: S, name: string, globalFields: string[]);
|
|
35
36
|
/**
|
|
36
37
|
* Go to the login page
|
|
37
38
|
*/
|
package/lib/app/ServiceApp.js
CHANGED
|
@@ -13,9 +13,10 @@ export class ServiceApp extends ReactApp {
|
|
|
13
13
|
* Constructor
|
|
14
14
|
* @param settings Settings
|
|
15
15
|
* @param name Application name
|
|
16
|
+
* @param globalFields Global fields
|
|
16
17
|
*/
|
|
17
|
-
constructor(settings, name) {
|
|
18
|
-
super(settings, name);
|
|
18
|
+
constructor(settings, name, globalFields) {
|
|
19
|
+
super(settings, name, globalFields);
|
|
19
20
|
/**
|
|
20
21
|
* Service passphrase
|
|
21
22
|
*/
|
|
@@ -51,7 +52,7 @@ export class ServiceApp extends ReactApp {
|
|
|
51
52
|
'&serviceDeviceId=' +
|
|
52
53
|
encodeURIComponent(this.deviceId) +
|
|
53
54
|
'&' +
|
|
54
|
-
DomUtils.
|
|
55
|
+
DomUtils.CultureField +
|
|
55
56
|
'=' +
|
|
56
57
|
this.culture;
|
|
57
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.80",
|
|
4
4
|
"description": "TypeScript ReactJs framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"@emotion/react": "^11.7.1",
|
|
51
51
|
"@emotion/style": "^0.8.0",
|
|
52
52
|
"@emotion/styled": "^11.6.0",
|
|
53
|
-
"@etsoo/appscript": "^1.1.
|
|
53
|
+
"@etsoo/appscript": "^1.1.97",
|
|
54
54
|
"@etsoo/notificationbase": "^1.0.95",
|
|
55
|
-
"@etsoo/shared": "^1.0.
|
|
55
|
+
"@etsoo/shared": "^1.0.89",
|
|
56
56
|
"@mui/icons-material": "^5.2.5",
|
|
57
57
|
"@mui/material": "^5.2.5",
|
|
58
58
|
"@reach/router": "^1.3.4",
|
package/src/app/ReactApp.ts
CHANGED
|
@@ -7,7 +7,12 @@ import {
|
|
|
7
7
|
IUserData
|
|
8
8
|
} from '@etsoo/appscript';
|
|
9
9
|
import { NotificationRenderProps } from '@etsoo/notificationbase';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
DataTypes,
|
|
12
|
+
DomUtils,
|
|
13
|
+
StorageUtils,
|
|
14
|
+
WindowStorage
|
|
15
|
+
} from '@etsoo/shared';
|
|
11
16
|
import React from 'react';
|
|
12
17
|
import { NotifierMU } from '../mu/NotifierMU';
|
|
13
18
|
import { ProgressCount } from '../mu/ProgressCount';
|
|
@@ -182,17 +187,38 @@ export class ReactApp<
|
|
|
182
187
|
* Constructor
|
|
183
188
|
* @param settings Settings
|
|
184
189
|
* @param name Application name
|
|
190
|
+
* @param globalFields Global fields
|
|
185
191
|
*/
|
|
186
|
-
constructor(settings: S, name: string) {
|
|
192
|
+
constructor(settings: S, name: string, globalFields: string[]) {
|
|
187
193
|
super(
|
|
188
194
|
settings,
|
|
189
195
|
ReactApp.createApi(settings),
|
|
190
196
|
ReactApp.createNotifier(),
|
|
191
|
-
new WindowStorage(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
197
|
+
new WindowStorage(
|
|
198
|
+
[
|
|
199
|
+
...globalFields,
|
|
200
|
+
|
|
201
|
+
DomUtils.CountryField,
|
|
202
|
+
DomUtils.CultureField,
|
|
203
|
+
|
|
204
|
+
CoreApp.deviceIdField,
|
|
205
|
+
CoreApp.headerTokenField,
|
|
206
|
+
CoreApp.serversideDeviceIdField
|
|
207
|
+
],
|
|
208
|
+
(field, data, index) => {
|
|
209
|
+
if (index > 0 && field === CoreApp.headerTokenField) {
|
|
210
|
+
// Clear passphrase to regenerate the device id
|
|
211
|
+
StorageUtils.setSessionData(
|
|
212
|
+
CoreApp.devicePassphraseField,
|
|
213
|
+
undefined
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
// Clear token
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
return data;
|
|
220
|
+
}
|
|
221
|
+
),
|
|
196
222
|
name
|
|
197
223
|
);
|
|
198
224
|
this.cultureState = new CultureState(settings.currentCulture);
|
package/src/app/ServiceApp.ts
CHANGED
|
@@ -50,9 +50,10 @@ export class ServiceApp<
|
|
|
50
50
|
* Constructor
|
|
51
51
|
* @param settings Settings
|
|
52
52
|
* @param name Application name
|
|
53
|
+
* @param globalFields Global fields
|
|
53
54
|
*/
|
|
54
|
-
constructor(settings: S, name: string) {
|
|
55
|
-
super(settings, name);
|
|
55
|
+
constructor(settings: S, name: string, globalFields: string[]) {
|
|
56
|
+
super(settings, name, globalFields);
|
|
56
57
|
|
|
57
58
|
// Check
|
|
58
59
|
if (settings.serviceId == null || settings.serviceEndpoint == null) {
|
|
@@ -79,7 +80,7 @@ export class ServiceApp<
|
|
|
79
80
|
'&serviceDeviceId=' +
|
|
80
81
|
encodeURIComponent(this.deviceId) +
|
|
81
82
|
'&' +
|
|
82
|
-
DomUtils.
|
|
83
|
+
DomUtils.CultureField +
|
|
83
84
|
'=' +
|
|
84
85
|
this.culture;
|
|
85
86
|
}
|