@veloceapps/sdk 11.0.0-30 → 11.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.
@@ -496,6 +496,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
496
496
  type: Injectable
497
497
  }], ctorParameters: function () { return [{ type: FlowInfoService }, { type: i2.MessageService }, { type: ConfigurationRuntimeService }, { type: SalesTransactionService }, { type: i1.OrchestrationsApiService }]; } });
498
498
 
499
+ class TestModeConfigurationService {
500
+ constructor(flowInfoService, configurationService, configurationRuntimeService, salesTransactionService) {
501
+ this.flowInfoService = flowInfoService;
502
+ this.configurationService = configurationService;
503
+ this.configurationRuntimeService = configurationRuntimeService;
504
+ this.salesTransactionService = salesTransactionService;
505
+ this.isInitialized = false;
506
+ }
507
+ initTestMode$(uiDefinitionContainer) {
508
+ this.configurationRuntimeService.uiDefinitionContainer = uiDefinitionContainer;
509
+ if (this.checkInitialized(uiDefinitionContainer)) {
510
+ this.configurationRuntimeService.pcmModel = this.pcmModel;
511
+ return of(undefined);
512
+ }
513
+ this.configurationService.reset();
514
+ const { productId, quoteId } = uiDefinitionContainer.source.properties ?? {};
515
+ if (!productId) {
516
+ return throwError(() => 'Unable to start the Configuration Preview: Product is missing.');
517
+ }
518
+ if (!quoteId) {
519
+ return throwError(() => `Unable to start the Configuration Preview: Quote is missing.`);
520
+ }
521
+ return this.flowInfoService.initTestFlow$(productId).pipe(switchMap(() => this.configurationRuntimeService.init$({ productId })), tap(pcmModel => (this.pcmModel = pcmModel)), tap(() => this.salesTransactionService.setState(this.getTestSalesTransaction(quoteId))), switchMap(() => this.configurationService.init$()), switchMap(() => this.configurationService.state
522
+ ? this.configurationService.configureRequest$(this.configurationService.state)
523
+ : of(undefined)), tap(() => (this.isInitialized = true)), map(noop));
524
+ }
525
+ getTestSalesTransaction(quoteId) {
526
+ const testTransaction = {
527
+ id: quoteId,
528
+ businessObjectType: 'Quote',
529
+ salesTransactionItems: [],
530
+ };
531
+ return testTransaction;
532
+ }
533
+ checkInitialized(uiDefinitionContainer) {
534
+ return this.isInitialized && !!uiDefinitionContainer.source.properties?.persistTestState;
535
+ }
536
+ }
537
+ 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 }], target: i0.ɵɵFactoryTarget.Injectable });
538
+ TestModeConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TestModeConfigurationService });
539
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TestModeConfigurationService, decorators: [{
540
+ type: Injectable
541
+ }], ctorParameters: function () { return [{ type: FlowInfoService }, { type: ConfigurationService }, { type: ConfigurationRuntimeService }, { type: SalesTransactionService }]; } });
542
+
499
543
  class SalesTransactionService {
500
544
  get isInitialized$() {
501
545
  return this.isInitializedSubj$.asObservable();
@@ -1468,12 +1512,22 @@ class ConfigurationModule {
1468
1512
  }
1469
1513
  ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1470
1514
  ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule, ApiModule] });
1471
- ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, providers: [ConfigurationService, ConfigurationStateService, ConfigurationRuntimeService], imports: [ConfirmationDialogModule, ApiModule] });
1515
+ ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, providers: [
1516
+ ConfigurationService,
1517
+ ConfigurationStateService,
1518
+ ConfigurationRuntimeService,
1519
+ TestModeConfigurationService,
1520
+ ], imports: [ConfirmationDialogModule, ApiModule] });
1472
1521
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, decorators: [{
1473
1522
  type: NgModule,
1474
1523
  args: [{
1475
1524
  imports: [ConfirmationDialogModule, ApiModule],
1476
- providers: [ConfigurationService, ConfigurationStateService, ConfigurationRuntimeService],
1525
+ providers: [
1526
+ ConfigurationService,
1527
+ ConfigurationStateService,
1528
+ ConfigurationRuntimeService,
1529
+ TestModeConfigurationService,
1530
+ ],
1477
1531
  }]
1478
1532
  }] });
1479
1533
 
@@ -1728,5 +1782,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1728
1782
  * Generated bundle index. Do not edit.
1729
1783
  */
1730
1784
 
1731
- export { ActionCodePipe, CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ConfigurationStateService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FLOW_CUSTOMIZATION, FORMATTING_SETTINGS_TOKEN, FlowConfigurationService, FlowInfoService, FlowStateConfigurationService, FlowStateService, IntegrationState, NumberPipe, PricePipe, ProductImagesService, RuntimeSettingsService, SalesTransactionService, SdkCoreModule, SdkDirectivesModule, SdkPipesModule, TransactionItemWorker, UI_DEFINITION_VERSION, extractMetadata, findTransactionItem, findTransactionItemWithComparator, generateTransactionItem, insertTransactionItem, removeTransactionItem, replaceTransactionItem };
1785
+ export { ActionCodePipe, CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ConfigurationStateService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FLOW_CUSTOMIZATION, FORMATTING_SETTINGS_TOKEN, FlowConfigurationService, FlowInfoService, FlowStateConfigurationService, FlowStateService, IntegrationState, NumberPipe, PricePipe, ProductImagesService, RuntimeSettingsService, SalesTransactionService, SdkCoreModule, SdkDirectivesModule, SdkPipesModule, TestModeConfigurationService, TransactionItemWorker, UI_DEFINITION_VERSION, extractMetadata, findTransactionItem, findTransactionItemWithComparator, generateTransactionItem, insertTransactionItem, removeTransactionItem, replaceTransactionItem };
1732
1786
  //# sourceMappingURL=veloceapps-sdk-core.mjs.map