@veloceapps/sdk 4.0.5-1 → 4.0.6
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/bundles/veloce-sdk-cms.umd.js +4 -2
- package/bundles/veloce-sdk-cms.umd.js.map +1 -1
- package/bundles/veloce-sdk-core.umd.js +26 -16
- package/bundles/veloce-sdk-core.umd.js.map +1 -1
- package/bundles/veloce-sdk.umd.js +26 -3
- package/bundles/veloce-sdk.umd.js.map +1 -1
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +0 -1
- package/core/modules/configuration/services/configuration.service.d.ts +0 -2
- package/core/modules/configuration/types/configuration-runtime.types.d.ts +0 -15
- package/core/services/quote-draft.service.d.ts +3 -1
- package/esm2015/cms/components/preview/preview.component.js +5 -4
- package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +5 -7
- package/esm2015/core/modules/configuration/services/configuration.service.js +1 -4
- package/esm2015/core/modules/configuration/types/configuration-runtime.types.js +1 -1
- package/esm2015/core/services/quote-draft.service.js +19 -8
- package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +2 -2
- package/esm2015/src/components/header/header.component.js +2 -2
- package/esm2015/src/resolvers/quote.resolver.js +24 -2
- package/fesm2015/veloce-sdk-cms.js +4 -3
- package/fesm2015/veloce-sdk-cms.js.map +1 -1
- package/fesm2015/veloce-sdk-core.js +21 -15
- package/fesm2015/veloce-sdk-core.js.map +1 -1
- package/fesm2015/veloce-sdk.js +25 -3
- package/fesm2015/veloce-sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/resolvers/quote.resolver.d.ts +1 -0
@@ -457,13 +457,28 @@
|
|
457
457
|
this.priceApiService = priceApiService;
|
458
458
|
this.quoteSubj$ = new rxjs.BehaviorSubject(null);
|
459
459
|
this.resetSubj$ = new rxjs.BehaviorSubject(true);
|
460
|
-
this.isInitialized = false;
|
460
|
+
this.isInitialized$ = new rxjs.BehaviorSubject(false);
|
461
461
|
this.allPriceLists = [];
|
462
462
|
this.assetPriceLists = [];
|
463
463
|
this.hasUnsavedChanges = false;
|
464
464
|
this.reset$ = this.resetSubj$.asObservable();
|
465
465
|
this.activePriceList$ = this.context.resolve$().pipe(operators.map(function (ctx) { return _this.allPriceLists.find(function (priceList) { return priceList.id === ctx.properties.PriceListId; }); }), operators.map(function (priceList) { return priceList !== null && priceList !== void 0 ? priceList : null; }));
|
466
|
+
this.isInitialized$
|
467
|
+
.pipe(operators.filter(function (isInitialized) { return isInitialized; }), operators.switchMap(function () { return _this.quoteSubj$.asObservable(); }), operators.skip(1), operators.tap(function (quote) { return _this.markAsUpdated(quote); }))
|
468
|
+
.subscribe();
|
466
469
|
}
|
470
|
+
Object.defineProperty(QuoteDraftService.prototype, "isInitialized", {
|
471
|
+
get: function () {
|
472
|
+
return this.isInitialized$.getValue();
|
473
|
+
},
|
474
|
+
set: function (value) {
|
475
|
+
if (this.isInitialized !== value) {
|
476
|
+
this.isInitialized$.next(value);
|
477
|
+
}
|
478
|
+
},
|
479
|
+
enumerable: false,
|
480
|
+
configurable: true
|
481
|
+
});
|
467
482
|
QuoteDraftService.prototype.reset = function () {
|
468
483
|
this.resetSubj$.next(true);
|
469
484
|
this.quoteSubj$.next(null);
|
@@ -484,7 +499,6 @@
|
|
484
499
|
return;
|
485
500
|
}
|
486
501
|
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
|
487
|
-
this.markAsUpdated();
|
488
502
|
};
|
489
503
|
QuoteDraftService.prototype.updateQuoteDraft = function (update) {
|
490
504
|
var quoteDraft = this.quoteSubj$.value;
|
@@ -495,7 +509,6 @@
|
|
495
509
|
this.context.update(update.context);
|
496
510
|
}
|
497
511
|
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
|
498
|
-
this.markAsUpdated();
|
499
512
|
};
|
500
513
|
QuoteDraftService.prototype.updateByPriceSummary = function (priceSummary) {
|
501
514
|
var quoteDraft = this.quoteSubj$.value;
|
@@ -507,7 +520,6 @@
|
|
507
520
|
return updated !== null && updated !== void 0 ? updated : lineItem;
|
508
521
|
});
|
509
522
|
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedCurrentState, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
|
510
|
-
this.markAsUpdated();
|
511
523
|
};
|
512
524
|
Object.defineProperty(QuoteDraftService.prototype, "quoteDraft$", {
|
513
525
|
get: function () {
|
@@ -675,8 +687,11 @@
|
|
675
687
|
var ctx = this.context.resolve();
|
676
688
|
return lineItems.filter(function (li) { return !li.priceListId || li.priceListId === ctx.properties.PriceListId; });
|
677
689
|
};
|
678
|
-
QuoteDraftService.prototype.markAsUpdated = function () {
|
679
|
-
if (
|
690
|
+
QuoteDraftService.prototype.markAsUpdated = function (quote) {
|
691
|
+
if ((quote === null || quote === void 0 ? void 0 : quote.context.properties.mode) === core.ConfigurationContextMode.ACCOUNT) {
|
692
|
+
this.hasUnsavedChanges = !!quote && !quote.currentState.every(function (li) { return li.actionCode === 'EXIST'; });
|
693
|
+
}
|
694
|
+
else {
|
680
695
|
this.hasUnsavedChanges = true;
|
681
696
|
}
|
682
697
|
};
|
@@ -743,7 +758,6 @@
|
|
743
758
|
this.runtimeContextService = runtimeContextService;
|
744
759
|
this._isInitialized = false;
|
745
760
|
this.uiDefinitionProperties = {};
|
746
|
-
this.configurationId = '';
|
747
761
|
}
|
748
762
|
ConfigurationRuntimeService.prototype.reset = function () {
|
749
763
|
this._isInitialized = false;
|
@@ -751,17 +765,16 @@
|
|
751
765
|
this._assets = undefined;
|
752
766
|
this.initializationProps = undefined;
|
753
767
|
this.uiDefinitionProperties = {};
|
754
|
-
this.configurationId = '';
|
755
768
|
};
|
756
769
|
ConfigurationRuntimeService.prototype.initTestMode = function (modelId, uiDefinition) {
|
757
770
|
var _this = this;
|
758
771
|
var _a, _b;
|
759
772
|
this.uiDefinitionProperties = (_a = uiDefinition.properties) !== null && _a !== void 0 ? _a : {};
|
760
773
|
var uiDefinitionExternals = (_b = uiDefinition.externals) !== null && _b !== void 0 ? _b : {};
|
761
|
-
return
|
762
|
-
|
763
|
-
|
764
|
-
])
|
774
|
+
return rxjs.combineLatest([
|
775
|
+
this.apiService.getRuntimeDataByModelId(modelId),
|
776
|
+
this.contextService.create('TestId', core.ConfigurationContextMode.TEST),
|
777
|
+
]).pipe(operators.first(), operators.tap(function (_e) {
|
765
778
|
var _f = __read(_e, 2), runtimeData = _f[0], context = _f[1];
|
766
779
|
var _a;
|
767
780
|
_this._runtimeContext = {
|
@@ -780,7 +793,7 @@
|
|
780
793
|
this.initializationProps = props;
|
781
794
|
this._assets = props.assets;
|
782
795
|
var context = this.contextService.resolve();
|
783
|
-
return this.
|
796
|
+
return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(operators.tap(function (runtimeContext) {
|
784
797
|
var _a, _b, _c, _d;
|
785
798
|
_this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {};
|
786
799
|
var PriceListId = ((_c = context.properties) !== null && _c !== void 0 ? _c : {}).PriceListId;
|
@@ -1010,9 +1023,6 @@
|
|
1010
1023
|
this.lineItem.next(undefined);
|
1011
1024
|
this.charges.next({});
|
1012
1025
|
};
|
1013
|
-
ConfigurationService.prototype.update$ = function (update) {
|
1014
|
-
return this.configurationApiService.update(this.runtimeService.configurationId, update);
|
1015
|
-
};
|
1016
1026
|
ConfigurationService.prototype.patch$ = function (lineItem) {
|
1017
1027
|
var _this = this;
|
1018
1028
|
if (!this.lineItem.value) {
|