@veloceapps/sdk 8.0.0-99 → 9.0.0-1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. package/cms/README.md +0 -20
  2. package/cms/cms.actions.d.ts +9 -1
  3. package/cms/components/preview/preview.component.d.ts +2 -3
  4. package/cms/components/preview/preview.types.d.ts +4 -0
  5. package/cms/index.d.ts +1 -0
  6. package/cms/modules/runtime/services/runtime.service.d.ts +1 -1
  7. package/cms/services/index.d.ts +0 -1
  8. package/cms/services/resources.service.d.ts +2 -0
  9. package/cms/types/index.d.ts +0 -1
  10. package/cms/utils/element-metadata-worker.d.ts +11 -0
  11. package/cms/utils/elements-resolver.d.ts +0 -2
  12. package/cms/utils/index.d.ts +3 -0
  13. package/cms/utils/transpilation-worker.d.ts +13 -0
  14. package/cms/vendor-map.d.ts +21 -18
  15. package/core/README.md +20 -0
  16. package/core/modules/configuration/configuration.module.d.ts +2 -1
  17. package/core/modules/configuration/helpers.d.ts +2 -1
  18. package/core/modules/configuration/index.d.ts +1 -1
  19. package/core/modules/configuration/services/configuration-state.service.d.ts +54 -0
  20. package/core/modules/configuration/services/configuration.service.d.ts +6 -6
  21. package/core/modules/configuration/types/configuration.types.d.ts +4 -0
  22. package/core/modules/flow-configuration/flow-configuration.module.d.ts +2 -1
  23. package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +5 -0
  24. package/core/services/context.service.d.ts +2 -0
  25. package/core/services/flow-info.service.d.ts +29 -0
  26. package/core/services/flow-state-configuration.service.d.ts +19 -0
  27. package/core/services/flow-state.service.d.ts +80 -0
  28. package/core/services/index.d.ts +4 -1
  29. package/core/services/quote-draft.service.d.ts +12 -28
  30. package/core/types/flow-customization.types.d.ts +22 -0
  31. package/core/types/flow-state.types.d.ts +11 -0
  32. package/core/types/index.d.ts +3 -1
  33. package/{cms → core}/types/integration.types.d.ts +0 -1
  34. package/core/utils/line-item.utils.d.ts +1 -3
  35. package/esm2020/cms/cms.actions.mjs +11 -1
  36. package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +3 -3
  37. package/esm2020/cms/components/element-tools-panel/element-tools-panel.component.mjs +3 -3
  38. package/esm2020/cms/components/preview/preview.component.mjs +10 -10
  39. package/esm2020/cms/components/preview/preview.module.mjs +2 -2
  40. package/esm2020/cms/components/preview/preview.types.mjs +1 -1
  41. package/esm2020/cms/index.mjs +2 -1
  42. package/esm2020/cms/launcher.module.mjs +4 -4
  43. package/esm2020/cms/modules/migrations/migrations.mjs +2 -2
  44. package/esm2020/cms/modules/migrations/services/migrations.service.mjs +6 -2
  45. package/esm2020/cms/modules/runtime/services/compilation.service.mjs +8 -8
  46. package/esm2020/cms/modules/runtime/services/runtime.service.mjs +4 -4
  47. package/esm2020/cms/plugins/configuration.plugin.mjs +8 -4
  48. package/esm2020/cms/services/index.mjs +1 -2
  49. package/esm2020/cms/services/io-provider.service.mjs +10 -9
  50. package/esm2020/cms/services/resources.service.mjs +10 -6
  51. package/esm2020/cms/services/templates.service.mjs +10 -9
  52. package/esm2020/cms/types/index.mjs +1 -2
  53. package/esm2020/cms/utils/element-metadata-worker.mjs +31 -0
  54. package/esm2020/cms/utils/elements-resolver.mjs +13 -27
  55. package/esm2020/cms/utils/encoding.utils.mjs +3 -2
  56. package/esm2020/cms/utils/index.mjs +4 -1
  57. package/esm2020/cms/utils/path.utils.mjs +3 -3
  58. package/esm2020/cms/utils/script.utils.mjs +19 -15
  59. package/esm2020/cms/utils/transpilation-worker.mjs +52 -0
  60. package/esm2020/cms/vendor-map.mjs +10 -5
  61. package/esm2020/core/core.module.mjs +19 -3
  62. package/esm2020/core/modules/configuration/configuration.module.mjs +7 -23
  63. package/esm2020/core/modules/configuration/helpers.mjs +21 -1
  64. package/esm2020/core/modules/configuration/index.mjs +2 -2
  65. package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +335 -0
  66. package/esm2020/core/modules/configuration/services/configuration.service.mjs +56 -50
  67. package/esm2020/core/modules/configuration/types/configuration.types.mjs +1 -1
  68. package/esm2020/core/modules/flow-configuration/flow-configuration.module.mjs +6 -6
  69. package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +12 -9
  70. package/esm2020/core/services/context.service.mjs +17 -5
  71. package/esm2020/core/services/flow-info.service.mjs +99 -0
  72. package/esm2020/core/services/flow-state-configuration.service.mjs +53 -0
  73. package/esm2020/core/services/flow-state.service.mjs +512 -0
  74. package/esm2020/core/services/index.mjs +5 -2
  75. package/esm2020/core/services/integration.state.mjs +36 -0
  76. package/esm2020/core/services/product-images.service.mjs +4 -5
  77. package/esm2020/core/services/quote-draft.service.mjs +39 -91
  78. package/esm2020/core/services/runtime-settings.service.mjs +7 -5
  79. package/esm2020/core/types/flow-customization.types.mjs +3 -0
  80. package/esm2020/core/types/flow-state.types.mjs +2 -0
  81. package/esm2020/core/types/index.mjs +4 -2
  82. package/esm2020/core/types/integration.types.mjs +2 -0
  83. package/esm2020/core/utils/line-item.utils.mjs +33 -32
  84. package/esm2020/src/components/doc-gen/doc-gen.component.mjs +44 -51
  85. package/esm2020/src/components/flow-header/flow-header.component.mjs +36 -47
  86. package/esm2020/src/components/guided-selling/guided-selling.component.mjs +35 -46
  87. package/esm2020/src/flow-routing.module.mjs +5 -18
  88. package/esm2020/src/flow.component.mjs +22 -37
  89. package/esm2020/src/guards/context.guard.mjs +6 -11
  90. package/esm2020/src/guards/flow.guard.mjs +23 -9
  91. package/esm2020/src/pages/assets/assets.component.mjs +30 -34
  92. package/esm2020/src/pages/catalog/catalog.component.mjs +30 -34
  93. package/esm2020/src/pages/debug/debug.component.mjs +2 -2
  94. package/esm2020/src/pages/product/product.component.mjs +34 -20
  95. package/esm2020/src/pages/record-not-found/record-not-found.component.mjs +6 -3
  96. package/esm2020/src/pages/remote/remote.component.mjs +15 -14
  97. package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +31 -35
  98. package/esm2020/src/resolvers/flow.resolver.mjs +37 -55
  99. package/esm2020/src/resolvers/quote.resolver.mjs +55 -67
  100. package/esm2020/src/services/doc-gen.service.mjs +4 -3
  101. package/esm2020/src/services/flow-dialog.service.mjs +17 -6
  102. package/esm2020/src/services/flow-router.service.mjs +42 -15
  103. package/esm2020/src/services/flow.service.mjs +67 -52
  104. package/esm2020/src/services/guided-selling.service.mjs +5 -4
  105. package/esm2020/src/types/index.mjs +1 -2
  106. package/fesm2015/veloceapps-sdk-cms.mjs +270 -191
  107. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
  108. package/fesm2015/veloceapps-sdk-core.mjs +1195 -427
  109. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  110. package/fesm2015/veloceapps-sdk.mjs +776 -826
  111. package/fesm2015/veloceapps-sdk.mjs.map +1 -1
  112. package/fesm2020/veloceapps-sdk-cms.mjs +275 -206
  113. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
  114. package/fesm2020/veloceapps-sdk-core.mjs +1176 -454
  115. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  116. package/fesm2020/veloceapps-sdk.mjs +899 -945
  117. package/fesm2020/veloceapps-sdk.mjs.map +1 -1
  118. package/package.json +8 -7
  119. package/src/components/doc-gen/doc-gen.component.d.ts +7 -10
  120. package/src/components/flow-header/flow-header.component.d.ts +6 -9
  121. package/src/components/guided-selling/guided-selling.component.d.ts +6 -9
  122. package/src/flow-routing.module.d.ts +1 -2
  123. package/src/flow.component.d.ts +7 -12
  124. package/src/guards/context.guard.d.ts +0 -1
  125. package/src/guards/flow.guard.d.ts +1 -1
  126. package/src/pages/assets/assets.component.d.ts +5 -7
  127. package/src/pages/catalog/catalog.component.d.ts +5 -7
  128. package/src/pages/product/product.component.d.ts +8 -7
  129. package/src/pages/record-not-found/record-not-found.component.d.ts +2 -0
  130. package/src/pages/remote/remote.component.d.ts +2 -3
  131. package/src/pages/shopping-cart/shopping-cart.component.d.ts +5 -7
  132. package/src/resolvers/flow.resolver.d.ts +6 -9
  133. package/src/resolvers/quote.resolver.d.ts +7 -14
  134. package/src/services/doc-gen.service.d.ts +1 -1
  135. package/src/services/flow-dialog.service.d.ts +4 -2
  136. package/src/services/flow-router.service.d.ts +6 -3
  137. package/src/services/flow.service.d.ts +10 -14
  138. package/src/services/guided-selling.service.d.ts +1 -1
  139. package/src/types/index.d.ts +0 -1
  140. package/core/modules/configuration/services/configuration.state.d.ts +0 -30
  141. package/core/services/metric-calculation/metric-calculation.service.d.ts +0 -25
  142. package/core/services/metric-calculation/metric-calculation.types.d.ts +0 -1
  143. package/core/services/metric-calculation/metric-calculation.utils.d.ts +0 -5
  144. package/esm2020/cms/services/integration.state.mjs +0 -37
  145. package/esm2020/cms/types/integration.types.mjs +0 -2
  146. package/esm2020/core/modules/configuration/services/configuration.state.mjs +0 -142
  147. package/esm2020/core/services/metric-calculation/metric-calculation.service.mjs +0 -85
  148. package/esm2020/core/services/metric-calculation/metric-calculation.types.mjs +0 -2
  149. package/esm2020/core/services/metric-calculation/metric-calculation.utils.mjs +0 -42
  150. package/esm2020/src/pages/empty-account/empty-account.component.mjs +0 -12
  151. package/esm2020/src/pages/empty-account/empty-account.module.mjs +0 -20
  152. package/esm2020/src/types/flow-customization.types.mjs +0 -3
  153. package/src/pages/empty-account/empty-account.component.d.ts +0 -5
  154. package/src/pages/empty-account/empty-account.module.d.ts +0 -10
  155. package/src/types/flow-customization.types.d.ts +0 -12
  156. /package/{cms → core}/services/integration.state.d.ts +0 -0
package/cms/README.md CHANGED
@@ -2,26 +2,6 @@
2
2
 
3
3
  [← Back to SDK](../)
4
4
 
5
- ## IntegrationState
6
-
7
- An application state, which helps to cover cross-component communication. Contains reactive store and event system.
8
-
9
- `get state$(): Observable<S>`
10
-
11
- `get state(): S`
12
-
13
- `patchState(update: Partial<S>): void`
14
-
15
- `dispatch(action: IntegrationAction): void`
16
-
17
- `listen$<P = any>(actionType: string): Observable<P>`
18
-
19
- `listenAll$<T extends IntegrationAction>(): Observable<T>`
20
-
21
- `clear(): void`
22
-
23
- **Important!** Don't overuse it, otherwise application can become messy and hardly supportable.
24
-
25
5
  ## ResourcesService
26
6
 
27
7
  A service provides an ability to load scripts and styles from external resources.
@@ -1,4 +1,5 @@
1
- import { IntegrationAction } from './types';
1
+ import { CustomizationChanges } from '@veloceapps/core';
2
+ import { IntegrationAction } from '@veloceapps/sdk/core';
2
3
  export declare namespace FlowAction {
3
4
  const FLOW_CONFIGURE_PRODUCT = "[FLOW]_CONFIGURE_PRODUCT";
4
5
  const FLOW_NAVIGATE_BACK = "[FLOW]_NAVIGATE_BACK";
@@ -95,6 +96,7 @@ export declare const SwitchObjectAction: (payload: {
95
96
  export declare namespace CmsAction {
96
97
  const GO_TO_PAGE = "[CMS]_GO_TO_PAGE";
97
98
  const UPDATE_CUSTOMIZATION = "[CMS]_UPDATE_CUSTOMIZATION";
99
+ const EMIT_CUSTOMIZATION_CHANGES = "[CMS]_EMIT_CUSTOMIZATION_CHANGES";
98
100
  const SHOW_OVERLAY = "[CMS]_SHOW_OVERLAY";
99
101
  const HIDE_OVERLAY = "[CMS]_HIDE_OVERLAY";
100
102
  const HIDE_ALL_OVERLAYS = "[CMS]_HIDE_ALL_OVERLAYS";
@@ -110,6 +112,12 @@ export declare namespace CmsAction {
110
112
  * @param pageName name of the page
111
113
  */
112
114
  const UpdateCustomization: (value: any) => IntegrationAction;
115
+ /**
116
+ * Emit customization page changes
117
+ *
118
+ * @param changes - object with customization page changes
119
+ */
120
+ const EmitCustomizationChanges: (changes: CustomizationChanges) => IntegrationAction;
113
121
  /**
114
122
  * Show an Overlay on the selected page
115
123
  *
@@ -1,10 +1,9 @@
1
1
  import { OnDestroy, OnInit } from '@angular/core';
2
2
  import { ToastService } from '@veloceapps/components';
3
3
  import { UIDefinition } from '@veloceapps/core';
4
- import { ConfigurationState } from '@veloceapps/sdk/core';
4
+ import { ConfigurationStateService, IntegrationState } from '@veloceapps/sdk/core';
5
5
  import { BehaviorSubject, Observable } from 'rxjs';
6
6
  import { RuntimeService } from '../../modules/runtime/services/runtime.service';
7
- import { IntegrationState } from '../../services';
8
7
  import { ElementMetadata } from '../../types/common.types';
9
8
  import { CMSPreviewConfig } from './preview.types';
10
9
  import * as i0 from "@angular/core";
@@ -22,7 +21,7 @@ export declare class PreviewComponent implements OnInit, OnDestroy {
22
21
  state$: BehaviorSubject<State>;
23
22
  elements$: Observable<ElementMetadata[]>;
24
23
  private destroy$;
25
- constructor(runtimeService: RuntimeService, configurationState: ConfigurationState, toastService: ToastService, integrationState: IntegrationState);
24
+ constructor(runtimeService: RuntimeService, configurationState: ConfigurationStateService, toastService: ToastService, integrationState: IntegrationState);
26
25
  ngOnInit(): void;
27
26
  ngOnDestroy(): void;
28
27
  trackBy(_: number, el: ElementMetadata): ElementMetadata;
@@ -13,6 +13,10 @@ export interface CMSPreviewConfig {
13
13
  * When `true`, preview renders settings page (element with `type: CUSTOMIZATION_PAGE`)
14
14
  */
15
15
  customizationMode?: boolean;
16
+ /**
17
+ * When `true`, preview component does not clear configuration state on destroy
18
+ */
19
+ persistConfigurationState?: boolean;
16
20
  /**
17
21
  * Custom initialization function which will be executed before starting a preview
18
22
  */
package/cms/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { IntegrationAction, IntegrationState, IntegrationStateModel } from '@veloceapps/sdk/core';
1
2
  export * from './cms.actions';
2
3
  export * from './cms.layouts';
3
4
  export * from './components';
@@ -1,10 +1,10 @@
1
1
  import { Injector, NgModule, NgModuleRef, Type } from '@angular/core';
2
2
  import { UIDefinition } from '@veloceapps/core';
3
+ import { IntegrationState } from '@veloceapps/sdk/core';
3
4
  import { Patch } from 'rfc6902';
4
5
  import { BehaviorSubject, Observable, Subject } from 'rxjs';
5
6
  import { CMSPreviewConfig } from '../../../components/preview/preview.types';
6
7
  import { Entity } from '../../../engine/models/entity';
7
- import { IntegrationState } from '../../../services/integration.state';
8
8
  import { ElementMetadata } from '../../../types';
9
9
  import * as i0 from "@angular/core";
10
10
  export declare class RuntimeService {
@@ -1,3 +1,2 @@
1
- export * from './integration.state';
2
1
  export * from './resources.service';
3
2
  export * from './templates.service';
@@ -1,4 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
+ import { ScriptHost } from '../types';
2
3
  import * as i0 from "@angular/core";
3
4
  export declare class ResourcesService {
4
5
  private scripts;
@@ -12,6 +13,7 @@ export declare class ResourcesService {
12
13
  private amd;
13
14
  loadScript(url: string): Observable<void>;
14
15
  loadStyles(url: string): Observable<void>;
16
+ loadStyles(host: ScriptHost, url: string): Observable<void>;
15
17
  private persistAMDLoader;
16
18
  private restoreAMDLoader;
17
19
  static ɵfac: i0.ɵɵFactoryDeclaration<ResourcesService, never>;
@@ -2,7 +2,6 @@ export * from '../modules/runtime/types/compilation.types';
2
2
  export * from './common.types';
3
3
  export * from './configuration.types';
4
4
  export * from './elements.types';
5
- export * from './integration.types';
6
5
  export * from './layouts.types';
7
6
  export * from './pages.types';
8
7
  export * from './path.types';
@@ -0,0 +1,11 @@
1
+ import { UIElement } from '@veloceapps/core';
2
+ import { Observable } from 'rxjs';
3
+ import { ElementMetadata } from '../types/common.types';
4
+ export declare class ElementMetadataWorker {
5
+ private elements;
6
+ constructor(elements: UIElement[]);
7
+ get$(): Observable<ElementMetadata[]>;
8
+ private processAsync;
9
+ private processLevelAsync;
10
+ private elementToMetadataAsync;
11
+ }
@@ -13,8 +13,6 @@ export declare class ElementsResolver {
13
13
  constructor(uiDef: UIDefinitionMetadata, elements: ElementMetadata[], sharedElements?: ElementMetadata[], config?: CMSPreviewConfig | undefined);
14
14
  addElement(element: ElementMetadata): void;
15
15
  getNgComponents(): Record<string, Type<Entity>>;
16
- private transpile;
17
- private transpileScripts;
18
16
  private flattenElements;
19
17
  private isSharedElement;
20
18
  private getRenderableElements;
@@ -1,5 +1,8 @@
1
+ export * from './element-metadata-worker';
1
2
  export * from './element.utils';
2
3
  export * from './elements-resolver';
4
+ export * from './encoding.utils';
3
5
  export * from './path.utils';
6
+ export * from './transpilation-worker';
4
7
  export * from './ui-builder-layout.utils';
5
8
  export * from './ui-definition.utils';
@@ -0,0 +1,13 @@
1
+ import { Observable } from 'rxjs';
2
+ import { ElementMetadata } from '../types/common.types';
3
+ export declare class TranspilationWorker {
4
+ private elements;
5
+ constructor(elements: ElementMetadata[]);
6
+ get$(): Observable<ElementMetadata[]>;
7
+ get(): ElementMetadata[];
8
+ private transpileScripts;
9
+ private transpileScriptsAsync;
10
+ private processLevelAsync;
11
+ private transpileMetadataAsync;
12
+ private transpile;
13
+ }
@@ -1,19 +1,22 @@
1
1
  import * as angularCore from '@angular/core';
2
2
  import * as angularForms from '@angular/forms';
3
+ import { DataSource } from '@angular/cdk/collections';
3
4
  import { CatalogApiService, ConfigurationSettingsApiService, ContractedPriceApiService, DeltaApiService, DocumentAttachmentApiService, DocumentTemplatesApiService, GuidedSellingApiService, PicklistsApiService, PriceApiService, QuoteApiService, RampApiService, SalesforceApiService, ShoppingCartSettingsApiService } from '@veloceapps/api';
4
5
  import { ToastService, ToastType } from '@veloceapps/components';
5
6
  import { ConfigurationContextMode, Operator, parseJsonSafely, Predicate } from '@veloceapps/core';
6
- import { ActionCodePipe, ConfigurationService, ConfigurationState, ContextService, DatePipe, FlowConfigurationService, LineItemWorker, MetricsCalculationService, NumberPipe, PricePipe, ProductImagesService, QuoteDraftService, RuntimeSettingsService } from '@veloceapps/sdk/core';
7
+ import { ActionCodePipe, ConfigurationService, ConfigurationStateService, ContextService, DatePipe, FlowConfigurationService, FlowStateConfigurationService, FlowStateService, IntegrationState, LineItemWorker, NumberPipe, PricePipe, ProductImagesService, QuoteDraftService, RuntimeSettingsService } from '@veloceapps/sdk/core';
7
8
  import lodash from 'lodash';
8
9
  import * as rxjs from 'rxjs';
9
10
  import * as rxjsOperators from 'rxjs/operators';
10
11
  import * as cmsActions from './cms.actions';
11
- import { IntegrationState } from './services/integration.state';
12
12
  import { ResourcesService } from './services/resources.service';
13
13
  import { TemplatesService } from './services/templates.service';
14
14
  export declare const vendorMap: {
15
15
  '@angular/core': typeof angularCore;
16
16
  '@angular/forms': typeof angularForms;
17
+ '@angular/cdk/collections': {
18
+ DataSource: typeof DataSource;
19
+ };
17
20
  rxjs: typeof rxjs;
18
21
  'rxjs/operators': typeof rxjsOperators;
19
22
  lodash: lodash.LoDashStatic;
@@ -49,7 +52,6 @@ export declare const vendorMap: {
49
52
  insertLineItem: (lineItem: import("@veloceapps/core").LineItem, parentId: string, toInsert: import("@veloceapps/core").LineItem) => import("@veloceapps/core").LineItem;
50
53
  removeLineItem: (lineItem: import("@veloceapps/core").LineItem, idToRemove: string) => import("@veloceapps/core").LineItem;
51
54
  replaceLineItem: (lineItem: import("@veloceapps/core").LineItem, replaceTo: import("@veloceapps/core").LineItem, skipCardinalityCalculation?: boolean | undefined) => import("@veloceapps/core").LineItem;
52
- calculateCardinalityVariables: (lineItems: import("@veloceapps/core").LineItem[]) => Map<string, number>;
53
55
  recalculateCardinalityVariables: (original: import("@veloceapps/core").LineItem, updated: import("@veloceapps/core").LineItem) => import("@veloceapps/core").LineItem;
54
56
  mapAttributes: (attributes: import("@veloceapps/core").Attribute[]) => lodash.Dictionary<any>;
55
57
  getAttributes: (attributes: import("@veloceapps/core").Attribute[], names?: string[] | undefined) => import("@veloceapps/core").Attribute[];
@@ -61,23 +63,24 @@ export declare const vendorMap: {
61
63
  net: number;
62
64
  list: number;
63
65
  };
64
- generateModifiedAssetsMap: (lineItems: import("@veloceapps/core").LineItem[]) => Record<string, boolean>;
65
66
  getOriginParent: (lineItems: import("@veloceapps/core").LineItem[], currentLineItem: import("@veloceapps/core").LineItem) => import("@veloceapps/core").LineItem | undefined;
66
- isLineItemModified: <T_1 extends Pick<import("@veloceapps/core").LineItem, "actionCode" | "status">>(lineItem: T_1) => boolean;
67
+ assetPredicateFn: (lineItem: import("@veloceapps/core").LineItem, assetId?: string | undefined) => boolean;
67
68
  multiplyLineItems: (lineItem: import("@veloceapps/core").LineItem, qty: number, split: boolean) => import("@veloceapps/core").LineItem[];
68
69
  isTechnicalAttribute: (name: string) => boolean;
69
- filterOutTechnicalAttributes: <T_2 extends {
70
+ filterOutTechnicalAttributes: <T_1 extends {
70
71
  name: string;
71
- }>(attributes: T_2[]) => T_2[];
72
+ }>(attributes: T_1[]) => T_1[];
72
73
  ConfigurationService: typeof ConfigurationService;
73
- ConfigurationState: typeof ConfigurationState;
74
+ ConfigurationStateService: typeof ConfigurationStateService;
74
75
  QuoteDraftService: typeof QuoteDraftService;
75
76
  FlowConfigurationService: typeof FlowConfigurationService;
77
+ IntegrationState: typeof IntegrationState;
78
+ FlowStateService: typeof FlowStateService;
79
+ FlowStateConfigurationService: typeof FlowStateConfigurationService;
76
80
  LineItemWorker: typeof LineItemWorker;
77
81
  ProductImagesService: typeof ProductImagesService;
78
82
  ContextService: typeof ContextService;
79
83
  RuntimeSettingsService: typeof RuntimeSettingsService;
80
- MetricsCalculationService: typeof MetricsCalculationService;
81
84
  ActionCodePipe: typeof ActionCodePipe;
82
85
  DatePipe: typeof DatePipe;
83
86
  NumberPipe: typeof NumberPipe;
@@ -91,17 +94,17 @@ export declare const vendorMap: {
91
94
  ConfigureProductAction: ({ lineItemId, productId, }: {
92
95
  lineItemId?: string | undefined;
93
96
  productId?: string | undefined;
94
- }) => import("@veloceapps/sdk/cms").IntegrationAction<any>;
95
- NavigateBackAction: () => import("@veloceapps/sdk/cms").IntegrationAction<any>;
96
- NavigateToCatalogAction: () => import("@veloceapps/sdk/cms").IntegrationAction<any>;
97
- ApplyProductConfigurationAction: () => import("@veloceapps/sdk/cms").IntegrationAction<any>;
98
- OpenDocGenAction: () => import("@veloceapps/sdk/cms").IntegrationAction<any>;
99
- CloseDocGenAction: () => import("@veloceapps/sdk/cms").IntegrationAction<any>;
100
- RemoteApplyAction: () => import("@veloceapps/sdk/cms").IntegrationAction<any>;
101
- RemoteCancelAction: () => import("@veloceapps/sdk/cms").IntegrationAction<any>;
97
+ }) => import("@veloceapps/sdk/core").IntegrationAction<any>;
98
+ NavigateBackAction: () => import("@veloceapps/sdk/core").IntegrationAction<any>;
99
+ NavigateToCatalogAction: () => import("@veloceapps/sdk/core").IntegrationAction<any>;
100
+ ApplyProductConfigurationAction: () => import("@veloceapps/sdk/core").IntegrationAction<any>;
101
+ OpenDocGenAction: () => import("@veloceapps/sdk/core").IntegrationAction<any>;
102
+ CloseDocGenAction: () => import("@veloceapps/sdk/core").IntegrationAction<any>;
103
+ RemoteApplyAction: () => import("@veloceapps/sdk/core").IntegrationAction<any>;
104
+ RemoteCancelAction: () => import("@veloceapps/sdk/core").IntegrationAction<any>;
102
105
  SwitchObjectAction: (payload: {
103
106
  id: string;
104
- }) => import("@veloceapps/sdk/cms").IntegrationAction<any>;
107
+ }) => import("@veloceapps/sdk/core").IntegrationAction<any>;
105
108
  CmsAction: typeof cmsActions.CmsAction;
106
109
  DEFAULT_PLUGINS_TOKEN: angularCore.InjectionToken<typeof import("./engine/models/plugin").Plugin[]>;
107
110
  UI_DEFINITION_METADATA: angularCore.InjectionToken<import("@veloceapps/core").UIDefinitionMetadata>;
package/core/README.md CHANGED
@@ -3,3 +3,23 @@
3
3
  [← Back to SDK](../)
4
4
 
5
5
  The place where configuration logic lives: services, utils, workers etc
6
+
7
+ ## IntegrationState
8
+
9
+ An application state, which helps to cover cross-component communication. Contains reactive store and event system.
10
+
11
+ `get state$(): Observable<S>`
12
+
13
+ `get state(): S`
14
+
15
+ `patchState(update: Partial<S>): void`
16
+
17
+ `dispatch(action: IntegrationAction): void`
18
+
19
+ `listen$<P = any>(actionType: string): Observable<P>`
20
+
21
+ `listenAll$<T extends IntegrationAction>(): Observable<T>`
22
+
23
+ `clear(): void`
24
+
25
+ **Important!** Don't overuse it, otherwise application can become messy and hardly supportable.
@@ -1,7 +1,8 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import * as i1 from "@veloceapps/components";
3
+ import * as i2 from "@veloceapps/api";
3
4
  export declare class ConfigurationModule {
4
5
  static ɵfac: i0.ɵɵFactoryDeclaration<ConfigurationModule, never>;
5
- static ɵmod: i0.ɵɵNgModuleDeclaration<ConfigurationModule, never, [typeof i1.ConfirmationDialogModule], never>;
6
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ConfigurationModule, never, [typeof i1.ConfirmationDialogModule, typeof i2.ApiModule], never>;
6
7
  static ɵinj: i0.ɵɵInjectorDeclaration<ConfigurationModule>;
7
8
  }
@@ -1,5 +1,6 @@
1
1
  import { ConfigurationContext, ConfigurationRequest, LineItem, UIDefinitionProps } from '@veloceapps/core';
2
2
  import { RuntimeContext } from '../../types';
3
- import { GuidedSellingSubmitData } from './types/configuration.types';
3
+ import { GuidedSellingSubmitData, NewConfigurationProps } from './types/configuration.types';
4
4
  export declare const getDefaultLineItem: (context: RuntimeContext, uiDefinitionProperties: UIDefinitionProps, qty?: number) => LineItem;
5
5
  export declare const getGuidedSellingConfigurationRequest: (data: GuidedSellingSubmitData, context: ConfigurationContext) => ConfigurationRequest;
6
+ export declare const generateConfigurationLineItem: (props: NewConfigurationProps, qty?: number) => LineItem;
@@ -1,6 +1,6 @@
1
1
  export * from './helpers';
2
2
  export * from './services/configuration-runtime.service';
3
3
  export * from './services/configuration.service';
4
- export * from './services/configuration.state';
4
+ export * from './services/configuration-state.service';
5
5
  export * from './types/configuration-runtime.types';
6
6
  export * from './types/configuration.types';
@@ -0,0 +1,54 @@
1
+ import { FlowStateApiService, QuoteApiService, SaveQuoteResponse } from '@veloceapps/api';
2
+ import { ToastService } from '@veloceapps/components';
3
+ import { FlowStateExecutionRequestDTO, FlowStateExecutionResult, FlowStateSelectorResponse } from '@veloceapps/core';
4
+ import { BehaviorSubject, Observable, Subject } from 'rxjs';
5
+ import { FlowInfoService, FlowStateService, QuoteDraftService } from '../../../services';
6
+ import { FlowStateSubscriptionOptions } from '../../../types/flow-state.types';
7
+ import { FlowConfigurationService } from '../../flow-configuration';
8
+ import { ConfigurationRuntimeService } from './configuration-runtime.service';
9
+ import { ConfigurationService } from './configuration.service';
10
+ import * as i0 from "@angular/core";
11
+ export declare class ConfigurationStateService {
12
+ private configurationRuntimeService;
13
+ private configurationService;
14
+ private quoteDraftService;
15
+ private toastService;
16
+ private flowStateService;
17
+ private flowInfoService;
18
+ private flowConfigurationService;
19
+ private flowStateApiService;
20
+ private quoteApiService;
21
+ isInitialized$: BehaviorSubject<boolean>;
22
+ canceledConfiguration$: Subject<void>;
23
+ private readonly NOT_INITIALIZED;
24
+ private readonly EXECUTION_BUFFER_TIME;
25
+ private executedFunctions;
26
+ private stateId;
27
+ private ownerId;
28
+ private subscriptions;
29
+ private configurationStore;
30
+ private statefulExecutionInProgress$;
31
+ private statefulRequestStream$;
32
+ private statefulExecutionRequest$;
33
+ constructor(configurationRuntimeService: ConfigurationRuntimeService, configurationService: ConfigurationService, quoteDraftService: QuoteDraftService, toastService: ToastService, flowStateService: FlowStateService, flowInfoService: FlowInfoService, flowConfigurationService: FlowConfigurationService, flowStateApiService: FlowStateApiService, quoteApiService: QuoteApiService);
34
+ init$(): Observable<void>;
35
+ cleanup(): void;
36
+ execute$(req: FlowStateExecutionRequestDTO, forceSubscriptions?: boolean): Observable<FlowStateExecutionResult>;
37
+ private handleSelectorsResponse;
38
+ dispatch$(actionName: string, inputData?: unknown): Observable<FlowStateExecutionResult>;
39
+ select$<Response = unknown>(selectorName: string, inputData?: unknown): Observable<FlowStateSelectorResponse<Response>>;
40
+ subscribe$<Response = unknown>(selectorName: string, inputData?: unknown, options?: FlowStateSubscriptionOptions): Observable<FlowStateSelectorResponse<Response>>;
41
+ saveConfiguration(quoteId?: string, flow?: boolean): Observable<SaveQuoteResponse>;
42
+ cancelConfiguration(): Observable<void>;
43
+ private get isStatefulConfiguration();
44
+ private initStateful$;
45
+ private initStateless$;
46
+ private executeStateless$;
47
+ private initBufferedRequest$;
48
+ private executeStateful$;
49
+ private executeActionScript;
50
+ private executeSelectorScript;
51
+ private executeProcessorScript;
52
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConfigurationStateService, never>;
53
+ static ɵprov: i0.ɵɵInjectableDeclaration<ConfigurationStateService>;
54
+ }
@@ -21,10 +21,7 @@ export declare class ConfigurationService {
21
21
  private runtimeSettings;
22
22
  private mode;
23
23
  private configurableRamp;
24
- private lineItem;
25
- private charges;
26
- private pricePlans;
27
- private procedureContext;
24
+ private configurationState;
28
25
  private isLoadingSubj$;
29
26
  isLoading$: Observable<boolean>;
30
27
  hasUnsavedChanges: boolean;
@@ -37,6 +34,8 @@ export declare class ConfigurationService {
37
34
  getSnapshot(): LineItem | undefined;
38
35
  getRuntimeModel(): RuntimeModel;
39
36
  getRuntimeContext(): RuntimeContext;
37
+ get state$(): Observable<ConfigurePrice | null>;
38
+ get stateSnapshot(): ConfigurePrice | null;
40
39
  get contextSnapshot(): ConfigurationContext;
41
40
  get context$(): Observable<ConfigurationContext>;
42
41
  get charges$(): Observable<Dictionary<Charge>>;
@@ -49,10 +48,11 @@ export declare class ConfigurationService {
49
48
  configureRequest$(configurationRequest: ConfigurationRequest): Observable<LineItem>;
50
49
  configureExternal$(props: ExternalConfigurationProps): Observable<LineItem>;
51
50
  configureGuidedSelling$(data: GuidedSellingSubmitData): Observable<ConfigurePrice>;
52
- generateRequest(): ConfigurationRequest;
51
+ generateRequest(lightMode?: boolean): ConfigurationRequest;
52
+ generateLineItem(): LineItem;
53
+ getAsset(): LineItem | undefined;
53
54
  private getUIDefinitionProperties;
54
55
  private showInactiveProductsConfirmation;
55
- private getAsset;
56
56
  static ɵfac: i0.ɵɵFactoryDeclaration<ConfigurationService, never>;
57
57
  static ɵprov: i0.ɵɵInjectableDeclaration<ConfigurationService>;
58
58
  }
@@ -1,3 +1,4 @@
1
+ import { Product } from '@veloceapps/core';
1
2
  export interface GuidedSellingSubmitData {
2
3
  modelId: string;
3
4
  modelType: string;
@@ -8,3 +9,6 @@ export interface ExternalConfigurationProps {
8
9
  qty?: number;
9
10
  attributesMap?: Record<string, any>;
10
11
  }
12
+ export interface NewConfigurationProps extends ExternalConfigurationProps {
13
+ product: Product;
14
+ }
@@ -1,6 +1,7 @@
1
1
  import * as i0 from "@angular/core";
2
+ import * as i1 from "@veloceapps/api";
2
3
  export declare class FlowConfigurationModule {
3
4
  static ɵfac: i0.ɵɵFactoryDeclaration<FlowConfigurationModule, never>;
4
- static ɵmod: i0.ɵɵNgModuleDeclaration<FlowConfigurationModule, never, never, never>;
5
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FlowConfigurationModule, never, [typeof i1.ApiModule], never>;
5
6
  static ɵinj: i0.ɵɵInjectorDeclaration<FlowConfigurationModule>;
6
7
  }
@@ -15,6 +15,11 @@ export declare class FlowConfigurationService {
15
15
  private quoteDraftService;
16
16
  private updateService;
17
17
  private configurationService;
18
+ /**
19
+ * An event being fired when QuoteDraft was updated
20
+ */
21
+ updated$: Observable<void>;
22
+ private updatedSubj$;
18
23
  constructor(proceduresApiService: ProceduresApiService, contextService: ContextService, quoteDraftService: QuoteDraftService, updateService: FlowUpdateService, configurationService: ConfigurationService);
19
24
  calculate$(quoteDraft: QuoteDraft): Observable<void>;
20
25
  calculate(quoteDraft: QuoteDraft): void;
@@ -9,6 +9,8 @@ export declare class ContextService {
9
9
  get isInitialized(): boolean;
10
10
  get isInitialized$(): Observable<boolean>;
11
11
  get mode(): ConfigurationContextMode | undefined;
12
+ get isEditMode$(): Observable<boolean>;
13
+ get isEditMode(): boolean;
12
14
  resolve(): ConfigurationContext;
13
15
  resolve$(): Observable<ConfigurationContext>;
14
16
  create(headerId: string, mode: ConfigurationContextMode): Observable<ConfigurationContext>;
@@ -0,0 +1,29 @@
1
+ import { Params } from '@angular/router';
2
+ import { FlowsApiService, UITemplatesApiService } from '@veloceapps/api';
3
+ import { Flow, UITemplate, UITemplateType } from '@veloceapps/core';
4
+ import { Observable } from 'rxjs';
5
+ import { FlowCustomization } from '../types';
6
+ import * as i0 from "@angular/core";
7
+ export declare class FlowInfoService {
8
+ private flowsApiService;
9
+ private templatesApiService;
10
+ private customizationService?;
11
+ flow$: Observable<Flow | null>;
12
+ params?: Params;
13
+ templates: {
14
+ [key in UITemplateType]?: UITemplate;
15
+ };
16
+ get flow(): Flow | null;
17
+ set flow(value: Flow | null);
18
+ get isLegacy(): boolean;
19
+ get isStateful(): boolean;
20
+ private readonly defaultTemplates;
21
+ private flowSubj$;
22
+ constructor(flowsApiService: FlowsApiService, templatesApiService: UITemplatesApiService, customizationService?: FlowCustomization | undefined);
23
+ init$(flowId: string, params: Params): Observable<void>;
24
+ cleanup(): void;
25
+ private initFlowTemplates$;
26
+ private remapTemplateName;
27
+ static ɵfac: i0.ɵɵFactoryDeclaration<FlowInfoService, [null, null, { optional: true; }]>;
28
+ static ɵprov: i0.ɵɵInjectableDeclaration<FlowInfoService>;
29
+ }
@@ -0,0 +1,19 @@
1
+ import { FlowStateApiService } from '@veloceapps/api';
2
+ import { Observable } from 'rxjs';
3
+ import { NewConfigurationProps } from '../modules/configuration';
4
+ import { FlowConfigurationService } from '../modules/flow-configuration';
5
+ import { FlowInfoService } from './flow-info.service';
6
+ import { FlowStateService } from './flow-state.service';
7
+ import * as i0 from "@angular/core";
8
+ export declare class FlowStateConfigurationService {
9
+ private flowInfoService;
10
+ private flowConfigurationService;
11
+ private flowStateApiService;
12
+ private flowStateService;
13
+ private configurationStateId$;
14
+ constructor(flowInfoService: FlowInfoService, flowConfigurationService: FlowConfigurationService, flowStateApiService: FlowStateApiService, flowStateService: FlowStateService);
15
+ get configurationStateId(): string | null;
16
+ addToCart$(props: NewConfigurationProps): Observable<void>;
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<FlowStateConfigurationService, never>;
18
+ static ɵprov: i0.ɵɵInjectableDeclaration<FlowStateConfigurationService>;
19
+ }
@@ -0,0 +1,80 @@
1
+ import { ConfigurationProcessorsApiService, FlowStateApiService, QuoteApiService } from '@veloceapps/api';
2
+ import { ToastService } from '@veloceapps/components';
3
+ import { Charge, CompiledPricePlan, FlowStateExecutionRequest, FlowStateExecutionRequestDTO, FlowStateExecutionResult, FlowStateSelectorResponse, MetricRule, UITemplateType } from '@veloceapps/core';
4
+ import { Dictionary } from 'lodash';
5
+ import { Observable } from 'rxjs';
6
+ import { FlowConfigurationService } from '../modules';
7
+ import { FlowCustomization } from '../types/flow-customization.types';
8
+ import { FlowStateSubscriptionOptions } from '../types/flow-state.types';
9
+ import { ContextService } from './context.service';
10
+ import { FlowInfoService } from './flow-info.service';
11
+ import { QuoteDraftService } from './quote-draft.service';
12
+ import * as i0 from "@angular/core";
13
+ export declare class FlowStateService {
14
+ private contextService;
15
+ private quoteDraftService;
16
+ private flowInfoService;
17
+ private flowConfiguration;
18
+ private processorsApiService;
19
+ private flowStateApiService;
20
+ private quoteApiService;
21
+ private toastService;
22
+ private customizationService?;
23
+ charges$: Observable<Dictionary<Charge>>;
24
+ pricePlans$: Observable<Dictionary<CompiledPricePlan>>;
25
+ activeMetrics$: Observable<MetricRule[]>;
26
+ isPriceListLocked$: Observable<boolean>;
27
+ private readonly NOT_INITIALIZED;
28
+ private readonly EXECUTION_BUFFER_TIME;
29
+ private executedFunctions;
30
+ private stateId$;
31
+ private _hasStatefulUnsavedChanges;
32
+ private processors;
33
+ private subscriptions;
34
+ private flowStore;
35
+ private statefulExecutionInProgress$;
36
+ private statefulRequestStream$;
37
+ private statefulExecutionRequest$;
38
+ private cleanup$;
39
+ constructor(contextService: ContextService, quoteDraftService: QuoteDraftService, flowInfoService: FlowInfoService, flowConfiguration: FlowConfigurationService, processorsApiService: ConfigurationProcessorsApiService, flowStateApiService: FlowStateApiService, quoteApiService: QuoteApiService, toastService: ToastService, customizationService?: FlowCustomization | undefined);
40
+ init$(): Observable<void>;
41
+ cleanup(): void;
42
+ get hasUnsavedChanges(): boolean;
43
+ get stateId(): string | null;
44
+ get isExecutionInProgress$(): Observable<boolean>;
45
+ isInitialized$(): Observable<boolean>;
46
+ isInitialized(): boolean;
47
+ execute$(scope: UITemplateType, exec: FlowStateExecutionRequest): Observable<FlowStateExecutionResult['selectors']>;
48
+ dispatch$(scope: UITemplateType, action: string, inputData?: unknown): Observable<void>;
49
+ select$<Response = unknown>(scope: UITemplateType, selectorName: string, inputData?: unknown): Observable<FlowStateSelectorResponse<Response>>;
50
+ subscribe$<Response = unknown>(scope: UITemplateType, selectorName: string, inputData?: unknown, options?: FlowStateSubscriptionOptions): Observable<FlowStateSelectorResponse<Response>>;
51
+ save$(): Observable<{
52
+ quoteId: string;
53
+ }>;
54
+ submit$(): Observable<{
55
+ quoteId: string;
56
+ }>;
57
+ getFlowStore(): Record<string, unknown>;
58
+ private getOwnerIdByScope;
59
+ private getScopeByOwnerId;
60
+ private execToRequest;
61
+ executeRequest$(request: FlowStateExecutionRequestDTO, forceSubscriptions?: boolean): Observable<FlowStateExecutionResult>;
62
+ private handleSelectorsResponse;
63
+ private initStateful$;
64
+ private initBufferedRequest$;
65
+ private executeStateful$;
66
+ private initStateless$;
67
+ private calculate$;
68
+ private executeStateless$;
69
+ private executeStatelessActions;
70
+ private executeStatelessSelectors;
71
+ private getFlowSafe;
72
+ private initProcessors$;
73
+ private executeActionScript;
74
+ private executeSelectorScript;
75
+ private executeProcessorScript;
76
+ private generateRequestId;
77
+ private getDefaultExecutionRequestDTO;
78
+ static ɵfac: i0.ɵɵFactoryDeclaration<FlowStateService, [null, null, null, null, null, null, null, null, { optional: true; }]>;
79
+ static ɵprov: i0.ɵɵInjectableDeclaration<FlowStateService>;
80
+ }
@@ -1,5 +1,8 @@
1
1
  export * from './context.service';
2
- export * from './metric-calculation/metric-calculation.service';
2
+ export * from './flow-info.service';
3
+ export * from './flow-state.service';
4
+ export * from './flow-state-configuration.service';
5
+ export * from './integration.state';
3
6
  export * from './product-images.service';
4
7
  export * from './quote-draft.service';
5
8
  export * from './runtime-settings.service';