@veloceapps/sdk 11.0.0-105 → 11.0.0-106
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/core/modules/configuration/services/test-mode-configuration.service.d.ts +4 -1
- package/esm2020/core/modules/configuration/services/test-mode-configuration.service.mjs +32 -9
- package/fesm2015/veloceapps-sdk-core.mjs +29 -7
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +28 -7
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/package.json +1 -1
@@ -695,12 +695,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
695
695
|
}], ctorParameters: function () { return [{ type: i1.OrchestrationsApiService }, { type: SalesTransactionService }, { type: FlowInfoService }]; } });
|
696
696
|
|
697
697
|
class TestModeConfigurationService {
|
698
|
-
constructor(flowInfoService, configurationService, configurationRuntimeService, salesTransactionService, runtimeSettingsService) {
|
698
|
+
constructor(flowInfoService, configurationService, configurationRuntimeService, salesTransactionService, runtimeSettingsService, sfApiService) {
|
699
699
|
this.flowInfoService = flowInfoService;
|
700
700
|
this.configurationService = configurationService;
|
701
701
|
this.configurationRuntimeService = configurationRuntimeService;
|
702
702
|
this.salesTransactionService = salesTransactionService;
|
703
703
|
this.runtimeSettingsService = runtimeSettingsService;
|
704
|
+
this.sfApiService = sfApiService;
|
704
705
|
this.isInitialized = false;
|
705
706
|
}
|
706
707
|
initTestMode$(uiDefinitionContainer, options) {
|
@@ -720,7 +721,7 @@ class TestModeConfigurationService {
|
|
720
721
|
if (!flowId) {
|
721
722
|
return throwError(() => `Unable to start the Configuration Preview: Flow is missing.`);
|
722
723
|
}
|
723
|
-
return this.runtimeSettingsService.create().pipe(switchMap(() => this.flowInfoService.init$(flowId, { productId, headerId: quoteId })), switchMap(() => this.configurationRuntimeService.init$({ productId })), tap(pcmModel => (this.pcmModel = pcmModel)), switchMap(() => {
|
724
|
+
return this.runtimeSettingsService.create().pipe(switchMap(() => this.flowInfoService.init$(flowId, { productId, headerId: quoteId, testMode: true })), switchMap(() => this.configurationRuntimeService.init$({ productId })), tap(pcmModel => (this.pcmModel = pcmModel)), switchMap(() => {
|
724
725
|
if (options?.customizationMode) {
|
725
726
|
return of(undefined);
|
726
727
|
}
|
@@ -728,17 +729,37 @@ class TestModeConfigurationService {
|
|
728
729
|
}), tap(() => (this.isInitialized = true)), map(noop));
|
729
730
|
}
|
730
731
|
initConfiguration$(quoteId) {
|
731
|
-
this.
|
732
|
-
return this.configurationService.init$().pipe(switchMap(() => this.configurationService.state
|
732
|
+
return this.getPriceBookId(quoteId).pipe(map(priceBookId => this.getTestTransactionContext(quoteId, priceBookId)), tap(state => this.salesTransactionService.setState(state)), switchMap(() => this.configurationService.init$()), switchMap(() => this.configurationService.state
|
733
733
|
? this.configurationService.configure$(this.configurationService.state)
|
734
734
|
: of(undefined)), map(noop));
|
735
735
|
}
|
736
|
-
|
736
|
+
getPriceBookId(quoteId) {
|
737
|
+
return this.sfApiService
|
738
|
+
.query({ count: 1, fields: ['Pricebook2Id'], rawCondition: `Id = '${quoteId}'` }, 'Quote')
|
739
|
+
.pipe(map(r => r?.[0]?.Pricebook2Id ?? null));
|
740
|
+
}
|
741
|
+
getTestTransactionContext(quoteId, priceBookId) {
|
742
|
+
const dateStr = new Date().toISOString().split('T')[0] ?? '';
|
737
743
|
const testTransaction = {
|
738
744
|
id: quoteId,
|
739
745
|
businessObjectType: 'Quote',
|
740
746
|
salesTransactionItems: [],
|
747
|
+
salesTransactionName: 'Test Quote',
|
748
|
+
account: '',
|
749
|
+
quoteAccount: '',
|
750
|
+
pricebook: '',
|
751
|
+
status: 'Draft',
|
752
|
+
totalAmount: 0,
|
753
|
+
subtotal: 0,
|
754
|
+
activatedDate: dateStr,
|
755
|
+
effectiveDate: dateStr,
|
756
|
+
startDate: dateStr,
|
757
|
+
attributes: {},
|
758
|
+
nodes: {},
|
741
759
|
};
|
760
|
+
if (priceBookId) {
|
761
|
+
testTransaction.pricebook = priceBookId;
|
762
|
+
}
|
742
763
|
return {
|
743
764
|
salesTransaction: testTransaction,
|
744
765
|
transactionId: quoteId,
|
@@ -752,11 +773,11 @@ class TestModeConfigurationService {
|
|
752
773
|
return this.isInitialized && !!uiDefinitionContainer.source.properties?.persistTestState;
|
753
774
|
}
|
754
775
|
}
|
755
|
-
TestModeConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TestModeConfigurationService, deps: [{ token: FlowInfoService }, { token: ConfigurationService }, { token: ConfigurationRuntimeService }, { token: SalesTransactionService }, { token: RuntimeSettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
776
|
+
TestModeConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TestModeConfigurationService, deps: [{ token: FlowInfoService }, { token: ConfigurationService }, { token: ConfigurationRuntimeService }, { token: SalesTransactionService }, { token: RuntimeSettingsService }, { token: i1.SalesforceApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
756
777
|
TestModeConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TestModeConfigurationService });
|
757
778
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TestModeConfigurationService, decorators: [{
|
758
779
|
type: Injectable
|
759
|
-
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: ConfigurationService }, { type: ConfigurationRuntimeService }, { type: SalesTransactionService }, { type: RuntimeSettingsService }]; } });
|
780
|
+
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: ConfigurationService }, { type: ConfigurationRuntimeService }, { type: SalesTransactionService }, { type: RuntimeSettingsService }, { type: i1.SalesforceApiService }]; } });
|
760
781
|
|
761
782
|
class FlowStateService {
|
762
783
|
constructor(flowConfiguration, flowInfoService, flowStateApiService, processorsApiService, salesTransactionApiService, salesTransactionService, toastService, customizationService) {
|