@veloceapps/sdk 7.0.2-3 → 7.0.2-31
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/cms/cms.actions.d.ts +30 -1
- package/cms/components/element-children/element-children.component.d.ts +3 -1
- package/cms/components/element-tools-panel/element-tools-panel.component.d.ts +14 -0
- package/cms/components/preview/preview.component.d.ts +1 -0
- package/cms/components/preview/preview.module.d.ts +2 -1
- package/cms/components/preview/preview.types.d.ts +4 -0
- package/cms/injection-tokens.d.ts +1 -3
- package/cms/modules/runtime/index.d.ts +1 -0
- package/cms/modules/runtime/services/compilation.service.d.ts +2 -1
- package/cms/modules/runtime/services/runtime-editor.service.d.ts +6 -4
- package/cms/modules/runtime/services/runtime.service.d.ts +5 -1
- package/cms/modules/runtime/types/runtime.actions.d.ts +5 -2
- package/cms/plugins/element-hover.plugin.d.ts +32 -0
- package/cms/plugins/page.plugin.d.ts +15 -0
- package/cms/plugins/script.plugin.d.ts +0 -3
- package/cms/types/common.types.d.ts +11 -1
- package/cms/types/index.d.ts +2 -0
- package/cms/types/layouts.types.d.ts +28 -2
- package/cms/types/pages.types.d.ts +1 -0
- package/cms/utils/elements-resolver.d.ts +5 -1
- package/cms/utils/script.utils.d.ts +2 -0
- package/cms/vendor-map.d.ts +9 -6
- package/core/modules/configuration/services/configuration.service.d.ts +3 -3
- package/core/services/index.d.ts +1 -0
- package/core/services/runtime-settings.service.d.ts +18 -0
- package/core/types/ui-definition.types.d.ts +7 -2
- package/core/utils/line-item.utils.d.ts +4 -2
- package/core/utils/line-item.worker.d.ts +2 -2
- package/esm2020/cms/cms.actions.mjs +42 -2
- package/esm2020/cms/cms.elements.mjs +16 -4
- package/esm2020/cms/cms.layouts.mjs +53 -1
- package/esm2020/cms/components/element-children/element-children.component.mjs +11 -6
- package/esm2020/cms/components/element-drop-handle/element-drop-handle.component.mjs +2 -2
- package/esm2020/cms/components/element-tools-panel/element-tools-panel.component.mjs +35 -0
- package/esm2020/cms/components/preview/preview.component.mjs +11 -7
- package/esm2020/cms/components/preview/preview.module.mjs +22 -4
- package/esm2020/cms/components/preview/preview.types.mjs +1 -1
- package/esm2020/cms/injection-tokens.mjs +1 -2
- package/esm2020/cms/modules/runtime/index.mjs +2 -1
- package/esm2020/cms/modules/runtime/services/compilation.service.mjs +3 -3
- package/esm2020/cms/modules/runtime/services/runtime-editor.service.mjs +5 -3
- package/esm2020/cms/modules/runtime/services/runtime.service.mjs +39 -5
- package/esm2020/cms/modules/runtime/types/runtime.actions.mjs +1 -1
- package/esm2020/cms/plugins/element-hover.plugin.mjs +112 -0
- package/esm2020/cms/plugins/page.plugin.mjs +37 -0
- package/esm2020/cms/plugins/script.plugin.mjs +6 -40
- package/esm2020/cms/services/integration.state.mjs +3 -6
- package/esm2020/cms/services/io-provider.service.mjs +7 -5
- package/esm2020/cms/types/common.types.mjs +1 -1
- package/esm2020/cms/types/index.mjs +3 -1
- package/esm2020/cms/types/layouts.types.mjs +70 -1
- package/esm2020/cms/types/pages.types.mjs +2 -0
- package/esm2020/cms/utils/elements-resolver.mjs +22 -8
- package/esm2020/cms/utils/script.utils.mjs +42 -0
- package/esm2020/cms/vendor-map.mjs +5 -3
- package/esm2020/core/core.module.mjs +16 -4
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +6 -5
- package/esm2020/core/services/index.mjs +2 -1
- package/esm2020/core/services/runtime-settings.service.mjs +62 -0
- package/esm2020/core/types/ui-definition.types.mjs +1 -1
- package/esm2020/core/utils/line-item.utils.mjs +35 -16
- package/esm2020/core/utils/line-item.worker.mjs +5 -5
- package/esm2020/src/components/header/header.component.mjs +15 -3
- package/esm2020/src/components/header/metrics/metrics.component.mjs +9 -7
- package/esm2020/src/flow-routing.module.mjs +1 -1
- package/esm2020/src/guards/context.guard.mjs +11 -8
- package/fesm2015/veloceapps-sdk-cms.mjs +497 -150
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +117 -27
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +31 -13
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +578 -164
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +117 -27
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +30 -13
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/header/metrics/metrics.component.d.ts +4 -2
- package/src/guards/context.guard.d.ts +3 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, NgModule } from '@angular/core';
|
|
3
|
-
import { UUID, ConfigurationContext, RuntimeModel, ConfigurationContextMode, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, ChargeGroupUtils } from '@veloceapps/core';
|
|
3
|
+
import { UUID, ConfigurationContext, RuntimeModel, ConfigurationContextMode, SalesforceIdUtils, ConfigurationMode, ConfigurationTranslatorUtils, ChargeGroupUtils, parseJsonSafely } from '@veloceapps/core';
|
|
4
4
|
import { BehaviorSubject, combineLatest, zip, noop, throwError, shareReplay as shareReplay$1, tap as tap$1, map as map$2, of, switchMap as switchMap$1, catchError as catchError$1, Subject, take as take$1, distinctUntilChanged } from 'rxjs';
|
|
5
5
|
import { filter, tap, map, first, switchMap, skip, take, shareReplay, catchError, finalize } from 'rxjs/operators';
|
|
6
6
|
import * as i1 from '@veloceapps/api';
|
|
@@ -243,15 +243,22 @@ const removeLineItem = (lineItem, idToRemove) => {
|
|
|
243
243
|
})
|
|
244
244
|
.filter(r => !!r) });
|
|
245
245
|
};
|
|
246
|
-
const replaceLineItem = (lineItem, replaceTo) => {
|
|
246
|
+
const replaceLineItem = (lineItem, replaceTo, skipCardinalityCalculation = false) => {
|
|
247
247
|
if (lineItem.id === replaceTo.id) {
|
|
248
|
-
|
|
248
|
+
if (!skipCardinalityCalculation) {
|
|
249
|
+
return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
return Object.assign({}, replaceTo);
|
|
253
|
+
}
|
|
249
254
|
}
|
|
250
|
-
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo)) });
|
|
255
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo, skipCardinalityCalculation)) });
|
|
251
256
|
};
|
|
252
257
|
const calculateCardinalityVariables = (lineItems) => {
|
|
253
258
|
const cardVars = new Map();
|
|
254
|
-
lineItems
|
|
259
|
+
lineItems
|
|
260
|
+
.filter(({ port, type }) => !!port && !!type)
|
|
261
|
+
.forEach(li => {
|
|
255
262
|
var _a;
|
|
256
263
|
const cardinalityVariableName = `#CV-${li.type}@${li.port}`;
|
|
257
264
|
cardVars.set(cardinalityVariableName, ((_a = cardVars.get(cardinalityVariableName)) !== null && _a !== void 0 ? _a : 0) + li.qty);
|
|
@@ -289,13 +296,13 @@ const upsertAttributes = (originalAttributes, attributesToUpsert) => {
|
|
|
289
296
|
];
|
|
290
297
|
}, originalAttributes);
|
|
291
298
|
};
|
|
292
|
-
const patchAttributes = (rootLineItem, id, attrs) => {
|
|
299
|
+
const patchAttributes = (rootLineItem, id, attrs, skipCardinalityCalculation = false) => {
|
|
293
300
|
const lineItem = findLineItem(id, [rootLineItem]);
|
|
294
301
|
if (!lineItem) {
|
|
295
302
|
return rootLineItem;
|
|
296
303
|
}
|
|
297
304
|
const attributes = upsertAttributes(lineItem.attributes, attrs);
|
|
298
|
-
return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }));
|
|
305
|
+
return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }), skipCardinalityCalculation);
|
|
299
306
|
};
|
|
300
307
|
const getAttributeValue = (attributes, name) => { var _a; return (_a = attributes.find(attr => attr.name === name)) === null || _a === void 0 ? void 0 : _a.value; };
|
|
301
308
|
const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
|
|
@@ -323,19 +330,31 @@ const getRecommendedPrices = (portDomain, type) => {
|
|
|
323
330
|
const generateModifiedAssetsMap = (lineItems) => {
|
|
324
331
|
return lineItems.reduce((acc, li) => {
|
|
325
332
|
var _a;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}
|
|
333
|
+
const isModified = isLineItemModified(li);
|
|
334
|
+
if (!isModified) {
|
|
335
|
+
return acc;
|
|
336
|
+
}
|
|
337
|
+
const target = getOriginParent(lineItems, li);
|
|
338
|
+
const id = (_a = target === null || target === void 0 ? void 0 : target.assetId) !== null && _a !== void 0 ? _a : target === null || target === void 0 ? void 0 : target.openOrderLineItemId;
|
|
339
|
+
if (id) {
|
|
340
|
+
acc[id] = true;
|
|
335
341
|
}
|
|
336
342
|
return acc;
|
|
337
343
|
}, {});
|
|
338
344
|
};
|
|
345
|
+
const getOriginParent = (lineItems, currentLineItem) => {
|
|
346
|
+
let target = currentLineItem;
|
|
347
|
+
while (target && target.rampInstanceId) {
|
|
348
|
+
target = lineItems.find(sub => sub.id === currentLineItem.rampInstanceId);
|
|
349
|
+
}
|
|
350
|
+
return target;
|
|
351
|
+
};
|
|
352
|
+
const isLineItemModified = (lineItem) => {
|
|
353
|
+
if (lineItem.actionCode === 'EXIST' && lineItem.status === 'PENDING') {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
return lineItem.actionCode !== 'EXIST';
|
|
357
|
+
};
|
|
339
358
|
const multiplyLineItems = (lineItem, qty, split) => {
|
|
340
359
|
if (split) {
|
|
341
360
|
const unifyIds = (lineItem) => (Object.assign(Object.assign({}, lineItem), { id: UUID.UUID(), lineItems: lineItem.lineItems.map(unifyIds) }));
|
|
@@ -357,8 +376,10 @@ var lineItem_utils = /*#__PURE__*/Object.freeze({
|
|
|
357
376
|
generateModifiedAssetsMap: generateModifiedAssetsMap,
|
|
358
377
|
getAttributeValue: getAttributeValue,
|
|
359
378
|
getAttributes: getAttributes,
|
|
379
|
+
getOriginParent: getOriginParent,
|
|
360
380
|
getRecommendedPrices: getRecommendedPrices,
|
|
361
381
|
insertLineItem: insertLineItem,
|
|
382
|
+
isLineItemModified: isLineItemModified,
|
|
362
383
|
mapAttributes: mapAttributes,
|
|
363
384
|
multiplyLineItems: multiplyLineItems,
|
|
364
385
|
patchAttributes: patchAttributes,
|
|
@@ -378,11 +399,11 @@ class LineItemWorker {
|
|
|
378
399
|
remove(id) {
|
|
379
400
|
return new LineItemWorker(removeLineItem(this.li, id));
|
|
380
401
|
}
|
|
381
|
-
replace(toReplace) {
|
|
382
|
-
return new LineItemWorker(replaceLineItem(this.li, toReplace));
|
|
402
|
+
replace(toReplace, skipCardinalityCalculation = false) {
|
|
403
|
+
return new LineItemWorker(replaceLineItem(this.li, toReplace, skipCardinalityCalculation));
|
|
383
404
|
}
|
|
384
|
-
patchAttribute(attrs, id) {
|
|
385
|
-
return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
|
|
405
|
+
patchAttribute(attrs, id, skipCardinalityCalculation = false) {
|
|
406
|
+
return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs, skipCardinalityCalculation));
|
|
386
407
|
}
|
|
387
408
|
}
|
|
388
409
|
|
|
@@ -617,11 +638,12 @@ class ConfigurationService {
|
|
|
617
638
|
this.charges.next({});
|
|
618
639
|
this.pricePlans.next({});
|
|
619
640
|
}
|
|
620
|
-
patch$(lineItem) {
|
|
641
|
+
patch$(lineItem, options) {
|
|
621
642
|
if (!this.lineItem.value) {
|
|
622
643
|
return throwError(() => new Error(`Source LineItem not found`));
|
|
623
644
|
}
|
|
624
|
-
|
|
645
|
+
const skipCardinalityCalculation = (options === null || options === void 0 ? void 0 : options.skipCardinalityCalculation) || this.contextSnapshot.properties['#skipCardinalityCalculation'] === 'true';
|
|
646
|
+
this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem, skipCardinalityCalculation).li;
|
|
625
647
|
return this.configure().pipe(catchError(error => {
|
|
626
648
|
console.error(error);
|
|
627
649
|
if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
|
@@ -636,8 +658,8 @@ class ConfigurationService {
|
|
|
636
658
|
}
|
|
637
659
|
}));
|
|
638
660
|
}
|
|
639
|
-
patch(lineItem) {
|
|
640
|
-
this.patch$(lineItem).subscribe();
|
|
661
|
+
patch(lineItem, options) {
|
|
662
|
+
this.patch$(lineItem, options).subscribe();
|
|
641
663
|
}
|
|
642
664
|
setConfigurableRamp(lineItem) {
|
|
643
665
|
this.configurableRamp = lineItem;
|
|
@@ -1211,16 +1233,84 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
|
1211
1233
|
args: [{ providedIn: 'root' }]
|
|
1212
1234
|
}], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
|
|
1213
1235
|
|
|
1236
|
+
class RuntimeSettingsService {
|
|
1237
|
+
constructor(configurationSettingsApiService) {
|
|
1238
|
+
this.configurationSettingsApiService = configurationSettingsApiService;
|
|
1239
|
+
this.configurationSettings$ = new BehaviorSubject({});
|
|
1240
|
+
this.currencySettings$ = new BehaviorSubject({
|
|
1241
|
+
iso: 'USD',
|
|
1242
|
+
symbol: '$',
|
|
1243
|
+
});
|
|
1244
|
+
this.getCurrencySymbol = (locale, currency) => {
|
|
1245
|
+
return (0)
|
|
1246
|
+
.toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
|
|
1247
|
+
.replace(/\d/g, '')
|
|
1248
|
+
.trim();
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1251
|
+
create() {
|
|
1252
|
+
return this.configurationSettingsApiService.fetchSettings().pipe(map$2(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => this.configurationSettings$.next(configurationSettings)), map$2(() => undefined));
|
|
1253
|
+
}
|
|
1254
|
+
initCurrency(iso) {
|
|
1255
|
+
if (iso) {
|
|
1256
|
+
const symbol = this.getCurrencySymbol('en-US', iso);
|
|
1257
|
+
this.currencySettings$.next({ iso, symbol });
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
getConfigurationSettings() {
|
|
1261
|
+
return this.configurationSettings$.value;
|
|
1262
|
+
}
|
|
1263
|
+
getCurrencySettings() {
|
|
1264
|
+
return this.currencySettings$.value;
|
|
1265
|
+
}
|
|
1266
|
+
parseConfigurationSettings(settings) {
|
|
1267
|
+
return settings.reduce((acc, setting) => {
|
|
1268
|
+
switch (setting.key) {
|
|
1269
|
+
case 'shopping-cart':
|
|
1270
|
+
acc['shopping-cart'] = parseJsonSafely(setting.value, []);
|
|
1271
|
+
break;
|
|
1272
|
+
case 'navigation':
|
|
1273
|
+
acc.navigation = parseJsonSafely(setting.value, {});
|
|
1274
|
+
break;
|
|
1275
|
+
case 'flows':
|
|
1276
|
+
acc.flows = parseJsonSafely(setting.value, []);
|
|
1277
|
+
break;
|
|
1278
|
+
default:
|
|
1279
|
+
acc[setting.key] = setting.value;
|
|
1280
|
+
}
|
|
1281
|
+
return acc;
|
|
1282
|
+
}, {});
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1286
|
+
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, providedIn: 'root' });
|
|
1287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeSettingsService, decorators: [{
|
|
1288
|
+
type: Injectable,
|
|
1289
|
+
args: [{ providedIn: 'root' }]
|
|
1290
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
|
|
1291
|
+
|
|
1214
1292
|
class SdkCoreModule {
|
|
1215
1293
|
}
|
|
1216
1294
|
SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1217
1295
|
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
|
|
1218
|
-
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
|
|
1296
|
+
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, providers: [
|
|
1297
|
+
ContextService,
|
|
1298
|
+
QuoteDraftService,
|
|
1299
|
+
ProductImagesService,
|
|
1300
|
+
MetricsCalculationService,
|
|
1301
|
+
RuntimeSettingsService,
|
|
1302
|
+
], imports: [ConfigurationModule, FlowConfigurationModule] });
|
|
1219
1303
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: SdkCoreModule, decorators: [{
|
|
1220
1304
|
type: NgModule,
|
|
1221
1305
|
args: [{
|
|
1222
1306
|
imports: [ConfigurationModule, FlowConfigurationModule],
|
|
1223
|
-
providers: [
|
|
1307
|
+
providers: [
|
|
1308
|
+
ContextService,
|
|
1309
|
+
QuoteDraftService,
|
|
1310
|
+
ProductImagesService,
|
|
1311
|
+
MetricsCalculationService,
|
|
1312
|
+
RuntimeSettingsService,
|
|
1313
|
+
],
|
|
1224
1314
|
}]
|
|
1225
1315
|
}] });
|
|
1226
1316
|
|
|
@@ -1228,5 +1318,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
|
|
|
1228
1318
|
* Generated bundle index. Do not edit.
|
|
1229
1319
|
*/
|
|
1230
1320
|
|
|
1231
|
-
export { ConfigurationRuntimeService, ConfigurationService, ContextService, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, MetricsCalculationService, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeStep, SdkCoreModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, findLineItem, findLineItemWithComparator, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getRecommendedPrices, insertLineItem, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
|
|
1321
|
+
export { ConfigurationRuntimeService, ConfigurationService, ContextService, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, MetricsCalculationService, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeSettingsService, RuntimeStep, SdkCoreModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, findLineItem, findLineItemWithComparator, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
|
|
1232
1322
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|