bpm-core 0.0.41 → 0.0.42

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.
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { Injectable, Inject, Component, CUSTOM_ELEMENTS_SCHEMA, Pipe, forwardRef, EventEmitter, Input, Output, ViewChild, Directive, inject, HostListener, NO_ERRORS_SCHEMA, PLATFORM_ID, InjectionToken } from '@angular/core';
3
3
  import * as i1$1 from '@angular/material/dialog';
4
4
  import { MAT_DIALOG_DATA, MatDialogContent, MatDialogActions, MatDialogClose, MatDialogTitle, MatDialog, MatDialogModule } from '@angular/material/dialog';
5
- import { Subject, ReplaySubject, BehaviorSubject, catchError, throwError, switchMap, of, from } from 'rxjs';
5
+ import { Subject, ReplaySubject, BehaviorSubject, catchError, throwError, switchMap, from } from 'rxjs';
6
6
  import * as i1 from '@angular/common/http';
7
7
  import { HttpHeaders } from '@angular/common/http';
8
8
  import { map } from 'rxjs/operators';
@@ -829,7 +829,7 @@ class CoreService {
829
829
  const options = this.getRequestOptions();
830
830
  return this.callPost(body, options);
831
831
  }), switchMap(postObservable => postObservable), catchError((httpError) => {
832
- return of(throwError(httpError));
832
+ return throwError(httpError);
833
833
  }));
834
834
  }
835
835
  buildAuthUrl() {
@@ -961,20 +961,28 @@ class CoreService {
961
961
  }
962
962
  return body;
963
963
  }
964
+ /* private callPost(body, options) {
965
+ const language = (window as any)?.wmConfig?.language ? (window as any).wmConfig.language : "en";
966
+ let apiUrl = this.config.proxyServiceBaseUrl + language + this.config.proxyFullAddress + this.config.proxyServiceExecute;
967
+ return this.http.post(apiUrl, encodeURIComponent(JSON.stringify(body)), options).toPromise()
968
+ .then(
969
+ (responseObject: any) => {
970
+ return this.successWm(responseObject)
971
+ },
972
+ ).catch(
973
+ (httpError: any) => {
974
+ return throwError(httpError)
975
+ }
976
+ );
977
+ }*/
964
978
  callPost(body, options) {
965
979
  const language = window?.wmConfig?.language ? window.wmConfig.language : "en";
966
980
  let apiUrl = this.config.proxyServiceBaseUrl + language + this.config.proxyFullAddress + this.config.proxyServiceExecute;
967
- return this.http.post(apiUrl, encodeURIComponent(JSON.stringify(body)), options).toPromise()
968
- .then((responseObject) => {
969
- return this.successWm(responseObject);
970
- }).catch((httpError) => {
971
- return throwError(httpError);
972
- });
981
+ return this.http.post(apiUrl, encodeURIComponent(JSON.stringify(body)), options).pipe(map((responseObject) => this.successWm(responseObject)), catchError((httpError) => throwError(httpError)));
973
982
  }
974
983
  submit(body, options) {
975
984
  const language = window?.wmConfig?.language ? window.wmConfig.language : "en";
976
985
  const apiUrl = this.config.proxyServiceBaseUrl + language + this.config.proxyFullAddress + this.config.proxyServiceExecute;
977
- // Convert the promise to an observable
978
986
  return from(this.http.post(apiUrl, encodeURIComponent(JSON.stringify(body)), options).toPromise().then((responseObject) => {
979
987
  let formResponse = responseObject.data.form;
980
988
  if (saveFormHooks.afterSendPayload) {
@@ -6741,19 +6749,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.10", ngImpo
6741
6749
  type: Input
6742
6750
  }] } });
6743
6751
 
6744
- var loadFormHooks = {
6745
- beforeTranspilePayload(payload) {
6746
- const hookResult = payload;
6747
- // Here should be the code to manipulate the payload before the transpile stage
6748
- return hookResult;
6749
- },
6750
- afterTranspilePayload(form) {
6751
- const hookResult = form;
6752
- // Here should be the code to manipulate the form object after the transpile stage
6753
- return hookResult;
6754
- }
6755
- };
6756
-
6757
6752
  class RequestDetailsSectionComponent {
6758
6753
  i18n;
6759
6754
  fb;
@@ -7044,17 +7039,21 @@ class CoreAppComponent {
7044
7039
  document;
7045
7040
  router;
7046
7041
  sidenavService;
7042
+ i18n;
7047
7043
  coreService;
7048
7044
  loading = {
7049
7045
  form: false
7050
7046
  };
7051
7047
  form;
7052
7048
  formTitle = 'Test';
7053
- constructor(segmentDynamicLoader, document, router, sidenavService, coreService) {
7049
+ noError = true;
7050
+ errorMessage;
7051
+ constructor(segmentDynamicLoader, document, router, sidenavService, i18n, coreService) {
7054
7052
  this.segmentDynamicLoader = segmentDynamicLoader;
7055
7053
  this.document = document;
7056
7054
  this.router = router;
7057
7055
  this.sidenavService = sidenavService;
7056
+ this.i18n = i18n;
7058
7057
  this.coreService = coreService;
7059
7058
  this.loading['form'] = true;
7060
7059
  this.coreService.loadForm().subscribe({
@@ -7063,24 +7062,16 @@ class CoreAppComponent {
7063
7062
  this.loading['form'] = false;
7064
7063
  },
7065
7064
  error: (err) => {
7066
- this.errorResponse(err);
7065
+ this.noError = false;
7066
+ this.loading['form'] = false;
7067
+ this.errorMessage = err?.error?.meta?.messages;
7067
7068
  }
7068
7069
  });
7069
7070
  }
7070
- errorResponse(form) {
7071
- if (!this.form) {
7072
- this.form = new Form(NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, form);
7073
- }
7074
- else {
7075
- this.form.messages = form;
7076
- this.form = loadFormHooks.afterTranspilePayload(this.form);
7077
- }
7078
- window.scrollTo(0, 0);
7079
- }
7080
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: CoreAppComponent, deps: [{ token: SegmentDynamicLoaderService }, { token: DOCUMENT }, { token: i2$4.Router }, { token: SidenavService }, { token: CoreService }], target: i0.ɵɵFactoryTarget.Component });
7071
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: CoreAppComponent, deps: [{ token: SegmentDynamicLoaderService }, { token: DOCUMENT }, { token: i2$4.Router }, { token: SidenavService }, { token: CoreI18nService }, { token: CoreService }], target: i0.ɵɵFactoryTarget.Component });
7081
7072
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.10", type: CoreAppComponent, isStandalone: true, selector: "lib-app", providers: [
7082
7073
  { provide: DynamicComponentInjectorToken, useValue: { /* your value here */} }
7083
- ], ngImport: i0, template: "<core-layout>\r\n @if (!loading['form']) {\r\n <core-service-header\r\n [isLoading]=\"false\"\r\n [formTitle]=\"formTitle\"\r\n [form]=\"form\">\r\n </core-service-header>\r\n <app-workflow-section\r\n workflow\r\n [form]=\"form\"\r\n [segmentDynamicLoaderService]=\"segmentDynamicLoader\"\r\n [sections]=\"form?.sections\">\r\n\r\n <app-request-details-section [form]=\"form\" [section]=\"form?.sections[0]\" [lov]=\"form?.lovs\" className=\"form-section\"></app-request-details-section>\r\n <!-- [isReadOnly]=\"form.sections[0].header.readOnly\"-->\r\n </app-workflow-section>\r\n } @else {\r\n <core-service-header header [formTitle]=\"formTitle\" [isLoading]=\"true\">\r\n </core-service-header>\r\n }\r\n</core-layout>\r\n", styles: [""], dependencies: [{ kind: "component", type:
7074
+ ], ngImport: i0, template: "<core-layout>\r\n @if (!loading['form']) {\r\n\r\n @if (noError) {\r\n <core-service-header\r\n [isLoading]=\"false\"\r\n [formTitle]=\"formTitle\"\r\n [form]=\"form\">\r\n </core-service-header>\r\n <app-workflow-section\r\n workflow\r\n [segmentDynamicLoaderService]=\"segmentDynamicLoader\"\r\n [form]=\"form\" [sections]=\"form?.['sections']\">\r\n <app-request-details-section\r\n [section]=\"form.sections[0]\" [form]=\"form\" [lov]=\"form?.lovs\" className=\"form-section\"\r\n [isReadOnly]=\"form.sections[0].header.readOnly\"></app-request-details-section>\r\n </app-workflow-section>\r\n } @else {\r\n @if (errorMessage?.length) {\r\n <ds-message></ds-message>\r\n @for (item of errorMessage; track $index) {\r\n <div class=\"d-flex justify-content-center\">\r\n <span class=\"fc-coral fs-18\" >{{ item?.['message'] }}</span>\r\n </div>\r\n }\r\n } @else {\r\n <ds-message label=\"{{i18n.translate('errorOccurred')}}\"></ds-message>\r\n }\r\n }\r\n } @else {\r\n <core-service-header header [formTitle]=\"formTitle\" [isLoading]=\"true\">\r\n </core-service-header>\r\n }\r\n</core-layout>\r\n", styles: [""], dependencies: [{ kind: "component", type:
7084
7075
  // DynamicModule,
7085
7076
  LayoutComponent, selector: "core-layout", inputs: ["form", "formTitle", "isLoading", "serviceBrief"] }, { kind: "component", type: ServiceHeaderComponent, selector: "core-service-header", inputs: ["form", "showHistory", "isLoading", "showApprovalHistory", "approvalHistory", "creationDate", "formTitle", "section", "serviceFaq"] }, { kind: "component", type: WorkflowSectionComponent, selector: "app-workflow-section", inputs: ["sections", "isReadOnly", "isLoading", "form", "contentClass", "sectionsController", "segmentDynamicLoaderService", "sectionFormComponent", "sectionName"], outputs: ["sectionSubmitted"] }, { kind: "component", type: RequestDetailsSectionComponent, selector: "app-request-details-section", inputs: ["isReadOnly", "section", "form", "lov", "className"] }] });
7086
7077
  }
@@ -7092,13 +7083,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.10", ngImpo
7092
7083
  ServiceHeaderComponent,
7093
7084
  WorkflowSectionComponent,
7094
7085
  RequestDetailsSectionComponent
7095
- ], providers: [
7086
+ ], schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA], providers: [
7096
7087
  { provide: DynamicComponentInjectorToken, useValue: { /* your value here */} }
7097
- ], template: "<core-layout>\r\n @if (!loading['form']) {\r\n <core-service-header\r\n [isLoading]=\"false\"\r\n [formTitle]=\"formTitle\"\r\n [form]=\"form\">\r\n </core-service-header>\r\n <app-workflow-section\r\n workflow\r\n [form]=\"form\"\r\n [segmentDynamicLoaderService]=\"segmentDynamicLoader\"\r\n [sections]=\"form?.sections\">\r\n\r\n <app-request-details-section [form]=\"form\" [section]=\"form?.sections[0]\" [lov]=\"form?.lovs\" className=\"form-section\"></app-request-details-section>\r\n <!-- [isReadOnly]=\"form.sections[0].header.readOnly\"-->\r\n </app-workflow-section>\r\n } @else {\r\n <core-service-header header [formTitle]=\"formTitle\" [isLoading]=\"true\">\r\n </core-service-header>\r\n }\r\n</core-layout>\r\n" }]
7088
+ ], template: "<core-layout>\r\n @if (!loading['form']) {\r\n\r\n @if (noError) {\r\n <core-service-header\r\n [isLoading]=\"false\"\r\n [formTitle]=\"formTitle\"\r\n [form]=\"form\">\r\n </core-service-header>\r\n <app-workflow-section\r\n workflow\r\n [segmentDynamicLoaderService]=\"segmentDynamicLoader\"\r\n [form]=\"form\" [sections]=\"form?.['sections']\">\r\n <app-request-details-section\r\n [section]=\"form.sections[0]\" [form]=\"form\" [lov]=\"form?.lovs\" className=\"form-section\"\r\n [isReadOnly]=\"form.sections[0].header.readOnly\"></app-request-details-section>\r\n </app-workflow-section>\r\n } @else {\r\n @if (errorMessage?.length) {\r\n <ds-message></ds-message>\r\n @for (item of errorMessage; track $index) {\r\n <div class=\"d-flex justify-content-center\">\r\n <span class=\"fc-coral fs-18\" >{{ item?.['message'] }}</span>\r\n </div>\r\n }\r\n } @else {\r\n <ds-message label=\"{{i18n.translate('errorOccurred')}}\"></ds-message>\r\n }\r\n }\r\n } @else {\r\n <core-service-header header [formTitle]=\"formTitle\" [isLoading]=\"true\">\r\n </core-service-header>\r\n }\r\n</core-layout>\r\n" }]
7098
7089
  }], ctorParameters: () => [{ type: SegmentDynamicLoaderService }, { type: Document, decorators: [{
7099
7090
  type: Inject,
7100
7091
  args: [DOCUMENT]
7101
- }] }, { type: i2$4.Router }, { type: SidenavService }, { type: CoreService }] });
7092
+ }] }, { type: i2$4.Router }, { type: SidenavService }, { type: CoreI18nService }, { type: CoreService }] });
7102
7093
 
7103
7094
  function encodePassword(formId, password) {
7104
7095
  const formIdString = Array.from(new TextEncoder().encode(formId), (x) => String.fromCodePoint(x)).join('');
@@ -7257,6 +7248,19 @@ class BuiltInCustomValidators {
7257
7248
  }
7258
7249
  }
7259
7250
 
7251
+ var loadForm = {
7252
+ beforeTranspilePayload(payload) {
7253
+ const hookResult = payload;
7254
+ // Here should be the code to manipulate the payload before the transpile stage
7255
+ return hookResult;
7256
+ },
7257
+ afterTranspilePayload(form) {
7258
+ const hookResult = form;
7259
+ // Here should be the code to manipulate the form object after the transpile stage
7260
+ return hookResult;
7261
+ }
7262
+ };
7263
+
7260
7264
  /* eslint-disable @typescript-eslint/no-explicit-any */
7261
7265
  function validateSAID() {
7262
7266
  if (this?.personalInfoFormTemp) {