@veloceapps/sdk 2.0.3 → 2.0.5

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 (148) hide show
  1. package/bundles/veloce-sdk-cms.umd.js +533 -355
  2. package/bundles/veloce-sdk-cms.umd.js.map +1 -1
  3. package/bundles/veloce-sdk-runtime.umd.js +145 -173
  4. package/bundles/veloce-sdk-runtime.umd.js.map +1 -1
  5. package/bundles/veloce-sdk.umd.js +1104 -8
  6. package/bundles/veloce-sdk.umd.js.map +1 -1
  7. package/cms/components/preview/preview.component.d.ts +4 -1
  8. package/cms/modules/configuration/index.d.ts +2 -0
  9. package/cms/modules/configuration/services/configuration-runtime.service.d.ts +29 -0
  10. package/cms/modules/configuration/services/configuration.service.d.ts +11 -10
  11. package/cms/modules/configuration/services/runtime-context.service.d.ts +14 -0
  12. package/cms/modules/configuration/types/configuration-runtime.types.d.ts +6 -0
  13. package/cms/modules/configuration/types/configuration.types.d.ts +2 -0
  14. package/esm2015/cms/components/element-children/element-children.component.js +3 -3
  15. package/esm2015/cms/components/element-children/element-children.module.js +4 -4
  16. package/esm2015/cms/components/element-renderer/element-renderer.component.js +3 -3
  17. package/esm2015/cms/components/element-renderer/element-renderer.module.js +4 -4
  18. package/esm2015/cms/components/federated/federated.component.js +3 -3
  19. package/esm2015/cms/components/federated/federated.module.js +4 -4
  20. package/esm2015/cms/components/plugin.component.js +3 -3
  21. package/esm2015/cms/components/preview/preview.component.js +32 -24
  22. package/esm2015/cms/components/preview/preview.module.js +4 -4
  23. package/esm2015/cms/directives/custom-template.directive.js +3 -3
  24. package/esm2015/cms/launcher.module.js +4 -4
  25. package/esm2015/cms/modules/configuration/configuration.module.js +25 -6
  26. package/esm2015/cms/modules/configuration/index.js +3 -1
  27. package/esm2015/cms/modules/configuration/services/configuration-runtime.service.js +80 -0
  28. package/esm2015/cms/modules/configuration/services/configuration.service.js +45 -44
  29. package/esm2015/cms/modules/configuration/services/runtime-context.service.js +60 -0
  30. package/esm2015/cms/modules/configuration/types/configuration-runtime.types.js +2 -0
  31. package/esm2015/cms/modules/configuration/types/configuration.types.js +1 -1
  32. package/esm2015/cms/plugins/configuration.plugin.js +3 -3
  33. package/esm2015/cms/plugins/io.plugin.js +3 -3
  34. package/esm2015/cms/plugins/script.plugin.js +3 -3
  35. package/esm2015/cms/services/dynamic-module.service.js +3 -3
  36. package/esm2015/cms/services/element-context.service.js +3 -3
  37. package/esm2015/cms/services/io-provider.service.js +3 -3
  38. package/esm2015/cms/services/launcher.service.js +3 -3
  39. package/esm2015/cms/services/templates.service.js +3 -3
  40. package/esm2015/index.js +2 -2
  41. package/esm2015/runtime/components/component-preview/component-preview.component.js +3 -3
  42. package/esm2015/runtime/components/section-renderer/section-renderer.component.js +3 -3
  43. package/esm2015/runtime/components/ui-runtime/runtime.component.js +3 -3
  44. package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +3 -3
  45. package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +6 -6
  46. package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +3 -3
  47. package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +3 -3
  48. package/esm2015/runtime/execution/components/federated/federated.component.js +3 -3
  49. package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +3 -3
  50. package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +3 -3
  51. package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +3 -3
  52. package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +3 -3
  53. package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +3 -3
  54. package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +3 -3
  55. package/esm2015/runtime/execution/directives/section-script.directive.js +3 -3
  56. package/esm2015/runtime/execution/directives/sf-query.directive.js +3 -3
  57. package/esm2015/runtime/execution/directives/velo-attribute.directive.js +3 -3
  58. package/esm2015/runtime/execution/directives/velo-port.directive.js +18 -18
  59. package/esm2015/runtime/execution/directives/vl-approval.directive.js +3 -3
  60. package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +3 -3
  61. package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +3 -3
  62. package/esm2015/runtime/execution/directives/vl-quote.directive.js +3 -3
  63. package/esm2015/runtime/execution/directives/vl-ramp.directive.js +3 -3
  64. package/esm2015/runtime/execution/runtime-execution.module.js +5 -8
  65. package/esm2015/runtime/runtime.module.js +5 -8
  66. package/esm2015/runtime/services/cart.service.js +3 -3
  67. package/esm2015/runtime/services/collapsible-state.service.js +3 -3
  68. package/esm2015/runtime/services/configuration.service.js +3 -3
  69. package/esm2015/runtime/services/context.service.js +6 -5
  70. package/esm2015/runtime/services/current-state.service.js +3 -3
  71. package/esm2015/runtime/services/form-scope.service.js +3 -3
  72. package/esm2015/runtime/services/index.js +1 -2
  73. package/esm2015/runtime/services/product-model-cache.service.js +3 -3
  74. package/esm2015/runtime/services/quote.service.js +3 -3
  75. package/esm2015/runtime/services/runtime-context.service.js +3 -3
  76. package/esm2015/runtime/services/runtime-form.service.js +3 -3
  77. package/esm2015/runtime/services/runtime.service.js +3 -3
  78. package/esm2015/runtime/services/section-helper.service.js +3 -3
  79. package/esm2015/runtime/services/section-scope.service.js +3 -3
  80. package/esm2015/runtime/services/section-store.service.js +3 -3
  81. package/esm2015/runtime/services/section.service.js +6 -6
  82. package/esm2015/runtime/types/index.js +1 -2
  83. package/esm2015/src/constants.js +2 -0
  84. package/esm2015/src/flow-routing.module.js +75 -0
  85. package/esm2015/src/flow.component.js +23 -0
  86. package/esm2015/src/flow.module.js +24 -0
  87. package/esm2015/src/guards/context.guard.js +63 -0
  88. package/esm2015/src/guards/index.js +2 -0
  89. package/esm2015/src/guards/root.guard.js +41 -0
  90. package/esm2015/src/index.js +6 -0
  91. package/esm2015/src/pages/debug/debug.component.js +54 -0
  92. package/esm2015/src/pages/debug/debug.module.js +44 -0
  93. package/esm2015/src/pages/legacy-product/legacy-product.component.js +117 -0
  94. package/esm2015/src/pages/legacy-product/legacy-product.module.js +20 -0
  95. package/esm2015/src/pages/product/product.component.js +95 -0
  96. package/esm2015/src/pages/product/product.module.js +20 -0
  97. package/esm2015/src/pages/record-not-found/record-not-found.component.js +26 -0
  98. package/esm2015/src/pages/record-not-found/record-not-found.module.js +20 -0
  99. package/esm2015/src/resolvers/context.resolver.js +42 -0
  100. package/esm2015/src/resolvers/flow.resolver.js +58 -0
  101. package/esm2015/src/resolvers/quote.resolver.js +36 -0
  102. package/esm2015/src/services/flow.service.js +24 -0
  103. package/esm2015/src/services/index.js +2 -0
  104. package/esm2015/src/services/router.service.js +47 -0
  105. package/esm2015/src/types/context-route.types.js +2 -0
  106. package/esm2015/src/types/flow-customization.types.js +3 -0
  107. package/esm2015/src/types/flow.types.js +2 -0
  108. package/esm2015/src/types/index.js +4 -0
  109. package/esm2015/src/types/route.types.js +2 -0
  110. package/fesm2015/veloce-sdk-cms.js +466 -318
  111. package/fesm2015/veloce-sdk-cms.js.map +1 -1
  112. package/fesm2015/veloce-sdk-runtime.js +146 -169
  113. package/fesm2015/veloce-sdk-runtime.js.map +1 -1
  114. package/fesm2015/veloce-sdk.js +725 -1
  115. package/fesm2015/veloce-sdk.js.map +1 -1
  116. package/index.d.ts +1 -2
  117. package/package.json +1 -1
  118. package/runtime/services/index.d.ts +0 -1
  119. package/runtime/types/index.d.ts +0 -1
  120. package/src/constants.d.ts +1 -0
  121. package/src/flow-routing.module.d.ts +9 -0
  122. package/src/flow.component.d.ts +8 -0
  123. package/src/flow.module.d.ts +12 -0
  124. package/src/guards/context.guard.d.ts +16 -0
  125. package/src/guards/index.d.ts +1 -0
  126. package/src/guards/root.guard.d.ts +15 -0
  127. package/src/index.d.ts +5 -0
  128. package/src/pages/debug/debug.component.d.ts +24 -0
  129. package/src/pages/debug/debug.module.d.ts +13 -0
  130. package/src/pages/legacy-product/legacy-product.component.d.ts +33 -0
  131. package/src/pages/legacy-product/legacy-product.module.d.ts +10 -0
  132. package/src/pages/product/product.component.d.ts +32 -0
  133. package/src/pages/product/product.module.d.ts +10 -0
  134. package/src/pages/record-not-found/record-not-found.component.d.ts +11 -0
  135. package/src/pages/record-not-found/record-not-found.module.d.ts +9 -0
  136. package/src/resolvers/context.resolver.d.ts +16 -0
  137. package/src/resolvers/flow.resolver.d.ts +14 -0
  138. package/src/resolvers/quote.resolver.d.ts +15 -0
  139. package/{runtime → src}/services/flow.service.d.ts +1 -2
  140. package/src/services/index.d.ts +1 -0
  141. package/src/services/router.service.d.ts +12 -0
  142. package/src/types/context-route.types.d.ts +5 -0
  143. package/src/types/flow-customization.types.d.ts +7 -0
  144. package/{runtime → src}/types/flow.types.d.ts +0 -0
  145. package/src/types/index.d.ts +3 -0
  146. package/src/types/route.types.d.ts +4 -0
  147. package/esm2015/runtime/services/flow.service.js +0 -24
  148. package/esm2015/runtime/types/flow.types.js +0 -2
@@ -2,23 +2,23 @@ import { __decorate, __param, __awaiter, __rest } from 'tslib';
2
2
  import * as i0 from '@angular/core';
3
3
  import { InjectionToken, Component, ChangeDetectionStrategy, Inject, Injector, Injectable, ViewContainerRef, SkipSelf, ViewChild, Input, Directive, EventEmitter, TemplateRef, Output, NgModule } from '@angular/core';
4
4
  import * as rxjs from 'rxjs';
5
- import { BehaviorSubject, combineLatest, of, shareReplay, throwError, Subject, takeUntil, map as map$1, from, tap as tap$1, forkJoin, catchError as catchError$1 } from 'rxjs';
6
- import { EntityUtil, UUID, ConfigurationMode, ConfigurationContextMode, RuntimeModel, CoreModule } from '@veloce/core';
7
- import * as i2 from '@veloce/sdk/runtime';
5
+ import { BehaviorSubject, combineLatest, of, shareReplay, throwError, Subject, takeUntil, map as map$1, from, tap as tap$1, switchMap, forkJoin, catchError as catchError$1 } from 'rxjs';
6
+ import * as i7 from '@angular/common';
7
+ import { DOCUMENT, CommonModule } from '@angular/common';
8
+ import * as angularForms from '@angular/forms';
9
+ import { ReactiveFormsModule } from '@angular/forms';
10
+ import { EntityUtil, UUID, RuntimeModel, ConfigurationContextMode, SalesforceIdUtils, ConfigurationMode, CoreModule } from '@veloce/core';
11
+ import * as lodash from 'lodash';
12
+ import { compact, sortBy, merge, isArray, pull, flatten, set } from 'lodash';
13
+ import * as i2$1 from '@veloce/sdk/runtime';
8
14
  import { RuntimeMode, RuntimeStep, ContextService } from '@veloce/sdk/runtime';
9
15
  import * as rxjsOperators from 'rxjs/operators';
10
- import { first, switchMap, catchError, map, tap } from 'rxjs/operators';
11
- import * as lodash from 'lodash';
12
- import { compact, sortBy, isArray, pull, flatten, set } from 'lodash';
16
+ import { map, first, tap, catchError } from 'rxjs/operators';
13
17
  import * as i1 from '@veloce/api';
14
18
  import { SalesforceApiService, QuoteApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloce/api';
15
- import * as i3 from 'primeng/api';
16
- import * as i6 from '@angular/common';
17
- import { DOCUMENT, CommonModule } from '@angular/common';
18
- import * as angularForms from '@angular/forms';
19
- import { ReactiveFormsModule } from '@angular/forms';
19
+ import * as i2 from 'primeng/api';
20
20
  import { transform } from '@babel/standalone';
21
- import * as i4 from '@veloce/components';
21
+ import * as i5 from '@veloce/components';
22
22
  import { LoaderModule } from '@veloce/components';
23
23
 
24
24
  const DEFAULT_PLUGINS_TOKEN = new InjectionToken('DEFAULT_PLUGINS_TOKEN');
@@ -79,6 +79,212 @@ ElementComponent = __decorate([
79
79
  __param(0, Inject(Injector))
80
80
  ], ElementComponent);
81
81
 
82
+ const parsePath = (path) => {
83
+ var _a, _b, _c, _d;
84
+ const segments = path.split('/');
85
+ let module;
86
+ let variable;
87
+ if ((_a = segments[0]) === null || _a === void 0 ? void 0 : _a.startsWith('@')) {
88
+ module = (_b = segments.shift()) === null || _b === void 0 ? void 0 : _b.substring(1);
89
+ }
90
+ if (((_c = segments[segments.length - 1]) === null || _c === void 0 ? void 0 : _c[0]) === ':') {
91
+ variable = (_d = segments.pop()) === null || _d === void 0 ? void 0 : _d.substring(1);
92
+ }
93
+ return {
94
+ segments,
95
+ module,
96
+ variable,
97
+ };
98
+ };
99
+ const findElementByModule = (elements, module, elementName) => {
100
+ for (const el of elements) {
101
+ if (el.module === module && el.name === elementName) {
102
+ return el;
103
+ }
104
+ const child = findElementByModule(el.children, module, elementName);
105
+ if (child) {
106
+ return child;
107
+ }
108
+ }
109
+ return;
110
+ };
111
+ const getAbsolutePath = (elements, subject, path) => {
112
+ var _a, _b, _c, _d;
113
+ if (path.module) {
114
+ return (_a = findElementByModule(elements, path.module, path.segments[0])) === null || _a === void 0 ? void 0 : _a.path;
115
+ }
116
+ const subjectSegments = (_c = (_b = subject.path) === null || _b === void 0 ? void 0 : _b.split('/')) !== null && _c !== void 0 ? _c : [];
117
+ const isRelativePath = ((_d = path.segments[0]) === null || _d === void 0 ? void 0 : _d[0]) === '.';
118
+ if (!isRelativePath) {
119
+ return path.segments.join('/');
120
+ }
121
+ const segments = [...path.segments];
122
+ while (segments.length) {
123
+ const segment = segments.shift();
124
+ if (segment === '..') {
125
+ subjectSegments.pop();
126
+ }
127
+ else if (segment) {
128
+ subjectSegments.push(segment);
129
+ }
130
+ }
131
+ return subjectSegments.join('/');
132
+ };
133
+
134
+ class DynamicModuleService {
135
+ constructor() {
136
+ this._elementsTree = [];
137
+ this._componentFactories = [];
138
+ }
139
+ set componentFactories(data) {
140
+ this._componentFactories = data;
141
+ }
142
+ get componentFactories() {
143
+ return this._componentFactories;
144
+ }
145
+ getComponentFactory(element) {
146
+ return this.componentFactories.find(f => f.componentType.path === element.path);
147
+ }
148
+ get elementsTree() {
149
+ return this._elementsTree;
150
+ }
151
+ set elementsTree(tree) {
152
+ this._elementsTree = tree;
153
+ }
154
+ clear() {
155
+ this._elementsTree = [];
156
+ this.componentFactories = [];
157
+ }
158
+ }
159
+ DynamicModuleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DynamicModuleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
160
+ DynamicModuleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DynamicModuleService });
161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DynamicModuleService, decorators: [{
162
+ type: Injectable
163
+ }] });
164
+
165
+ class IOProviderService {
166
+ constructor(dynamicModuleService) {
167
+ this.dynamicModuleService = dynamicModuleService;
168
+ this.inputs = {};
169
+ }
170
+ connect(el, name, target) {
171
+ var _a;
172
+ return (_a = this.resolveTarget(el, name, target)) === null || _a === void 0 ? void 0 : _a.asObservable();
173
+ }
174
+ provide(el, name, target) {
175
+ return this.resolveTarget(el, name, target);
176
+ }
177
+ resolveTarget(el, name, target) {
178
+ var _a, _b;
179
+ const isHost = !target;
180
+ if (isHost) {
181
+ return this.createSubjectSafe((_a = el.path) !== null && _a !== void 0 ? _a : '', name);
182
+ }
183
+ const elPath = parsePath(target);
184
+ const pathIsValue = elPath.segments.length === 1 && elPath.segments[0].startsWith('"') && elPath.segments[0].endsWith('"');
185
+ const finalName = (_b = elPath.variable) !== null && _b !== void 0 ? _b : name;
186
+ const value = pathIsValue ? new BehaviorSubject(elPath.segments[0].slice(1, -1)) : undefined;
187
+ const absolutePath = !pathIsValue ? getAbsolutePath(this.dynamicModuleService.elementsTree, el, elPath) : el.path;
188
+ return this.createSubjectSafe(absolutePath !== null && absolutePath !== void 0 ? absolutePath : '', finalName, value);
189
+ }
190
+ createSubjectSafe(path, name, subject) {
191
+ if (!this.inputs[path]) {
192
+ this.inputs[path] = {};
193
+ }
194
+ if (!this.inputs[path][name]) {
195
+ this.inputs[path][name] = subject !== null && subject !== void 0 ? subject : new BehaviorSubject(undefined);
196
+ }
197
+ return this.inputs[path][name];
198
+ }
199
+ }
200
+ IOProviderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: IOProviderService, deps: [{ token: DynamicModuleService }], target: i0.ɵɵFactoryTarget.Injectable });
201
+ IOProviderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: IOProviderService });
202
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: IOProviderService, decorators: [{
203
+ type: Injectable
204
+ }], ctorParameters: function () { return [{ type: DynamicModuleService }]; } });
205
+
206
+ class TemplatesService {
207
+ constructor() {
208
+ this.templates = {};
209
+ }
210
+ register(name, templateRef) {
211
+ this.templates[name] = templateRef;
212
+ }
213
+ get(name) {
214
+ return this.templates[name];
215
+ }
216
+ }
217
+ TemplatesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TemplatesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
218
+ TemplatesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TemplatesService });
219
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: TemplatesService, decorators: [{
220
+ type: Injectable
221
+ }] });
222
+
223
+ const EXPORTED_CLASS_REGEX = /export class (\S+)/;
224
+ const METADATA_DECORATOR_REGEX = /@ElementDefinition\(([\s\S]+)\)(\n|.)*export class/g;
225
+ const elementToMetadata = (el, parentPath) => {
226
+ var _a;
227
+ const script = el.script && window.atob(el.script);
228
+ const template = el.template && window.atob(el.template);
229
+ const styles = el.styles && window.atob(el.styles);
230
+ const exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
231
+ if (!exportedClassName) {
232
+ console.error("Script doesn't have exported class");
233
+ }
234
+ const elementMetadata = extractElementMetadata(script || '');
235
+ const path = (parentPath ? parentPath + '/' : '') + elementMetadata.name;
236
+ return Object.assign(Object.assign({}, elementMetadata), { path, script: script === null || script === void 0 ? void 0 : script.replace(METADATA_DECORATOR_REGEX, 'export class'), template,
237
+ styles, children: el.children.map(child => elementToMetadata(child, path)) });
238
+ };
239
+ const metadataToElement = (metadata) => {
240
+ const elMetadata = {
241
+ name: metadata.name,
242
+ type: metadata.type,
243
+ model: metadata.model,
244
+ module: metadata.module,
245
+ reference: metadata.reference,
246
+ inputs: metadata.inputs,
247
+ outputs: metadata.outputs,
248
+ children: metadata.children.map(({ name }) => name),
249
+ };
250
+ const script = metadata.script &&
251
+ window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, `@ElementDefinition(${JSON.stringify(elMetadata)}) export class Script`));
252
+ const template = metadata.template && window.btoa(metadata.template);
253
+ const styles = metadata.styles && window.btoa(metadata.styles);
254
+ return {
255
+ script,
256
+ template,
257
+ styles,
258
+ children: metadata.children.map(meta => metadataToElement(meta)),
259
+ };
260
+ };
261
+ const extractElementMetadata = (script) => {
262
+ var _a;
263
+ const metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
264
+ // need to reset regex last index to prevent null result for next execution
265
+ METADATA_DECORATOR_REGEX.lastIndex = 0;
266
+ return eval(`(${metadataString})`);
267
+ };
268
+ const extendElementMetadata = (script, extend) => {
269
+ var _a;
270
+ const metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
271
+ // need to reset regex last index to prevent null result for next execution
272
+ METADATA_DECORATOR_REGEX.lastIndex = 0;
273
+ if (!metadataString) {
274
+ return script;
275
+ }
276
+ const updated = Object.assign(Object.assign({}, eval(`(${metadataString})`)), extend);
277
+ return script.replace(metadataString, JSON.stringify(updated));
278
+ };
279
+
280
+ class ElementContextService {
281
+ }
282
+ ElementContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementContextService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
283
+ ElementContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementContextService });
284
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementContextService, decorators: [{
285
+ type: Injectable
286
+ }] });
287
+
82
288
  const parseBoundPath = (path) => {
83
289
  var _a, _b;
84
290
  const regexp = new RegExp(`(?:\\/)(?:\\w+)(?:\\/)(?:ports|attributes)(?:\\/)(?:\\w+)|(?:\\/)(?:\\w+)`, 'g');
@@ -206,38 +412,148 @@ const getDefaultLineItem = (context, uiDefinitionProperties) => {
206
412
  return lineItem;
207
413
  };
208
414
 
209
- class ConfigurationService {
210
- constructor(apiService, contextService, configurationApiService, messageService) {
211
- this.apiService = apiService;
212
- this.contextService = contextService;
415
+ class RuntimeContextService {
416
+ constructor(configurationApiService, messageService) {
213
417
  this.configurationApiService = configurationApiService;
214
418
  this.messageService = messageService;
215
- this.mode = ConfigurationMode.SEARCH;
216
- this.states = {};
419
+ }
420
+ getRuntimeContext(productId, offeringId) {
421
+ return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
422
+ var _a, _b;
423
+ const uiDefinition = this.getUIDefinition(runtimeData);
424
+ const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
425
+ const { productName, properties } = (_a = Array.from(runtimeModel.components.values()).find(c => c.productId === productId)) !== null && _a !== void 0 ? _a : {};
426
+ return {
427
+ modelId: runtimeData.modelId,
428
+ uiDefinition: uiDefinition,
429
+ runtimeModel: runtimeModel,
430
+ runtimeMode: RuntimeMode.PROD,
431
+ productId: productId,
432
+ productType: (properties === null || properties === void 0 ? void 0 : properties.displayName) || productName,
433
+ offeringId: offeringId,
434
+ properties: {
435
+ PricingEnabled: (_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.pricingEnabled,
436
+ },
437
+ };
438
+ }));
439
+ }
440
+ getUIDefinition(runtimeData) {
441
+ var _a;
442
+ let rawUiDefinitions;
443
+ try {
444
+ rawUiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
445
+ }
446
+ catch (e) {
447
+ return;
448
+ }
449
+ const uiDefinitions = rawUiDefinitions.filter(uiDef => uiDef.version);
450
+ const uiDefinition = (_a = uiDefinitions.find(uiDef => uiDef.primary)) !== null && _a !== void 0 ? _a : uiDefinitions[0];
451
+ if (!uiDefinition) {
452
+ const errMsg = `Unable to find Default UI`;
453
+ this.messageService.add({
454
+ severity: 'error',
455
+ summary: 'ERROR',
456
+ });
457
+ throw new Error(errMsg);
458
+ }
459
+ return uiDefinition;
460
+ }
461
+ }
462
+ RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }, { token: i2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
463
+ RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: RuntimeContextService });
464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: RuntimeContextService, decorators: [{
465
+ type: Injectable
466
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: i2.MessageService }]; } });
467
+
468
+ class ConfigurationRuntimeService {
469
+ constructor(apiService, contextService, runtimeContextService) {
470
+ this.apiService = apiService;
471
+ this.contextService = contextService;
472
+ this.runtimeContextService = runtimeContextService;
473
+ this._isInitialized = new BehaviorSubject(false);
217
474
  this.uiDefinitionProperties = {};
218
- this.lineItem = new BehaviorSubject(undefined);
219
475
  }
220
- init(modelId, uiDefinitionProperties) {
476
+ initTestMode(modelId, uiDefinitionProperties) {
221
477
  this.uiDefinitionProperties = uiDefinitionProperties;
222
478
  return combineLatest([
223
479
  this.apiService.getRuntimeDataByModelId(modelId),
224
480
  this.contextService.create('TestId', ConfigurationContextMode.TEST),
225
- ]).pipe(first(), switchMap(([runtimeData]) => {
226
- this.runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
481
+ ]).pipe(first(), tap(([runtimeData]) => {
482
+ const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
227
483
  const runtimeContext = {
228
484
  modelId: modelId,
229
- runtimeModel: this.runtimeModel,
485
+ runtimeModel,
230
486
  runtimeMode: RuntimeMode.TEST,
231
487
  };
232
- this.runtimeContext = runtimeContext;
233
- return this.configure();
488
+ this._runtimeContext = runtimeContext;
489
+ this._isInitialized.next(true);
234
490
  }));
235
491
  }
492
+ init(props) {
493
+ this._assets = props.assets;
494
+ const configurationContext = this.contextService.resolve();
495
+ if (!configurationContext) {
496
+ return of();
497
+ }
498
+ return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
499
+ var _a, _b, _c;
500
+ this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {};
501
+ const mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign({}, runtimeContext.properties), configurationContext.properties) });
502
+ const accountId = (_c = mergeContext.properties) === null || _c === void 0 ? void 0 : _c.AccountId;
503
+ if (accountId && accountId.length === 15) {
504
+ this.patchContext(mergeContext, {
505
+ properties: { AccountId: SalesforceIdUtils.generateId18FromId15(accountId) },
506
+ });
507
+ }
508
+ this._runtimeContext = mergeContext;
509
+ this._isInitialized.next(true);
510
+ }));
511
+ }
512
+ patchContext(context, patch) {
513
+ merge(context, patch);
514
+ }
515
+ getAsset(lineItem) {
516
+ return this._assets && this._assets.find(a => a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId);
517
+ }
518
+ get isInitialized$() {
519
+ return this._isInitialized.asObservable();
520
+ }
521
+ get isInitialized() {
522
+ return this._isInitialized.getValue();
523
+ }
524
+ get runtimeModel() {
525
+ var _a;
526
+ return (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.runtimeModel;
527
+ }
528
+ get runtimeContext() {
529
+ return this._runtimeContext;
530
+ }
531
+ }
532
+ ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.ConfigurationApiService }, { token: i2$1.ContextService }, { token: RuntimeContextService }], target: i0.ɵɵFactoryTarget.Injectable });
533
+ ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigurationRuntimeService });
534
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
535
+ type: Injectable
536
+ }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: i2$1.ContextService }, { type: RuntimeContextService }]; } });
537
+
538
+ class ConfigurationService {
539
+ constructor(runtimeService, contextService, configurationApiService, messageService) {
540
+ this.runtimeService = runtimeService;
541
+ this.contextService = contextService;
542
+ this.configurationApiService = configurationApiService;
543
+ this.messageService = messageService;
544
+ this.mode = ConfigurationMode.SEARCH;
545
+ this.states = {};
546
+ this.lineItem = new BehaviorSubject(undefined);
547
+ this.charges = new BehaviorSubject({});
548
+ }
236
549
  patch(lineItem) {
237
550
  if (!this.lineItem.value) {
238
551
  return;
239
552
  }
240
553
  this.states.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
554
+ this.states.asset = this.states.configurableRamp
555
+ ? this.runtimeService.getAsset(this.states.configurableRamp)
556
+ : undefined;
241
557
  this.configure()
242
558
  .pipe(catchError(error => {
243
559
  this.messageService.add({
@@ -250,50 +566,62 @@ class ConfigurationService {
250
566
  }))
251
567
  .subscribe();
252
568
  }
569
+ updateCurrentStates(update) {
570
+ this.states = Object.assign(Object.assign({}, this.states), update);
571
+ }
253
572
  get() {
254
- var _a;
255
- return (_a = this.lineItem) === null || _a === void 0 ? void 0 : _a.asObservable().pipe(shareReplay());
573
+ return this.lineItem.asObservable().pipe(shareReplay());
256
574
  }
257
575
  getSnapshot() {
258
576
  return this.lineItem.value ? Object.assign({}, this.lineItem.value) : undefined;
259
577
  }
260
578
  getRuntimeModel() {
261
- return this.runtimeModel;
579
+ return this.runtimeService.runtimeModel;
262
580
  }
263
581
  getRuntimeContext() {
264
- return this.runtimeContext;
582
+ return this.runtimeService.runtimeContext;
583
+ }
584
+ get charges$() {
585
+ return this.charges.asObservable();
586
+ }
587
+ get chargesSnapshot() {
588
+ return this.charges.value;
265
589
  }
266
590
  configure() {
267
- var _a, _b;
268
- if (!this.runtimeContext || !this.runtimeModel) {
591
+ var _a, _b, _c, _d;
592
+ const runtimeContext = this.getRuntimeContext();
593
+ const runtimeModel = this.getRuntimeModel();
594
+ if (!runtimeContext || !runtimeModel) {
269
595
  return of(undefined);
270
596
  }
271
- const lineItem = (_a = this.states.configurableRamp) !== null && _a !== void 0 ? _a : getDefaultLineItem(this.runtimeContext, this.uiDefinitionProperties);
597
+ const 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 : {}));
598
+ const lineItem = (_d = this.states.configurableRamp) !== null && _d !== void 0 ? _d : getDefaultLineItem(runtimeContext, uiDefinitionProperties);
272
599
  const configurationRequest = this.createRequest(lineItem);
273
600
  configurationRequest.lineItems = this.states.currentState || [];
274
601
  configurationRequest.asset = this.states.asset;
275
- const runtimeModel = (_b = this.runtimeContext) === null || _b === void 0 ? void 0 : _b.runtimeModel;
276
602
  let request$;
277
- if (this.uiDefinitionProperties.pricingEnabled) {
278
- request$ = this.configurationApiService.configureAndPriceLineItem(configurationRequest, this.runtimeModel).pipe(map(({ lineItem, context }) => {
603
+ if (uiDefinitionProperties.pricingEnabled) {
604
+ request$ = this.configurationApiService.configureAndPriceLineItem(configurationRequest, runtimeModel).pipe(map(({ lineItem, context, charges }) => {
279
605
  if (context) {
280
606
  this.contextService.update({ properties: context.properties });
281
607
  }
608
+ this.charges.next(charges !== null && charges !== void 0 ? charges : {});
282
609
  return lineItem;
283
610
  }));
284
611
  }
285
612
  else {
286
613
  request$ = this.configurationApiService.configureLineItem(configurationRequest, runtimeModel);
287
614
  }
288
- return request$.pipe(tap(lineItem => { var _a; return lineItem && ((_a = this.lineItem) === null || _a === void 0 ? void 0 : _a.next(lineItem)); }), catchError(error => throwError(() => { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); })));
615
+ return request$.pipe(tap(lineItem => lineItem && this.lineItem.next(lineItem)), catchError(error => throwError(() => { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); })));
289
616
  }
290
617
  createRequest(lineItem) {
291
618
  var _a, _b, _c;
292
- const runtimeContext = this.runtimeContext;
619
+ const runtimeContext = this.getRuntimeContext();
620
+ const { uiDefinitionProperties } = this.runtimeService;
293
621
  if (runtimeContext.runtimeMode === RuntimeMode.TEST) {
294
- const properties = Object.assign(Object.assign({}, runtimeContext.properties), { ModelId: runtimeContext.modelId, RuntimeMode: ConfigurationContextMode.TEST, PricingEnabled: String(this.uiDefinitionProperties.pricingEnabled), StartDate: (_b = (_a = runtimeContext.properties) === null || _a === void 0 ? void 0 : _a.StartDate) !== null && _b !== void 0 ? _b : new Date().toISOString().substring(0, 10), PriceListId: this.uiDefinitionProperties.priceList });
622
+ const properties = Object.assign(Object.assign({}, runtimeContext.properties), { ModelId: runtimeContext.modelId, RuntimeMode: ConfigurationContextMode.TEST, PricingEnabled: String(uiDefinitionProperties.pricingEnabled), StartDate: (_b = (_a = runtimeContext.properties) === null || _a === void 0 ? void 0 : _a.StartDate) !== null && _b !== void 0 ? _b : new Date().toISOString().substring(0, 10), PriceListId: uiDefinitionProperties.priceList });
295
623
  const ctx = {
296
- priceListId: this.uiDefinitionProperties.priceList,
624
+ priceListId: uiDefinitionProperties.priceList,
297
625
  properties,
298
626
  };
299
627
  this.contextService.update(ctx);
@@ -302,7 +630,8 @@ class ConfigurationService {
302
630
  const context = this.contextService.resolve();
303
631
  if ((context === null || context === void 0 ? void 0 : context.properties) && ((_c = runtimeContext.properties) === null || _c === void 0 ? void 0 : _c.StartDate)) {
304
632
  this.contextService.update({
305
- properties: Object.assign(Object.assign({}, context.properties), runtimeContext.properties),
633
+ priceListId: uiDefinitionProperties.priceList,
634
+ properties: Object.assign(Object.assign(Object.assign({}, context.properties), runtimeContext.properties), { PricingEnabled: String(uiDefinitionProperties.pricingEnabled), PriceListId: uiDefinitionProperties.priceList }),
306
635
  });
307
636
  }
308
637
  }
@@ -315,217 +644,11 @@ class ConfigurationService {
315
644
  };
316
645
  }
317
646
  }
318
- ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, deps: [{ token: i1.ConfigurationApiService }, { token: i2.ContextService }, { token: i1.ConfigurationApiService }, { token: i3.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
319
- ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService });
320
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, decorators: [{
321
- type: Injectable
322
- }], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: i2.ContextService }, { type: i1.ConfigurationApiService }, { type: i3.MessageService }]; } });
323
-
324
- const parsePath = (path) => {
325
- var _a, _b, _c, _d;
326
- const segments = path.split('/');
327
- let module;
328
- let variable;
329
- if ((_a = segments[0]) === null || _a === void 0 ? void 0 : _a.startsWith('@')) {
330
- module = (_b = segments.shift()) === null || _b === void 0 ? void 0 : _b.substring(1);
331
- }
332
- if (((_c = segments[segments.length - 1]) === null || _c === void 0 ? void 0 : _c[0]) === ':') {
333
- variable = (_d = segments.pop()) === null || _d === void 0 ? void 0 : _d.substring(1);
334
- }
335
- return {
336
- segments,
337
- module,
338
- variable,
339
- };
340
- };
341
- const findElementByModule = (elements, module, elementName) => {
342
- for (const el of elements) {
343
- if (el.module === module && el.name === elementName) {
344
- return el;
345
- }
346
- const child = findElementByModule(el.children, module, elementName);
347
- if (child) {
348
- return child;
349
- }
350
- }
351
- return;
352
- };
353
- const getAbsolutePath = (elements, subject, path) => {
354
- var _a, _b, _c, _d;
355
- if (path.module) {
356
- return (_a = findElementByModule(elements, path.module, path.segments[0])) === null || _a === void 0 ? void 0 : _a.path;
357
- }
358
- const subjectSegments = (_c = (_b = subject.path) === null || _b === void 0 ? void 0 : _b.split('/')) !== null && _c !== void 0 ? _c : [];
359
- const isRelativePath = ((_d = path.segments[0]) === null || _d === void 0 ? void 0 : _d[0]) === '.';
360
- if (!isRelativePath) {
361
- return path.segments.join('/');
362
- }
363
- const segments = [...path.segments];
364
- while (segments.length) {
365
- const segment = segments.shift();
366
- if (segment === '..') {
367
- subjectSegments.pop();
368
- }
369
- else if (segment) {
370
- subjectSegments.push(segment);
371
- }
372
- }
373
- return subjectSegments.join('/');
374
- };
375
-
376
- class DynamicModuleService {
377
- constructor() {
378
- this._elementsTree = [];
379
- this._componentFactories = [];
380
- }
381
- set componentFactories(data) {
382
- this._componentFactories = data;
383
- }
384
- get componentFactories() {
385
- return this._componentFactories;
386
- }
387
- getComponentFactory(element) {
388
- return this.componentFactories.find(f => f.componentType.path === element.path);
389
- }
390
- get elementsTree() {
391
- return this._elementsTree;
392
- }
393
- set elementsTree(tree) {
394
- this._elementsTree = tree;
395
- }
396
- clear() {
397
- this._elementsTree = [];
398
- this.componentFactories = [];
399
- }
400
- }
401
- DynamicModuleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DynamicModuleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
402
- DynamicModuleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DynamicModuleService });
403
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DynamicModuleService, decorators: [{
404
- type: Injectable
405
- }] });
406
-
407
- class IOProviderService {
408
- constructor(dynamicModuleService) {
409
- this.dynamicModuleService = dynamicModuleService;
410
- this.inputs = {};
411
- }
412
- connect(el, name, target) {
413
- var _a;
414
- return (_a = this.resolveTarget(el, name, target)) === null || _a === void 0 ? void 0 : _a.asObservable();
415
- }
416
- provide(el, name, target) {
417
- return this.resolveTarget(el, name, target);
418
- }
419
- resolveTarget(el, name, target) {
420
- var _a, _b;
421
- const isHost = !target;
422
- if (isHost) {
423
- return this.createSubjectSafe((_a = el.path) !== null && _a !== void 0 ? _a : '', name);
424
- }
425
- const elPath = parsePath(target);
426
- const pathIsValue = elPath.segments.length === 1 && elPath.segments[0].startsWith('"') && elPath.segments[0].endsWith('"');
427
- const finalName = (_b = elPath.variable) !== null && _b !== void 0 ? _b : name;
428
- const value = pathIsValue ? new BehaviorSubject(elPath.segments[0].slice(1, -1)) : undefined;
429
- const absolutePath = !pathIsValue ? getAbsolutePath(this.dynamicModuleService.elementsTree, el, elPath) : el.path;
430
- return this.createSubjectSafe(absolutePath !== null && absolutePath !== void 0 ? absolutePath : '', finalName, value);
431
- }
432
- createSubjectSafe(path, name, subject) {
433
- if (!this.inputs[path]) {
434
- this.inputs[path] = {};
435
- }
436
- if (!this.inputs[path][name]) {
437
- this.inputs[path][name] = subject !== null && subject !== void 0 ? subject : new BehaviorSubject(undefined);
438
- }
439
- return this.inputs[path][name];
440
- }
441
- }
442
- IOProviderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IOProviderService, deps: [{ token: DynamicModuleService }], target: i0.ɵɵFactoryTarget.Injectable });
443
- IOProviderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IOProviderService });
444
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IOProviderService, decorators: [{
445
- type: Injectable
446
- }], ctorParameters: function () { return [{ type: DynamicModuleService }]; } });
447
-
448
- class TemplatesService {
449
- constructor() {
450
- this.templates = {};
451
- }
452
- register(name, templateRef) {
453
- this.templates[name] = templateRef;
454
- }
455
- get(name) {
456
- return this.templates[name];
457
- }
458
- }
459
- TemplatesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TemplatesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
460
- TemplatesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TemplatesService });
461
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TemplatesService, decorators: [{
462
- type: Injectable
463
- }] });
464
-
465
- const EXPORTED_CLASS_REGEX = /export class (\S+)/;
466
- const METADATA_DECORATOR_REGEX = /@ElementDefinition\(([\s\S]+)\)(\n|.)*export class/g;
467
- const elementToMetadata = (el, parentPath) => {
468
- var _a;
469
- const script = el.script && window.atob(el.script);
470
- const template = el.template && window.atob(el.template);
471
- const styles = el.styles && window.atob(el.styles);
472
- const exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
473
- if (!exportedClassName) {
474
- console.error("Script doesn't have exported class");
475
- }
476
- const elementMetadata = extractElementMetadata(script || '');
477
- const path = (parentPath ? parentPath + '/' : '') + elementMetadata.name;
478
- return Object.assign(Object.assign({}, elementMetadata), { path, script: script === null || script === void 0 ? void 0 : script.replace(METADATA_DECORATOR_REGEX, 'export class'), template,
479
- styles, children: el.children.map(child => elementToMetadata(child, path)) });
480
- };
481
- const metadataToElement = (metadata) => {
482
- const elMetadata = {
483
- name: metadata.name,
484
- type: metadata.type,
485
- model: metadata.model,
486
- module: metadata.module,
487
- reference: metadata.reference,
488
- inputs: metadata.inputs,
489
- outputs: metadata.outputs,
490
- children: metadata.children.map(({ name }) => name),
491
- };
492
- const script = metadata.script &&
493
- window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, `@ElementDefinition(${JSON.stringify(elMetadata)}) export class Script`));
494
- const template = metadata.template && window.btoa(metadata.template);
495
- const styles = metadata.styles && window.btoa(metadata.styles);
496
- return {
497
- script,
498
- template,
499
- styles,
500
- children: metadata.children.map(meta => metadataToElement(meta)),
501
- };
502
- };
503
- const extractElementMetadata = (script) => {
504
- var _a;
505
- const metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
506
- // need to reset regex last index to prevent null result for next execution
507
- METADATA_DECORATOR_REGEX.lastIndex = 0;
508
- return eval(`(${metadataString})`);
509
- };
510
- const extendElementMetadata = (script, extend) => {
511
- var _a;
512
- const metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
513
- // need to reset regex last index to prevent null result for next execution
514
- METADATA_DECORATOR_REGEX.lastIndex = 0;
515
- if (!metadataString) {
516
- return script;
517
- }
518
- const updated = Object.assign(Object.assign({}, eval(`(${metadataString})`)), extend);
519
- return script.replace(metadataString, JSON.stringify(updated));
520
- };
521
-
522
- class ElementContextService {
523
- }
524
- ElementContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementContextService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
525
- ElementContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementContextService });
526
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementContextService, decorators: [{
647
+ ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigurationService, deps: [{ token: ConfigurationRuntimeService }, { token: i2$1.ContextService }, { token: i1.ConfigurationApiService }, { token: i2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
648
+ ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigurationService });
649
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigurationService, decorators: [{
527
650
  type: Injectable
528
- }] });
651
+ }], ctorParameters: function () { return [{ type: ConfigurationRuntimeService }, { type: i2$1.ContextService }, { type: i1.ConfigurationApiService }, { type: i2.MessageService }]; } });
529
652
 
530
653
  class ElementRendererComponent {
531
654
  constructor(parentInjector, dynamicModuleService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
@@ -639,9 +762,9 @@ class ElementRendererComponent {
639
762
  this.refs = {};
640
763
  }
641
764
  }
642
- ElementRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementRendererComponent, deps: [{ token: i0.Injector, skipSelf: true }, { token: DynamicModuleService }, { token: ElementContextService }, { token: IOProviderService }, { token: ConfigurationService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
643
- ElementRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: { meta: "meta" }, providers: [ElementContextService], viewQueries: [{ propertyName: "el", first: true, predicate: ["el"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-template #el></ng-template>\n", styles: [":host{display:contents}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
644
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementRendererComponent, decorators: [{
765
+ ElementRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementRendererComponent, deps: [{ token: i0.Injector, skipSelf: true }, { token: DynamicModuleService }, { token: ElementContextService }, { token: IOProviderService }, { token: ConfigurationService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
766
+ ElementRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: { meta: "meta" }, providers: [ElementContextService], viewQueries: [{ propertyName: "el", first: true, predicate: ["el"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-template #el></ng-template>\n", styles: [":host{display:contents}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
767
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementRendererComponent, decorators: [{
645
768
  type: Component,
646
769
  args: [{
647
770
  selector: 'vl-cms-element-renderer',
@@ -665,9 +788,9 @@ class ElementChildrenComponent {
665
788
  this.metadata = this.elementContext.metadata;
666
789
  }
667
790
  }
668
- ElementChildrenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementChildrenComponent, deps: [{ token: ElementContextService }], target: i0.ɵɵFactoryTarget.Component });
669
- ElementChildrenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: ElementChildrenComponent, selector: "element-children", ngImport: i0, template: "<ng-container *ngIf=\"metadata?.children.length\">\n <ng-container *ngFor=\"let child of metadata.children\">\n <vl-cms-element-renderer [meta]=\"child\"></vl-cms-element-renderer>\n </ng-container>\n</ng-container>\n", styles: [":host{display:contents}\n"], components: [{ type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
670
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementChildrenComponent, decorators: [{
791
+ ElementChildrenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementChildrenComponent, deps: [{ token: ElementContextService }], target: i0.ɵɵFactoryTarget.Component });
792
+ ElementChildrenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ElementChildrenComponent, selector: "element-children", ngImport: i0, template: "<ng-container *ngIf=\"metadata?.children.length\">\n <ng-container *ngFor=\"let child of metadata.children\">\n <vl-cms-element-renderer [meta]=\"child\"></vl-cms-element-renderer>\n </ng-container>\n</ng-container>\n", styles: [":host{display:contents}\n"], components: [{ type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
793
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementChildrenComponent, decorators: [{
671
794
  type: Component,
672
795
  args: [{
673
796
  // eslint-disable-next-line @angular-eslint/component-selector
@@ -691,9 +814,9 @@ class CustomTemplateDirective {
691
814
  this.templatesService.register(this.customTemplate, this.templateRef);
692
815
  }
693
816
  }
694
- CustomTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CustomTemplateDirective, deps: [{ token: i0.TemplateRef }, { token: TemplatesService }], target: i0.ɵɵFactoryTarget.Directive });
695
- CustomTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0 });
696
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CustomTemplateDirective, decorators: [{
817
+ CustomTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomTemplateDirective, deps: [{ token: i0.TemplateRef }, { token: TemplatesService }], target: i0.ɵɵFactoryTarget.Directive });
818
+ CustomTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0 });
819
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CustomTemplateDirective, decorators: [{
697
820
  type: Directive,
698
821
  args: [{ selector: '[customTemplate]' }]
699
822
  }], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: TemplatesService }]; }, propDecorators: { customTemplate: [{
@@ -784,15 +907,16 @@ class ConfigurationPlugin {
784
907
  return this.host;
785
908
  }
786
909
  }
787
- ConfigurationPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationPlugin, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
788
- ConfigurationPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: ConfigurationPlugin, ngImport: i0 });
789
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationPlugin, decorators: [{
910
+ ConfigurationPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigurationPlugin, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
911
+ ConfigurationPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: ConfigurationPlugin, ngImport: i0 });
912
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigurationPlugin, decorators: [{
790
913
  type: Directive
791
914
  }], ctorParameters: function () { return [{ type: undefined }]; } });
792
915
 
793
916
  var vlCmsModules = /*#__PURE__*/Object.freeze({
794
917
  __proto__: null,
795
918
  getDefaultLineItem: getDefaultLineItem,
919
+ ConfigurationRuntimeService: ConfigurationRuntimeService,
796
920
  ConfigurationService: ConfigurationService
797
921
  });
798
922
 
@@ -868,9 +992,9 @@ class ScriptPlugin {
868
992
  this.document.body.removeChild(script);
869
993
  }
870
994
  }
871
- ScriptPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ScriptPlugin, deps: [{ token: ElementComponent }], target: i0.ɵɵFactoryTarget.Directive });
872
- ScriptPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: ScriptPlugin, ngImport: i0 });
873
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ScriptPlugin, decorators: [{
995
+ ScriptPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ScriptPlugin, deps: [{ token: ElementComponent }], target: i0.ɵɵFactoryTarget.Directive });
996
+ ScriptPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: ScriptPlugin, ngImport: i0 });
997
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ScriptPlugin, decorators: [{
874
998
  type: Directive
875
999
  }], ctorParameters: function () { return [{ type: ElementComponent }]; } });
876
1000
 
@@ -905,9 +1029,9 @@ class IOPlugin {
905
1029
  });
906
1030
  }
907
1031
  }
908
- IOPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IOPlugin, deps: [{ token: ElementComponent }], target: i0.ɵɵFactoryTarget.Directive });
909
- IOPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: IOPlugin, ngImport: i0 });
910
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IOPlugin, decorators: [{
1032
+ IOPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: IOPlugin, deps: [{ token: ElementComponent }], target: i0.ɵɵFactoryTarget.Directive });
1033
+ IOPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: IOPlugin, ngImport: i0 });
1034
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: IOPlugin, decorators: [{
911
1035
  type: Directive
912
1036
  }], ctorParameters: function () { return [{ type: ElementComponent }]; } });
913
1037
 
@@ -1093,9 +1217,9 @@ class FederatedComponent {
1093
1217
  this.instance.ngOnChanges(changes);
1094
1218
  }
1095
1219
  }
1096
- FederatedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedComponent, deps: [{ token: i0.Injector }, { token: i0.Compiler }, { token: i0.ApplicationRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
1097
- FederatedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", eventData: "eventData" }, outputs: { integrationEvent: "integrationEvent" }, viewQueries: [{ propertyName: "federatedComponent", first: true, predicate: ["federatedComponent"], descendants: true, read: ViewContainerRef }, { propertyName: "foo", first: true, predicate: ["foo"], descendants: true, read: TemplateRef }, { propertyName: "moduleHostRef", first: true, predicate: ["moduleHost"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #moduleHost></div>\n", styles: [":host{display:block}div{height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1098
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedComponent, decorators: [{
1220
+ FederatedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FederatedComponent, deps: [{ token: i0.Injector }, { token: i0.Compiler }, { token: i0.ApplicationRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
1221
+ FederatedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", eventData: "eventData" }, outputs: { integrationEvent: "integrationEvent" }, viewQueries: [{ propertyName: "federatedComponent", first: true, predicate: ["federatedComponent"], descendants: true, read: ViewContainerRef }, { propertyName: "foo", first: true, predicate: ["foo"], descendants: true, read: TemplateRef }, { propertyName: "moduleHostRef", first: true, predicate: ["moduleHost"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #moduleHost></div>\n", styles: [":host{display:block}div{height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1222
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FederatedComponent, decorators: [{
1099
1223
  type: Component,
1100
1224
  args: [{
1101
1225
  // eslint-disable-next-line @angular-eslint/component-selector
@@ -1129,10 +1253,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
1129
1253
 
1130
1254
  class FederatedModule {
1131
1255
  }
1132
- FederatedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1133
- FederatedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule, declarations: [FederatedComponent], exports: [FederatedComponent] });
1134
- FederatedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule });
1135
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule, decorators: [{
1256
+ FederatedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FederatedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1257
+ FederatedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FederatedModule, declarations: [FederatedComponent], exports: [FederatedComponent] });
1258
+ FederatedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FederatedModule });
1259
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FederatedModule, decorators: [{
1136
1260
  type: NgModule,
1137
1261
  args: [{
1138
1262
  declarations: [FederatedComponent],
@@ -1178,17 +1302,18 @@ class LauncherService {
1178
1302
  return DynamicModule;
1179
1303
  }
1180
1304
  }
1181
- LauncherService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherService, deps: [{ token: i0.Compiler }, { token: DynamicModuleService }], target: i0.ɵɵFactoryTarget.Injectable });
1182
- LauncherService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherService });
1183
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherService, decorators: [{
1305
+ LauncherService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LauncherService, deps: [{ token: i0.Compiler }, { token: DynamicModuleService }], target: i0.ɵɵFactoryTarget.Injectable });
1306
+ LauncherService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LauncherService });
1307
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LauncherService, decorators: [{
1184
1308
  type: Injectable
1185
1309
  }], ctorParameters: function () { return [{ type: i0.Compiler }, { type: DynamicModuleService }]; } });
1186
1310
 
1187
1311
  class PreviewComponent {
1188
- constructor(launcherService, configurationService, messageService) {
1312
+ constructor(launcherService, configurationService, messageService, runtimeService) {
1189
1313
  this.launcherService = launcherService;
1190
1314
  this.configurationService = configurationService;
1191
1315
  this.messageService = messageService;
1316
+ this.runtimeService = runtimeService;
1192
1317
  this.state$ = new BehaviorSubject({ loading: true, failure: false });
1193
1318
  this.elements = [];
1194
1319
  this.destroy$ = new Subject();
@@ -1200,23 +1325,30 @@ class PreviewComponent {
1200
1325
  this.destroy$.next();
1201
1326
  this.destroy$.complete();
1202
1327
  }
1203
- startPreview() {
1328
+ initializeConfiguration$() {
1204
1329
  var _a;
1330
+ const isAlreadyInitialized = this.runtimeService.isInitialized;
1331
+ if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
1332
+ return of({});
1333
+ }
1334
+ if (!this.modelId) {
1335
+ console.warn(`No modelId is given for uiDefinition with '${this.uiDefinition.type}' type`);
1336
+ return of({});
1337
+ }
1338
+ // If still not initialized - init configuration in Test mode
1339
+ const uiDefinitionProps = (_a = this.uiDefinition.properties) !== null && _a !== void 0 ? _a : {};
1340
+ return this.runtimeService
1341
+ .initTestMode(this.modelId, uiDefinitionProps)
1342
+ .pipe(switchMap(() => this.configurationService.configure()));
1343
+ }
1344
+ startPreview() {
1205
1345
  if (!this.uiDefinition) {
1206
1346
  return;
1207
1347
  }
1208
- const _b = this.uiDefinition, { children } = _b, uiDefinitionMeta = __rest(_b, ["children"]);
1348
+ const _a = this.uiDefinition, { children } = _a, uiDefinitionMeta = __rest(_a, ["children"]);
1209
1349
  this.elements = children.map(child => elementToMetadata(child));
1210
- const initializers = [this.launcherService.compileModule(this.elements, uiDefinitionMeta)];
1211
- if (this.uiDefinition.type === 'CONFIGURATION') {
1212
- if (!this.modelId) {
1213
- console.warn(`No modelId is given for uiDefinition with '${this.uiDefinition.type}' type`);
1214
- return;
1215
- }
1216
- const uiDefinitionProps = (_a = this.uiDefinition.properties) !== null && _a !== void 0 ? _a : {};
1217
- initializers.push(this.configurationService.init(this.modelId, uiDefinitionProps));
1218
- }
1219
- forkJoin(initializers)
1350
+ const compilation$ = this.launcherService.compileModule(this.elements, uiDefinitionMeta);
1351
+ forkJoin([compilation$, this.initializeConfiguration$()])
1220
1352
  .pipe(tap$1(() => this.state$.next({ loading: false, failure: false })), catchError$1(error => {
1221
1353
  this.messageService.add({
1222
1354
  severity: 'error',
@@ -1228,18 +1360,18 @@ class PreviewComponent {
1228
1360
  .subscribe();
1229
1361
  }
1230
1362
  }
1231
- PreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewComponent, deps: [{ token: LauncherService }, { token: ConfigurationService }, { token: i3.MessageService }], target: i0.ɵɵFactoryTarget.Component });
1232
- PreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition" }, providers: [IOProviderService, ConfigurationService, TemplatesService], ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-element-renderer *ngFor=\"let el of elements\" [meta]=\"el\"></vl-cms-element-renderer>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [":host{flex-grow:1;display:flex;flex-direction:column;height:100%}\n"], components: [{ type: i4.LoaderComponent, selector: "vl-loader", inputs: ["label"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i6.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1233
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewComponent, decorators: [{
1363
+ PreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PreviewComponent, deps: [{ token: LauncherService }, { token: ConfigurationService }, { token: i2.MessageService }, { token: ConfigurationRuntimeService }], target: i0.ɵɵFactoryTarget.Component });
1364
+ PreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition" }, providers: [IOProviderService, TemplatesService], ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-element-renderer *ngFor=\"let el of elements\" [meta]=\"el\"></vl-cms-element-renderer>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [":host{flex-grow:1;display:flex;flex-direction:column;height:100%}\n"], components: [{ type: i5.LoaderComponent, selector: "vl-loader", inputs: ["label"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i7.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1365
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PreviewComponent, decorators: [{
1234
1366
  type: Component,
1235
1367
  args: [{
1236
1368
  selector: 'vl-cms-preview',
1237
1369
  templateUrl: './preview.component.html',
1238
1370
  styleUrls: ['./preview.component.scss'],
1239
1371
  changeDetection: ChangeDetectionStrategy.OnPush,
1240
- providers: [IOProviderService, ConfigurationService, TemplatesService],
1372
+ providers: [IOProviderService, TemplatesService],
1241
1373
  }]
1242
- }], ctorParameters: function () { return [{ type: LauncherService }, { type: ConfigurationService }, { type: i3.MessageService }]; }, propDecorators: { modelId: [{
1374
+ }], ctorParameters: function () { return [{ type: LauncherService }, { type: ConfigurationService }, { type: i2.MessageService }, { type: ConfigurationRuntimeService }]; }, propDecorators: { modelId: [{
1243
1375
  type: Input
1244
1376
  }], uiDefinition: [{
1245
1377
  type: Input
@@ -1247,10 +1379,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
1247
1379
 
1248
1380
  class ElementRendererModule {
1249
1381
  }
1250
- ElementRendererModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementRendererModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1251
- ElementRendererModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementRendererModule, declarations: [ElementRendererComponent], exports: [ElementRendererComponent] });
1252
- ElementRendererModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementRendererModule });
1253
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementRendererModule, decorators: [{
1382
+ ElementRendererModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementRendererModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1383
+ ElementRendererModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementRendererModule, declarations: [ElementRendererComponent], exports: [ElementRendererComponent] });
1384
+ ElementRendererModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementRendererModule });
1385
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementRendererModule, decorators: [{
1254
1386
  type: NgModule,
1255
1387
  args: [{
1256
1388
  declarations: [ElementRendererComponent],
@@ -1260,10 +1392,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
1260
1392
 
1261
1393
  class ElementChildrenModule {
1262
1394
  }
1263
- ElementChildrenModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementChildrenModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1264
- ElementChildrenModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementChildrenModule, declarations: [ElementChildrenComponent], imports: [ElementRendererModule], exports: [ElementChildrenComponent] });
1265
- ElementChildrenModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementChildrenModule, imports: [[ElementRendererModule]] });
1266
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementChildrenModule, decorators: [{
1395
+ ElementChildrenModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementChildrenModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1396
+ ElementChildrenModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementChildrenModule, declarations: [ElementChildrenComponent], imports: [ElementRendererModule], exports: [ElementChildrenComponent] });
1397
+ ElementChildrenModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementChildrenModule, imports: [[ElementRendererModule]] });
1398
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ElementChildrenModule, decorators: [{
1267
1399
  type: NgModule,
1268
1400
  args: [{
1269
1401
  declarations: [ElementChildrenComponent],
@@ -1274,10 +1406,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
1274
1406
 
1275
1407
  class PreviewModule {
1276
1408
  }
1277
- PreviewModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1278
- PreviewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewModule, declarations: [PreviewComponent], imports: [CommonModule, LoaderModule, ElementRendererModule, ElementChildrenModule], exports: [PreviewComponent] });
1279
- PreviewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewModule, imports: [[CommonModule, LoaderModule, ElementRendererModule, ElementChildrenModule]] });
1280
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewModule, decorators: [{
1409
+ PreviewModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PreviewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1410
+ PreviewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PreviewModule, declarations: [PreviewComponent], imports: [CommonModule, LoaderModule, ElementRendererModule, ElementChildrenModule], exports: [PreviewComponent] });
1411
+ PreviewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PreviewModule, imports: [[CommonModule, LoaderModule, ElementRendererModule, ElementChildrenModule]] });
1412
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: PreviewModule, decorators: [{
1281
1413
  type: NgModule,
1282
1414
  args: [{
1283
1415
  declarations: [PreviewComponent],
@@ -1294,22 +1426,38 @@ function ElementDefinition(definition) {
1294
1426
 
1295
1427
  class ConfigurationModule {
1296
1428
  }
1297
- ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1298
- ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule });
1299
- ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, providers: [ContextService, ContextApiService, ProductModelApiService, ConfigurationApiService] });
1300
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, decorators: [{
1429
+ ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1430
+ ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigurationModule });
1431
+ ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigurationModule, providers: [
1432
+ ContextService,
1433
+ ContextApiService,
1434
+ ProductModelApiService,
1435
+ ConfigurationApiService,
1436
+ ConfigurationRuntimeService,
1437
+ RuntimeContextService,
1438
+ ConfigurationService,
1439
+ ] });
1440
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ConfigurationModule, decorators: [{
1301
1441
  type: NgModule,
1302
1442
  args: [{
1303
- providers: [ContextService, ContextApiService, ProductModelApiService, ConfigurationApiService],
1443
+ providers: [
1444
+ ContextService,
1445
+ ContextApiService,
1446
+ ProductModelApiService,
1447
+ ConfigurationApiService,
1448
+ ConfigurationRuntimeService,
1449
+ RuntimeContextService,
1450
+ ConfigurationService,
1451
+ ],
1304
1452
  }]
1305
1453
  }] });
1306
1454
 
1307
1455
  class LauncherModule {
1308
1456
  }
1309
- LauncherModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1310
- LauncherModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherModule, imports: [CommonModule, CoreModule, ConfigurationModule] });
1311
- LauncherModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherModule, providers: [LauncherService, DynamicModuleService, SalesforceApiService, QuoteApiService], imports: [[CommonModule, CoreModule, ConfigurationModule]] });
1312
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherModule, decorators: [{
1457
+ LauncherModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LauncherModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1458
+ LauncherModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LauncherModule, imports: [CommonModule, CoreModule, ConfigurationModule] });
1459
+ LauncherModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LauncherModule, providers: [LauncherService, DynamicModuleService, SalesforceApiService, QuoteApiService], imports: [[CommonModule, CoreModule, ConfigurationModule]] });
1460
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: LauncherModule, decorators: [{
1313
1461
  type: NgModule,
1314
1462
  args: [{
1315
1463
  imports: [CommonModule, CoreModule, ConfigurationModule],
@@ -1321,5 +1469,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImpo
1321
1469
  * Generated bundle index. Do not edit.
1322
1470
  */
1323
1471
 
1324
- export { ConfigurationService, DEFAULT_PLUGINS_TOKEN, ELEMENT_CONFIG, ELEMENT_METADATA, ElementComponent, ElementDefinition, LauncherModule, LauncherService, LineItemWorker, PreviewComponent, PreviewModule, SHARED_ELEMENT_METADATA, TemplatesService, UI_DEFINITION_METADATA, elementToMetadata, extendElementMetadata, extractElementMetadata, findLineItem, generateLineItem, getAttributeValue, getAttributes, getDefaultLineItem, getRecommendedPrices, insertLineItem, mapAttributes, metadataToElement, parseBoundPath, patchAttributes, removeLineItem, replaceLineItem, upsertAttributes };
1472
+ export { ConfigurationRuntimeService, ConfigurationService, DEFAULT_PLUGINS_TOKEN, ELEMENT_CONFIG, ELEMENT_METADATA, ElementComponent, ElementDefinition, LauncherModule, LauncherService, LineItemWorker, PreviewComponent, PreviewModule, SHARED_ELEMENT_METADATA, TemplatesService, UI_DEFINITION_METADATA, elementToMetadata, extendElementMetadata, extractElementMetadata, findLineItem, generateLineItem, getAttributeValue, getAttributes, getDefaultLineItem, getRecommendedPrices, insertLineItem, mapAttributes, metadataToElement, parseBoundPath, patchAttributes, removeLineItem, replaceLineItem, upsertAttributes };
1325
1473
  //# sourceMappingURL=veloce-sdk-cms.js.map