@veloceapps/sdk 11.0.0-1 → 11.0.0-10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/cms/cms.actions.d.ts +0 -40
  2. package/cms/vendor-map.d.ts +10 -21
  3. package/core/modules/configuration/services/configuration-state.service.d.ts +0 -4
  4. package/core/modules/configuration/services/configuration.service.d.ts +5 -1
  5. package/core/modules/configuration/services/runtime-context.service.d.ts +1 -1
  6. package/core/modules/configuration/types/configuration-runtime.types.d.ts +2 -0
  7. package/core/types/flow-customization.types.d.ts +0 -12
  8. package/esm2020/cms/cms.actions.mjs +1 -36
  9. package/esm2020/cms/components/element-tools-panel/element-tools-panel.component.mjs +3 -3
  10. package/esm2020/cms/vendor-map.mjs +4 -9
  11. package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +4 -2
  12. package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +2 -3
  13. package/esm2020/core/modules/configuration/services/configuration.service.mjs +29 -10
  14. package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +5 -3
  15. package/esm2020/core/modules/configuration/types/configuration-runtime.types.mjs +1 -1
  16. package/esm2020/core/types/flow-customization.types.mjs +1 -1
  17. package/esm2020/src/pages/product/product.component.mjs +9 -2
  18. package/fesm2015/veloceapps-sdk-cms.mjs +15 -52
  19. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
  20. package/fesm2015/veloceapps-sdk-core.mjs +32 -14
  21. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  22. package/fesm2015/veloceapps-sdk.mjs +9 -2
  23. package/fesm2015/veloceapps-sdk.mjs.map +1 -1
  24. package/fesm2020/veloceapps-sdk-cms.mjs +7 -54
  25. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
  26. package/fesm2020/veloceapps-sdk-core.mjs +34 -14
  27. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  28. package/fesm2020/veloceapps-sdk.mjs +8 -1
  29. package/fesm2020/veloceapps-sdk.mjs.map +1 -1
  30. package/package.json +1 -1
@@ -1321,7 +1321,7 @@ function extractMetadata(uiDefinition) {
1321
1321
  }
1322
1322
 
1323
1323
  class ConfigurationService {
1324
- constructor(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService, runtimeSettings) {
1324
+ constructor(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService, runtimeSettings, flowInfoService) {
1325
1325
  this.quoteDraftService = quoteDraftService;
1326
1326
  this.runtimeService = runtimeService;
1327
1327
  this.contextService = contextService;
@@ -1329,6 +1329,7 @@ class ConfigurationService {
1329
1329
  this.messageService = messageService;
1330
1330
  this.dialogService = dialogService;
1331
1331
  this.runtimeSettings = runtimeSettings;
1332
+ this.flowInfoService = flowInfoService;
1332
1333
  this.mode = ConfigurationMode.SEARCH;
1333
1334
  this.configurationState = new BehaviorSubject(null);
1334
1335
  this.previousConfigurationState = new BehaviorSubject(null);
@@ -1436,8 +1437,12 @@ class ConfigurationService {
1436
1437
  const customPriceApi = this.runtimeSettings.getConfigurationSettings()['CUSTOM_PRICE_API'];
1437
1438
  this.isLoadingSubj$.next(true);
1438
1439
  const configure$ = pricingEnabled && customPriceApi
1439
- ? this.configurationApiService.customConfigurePrice({ url: customPriceApi, configurationRequest, runtimeModel })
1440
- : this.configurationApiService.configureLineItem({
1440
+ ? this.configurationApiService.customConfigurePrice({
1441
+ url: customPriceApi,
1442
+ configurationRequest: this.extendConfigurationRequest(configurationRequest),
1443
+ runtimeModel,
1444
+ })
1445
+ : this.extendedConfigureLineItem$({
1441
1446
  configurationRequest,
1442
1447
  runtimeModel,
1443
1448
  pricingEnabled,
@@ -1471,11 +1476,9 @@ class ConfigurationService {
1471
1476
  }), finalize$1(() => this.reset()));
1472
1477
  }
1473
1478
  configureGuidedSelling$(data) {
1474
- return this.configurationApiService
1475
- .configureLineItem({
1479
+ return this.extendedConfigureLineItem$({
1476
1480
  configurationRequest: getGuidedSellingConfigurationRequest(data, this.contextService.resolve()),
1477
- })
1478
- .pipe(catchError$1(error => {
1481
+ }).pipe(catchError$1(error => {
1479
1482
  if (error instanceof HttpErrorResponse) {
1480
1483
  this.messageService.add({ severity: ToastType.error, summary: error.error.message || error.error });
1481
1484
  }
@@ -1551,12 +1554,26 @@ class ConfigurationService {
1551
1554
  }
1552
1555
  });
1553
1556
  }
1557
+ extendedConfigureLineItem$({ configurationRequest, runtimeModel, pricingEnabled, }) {
1558
+ return this.configurationApiService.configureLineItem({
1559
+ configurationRequest: this.extendConfigurationRequest(configurationRequest),
1560
+ runtimeModel,
1561
+ pricingEnabled,
1562
+ });
1563
+ }
1564
+ extendConfigurationRequest(configurationRequest) {
1565
+ const procedureName = this.flowInfoService.flow?.properties.procedureName;
1566
+ return {
1567
+ ...configurationRequest,
1568
+ ...(procedureName ? { procedureName } : {}),
1569
+ };
1570
+ }
1554
1571
  }
1555
- ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1.ConfigurationApiService }, { token: i5.MessageService }, { token: i6$1.DialogService }, { token: RuntimeSettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
1572
+ ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1.ConfigurationApiService }, { token: i5.MessageService }, { token: i6$1.DialogService }, { token: RuntimeSettingsService }, { token: FlowInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
1556
1573
  ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService });
1557
1574
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, decorators: [{
1558
1575
  type: Injectable
1559
- }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6$1.DialogService }, { type: RuntimeSettingsService }]; } });
1576
+ }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6$1.DialogService }, { type: RuntimeSettingsService }, { type: FlowInfoService }]; } });
1560
1577
 
1561
1578
  class FlowUpdateService {
1562
1579
  update(rootLineItems, updates, charges) {
@@ -1953,8 +1970,10 @@ class RuntimeContextService {
1953
1970
  constructor(configurationApiService) {
1954
1971
  this.configurationApiService = configurationApiService;
1955
1972
  }
1956
- getRuntimeContext(productId, offeringId) {
1957
- return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
1973
+ getRuntimeContext(productId, offeringId, defaultUIDefinitionId, requiredUIDefinitionId) {
1974
+ return this.configurationApiService
1975
+ .getRuntimeDataByProductId(productId, offeringId, defaultUIDefinitionId, requiredUIDefinitionId)
1976
+ .pipe(map(runtimeData => {
1958
1977
  const uiDefinitionContainer = this.getUIDefinitionContainer(runtimeData);
1959
1978
  const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
1960
1979
  const { productName, properties } = Array.from(runtimeModel.components.values()).find(c => c.productId === productId) ?? {};
@@ -2029,7 +2048,9 @@ class ConfigurationRuntimeService {
2029
2048
  init(props) {
2030
2049
  this.initializationProps = props;
2031
2050
  const context = this.contextService.resolve();
2032
- return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
2051
+ return this.runtimeContextService
2052
+ .getRuntimeContext(props.productId, props.offeringId, props.defaultUIDefinitionId, props.requiredUIDefinitionId)
2053
+ .pipe(tap(runtimeContext => {
2033
2054
  this.uiDefinitionProperties = runtimeContext.uiDefinitionContainer?.source.properties ?? {};
2034
2055
  const { PriceListId } = context.properties ?? {};
2035
2056
  const mergeContext = {
@@ -2203,8 +2224,7 @@ class ConfigurationStateService {
2203
2224
  }
2204
2225
  }), takeUntil(this.canceledConfiguration$));
2205
2226
  }
2206
- saveConfiguration(first, second) {
2207
- const flow = typeof first === 'boolean' ? first : second;
2227
+ saveConfiguration(flow) {
2208
2228
  if (this.isStatefulConfiguration) {
2209
2229
  return this.flowStateApiService
2210
2230
  .saveConfiguration(this.flowStateService.stateId ?? '', this.stateId ?? '')