@veloceapps/sdk 5.0.7 → 5.0.9

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 (36) hide show
  1. package/bundles/veloce-sdk-cms.umd.js +41 -4
  2. package/bundles/veloce-sdk-cms.umd.js.map +1 -1
  3. package/bundles/veloce-sdk.umd.js +469 -192
  4. package/bundles/veloce-sdk.umd.js.map +1 -1
  5. package/cms/cms.actions.d.ts +8 -2
  6. package/cms/types/common.types.d.ts +5 -0
  7. package/cms/types/index.d.ts +1 -0
  8. package/cms/types/metrics.types.d.ts +5 -0
  9. package/cms/utils/elements-resolver.d.ts +2 -1
  10. package/cms/vendor-map.d.ts +4 -0
  11. package/esm2015/cms/cms.actions.js +11 -1
  12. package/esm2015/cms/types/common.types.js +1 -1
  13. package/esm2015/cms/types/index.js +2 -1
  14. package/esm2015/cms/types/metrics.types.js +2 -0
  15. package/esm2015/cms/utils/element.utils.js +6 -1
  16. package/esm2015/cms/utils/elements-resolver.js +21 -4
  17. package/esm2015/src/components/header/header.component.js +7 -16
  18. package/esm2015/src/components/header/header.module.js +6 -2
  19. package/esm2015/src/components/header/metrics/index.js +2 -0
  20. package/esm2015/src/components/header/metrics/metrics.component.js +216 -0
  21. package/esm2015/src/components/header/metrics/metrics.definitions.js +9 -0
  22. package/esm2015/src/components/header/metrics/metrics.module.js +64 -0
  23. package/esm2015/src/services/flow-router.service.js +13 -1
  24. package/esm2015/src/services/flow.service.js +7 -1
  25. package/fesm2015/veloce-sdk-cms.js +39 -5
  26. package/fesm2015/veloce-sdk-cms.js.map +1 -1
  27. package/fesm2015/veloce-sdk.js +356 -85
  28. package/fesm2015/veloce-sdk.js.map +1 -1
  29. package/package.json +1 -1
  30. package/src/components/header/header.component.d.ts +0 -8
  31. package/src/components/header/header.module.d.ts +2 -1
  32. package/src/components/header/metrics/index.d.ts +1 -0
  33. package/src/components/header/metrics/metrics.component.d.ts +49 -0
  34. package/src/components/header/metrics/metrics.definitions.d.ts +4 -0
  35. package/src/components/header/metrics/metrics.module.d.ts +17 -0
  36. package/src/services/flow-router.service.d.ts +1 -0
@@ -4,7 +4,7 @@ import { InjectionToken, Component, ChangeDetectionStrategy, Inject, Injector, I
4
4
  import * as rxjs from 'rxjs';
5
5
  import { BehaviorSubject, Subject, takeUntil, map, filter, from, tap, of, switchMap, forkJoin, catchError } from 'rxjs';
6
6
  import * as lodash from 'lodash';
7
- import { compact, flatten, isArray, pull, set } from 'lodash';
7
+ import { compact, flatten, isArray, pull, set, kebabCase } from 'lodash';
8
8
  import * as i7 from '@angular/common';
9
9
  import { DOCUMENT, CommonModule } from '@angular/common';
10
10
  import { UUID, CoreModule } from '@veloce/core';
@@ -29,8 +29,10 @@ var FlowAction;
29
29
  FlowAction["FLOW_APPLY_PRODUCT_CONFIGURATION"] = "FLOW_APPLY_PRODUCT_CONFIGURATION";
30
30
  FlowAction["FLOW_OPEN_DOC_GEN"] = "FLOW_OPEN_DOC_GEN";
31
31
  FlowAction["FLOW_CLOSE_DOC_GEN"] = "FLOW_CLOSE_DOC_GEN";
32
+ FlowAction["FLOW_SWITCH_OBJECT"] = "FLOW_SWITCH_OBJECT";
32
33
  FlowAction["REMOTE_APPLY"] = "REMOTE_APPLY";
33
34
  FlowAction["REMOTE_CANCEL"] = "REMOTE_CANCEL";
35
+ FlowAction["SET_DEFAULT_METRICS"] = "SET_DEFAULT_METRICS";
34
36
  })(FlowAction || (FlowAction = {}));
35
37
  const ConfigureProductAction = ({ lineItemId, productId, }) => ({
36
38
  type: FlowAction.FLOW_CONFIGURE_PRODUCT,
@@ -57,6 +59,14 @@ const RemoteApplyAction = () => ({
57
59
  const RemoteCancelAction = () => ({
58
60
  type: FlowAction.REMOTE_CANCEL,
59
61
  });
62
+ const SwitchObjectAction = (payload) => ({
63
+ type: FlowAction.FLOW_SWITCH_OBJECT,
64
+ payload,
65
+ });
66
+ const SetDefaultMetrics = (metrics) => ({
67
+ type: FlowAction.SET_DEFAULT_METRICS,
68
+ payload: { metrics },
69
+ });
60
70
 
61
71
  var cmsActions = /*#__PURE__*/Object.freeze({
62
72
  __proto__: null,
@@ -68,7 +78,9 @@ var cmsActions = /*#__PURE__*/Object.freeze({
68
78
  OpenDocGenAction: OpenDocGenAction,
69
79
  CloseDocGenAction: CloseDocGenAction,
70
80
  RemoteApplyAction: RemoteApplyAction,
71
- RemoteCancelAction: RemoteCancelAction
81
+ RemoteCancelAction: RemoteCancelAction,
82
+ SwitchObjectAction: SwitchObjectAction,
83
+ SetDefaultMetrics: SetDefaultMetrics
72
84
  });
73
85
 
74
86
  const DEFAULT_PLUGINS_TOKEN = new InjectionToken('DEFAULT_PLUGINS_TOKEN');
@@ -466,6 +478,7 @@ const metadataToElement = (metadata, recursive = true) => {
466
478
  inputs: metadata.inputs,
467
479
  outputs: metadata.outputs,
468
480
  children: metadata.children.map(({ name }) => name),
481
+ configuredStyles: metadata.configuredStyles,
469
482
  };
470
483
  const normalizedElMetadata = normalizeElementMetadata(elMetadata);
471
484
  if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
@@ -530,6 +543,10 @@ const normalizeElementMetadata = (elementMetadata) => {
530
543
  if (!metadata.isShared) {
531
544
  delete metadata.isShared;
532
545
  }
546
+ // configuredStyles
547
+ if (!metadata.configuredStyles) {
548
+ delete metadata.configuredStyles;
549
+ }
533
550
  return metadata;
534
551
  };
535
552
  const extractElementMetadata = (script) => {
@@ -1077,6 +1094,9 @@ class ElementsResolver {
1077
1094
  }
1078
1095
  }
1079
1096
  }
1097
+ getNgComponents() {
1098
+ return this.renderableElements.map(el => this.resolveElement(el)).filter(Boolean);
1099
+ }
1080
1100
  transpile(el) {
1081
1101
  var _a;
1082
1102
  if (!el.script) {
@@ -1144,6 +1164,11 @@ class ElementsResolver {
1144
1164
  console.warn(`Unknown element type "${element.type}"`);
1145
1165
  return;
1146
1166
  }
1167
+ const configuredStyles = this.convertInlineStylesToCSS(element.configuredStyles);
1168
+ if (configuredStyles) {
1169
+ // order is important: styles written by user in CSS code should has higher priority
1170
+ element.styles = configuredStyles + element.styles;
1171
+ }
1147
1172
  const component = Object.assign(Object.assign({ selector: 'vl-element', template: element.template }, (element.styles ? { styles: [element.styles] } : {})), { providers: [
1148
1173
  { provide: DEFAULT_PLUGINS_TOKEN, useValue: defaultPlugins },
1149
1174
  { provide: UI_DEFINITION_METADATA, useValue: this.uiDef },
@@ -1157,8 +1182,17 @@ class ElementsResolver {
1157
1182
  set(cmp, 'path', element.path);
1158
1183
  return cmp;
1159
1184
  }
1160
- getNgComponents() {
1161
- return this.renderableElements.map(el => this.resolveElement(el)).filter(Boolean);
1185
+ convertInlineStylesToCSS(styles) {
1186
+ if (!styles) {
1187
+ return '';
1188
+ }
1189
+ const entries = Object.entries(styles);
1190
+ let result = ':host {';
1191
+ entries.forEach(([style, value]) => {
1192
+ result += `${kebabCase(style)}:${value};`;
1193
+ });
1194
+ result += '}';
1195
+ return result;
1162
1196
  }
1163
1197
  }
1164
1198
 
@@ -1362,5 +1396,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
1362
1396
  * Generated bundle index. Do not edit.
1363
1397
  */
1364
1398
 
1365
- export { ApplyProductConfigurationAction, CloseDocGenAction, ConfigureProductAction, DEFAULT_PLUGINS_TOKEN, ELEMENT_CONFIG, ELEMENT_METADATA, ElementComponent, ElementDefinition, ElementsResolver, FlowAction, IntegrationState, LauncherModule, LauncherService, NavigateBackAction, NavigateToCatalogAction, OpenDocGenAction, PreviewComponent, PreviewModule, RemoteApplyAction, RemoteCancelAction, SHARED_ELEMENT_METADATA, TemplatesService, UI_DEFINITION_METADATA, UiBuildError, VENDOR_MAP, doesElementSupportIO, elementToMetadata, extendElementMetadata, extractElementMetadata, findElementByModule, flattenElements, getAbsolutePath, getElementConfig, isSharedElement, isValidScript, metadataToElement, normalizeElementMetadata, parseBoundPath, parsePath, stringifyElementMetadata };
1399
+ export { ApplyProductConfigurationAction, CloseDocGenAction, ConfigureProductAction, DEFAULT_PLUGINS_TOKEN, ELEMENT_CONFIG, ELEMENT_METADATA, ElementComponent, ElementDefinition, ElementsResolver, FlowAction, IntegrationState, LauncherModule, LauncherService, NavigateBackAction, NavigateToCatalogAction, OpenDocGenAction, PreviewComponent, PreviewModule, RemoteApplyAction, RemoteCancelAction, SHARED_ELEMENT_METADATA, SetDefaultMetrics, SwitchObjectAction, TemplatesService, UI_DEFINITION_METADATA, UiBuildError, VENDOR_MAP, doesElementSupportIO, elementToMetadata, extendElementMetadata, extractElementMetadata, findElementByModule, flattenElements, getAbsolutePath, getElementConfig, isSharedElement, isValidScript, metadataToElement, normalizeElementMetadata, parseBoundPath, parsePath, stringifyElementMetadata };
1366
1400
  //# sourceMappingURL=veloce-sdk-cms.js.map