@veloceapps/sdk 11.0.0-9 → 11.0.0-91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/cms/cms.actions.d.ts +94 -29
  2. package/cms/components/element-renderer/element-renderer.component.d.ts +3 -10
  3. package/cms/components/preview/preview.component.d.ts +5 -6
  4. package/cms/components/preview/preview.types.d.ts +0 -4
  5. package/cms/services/element-context.service.d.ts +0 -1
  6. package/cms/types/common.types.d.ts +2 -0
  7. package/cms/types/index.d.ts +0 -1
  8. package/cms/utils/path.utils.d.ts +1 -2
  9. package/cms/vendor-map.d.ts +18 -40
  10. package/core/index.d.ts +1 -1
  11. package/core/modules/configuration/index.d.ts +4 -4
  12. package/core/modules/configuration/services/configuration-runtime.service.d.ts +8 -19
  13. package/core/modules/configuration/services/configuration-state.service.d.ts +8 -8
  14. package/core/modules/configuration/services/configuration.service.d.ts +22 -52
  15. package/core/modules/configuration/services/guided-selling.service.d.ts +13 -0
  16. package/core/modules/configuration/services/test-mode-configuration.service.d.ts +23 -0
  17. package/core/modules/configuration/types/configuration-runtime.types.d.ts +0 -5
  18. package/core/modules/configuration/types/configuration.types.d.ts +4 -2
  19. package/core/modules/configuration/types/index.d.ts +2 -0
  20. package/core/modules/flow-configuration/index.d.ts +0 -3
  21. package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +11 -38
  22. package/core/operators/filter-successful-execute.operator.d.ts +3 -0
  23. package/core/operators/index.d.ts +1 -0
  24. package/core/services/catalog-products.service.d.ts +11 -0
  25. package/core/services/flow-info.service.d.ts +27 -12
  26. package/core/services/flow-state-configuration.service.d.ts +9 -8
  27. package/core/services/flow-state.service.d.ts +12 -24
  28. package/core/services/index.d.ts +3 -3
  29. package/core/services/integration.state.d.ts +1 -1
  30. package/core/services/product-images.service.d.ts +3 -3
  31. package/core/services/runtime-settings.service.d.ts +1 -1
  32. package/core/services/sales-transaction.service.d.ts +27 -0
  33. package/core/types/flow-customization.types.d.ts +2 -2
  34. package/core/types/flow-state.types.d.ts +2 -2
  35. package/core/types/index.d.ts +0 -1
  36. package/core/utils/index.d.ts +2 -2
  37. package/core/utils/transaction-item.utils.d.ts +7 -0
  38. package/core/utils/transaction-item.worker.d.ts +8 -0
  39. package/esm2020/cms/cms.actions.mjs +93 -71
  40. package/esm2020/cms/cms.default.mjs +2 -3
  41. package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +7 -64
  42. package/esm2020/cms/components/element-tools-panel/element-tools-panel.component.mjs +3 -3
  43. package/esm2020/cms/components/preview/preview.component.mjs +19 -28
  44. package/esm2020/cms/components/preview/preview.types.mjs +1 -1
  45. package/esm2020/cms/services/element-context.service.mjs +1 -1
  46. package/esm2020/cms/types/common.types.mjs +1 -1
  47. package/esm2020/cms/types/index.mjs +1 -2
  48. package/esm2020/cms/utils/element.utils.mjs +3 -3
  49. package/esm2020/cms/utils/elements-resolver.mjs +16 -5
  50. package/esm2020/cms/utils/path.utils.mjs +1 -10
  51. package/esm2020/cms/vendor-map.mjs +18 -18
  52. package/esm2020/core/core.module.mjs +7 -7
  53. package/esm2020/core/index.mjs +2 -2
  54. package/esm2020/core/modules/configuration/configuration.module.mjs +17 -4
  55. package/esm2020/core/modules/configuration/index.mjs +5 -5
  56. package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +16 -101
  57. package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +69 -77
  58. package/esm2020/core/modules/configuration/services/configuration.service.mjs +115 -247
  59. package/esm2020/core/modules/configuration/services/guided-selling.service.mjs +47 -0
  60. package/esm2020/core/modules/configuration/services/test-mode-configuration.service.mjs +74 -0
  61. package/esm2020/core/modules/configuration/types/configuration-runtime.types.mjs +1 -1
  62. package/esm2020/core/modules/configuration/types/configuration.types.mjs +1 -1
  63. package/esm2020/core/modules/configuration/types/index.mjs +3 -0
  64. package/esm2020/core/modules/flow-configuration/flow-configuration.module.mjs +3 -4
  65. package/esm2020/core/modules/flow-configuration/index.mjs +1 -4
  66. package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +44 -128
  67. package/esm2020/core/operators/filter-successful-execute.operator.mjs +5 -0
  68. package/esm2020/core/operators/index.mjs +2 -0
  69. package/esm2020/core/services/catalog-products.service.mjs +25 -0
  70. package/esm2020/core/services/flow-info.service.mjs +82 -31
  71. package/esm2020/core/services/flow-state-configuration.service.mjs +52 -25
  72. package/esm2020/core/services/flow-state.service.mjs +58 -180
  73. package/esm2020/core/services/index.mjs +4 -4
  74. package/esm2020/core/services/integration.state.mjs +2 -2
  75. package/esm2020/core/services/product-images.service.mjs +8 -8
  76. package/esm2020/core/services/runtime-settings.service.mjs +3 -3
  77. package/esm2020/core/services/sales-transaction.service.mjs +67 -0
  78. package/esm2020/core/types/flow-customization.types.mjs +1 -1
  79. package/esm2020/core/types/flow-state.types.mjs +1 -1
  80. package/esm2020/core/types/index.mjs +1 -2
  81. package/esm2020/core/utils/index.mjs +3 -3
  82. package/esm2020/core/utils/transaction-item.utils.mjs +60 -0
  83. package/esm2020/core/utils/transaction-item.worker.mjs +16 -0
  84. package/esm2020/src/components/flow-header/flow-header.component.mjs +8 -12
  85. package/esm2020/src/components/guided-selling/guided-selling.component.mjs +8 -12
  86. package/esm2020/src/flow-routing.module.mjs +12 -41
  87. package/esm2020/src/flow.component.mjs +5 -5
  88. package/esm2020/src/guards/flow.guard.mjs +13 -14
  89. package/esm2020/src/guards/product-unload.guard.mjs +7 -9
  90. package/esm2020/src/index.mjs +1 -3
  91. package/esm2020/src/pages/assets/assets.component.mjs +8 -9
  92. package/esm2020/src/pages/catalog/catalog.component.mjs +8 -9
  93. package/esm2020/src/pages/debug/debug.component.mjs +14 -23
  94. package/esm2020/src/pages/product/product.component.mjs +12 -89
  95. package/esm2020/src/pages/product/product.module.mjs +5 -5
  96. package/esm2020/src/pages/record-not-found/record-not-found.component.mjs +5 -6
  97. package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +8 -9
  98. package/esm2020/src/resolvers/flow.resolver.mjs +10 -18
  99. package/esm2020/src/resolvers/pcm-model.resolver.mjs +12 -0
  100. package/esm2020/src/resolvers/sales-transaction.resolver.mjs +64 -0
  101. package/esm2020/src/resolvers/ui-definition.resolver.mjs +42 -0
  102. package/esm2020/src/services/flow-dialog.service.mjs +10 -31
  103. package/esm2020/src/services/flow-router.service.mjs +16 -33
  104. package/esm2020/src/services/flow.service.mjs +15 -54
  105. package/esm2020/src/types/index.mjs +2 -3
  106. package/esm2020/src/types/route.types.mjs +1 -1
  107. package/fesm2015/veloceapps-sdk-cms.mjs +163 -309
  108. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
  109. package/fesm2015/veloceapps-sdk-core.mjs +877 -1673
  110. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  111. package/fesm2015/veloceapps-sdk.mjs +192 -824
  112. package/fesm2015/veloceapps-sdk.mjs.map +1 -1
  113. package/fesm2020/veloceapps-sdk-cms.mjs +159 -300
  114. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
  115. package/fesm2020/veloceapps-sdk-core.mjs +954 -1758
  116. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  117. package/fesm2020/veloceapps-sdk.mjs +192 -818
  118. package/fesm2020/veloceapps-sdk.mjs.map +1 -1
  119. package/package.json +1 -1
  120. package/src/components/flow-header/flow-header.component.d.ts +3 -3
  121. package/src/components/guided-selling/guided-selling.component.d.ts +3 -3
  122. package/src/flow-routing.module.d.ts +1 -2
  123. package/src/flow.component.d.ts +2 -2
  124. package/src/guards/product-unload.guard.d.ts +5 -6
  125. package/src/index.d.ts +0 -2
  126. package/src/pages/assets/assets.component.d.ts +3 -3
  127. package/src/pages/catalog/catalog.component.d.ts +3 -3
  128. package/src/pages/debug/debug.component.d.ts +2 -5
  129. package/src/pages/product/product.component.d.ts +5 -14
  130. package/src/pages/product/product.module.d.ts +1 -1
  131. package/src/pages/record-not-found/record-not-found.component.d.ts +2 -3
  132. package/src/pages/shopping-cart/shopping-cart.component.d.ts +3 -3
  133. package/src/resolvers/flow.resolver.d.ts +5 -6
  134. package/src/resolvers/pcm-model.resolver.d.ts +3 -0
  135. package/src/resolvers/sales-transaction.resolver.d.ts +18 -0
  136. package/src/resolvers/ui-definition.resolver.d.ts +3 -0
  137. package/src/services/flow-dialog.service.d.ts +6 -8
  138. package/src/services/flow-router.service.d.ts +4 -6
  139. package/src/services/flow.service.d.ts +3 -7
  140. package/src/types/index.d.ts +1 -2
  141. package/src/types/route.types.d.ts +0 -5
  142. package/cms/plugins/configuration.plugin.d.ts +0 -23
  143. package/cms/types/configuration.types.d.ts +0 -21
  144. package/core/modules/configuration/helpers.d.ts +0 -6
  145. package/core/modules/configuration/services/runtime-context.service.d.ts +0 -12
  146. package/core/modules/flow-configuration/services/flow-update.service.d.ts +0 -13
  147. package/core/modules/flow-configuration/types/update.types.d.ts +0 -12
  148. package/core/services/context.service.d.ts +0 -23
  149. package/core/services/quote-draft.service.d.ts +0 -50
  150. package/core/types/runtime.types.d.ts +0 -30
  151. package/core/utils/line-item.utils.d.ts +0 -25
  152. package/core/utils/line-item.worker.d.ts +0 -9
  153. package/esm2020/cms/plugins/configuration.plugin.mjs +0 -109
  154. package/esm2020/cms/types/configuration.types.mjs +0 -2
  155. package/esm2020/core/modules/configuration/helpers.mjs +0 -73
  156. package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +0 -45
  157. package/esm2020/core/modules/flow-configuration/services/flow-update.service.mjs +0 -138
  158. package/esm2020/core/modules/flow-configuration/types/update.types.mjs +0 -2
  159. package/esm2020/core/services/context.service.mjs +0 -91
  160. package/esm2020/core/services/quote-draft.service.mjs +0 -192
  161. package/esm2020/core/types/runtime.types.mjs +0 -16
  162. package/esm2020/core/utils/line-item.utils.mjs +0 -187
  163. package/esm2020/core/utils/line-item.worker.mjs +0 -19
  164. package/esm2020/src/guards/context.guard.mjs +0 -91
  165. package/esm2020/src/guards/index.mjs +0 -2
  166. package/esm2020/src/pages/remote/remote.component.mjs +0 -342
  167. package/esm2020/src/pages/remote/remote.module.mjs +0 -20
  168. package/esm2020/src/pages/remote/remote.types.mjs +0 -2
  169. package/esm2020/src/resolvers/quote.resolver.mjs +0 -82
  170. package/esm2020/src/types/context-route.types.mjs +0 -2
  171. package/esm2020/src/types/metrics.types.mjs +0 -2
  172. package/esm2020/src/utils/flow.utils.mjs +0 -25
  173. package/esm2020/src/utils/index.mjs +0 -2
  174. package/src/guards/context.guard.d.ts +0 -19
  175. package/src/guards/index.d.ts +0 -1
  176. package/src/pages/remote/remote.component.d.ts +0 -46
  177. package/src/pages/remote/remote.module.d.ts +0 -10
  178. package/src/pages/remote/remote.types.d.ts +0 -4
  179. package/src/resolvers/quote.resolver.d.ts +0 -19
  180. package/src/types/context-route.types.d.ts +0 -5
  181. package/src/types/metrics.types.d.ts +0 -5
  182. package/src/utils/flow.utils.d.ts +0 -8
  183. package/src/utils/index.d.ts +0 -1
@@ -2,31 +2,31 @@ 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';
6
5
  import { ApiModule } from '@veloceapps/api';
7
- import * as i2$1 from '@veloceapps/components';
6
+ import * as i2 from '@veloceapps/components';
8
7
  import { ToastType, LoaderModule, LetDirectiveModule } from '@veloceapps/components';
9
8
  import * as i5 from '@veloceapps/sdk/cms';
10
9
  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';
10
+ import * as i3$1 from '@veloceapps/sdk/core';
11
+ import { FLOW_CUSTOMIZATION, RuntimeSettingsService, FlowStateService, FlowInfoService, SalesTransactionService, ConfigurationService, IntegrationState, ConfigurationRuntimeService, SdkCoreModule } from '@veloceapps/sdk/core';
13
12
  import * as i3 from 'primeng/button';
14
13
  import { ButtonModule } from 'primeng/button';
15
14
  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';
15
+ import * as i1$1 from '@veloceapps/api/v2';
16
+ import { UIDefinitionsAdminApiService } from '@veloceapps/api/v2';
17
+ import { BehaviorSubject, Subject, filter, first, tap, takeUntil, catchError, of, map, switchMap, shareReplay, startWith, distinctUntilChanged, from, take, combineLatest } from 'rxjs';
17
18
  import { DomHandler } from 'primeng/dom';
18
19
  import * as i1$2 from '@angular/router';
19
20
  import { NavigationEnd, NavigationStart, NavigationCancel, NavigationError, RouterModule } from '@angular/router';
20
- import { mapShoppingCartSettings, getMaxRenewalTermsValue, UITemplateType, SalesforceIdUtils, ConfigurationContextMode, isVeloceError, extractErrorDetails, UUID } from '@veloceapps/core';
21
+ import { mapShoppingCartSettings, getMaxRenewalTermsValue, SalesforceIdUtils, UITemplateType, isVeloceError, extractErrorDetails } from '@veloceapps/core';
21
22
  import { HttpErrorResponse, HttpParams } from '@angular/common/http';
22
- import * as i5$1 from '@angular/forms';
23
+ import * as i4$1 from '@angular/forms';
23
24
  import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
24
25
  import { DropdownModule } from 'primeng/dropdown';
25
- import * as i8 from 'primeng/inputtext';
26
+ import * as i7 from 'primeng/inputtext';
26
27
  import { InputTextModule } from 'primeng/inputtext';
27
- import * as i6 from 'primeng/radiobutton';
28
+ import * as i5$1 from 'primeng/radiobutton';
28
29
  import { RadioButtonModule } from 'primeng/radiobutton';
29
- import * as i2$2 from 'primeng/api';
30
30
  import { catchError as catchError$1 } from 'rxjs/operators';
31
31
 
32
32
  const VELOCE_FLOW_ROOT_ROUTE = 'VELOCE_FLOW_ROOT_ROUTE';
@@ -76,8 +76,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
76
76
  }] });
77
77
 
78
78
  class FlowHeaderComponent {
79
- constructor(templatesApi, flowStateService, flowInfo, toastService, customizationService) {
80
- this.templatesApi = templatesApi;
79
+ constructor(templatesAdminApiService, flowStateService, flowInfo, toastService, customizationService) {
80
+ this.templatesAdminApiService = templatesAdminApiService;
81
81
  this.flowStateService = flowStateService;
82
82
  this.flowInfo = flowInfo;
83
83
  this.toastService = toastService;
@@ -97,9 +97,6 @@ class FlowHeaderComponent {
97
97
  }
98
98
  initialize() {
99
99
  this.templateApiName = this.flowInfo.flow?.properties.templates?.flowHeader ?? '';
100
- if (this.flowInfo.isLegacy && !this.templateApiName) {
101
- return;
102
- }
103
100
  this.generateUIDefinition$()
104
101
  .pipe(tap(uiDef => {
105
102
  if (!uiDef) {
@@ -134,7 +131,7 @@ class FlowHeaderComponent {
134
131
  if (!template) {
135
132
  return of(undefined);
136
133
  }
137
- return this.templatesApi.fetchComponentsAttachments$(template.id);
134
+ return this.templatesAdminApiService.fetchComponentsAttachments$(template.id);
138
135
  }
139
136
  generateUIDefinition$() {
140
137
  return of(undefined).pipe(tap(() => {
@@ -148,7 +145,6 @@ class FlowHeaderComponent {
148
145
  const uiDef = {
149
146
  name: '',
150
147
  createdTimestamp: 0,
151
- primary: true,
152
148
  type: 'DEFAULT',
153
149
  version: 2,
154
150
  children: metaList.map(meta => ({
@@ -162,12 +158,12 @@ class FlowHeaderComponent {
162
158
  }));
163
159
  }
164
160
  }
165
- 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 });
161
+ FlowHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowHeaderComponent, deps: [{ token: i1$1.UITemplatesAdminApiService }, { token: i3$1.FlowStateService }, { token: i3$1.FlowInfoService }, { token: i2.ToastService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
166
162
  FlowHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: FlowHeaderComponent, selector: "vl-flow-new-header", ngImport: i0, template: "<ng-container *ngIf=\"uiDefinition$ | async as uiDefinition\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n</ng-container>\n", styles: [":host,vl-cms-preview{display:contents}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.PreviewComponent, selector: "vl-cms-preview", inputs: ["uiDefinition", "config"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
167
163
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowHeaderComponent, decorators: [{
168
164
  type: Component,
169
165
  args: [{ selector: 'vl-flow-new-header', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"uiDefinition$ | async as uiDefinition\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n</ng-container>\n", styles: [":host,vl-cms-preview{display:contents}\n"] }]
170
- }], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type: i2.FlowStateService }, { type: i2.FlowInfoService }, { type: i2$1.ToastService }, { type: undefined, decorators: [{
166
+ }], ctorParameters: function () { return [{ type: i1$1.UITemplatesAdminApiService }, { type: i3$1.FlowStateService }, { type: i3$1.FlowInfoService }, { type: i2.ToastService }, { type: undefined, decorators: [{
171
167
  type: Optional
172
168
  }, {
173
169
  type: Inject,
@@ -189,8 +185,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
189
185
  }] });
190
186
 
191
187
  class GuidedSellingComponent {
192
- constructor(templatesApi, flowStateService, flowInfo, toastService, customizationService) {
193
- this.templatesApi = templatesApi;
188
+ constructor(templatesAdminApiService, flowStateService, flowInfo, toastService, customizationService) {
189
+ this.templatesAdminApiService = templatesAdminApiService;
194
190
  this.flowStateService = flowStateService;
195
191
  this.flowInfo = flowInfo;
196
192
  this.toastService = toastService;
@@ -210,9 +206,6 @@ class GuidedSellingComponent {
210
206
  }
211
207
  initialize() {
212
208
  this.templateApiName = this.flowInfo.flow?.properties.templates?.guidedSelling ?? '';
213
- if (this.flowInfo.isLegacy && !this.templateApiName) {
214
- return;
215
- }
216
209
  this.generateUIDefinition$()
217
210
  .pipe(tap(uiDef => {
218
211
  if (!uiDef) {
@@ -247,7 +240,7 @@ class GuidedSellingComponent {
247
240
  if (!template) {
248
241
  return of(undefined);
249
242
  }
250
- return this.templatesApi.fetchComponentsAttachments$(template.id);
243
+ return this.templatesAdminApiService.fetchComponentsAttachments$(template.id);
251
244
  }
252
245
  generateUIDefinition$() {
253
246
  return of(undefined).pipe(tap(() => {
@@ -261,7 +254,6 @@ class GuidedSellingComponent {
261
254
  const uiDef = {
262
255
  name: '',
263
256
  createdTimestamp: 0,
264
- primary: true,
265
257
  type: 'DEFAULT',
266
258
  version: 2,
267
259
  children: metaList.map(meta => ({
@@ -275,12 +267,12 @@ class GuidedSellingComponent {
275
267
  }));
276
268
  }
277
269
  }
278
- 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 });
270
+ GuidedSellingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingComponent, deps: [{ token: i1$1.UITemplatesAdminApiService }, { token: i3$1.FlowStateService }, { token: i3$1.FlowInfoService }, { token: i2.ToastService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
279
271
  GuidedSellingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: GuidedSellingComponent, selector: "vl-flow-guided-selling", ngImport: i0, template: "<ng-container *ngIf=\"uiDefinition$ | async as uiDefinition\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n</ng-container>\n", styles: [":host,vl-cms-preview{display:contents}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.PreviewComponent, selector: "vl-cms-preview", inputs: ["uiDefinition", "config"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
280
272
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingComponent, decorators: [{
281
273
  type: Component,
282
274
  args: [{ selector: 'vl-flow-guided-selling', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"uiDefinition$ | async as uiDefinition\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n</ng-container>\n", styles: [":host,vl-cms-preview{display:contents}\n"] }]
283
- }], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type: i2.FlowStateService }, { type: i2.FlowInfoService }, { type: i2$1.ToastService }, { type: undefined, decorators: [{
275
+ }], ctorParameters: function () { return [{ type: i1$1.UITemplatesAdminApiService }, { type: i3$1.FlowStateService }, { type: i3$1.FlowInfoService }, { type: i2.ToastService }, { type: undefined, decorators: [{
284
276
  type: Optional
285
277
  }, {
286
278
  type: Inject,
@@ -334,10 +326,10 @@ const configurePrimengShadowDOM = () => {
334
326
  };
335
327
 
336
328
  class FlowDialogService {
337
- constructor(dialogService, contextService, runtimeSettings) {
329
+ constructor(dialogService, runtimeSettings, flowInfoService) {
338
330
  this.dialogService = dialogService;
339
- this.contextService = contextService;
340
331
  this.runtimeSettings = runtimeSettings;
332
+ this.flowInfoService = flowInfoService;
341
333
  }
342
334
  show(config) {
343
335
  return this.dialogService.open(FlowDialogComponent, {
@@ -358,8 +350,8 @@ class FlowDialogService {
358
350
  });
359
351
  }
360
352
  showReadonlyModeDialog() {
361
- const ctx = this.contextService.resolve();
362
- const objectName = ctx.mode ? ctx.mode[0]?.toUpperCase() + ctx.mode.substring(1).toLowerCase() : 'Object';
353
+ const mode = this.flowInfoService.context.mode;
354
+ const objectName = mode ? mode[0]?.toUpperCase() + mode.substring(1).toLowerCase() : 'Object';
363
355
  return this.show({
364
356
  title: 'Error',
365
357
  description: `${objectName} Cannot be Saved`,
@@ -373,10 +365,10 @@ class FlowDialogService {
373
365
  primaryButton: 'Ok',
374
366
  });
375
367
  }
376
- showQuoteOutsideShoppingCartDialog() {
368
+ showQuoteInConfiguratorDialog() {
377
369
  return this.show({
378
370
  title: 'Quote Cannot be Saved',
379
- description: 'It is only possible to save quotes from the Shopping Cart. To proceed, go to the Shopping Cart.',
371
+ description: 'It not possible to save quotes from the Configurator. To proceed, finish configuring product.',
380
372
  primaryButton: 'Ok',
381
373
  });
382
374
  }
@@ -396,27 +388,6 @@ class FlowDialogService {
396
388
  oppositeButtonActions: true,
397
389
  });
398
390
  }
399
- showReadonlyQuoteSubmitFailureDialog() {
400
- return this.show({
401
- title: 'Cannot Submit for Approval',
402
- description: 'It is only possible to submit for approval quotes with the “Draft“ status. Please create a new quote to proceed.',
403
- primaryButton: 'Ok',
404
- });
405
- }
406
- showOutsideShoppingCartQuoteSubmitFailureDialog() {
407
- return this.show({
408
- title: 'Cannot Submit for Approval',
409
- description: 'It is only possible to submit quotes for approval from the Shopping Cart. To proceed, go to the Shopping Cart.',
410
- primaryButton: 'Ok',
411
- });
412
- }
413
- showAccountSubmitFailureDialog() {
414
- return this.show({
415
- title: 'Save Changes',
416
- description: 'To submit for approval, save the quote first, and then submit it for approval from the Shopping Cart.',
417
- primaryButton: 'Ok',
418
- });
419
- }
420
391
  showTermsLimitReachedDialog() {
421
392
  const shoppingCartSettings = mapShoppingCartSettings(this.runtimeSettings.getShoppingCartSettings() || []);
422
393
  const maxRenewalTerms = getMaxRenewalTermsValue(shoppingCartSettings);
@@ -431,20 +402,18 @@ class FlowDialogService {
431
402
  return dialogFunction(dialog);
432
403
  }
433
404
  }
434
- 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 });
405
+ FlowDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService, deps: [{ token: i1.DialogService }, { token: i3$1.RuntimeSettingsService }, { token: i3$1.FlowInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
435
406
  FlowDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService });
436
407
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowDialogService, decorators: [{
437
408
  type: Injectable
438
- }], ctorParameters: function () { return [{ type: i1.DialogService }, { type: i2.ContextService }, { type: i2.RuntimeSettingsService }]; } });
409
+ }], ctorParameters: function () { return [{ type: i1.DialogService }, { type: i3$1.RuntimeSettingsService }, { type: i3$1.FlowInfoService }]; } });
439
410
 
440
411
  class FlowRouterService {
441
- constructor(router, route, contextService, integrationState, flowInfoService, flowStateService) {
412
+ constructor(router, route, integrationState, flowInfoService) {
442
413
  this.router = router;
443
414
  this.route = route;
444
- this.contextService = contextService;
445
415
  this.integrationState = integrationState;
446
416
  this.flowInfoService = flowInfoService;
447
- this.flowStateService = flowStateService;
448
417
  this.urlHistory = [];
449
418
  this.getLastChildRoute = (route) => {
450
419
  return route.firstChild ? this.getLastChildRoute(route.firstChild) : route;
@@ -538,7 +507,7 @@ class FlowRouterService {
538
507
  this.router.navigateByUrl(prevUrl);
539
508
  }
540
509
  }
541
- navigateTo(path, productId, lineItemId) {
510
+ navigateTo(path, productId, transactionItemId) {
542
511
  if (path === 'shopping-cart') {
543
512
  this.navigateToShoppingCart();
544
513
  }
@@ -549,31 +518,16 @@ class FlowRouterService {
549
518
  this.navigateToAssets();
550
519
  }
551
520
  else if (path === 'product' && productId) {
552
- this.navigateToProductConfiguration(productId, lineItemId);
521
+ this.navigateToProductConfiguration(productId, transactionItemId);
553
522
  }
554
523
  }
555
- navigateToProductConfiguration(productId, lineItemId) {
556
- let updateContext$;
557
- if (this.flowInfoService.isLegacy) {
558
- updateContext$ = of(undefined).pipe(tap(() => {
559
- this.contextService.update({ properties: { productId, lineItemId: lineItemId ?? '' } });
560
- }));
561
- }
562
- else {
563
- updateContext$ = this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'UPDATE_CONTEXT_PROPERTIES', {
564
- productId,
565
- lineItemId: lineItemId ?? '',
566
- });
567
- }
568
- updateContext$
569
- .pipe(tap(() => {
570
- const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
571
- const flowRouteUrl = this.getFlowRootPath(routeSnapshot);
572
- this.router.navigate([flowRouteUrl, 'product'], {
573
- queryParams: { ...routeSnapshot.queryParams, productId },
574
- });
575
- }))
576
- .subscribe();
524
+ navigateToProductConfiguration(productId, transactionItemId) {
525
+ this.flowInfoService.updateContext({ productId, transactionItemId });
526
+ const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
527
+ const flowRouteUrl = this.getFlowRootPath(routeSnapshot);
528
+ this.router.navigate([flowRouteUrl, 'product'], {
529
+ queryParams: { ...routeSnapshot.queryParams, productId, transactionItemId },
530
+ });
577
531
  }
578
532
  navigateToShoppingCart() {
579
533
  const routeSnapshot = this.getLastChildRouteSnapshot(this.route.snapshot);
@@ -610,24 +564,22 @@ class FlowRouterService {
610
564
  this.router.navigate([], { relativeTo: route, queryParams: { ...routeSnapshot.queryParams, ...queryParams } });
611
565
  }
612
566
  }
613
- FlowRouterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRouterService, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }, { token: i2.ContextService }, { token: i2.IntegrationState }, { token: i2.FlowInfoService }, { token: i2.FlowStateService }], target: i0.ɵɵFactoryTarget.Injectable });
567
+ FlowRouterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRouterService, deps: [{ token: i1$2.Router }, { token: i1$2.ActivatedRoute }, { token: i3$1.IntegrationState }, { token: i3$1.FlowInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
614
568
  FlowRouterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRouterService, providedIn: 'root' });
615
569
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRouterService, decorators: [{
616
570
  type: Injectable,
617
571
  args: [{ providedIn: 'root' }]
618
- }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: i2.ContextService }, { type: i2.IntegrationState }, { type: i2.FlowInfoService }, { type: i2.FlowStateService }]; } });
572
+ }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: i3$1.IntegrationState }, { type: i3$1.FlowInfoService }]; } });
619
573
 
620
574
  class FlowService {
621
- constructor(integrationState, flowRouterService, quoteDraftService, configurationService, configurationStateService, flowDialogService, flowConfigurationService, flowInfoService, flowStateService) {
575
+ constructor(integrationState, flowRouterService, configurationService, configurationStateService, flowDialogService, flowStateService, flowInfoService) {
622
576
  this.integrationState = integrationState;
623
577
  this.flowRouterService = flowRouterService;
624
- this.quoteDraftService = quoteDraftService;
625
578
  this.configurationService = configurationService;
626
579
  this.configurationStateService = configurationStateService;
627
580
  this.flowDialogService = flowDialogService;
628
- this.flowConfigurationService = flowConfigurationService;
629
- this.flowInfoService = flowInfoService;
630
581
  this.flowStateService = flowStateService;
582
+ this.flowInfoService = flowInfoService;
631
583
  this.cleanup$ = new Subject();
632
584
  }
633
585
  cleanup() {
@@ -636,16 +588,10 @@ class FlowService {
636
588
  initSubscriptions() {
637
589
  this.integrationState
638
590
  .listen$(FlowAction.FLOW_CONFIGURE_PRODUCT)
639
- .pipe(switchMap(payload => {
640
- if (this.flowInfoService.isLegacy) {
641
- const productId = payload.productId ??
642
- this.quoteDraftService.currentState.find(li => li.id === payload.lineItemId)?.productId;
643
- return of({ ...payload, productId });
644
- }
645
- return this.prepareConfiguration$(payload.lineItemId).pipe(map(() => payload));
646
- }), tap(payload => {
591
+ .pipe(tap(payload => {
647
592
  if (payload.productId) {
648
- this.flowRouterService.navigateToProductConfiguration(payload.productId, payload.lineItemId);
593
+ this.flowInfoService.updateContext({ newProductQty: payload.qty });
594
+ this.flowRouterService.navigateToProductConfiguration(payload.productId, payload.transactionItemId);
649
595
  }
650
596
  else {
651
597
  console.warn("Parameter 'productId' is needed to start configuration");
@@ -669,7 +615,7 @@ class FlowService {
669
615
  this.integrationState.dispatch(FlowAction.ConfigureProductAction(payload));
670
616
  }
671
617
  else {
672
- this.flowRouterService.navigateTo(payload.path, payload.productId, payload.lineItemId);
618
+ this.flowRouterService.navigateTo(payload.path, payload.productId, payload.transactionItemId);
673
619
  }
674
620
  }), takeUntil(this.cleanup$))
675
621
  .subscribe();
@@ -689,17 +635,10 @@ class FlowService {
689
635
  .subscribe();
690
636
  this.integrationState
691
637
  .listen$(FlowAction.FLOW_APPLY_PRODUCT_CONFIGURATION)
692
- .pipe(switchMap(() => {
693
- if (this.flowInfoService.isLegacy) {
694
- return this.legacyApplyConfiguration();
695
- }
696
- else {
697
- return this.configurationStateService.saveConfiguration(true).pipe(switchMap(() => this.configurationStateService.cancelConfiguration()), switchMap(() => this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'MODIFY_ASSETS', {
698
- addConfiguringAssetId: true,
699
- enable: true,
700
- })));
701
- }
702
- }), tap(() => {
638
+ .pipe(switchMap(() => this.configurationStateService.saveConfiguration()), switchMap(() => this.configurationStateService.cancelConfiguration()), switchMap(() => this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'MODIFY_ASSETS', {
639
+ addConfiguringAssetId: true,
640
+ enable: true,
641
+ })), tap(() => {
703
642
  this.configurationService.hasUnsavedChanges = false;
704
643
  this.flowRouterService.navigateToShoppingCart();
705
644
  }), takeUntil(this.cleanup$))
@@ -715,36 +654,12 @@ class FlowService {
715
654
  .pipe(map(path => path.queryParams['productId']), takeUntil(this.cleanup$))
716
655
  .subscribe(productId => this.integrationState.patchState({ productId }));
717
656
  }
718
- prepareConfiguration$(lineItemId) {
719
- if (!lineItemId) {
720
- return of(undefined);
721
- }
722
- return this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'UPDATE_PRICE_LIST', {
723
- lineItemId,
724
- });
725
- }
726
- legacyApplyConfiguration() {
727
- const quoteDraft = this.quoteDraftService.quoteDraft;
728
- const lineItem = this.configurationService.getSnapshot();
729
- if (!quoteDraft || !lineItem) {
730
- return of(undefined);
731
- }
732
- const isNewLineItem = quoteDraft.currentState.every(li => li.id !== lineItem.id);
733
- let updatedState;
734
- if (isNewLineItem) {
735
- updatedState = [...quoteDraft.currentState, lineItem];
736
- }
737
- else {
738
- updatedState = quoteDraft.currentState.map(li => (li.id === lineItem.id ? lineItem : li));
739
- }
740
- return this.flowConfigurationService.calculate$({ ...quoteDraft, currentState: updatedState });
741
- }
742
657
  }
743
- 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 });
658
+ 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 }, { token: i3$1.FlowInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
744
659
  FlowService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowService });
745
660
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowService, decorators: [{
746
661
  type: Injectable
747
- }], 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 }]; } });
662
+ }], ctorParameters: function () { return [{ type: i5.IntegrationState }, { type: FlowRouterService }, { type: i3$1.ConfigurationService }, { type: i3$1.ConfigurationStateService }, { type: FlowDialogService }, { type: i3$1.FlowStateService }, { type: i3$1.FlowInfoService }]; } });
748
663
 
749
664
  class FlowGuidedSellingService {
750
665
  constructor(integrationState) {
@@ -768,21 +683,21 @@ class FlowGuidedSellingService {
768
683
  .subscribe();
769
684
  }
770
685
  }
771
- FlowGuidedSellingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowGuidedSellingService, deps: [{ token: i2.IntegrationState }], target: i0.ɵɵFactoryTarget.Injectable });
686
+ FlowGuidedSellingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowGuidedSellingService, deps: [{ token: i3$1.IntegrationState }], target: i0.ɵɵFactoryTarget.Injectable });
772
687
  FlowGuidedSellingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowGuidedSellingService });
773
688
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowGuidedSellingService, decorators: [{
774
689
  type: Injectable
775
- }], ctorParameters: function () { return [{ type: i2.IntegrationState }]; } });
690
+ }], ctorParameters: function () { return [{ type: i3$1.IntegrationState }]; } });
776
691
 
777
692
  class FlowComponent {
778
- constructor(routerService, flowService, flowInfo, guidedSellingService) {
693
+ constructor(routerService, flowService, flowInfoService, guidedSellingService) {
779
694
  this.routerService = routerService;
780
695
  this.flowService = flowService;
781
- this.flowInfo = flowInfo;
696
+ this.flowInfoService = flowInfoService;
782
697
  this.guidedSellingService = guidedSellingService;
783
698
  this.isLoading$ = this.routerService.loading$;
784
- this.showHeader$ = combineLatest([this.routerService.route$, this.flowInfo.flow$]).pipe(map(([route, flow]) => route.data['showHeader'] && !flow?.properties.standalone));
785
- this.isStandalone$ = this.flowInfo.flow$.pipe(map(flow => Boolean(flow?.properties.standalone)));
699
+ this.showHeader$ = combineLatest([this.routerService.route$, this.flowInfoService.flow$]).pipe(map(([route, flow]) => route.data['showHeader'] && !flow?.properties.standalone));
700
+ this.isStandalone$ = this.flowInfoService.flow$.pipe(map(flow => Boolean(flow?.properties.standalone)));
786
701
  this.guidedSellingVisible$ = this.guidedSellingService.isVisible$;
787
702
  this.flowService.initSubscriptions();
788
703
  }
@@ -790,140 +705,36 @@ class FlowComponent {
790
705
  this.flowService.cleanup();
791
706
  }
792
707
  }
793
- 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 });
794
- FlowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: FlowComponent, selector: "vl-flow", ngImport: i0, template: "<vl-flow-new-header *ngIf=\"showHeader$ | async\"></vl-flow-new-header>\n\n<div class=\"flow-content\">\n <div class=\"loading-overlay\" *ngIf=\"isLoading$ | async\">\n <vl-loader label=\"LOADING\"></vl-loader>\n </div>\n\n <router-outlet></router-outlet>\n\n <div class=\"guided-selling\" [ngClass]=\"{ hidden: (guidedSellingVisible$ | async) === false }\">\n <vl-flow-guided-selling *ngIf=\"(isStandalone$ | async) !== true\"></vl-flow-guided-selling>\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column;width:100%;height:100%}.flow-content{flex-grow:1;position:relative;overflow:hidden}.loading-overlay{position:absolute;height:100%;width:100%;inset:0;background-color:#fff;z-index:999}.guided-selling{position:absolute;top:0;width:100%;height:100%;z-index:100}.hidden{display:none}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: i2$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 });
708
+ 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 });
709
+ FlowComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: FlowComponent, selector: "vl-flow", ngImport: i0, template: "<vl-flow-new-header *ngIf=\"showHeader$ | async\"></vl-flow-new-header>\n\n<div class=\"flow-content\">\n <div class=\"loading-overlay\" *ngIf=\"isLoading$ | async\">\n <vl-loader label=\"LOADING\"></vl-loader>\n </div>\n\n <router-outlet></router-outlet>\n\n <div class=\"guided-selling\" [ngClass]=\"{ hidden: (guidedSellingVisible$ | async) === false }\">\n <vl-flow-guided-selling *ngIf=\"(isStandalone$ | async) !== true\"></vl-flow-guided-selling>\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column;width:100%;height:100%}.flow-content{flex-grow:1;position:relative;overflow:hidden}.loading-overlay{position:absolute;height:100%;width:100%;inset:0;background-color:#fff;z-index:999}.guided-selling{position:absolute;top:0;width:100%;height:100%;z-index:100}.hidden{display:none}\n"], dependencies: [{ kind: "directive", type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$2.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "component", type: i2.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "component", type: FlowHeaderComponent, selector: "vl-flow-new-header" }, { kind: "component", type: GuidedSellingComponent, selector: "vl-flow-guided-selling" }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
795
710
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowComponent, decorators: [{
796
711
  type: Component,
797
712
  args: [{ selector: 'vl-flow', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-flow-new-header *ngIf=\"showHeader$ | async\"></vl-flow-new-header>\n\n<div class=\"flow-content\">\n <div class=\"loading-overlay\" *ngIf=\"isLoading$ | async\">\n <vl-loader label=\"LOADING\"></vl-loader>\n </div>\n\n <router-outlet></router-outlet>\n\n <div class=\"guided-selling\" [ngClass]=\"{ hidden: (guidedSellingVisible$ | async) === false }\">\n <vl-flow-guided-selling *ngIf=\"(isStandalone$ | async) !== true\"></vl-flow-guided-selling>\n </div>\n</div>\n", styles: [":host{display:flex;flex-direction:column;width:100%;height:100%}.flow-content{flex-grow:1;position:relative;overflow:hidden}.loading-overlay{position:absolute;height:100%;width:100%;inset:0;background-color:#fff;z-index:999}.guided-selling{position:absolute;top:0;width:100%;height:100%;z-index:100}.hidden{display:none}\n"] }]
798
- }], ctorParameters: function () { return [{ type: FlowRouterService }, { type: FlowService }, { type: i2.FlowInfoService }, { type: FlowGuidedSellingService }]; } });
799
-
800
- const getFlowObjectIdPropertyName = (id) => {
801
- const objectName = SalesforceIdUtils.getSfObjectNameById(id);
802
- switch (objectName) {
803
- case 'Account':
804
- return 'accountId';
805
- case 'Order':
806
- return 'orderId';
807
- case 'Quote':
808
- default:
809
- return 'quoteId';
810
- }
811
- };
812
- const getDefaultProperties = (params) => {
813
- const properties = {};
814
- let standalone = params.flowParams?.standalone;
815
- if (params.flowParams?.entryPath.includes('/product') || params.mode === ConfigurationContextMode.REMOTE) {
816
- standalone = standalone ?? true;
817
- }
818
- if (standalone != null) {
819
- properties.standalone = standalone ? 'true' : 'false';
820
- }
821
- return properties;
822
- };
823
-
824
- class ContextGuard {
825
- constructor(router, routerService, contextService, runtimeSettingsService) {
826
- this.router = router;
827
- this.routerService = routerService;
828
- this.contextService = contextService;
829
- this.runtimeSettingsService = runtimeSettingsService;
830
- }
831
- checkActivation(route) {
832
- const { queryParams } = route;
833
- const { accountId, quoteId, orderId } = queryParams;
834
- const rpcMessage = window.RPC_MESSAGE;
835
- const mode = this.getConfigurationContextMode(accountId, quoteId, orderId, rpcMessage);
836
- // Restrict if mode is not defined
837
- if (mode == null) {
838
- return this.routerService.showErrorPage$('Mode is undefined');
839
- }
840
- const headerId = accountId || quoteId || orderId || this.rpcMessageId || 'empty-for-test-mode';
841
- // Allow if context is already initialized with the same headerId
842
- if (this.contextService.isInitialized) {
843
- const currentContext = this.contextService.resolve();
844
- if (headerId && currentContext.headerId === headerId) {
845
- return of(true);
846
- }
847
- }
848
- // Initialize context and runtime settings
849
- return forkJoin([this.contextService.create(headerId, mode), this.runtimeSettingsService.create()]).pipe(tap(([context]) => {
850
- this.contextService.update({
851
- ...context,
852
- properties: {
853
- ...context.properties,
854
- ...(queryParams ?? {}),
855
- ...getDefaultProperties({ mode }),
856
- },
857
- });
858
- // Init currency settings
859
- this.runtimeSettingsService.initCurrency(context.properties['CurrencyIsoCode']);
860
- }), map(() => true), catchError(e => {
861
- const message = e instanceof HttpErrorResponse ? e.error.message : e;
862
- const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
863
- return this.routerService.showErrorPage$(message, errorDetails);
864
- }));
865
- }
866
- canActivate(route) {
867
- return this.checkActivation(route);
868
- }
869
- canActivateChild(childRoute) {
870
- return this.checkActivation(childRoute);
871
- }
872
- get rpcMessageId() {
873
- if (!window.RPC_MESSAGE) {
874
- return;
875
- }
876
- const rpcMessage = JSON.parse(window.RPC_MESSAGE);
877
- const veloceReferenceId = rpcMessage.configuration?.VeloceReferenceId;
878
- const quoteId = rpcMessage.quote?.Id;
879
- return veloceReferenceId || quoteId;
880
- }
881
- getConfigurationContextMode(accountId, quoteId, orderId, rpcMessage) {
882
- if (accountId) {
883
- return ConfigurationContextMode.ACCOUNT;
884
- }
885
- if (quoteId) {
886
- return ConfigurationContextMode.QUOTE;
887
- }
888
- if (orderId) {
889
- return ConfigurationContextMode.ORDER;
890
- }
891
- if (rpcMessage) {
892
- return ConfigurationContextMode.REMOTE;
893
- }
894
- return;
895
- }
896
- }
897
- ContextGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextGuard, deps: [{ token: i1$2.Router }, { token: FlowRouterService }, { token: i2.ContextService }, { token: i2.RuntimeSettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
898
- ContextGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextGuard });
899
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextGuard, decorators: [{
900
- type: Injectable
901
- }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i2.ContextService }, { type: i2.RuntimeSettingsService }]; } });
713
+ }], ctorParameters: function () { return [{ type: FlowRouterService }, { type: FlowService }, { type: i3$1.FlowInfoService }, { type: FlowGuidedSellingService }]; } });
902
714
 
903
715
  const keepFlowInitialized = (route) => {
904
- const contextService = inject(ContextService);
716
+ const routerService = inject(FlowRouterService);
717
+ const runtimeSettingsService = inject(RuntimeSettingsService);
905
718
  const flowState = inject(FlowStateService);
906
719
  const flowInfoService = inject(FlowInfoService);
907
- const routerService = inject(FlowRouterService);
908
- const quoteDraft = inject(QuoteDraftService);
720
+ const salesTrasnsactionService = inject(SalesTransactionService);
909
721
  const configurationService = inject(ConfigurationService);
910
722
  const integrationState = inject(IntegrationState);
911
723
  const { flowId } = route.queryParams;
912
- const flow = flowInfoService.flow;
913
- if (flow && flow?.id === flowId) {
724
+ if (flowInfoService.isFlowInitialized && flowInfoService.flow.id === flowId) {
914
725
  return true;
915
726
  }
916
727
  // Cleanup
917
- flowState.cleanup();
918
- quoteDraft.reset();
728
+ flowState.reset();
729
+ salesTrasnsactionService.reset();
919
730
  configurationService.reset();
920
- integrationState.clear();
921
- flowInfoService.cleanup();
922
- contextService.delete();
731
+ integrationState.reset();
732
+ flowInfoService.reset();
923
733
  if (!flowId) {
924
734
  return true;
925
735
  }
926
- return flowInfoService.init$(flowId, route.queryParams).pipe(map(() => true), catchError(e => {
736
+ return runtimeSettingsService.create().pipe(tap(() => runtimeSettingsService.initCurrency('USD')), switchMap(() => flowInfoService.init$(flowId, route.queryParams)), map(() => true), catchError(e => {
737
+ console.error(e);
927
738
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
928
739
  const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
929
740
  return routerService.showErrorPage$(message, errorDetails);
@@ -931,22 +742,20 @@ const keepFlowInitialized = (route) => {
931
742
  };
932
743
 
933
744
  class ProductUnloadGuard {
934
- constructor(router, contextService, quoteDraftService, configurationService, flowDialogService) {
745
+ constructor(router, flowInfoService, configurationService, flowDialogService) {
935
746
  this.router = router;
936
- this.contextService = contextService;
937
- this.quoteDraftService = quoteDraftService;
747
+ this.flowInfoService = flowInfoService;
938
748
  this.configurationService = configurationService;
939
749
  this.flowDialogService = flowDialogService;
940
750
  }
941
751
  canDeactivate(_, route, currentState, nextState) {
942
752
  let observable = of(true);
943
- if (!this.quoteDraftService.isStandalone && this.configurationService.hasUnsavedChanges) {
753
+ if (!this.flowInfoService.flow.properties.standalone && this.configurationService.hasUnsavedChanges) {
944
754
  observable = this.flowDialogService.showUnsavedChangesDialog();
945
755
  }
946
756
  return observable.pipe(map(unload => {
947
757
  if (unload) {
948
758
  this.configurationService.reset();
949
- this.contextService.update({ properties: { productId: undefined, lineItemId: undefined } });
950
759
  if (!nextState || currentState.url === nextState.url) {
951
760
  return true;
952
761
  }
@@ -964,11 +773,11 @@ class ProductUnloadGuard {
964
773
  }));
965
774
  }
966
775
  }
967
- 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 });
776
+ ProductUnloadGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard, deps: [{ token: i1$2.Router }, { token: i3$1.FlowInfoService }, { token: i3$1.ConfigurationService }, { token: FlowDialogService }], target: i0.ɵɵFactoryTarget.Injectable });
968
777
  ProductUnloadGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard });
969
778
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductUnloadGuard, decorators: [{
970
779
  type: Injectable
971
- }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i2.ContextService }, { type: i2.QuoteDraftService }, { type: i2.ConfigurationService }, { type: FlowDialogService }]; } });
780
+ }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i3$1.FlowInfoService }, { type: i3$1.ConfigurationService }, { type: FlowDialogService }]; } });
972
781
 
973
782
  class RootGuard {
974
783
  constructor(router, routerService) {
@@ -1011,8 +820,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1011
820
  }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }]; } });
1012
821
 
1013
822
  class AssetsComponent {
1014
- constructor(templatesApi, cdr, toastService, flowInfo, customizationService) {
1015
- this.templatesApi = templatesApi;
823
+ constructor(templatesAdminApiService, cdr, toastService, flowInfo, customizationService) {
824
+ this.templatesAdminApiService = templatesAdminApiService;
1016
825
  this.cdr = cdr;
1017
826
  this.toastService = toastService;
1018
827
  this.flowInfo = flowInfo;
@@ -1065,7 +874,7 @@ class AssetsComponent {
1065
874
  if (!template) {
1066
875
  return of(undefined);
1067
876
  }
1068
- return this.templatesApi.fetchComponentsAttachments$(template.id);
877
+ return this.templatesAdminApiService.fetchComponentsAttachments$(template.id);
1069
878
  }
1070
879
  generateUIDefinition$() {
1071
880
  return of(undefined).pipe(tap(() => {
@@ -1079,7 +888,6 @@ class AssetsComponent {
1079
888
  const uiDef = {
1080
889
  name: '',
1081
890
  createdTimestamp: 0,
1082
- primary: true,
1083
891
  type: 'DEFAULT',
1084
892
  version: 2,
1085
893
  children: metaList.map(meta => ({
@@ -1093,12 +901,12 @@ class AssetsComponent {
1093
901
  }));
1094
902
  }
1095
903
  }
1096
- AssetsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AssetsComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token: i0.ChangeDetectorRef }, { token: i2$1.ToastService }, { token: i2.FlowInfoService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1097
- AssetsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AssetsComponent, selector: "vl-flow-assets", ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.PreviewComponent, selector: "vl-cms-preview", inputs: ["uiDefinition", "config"] }, { kind: "component", type: i2$1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
904
+ AssetsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AssetsComponent, deps: [{ token: i1$1.UITemplatesAdminApiService }, { token: i0.ChangeDetectorRef }, { token: i2.ToastService }, { token: i3$1.FlowInfoService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
905
+ AssetsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: AssetsComponent, selector: "vl-flow-assets", ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.PreviewComponent, selector: "vl-cms-preview", inputs: ["uiDefinition", "config"] }, { kind: "component", type: i2.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1098
906
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AssetsComponent, decorators: [{
1099
907
  type: Component,
1100
908
  args: [{ selector: 'vl-flow-assets', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n </ng-container>\n </ng-template>\n</ng-container>\n" }]
1101
- }], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2$1.ToastService }, { type: i2.FlowInfoService }, { type: undefined, decorators: [{
909
+ }], ctorParameters: function () { return [{ type: i1$1.UITemplatesAdminApiService }, { type: i0.ChangeDetectorRef }, { type: i2.ToastService }, { type: i3$1.FlowInfoService }, { type: undefined, decorators: [{
1102
910
  type: Optional
1103
911
  }, {
1104
912
  type: Inject,
@@ -1120,8 +928,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1120
928
  }] });
1121
929
 
1122
930
  class CatalogComponent {
1123
- constructor(templatesApi, cdr, toastService, flowInfo, customizationService) {
1124
- this.templatesApi = templatesApi;
931
+ constructor(templatesAdminApiService, cdr, toastService, flowInfo, customizationService) {
932
+ this.templatesAdminApiService = templatesAdminApiService;
1125
933
  this.cdr = cdr;
1126
934
  this.toastService = toastService;
1127
935
  this.flowInfo = flowInfo;
@@ -1174,7 +982,7 @@ class CatalogComponent {
1174
982
  if (!template) {
1175
983
  return of(undefined);
1176
984
  }
1177
- return this.templatesApi.fetchComponentsAttachments$(template.id);
985
+ return this.templatesAdminApiService.fetchComponentsAttachments$(template.id);
1178
986
  }
1179
987
  generateUIDefinition$() {
1180
988
  return of(undefined).pipe(tap(() => {
@@ -1188,7 +996,6 @@ class CatalogComponent {
1188
996
  const uiDef = {
1189
997
  name: '',
1190
998
  createdTimestamp: 0,
1191
- primary: true,
1192
999
  type: 'DEFAULT',
1193
1000
  version: 2,
1194
1001
  children: metaList.map(meta => ({
@@ -1202,12 +1009,12 @@ class CatalogComponent {
1202
1009
  }));
1203
1010
  }
1204
1011
  }
1205
- CatalogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogComponent, deps: [{ token: i1$1.UITemplatesApiService }, { token: i0.ChangeDetectorRef }, { token: i2$1.ToastService }, { token: i2.FlowInfoService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1206
- CatalogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CatalogComponent, selector: "vl-flow-catalog", ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.PreviewComponent, selector: "vl-cms-preview", inputs: ["uiDefinition", "config"] }, { kind: "component", type: i2$1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1012
+ CatalogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogComponent, deps: [{ token: i1$1.UITemplatesAdminApiService }, { token: i0.ChangeDetectorRef }, { token: i2.ToastService }, { token: i3$1.FlowInfoService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1013
+ CatalogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: CatalogComponent, selector: "vl-flow-catalog", ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.PreviewComponent, selector: "vl-cms-preview", inputs: ["uiDefinition", "config"] }, { kind: "component", type: i2.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1207
1014
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogComponent, decorators: [{
1208
1015
  type: Component,
1209
1016
  args: [{ selector: 'vl-flow-catalog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-preview [uiDefinition]=\"uiDefinition\"></vl-cms-preview>\n </ng-container>\n </ng-template>\n</ng-container>\n" }]
1210
- }], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2$1.ToastService }, { type: i2.FlowInfoService }, { type: undefined, decorators: [{
1017
+ }], ctorParameters: function () { return [{ type: i1$1.UITemplatesAdminApiService }, { type: i0.ChangeDetectorRef }, { type: i2.ToastService }, { type: i3$1.FlowInfoService }, { type: undefined, decorators: [{
1211
1018
  type: Optional
1212
1019
  }, {
1213
1020
  type: Inject,
@@ -1229,12 +1036,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1229
1036
  }] });
1230
1037
 
1231
1038
  class DebugComponent {
1232
- constructor(flowsApiService, router, activatedRoute, context, quoteDraftService) {
1039
+ constructor(flowsApiService, router, activatedRoute) {
1233
1040
  this.flowsApiService = flowsApiService;
1234
1041
  this.router = router;
1235
1042
  this.activatedRoute = activatedRoute;
1236
- this.context = context;
1237
- this.quoteDraftService = quoteDraftService;
1238
1043
  this.form = new FormGroup({
1239
1044
  id: new FormControl(''),
1240
1045
  });
@@ -1242,17 +1047,13 @@ class DebugComponent {
1242
1047
  }
1243
1048
  runFlow() {
1244
1049
  const { id } = this.form.value;
1245
- const objectPropertyName = id && getFlowObjectIdPropertyName(id);
1246
- if (!id || !objectPropertyName || !this.selectedFlow) {
1050
+ if (!id || !this.selectedFlow) {
1247
1051
  return;
1248
1052
  }
1249
- // Delete context before starting a new flow
1250
- this.context.delete();
1251
- this.quoteDraftService.reset();
1252
1053
  this.router.navigate(['..', 'flows'], {
1253
1054
  queryParams: {
1254
1055
  flowId: this.selectedFlow.id,
1255
- [objectPropertyName]: id,
1056
+ headerId: id,
1256
1057
  ...this.selectedFlow.properties.queryParams,
1257
1058
  },
1258
1059
  relativeTo: this.activatedRoute,
@@ -1262,12 +1063,12 @@ class DebugComponent {
1262
1063
  return new HttpParams({ fromObject: params }).toString();
1263
1064
  }
1264
1065
  }
1265
- 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 });
1266
- DebugComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: DebugComponent, selector: "vl-flow-debug", ngImport: i0, template: "<form [formGroup]=\"form\">\n <div class=\"fields-container\">\n <div class=\"field\">\n <label>SF Object ID</label>\n <input formControlName=\"id\" pInputText type=\"text\" />\n </div>\n </div>\n\n <p-button\n styleClass=\"p-button-primary\"\n label=\"Run Flow\"\n [disabled]=\"!form.value.id || !selectedFlow\"\n (onClick)=\"runFlow()\"\n ></p-button>\n</form>\n\n<table>\n <thead>\n <tr>\n <th [width]=\"30\"></th>\n <th [width]=\"160\">ID</th>\n <th [width]=\"160\">Entry Path</th>\n <th>QueryParams</th>\n <th [width]=\"100\">Standalone</th>\n <th [width]=\"100\">Stateful</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let flow of flows$ | async\" (click)=\"selectedFlow = flow\">\n <td><p-radioButton [inputId]=\"flow.id\" name=\"flow\" [value]=\"flow\" [(ngModel)]=\"selectedFlow\"></p-radioButton></td>\n <td>{{ flow.id }}</td>\n <td>{{ flow.properties.entryPath }}</td>\n <td class=\"cell-query-params\">{{ getQueryParamsString(flow.properties.queryParams) }}</td>\n <td>{{ flow.properties.standalone }}</td>\n <td>{{ flow.properties.stateful }}</td>\n </tr>\n </tbody>\n</table>\n", styles: [":host{display:block;padding:24px 54px}form{display:flex;align-items:center;justify-content:space-between}.fields-container{display:flex;gap:24px}.field{display:flex;flex-direction:column;width:200px;flex-shrink:0}:host ::ng-deep .p-dropdown{width:100%}table{width:100%;border-collapse:collapse;table-layout:fixed}tbody>tr{cursor:pointer}tbody>tr:hover{background-color:#f0f5fa}th{text-align:left;font-weight:600}th,td{padding:0 10px;height:30px;border-bottom:1px solid var(--vl-border-color);margin-right:16px;line-height:18px}.cell-query-params{word-break:break-all}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: 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 });
1066
+ 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 }], target: i0.ɵɵFactoryTarget.Component });
1067
+ DebugComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: DebugComponent, selector: "vl-flow-debug", ngImport: i0, template: "<form [formGroup]=\"form\">\n <div class=\"fields-container\">\n <div class=\"field\">\n <label>SF Object ID</label>\n <input formControlName=\"id\" pInputText type=\"text\" />\n </div>\n </div>\n\n <p-button\n styleClass=\"p-button-primary\"\n label=\"Run Flow\"\n [disabled]=\"!form.value.id || !selectedFlow\"\n (onClick)=\"runFlow()\"\n ></p-button>\n</form>\n\n<table>\n <thead>\n <tr>\n <th [width]=\"30\"></th>\n <th [width]=\"160\">ID</th>\n <th [width]=\"160\">Entry Path</th>\n <th>QueryParams</th>\n <th [width]=\"100\">Standalone</th>\n <th [width]=\"100\">Stateful</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let flow of flows$ | async\" (click)=\"selectedFlow = flow\">\n <td><p-radioButton [inputId]=\"flow.id\" name=\"flow\" [value]=\"flow\" [(ngModel)]=\"selectedFlow\"></p-radioButton></td>\n <td>{{ flow.id }}</td>\n <td>{{ flow.properties.entryPath }}</td>\n <td class=\"cell-query-params\">{{ getQueryParamsString(flow.properties.queryParams) }}</td>\n <td>{{ flow.properties.standalone }}</td>\n <td>{{ flow.properties.stateful }}</td>\n </tr>\n </tbody>\n</table>\n", styles: [":host{display:block;padding:24px 54px}form{display:flex;align-items:center;justify-content:space-between}.fields-container{display:flex;gap:24px}.field{display:flex;flex-direction:column;width:200px;flex-shrink:0}:host ::ng-deep .p-dropdown{width:100%}table{width:100%;border-collapse:collapse;table-layout:fixed}tbody>tr{cursor:pointer}tbody>tr:hover{background-color:#f0f5fa}th{text-align:left;font-weight:600}th,td{padding:0 10px;height:30px;border-bottom:1px solid var(--vl-border-color);margin-right:16px;line-height:18px}.cell-query-params{word-break:break-all}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i4$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i4$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i4$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i5$1.RadioButton, selector: "p-radioButton", inputs: ["value", "formControlName", "name", "disabled", "label", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "style", "styleClass", "labelStyleClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: i7.InputText, selector: "[pInputText]" }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1267
1068
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DebugComponent, decorators: [{
1268
1069
  type: Component,
1269
1070
  args: [{ selector: 'vl-flow-debug', changeDetection: ChangeDetectionStrategy.OnPush, template: "<form [formGroup]=\"form\">\n <div class=\"fields-container\">\n <div class=\"field\">\n <label>SF Object ID</label>\n <input formControlName=\"id\" pInputText type=\"text\" />\n </div>\n </div>\n\n <p-button\n styleClass=\"p-button-primary\"\n label=\"Run Flow\"\n [disabled]=\"!form.value.id || !selectedFlow\"\n (onClick)=\"runFlow()\"\n ></p-button>\n</form>\n\n<table>\n <thead>\n <tr>\n <th [width]=\"30\"></th>\n <th [width]=\"160\">ID</th>\n <th [width]=\"160\">Entry Path</th>\n <th>QueryParams</th>\n <th [width]=\"100\">Standalone</th>\n <th [width]=\"100\">Stateful</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let flow of flows$ | async\" (click)=\"selectedFlow = flow\">\n <td><p-radioButton [inputId]=\"flow.id\" name=\"flow\" [value]=\"flow\" [(ngModel)]=\"selectedFlow\"></p-radioButton></td>\n <td>{{ flow.id }}</td>\n <td>{{ flow.properties.entryPath }}</td>\n <td class=\"cell-query-params\">{{ getQueryParamsString(flow.properties.queryParams) }}</td>\n <td>{{ flow.properties.standalone }}</td>\n <td>{{ flow.properties.stateful }}</td>\n </tr>\n </tbody>\n</table>\n", styles: [":host{display:block;padding:24px 54px}form{display:flex;align-items:center;justify-content:space-between}.fields-container{display:flex;gap:24px}.field{display:flex;flex-direction:column;width:200px;flex-shrink:0}:host ::ng-deep .p-dropdown{width:100%}table{width:100%;border-collapse:collapse;table-layout:fixed}tbody>tr{cursor:pointer}tbody>tr:hover{background-color:#f0f5fa}th{text-align:left;font-weight:600}th,td{padding:0 10px;height:30px;border-bottom:1px solid var(--vl-border-color);margin-right:16px;line-height:18px}.cell-query-params{word-break:break-all}\n"] }]
1270
- }], ctorParameters: function () { return [{ type: i1$1.FlowsApiService }, { type: i1$2.Router }, { type: i1$2.ActivatedRoute }, { type: i2.ContextService }, { type: i2.QuoteDraftService }]; } });
1071
+ }], ctorParameters: function () { return [{ type: i1$1.FlowsApiService }, { type: i1$2.Router }, { type: i1$2.ActivatedRoute }]; } });
1271
1072
 
1272
1073
  const routes$1 = [{ path: '', component: DebugComponent }];
1273
1074
  class DebugModule {
@@ -1305,121 +1106,43 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1305
1106
  }] });
1306
1107
 
1307
1108
  class ProductComponent {
1308
- constructor(contextService, configurationRuntimeService, configurationService, configurationStateService, quoteDraftService, flowInfoService, flowStateService, integrationState, customizationService) {
1309
- this.contextService = contextService;
1109
+ constructor(configurationRuntimeService, configurationStateService) {
1310
1110
  this.configurationRuntimeService = configurationRuntimeService;
1311
- this.configurationService = configurationService;
1312
1111
  this.configurationStateService = configurationStateService;
1313
- this.quoteDraftService = quoteDraftService;
1314
- this.flowInfoService = flowInfoService;
1315
- this.flowStateService = flowStateService;
1316
- this.integrationState = integrationState;
1317
- this.customizationService = customizationService;
1318
- this.uiDefinition$ = new BehaviorSubject(undefined);
1112
+ this.uiDefinitionContainer$ = new BehaviorSubject(null);
1113
+ this.uiDefinitionContainer$.next(this.configurationRuntimeService.uiDefinitionContainer);
1319
1114
  this.config = {
1320
1115
  init$: () => this.init$(),
1321
1116
  };
1322
1117
  }
1323
- customizeUI$() {
1324
- const { productId } = this.configurationRuntimeService.runtimeContext ?? {};
1325
- if (!productId || !this.customizationService?.getUiDefinition) {
1326
- return of(undefined);
1327
- }
1328
- return this.customizationService.getUiDefinition(productId).pipe(map(uiDefinitionContainer => {
1329
- if (uiDefinitionContainer) {
1330
- this.configurationRuntimeService.overrideUIDefinition(uiDefinitionContainer);
1331
- }
1332
- }));
1333
- }
1334
1118
  init$() {
1335
- let quoteDraft$;
1336
- if (this.flowInfoService.isLegacy || !this.flowInfoService.isStateful) {
1337
- quoteDraft$ = this.quoteDraftService.quoteDraft$;
1338
- }
1339
- else {
1340
- quoteDraft$ = of(undefined);
1341
- }
1342
- return quoteDraft$.pipe(first(), switchMap(quote => {
1343
- const contextProperties = this.contextService.resolve().properties;
1344
- const productId = contextProperties.productId ?? this.flowInfoService.flow?.properties.queryParams['productId'];
1345
- const defaultUIDefinitionId = this.flowInfoService.flow?.properties.queryParams['defaultUIDefinitionId'];
1346
- const requiredUIDefinitionId = this.flowInfoService.flow?.properties.queryParams['requiredUIDefinitionId'];
1347
- if (!productId) {
1348
- throw new Error(`Unable to start configuration for 'productId == null'`);
1349
- }
1350
- if (!quote) {
1351
- const offeringId = contextProperties.offeringId;
1352
- return this.configurationRuntimeService.init({ productId, offeringId });
1353
- }
1354
- const lineItem = this.getLineItem(quote, productId, contextProperties.lineItemId);
1355
- if (lineItem) {
1356
- this.configurationService.setConfigurableRamp(lineItem);
1357
- }
1358
- const { offeringId } = lineItem ?? {};
1359
- return this.configurationRuntimeService.init({
1360
- productId,
1361
- offeringId,
1362
- defaultUIDefinitionId,
1363
- requiredUIDefinitionId,
1364
- });
1365
- }), switchMap(() => this.customizeUI$()), tap(() => {
1366
- const uiDefinition = this.configurationRuntimeService.runtimeContext?.uiDefinitionContainer?.source;
1367
- if (uiDefinition) {
1368
- this.uiDefinition$.next(uiDefinition);
1369
- }
1370
- else {
1371
- throw new Error('Product does not have Configuration UI');
1372
- }
1373
- }), tap(() => {
1374
- if (this.configurationRuntimeService.initializationProps) {
1375
- this.configurationRuntimeService.initializationProps.attributesMap =
1376
- this.integrationState.state.guidedSelling;
1377
- }
1378
- }), switchMap(() => this.configurationStateService.init$()));
1379
- }
1380
- getLineItem(quote, productId, lineItemId) {
1381
- // search by lineItemId first
1382
- let li = quote.currentState.find(li => li.id === lineItemId);
1383
- if (!li && this.quoteDraftService.isStandalone) {
1384
- li = quote.currentState.find(li => li.productId === productId);
1385
- }
1386
- // If still not found, is could be an asset
1387
- if (!li) {
1388
- li = this.quoteDraftService.assetsState?.currentState.find(li => li.id === lineItemId);
1389
- }
1390
- return li;
1119
+ return this.configurationStateService.init$();
1391
1120
  }
1392
1121
  }
1393
- 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 });
1394
- 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 });
1122
+ 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 });
1123
+ 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 });
1395
1124
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductComponent, decorators: [{
1396
1125
  type: Component,
1397
- args: [{ selector: 'vl-flow-product', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-cms-preview [uiDefinition]=\"$any(uiDefinition$ | async)\" [config]=\"config\"></vl-cms-preview>\n" }]
1398
- }], ctorParameters: function () { 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: [{
1399
- type: Optional
1400
- }, {
1401
- type: Inject,
1402
- args: [FLOW_CUSTOMIZATION]
1403
- }] }]; } });
1126
+ args: [{ selector: 'vl-flow-product', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-cms-preview [uiDefinition]=\"(uiDefinitionContainer$ | async)?.source\" [config]=\"config\"></vl-cms-preview>\n" }]
1127
+ }], ctorParameters: function () { return [{ type: i3$1.ConfigurationRuntimeService }, { type: i3$1.ConfigurationStateService }]; } });
1404
1128
 
1405
1129
  class ProductModule {
1406
1130
  }
1407
1131
  ProductModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1408
- ProductModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, declarations: [ProductComponent], imports: [CommonModule, PreviewModule, LoaderModule], exports: [ProductComponent] });
1409
- ProductModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, imports: [CommonModule, PreviewModule, LoaderModule] });
1132
+ 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] });
1133
+ ProductModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, imports: [CommonModule, PreviewModule, LoaderModule, LetDirectiveModule] });
1410
1134
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductModule, decorators: [{
1411
1135
  type: NgModule,
1412
1136
  args: [{
1413
1137
  declarations: [ProductComponent],
1414
- imports: [CommonModule, PreviewModule, LoaderModule],
1138
+ imports: [CommonModule, PreviewModule, LoaderModule, LetDirectiveModule],
1415
1139
  exports: [ProductComponent],
1416
1140
  }]
1417
1141
  }] });
1418
1142
 
1419
1143
  class RecordNotFoundComponent {
1420
- constructor(router, route) {
1144
+ constructor(router) {
1421
1145
  this.router = router;
1422
- this.route = route;
1423
1146
  this.subMessage = '';
1424
1147
  this.type = '';
1425
1148
  const navigation = this.router.getCurrentNavigation();
@@ -1432,12 +1155,12 @@ class RecordNotFoundComponent {
1432
1155
  }
1433
1156
  }
1434
1157
  }
1435
- 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 });
1158
+ 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 });
1436
1159
  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 });
1437
1160
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RecordNotFoundComponent, decorators: [{
1438
1161
  type: Component,
1439
1162
  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"] }]
1440
- }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i1$2.ActivatedRoute }]; } });
1163
+ }], ctorParameters: function () { return [{ type: i1$2.Router }]; } });
1441
1164
 
1442
1165
  const routes = [{ path: '', component: RecordNotFoundComponent }];
1443
1166
  class RecordNotFoundModule {
@@ -1453,352 +1176,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1453
1176
  }]
1454
1177
  }] });
1455
1178
 
1456
- class RemoteComponent {
1457
- constructor(contextService, quoteDraftService, runtimeService, configurationService, configurationState, messageService, integrationState, location) {
1458
- this.contextService = contextService;
1459
- this.quoteDraftService = quoteDraftService;
1460
- this.runtimeService = runtimeService;
1461
- this.configurationService = configurationService;
1462
- this.configurationState = configurationState;
1463
- this.messageService = messageService;
1464
- this.integrationState = integrationState;
1465
- this.location = location;
1466
- this.state$ = new BehaviorSubject({ loading: true, failure: false });
1467
- this.DYNAMIC_OPTION_PRODUCTS_KEY = 'Dynamic';
1468
- this.destroyed$ = new Subject();
1469
- this.rpcMessage = JSON.parse(window.RPC_MESSAGE);
1470
- this.rpcMessage.options.sort((a, b) => (a.featureNumber ?? 99999) - (b.featureNumber ?? 99999));
1471
- this.updateHasChildrenFlag(this.rpcMessage.product.configuredProductId);
1472
- // update context properties
1473
- if (this.rpcMessage.quote) {
1474
- const properties = {};
1475
- if (this.rpcMessage.quote['SBQQ__Opportunity2__c']) {
1476
- properties.OpportunityId = this.rpcMessage.quote['SBQQ__Opportunity2__c'];
1477
- }
1478
- Object.entries(this.rpcMessage.quote).forEach(([key, value]) => {
1479
- if (value !== undefined && !(value instanceof Object)) {
1480
- properties[key] = value;
1481
- }
1482
- });
1483
- this.contextService.update({ properties });
1484
- }
1485
- this.initSubscriptions();
1486
- this.initConfiguration();
1487
- }
1488
- ngOnDestroy() {
1489
- this.destroyed$.next();
1490
- this.destroyed$.complete();
1491
- }
1492
- initConfiguration() {
1493
- const productId = this.rpcMessage.product.configuredProductId;
1494
- const quote = this.quoteDraftService.quoteDraft;
1495
- if (!productId || !quote) {
1496
- return;
1497
- }
1498
- this.runtimeService
1499
- .init({ productId })
1500
- .pipe(first(), tap(context => {
1501
- const uiDefinitionProperties = context.uiDefinitionContainer?.source.properties ?? {};
1502
- this.uiDefinition = context.uiDefinitionContainer?.source;
1503
- const pricingEnabled = uiDefinitionProperties.pricingEnabled ? 'true' : 'false';
1504
- const priceListId = uiDefinitionProperties.priceList;
1505
- const runtimeContextProperties = this.runtimeService.runtimeContext?.properties;
1506
- if (runtimeContextProperties) {
1507
- runtimeContextProperties.PriceListId = priceListId;
1508
- runtimeContextProperties.PricingEnabled = pricingEnabled;
1509
- }
1510
- this.contextService.update({
1511
- properties: {
1512
- ModelId: context.modelId,
1513
- RuntimeMode: 'TEST',
1514
- PricingEnabled: pricingEnabled,
1515
- PriceListId: priceListId,
1516
- },
1517
- });
1518
- this.configurationService.setConfigurableRamp(this.createLineItem());
1519
- }), this.throwIfNoUIDefinition(), switchMap(() => this.configurationState.init$()), tap(() => this.state$.next({ loading: false, failure: false })), catchError(error => {
1520
- if (!this.uiDefinition?.properties?.suppressToastMessages) {
1521
- this.messageService.add({ severity: 'error', summary: error });
1522
- }
1523
- this.state$.next({ loading: false, failure: true });
1524
- return of();
1525
- }), takeUntil(this.destroyed$))
1526
- .subscribe();
1527
- }
1528
- throwIfNoUIDefinition() {
1529
- return (source$) => {
1530
- return source$.pipe(switchMap(() => {
1531
- if (!this.uiDefinition) {
1532
- return throwError(() => 'Product does not have Configuration UI');
1533
- }
1534
- return source$;
1535
- }));
1536
- };
1537
- }
1538
- initSubscriptions() {
1539
- this.integrationState
1540
- .listen$(FlowAction.REMOTE_CANCEL)
1541
- .pipe(tap(() => this.location.back()), takeUntil(this.destroyed$))
1542
- .subscribe();
1543
- this.integrationState
1544
- .listen$(FlowAction.REMOTE_APPLY)
1545
- .pipe(tap(() => this.saveRpcMessage()), takeUntil(this.destroyed$))
1546
- .subscribe();
1547
- }
1548
- createLineItem() {
1549
- const [quoteDraftLineItem] = this.quoteDraftService.quoteDraft?.currentState ?? [];
1550
- if (quoteDraftLineItem && (quoteDraftLineItem.attributes.length > 0 || quoteDraftLineItem.lineItems.length > 0)) {
1551
- return quoteDraftLineItem;
1552
- }
1553
- const lineItem = this.createRootLineItem();
1554
- const dynamicOptionProducts = this.rpcMessage.product.optionConfigurations[this.DYNAMIC_OPTION_PRODUCTS_KEY];
1555
- if (dynamicOptionProducts) {
1556
- const options = this.toParentChildMap(dynamicOptionProducts);
1557
- let items = [lineItem];
1558
- for (let i = 0; i < items.length; i++) {
1559
- const item = items[i];
1560
- const children = item && options.get(item.id);
1561
- if (children) {
1562
- item.lineItems = children;
1563
- items = items.concat(children);
1564
- }
1565
- }
1566
- }
1567
- return lineItem;
1568
- }
1569
- createRootLineItem() {
1570
- const product = this.rpcMessage.product;
1571
- const runtimeContext = this.runtimeService.runtimeContext;
1572
- const veloceInstanceId = product.configurationAttributes['VeloceInstanceId__c'];
1573
- const quoteId = this.quoteDraftService.quoteDraft?.currentState[0]?.id;
1574
- return {
1575
- id: quoteId || veloceInstanceId || UUID.UUID(),
1576
- type: runtimeContext.productType ?? '',
1577
- name: runtimeContext.properties?.['displayName'] || runtimeContext.productName,
1578
- productName: runtimeContext.productName,
1579
- productId: runtimeContext.productId,
1580
- cfgStatus: 'Default',
1581
- actionCode: 'ADD',
1582
- qty: 1,
1583
- };
1584
- }
1585
- toParentChildMap(remoteOptionProducts) {
1586
- const result = new Map();
1587
- for (const option of remoteOptionProducts) {
1588
- const configurationData = option?.readOnly?.line;
1589
- const id = configurationData?.VeloceInstanceId__c;
1590
- const parentId = configurationData?.VeloceParentInstanceId__c;
1591
- if (!option.selected || !configurationData || !id || !parentId) {
1592
- continue;
1593
- }
1594
- const productId = option.productId;
1595
- const lineItem = {
1596
- id,
1597
- productId,
1598
- parentId,
1599
- type: configurationData.ModelType__c,
1600
- port: configurationData.ModelPort__c,
1601
- cfgStatus: configurationData.ConfigurationStatus__c,
1602
- actionCode: configurationData.ActionCode__c,
1603
- qty: option.Quantity,
1604
- };
1605
- let siblings = result.get(productId);
1606
- if (!siblings) {
1607
- result.set(parentId, (siblings = []));
1608
- }
1609
- siblings.push(lineItem);
1610
- }
1611
- return result;
1612
- }
1613
- saveRpcMessage() {
1614
- const quote = this.quoteDraftService.quoteDraft;
1615
- const lineItem = this.configurationService.getSnapshot();
1616
- if (!quote || !lineItem) {
1617
- return;
1618
- }
1619
- this.rpcMessage.VeloceReferenceId = quote.quoteId;
1620
- this.rpcMessage.product.configurationData.VeloceInstanceId__c = lineItem.id;
1621
- const childItems = this.flattenChildLineItems(lineItem);
1622
- const savingMode = window.SavingMode;
1623
- this.updateContentData(this.rpcMessage.product, lineItem);
1624
- this.rpcMessage.quote = this.mapAttributesTo('Quote', lineItem);
1625
- if (savingMode === 'ALL') {
1626
- const optionConfigurations = this.getOptionConfigurations(this.rpcMessage.product);
1627
- const rootProductOptions = this.rpcMessage.options.filter(po => po.configuredProductId === lineItem.productId);
1628
- childItems.forEach(lineItem => {
1629
- const rootOption = rootProductOptions.find(po => po.optionalProductId === lineItem.productId);
1630
- if (rootOption) {
1631
- const featureOptions = optionConfigurations[rootOption.featureName] ?? (optionConfigurations[rootOption.featureName] = []);
1632
- const originOption = !rootOption.hasChildren
1633
- ? optionConfigurations[rootOption.featureName]?.find(({ optionId }) => optionId === rootOption.optionId)
1634
- : undefined;
1635
- const option = originOption ?? {};
1636
- option.optionId = option.optionId ?? rootOption.optionId;
1637
- this.updateContentData(option, lineItem);
1638
- option.index = option.index ?? featureOptions.length;
1639
- option.selected = true;
1640
- if (!originOption) {
1641
- featureOptions.push(option);
1642
- }
1643
- if (lineItem.parentLineItem) {
1644
- const nestedProductOption = this.rpcMessage.options.find(po => po.configuredProductId === lineItem.parentLineItem?.productId &&
1645
- po.optionalProductId === lineItem.productId);
1646
- if (nestedProductOption) {
1647
- option.configurationData = {
1648
- ...option.configurationData,
1649
- VeloceParentInstanceId__c: lineItem.parentLineItem.id,
1650
- VeloceNestedOptionId__c: nestedProductOption.optionId,
1651
- VeloceNestedFeatureId__c: nestedProductOption.featureId,
1652
- };
1653
- }
1654
- }
1655
- }
1656
- else {
1657
- this.rpcMessage.dynamicFeatures.forEach(feature => {
1658
- const featureOptions = optionConfigurations[feature.name] ?? (optionConfigurations[feature.name] = []);
1659
- const originOption = featureOptions.find(({ productId }) => productId === lineItem.productId);
1660
- const option = originOption ?? {};
1661
- this.updateContentData(option, lineItem);
1662
- option.index = option.index ?? featureOptions.length;
1663
- option.selected = true;
1664
- if (!originOption) {
1665
- featureOptions.push(option);
1666
- }
1667
- });
1668
- }
1669
- });
1670
- this.rpcMessage.product = { ...this.rpcMessage.product, optionConfigurations };
1671
- }
1672
- window.RPC_BROADCAST?.apply(null, [this.rpcMessage]);
1673
- }
1674
- updateHasChildrenFlag(bundleProductId) {
1675
- const bundleOptionsByOptionId = {};
1676
- const notBundleOptions = [];
1677
- for (const productOption of this.rpcMessage.options) {
1678
- if (productOption.configuredProductId === bundleProductId) {
1679
- bundleOptionsByOptionId[productOption.optionalProductId] = productOption;
1680
- }
1681
- else {
1682
- notBundleOptions.push(productOption);
1683
- }
1684
- }
1685
- for (const option of notBundleOptions) {
1686
- const bundleOption = bundleOptionsByOptionId[option.configuredProductId];
1687
- if (bundleOption) {
1688
- bundleOption.hasChildren = true;
1689
- }
1690
- }
1691
- }
1692
- flattenChildLineItems(lineItem) {
1693
- let items = lineItem.lineItems ?? [];
1694
- for (let i = 0; i < items.length; i++) {
1695
- const item = items[i];
1696
- if (item?.lineItems) {
1697
- items = items.concat(item.lineItems.map(li => ({ ...li, parentLineItem: item })));
1698
- }
1699
- }
1700
- return items;
1701
- }
1702
- updateContentData(entity, lineItem) {
1703
- if (lineItem.productId) {
1704
- entity.productId = lineItem.productId;
1705
- }
1706
- const quantityAttribute = lineItem.properties['quantityAttribute'];
1707
- entity.Quantity = quantityAttribute
1708
- ? lineItem.attributes.find(attribute => attribute.name === quantityAttribute)?.value ?? 1
1709
- : lineItem.qty;
1710
- const totalPrice = this.computeNetPrice(lineItem);
1711
- const targetTotalPriceField = lineItem.properties['TargetTotalPriceField'] || 'TotalPrice__c';
1712
- entity.configurationData[targetTotalPriceField] = entity.configurationData[targetTotalPriceField]
1713
- ? entity.configurationData[targetTotalPriceField] + totalPrice
1714
- : totalPrice;
1715
- const targetPriceField = lineItem.properties['TargetPriceField'] || 'SBQQ__ListPrice__c';
1716
- const price = entity.Quantity != null ? entity.configurationData[targetTotalPriceField] / entity.Quantity || 0 : 0;
1717
- const targetPriceValue = Number(entity.configurationData[targetPriceField]) || 0;
1718
- entity.configurationData[targetPriceField] = targetPriceValue
1719
- ? (targetPriceValue + price).toFixed(2)
1720
- : price.toFixed(2);
1721
- entity.configurationAttributes = this.mapAttributesTo('Attribute', lineItem);
1722
- entity.configurationData = {
1723
- ...entity.configurationData,
1724
- ...this.mapAttributesTo('Field', lineItem),
1725
- ...this.mapAttributesTo('', lineItem),
1726
- VeloceInstanceId__c: lineItem.id,
1727
- };
1728
- }
1729
- computeNetPrice(lineItem) {
1730
- if (lineItem.properties['GroupCharges']) {
1731
- return this.sumNetPrice(lineItem.chargeGroupItems, this.getChargeNameSet(lineItem.properties['GroupCharges']));
1732
- }
1733
- return this.sumNetPrice(lineItem.chargeItems, this.getChargeNameSet(lineItem.properties['Charges']));
1734
- }
1735
- getChargeNameSet(property) {
1736
- if (property && property.length > 0) {
1737
- return new Set(property.split(','));
1738
- }
1739
- return new Set();
1740
- }
1741
- sumNetPrice(chargeItems, charges) {
1742
- let netPrice = 0;
1743
- for (const chargeItem of chargeItems) {
1744
- if (!charges || charges.has(chargeItem.chargeType)) {
1745
- netPrice += chargeItem.netPrice ?? 0;
1746
- }
1747
- }
1748
- return netPrice;
1749
- }
1750
- mapAttributesTo(target, lineItem) {
1751
- const result = {};
1752
- const component = this.runtimeService.runtimeModel?.components.get(lineItem.type);
1753
- if (!component) {
1754
- return result;
1755
- }
1756
- const propertyName = 'mapTo' + target;
1757
- component.attributes
1758
- .filter(a => a.properties && a.properties[propertyName])
1759
- .forEach(mapping => {
1760
- const attribute = lineItem.attributes.find(a => a.name === mapping.name);
1761
- if (attribute) {
1762
- new Set(mapping.properties[propertyName]?.split(',')).forEach(k => (result[k] = attribute.value));
1763
- }
1764
- });
1765
- return result;
1766
- }
1767
- getOptionConfigurations(product) {
1768
- const optionConfigurations = {};
1769
- const requestOptionConfigurations = product.optionConfigurations ?? {};
1770
- Object.keys(requestOptionConfigurations).forEach(k => {
1771
- optionConfigurations[k] = (requestOptionConfigurations[k] ?? []).map(opt => {
1772
- return { ...opt, selected: false };
1773
- });
1774
- });
1775
- return optionConfigurations;
1776
- }
1777
- }
1778
- 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 });
1779
- 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 });
1780
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteComponent, decorators: [{
1781
- type: Component,
1782
- 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" }]
1783
- }], 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 }]; } });
1784
-
1785
- class RemoteModule {
1786
- }
1787
- RemoteModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1788
- RemoteModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, declarations: [RemoteComponent], imports: [CommonModule, PreviewModule, LoaderModule], exports: [RemoteComponent] });
1789
- RemoteModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, imports: [CommonModule, PreviewModule, LoaderModule] });
1790
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RemoteModule, decorators: [{
1791
- type: NgModule,
1792
- args: [{
1793
- declarations: [RemoteComponent],
1794
- imports: [CommonModule, PreviewModule, LoaderModule],
1795
- exports: [RemoteComponent],
1796
- }]
1797
- }] });
1798
-
1799
1179
  class ShoppingCartComponent {
1800
- constructor(templatesApi, cdr, toastService, flowInfo, customizationService) {
1801
- this.templatesApi = templatesApi;
1180
+ constructor(templatesAdminApiService, cdr, toastService, flowInfo, customizationService) {
1181
+ this.templatesAdminApiService = templatesAdminApiService;
1802
1182
  this.cdr = cdr;
1803
1183
  this.toastService = toastService;
1804
1184
  this.flowInfo = flowInfo;
@@ -1851,7 +1231,7 @@ class ShoppingCartComponent {
1851
1231
  if (!template) {
1852
1232
  return of(undefined);
1853
1233
  }
1854
- return this.templatesApi.fetchComponentsAttachments$(template.id);
1234
+ return this.templatesAdminApiService.fetchComponentsAttachments$(template.id);
1855
1235
  }
1856
1236
  generateUIDefinition$() {
1857
1237
  return of(undefined).pipe(tap(() => {
@@ -1865,7 +1245,6 @@ class ShoppingCartComponent {
1865
1245
  const uiDef = {
1866
1246
  name: '',
1867
1247
  createdTimestamp: 0,
1868
- primary: true,
1869
1248
  type: 'DEFAULT',
1870
1249
  version: 2,
1871
1250
  children: metaList.map(meta => ({
@@ -1879,12 +1258,12 @@ class ShoppingCartComponent {
1879
1258
  }));
1880
1259
  }
1881
1260
  }
1882
- 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 });
1883
- 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 });
1261
+ ShoppingCartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ShoppingCartComponent, deps: [{ token: i1$1.UITemplatesAdminApiService }, { token: i0.ChangeDetectorRef }, { token: i2.ToastService }, { token: i3$1.FlowInfoService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1262
+ 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 });
1884
1263
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ShoppingCartComponent, decorators: [{
1885
1264
  type: Component,
1886
1265
  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" }]
1887
- }], ctorParameters: function () { return [{ type: i1$1.UITemplatesApiService }, { type: i0.ChangeDetectorRef }, { type: i2$1.ToastService }, { type: i2.FlowInfoService }, { type: undefined, decorators: [{
1266
+ }], ctorParameters: function () { return [{ type: i1$1.UITemplatesAdminApiService }, { type: i0.ChangeDetectorRef }, { type: i2.ToastService }, { type: i3$1.FlowInfoService }, { type: undefined, decorators: [{
1888
1267
  type: Optional
1889
1268
  }, {
1890
1269
  type: Inject,
@@ -1906,30 +1285,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1906
1285
  }] });
1907
1286
 
1908
1287
  class FlowResolver {
1909
- constructor(router, routerService, contextService, flowInfo) {
1288
+ constructor(router, routerService, flowInfoService) {
1910
1289
  this.router = router;
1911
1290
  this.routerService = routerService;
1912
- this.contextService = contextService;
1913
- this.flowInfo = flowInfo;
1291
+ this.flowInfoService = flowInfoService;
1914
1292
  }
1915
1293
  resolve(route) {
1916
- const { queryParams } = route;
1917
- const flow = this.flowInfo.flow;
1918
- if (!flow) {
1294
+ if (!this.flowInfoService.isFlowInitialized) {
1919
1295
  return of(false);
1920
1296
  }
1921
- const { properties } = flow;
1297
+ const { queryParams } = route;
1298
+ const { properties } = this.flowInfoService.flow;
1922
1299
  const { queryParams: flowQueryParams, entryPath } = properties;
1923
1300
  const mergedQueryParams = {
1924
1301
  ...queryParams,
1925
1302
  ...flowQueryParams,
1926
1303
  };
1927
- const contextProperties = Object.entries({
1928
- ...mergedQueryParams,
1929
- ...getDefaultProperties({ flowParams: properties }),
1930
- }).reduce((trunk, [key, value]) => ({ ...trunk, [key]: String(value) }), {});
1931
- this.contextService.update({ properties: contextProperties });
1932
- this.flowInfo.flow = flow;
1933
1304
  const parentUrl = this.routerService.getFlowRootPath(route);
1934
1305
  const entryUrl = String(entryPath ?? '')
1935
1306
  .split('/')
@@ -1938,29 +1309,39 @@ class FlowResolver {
1938
1309
  queryParams: mergedQueryParams,
1939
1310
  replaceUrl: true,
1940
1311
  })).pipe(catchError$1(e => {
1312
+ console.error(e);
1941
1313
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
1942
1314
  const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
1943
1315
  return this.routerService.showErrorPage$(message, errorDetails);
1944
1316
  }));
1945
1317
  }
1946
1318
  }
1947
- 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 });
1319
+ 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 });
1948
1320
  FlowResolver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowResolver });
1949
1321
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowResolver, decorators: [{
1950
1322
  type: Injectable
1951
- }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i2.ContextService }, { type: i2.FlowInfoService }]; } });
1323
+ }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i3$1.FlowInfoService }]; } });
1324
+
1325
+ const resolvePCMModel = () => {
1326
+ const flowInfoService = inject(FlowInfoService);
1327
+ const configurationRuntimeService = inject(ConfigurationRuntimeService);
1328
+ const { productId } = flowInfoService.context;
1329
+ if (!productId) {
1330
+ throw new Error(`Unable to start configuration for 'productId == null'`);
1331
+ }
1332
+ return configurationRuntimeService.init$({ productId });
1333
+ };
1952
1334
 
1953
- class QuoteResolver {
1954
- constructor(router, quoteDraftService, routerService, contextService, flowInfo, flowStateService) {
1335
+ class SalesTransactionResolver {
1336
+ constructor(router, routerService, flowInfoService, flowStateService, salesTransactionService) {
1955
1337
  this.router = router;
1956
- this.quoteDraftService = quoteDraftService;
1957
1338
  this.routerService = routerService;
1958
- this.contextService = contextService;
1959
- this.flowInfo = flowInfo;
1339
+ this.flowInfoService = flowInfoService;
1960
1340
  this.flowStateService = flowStateService;
1341
+ this.salesTransactionService = salesTransactionService;
1961
1342
  }
1962
1343
  resolve(route) {
1963
- const flow = this.flowInfo.flow;
1344
+ const flow = this.flowInfoService.flow;
1964
1345
  if (!flow) {
1965
1346
  return of(false);
1966
1347
  }
@@ -1968,13 +1349,14 @@ class QuoteResolver {
1968
1349
  return of(true);
1969
1350
  }
1970
1351
  return this.flowStateService.init$().pipe(switchMap(() => this.checkDynamicNavigation$(route)), catchError(e => {
1352
+ console.error(e);
1971
1353
  const message = e instanceof HttpErrorResponse ? e.error.message : e;
1972
1354
  const errorDetails = isVeloceError(e.error) ? extractErrorDetails(e.error) : [];
1973
1355
  return this.routerService.showErrorPage$(message, errorDetails);
1974
1356
  }));
1975
1357
  }
1976
1358
  checkDynamicNavigation$(route) {
1977
- const flow = this.flowInfo.flow;
1359
+ const flow = this.flowInfoService.flow;
1978
1360
  if (!flow) {
1979
1361
  return of(true);
1980
1362
  }
@@ -1993,33 +1375,53 @@ class QuoteResolver {
1993
1375
  }));
1994
1376
  }
1995
1377
  getNavigateTo() {
1996
- const flow = this.flowInfo.flow;
1997
- let navigateTo;
1998
- if (flow?.properties.stateful) {
1999
- return this.flowStateService.select$(UITemplateType.FLOW_ENGINE, 'NAVIGATE_TO').pipe(map(r => {
2000
- if (r.success) {
2001
- return r.result;
2002
- }
2003
- return '';
2004
- }));
2005
- }
2006
- else {
2007
- const isAccountMode = this.contextService.mode === ConfigurationContextMode.ACCOUNT;
2008
- if (isAccountMode || this.quoteDraftService.hasAssets) {
2009
- navigateTo = '/assets';
2010
- }
2011
- else if (this.quoteDraftService.hasProducts) {
2012
- navigateTo = '/cart';
2013
- }
2014
- }
2015
- return of(navigateTo);
1378
+ // Implement when needed
1379
+ return of('');
2016
1380
  }
2017
1381
  }
2018
- 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 });
2019
- QuoteResolver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteResolver });
2020
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteResolver, decorators: [{
1382
+ 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 });
1383
+ SalesTransactionResolver.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionResolver });
1384
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionResolver, decorators: [{
2021
1385
  type: Injectable
2022
- }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: i2.QuoteDraftService }, { type: FlowRouterService }, { type: i2.ContextService }, { type: i2.FlowInfoService }, { type: i2.FlowStateService }]; } });
1386
+ }], ctorParameters: function () { return [{ type: i1$2.Router }, { type: FlowRouterService }, { type: i3$1.FlowInfoService }, { type: i3$1.FlowStateService }, { type: i3$1.SalesTransactionService }]; } });
1387
+
1388
+ const resolveUIDefinition = () => {
1389
+ const customizationService = inject(FLOW_CUSTOMIZATION, { optional: true });
1390
+ const flowInfoService = inject(FlowInfoService);
1391
+ const uiDefinitionsAdminApiService = inject(UIDefinitionsAdminApiService);
1392
+ const configurationRuntimeService = inject(ConfigurationRuntimeService);
1393
+ const { productId } = flowInfoService.context;
1394
+ if (!productId) {
1395
+ throw new Error(`Unable to start configuration for 'productId == null'`);
1396
+ }
1397
+ return of(undefined).pipe(switchMap(() => {
1398
+ // Try resolving via customization service
1399
+ if (!productId || !customizationService?.getUiDefinition) {
1400
+ return of(undefined);
1401
+ }
1402
+ return customizationService.getUiDefinition(flowInfoService.context);
1403
+ }), switchMap(uiDefContainer => {
1404
+ // Resolve UIDefinition from the org
1405
+ if (uiDefContainer) {
1406
+ return of(uiDefContainer);
1407
+ }
1408
+ if (flowInfoService.context.requiredUIDefinitionId) {
1409
+ return uiDefinitionsAdminApiService.fetch$(flowInfoService.context.requiredUIDefinitionId);
1410
+ }
1411
+ return uiDefinitionsAdminApiService
1412
+ .fetchAll$({
1413
+ productId,
1414
+ defaultUIDefinitionId: flowInfoService.context.defaultUIDefinitionId,
1415
+ })
1416
+ .pipe(map((uiDefinitionContainers) => {
1417
+ const uiDefContainer = uiDefinitionContainers[0];
1418
+ if (!uiDefContainer) {
1419
+ throw new Error(`UI Definition for productId=${productId} is not resolved`);
1420
+ }
1421
+ return uiDefContainer;
1422
+ }));
1423
+ }), tap(uiDefContainer => (configurationRuntimeService.uiDefinitionContainer = uiDefContainer)));
1424
+ };
2023
1425
 
2024
1426
  const rootRoute = {
2025
1427
  id: VELOCE_FLOW_ROOT_ROUTE,
@@ -2037,15 +1439,13 @@ const rootRoute = {
2037
1439
  path: 'flows',
2038
1440
  runGuardsAndResolvers: 'paramsOrQueryParamsChange',
2039
1441
  resolve: { flow: FlowResolver },
2040
- canActivate: [ContextGuard],
2041
1442
  children: [],
2042
1443
  },
2043
1444
  {
2044
1445
  path: 'product',
2045
1446
  component: ProductComponent,
2046
1447
  runGuardsAndResolvers: 'paramsOrQueryParamsChange',
2047
- resolve: { quote: QuoteResolver },
2048
- canActivate: [ContextGuard],
1448
+ resolve: { salesTransaction: SalesTransactionResolver, uiDef: resolveUIDefinition, pcm: resolvePCMModel },
2049
1449
  canDeactivate: [ProductUnloadGuard],
2050
1450
  data: { showHeader: true },
2051
1451
  },
@@ -2053,33 +1453,23 @@ const rootRoute = {
2053
1453
  path: 'cart',
2054
1454
  component: ShoppingCartComponent,
2055
1455
  runGuardsAndResolvers: 'paramsOrQueryParamsChange',
2056
- resolve: { quote: QuoteResolver },
2057
- canActivate: [ContextGuard],
1456
+ resolve: { salesTransaction: SalesTransactionResolver },
2058
1457
  data: { showHeader: true },
2059
1458
  },
2060
1459
  {
2061
1460
  path: 'catalog',
2062
1461
  component: CatalogComponent,
2063
1462
  runGuardsAndResolvers: 'paramsOrQueryParamsChange',
2064
- resolve: { quote: QuoteResolver },
2065
- canActivate: [ContextGuard],
1463
+ resolve: { salesTransaction: SalesTransactionResolver },
2066
1464
  data: { showHeader: true },
2067
1465
  },
2068
1466
  {
2069
1467
  path: 'assets',
2070
1468
  component: AssetsComponent,
2071
1469
  runGuardsAndResolvers: 'paramsOrQueryParamsChange',
2072
- resolve: { quote: QuoteResolver },
2073
- canActivate: [ContextGuard],
1470
+ resolve: { salesTransaction: SalesTransactionResolver },
2074
1471
  data: { showHeader: true },
2075
1472
  },
2076
- {
2077
- path: 'remote',
2078
- component: RemoteComponent,
2079
- runGuardsAndResolvers: 'paramsOrQueryParamsChange',
2080
- resolve: { quote: QuoteResolver },
2081
- canActivate: [ContextGuard],
2082
- },
2083
1473
  {
2084
1474
  path: 'debug',
2085
1475
  loadChildren: () => DebugModule,
@@ -2095,30 +1485,14 @@ const rootRoute = {
2095
1485
  class FlowRoutingModule {
2096
1486
  }
2097
1487
  FlowRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2098
- FlowRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, imports: [i1$2.RouterModule, ProductModule,
2099
- ShoppingCartModule,
2100
- CatalogModule,
2101
- AssetsModule,
2102
- RemoteModule], exports: [RouterModule] });
2103
- 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]),
2104
- ProductModule,
2105
- ShoppingCartModule,
2106
- CatalogModule,
2107
- AssetsModule,
2108
- RemoteModule, RouterModule] });
1488
+ 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] });
1489
+ 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] });
2109
1490
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowRoutingModule, decorators: [{
2110
1491
  type: NgModule,
2111
1492
  args: [{
2112
- imports: [
2113
- RouterModule.forChild([rootRoute]),
2114
- ProductModule,
2115
- ShoppingCartModule,
2116
- CatalogModule,
2117
- AssetsModule,
2118
- RemoteModule,
2119
- ],
1493
+ imports: [RouterModule.forChild([rootRoute]), ProductModule, ShoppingCartModule, CatalogModule, AssetsModule],
2120
1494
  exports: [RouterModule],
2121
- providers: [FlowRouterService, RootGuard, ContextGuard, ProductUnloadGuard, FlowResolver, QuoteResolver],
1495
+ providers: [FlowRouterService, RootGuard, ProductUnloadGuard, FlowResolver, SalesTransactionResolver],
2122
1496
  }]
2123
1497
  }] });
2124
1498
 
@@ -2170,5 +1544,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2170
1544
  * Generated bundle index. Do not edit.
2171
1545
  */
2172
1546
 
2173
- export { ContextGuard, FlowDialogService, FlowModule, FlowRouterService, FlowService, VELOCE_FLOW_ROOT_ROUTE, getDefaultProperties, getFlowObjectIdPropertyName };
1547
+ export { FlowDialogService, FlowModule, FlowRouterService, FlowService, VELOCE_FLOW_ROOT_ROUTE };
2174
1548
  //# sourceMappingURL=veloceapps-sdk.mjs.map