@veloceapps/sdk 11.0.0-2 → 11.0.0-21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. package/cms/cms.actions.d.ts +92 -29
  2. package/cms/components/element-renderer/element-renderer.component.d.ts +3 -10
  3. package/cms/services/element-context.service.d.ts +0 -1
  4. package/cms/types/common.types.d.ts +2 -0
  5. package/cms/types/index.d.ts +0 -1
  6. package/cms/utils/path.utils.d.ts +1 -2
  7. package/cms/vendor-map.d.ts +19 -40
  8. package/core/index.d.ts +0 -1
  9. package/core/modules/configuration/index.d.ts +1 -4
  10. package/core/modules/configuration/services/configuration-runtime.service.d.ts +3 -22
  11. package/core/modules/configuration/services/configuration-state.service.d.ts +8 -8
  12. package/core/modules/configuration/services/configuration.service.d.ts +23 -47
  13. package/core/modules/flow-configuration/index.d.ts +0 -3
  14. package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +10 -39
  15. package/core/services/catalog-products.service.d.ts +11 -0
  16. package/core/services/flow-info.service.d.ts +25 -11
  17. package/core/services/flow-state-configuration.service.d.ts +2 -8
  18. package/core/services/flow-state.service.d.ts +13 -22
  19. package/core/services/index.d.ts +2 -3
  20. package/core/services/integration.state.d.ts +1 -1
  21. package/core/services/sales-transaction.service.d.ts +30 -0
  22. package/core/types/flow-state.types.d.ts +2 -2
  23. package/core/types/index.d.ts +0 -1
  24. package/core/utils/index.d.ts +2 -2
  25. package/core/utils/transaction-item.utils.d.ts +7 -0
  26. package/core/utils/transaction-item.worker.d.ts +8 -0
  27. package/esm2020/cms/cms.actions.mjs +93 -71
  28. package/esm2020/cms/cms.default.mjs +2 -3
  29. package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +7 -64
  30. package/esm2020/cms/components/preview/preview.component.mjs +3 -3
  31. package/esm2020/cms/services/element-context.service.mjs +1 -1
  32. package/esm2020/cms/types/common.types.mjs +1 -1
  33. package/esm2020/cms/types/index.mjs +1 -2
  34. package/esm2020/cms/utils/element.utils.mjs +3 -3
  35. package/esm2020/cms/utils/path.utils.mjs +1 -10
  36. package/esm2020/cms/vendor-map.mjs +12 -17
  37. package/esm2020/core/core.module.mjs +9 -7
  38. package/esm2020/core/index.mjs +1 -2
  39. package/esm2020/core/modules/configuration/configuration.module.mjs +3 -4
  40. package/esm2020/core/modules/configuration/index.mjs +2 -5
  41. package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +9 -102
  42. package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +60 -76
  43. package/esm2020/core/modules/configuration/services/configuration.service.mjs +96 -225
  44. package/esm2020/core/modules/flow-configuration/flow-configuration.module.mjs +3 -4
  45. package/esm2020/core/modules/flow-configuration/index.mjs +1 -4
  46. package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +33 -126
  47. package/esm2020/core/services/catalog-products.service.mjs +25 -0
  48. package/esm2020/core/services/flow-info.service.mjs +77 -29
  49. package/esm2020/core/services/flow-state-configuration.service.mjs +10 -25
  50. package/esm2020/core/services/flow-state.service.mjs +62 -169
  51. package/esm2020/core/services/index.mjs +3 -4
  52. package/esm2020/core/services/integration.state.mjs +2 -2
  53. package/esm2020/core/services/sales-transaction.service.mjs +68 -0
  54. package/esm2020/core/types/flow-state.types.mjs +1 -1
  55. package/esm2020/core/types/index.mjs +1 -2
  56. package/esm2020/core/utils/index.mjs +3 -3
  57. package/esm2020/core/utils/transaction-item.utils.mjs +60 -0
  58. package/esm2020/core/utils/transaction-item.worker.mjs +16 -0
  59. package/esm2020/src/components/flow-header/flow-header.component.mjs +3 -7
  60. package/esm2020/src/components/guided-selling/guided-selling.component.mjs +3 -7
  61. package/esm2020/src/flow-routing.module.mjs +11 -41
  62. package/esm2020/src/flow.component.mjs +5 -5
  63. package/esm2020/src/guards/flow.guard.mjs +13 -14
  64. package/esm2020/src/guards/product-unload.guard.mjs +7 -9
  65. package/esm2020/src/index.mjs +1 -3
  66. package/esm2020/src/pages/assets/assets.component.mjs +3 -4
  67. package/esm2020/src/pages/catalog/catalog.component.mjs +3 -4
  68. package/esm2020/src/pages/debug/debug.component.mjs +12 -21
  69. package/esm2020/src/pages/product/product.component.mjs +12 -82
  70. package/esm2020/src/pages/product/product.module.mjs +5 -5
  71. package/esm2020/src/pages/record-not-found/record-not-found.component.mjs +5 -6
  72. package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +3 -4
  73. package/esm2020/src/resolvers/flow.resolver.mjs +10 -18
  74. package/esm2020/src/resolvers/sales-transaction.resolver.mjs +83 -0
  75. package/esm2020/src/resolvers/ui-definition.resolver.mjs +42 -0
  76. package/esm2020/src/services/flow-dialog.service.mjs +8 -8
  77. package/esm2020/src/services/flow-router.service.mjs +16 -33
  78. package/esm2020/src/services/flow.service.mjs +13 -54
  79. package/esm2020/src/types/index.mjs +2 -3
  80. package/esm2020/src/types/route.types.mjs +1 -1
  81. package/fesm2015/veloceapps-sdk-cms.mjs +126 -268
  82. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
  83. package/fesm2015/veloceapps-sdk-core.mjs +712 -1644
  84. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  85. package/fesm2015/veloceapps-sdk.mjs +167 -763
  86. package/fesm2015/veloceapps-sdk.mjs.map +1 -1
  87. package/fesm2020/veloceapps-sdk-cms.mjs +114 -262
  88. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
  89. package/fesm2020/veloceapps-sdk-core.mjs +758 -1725
  90. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  91. package/fesm2020/veloceapps-sdk.mjs +167 -757
  92. package/fesm2020/veloceapps-sdk.mjs.map +1 -1
  93. package/package.json +1 -1
  94. package/src/components/flow-header/flow-header.component.d.ts +1 -1
  95. package/src/components/guided-selling/guided-selling.component.d.ts +1 -1
  96. package/src/flow-routing.module.d.ts +1 -2
  97. package/src/flow.component.d.ts +2 -2
  98. package/src/guards/product-unload.guard.d.ts +5 -6
  99. package/src/index.d.ts +0 -2
  100. package/src/pages/assets/assets.component.d.ts +1 -1
  101. package/src/pages/catalog/catalog.component.d.ts +1 -1
  102. package/src/pages/debug/debug.component.d.ts +1 -4
  103. package/src/pages/product/product.component.d.ts +5 -14
  104. package/src/pages/product/product.module.d.ts +1 -1
  105. package/src/pages/record-not-found/record-not-found.component.d.ts +2 -3
  106. package/src/pages/shopping-cart/shopping-cart.component.d.ts +1 -1
  107. package/src/resolvers/flow.resolver.d.ts +5 -6
  108. package/src/resolvers/sales-transaction.resolver.d.ts +18 -0
  109. package/src/resolvers/ui-definition.resolver.d.ts +3 -0
  110. package/src/services/flow-dialog.service.d.ts +5 -4
  111. package/src/services/flow-router.service.d.ts +4 -6
  112. package/src/services/flow.service.d.ts +2 -7
  113. package/src/types/index.d.ts +1 -2
  114. package/src/types/route.types.d.ts +0 -5
  115. package/cms/plugins/configuration.plugin.d.ts +0 -23
  116. package/cms/types/configuration.types.d.ts +0 -21
  117. package/core/modules/configuration/helpers.d.ts +0 -6
  118. package/core/modules/configuration/services/runtime-context.service.d.ts +0 -12
  119. package/core/modules/configuration/types/configuration-runtime.types.d.ts +0 -6
  120. package/core/modules/flow-configuration/services/flow-update.service.d.ts +0 -13
  121. package/core/modules/flow-configuration/types/update.types.d.ts +0 -12
  122. package/core/services/context.service.d.ts +0 -23
  123. package/core/services/quote-draft.service.d.ts +0 -50
  124. package/core/types/runtime.types.d.ts +0 -30
  125. package/core/utils/line-item.utils.d.ts +0 -25
  126. package/core/utils/line-item.worker.d.ts +0 -9
  127. package/esm2020/cms/plugins/configuration.plugin.mjs +0 -109
  128. package/esm2020/cms/types/configuration.types.mjs +0 -2
  129. package/esm2020/core/modules/configuration/helpers.mjs +0 -73
  130. package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +0 -43
  131. package/esm2020/core/modules/configuration/types/configuration-runtime.types.mjs +0 -2
  132. package/esm2020/core/modules/flow-configuration/services/flow-update.service.mjs +0 -138
  133. package/esm2020/core/modules/flow-configuration/types/update.types.mjs +0 -2
  134. package/esm2020/core/services/context.service.mjs +0 -91
  135. package/esm2020/core/services/quote-draft.service.mjs +0 -192
  136. package/esm2020/core/types/runtime.types.mjs +0 -16
  137. package/esm2020/core/utils/line-item.utils.mjs +0 -187
  138. package/esm2020/core/utils/line-item.worker.mjs +0 -19
  139. package/esm2020/src/guards/context.guard.mjs +0 -91
  140. package/esm2020/src/guards/index.mjs +0 -2
  141. package/esm2020/src/pages/remote/remote.component.mjs +0 -342
  142. package/esm2020/src/pages/remote/remote.module.mjs +0 -20
  143. package/esm2020/src/pages/remote/remote.types.mjs +0 -2
  144. package/esm2020/src/resolvers/quote.resolver.mjs +0 -82
  145. package/esm2020/src/types/context-route.types.mjs +0 -2
  146. package/esm2020/src/types/metrics.types.mjs +0 -2
  147. package/esm2020/src/utils/flow.utils.mjs +0 -25
  148. package/esm2020/src/utils/index.mjs +0 -2
  149. package/src/guards/context.guard.d.ts +0 -19
  150. package/src/guards/index.d.ts +0 -1
  151. package/src/pages/remote/remote.component.d.ts +0 -46
  152. package/src/pages/remote/remote.module.d.ts +0 -10
  153. package/src/pages/remote/remote.types.d.ts +0 -4
  154. package/src/resolvers/quote.resolver.d.ts +0 -19
  155. package/src/types/context-route.types.d.ts +0 -5
  156. package/src/types/metrics.types.d.ts +0 -5
  157. package/src/utils/flow.utils.d.ts +0 -8
  158. 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$1 from '@veloceapps/api';
5
+ import * as i1$3 from '@veloceapps/api';
6
6
  import { ApiModule } from '@veloceapps/api';
7
- import * as i2$1 from '@veloceapps/components';
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 i2 from '@veloceapps/sdk/core';
12
- import { FLOW_CUSTOMIZATION, ContextService, FlowStateService, FlowInfoService, QuoteDraftService, ConfigurationService, IntegrationState, SdkCoreModule } from '@veloceapps/sdk/core';
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 { BehaviorSubject, Subject, filter, first, tap, takeUntil, catchError, of, map, switchMap, shareReplay, startWith, distinctUntilChanged, from, take, combineLatest, forkJoin, throwError } from 'rxjs';
16
+ import { BehaviorSubject, Subject, filter, first, tap, takeUntil, catchError, of, map, switchMap, shareReplay, startWith, distinctUntilChanged, from, take, combineLatest } from 'rxjs';
17
+ import * as i1$1 from '@veloceapps/api/v2';
18
+ import { UIDefinitionsApiService } from '@veloceapps/api/v2';
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 { UITemplateType, SalesforceIdUtils, mapShoppingCartSettings, getMaxRenewalTermsValue, ConfigurationContextMode, isVeloceError, extractErrorDetails, UUID } from '@veloceapps/core';
22
+ import { SalesforceIdUtils, mapShoppingCartSettings, getMaxRenewalTermsValue, UITemplateType, isVeloceError, extractErrorDetails } from '@veloceapps/core';
21
23
  import { HttpErrorResponse, HttpParams } from '@angular/common/http';
22
- import * as i5$1 from '@angular/forms';
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 i8 from 'primeng/inputtext';
27
+ import * as i7 from 'primeng/inputtext';
26
28
  import { InputTextModule } from 'primeng/inputtext';
27
- import * as i6 from 'primeng/radiobutton';
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';
@@ -98,9 +99,6 @@ class FlowHeaderComponent {
98
99
  initialize() {
99
100
  var _a, _b, _c;
100
101
  this.templateApiName = (_c = (_b = (_a = this.flowInfo.flow) === null || _a === void 0 ? void 0 : _a.properties.templates) === null || _b === void 0 ? void 0 : _b.flowHeader) !== null && _c !== void 0 ? _c : '';
101
- if (this.flowInfo.isLegacy && !this.templateApiName) {
102
- return;
103
- }
104
102
  this.generateUIDefinition$()
105
103
  .pipe(tap(uiDef => {
106
104
  if (!uiDef) {
@@ -151,7 +149,6 @@ class FlowHeaderComponent {
151
149
  const uiDef = {
152
150
  name: '',
153
151
  createdTimestamp: 0,
154
- primary: true,
155
152
  type: 'DEFAULT',
156
153
  version: 2,
157
154
  children: metaList.map(meta => ({
@@ -165,13 +162,13 @@ class FlowHeaderComponent {
165
162
  }));
166
163
  }
167
164
  }
168
- FlowHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowHeaderComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token: i2.FlowStateService }, { token: i2.FlowInfoService }, { token: i2$1.ToastService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
165
+ 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 });
169
166
  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 });
170
167
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowHeaderComponent, decorators: [{
171
168
  type: Component,
172
169
  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"] }]
173
170
  }], ctorParameters: function () {
174
- return [{ type: i1$1.UITemplatesApiService }, { type: i2.FlowStateService }, { type: i2.FlowInfoService }, { type: i2$1.ToastService }, { type: undefined, decorators: [{
171
+ return [{ type: i1$1.UITemplatesApiService }, { type: i3$1.FlowStateService }, { type: i3$1.FlowInfoService }, { type: i2.ToastService }, { type: undefined, decorators: [{
175
172
  type: Optional
176
173
  }, {
177
174
  type: Inject,
@@ -216,9 +213,6 @@ class GuidedSellingComponent {
216
213
  initialize() {
217
214
  var _a, _b, _c;
218
215
  this.templateApiName = (_c = (_b = (_a = this.flowInfo.flow) === null || _a === void 0 ? void 0 : _a.properties.templates) === null || _b === void 0 ? void 0 : _b.guidedSelling) !== null && _c !== void 0 ? _c : '';
219
- if (this.flowInfo.isLegacy && !this.templateApiName) {
220
- return;
221
- }
222
216
  this.generateUIDefinition$()
223
217
  .pipe(tap(uiDef => {
224
218
  if (!uiDef) {
@@ -269,7 +263,6 @@ class GuidedSellingComponent {
269
263
  const uiDef = {
270
264
  name: '',
271
265
  createdTimestamp: 0,
272
- primary: true,
273
266
  type: 'DEFAULT',
274
267
  version: 2,
275
268
  children: metaList.map(meta => ({
@@ -283,13 +276,13 @@ class GuidedSellingComponent {
283
276
  }));
284
277
  }
285
278
  }
286
- GuidedSellingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token: i2.FlowStateService }, { token: i2.FlowInfoService }, { token: i2$1.ToastService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
279
+ 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 });
287
280
  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 });
288
281
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingComponent, decorators: [{
289
282
  type: Component,
290
283
  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"] }]
291
284
  }], ctorParameters: function () {
292
- return [{ type: i1$1.UITemplatesApiService }, { type: i2.FlowStateService }, { type: i2.FlowInfoService }, { type: i2$1.ToastService }, { type: undefined, decorators: [{
285
+ return [{ type: i1$1.UITemplatesApiService }, { type: i3$1.FlowStateService }, { type: i3$1.FlowInfoService }, { type: i2.ToastService }, { type: undefined, decorators: [{
293
286
  type: Optional
294
287
  }, {
295
288
  type: Inject,
@@ -344,13 +337,11 @@ const configurePrimengShadowDOM = () => {
344
337
  };
345
338
 
346
339
  class FlowRouterService {
347
- constructor(router, route, contextService, integrationState, flowInfoService, flowStateService) {
340
+ constructor(router, route, integrationState, flowInfoService) {
348
341
  this.router = router;
349
342
  this.route = route;
350
- this.contextService = contextService;
351
343
  this.integrationState = integrationState;
352
344
  this.flowInfoService = flowInfoService;
353
- this.flowStateService = flowStateService;
354
345
  this.urlHistory = [];
355
346
  this.getLastChildRoute = (route) => {
356
347
  return route.firstChild ? this.getLastChildRoute(route.firstChild) : route;
@@ -445,7 +436,7 @@ class FlowRouterService {
445
436
  this.router.navigateByUrl(prevUrl);
446
437
  }
447
438
  }
448
- navigateTo(path, productId, lineItemId) {
439
+ navigateTo(path, productId, transactionItemId) {
449
440
  if (path === 'shopping-cart') {
450
441
  this.navigateToShoppingCart();
451
442
  }
@@ -456,31 +447,16 @@ class FlowRouterService {
456
447
  this.navigateToAssets();
457
448
  }
458
449
  else if (path === 'product' && productId) {
459
- this.navigateToProductConfiguration(productId, lineItemId);
450
+ this.navigateToProductConfiguration(productId, transactionItemId);
460
451
  }
461
452
  }
462
- navigateToProductConfiguration(productId, lineItemId) {
463
- let updateContext$;
464
- if (this.flowInfoService.isLegacy) {
465
- updateContext$ = of(undefined).pipe(tap(() => {
466
- this.contextService.update({ properties: { productId, lineItemId: lineItemId !== null && lineItemId !== void 0 ? lineItemId : '' } });
467
- }));
468
- }
469
- else {
470
- updateContext$ = this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'UPDATE_CONTEXT_PROPERTIES', {
471
- productId,
472
- lineItemId: lineItemId !== null && lineItemId !== void 0 ? lineItemId : '',
473
- });
474
- }
475
- updateContext$
476
- .pipe(tap(() => {
477
- const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
478
- const flowRouteUrl = this.getFlowRootPath(routeSnapshot);
479
- this.router.navigate([flowRouteUrl, 'product'], {
480
- queryParams: Object.assign(Object.assign({}, routeSnapshot.queryParams), { productId }),
481
- });
482
- }))
483
- .subscribe();
453
+ navigateToProductConfiguration(productId, transactionItemId) {
454
+ this.flowInfoService.updateContext({ productId, transactionItemId });
455
+ const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
456
+ const flowRouteUrl = this.getFlowRootPath(routeSnapshot);
457
+ this.router.navigate([flowRouteUrl, 'product'], {
458
+ queryParams: Object.assign(Object.assign({}, routeSnapshot.queryParams), { productId, transactionItemId }),
459
+ });
484
460
  }
485
461
  navigateToShoppingCart() {
486
462
  const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
@@ -517,18 +493,18 @@ class FlowRouterService {
517
493
  this.router.navigate([], { relativeTo: route, queryParams: Object.assign(Object.assign({}, routeSnapshot.queryParams), queryParams) });
518
494
  }
519
495
  }
520
- FlowRouterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRouterService, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }, { token: i2.ContextService }, { token: i2.IntegrationState }, { token: i2.FlowInfoService }, { token: i2.FlowStateService }], target: i0.ɵɵFactoryTarget.Injectable });
496
+ 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 });
521
497
  FlowRouterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRouterService, providedIn: 'root' });
522
498
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRouterService, decorators: [{
523
499
  type: Injectable,
524
500
  args: [{ providedIn: 'root' }]
525
- }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: i2.ContextService }, { type: i2.IntegrationState }, { type: i2.FlowInfoService }, { type: i2.FlowStateService }]; } });
501
+ }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: i3$1.IntegrationState }, { type: i3$1.FlowInfoService }]; } });
526
502
 
527
503
  class FlowDialogService {
528
- constructor(dialogService, contextService, runtimeSettings) {
504
+ constructor(dialogService, runtimeSettings, flowInfoService) {
529
505
  this.dialogService = dialogService;
530
- this.contextService = contextService;
531
506
  this.runtimeSettings = runtimeSettings;
507
+ this.flowInfoService = flowInfoService;
532
508
  }
533
509
  show(config) {
534
510
  return this.dialogService.open(FlowDialogComponent, {
@@ -550,8 +526,8 @@ class FlowDialogService {
550
526
  }
551
527
  showReadonlyModeDialog() {
552
528
  var _a;
553
- const ctx = this.contextService.resolve();
554
- const objectName = ctx.mode ? ((_a = ctx.mode[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase()) + ctx.mode.substring(1).toLowerCase() : 'Object';
529
+ const mode = this.flowInfoService.context.mode;
530
+ const objectName = mode ? ((_a = mode[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase()) + mode.substring(1).toLowerCase() : 'Object';
555
531
  return this.show({
556
532
  title: 'Error',
557
533
  description: `${objectName} Cannot be Saved`,
@@ -623,22 +599,19 @@ class FlowDialogService {
623
599
  return dialogFunction(dialog);
624
600
  }
625
601
  }
626
- FlowDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService, deps: [{ token: i1.DialogService }, { token: i2.ContextService }, { token: i2.RuntimeSettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
602
+ 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 });
627
603
  FlowDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService });
628
604
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService, decorators: [{
629
605
  type: Injectable
630
- }], ctorParameters: function () { return [{ type: i1.DialogService }, { type: i2.ContextService }, { type: i2.RuntimeSettingsService }]; } });
606
+ }], ctorParameters: function () { return [{ type: i1.DialogService }, { type: i3$1.RuntimeSettingsService }, { type: i3$1.FlowInfoService }]; } });
631
607
 
632
608
  class FlowService {
633
- constructor(integrationState, flowRouterService, quoteDraftService, configurationService, configurationStateService, flowDialogService, flowConfigurationService, flowInfoService, flowStateService) {
609
+ constructor(integrationState, flowRouterService, configurationService, configurationStateService, flowDialogService, flowStateService) {
634
610
  this.integrationState = integrationState;
635
611
  this.flowRouterService = flowRouterService;
636
- this.quoteDraftService = quoteDraftService;
637
612
  this.configurationService = configurationService;
638
613
  this.configurationStateService = configurationStateService;
639
614
  this.flowDialogService = flowDialogService;
640
- this.flowConfigurationService = flowConfigurationService;
641
- this.flowInfoService = flowInfoService;
642
615
  this.flowStateService = flowStateService;
643
616
  this.cleanup$ = new Subject();
644
617
  }
@@ -648,16 +621,9 @@ class FlowService {
648
621
  initSubscriptions() {
649
622
  this.integrationState
650
623
  .listen$(FlowAction.FLOW_CONFIGURE_PRODUCT)
651
- .pipe(switchMap(payload => {
652
- var _a, _b;
653
- if (this.flowInfoService.isLegacy) {
654
- const productId = (_a = payload.productId) !== null && _a !== void 0 ? _a : (_b = this.quoteDraftService.currentState.find(li => li.id === payload.lineItemId)) === null || _b === void 0 ? void 0 : _b.productId;
655
- return of(Object.assign(Object.assign({}, payload), { productId }));
656
- }
657
- return this.prepareConfiguration$(payload.lineItemId).pipe(map(() => payload));
658
- }), tap(payload => {
624
+ .pipe(tap(payload => {
659
625
  if (payload.productId) {
660
- this.flowRouterService.navigateToProductConfiguration(payload.productId, payload.lineItemId);
626
+ this.flowRouterService.navigateToProductConfiguration(payload.productId, payload.transactionItemId);
661
627
  }
662
628
  else {
663
629
  console.warn("Parameter 'productId' is needed to start configuration");
@@ -681,7 +647,7 @@ class FlowService {
681
647
  this.integrationState.dispatch(FlowAction.ConfigureProductAction(payload));
682
648
  }
683
649
  else {
684
- this.flowRouterService.navigateTo(payload.path, payload.productId, payload.lineItemId);
650
+ this.flowRouterService.navigateTo(payload.path, payload.productId, payload.transactionItemId);
685
651
  }
686
652
  }), takeUntil(this.cleanup$))
687
653
  .subscribe();
@@ -701,17 +667,10 @@ class FlowService {
701
667
  .subscribe();
702
668
  this.integrationState
703
669
  .listen$(FlowAction.FLOW_APPLY_PRODUCT_CONFIGURATION)
704
- .pipe(switchMap(() => {
705
- if (this.flowInfoService.isLegacy) {
706
- return this.legacyApplyConfiguration();
707
- }
708
- else {
709
- return this.configurationStateService.saveConfiguration(true).pipe(switchMap(() => this.configurationStateService.cancelConfiguration()), switchMap(() => this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'MODIFY_ASSETS', {
710
- addConfiguringAssetId: true,
711
- enable: true,
712
- })));
713
- }
714
- }), tap(() => {
670
+ .pipe(switchMap(() => this.configurationStateService.saveConfiguration()), switchMap(() => this.configurationStateService.cancelConfiguration()), switchMap(() => this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'MODIFY_ASSETS', {
671
+ addConfiguringAssetId: true,
672
+ enable: true,
673
+ })), tap(() => {
715
674
  this.configurationService.hasUnsavedChanges = false;
716
675
  this.flowRouterService.navigateToShoppingCart();
717
676
  }), takeUntil(this.cleanup$))
@@ -727,36 +686,12 @@ class FlowService {
727
686
  .pipe(map(path => path.queryParams['productId']), takeUntil(this.cleanup$))
728
687
  .subscribe(productId => this.integrationState.patchState({ productId }));
729
688
  }
730
- prepareConfiguration$(lineItemId) {
731
- if (!lineItemId) {
732
- return of(undefined);
733
- }
734
- return this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'UPDATE_PRICE_LIST', {
735
- lineItemId,
736
- });
737
- }
738
- legacyApplyConfiguration() {
739
- const quoteDraft = this.quoteDraftService.quoteDraft;
740
- const lineItem = this.configurationService.getSnapshot();
741
- if (!quoteDraft || !lineItem) {
742
- return of(undefined);
743
- }
744
- const isNewLineItem = quoteDraft.currentState.every(li => li.id !== lineItem.id);
745
- let updatedState;
746
- if (isNewLineItem) {
747
- updatedState = [...quoteDraft.currentState, lineItem];
748
- }
749
- else {
750
- updatedState = quoteDraft.currentState.map(li => (li.id === lineItem.id ? lineItem : li));
751
- }
752
- return this.flowConfigurationService.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }));
753
- }
754
689
  }
755
- FlowService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowService, deps: [{ token: i5.IntegrationState }, { token: FlowRouterService }, { token: i2.QuoteDraftService }, { token: i2.ConfigurationService }, { token: i2.ConfigurationStateService }, { token: FlowDialogService }, { token: i2.FlowConfigurationService }, { token: i2.FlowInfoService }, { token: i2.FlowStateService }], target: i0.ɵɵFactoryTarget.Injectable });
690
+ 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 });
756
691
  FlowService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowService });
757
692
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowService, decorators: [{
758
693
  type: Injectable
759
- }], ctorParameters: function () { return [{ type: i5.IntegrationState }, { type: FlowRouterService }, { type: i2.QuoteDraftService }, { type: i2.ConfigurationService }, { type: i2.ConfigurationStateService }, { type: FlowDialogService }, { type: i2.FlowConfigurationService }, { type: i2.FlowInfoService }, { type: i2.FlowStateService }]; } });
694
+ }], ctorParameters: function () { return [{ type: i5.IntegrationState }, { type: FlowRouterService }, { type: i3$1.ConfigurationService }, { type: i3$1.ConfigurationStateService }, { type: FlowDialogService }, { type: i3$1.FlowStateService }]; } });
760
695
 
761
696
  class FlowGuidedSellingService {
762
697
  constructor(integrationState) {
@@ -780,21 +715,21 @@ class FlowGuidedSellingService {
780
715
  .subscribe();
781
716
  }
782
717
  }
783
- FlowGuidedSellingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowGuidedSellingService, deps: [{ token: i2.IntegrationState }], target: i0.ɵɵFactoryTarget.Injectable });
718
+ 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 });
784
719
  FlowGuidedSellingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowGuidedSellingService });
785
720
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowGuidedSellingService, decorators: [{
786
721
  type: Injectable
787
- }], ctorParameters: function () { return [{ type: i2.IntegrationState }]; } });
722
+ }], ctorParameters: function () { return [{ type: i3$1.IntegrationState }]; } });
788
723
 
789
724
  class FlowComponent {
790
- constructor(routerService, flowService, flowInfo, guidedSellingService) {
725
+ constructor(routerService, flowService, flowInfoService, guidedSellingService) {
791
726
  this.routerService = routerService;
792
727
  this.flowService = flowService;
793
- this.flowInfo = flowInfo;
728
+ this.flowInfoService = flowInfoService;
794
729
  this.guidedSellingService = guidedSellingService;
795
730
  this.isLoading$ = this.routerService.loading$;
796
- this.showHeader$ = combineLatest([this.routerService.route$, this.flowInfo.flow$]).pipe(map(([route, flow]) => route.data['showHeader'] && !(flow === null || flow === void 0 ? void 0 : flow.properties.standalone)));
797
- this.isStandalone$ = this.flowInfo.flow$.pipe(map(flow => Boolean(flow === null || flow === void 0 ? void 0 : flow.properties.standalone)));
731
+ this.showHeader$ = combineLatest([this.routerService.route$, this.flowInfoService.flow$]).pipe(map(([route, flow]) => route.data['showHeader'] && !(flow === null || flow === void 0 ? void 0 : flow.properties.standalone)));
732
+ this.isStandalone$ = this.flowInfoService.flow$.pipe(map(flow => Boolean(flow === null || flow === void 0 ? void 0 : flow.properties.standalone)));
798
733
  this.guidedSellingVisible$ = this.guidedSellingService.isVisible$;
799
734
  this.flowService.initSubscriptions();
800
735
  }
@@ -802,135 +737,36 @@ class FlowComponent {
802
737
  this.flowService.cleanup();
803
738
  }
804
739
  }
805
- FlowComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowComponent, deps: [{ token: FlowRouterService }, { token: FlowService }, { token: i2.FlowInfoService }, { token: FlowGuidedSellingService }], target: i0.ɵɵFactoryTarget.Component });
806
- 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$1.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 });
740
+ 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 });
741
+ 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 });
807
742
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowComponent, decorators: [{
808
743
  type: Component,
809
744
  args: [{ selector: 'vl-flow', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-flow-new-header *ngIf=\"showHeader$ | async\"></vl-flow-new-header>\n\n<div class=\"flow-content\">\n <div class=\"loading-overlay\" *ngIf=\"isLoading$ | async\">\n <vl-loader label=\"LOADING\"></vl-loader>\n </div>\n\n <router-outlet></router-outlet>\n\n <div class=\"guided-selling\" [ngClass]=\"{ hidden: (guidedSellingVisible$ | async) === false }\">\n <vl-flow-guided-selling *ngIf=\"(isStandalone$ | async) !== true\"></vl-flow-guided-selling>\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column;width:100%;height:100%}.flow-content{flex-grow:1;position:relative;overflow:hidden}.loading-overlay{position:absolute;height:100%;width:100%;inset:0;background-color:#fff;z-index:999}.guided-selling{position:absolute;top:0;width:100%;height:100%;z-index:100}.hidden{display:none}\n"] }]
810
- }], ctorParameters: function () { return [{ type: FlowRouterService }, { type: FlowService }, { type: i2.FlowInfoService }, { type: FlowGuidedSellingService }]; } });
811
-
812
- const getFlowObjectIdPropertyName = (id) => {
813
- const objectName = SalesforceIdUtils.getSfObjectNameById(id);
814
- switch (objectName) {
815
- case 'Account':
816
- return 'accountId';
817
- case 'Order':
818
- return 'orderId';
819
- case 'Quote':
820
- default:
821
- return 'quoteId';
822
- }
823
- };
824
- const getDefaultProperties = (params) => {
825
- var _a, _b;
826
- const properties = {};
827
- let standalone = (_a = params.flowParams) === null || _a === void 0 ? void 0 : _a.standalone;
828
- if (((_b = params.flowParams) === null || _b === void 0 ? void 0 : _b.entryPath.includes('/product')) || params.mode === ConfigurationContextMode.REMOTE) {
829
- standalone = standalone !== null && standalone !== void 0 ? standalone : true;
830
- }
831
- if (standalone != null) {
832
- properties.standalone = standalone ? 'true' : 'false';
833
- }
834
- return properties;
835
- };
836
-
837
- class ContextGuard {
838
- constructor(router, routerService, contextService, runtimeSettingsService) {
839
- this.router = router;
840
- this.routerService = routerService;
841
- this.contextService = contextService;
842
- this.runtimeSettingsService = runtimeSettingsService;
843
- }
844
- checkActivation(route) {
845
- const { queryParams } = route;
846
- const { accountId, quoteId, orderId } = queryParams;
847
- const rpcMessage = window.RPC_MESSAGE;
848
- const mode = this.getConfigurationContextMode(accountId, quoteId, orderId, rpcMessage);
849
- // Restrict if mode is not defined
850
- if (mode == null) {
851
- return this.routerService.showErrorPage$('Mode is undefined');
852
- }
853
- const headerId = accountId || quoteId || orderId || this.rpcMessageId || 'empty-for-test-mode';
854
- // Allow if context is already initialized with the same headerId
855
- if (this.contextService.isInitialized) {
856
- const currentContext = this.contextService.resolve();
857
- if (headerId && currentContext.headerId === headerId) {
858
- return of(true);
859
- }
860
- }
861
- // Initialize context and runtime settings
862
- return forkJoin([this.contextService.create(headerId, mode), this.runtimeSettingsService.create()]).pipe(tap(([context]) => {
863
- this.contextService.update(Object.assign(Object.assign({}, context), { properties: Object.assign(Object.assign(Object.assign({}, context.properties), (queryParams !== null && queryParams !== void 0 ? queryParams : {})), getDefaultProperties({ mode })) }));
864
- // Init currency settings
865
- this.runtimeSettingsService.initCurrency(context.properties['CurrencyIsoCode']);
866
- }), map(() => true), catchError(e => {
867
- const message = e instanceof HttpErrorResponse ? e.error.message : e;
868
- const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
869
- return this.routerService.showErrorPage$(message, errorDetails);
870
- }));
871
- }
872
- canActivate(route) {
873
- return this.checkActivation(route);
874
- }
875
- canActivateChild(childRoute) {
876
- return this.checkActivation(childRoute);
877
- }
878
- get rpcMessageId() {
879
- var _a, _b;
880
- if (!window.RPC_MESSAGE) {
881
- return;
882
- }
883
- const rpcMessage = JSON.parse(window.RPC_MESSAGE);
884
- const veloceReferenceId = (_a = rpcMessage.configuration) === null || _a === void 0 ? void 0 : _a.VeloceReferenceId;
885
- const quoteId = (_b = rpcMessage.quote) === null || _b === void 0 ? void 0 : _b.Id;
886
- return veloceReferenceId || quoteId;
887
- }
888
- getConfigurationContextMode(accountId, quoteId, orderId, rpcMessage) {
889
- if (accountId) {
890
- return ConfigurationContextMode.ACCOUNT;
891
- }
892
- if (quoteId) {
893
- return ConfigurationContextMode.QUOTE;
894
- }
895
- if (orderId) {
896
- return ConfigurationContextMode.ORDER;
897
- }
898
- if (rpcMessage) {
899
- return ConfigurationContextMode.REMOTE;
900
- }
901
- return;
902
- }
903
- }
904
- ContextGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextGuard, deps: [{ token: i1$2.Router }, { token: FlowRouterService }, { token: i2.ContextService }, { token: i2.RuntimeSettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
905
- ContextGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextGuard });
906
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextGuard, decorators: [{
907
- type: Injectable
908
- }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i2.ContextService }, { type: i2.RuntimeSettingsService }]; } });
745
+ }], ctorParameters: function () { return [{ type: FlowRouterService }, { type: FlowService }, { type: i3$1.FlowInfoService }, { type: FlowGuidedSellingService }]; } });
909
746
 
910
747
  const keepFlowInitialized = (route) => {
911
- const contextService = inject(ContextService);
748
+ const routerService = inject(FlowRouterService);
749
+ const runtimeSettingsService = inject(RuntimeSettingsService);
912
750
  const flowState = inject(FlowStateService);
913
751
  const flowInfoService = inject(FlowInfoService);
914
- const routerService = inject(FlowRouterService);
915
- const quoteDraft = inject(QuoteDraftService);
752
+ const salesTrasnsactionService = inject(SalesTransactionService);
916
753
  const configurationService = inject(ConfigurationService);
917
754
  const integrationState = inject(IntegrationState);
918
755
  const { flowId } = route.queryParams;
919
- const flow = flowInfoService.flow;
920
- if (flow && (flow === null || flow === void 0 ? void 0 : flow.id) === flowId) {
756
+ if (flowInfoService.isFlowInitialized && flowInfoService.flow.id === flowId) {
921
757
  return true;
922
758
  }
923
759
  // Cleanup
924
- flowState.cleanup();
925
- quoteDraft.reset();
760
+ flowState.reset();
761
+ salesTrasnsactionService.reset();
926
762
  configurationService.reset();
927
- integrationState.clear();
928
- flowInfoService.cleanup();
929
- contextService.delete();
763
+ integrationState.reset();
764
+ flowInfoService.reset();
930
765
  if (!flowId) {
931
766
  return true;
932
767
  }
933
- return flowInfoService.init$(flowId, route.queryParams).pipe(map(() => true), catchError(e => {
768
+ return runtimeSettingsService.create().pipe(tap(() => runtimeSettingsService.initCurrency('USD')), switchMap(() => flowInfoService.init$(flowId, route.queryParams)), map(() => true), catchError(e => {
769
+ console.error(e);
934
770
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
935
771
  const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
936
772
  return routerService.showErrorPage$(message, errorDetails);
@@ -938,22 +774,20 @@ const keepFlowInitialized = (route) => {
938
774
  };
939
775
 
940
776
  class ProductUnloadGuard {
941
- constructor(router, contextService, quoteDraftService, configurationService, flowDialogService) {
777
+ constructor(router, flowInfoService, configurationService, flowDialogService) {
942
778
  this.router = router;
943
- this.contextService = contextService;
944
- this.quoteDraftService = quoteDraftService;
779
+ this.flowInfoService = flowInfoService;
945
780
  this.configurationService = configurationService;
946
781
  this.flowDialogService = flowDialogService;
947
782
  }
948
783
  canDeactivate(_, route, currentState, nextState) {
949
784
  let observable = of(true);
950
- if (!this.quoteDraftService.isStandalone && this.configurationService.hasUnsavedChanges) {
785
+ if (!this.flowInfoService.flow.properties.standalone && this.configurationService.hasUnsavedChanges) {
951
786
  observable = this.flowDialogService.showUnsavedChangesDialog();
952
787
  }
953
788
  return observable.pipe(map(unload => {
954
789
  if (unload) {
955
790
  this.configurationService.reset();
956
- this.contextService.update({ properties: { productId: undefined, lineItemId: undefined } });
957
791
  if (!nextState || currentState.url === nextState.url) {
958
792
  return true;
959
793
  }
@@ -971,11 +805,11 @@ class ProductUnloadGuard {
971
805
  }));
972
806
  }
973
807
  }
974
- ProductUnloadGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard, deps: [{ token: i1$2.Router }, { token: i2.ContextService }, { token: i2.QuoteDraftService }, { token: i2.ConfigurationService }, { token: FlowDialogService }], target: i0.ɵɵFactoryTarget.Injectable });
808
+ 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 });
975
809
  ProductUnloadGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard });
976
810
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard, decorators: [{
977
811
  type: Injectable
978
- }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i2.ContextService }, { type: i2.QuoteDraftService }, { type: i2.ConfigurationService }, { type: FlowDialogService }]; } });
812
+ }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i3$1.FlowInfoService }, { type: i3$1.ConfigurationService }, { type: FlowDialogService }]; } });
979
813
 
980
814
  class RootGuard {
981
815
  constructor(router, routerService) {
@@ -1089,7 +923,6 @@ class AssetsComponent {
1089
923
  const uiDef = {
1090
924
  name: '',
1091
925
  createdTimestamp: 0,
1092
- primary: true,
1093
926
  type: 'DEFAULT',
1094
927
  version: 2,
1095
928
  children: metaList.map(meta => ({
@@ -1103,13 +936,13 @@ class AssetsComponent {
1103
936
  }));
1104
937
  }
1105
938
  }
1106
- 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$1.ToastService }, { token: i2.FlowInfoService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1107
- 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$1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
939
+ 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 });
940
+ 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 });
1108
941
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AssetsComponent, decorators: [{
1109
942
  type: Component,
1110
943
  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" }]
1111
944
  }], ctorParameters: function () {
1112
- return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2$1.ToastService }, { type: i2.FlowInfoService }, { type: undefined, decorators: [{
945
+ return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2.ToastService }, { type: i3$1.FlowInfoService }, { type: undefined, decorators: [{
1113
946
  type: Optional
1114
947
  }, {
1115
948
  type: Inject,
@@ -1203,7 +1036,6 @@ class CatalogComponent {
1203
1036
  const uiDef = {
1204
1037
  name: '',
1205
1038
  createdTimestamp: 0,
1206
- primary: true,
1207
1039
  type: 'DEFAULT',
1208
1040
  version: 2,
1209
1041
  children: metaList.map(meta => ({
@@ -1217,13 +1049,13 @@ class CatalogComponent {
1217
1049
  }));
1218
1050
  }
1219
1051
  }
1220
- 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$1.ToastService }, { token: i2.FlowInfoService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1221
- 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$1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1052
+ 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 });
1053
+ 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 });
1222
1054
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogComponent, decorators: [{
1223
1055
  type: Component,
1224
1056
  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" }]
1225
1057
  }], ctorParameters: function () {
1226
- return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2$1.ToastService }, { type: i2.FlowInfoService }, { type: undefined, decorators: [{
1058
+ return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2.ToastService }, { type: i3$1.FlowInfoService }, { type: undefined, decorators: [{
1227
1059
  type: Optional
1228
1060
  }, {
1229
1061
  type: Inject,
@@ -1246,12 +1078,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1246
1078
  }] });
1247
1079
 
1248
1080
  class DebugComponent {
1249
- constructor(flowsApiService, router, activatedRoute, context, quoteDraftService) {
1081
+ constructor(flowsApiService, router, activatedRoute) {
1250
1082
  this.flowsApiService = flowsApiService;
1251
1083
  this.router = router;
1252
1084
  this.activatedRoute = activatedRoute;
1253
- this.context = context;
1254
- this.quoteDraftService = quoteDraftService;
1255
1085
  this.form = new FormGroup({
1256
1086
  id: new FormControl(''),
1257
1087
  });
@@ -1259,15 +1089,11 @@ class DebugComponent {
1259
1089
  }
1260
1090
  runFlow() {
1261
1091
  const { id } = this.form.value;
1262
- const objectPropertyName = id && getFlowObjectIdPropertyName(id);
1263
- if (!id || !objectPropertyName || !this.selectedFlow) {
1092
+ if (!id || !this.selectedFlow) {
1264
1093
  return;
1265
1094
  }
1266
- // Delete context before starting a new flow
1267
- this.context.delete();
1268
- this.quoteDraftService.reset();
1269
1095
  this.router.navigate(['..', 'flows'], {
1270
- queryParams: Object.assign({ flowId: this.selectedFlow.id, [objectPropertyName]: id }, this.selectedFlow.properties.queryParams),
1096
+ queryParams: Object.assign({ flowId: this.selectedFlow.id, headerId: id }, this.selectedFlow.properties.queryParams),
1271
1097
  relativeTo: this.activatedRoute,
1272
1098
  });
1273
1099
  }
@@ -1275,12 +1101,12 @@ class DebugComponent {
1275
1101
  return new HttpParams({ fromObject: params }).toString();
1276
1102
  }
1277
1103
  }
1278
- DebugComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebugComponent, deps: [{ token: i1$1.FlowsApiService }, { token: i1$2.Router }, { token: i1$2.ActivatedRoute }, { token: i2.ContextService }, { token: i2.QuoteDraftService }], target: i0.ɵɵFactoryTarget.Component });
1279
- DebugComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: DebugComponent, selector: "vl-flow-debug", ngImport: i0, template: "<form [formGroup]=\"form\">\n <div class=\"fields-container\">\n <div class=\"field\">\n <label>SF Object ID</label>\n <input formControlName=\"id\" pInputText type=\"text\" />\n </div>\n </div>\n\n <p-button\n styleClass=\"p-button-primary\"\n label=\"Run Flow\"\n [disabled]=\"!form.value.id || !selectedFlow\"\n (onClick)=\"runFlow()\"\n ></p-button>\n</form>\n\n<table>\n <thead>\n <tr>\n <th [width]=\"30\"></th>\n <th [width]=\"160\">ID</th>\n <th [width]=\"160\">Entry Path</th>\n <th>QueryParams</th>\n <th [width]=\"100\">Standalone</th>\n <th [width]=\"100\">Stateful</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let flow of flows$ | async\" (click)=\"selectedFlow = flow\">\n <td><p-radioButton [inputId]=\"flow.id\" name=\"flow\" [value]=\"flow\" [(ngModel)]=\"selectedFlow\"></p-radioButton></td>\n <td>{{ flow.id }}</td>\n <td>{{ flow.properties.entryPath }}</td>\n <td class=\"cell-query-params\">{{ getQueryParamsString(flow.properties.queryParams) }}</td>\n <td>{{ flow.properties.standalone }}</td>\n <td>{{ flow.properties.stateful }}</td>\n </tr>\n </tbody>\n</table>\n", styles: [":host{display:block;padding:24px 54px}form{display:flex;align-items:center;justify-content:space-between}.fields-container{display:flex;gap:24px}.field{display:flex;flex-direction:column;width:200px;flex-shrink:0}:host ::ng-deep .p-dropdown{width:100%}table{width:100%;border-collapse:collapse;table-layout:fixed}tbody>tr{cursor:pointer}tbody>tr:hover{background-color:#f0f5fa}th{text-align:left;font-weight:600}th,td{padding:0 10px;height:30px;border-bottom:1px solid var(--vl-border-color);margin-right:16px;line-height:18px}.cell-query-params{word-break:break-all}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i5$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i5$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i5$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i5$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i6.RadioButton, selector: "p-radioButton", inputs: ["value", "formControlName", "name", "disabled", "label", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "style", "styleClass", "labelStyleClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: i8.InputText, selector: "[pInputText]" }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1104
+ 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 });
1105
+ 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 });
1280
1106
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebugComponent, decorators: [{
1281
1107
  type: Component,
1282
1108
  args: [{ selector: 'vl-flow-debug', changeDetection: ChangeDetectionStrategy.OnPush, template: "<form [formGroup]=\"form\">\n <div class=\"fields-container\">\n <div class=\"field\">\n <label>SF Object ID</label>\n <input formControlName=\"id\" pInputText type=\"text\" />\n </div>\n </div>\n\n <p-button\n styleClass=\"p-button-primary\"\n label=\"Run Flow\"\n [disabled]=\"!form.value.id || !selectedFlow\"\n (onClick)=\"runFlow()\"\n ></p-button>\n</form>\n\n<table>\n <thead>\n <tr>\n <th [width]=\"30\"></th>\n <th [width]=\"160\">ID</th>\n <th [width]=\"160\">Entry Path</th>\n <th>QueryParams</th>\n <th [width]=\"100\">Standalone</th>\n <th [width]=\"100\">Stateful</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let flow of flows$ | async\" (click)=\"selectedFlow = flow\">\n <td><p-radioButton [inputId]=\"flow.id\" name=\"flow\" [value]=\"flow\" [(ngModel)]=\"selectedFlow\"></p-radioButton></td>\n <td>{{ flow.id }}</td>\n <td>{{ flow.properties.entryPath }}</td>\n <td class=\"cell-query-params\">{{ getQueryParamsString(flow.properties.queryParams) }}</td>\n <td>{{ flow.properties.standalone }}</td>\n <td>{{ flow.properties.stateful }}</td>\n </tr>\n </tbody>\n</table>\n", styles: [":host{display:block;padding:24px 54px}form{display:flex;align-items:center;justify-content:space-between}.fields-container{display:flex;gap:24px}.field{display:flex;flex-direction:column;width:200px;flex-shrink:0}:host ::ng-deep .p-dropdown{width:100%}table{width:100%;border-collapse:collapse;table-layout:fixed}tbody>tr{cursor:pointer}tbody>tr:hover{background-color:#f0f5fa}th{text-align:left;font-weight:600}th,td{padding:0 10px;height:30px;border-bottom:1px solid var(--vl-border-color);margin-right:16px;line-height:18px}.cell-query-params{word-break:break-all}\n"] }]
1283
- }], ctorParameters: function () { return [{ type: i1$1.FlowsApiService }, { type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: i2.ContextService }, { type: i2.QuoteDraftService }]; } });
1109
+ }], ctorParameters: function () { return [{ type: i1$3.FlowsApiService }, { type: i1$2.Router }, { type: i1$2.ActivatedRoute }]; } });
1284
1110
 
1285
1111
  const routes$1 = [{ path: '', component: DebugComponent }];
1286
1112
  class DebugModule {
@@ -1318,120 +1144,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1318
1144
  }] });
1319
1145
 
1320
1146
  class ProductComponent {
1321
- constructor(contextService, configurationRuntimeService, configurationService, configurationStateService, quoteDraftService, flowInfoService, flowStateService, integrationState, customizationService) {
1322
- this.contextService = contextService;
1147
+ constructor(configurationRuntimeService, configurationStateService) {
1323
1148
  this.configurationRuntimeService = configurationRuntimeService;
1324
- this.configurationService = configurationService;
1325
1149
  this.configurationStateService = configurationStateService;
1326
- this.quoteDraftService = quoteDraftService;
1327
- this.flowInfoService = flowInfoService;
1328
- this.flowStateService = flowStateService;
1329
- this.integrationState = integrationState;
1330
- this.customizationService = customizationService;
1331
- this.uiDefinition$ = new BehaviorSubject(undefined);
1150
+ this.uiDefinitionContainer$ = new BehaviorSubject(null);
1151
+ this.uiDefinitionContainer$.next(this.configurationRuntimeService.uiDefinitionContainer);
1332
1152
  this.config = {
1333
1153
  init$: () => this.init$(),
1334
1154
  };
1335
1155
  }
1336
- customizeUI$() {
1337
- var _a, _b;
1338
- const { productId } = (_a = this.configurationRuntimeService.runtimeContext) !== null && _a !== void 0 ? _a : {};
1339
- if (!productId || !((_b = this.customizationService) === null || _b === void 0 ? void 0 : _b.getUiDefinition)) {
1340
- return of(undefined);
1341
- }
1342
- return this.customizationService.getUiDefinition(productId).pipe(map(uiDefinitionContainer => {
1343
- if (uiDefinitionContainer) {
1344
- this.configurationRuntimeService.overrideUIDefinition(uiDefinitionContainer);
1345
- }
1346
- }));
1347
- }
1348
1156
  init$() {
1349
- let quoteDraft$;
1350
- if (this.flowInfoService.isLegacy || !this.flowInfoService.isStateful) {
1351
- quoteDraft$ = this.quoteDraftService.quoteDraft$;
1352
- }
1353
- else {
1354
- quoteDraft$ = of(undefined);
1355
- }
1356
- return quoteDraft$.pipe(first(), switchMap(quote => {
1357
- var _a, _b;
1358
- const contextProperties = this.contextService.resolve().properties;
1359
- const productId = (_a = contextProperties.productId) !== null && _a !== void 0 ? _a : (_b = this.flowInfoService.flow) === null || _b === void 0 ? void 0 : _b.properties.queryParams['productId'];
1360
- if (!productId) {
1361
- throw new Error(`Unable to start configuration for 'productId == null'`);
1362
- }
1363
- if (!quote) {
1364
- const offeringId = contextProperties.offeringId;
1365
- return this.configurationRuntimeService.init({ productId, offeringId });
1366
- }
1367
- const lineItem = this.getLineItem(quote, productId, contextProperties.lineItemId);
1368
- if (lineItem) {
1369
- this.configurationService.setConfigurableRamp(lineItem);
1370
- }
1371
- const { offeringId } = lineItem !== null && lineItem !== void 0 ? lineItem : {};
1372
- return this.configurationRuntimeService.init({ productId, offeringId });
1373
- }), switchMap(() => this.customizeUI$()), tap(() => {
1374
- var _a, _b;
1375
- const uiDefinition = (_b = (_a = this.configurationRuntimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) === null || _b === void 0 ? void 0 : _b.source;
1376
- if (uiDefinition) {
1377
- this.uiDefinition$.next(uiDefinition);
1378
- }
1379
- else {
1380
- throw new Error('Product does not have Configuration UI');
1381
- }
1382
- }), tap(() => {
1383
- if (this.configurationRuntimeService.initializationProps) {
1384
- this.configurationRuntimeService.initializationProps.attributesMap =
1385
- this.integrationState.state.guidedSelling;
1386
- }
1387
- }), switchMap(() => this.configurationStateService.init$()));
1388
- }
1389
- getLineItem(quote, productId, lineItemId) {
1390
- var _a;
1391
- // search by lineItemId first
1392
- let li = quote.currentState.find(li => li.id === lineItemId);
1393
- if (!li && this.quoteDraftService.isStandalone) {
1394
- li = quote.currentState.find(li => li.productId === productId);
1395
- }
1396
- // If still not found, is could be an asset
1397
- if (!li) {
1398
- li = (_a = this.quoteDraftService.assetsState) === null || _a === void 0 ? void 0 : _a.currentState.find(li => li.id === lineItemId);
1399
- }
1400
- return li;
1157
+ return this.configurationStateService.init$();
1401
1158
  }
1402
1159
  }
1403
- ProductComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductComponent, deps: [{ token: i2.ContextService }, { token: i2.ConfigurationRuntimeService }, { token: i2.ConfigurationService }, { token: i2.ConfigurationStateService }, { token: i2.QuoteDraftService }, { token: i2.FlowInfoService }, { token: i2.FlowStateService }, { token: i2.IntegrationState }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1404
- 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]=\"$any(uiDefinition$ | async)\" [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 });
1160
+ 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 });
1161
+ 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 });
1405
1162
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductComponent, decorators: [{
1406
1163
  type: Component,
1407
- args: [{ selector: 'vl-flow-product', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-cms-preview [uiDefinition]=\"$any(uiDefinition$ | async)\" [config]=\"config\"></vl-cms-preview>\n" }]
1408
- }], ctorParameters: function () {
1409
- return [{ type: i2.ContextService }, { type: i2.ConfigurationRuntimeService }, { type: i2.ConfigurationService }, { type: i2.ConfigurationStateService }, { type: i2.QuoteDraftService }, { type: i2.FlowInfoService }, { type: i2.FlowStateService }, { type: i2.IntegrationState }, { type: undefined, decorators: [{
1410
- type: Optional
1411
- }, {
1412
- type: Inject,
1413
- args: [FLOW_CUSTOMIZATION]
1414
- }] }];
1415
- } });
1164
+ args: [{ selector: 'vl-flow-product', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-cms-preview [uiDefinition]=\"(uiDefinitionContainer$ | async)?.source\" [config]=\"config\"></vl-cms-preview>\n" }]
1165
+ }], ctorParameters: function () { return [{ type: i3$1.ConfigurationRuntimeService }, { type: i3$1.ConfigurationStateService }]; } });
1416
1166
 
1417
1167
  class ProductModule {
1418
1168
  }
1419
1169
  ProductModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1420
- ProductModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, declarations: [ProductComponent], imports: [CommonModule, PreviewModule, LoaderModule], exports: [ProductComponent] });
1421
- ProductModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, imports: [CommonModule, PreviewModule, LoaderModule] });
1170
+ 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] });
1171
+ ProductModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, imports: [CommonModule, PreviewModule, LoaderModule, LetDirectiveModule] });
1422
1172
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, decorators: [{
1423
1173
  type: NgModule,
1424
1174
  args: [{
1425
1175
  declarations: [ProductComponent],
1426
- imports: [CommonModule, PreviewModule, LoaderModule],
1176
+ imports: [CommonModule, PreviewModule, LoaderModule, LetDirectiveModule],
1427
1177
  exports: [ProductComponent],
1428
1178
  }]
1429
1179
  }] });
1430
1180
 
1431
1181
  class RecordNotFoundComponent {
1432
- constructor(router, route) {
1182
+ constructor(router) {
1433
1183
  this.router = router;
1434
- this.route = route;
1435
1184
  this.subMessage = '';
1436
1185
  this.type = '';
1437
1186
  const navigation = this.router.getCurrentNavigation();
@@ -1444,12 +1193,12 @@ class RecordNotFoundComponent {
1444
1193
  }
1445
1194
  }
1446
1195
  }
1447
- RecordNotFoundComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RecordNotFoundComponent, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
1196
+ 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 });
1448
1197
  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 });
1449
1198
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RecordNotFoundComponent, decorators: [{
1450
1199
  type: Component,
1451
1200
  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"] }]
1452
- }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }]; } });
1201
+ }], ctorParameters: function () { return [{ type: i1$2.Router }]; } });
1453
1202
 
1454
1203
  const routes = [{ path: '', component: RecordNotFoundComponent }];
1455
1204
  class RecordNotFoundModule {
@@ -1465,357 +1214,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1465
1214
  }]
1466
1215
  }] });
1467
1216
 
1468
- class RemoteComponent {
1469
- constructor(contextService, quoteDraftService, runtimeService, configurationService, configurationState, messageService, integrationState, location) {
1470
- this.contextService = contextService;
1471
- this.quoteDraftService = quoteDraftService;
1472
- this.runtimeService = runtimeService;
1473
- this.configurationService = configurationService;
1474
- this.configurationState = configurationState;
1475
- this.messageService = messageService;
1476
- this.integrationState = integrationState;
1477
- this.location = location;
1478
- this.state$ = new BehaviorSubject({ loading: true, failure: false });
1479
- this.DYNAMIC_OPTION_PRODUCTS_KEY = 'Dynamic';
1480
- this.destroyed$ = new Subject();
1481
- this.rpcMessage = JSON.parse(window.RPC_MESSAGE);
1482
- this.rpcMessage.options.sort((a, b) => { var _a, _b; return ((_a = a.featureNumber) !== null && _a !== void 0 ? _a : 99999) - ((_b = b.featureNumber) !== null && _b !== void 0 ? _b : 99999); });
1483
- this.updateHasChildrenFlag(this.rpcMessage.product.configuredProductId);
1484
- // update context properties
1485
- if (this.rpcMessage.quote) {
1486
- const properties = {};
1487
- if (this.rpcMessage.quote['SBQQ__Opportunity2__c']) {
1488
- properties.OpportunityId = this.rpcMessage.quote['SBQQ__Opportunity2__c'];
1489
- }
1490
- Object.entries(this.rpcMessage.quote).forEach(([key, value]) => {
1491
- if (value !== undefined && !(value instanceof Object)) {
1492
- properties[key] = value;
1493
- }
1494
- });
1495
- this.contextService.update({ properties });
1496
- }
1497
- this.initSubscriptions();
1498
- this.initConfiguration();
1499
- }
1500
- ngOnDestroy() {
1501
- this.destroyed$.next();
1502
- this.destroyed$.complete();
1503
- }
1504
- initConfiguration() {
1505
- const productId = this.rpcMessage.product.configuredProductId;
1506
- const quote = this.quoteDraftService.quoteDraft;
1507
- if (!productId || !quote) {
1508
- return;
1509
- }
1510
- this.runtimeService
1511
- .init({ productId })
1512
- .pipe(first(), tap(context => {
1513
- var _a, _b, _c, _d;
1514
- const uiDefinitionProperties = (_b = (_a = context.uiDefinitionContainer) === null || _a === void 0 ? void 0 : _a.source.properties) !== null && _b !== void 0 ? _b : {};
1515
- this.uiDefinition = (_c = context.uiDefinitionContainer) === null || _c === void 0 ? void 0 : _c.source;
1516
- const pricingEnabled = uiDefinitionProperties.pricingEnabled ? 'true' : 'false';
1517
- const priceListId = uiDefinitionProperties.priceList;
1518
- const runtimeContextProperties = (_d = this.runtimeService.runtimeContext) === null || _d === void 0 ? void 0 : _d.properties;
1519
- if (runtimeContextProperties) {
1520
- runtimeContextProperties.PriceListId = priceListId;
1521
- runtimeContextProperties.PricingEnabled = pricingEnabled;
1522
- }
1523
- this.contextService.update({
1524
- properties: {
1525
- ModelId: context.modelId,
1526
- RuntimeMode: 'TEST',
1527
- PricingEnabled: pricingEnabled,
1528
- PriceListId: priceListId,
1529
- },
1530
- });
1531
- this.configurationService.setConfigurableRamp(this.createLineItem());
1532
- }), this.throwIfNoUIDefinition(), switchMap(() => this.configurationState.init$()), tap(() => this.state$.next({ loading: false, failure: false })), catchError(error => {
1533
- var _a, _b;
1534
- if (!((_b = (_a = this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
1535
- this.messageService.add({ severity: 'error', summary: error });
1536
- }
1537
- this.state$.next({ loading: false, failure: true });
1538
- return of();
1539
- }), takeUntil(this.destroyed$))
1540
- .subscribe();
1541
- }
1542
- throwIfNoUIDefinition() {
1543
- return (source$) => {
1544
- return source$.pipe(switchMap(() => {
1545
- if (!this.uiDefinition) {
1546
- return throwError(() => 'Product does not have Configuration UI');
1547
- }
1548
- return source$;
1549
- }));
1550
- };
1551
- }
1552
- initSubscriptions() {
1553
- this.integrationState
1554
- .listen$(FlowAction.REMOTE_CANCEL)
1555
- .pipe(tap(() => this.location.back()), takeUntil(this.destroyed$))
1556
- .subscribe();
1557
- this.integrationState
1558
- .listen$(FlowAction.REMOTE_APPLY)
1559
- .pipe(tap(() => this.saveRpcMessage()), takeUntil(this.destroyed$))
1560
- .subscribe();
1561
- }
1562
- createLineItem() {
1563
- var _a, _b;
1564
- const [quoteDraftLineItem] = (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
1565
- if (quoteDraftLineItem && (quoteDraftLineItem.attributes.length > 0 || quoteDraftLineItem.lineItems.length > 0)) {
1566
- return quoteDraftLineItem;
1567
- }
1568
- const lineItem = this.createRootLineItem();
1569
- const dynamicOptionProducts = this.rpcMessage.product.optionConfigurations[this.DYNAMIC_OPTION_PRODUCTS_KEY];
1570
- if (dynamicOptionProducts) {
1571
- const options = this.toParentChildMap(dynamicOptionProducts);
1572
- let items = [lineItem];
1573
- for (let i = 0; i < items.length; i++) {
1574
- const item = items[i];
1575
- const children = item && options.get(item.id);
1576
- if (children) {
1577
- item.lineItems = children;
1578
- items = items.concat(children);
1579
- }
1580
- }
1581
- }
1582
- return lineItem;
1583
- }
1584
- createRootLineItem() {
1585
- var _a, _b, _c, _d;
1586
- const product = this.rpcMessage.product;
1587
- const runtimeContext = this.runtimeService.runtimeContext;
1588
- const veloceInstanceId = product.configurationAttributes['VeloceInstanceId__c'];
1589
- const quoteId = (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState[0]) === null || _b === void 0 ? void 0 : _b.id;
1590
- return {
1591
- id: quoteId || veloceInstanceId || UUID.UUID(),
1592
- type: (_c = runtimeContext.productType) !== null && _c !== void 0 ? _c : '',
1593
- name: ((_d = runtimeContext.properties) === null || _d === void 0 ? void 0 : _d['displayName']) || runtimeContext.productName,
1594
- productName: runtimeContext.productName,
1595
- productId: runtimeContext.productId,
1596
- cfgStatus: 'Default',
1597
- actionCode: 'ADD',
1598
- qty: 1,
1599
- };
1600
- }
1601
- toParentChildMap(remoteOptionProducts) {
1602
- var _a;
1603
- const result = new Map();
1604
- for (const option of remoteOptionProducts) {
1605
- const configurationData = (_a = option === null || option === void 0 ? void 0 : option.readOnly) === null || _a === void 0 ? void 0 : _a.line;
1606
- const id = configurationData === null || configurationData === void 0 ? void 0 : configurationData.VeloceInstanceId__c;
1607
- const parentId = configurationData === null || configurationData === void 0 ? void 0 : configurationData.VeloceParentInstanceId__c;
1608
- if (!option.selected || !configurationData || !id || !parentId) {
1609
- continue;
1610
- }
1611
- const productId = option.productId;
1612
- const lineItem = {
1613
- id,
1614
- productId,
1615
- parentId,
1616
- type: configurationData.ModelType__c,
1617
- port: configurationData.ModelPort__c,
1618
- cfgStatus: configurationData.ConfigurationStatus__c,
1619
- actionCode: configurationData.ActionCode__c,
1620
- qty: option.Quantity,
1621
- };
1622
- let siblings = result.get(productId);
1623
- if (!siblings) {
1624
- result.set(parentId, (siblings = []));
1625
- }
1626
- siblings.push(lineItem);
1627
- }
1628
- return result;
1629
- }
1630
- saveRpcMessage() {
1631
- var _a;
1632
- const quote = this.quoteDraftService.quoteDraft;
1633
- const lineItem = this.configurationService.getSnapshot();
1634
- if (!quote || !lineItem) {
1635
- return;
1636
- }
1637
- this.rpcMessage.VeloceReferenceId = quote.quoteId;
1638
- this.rpcMessage.product.configurationData.VeloceInstanceId__c = lineItem.id;
1639
- const childItems = this.flattenChildLineItems(lineItem);
1640
- const savingMode = window.SavingMode;
1641
- this.updateContentData(this.rpcMessage.product, lineItem);
1642
- this.rpcMessage.quote = this.mapAttributesTo('Quote', lineItem);
1643
- if (savingMode === 'ALL') {
1644
- const optionConfigurations = this.getOptionConfigurations(this.rpcMessage.product);
1645
- const rootProductOptions = this.rpcMessage.options.filter(po => po.configuredProductId === lineItem.productId);
1646
- childItems.forEach(lineItem => {
1647
- var _a, _b, _c, _d;
1648
- const rootOption = rootProductOptions.find(po => po.optionalProductId === lineItem.productId);
1649
- if (rootOption) {
1650
- const featureOptions = (_a = optionConfigurations[rootOption.featureName]) !== null && _a !== void 0 ? _a : (optionConfigurations[rootOption.featureName] = []);
1651
- const originOption = !rootOption.hasChildren
1652
- ? (_b = optionConfigurations[rootOption.featureName]) === null || _b === void 0 ? void 0 : _b.find(({ optionId }) => optionId === rootOption.optionId)
1653
- : undefined;
1654
- const option = originOption !== null && originOption !== void 0 ? originOption : {};
1655
- option.optionId = (_c = option.optionId) !== null && _c !== void 0 ? _c : rootOption.optionId;
1656
- this.updateContentData(option, lineItem);
1657
- option.index = (_d = option.index) !== null && _d !== void 0 ? _d : featureOptions.length;
1658
- option.selected = true;
1659
- if (!originOption) {
1660
- featureOptions.push(option);
1661
- }
1662
- if (lineItem.parentLineItem) {
1663
- const nestedProductOption = this.rpcMessage.options.find(po => {
1664
- var _a;
1665
- return po.configuredProductId === ((_a = lineItem.parentLineItem) === null || _a === void 0 ? void 0 : _a.productId) &&
1666
- po.optionalProductId === lineItem.productId;
1667
- });
1668
- if (nestedProductOption) {
1669
- option.configurationData = Object.assign(Object.assign({}, option.configurationData), { VeloceParentInstanceId__c: lineItem.parentLineItem.id, VeloceNestedOptionId__c: nestedProductOption.optionId, VeloceNestedFeatureId__c: nestedProductOption.featureId });
1670
- }
1671
- }
1672
- }
1673
- else {
1674
- this.rpcMessage.dynamicFeatures.forEach(feature => {
1675
- var _a, _b;
1676
- const featureOptions = (_a = optionConfigurations[feature.name]) !== null && _a !== void 0 ? _a : (optionConfigurations[feature.name] = []);
1677
- const originOption = featureOptions.find(({ productId }) => productId === lineItem.productId);
1678
- const option = originOption !== null && originOption !== void 0 ? originOption : {};
1679
- this.updateContentData(option, lineItem);
1680
- option.index = (_b = option.index) !== null && _b !== void 0 ? _b : featureOptions.length;
1681
- option.selected = true;
1682
- if (!originOption) {
1683
- featureOptions.push(option);
1684
- }
1685
- });
1686
- }
1687
- });
1688
- this.rpcMessage.product = Object.assign(Object.assign({}, this.rpcMessage.product), { optionConfigurations });
1689
- }
1690
- (_a = window.RPC_BROADCAST) === null || _a === void 0 ? void 0 : _a.apply(null, [this.rpcMessage]);
1691
- }
1692
- updateHasChildrenFlag(bundleProductId) {
1693
- const bundleOptionsByOptionId = {};
1694
- const notBundleOptions = [];
1695
- for (const productOption of this.rpcMessage.options) {
1696
- if (productOption.configuredProductId === bundleProductId) {
1697
- bundleOptionsByOptionId[productOption.optionalProductId] = productOption;
1698
- }
1699
- else {
1700
- notBundleOptions.push(productOption);
1701
- }
1702
- }
1703
- for (const option of notBundleOptions) {
1704
- const bundleOption = bundleOptionsByOptionId[option.configuredProductId];
1705
- if (bundleOption) {
1706
- bundleOption.hasChildren = true;
1707
- }
1708
- }
1709
- }
1710
- flattenChildLineItems(lineItem) {
1711
- var _a;
1712
- let items = (_a = lineItem.lineItems) !== null && _a !== void 0 ? _a : [];
1713
- for (let i = 0; i < items.length; i++) {
1714
- const item = items[i];
1715
- if (item === null || item === void 0 ? void 0 : item.lineItems) {
1716
- items = items.concat(item.lineItems.map(li => (Object.assign(Object.assign({}, li), { parentLineItem: item }))));
1717
- }
1718
- }
1719
- return items;
1720
- }
1721
- updateContentData(entity, lineItem) {
1722
- var _a, _b;
1723
- if (lineItem.productId) {
1724
- entity.productId = lineItem.productId;
1725
- }
1726
- const quantityAttribute = lineItem.properties['quantityAttribute'];
1727
- entity.Quantity = quantityAttribute
1728
- ? (_b = (_a = lineItem.attributes.find(attribute => attribute.name === quantityAttribute)) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 1
1729
- : lineItem.qty;
1730
- const totalPrice = this.computeNetPrice(lineItem);
1731
- const targetTotalPriceField = lineItem.properties['TargetTotalPriceField'] || 'TotalPrice__c';
1732
- entity.configurationData[targetTotalPriceField] = entity.configurationData[targetTotalPriceField]
1733
- ? entity.configurationData[targetTotalPriceField] + totalPrice
1734
- : totalPrice;
1735
- const targetPriceField = lineItem.properties['TargetPriceField'] || 'SBQQ__ListPrice__c';
1736
- const price = entity.Quantity != null ? entity.configurationData[targetTotalPriceField] / entity.Quantity || 0 : 0;
1737
- const targetPriceValue = Number(entity.configurationData[targetPriceField]) || 0;
1738
- entity.configurationData[targetPriceField] = targetPriceValue
1739
- ? (targetPriceValue + price).toFixed(2)
1740
- : price.toFixed(2);
1741
- entity.configurationAttributes = this.mapAttributesTo('Attribute', lineItem);
1742
- entity.configurationData = Object.assign(Object.assign(Object.assign(Object.assign({}, entity.configurationData), this.mapAttributesTo('Field', lineItem)), this.mapAttributesTo('', lineItem)), { VeloceInstanceId__c: lineItem.id });
1743
- }
1744
- computeNetPrice(lineItem) {
1745
- if (lineItem.properties['GroupCharges']) {
1746
- return this.sumNetPrice(lineItem.chargeGroupItems, this.getChargeNameSet(lineItem.properties['GroupCharges']));
1747
- }
1748
- return this.sumNetPrice(lineItem.chargeItems, this.getChargeNameSet(lineItem.properties['Charges']));
1749
- }
1750
- getChargeNameSet(property) {
1751
- if (property && property.length > 0) {
1752
- return new Set(property.split(','));
1753
- }
1754
- return new Set();
1755
- }
1756
- sumNetPrice(chargeItems, charges) {
1757
- var _a;
1758
- let netPrice = 0;
1759
- for (const chargeItem of chargeItems) {
1760
- if (!charges || charges.has(chargeItem.chargeType)) {
1761
- netPrice += (_a = chargeItem.netPrice) !== null && _a !== void 0 ? _a : 0;
1762
- }
1763
- }
1764
- return netPrice;
1765
- }
1766
- mapAttributesTo(target, lineItem) {
1767
- var _a;
1768
- const result = {};
1769
- const component = (_a = this.runtimeService.runtimeModel) === null || _a === void 0 ? void 0 : _a.components.get(lineItem.type);
1770
- if (!component) {
1771
- return result;
1772
- }
1773
- const propertyName = 'mapTo' + target;
1774
- component.attributes
1775
- .filter(a => a.properties && a.properties[propertyName])
1776
- .forEach(mapping => {
1777
- var _a;
1778
- const attribute = lineItem.attributes.find(a => a.name === mapping.name);
1779
- if (attribute) {
1780
- new Set((_a = mapping.properties[propertyName]) === null || _a === void 0 ? void 0 : _a.split(',')).forEach(k => (result[k] = attribute.value));
1781
- }
1782
- });
1783
- return result;
1784
- }
1785
- getOptionConfigurations(product) {
1786
- var _a;
1787
- const optionConfigurations = {};
1788
- const requestOptionConfigurations = (_a = product.optionConfigurations) !== null && _a !== void 0 ? _a : {};
1789
- Object.keys(requestOptionConfigurations).forEach(k => {
1790
- var _a;
1791
- optionConfigurations[k] = ((_a = requestOptionConfigurations[k]) !== null && _a !== void 0 ? _a : []).map(opt => {
1792
- return Object.assign(Object.assign({}, opt), { selected: false });
1793
- });
1794
- });
1795
- return optionConfigurations;
1796
- }
1797
- }
1798
- 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 });
1799
- 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 });
1800
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteComponent, decorators: [{
1801
- type: Component,
1802
- 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" }]
1803
- }], 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 }]; } });
1804
-
1805
- class RemoteModule {
1806
- }
1807
- RemoteModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1808
- RemoteModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, declarations: [RemoteComponent], imports: [CommonModule, PreviewModule, LoaderModule], exports: [RemoteComponent] });
1809
- RemoteModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, imports: [CommonModule, PreviewModule, LoaderModule] });
1810
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, decorators: [{
1811
- type: NgModule,
1812
- args: [{
1813
- declarations: [RemoteComponent],
1814
- imports: [CommonModule, PreviewModule, LoaderModule],
1815
- exports: [RemoteComponent],
1816
- }]
1817
- }] });
1818
-
1819
1217
  class ShoppingCartComponent {
1820
1218
  constructor(templatesApi, cdr, toastService, flowInfo, customizationService) {
1821
1219
  var _a, _b, _c;
@@ -1888,7 +1286,6 @@ class ShoppingCartComponent {
1888
1286
  const uiDef = {
1889
1287
  name: '',
1890
1288
  createdTimestamp: 0,
1891
- primary: true,
1892
1289
  type: 'DEFAULT',
1893
1290
  version: 2,
1894
1291
  children: metaList.map(meta => ({
@@ -1902,13 +1299,13 @@ class ShoppingCartComponent {
1902
1299
  }));
1903
1300
  }
1904
1301
  }
1905
- 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$1.ToastService }, { token: i2.FlowInfoService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1906
- 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$1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1302
+ 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 });
1303
+ 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 });
1907
1304
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ShoppingCartComponent, decorators: [{
1908
1305
  type: Component,
1909
1306
  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" }]
1910
1307
  }], ctorParameters: function () {
1911
- return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2$1.ToastService }, { type: i2.FlowInfoService }, { type: undefined, decorators: [{
1308
+ return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2.ToastService }, { type: i3$1.FlowInfoService }, { type: undefined, decorators: [{
1912
1309
  type: Optional
1913
1310
  }, {
1914
1311
  type: Inject,
@@ -1931,24 +1328,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1931
1328
  }] });
1932
1329
 
1933
1330
  class FlowResolver {
1934
- constructor(router, routerService, contextService, flowInfo) {
1331
+ constructor(router, routerService, flowInfoService) {
1935
1332
  this.router = router;
1936
1333
  this.routerService = routerService;
1937
- this.contextService = contextService;
1938
- this.flowInfo = flowInfo;
1334
+ this.flowInfoService = flowInfoService;
1939
1335
  }
1940
1336
  resolve(route) {
1941
- const { queryParams } = route;
1942
- const flow = this.flowInfo.flow;
1943
- if (!flow) {
1337
+ if (!this.flowInfoService.isFlowInitialized) {
1944
1338
  return of(false);
1945
1339
  }
1946
- const { properties } = flow;
1340
+ const { queryParams } = route;
1341
+ const { properties } = this.flowInfoService.flow;
1947
1342
  const { queryParams: flowQueryParams, entryPath } = properties;
1948
1343
  const mergedQueryParams = Object.assign(Object.assign({}, queryParams), flowQueryParams);
1949
- const contextProperties = Object.entries(Object.assign(Object.assign({}, mergedQueryParams), getDefaultProperties({ flowParams: properties }))).reduce((trunk, [key, value]) => (Object.assign(Object.assign({}, trunk), { [key]: String(value) })), {});
1950
- this.contextService.update({ properties: contextProperties });
1951
- this.flowInfo.flow = flow;
1952
1344
  const parentUrl = this.routerService.getFlowRootPath(route);
1953
1345
  const entryUrl = String(entryPath !== null && entryPath !== void 0 ? entryPath : '')
1954
1346
  .split('/')
@@ -1957,29 +1349,29 @@ class FlowResolver {
1957
1349
  queryParams: mergedQueryParams,
1958
1350
  replaceUrl: true,
1959
1351
  })).pipe(catchError$1(e => {
1352
+ console.error(e);
1960
1353
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
1961
1354
  const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
1962
1355
  return this.routerService.showErrorPage$(message, errorDetails);
1963
1356
  }));
1964
1357
  }
1965
1358
  }
1966
- FlowResolver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowResolver, deps: [{ token: i1$2.Router }, { token: FlowRouterService }, { token: i2.ContextService }, { token: i2.FlowInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
1359
+ 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 });
1967
1360
  FlowResolver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowResolver });
1968
1361
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowResolver, decorators: [{
1969
1362
  type: Injectable
1970
- }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i2.ContextService }, { type: i2.FlowInfoService }]; } });
1363
+ }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i3$1.FlowInfoService }]; } });
1971
1364
 
1972
- class QuoteResolver {
1973
- constructor(router, quoteDraftService, routerService, contextService, flowInfo, flowStateService) {
1365
+ class SalesTransactionResolver {
1366
+ constructor(router, routerService, flowInfoService, flowStateService, salesTransactionService) {
1974
1367
  this.router = router;
1975
- this.quoteDraftService = quoteDraftService;
1976
1368
  this.routerService = routerService;
1977
- this.contextService = contextService;
1978
- this.flowInfo = flowInfo;
1369
+ this.flowInfoService = flowInfoService;
1979
1370
  this.flowStateService = flowStateService;
1371
+ this.salesTransactionService = salesTransactionService;
1980
1372
  }
1981
1373
  resolve(route) {
1982
- const flow = this.flowInfo.flow;
1374
+ const flow = this.flowInfoService.flow;
1983
1375
  if (!flow) {
1984
1376
  return of(false);
1985
1377
  }
@@ -1987,13 +1379,14 @@ class QuoteResolver {
1987
1379
  return of(true);
1988
1380
  }
1989
1381
  return this.flowStateService.init$().pipe(switchMap(() => this.checkDynamicNavigation$(route)), catchError(e => {
1382
+ console.error(e);
1990
1383
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
1991
1384
  const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
1992
1385
  return this.routerService.showErrorPage$(message, errorDetails);
1993
1386
  }));
1994
1387
  }
1995
1388
  checkDynamicNavigation$(route) {
1996
- const flow = this.flowInfo.flow;
1389
+ const flow = this.flowInfoService.flow;
1997
1390
  if (!flow) {
1998
1391
  return of(true);
1999
1392
  }
@@ -2012,7 +1405,7 @@ class QuoteResolver {
2012
1405
  }));
2013
1406
  }
2014
1407
  getNavigateTo() {
2015
- const flow = this.flowInfo.flow;
1408
+ const flow = this.flowInfoService.flow;
2016
1409
  let navigateTo;
2017
1410
  if (flow === null || flow === void 0 ? void 0 : flow.properties.stateful) {
2018
1411
  return this.flowStateService.select$(UITemplateType.FLOW_ENGINE, 'NAVIGATE_TO').pipe(map(r => {
@@ -2023,22 +1416,61 @@ class QuoteResolver {
2023
1416
  }));
2024
1417
  }
2025
1418
  else {
2026
- const isAccountMode = this.contextService.mode === ConfigurationContextMode.ACCOUNT;
2027
- if (isAccountMode || this.quoteDraftService.hasAssets) {
1419
+ const isAccountMode = this.flowInfoService.context.mode === 'ACCOUNT';
1420
+ const { hasAssets, hasProducts } = this.salesTransactionService;
1421
+ if (isAccountMode || hasAssets) {
2028
1422
  navigateTo = '/assets';
2029
1423
  }
2030
- else if (this.quoteDraftService.hasProducts) {
1424
+ else if (hasProducts) {
2031
1425
  navigateTo = '/cart';
2032
1426
  }
2033
1427
  }
2034
1428
  return of(navigateTo);
2035
1429
  }
2036
1430
  }
2037
- QuoteResolver.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteResolver, deps: [{ token: i1$2.Router }, { token: i2.QuoteDraftService }, { token: FlowRouterService }, { token: i2.ContextService }, { token: i2.FlowInfoService }, { token: i2.FlowStateService }], target: i0.ɵɵFactoryTarget.Injectable });
2038
- QuoteResolver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteResolver });
2039
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteResolver, decorators: [{
1431
+ 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 });
1432
+ SalesTransactionResolver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionResolver });
1433
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionResolver, decorators: [{
2040
1434
  type: Injectable
2041
- }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i2.QuoteDraftService }, { type: FlowRouterService }, { type: i2.ContextService }, { type: i2.FlowInfoService }, { type: i2.FlowStateService }]; } });
1435
+ }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i3$1.FlowInfoService }, { type: i3$1.FlowStateService }, { type: i3$1.SalesTransactionService }]; } });
1436
+
1437
+ const resolveUIDefinition = () => {
1438
+ const customizationService = inject(FLOW_CUSTOMIZATION, { optional: true });
1439
+ const flowInfoService = inject(FlowInfoService);
1440
+ const uiDefinitionsApiService = inject(UIDefinitionsApiService);
1441
+ const configurationRuntimeService = inject(ConfigurationRuntimeService);
1442
+ const { productId } = flowInfoService.context;
1443
+ if (!productId) {
1444
+ throw new Error(`Unable to start configuration for 'productId == null'`);
1445
+ }
1446
+ return of(undefined).pipe(switchMap(() => {
1447
+ // Try resolving via customization service
1448
+ if (!productId || !(customizationService === null || customizationService === void 0 ? void 0 : customizationService.getUiDefinition)) {
1449
+ return of(undefined);
1450
+ }
1451
+ return customizationService.getUiDefinition(productId);
1452
+ }), switchMap(uiDefContainer => {
1453
+ // Resolve UIDefinition from the org
1454
+ if (uiDefContainer) {
1455
+ return of(uiDefContainer);
1456
+ }
1457
+ if (flowInfoService.context.requiredUIDefinitionId) {
1458
+ return uiDefinitionsApiService.fetch$(flowInfoService.context.requiredUIDefinitionId);
1459
+ }
1460
+ return uiDefinitionsApiService
1461
+ .fetchAll$({
1462
+ productId,
1463
+ defaultUIDefinitionId: flowInfoService.context.defaultUIDefinitionId,
1464
+ })
1465
+ .pipe(map((uiDefinitionContainers) => {
1466
+ const uiDefContainer = uiDefinitionContainers[0];
1467
+ if (!uiDefContainer) {
1468
+ throw new Error(`UI Definition for productId=${productId} is not resolved`);
1469
+ }
1470
+ return uiDefContainer;
1471
+ }));
1472
+ }), tap(uiDefContainer => (configurationRuntimeService.uiDefinitionContainer = uiDefContainer)));
1473
+ };
2042
1474
 
2043
1475
  const rootRoute = {
2044
1476
  id: VELOCE_FLOW_ROOT_ROUTE,
@@ -2056,15 +1488,13 @@ const rootRoute = {
2056
1488
  path: 'flows',
2057
1489
  runGuardsAndResolvers: 'paramsOrQueryParamsChange',
2058
1490
  resolve: { flow: FlowResolver },
2059
- canActivate: [ContextGuard],
2060
1491
  children: [],
2061
1492
  },
2062
1493
  {
2063
1494
  path: 'product',
2064
1495
  component: ProductComponent,
2065
1496
  runGuardsAndResolvers: 'paramsOrQueryParamsChange',
2066
- resolve: { quote: QuoteResolver },
2067
- canActivate: [ContextGuard],
1497
+ resolve: { salesTransaction: SalesTransactionResolver, uiDef: resolveUIDefinition },
2068
1498
  canDeactivate: [ProductUnloadGuard],
2069
1499
  data: { showHeader: true },
2070
1500
  },
@@ -2072,33 +1502,23 @@ const rootRoute = {
2072
1502
  path: 'cart',
2073
1503
  component: ShoppingCartComponent,
2074
1504
  runGuardsAndResolvers: 'paramsOrQueryParamsChange',
2075
- resolve: { quote: QuoteResolver },
2076
- canActivate: [ContextGuard],
1505
+ resolve: { salesTransaction: SalesTransactionResolver },
2077
1506
  data: { showHeader: true },
2078
1507
  },
2079
1508
  {
2080
1509
  path: 'catalog',
2081
1510
  component: CatalogComponent,
2082
1511
  runGuardsAndResolvers: 'paramsOrQueryParamsChange',
2083
- resolve: { quote: QuoteResolver },
2084
- canActivate: [ContextGuard],
1512
+ resolve: { salesTransaction: SalesTransactionResolver },
2085
1513
  data: { showHeader: true },
2086
1514
  },
2087
1515
  {
2088
1516
  path: 'assets',
2089
1517
  component: AssetsComponent,
2090
1518
  runGuardsAndResolvers: 'paramsOrQueryParamsChange',
2091
- resolve: { quote: QuoteResolver },
2092
- canActivate: [ContextGuard],
1519
+ resolve: { salesTransaction: SalesTransactionResolver },
2093
1520
  data: { showHeader: true },
2094
1521
  },
2095
- {
2096
- path: 'remote',
2097
- component: RemoteComponent,
2098
- runGuardsAndResolvers: 'paramsOrQueryParamsChange',
2099
- resolve: { quote: QuoteResolver },
2100
- canActivate: [ContextGuard],
2101
- },
2102
1522
  {
2103
1523
  path: 'debug',
2104
1524
  loadChildren: () => DebugModule,
@@ -2114,30 +1534,14 @@ const rootRoute = {
2114
1534
  class FlowRoutingModule {
2115
1535
  }
2116
1536
  FlowRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2117
- FlowRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, imports: [i1$2.RouterModule, ProductModule,
2118
- ShoppingCartModule,
2119
- CatalogModule,
2120
- AssetsModule,
2121
- RemoteModule], exports: [RouterModule] });
2122
- 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]),
2123
- ProductModule,
2124
- ShoppingCartModule,
2125
- CatalogModule,
2126
- AssetsModule,
2127
- RemoteModule, RouterModule] });
1537
+ 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] });
1538
+ 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] });
2128
1539
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, decorators: [{
2129
1540
  type: NgModule,
2130
1541
  args: [{
2131
- imports: [
2132
- RouterModule.forChild([rootRoute]),
2133
- ProductModule,
2134
- ShoppingCartModule,
2135
- CatalogModule,
2136
- AssetsModule,
2137
- RemoteModule,
2138
- ],
1542
+ imports: [RouterModule.forChild([rootRoute]), ProductModule, ShoppingCartModule, CatalogModule, AssetsModule],
2139
1543
  exports: [RouterModule],
2140
- providers: [FlowRouterService, RootGuard, ContextGuard, ProductUnloadGuard, FlowResolver, QuoteResolver],
1544
+ providers: [FlowRouterService, RootGuard, ProductUnloadGuard, FlowResolver, SalesTransactionResolver],
2141
1545
  }]
2142
1546
  }] });
2143
1547
 
@@ -2189,5 +1593,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2189
1593
  * Generated bundle index. Do not edit.
2190
1594
  */
2191
1595
 
2192
- export { ContextGuard, FlowDialogService, FlowModule, FlowRouterService, FlowService, VELOCE_FLOW_ROOT_ROUTE, getDefaultProperties, getFlowObjectIdPropertyName };
1596
+ export { FlowDialogService, FlowModule, FlowRouterService, FlowService, VELOCE_FLOW_ROOT_ROUTE };
2193
1597
  //# sourceMappingURL=veloceapps-sdk.mjs.map