@veloceapps/sdk 12.0.0-16 → 12.0.0-18

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/index.d.ts CHANGED
@@ -212,6 +212,8 @@ declare class ConfigurationService {
212
212
  get root(): SalesTransactionItem | null;
213
213
  reset(): void;
214
214
  init$(): Observable<void>;
215
+ patchState$(context: TransactionContext): Observable<void>;
216
+ patchState(context: TransactionContext): void;
215
217
  patch$(transactionItem: SalesTransactionItem): Observable<void>;
216
218
  patch(transactionItem: SalesTransactionItem): void;
217
219
  configure$(transactionContext: TransactionContext): Observable<TransactionContext>;
@@ -597,6 +597,22 @@ class ConfigurationService {
597
597
  this.previousConfigurationStateSubj$.next(configurationState);
598
598
  }), map$1(noop));
599
599
  }
600
+ patchState$(context) {
601
+ return this.configure$(context).pipe(catchError(error => {
602
+ console.error(error);
603
+ if (!this.configurationRuntimeService.uiDefinitionProps.suppressToastMessages) {
604
+ this.messageService.add({ severity: 'error', summary: error });
605
+ }
606
+ return throwError(() => error);
607
+ }), tap$1(() => {
608
+ if (!this.hasUnsavedChanges) {
609
+ this.hasUnsavedChanges = true;
610
+ }
611
+ }), map$1(noop));
612
+ }
613
+ patchState(context) {
614
+ this.patchState$(context).subscribe();
615
+ }
600
616
  patch$(transactionItem) {
601
617
  const { state, root } = this;
602
618
  if (!state) {
@@ -613,17 +629,7 @@ class ConfigurationService {
613
629
  salesTransactionItems: [newRoot],
614
630
  },
615
631
  };
616
- return this.configure$(newTransactionContext).pipe(catchError(error => {
617
- console.error(error);
618
- if (!this.configurationRuntimeService.uiDefinitionProps.suppressToastMessages) {
619
- this.messageService.add({ severity: 'error', summary: error });
620
- }
621
- return throwError(() => error);
622
- }), tap$1(() => {
623
- if (!this.hasUnsavedChanges) {
624
- this.hasUnsavedChanges = true;
625
- }
626
- }), map$1(noop));
632
+ return this.patchState$(newTransactionContext);
627
633
  }
628
634
  patch(transactionItem) {
629
635
  this.patch$(transactionItem).subscribe();
@@ -1608,12 +1614,12 @@ class ConfigurationStateService {
1608
1614
  return of({ id: '' });
1609
1615
  }
1610
1616
  const { standalone } = this.flowInfoService.flow.properties;
1611
- const transactionContext = this.salesTransactionService.state;
1617
+ const transactionContext = this.configurationService.state;
1612
1618
  const configurationRoot = this.configurationService.root;
1613
1619
  if (!transactionContext || !configurationRoot) {
1614
1620
  return of({ id: '' });
1615
1621
  }
1616
- const stateItems = transactionContext.salesTransaction.salesTransactionItems;
1622
+ const stateItems = this.salesTransactionService.state?.salesTransaction.salesTransactionItems ?? [];
1617
1623
  const isNewTransactionItem = stateItems.every(ti => ti.id !== configurationRoot.id);
1618
1624
  let salesTransactionItems;
1619
1625
  if (isNewTransactionItem) {