@veloceapps/sdk 11.0.0-11 → 11.0.0-13
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/cms/vendor-map.d.ts +7 -6
- package/core/modules/configuration/helpers.d.ts +2 -1
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +1 -3
- package/core/modules/configuration/services/configuration-state.service.d.ts +7 -7
- package/core/modules/configuration/services/configuration.service.d.ts +5 -10
- package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +11 -32
- package/core/services/catalog-products.service.d.ts +11 -0
- package/core/services/flow-info.service.d.ts +23 -10
- package/core/services/flow-state.service.d.ts +9 -12
- package/core/services/index.d.ts +2 -2
- package/core/services/quote-draft.service.d.ts +5 -5
- package/core/services/sales-transaction.service.d.ts +28 -0
- package/core/types/flow-state.types.d.ts +2 -2
- package/esm2020/cms/vendor-map.mjs +8 -7
- package/esm2020/core/core.module.mjs +7 -4
- package/esm2020/core/modules/configuration/helpers.mjs +11 -17
- package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +8 -45
- package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +46 -54
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +21 -39
- package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +34 -110
- package/esm2020/core/services/catalog-products.service.mjs +25 -0
- package/esm2020/core/services/flow-info.service.mjs +70 -28
- package/esm2020/core/services/flow-state.service.mjs +59 -133
- package/esm2020/core/services/index.mjs +3 -3
- package/esm2020/core/services/quote-draft.service.mjs +20 -38
- package/esm2020/core/services/sales-transaction.service.mjs +62 -0
- package/esm2020/core/types/flow-state.types.mjs +1 -1
- package/esm2020/src/components/flow-header/flow-header.component.mjs +3 -6
- package/esm2020/src/components/guided-selling/guided-selling.component.mjs +3 -6
- package/esm2020/src/flow-routing.module.mjs +5 -36
- package/esm2020/src/flow.component.mjs +5 -5
- package/esm2020/src/guards/flow.guard.mjs +10 -9
- package/esm2020/src/guards/product-unload.guard.mjs +5 -7
- package/esm2020/src/index.mjs +1 -2
- package/esm2020/src/pages/assets/assets.component.mjs +3 -3
- package/esm2020/src/pages/catalog/catalog.component.mjs +3 -3
- package/esm2020/src/pages/debug/debug.component.mjs +7 -11
- package/esm2020/src/pages/product/product.component.mjs +47 -67
- package/esm2020/src/pages/product/product.module.mjs +5 -5
- package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +3 -3
- package/esm2020/src/resolvers/flow.resolver.mjs +10 -18
- package/esm2020/src/resolvers/quote.resolver.mjs +11 -11
- package/esm2020/src/services/flow-dialog.service.mjs +8 -8
- package/esm2020/src/services/flow-router.service.mjs +11 -21
- package/esm2020/src/services/flow.service.mjs +10 -43
- package/esm2020/src/utils/flow.utils.mjs +2 -13
- package/fesm2015/veloceapps-sdk-cms.mjs +7 -6
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +1483 -1636
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +126 -672
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +7 -6
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +1515 -1707
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +124 -667
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/flow-header/flow-header.component.d.ts +1 -1
- package/src/components/guided-selling/guided-selling.component.d.ts +1 -1
- package/src/flow-routing.module.d.ts +1 -2
- package/src/flow.component.d.ts +2 -2
- package/src/guards/product-unload.guard.d.ts +4 -5
- package/src/index.d.ts +0 -1
- package/src/pages/assets/assets.component.d.ts +1 -1
- package/src/pages/catalog/catalog.component.d.ts +1 -1
- package/src/pages/debug/debug.component.d.ts +2 -3
- package/src/pages/product/product.component.d.ts +9 -10
- package/src/pages/product/product.module.d.ts +1 -1
- package/src/pages/shopping-cart/shopping-cart.component.d.ts +1 -1
- package/src/resolvers/flow.resolver.d.ts +5 -6
- package/src/resolvers/quote.resolver.d.ts +5 -6
- package/src/services/flow-dialog.service.d.ts +3 -3
- package/src/services/flow-router.service.d.ts +2 -4
- package/src/services/flow.service.d.ts +2 -6
- package/src/utils/flow.utils.d.ts +0 -7
- package/core/services/context.service.d.ts +0 -23
- package/esm2020/core/services/context.service.mjs +0 -91
- package/esm2020/src/guards/context.guard.mjs +0 -91
- package/esm2020/src/guards/index.mjs +0 -2
- package/esm2020/src/pages/remote/remote.component.mjs +0 -342
- package/esm2020/src/pages/remote/remote.module.mjs +0 -20
- package/esm2020/src/pages/remote/remote.types.mjs +0 -2
- package/src/guards/context.guard.d.ts +0 -19
- package/src/guards/index.d.ts +0 -1
- package/src/pages/remote/remote.component.d.ts +0 -46
- package/src/pages/remote/remote.module.d.ts +0 -10
- package/src/pages/remote/remote.types.d.ts +0 -4
|
@@ -2,22 +2,23 @@ import * as i4 from '@angular/common';
|
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { Component, ChangeDetectionStrategy, NgModule, Optional, Inject, Injectable, inject } from '@angular/core';
|
|
5
|
-
import * as i1$
|
|
5
|
+
import * as i1$3 from '@veloceapps/api';
|
|
6
6
|
import { ApiModule } from '@veloceapps/api';
|
|
7
7
|
import * as i2$1 from '@veloceapps/components';
|
|
8
8
|
import { ToastType, LoaderModule, LetDirectiveModule } from '@veloceapps/components';
|
|
9
9
|
import * as i5 from '@veloceapps/sdk/cms';
|
|
10
10
|
import { btoaSafe, PreviewModule, FlowAction, LauncherModule } from '@veloceapps/sdk/cms';
|
|
11
11
|
import * as i2 from '@veloceapps/sdk/core';
|
|
12
|
-
import { FLOW_CUSTOMIZATION,
|
|
12
|
+
import { FLOW_CUSTOMIZATION, RuntimeSettingsService, FlowStateService, FlowInfoService, QuoteDraftService, SalesTransactionService, ConfigurationService, IntegrationState, SdkCoreModule } from '@veloceapps/sdk/core';
|
|
13
13
|
import * as i3 from 'primeng/button';
|
|
14
14
|
import { ButtonModule } from 'primeng/button';
|
|
15
15
|
import * as i1 from 'primeng/dynamicdialog';
|
|
16
|
-
import { BehaviorSubject, Subject, filter, first, tap, takeUntil, catchError, of, map, switchMap, shareReplay, startWith, distinctUntilChanged, from, take, combineLatest,
|
|
16
|
+
import { BehaviorSubject, Subject, filter, first, tap, takeUntil, catchError, of, map, switchMap, shareReplay, startWith, distinctUntilChanged, from, take, combineLatest, timer, noop } from 'rxjs';
|
|
17
|
+
import * as i1$1 from '@veloceapps/api/v2';
|
|
17
18
|
import { DomHandler } from 'primeng/dom';
|
|
18
19
|
import * as i1$2 from '@angular/router';
|
|
19
20
|
import { NavigationEnd, NavigationStart, NavigationCancel, NavigationError, RouterModule } from '@angular/router';
|
|
20
|
-
import { UITemplateType, SalesforceIdUtils, mapShoppingCartSettings, getMaxRenewalTermsValue,
|
|
21
|
+
import { UITemplateType, SalesforceIdUtils, mapShoppingCartSettings, getMaxRenewalTermsValue, isVeloceError, extractErrorDetails, ConfigurationContextMode } from '@veloceapps/core';
|
|
21
22
|
import { HttpErrorResponse, HttpParams } from '@angular/common/http';
|
|
22
23
|
import * as i5$1 from '@angular/forms';
|
|
23
24
|
import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
@@ -26,7 +27,6 @@ import * as i8 from 'primeng/inputtext';
|
|
|
26
27
|
import { InputTextModule } from 'primeng/inputtext';
|
|
27
28
|
import * as i6 from 'primeng/radiobutton';
|
|
28
29
|
import { RadioButtonModule } from 'primeng/radiobutton';
|
|
29
|
-
import * as i2$2 from 'primeng/api';
|
|
30
30
|
import { catchError as catchError$1 } from 'rxjs/operators';
|
|
31
31
|
|
|
32
32
|
const VELOCE_FLOW_ROOT_ROUTE = 'VELOCE_FLOW_ROOT_ROUTE';
|
|
@@ -98,9 +98,6 @@ class FlowHeaderComponent {
|
|
|
98
98
|
initialize() {
|
|
99
99
|
var _a, _b, _c;
|
|
100
100
|
this.templateApiName = (_c = (_b = (_a = this.flowInfo.flow) === null || _a === void 0 ? void 0 : _a.properties.templates) === null || _b === void 0 ? void 0 : _b.flowHeader) !== null && _c !== void 0 ? _c : '';
|
|
101
|
-
if (this.flowInfo.isLegacy && !this.templateApiName) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
101
|
this.generateUIDefinition$()
|
|
105
102
|
.pipe(tap(uiDef => {
|
|
106
103
|
if (!uiDef) {
|
|
@@ -216,9 +213,6 @@ class GuidedSellingComponent {
|
|
|
216
213
|
initialize() {
|
|
217
214
|
var _a, _b, _c;
|
|
218
215
|
this.templateApiName = (_c = (_b = (_a = this.flowInfo.flow) === null || _a === void 0 ? void 0 : _a.properties.templates) === null || _b === void 0 ? void 0 : _b.guidedSelling) !== null && _c !== void 0 ? _c : '';
|
|
219
|
-
if (this.flowInfo.isLegacy && !this.templateApiName) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
216
|
this.generateUIDefinition$()
|
|
223
217
|
.pipe(tap(uiDef => {
|
|
224
218
|
if (!uiDef) {
|
|
@@ -344,12 +338,10 @@ const configurePrimengShadowDOM = () => {
|
|
|
344
338
|
};
|
|
345
339
|
|
|
346
340
|
class FlowRouterService {
|
|
347
|
-
constructor(router, route,
|
|
341
|
+
constructor(router, route, integrationState, flowStateService) {
|
|
348
342
|
this.router = router;
|
|
349
343
|
this.route = route;
|
|
350
|
-
this.contextService = contextService;
|
|
351
344
|
this.integrationState = integrationState;
|
|
352
|
-
this.flowInfoService = flowInfoService;
|
|
353
345
|
this.flowStateService = flowStateService;
|
|
354
346
|
this.urlHistory = [];
|
|
355
347
|
this.getLastChildRoute = (route) => {
|
|
@@ -460,19 +452,11 @@ class FlowRouterService {
|
|
|
460
452
|
}
|
|
461
453
|
}
|
|
462
454
|
navigateToProductConfiguration(productId, lineItemId) {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
469
|
-
else {
|
|
470
|
-
updateContext$ = this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'UPDATE_CONTEXT_PROPERTIES', {
|
|
471
|
-
productId,
|
|
472
|
-
lineItemId: lineItemId !== null && lineItemId !== void 0 ? lineItemId : '',
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
updateContext$
|
|
455
|
+
this.flowStateService
|
|
456
|
+
.dispatch$(UITemplateType.FLOW_ENGINE, 'UPDATE_CONTEXT_PROPERTIES', {
|
|
457
|
+
productId,
|
|
458
|
+
lineItemId: lineItemId !== null && lineItemId !== void 0 ? lineItemId : '',
|
|
459
|
+
})
|
|
476
460
|
.pipe(tap(() => {
|
|
477
461
|
const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
|
|
478
462
|
const flowRouteUrl = this.getFlowRootPath(routeSnapshot);
|
|
@@ -517,18 +501,18 @@ class FlowRouterService {
|
|
|
517
501
|
this.router.navigate([], { relativeTo: route, queryParams: Object.assign(Object.assign({}, routeSnapshot.queryParams), queryParams) });
|
|
518
502
|
}
|
|
519
503
|
}
|
|
520
|
-
FlowRouterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRouterService, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }, { token: i2.
|
|
504
|
+
FlowRouterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRouterService, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }, { token: i2.IntegrationState }, { token: i2.FlowStateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
521
505
|
FlowRouterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRouterService, providedIn: 'root' });
|
|
522
506
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRouterService, decorators: [{
|
|
523
507
|
type: Injectable,
|
|
524
508
|
args: [{ providedIn: 'root' }]
|
|
525
|
-
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: i2.
|
|
509
|
+
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: i2.IntegrationState }, { type: i2.FlowStateService }]; } });
|
|
526
510
|
|
|
527
511
|
class FlowDialogService {
|
|
528
|
-
constructor(dialogService,
|
|
512
|
+
constructor(dialogService, runtimeSettings, flowInfoService) {
|
|
529
513
|
this.dialogService = dialogService;
|
|
530
|
-
this.contextService = contextService;
|
|
531
514
|
this.runtimeSettings = runtimeSettings;
|
|
515
|
+
this.flowInfoService = flowInfoService;
|
|
532
516
|
}
|
|
533
517
|
show(config) {
|
|
534
518
|
return this.dialogService.open(FlowDialogComponent, {
|
|
@@ -550,8 +534,8 @@ class FlowDialogService {
|
|
|
550
534
|
}
|
|
551
535
|
showReadonlyModeDialog() {
|
|
552
536
|
var _a;
|
|
553
|
-
const
|
|
554
|
-
const objectName =
|
|
537
|
+
const mode = this.flowInfoService.context.mode;
|
|
538
|
+
const objectName = mode ? ((_a = mode[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase()) + mode.substring(1).toLowerCase() : 'Object';
|
|
555
539
|
return this.show({
|
|
556
540
|
title: 'Error',
|
|
557
541
|
description: `${objectName} Cannot be Saved`,
|
|
@@ -623,22 +607,19 @@ class FlowDialogService {
|
|
|
623
607
|
return dialogFunction(dialog);
|
|
624
608
|
}
|
|
625
609
|
}
|
|
626
|
-
FlowDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService, deps: [{ token: i1.DialogService }, { token: i2.
|
|
610
|
+
FlowDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService, deps: [{ token: i1.DialogService }, { token: i2.RuntimeSettingsService }, { token: i2.FlowInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
627
611
|
FlowDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService });
|
|
628
612
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService, decorators: [{
|
|
629
613
|
type: Injectable
|
|
630
|
-
}], ctorParameters: function () { return [{ type: i1.DialogService }, { type: i2.
|
|
614
|
+
}], ctorParameters: function () { return [{ type: i1.DialogService }, { type: i2.RuntimeSettingsService }, { type: i2.FlowInfoService }]; } });
|
|
631
615
|
|
|
632
616
|
class FlowService {
|
|
633
|
-
constructor(integrationState, flowRouterService,
|
|
617
|
+
constructor(integrationState, flowRouterService, configurationService, configurationStateService, flowDialogService, flowStateService) {
|
|
634
618
|
this.integrationState = integrationState;
|
|
635
619
|
this.flowRouterService = flowRouterService;
|
|
636
|
-
this.quoteDraftService = quoteDraftService;
|
|
637
620
|
this.configurationService = configurationService;
|
|
638
621
|
this.configurationStateService = configurationStateService;
|
|
639
622
|
this.flowDialogService = flowDialogService;
|
|
640
|
-
this.flowConfigurationService = flowConfigurationService;
|
|
641
|
-
this.flowInfoService = flowInfoService;
|
|
642
623
|
this.flowStateService = flowStateService;
|
|
643
624
|
this.cleanup$ = new Subject();
|
|
644
625
|
}
|
|
@@ -648,14 +629,7 @@ class FlowService {
|
|
|
648
629
|
initSubscriptions() {
|
|
649
630
|
this.integrationState
|
|
650
631
|
.listen$(FlowAction.FLOW_CONFIGURE_PRODUCT)
|
|
651
|
-
.pipe(switchMap(payload => {
|
|
652
|
-
var _a, _b;
|
|
653
|
-
if (this.flowInfoService.isLegacy) {
|
|
654
|
-
const productId = (_a = payload.productId) !== null && _a !== void 0 ? _a : (_b = this.quoteDraftService.currentState.find(li => li.id === payload.lineItemId)) === null || _b === void 0 ? void 0 : _b.productId;
|
|
655
|
-
return of(Object.assign(Object.assign({}, payload), { productId }));
|
|
656
|
-
}
|
|
657
|
-
return this.prepareConfiguration$(payload.lineItemId).pipe(map(() => payload));
|
|
658
|
-
}), tap(payload => {
|
|
632
|
+
.pipe(switchMap(payload => this.prepareConfiguration$(payload.lineItemId).pipe(map(() => payload))), tap(payload => {
|
|
659
633
|
if (payload.productId) {
|
|
660
634
|
this.flowRouterService.navigateToProductConfiguration(payload.productId, payload.lineItemId);
|
|
661
635
|
}
|
|
@@ -701,17 +675,10 @@ class FlowService {
|
|
|
701
675
|
.subscribe();
|
|
702
676
|
this.integrationState
|
|
703
677
|
.listen$(FlowAction.FLOW_APPLY_PRODUCT_CONFIGURATION)
|
|
704
|
-
.pipe(switchMap(() => {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
else {
|
|
709
|
-
return this.configurationStateService.saveConfiguration(true).pipe(switchMap(() => this.configurationStateService.cancelConfiguration()), switchMap(() => this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'MODIFY_ASSETS', {
|
|
710
|
-
addConfiguringAssetId: true,
|
|
711
|
-
enable: true,
|
|
712
|
-
})));
|
|
713
|
-
}
|
|
714
|
-
}), tap(() => {
|
|
678
|
+
.pipe(switchMap(() => this.configurationStateService.saveConfiguration()), switchMap(() => this.configurationStateService.cancelConfiguration()), switchMap(() => this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'MODIFY_ASSETS', {
|
|
679
|
+
addConfiguringAssetId: true,
|
|
680
|
+
enable: true,
|
|
681
|
+
})), tap(() => {
|
|
715
682
|
this.configurationService.hasUnsavedChanges = false;
|
|
716
683
|
this.flowRouterService.navigateToShoppingCart();
|
|
717
684
|
}), takeUntil(this.cleanup$))
|
|
@@ -735,28 +702,12 @@ class FlowService {
|
|
|
735
702
|
lineItemId,
|
|
736
703
|
});
|
|
737
704
|
}
|
|
738
|
-
legacyApplyConfiguration() {
|
|
739
|
-
const quoteDraft = this.quoteDraftService.quoteDraft;
|
|
740
|
-
const lineItem = this.configurationService.getSnapshot();
|
|
741
|
-
if (!quoteDraft || !lineItem) {
|
|
742
|
-
return of(undefined);
|
|
743
|
-
}
|
|
744
|
-
const isNewLineItem = quoteDraft.currentState.every(li => li.id !== lineItem.id);
|
|
745
|
-
let updatedState;
|
|
746
|
-
if (isNewLineItem) {
|
|
747
|
-
updatedState = [...quoteDraft.currentState, lineItem];
|
|
748
|
-
}
|
|
749
|
-
else {
|
|
750
|
-
updatedState = quoteDraft.currentState.map(li => (li.id === lineItem.id ? lineItem : li));
|
|
751
|
-
}
|
|
752
|
-
return this.flowConfigurationService.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }));
|
|
753
|
-
}
|
|
754
705
|
}
|
|
755
|
-
FlowService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowService, deps: [{ token: i5.IntegrationState }, { token: FlowRouterService }, { token: i2.
|
|
706
|
+
FlowService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowService, deps: [{ token: i5.IntegrationState }, { token: FlowRouterService }, { token: i2.ConfigurationService }, { token: i2.ConfigurationStateService }, { token: FlowDialogService }, { token: i2.FlowStateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
756
707
|
FlowService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowService });
|
|
757
708
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowService, decorators: [{
|
|
758
709
|
type: Injectable
|
|
759
|
-
}], ctorParameters: function () { return [{ type: i5.IntegrationState }, { type: FlowRouterService }, { type: i2.
|
|
710
|
+
}], ctorParameters: function () { return [{ type: i5.IntegrationState }, { type: FlowRouterService }, { type: i2.ConfigurationService }, { type: i2.ConfigurationStateService }, { type: FlowDialogService }, { type: i2.FlowStateService }]; } });
|
|
760
711
|
|
|
761
712
|
class FlowGuidedSellingService {
|
|
762
713
|
constructor(integrationState) {
|
|
@@ -787,14 +738,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
787
738
|
}], ctorParameters: function () { return [{ type: i2.IntegrationState }]; } });
|
|
788
739
|
|
|
789
740
|
class FlowComponent {
|
|
790
|
-
constructor(routerService, flowService,
|
|
741
|
+
constructor(routerService, flowService, flowInfoService, guidedSellingService) {
|
|
791
742
|
this.routerService = routerService;
|
|
792
743
|
this.flowService = flowService;
|
|
793
|
-
this.
|
|
744
|
+
this.flowInfoService = flowInfoService;
|
|
794
745
|
this.guidedSellingService = guidedSellingService;
|
|
795
746
|
this.isLoading$ = this.routerService.loading$;
|
|
796
|
-
this.showHeader$ = combineLatest([this.routerService.route$, this.
|
|
797
|
-
this.isStandalone$ = this.
|
|
747
|
+
this.showHeader$ = combineLatest([this.routerService.route$, this.flowInfoService.flow$]).pipe(map(([route, flow]) => route.data['showHeader'] && !(flow === null || flow === void 0 ? void 0 : flow.properties.standalone)));
|
|
748
|
+
this.isStandalone$ = this.flowInfoService.flow$.pipe(map(flow => Boolean(flow === null || flow === void 0 ? void 0 : flow.properties.standalone)));
|
|
798
749
|
this.guidedSellingVisible$ = this.guidedSellingService.isVisible$;
|
|
799
750
|
this.flowService.initSubscriptions();
|
|
800
751
|
}
|
|
@@ -809,128 +760,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
809
760
|
args: [{ selector: 'vl-flow', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-flow-new-header *ngIf=\"showHeader$ | async\"></vl-flow-new-header>\n\n<div class=\"flow-content\">\n <div class=\"loading-overlay\" *ngIf=\"isLoading$ | async\">\n <vl-loader label=\"LOADING\"></vl-loader>\n </div>\n\n <router-outlet></router-outlet>\n\n <div class=\"guided-selling\" [ngClass]=\"{ hidden: (guidedSellingVisible$ | async) === false }\">\n <vl-flow-guided-selling *ngIf=\"(isStandalone$ | async) !== true\"></vl-flow-guided-selling>\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column;width:100%;height:100%}.flow-content{flex-grow:1;position:relative;overflow:hidden}.loading-overlay{position:absolute;height:100%;width:100%;inset:0;background-color:#fff;z-index:999}.guided-selling{position:absolute;top:0;width:100%;height:100%;z-index:100}.hidden{display:none}\n"] }]
|
|
810
761
|
}], ctorParameters: function () { return [{ type: FlowRouterService }, { type: FlowService }, { type: i2.FlowInfoService }, { type: FlowGuidedSellingService }]; } });
|
|
811
762
|
|
|
812
|
-
const getFlowObjectIdPropertyName = (id) => {
|
|
813
|
-
const objectName = SalesforceIdUtils.getSfObjectNameById(id);
|
|
814
|
-
switch (objectName) {
|
|
815
|
-
case 'Account':
|
|
816
|
-
return 'accountId';
|
|
817
|
-
case 'Order':
|
|
818
|
-
return 'orderId';
|
|
819
|
-
case 'Quote':
|
|
820
|
-
default:
|
|
821
|
-
return 'quoteId';
|
|
822
|
-
}
|
|
823
|
-
};
|
|
824
|
-
const getDefaultProperties = (params) => {
|
|
825
|
-
var _a, _b;
|
|
826
|
-
const properties = {};
|
|
827
|
-
let standalone = (_a = params.flowParams) === null || _a === void 0 ? void 0 : _a.standalone;
|
|
828
|
-
if (((_b = params.flowParams) === null || _b === void 0 ? void 0 : _b.entryPath.includes('/product')) || params.mode === ConfigurationContextMode.REMOTE) {
|
|
829
|
-
standalone = standalone !== null && standalone !== void 0 ? standalone : true;
|
|
830
|
-
}
|
|
831
|
-
if (standalone != null) {
|
|
832
|
-
properties.standalone = standalone ? 'true' : 'false';
|
|
833
|
-
}
|
|
834
|
-
return properties;
|
|
835
|
-
};
|
|
836
|
-
|
|
837
|
-
class ContextGuard {
|
|
838
|
-
constructor(router, routerService, contextService, runtimeSettingsService) {
|
|
839
|
-
this.router = router;
|
|
840
|
-
this.routerService = routerService;
|
|
841
|
-
this.contextService = contextService;
|
|
842
|
-
this.runtimeSettingsService = runtimeSettingsService;
|
|
843
|
-
}
|
|
844
|
-
checkActivation(route) {
|
|
845
|
-
const { queryParams } = route;
|
|
846
|
-
const { accountId, quoteId, orderId } = queryParams;
|
|
847
|
-
const rpcMessage = window.RPC_MESSAGE;
|
|
848
|
-
const mode = this.getConfigurationContextMode(accountId, quoteId, orderId, rpcMessage);
|
|
849
|
-
// Restrict if mode is not defined
|
|
850
|
-
if (mode == null) {
|
|
851
|
-
return this.routerService.showErrorPage$('Mode is undefined');
|
|
852
|
-
}
|
|
853
|
-
const headerId = accountId || quoteId || orderId || this.rpcMessageId || 'empty-for-test-mode';
|
|
854
|
-
// Allow if context is already initialized with the same headerId
|
|
855
|
-
if (this.contextService.isInitialized) {
|
|
856
|
-
const currentContext = this.contextService.resolve();
|
|
857
|
-
if (headerId && currentContext.headerId === headerId) {
|
|
858
|
-
return of(true);
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
// Initialize context and runtime settings
|
|
862
|
-
return forkJoin([this.contextService.create(headerId, mode), this.runtimeSettingsService.create()]).pipe(tap(([context]) => {
|
|
863
|
-
this.contextService.update(Object.assign(Object.assign({}, context), { properties: Object.assign(Object.assign(Object.assign({}, context.properties), (queryParams !== null && queryParams !== void 0 ? queryParams : {})), getDefaultProperties({ mode })) }));
|
|
864
|
-
// Init currency settings
|
|
865
|
-
this.runtimeSettingsService.initCurrency(context.properties['CurrencyIsoCode']);
|
|
866
|
-
}), map(() => true), catchError(e => {
|
|
867
|
-
const message = e instanceof HttpErrorResponse ? e.error.message : e;
|
|
868
|
-
const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
|
|
869
|
-
return this.routerService.showErrorPage$(message, errorDetails);
|
|
870
|
-
}));
|
|
871
|
-
}
|
|
872
|
-
canActivate(route) {
|
|
873
|
-
return this.checkActivation(route);
|
|
874
|
-
}
|
|
875
|
-
canActivateChild(childRoute) {
|
|
876
|
-
return this.checkActivation(childRoute);
|
|
877
|
-
}
|
|
878
|
-
get rpcMessageId() {
|
|
879
|
-
var _a, _b;
|
|
880
|
-
if (!window.RPC_MESSAGE) {
|
|
881
|
-
return;
|
|
882
|
-
}
|
|
883
|
-
const rpcMessage = JSON.parse(window.RPC_MESSAGE);
|
|
884
|
-
const veloceReferenceId = (_a = rpcMessage.configuration) === null || _a === void 0 ? void 0 : _a.VeloceReferenceId;
|
|
885
|
-
const quoteId = (_b = rpcMessage.quote) === null || _b === void 0 ? void 0 : _b.Id;
|
|
886
|
-
return veloceReferenceId || quoteId;
|
|
887
|
-
}
|
|
888
|
-
getConfigurationContextMode(accountId, quoteId, orderId, rpcMessage) {
|
|
889
|
-
if (accountId) {
|
|
890
|
-
return ConfigurationContextMode.ACCOUNT;
|
|
891
|
-
}
|
|
892
|
-
if (quoteId) {
|
|
893
|
-
return ConfigurationContextMode.QUOTE;
|
|
894
|
-
}
|
|
895
|
-
if (orderId) {
|
|
896
|
-
return ConfigurationContextMode.ORDER;
|
|
897
|
-
}
|
|
898
|
-
if (rpcMessage) {
|
|
899
|
-
return ConfigurationContextMode.REMOTE;
|
|
900
|
-
}
|
|
901
|
-
return;
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
ContextGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextGuard, deps: [{ token: i1$2.Router }, { token: FlowRouterService }, { token: i2.ContextService }, { token: i2.RuntimeSettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
905
|
-
ContextGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextGuard });
|
|
906
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextGuard, decorators: [{
|
|
907
|
-
type: Injectable
|
|
908
|
-
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i2.ContextService }, { type: i2.RuntimeSettingsService }]; } });
|
|
909
|
-
|
|
910
763
|
const keepFlowInitialized = (route) => {
|
|
911
|
-
const
|
|
764
|
+
const routerService = inject(FlowRouterService);
|
|
765
|
+
const runtimeSettingsService = inject(RuntimeSettingsService);
|
|
912
766
|
const flowState = inject(FlowStateService);
|
|
913
767
|
const flowInfoService = inject(FlowInfoService);
|
|
914
|
-
const routerService = inject(FlowRouterService);
|
|
915
768
|
const quoteDraft = inject(QuoteDraftService);
|
|
769
|
+
const salesTrasnsactionService = inject(SalesTransactionService);
|
|
916
770
|
const configurationService = inject(ConfigurationService);
|
|
917
771
|
const integrationState = inject(IntegrationState);
|
|
918
772
|
const { flowId } = route.queryParams;
|
|
919
|
-
|
|
920
|
-
if (flow && (flow === null || flow === void 0 ? void 0 : flow.id) === flowId) {
|
|
773
|
+
if (flowInfoService.isFlowInitialized && flowInfoService.flow.id === flowId) {
|
|
921
774
|
return true;
|
|
922
775
|
}
|
|
923
776
|
// Cleanup
|
|
924
777
|
flowState.cleanup();
|
|
925
778
|
quoteDraft.reset();
|
|
779
|
+
salesTrasnsactionService.reset();
|
|
926
780
|
configurationService.reset();
|
|
927
781
|
integrationState.clear();
|
|
928
782
|
flowInfoService.cleanup();
|
|
929
|
-
contextService.delete();
|
|
930
783
|
if (!flowId) {
|
|
931
784
|
return true;
|
|
932
785
|
}
|
|
933
|
-
return flowInfoService.init$(flowId, route.queryParams)
|
|
786
|
+
return runtimeSettingsService.create().pipe(tap(() => runtimeSettingsService.initCurrency('USD')), switchMap(() => flowInfoService.init$(flowId, route.queryParams)), map(() => true), catchError(e => {
|
|
787
|
+
console.error(e);
|
|
934
788
|
const message = e instanceof HttpErrorResponse ? e.error.message : e;
|
|
935
789
|
const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
|
|
936
790
|
return routerService.showErrorPage$(message, errorDetails);
|
|
@@ -938,9 +792,8 @@ const keepFlowInitialized = (route) => {
|
|
|
938
792
|
};
|
|
939
793
|
|
|
940
794
|
class ProductUnloadGuard {
|
|
941
|
-
constructor(router,
|
|
795
|
+
constructor(router, quoteDraftService, configurationService, flowDialogService) {
|
|
942
796
|
this.router = router;
|
|
943
|
-
this.contextService = contextService;
|
|
944
797
|
this.quoteDraftService = quoteDraftService;
|
|
945
798
|
this.configurationService = configurationService;
|
|
946
799
|
this.flowDialogService = flowDialogService;
|
|
@@ -953,7 +806,6 @@ class ProductUnloadGuard {
|
|
|
953
806
|
return observable.pipe(map(unload => {
|
|
954
807
|
if (unload) {
|
|
955
808
|
this.configurationService.reset();
|
|
956
|
-
this.contextService.update({ properties: { productId: undefined, lineItemId: undefined } });
|
|
957
809
|
if (!nextState || currentState.url === nextState.url) {
|
|
958
810
|
return true;
|
|
959
811
|
}
|
|
@@ -971,11 +823,11 @@ class ProductUnloadGuard {
|
|
|
971
823
|
}));
|
|
972
824
|
}
|
|
973
825
|
}
|
|
974
|
-
ProductUnloadGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard, deps: [{ token: i1$2.Router }, { token: i2.
|
|
826
|
+
ProductUnloadGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard, deps: [{ token: i1$2.Router }, { token: i2.QuoteDraftService }, { token: i2.ConfigurationService }, { token: FlowDialogService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
975
827
|
ProductUnloadGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard });
|
|
976
828
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard, decorators: [{
|
|
977
829
|
type: Injectable
|
|
978
|
-
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i2.
|
|
830
|
+
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i2.QuoteDraftService }, { type: i2.ConfigurationService }, { type: FlowDialogService }]; } });
|
|
979
831
|
|
|
980
832
|
class RootGuard {
|
|
981
833
|
constructor(router, routerService) {
|
|
@@ -1246,11 +1098,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1246
1098
|
}] });
|
|
1247
1099
|
|
|
1248
1100
|
class DebugComponent {
|
|
1249
|
-
constructor(flowsApiService, router, activatedRoute,
|
|
1101
|
+
constructor(flowsApiService, router, activatedRoute, quoteDraftService) {
|
|
1250
1102
|
this.flowsApiService = flowsApiService;
|
|
1251
1103
|
this.router = router;
|
|
1252
1104
|
this.activatedRoute = activatedRoute;
|
|
1253
|
-
this.context = context;
|
|
1254
1105
|
this.quoteDraftService = quoteDraftService;
|
|
1255
1106
|
this.form = new FormGroup({
|
|
1256
1107
|
id: new FormControl(''),
|
|
@@ -1259,15 +1110,13 @@ class DebugComponent {
|
|
|
1259
1110
|
}
|
|
1260
1111
|
runFlow() {
|
|
1261
1112
|
const { id } = this.form.value;
|
|
1262
|
-
|
|
1263
|
-
if (!id || !objectPropertyName || !this.selectedFlow) {
|
|
1113
|
+
if (!id || !this.selectedFlow) {
|
|
1264
1114
|
return;
|
|
1265
1115
|
}
|
|
1266
1116
|
// Delete context before starting a new flow
|
|
1267
|
-
this.context.delete();
|
|
1268
1117
|
this.quoteDraftService.reset();
|
|
1269
1118
|
this.router.navigate(['..', 'flows'], {
|
|
1270
|
-
queryParams: Object.assign({ flowId: this.selectedFlow.id,
|
|
1119
|
+
queryParams: Object.assign({ flowId: this.selectedFlow.id, headerId: id }, this.selectedFlow.properties.queryParams),
|
|
1271
1120
|
relativeTo: this.activatedRoute,
|
|
1272
1121
|
});
|
|
1273
1122
|
}
|
|
@@ -1275,12 +1124,12 @@ class DebugComponent {
|
|
|
1275
1124
|
return new HttpParams({ fromObject: params }).toString();
|
|
1276
1125
|
}
|
|
1277
1126
|
}
|
|
1278
|
-
DebugComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebugComponent, deps: [{ token: i1$
|
|
1127
|
+
DebugComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebugComponent, deps: [{ token: i1$3.FlowsApiService }, { token: i1$2.Router }, { token: i1$2.ActivatedRoute }, { token: i2.QuoteDraftService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1279
1128
|
DebugComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: DebugComponent, selector: "vl-flow-debug", ngImport: i0, template: "<form [formGroup]=\"form\">\n <div class=\"fields-container\">\n <div class=\"field\">\n <label>SF Object ID</label>\n <input formControlName=\"id\" pInputText type=\"text\" />\n </div>\n </div>\n\n <p-button\n styleClass=\"p-button-primary\"\n label=\"Run Flow\"\n [disabled]=\"!form.value.id || !selectedFlow\"\n (onClick)=\"runFlow()\"\n ></p-button>\n</form>\n\n<table>\n <thead>\n <tr>\n <th [width]=\"30\"></th>\n <th [width]=\"160\">ID</th>\n <th [width]=\"160\">Entry Path</th>\n <th>QueryParams</th>\n <th [width]=\"100\">Standalone</th>\n <th [width]=\"100\">Stateful</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let flow of flows$ | async\" (click)=\"selectedFlow = flow\">\n <td><p-radioButton [inputId]=\"flow.id\" name=\"flow\" [value]=\"flow\" [(ngModel)]=\"selectedFlow\"></p-radioButton></td>\n <td>{{ flow.id }}</td>\n <td>{{ flow.properties.entryPath }}</td>\n <td class=\"cell-query-params\">{{ getQueryParamsString(flow.properties.queryParams) }}</td>\n <td>{{ flow.properties.standalone }}</td>\n <td>{{ flow.properties.stateful }}</td>\n </tr>\n </tbody>\n</table>\n", styles: [":host{display:block;padding:24px 54px}form{display:flex;align-items:center;justify-content:space-between}.fields-container{display:flex;gap:24px}.field{display:flex;flex-direction:column;width:200px;flex-shrink:0}:host ::ng-deep .p-dropdown{width:100%}table{width:100%;border-collapse:collapse;table-layout:fixed}tbody>tr{cursor:pointer}tbody>tr:hover{background-color:#f0f5fa}th{text-align:left;font-weight:600}th,td{padding:0 10px;height:30px;border-bottom:1px solid var(--vl-border-color);margin-right:16px;line-height:18px}.cell-query-params{word-break:break-all}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i5$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i5$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i6.RadioButton, selector: "p-radioButton", inputs: ["value", "formControlName", "name", "disabled", "label", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "style", "styleClass", "labelStyleClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: i8.InputText, selector: "[pInputText]" }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1280
1129
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebugComponent, decorators: [{
|
|
1281
1130
|
type: Component,
|
|
1282
1131
|
args: [{ selector: 'vl-flow-debug', changeDetection: ChangeDetectionStrategy.OnPush, template: "<form [formGroup]=\"form\">\n <div class=\"fields-container\">\n <div class=\"field\">\n <label>SF Object ID</label>\n <input formControlName=\"id\" pInputText type=\"text\" />\n </div>\n </div>\n\n <p-button\n styleClass=\"p-button-primary\"\n label=\"Run Flow\"\n [disabled]=\"!form.value.id || !selectedFlow\"\n (onClick)=\"runFlow()\"\n ></p-button>\n</form>\n\n<table>\n <thead>\n <tr>\n <th [width]=\"30\"></th>\n <th [width]=\"160\">ID</th>\n <th [width]=\"160\">Entry Path</th>\n <th>QueryParams</th>\n <th [width]=\"100\">Standalone</th>\n <th [width]=\"100\">Stateful</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let flow of flows$ | async\" (click)=\"selectedFlow = flow\">\n <td><p-radioButton [inputId]=\"flow.id\" name=\"flow\" [value]=\"flow\" [(ngModel)]=\"selectedFlow\"></p-radioButton></td>\n <td>{{ flow.id }}</td>\n <td>{{ flow.properties.entryPath }}</td>\n <td class=\"cell-query-params\">{{ getQueryParamsString(flow.properties.queryParams) }}</td>\n <td>{{ flow.properties.standalone }}</td>\n <td>{{ flow.properties.stateful }}</td>\n </tr>\n </tbody>\n</table>\n", styles: [":host{display:block;padding:24px 54px}form{display:flex;align-items:center;justify-content:space-between}.fields-container{display:flex;gap:24px}.field{display:flex;flex-direction:column;width:200px;flex-shrink:0}:host ::ng-deep .p-dropdown{width:100%}table{width:100%;border-collapse:collapse;table-layout:fixed}tbody>tr{cursor:pointer}tbody>tr:hover{background-color:#f0f5fa}th{text-align:left;font-weight:600}th,td{padding:0 10px;height:30px;border-bottom:1px solid var(--vl-border-color);margin-right:16px;line-height:18px}.cell-query-params{word-break:break-all}\n"] }]
|
|
1283
|
-
}], ctorParameters: function () { return [{ type: i1$
|
|
1132
|
+
}], ctorParameters: function () { return [{ type: i1$3.FlowsApiService }, { type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: i2.QuoteDraftService }]; } });
|
|
1284
1133
|
|
|
1285
1134
|
const routes$1 = [{ path: '', component: DebugComponent }];
|
|
1286
1135
|
class DebugModule {
|
|
@@ -1318,102 +1167,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1318
1167
|
}] });
|
|
1319
1168
|
|
|
1320
1169
|
class ProductComponent {
|
|
1321
|
-
constructor(
|
|
1322
|
-
|
|
1323
|
-
|
|
1170
|
+
constructor(
|
|
1171
|
+
// private configurationRuntimeService: ConfigurationRuntimeService,
|
|
1172
|
+
configurationService, configurationStateService, salesTransactionService, flowInfoService, integrationState, uiDefinitionsApiService, customizationService) {
|
|
1324
1173
|
this.configurationService = configurationService;
|
|
1325
1174
|
this.configurationStateService = configurationStateService;
|
|
1326
|
-
this.
|
|
1175
|
+
this.salesTransactionService = salesTransactionService;
|
|
1327
1176
|
this.flowInfoService = flowInfoService;
|
|
1328
|
-
this.flowStateService = flowStateService;
|
|
1329
1177
|
this.integrationState = integrationState;
|
|
1178
|
+
this.uiDefinitionsApiService = uiDefinitionsApiService;
|
|
1330
1179
|
this.customizationService = customizationService;
|
|
1331
|
-
this.
|
|
1180
|
+
this.uiDefinitionContainer$ = new BehaviorSubject(null);
|
|
1332
1181
|
this.config = {
|
|
1333
1182
|
init$: () => this.init$(),
|
|
1334
1183
|
};
|
|
1335
1184
|
}
|
|
1336
1185
|
customizeUI$() {
|
|
1337
|
-
var _a
|
|
1338
|
-
const { productId } =
|
|
1339
|
-
if (!productId || !((
|
|
1186
|
+
var _a;
|
|
1187
|
+
const { productId } = this.flowInfoService.context;
|
|
1188
|
+
if (!productId || !((_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getUiDefinition)) {
|
|
1340
1189
|
return of(undefined);
|
|
1341
1190
|
}
|
|
1342
1191
|
return this.customizationService.getUiDefinition(productId).pipe(map(uiDefinitionContainer => {
|
|
1343
|
-
|
|
1344
|
-
|
|
1192
|
+
this.uiDefinitionContainer$.next(uiDefinitionContainer);
|
|
1193
|
+
}));
|
|
1194
|
+
}
|
|
1195
|
+
fetchUIDefinition$() {
|
|
1196
|
+
const flowContext = this.flowInfoService.context;
|
|
1197
|
+
if (flowContext.requiredUIDefinitionId) {
|
|
1198
|
+
return this.uiDefinitionsApiService
|
|
1199
|
+
.fetchUIDefinition$(flowContext.requiredUIDefinitionId)
|
|
1200
|
+
.pipe(map((uiDefContainer) => this.uiDefinitionContainer$.next(uiDefContainer)));
|
|
1201
|
+
}
|
|
1202
|
+
return this.uiDefinitionsApiService
|
|
1203
|
+
.fetchUIDefinitions$({
|
|
1204
|
+
productId: flowContext.productId,
|
|
1205
|
+
defaultUIDefinitionId: flowContext.defaultUIDefinitionId,
|
|
1206
|
+
})
|
|
1207
|
+
.pipe(map((uiDefinitionContainers) => {
|
|
1208
|
+
const uiDefContainer = uiDefinitionContainers[0];
|
|
1209
|
+
if (uiDefContainer) {
|
|
1210
|
+
this.uiDefinitionContainer$.next(uiDefContainer);
|
|
1345
1211
|
}
|
|
1346
1212
|
}));
|
|
1347
1213
|
}
|
|
1348
1214
|
init$() {
|
|
1349
|
-
let
|
|
1350
|
-
if (
|
|
1351
|
-
|
|
1215
|
+
let state$;
|
|
1216
|
+
if (!this.flowInfoService.isStateful) {
|
|
1217
|
+
state$ = this.salesTransactionService.state$;
|
|
1352
1218
|
}
|
|
1353
1219
|
else {
|
|
1354
|
-
|
|
1220
|
+
state$ = of(undefined);
|
|
1355
1221
|
}
|
|
1356
|
-
return
|
|
1357
|
-
|
|
1358
|
-
const contextProperties = this.contextService.resolve().properties;
|
|
1359
|
-
const productId = (_a = contextProperties.productId) !== null && _a !== void 0 ? _a : (_b = this.flowInfoService.flow) === null || _b === void 0 ? void 0 : _b.properties.queryParams['productId'];
|
|
1360
|
-
const defaultUIDefinitionId = (_c = this.flowInfoService.flow) === null || _c === void 0 ? void 0 : _c.properties.queryParams['defaultUIDefinitionId'];
|
|
1361
|
-
const requiredUIDefinitionId = (_d = this.flowInfoService.flow) === null || _d === void 0 ? void 0 : _d.properties.queryParams['requiredUIDefinitionId'];
|
|
1362
|
-
if (!productId) {
|
|
1222
|
+
return state$.pipe(first(), tap(() => {
|
|
1223
|
+
if (!this.flowInfoService.context.productId) {
|
|
1363
1224
|
throw new Error(`Unable to start configuration for 'productId == null'`);
|
|
1364
1225
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
return this.configurationRuntimeService.init({ productId, offeringId });
|
|
1368
|
-
}
|
|
1369
|
-
const lineItem = this.getLineItem(quote, productId, contextProperties.lineItemId);
|
|
1370
|
-
if (lineItem) {
|
|
1371
|
-
this.configurationService.setConfigurableRamp(lineItem);
|
|
1372
|
-
}
|
|
1373
|
-
const { offeringId } = lineItem !== null && lineItem !== void 0 ? lineItem : {};
|
|
1374
|
-
return this.configurationRuntimeService.init({
|
|
1375
|
-
productId,
|
|
1376
|
-
offeringId,
|
|
1377
|
-
defaultUIDefinitionId,
|
|
1378
|
-
requiredUIDefinitionId,
|
|
1379
|
-
});
|
|
1380
|
-
}), switchMap(() => this.customizeUI$()), tap(() => {
|
|
1381
|
-
var _a, _b;
|
|
1382
|
-
const uiDefinition = (_b = (_a = this.configurationRuntimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) === null || _b === void 0 ? void 0 : _b.source;
|
|
1383
|
-
if (uiDefinition) {
|
|
1384
|
-
this.uiDefinition$.next(uiDefinition);
|
|
1385
|
-
}
|
|
1386
|
-
else {
|
|
1226
|
+
}), switchMap(() => this.customizeUI$()), switchMap(() => (this.uiDefinitionContainer$.value ? of(undefined) : this.fetchUIDefinition$())), tap(() => {
|
|
1227
|
+
if (!this.uiDefinitionContainer$.value) {
|
|
1387
1228
|
throw new Error('Product does not have Configuration UI');
|
|
1388
1229
|
}
|
|
1389
|
-
}),
|
|
1390
|
-
|
|
1391
|
-
this.configurationRuntimeService.initializationProps.attributesMap =
|
|
1392
|
-
this.integrationState.state.guidedSelling;
|
|
1393
|
-
}
|
|
1394
|
-
}), switchMap(() => this.configurationStateService.init$()));
|
|
1395
|
-
}
|
|
1396
|
-
getLineItem(quote, productId, lineItemId) {
|
|
1397
|
-
var _a;
|
|
1398
|
-
// search by lineItemId first
|
|
1399
|
-
let li = quote.currentState.find(li => li.id === lineItemId);
|
|
1400
|
-
if (!li && this.quoteDraftService.isStandalone) {
|
|
1401
|
-
li = quote.currentState.find(li => li.productId === productId);
|
|
1402
|
-
}
|
|
1403
|
-
// If still not found, is could be an asset
|
|
1404
|
-
if (!li) {
|
|
1405
|
-
li = (_a = this.quoteDraftService.assetsState) === null || _a === void 0 ? void 0 : _a.currentState.find(li => li.id === lineItemId);
|
|
1406
|
-
}
|
|
1407
|
-
return li;
|
|
1230
|
+
}), switchMap(() => this.configurationStateService.init$()), switchMap(() => timer(1)), // wait until updates inputs on child components
|
|
1231
|
+
map(noop));
|
|
1408
1232
|
}
|
|
1409
1233
|
}
|
|
1410
|
-
ProductComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductComponent, deps: [{ token: i2.
|
|
1411
|
-
ProductComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ProductComponent, selector: "vl-flow-product", ngImport: i0, template: "<vl-cms-preview [uiDefinition]=\"
|
|
1234
|
+
ProductComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductComponent, deps: [{ token: i2.ConfigurationService }, { token: i2.ConfigurationStateService }, { token: i2.SalesTransactionService }, { token: i2.FlowInfoService }, { token: i2.IntegrationState }, { token: i1$1.UIDefinitionsApiService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
1235
|
+
ProductComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ProductComponent, selector: "vl-flow-product", ngImport: i0, template: "<vl-cms-preview [uiDefinition]=\"(uiDefinitionContainer$ | async)?.source\" [config]=\"config\"></vl-cms-preview>\n", styles: [""], dependencies: [{ kind: "component", type: i5.PreviewComponent, selector: "vl-cms-preview", inputs: ["uiDefinition", "config"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1412
1236
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductComponent, decorators: [{
|
|
1413
1237
|
type: Component,
|
|
1414
|
-
args: [{ selector: 'vl-flow-product', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-cms-preview [uiDefinition]=\"
|
|
1238
|
+
args: [{ selector: 'vl-flow-product', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-cms-preview [uiDefinition]=\"(uiDefinitionContainer$ | async)?.source\" [config]=\"config\"></vl-cms-preview>\n" }]
|
|
1415
1239
|
}], ctorParameters: function () {
|
|
1416
|
-
return [{ type: i2.
|
|
1240
|
+
return [{ type: i2.ConfigurationService }, { type: i2.ConfigurationStateService }, { type: i2.SalesTransactionService }, { type: i2.FlowInfoService }, { type: i2.IntegrationState }, { type: i1$1.UIDefinitionsApiService }, { type: undefined, decorators: [{
|
|
1417
1241
|
type: Optional
|
|
1418
1242
|
}, {
|
|
1419
1243
|
type: Inject,
|
|
@@ -1424,13 +1248,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1424
1248
|
class ProductModule {
|
|
1425
1249
|
}
|
|
1426
1250
|
ProductModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1427
|
-
ProductModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, declarations: [ProductComponent], imports: [CommonModule, PreviewModule, LoaderModule], exports: [ProductComponent] });
|
|
1428
|
-
ProductModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, imports: [CommonModule, PreviewModule, LoaderModule] });
|
|
1251
|
+
ProductModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, declarations: [ProductComponent], imports: [CommonModule, PreviewModule, LoaderModule, LetDirectiveModule], exports: [ProductComponent] });
|
|
1252
|
+
ProductModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, imports: [CommonModule, PreviewModule, LoaderModule, LetDirectiveModule] });
|
|
1429
1253
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, decorators: [{
|
|
1430
1254
|
type: NgModule,
|
|
1431
1255
|
args: [{
|
|
1432
1256
|
declarations: [ProductComponent],
|
|
1433
|
-
imports: [CommonModule, PreviewModule, LoaderModule],
|
|
1257
|
+
imports: [CommonModule, PreviewModule, LoaderModule, LetDirectiveModule],
|
|
1434
1258
|
exports: [ProductComponent],
|
|
1435
1259
|
}]
|
|
1436
1260
|
}] });
|
|
@@ -1472,357 +1296,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1472
1296
|
}]
|
|
1473
1297
|
}] });
|
|
1474
1298
|
|
|
1475
|
-
class RemoteComponent {
|
|
1476
|
-
constructor(contextService, quoteDraftService, runtimeService, configurationService, configurationState, messageService, integrationState, location) {
|
|
1477
|
-
this.contextService = contextService;
|
|
1478
|
-
this.quoteDraftService = quoteDraftService;
|
|
1479
|
-
this.runtimeService = runtimeService;
|
|
1480
|
-
this.configurationService = configurationService;
|
|
1481
|
-
this.configurationState = configurationState;
|
|
1482
|
-
this.messageService = messageService;
|
|
1483
|
-
this.integrationState = integrationState;
|
|
1484
|
-
this.location = location;
|
|
1485
|
-
this.state$ = new BehaviorSubject({ loading: true, failure: false });
|
|
1486
|
-
this.DYNAMIC_OPTION_PRODUCTS_KEY = 'Dynamic';
|
|
1487
|
-
this.destroyed$ = new Subject();
|
|
1488
|
-
this.rpcMessage = JSON.parse(window.RPC_MESSAGE);
|
|
1489
|
-
this.rpcMessage.options.sort((a, b) => { var _a, _b; return ((_a = a.featureNumber) !== null && _a !== void 0 ? _a : 99999) - ((_b = b.featureNumber) !== null && _b !== void 0 ? _b : 99999); });
|
|
1490
|
-
this.updateHasChildrenFlag(this.rpcMessage.product.configuredProductId);
|
|
1491
|
-
// update context properties
|
|
1492
|
-
if (this.rpcMessage.quote) {
|
|
1493
|
-
const properties = {};
|
|
1494
|
-
if (this.rpcMessage.quote['SBQQ__Opportunity2__c']) {
|
|
1495
|
-
properties.OpportunityId = this.rpcMessage.quote['SBQQ__Opportunity2__c'];
|
|
1496
|
-
}
|
|
1497
|
-
Object.entries(this.rpcMessage.quote).forEach(([key, value]) => {
|
|
1498
|
-
if (value !== undefined && !(value instanceof Object)) {
|
|
1499
|
-
properties[key] = value;
|
|
1500
|
-
}
|
|
1501
|
-
});
|
|
1502
|
-
this.contextService.update({ properties });
|
|
1503
|
-
}
|
|
1504
|
-
this.initSubscriptions();
|
|
1505
|
-
this.initConfiguration();
|
|
1506
|
-
}
|
|
1507
|
-
ngOnDestroy() {
|
|
1508
|
-
this.destroyed$.next();
|
|
1509
|
-
this.destroyed$.complete();
|
|
1510
|
-
}
|
|
1511
|
-
initConfiguration() {
|
|
1512
|
-
const productId = this.rpcMessage.product.configuredProductId;
|
|
1513
|
-
const quote = this.quoteDraftService.quoteDraft;
|
|
1514
|
-
if (!productId || !quote) {
|
|
1515
|
-
return;
|
|
1516
|
-
}
|
|
1517
|
-
this.runtimeService
|
|
1518
|
-
.init({ productId })
|
|
1519
|
-
.pipe(first(), tap(context => {
|
|
1520
|
-
var _a, _b, _c, _d;
|
|
1521
|
-
const uiDefinitionProperties = (_b = (_a = context.uiDefinitionContainer) === null || _a === void 0 ? void 0 : _a.source.properties) !== null && _b !== void 0 ? _b : {};
|
|
1522
|
-
this.uiDefinition = (_c = context.uiDefinitionContainer) === null || _c === void 0 ? void 0 : _c.source;
|
|
1523
|
-
const pricingEnabled = uiDefinitionProperties.pricingEnabled ? 'true' : 'false';
|
|
1524
|
-
const priceListId = uiDefinitionProperties.priceList;
|
|
1525
|
-
const runtimeContextProperties = (_d = this.runtimeService.runtimeContext) === null || _d === void 0 ? void 0 : _d.properties;
|
|
1526
|
-
if (runtimeContextProperties) {
|
|
1527
|
-
runtimeContextProperties.PriceListId = priceListId;
|
|
1528
|
-
runtimeContextProperties.PricingEnabled = pricingEnabled;
|
|
1529
|
-
}
|
|
1530
|
-
this.contextService.update({
|
|
1531
|
-
properties: {
|
|
1532
|
-
ModelId: context.modelId,
|
|
1533
|
-
RuntimeMode: 'TEST',
|
|
1534
|
-
PricingEnabled: pricingEnabled,
|
|
1535
|
-
PriceListId: priceListId,
|
|
1536
|
-
},
|
|
1537
|
-
});
|
|
1538
|
-
this.configurationService.setConfigurableRamp(this.createLineItem());
|
|
1539
|
-
}), this.throwIfNoUIDefinition(), switchMap(() => this.configurationState.init$()), tap(() => this.state$.next({ loading: false, failure: false })), catchError(error => {
|
|
1540
|
-
var _a, _b;
|
|
1541
|
-
if (!((_b = (_a = this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
|
|
1542
|
-
this.messageService.add({ severity: 'error', summary: error });
|
|
1543
|
-
}
|
|
1544
|
-
this.state$.next({ loading: false, failure: true });
|
|
1545
|
-
return of();
|
|
1546
|
-
}), takeUntil(this.destroyed$))
|
|
1547
|
-
.subscribe();
|
|
1548
|
-
}
|
|
1549
|
-
throwIfNoUIDefinition() {
|
|
1550
|
-
return (source$) => {
|
|
1551
|
-
return source$.pipe(switchMap(() => {
|
|
1552
|
-
if (!this.uiDefinition) {
|
|
1553
|
-
return throwError(() => 'Product does not have Configuration UI');
|
|
1554
|
-
}
|
|
1555
|
-
return source$;
|
|
1556
|
-
}));
|
|
1557
|
-
};
|
|
1558
|
-
}
|
|
1559
|
-
initSubscriptions() {
|
|
1560
|
-
this.integrationState
|
|
1561
|
-
.listen$(FlowAction.REMOTE_CANCEL)
|
|
1562
|
-
.pipe(tap(() => this.location.back()), takeUntil(this.destroyed$))
|
|
1563
|
-
.subscribe();
|
|
1564
|
-
this.integrationState
|
|
1565
|
-
.listen$(FlowAction.REMOTE_APPLY)
|
|
1566
|
-
.pipe(tap(() => this.saveRpcMessage()), takeUntil(this.destroyed$))
|
|
1567
|
-
.subscribe();
|
|
1568
|
-
}
|
|
1569
|
-
createLineItem() {
|
|
1570
|
-
var _a, _b;
|
|
1571
|
-
const [quoteDraftLineItem] = (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
|
1572
|
-
if (quoteDraftLineItem && (quoteDraftLineItem.attributes.length > 0 || quoteDraftLineItem.lineItems.length > 0)) {
|
|
1573
|
-
return quoteDraftLineItem;
|
|
1574
|
-
}
|
|
1575
|
-
const lineItem = this.createRootLineItem();
|
|
1576
|
-
const dynamicOptionProducts = this.rpcMessage.product.optionConfigurations[this.DYNAMIC_OPTION_PRODUCTS_KEY];
|
|
1577
|
-
if (dynamicOptionProducts) {
|
|
1578
|
-
const options = this.toParentChildMap(dynamicOptionProducts);
|
|
1579
|
-
let items = [lineItem];
|
|
1580
|
-
for (let i = 0; i < items.length; i++) {
|
|
1581
|
-
const item = items[i];
|
|
1582
|
-
const children = item && options.get(item.id);
|
|
1583
|
-
if (children) {
|
|
1584
|
-
item.lineItems = children;
|
|
1585
|
-
items = items.concat(children);
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
}
|
|
1589
|
-
return lineItem;
|
|
1590
|
-
}
|
|
1591
|
-
createRootLineItem() {
|
|
1592
|
-
var _a, _b, _c, _d;
|
|
1593
|
-
const product = this.rpcMessage.product;
|
|
1594
|
-
const runtimeContext = this.runtimeService.runtimeContext;
|
|
1595
|
-
const veloceInstanceId = product.configurationAttributes['VeloceInstanceId__c'];
|
|
1596
|
-
const quoteId = (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
1597
|
-
return {
|
|
1598
|
-
id: quoteId || veloceInstanceId || UUID.UUID(),
|
|
1599
|
-
type: (_c = runtimeContext.productType) !== null && _c !== void 0 ? _c : '',
|
|
1600
|
-
name: ((_d = runtimeContext.properties) === null || _d === void 0 ? void 0 : _d['displayName']) || runtimeContext.productName,
|
|
1601
|
-
productName: runtimeContext.productName,
|
|
1602
|
-
productId: runtimeContext.productId,
|
|
1603
|
-
cfgStatus: 'Default',
|
|
1604
|
-
actionCode: 'ADD',
|
|
1605
|
-
qty: 1,
|
|
1606
|
-
};
|
|
1607
|
-
}
|
|
1608
|
-
toParentChildMap(remoteOptionProducts) {
|
|
1609
|
-
var _a;
|
|
1610
|
-
const result = new Map();
|
|
1611
|
-
for (const option of remoteOptionProducts) {
|
|
1612
|
-
const configurationData = (_a = option === null || option === void 0 ? void 0 : option.readOnly) === null || _a === void 0 ? void 0 : _a.line;
|
|
1613
|
-
const id = configurationData === null || configurationData === void 0 ? void 0 : configurationData.VeloceInstanceId__c;
|
|
1614
|
-
const parentId = configurationData === null || configurationData === void 0 ? void 0 : configurationData.VeloceParentInstanceId__c;
|
|
1615
|
-
if (!option.selected || !configurationData || !id || !parentId) {
|
|
1616
|
-
continue;
|
|
1617
|
-
}
|
|
1618
|
-
const productId = option.productId;
|
|
1619
|
-
const lineItem = {
|
|
1620
|
-
id,
|
|
1621
|
-
productId,
|
|
1622
|
-
parentId,
|
|
1623
|
-
type: configurationData.ModelType__c,
|
|
1624
|
-
port: configurationData.ModelPort__c,
|
|
1625
|
-
cfgStatus: configurationData.ConfigurationStatus__c,
|
|
1626
|
-
actionCode: configurationData.ActionCode__c,
|
|
1627
|
-
qty: option.Quantity,
|
|
1628
|
-
};
|
|
1629
|
-
let siblings = result.get(productId);
|
|
1630
|
-
if (!siblings) {
|
|
1631
|
-
result.set(parentId, (siblings = []));
|
|
1632
|
-
}
|
|
1633
|
-
siblings.push(lineItem);
|
|
1634
|
-
}
|
|
1635
|
-
return result;
|
|
1636
|
-
}
|
|
1637
|
-
saveRpcMessage() {
|
|
1638
|
-
var _a;
|
|
1639
|
-
const quote = this.quoteDraftService.quoteDraft;
|
|
1640
|
-
const lineItem = this.configurationService.getSnapshot();
|
|
1641
|
-
if (!quote || !lineItem) {
|
|
1642
|
-
return;
|
|
1643
|
-
}
|
|
1644
|
-
this.rpcMessage.VeloceReferenceId = quote.quoteId;
|
|
1645
|
-
this.rpcMessage.product.configurationData.VeloceInstanceId__c = lineItem.id;
|
|
1646
|
-
const childItems = this.flattenChildLineItems(lineItem);
|
|
1647
|
-
const savingMode = window.SavingMode;
|
|
1648
|
-
this.updateContentData(this.rpcMessage.product, lineItem);
|
|
1649
|
-
this.rpcMessage.quote = this.mapAttributesTo('Quote', lineItem);
|
|
1650
|
-
if (savingMode === 'ALL') {
|
|
1651
|
-
const optionConfigurations = this.getOptionConfigurations(this.rpcMessage.product);
|
|
1652
|
-
const rootProductOptions = this.rpcMessage.options.filter(po => po.configuredProductId === lineItem.productId);
|
|
1653
|
-
childItems.forEach(lineItem => {
|
|
1654
|
-
var _a, _b, _c, _d;
|
|
1655
|
-
const rootOption = rootProductOptions.find(po => po.optionalProductId === lineItem.productId);
|
|
1656
|
-
if (rootOption) {
|
|
1657
|
-
const featureOptions = (_a = optionConfigurations[rootOption.featureName]) !== null && _a !== void 0 ? _a : (optionConfigurations[rootOption.featureName] = []);
|
|
1658
|
-
const originOption = !rootOption.hasChildren
|
|
1659
|
-
? (_b = optionConfigurations[rootOption.featureName]) === null || _b === void 0 ? void 0 : _b.find(({ optionId }) => optionId === rootOption.optionId)
|
|
1660
|
-
: undefined;
|
|
1661
|
-
const option = originOption !== null && originOption !== void 0 ? originOption : {};
|
|
1662
|
-
option.optionId = (_c = option.optionId) !== null && _c !== void 0 ? _c : rootOption.optionId;
|
|
1663
|
-
this.updateContentData(option, lineItem);
|
|
1664
|
-
option.index = (_d = option.index) !== null && _d !== void 0 ? _d : featureOptions.length;
|
|
1665
|
-
option.selected = true;
|
|
1666
|
-
if (!originOption) {
|
|
1667
|
-
featureOptions.push(option);
|
|
1668
|
-
}
|
|
1669
|
-
if (lineItem.parentLineItem) {
|
|
1670
|
-
const nestedProductOption = this.rpcMessage.options.find(po => {
|
|
1671
|
-
var _a;
|
|
1672
|
-
return po.configuredProductId === ((_a = lineItem.parentLineItem) === null || _a === void 0 ? void 0 : _a.productId) &&
|
|
1673
|
-
po.optionalProductId === lineItem.productId;
|
|
1674
|
-
});
|
|
1675
|
-
if (nestedProductOption) {
|
|
1676
|
-
option.configurationData = Object.assign(Object.assign({}, option.configurationData), { VeloceParentInstanceId__c: lineItem.parentLineItem.id, VeloceNestedOptionId__c: nestedProductOption.optionId, VeloceNestedFeatureId__c: nestedProductOption.featureId });
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
}
|
|
1680
|
-
else {
|
|
1681
|
-
this.rpcMessage.dynamicFeatures.forEach(feature => {
|
|
1682
|
-
var _a, _b;
|
|
1683
|
-
const featureOptions = (_a = optionConfigurations[feature.name]) !== null && _a !== void 0 ? _a : (optionConfigurations[feature.name] = []);
|
|
1684
|
-
const originOption = featureOptions.find(({ productId }) => productId === lineItem.productId);
|
|
1685
|
-
const option = originOption !== null && originOption !== void 0 ? originOption : {};
|
|
1686
|
-
this.updateContentData(option, lineItem);
|
|
1687
|
-
option.index = (_b = option.index) !== null && _b !== void 0 ? _b : featureOptions.length;
|
|
1688
|
-
option.selected = true;
|
|
1689
|
-
if (!originOption) {
|
|
1690
|
-
featureOptions.push(option);
|
|
1691
|
-
}
|
|
1692
|
-
});
|
|
1693
|
-
}
|
|
1694
|
-
});
|
|
1695
|
-
this.rpcMessage.product = Object.assign(Object.assign({}, this.rpcMessage.product), { optionConfigurations });
|
|
1696
|
-
}
|
|
1697
|
-
(_a = window.RPC_BROADCAST) === null || _a === void 0 ? void 0 : _a.apply(null, [this.rpcMessage]);
|
|
1698
|
-
}
|
|
1699
|
-
updateHasChildrenFlag(bundleProductId) {
|
|
1700
|
-
const bundleOptionsByOptionId = {};
|
|
1701
|
-
const notBundleOptions = [];
|
|
1702
|
-
for (const productOption of this.rpcMessage.options) {
|
|
1703
|
-
if (productOption.configuredProductId === bundleProductId) {
|
|
1704
|
-
bundleOptionsByOptionId[productOption.optionalProductId] = productOption;
|
|
1705
|
-
}
|
|
1706
|
-
else {
|
|
1707
|
-
notBundleOptions.push(productOption);
|
|
1708
|
-
}
|
|
1709
|
-
}
|
|
1710
|
-
for (const option of notBundleOptions) {
|
|
1711
|
-
const bundleOption = bundleOptionsByOptionId[option.configuredProductId];
|
|
1712
|
-
if (bundleOption) {
|
|
1713
|
-
bundleOption.hasChildren = true;
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
flattenChildLineItems(lineItem) {
|
|
1718
|
-
var _a;
|
|
1719
|
-
let items = (_a = lineItem.lineItems) !== null && _a !== void 0 ? _a : [];
|
|
1720
|
-
for (let i = 0; i < items.length; i++) {
|
|
1721
|
-
const item = items[i];
|
|
1722
|
-
if (item === null || item === void 0 ? void 0 : item.lineItems) {
|
|
1723
|
-
items = items.concat(item.lineItems.map(li => (Object.assign(Object.assign({}, li), { parentLineItem: item }))));
|
|
1724
|
-
}
|
|
1725
|
-
}
|
|
1726
|
-
return items;
|
|
1727
|
-
}
|
|
1728
|
-
updateContentData(entity, lineItem) {
|
|
1729
|
-
var _a, _b;
|
|
1730
|
-
if (lineItem.productId) {
|
|
1731
|
-
entity.productId = lineItem.productId;
|
|
1732
|
-
}
|
|
1733
|
-
const quantityAttribute = lineItem.properties['quantityAttribute'];
|
|
1734
|
-
entity.Quantity = quantityAttribute
|
|
1735
|
-
? (_b = (_a = lineItem.attributes.find(attribute => attribute.name === quantityAttribute)) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 1
|
|
1736
|
-
: lineItem.qty;
|
|
1737
|
-
const totalPrice = this.computeNetPrice(lineItem);
|
|
1738
|
-
const targetTotalPriceField = lineItem.properties['TargetTotalPriceField'] || 'TotalPrice__c';
|
|
1739
|
-
entity.configurationData[targetTotalPriceField] = entity.configurationData[targetTotalPriceField]
|
|
1740
|
-
? entity.configurationData[targetTotalPriceField] + totalPrice
|
|
1741
|
-
: totalPrice;
|
|
1742
|
-
const targetPriceField = lineItem.properties['TargetPriceField'] || 'SBQQ__ListPrice__c';
|
|
1743
|
-
const price = entity.Quantity != null ? entity.configurationData[targetTotalPriceField] / entity.Quantity || 0 : 0;
|
|
1744
|
-
const targetPriceValue = Number(entity.configurationData[targetPriceField]) || 0;
|
|
1745
|
-
entity.configurationData[targetPriceField] = targetPriceValue
|
|
1746
|
-
? (targetPriceValue + price).toFixed(2)
|
|
1747
|
-
: price.toFixed(2);
|
|
1748
|
-
entity.configurationAttributes = this.mapAttributesTo('Attribute', lineItem);
|
|
1749
|
-
entity.configurationData = Object.assign(Object.assign(Object.assign(Object.assign({}, entity.configurationData), this.mapAttributesTo('Field', lineItem)), this.mapAttributesTo('', lineItem)), { VeloceInstanceId__c: lineItem.id });
|
|
1750
|
-
}
|
|
1751
|
-
computeNetPrice(lineItem) {
|
|
1752
|
-
if (lineItem.properties['GroupCharges']) {
|
|
1753
|
-
return this.sumNetPrice(lineItem.chargeGroupItems, this.getChargeNameSet(lineItem.properties['GroupCharges']));
|
|
1754
|
-
}
|
|
1755
|
-
return this.sumNetPrice(lineItem.chargeItems, this.getChargeNameSet(lineItem.properties['Charges']));
|
|
1756
|
-
}
|
|
1757
|
-
getChargeNameSet(property) {
|
|
1758
|
-
if (property && property.length > 0) {
|
|
1759
|
-
return new Set(property.split(','));
|
|
1760
|
-
}
|
|
1761
|
-
return new Set();
|
|
1762
|
-
}
|
|
1763
|
-
sumNetPrice(chargeItems, charges) {
|
|
1764
|
-
var _a;
|
|
1765
|
-
let netPrice = 0;
|
|
1766
|
-
for (const chargeItem of chargeItems) {
|
|
1767
|
-
if (!charges || charges.has(chargeItem.chargeType)) {
|
|
1768
|
-
netPrice += (_a = chargeItem.netPrice) !== null && _a !== void 0 ? _a : 0;
|
|
1769
|
-
}
|
|
1770
|
-
}
|
|
1771
|
-
return netPrice;
|
|
1772
|
-
}
|
|
1773
|
-
mapAttributesTo(target, lineItem) {
|
|
1774
|
-
var _a;
|
|
1775
|
-
const result = {};
|
|
1776
|
-
const component = (_a = this.runtimeService.runtimeModel) === null || _a === void 0 ? void 0 : _a.components.get(lineItem.type);
|
|
1777
|
-
if (!component) {
|
|
1778
|
-
return result;
|
|
1779
|
-
}
|
|
1780
|
-
const propertyName = 'mapTo' + target;
|
|
1781
|
-
component.attributes
|
|
1782
|
-
.filter(a => a.properties && a.properties[propertyName])
|
|
1783
|
-
.forEach(mapping => {
|
|
1784
|
-
var _a;
|
|
1785
|
-
const attribute = lineItem.attributes.find(a => a.name === mapping.name);
|
|
1786
|
-
if (attribute) {
|
|
1787
|
-
new Set((_a = mapping.properties[propertyName]) === null || _a === void 0 ? void 0 : _a.split(',')).forEach(k => (result[k] = attribute.value));
|
|
1788
|
-
}
|
|
1789
|
-
});
|
|
1790
|
-
return result;
|
|
1791
|
-
}
|
|
1792
|
-
getOptionConfigurations(product) {
|
|
1793
|
-
var _a;
|
|
1794
|
-
const optionConfigurations = {};
|
|
1795
|
-
const requestOptionConfigurations = (_a = product.optionConfigurations) !== null && _a !== void 0 ? _a : {};
|
|
1796
|
-
Object.keys(requestOptionConfigurations).forEach(k => {
|
|
1797
|
-
var _a;
|
|
1798
|
-
optionConfigurations[k] = ((_a = requestOptionConfigurations[k]) !== null && _a !== void 0 ? _a : []).map(opt => {
|
|
1799
|
-
return Object.assign(Object.assign({}, opt), { selected: false });
|
|
1800
|
-
});
|
|
1801
|
-
});
|
|
1802
|
-
return optionConfigurations;
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
RemoteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteComponent, deps: [{ token: i2.ContextService }, { token: i2.QuoteDraftService }, { token: i2.ConfigurationRuntimeService }, { token: i2.ConfigurationService }, { token: i2.ConfigurationStateService }, { token: i2$2.MessageService }, { token: i2.IntegrationState }, { token: i4.Location }], target: i0.ɵɵFactoryTarget.Component });
|
|
1806
|
-
RemoteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: RemoteComponent, selector: "vl-flow-remote", ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.PreviewComponent, selector: "vl-cms-preview", inputs: ["uiDefinition", "config"] }, { kind: "component", type: i2$1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1807
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteComponent, decorators: [{
|
|
1808
|
-
type: Component,
|
|
1809
|
-
args: [{ selector: 'vl-flow-remote', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n </ng-container>\n </ng-template>\n</ng-container>\n" }]
|
|
1810
|
-
}], ctorParameters: function () { return [{ type: i2.ContextService }, { type: i2.QuoteDraftService }, { type: i2.ConfigurationRuntimeService }, { type: i2.ConfigurationService }, { type: i2.ConfigurationStateService }, { type: i2$2.MessageService }, { type: i2.IntegrationState }, { type: i4.Location }]; } });
|
|
1811
|
-
|
|
1812
|
-
class RemoteModule {
|
|
1813
|
-
}
|
|
1814
|
-
RemoteModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1815
|
-
RemoteModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, declarations: [RemoteComponent], imports: [CommonModule, PreviewModule, LoaderModule], exports: [RemoteComponent] });
|
|
1816
|
-
RemoteModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, imports: [CommonModule, PreviewModule, LoaderModule] });
|
|
1817
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, decorators: [{
|
|
1818
|
-
type: NgModule,
|
|
1819
|
-
args: [{
|
|
1820
|
-
declarations: [RemoteComponent],
|
|
1821
|
-
imports: [CommonModule, PreviewModule, LoaderModule],
|
|
1822
|
-
exports: [RemoteComponent],
|
|
1823
|
-
}]
|
|
1824
|
-
}] });
|
|
1825
|
-
|
|
1826
1299
|
class ShoppingCartComponent {
|
|
1827
1300
|
constructor(templatesApi, cdr, toastService, flowInfo, customizationService) {
|
|
1828
1301
|
var _a, _b, _c;
|
|
@@ -1938,24 +1411,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1938
1411
|
}] });
|
|
1939
1412
|
|
|
1940
1413
|
class FlowResolver {
|
|
1941
|
-
constructor(router, routerService,
|
|
1414
|
+
constructor(router, routerService, flowInfoService) {
|
|
1942
1415
|
this.router = router;
|
|
1943
1416
|
this.routerService = routerService;
|
|
1944
|
-
this.
|
|
1945
|
-
this.flowInfo = flowInfo;
|
|
1417
|
+
this.flowInfoService = flowInfoService;
|
|
1946
1418
|
}
|
|
1947
1419
|
resolve(route) {
|
|
1948
|
-
|
|
1949
|
-
const flow = this.flowInfo.flow;
|
|
1950
|
-
if (!flow) {
|
|
1420
|
+
if (!this.flowInfoService.isFlowInitialized) {
|
|
1951
1421
|
return of(false);
|
|
1952
1422
|
}
|
|
1953
|
-
const {
|
|
1423
|
+
const { queryParams } = route;
|
|
1424
|
+
const { properties } = this.flowInfoService.flow;
|
|
1954
1425
|
const { queryParams: flowQueryParams, entryPath } = properties;
|
|
1955
1426
|
const mergedQueryParams = Object.assign(Object.assign({}, queryParams), flowQueryParams);
|
|
1956
|
-
const contextProperties = Object.entries(Object.assign(Object.assign({}, mergedQueryParams), getDefaultProperties({ flowParams: properties }))).reduce((trunk, [key, value]) => (Object.assign(Object.assign({}, trunk), { [key]: String(value) })), {});
|
|
1957
|
-
this.contextService.update({ properties: contextProperties });
|
|
1958
|
-
this.flowInfo.flow = flow;
|
|
1959
1427
|
const parentUrl = this.routerService.getFlowRootPath(route);
|
|
1960
1428
|
const entryUrl = String(entryPath !== null && entryPath !== void 0 ? entryPath : '')
|
|
1961
1429
|
.split('/')
|
|
@@ -1964,29 +1432,29 @@ class FlowResolver {
|
|
|
1964
1432
|
queryParams: mergedQueryParams,
|
|
1965
1433
|
replaceUrl: true,
|
|
1966
1434
|
})).pipe(catchError$1(e => {
|
|
1435
|
+
console.error(e);
|
|
1967
1436
|
const message = e instanceof HttpErrorResponse ? e.error.message : e;
|
|
1968
1437
|
const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
|
|
1969
1438
|
return this.routerService.showErrorPage$(message, errorDetails);
|
|
1970
1439
|
}));
|
|
1971
1440
|
}
|
|
1972
1441
|
}
|
|
1973
|
-
FlowResolver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowResolver, deps: [{ token: i1$2.Router }, { token: FlowRouterService }, { token: i2.
|
|
1442
|
+
FlowResolver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowResolver, deps: [{ token: i1$2.Router }, { token: FlowRouterService }, { token: i2.FlowInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1974
1443
|
FlowResolver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowResolver });
|
|
1975
1444
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowResolver, decorators: [{
|
|
1976
1445
|
type: Injectable
|
|
1977
|
-
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i2.
|
|
1446
|
+
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i2.FlowInfoService }]; } });
|
|
1978
1447
|
|
|
1979
1448
|
class QuoteResolver {
|
|
1980
|
-
constructor(router, quoteDraftService, routerService,
|
|
1449
|
+
constructor(router, quoteDraftService, routerService, flowInfoService, flowStateService) {
|
|
1981
1450
|
this.router = router;
|
|
1982
1451
|
this.quoteDraftService = quoteDraftService;
|
|
1983
1452
|
this.routerService = routerService;
|
|
1984
|
-
this.
|
|
1985
|
-
this.flowInfo = flowInfo;
|
|
1453
|
+
this.flowInfoService = flowInfoService;
|
|
1986
1454
|
this.flowStateService = flowStateService;
|
|
1987
1455
|
}
|
|
1988
1456
|
resolve(route) {
|
|
1989
|
-
const flow = this.
|
|
1457
|
+
const flow = this.flowInfoService.flow;
|
|
1990
1458
|
if (!flow) {
|
|
1991
1459
|
return of(false);
|
|
1992
1460
|
}
|
|
@@ -1994,13 +1462,14 @@ class QuoteResolver {
|
|
|
1994
1462
|
return of(true);
|
|
1995
1463
|
}
|
|
1996
1464
|
return this.flowStateService.init$().pipe(switchMap(() => this.checkDynamicNavigation$(route)), catchError(e => {
|
|
1465
|
+
console.error(e);
|
|
1997
1466
|
const message = e instanceof HttpErrorResponse ? e.error.message : e;
|
|
1998
1467
|
const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
|
|
1999
1468
|
return this.routerService.showErrorPage$(message, errorDetails);
|
|
2000
1469
|
}));
|
|
2001
1470
|
}
|
|
2002
1471
|
checkDynamicNavigation$(route) {
|
|
2003
|
-
const flow = this.
|
|
1472
|
+
const flow = this.flowInfoService.flow;
|
|
2004
1473
|
if (!flow) {
|
|
2005
1474
|
return of(true);
|
|
2006
1475
|
}
|
|
@@ -2019,7 +1488,7 @@ class QuoteResolver {
|
|
|
2019
1488
|
}));
|
|
2020
1489
|
}
|
|
2021
1490
|
getNavigateTo() {
|
|
2022
|
-
const flow = this.
|
|
1491
|
+
const flow = this.flowInfoService.flow;
|
|
2023
1492
|
let navigateTo;
|
|
2024
1493
|
if (flow === null || flow === void 0 ? void 0 : flow.properties.stateful) {
|
|
2025
1494
|
return this.flowStateService.select$(UITemplateType.FLOW_ENGINE, 'NAVIGATE_TO').pipe(map(r => {
|
|
@@ -2030,7 +1499,7 @@ class QuoteResolver {
|
|
|
2030
1499
|
}));
|
|
2031
1500
|
}
|
|
2032
1501
|
else {
|
|
2033
|
-
const isAccountMode = this.
|
|
1502
|
+
const isAccountMode = this.flowInfoService.context.mode === ConfigurationContextMode.ACCOUNT;
|
|
2034
1503
|
if (isAccountMode || this.quoteDraftService.hasAssets) {
|
|
2035
1504
|
navigateTo = '/assets';
|
|
2036
1505
|
}
|
|
@@ -2041,11 +1510,11 @@ class QuoteResolver {
|
|
|
2041
1510
|
return of(navigateTo);
|
|
2042
1511
|
}
|
|
2043
1512
|
}
|
|
2044
|
-
QuoteResolver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteResolver, deps: [{ token: i1$2.Router }, { token: i2.QuoteDraftService }, { token: FlowRouterService }, { token: i2.
|
|
1513
|
+
QuoteResolver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteResolver, deps: [{ token: i1$2.Router }, { token: i2.QuoteDraftService }, { token: FlowRouterService }, { token: i2.FlowInfoService }, { token: i2.FlowStateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2045
1514
|
QuoteResolver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteResolver });
|
|
2046
1515
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteResolver, decorators: [{
|
|
2047
1516
|
type: Injectable
|
|
2048
|
-
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i2.QuoteDraftService }, { type: FlowRouterService }, { type: i2.
|
|
1517
|
+
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i2.QuoteDraftService }, { type: FlowRouterService }, { type: i2.FlowInfoService }, { type: i2.FlowStateService }]; } });
|
|
2049
1518
|
|
|
2050
1519
|
const rootRoute = {
|
|
2051
1520
|
id: VELOCE_FLOW_ROOT_ROUTE,
|
|
@@ -2063,7 +1532,6 @@ const rootRoute = {
|
|
|
2063
1532
|
path: 'flows',
|
|
2064
1533
|
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
|
|
2065
1534
|
resolve: { flow: FlowResolver },
|
|
2066
|
-
canActivate: [ContextGuard],
|
|
2067
1535
|
children: [],
|
|
2068
1536
|
},
|
|
2069
1537
|
{
|
|
@@ -2071,7 +1539,6 @@ const rootRoute = {
|
|
|
2071
1539
|
component: ProductComponent,
|
|
2072
1540
|
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
|
|
2073
1541
|
resolve: { quote: QuoteResolver },
|
|
2074
|
-
canActivate: [ContextGuard],
|
|
2075
1542
|
canDeactivate: [ProductUnloadGuard],
|
|
2076
1543
|
data: { showHeader: true },
|
|
2077
1544
|
},
|
|
@@ -2080,7 +1547,6 @@ const rootRoute = {
|
|
|
2080
1547
|
component: ShoppingCartComponent,
|
|
2081
1548
|
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
|
|
2082
1549
|
resolve: { quote: QuoteResolver },
|
|
2083
|
-
canActivate: [ContextGuard],
|
|
2084
1550
|
data: { showHeader: true },
|
|
2085
1551
|
},
|
|
2086
1552
|
{
|
|
@@ -2088,7 +1554,6 @@ const rootRoute = {
|
|
|
2088
1554
|
component: CatalogComponent,
|
|
2089
1555
|
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
|
|
2090
1556
|
resolve: { quote: QuoteResolver },
|
|
2091
|
-
canActivate: [ContextGuard],
|
|
2092
1557
|
data: { showHeader: true },
|
|
2093
1558
|
},
|
|
2094
1559
|
{
|
|
@@ -2096,16 +1561,8 @@ const rootRoute = {
|
|
|
2096
1561
|
component: AssetsComponent,
|
|
2097
1562
|
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
|
|
2098
1563
|
resolve: { quote: QuoteResolver },
|
|
2099
|
-
canActivate: [ContextGuard],
|
|
2100
1564
|
data: { showHeader: true },
|
|
2101
1565
|
},
|
|
2102
|
-
{
|
|
2103
|
-
path: 'remote',
|
|
2104
|
-
component: RemoteComponent,
|
|
2105
|
-
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
|
|
2106
|
-
resolve: { quote: QuoteResolver },
|
|
2107
|
-
canActivate: [ContextGuard],
|
|
2108
|
-
},
|
|
2109
1566
|
{
|
|
2110
1567
|
path: 'debug',
|
|
2111
1568
|
loadChildren: () => DebugModule,
|
|
@@ -2121,30 +1578,14 @@ const rootRoute = {
|
|
|
2121
1578
|
class FlowRoutingModule {
|
|
2122
1579
|
}
|
|
2123
1580
|
FlowRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2124
|
-
FlowRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, imports: [i1$2.RouterModule, ProductModule,
|
|
2125
|
-
|
|
2126
|
-
CatalogModule,
|
|
2127
|
-
AssetsModule,
|
|
2128
|
-
RemoteModule], exports: [RouterModule] });
|
|
2129
|
-
FlowRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, providers: [FlowRouterService, RootGuard, ContextGuard, ProductUnloadGuard, FlowResolver, QuoteResolver], imports: [RouterModule.forChild([rootRoute]),
|
|
2130
|
-
ProductModule,
|
|
2131
|
-
ShoppingCartModule,
|
|
2132
|
-
CatalogModule,
|
|
2133
|
-
AssetsModule,
|
|
2134
|
-
RemoteModule, RouterModule] });
|
|
1581
|
+
FlowRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, imports: [i1$2.RouterModule, ProductModule, ShoppingCartModule, CatalogModule, AssetsModule], exports: [RouterModule] });
|
|
1582
|
+
FlowRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, providers: [FlowRouterService, RootGuard, ProductUnloadGuard, FlowResolver, QuoteResolver], imports: [RouterModule.forChild([rootRoute]), ProductModule, ShoppingCartModule, CatalogModule, AssetsModule, RouterModule] });
|
|
2135
1583
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, decorators: [{
|
|
2136
1584
|
type: NgModule,
|
|
2137
1585
|
args: [{
|
|
2138
|
-
imports: [
|
|
2139
|
-
RouterModule.forChild([rootRoute]),
|
|
2140
|
-
ProductModule,
|
|
2141
|
-
ShoppingCartModule,
|
|
2142
|
-
CatalogModule,
|
|
2143
|
-
AssetsModule,
|
|
2144
|
-
RemoteModule,
|
|
2145
|
-
],
|
|
1586
|
+
imports: [RouterModule.forChild([rootRoute]), ProductModule, ShoppingCartModule, CatalogModule, AssetsModule],
|
|
2146
1587
|
exports: [RouterModule],
|
|
2147
|
-
providers: [FlowRouterService, RootGuard,
|
|
1588
|
+
providers: [FlowRouterService, RootGuard, ProductUnloadGuard, FlowResolver, QuoteResolver],
|
|
2148
1589
|
}]
|
|
2149
1590
|
}] });
|
|
2150
1591
|
|
|
@@ -2192,9 +1633,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2192
1633
|
}]
|
|
2193
1634
|
}] });
|
|
2194
1635
|
|
|
1636
|
+
const getFlowObjectIdPropertyName = (id) => {
|
|
1637
|
+
const objectName = SalesforceIdUtils.getSfObjectNameById(id);
|
|
1638
|
+
switch (objectName) {
|
|
1639
|
+
case 'Account':
|
|
1640
|
+
return 'accountId';
|
|
1641
|
+
case 'Order':
|
|
1642
|
+
return 'orderId';
|
|
1643
|
+
case 'Quote':
|
|
1644
|
+
default:
|
|
1645
|
+
return 'quoteId';
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
|
|
2195
1649
|
/**
|
|
2196
1650
|
* Generated bundle index. Do not edit.
|
|
2197
1651
|
*/
|
|
2198
1652
|
|
|
2199
|
-
export {
|
|
1653
|
+
export { FlowDialogService, FlowModule, FlowRouterService, FlowService, VELOCE_FLOW_ROOT_ROUTE, getFlowObjectIdPropertyName };
|
|
2200
1654
|
//# sourceMappingURL=veloceapps-sdk.mjs.map
|