@veloceapps/sdk 11.0.0-91 → 11.0.0-93
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 +3 -1
- package/core/modules/configuration/services/guided-selling.service.d.ts +4 -2
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +15 -5
- package/esm2020/core/modules/configuration/services/guided-selling.service.mjs +18 -3
- package/esm2020/core/services/flow-state-configuration.service.mjs +5 -2
- package/fesm2015/veloceapps-sdk-core.mjs +32 -6
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +71 -46
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/package.json +1 -1
@@ -363,13 +363,70 @@ function extractMetadata(uiDefinition) {
|
|
363
363
|
]);
|
364
364
|
}
|
365
365
|
|
366
|
+
class GuidedSellingService {
|
367
|
+
constructor(orchestrationsApiService) {
|
368
|
+
this.orchestrationsApiService = orchestrationsApiService;
|
369
|
+
this.guidedSellingResult$ = new BehaviorSubject({});
|
370
|
+
}
|
371
|
+
get guidedSellingResult() {
|
372
|
+
return this.guidedSellingResult$.value;
|
373
|
+
}
|
374
|
+
configureGuidedSelling$(data) {
|
375
|
+
return this.orchestrationsApiService
|
376
|
+
.apply$({
|
377
|
+
transactionContext: this.getTransactionContext(data.attributesMap),
|
378
|
+
orchestrationName: data.orchestrationName,
|
379
|
+
})
|
380
|
+
.pipe(map(transactionContext => {
|
381
|
+
const guidedSellingNode = transactionContext.childNodes['GuidedSelling']?.[0];
|
382
|
+
const guidedSellingResult = guidedSellingNode?.tagAttributes?.['result'] || {};
|
383
|
+
this.guidedSellingResult$.next(guidedSellingResult);
|
384
|
+
return guidedSellingResult;
|
385
|
+
}));
|
386
|
+
}
|
387
|
+
clearGuidedSelling$() {
|
388
|
+
this.guidedSellingResult$.next({});
|
389
|
+
}
|
390
|
+
getTransactionContext(guidedSellingAttributes) {
|
391
|
+
const testTransaction = {
|
392
|
+
id: UUID.UUID(),
|
393
|
+
businessObjectType: 'Quote',
|
394
|
+
salesTransactionItems: [],
|
395
|
+
tagAttributes: {},
|
396
|
+
};
|
397
|
+
return {
|
398
|
+
salesTransaction: testTransaction,
|
399
|
+
transactionId: UUID.UUID(),
|
400
|
+
businessObjectType: 'Quote',
|
401
|
+
childNodes: {
|
402
|
+
GuidedSelling: [
|
403
|
+
{
|
404
|
+
id: UUID.UUID(),
|
405
|
+
tagAttributes: {},
|
406
|
+
childNodes: {},
|
407
|
+
properties: { guidedSellingAttributes },
|
408
|
+
},
|
409
|
+
],
|
410
|
+
},
|
411
|
+
id: UUID.UUID(),
|
412
|
+
tagAttributes: {},
|
413
|
+
};
|
414
|
+
}
|
415
|
+
}
|
416
|
+
GuidedSellingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingService, deps: [{ token: i1.OrchestrationsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
417
|
+
GuidedSellingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingService });
|
418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingService, decorators: [{
|
419
|
+
type: Injectable
|
420
|
+
}], ctorParameters: function () { return [{ type: i1.OrchestrationsApiService }]; } });
|
421
|
+
|
366
422
|
class ConfigurationService {
|
367
|
-
constructor(flowInfoService, messageService, configurationRuntimeService, salesTransactionService, orchestrationsApiService) {
|
423
|
+
constructor(flowInfoService, messageService, configurationRuntimeService, salesTransactionService, orchestrationsApiService, guidedSellingService) {
|
368
424
|
this.flowInfoService = flowInfoService;
|
369
425
|
this.messageService = messageService;
|
370
426
|
this.configurationRuntimeService = configurationRuntimeService;
|
371
427
|
this.salesTransactionService = salesTransactionService;
|
372
428
|
this.orchestrationsApiService = orchestrationsApiService;
|
429
|
+
this.guidedSellingService = guidedSellingService;
|
373
430
|
this.hasUnsavedChanges = false;
|
374
431
|
this.configurationStateSubj$ = new BehaviorSubject(null);
|
375
432
|
this.previousConfigurationStateSubj$ = new BehaviorSubject(null);
|
@@ -416,6 +473,13 @@ class ConfigurationService {
|
|
416
473
|
}
|
417
474
|
isRootGenerated = true;
|
418
475
|
}
|
476
|
+
if (transactionItem) {
|
477
|
+
const guidedSellingResult = this.guidedSellingService.guidedSellingResult;
|
478
|
+
transactionItem.attributes = Object.entries(guidedSellingResult).map(([attributeName, value]) => ({
|
479
|
+
attributeName,
|
480
|
+
value,
|
481
|
+
}));
|
482
|
+
}
|
419
483
|
const configurationState = {
|
420
484
|
...state,
|
421
485
|
salesTransaction: {
|
@@ -493,11 +557,11 @@ class ConfigurationService {
|
|
493
557
|
return pcmModel;
|
494
558
|
}
|
495
559
|
}
|
496
|
-
ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, deps: [{ token: FlowInfoService }, { token: i2.MessageService }, { token: ConfigurationRuntimeService }, { token: SalesTransactionService }, { token: i1.OrchestrationsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
560
|
+
ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, deps: [{ token: FlowInfoService }, { token: i2.MessageService }, { token: ConfigurationRuntimeService }, { token: SalesTransactionService }, { token: i1.OrchestrationsApiService }, { token: GuidedSellingService }], target: i0.ɵɵFactoryTarget.Injectable });
|
497
561
|
ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService });
|
498
562
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, decorators: [{
|
499
563
|
type: Injectable
|
500
|
-
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: i2.MessageService }, { type: ConfigurationRuntimeService }, { type: SalesTransactionService }, { type: i1.OrchestrationsApiService }]; } });
|
564
|
+
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: i2.MessageService }, { type: ConfigurationRuntimeService }, { type: SalesTransactionService }, { type: i1.OrchestrationsApiService }, { type: GuidedSellingService }]; } });
|
501
565
|
|
502
566
|
class SalesTransactionService {
|
503
567
|
get isInitialized$() {
|
@@ -694,48 +758,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
694
758
|
type: Injectable
|
695
759
|
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: ConfigurationService }, { type: ConfigurationRuntimeService }, { type: SalesTransactionService }, { type: RuntimeSettingsService }]; } });
|
696
760
|
|
697
|
-
class GuidedSellingService {
|
698
|
-
constructor(orchestrationsApiService) {
|
699
|
-
this.orchestrationsApiService = orchestrationsApiService;
|
700
|
-
}
|
701
|
-
configureGuidedSelling$(data) {
|
702
|
-
return this.orchestrationsApiService.apply$({
|
703
|
-
transactionContext: this.getTransactionContext(data.attributesMap),
|
704
|
-
orchestrationName: data.orchestrationName,
|
705
|
-
});
|
706
|
-
}
|
707
|
-
getTransactionContext(guidedSellingAttributes) {
|
708
|
-
const testTransaction = {
|
709
|
-
id: UUID.UUID(),
|
710
|
-
businessObjectType: 'Quote',
|
711
|
-
salesTransactionItems: [],
|
712
|
-
tagAttributes: {},
|
713
|
-
};
|
714
|
-
return {
|
715
|
-
salesTransaction: testTransaction,
|
716
|
-
transactionId: UUID.UUID(),
|
717
|
-
businessObjectType: 'Quote',
|
718
|
-
childNodes: {
|
719
|
-
GuidedSelling: [
|
720
|
-
{
|
721
|
-
id: UUID.UUID(),
|
722
|
-
tagAttributes: {},
|
723
|
-
childNodes: {},
|
724
|
-
properties: { guidedSellingAttributes },
|
725
|
-
},
|
726
|
-
],
|
727
|
-
},
|
728
|
-
id: UUID.UUID(),
|
729
|
-
tagAttributes: {},
|
730
|
-
};
|
731
|
-
}
|
732
|
-
}
|
733
|
-
GuidedSellingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingService, deps: [{ token: i1.OrchestrationsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
734
|
-
GuidedSellingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingService });
|
735
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GuidedSellingService, decorators: [{
|
736
|
-
type: Injectable
|
737
|
-
}], ctorParameters: function () { return [{ type: i1.OrchestrationsApiService }]; } });
|
738
|
-
|
739
761
|
class FlowStateService {
|
740
762
|
constructor(flowConfiguration, flowInfoService, flowStateApiService, processorsApiService, salesTransactionApiService, salesTransactionService, toastService, customizationService) {
|
741
763
|
this.flowConfiguration = flowConfiguration;
|
@@ -1174,7 +1196,10 @@ class FlowStateConfigurationService {
|
|
1174
1196
|
{
|
1175
1197
|
...generateTransactionItem(props.productId),
|
1176
1198
|
qty: props.qty ?? 1,
|
1177
|
-
|
1199
|
+
attributes: Object.entries(props.attributesMap ?? {}).map(([attributeName, value]) => ({
|
1200
|
+
attributeName,
|
1201
|
+
value,
|
1202
|
+
})),
|
1178
1203
|
},
|
1179
1204
|
],
|
1180
1205
|
},
|