@rws-framework/client 2.9.11 → 2.9.13

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/README.md CHANGED
@@ -8,6 +8,7 @@ Realtime Web Suit is a web-component powered, MS FAST powered fullstack-oriented
8
8
  2. [Getting Started](#getting-started)
9
9
  3. [Key Components: RWSClient & RoutingService](#key-components-rwsclient--routingservice)
10
10
  4. [Component Initialization](#component-initialization)
11
+ 4. [RWS Decorators](#rws-decorators)
11
12
  5. [DI](#dependency-injection)
12
13
  6. [Frontend routes](#frontend-routes)
13
14
  7. [Backend Imports](#backend-imports)
@@ -388,7 +389,16 @@ class WebChat extends RWSViewComponent {
388
389
  }
389
390
  ```
390
391
 
391
- The decorator options type:
392
+ **external decorators + @ngAttr fire externalChanged function after changes**
393
+
394
+ ```typescript
395
+ externalChanged(name: string, oldValue: string | undefined, newValue: string): void
396
+ {
397
+ this.callApi();
398
+ }
399
+ ```
400
+
401
+ The RWSView decorator options type:
392
402
 
393
403
  ```typescript
394
404
  interface RWSDecoratorOptions{
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/client",
3
3
  "private": false,
4
- "version": "2.9.11",
4
+ "version": "2.9.13",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
7
7
  "docs": "typedoc --tsconfig ./tsconfig.json"
@@ -8,13 +8,6 @@ import deepmerge from 'deepmerge';
8
8
  type RWSInfoType = { components: string[] };
9
9
 
10
10
  function getUser(this: RWSClientInstance): IRWSUser {
11
-
12
- const localSaved = localStorage.getItem('the_rws_user');
13
-
14
- if (localSaved) {
15
- this.setUser(JSON.parse(localSaved) as IRWSUser);
16
- }
17
-
18
11
  return this.user;
19
12
  }
20
13
 
@@ -28,8 +21,6 @@ function setUser(this: RWSClientInstance, user: IRWSUser): RWSClientInstance {
28
21
 
29
22
  this.apiService.setToken(this.user.jwt_token);
30
23
 
31
- localStorage.setItem('the_rws_user', JSON.stringify(this.user));
32
-
33
24
  for(const plugin of RWSPlugin.getAllPlugins()){
34
25
  plugin.onSetUser(user);
35
26
  }
@@ -98,6 +89,8 @@ async function setup(this: RWSClientInstance, config: IRWSConfig = {}): Promise<
98
89
 
99
90
  this.appConfig.mergeConfig(this.config);
100
91
 
92
+ console.log(this.config);
93
+
101
94
  if(this.config.plugins){
102
95
  for (const pluginEntry of this.config.plugins){
103
96
  addPlugin.bind(this)(pluginEntry);
@@ -110,7 +103,11 @@ async function setup(this: RWSClientInstance, config: IRWSConfig = {}): Promise<
110
103
  for (const plugin of RWSPlugin.getAllPlugins()){
111
104
  plugin.onPartedComponentsLoad(componentParts);
112
105
  }
113
- }
106
+ }
107
+
108
+ if(config?.user){
109
+ this.setUser(config.user);
110
+ }
114
111
 
115
112
  this.isSetup = true;
116
113
  return this.config;
@@ -127,13 +124,16 @@ async function start(this: RWSClientInstance, config: IRWSConfig = {}): Promise<
127
124
  this.appConfig.mergeConfig(this.config);
128
125
  }
129
126
 
127
+ if(!this.user && config?.user){
128
+ this.setUser(config.user);
129
+ }
130
+
130
131
  if (this.config.user && !this.config.dontPushToSW) {
131
132
  this.pushUserToServiceWorker(this.user);
132
133
  }
133
134
 
134
135
  await this.initCallback();
135
-
136
- for (const plugin of RWSPlugin.getAllPlugins()){
136
+ for (const plugin of RWSPlugin.getAllPlugins()){
137
137
  await plugin.onClientStart();
138
138
  }
139
139
 
package/src/client.ts CHANGED
@@ -200,6 +200,11 @@ class RWSClient {
200
200
  defineComponents(){
201
201
  ComponentHelperStatic.defineAllComponents();
202
202
  }
203
+
204
+
205
+ logout(){
206
+ this.user = null;
207
+ }
203
208
  }
204
209
 
205
210
  export default DI.createInterface<RWSClient>(x => x.singleton(RWSClient));