@veloceapps/sdk 11.0.0-25 → 11.0.0-27
Sign up to get free protection for your applications and to get access to all the features.
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +9 -1
- package/core/modules/configuration/services/configuration.service.d.ts +2 -2
- package/core/modules/configuration/types/configuration-runtime.types.d.ts +3 -0
- package/core/services/flow-info.service.d.ts +1 -0
- package/core/services/sales-transaction.service.d.ts +0 -1
- package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +14 -4
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +12 -9
- package/esm2020/core/modules/configuration/types/configuration-runtime.types.mjs +2 -0
- package/esm2020/core/services/flow-info.service.mjs +14 -1
- package/esm2020/core/services/flow-state.service.mjs +2 -7
- package/esm2020/core/services/sales-transaction.service.mjs +1 -4
- package/esm2020/src/flow-routing.module.mjs +3 -2
- package/esm2020/src/resolvers/pcm-model.resolver.mjs +12 -0
- package/esm2020/src/resolvers/sales-transaction.resolver.mjs +3 -3
- package/fesm2015/veloceapps-sdk-core.mjs +37 -23
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +13 -3
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +35 -20
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +13 -3
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +1 -1
- package/src/resolvers/pcm-model.resolver.d.ts +3 -0
@@ -5,9 +5,9 @@ import * as i1 from '@veloceapps/api';
|
|
5
5
|
import { ApiModule } from '@veloceapps/api';
|
6
6
|
import * as i6 from '@veloceapps/components';
|
7
7
|
import { ToastType, ConfirmationDialogModule } from '@veloceapps/components';
|
8
|
+
import { tap, BehaviorSubject, map, switchMap, of, forkJoin, throwError, noop, filter as filter$1, Subject, catchError as catchError$1, combineLatest, finalize as finalize$1, buffer, debounceTime, share, take, distinctUntilChanged, shareReplay, takeUntil } from 'rxjs';
|
8
9
|
import * as i4 from '@veloceapps/api/v2';
|
9
10
|
import { uniqBy, flatten, omit, cloneDeep, assign, isEqual } from 'lodash';
|
10
|
-
import { BehaviorSubject, map, tap, switchMap, of, forkJoin, throwError, noop, filter as filter$1, Subject, catchError as catchError$1, combineLatest, finalize as finalize$1, buffer, debounceTime, share, take, distinctUntilChanged, shareReplay, takeUntil } from 'rxjs';
|
11
11
|
import * as i2 from 'primeng/api';
|
12
12
|
import { filter, map as map$1, catchError, tap as tap$1, finalize } from 'rxjs/operators';
|
13
13
|
import { NgControl } from '@angular/forms';
|
@@ -15,7 +15,8 @@ import 'primeng/calendar';
|
|
15
15
|
import { DATE_PIPE_DEFAULT_OPTIONS, formatDate } from '@angular/common';
|
16
16
|
|
17
17
|
class ConfigurationRuntimeService {
|
18
|
-
constructor() {
|
18
|
+
constructor(pcmApiService) {
|
19
|
+
this.pcmApiService = pcmApiService;
|
19
20
|
this.uiDefinitionContainer = null;
|
20
21
|
}
|
21
22
|
get uiDefinitionProps() {
|
@@ -23,13 +24,19 @@ class ConfigurationRuntimeService {
|
|
23
24
|
}
|
24
25
|
reset() {
|
25
26
|
this.uiDefinitionContainer = null;
|
27
|
+
this.initializationProps = undefined;
|
28
|
+
this.pcmModel = undefined;
|
29
|
+
}
|
30
|
+
init$(props) {
|
31
|
+
this.initializationProps = props;
|
32
|
+
return this.pcmApiService.fetchPCMByProductId(props.productId).pipe(tap(pcmModel => (this.pcmModel = pcmModel)));
|
26
33
|
}
|
27
34
|
}
|
28
|
-
ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
35
|
+
ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.PCMApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
29
36
|
ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService });
|
30
37
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
|
31
38
|
type: Injectable
|
32
|
-
}] });
|
39
|
+
}], ctorParameters: function () { return [{ type: i1.PCMApiService }]; } });
|
33
40
|
|
34
41
|
const FLOW_CUSTOMIZATION = new InjectionToken('FLOW_CUSTOMIZATION');
|
35
42
|
|
@@ -184,6 +191,19 @@ class FlowInfoService {
|
|
184
191
|
init$(flowId, routeQueryParams) {
|
185
192
|
return this.initFlow$(flowId, routeQueryParams).pipe(switchMap(() => this.initFlowTemplates$()));
|
186
193
|
}
|
194
|
+
initTestFlow$(productId) {
|
195
|
+
this.contextSubj$.next({
|
196
|
+
mode: 'QUOTE',
|
197
|
+
headerId: '0Q0-test-quote-id',
|
198
|
+
productId,
|
199
|
+
});
|
200
|
+
this.flowSubj$.next({
|
201
|
+
id: 'preview-flow-id',
|
202
|
+
properties: { entryPath: '/product', queryParams: {} },
|
203
|
+
version: 2,
|
204
|
+
});
|
205
|
+
return of(undefined);
|
206
|
+
}
|
187
207
|
updateContext(update) {
|
188
208
|
this.contextSubj$.next({
|
189
209
|
...this.context,
|
@@ -363,9 +383,6 @@ class ConfigurationService {
|
|
363
383
|
get previousState() {
|
364
384
|
return this.previousConfigurationStateSubj$.getValue();
|
365
385
|
}
|
366
|
-
get asset() {
|
367
|
-
return this.state?.assets[0] ?? null;
|
368
|
-
}
|
369
386
|
get root$() {
|
370
387
|
return this.state$.pipe(map$1(state => state.salesTransactionItems[0]), filter(isDefined));
|
371
388
|
}
|
@@ -396,14 +413,13 @@ class ConfigurationService {
|
|
396
413
|
return of(undefined);
|
397
414
|
}
|
398
415
|
let transactionItem = state?.salesTransactionItems.find(item => item.id === transactionItemId);
|
399
|
-
if (!transactionItem) {
|
400
|
-
transactionItem =
|
416
|
+
if (!transactionItem && productId) {
|
417
|
+
transactionItem =
|
418
|
+
state.salesTransactionItems.find(item => item.productId === productId) ?? generateTransactionItem(productId);
|
401
419
|
}
|
402
|
-
const assetItem = transactionItem ? state?.assets.find(item => item.id === transactionItem?.assetId) : undefined;
|
403
420
|
const configurationState = {
|
404
421
|
...state,
|
405
422
|
salesTransactionItems: transactionItem ? [transactionItem] : [],
|
406
|
-
assets: assetItem ? [assetItem] : [],
|
407
423
|
};
|
408
424
|
this.configurationStateSubj$.next(configurationState);
|
409
425
|
this.previousConfigurationStateSubj$.next(configurationState);
|
@@ -466,6 +482,13 @@ class ConfigurationService {
|
|
466
482
|
// TODO: implement
|
467
483
|
throw new Error('Not implemented');
|
468
484
|
}
|
485
|
+
getPCMModel() {
|
486
|
+
const pcmModel = this.configurationRuntimeService.pcmModel;
|
487
|
+
if (!pcmModel) {
|
488
|
+
throw new Error('PCM model not initialized');
|
489
|
+
}
|
490
|
+
return pcmModel;
|
491
|
+
}
|
469
492
|
}
|
470
493
|
ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, deps: [{ token: FlowInfoService }, { token: i2.MessageService }, { token: ConfigurationRuntimeService }, { token: SalesTransactionService }, { token: i4.ProceduresApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
471
494
|
ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService });
|
@@ -492,9 +515,6 @@ class SalesTransactionService {
|
|
492
515
|
get state() {
|
493
516
|
return this.stateSubj$.getValue();
|
494
517
|
}
|
495
|
-
get hasAssets() {
|
496
|
-
return Boolean(this.state?.assets.length);
|
497
|
-
}
|
498
518
|
get hasProducts() {
|
499
519
|
return Boolean(this.state?.salesTransactionItems.length);
|
500
520
|
}
|
@@ -859,12 +879,7 @@ class FlowStateService {
|
|
859
879
|
])), map(([response]) => response), take(1));
|
860
880
|
}
|
861
881
|
initStateless$() {
|
862
|
-
return this.salesTransactionService.init(this.flowInfoService.context.headerId, this.flowInfoService.context).pipe(tap(() =>
|
863
|
-
const assets = this.salesTransactionService.state?.assets;
|
864
|
-
if (assets) {
|
865
|
-
this.flowStore = { ...this.flowStore, assets };
|
866
|
-
}
|
867
|
-
}), switchMap(state => this.flowConfiguration.calculate$(state)), tap(() => this.salesTransactionService.finalizeInit()), map(noop));
|
882
|
+
return this.salesTransactionService.init(this.flowInfoService.context.headerId, this.flowInfoService.context).pipe(switchMap(state => this.flowConfiguration.calculate$(state)), tap(() => this.salesTransactionService.finalizeInit()), map(noop));
|
868
883
|
}
|
869
884
|
executeStateless$(request) {
|
870
885
|
this.executionInProgress$.next(true);
|