@veloceapps/sdk 10.0.0-9 → 11.0.0-1
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.
- package/cms/cms.actions.d.ts +0 -12
- package/cms/vendor-map.d.ts +4 -6
- package/core/modules/configuration/services/configuration-state.service.d.ts +1 -0
- package/core/modules/configuration/services/configuration.service.d.ts +2 -0
- package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +4 -1
- package/esm2020/cms/cms.actions.mjs +1 -17
- package/esm2020/cms/components/element-tools-panel/element-tools-panel.component.mjs +3 -3
- package/esm2020/cms/vendor-map.mjs +6 -6
- package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +29 -22
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +13 -2
- package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +16 -5
- package/esm2020/core/services/flow-info.service.mjs +1 -3
- package/esm2020/core/services/flow-state.service.mjs +5 -5
- package/esm2020/src/flow.component.mjs +4 -5
- package/esm2020/src/flow.module.mjs +5 -10
- package/esm2020/src/services/flow-dialog.service.mjs +1 -30
- package/fesm2015/veloceapps-sdk-cms.mjs +6 -24
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +57 -31
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +57 -248
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +6 -24
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +55 -30
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +57 -248
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +4 -4
- package/src/flow.module.d.ts +2 -3
- package/src/services/flow-dialog.service.d.ts +0 -4
- package/esm2020/src/components/doc-gen/doc-gen.component.mjs +0 -129
- package/esm2020/src/components/doc-gen/doc-gen.module.mjs +0 -19
- package/esm2020/src/services/doc-gen.service.mjs +0 -34
- package/src/components/doc-gen/doc-gen.component.d.ts +0 -26
- package/src/components/doc-gen/doc-gen.module.d.ts +0 -9
- package/src/services/doc-gen.service.d.ts +0 -13
@@ -230,8 +230,6 @@ class FlowInfoService {
|
|
230
230
|
return UITemplateType.SHOPPING_CART;
|
231
231
|
case 'catalog':
|
232
232
|
return UITemplateType.CATALOG;
|
233
|
-
case 'docGen':
|
234
|
-
return UITemplateType.DOCGEN;
|
235
233
|
case 'guidedSelling':
|
236
234
|
return UITemplateType.GUIDED_SELLING;
|
237
235
|
case 'flowHeader':
|
@@ -617,8 +615,8 @@ class FlowStateService {
|
|
617
615
|
else {
|
618
616
|
const quoteDraft = this.quoteDraftService.quoteDraft;
|
619
617
|
if (quoteDraft) {
|
620
|
-
return this.quoteApiService.upsertQuote(quoteDraft).pipe(tap$1(({
|
621
|
-
this.contextService.update({ properties: {
|
618
|
+
return this.quoteApiService.upsertQuote(quoteDraft).pipe(tap$1(({ versionId }) => {
|
619
|
+
this.contextService.update({ properties: { VELOCE_PRISM__VersionId__c: versionId } });
|
622
620
|
}));
|
623
621
|
}
|
624
622
|
}
|
@@ -633,8 +631,8 @@ class FlowStateService {
|
|
633
631
|
else {
|
634
632
|
const quoteDraft = this.quoteDraftService.quoteDraft;
|
635
633
|
if (quoteDraft) {
|
636
|
-
return this.quoteApiService.submitQuote(quoteDraft).pipe(tap$1(({
|
637
|
-
this.contextService.update({ properties: {
|
634
|
+
return this.quoteApiService.submitQuote(quoteDraft).pipe(tap$1(({ versionId }) => {
|
635
|
+
this.contextService.update({ properties: { VELOCE_PRISM__VersionId__c: versionId } });
|
638
636
|
}));
|
639
637
|
}
|
640
638
|
}
|
@@ -1434,6 +1432,7 @@ class ConfigurationService {
|
|
1434
1432
|
this.runtimeSettings = runtimeSettings;
|
1435
1433
|
this.mode = ConfigurationMode.SEARCH;
|
1436
1434
|
this.configurationState = new BehaviorSubject(null);
|
1435
|
+
this.previousConfigurationState = new BehaviorSubject(null);
|
1437
1436
|
this.isLoadingSubj$ = new BehaviorSubject(false);
|
1438
1437
|
this.isLoading$ = this.isLoadingSubj$.asObservable();
|
1439
1438
|
this.hasUnsavedChanges = false;
|
@@ -1443,6 +1442,7 @@ class ConfigurationService {
|
|
1443
1442
|
this.runtimeService.reset();
|
1444
1443
|
this.configurableRamp = undefined;
|
1445
1444
|
this.configurationState.next(null);
|
1445
|
+
this.previousConfigurationState.next(null);
|
1446
1446
|
}
|
1447
1447
|
patch$(lineItem, options) {
|
1448
1448
|
const source = this.getSnapshot();
|
@@ -1499,6 +1499,9 @@ class ConfigurationService {
|
|
1499
1499
|
get stateSnapshot() {
|
1500
1500
|
return this.configurationState.value;
|
1501
1501
|
}
|
1502
|
+
get previousStateSnapshot() {
|
1503
|
+
return this.previousConfigurationState.value;
|
1504
|
+
}
|
1502
1505
|
get contextSnapshot() {
|
1503
1506
|
return this.contextService.resolve();
|
1504
1507
|
}
|
@@ -1549,11 +1552,17 @@ class ConfigurationService {
|
|
1549
1552
|
var _a;
|
1550
1553
|
this.contextService.update(result.context);
|
1551
1554
|
this.configurationState.next(result);
|
1555
|
+
this.previousConfigurationState.next(cloneDeep(result));
|
1552
1556
|
if ((_a = result.deletedLineItems) === null || _a === void 0 ? void 0 : _a.length) {
|
1553
1557
|
this.showInactiveProductsConfirmation();
|
1554
1558
|
}
|
1555
1559
|
this.configurableRamp = result.lineItem;
|
1556
1560
|
}), map(({ lineItem }) => lineItem), catchError$1(error => throwError(() => {
|
1561
|
+
const resetState = this.previousConfigurationState.value;
|
1562
|
+
if (resetState) {
|
1563
|
+
this.previousConfigurationState.next(cloneDeep(resetState));
|
1564
|
+
this.configurationState.next(resetState);
|
1565
|
+
}
|
1557
1566
|
if (error.error) {
|
1558
1567
|
return extractErrorDetails(error.error).join('. ');
|
1559
1568
|
}
|
@@ -1601,7 +1610,7 @@ class ConfigurationService {
|
|
1601
1610
|
var _a;
|
1602
1611
|
const runtimeContext = this.getRuntimeContext();
|
1603
1612
|
const uiDefinitionProperties = this.getUIDefinitionProperties();
|
1604
|
-
let lineItem =
|
1613
|
+
let lineItem = this.configurableRamp;
|
1605
1614
|
if (!lineItem) {
|
1606
1615
|
const { initializationProps } = (_a = this.runtimeService) !== null && _a !== void 0 ? _a : {};
|
1607
1616
|
lineItem = getDefaultLineItem(runtimeContext, uiDefinitionProperties, initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.defaultQty);
|
@@ -1658,17 +1667,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
1658
1667
|
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6$1.DialogService }, { type: RuntimeSettingsService }]; } });
|
1659
1668
|
|
1660
1669
|
class FlowConfigurationService {
|
1661
|
-
constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService) {
|
1670
|
+
constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService, flowInfoService) {
|
1662
1671
|
this.proceduresApiService = proceduresApiService;
|
1663
1672
|
this.contextService = contextService;
|
1664
1673
|
this.quoteDraftService = quoteDraftService;
|
1665
1674
|
this.updateService = updateService;
|
1666
1675
|
this.configurationService = configurationService;
|
1676
|
+
this.flowInfoService = flowInfoService;
|
1667
1677
|
this.updatedSubj$ = new Subject();
|
1668
1678
|
this.updated$ = this.updatedSubj$.asObservable();
|
1669
1679
|
}
|
1670
1680
|
calculate$(quoteDraft) {
|
1671
|
-
return this.
|
1681
|
+
return this.extendedApply$(quoteDraft).pipe(tap$1(result => {
|
1672
1682
|
// sort the result current state based on the quote draft initial state
|
1673
1683
|
const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
|
1674
1684
|
result.currentState = result.currentState
|
@@ -1793,12 +1803,21 @@ class FlowConfigurationService {
|
|
1793
1803
|
}));
|
1794
1804
|
};
|
1795
1805
|
}
|
1806
|
+
extendedApply$(quoteDraft) {
|
1807
|
+
var _a;
|
1808
|
+
const request = Object.assign({}, quoteDraft);
|
1809
|
+
const procedureName = (_a = this.flowInfoService.flow) === null || _a === void 0 ? void 0 : _a.properties.procedureName;
|
1810
|
+
if (procedureName) {
|
1811
|
+
request.procedureName = procedureName;
|
1812
|
+
}
|
1813
|
+
return this.proceduresApiService.apply$(request);
|
1814
|
+
}
|
1796
1815
|
}
|
1797
|
-
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 });
|
1816
|
+
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 });
|
1798
1817
|
FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService });
|
1799
1818
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, decorators: [{
|
1800
1819
|
type: Injectable
|
1801
|
-
}], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
|
1820
|
+
}], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }, { type: FlowInfoService }]; } });
|
1802
1821
|
|
1803
1822
|
class FlowConfigurationModule {
|
1804
1823
|
}
|
@@ -2311,7 +2330,7 @@ class ConfigurationStateService {
|
|
2311
2330
|
if (!((_a = request.actions) === null || _a === void 0 ? void 0 : _a.length)) {
|
2312
2331
|
return of(undefined);
|
2313
2332
|
}
|
2314
|
-
let configurationRequest = this.configurationService.generateRequest();
|
2333
|
+
let configurationRequest = this.configurationService.generateRequest(false);
|
2315
2334
|
request.actions.forEach(action => {
|
2316
2335
|
var _a;
|
2317
2336
|
configurationRequest = (_a = this.executeActionScript(configurationRequest, action)) !== null && _a !== void 0 ? _a : configurationRequest;
|
@@ -2319,30 +2338,18 @@ class ConfigurationStateService {
|
|
2319
2338
|
configurationRequest = ConfigurationTranslatorUtils.lightenConfigurationRequest(configurationRequest);
|
2320
2339
|
return this.configurationService.configureRequest$(configurationRequest);
|
2321
2340
|
}), map$1(() => {
|
2322
|
-
var _a;
|
2323
2341
|
// Run selectors and apply them to the state
|
2324
|
-
const configurationState =
|
2342
|
+
const configurationState = this.configurationService.stateSnapshot;
|
2325
2343
|
if (!configurationState) {
|
2326
2344
|
return { stateId: '', selectors: {} };
|
2327
2345
|
}
|
2328
|
-
|
2329
|
-
try {
|
2330
|
-
result.selectors[key] = {
|
2331
|
-
success: true,
|
2332
|
-
result: this.executeSelectorScript(configurationState, selector),
|
2333
|
-
};
|
2334
|
-
}
|
2335
|
-
catch (e) {
|
2336
|
-
console.error(e);
|
2337
|
-
result.selectors[key] = {
|
2338
|
-
success: false,
|
2339
|
-
errorMessage: String(e),
|
2340
|
-
};
|
2341
|
-
}
|
2342
|
-
return result;
|
2343
|
-
}, { stateId: '', selectors: {} });
|
2344
|
-
return selectorsResult;
|
2346
|
+
return this.runStatelessSelectors(request, configurationState);
|
2345
2347
|
}), tap$1(() => this.executionInProgress$.next(false)), catchError(error => {
|
2348
|
+
const configurationState = this.configurationService.previousStateSnapshot;
|
2349
|
+
if (configurationState) {
|
2350
|
+
const selectorsResult = this.runStatelessSelectors(request, configurationState);
|
2351
|
+
this.handleSelectorsResponse(selectorsResult.selectors);
|
2352
|
+
}
|
2346
2353
|
this.executionInProgress$.next(false);
|
2347
2354
|
if (!this.configurationRuntimeService.uiDefinitionProperties.suppressToastMessages) {
|
2348
2355
|
this.toastService.add({ severity: ToastType.error, summary: String(error) });
|
@@ -2411,6 +2418,25 @@ class ConfigurationStateService {
|
|
2411
2418
|
configurationStore: this.configurationStore,
|
2412
2419
|
});
|
2413
2420
|
}
|
2421
|
+
runStatelessSelectors(request, configurationState) {
|
2422
|
+
var _a;
|
2423
|
+
return EntityUtil.entries((_a = request.selectors) !== null && _a !== void 0 ? _a : {}).reduce((result, [key, selector]) => {
|
2424
|
+
try {
|
2425
|
+
result.selectors[key] = {
|
2426
|
+
success: true,
|
2427
|
+
result: this.executeSelectorScript(configurationState, selector),
|
2428
|
+
};
|
2429
|
+
}
|
2430
|
+
catch (e) {
|
2431
|
+
console.error(e);
|
2432
|
+
result.selectors[key] = {
|
2433
|
+
success: false,
|
2434
|
+
errorMessage: String(e),
|
2435
|
+
};
|
2436
|
+
}
|
2437
|
+
return result;
|
2438
|
+
}, { stateId: '', selectors: {} });
|
2439
|
+
}
|
2414
2440
|
}
|
2415
2441
|
ConfigurationStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationStateService, deps: [{ token: ConfigurationRuntimeService }, { token: ConfigurationService }, { token: QuoteDraftService }, { token: i6.ToastService }, { token: FlowStateService }, { token: FlowInfoService }, { token: FlowConfigurationService }, { token: i1.FlowStateApiService }, { token: i1.QuoteApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2416
2442
|
ConfigurationStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationStateService });
|