@veloceapps/sdk 3.0.6 → 3.0.7

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.
@@ -1037,10 +1037,10 @@
1037
1037
  RuntimeContextService.prototype.getRuntimeContext = function (productId, offeringId) {
1038
1038
  var _this = this;
1039
1039
  return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(rxjsOperators.map(function (runtimeData) {
1040
- var _a, _b, _c, _d;
1040
+ var _a, _b, _c;
1041
1041
  var uiDefinition = _this.getUIDefinition(runtimeData);
1042
1042
  var runtimeModel = core.RuntimeModel.create(runtimeData.types, runtimeData.products);
1043
- var _e = (_a = Array.from(runtimeModel.components.values()).find(function (c) { return c.productId === productId; })) !== null && _a !== void 0 ? _a : {}, productName = _e.productName, properties = _e.properties;
1043
+ var _d = (_a = Array.from(runtimeModel.components.values()).find(function (c) { return c.productId === productId; })) !== null && _a !== void 0 ? _a : {}, productName = _d.productName, properties = _d.properties;
1044
1044
  return {
1045
1045
  modelId: runtimeData.modelId,
1046
1046
  uiDefinition: uiDefinition,
@@ -1049,10 +1049,9 @@
1049
1049
  productId: productId,
1050
1050
  productType: (properties === null || properties === void 0 ? void 0 : properties.displayName) || productName,
1051
1051
  offeringId: offeringId,
1052
- priceListId: (_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.priceList,
1053
1052
  properties: {
1054
- PricingEnabled: (_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _c === void 0 ? void 0 : _c.pricingEnabled,
1055
- PriceListId: (_d = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _d === void 0 ? void 0 : _d.priceList,
1053
+ PricingEnabled: ((_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.pricingEnabled) ? 'true' : 'false',
1054
+ PriceListId: (_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _c === void 0 ? void 0 : _c.priceList,
1056
1055
  },
1057
1056
  };
1058
1057
  }));
@@ -1108,8 +1107,8 @@
1108
1107
  return rxjs.combineLatest([
1109
1108
  this.apiService.getRuntimeDataByModelId(modelId),
1110
1109
  this.contextService.create('TestId', core.ConfigurationContextMode.TEST),
1111
- ]).pipe(rxjsOperators.first(), rxjsOperators.tap(function (_d) {
1112
- var _e = __read(_d, 2), runtimeData = _e[0], configurationContext = _e[1];
1110
+ ]).pipe(rxjsOperators.first(), rxjsOperators.tap(function (_e) {
1111
+ var _f = __read(_e, 2), runtimeData = _f[0], context = _f[1];
1113
1112
  var _a;
1114
1113
  _this._runtimeContext = {
1115
1114
  modelId: modelId,
@@ -1117,8 +1116,7 @@
1117
1116
  runtimeMode: i2.RuntimeMode.TEST,
1118
1117
  };
1119
1118
  _this.contextService.update({
1120
- priceListId: _this.uiDefinitionProperties.priceList,
1121
- properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = _this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), configurationContext.properties), { ModelId: modelId, RuntimeMode: core.ConfigurationContextMode.TEST, PricingEnabled: String(_this.uiDefinitionProperties.pricingEnabled), StartDate: new Date().toISOString().substring(0, 10), PriceListId: _this.uiDefinitionProperties.priceList }), uiDefinitionExternals),
1119
+ properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = _this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: modelId, RuntimeMode: core.ConfigurationContextMode.TEST, PricingEnabled: _this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: _this.uiDefinitionProperties.priceList }), uiDefinitionExternals),
1122
1120
  });
1123
1121
  _this._isInitialized = true;
1124
1122
  }));
@@ -1126,20 +1124,20 @@
1126
1124
  ConfigurationRuntimeService.prototype.init = function (props) {
1127
1125
  var _this = this;
1128
1126
  this._assets = props.assets;
1129
- var configurationContext = this.contextService.resolve();
1130
- if (!configurationContext) {
1127
+ var context = this.contextService.resolve();
1128
+ if (!context) {
1131
1129
  return rxjs.of();
1132
1130
  }
1133
1131
  return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(rxjsOperators.tap(function (runtimeContext) {
1134
- var _a, _b, _c;
1132
+ var _a, _b, _c, _d;
1135
1133
  _this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {};
1136
- var mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign({}, runtimeContext.properties), configurationContext.properties) });
1134
+ var PriceListId = ((_c = context.properties) !== null && _c !== void 0 ? _c : {}).PriceListId;
1135
+ var mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
1137
1136
  _this.id15to18('AccountId', mergeContext.properties);
1138
1137
  _this._runtimeContext = mergeContext;
1139
- if (configurationContext.properties && ((_c = runtimeContext.properties) === null || _c === void 0 ? void 0 : _c.StartDate)) {
1138
+ if (context.properties && ((_d = _this._runtimeContext.properties) === null || _d === void 0 ? void 0 : _d.StartDate)) {
1140
1139
  _this.contextService.update({
1141
- priceListId: _this.uiDefinitionProperties.priceList,
1142
- properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), configurationContext.properties), { PricingEnabled: String(_this.uiDefinitionProperties.pricingEnabled), PriceListId: _this.uiDefinitionProperties.priceList }),
1140
+ properties: Object.assign(Object.assign({}, _this._runtimeContext.properties), context.properties),
1143
1141
  });
1144
1142
  }
1145
1143
  _this._isInitialized = true;
@@ -1258,7 +1256,7 @@
1258
1256
  });
1259
1257
  ConfigurationService.prototype.configure = function () {
1260
1258
  var _this = this;
1261
- var _a, _b, _c, _d;
1259
+ var _a, _b, _c, _d, _e;
1262
1260
  var runtimeContext = this.getRuntimeContext();
1263
1261
  var runtimeModel = this.getRuntimeModel();
1264
1262
  if (!runtimeContext || !runtimeModel) {
@@ -1269,11 +1267,12 @@
1269
1267
  var configurationRequest = this.createRequest(lineItem);
1270
1268
  configurationRequest.lineItems = this.states.currentState || [];
1271
1269
  configurationRequest.asset = this.states.asset;
1272
- var pricingEnabled = uiDefinitionProperties.pricingEnabled;
1270
+ var mainPricingEnabled = (_e = runtimeContext.properties) === null || _e === void 0 ? void 0 : _e.PricingEnabled;
1271
+ var pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
1273
1272
  return this.configurationApiService
1274
1273
  .configureLineItem({ configurationRequest: configurationRequest, runtimeModel: runtimeModel, pricingEnabled: pricingEnabled })
1275
- .pipe(rxjsOperators.map(function (_e) {
1276
- var lineItem = _e.lineItem, context = _e.context, charges = _e.charges, deletedLineItems = _e.deletedLineItems;
1274
+ .pipe(rxjsOperators.map(function (_f) {
1275
+ var lineItem = _f.lineItem, context = _f.context, charges = _f.charges, deletedLineItems = _f.deletedLineItems;
1277
1276
  if (context) {
1278
1277
  _this.contextService.update({ properties: context.properties });
1279
1278
  }