@smartbit4all/ng-client 1.1.21 → 1.1.23

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.
@@ -759,8 +759,6 @@ class SmartSessionService {
759
759
  throw new Error(`sessionHandlerService was not initialized. Error: ${sessionError.code}`);
760
760
  }
761
761
  addHeaderParam(headerParam) {
762
- console.log('addHeaderParam called ');
763
- console.log(headerParam);
764
762
  if (this.headerParams.find((h) => h.headerName === headerParam.headerName)) {
765
763
  let index = this.headerParams.findIndex((h) => h.headerName === headerParam.headerName);
766
764
  this.headerParams[index].value = headerParam.value;
@@ -771,13 +769,10 @@ class SmartSessionService {
771
769
  this.headersUpdated.next();
772
770
  }
773
771
  setUpTokenForSessionService() {
774
- if (this.headerParams.find((header) => header.headerName === 'Authorization')) {
775
- let index = this.headerParams.findIndex((header) => header.headerName === 'Authorization');
776
- this.headerParams[index].value = `Bearer ${this.token}`;
777
- }
778
- else {
779
- this.addHeaderParam({ headerName: 'Authorization', value: `Bearer ${this.token}` });
780
- }
772
+ this.addHeaderParam({
773
+ headerName: 'Authorization',
774
+ value: `Bearer ${this.token}`,
775
+ });
781
776
  }
782
777
  setUrl(url) {
783
778
  this.basePath = url;
@@ -2184,7 +2179,6 @@ class SmartViewContextService {
2184
2179
  sessionStorage.clear();
2185
2180
  }
2186
2181
  setTabId(tabId) {
2187
- console.log('setTabId ' + tabId);
2188
2182
  sessionStorage.setItem(this.tabIdName, tabId);
2189
2183
  this.session.addHeaderParam({
2190
2184
  headerName: this.tabIdhttpHeaderName,
@@ -2192,7 +2186,6 @@ class SmartViewContextService {
2192
2186
  });
2193
2187
  }
2194
2188
  async startViewContext() {
2195
- console.log('startViewContext');
2196
2189
  this.clearSessionStorage();
2197
2190
  let newViewContext = await this.view
2198
2191
  .createViewContext()
@@ -2201,7 +2194,6 @@ class SmartViewContextService {
2201
2194
  throw new Error('No ViewContext was created');
2202
2195
  }
2203
2196
  this.viewContext = newViewContext;
2204
- console.log(this.viewContext);
2205
2197
  this.setTabId(newViewContext.uuid);
2206
2198
  return this.viewContext;
2207
2199
  }
@@ -2212,8 +2204,6 @@ class SmartViewContextService {
2212
2204
  if (!this.messageDialogname) {
2213
2205
  throw new Error('The messageDialogName provided by the backend has not been set.');
2214
2206
  }
2215
- console.log('init viewContext');
2216
- console.log(uuid);
2217
2207
  if (uuid) {
2218
2208
  let subscription = this.session.headersUpdated.subscribe(async () => {
2219
2209
  subscription.unsubscribe();
@@ -2237,8 +2227,6 @@ class SmartViewContextService {
2237
2227
  if (!viewHandler) {
2238
2228
  throw new Error(`SmartViewHandlerModel was not found by view name: ${view.viewName}`);
2239
2229
  }
2240
- console.log(view);
2241
- sessionStorage.setItem(view.viewName, view.uuid);
2242
2230
  if (view.type === ViewType.Dialog) {
2243
2231
  if (!viewHandler.component) {
2244
2232
  throw new Error(`Component is undefined in SmartViewHandlerModel with name: ${view.viewName}`);
@@ -2266,6 +2254,7 @@ class SmartViewContextService {
2266
2254
  view.state = ViewState.Opened;
2267
2255
  this.openedViewUuids.push(view.uuid);
2268
2256
  this.openedViewData.push(view);
2257
+ sessionStorage.setItem(view.viewName, view.uuid);
2269
2258
  this.uuidOfPageHasBeenChanged.next(view.viewName);
2270
2259
  this.updateViewContext({
2271
2260
  updates: [
@@ -2277,7 +2266,7 @@ class SmartViewContextService {
2277
2266
  uuid: this.viewContext?.uuid,
2278
2267
  });
2279
2268
  }
2280
- closeView(view) {
2269
+ closeView(view, keepInSession) {
2281
2270
  let viewHandler = this.viewHandlers.find((handler) => handler.name === view.viewName);
2282
2271
  if (!viewHandler) {
2283
2272
  throw new Error(`SmartViewHandlerModel was not found by view name: ${view.viewName}`);
@@ -2305,8 +2294,10 @@ class SmartViewContextService {
2305
2294
  if (index >= 0) {
2306
2295
  this.openedViewUuids.splice(index, 1);
2307
2296
  this.openedViewData.splice(index, 1);
2297
+ if (!keepInSession) {
2298
+ sessionStorage.removeItem(view.viewName);
2299
+ }
2308
2300
  }
2309
- sessionStorage.removeItem(view.viewName);
2310
2301
  this.updateViewContext({
2311
2302
  updates: [
2312
2303
  {
@@ -2318,7 +2309,6 @@ class SmartViewContextService {
2318
2309
  });
2319
2310
  }
2320
2311
  async restoreViews(uuid) {
2321
- console.log('restoreViews');
2322
2312
  if (!this.viewContext) {
2323
2313
  await this.getViewContext(uuid);
2324
2314
  }
@@ -2333,7 +2323,7 @@ class SmartViewContextService {
2333
2323
  this.openView(view);
2334
2324
  break;
2335
2325
  case ViewState.ToClose:
2336
- this.closeView(view);
2326
+ this.closeView(view, false);
2337
2327
  break;
2338
2328
  }
2339
2329
  });
@@ -2341,8 +2331,8 @@ class SmartViewContextService {
2341
2331
  .flatMap((viewData) => viewData.uuid)
2342
2332
  .includes(viewData.uuid));
2343
2333
  if (viewDataToClose?.length) {
2344
- viewDataToClose.map(async (viewData) => {
2345
- await this.closeView(viewData);
2334
+ viewDataToClose.map((viewData) => {
2335
+ this.closeView(viewData, true);
2346
2336
  });
2347
2337
  }
2348
2338
  this.viewContextHasBeenSynced.next();
@@ -4242,7 +4232,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
4242
4232
  }
4243
4233
  }
4244
4234
  catch (error) {
4245
- console.log(error);
4235
+ console.error(error);
4246
4236
  this.model = change.value;
4247
4237
  }
4248
4238
  if (!change.changedWidgets && !change.changes && change.value) {