@veloceapps/sdk 12.0.0-2 → 12.0.0-21
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/configuration.service.d.ts +2 -0
- package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +4 -4
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +18 -12
- package/esm2020/core/utils/transaction-item.utils.mjs +10 -2
- package/fesm2015/veloceapps-sdk-core.mjs +29 -15
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +28 -14
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -362,6 +362,10 @@ const generateTransactionItemFromPCM = (option, salesTransactionId, parentTi) =>
|
|
|
362
362
|
productName: option.name,
|
|
363
363
|
productCode: option.productCode,
|
|
364
364
|
productRelatedComponentId: option.productRelatedComponent?.id,
|
|
365
|
+
constraintEngineNodeStatus: {
|
|
366
|
+
attributes: [],
|
|
367
|
+
cfgStatus: 'User',
|
|
368
|
+
},
|
|
365
369
|
stiAttributes: [],
|
|
366
370
|
attributes: {
|
|
367
371
|
ParentReference: salesTransactionId,
|
|
@@ -421,11 +425,15 @@ const updateQuantity = (ti, qty, pcm, parentQty = 1) => {
|
|
|
421
425
|
else if (parentPrevQty !== parentNewQty) {
|
|
422
426
|
nextQty = calcNewQty(item, parentPrevQty, parentNewQty, pcm, qty, false);
|
|
423
427
|
}
|
|
424
|
-
|
|
428
|
+
const sti = {
|
|
425
429
|
...item,
|
|
426
430
|
qty: nextQty,
|
|
427
431
|
children: item.children.map(child => updateItem(child, item.qty, nextQty, false)),
|
|
428
432
|
};
|
|
433
|
+
if (nextQty !== item.qty) {
|
|
434
|
+
sti.constraintEngineNodeStatus = { ...sti.constraintEngineNodeStatus, cfgStatus: 'User' };
|
|
435
|
+
}
|
|
436
|
+
return sti;
|
|
429
437
|
};
|
|
430
438
|
return updateItem(ti, parentQty, parentQty, false);
|
|
431
439
|
};
|
|
@@ -580,6 +588,22 @@ class ConfigurationService {
|
|
|
580
588
|
this.previousConfigurationStateSubj$.next(configurationState);
|
|
581
589
|
}), map$1(noop));
|
|
582
590
|
}
|
|
591
|
+
patchState$(context) {
|
|
592
|
+
return this.configure$(context).pipe(catchError(error => {
|
|
593
|
+
console.error(error);
|
|
594
|
+
if (!this.configurationRuntimeService.uiDefinitionProps.suppressToastMessages) {
|
|
595
|
+
this.messageService.add({ severity: 'error', summary: error });
|
|
596
|
+
}
|
|
597
|
+
return throwError(() => error);
|
|
598
|
+
}), tap$1(() => {
|
|
599
|
+
if (!this.hasUnsavedChanges) {
|
|
600
|
+
this.hasUnsavedChanges = true;
|
|
601
|
+
}
|
|
602
|
+
}), map$1(noop));
|
|
603
|
+
}
|
|
604
|
+
patchState(context) {
|
|
605
|
+
this.patchState$(context).subscribe();
|
|
606
|
+
}
|
|
583
607
|
patch$(transactionItem) {
|
|
584
608
|
const { state, root } = this;
|
|
585
609
|
if (!state) {
|
|
@@ -596,17 +620,7 @@ class ConfigurationService {
|
|
|
596
620
|
salesTransactionItems: [newRoot],
|
|
597
621
|
},
|
|
598
622
|
};
|
|
599
|
-
return this.
|
|
600
|
-
console.error(error);
|
|
601
|
-
if (!this.configurationRuntimeService.uiDefinitionProps.suppressToastMessages) {
|
|
602
|
-
this.messageService.add({ severity: 'error', summary: error });
|
|
603
|
-
}
|
|
604
|
-
return throwError(() => error);
|
|
605
|
-
}), tap$1(() => {
|
|
606
|
-
if (!this.hasUnsavedChanges) {
|
|
607
|
-
this.hasUnsavedChanges = true;
|
|
608
|
-
}
|
|
609
|
-
}), map$1(noop));
|
|
623
|
+
return this.patchState$(newTransactionContext);
|
|
610
624
|
}
|
|
611
625
|
patch(transactionItem) {
|
|
612
626
|
this.patch$(transactionItem).subscribe();
|
|
@@ -1578,12 +1592,12 @@ class ConfigurationStateService {
|
|
|
1578
1592
|
return of({ id: '' });
|
|
1579
1593
|
}
|
|
1580
1594
|
const { standalone } = this.flowInfoService.flow.properties;
|
|
1581
|
-
const transactionContext = this.
|
|
1595
|
+
const transactionContext = this.configurationService.state;
|
|
1582
1596
|
const configurationRoot = this.configurationService.root;
|
|
1583
1597
|
if (!transactionContext || !configurationRoot) {
|
|
1584
1598
|
return of({ id: '' });
|
|
1585
1599
|
}
|
|
1586
|
-
const stateItems =
|
|
1600
|
+
const stateItems = this.salesTransactionService.state?.salesTransaction.salesTransactionItems ?? [];
|
|
1587
1601
|
const isNewTransactionItem = stateItems.every(ti => ti.id !== configurationRoot.id);
|
|
1588
1602
|
let salesTransactionItems;
|
|
1589
1603
|
if (isNewTransactionItem) {
|