@veloceapps/sdk 10.0.0-3 → 10.0.0-30

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -642,14 +642,18 @@ class FlowStateService {
642
642
  save$() {
643
643
  if (this.getFlowSafe().properties.stateful) {
644
644
  if (this.stateId$.value) {
645
- return this.flowStateApiService.save(this.stateId$.value);
645
+ return this.flowStateApiService.save(this.stateId$.value).pipe(tap$1(() => {
646
+ Array.from(this.trackedStatefulChangesMap.keys()).forEach(key => {
647
+ this.trackedStatefulChangesMap.set(key, false);
648
+ });
649
+ }));
646
650
  }
647
651
  }
648
652
  else {
649
653
  const quoteDraft = this.quoteDraftService.quoteDraft;
650
654
  if (quoteDraft) {
651
- return this.quoteApiService.upsertQuote(quoteDraft).pipe(tap$1(({ configurationId }) => {
652
- this.contextService.update({ properties: { ConfigurationId: configurationId } });
655
+ return this.quoteApiService.upsertQuote(quoteDraft).pipe(tap$1(({ versionId }) => {
656
+ this.contextService.update({ properties: { VELOCPQ__VersionId__c: versionId } });
653
657
  }));
654
658
  }
655
659
  }
@@ -664,8 +668,8 @@ class FlowStateService {
664
668
  else {
665
669
  const quoteDraft = this.quoteDraftService.quoteDraft;
666
670
  if (quoteDraft) {
667
- return this.quoteApiService.submitQuote(quoteDraft).pipe(tap$1(({ configurationId }) => {
668
- this.contextService.update({ properties: { ConfigurationId: configurationId } });
671
+ return this.quoteApiService.submitQuote(quoteDraft).pipe(tap$1(({ versionId }) => {
672
+ this.contextService.update({ properties: { VELOCPQ__VersionId__c: versionId } });
669
673
  }));
670
674
  }
671
675
  }
@@ -1488,7 +1492,7 @@ class ConfigurationService {
1488
1492
  generateLineItem() {
1489
1493
  const runtimeContext = this.getRuntimeContext();
1490
1494
  const uiDefinitionProperties = this.getUIDefinitionProperties();
1491
- let lineItem = cloneDeep(this.configurableRamp);
1495
+ let lineItem = this.configurableRamp;
1492
1496
  if (!lineItem) {
1493
1497
  const { initializationProps } = this.runtimeService ?? {};
1494
1498
  lineItem = getDefaultLineItem(runtimeContext, uiDefinitionProperties, initializationProps?.defaultQty);
@@ -1678,17 +1682,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1678
1682
  }] });
1679
1683
 
1680
1684
  class FlowConfigurationService {
1681
- constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService) {
1685
+ constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService, flowInfoService) {
1682
1686
  this.proceduresApiService = proceduresApiService;
1683
1687
  this.contextService = contextService;
1684
1688
  this.quoteDraftService = quoteDraftService;
1685
1689
  this.updateService = updateService;
1686
1690
  this.configurationService = configurationService;
1691
+ this.flowInfoService = flowInfoService;
1687
1692
  this.updatedSubj$ = new Subject();
1688
1693
  this.updated$ = this.updatedSubj$.asObservable();
1689
1694
  }
1690
1695
  calculate$(quoteDraft) {
1691
- return this.proceduresApiService.apply$(quoteDraft).pipe(tap$1(result => {
1696
+ return this.extendedApply$(quoteDraft).pipe(tap$1(result => {
1692
1697
  // sort the result current state based on the quote draft initial state
1693
1698
  const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
1694
1699
  result.currentState = result.currentState
@@ -1808,12 +1813,20 @@ class FlowConfigurationService {
1808
1813
  }));
1809
1814
  };
1810
1815
  }
1816
+ extendedApply$(quoteDraft) {
1817
+ const request = { ...quoteDraft };
1818
+ const procedureName = this.flowInfoService.flow?.properties.procedureName;
1819
+ if (procedureName) {
1820
+ request.procedureName = procedureName;
1821
+ }
1822
+ return this.proceduresApiService.apply$(request);
1823
+ }
1811
1824
  }
1812
- 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 });
1825
+ 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 });
1813
1826
  FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService });
1814
1827
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, decorators: [{
1815
1828
  type: Injectable
1816
- }], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
1829
+ }], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }, { type: FlowInfoService }]; } });
1817
1830
 
1818
1831
  class FlowConfigurationModule {
1819
1832
  }
@@ -2085,6 +2098,7 @@ class ConfigurationStateService {
2085
2098
  this.configurationStore = {};
2086
2099
  this.executionInProgress$ = new BehaviorSubject(false);
2087
2100
  this.statefulRequestStream$ = new Subject();
2101
+ this.statelessExecutionRequest$ = null;
2088
2102
  this.statefulExecutionRequest$ = this.initBufferedRequest$();
2089
2103
  }
2090
2104
  get isExecutionInProgress$() {
@@ -2131,7 +2145,15 @@ class ConfigurationStateService {
2131
2145
  actions: [{ name: actionName, inputData }],
2132
2146
  };
2133
2147
  const request = this.execToRequest(exec);
2134
- return this.executeRequest$(request);
2148
+ const executionRequest$ = this.executeRequest$(request);
2149
+ if (this.isStatefulConfiguration) {
2150
+ return executionRequest$;
2151
+ }
2152
+ // prevent parallel configuration requests in stateless mode
2153
+ if (!this.statelessExecutionRequest$) {
2154
+ this.statelessExecutionRequest$ = executionRequest$.pipe(shareReplay$1(), take$1(1), finalize(() => (this.statelessExecutionRequest$ = null)));
2155
+ }
2156
+ return this.statelessExecutionRequest$;
2135
2157
  }
2136
2158
  select$(selectorName, inputData = {}) {
2137
2159
  const requestId = UUID.UUID();
@@ -2322,7 +2344,7 @@ class ConfigurationStateService {
2322
2344
  return this.configurationService.configureRequest$(configurationRequest);
2323
2345
  }), map$1(() => {
2324
2346
  // Run selectors and apply them to the state
2325
- const configurationState = cloneDeep(this.configurationService.stateSnapshot);
2347
+ const configurationState = this.configurationService.stateSnapshot;
2326
2348
  if (!configurationState) {
2327
2349
  return { stateId: '', selectors: {} };
2328
2350
  }