@veloceapps/sdk 6.0.0-23 → 6.0.0-25

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.
Files changed (37) hide show
  1. package/bundles/veloceapps-sdk-core.umd.js +19 -22
  2. package/bundles/veloceapps-sdk-core.umd.js.map +1 -1
  3. package/bundles/veloceapps-sdk-runtime.umd.js.map +1 -1
  4. package/bundles/veloceapps-sdk.umd.js +6 -16
  5. package/bundles/veloceapps-sdk.umd.js.map +1 -1
  6. package/core/modules/configuration/services/configuration-runtime.service.d.ts +1 -3
  7. package/core/modules/configuration/services/configuration.service.d.ts +4 -3
  8. package/core/modules/configuration/types/configuration-runtime.types.d.ts +0 -2
  9. package/core/services/quote-draft.service.d.ts +2 -2
  10. package/core/types/index.d.ts +0 -1
  11. package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +1 -6
  12. package/esm2015/core/modules/configuration/services/configuration.service.js +17 -15
  13. package/esm2015/core/modules/configuration/types/configuration-runtime.types.js +1 -1
  14. package/esm2015/core/services/quote-draft.service.js +4 -4
  15. package/esm2015/core/types/index.js +1 -2
  16. package/esm2015/runtime/execution/directives/vl-quote.directive.js +1 -1
  17. package/esm2015/runtime/services/configuration.service.js +1 -1
  18. package/esm2015/runtime/services/runtime.service.js +1 -1
  19. package/esm2015/runtime/types/index.js +2 -1
  20. package/esm2015/runtime/types/quote-states.types.js +2 -0
  21. package/esm2015/src/components/header/header.component.js +3 -3
  22. package/esm2015/src/pages/legacy-product/legacy-product.component.js +1 -1
  23. package/esm2015/src/pages/product/product.component.js +2 -9
  24. package/esm2015/src/pages/remote/remote.component.js +2 -5
  25. package/esm2015/src/resolvers/quote.resolver.js +3 -3
  26. package/fesm2015/veloceapps-sdk-core.js +19 -22
  27. package/fesm2015/veloceapps-sdk-core.js.map +1 -1
  28. package/fesm2015/veloceapps-sdk-runtime.js.map +1 -1
  29. package/fesm2015/veloceapps-sdk.js +6 -16
  30. package/fesm2015/veloceapps-sdk.js.map +1 -1
  31. package/package.json +1 -1
  32. package/runtime/services/configuration.service.d.ts +2 -1
  33. package/runtime/services/runtime.service.d.ts +2 -1
  34. package/runtime/types/index.d.ts +1 -0
  35. package/{core → runtime}/types/quote-states.types.d.ts +0 -0
  36. package/src/pages/product/product.component.d.ts +0 -1
  37. package/esm2015/core/types/quote-states.types.js +0 -2
@@ -548,7 +548,6 @@
548
548
  ConfigurationRuntimeService.prototype.reset = function () {
549
549
  this._isInitialized = false;
550
550
  this._runtimeContext = undefined;
551
- this._assets = undefined;
552
551
  this.initializationProps = undefined;
553
552
  this.uiDefinitionProperties = {};
554
553
  };
@@ -577,7 +576,6 @@
577
576
  ConfigurationRuntimeService.prototype.init = function (props) {
578
577
  var _this = this;
579
578
  this.initializationProps = props;
580
- this._assets = props.assets;
581
579
  var context = this.contextService.resolve();
582
580
  return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(operators.tap(function (runtimeContext) {
583
581
  var _a, _b, _c, _d;
@@ -603,9 +601,6 @@
603
601
  source[propertyName] = core.SalesforceIdUtils.generateId18FromId15(value);
604
602
  }
605
603
  };
606
- ConfigurationRuntimeService.prototype.getAsset = function (lineItem) {
607
- return this._assets && this._assets.find(function (a) { return a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId; });
608
- };
609
604
  Object.defineProperty(ConfigurationRuntimeService.prototype, "isInitialized", {
610
605
  get: function () {
611
606
  return this._isInitialized;
@@ -845,15 +840,15 @@
845
840
  enumerable: false,
846
841
  configurable: true
847
842
  });
848
- Object.defineProperty(QuoteDraftService.prototype, "hasAssets$", {
843
+ Object.defineProperty(QuoteDraftService.prototype, "hasProducts$", {
849
844
  get: function () {
850
845
  var _this = this;
851
- return this.quoteSubj$.pipe(operators.map(function () { return _this.hasAssets; }));
846
+ return this.quoteSubj$.pipe(operators.map(function () { return _this.hasProducts; }));
852
847
  },
853
848
  enumerable: false,
854
849
  configurable: true
855
850
  });
856
- Object.defineProperty(QuoteDraftService.prototype, "hasAssets", {
851
+ Object.defineProperty(QuoteDraftService.prototype, "hasProducts", {
857
852
  get: function () {
858
853
  var quoteDraft = this.quoteSubj$.value;
859
854
  return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
@@ -1091,7 +1086,6 @@
1091
1086
  this.messageService = messageService;
1092
1087
  this.dialogService = dialogService;
1093
1088
  this.mode = core.ConfigurationMode.SEARCH;
1094
- this.states = {};
1095
1089
  this.lineItem = new rxjs.BehaviorSubject(undefined);
1096
1090
  this.charges = new rxjs.BehaviorSubject({});
1097
1091
  this.pricePlans = new rxjs.BehaviorSubject({});
@@ -1100,7 +1094,7 @@
1100
1094
  ConfigurationService.prototype.reset = function () {
1101
1095
  this.hasUnsavedChanges = false;
1102
1096
  this.runtimeService.reset();
1103
- this.states = {};
1097
+ this.configurableRamp = undefined;
1104
1098
  this.lineItem.next(undefined);
1105
1099
  this.charges.next({});
1106
1100
  this.pricePlans.next({});
@@ -1110,10 +1104,7 @@
1110
1104
  if (!this.lineItem.value) {
1111
1105
  return rxjs.throwError(function () { return new Error("Source LineItem not found"); });
1112
1106
  }
1113
- this.states.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
1114
- this.states.asset = this.states.configurableRamp
1115
- ? this.runtimeService.getAsset(this.states.configurableRamp)
1116
- : undefined;
1107
+ this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
1117
1108
  return this.configure().pipe(operators.catchError(function (error) {
1118
1109
  console.error(error);
1119
1110
  if (!_this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
@@ -1131,8 +1122,8 @@
1131
1122
  ConfigurationService.prototype.patch = function (lineItem) {
1132
1123
  this.patch$(lineItem).subscribe();
1133
1124
  };
1134
- ConfigurationService.prototype.updateCurrentStates = function (update) {
1135
- this.states = Object.assign(Object.assign({}, this.states), update);
1125
+ ConfigurationService.prototype.setConfigurableRamp = function (lineItem) {
1126
+ this.configurableRamp = lineItem;
1136
1127
  };
1137
1128
  ConfigurationService.prototype.get = function () {
1138
1129
  return this.lineItem.asObservable().pipe(rxjs.shareReplay());
@@ -1198,7 +1189,7 @@
1198
1189
  }
1199
1190
  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 : {}));
1200
1191
  var qty = (_d = this.runtimeService.initializationProps) === null || _d === void 0 ? void 0 : _d.defaultQty;
1201
- var lineItem = (_e = this.states.configurableRamp) !== null && _e !== void 0 ? _e : getDefaultLineItem(runtimeContext, uiDefinitionProperties, qty);
1192
+ var lineItem = (_e = this.configurableRamp) !== null && _e !== void 0 ? _e : getDefaultLineItem(runtimeContext, uiDefinitionProperties, qty);
1202
1193
  var configurationRequest = this.createRequest(lineItem);
1203
1194
  var mainPricingEnabled = (_f = runtimeContext.properties) === null || _f === void 0 ? void 0 : _f.PricingEnabled;
1204
1195
  var pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
@@ -1218,23 +1209,21 @@
1218
1209
  };
1219
1210
  ConfigurationService.prototype.configureExternal$ = function (productId, qty) {
1220
1211
  var _this = this;
1221
- this.updateCurrentStates({
1222
- currentState: this.quoteDraftService.currentState,
1223
- });
1224
1212
  return this.runtimeService.init({ productId: productId, defaultQty: qty }).pipe(operators.switchMap(function () { return _this.configure(); }), operators.first(), operators.catchError(function (error) {
1225
1213
  _this.messageService.add({ severity: components.ToastType.error, summary: error });
1226
1214
  throw error;
1227
1215
  }), operators.finalize(function () { return _this.reset(); }));
1228
1216
  };
1229
1217
  ConfigurationService.prototype.createRequest = function (lineItem) {
1218
+ var _a;
1230
1219
  return {
1231
1220
  lineItem: lineItem,
1232
1221
  mode: this.mode,
1233
1222
  step: !this.lineItem.value ? exports.RuntimeStep.START : exports.RuntimeStep.UPDATE,
1234
1223
  attributeDomainMode: 'ALL',
1235
1224
  context: this.contextService.resolve(),
1236
- lineItems: this.states.currentState || [],
1237
- asset: this.states.asset,
1225
+ lineItems: ((_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) || [],
1226
+ asset: this.getAsset(),
1238
1227
  };
1239
1228
  };
1240
1229
  ConfigurationService.prototype.showInactiveProductsConfirmation = function () {
@@ -1263,6 +1252,14 @@
1263
1252
  }
1264
1253
  });
1265
1254
  };
1255
+ ConfigurationService.prototype.getAsset = function () {
1256
+ var _a;
1257
+ var lineItem = this.configurableRamp;
1258
+ if (!lineItem) {
1259
+ return;
1260
+ }
1261
+ return (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState.find(function (a) { return a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId; });
1262
+ };
1266
1263
  return ConfigurationService;
1267
1264
  }());
1268
1265
  ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1__namespace.ConfigurationApiService }, { token: i5__namespace.MessageService }, { token: i6__namespace.DialogService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });