@smartbit4all/ng-client 1.0.20 → 1.0.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.
@@ -1988,8 +1988,8 @@ class SmartViewContextService {
1988
1988
  this.session = session;
1989
1989
  this.navigation = navigation;
1990
1990
  this.dialog = dialog;
1991
- this.tabIdName = 'viewContextUuid';
1992
- this.tabIdhttpHeaderName = 'viewContextUuid';
1991
+ this.tabIdName = "viewContextUuid";
1992
+ this.tabIdhttpHeaderName = "viewContextUuid";
1993
1993
  this.viewHandlers = new Array();
1994
1994
  this.openedViewUuids = new Array();
1995
1995
  this.uuidOfPageHasBeenChanged = new Subject();
@@ -2022,7 +2022,7 @@ class SmartViewContextService {
2022
2022
  }
2023
2023
  getActionDescriptors() {
2024
2024
  if (!this.actionDescriptors) {
2025
- console.error('No action descriptors has been set to ViewContext.');
2025
+ console.error("No action descriptors has been set to ViewContext.");
2026
2026
  }
2027
2027
  return this.actionDescriptors;
2028
2028
  }
@@ -2043,7 +2043,7 @@ class SmartViewContextService {
2043
2043
  this.view.configuration.basePath = this.url;
2044
2044
  }
2045
2045
  setUrl(url) {
2046
- this.url = url + '/view';
2046
+ this.url = url + "/view";
2047
2047
  this.setUpUrlForViewService();
2048
2048
  }
2049
2049
  async getAndSyncViewContext(uuid) {
@@ -2057,7 +2057,7 @@ class SmartViewContextService {
2057
2057
  async getViewContext(uuid) {
2058
2058
  this.viewContext = await this.view.getViewContext(uuid).toPromise();
2059
2059
  if (!this.viewContext) {
2060
- throw new Error('ViewContext does not exist with the given uuid.');
2060
+ throw new Error("ViewContext does not exist with the given uuid.");
2061
2061
  }
2062
2062
  return this.viewContext;
2063
2063
  }
@@ -2065,7 +2065,7 @@ class SmartViewContextService {
2065
2065
  if (!this.viewContext) {
2066
2066
  let viewContextUuid = sessionStorage.getItem(this.tabIdName);
2067
2067
  if (!viewContextUuid) {
2068
- throw new Error('View context is not initialized!');
2068
+ throw new Error("View context is not initialized!");
2069
2069
  }
2070
2070
  await this.getViewContext(viewContextUuid);
2071
2071
  }
@@ -2077,7 +2077,9 @@ class SmartViewContextService {
2077
2077
  return viewContextByPageName;
2078
2078
  }
2079
2079
  async updateViewContext(viewContextUpdate) {
2080
- this.viewContext = await this.view.updateViewContext(viewContextUpdate).toPromise();
2080
+ this.viewContext = await this.view
2081
+ .updateViewContext(viewContextUpdate)
2082
+ .toPromise();
2081
2083
  return this.viewContext;
2082
2084
  }
2083
2085
  clearSessionStorage() {
@@ -2085,7 +2087,10 @@ class SmartViewContextService {
2085
2087
  }
2086
2088
  setTabId(tabId) {
2087
2089
  sessionStorage.setItem(this.tabIdName, tabId);
2088
- this.session.addHeaderParam({ headerName: this.tabIdhttpHeaderName, value: tabId });
2090
+ this.session.addHeaderParam({
2091
+ headerName: this.tabIdhttpHeaderName,
2092
+ value: tabId,
2093
+ });
2089
2094
  }
2090
2095
  async startViewContext() {
2091
2096
  this.clearSessionStorage();
@@ -2093,7 +2098,7 @@ class SmartViewContextService {
2093
2098
  .createViewContext()
2094
2099
  .toPromise();
2095
2100
  if (!newViewContext) {
2096
- throw new Error('No ViewContext was created');
2101
+ throw new Error("No ViewContext was created");
2097
2102
  }
2098
2103
  this.viewContext = newViewContext;
2099
2104
  this.setTabId(newViewContext.uuid);
@@ -2104,7 +2109,7 @@ class SmartViewContextService {
2104
2109
  throw new Error("There aren't any viewHandlers in SmartViewContextService! Provide some to use its functions.");
2105
2110
  }
2106
2111
  if (!this.messageDialogname) {
2107
- throw new Error('The messageDialogName provided by the backend has not been set.');
2112
+ throw new Error("The messageDialogName provided by the backend has not been set.");
2108
2113
  }
2109
2114
  if (uuid) {
2110
2115
  let subscription = this.session.headersUpdated.subscribe(async () => {
@@ -2134,11 +2139,11 @@ class SmartViewContextService {
2134
2139
  throw new Error(`Component is undefined in SmartViewHandlerModel with name: ${view.viewName}`);
2135
2140
  }
2136
2141
  let dialogRef = this.dialog.openComponentAsDialog(viewHandler.component, viewHandler.name);
2137
- if (view.viewName === this.messageDialogname) {
2138
- if (view.message?.options && view.message.options.length) {
2139
- dialogRef.disableClose = true;
2140
- }
2141
- }
2142
+ dialogRef.disableClose = true;
2143
+ // if (view.viewName === this.messageDialogname) {
2144
+ // if (view.message?.options && view.message.options.length) {
2145
+ // }
2146
+ // }
2142
2147
  this.dialogRefs.push({
2143
2148
  uuid: view.uuid,
2144
2149
  dialogRef,
@@ -2148,10 +2153,10 @@ class SmartViewContextService {
2148
2153
  if (viewHandler.route === undefined) {
2149
2154
  throw new Error(`Route is undefined in SmartViewHandlerModel with name: ${view.viewName}`);
2150
2155
  }
2151
- this.navigation.navigateTo(viewHandler.route.split('/'));
2156
+ this.navigation.navigateTo(viewHandler.route.split("/"));
2152
2157
  }
2153
2158
  else {
2154
- throw new Error('The type of the view and its viewHandler is not the same!');
2159
+ throw new Error("The type of the view and its viewHandler is not the same!");
2155
2160
  }
2156
2161
  view.state = ViewState.Opened;
2157
2162
  this.openedViewUuids.push(view.uuid);
@@ -2180,7 +2185,7 @@ class SmartViewContextService {
2180
2185
  this.dialogRefs.splice(index, 1);
2181
2186
  }
2182
2187
  else {
2183
- throw new Error('DialogRef is not found by uuid.');
2188
+ throw new Error("DialogRef is not found by uuid.");
2184
2189
  }
2185
2190
  }
2186
2191
  else if (view.type === ViewType.Normal) {
@@ -2188,7 +2193,7 @@ class SmartViewContextService {
2188
2193
  // this.navigation.navigateTo(viewHandler.route.split("/"));
2189
2194
  }
2190
2195
  else {
2191
- throw new Error('The type of the view and its viewHandler is not the same!');
2196
+ throw new Error("The type of the view and its viewHandler is not the same!");
2192
2197
  }
2193
2198
  view.state = ViewState.Closed;
2194
2199
  this.openedViewUuids.slice(this.openedViewUuids.indexOf(view.uuid), 1);
@@ -2233,7 +2238,7 @@ class SmartViewContextService {
2233
2238
  }
2234
2239
  async message(messageData, messageResult) {
2235
2240
  await this.view
2236
- .message(messageData.viewUuid ?? '', messageData.uuid, messageResult)
2241
+ .message(messageData.viewUuid ?? "", messageData.uuid, messageResult)
2237
2242
  .toPromise();
2238
2243
  await this.getAndSyncViewContext();
2239
2244
  }
@@ -2241,29 +2246,32 @@ class SmartViewContextService {
2241
2246
  if (!this.smartViewContextApiErrors) {
2242
2247
  return {
2243
2248
  code,
2244
- message: 'An error has occured.',
2245
- buttonLabel: 'Ok',
2246
- dialogTitle: 'Hiba',
2249
+ message: "An error has occured.",
2250
+ buttonLabel: "Ok",
2251
+ dialogTitle: "Hiba",
2247
2252
  };
2248
2253
  }
2249
2254
  let apiErrorsWithCode = this.smartViewContextApiErrors.viewContextApiErrors.filter((apiError) => {
2250
2255
  return apiError.code === code;
2251
2256
  });
2252
- if (!apiErrorsWithCode || (apiErrorsWithCode && !apiErrorsWithCode.length)) {
2257
+ if (!apiErrorsWithCode ||
2258
+ (apiErrorsWithCode && !apiErrorsWithCode.length)) {
2253
2259
  console.error(`SmartViewContextApiError with code ${code} could not be found.`);
2254
2260
  return {
2255
2261
  code,
2256
- message: 'An error has occured.',
2257
- buttonLabel: 'Ok',
2258
- dialogTitle: 'Hiba',
2262
+ message: "An error has occured.",
2263
+ buttonLabel: "Ok",
2264
+ dialogTitle: "Hiba",
2259
2265
  };
2260
2266
  }
2261
2267
  return apiErrorsWithCode[0];
2262
2268
  }
2263
2269
  async getViewConstraint(uuid) {
2264
- let viewConstraintResponse = await this.view.getViewConstraint(uuid).toPromise();
2270
+ let viewConstraintResponse = await this.view
2271
+ .getViewConstraint(uuid)
2272
+ .toPromise();
2265
2273
  if (!viewConstraintResponse)
2266
- throw new Error('Could not get ViewConstraint with the given uuid.');
2274
+ throw new Error("Could not get ViewConstraint with the given uuid.");
2267
2275
  return viewConstraintResponse;
2268
2276
  }
2269
2277
  async showPublishedView(channel, uuid) {
@@ -2284,10 +2292,14 @@ class SmartViewContextService {
2284
2292
  return await this.handlePerformActionResponse(await this.view.performAction(uuid, uiActionRequest).toPromise());
2285
2293
  }
2286
2294
  async performWidgetAction(uuid, widgetId, nodeId, uiActionRequest) {
2287
- return await this.handlePerformActionResponse(await this.view.performWidgetAction(uuid, widgetId, nodeId, uiActionRequest).toPromise());
2295
+ return await this.handlePerformActionResponse(await this.view
2296
+ .performWidgetAction(uuid, widgetId, nodeId, uiActionRequest)
2297
+ .toPromise());
2288
2298
  }
2289
2299
  async performWidgetMainAction(uuid, widgetId, uiActionRequest) {
2290
- return await this.handlePerformActionResponse(await this.view.performWidgetMainAction(uuid, widgetId, uiActionRequest).toPromise());
2300
+ return await this.handlePerformActionResponse(await this.view
2301
+ .performWidgetMainAction(uuid, widgetId, uiActionRequest)
2302
+ .toPromise());
2291
2303
  }
2292
2304
  async handlePerformActionResponse(viewContextChange) {
2293
2305
  this.viewContext = viewContextChange?.viewContext;
@@ -2309,11 +2321,11 @@ class SmartViewContextService {
2309
2321
  }
2310
2322
  }
2311
2323
  SmartViewContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextService, deps: [{ token: ViewService }, { token: SmartSessionService }, { token: i3$1.SmartNavigationService }, { token: i4.SmartdialogService }], target: i0.ɵɵFactoryTarget.Injectable });
2312
- SmartViewContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextService, providedIn: 'root' });
2324
+ SmartViewContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextService, providedIn: "root" });
2313
2325
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextService, decorators: [{
2314
2326
  type: Injectable,
2315
2327
  args: [{
2316
- providedIn: 'root',
2328
+ providedIn: "root",
2317
2329
  }]
2318
2330
  }], ctorParameters: function () { return [{ type: ViewService }, { type: SmartSessionService }, { type: i3$1.SmartNavigationService }, { type: i4.SmartdialogService }]; } });
2319
2331
 
@@ -2987,6 +2999,16 @@ class SmartViewContextInterceptor {
2987
2999
  this.viewContextErrorDialog = viewContextErrorDialog;
2988
3000
  }
2989
3001
  intercept(request, next) {
3002
+ // parameter: async: True -> don't throw/open error (dialog)
3003
+ if (request.body) {
3004
+ try {
3005
+ let body = request.body;
3006
+ if (body.params[IS_ASYNC_PARAM_NAME]) {
3007
+ return next.handle(request);
3008
+ }
3009
+ }
3010
+ catch (error) { }
3011
+ }
2990
3012
  return next.handle(request).pipe(catchError((error) => {
2991
3013
  if (error.status === 409 &&
2992
3014
  (error.error.code || error.error.message)) {
@@ -3005,6 +3027,7 @@ SmartViewContextInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "1
3005
3027
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextInterceptor, decorators: [{
3006
3028
  type: Injectable
3007
3029
  }], ctorParameters: function () { return [{ type: SmartViewContextErrorDialogService }]; } });
3030
+ const IS_ASYNC_PARAM_NAME = 'isAsync';
3008
3031
 
3009
3032
  class SmartViewRedirect {
3010
3033
  constructor(service, navigation, route) {