@rws-framework/client 2.9.19 → 2.9.22

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/client",
3
3
  "private": false,
4
- "version": "2.9.19",
4
+ "version": "2.9.22",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
7
7
  "docs": "typedoc --tsconfig ./tsconfig.json"
@@ -70,11 +70,19 @@ const RWSWebpackWrapper = async (config) => {
70
70
 
71
71
  //AFTER OPTION DEFINITIONS
72
72
 
73
+ let _rws_defines = {
74
+ 'process.env._RWS_DEFAULTS': JSON.stringify(BuildConfigurator.exportDefaultConfig()),
75
+ 'process.env._RWS_BUILD_OVERRIDE': JSON.stringify(BuildConfigurator.exportBuildConfig())
76
+ }
77
+
78
+ const rwsDefines = BuildConfigurator.get('rwsDefines') || config.rwsDefines || null;
79
+
80
+ if(rwsDefines){
81
+ _rws_defines = {..._rws_defines, ...rwsDefines}
82
+ }
83
+
73
84
  let WEBPACK_PLUGINS = [
74
- new webpack.DefinePlugin({
75
- 'process.env._RWS_DEFAULTS': JSON.stringify(BuildConfigurator.exportDefaultConfig()),
76
- 'process.env._RWS_BUILD_OVERRIDE': JSON.stringify(BuildConfigurator.exportBuildConfig())
77
- }),
85
+ new webpack.DefinePlugin(_rws_defines),
78
86
  new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en-gb/),
79
87
  new webpack.IgnorePlugin({
80
88
  resourceRegExp: /.*\.es6\.js$/,
@@ -122,17 +122,20 @@ async function setup(this: RWSClientInstance, config: IRWSConfig = {}): Promise<
122
122
 
123
123
  async function start(this: RWSClientInstance, config: IRWSConfig = {}): Promise<RWSClientInstance> {
124
124
  this.config = { ...this.config, ...config };
125
-
125
+
126
126
  if (!this.isSetup) {
127
127
  this.config = await this.setup(this.config);
128
128
  }
129
129
 
130
130
  if (Object.keys(config).length) {
131
131
  this.appConfig.mergeConfig(this.config);
132
- }
132
+ }
133
133
 
134
- if(!this.user && config?.user){
135
- this.setUser(config.user);
134
+ const setThisUser = config?.user || this.getUser();
135
+
136
+ if(setThisUser){
137
+ this.config.user = setThisUser;
138
+ this.setUser(setThisUser);
136
139
  }
137
140
 
138
141
  if (this.config.user && !this.config.dontPushToSW) {
@@ -141,7 +144,7 @@ async function start(this: RWSClientInstance, config: IRWSConfig = {}): Promise<
141
144
 
142
145
  await this.initCallback();
143
146
 
144
- for (const plugin of RWSPlugin.getAllPlugins()){
147
+ for (const plugin of RWSPlugin.getAllPlugins()){
145
148
  await plugin.onClientStart();
146
149
  }
147
150
 
@@ -6,6 +6,7 @@ export type IFrontRoutes = Record<string, unknown>;
6
6
  export type RWSPluginEntry<T extends DefaultRWSPluginOptionsType = DefaultRWSPluginOptionsType> = new (...args: any[]) => RWSPlugin<T>;
7
7
 
8
8
  export default interface IRWSConfig {
9
+ [key: string]: any
9
10
  dev?: boolean
10
11
  defaultLayout?: typeof RWSViewComponent
11
12
  backendUrl?: string
@@ -20,7 +21,8 @@ export default interface IRWSConfig {
20
21
  pubUrlFilePrefix?: string
21
22
  partedDirUrlPrefix?: string
22
23
  dontPushToSW?: boolean
23
- parted?: boolean
24
+ parted?: boolean,
25
+ rwsDefines?: {[key: string]: any}
24
26
  partedFileDir?: string
25
27
  partedPrefix?: string
26
28
  plugins?: IStaticRWSPlugin[]