@veloceapps/sdk 10.0.0-3 → 10.0.0-31

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 (27) hide show
  1. package/cms/modules/runtime/services/runtime.service.d.ts +3 -1
  2. package/cms/utils/index.d.ts +1 -0
  3. package/cms/utils/inject.d.ts +1 -0
  4. package/cms/utils/ui-definition.utils.d.ts +1 -0
  5. package/cms/vendor-map.d.ts +4 -2
  6. package/core/modules/configuration/services/configuration-state.service.d.ts +1 -0
  7. package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +4 -1
  8. package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +3 -2
  9. package/esm2020/cms/components/element-tools-panel/element-tools-panel.component.mjs +3 -3
  10. package/esm2020/cms/modules/runtime/services/runtime.service.mjs +3 -1
  11. package/esm2020/cms/utils/index.mjs +2 -1
  12. package/esm2020/cms/utils/inject.mjs +27 -0
  13. package/esm2020/cms/utils/ui-definition.utils.mjs +13 -1
  14. package/esm2020/cms/vendor-map.mjs +7 -4
  15. package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +13 -4
  16. package/esm2020/core/modules/configuration/services/configuration.service.mjs +3 -3
  17. package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +16 -5
  18. package/esm2020/core/services/flow-state.service.mjs +10 -6
  19. package/fesm2015/veloceapps-sdk-cms.mjs +45 -5
  20. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
  21. package/fesm2015/veloceapps-sdk-core.mjs +35 -12
  22. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  23. package/fesm2020/veloceapps-sdk-cms.mjs +44 -4
  24. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
  25. package/fesm2020/veloceapps-sdk-core.mjs +34 -12
  26. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  27. package/package.json +1 -1
@@ -607,14 +607,18 @@ class FlowStateService {
607
607
  save$() {
608
608
  if (this.getFlowSafe().properties.stateful) {
609
609
  if (this.stateId$.value) {
610
- return this.flowStateApiService.save(this.stateId$.value);
610
+ return this.flowStateApiService.save(this.stateId$.value).pipe(tap$1(() => {
611
+ Array.from(this.trackedStatefulChangesMap.keys()).forEach(key => {
612
+ this.trackedStatefulChangesMap.set(key, false);
613
+ });
614
+ }));
611
615
  }
612
616
  }
613
617
  else {
614
618
  const quoteDraft = this.quoteDraftService.quoteDraft;
615
619
  if (quoteDraft) {
616
- return this.quoteApiService.upsertQuote(quoteDraft).pipe(tap$1(({ configurationId }) => {
617
- this.contextService.update({ properties: { ConfigurationId: configurationId } });
620
+ return this.quoteApiService.upsertQuote(quoteDraft).pipe(tap$1(({ versionId }) => {
621
+ this.contextService.update({ properties: { VELOCPQ__VersionId__c: versionId } });
618
622
  }));
619
623
  }
620
624
  }
@@ -629,8 +633,8 @@ class FlowStateService {
629
633
  else {
630
634
  const quoteDraft = this.quoteDraftService.quoteDraft;
631
635
  if (quoteDraft) {
632
- return this.quoteApiService.submitQuote(quoteDraft).pipe(tap$1(({ configurationId }) => {
633
- this.contextService.update({ properties: { ConfigurationId: configurationId } });
636
+ return this.quoteApiService.submitQuote(quoteDraft).pipe(tap$1(({ versionId }) => {
637
+ this.contextService.update({ properties: { VELOCPQ__VersionId__c: versionId } });
634
638
  }));
635
639
  }
636
640
  }
@@ -1597,7 +1601,7 @@ class ConfigurationService {
1597
1601
  var _a;
1598
1602
  const runtimeContext = this.getRuntimeContext();
1599
1603
  const uiDefinitionProperties = this.getUIDefinitionProperties();
1600
- let lineItem = cloneDeep(this.configurableRamp);
1604
+ let lineItem = this.configurableRamp;
1601
1605
  if (!lineItem) {
1602
1606
  const { initializationProps } = (_a = this.runtimeService) !== null && _a !== void 0 ? _a : {};
1603
1607
  lineItem = getDefaultLineItem(runtimeContext, uiDefinitionProperties, initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.defaultQty);
@@ -1654,17 +1658,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1654
1658
  }], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6$1.DialogService }, { type: RuntimeSettingsService }]; } });
1655
1659
 
1656
1660
  class FlowConfigurationService {
1657
- constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService) {
1661
+ constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService, flowInfoService) {
1658
1662
  this.proceduresApiService = proceduresApiService;
1659
1663
  this.contextService = contextService;
1660
1664
  this.quoteDraftService = quoteDraftService;
1661
1665
  this.updateService = updateService;
1662
1666
  this.configurationService = configurationService;
1667
+ this.flowInfoService = flowInfoService;
1663
1668
  this.updatedSubj$ = new Subject();
1664
1669
  this.updated$ = this.updatedSubj$.asObservable();
1665
1670
  }
1666
1671
  calculate$(quoteDraft) {
1667
- return this.proceduresApiService.apply$(quoteDraft).pipe(tap$1(result => {
1672
+ return this.extendedApply$(quoteDraft).pipe(tap$1(result => {
1668
1673
  // sort the result current state based on the quote draft initial state
1669
1674
  const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
1670
1675
  result.currentState = result.currentState
@@ -1789,12 +1794,21 @@ class FlowConfigurationService {
1789
1794
  }));
1790
1795
  };
1791
1796
  }
1797
+ extendedApply$(quoteDraft) {
1798
+ var _a;
1799
+ const request = Object.assign({}, quoteDraft);
1800
+ const procedureName = (_a = this.flowInfoService.flow) === null || _a === void 0 ? void 0 : _a.properties.procedureName;
1801
+ if (procedureName) {
1802
+ request.procedureName = procedureName;
1803
+ }
1804
+ return this.proceduresApiService.apply$(request);
1805
+ }
1792
1806
  }
1793
- FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
1807
+ FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }, { token: FlowInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
1794
1808
  FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService });
1795
1809
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, decorators: [{
1796
1810
  type: Injectable
1797
- }], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
1811
+ }], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }, { type: FlowInfoService }]; } });
1798
1812
 
1799
1813
  class FlowConfigurationModule {
1800
1814
  }
@@ -2056,6 +2070,7 @@ class ConfigurationStateService {
2056
2070
  this.configurationStore = {};
2057
2071
  this.executionInProgress$ = new BehaviorSubject(false);
2058
2072
  this.statefulRequestStream$ = new Subject();
2073
+ this.statelessExecutionRequest$ = null;
2059
2074
  this.statefulExecutionRequest$ = this.initBufferedRequest$();
2060
2075
  }
2061
2076
  get isExecutionInProgress$() {
@@ -2103,7 +2118,15 @@ class ConfigurationStateService {
2103
2118
  actions: [{ name: actionName, inputData }],
2104
2119
  };
2105
2120
  const request = this.execToRequest(exec);
2106
- return this.executeRequest$(request);
2121
+ const executionRequest$ = this.executeRequest$(request);
2122
+ if (this.isStatefulConfiguration) {
2123
+ return executionRequest$;
2124
+ }
2125
+ // prevent parallel configuration requests in stateless mode
2126
+ if (!this.statelessExecutionRequest$) {
2127
+ this.statelessExecutionRequest$ = executionRequest$.pipe(shareReplay$1(), take$1(1), finalize(() => (this.statelessExecutionRequest$ = null)));
2128
+ }
2129
+ return this.statelessExecutionRequest$;
2107
2130
  }
2108
2131
  select$(selectorName, inputData = {}) {
2109
2132
  const requestId = UUID.UUID();
@@ -2308,7 +2331,7 @@ class ConfigurationStateService {
2308
2331
  }), map$1(() => {
2309
2332
  var _a;
2310
2333
  // Run selectors and apply them to the state
2311
- const configurationState = cloneDeep(this.configurationService.stateSnapshot);
2334
+ const configurationState = this.configurationService.stateSnapshot;
2312
2335
  if (!configurationState) {
2313
2336
  return { stateId: '', selectors: {} };
2314
2337
  }