@veloceapps/sdk 3.1.10 → 3.1.12
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-core.umd.js +38 -13
- package/bundles/veloce-sdk-core.umd.js.map +1 -1
- package/bundles/veloce-sdk.umd.js +4 -4
- package/bundles/veloce-sdk.umd.js.map +1 -1
- package/cms/vendor-map.d.ts +124 -116
- package/core/modules/configuration/helpers.d.ts +1 -1
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +1 -0
- package/core/modules/configuration/services/configuration.service.d.ts +4 -2
- package/core/modules/configuration/types/configuration-runtime.types.d.ts +1 -0
- package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +4 -1
- package/esm2015/core/modules/configuration/helpers.js +3 -3
- package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +3 -1
- package/esm2015/core/modules/configuration/services/configuration.service.js +23 -11
- package/esm2015/core/modules/configuration/types/configuration-runtime.types.js +1 -1
- package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +13 -4
- package/esm2015/src/pages/product/product.component.js +5 -5
- package/fesm2015/veloce-sdk-core.js +38 -16
- package/fesm2015/veloce-sdk-core.js.map +1 -1
- package/fesm2015/veloce-sdk.js +4 -4
- package/fesm2015/veloce-sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/pages/product/product.component.d.ts +2 -2
@@ -30,10 +30,11 @@
|
|
30
30
|
var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
|
31
31
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
32
32
|
|
33
|
-
var getDefaultLineItem = function (context, uiDefinitionProperties) {
|
33
|
+
var getDefaultLineItem = function (context, uiDefinitionProperties, qty) {
|
34
|
+
if (qty === void 0) { qty = 1; }
|
34
35
|
var _a, _b, _c;
|
35
36
|
var id = core.UUID.UUID();
|
36
|
-
var lineItem = Object.assign({ id: id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', actionCode: 'ADD', qty:
|
37
|
+
var lineItem = Object.assign({ id: id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', actionCode: 'ADD', qty: qty, productName: ((_b = context.properties) === null || _b === void 0 ? void 0 : _b.displayName) || context.productName, productId: (_c = context.productId) !== null && _c !== void 0 ? _c : '' }, (context.offeringId
|
37
38
|
? { offeringId: context.offeringId, offeringInstanceId: context.offeringInstanceId || id }
|
38
39
|
: {}));
|
39
40
|
return lineItem;
|
@@ -614,6 +615,7 @@
|
|
614
615
|
this._isInitialized = false;
|
615
616
|
this._runtimeContext = undefined;
|
616
617
|
this._assets = undefined;
|
618
|
+
this.initializationProps = undefined;
|
617
619
|
this.uiDefinitionProperties = {};
|
618
620
|
};
|
619
621
|
ConfigurationRuntimeService.prototype.initTestMode = function (modelId, uiDefinition) {
|
@@ -640,6 +642,7 @@
|
|
640
642
|
};
|
641
643
|
ConfigurationRuntimeService.prototype.init = function (props) {
|
642
644
|
var _this = this;
|
645
|
+
this.initializationProps = props;
|
643
646
|
this._assets = props.assets;
|
644
647
|
var context = this.contextService.resolve();
|
645
648
|
return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(operators.tap(function (runtimeContext) {
|
@@ -851,7 +854,8 @@
|
|
851
854
|
}());
|
852
855
|
|
853
856
|
var ConfigurationService = /** @class */ (function () {
|
854
|
-
function ConfigurationService(runtimeService, contextService, configurationApiService, messageService, dialogService) {
|
857
|
+
function ConfigurationService(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService) {
|
858
|
+
this.quoteDraftService = quoteDraftService;
|
855
859
|
this.runtimeService = runtimeService;
|
856
860
|
this.contextService = contextService;
|
857
861
|
this.configurationApiService = configurationApiService;
|
@@ -941,23 +945,24 @@
|
|
941
945
|
});
|
942
946
|
ConfigurationService.prototype.configure = function () {
|
943
947
|
var _this = this;
|
944
|
-
var _a, _b, _c, _d, _e;
|
948
|
+
var _a, _b, _c, _d, _e, _f;
|
945
949
|
var runtimeContext = this.getRuntimeContext();
|
946
950
|
var runtimeModel = this.getRuntimeModel();
|
947
951
|
if (!runtimeContext || !runtimeModel) {
|
948
952
|
return rxjs.throwError(function () { return new Error('Runtime context/model not initialized'); });
|
949
953
|
}
|
950
954
|
var uiDefinitionProperties = Object.assign(Object.assign({}, ((_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {})), ((_c = this.runtimeService.uiDefinitionProperties) !== null && _c !== void 0 ? _c : {}));
|
951
|
-
var
|
955
|
+
var qty = (_d = this.runtimeService.initializationProps) === null || _d === void 0 ? void 0 : _d.defaultQty;
|
956
|
+
var lineItem = (_e = this.states.configurableRamp) !== null && _e !== void 0 ? _e : getDefaultLineItem(runtimeContext, uiDefinitionProperties, qty);
|
952
957
|
var configurationRequest = this.createRequest(lineItem);
|
953
958
|
configurationRequest.lineItems = this.states.currentState || [];
|
954
959
|
configurationRequest.asset = this.states.asset;
|
955
|
-
var mainPricingEnabled = (
|
960
|
+
var mainPricingEnabled = (_f = runtimeContext.properties) === null || _f === void 0 ? void 0 : _f.PricingEnabled;
|
956
961
|
var pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
|
957
962
|
return this.configurationApiService
|
958
963
|
.configureLineItem({ configurationRequest: configurationRequest, runtimeModel: runtimeModel, pricingEnabled: pricingEnabled })
|
959
|
-
.pipe(operators.map(function (
|
960
|
-
var lineItem =
|
964
|
+
.pipe(operators.map(function (_g) {
|
965
|
+
var lineItem = _g.lineItem, context = _g.context, charges = _g.charges, deletedLineItems = _g.deletedLineItems;
|
961
966
|
_this.contextService.update(context !== null && context !== void 0 ? context : {});
|
962
967
|
_this.charges.next(charges !== null && charges !== void 0 ? charges : {});
|
963
968
|
if (deletedLineItems === null || deletedLineItems === void 0 ? void 0 : deletedLineItems.length) {
|
@@ -967,6 +972,17 @@
|
|
967
972
|
}))
|
968
973
|
.pipe(operators.tap(function (lineItem) { return lineItem && _this.lineItem.next(lineItem); }), operators.catchError(function (error) { return rxjs.throwError(function () { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); }); }));
|
969
974
|
};
|
975
|
+
ConfigurationService.prototype.configureExternal$ = function (productId, qty) {
|
976
|
+
var _this = this;
|
977
|
+
// TODO: uncomment when procedure issue is fixed on backend side
|
978
|
+
// this.updateCurrentStates({
|
979
|
+
// currentState: this.quoteDraftService.quoteSnapshot?.currentState ?? [],
|
980
|
+
// });
|
981
|
+
return this.runtimeService.init({ productId: productId, defaultQty: qty }).pipe(operators.switchMap(function () { return _this.configure(); }), operators.first(), operators.catchError(function (error) {
|
982
|
+
_this.messageService.add({ severity: components.ToastType.error, summary: error });
|
983
|
+
throw error;
|
984
|
+
}), operators.finalize(function () { return _this.reset(); }));
|
985
|
+
};
|
970
986
|
ConfigurationService.prototype.createRequest = function (lineItem) {
|
971
987
|
return {
|
972
988
|
lineItem: lineItem,
|
@@ -1004,11 +1020,11 @@
|
|
1004
1020
|
};
|
1005
1021
|
return ConfigurationService;
|
1006
1022
|
}());
|
1007
|
-
ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService, deps: [{ token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1__namespace.ConfigurationApiService }, { token: i2__namespace.MessageService }, { token: i5__namespace.DialogService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
1023
|
+
ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1__namespace.ConfigurationApiService }, { token: i2__namespace.MessageService }, { token: i5__namespace.DialogService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
1008
1024
|
ConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService });
|
1009
1025
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationService, decorators: [{
|
1010
1026
|
type: i0.Injectable
|
1011
|
-
}], ctorParameters: function () { return [{ type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1__namespace.ConfigurationApiService }, { type: i2__namespace.MessageService }, { type: i5__namespace.DialogService }]; } });
|
1027
|
+
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1__namespace.ConfigurationApiService }, { type: i2__namespace.MessageService }, { type: i5__namespace.DialogService }]; } });
|
1012
1028
|
|
1013
1029
|
var FlowUpdateService = /** @class */ (function () {
|
1014
1030
|
function FlowUpdateService() {
|
@@ -1130,12 +1146,13 @@
|
|
1130
1146
|
}] });
|
1131
1147
|
|
1132
1148
|
var FlowConfigurationService = /** @class */ (function () {
|
1133
|
-
function FlowConfigurationService(priceApiService, contextService, quoteDraftService, messageService, updateService) {
|
1149
|
+
function FlowConfigurationService(priceApiService, contextService, quoteDraftService, messageService, updateService, configurationService) {
|
1134
1150
|
this.priceApiService = priceApiService;
|
1135
1151
|
this.contextService = contextService;
|
1136
1152
|
this.quoteDraftService = quoteDraftService;
|
1137
1153
|
this.messageService = messageService;
|
1138
1154
|
this.updateService = updateService;
|
1155
|
+
this.configurationService = configurationService;
|
1139
1156
|
this.charges = new rxjs.BehaviorSubject({});
|
1140
1157
|
this.bounceBackUpdate$ = new rxjs.BehaviorSubject(true);
|
1141
1158
|
}
|
@@ -1184,6 +1201,14 @@
|
|
1184
1201
|
return quoteDraft.currentState;
|
1185
1202
|
}), rxjs.shareReplay());
|
1186
1203
|
};
|
1204
|
+
FlowConfigurationService.prototype.addToCart$ = function (productId, qty) {
|
1205
|
+
var _this = this;
|
1206
|
+
return this.configurationService.configureExternal$(productId, qty).pipe(rxjs.tap(function (lineItem) {
|
1207
|
+
var _a, _b;
|
1208
|
+
var currentState = (_b = (_a = _this.quoteDraftService.quoteSnapshot) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
1209
|
+
_this.quoteDraftService.setCurrentLineItemState(__spreadArray(__spreadArray([], __read(currentState)), [lineItem]));
|
1210
|
+
}), rxjs.map(rxjs.noop));
|
1211
|
+
};
|
1187
1212
|
FlowConfigurationService.prototype.getSnapshot = function () {
|
1188
1213
|
var _a, _b;
|
1189
1214
|
return (_b = (_a = this.quoteDraftService.quoteSnapshot) === null || _a === void 0 ? void 0 : _a.currentState.slice()) !== null && _b !== void 0 ? _b : [];
|
@@ -1230,11 +1255,11 @@
|
|
1230
1255
|
};
|
1231
1256
|
return FlowConfigurationService;
|
1232
1257
|
}());
|
1233
|
-
FlowConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService, deps: [{ token: i1__namespace.PriceApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: i2__namespace.MessageService }, { token: FlowUpdateService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
1258
|
+
FlowConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService, deps: [{ token: i1__namespace.PriceApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: i2__namespace.MessageService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
1234
1259
|
FlowConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService });
|
1235
1260
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService, decorators: [{
|
1236
1261
|
type: i0.Injectable
|
1237
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.PriceApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: i2__namespace.MessageService }, { type: FlowUpdateService }]; } });
|
1262
|
+
}], ctorParameters: function () { return [{ type: i1__namespace.PriceApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: i2__namespace.MessageService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
|
1238
1263
|
|
1239
1264
|
var FlowConfigurationModule = /** @class */ (function () {
|
1240
1265
|
function FlowConfigurationModule() {
|