@veloceapps/sdk 11.0.0-2 → 11.0.0-20
Sign up to get free protection for your applications and to get access to all the features.
- package/cms/cms.actions.d.ts +92 -29
- package/cms/components/element-renderer/element-renderer.component.d.ts +3 -10
- package/cms/services/element-context.service.d.ts +0 -1
- package/cms/types/common.types.d.ts +2 -0
- package/cms/types/index.d.ts +0 -1
- package/cms/utils/path.utils.d.ts +1 -2
- package/cms/vendor-map.d.ts +19 -40
- package/core/index.d.ts +0 -1
- package/core/modules/configuration/index.d.ts +1 -4
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +3 -22
- package/core/modules/configuration/services/configuration-state.service.d.ts +8 -8
- package/core/modules/configuration/services/configuration.service.d.ts +23 -47
- package/core/modules/flow-configuration/index.d.ts +0 -3
- package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +10 -39
- package/core/services/catalog-products.service.d.ts +11 -0
- package/core/services/flow-info.service.d.ts +25 -11
- package/core/services/flow-state-configuration.service.d.ts +2 -8
- package/core/services/flow-state.service.d.ts +13 -22
- package/core/services/index.d.ts +2 -3
- package/core/services/integration.state.d.ts +1 -1
- package/core/services/sales-transaction.service.d.ts +30 -0
- package/core/types/flow-state.types.d.ts +2 -2
- package/core/types/index.d.ts +0 -1
- package/core/utils/index.d.ts +2 -2
- package/core/utils/transaction-item.utils.d.ts +7 -0
- package/core/utils/transaction-item.worker.d.ts +8 -0
- package/esm2020/cms/cms.actions.mjs +93 -71
- package/esm2020/cms/cms.default.mjs +2 -3
- package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +7 -64
- package/esm2020/cms/components/preview/preview.component.mjs +3 -3
- package/esm2020/cms/services/element-context.service.mjs +1 -1
- package/esm2020/cms/types/common.types.mjs +1 -1
- package/esm2020/cms/types/index.mjs +1 -2
- package/esm2020/cms/utils/element.utils.mjs +3 -3
- package/esm2020/cms/utils/path.utils.mjs +1 -10
- package/esm2020/cms/vendor-map.mjs +12 -17
- package/esm2020/core/core.module.mjs +9 -7
- package/esm2020/core/index.mjs +1 -2
- package/esm2020/core/modules/configuration/configuration.module.mjs +3 -4
- package/esm2020/core/modules/configuration/index.mjs +2 -5
- package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +9 -102
- package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +60 -76
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +96 -225
- package/esm2020/core/modules/flow-configuration/flow-configuration.module.mjs +3 -4
- package/esm2020/core/modules/flow-configuration/index.mjs +1 -4
- package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +33 -126
- package/esm2020/core/services/catalog-products.service.mjs +25 -0
- package/esm2020/core/services/flow-info.service.mjs +77 -29
- package/esm2020/core/services/flow-state-configuration.service.mjs +10 -25
- package/esm2020/core/services/flow-state.service.mjs +62 -169
- package/esm2020/core/services/index.mjs +3 -4
- package/esm2020/core/services/integration.state.mjs +2 -2
- package/esm2020/core/services/sales-transaction.service.mjs +68 -0
- package/esm2020/core/types/flow-state.types.mjs +1 -1
- package/esm2020/core/types/index.mjs +1 -2
- package/esm2020/core/utils/index.mjs +3 -3
- package/esm2020/core/utils/transaction-item.utils.mjs +60 -0
- package/esm2020/core/utils/transaction-item.worker.mjs +16 -0
- 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 +11 -41
- package/esm2020/src/flow.component.mjs +5 -5
- package/esm2020/src/guards/flow.guard.mjs +13 -14
- package/esm2020/src/guards/product-unload.guard.mjs +7 -9
- package/esm2020/src/index.mjs +1 -3
- 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 +12 -21
- package/esm2020/src/pages/product/product.component.mjs +12 -82
- package/esm2020/src/pages/product/product.module.mjs +5 -5
- package/esm2020/src/pages/record-not-found/record-not-found.component.mjs +5 -6
- 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/sales-transaction.resolver.mjs +83 -0
- package/esm2020/src/resolvers/ui-definition.resolver.mjs +42 -0
- package/esm2020/src/services/flow-dialog.service.mjs +8 -8
- package/esm2020/src/services/flow-router.service.mjs +16 -33
- package/esm2020/src/services/flow.service.mjs +13 -54
- package/esm2020/src/types/index.mjs +2 -3
- package/esm2020/src/types/route.types.mjs +1 -1
- package/fesm2015/veloceapps-sdk-cms.mjs +126 -268
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +712 -1644
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +167 -758
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +114 -262
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +758 -1725
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +167 -752
- 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 +5 -6
- package/src/index.d.ts +0 -2
- 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 +1 -4
- package/src/pages/product/product.component.d.ts +5 -14
- package/src/pages/product/product.module.d.ts +1 -1
- package/src/pages/record-not-found/record-not-found.component.d.ts +2 -3
- package/src/pages/shopping-cart/shopping-cart.component.d.ts +1 -1
- package/src/resolvers/flow.resolver.d.ts +5 -6
- package/src/resolvers/sales-transaction.resolver.d.ts +18 -0
- package/src/resolvers/ui-definition.resolver.d.ts +3 -0
- package/src/services/flow-dialog.service.d.ts +5 -4
- package/src/services/flow-router.service.d.ts +4 -6
- package/src/services/flow.service.d.ts +2 -7
- package/src/types/index.d.ts +1 -2
- package/src/types/route.types.d.ts +0 -5
- package/cms/plugins/configuration.plugin.d.ts +0 -23
- package/cms/types/configuration.types.d.ts +0 -21
- package/core/modules/configuration/helpers.d.ts +0 -6
- package/core/modules/configuration/services/runtime-context.service.d.ts +0 -12
- package/core/modules/configuration/types/configuration-runtime.types.d.ts +0 -6
- package/core/modules/flow-configuration/services/flow-update.service.d.ts +0 -13
- package/core/modules/flow-configuration/types/update.types.d.ts +0 -12
- package/core/services/context.service.d.ts +0 -23
- package/core/services/quote-draft.service.d.ts +0 -50
- package/core/types/runtime.types.d.ts +0 -30
- package/core/utils/line-item.utils.d.ts +0 -25
- package/core/utils/line-item.worker.d.ts +0 -9
- package/esm2020/cms/plugins/configuration.plugin.mjs +0 -109
- package/esm2020/cms/types/configuration.types.mjs +0 -2
- package/esm2020/core/modules/configuration/helpers.mjs +0 -73
- package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +0 -43
- package/esm2020/core/modules/configuration/types/configuration-runtime.types.mjs +0 -2
- package/esm2020/core/modules/flow-configuration/services/flow-update.service.mjs +0 -138
- package/esm2020/core/modules/flow-configuration/types/update.types.mjs +0 -2
- package/esm2020/core/services/context.service.mjs +0 -91
- package/esm2020/core/services/quote-draft.service.mjs +0 -192
- package/esm2020/core/types/runtime.types.mjs +0 -16
- package/esm2020/core/utils/line-item.utils.mjs +0 -187
- package/esm2020/core/utils/line-item.worker.mjs +0 -19
- 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/esm2020/src/resolvers/quote.resolver.mjs +0 -82
- package/esm2020/src/types/context-route.types.mjs +0 -2
- package/esm2020/src/types/metrics.types.mjs +0 -2
- package/esm2020/src/utils/flow.utils.mjs +0 -25
- package/esm2020/src/utils/index.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
- package/src/resolvers/quote.resolver.d.ts +0 -19
- package/src/types/context-route.types.d.ts +0 -5
- package/src/types/metrics.types.d.ts +0 -5
- package/src/utils/flow.utils.d.ts +0 -8
- package/src/utils/index.d.ts +0 -1
@@ -2,31 +2,32 @@ 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
|
-
import * as i2
|
7
|
+
import * as i2 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
|
-
import * as
|
12
|
-
import { FLOW_CUSTOMIZATION,
|
11
|
+
import * as i3$1 from '@veloceapps/sdk/core';
|
12
|
+
import { FLOW_CUSTOMIZATION, RuntimeSettingsService, FlowStateService, FlowInfoService, SalesTransactionService, ConfigurationService, IntegrationState, ConfigurationRuntimeService, 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
|
16
|
+
import * as i1$1 from '@veloceapps/api/v2';
|
17
|
+
import { UIDefinitionsApiService } from '@veloceapps/api/v2';
|
18
|
+
import { BehaviorSubject, Subject, filter, first, tap, takeUntil, catchError, of, map, switchMap, shareReplay, startWith, distinctUntilChanged, from, take, combineLatest } from 'rxjs';
|
17
19
|
import { DomHandler } from 'primeng/dom';
|
18
20
|
import * as i1$2 from '@angular/router';
|
19
21
|
import { NavigationEnd, NavigationStart, NavigationCancel, NavigationError, RouterModule } from '@angular/router';
|
20
|
-
import { mapShoppingCartSettings, getMaxRenewalTermsValue,
|
22
|
+
import { mapShoppingCartSettings, getMaxRenewalTermsValue, SalesforceIdUtils, UITemplateType, isVeloceError, extractErrorDetails } from '@veloceapps/core';
|
21
23
|
import { HttpErrorResponse, HttpParams } from '@angular/common/http';
|
22
|
-
import * as
|
24
|
+
import * as i4$1 from '@angular/forms';
|
23
25
|
import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
24
26
|
import { DropdownModule } from 'primeng/dropdown';
|
25
|
-
import * as
|
27
|
+
import * as i7 from 'primeng/inputtext';
|
26
28
|
import { InputTextModule } from 'primeng/inputtext';
|
27
|
-
import * as
|
29
|
+
import * as i5$1 from 'primeng/radiobutton';
|
28
30
|
import { RadioButtonModule } from 'primeng/radiobutton';
|
29
|
-
import * as i2$2 from 'primeng/api';
|
30
31
|
import { catchError as catchError$1 } from 'rxjs/operators';
|
31
32
|
|
32
33
|
const VELOCE_FLOW_ROOT_ROUTE = 'VELOCE_FLOW_ROOT_ROUTE';
|
@@ -97,9 +98,6 @@ class FlowHeaderComponent {
|
|
97
98
|
}
|
98
99
|
initialize() {
|
99
100
|
this.templateApiName = this.flowInfo.flow?.properties.templates?.flowHeader ?? '';
|
100
|
-
if (this.flowInfo.isLegacy && !this.templateApiName) {
|
101
|
-
return;
|
102
|
-
}
|
103
101
|
this.generateUIDefinition$()
|
104
102
|
.pipe(tap(uiDef => {
|
105
103
|
if (!uiDef) {
|
@@ -162,12 +160,12 @@ class FlowHeaderComponent {
|
|
162
160
|
}));
|
163
161
|
}
|
164
162
|
}
|
165
|
-
FlowHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowHeaderComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token:
|
163
|
+
FlowHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowHeaderComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token: i3$1.FlowStateService }, { token: i3$1.FlowInfoService }, { token: i2.ToastService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
166
164
|
FlowHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: FlowHeaderComponent, selector: "vl-flow-new-header", ngImport: i0, template: "<ng-container *ngIf=\"uiDefinition$ | async as uiDefinition\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n</ng-container>\n", styles: [":host,vl-cms-preview{display:contents}\n"], 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: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
167
165
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowHeaderComponent, decorators: [{
|
168
166
|
type: Component,
|
169
167
|
args: [{ selector: 'vl-flow-new-header', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"uiDefinition$ | async as uiDefinition\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n</ng-container>\n", styles: [":host,vl-cms-preview{display:contents}\n"] }]
|
170
|
-
}], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type:
|
168
|
+
}], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type: i3$1.FlowStateService }, { type: i3$1.FlowInfoService }, { type: i2.ToastService }, { type: undefined, decorators: [{
|
171
169
|
type: Optional
|
172
170
|
}, {
|
173
171
|
type: Inject,
|
@@ -210,9 +208,6 @@ class GuidedSellingComponent {
|
|
210
208
|
}
|
211
209
|
initialize() {
|
212
210
|
this.templateApiName = this.flowInfo.flow?.properties.templates?.guidedSelling ?? '';
|
213
|
-
if (this.flowInfo.isLegacy && !this.templateApiName) {
|
214
|
-
return;
|
215
|
-
}
|
216
211
|
this.generateUIDefinition$()
|
217
212
|
.pipe(tap(uiDef => {
|
218
213
|
if (!uiDef) {
|
@@ -275,12 +270,12 @@ class GuidedSellingComponent {
|
|
275
270
|
}));
|
276
271
|
}
|
277
272
|
}
|
278
|
-
GuidedSellingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token:
|
273
|
+
GuidedSellingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token: i3$1.FlowStateService }, { token: i3$1.FlowInfoService }, { token: i2.ToastService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
279
274
|
GuidedSellingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GuidedSellingComponent, selector: "vl-flow-guided-selling", ngImport: i0, template: "<ng-container *ngIf=\"uiDefinition$ | async as uiDefinition\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n</ng-container>\n", styles: [":host,vl-cms-preview{display:contents}\n"], 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: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
280
275
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingComponent, decorators: [{
|
281
276
|
type: Component,
|
282
277
|
args: [{ selector: 'vl-flow-guided-selling', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"uiDefinition$ | async as uiDefinition\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n</ng-container>\n", styles: [":host,vl-cms-preview{display:contents}\n"] }]
|
283
|
-
}], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type:
|
278
|
+
}], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type: i3$1.FlowStateService }, { type: i3$1.FlowInfoService }, { type: i2.ToastService }, { type: undefined, decorators: [{
|
284
279
|
type: Optional
|
285
280
|
}, {
|
286
281
|
type: Inject,
|
@@ -334,10 +329,10 @@ const configurePrimengShadowDOM = () => {
|
|
334
329
|
};
|
335
330
|
|
336
331
|
class FlowDialogService {
|
337
|
-
constructor(dialogService,
|
332
|
+
constructor(dialogService, runtimeSettings, flowInfoService) {
|
338
333
|
this.dialogService = dialogService;
|
339
|
-
this.contextService = contextService;
|
340
334
|
this.runtimeSettings = runtimeSettings;
|
335
|
+
this.flowInfoService = flowInfoService;
|
341
336
|
}
|
342
337
|
show(config) {
|
343
338
|
return this.dialogService.open(FlowDialogComponent, {
|
@@ -358,8 +353,8 @@ class FlowDialogService {
|
|
358
353
|
});
|
359
354
|
}
|
360
355
|
showReadonlyModeDialog() {
|
361
|
-
const
|
362
|
-
const objectName =
|
356
|
+
const mode = this.flowInfoService.context.mode;
|
357
|
+
const objectName = mode ? mode[0]?.toUpperCase() + mode.substring(1).toLowerCase() : 'Object';
|
363
358
|
return this.show({
|
364
359
|
title: 'Error',
|
365
360
|
description: `${objectName} Cannot be Saved`,
|
@@ -431,20 +426,18 @@ class FlowDialogService {
|
|
431
426
|
return dialogFunction(dialog);
|
432
427
|
}
|
433
428
|
}
|
434
|
-
FlowDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService, deps: [{ token: i1.DialogService }, { token:
|
429
|
+
FlowDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService, deps: [{ token: i1.DialogService }, { token: i3$1.RuntimeSettingsService }, { token: i3$1.FlowInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
|
435
430
|
FlowDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService });
|
436
431
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService, decorators: [{
|
437
432
|
type: Injectable
|
438
|
-
}], ctorParameters: function () { return [{ type: i1.DialogService }, { type:
|
433
|
+
}], ctorParameters: function () { return [{ type: i1.DialogService }, { type: i3$1.RuntimeSettingsService }, { type: i3$1.FlowInfoService }]; } });
|
439
434
|
|
440
435
|
class FlowRouterService {
|
441
|
-
constructor(router, route,
|
436
|
+
constructor(router, route, integrationState, flowInfoService) {
|
442
437
|
this.router = router;
|
443
438
|
this.route = route;
|
444
|
-
this.contextService = contextService;
|
445
439
|
this.integrationState = integrationState;
|
446
440
|
this.flowInfoService = flowInfoService;
|
447
|
-
this.flowStateService = flowStateService;
|
448
441
|
this.urlHistory = [];
|
449
442
|
this.getLastChildRoute = (route) => {
|
450
443
|
return route.firstChild ? this.getLastChildRoute(route.firstChild) : route;
|
@@ -538,7 +531,7 @@ class FlowRouterService {
|
|
538
531
|
this.router.navigateByUrl(prevUrl);
|
539
532
|
}
|
540
533
|
}
|
541
|
-
navigateTo(path, productId,
|
534
|
+
navigateTo(path, productId, transactionItemId) {
|
542
535
|
if (path === 'shopping-cart') {
|
543
536
|
this.navigateToShoppingCart();
|
544
537
|
}
|
@@ -549,31 +542,16 @@ class FlowRouterService {
|
|
549
542
|
this.navigateToAssets();
|
550
543
|
}
|
551
544
|
else if (path === 'product' && productId) {
|
552
|
-
this.navigateToProductConfiguration(productId,
|
545
|
+
this.navigateToProductConfiguration(productId, transactionItemId);
|
553
546
|
}
|
554
547
|
}
|
555
|
-
navigateToProductConfiguration(productId,
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
}
|
561
|
-
}
|
562
|
-
else {
|
563
|
-
updateContext$ = this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'UPDATE_CONTEXT_PROPERTIES', {
|
564
|
-
productId,
|
565
|
-
lineItemId: lineItemId ?? '',
|
566
|
-
});
|
567
|
-
}
|
568
|
-
updateContext$
|
569
|
-
.pipe(tap(() => {
|
570
|
-
const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
|
571
|
-
const flowRouteUrl = this.getFlowRootPath(routeSnapshot);
|
572
|
-
this.router.navigate([flowRouteUrl, 'product'], {
|
573
|
-
queryParams: { ...routeSnapshot.queryParams, productId },
|
574
|
-
});
|
575
|
-
}))
|
576
|
-
.subscribe();
|
548
|
+
navigateToProductConfiguration(productId, transactionItemId) {
|
549
|
+
this.flowInfoService.updateContext({ productId, transactionItemId });
|
550
|
+
const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
|
551
|
+
const flowRouteUrl = this.getFlowRootPath(routeSnapshot);
|
552
|
+
this.router.navigate([flowRouteUrl, 'product'], {
|
553
|
+
queryParams: { ...routeSnapshot.queryParams, productId, transactionItemId },
|
554
|
+
});
|
577
555
|
}
|
578
556
|
navigateToShoppingCart() {
|
579
557
|
const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
|
@@ -610,23 +588,20 @@ class FlowRouterService {
|
|
610
588
|
this.router.navigate([], { relativeTo: route, queryParams: { ...routeSnapshot.queryParams, ...queryParams } });
|
611
589
|
}
|
612
590
|
}
|
613
|
-
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:
|
591
|
+
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: i3$1.IntegrationState }, { token: i3$1.FlowInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
|
614
592
|
FlowRouterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRouterService, providedIn: 'root' });
|
615
593
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRouterService, decorators: [{
|
616
594
|
type: Injectable,
|
617
595
|
args: [{ providedIn: 'root' }]
|
618
|
-
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type:
|
596
|
+
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: i3$1.IntegrationState }, { type: i3$1.FlowInfoService }]; } });
|
619
597
|
|
620
598
|
class FlowService {
|
621
|
-
constructor(integrationState, flowRouterService,
|
599
|
+
constructor(integrationState, flowRouterService, configurationService, configurationStateService, flowDialogService, flowStateService) {
|
622
600
|
this.integrationState = integrationState;
|
623
601
|
this.flowRouterService = flowRouterService;
|
624
|
-
this.quoteDraftService = quoteDraftService;
|
625
602
|
this.configurationService = configurationService;
|
626
603
|
this.configurationStateService = configurationStateService;
|
627
604
|
this.flowDialogService = flowDialogService;
|
628
|
-
this.flowConfigurationService = flowConfigurationService;
|
629
|
-
this.flowInfoService = flowInfoService;
|
630
605
|
this.flowStateService = flowStateService;
|
631
606
|
this.cleanup$ = new Subject();
|
632
607
|
}
|
@@ -636,16 +611,9 @@ class FlowService {
|
|
636
611
|
initSubscriptions() {
|
637
612
|
this.integrationState
|
638
613
|
.listen$(FlowAction.FLOW_CONFIGURE_PRODUCT)
|
639
|
-
.pipe(
|
640
|
-
if (this.flowInfoService.isLegacy) {
|
641
|
-
const productId = payload.productId ??
|
642
|
-
this.quoteDraftService.currentState.find(li => li.id === payload.lineItemId)?.productId;
|
643
|
-
return of({ ...payload, productId });
|
644
|
-
}
|
645
|
-
return this.prepareConfiguration$(payload.lineItemId).pipe(map(() => payload));
|
646
|
-
}), tap(payload => {
|
614
|
+
.pipe(tap(payload => {
|
647
615
|
if (payload.productId) {
|
648
|
-
this.flowRouterService.navigateToProductConfiguration(payload.productId, payload.
|
616
|
+
this.flowRouterService.navigateToProductConfiguration(payload.productId, payload.transactionItemId);
|
649
617
|
}
|
650
618
|
else {
|
651
619
|
console.warn("Parameter 'productId' is needed to start configuration");
|
@@ -669,7 +637,7 @@ class FlowService {
|
|
669
637
|
this.integrationState.dispatch(FlowAction.ConfigureProductAction(payload));
|
670
638
|
}
|
671
639
|
else {
|
672
|
-
this.flowRouterService.navigateTo(payload.path, payload.productId, payload.
|
640
|
+
this.flowRouterService.navigateTo(payload.path, payload.productId, payload.transactionItemId);
|
673
641
|
}
|
674
642
|
}), takeUntil(this.cleanup$))
|
675
643
|
.subscribe();
|
@@ -689,17 +657,10 @@ class FlowService {
|
|
689
657
|
.subscribe();
|
690
658
|
this.integrationState
|
691
659
|
.listen$(FlowAction.FLOW_APPLY_PRODUCT_CONFIGURATION)
|
692
|
-
.pipe(switchMap(() => {
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
else {
|
697
|
-
return this.configurationStateService.saveConfiguration(true).pipe(switchMap(() => this.configurationStateService.cancelConfiguration()), switchMap(() => this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'MODIFY_ASSETS', {
|
698
|
-
addConfiguringAssetId: true,
|
699
|
-
enable: true,
|
700
|
-
})));
|
701
|
-
}
|
702
|
-
}), tap(() => {
|
660
|
+
.pipe(switchMap(() => this.configurationStateService.saveConfiguration()), switchMap(() => this.configurationStateService.cancelConfiguration()), switchMap(() => this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'MODIFY_ASSETS', {
|
661
|
+
addConfiguringAssetId: true,
|
662
|
+
enable: true,
|
663
|
+
})), tap(() => {
|
703
664
|
this.configurationService.hasUnsavedChanges = false;
|
704
665
|
this.flowRouterService.navigateToShoppingCart();
|
705
666
|
}), takeUntil(this.cleanup$))
|
@@ -715,36 +676,12 @@ class FlowService {
|
|
715
676
|
.pipe(map(path => path.queryParams['productId']), takeUntil(this.cleanup$))
|
716
677
|
.subscribe(productId => this.integrationState.patchState({ productId }));
|
717
678
|
}
|
718
|
-
prepareConfiguration$(lineItemId) {
|
719
|
-
if (!lineItemId) {
|
720
|
-
return of(undefined);
|
721
|
-
}
|
722
|
-
return this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'UPDATE_PRICE_LIST', {
|
723
|
-
lineItemId,
|
724
|
-
});
|
725
|
-
}
|
726
|
-
legacyApplyConfiguration() {
|
727
|
-
const quoteDraft = this.quoteDraftService.quoteDraft;
|
728
|
-
const lineItem = this.configurationService.getSnapshot();
|
729
|
-
if (!quoteDraft || !lineItem) {
|
730
|
-
return of(undefined);
|
731
|
-
}
|
732
|
-
const isNewLineItem = quoteDraft.currentState.every(li => li.id !== lineItem.id);
|
733
|
-
let updatedState;
|
734
|
-
if (isNewLineItem) {
|
735
|
-
updatedState = [...quoteDraft.currentState, lineItem];
|
736
|
-
}
|
737
|
-
else {
|
738
|
-
updatedState = quoteDraft.currentState.map(li => (li.id === lineItem.id ? lineItem : li));
|
739
|
-
}
|
740
|
-
return this.flowConfigurationService.calculate$({ ...quoteDraft, currentState: updatedState });
|
741
|
-
}
|
742
679
|
}
|
743
|
-
FlowService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowService, deps: [{ token: i5.IntegrationState }, { token: FlowRouterService }, { token:
|
680
|
+
FlowService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowService, deps: [{ token: i5.IntegrationState }, { token: FlowRouterService }, { token: i3$1.ConfigurationService }, { token: i3$1.ConfigurationStateService }, { token: FlowDialogService }, { token: i3$1.FlowStateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
744
681
|
FlowService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowService });
|
745
682
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowService, decorators: [{
|
746
683
|
type: Injectable
|
747
|
-
}], ctorParameters: function () { return [{ type: i5.IntegrationState }, { type: FlowRouterService }, { type:
|
684
|
+
}], ctorParameters: function () { return [{ type: i5.IntegrationState }, { type: FlowRouterService }, { type: i3$1.ConfigurationService }, { type: i3$1.ConfigurationStateService }, { type: FlowDialogService }, { type: i3$1.FlowStateService }]; } });
|
748
685
|
|
749
686
|
class FlowGuidedSellingService {
|
750
687
|
constructor(integrationState) {
|
@@ -768,21 +705,21 @@ class FlowGuidedSellingService {
|
|
768
705
|
.subscribe();
|
769
706
|
}
|
770
707
|
}
|
771
|
-
FlowGuidedSellingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowGuidedSellingService, deps: [{ token:
|
708
|
+
FlowGuidedSellingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowGuidedSellingService, deps: [{ token: i3$1.IntegrationState }], target: i0.ɵɵFactoryTarget.Injectable });
|
772
709
|
FlowGuidedSellingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowGuidedSellingService });
|
773
710
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowGuidedSellingService, decorators: [{
|
774
711
|
type: Injectable
|
775
|
-
}], ctorParameters: function () { return [{ type:
|
712
|
+
}], ctorParameters: function () { return [{ type: i3$1.IntegrationState }]; } });
|
776
713
|
|
777
714
|
class FlowComponent {
|
778
|
-
constructor(routerService, flowService,
|
715
|
+
constructor(routerService, flowService, flowInfoService, guidedSellingService) {
|
779
716
|
this.routerService = routerService;
|
780
717
|
this.flowService = flowService;
|
781
|
-
this.
|
718
|
+
this.flowInfoService = flowInfoService;
|
782
719
|
this.guidedSellingService = guidedSellingService;
|
783
720
|
this.isLoading$ = this.routerService.loading$;
|
784
|
-
this.showHeader$ = combineLatest([this.routerService.route$, this.
|
785
|
-
this.isStandalone$ = this.
|
721
|
+
this.showHeader$ = combineLatest([this.routerService.route$, this.flowInfoService.flow$]).pipe(map(([route, flow]) => route.data['showHeader'] && !flow?.properties.standalone));
|
722
|
+
this.isStandalone$ = this.flowInfoService.flow$.pipe(map(flow => Boolean(flow?.properties.standalone)));
|
786
723
|
this.guidedSellingVisible$ = this.guidedSellingService.isVisible$;
|
787
724
|
this.flowService.initSubscriptions();
|
788
725
|
}
|
@@ -790,140 +727,36 @@ class FlowComponent {
|
|
790
727
|
this.flowService.cleanup();
|
791
728
|
}
|
792
729
|
}
|
793
|
-
FlowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowComponent, deps: [{ token: FlowRouterService }, { token: FlowService }, { token:
|
794
|
-
FlowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: FlowComponent, selector: "vl-flow", ngImport: i0, 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"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: i2
|
730
|
+
FlowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowComponent, deps: [{ token: FlowRouterService }, { token: FlowService }, { token: i3$1.FlowInfoService }, { token: FlowGuidedSellingService }], target: i0.ɵɵFactoryTarget.Component });
|
731
|
+
FlowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: FlowComponent, selector: "vl-flow", ngImport: i0, 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"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: i2.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "component", type: FlowHeaderComponent, selector: "vl-flow-new-header" }, { kind: "component", type: GuidedSellingComponent, selector: "vl-flow-guided-selling" }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
795
732
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowComponent, decorators: [{
|
796
733
|
type: Component,
|
797
734
|
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"] }]
|
798
|
-
}], ctorParameters: function () { return [{ type: FlowRouterService }, { type: FlowService }, { type:
|
799
|
-
|
800
|
-
const getFlowObjectIdPropertyName = (id) => {
|
801
|
-
const objectName = SalesforceIdUtils.getSfObjectNameById(id);
|
802
|
-
switch (objectName) {
|
803
|
-
case 'Account':
|
804
|
-
return 'accountId';
|
805
|
-
case 'Order':
|
806
|
-
return 'orderId';
|
807
|
-
case 'Quote':
|
808
|
-
default:
|
809
|
-
return 'quoteId';
|
810
|
-
}
|
811
|
-
};
|
812
|
-
const getDefaultProperties = (params) => {
|
813
|
-
const properties = {};
|
814
|
-
let standalone = params.flowParams?.standalone;
|
815
|
-
if (params.flowParams?.entryPath.includes('/product') || params.mode === ConfigurationContextMode.REMOTE) {
|
816
|
-
standalone = standalone ?? true;
|
817
|
-
}
|
818
|
-
if (standalone != null) {
|
819
|
-
properties.standalone = standalone ? 'true' : 'false';
|
820
|
-
}
|
821
|
-
return properties;
|
822
|
-
};
|
823
|
-
|
824
|
-
class ContextGuard {
|
825
|
-
constructor(router, routerService, contextService, runtimeSettingsService) {
|
826
|
-
this.router = router;
|
827
|
-
this.routerService = routerService;
|
828
|
-
this.contextService = contextService;
|
829
|
-
this.runtimeSettingsService = runtimeSettingsService;
|
830
|
-
}
|
831
|
-
checkActivation(route) {
|
832
|
-
const { queryParams } = route;
|
833
|
-
const { accountId, quoteId, orderId } = queryParams;
|
834
|
-
const rpcMessage = window.RPC_MESSAGE;
|
835
|
-
const mode = this.getConfigurationContextMode(accountId, quoteId, orderId, rpcMessage);
|
836
|
-
// Restrict if mode is not defined
|
837
|
-
if (mode == null) {
|
838
|
-
return this.routerService.showErrorPage$('Mode is undefined');
|
839
|
-
}
|
840
|
-
const headerId = accountId || quoteId || orderId || this.rpcMessageId || 'empty-for-test-mode';
|
841
|
-
// Allow if context is already initialized with the same headerId
|
842
|
-
if (this.contextService.isInitialized) {
|
843
|
-
const currentContext = this.contextService.resolve();
|
844
|
-
if (headerId && currentContext.headerId === headerId) {
|
845
|
-
return of(true);
|
846
|
-
}
|
847
|
-
}
|
848
|
-
// Initialize context and runtime settings
|
849
|
-
return forkJoin([this.contextService.create(headerId, mode), this.runtimeSettingsService.create()]).pipe(tap(([context]) => {
|
850
|
-
this.contextService.update({
|
851
|
-
...context,
|
852
|
-
properties: {
|
853
|
-
...context.properties,
|
854
|
-
...(queryParams ?? {}),
|
855
|
-
...getDefaultProperties({ mode }),
|
856
|
-
},
|
857
|
-
});
|
858
|
-
// Init currency settings
|
859
|
-
this.runtimeSettingsService.initCurrency(context.properties['CurrencyIsoCode']);
|
860
|
-
}), map(() => true), catchError(e => {
|
861
|
-
const message = e instanceof HttpErrorResponse ? e.error.message : e;
|
862
|
-
const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
|
863
|
-
return this.routerService.showErrorPage$(message, errorDetails);
|
864
|
-
}));
|
865
|
-
}
|
866
|
-
canActivate(route) {
|
867
|
-
return this.checkActivation(route);
|
868
|
-
}
|
869
|
-
canActivateChild(childRoute) {
|
870
|
-
return this.checkActivation(childRoute);
|
871
|
-
}
|
872
|
-
get rpcMessageId() {
|
873
|
-
if (!window.RPC_MESSAGE) {
|
874
|
-
return;
|
875
|
-
}
|
876
|
-
const rpcMessage = JSON.parse(window.RPC_MESSAGE);
|
877
|
-
const veloceReferenceId = rpcMessage.configuration?.VeloceReferenceId;
|
878
|
-
const quoteId = rpcMessage.quote?.Id;
|
879
|
-
return veloceReferenceId || quoteId;
|
880
|
-
}
|
881
|
-
getConfigurationContextMode(accountId, quoteId, orderId, rpcMessage) {
|
882
|
-
if (accountId) {
|
883
|
-
return ConfigurationContextMode.ACCOUNT;
|
884
|
-
}
|
885
|
-
if (quoteId) {
|
886
|
-
return ConfigurationContextMode.QUOTE;
|
887
|
-
}
|
888
|
-
if (orderId) {
|
889
|
-
return ConfigurationContextMode.ORDER;
|
890
|
-
}
|
891
|
-
if (rpcMessage) {
|
892
|
-
return ConfigurationContextMode.REMOTE;
|
893
|
-
}
|
894
|
-
return;
|
895
|
-
}
|
896
|
-
}
|
897
|
-
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 });
|
898
|
-
ContextGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextGuard });
|
899
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextGuard, decorators: [{
|
900
|
-
type: Injectable
|
901
|
-
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i2.ContextService }, { type: i2.RuntimeSettingsService }]; } });
|
735
|
+
}], ctorParameters: function () { return [{ type: FlowRouterService }, { type: FlowService }, { type: i3$1.FlowInfoService }, { type: FlowGuidedSellingService }]; } });
|
902
736
|
|
903
737
|
const keepFlowInitialized = (route) => {
|
904
|
-
const
|
738
|
+
const routerService = inject(FlowRouterService);
|
739
|
+
const runtimeSettingsService = inject(RuntimeSettingsService);
|
905
740
|
const flowState = inject(FlowStateService);
|
906
741
|
const flowInfoService = inject(FlowInfoService);
|
907
|
-
const
|
908
|
-
const quoteDraft = inject(QuoteDraftService);
|
742
|
+
const salesTrasnsactionService = inject(SalesTransactionService);
|
909
743
|
const configurationService = inject(ConfigurationService);
|
910
744
|
const integrationState = inject(IntegrationState);
|
911
745
|
const { flowId } = route.queryParams;
|
912
|
-
|
913
|
-
if (flow && flow?.id === flowId) {
|
746
|
+
if (flowInfoService.isFlowInitialized && flowInfoService.flow.id === flowId) {
|
914
747
|
return true;
|
915
748
|
}
|
916
749
|
// Cleanup
|
917
|
-
flowState.
|
918
|
-
|
750
|
+
flowState.reset();
|
751
|
+
salesTrasnsactionService.reset();
|
919
752
|
configurationService.reset();
|
920
|
-
integrationState.
|
921
|
-
flowInfoService.
|
922
|
-
contextService.delete();
|
753
|
+
integrationState.reset();
|
754
|
+
flowInfoService.reset();
|
923
755
|
if (!flowId) {
|
924
756
|
return true;
|
925
757
|
}
|
926
|
-
return flowInfoService.init$(flowId, route.queryParams)
|
758
|
+
return runtimeSettingsService.create().pipe(tap(() => runtimeSettingsService.initCurrency('USD')), switchMap(() => flowInfoService.init$(flowId, route.queryParams)), map(() => true), catchError(e => {
|
759
|
+
console.error(e);
|
927
760
|
const message = e instanceof HttpErrorResponse ? e.error.message : e;
|
928
761
|
const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
|
929
762
|
return routerService.showErrorPage$(message, errorDetails);
|
@@ -931,22 +764,20 @@ const keepFlowInitialized = (route) => {
|
|
931
764
|
};
|
932
765
|
|
933
766
|
class ProductUnloadGuard {
|
934
|
-
constructor(router,
|
767
|
+
constructor(router, flowInfoService, configurationService, flowDialogService) {
|
935
768
|
this.router = router;
|
936
|
-
this.
|
937
|
-
this.quoteDraftService = quoteDraftService;
|
769
|
+
this.flowInfoService = flowInfoService;
|
938
770
|
this.configurationService = configurationService;
|
939
771
|
this.flowDialogService = flowDialogService;
|
940
772
|
}
|
941
773
|
canDeactivate(_, route, currentState, nextState) {
|
942
774
|
let observable = of(true);
|
943
|
-
if (!this.
|
775
|
+
if (!this.flowInfoService.flow.properties.standalone && this.configurationService.hasUnsavedChanges) {
|
944
776
|
observable = this.flowDialogService.showUnsavedChangesDialog();
|
945
777
|
}
|
946
778
|
return observable.pipe(map(unload => {
|
947
779
|
if (unload) {
|
948
780
|
this.configurationService.reset();
|
949
|
-
this.contextService.update({ properties: { productId: undefined, lineItemId: undefined } });
|
950
781
|
if (!nextState || currentState.url === nextState.url) {
|
951
782
|
return true;
|
952
783
|
}
|
@@ -964,11 +795,11 @@ class ProductUnloadGuard {
|
|
964
795
|
}));
|
965
796
|
}
|
966
797
|
}
|
967
|
-
ProductUnloadGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard, deps: [{ token: i1$2.Router }, { token:
|
798
|
+
ProductUnloadGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard, deps: [{ token: i1$2.Router }, { token: i3$1.FlowInfoService }, { token: i3$1.ConfigurationService }, { token: FlowDialogService }], target: i0.ɵɵFactoryTarget.Injectable });
|
968
799
|
ProductUnloadGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard });
|
969
800
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard, decorators: [{
|
970
801
|
type: Injectable
|
971
|
-
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type:
|
802
|
+
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i3$1.FlowInfoService }, { type: i3$1.ConfigurationService }, { type: FlowDialogService }]; } });
|
972
803
|
|
973
804
|
class RootGuard {
|
974
805
|
constructor(router, routerService) {
|
@@ -1093,12 +924,12 @@ class AssetsComponent {
|
|
1093
924
|
}));
|
1094
925
|
}
|
1095
926
|
}
|
1096
|
-
AssetsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AssetsComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token: i0.ChangeDetectorRef }, { token: i2
|
1097
|
-
AssetsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AssetsComponent, selector: "vl-flow-assets", 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
|
927
|
+
AssetsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AssetsComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token: i0.ChangeDetectorRef }, { token: i2.ToastService }, { token: i3$1.FlowInfoService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
928
|
+
AssetsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AssetsComponent, selector: "vl-flow-assets", 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.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1098
929
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AssetsComponent, decorators: [{
|
1099
930
|
type: Component,
|
1100
931
|
args: [{ selector: 'vl-flow-assets', 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" }]
|
1101
|
-
}], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2
|
932
|
+
}], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2.ToastService }, { type: i3$1.FlowInfoService }, { type: undefined, decorators: [{
|
1102
933
|
type: Optional
|
1103
934
|
}, {
|
1104
935
|
type: Inject,
|
@@ -1202,12 +1033,12 @@ class CatalogComponent {
|
|
1202
1033
|
}));
|
1203
1034
|
}
|
1204
1035
|
}
|
1205
|
-
CatalogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token: i0.ChangeDetectorRef }, { token: i2
|
1206
|
-
CatalogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CatalogComponent, selector: "vl-flow-catalog", 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
|
1036
|
+
CatalogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token: i0.ChangeDetectorRef }, { token: i2.ToastService }, { token: i3$1.FlowInfoService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
1037
|
+
CatalogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CatalogComponent, selector: "vl-flow-catalog", 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.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1207
1038
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogComponent, decorators: [{
|
1208
1039
|
type: Component,
|
1209
1040
|
args: [{ selector: 'vl-flow-catalog', 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" }]
|
1210
|
-
}], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2
|
1041
|
+
}], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2.ToastService }, { type: i3$1.FlowInfoService }, { type: undefined, decorators: [{
|
1211
1042
|
type: Optional
|
1212
1043
|
}, {
|
1213
1044
|
type: Inject,
|
@@ -1229,12 +1060,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
1229
1060
|
}] });
|
1230
1061
|
|
1231
1062
|
class DebugComponent {
|
1232
|
-
constructor(flowsApiService, router, activatedRoute
|
1063
|
+
constructor(flowsApiService, router, activatedRoute) {
|
1233
1064
|
this.flowsApiService = flowsApiService;
|
1234
1065
|
this.router = router;
|
1235
1066
|
this.activatedRoute = activatedRoute;
|
1236
|
-
this.context = context;
|
1237
|
-
this.quoteDraftService = quoteDraftService;
|
1238
1067
|
this.form = new FormGroup({
|
1239
1068
|
id: new FormControl(''),
|
1240
1069
|
});
|
@@ -1242,17 +1071,13 @@ class DebugComponent {
|
|
1242
1071
|
}
|
1243
1072
|
runFlow() {
|
1244
1073
|
const { id } = this.form.value;
|
1245
|
-
|
1246
|
-
if (!id || !objectPropertyName || !this.selectedFlow) {
|
1074
|
+
if (!id || !this.selectedFlow) {
|
1247
1075
|
return;
|
1248
1076
|
}
|
1249
|
-
// Delete context before starting a new flow
|
1250
|
-
this.context.delete();
|
1251
|
-
this.quoteDraftService.reset();
|
1252
1077
|
this.router.navigate(['..', 'flows'], {
|
1253
1078
|
queryParams: {
|
1254
1079
|
flowId: this.selectedFlow.id,
|
1255
|
-
|
1080
|
+
headerId: id,
|
1256
1081
|
...this.selectedFlow.properties.queryParams,
|
1257
1082
|
},
|
1258
1083
|
relativeTo: this.activatedRoute,
|
@@ -1262,12 +1087,12 @@ class DebugComponent {
|
|
1262
1087
|
return new HttpParams({ fromObject: params }).toString();
|
1263
1088
|
}
|
1264
1089
|
}
|
1265
|
-
DebugComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebugComponent, deps: [{ token: i1$
|
1266
|
-
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:
|
1090
|
+
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 }], target: i0.ɵɵFactoryTarget.Component });
|
1091
|
+
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: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$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: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i5$1.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: i7.InputText, selector: "[pInputText]" }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1267
1092
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebugComponent, decorators: [{
|
1268
1093
|
type: Component,
|
1269
1094
|
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"] }]
|
1270
|
-
}], ctorParameters: function () { return [{ type: i1$
|
1095
|
+
}], ctorParameters: function () { return [{ type: i1$3.FlowsApiService }, { type: i1$2.Router }, { type: i1$2.ActivatedRoute }]; } });
|
1271
1096
|
|
1272
1097
|
const routes$1 = [{ path: '', component: DebugComponent }];
|
1273
1098
|
class DebugModule {
|
@@ -1305,114 +1130,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
1305
1130
|
}] });
|
1306
1131
|
|
1307
1132
|
class ProductComponent {
|
1308
|
-
constructor(
|
1309
|
-
this.contextService = contextService;
|
1133
|
+
constructor(configurationRuntimeService, configurationStateService) {
|
1310
1134
|
this.configurationRuntimeService = configurationRuntimeService;
|
1311
|
-
this.configurationService = configurationService;
|
1312
1135
|
this.configurationStateService = configurationStateService;
|
1313
|
-
this.
|
1314
|
-
this.
|
1315
|
-
this.flowStateService = flowStateService;
|
1316
|
-
this.integrationState = integrationState;
|
1317
|
-
this.customizationService = customizationService;
|
1318
|
-
this.uiDefinition$ = new BehaviorSubject(undefined);
|
1136
|
+
this.uiDefinitionContainer$ = new BehaviorSubject(null);
|
1137
|
+
this.uiDefinitionContainer$.next(this.configurationRuntimeService.uiDefinitionContainer);
|
1319
1138
|
this.config = {
|
1320
1139
|
init$: () => this.init$(),
|
1321
1140
|
};
|
1322
1141
|
}
|
1323
|
-
customizeUI$() {
|
1324
|
-
const { productId } = this.configurationRuntimeService.runtimeContext ?? {};
|
1325
|
-
if (!productId || !this.customizationService?.getUiDefinition) {
|
1326
|
-
return of(undefined);
|
1327
|
-
}
|
1328
|
-
return this.customizationService.getUiDefinition(productId).pipe(map(uiDefinitionContainer => {
|
1329
|
-
if (uiDefinitionContainer) {
|
1330
|
-
this.configurationRuntimeService.overrideUIDefinition(uiDefinitionContainer);
|
1331
|
-
}
|
1332
|
-
}));
|
1333
|
-
}
|
1334
1142
|
init$() {
|
1335
|
-
|
1336
|
-
if (this.flowInfoService.isLegacy || !this.flowInfoService.isStateful) {
|
1337
|
-
quoteDraft$ = this.quoteDraftService.quoteDraft$;
|
1338
|
-
}
|
1339
|
-
else {
|
1340
|
-
quoteDraft$ = of(undefined);
|
1341
|
-
}
|
1342
|
-
return quoteDraft$.pipe(first(), switchMap(quote => {
|
1343
|
-
const contextProperties = this.contextService.resolve().properties;
|
1344
|
-
const productId = contextProperties.productId ?? this.flowInfoService.flow?.properties.queryParams['productId'];
|
1345
|
-
if (!productId) {
|
1346
|
-
throw new Error(`Unable to start configuration for 'productId == null'`);
|
1347
|
-
}
|
1348
|
-
if (!quote) {
|
1349
|
-
const offeringId = contextProperties.offeringId;
|
1350
|
-
return this.configurationRuntimeService.init({ productId, offeringId });
|
1351
|
-
}
|
1352
|
-
const lineItem = this.getLineItem(quote, productId, contextProperties.lineItemId);
|
1353
|
-
if (lineItem) {
|
1354
|
-
this.configurationService.setConfigurableRamp(lineItem);
|
1355
|
-
}
|
1356
|
-
const { offeringId } = lineItem ?? {};
|
1357
|
-
return this.configurationRuntimeService.init({ productId, offeringId });
|
1358
|
-
}), switchMap(() => this.customizeUI$()), tap(() => {
|
1359
|
-
const uiDefinition = this.configurationRuntimeService.runtimeContext?.uiDefinitionContainer?.source;
|
1360
|
-
if (uiDefinition) {
|
1361
|
-
this.uiDefinition$.next(uiDefinition);
|
1362
|
-
}
|
1363
|
-
else {
|
1364
|
-
throw new Error('Product does not have Configuration UI');
|
1365
|
-
}
|
1366
|
-
}), tap(() => {
|
1367
|
-
if (this.configurationRuntimeService.initializationProps) {
|
1368
|
-
this.configurationRuntimeService.initializationProps.attributesMap =
|
1369
|
-
this.integrationState.state.guidedSelling;
|
1370
|
-
}
|
1371
|
-
}), switchMap(() => this.configurationStateService.init$()));
|
1372
|
-
}
|
1373
|
-
getLineItem(quote, productId, lineItemId) {
|
1374
|
-
// search by lineItemId first
|
1375
|
-
let li = quote.currentState.find(li => li.id === lineItemId);
|
1376
|
-
if (!li && this.quoteDraftService.isStandalone) {
|
1377
|
-
li = quote.currentState.find(li => li.productId === productId);
|
1378
|
-
}
|
1379
|
-
// If still not found, is could be an asset
|
1380
|
-
if (!li) {
|
1381
|
-
li = this.quoteDraftService.assetsState?.currentState.find(li => li.id === lineItemId);
|
1382
|
-
}
|
1383
|
-
return li;
|
1143
|
+
return this.configurationStateService.init$();
|
1384
1144
|
}
|
1385
1145
|
}
|
1386
|
-
ProductComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductComponent, deps: [{ token:
|
1387
|
-
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]=\"
|
1146
|
+
ProductComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductComponent, deps: [{ token: i3$1.ConfigurationRuntimeService }, { token: i3$1.ConfigurationStateService }], target: i0.ɵɵFactoryTarget.Component });
|
1147
|
+
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 });
|
1388
1148
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductComponent, decorators: [{
|
1389
1149
|
type: Component,
|
1390
|
-
args: [{ selector: 'vl-flow-product', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-cms-preview [uiDefinition]=\"
|
1391
|
-
}], ctorParameters: function () { return [{ type:
|
1392
|
-
type: Optional
|
1393
|
-
}, {
|
1394
|
-
type: Inject,
|
1395
|
-
args: [FLOW_CUSTOMIZATION]
|
1396
|
-
}] }]; } });
|
1150
|
+
args: [{ selector: 'vl-flow-product', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-cms-preview [uiDefinition]=\"(uiDefinitionContainer$ | async)?.source\" [config]=\"config\"></vl-cms-preview>\n" }]
|
1151
|
+
}], ctorParameters: function () { return [{ type: i3$1.ConfigurationRuntimeService }, { type: i3$1.ConfigurationStateService }]; } });
|
1397
1152
|
|
1398
1153
|
class ProductModule {
|
1399
1154
|
}
|
1400
1155
|
ProductModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1401
|
-
ProductModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, declarations: [ProductComponent], imports: [CommonModule, PreviewModule, LoaderModule], exports: [ProductComponent] });
|
1402
|
-
ProductModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, imports: [CommonModule, PreviewModule, LoaderModule] });
|
1156
|
+
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] });
|
1157
|
+
ProductModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, imports: [CommonModule, PreviewModule, LoaderModule, LetDirectiveModule] });
|
1403
1158
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, decorators: [{
|
1404
1159
|
type: NgModule,
|
1405
1160
|
args: [{
|
1406
1161
|
declarations: [ProductComponent],
|
1407
|
-
imports: [CommonModule, PreviewModule, LoaderModule],
|
1162
|
+
imports: [CommonModule, PreviewModule, LoaderModule, LetDirectiveModule],
|
1408
1163
|
exports: [ProductComponent],
|
1409
1164
|
}]
|
1410
1165
|
}] });
|
1411
1166
|
|
1412
1167
|
class RecordNotFoundComponent {
|
1413
|
-
constructor(router
|
1168
|
+
constructor(router) {
|
1414
1169
|
this.router = router;
|
1415
|
-
this.route = route;
|
1416
1170
|
this.subMessage = '';
|
1417
1171
|
this.type = '';
|
1418
1172
|
const navigation = this.router.getCurrentNavigation();
|
@@ -1425,12 +1179,12 @@ class RecordNotFoundComponent {
|
|
1425
1179
|
}
|
1426
1180
|
}
|
1427
1181
|
}
|
1428
|
-
RecordNotFoundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RecordNotFoundComponent, deps: [{ token: i1$2.Router }
|
1182
|
+
RecordNotFoundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RecordNotFoundComponent, deps: [{ token: i1$2.Router }], target: i0.ɵɵFactoryTarget.Component });
|
1429
1183
|
RecordNotFoundComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: RecordNotFoundComponent, selector: "vl-flow-record-not-found", ngImport: i0, template: "<div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"message-wrapper\">\n <div *ngIf=\"message; else defaultMessage\">\n <p class=\"text message-text\" [class]=\"type\">{{ message }}</p>\n\n <p *ngIf=\"subMessage\" class=\"text\">{{ subMessage }}</p>\n\n <div *ngIf=\"details && details.length > 0\">\n <div *ngFor=\"let detail of details\" class=\"text\">{{ detail }}</div>\n </div>\n </div>\n\n <ng-template #defaultMessage>Record not found</ng-template>\n </div>\n </div>\n</div>\n", styles: [":host{display:block;padding:24px 54px}:host .text{white-space:pre-line;word-break:break-word}:host .message-text.error{color:var(--vl-error-text-color)}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1430
1184
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RecordNotFoundComponent, decorators: [{
|
1431
1185
|
type: Component,
|
1432
1186
|
args: [{ selector: 'vl-flow-record-not-found', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"row\">\n <div class=\"col-md-12\">\n <div class=\"message-wrapper\">\n <div *ngIf=\"message; else defaultMessage\">\n <p class=\"text message-text\" [class]=\"type\">{{ message }}</p>\n\n <p *ngIf=\"subMessage\" class=\"text\">{{ subMessage }}</p>\n\n <div *ngIf=\"details && details.length > 0\">\n <div *ngFor=\"let detail of details\" class=\"text\">{{ detail }}</div>\n </div>\n </div>\n\n <ng-template #defaultMessage>Record not found</ng-template>\n </div>\n </div>\n</div>\n", styles: [":host{display:block;padding:24px 54px}:host .text{white-space:pre-line;word-break:break-word}:host .message-text.error{color:var(--vl-error-text-color)}\n"] }]
|
1433
|
-
}], ctorParameters: function () { return [{ type: i1$2.Router }
|
1187
|
+
}], ctorParameters: function () { return [{ type: i1$2.Router }]; } });
|
1434
1188
|
|
1435
1189
|
const routes = [{ path: '', component: RecordNotFoundComponent }];
|
1436
1190
|
class RecordNotFoundModule {
|
@@ -1446,349 +1200,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
1446
1200
|
}]
|
1447
1201
|
}] });
|
1448
1202
|
|
1449
|
-
class RemoteComponent {
|
1450
|
-
constructor(contextService, quoteDraftService, runtimeService, configurationService, configurationState, messageService, integrationState, location) {
|
1451
|
-
this.contextService = contextService;
|
1452
|
-
this.quoteDraftService = quoteDraftService;
|
1453
|
-
this.runtimeService = runtimeService;
|
1454
|
-
this.configurationService = configurationService;
|
1455
|
-
this.configurationState = configurationState;
|
1456
|
-
this.messageService = messageService;
|
1457
|
-
this.integrationState = integrationState;
|
1458
|
-
this.location = location;
|
1459
|
-
this.state$ = new BehaviorSubject({ loading: true, failure: false });
|
1460
|
-
this.DYNAMIC_OPTION_PRODUCTS_KEY = 'Dynamic';
|
1461
|
-
this.destroyed$ = new Subject();
|
1462
|
-
this.rpcMessage = JSON.parse(window.RPC_MESSAGE);
|
1463
|
-
this.rpcMessage.options.sort((a, b) => (a.featureNumber ?? 99999) - (b.featureNumber ?? 99999));
|
1464
|
-
this.updateHasChildrenFlag(this.rpcMessage.product.configuredProductId);
|
1465
|
-
// update context properties
|
1466
|
-
if (this.rpcMessage.quote) {
|
1467
|
-
const properties = {};
|
1468
|
-
if (this.rpcMessage.quote['SBQQ__Opportunity2__c']) {
|
1469
|
-
properties.OpportunityId = this.rpcMessage.quote['SBQQ__Opportunity2__c'];
|
1470
|
-
}
|
1471
|
-
Object.entries(this.rpcMessage.quote).forEach(([key, value]) => {
|
1472
|
-
if (value !== undefined && !(value instanceof Object)) {
|
1473
|
-
properties[key] = value;
|
1474
|
-
}
|
1475
|
-
});
|
1476
|
-
this.contextService.update({ properties });
|
1477
|
-
}
|
1478
|
-
this.initSubscriptions();
|
1479
|
-
this.initConfiguration();
|
1480
|
-
}
|
1481
|
-
ngOnDestroy() {
|
1482
|
-
this.destroyed$.next();
|
1483
|
-
this.destroyed$.complete();
|
1484
|
-
}
|
1485
|
-
initConfiguration() {
|
1486
|
-
const productId = this.rpcMessage.product.configuredProductId;
|
1487
|
-
const quote = this.quoteDraftService.quoteDraft;
|
1488
|
-
if (!productId || !quote) {
|
1489
|
-
return;
|
1490
|
-
}
|
1491
|
-
this.runtimeService
|
1492
|
-
.init({ productId })
|
1493
|
-
.pipe(first(), tap(context => {
|
1494
|
-
const uiDefinitionProperties = context.uiDefinitionContainer?.source.properties ?? {};
|
1495
|
-
this.uiDefinition = context.uiDefinitionContainer?.source;
|
1496
|
-
const pricingEnabled = uiDefinitionProperties.pricingEnabled ? 'true' : 'false';
|
1497
|
-
const priceListId = uiDefinitionProperties.priceList;
|
1498
|
-
const runtimeContextProperties = this.runtimeService.runtimeContext?.properties;
|
1499
|
-
if (runtimeContextProperties) {
|
1500
|
-
runtimeContextProperties.PriceListId = priceListId;
|
1501
|
-
runtimeContextProperties.PricingEnabled = pricingEnabled;
|
1502
|
-
}
|
1503
|
-
this.contextService.update({
|
1504
|
-
properties: {
|
1505
|
-
ModelId: context.modelId,
|
1506
|
-
RuntimeMode: 'TEST',
|
1507
|
-
PricingEnabled: pricingEnabled,
|
1508
|
-
PriceListId: priceListId,
|
1509
|
-
},
|
1510
|
-
});
|
1511
|
-
this.configurationService.setConfigurableRamp(this.createLineItem());
|
1512
|
-
}), this.throwIfNoUIDefinition(), switchMap(() => this.configurationState.init$()), tap(() => this.state$.next({ loading: false, failure: false })), catchError(error => {
|
1513
|
-
if (!this.uiDefinition?.properties?.suppressToastMessages) {
|
1514
|
-
this.messageService.add({ severity: 'error', summary: error });
|
1515
|
-
}
|
1516
|
-
this.state$.next({ loading: false, failure: true });
|
1517
|
-
return of();
|
1518
|
-
}), takeUntil(this.destroyed$))
|
1519
|
-
.subscribe();
|
1520
|
-
}
|
1521
|
-
throwIfNoUIDefinition() {
|
1522
|
-
return (source$) => {
|
1523
|
-
return source$.pipe(switchMap(() => {
|
1524
|
-
if (!this.uiDefinition) {
|
1525
|
-
return throwError(() => 'Product does not have Configuration UI');
|
1526
|
-
}
|
1527
|
-
return source$;
|
1528
|
-
}));
|
1529
|
-
};
|
1530
|
-
}
|
1531
|
-
initSubscriptions() {
|
1532
|
-
this.integrationState
|
1533
|
-
.listen$(FlowAction.REMOTE_CANCEL)
|
1534
|
-
.pipe(tap(() => this.location.back()), takeUntil(this.destroyed$))
|
1535
|
-
.subscribe();
|
1536
|
-
this.integrationState
|
1537
|
-
.listen$(FlowAction.REMOTE_APPLY)
|
1538
|
-
.pipe(tap(() => this.saveRpcMessage()), takeUntil(this.destroyed$))
|
1539
|
-
.subscribe();
|
1540
|
-
}
|
1541
|
-
createLineItem() {
|
1542
|
-
const [quoteDraftLineItem] = this.quoteDraftService.quoteDraft?.currentState ?? [];
|
1543
|
-
if (quoteDraftLineItem && (quoteDraftLineItem.attributes.length > 0 || quoteDraftLineItem.lineItems.length > 0)) {
|
1544
|
-
return quoteDraftLineItem;
|
1545
|
-
}
|
1546
|
-
const lineItem = this.createRootLineItem();
|
1547
|
-
const dynamicOptionProducts = this.rpcMessage.product.optionConfigurations[this.DYNAMIC_OPTION_PRODUCTS_KEY];
|
1548
|
-
if (dynamicOptionProducts) {
|
1549
|
-
const options = this.toParentChildMap(dynamicOptionProducts);
|
1550
|
-
let items = [lineItem];
|
1551
|
-
for (let i = 0; i < items.length; i++) {
|
1552
|
-
const item = items[i];
|
1553
|
-
const children = item && options.get(item.id);
|
1554
|
-
if (children) {
|
1555
|
-
item.lineItems = children;
|
1556
|
-
items = items.concat(children);
|
1557
|
-
}
|
1558
|
-
}
|
1559
|
-
}
|
1560
|
-
return lineItem;
|
1561
|
-
}
|
1562
|
-
createRootLineItem() {
|
1563
|
-
const product = this.rpcMessage.product;
|
1564
|
-
const runtimeContext = this.runtimeService.runtimeContext;
|
1565
|
-
const veloceInstanceId = product.configurationAttributes['VeloceInstanceId__c'];
|
1566
|
-
const quoteId = this.quoteDraftService.quoteDraft?.currentState[0]?.id;
|
1567
|
-
return {
|
1568
|
-
id: quoteId || veloceInstanceId || UUID.UUID(),
|
1569
|
-
type: runtimeContext.productType ?? '',
|
1570
|
-
name: runtimeContext.properties?.['displayName'] || runtimeContext.productName,
|
1571
|
-
productName: runtimeContext.productName,
|
1572
|
-
productId: runtimeContext.productId,
|
1573
|
-
cfgStatus: 'Default',
|
1574
|
-
actionCode: 'ADD',
|
1575
|
-
qty: 1,
|
1576
|
-
};
|
1577
|
-
}
|
1578
|
-
toParentChildMap(remoteOptionProducts) {
|
1579
|
-
const result = new Map();
|
1580
|
-
for (const option of remoteOptionProducts) {
|
1581
|
-
const configurationData = option?.readOnly?.line;
|
1582
|
-
const id = configurationData?.VeloceInstanceId__c;
|
1583
|
-
const parentId = configurationData?.VeloceParentInstanceId__c;
|
1584
|
-
if (!option.selected || !configurationData || !id || !parentId) {
|
1585
|
-
continue;
|
1586
|
-
}
|
1587
|
-
const productId = option.productId;
|
1588
|
-
const lineItem = {
|
1589
|
-
id,
|
1590
|
-
productId,
|
1591
|
-
parentId,
|
1592
|
-
type: configurationData.ModelType__c,
|
1593
|
-
port: configurationData.ModelPort__c,
|
1594
|
-
cfgStatus: configurationData.ConfigurationStatus__c,
|
1595
|
-
actionCode: configurationData.ActionCode__c,
|
1596
|
-
qty: option.Quantity,
|
1597
|
-
};
|
1598
|
-
let siblings = result.get(productId);
|
1599
|
-
if (!siblings) {
|
1600
|
-
result.set(parentId, (siblings = []));
|
1601
|
-
}
|
1602
|
-
siblings.push(lineItem);
|
1603
|
-
}
|
1604
|
-
return result;
|
1605
|
-
}
|
1606
|
-
saveRpcMessage() {
|
1607
|
-
const quote = this.quoteDraftService.quoteDraft;
|
1608
|
-
const lineItem = this.configurationService.getSnapshot();
|
1609
|
-
if (!quote || !lineItem) {
|
1610
|
-
return;
|
1611
|
-
}
|
1612
|
-
this.rpcMessage.VeloceReferenceId = quote.quoteId;
|
1613
|
-
this.rpcMessage.product.configurationData.VeloceInstanceId__c = lineItem.id;
|
1614
|
-
const childItems = this.flattenChildLineItems(lineItem);
|
1615
|
-
const savingMode = window.SavingMode;
|
1616
|
-
this.updateContentData(this.rpcMessage.product, lineItem);
|
1617
|
-
this.rpcMessage.quote = this.mapAttributesTo('Quote', lineItem);
|
1618
|
-
if (savingMode === 'ALL') {
|
1619
|
-
const optionConfigurations = this.getOptionConfigurations(this.rpcMessage.product);
|
1620
|
-
const rootProductOptions = this.rpcMessage.options.filter(po => po.configuredProductId === lineItem.productId);
|
1621
|
-
childItems.forEach(lineItem => {
|
1622
|
-
const rootOption = rootProductOptions.find(po => po.optionalProductId === lineItem.productId);
|
1623
|
-
if (rootOption) {
|
1624
|
-
const featureOptions = optionConfigurations[rootOption.featureName] ?? (optionConfigurations[rootOption.featureName] = []);
|
1625
|
-
const originOption = !rootOption.hasChildren
|
1626
|
-
? optionConfigurations[rootOption.featureName]?.find(({ optionId }) => optionId === rootOption.optionId)
|
1627
|
-
: undefined;
|
1628
|
-
const option = originOption ?? {};
|
1629
|
-
option.optionId = option.optionId ?? rootOption.optionId;
|
1630
|
-
this.updateContentData(option, lineItem);
|
1631
|
-
option.index = option.index ?? featureOptions.length;
|
1632
|
-
option.selected = true;
|
1633
|
-
if (!originOption) {
|
1634
|
-
featureOptions.push(option);
|
1635
|
-
}
|
1636
|
-
if (lineItem.parentLineItem) {
|
1637
|
-
const nestedProductOption = this.rpcMessage.options.find(po => po.configuredProductId === lineItem.parentLineItem?.productId &&
|
1638
|
-
po.optionalProductId === lineItem.productId);
|
1639
|
-
if (nestedProductOption) {
|
1640
|
-
option.configurationData = {
|
1641
|
-
...option.configurationData,
|
1642
|
-
VeloceParentInstanceId__c: lineItem.parentLineItem.id,
|
1643
|
-
VeloceNestedOptionId__c: nestedProductOption.optionId,
|
1644
|
-
VeloceNestedFeatureId__c: nestedProductOption.featureId,
|
1645
|
-
};
|
1646
|
-
}
|
1647
|
-
}
|
1648
|
-
}
|
1649
|
-
else {
|
1650
|
-
this.rpcMessage.dynamicFeatures.forEach(feature => {
|
1651
|
-
const featureOptions = optionConfigurations[feature.name] ?? (optionConfigurations[feature.name] = []);
|
1652
|
-
const originOption = featureOptions.find(({ productId }) => productId === lineItem.productId);
|
1653
|
-
const option = originOption ?? {};
|
1654
|
-
this.updateContentData(option, lineItem);
|
1655
|
-
option.index = option.index ?? featureOptions.length;
|
1656
|
-
option.selected = true;
|
1657
|
-
if (!originOption) {
|
1658
|
-
featureOptions.push(option);
|
1659
|
-
}
|
1660
|
-
});
|
1661
|
-
}
|
1662
|
-
});
|
1663
|
-
this.rpcMessage.product = { ...this.rpcMessage.product, optionConfigurations };
|
1664
|
-
}
|
1665
|
-
window.RPC_BROADCAST?.apply(null, [this.rpcMessage]);
|
1666
|
-
}
|
1667
|
-
updateHasChildrenFlag(bundleProductId) {
|
1668
|
-
const bundleOptionsByOptionId = {};
|
1669
|
-
const notBundleOptions = [];
|
1670
|
-
for (const productOption of this.rpcMessage.options) {
|
1671
|
-
if (productOption.configuredProductId === bundleProductId) {
|
1672
|
-
bundleOptionsByOptionId[productOption.optionalProductId] = productOption;
|
1673
|
-
}
|
1674
|
-
else {
|
1675
|
-
notBundleOptions.push(productOption);
|
1676
|
-
}
|
1677
|
-
}
|
1678
|
-
for (const option of notBundleOptions) {
|
1679
|
-
const bundleOption = bundleOptionsByOptionId[option.configuredProductId];
|
1680
|
-
if (bundleOption) {
|
1681
|
-
bundleOption.hasChildren = true;
|
1682
|
-
}
|
1683
|
-
}
|
1684
|
-
}
|
1685
|
-
flattenChildLineItems(lineItem) {
|
1686
|
-
let items = lineItem.lineItems ?? [];
|
1687
|
-
for (let i = 0; i < items.length; i++) {
|
1688
|
-
const item = items[i];
|
1689
|
-
if (item?.lineItems) {
|
1690
|
-
items = items.concat(item.lineItems.map(li => ({ ...li, parentLineItem: item })));
|
1691
|
-
}
|
1692
|
-
}
|
1693
|
-
return items;
|
1694
|
-
}
|
1695
|
-
updateContentData(entity, lineItem) {
|
1696
|
-
if (lineItem.productId) {
|
1697
|
-
entity.productId = lineItem.productId;
|
1698
|
-
}
|
1699
|
-
const quantityAttribute = lineItem.properties['quantityAttribute'];
|
1700
|
-
entity.Quantity = quantityAttribute
|
1701
|
-
? lineItem.attributes.find(attribute => attribute.name === quantityAttribute)?.value ?? 1
|
1702
|
-
: lineItem.qty;
|
1703
|
-
const totalPrice = this.computeNetPrice(lineItem);
|
1704
|
-
const targetTotalPriceField = lineItem.properties['TargetTotalPriceField'] || 'TotalPrice__c';
|
1705
|
-
entity.configurationData[targetTotalPriceField] = entity.configurationData[targetTotalPriceField]
|
1706
|
-
? entity.configurationData[targetTotalPriceField] + totalPrice
|
1707
|
-
: totalPrice;
|
1708
|
-
const targetPriceField = lineItem.properties['TargetPriceField'] || 'SBQQ__ListPrice__c';
|
1709
|
-
const price = entity.Quantity != null ? entity.configurationData[targetTotalPriceField] / entity.Quantity || 0 : 0;
|
1710
|
-
const targetPriceValue = Number(entity.configurationData[targetPriceField]) || 0;
|
1711
|
-
entity.configurationData[targetPriceField] = targetPriceValue
|
1712
|
-
? (targetPriceValue + price).toFixed(2)
|
1713
|
-
: price.toFixed(2);
|
1714
|
-
entity.configurationAttributes = this.mapAttributesTo('Attribute', lineItem);
|
1715
|
-
entity.configurationData = {
|
1716
|
-
...entity.configurationData,
|
1717
|
-
...this.mapAttributesTo('Field', lineItem),
|
1718
|
-
...this.mapAttributesTo('', lineItem),
|
1719
|
-
VeloceInstanceId__c: lineItem.id,
|
1720
|
-
};
|
1721
|
-
}
|
1722
|
-
computeNetPrice(lineItem) {
|
1723
|
-
if (lineItem.properties['GroupCharges']) {
|
1724
|
-
return this.sumNetPrice(lineItem.chargeGroupItems, this.getChargeNameSet(lineItem.properties['GroupCharges']));
|
1725
|
-
}
|
1726
|
-
return this.sumNetPrice(lineItem.chargeItems, this.getChargeNameSet(lineItem.properties['Charges']));
|
1727
|
-
}
|
1728
|
-
getChargeNameSet(property) {
|
1729
|
-
if (property && property.length > 0) {
|
1730
|
-
return new Set(property.split(','));
|
1731
|
-
}
|
1732
|
-
return new Set();
|
1733
|
-
}
|
1734
|
-
sumNetPrice(chargeItems, charges) {
|
1735
|
-
let netPrice = 0;
|
1736
|
-
for (const chargeItem of chargeItems) {
|
1737
|
-
if (!charges || charges.has(chargeItem.chargeType)) {
|
1738
|
-
netPrice += chargeItem.netPrice ?? 0;
|
1739
|
-
}
|
1740
|
-
}
|
1741
|
-
return netPrice;
|
1742
|
-
}
|
1743
|
-
mapAttributesTo(target, lineItem) {
|
1744
|
-
const result = {};
|
1745
|
-
const component = this.runtimeService.runtimeModel?.components.get(lineItem.type);
|
1746
|
-
if (!component) {
|
1747
|
-
return result;
|
1748
|
-
}
|
1749
|
-
const propertyName = 'mapTo' + target;
|
1750
|
-
component.attributes
|
1751
|
-
.filter(a => a.properties && a.properties[propertyName])
|
1752
|
-
.forEach(mapping => {
|
1753
|
-
const attribute = lineItem.attributes.find(a => a.name === mapping.name);
|
1754
|
-
if (attribute) {
|
1755
|
-
new Set(mapping.properties[propertyName]?.split(',')).forEach(k => (result[k] = attribute.value));
|
1756
|
-
}
|
1757
|
-
});
|
1758
|
-
return result;
|
1759
|
-
}
|
1760
|
-
getOptionConfigurations(product) {
|
1761
|
-
const optionConfigurations = {};
|
1762
|
-
const requestOptionConfigurations = product.optionConfigurations ?? {};
|
1763
|
-
Object.keys(requestOptionConfigurations).forEach(k => {
|
1764
|
-
optionConfigurations[k] = (requestOptionConfigurations[k] ?? []).map(opt => {
|
1765
|
-
return { ...opt, selected: false };
|
1766
|
-
});
|
1767
|
-
});
|
1768
|
-
return optionConfigurations;
|
1769
|
-
}
|
1770
|
-
}
|
1771
|
-
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 });
|
1772
|
-
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 });
|
1773
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteComponent, decorators: [{
|
1774
|
-
type: Component,
|
1775
|
-
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" }]
|
1776
|
-
}], 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 }]; } });
|
1777
|
-
|
1778
|
-
class RemoteModule {
|
1779
|
-
}
|
1780
|
-
RemoteModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1781
|
-
RemoteModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, declarations: [RemoteComponent], imports: [CommonModule, PreviewModule, LoaderModule], exports: [RemoteComponent] });
|
1782
|
-
RemoteModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, imports: [CommonModule, PreviewModule, LoaderModule] });
|
1783
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, decorators: [{
|
1784
|
-
type: NgModule,
|
1785
|
-
args: [{
|
1786
|
-
declarations: [RemoteComponent],
|
1787
|
-
imports: [CommonModule, PreviewModule, LoaderModule],
|
1788
|
-
exports: [RemoteComponent],
|
1789
|
-
}]
|
1790
|
-
}] });
|
1791
|
-
|
1792
1203
|
class ShoppingCartComponent {
|
1793
1204
|
constructor(templatesApi, cdr, toastService, flowInfo, customizationService) {
|
1794
1205
|
this.templatesApi = templatesApi;
|
@@ -1872,12 +1283,12 @@ class ShoppingCartComponent {
|
|
1872
1283
|
}));
|
1873
1284
|
}
|
1874
1285
|
}
|
1875
|
-
ShoppingCartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ShoppingCartComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token: i0.ChangeDetectorRef }, { token: i2
|
1876
|
-
ShoppingCartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ShoppingCartComponent, selector: "vl-flow-shopping-cart", 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
|
1286
|
+
ShoppingCartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ShoppingCartComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token: i0.ChangeDetectorRef }, { token: i2.ToastService }, { token: i3$1.FlowInfoService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
1287
|
+
ShoppingCartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ShoppingCartComponent, selector: "vl-flow-shopping-cart", 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.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1877
1288
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ShoppingCartComponent, decorators: [{
|
1878
1289
|
type: Component,
|
1879
1290
|
args: [{ selector: 'vl-flow-shopping-cart', 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" }]
|
1880
|
-
}], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2
|
1291
|
+
}], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2.ToastService }, { type: i3$1.FlowInfoService }, { type: undefined, decorators: [{
|
1881
1292
|
type: Optional
|
1882
1293
|
}, {
|
1883
1294
|
type: Inject,
|
@@ -1899,30 +1310,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
1899
1310
|
}] });
|
1900
1311
|
|
1901
1312
|
class FlowResolver {
|
1902
|
-
constructor(router, routerService,
|
1313
|
+
constructor(router, routerService, flowInfoService) {
|
1903
1314
|
this.router = router;
|
1904
1315
|
this.routerService = routerService;
|
1905
|
-
this.
|
1906
|
-
this.flowInfo = flowInfo;
|
1316
|
+
this.flowInfoService = flowInfoService;
|
1907
1317
|
}
|
1908
1318
|
resolve(route) {
|
1909
|
-
|
1910
|
-
const flow = this.flowInfo.flow;
|
1911
|
-
if (!flow) {
|
1319
|
+
if (!this.flowInfoService.isFlowInitialized) {
|
1912
1320
|
return of(false);
|
1913
1321
|
}
|
1914
|
-
const {
|
1322
|
+
const { queryParams } = route;
|
1323
|
+
const { properties } = this.flowInfoService.flow;
|
1915
1324
|
const { queryParams: flowQueryParams, entryPath } = properties;
|
1916
1325
|
const mergedQueryParams = {
|
1917
1326
|
...queryParams,
|
1918
1327
|
...flowQueryParams,
|
1919
1328
|
};
|
1920
|
-
const contextProperties = Object.entries({
|
1921
|
-
...mergedQueryParams,
|
1922
|
-
...getDefaultProperties({ flowParams: properties }),
|
1923
|
-
}).reduce((trunk, [key, value]) => ({ ...trunk, [key]: String(value) }), {});
|
1924
|
-
this.contextService.update({ properties: contextProperties });
|
1925
|
-
this.flowInfo.flow = flow;
|
1926
1329
|
const parentUrl = this.routerService.getFlowRootPath(route);
|
1927
1330
|
const entryUrl = String(entryPath ?? '')
|
1928
1331
|
.split('/')
|
@@ -1931,29 +1334,29 @@ class FlowResolver {
|
|
1931
1334
|
queryParams: mergedQueryParams,
|
1932
1335
|
replaceUrl: true,
|
1933
1336
|
})).pipe(catchError$1(e => {
|
1337
|
+
console.error(e);
|
1934
1338
|
const message = e instanceof HttpErrorResponse ? e.error.message : e;
|
1935
1339
|
const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
|
1936
1340
|
return this.routerService.showErrorPage$(message, errorDetails);
|
1937
1341
|
}));
|
1938
1342
|
}
|
1939
1343
|
}
|
1940
|
-
FlowResolver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowResolver, deps: [{ token: i1$2.Router }, { token: FlowRouterService }, { token:
|
1344
|
+
FlowResolver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowResolver, deps: [{ token: i1$2.Router }, { token: FlowRouterService }, { token: i3$1.FlowInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1941
1345
|
FlowResolver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowResolver });
|
1942
1346
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowResolver, decorators: [{
|
1943
1347
|
type: Injectable
|
1944
|
-
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type:
|
1348
|
+
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i3$1.FlowInfoService }]; } });
|
1945
1349
|
|
1946
|
-
class
|
1947
|
-
constructor(router,
|
1350
|
+
class SalesTransactionResolver {
|
1351
|
+
constructor(router, routerService, flowInfoService, flowStateService, salesTransactionService) {
|
1948
1352
|
this.router = router;
|
1949
|
-
this.quoteDraftService = quoteDraftService;
|
1950
1353
|
this.routerService = routerService;
|
1951
|
-
this.
|
1952
|
-
this.flowInfo = flowInfo;
|
1354
|
+
this.flowInfoService = flowInfoService;
|
1953
1355
|
this.flowStateService = flowStateService;
|
1356
|
+
this.salesTransactionService = salesTransactionService;
|
1954
1357
|
}
|
1955
1358
|
resolve(route) {
|
1956
|
-
const flow = this.
|
1359
|
+
const flow = this.flowInfoService.flow;
|
1957
1360
|
if (!flow) {
|
1958
1361
|
return of(false);
|
1959
1362
|
}
|
@@ -1961,13 +1364,14 @@ class QuoteResolver {
|
|
1961
1364
|
return of(true);
|
1962
1365
|
}
|
1963
1366
|
return this.flowStateService.init$().pipe(switchMap(() => this.checkDynamicNavigation$(route)), catchError(e => {
|
1367
|
+
console.error(e);
|
1964
1368
|
const message = e instanceof HttpErrorResponse ? e.error.message : e;
|
1965
1369
|
const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
|
1966
1370
|
return this.routerService.showErrorPage$(message, errorDetails);
|
1967
1371
|
}));
|
1968
1372
|
}
|
1969
1373
|
checkDynamicNavigation$(route) {
|
1970
|
-
const flow = this.
|
1374
|
+
const flow = this.flowInfoService.flow;
|
1971
1375
|
if (!flow) {
|
1972
1376
|
return of(true);
|
1973
1377
|
}
|
@@ -1986,7 +1390,7 @@ class QuoteResolver {
|
|
1986
1390
|
}));
|
1987
1391
|
}
|
1988
1392
|
getNavigateTo() {
|
1989
|
-
const flow = this.
|
1393
|
+
const flow = this.flowInfoService.flow;
|
1990
1394
|
let navigateTo;
|
1991
1395
|
if (flow?.properties.stateful) {
|
1992
1396
|
return this.flowStateService.select$(UITemplateType.FLOW_ENGINE, 'NAVIGATE_TO').pipe(map(r => {
|
@@ -1997,22 +1401,61 @@ class QuoteResolver {
|
|
1997
1401
|
}));
|
1998
1402
|
}
|
1999
1403
|
else {
|
2000
|
-
const isAccountMode = this.
|
2001
|
-
|
1404
|
+
const isAccountMode = this.flowInfoService.context.mode === 'ACCOUNT';
|
1405
|
+
const { hasAssets, hasProducts } = this.salesTransactionService;
|
1406
|
+
if (isAccountMode || hasAssets) {
|
2002
1407
|
navigateTo = '/assets';
|
2003
1408
|
}
|
2004
|
-
else if (
|
1409
|
+
else if (hasProducts) {
|
2005
1410
|
navigateTo = '/cart';
|
2006
1411
|
}
|
2007
1412
|
}
|
2008
1413
|
return of(navigateTo);
|
2009
1414
|
}
|
2010
1415
|
}
|
2011
|
-
|
2012
|
-
|
2013
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
1416
|
+
SalesTransactionResolver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionResolver, deps: [{ token: i1$2.Router }, { token: FlowRouterService }, { token: i3$1.FlowInfoService }, { token: i3$1.FlowStateService }, { token: i3$1.SalesTransactionService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1417
|
+
SalesTransactionResolver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionResolver });
|
1418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionResolver, decorators: [{
|
2014
1419
|
type: Injectable
|
2015
|
-
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type:
|
1420
|
+
}], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i3$1.FlowInfoService }, { type: i3$1.FlowStateService }, { type: i3$1.SalesTransactionService }]; } });
|
1421
|
+
|
1422
|
+
const resolveUIDefinition = () => {
|
1423
|
+
const customizationService = inject(FLOW_CUSTOMIZATION, { optional: true });
|
1424
|
+
const flowInfoService = inject(FlowInfoService);
|
1425
|
+
const uiDefinitionsApiService = inject(UIDefinitionsApiService);
|
1426
|
+
const configurationRuntimeService = inject(ConfigurationRuntimeService);
|
1427
|
+
const { productId } = flowInfoService.context;
|
1428
|
+
if (!productId) {
|
1429
|
+
throw new Error(`Unable to start configuration for 'productId == null'`);
|
1430
|
+
}
|
1431
|
+
return of(undefined).pipe(switchMap(() => {
|
1432
|
+
// Try resolving via customization service
|
1433
|
+
if (!productId || !customizationService?.getUiDefinition) {
|
1434
|
+
return of(undefined);
|
1435
|
+
}
|
1436
|
+
return customizationService.getUiDefinition(productId);
|
1437
|
+
}), switchMap(uiDefContainer => {
|
1438
|
+
// Resolve UIDefinition from the org
|
1439
|
+
if (uiDefContainer) {
|
1440
|
+
return of(uiDefContainer);
|
1441
|
+
}
|
1442
|
+
if (flowInfoService.context.requiredUIDefinitionId) {
|
1443
|
+
return uiDefinitionsApiService.fetchUIDefinition$(flowInfoService.context.requiredUIDefinitionId);
|
1444
|
+
}
|
1445
|
+
return uiDefinitionsApiService
|
1446
|
+
.fetchUIDefinitions$({
|
1447
|
+
productId,
|
1448
|
+
defaultUIDefinitionId: flowInfoService.context.defaultUIDefinitionId,
|
1449
|
+
})
|
1450
|
+
.pipe(map((uiDefinitionContainers) => {
|
1451
|
+
const uiDefContainer = uiDefinitionContainers[0];
|
1452
|
+
if (!uiDefContainer) {
|
1453
|
+
throw new Error(`UI Definition for productId=${productId} is not resolved`);
|
1454
|
+
}
|
1455
|
+
return uiDefContainer;
|
1456
|
+
}));
|
1457
|
+
}), tap(uiDefContainer => (configurationRuntimeService.uiDefinitionContainer = uiDefContainer)));
|
1458
|
+
};
|
2016
1459
|
|
2017
1460
|
const rootRoute = {
|
2018
1461
|
id: VELOCE_FLOW_ROOT_ROUTE,
|
@@ -2030,15 +1473,13 @@ const rootRoute = {
|
|
2030
1473
|
path: 'flows',
|
2031
1474
|
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
|
2032
1475
|
resolve: { flow: FlowResolver },
|
2033
|
-
canActivate: [ContextGuard],
|
2034
1476
|
children: [],
|
2035
1477
|
},
|
2036
1478
|
{
|
2037
1479
|
path: 'product',
|
2038
1480
|
component: ProductComponent,
|
2039
1481
|
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
|
2040
|
-
resolve: {
|
2041
|
-
canActivate: [ContextGuard],
|
1482
|
+
resolve: { salesTransaction: SalesTransactionResolver, uiDef: resolveUIDefinition },
|
2042
1483
|
canDeactivate: [ProductUnloadGuard],
|
2043
1484
|
data: { showHeader: true },
|
2044
1485
|
},
|
@@ -2046,33 +1487,23 @@ const rootRoute = {
|
|
2046
1487
|
path: 'cart',
|
2047
1488
|
component: ShoppingCartComponent,
|
2048
1489
|
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
|
2049
|
-
resolve: {
|
2050
|
-
canActivate: [ContextGuard],
|
1490
|
+
resolve: { salesTransaction: SalesTransactionResolver },
|
2051
1491
|
data: { showHeader: true },
|
2052
1492
|
},
|
2053
1493
|
{
|
2054
1494
|
path: 'catalog',
|
2055
1495
|
component: CatalogComponent,
|
2056
1496
|
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
|
2057
|
-
resolve: {
|
2058
|
-
canActivate: [ContextGuard],
|
1497
|
+
resolve: { salesTransaction: SalesTransactionResolver },
|
2059
1498
|
data: { showHeader: true },
|
2060
1499
|
},
|
2061
1500
|
{
|
2062
1501
|
path: 'assets',
|
2063
1502
|
component: AssetsComponent,
|
2064
1503
|
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
|
2065
|
-
resolve: {
|
2066
|
-
canActivate: [ContextGuard],
|
1504
|
+
resolve: { salesTransaction: SalesTransactionResolver },
|
2067
1505
|
data: { showHeader: true },
|
2068
1506
|
},
|
2069
|
-
{
|
2070
|
-
path: 'remote',
|
2071
|
-
component: RemoteComponent,
|
2072
|
-
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
|
2073
|
-
resolve: { quote: QuoteResolver },
|
2074
|
-
canActivate: [ContextGuard],
|
2075
|
-
},
|
2076
1507
|
{
|
2077
1508
|
path: 'debug',
|
2078
1509
|
loadChildren: () => DebugModule,
|
@@ -2088,30 +1519,14 @@ const rootRoute = {
|
|
2088
1519
|
class FlowRoutingModule {
|
2089
1520
|
}
|
2090
1521
|
FlowRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
2091
|
-
FlowRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, imports: [i1$2.RouterModule, ProductModule,
|
2092
|
-
|
2093
|
-
CatalogModule,
|
2094
|
-
AssetsModule,
|
2095
|
-
RemoteModule], exports: [RouterModule] });
|
2096
|
-
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]),
|
2097
|
-
ProductModule,
|
2098
|
-
ShoppingCartModule,
|
2099
|
-
CatalogModule,
|
2100
|
-
AssetsModule,
|
2101
|
-
RemoteModule, RouterModule] });
|
1522
|
+
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] });
|
1523
|
+
FlowRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, providers: [FlowRouterService, RootGuard, ProductUnloadGuard, FlowResolver, SalesTransactionResolver], imports: [RouterModule.forChild([rootRoute]), ProductModule, ShoppingCartModule, CatalogModule, AssetsModule, RouterModule] });
|
2102
1524
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, decorators: [{
|
2103
1525
|
type: NgModule,
|
2104
1526
|
args: [{
|
2105
|
-
imports: [
|
2106
|
-
RouterModule.forChild([rootRoute]),
|
2107
|
-
ProductModule,
|
2108
|
-
ShoppingCartModule,
|
2109
|
-
CatalogModule,
|
2110
|
-
AssetsModule,
|
2111
|
-
RemoteModule,
|
2112
|
-
],
|
1527
|
+
imports: [RouterModule.forChild([rootRoute]), ProductModule, ShoppingCartModule, CatalogModule, AssetsModule],
|
2113
1528
|
exports: [RouterModule],
|
2114
|
-
providers: [FlowRouterService, RootGuard,
|
1529
|
+
providers: [FlowRouterService, RootGuard, ProductUnloadGuard, FlowResolver, SalesTransactionResolver],
|
2115
1530
|
}]
|
2116
1531
|
}] });
|
2117
1532
|
|
@@ -2163,5 +1578,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2163
1578
|
* Generated bundle index. Do not edit.
|
2164
1579
|
*/
|
2165
1580
|
|
2166
|
-
export {
|
1581
|
+
export { FlowDialogService, FlowModule, FlowRouterService, FlowService, VELOCE_FLOW_ROOT_ROUTE };
|
2167
1582
|
//# sourceMappingURL=veloceapps-sdk.mjs.map
|