@veloceapps/sdk 11.0.0-81 → 11.0.0-83

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.
@@ -364,6 +364,18 @@ function extractMetadata(uiDefinition) {
364
364
  }
365
365
 
366
366
  class ConfigurationService {
367
+ constructor(flowInfoService, messageService, configurationRuntimeService, salesTransactionService, orchestrationsApiService) {
368
+ this.flowInfoService = flowInfoService;
369
+ this.messageService = messageService;
370
+ this.configurationRuntimeService = configurationRuntimeService;
371
+ this.salesTransactionService = salesTransactionService;
372
+ this.orchestrationsApiService = orchestrationsApiService;
373
+ this.hasUnsavedChanges = false;
374
+ this.configurationStateSubj$ = new BehaviorSubject(null);
375
+ this.previousConfigurationStateSubj$ = new BehaviorSubject(null);
376
+ this.isLoadingSubj$ = new BehaviorSubject(false);
377
+ this.isLoading$ = this.isLoadingSubj$.asObservable();
378
+ }
367
379
  get state$() {
368
380
  return this.configurationStateSubj$.asObservable().pipe(filter$1(isDefined));
369
381
  }
@@ -379,18 +391,6 @@ class ConfigurationService {
379
391
  get root() {
380
392
  return this.configurationStateSubj$.getValue()?.salesTransaction.salesTransactionItems[0] ?? null;
381
393
  }
382
- constructor(flowInfoService, messageService, configurationRuntimeService, salesTransactionService, orchestrationsApiService) {
383
- this.flowInfoService = flowInfoService;
384
- this.messageService = messageService;
385
- this.configurationRuntimeService = configurationRuntimeService;
386
- this.salesTransactionService = salesTransactionService;
387
- this.orchestrationsApiService = orchestrationsApiService;
388
- this.hasUnsavedChanges = false;
389
- this.configurationStateSubj$ = new BehaviorSubject(null);
390
- this.previousConfigurationStateSubj$ = new BehaviorSubject(null);
391
- this.isLoadingSubj$ = new BehaviorSubject(false);
392
- this.isLoading$ = this.isLoadingSubj$.asObservable();
393
- }
394
394
  reset() {
395
395
  this.hasUnsavedChanges = false;
396
396
  this.configurationStateSubj$.next(null);
@@ -480,10 +480,6 @@ class ConfigurationService {
480
480
  // TODO: implement
481
481
  throw new Error('Not implemented');
482
482
  }
483
- configureGuidedSelling$(data) {
484
- // TODO: implement
485
- throw new Error('Not implemented');
486
- }
487
483
  getPCMModel() {
488
484
  const pcmModel = this.configurationRuntimeService.pcmModel;
489
485
  if (!pcmModel) {
@@ -562,6 +558,48 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
562
558
  type: Injectable
563
559
  }], ctorParameters: function () { return [{ type: FlowInfoService }, { type: ConfigurationService }, { type: ConfigurationRuntimeService }, { type: SalesTransactionService }, { type: RuntimeSettingsService }]; } });
564
560
 
561
+ class GuidedSellingService {
562
+ constructor(orchestrationsApiService) {
563
+ this.orchestrationsApiService = orchestrationsApiService;
564
+ }
565
+ configureGuidedSelling$(data) {
566
+ return this.orchestrationsApiService.apply$({
567
+ transactionContext: this.getTransactionContext(data.attributesMap),
568
+ orchestrationName: data.orchestrationName,
569
+ });
570
+ }
571
+ getTransactionContext(guidedSellingAttributes) {
572
+ const testTransaction = {
573
+ id: UUID.UUID(),
574
+ businessObjectType: 'Quote',
575
+ salesTransactionItems: [],
576
+ tagAttributes: {},
577
+ };
578
+ return {
579
+ salesTransaction: testTransaction,
580
+ transactionId: UUID.UUID(),
581
+ businessObjectType: 'Quote',
582
+ childNodes: {
583
+ GuidedSelling: [
584
+ {
585
+ id: UUID.UUID(),
586
+ tagAttributes: {},
587
+ childNodes: {},
588
+ properties: { guidedSellingAttributes },
589
+ },
590
+ ],
591
+ },
592
+ id: UUID.UUID(),
593
+ tagAttributes: {},
594
+ };
595
+ }
596
+ }
597
+ GuidedSellingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingService, deps: [{ token: i1.OrchestrationsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
598
+ GuidedSellingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingService });
599
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingService, decorators: [{
600
+ type: Injectable
601
+ }], ctorParameters: function () { return [{ type: i1.OrchestrationsApiService }]; } });
602
+
565
603
  class SalesTransactionService {
566
604
  get isInitialized$() {
567
605
  return this.isInitializedSubj$.asObservable();
@@ -594,7 +632,12 @@ class SalesTransactionService {
594
632
  this.state$ = this.stateSubj$.asObservable().pipe(filter(isDefined));
595
633
  }
596
634
  init(headerId, params) {
597
- return this.salesTransactionApiService.getState(headerId, params).pipe(tap(res => this.stateSubj$.next(res)));
635
+ return this.salesTransactionApiService.query(headerId, params).pipe(tap(res => {
636
+ if (!res.salesTransaction) {
637
+ throw new Error('SalesTransaction is not defined. Please check Query Orchestration.');
638
+ }
639
+ this.stateSubj$.next(res);
640
+ }));
598
641
  }
599
642
  finalizeInit() {
600
643
  this.isInitializedSubj$.next(true);
@@ -1564,6 +1607,7 @@ ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
1564
1607
  ConfigurationStateService,
1565
1608
  ConfigurationRuntimeService,
1566
1609
  TestModeConfigurationService,
1610
+ GuidedSellingService,
1567
1611
  ], imports: [ConfirmationDialogModule, ApiModule] });
1568
1612
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, decorators: [{
1569
1613
  type: NgModule,
@@ -1574,6 +1618,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1574
1618
  ConfigurationStateService,
1575
1619
  ConfigurationRuntimeService,
1576
1620
  TestModeConfigurationService,
1621
+ GuidedSellingService,
1577
1622
  ],
1578
1623
  }]
1579
1624
  }] });
@@ -1812,5 +1857,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1812
1857
  * Generated bundle index. Do not edit.
1813
1858
  */
1814
1859
 
1815
- export { ActionCodePipe, CalendarDirective, CatalogProductsService, 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, filterSuccessfulExecute, findTransactionItem, findTransactionItemWithComparator, generateTransactionItem, insertTransactionItem, removeTransactionItem, replaceTransactionItem };
1860
+ export { ActionCodePipe, CalendarDirective, CatalogProductsService, ConfigurationRuntimeService, ConfigurationService, ConfigurationStateService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FLOW_CUSTOMIZATION, FORMATTING_SETTINGS_TOKEN, FlowConfigurationService, FlowInfoService, FlowStateConfigurationService, FlowStateService, GuidedSellingService, IntegrationState, NumberPipe, PricePipe, ProductImagesService, RuntimeSettingsService, SalesTransactionService, SdkCoreModule, SdkDirectivesModule, SdkPipesModule, TestModeConfigurationService, TransactionItemWorker, UI_DEFINITION_VERSION, extractMetadata, filterSuccessfulExecute, findTransactionItem, findTransactionItemWithComparator, generateTransactionItem, insertTransactionItem, removeTransactionItem, replaceTransactionItem };
1816
1861
  //# sourceMappingURL=veloceapps-sdk-core.mjs.map