@etsoo/materialui 1.3.95 → 1.3.97

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.
@@ -15,14 +15,6 @@ export declare abstract class CommonApp<U extends IUser = IUser, P extends IPage
15
15
  * @returns Fields
16
16
  */
17
17
  protected initCallEncryptedUpdateFields(): string[];
18
- /**
19
- * Do user login
20
- * @param data User data
21
- * @param refreshToken Refresh token
22
- * @param keep Keep login
23
- * @returns Success data
24
- */
25
- protected doUserLogin(data: U, refreshToken: string, keep: boolean): string | undefined;
26
18
  /**
27
19
  * Refresh token
28
20
  * @param props Props
@@ -20,17 +20,6 @@ export class CommonApp extends ReactApp {
20
20
  fields.push(CoreConstants.FieldUserIdSaved);
21
21
  return fields;
22
22
  }
23
- /**
24
- * Do user login
25
- * @param data User data
26
- * @param refreshToken Refresh token
27
- * @param keep Keep login
28
- * @returns Success data
29
- */
30
- doUserLogin(data, refreshToken, keep) {
31
- this.userLogin(data, refreshToken, keep);
32
- return undefined;
33
- }
34
23
  /**
35
24
  * Refresh token
36
25
  * @param props Props
@@ -73,10 +62,10 @@ export class CommonApp extends ReactApp {
73
62
  // Keep
74
63
  const keep = this.storage.getData(CoreConstants.FieldLoginKeep, false);
75
64
  // User login
76
- var successData = this.doUserLogin(result.data, refreshToken, keep);
65
+ this.userLogin(result.data, refreshToken, keep);
77
66
  // Callback
78
67
  if (failCallback)
79
- failCallback(true, successData);
68
+ failCallback(true);
80
69
  return true;
81
70
  };
82
71
  // Call API
@@ -53,11 +53,17 @@ export class ServiceApp extends ReactApp {
53
53
  return;
54
54
  // Add try login flag
55
55
  url = url.addUrlParam("tryLogin", tryLogin ?? false);
56
- if (BridgeUtils.host == null) {
57
- globalThis.location.href = url;
56
+ // Is it inside an iframe?
57
+ if (globalThis.self !== globalThis.parent) {
58
+ globalThis.parent.postMessage(["login", url], new URL(this.coreEndpoint.webUrl).origin);
58
59
  }
59
60
  else {
60
- BridgeUtils.host.loadApp(coreName, url);
61
+ if (BridgeUtils.host == null) {
62
+ globalThis.location.href = url;
63
+ }
64
+ else {
65
+ BridgeUtils.host.loadApp(coreName, url);
66
+ }
61
67
  }
62
68
  });
63
69
  // Make sure apply new device id for new login
@@ -71,16 +77,17 @@ export class ServiceApp extends ReactApp {
71
77
  * @param dispatch User state dispatch
72
78
  */
73
79
  userLogin(user, refreshToken, keep, dispatch) {
74
- // Super call, set token
75
- super.userLogin(user, refreshToken, keep, dispatch);
76
80
  if (user.clientDeviceId && user.passphrase) {
77
81
  // Save the passphrase
78
- const passphrase = this.decrypt(user.passphrase, `${user.uid}-${this.settings.appId}`);
82
+ // Interpolated string expressions are different between TypeScript and C# for the null value
83
+ const passphrase = this.decrypt(user.passphrase, `${user.uid ?? ""}-${this.settings.appId}`);
79
84
  if (passphrase) {
80
85
  this.deviceId = user.clientDeviceId;
81
86
  this.updatePassphrase(passphrase);
82
87
  }
83
88
  }
89
+ // Super call, set token
90
+ super.userLogin(user, refreshToken, keep, dispatch);
84
91
  }
85
92
  /**
86
93
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.3.95",
3
+ "version": "1.3.97",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -50,7 +50,7 @@
50
50
  "@emotion/css": "^11.13.4",
51
51
  "@emotion/react": "^11.13.3",
52
52
  "@emotion/styled": "^11.13.0",
53
- "@etsoo/appscript": "^1.5.28",
53
+ "@etsoo/appscript": "^1.5.29",
54
54
  "@etsoo/notificationbase": "^1.1.49",
55
55
  "@etsoo/react": "^1.7.69",
56
56
  "@etsoo/shared": "^1.2.48",
@@ -71,9 +71,9 @@
71
71
  },
72
72
  "devDependencies": {
73
73
  "@babel/cli": "^7.25.7",
74
- "@babel/core": "^7.25.7",
74
+ "@babel/core": "^7.25.8",
75
75
  "@babel/plugin-transform-runtime": "^7.25.7",
76
- "@babel/preset-env": "^7.25.7",
76
+ "@babel/preset-env": "^7.25.8",
77
77
  "@babel/preset-react": "^7.25.7",
78
78
  "@babel/preset-typescript": "^7.25.7",
79
79
  "@babel/runtime-corejs3": "^7.25.7",
@@ -36,22 +36,6 @@ export abstract class CommonApp<
36
36
  return fields;
37
37
  }
38
38
 
39
- /**
40
- * Do user login
41
- * @param data User data
42
- * @param refreshToken Refresh token
43
- * @param keep Keep login
44
- * @returns Success data
45
- */
46
- protected doUserLogin(
47
- data: U,
48
- refreshToken: string,
49
- keep: boolean
50
- ): string | undefined {
51
- this.userLogin(data, refreshToken, keep);
52
- return undefined;
53
- }
54
-
55
39
  /**
56
40
  * Refresh token
57
41
  * @param props Props
@@ -91,7 +75,7 @@ export abstract class CommonApp<
91
75
  // Success callback
92
76
  const success = (
93
77
  result: LoginResult,
94
- failCallback?: (result: RefreshTokenResult, serviceToken?: string) => void
78
+ failCallback?: (result: RefreshTokenResult) => void
95
79
  ) => {
96
80
  // Token
97
81
  const refreshToken = this.getResponseToken(payload.response);
@@ -104,10 +88,10 @@ export abstract class CommonApp<
104
88
  const keep = this.storage.getData(CoreConstants.FieldLoginKeep, false);
105
89
 
106
90
  // User login
107
- var successData = this.doUserLogin(result.data, refreshToken, keep);
91
+ this.userLogin(result.data, refreshToken, keep);
108
92
 
109
93
  // Callback
110
- if (failCallback) failCallback(true, successData);
94
+ if (failCallback) failCallback(true);
111
95
 
112
96
  return true;
113
97
  };
@@ -86,10 +86,18 @@ export class ServiceApp<
86
86
  // Add try login flag
87
87
  url = url.addUrlParam("tryLogin", tryLogin ?? false);
88
88
 
89
- if (BridgeUtils.host == null) {
90
- globalThis.location.href = url;
89
+ // Is it inside an iframe?
90
+ if (globalThis.self !== globalThis.parent) {
91
+ globalThis.parent.postMessage(
92
+ ["login", url],
93
+ new URL(this.coreEndpoint.webUrl).origin
94
+ );
91
95
  } else {
92
- BridgeUtils.host.loadApp(coreName, url);
96
+ if (BridgeUtils.host == null) {
97
+ globalThis.location.href = url;
98
+ } else {
99
+ BridgeUtils.host.loadApp(coreName, url);
100
+ }
93
101
  }
94
102
  });
95
103
 
@@ -110,20 +118,21 @@ export class ServiceApp<
110
118
  keep?: boolean,
111
119
  dispatch?: boolean
112
120
  ): void {
113
- // Super call, set token
114
- super.userLogin(user, refreshToken, keep, dispatch);
115
-
116
121
  if (user.clientDeviceId && user.passphrase) {
117
122
  // Save the passphrase
123
+ // Interpolated string expressions are different between TypeScript and C# for the null value
118
124
  const passphrase = this.decrypt(
119
125
  user.passphrase,
120
- `${user.uid}-${this.settings.appId}`
126
+ `${user.uid ?? ""}-${this.settings.appId}`
121
127
  );
122
128
  if (passphrase) {
123
129
  this.deviceId = user.clientDeviceId;
124
130
  this.updatePassphrase(passphrase);
125
131
  }
126
132
  }
133
+
134
+ // Super call, set token
135
+ super.userLogin(user, refreshToken, keep, dispatch);
127
136
  }
128
137
 
129
138
  /**