@veloceapps/sdk 6.0.0-10 → 6.0.0-101

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 (241) hide show
  1. package/README.md +10 -2
  2. package/bundles/veloceapps-sdk-cms.umd.js +1269 -798
  3. package/bundles/veloceapps-sdk-cms.umd.js.map +1 -1
  4. package/bundles/veloceapps-sdk-core.umd.js +783 -650
  5. package/bundles/veloceapps-sdk-core.umd.js.map +1 -1
  6. package/bundles/veloceapps-sdk-runtime.umd.js +216 -150
  7. package/bundles/veloceapps-sdk-runtime.umd.js.map +1 -1
  8. package/bundles/veloceapps-sdk.umd.js +582 -310
  9. package/bundles/veloceapps-sdk.umd.js.map +1 -1
  10. package/cms/cms.actions.d.ts +2 -4
  11. package/cms/components/element-children/element-children.component.d.ts +13 -3
  12. package/cms/components/element-children/element-children.module.d.ts +4 -2
  13. package/cms/components/element-drop-handle/element-drop-handle.component.d.ts +12 -0
  14. package/cms/components/element-drop-handle/element-drop-handle.module.d.ts +9 -0
  15. package/cms/components/element-renderer/element-renderer.component.d.ts +3 -3
  16. package/cms/components/preview/index.d.ts +1 -0
  17. package/cms/components/preview/preview.component.d.ts +9 -8
  18. package/cms/components/preview/preview.module.d.ts +2 -1
  19. package/cms/components/preview/preview.types.d.ts +11 -0
  20. package/cms/index.d.ts +2 -0
  21. package/cms/launcher.module.d.ts +3 -1
  22. package/cms/modules/migrations/index.d.ts +2 -0
  23. package/cms/modules/migrations/migrations.d.ts +2 -0
  24. package/cms/modules/migrations/migrations.module.d.ts +6 -0
  25. package/cms/modules/migrations/services/migrations.service.d.ts +10 -0
  26. package/cms/modules/migrations/types/migrations.types.d.ts +2 -0
  27. package/cms/modules/runtime/index.d.ts +2 -0
  28. package/cms/modules/runtime/runtime.module.d.ts +8 -0
  29. package/cms/modules/runtime/services/compilation.service.d.ts +18 -0
  30. package/cms/modules/runtime/services/runtime-editor.service.d.ts +18 -0
  31. package/cms/modules/runtime/services/runtime.service.d.ts +27 -0
  32. package/cms/modules/runtime/tokens.d.ts +3 -0
  33. package/cms/{types → modules/runtime/types}/compilation.types.d.ts +1 -1
  34. package/cms/modules/runtime/types/runtime.actions.d.ts +9 -0
  35. package/cms/services/index.d.ts +1 -1
  36. package/cms/services/integration.state.d.ts +2 -3
  37. package/cms/services/io-provider.service.d.ts +3 -3
  38. package/cms/services/resources.service.d.ts +10 -0
  39. package/cms/types/common.types.d.ts +1 -1
  40. package/cms/types/configuration.types.d.ts +1 -0
  41. package/cms/types/index.d.ts +1 -1
  42. package/cms/types/integration.types.d.ts +5 -0
  43. package/cms/utils/elements-resolver.d.ts +3 -2
  44. package/cms/utils/index.d.ts +1 -0
  45. package/cms/utils/path.utils.d.ts +0 -1
  46. package/cms/utils/ui-definition.utils.d.ts +6 -0
  47. package/cms/vendor-map.d.ts +52 -31
  48. package/core/modules/configuration/services/configuration-runtime.service.d.ts +2 -4
  49. package/core/modules/configuration/services/configuration.service.d.ts +6 -4
  50. package/core/modules/configuration/types/configuration-runtime.types.d.ts +0 -2
  51. package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +3 -2
  52. package/core/modules/flow-configuration/services/flow-update.service.d.ts +3 -2
  53. package/core/services/context.service.d.ts +1 -0
  54. package/core/services/metric-calculation/metric-calculation.service.d.ts +5 -1
  55. package/core/services/quote-draft.service.d.ts +2 -2
  56. package/core/types/index.d.ts +0 -1
  57. package/core/types/ui-definition.types.d.ts +19 -4
  58. package/core/utils/index.d.ts +1 -0
  59. package/core/utils/line-item.utils.d.ts +3 -0
  60. package/core/utils/ui-definition.utils.d.ts +2 -0
  61. package/esm2015/cms/cms.actions.js +1 -6
  62. package/esm2015/cms/components/element-children/element-children.component.js +24 -8
  63. package/esm2015/cms/components/element-children/element-children.module.js +8 -6
  64. package/esm2015/cms/components/element-drop-handle/element-drop-handle.component.js +32 -0
  65. package/esm2015/cms/components/element-drop-handle/element-drop-handle.module.js +19 -0
  66. package/esm2015/cms/components/element-renderer/element-renderer.component.js +9 -9
  67. package/esm2015/cms/components/element-renderer/element-renderer.module.js +4 -4
  68. package/esm2015/cms/components/plugin.component.js +3 -3
  69. package/esm2015/cms/components/preview/index.js +2 -1
  70. package/esm2015/cms/components/preview/preview.component.js +21 -36
  71. package/esm2015/cms/components/preview/preview.module.js +7 -6
  72. package/esm2015/cms/components/preview/preview.types.js +2 -0
  73. package/esm2015/cms/directives/custom-template.directive.js +3 -3
  74. package/esm2015/cms/index.js +3 -1
  75. package/esm2015/cms/launcher.module.js +11 -10
  76. package/esm2015/cms/modules/federated/federated.component.js +3 -3
  77. package/esm2015/cms/modules/federated/federated.module.js +4 -4
  78. package/esm2015/cms/modules/migrations/index.js +3 -0
  79. package/esm2015/cms/modules/migrations/migrations.js +11 -0
  80. package/esm2015/cms/modules/migrations/migrations.module.js +15 -0
  81. package/esm2015/cms/modules/migrations/services/migrations.service.js +43 -0
  82. package/esm2015/cms/modules/migrations/types/migrations.types.js +2 -0
  83. package/esm2015/cms/modules/runtime/index.js +3 -0
  84. package/esm2015/cms/modules/runtime/runtime.module.js +32 -0
  85. package/esm2015/cms/modules/runtime/services/compilation.service.js +84 -0
  86. package/esm2015/cms/modules/runtime/services/runtime-editor.service.js +27 -0
  87. package/esm2015/cms/modules/runtime/services/runtime.service.js +74 -0
  88. package/esm2015/cms/modules/runtime/tokens.js +3 -0
  89. package/esm2015/cms/modules/runtime/types/compilation.types.js +2 -0
  90. package/esm2015/cms/modules/runtime/types/runtime.actions.js +2 -0
  91. package/esm2015/cms/plugins/configuration.plugin.js +12 -4
  92. package/esm2015/cms/plugins/io.plugin.js +3 -3
  93. package/esm2015/cms/plugins/script.plugin.js +3 -3
  94. package/esm2015/cms/services/element-context.service.js +3 -3
  95. package/esm2015/cms/services/index.js +2 -2
  96. package/esm2015/cms/services/integration.state.js +4 -4
  97. package/esm2015/cms/services/io-provider.service.js +9 -9
  98. package/esm2015/cms/services/resources.service.js +50 -0
  99. package/esm2015/cms/services/templates.service.js +3 -3
  100. package/esm2015/cms/types/common.types.js +1 -1
  101. package/esm2015/cms/types/configuration.types.js +1 -1
  102. package/esm2015/cms/types/index.js +2 -2
  103. package/esm2015/cms/types/integration.types.js +1 -1
  104. package/esm2015/cms/utils/elements-resolver.js +18 -8
  105. package/esm2015/cms/utils/index.js +2 -1
  106. package/esm2015/cms/utils/path.utils.js +2 -13
  107. package/esm2015/cms/utils/ui-definition.utils.js +82 -0
  108. package/esm2015/cms/vendor-map.js +26 -10
  109. package/esm2015/core/core.module.js +4 -4
  110. package/esm2015/core/modules/configuration/configuration.module.js +4 -4
  111. package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +5 -10
  112. package/esm2015/core/modules/configuration/services/configuration.service.js +38 -34
  113. package/esm2015/core/modules/configuration/services/runtime-context.service.js +3 -3
  114. package/esm2015/core/modules/configuration/types/configuration-runtime.types.js +1 -1
  115. package/esm2015/core/modules/flow-configuration/flow-configuration.module.js +4 -4
  116. package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +11 -10
  117. package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +9 -9
  118. package/esm2015/core/services/context.service.js +7 -4
  119. package/esm2015/core/services/metric-calculation/metric-calculation.service.js +18 -9
  120. package/esm2015/core/services/product-images.service.js +3 -3
  121. package/esm2015/core/services/quote-draft.service.js +7 -7
  122. package/esm2015/core/types/index.js +1 -2
  123. package/esm2015/core/types/ui-definition.types.js +2 -2
  124. package/esm2015/core/utils/index.js +2 -1
  125. package/esm2015/core/utils/line-item.utils.js +43 -11
  126. package/esm2015/core/utils/ui-definition.utils.js +9 -0
  127. package/esm2015/runtime/components/component-preview/component-preview.component.js +4 -4
  128. package/esm2015/runtime/components/section-renderer/section-renderer.component.js +3 -3
  129. package/esm2015/runtime/components/ui-runtime/runtime.component.js +3 -3
  130. package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +3 -3
  131. package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +6 -6
  132. package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +3 -3
  133. package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +3 -3
  134. package/esm2015/runtime/execution/components/federated/federated.component.js +3 -3
  135. package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +3 -3
  136. package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +3 -3
  137. package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +3 -3
  138. package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +3 -3
  139. package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +3 -3
  140. package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +3 -3
  141. package/esm2015/runtime/execution/directives/section-script.directive.js +3 -3
  142. package/esm2015/runtime/execution/directives/sf-query.directive.js +3 -3
  143. package/esm2015/runtime/execution/directives/velo-attribute.directive.js +3 -3
  144. package/esm2015/runtime/execution/directives/velo-port.directive.js +18 -18
  145. package/esm2015/runtime/execution/directives/vl-approval.directive.js +3 -3
  146. package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +3 -3
  147. package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +3 -3
  148. package/esm2015/runtime/execution/directives/vl-quote.directive.js +4 -4
  149. package/esm2015/runtime/execution/directives/vl-ramp.directive.js +3 -3
  150. package/esm2015/runtime/execution/runtime-execution.module.js +4 -4
  151. package/esm2015/runtime/runtime.module.js +4 -4
  152. package/esm2015/runtime/services/cart.service.js +3 -3
  153. package/esm2015/runtime/services/collapsible-state.service.js +3 -3
  154. package/esm2015/runtime/services/configuration.service.js +11 -12
  155. package/esm2015/runtime/services/current-state.service.js +3 -3
  156. package/esm2015/runtime/services/form-scope.service.js +3 -3
  157. package/esm2015/runtime/services/product-model-cache.service.js +3 -3
  158. package/esm2015/runtime/services/runtime-context.service.js +3 -3
  159. package/esm2015/runtime/services/runtime-form.service.js +3 -3
  160. package/esm2015/runtime/services/runtime.service.js +4 -4
  161. package/esm2015/runtime/services/section-helper.service.js +3 -3
  162. package/esm2015/runtime/services/section-scope.service.js +3 -3
  163. package/esm2015/runtime/services/section-store.service.js +3 -3
  164. package/esm2015/runtime/services/section.service.js +6 -6
  165. package/esm2015/runtime/types/index.js +2 -1
  166. package/esm2015/runtime/types/quote-states.types.js +2 -0
  167. package/esm2015/src/components/dialog/dialog.component.js +16 -6
  168. package/esm2015/src/components/dialog/dialog.module.js +4 -4
  169. package/esm2015/src/components/dialog/dialog.types.js +1 -1
  170. package/esm2015/src/components/doc-gen/doc-gen.component.js +3 -3
  171. package/esm2015/src/components/doc-gen/doc-gen.module.js +4 -4
  172. package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +3 -3
  173. package/esm2015/src/components/header/cart-overlay/cart-preview.module.js +4 -4
  174. package/esm2015/src/components/header/header.component.js +39 -13
  175. package/esm2015/src/components/header/header.module.js +4 -4
  176. package/esm2015/src/components/header/metrics/metrics.component.js +79 -67
  177. package/esm2015/src/components/header/metrics/metrics.definitions.js +1 -8
  178. package/esm2015/src/components/header/metrics/metrics.module.js +4 -4
  179. package/esm2015/src/flow-routing.module.js +18 -5
  180. package/esm2015/src/flow.component.js +3 -3
  181. package/esm2015/src/flow.module.js +4 -4
  182. package/esm2015/src/guards/context.guard.js +3 -3
  183. package/esm2015/src/guards/product-unload.guard.js +5 -5
  184. package/esm2015/src/guards/root.guard.js +3 -3
  185. package/esm2015/src/pages/assets/assets.component.js +117 -0
  186. package/esm2015/src/pages/assets/assets.module.js +20 -0
  187. package/esm2015/src/pages/catalog/catalog.component.js +6 -6
  188. package/esm2015/src/pages/catalog/catalog.module.js +4 -4
  189. package/esm2015/src/pages/debug/debug.component.js +3 -3
  190. package/esm2015/src/pages/debug/debug.module.js +4 -4
  191. package/esm2015/src/pages/empty-account/empty-account.component.js +3 -3
  192. package/esm2015/src/pages/empty-account/empty-account.module.js +4 -4
  193. package/esm2015/src/pages/legacy-product/legacy-product.component.js +4 -4
  194. package/esm2015/src/pages/legacy-product/legacy-product.module.js +4 -4
  195. package/esm2015/src/pages/product/product.component.js +5 -12
  196. package/esm2015/src/pages/product/product.module.js +4 -4
  197. package/esm2015/src/pages/record-not-found/record-not-found.component.js +3 -3
  198. package/esm2015/src/pages/record-not-found/record-not-found.module.js +4 -4
  199. package/esm2015/src/pages/remote/remote.component.js +5 -8
  200. package/esm2015/src/pages/remote/remote.module.js +4 -4
  201. package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +6 -6
  202. package/esm2015/src/pages/shopping-cart/shopping-cart.module.js +4 -4
  203. package/esm2015/src/resolvers/flow.resolver.js +3 -3
  204. package/esm2015/src/resolvers/quote.resolver.js +28 -14
  205. package/esm2015/src/services/doc-gen.service.js +3 -3
  206. package/esm2015/src/services/flow-dialog.service.js +5 -4
  207. package/esm2015/src/services/flow-router.service.js +12 -4
  208. package/esm2015/src/services/flow.service.js +12 -5
  209. package/esm2015/src/types/flow-customization.types.js +1 -1
  210. package/esm2015/src/utils/flow.utils.js +3 -3
  211. package/fesm2015/veloceapps-sdk-cms.js +1073 -718
  212. package/fesm2015/veloceapps-sdk-cms.js.map +1 -1
  213. package/fesm2015/veloceapps-sdk-core.js +574 -520
  214. package/fesm2015/veloceapps-sdk-core.js.map +1 -1
  215. package/fesm2015/veloceapps-sdk-runtime.js +145 -146
  216. package/fesm2015/veloceapps-sdk-runtime.js.map +1 -1
  217. package/fesm2015/veloceapps-sdk.js +455 -264
  218. package/fesm2015/veloceapps-sdk.js.map +1 -1
  219. package/package.json +5 -3
  220. package/runtime/services/configuration.service.d.ts +2 -1
  221. package/runtime/services/runtime.service.d.ts +2 -1
  222. package/runtime/types/index.d.ts +1 -0
  223. package/src/components/dialog/dialog.types.d.ts +1 -0
  224. package/src/components/header/header.component.d.ts +10 -3
  225. package/src/components/header/metrics/metrics.component.d.ts +15 -6
  226. package/src/components/header/metrics/metrics.definitions.d.ts +0 -3
  227. package/src/flow-routing.module.d.ts +4 -3
  228. package/src/pages/assets/assets.component.d.ts +32 -0
  229. package/src/pages/assets/assets.module.d.ts +10 -0
  230. package/src/pages/product/product.component.d.ts +0 -1
  231. package/src/resolvers/quote.resolver.d.ts +5 -1
  232. package/src/services/flow-router.service.d.ts +2 -0
  233. package/src/services/flow.service.d.ts +1 -0
  234. package/src/types/flow-customization.types.d.ts +1 -0
  235. package/cms/services/dynamic-module.service.d.ts +0 -15
  236. package/cms/services/launcher.service.d.ts +0 -18
  237. package/esm2015/cms/services/dynamic-module.service.js +0 -33
  238. package/esm2015/cms/services/launcher.service.js +0 -58
  239. package/esm2015/cms/types/compilation.types.js +0 -2
  240. package/esm2015/core/types/quote-states.types.js +0 -2
  241. /package/{core → runtime}/types/quote-states.types.d.ts +0 -0
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('lodash'), require('@angular/common'), require('@veloceapps/core'), require('@angular/cdk/drag-drop'), require('@angular/cdk/scrolling'), require('@angular/forms'), require('@veloceapps/sdk/core'), require('@veloceapps/components'), require('@babel/standalone'), require('@veloceapps/api'), require('rxjs/operators'), require('primeng/api'), require('primeng/dynamicdialog')) :
3
- typeof define === 'function' && define.amd ? define('@veloceapps/sdk/cms', ['exports', '@angular/core', 'rxjs', 'lodash', '@angular/common', '@veloceapps/core', '@angular/cdk/drag-drop', '@angular/cdk/scrolling', '@angular/forms', '@veloceapps/sdk/core', '@veloceapps/components', '@babel/standalone', '@veloceapps/api', 'rxjs/operators', 'primeng/api', 'primeng/dynamicdialog'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloceapps = global.veloceapps || {}, global.veloceapps.sdk = global.veloceapps.sdk || {}, global.veloceapps.sdk.cms = {}), global.ng.core, global.rxjs, global.lodash, global.ng.common, global["@veloceapps/core"], global.ng.cdk.dragDrop, global.ng.cdk.scrolling, global.ng.forms, global.veloceapps.sdk.core, global["@veloceapps/components"], global["@babel/standalone"], global["@veloceapps/api"], global.rxjs.operators, global["primeng/api"], global["primeng/dynamicdialog"]));
5
- })(this, (function (exports, i0, rxjs, lodash, i7, core, dragDrop, scrolling, angularForms, i2, i1, standalone, api, rxjsOperators, i3, dynamicdialog) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('lodash'), require('rfc6902'), require('@veloceapps/sdk/core'), require('primeng/api'), require('@veloceapps/components'), require('@veloceapps/core'), require('@angular/common'), require('ngx-drag-drop'), require('@veloceapps/api'), require('primeng/dynamicdialog'), require('@angular/cdk/drag-drop'), require('@angular/cdk/scrolling'), require('@angular/forms'), require('@babel/standalone'), require('rxjs/operators')) :
3
+ typeof define === 'function' && define.amd ? define('@veloceapps/sdk/cms', ['exports', '@angular/core', 'rxjs', 'lodash', 'rfc6902', '@veloceapps/sdk/core', 'primeng/api', '@veloceapps/components', '@veloceapps/core', '@angular/common', 'ngx-drag-drop', '@veloceapps/api', 'primeng/dynamicdialog', '@angular/cdk/drag-drop', '@angular/cdk/scrolling', '@angular/forms', '@babel/standalone', 'rxjs/operators'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloceapps = global.veloceapps || {}, global.veloceapps.sdk = global.veloceapps.sdk || {}, global.veloceapps.sdk.cms = {}), global.ng.core, global.rxjs, global.lodash, global.rfc6902, global.veloceapps.sdk.core, global["primeng/api"], global["@veloceapps/components"], global["@veloceapps/core"], global.ng.common, global["ngx-drag-drop"], global["@veloceapps/api"], global["primeng/dynamicdialog"], global.ng.cdk.dragDrop, global.ng.cdk.scrolling, global.ng.forms, global["@babel/standalone"], global.rxjs.operators));
5
+ })(this, (function (exports, i0, rxjs, lodash, rfc6902, i2, i3, i1, core, i7, i2$1, api, dynamicdialog, dragDrop, scrolling, angularForms, standalone, rxjsOperators) { 'use strict';
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -25,12 +25,13 @@
25
25
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
26
  var rxjs__namespace = /*#__PURE__*/_interopNamespace(rxjs);
27
27
  var lodash__namespace = /*#__PURE__*/_interopNamespace(lodash);
28
- var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
29
- var angularForms__namespace = /*#__PURE__*/_interopNamespace(angularForms);
30
28
  var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
29
+ var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
31
30
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
31
+ var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
32
+ var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
33
+ var angularForms__namespace = /*#__PURE__*/_interopNamespace(angularForms);
32
34
  var rxjsOperators__namespace = /*#__PURE__*/_interopNamespace(rxjsOperators);
33
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
34
35
 
35
36
  exports.FlowAction = void 0;
36
37
  (function (FlowAction) {
@@ -43,7 +44,6 @@
43
44
  FlowAction["FLOW_SWITCH_OBJECT"] = "FLOW_SWITCH_OBJECT";
44
45
  FlowAction["REMOTE_APPLY"] = "REMOTE_APPLY";
45
46
  FlowAction["REMOTE_CANCEL"] = "REMOTE_CANCEL";
46
- FlowAction["SET_DEFAULT_METRICS"] = "SET_DEFAULT_METRICS";
47
47
  })(exports.FlowAction || (exports.FlowAction = {}));
48
48
  var ConfigureProductAction = function (_a) {
49
49
  var lineItemId = _a.lineItemId, productId = _a.productId;
@@ -77,10 +77,6 @@
77
77
  type: exports.FlowAction.FLOW_SWITCH_OBJECT,
78
78
  payload: payload,
79
79
  }); };
80
- var SetDefaultMetrics = function (metrics) { return ({
81
- type: exports.FlowAction.SET_DEFAULT_METRICS,
82
- payload: { metrics: metrics },
83
- }); };
84
80
 
85
81
  var cmsActions = /*#__PURE__*/Object.freeze({
86
82
  __proto__: null,
@@ -93,11 +89,10 @@
93
89
  CloseDocGenAction: CloseDocGenAction,
94
90
  RemoteApplyAction: RemoteApplyAction,
95
91
  RemoteCancelAction: RemoteCancelAction,
96
- SwitchObjectAction: SwitchObjectAction,
97
- SetDefaultMetrics: SetDefaultMetrics
92
+ SwitchObjectAction: SwitchObjectAction
98
93
  });
99
94
 
100
- /*! *****************************************************************************
95
+ /******************************************************************************
101
96
  Copyright (c) Microsoft Corporation.
102
97
 
103
98
  Permission to use, copy, modify, and/or distribute this software for any
@@ -164,6 +159,64 @@
164
159
  function __param(paramIndex, decorator) {
165
160
  return function (target, key) { decorator(target, key, paramIndex); };
166
161
  }
162
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
163
+ function accept(f) { if (f !== void 0 && typeof f !== "function")
164
+ throw new TypeError("Function expected"); return f; }
165
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
166
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
167
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
168
+ var _, done = false;
169
+ for (var i = decorators.length - 1; i >= 0; i--) {
170
+ var context = {};
171
+ for (var p in contextIn)
172
+ context[p] = p === "access" ? {} : contextIn[p];
173
+ for (var p in contextIn.access)
174
+ context.access[p] = contextIn.access[p];
175
+ context.addInitializer = function (f) { if (done)
176
+ throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
177
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
178
+ if (kind === "accessor") {
179
+ if (result === void 0)
180
+ continue;
181
+ if (result === null || typeof result !== "object")
182
+ throw new TypeError("Object expected");
183
+ if (_ = accept(result.get))
184
+ descriptor.get = _;
185
+ if (_ = accept(result.set))
186
+ descriptor.set = _;
187
+ if (_ = accept(result.init))
188
+ initializers.push(_);
189
+ }
190
+ else if (_ = accept(result)) {
191
+ if (kind === "field")
192
+ initializers.push(_);
193
+ else
194
+ descriptor[key] = _;
195
+ }
196
+ }
197
+ if (target)
198
+ Object.defineProperty(target, contextIn.name, descriptor);
199
+ done = true;
200
+ }
201
+ ;
202
+ function __runInitializers(thisArg, initializers, value) {
203
+ var useValue = arguments.length > 2;
204
+ for (var i = 0; i < initializers.length; i++) {
205
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
206
+ }
207
+ return useValue ? value : void 0;
208
+ }
209
+ ;
210
+ function __propKey(x) {
211
+ return typeof x === "symbol" ? x : "".concat(x);
212
+ }
213
+ ;
214
+ function __setFunctionName(f, name, prefix) {
215
+ if (typeof name === "symbol")
216
+ name = name.description ? "[".concat(name.description, "]") : "";
217
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
218
+ }
219
+ ;
167
220
  function __metadata(metadataKey, metadataValue) {
168
221
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
169
222
  return Reflect.metadata(metadataKey, metadataValue);
@@ -195,7 +248,7 @@
195
248
  function step(op) {
196
249
  if (f)
197
250
  throw new TypeError("Generator is already executing.");
198
- while (_)
251
+ while (g && (g = 0, op[0] && (_ = 0)), _)
199
252
  try {
200
253
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
201
254
  return t;
@@ -259,7 +312,11 @@
259
312
  var __createBinding = Object.create ? (function (o, m, k, k2) {
260
313
  if (k2 === undefined)
261
314
  k2 = k;
262
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
315
+ var desc = Object.getOwnPropertyDescriptor(m, k);
316
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
317
+ desc = { enumerable: true, get: function () { return m[k]; } };
318
+ }
319
+ Object.defineProperty(o, k2, desc);
263
320
  }) : (function (o, m, k, k2) {
264
321
  if (k2 === undefined)
265
322
  k2 = k;
@@ -359,7 +416,7 @@
359
416
  function __asyncDelegator(o) {
360
417
  var i, p;
361
418
  return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
362
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
419
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
363
420
  }
364
421
  function __asyncValues(o) {
365
422
  if (!Symbol.asyncIterator)
@@ -414,6 +471,11 @@
414
471
  throw new TypeError("Cannot write private member to an object whose class did not declare it");
415
472
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
416
473
  }
474
+ function __classPrivateFieldIn(state, receiver) {
475
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
476
+ throw new TypeError("Cannot use 'in' operator on non-object");
477
+ return typeof state === "function" ? receiver === state : state.has(receiver);
478
+ }
417
479
 
418
480
  var DEFAULT_PLUGINS_TOKEN = new i0.InjectionToken('DEFAULT_PLUGINS_TOKEN');
419
481
  var UI_DEFINITION_METADATA = new i0.InjectionToken('UI_DEFINITION_METADATA_TOKEN');
@@ -492,6 +554,110 @@
492
554
  __param(0, i0.Inject(i0.Injector))
493
555
  ], exports.ElementComponent);
494
556
 
557
+ function getElementUniqueName(collection, name, comparator) {
558
+ var result = '';
559
+ var index = 0;
560
+ while (!result) {
561
+ var candidate = name + (index ? " (" + index + ")" : '');
562
+ var exists = collection.some(comparator(candidate));
563
+ if (!exists) {
564
+ result = candidate;
565
+ }
566
+ else {
567
+ index++;
568
+ }
569
+ }
570
+ return result;
571
+ }
572
+ var insertElementAt = function (source, target, parentPath, index) {
573
+ var result = __spreadArray([], __read(source));
574
+ var name = getElementUniqueName(result, target.name, function (name) { return function (el) { return el.name === name; }; });
575
+ var path = parentPath ? parentPath + "/" + name : name;
576
+ result.splice(index, 0, Object.assign(Object.assign({}, target), { path: path, name: name }));
577
+ return result;
578
+ };
579
+ var insertElement = function (source, target, path, index) {
580
+ if (!path) {
581
+ return insertElementAt(source, target, '', index);
582
+ }
583
+ return source.map(function (element) {
584
+ var _a;
585
+ if (element.path === path) {
586
+ return Object.assign(Object.assign({}, element), { children: insertElementAt(element.children, target, element.path, index) });
587
+ }
588
+ else if ((_a = element.path) === null || _a === void 0 ? void 0 : _a.startsWith(path)) {
589
+ return Object.assign(Object.assign({}, element), { children: insertElement(element.children, target, path, index) });
590
+ }
591
+ else {
592
+ return element;
593
+ }
594
+ });
595
+ };
596
+ var removeElement = function (source, path) {
597
+ return source.reduce(function (trunk, element) {
598
+ if (path === element.path) {
599
+ return trunk;
600
+ }
601
+ if (element.path) {
602
+ if (path.startsWith(element.path)) {
603
+ trunk.push(Object.assign(Object.assign({}, element), { children: removeElement(element.children, path) }));
604
+ }
605
+ else {
606
+ trunk.push(element);
607
+ }
608
+ }
609
+ return trunk;
610
+ }, []);
611
+ };
612
+ var findElementByPath = function (source, path) {
613
+ var e_1, _b;
614
+ try {
615
+ for (var source_1 = __values(source), source_1_1 = source_1.next(); !source_1_1.done; source_1_1 = source_1.next()) {
616
+ var el = source_1_1.value;
617
+ if (el.path === path) {
618
+ return el;
619
+ }
620
+ if (el.path && path.startsWith(el.path)) {
621
+ var found = findElementByPath(el.children, path);
622
+ if (found) {
623
+ return found;
624
+ }
625
+ }
626
+ }
627
+ }
628
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
629
+ finally {
630
+ try {
631
+ if (source_1_1 && !source_1_1.done && (_b = source_1.return)) _b.call(source_1);
632
+ }
633
+ finally { if (e_1) throw e_1.error; }
634
+ }
635
+ return;
636
+ };
637
+ var findElementByModule = function (elements, module, elementName) {
638
+ var e_2, _b;
639
+ try {
640
+ for (var elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
641
+ var el = elements_1_1.value;
642
+ if (el.module === module && el.name === elementName) {
643
+ return el;
644
+ }
645
+ var child = findElementByModule(el.children, module, elementName);
646
+ if (child) {
647
+ return child;
648
+ }
649
+ }
650
+ }
651
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
652
+ finally {
653
+ try {
654
+ if (elements_1_1 && !elements_1_1.done && (_b = elements_1.return)) _b.call(elements_1);
655
+ }
656
+ finally { if (e_2) throw e_2.error; }
657
+ }
658
+ return;
659
+ };
660
+
495
661
  var parseBoundPath = function (path) {
496
662
  var _a, _b;
497
663
  var regexp = new RegExp("(?:\\/)(?:\\w+)(?:\\/)(?:ports|attributes)(?:\\/)(?:\\w+)|(?:\\/)(?:\\w+)", 'g');
@@ -524,29 +690,6 @@
524
690
  variable: variable,
525
691
  };
526
692
  };
527
- var findElementByModule = function (elements, module, elementName) {
528
- var e_1, _e;
529
- try {
530
- for (var elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
531
- var el = elements_1_1.value;
532
- if (el.module === module && el.name === elementName) {
533
- return el;
534
- }
535
- var child = findElementByModule(el.children, module, elementName);
536
- if (child) {
537
- return child;
538
- }
539
- }
540
- }
541
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
542
- finally {
543
- try {
544
- if (elements_1_1 && !elements_1_1.done && (_e = elements_1.return)) _e.call(elements_1);
545
- }
546
- finally { if (e_1) throw e_1.error; }
547
- }
548
- return;
549
- };
550
693
  var getAbsolutePath = function (elements, subject, path) {
551
694
  var _a, _b, _c;
552
695
  if (path.module) {
@@ -569,49 +712,85 @@
569
712
  return subjectSegments.join('/');
570
713
  };
571
714
 
572
- var DynamicModuleService = /** @class */ (function () {
573
- function DynamicModuleService() {
574
- this._elementsTree = [];
575
- this._componentFactories = [];
715
+ var CMS_COMPILATION_SERVICE = new i0.InjectionToken('VENDOR_MAP');
716
+
717
+ var RuntimeService = /** @class */ (function () {
718
+ function RuntimeService(injector) {
719
+ this.injector = injector;
720
+ this.modules = [];
721
+ this.componentFactories = {};
722
+ this.applicationTree = [];
723
+ this.isInitialized$ = new rxjs.BehaviorSubject(false);
724
+ this.updated$ = new rxjs.Subject();
725
+ this.compilationService = this.injector.get(CMS_COMPILATION_SERVICE);
576
726
  }
577
- Object.defineProperty(DynamicModuleService.prototype, "componentFactories", {
578
- get: function () {
579
- return this._componentFactories;
580
- },
581
- set: function (data) {
582
- this._componentFactories = data;
583
- },
584
- enumerable: false,
585
- configurable: true
586
- });
587
- DynamicModuleService.prototype.getComponentFactory = function (element) {
588
- return this.componentFactories.find(function (f) { return f.componentType.path === element.path; });
727
+ RuntimeService.prototype.initialize$ = function (uiDefinition, config) {
728
+ var _this = this;
729
+ this.config = config;
730
+ if (!uiDefinition) {
731
+ return rxjs.of([]);
732
+ }
733
+ return this.compilationService.compileUIDefinition$(uiDefinition).pipe(rxjs.map(function (result) {
734
+ _this.applicationTree = result.elements;
735
+ _this.addComponentFactories(result.module.componentFactories);
736
+ return result.elements;
737
+ }), rxjs.tap(function () { return _this.isInitialized$.next(true); }));
589
738
  };
590
- Object.defineProperty(DynamicModuleService.prototype, "elementsTree", {
591
- get: function () {
592
- return this._elementsTree;
593
- },
594
- set: function (tree) {
595
- this._elementsTree = tree;
596
- },
597
- enumerable: false,
598
- configurable: true
599
- });
600
- DynamicModuleService.prototype.clear = function () {
601
- this._elementsTree = [];
602
- this.componentFactories = [];
739
+ RuntimeService.prototype.applyPatch$ = function (patch) {
740
+ var _this = this;
741
+ var observable$ = rxjs.of(undefined);
742
+ patch.forEach(function (operation) {
743
+ switch (operation.op) {
744
+ case 'add': {
745
+ observable$ = observable$.pipe(rxjs.switchMap(function () { return _this.addElement$(operation); }));
746
+ break;
747
+ }
748
+ case 'remove': {
749
+ observable$ = observable$.pipe(rxjs.map(function () { return _this.deleteElement(operation); }));
750
+ break;
751
+ }
752
+ default:
753
+ observable$ = rxjs.of();
754
+ }
755
+ });
756
+ return observable$.pipe(rxjs.tap(function () { return _this.updated$.next(); }));
757
+ };
758
+ RuntimeService.prototype.getCompiledElement$ = function (path) {
759
+ var _this = this;
760
+ return this.updated$.pipe(rxjs.startWith(undefined), rxjs.map(function () { return findElementByPath(_this.applicationTree, path); }), rxjs.distinctUntilChanged());
761
+ };
762
+ RuntimeService.prototype.clear = function () {
763
+ this.compilationService.clearModuleCache(this.modules);
764
+ this.modules = [];
765
+ this.applicationTree = [];
766
+ this.componentFactories = {};
767
+ this.isInitialized$.next(false);
768
+ };
769
+ RuntimeService.prototype.addElement$ = function (operation) {
770
+ var _this = this;
771
+ return this.compilationService.compileElement$(operation.value).pipe(rxjs.map(function (result) {
772
+ _this.addComponentFactories(result.module.componentFactories);
773
+ rfc6902.applyPatch(_this.applicationTree, [Object.assign(Object.assign({}, operation), { value: result.elements[0] })]);
774
+ }));
775
+ };
776
+ RuntimeService.prototype.deleteElement = function (operation) {
777
+ rfc6902.applyPatch(this.applicationTree, [operation]);
778
+ };
779
+ RuntimeService.prototype.addComponentFactories = function (list) {
780
+ var _this = this;
781
+ list.forEach(function (item) { return (_this.componentFactories[item.componentType.path] = item); });
603
782
  };
604
- return DynamicModuleService;
783
+ return RuntimeService;
605
784
  }());
606
- DynamicModuleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DynamicModuleService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
607
- DynamicModuleService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DynamicModuleService });
608
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: DynamicModuleService, decorators: [{
785
+ RuntimeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeService, deps: [{ token: i0__namespace.Injector }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
786
+ RuntimeService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeService });
787
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeService, decorators: [{
609
788
  type: i0.Injectable
610
- }] });
789
+ }], ctorParameters: function () { return [{ type: i0__namespace.Injector }]; } });
611
790
 
612
791
  var IOProviderService = /** @class */ (function () {
613
- function IOProviderService(dynamicModuleService) {
614
- this.dynamicModuleService = dynamicModuleService;
792
+ function IOProviderService(runtimeService) {
793
+ this.runtimeService = runtimeService;
615
794
  this.inputs = {};
616
795
  }
617
796
  IOProviderService.prototype.connect = function (el, name, target) {
@@ -631,7 +810,7 @@
631
810
  var pathIsValue = elPath.segments.length === 1 && elPath.segments[0].startsWith('"') && elPath.segments[0].endsWith('"');
632
811
  var finalName = (_b = elPath.variable) !== null && _b !== void 0 ? _b : name;
633
812
  var value = pathIsValue ? new rxjs.BehaviorSubject(elPath.segments[0].slice(1, -1)) : undefined;
634
- var absolutePath = !pathIsValue ? getAbsolutePath(this.dynamicModuleService.elementsTree, el, elPath) : el.path;
813
+ var absolutePath = !pathIsValue ? getAbsolutePath(this.runtimeService.applicationTree, el, elPath) : el.path;
635
814
  return this.createSubjectSafe(absolutePath !== null && absolutePath !== void 0 ? absolutePath : '', finalName, value);
636
815
  };
637
816
  IOProviderService.prototype.createSubjectSafe = function (path, name, subject) {
@@ -651,11 +830,11 @@
651
830
  };
652
831
  return IOProviderService;
653
832
  }());
654
- IOProviderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IOProviderService, deps: [{ token: DynamicModuleService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
655
- IOProviderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IOProviderService });
656
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IOProviderService, decorators: [{
833
+ IOProviderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOProviderService, deps: [{ token: RuntimeService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
834
+ IOProviderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOProviderService });
835
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOProviderService, decorators: [{
657
836
  type: i0.Injectable
658
- }], ctorParameters: function () { return [{ type: DynamicModuleService }]; } });
837
+ }], ctorParameters: function () { return [{ type: RuntimeService }]; } });
659
838
 
660
839
  var TemplatesService = /** @class */ (function () {
661
840
  function TemplatesService() {
@@ -680,318 +859,122 @@
680
859
  };
681
860
  return TemplatesService;
682
861
  }());
683
- TemplatesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TemplatesService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
684
- TemplatesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TemplatesService });
685
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TemplatesService, decorators: [{
862
+ TemplatesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TemplatesService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
863
+ TemplatesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TemplatesService });
864
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TemplatesService, decorators: [{
686
865
  type: i0.Injectable
687
866
  }] });
688
867
 
689
- var IOPlugin = /** @class */ (function () {
690
- function IOPlugin(host) {
691
- var _this = this;
692
- var _a, _b;
693
- this.host = host;
694
- var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
695
- var inputProvider = this.host.injector.get(IOProviderService);
696
- var inputs = Object.entries((_a = elementMetadata.inputs) !== null && _a !== void 0 ? _a : {});
697
- var outputs = Object.entries((_b = elementMetadata.outputs) !== null && _b !== void 0 ? _b : {});
698
- inputs.forEach(function (_c) {
699
- var _d = __read(_c, 2), key = _d[0], path = _d[1];
700
- var _a;
701
- if (path && typeof path !== 'string') {
702
- console.error("The value of '" + key + "' input should be a string");
703
- }
704
- if (((_a = elementMetadata.outputs) === null || _a === void 0 ? void 0 : _a[key]) !== undefined) {
705
- console.warn("'" + key + "' appears both in inputs and outputs. To prevent inconsistent behavior please keep them unique ");
706
- }
707
- _this.host[key] = inputProvider.connect(elementMetadata, key, path);
708
- });
709
- outputs.forEach(function (_c) {
710
- var _d = __read(_c, 2), key = _d[0], path = _d[1];
711
- if (path && typeof path !== 'string') {
712
- console.error("The value of '" + key + "' output should be a string");
713
- }
714
- _this.host[key] = inputProvider.provide(elementMetadata, key, path);
715
- });
868
+ var InitAction = { type: 'INIT' };
869
+ var ClearAction = { type: 'CLEAR' };
870
+ var IntegrationState = /** @class */ (function () {
871
+ function IntegrationState() {
872
+ this.stateSubj$ = new rxjs.BehaviorSubject({});
873
+ this.action$ = new rxjs.BehaviorSubject(InitAction);
716
874
  }
717
- return IOPlugin;
875
+ Object.defineProperty(IntegrationState.prototype, "state$", {
876
+ get: function () {
877
+ return this.stateSubj$.asObservable();
878
+ },
879
+ enumerable: false,
880
+ configurable: true
881
+ });
882
+ Object.defineProperty(IntegrationState.prototype, "state", {
883
+ get: function () {
884
+ return this.stateSubj$.getValue();
885
+ },
886
+ enumerable: false,
887
+ configurable: true
888
+ });
889
+ IntegrationState.prototype.patchState = function (update) {
890
+ this.stateSubj$.next(Object.assign(Object.assign({}, this.stateSubj$.getValue()), update));
891
+ };
892
+ IntegrationState.prototype.dispatch = function (action) {
893
+ this.action$.next(action);
894
+ };
895
+ IntegrationState.prototype.listen$ = function (actionType) {
896
+ return this.action$.pipe(rxjs.filter(function (action) { return action.type === actionType; }), rxjs.map(function (action) { return action.payload; }));
897
+ };
898
+ IntegrationState.prototype.listenAll$ = function () {
899
+ return this.action$.asObservable();
900
+ };
901
+ IntegrationState.prototype.clear = function () {
902
+ this.stateSubj$.next({});
903
+ this.action$.next(ClearAction);
904
+ };
905
+ return IntegrationState;
718
906
  }());
719
- IOPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IOPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
720
- IOPlugindir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: IOPlugin, ngImport: i0__namespace });
721
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IOPlugin, decorators: [{
722
- type: i0.Directive
723
- }], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
907
+ IntegrationState.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IntegrationState, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
908
+ IntegrationStateprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IntegrationState, providedIn: 'root' });
909
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IntegrationState, decorators: [{
910
+ type: i0.Injectable,
911
+ args: [{ providedIn: 'root' }]
912
+ }] });
724
913
 
725
- var ScriptPlugin = /** @class */ (function () {
726
- function ScriptPlugin(host) {
727
- var _this = this;
728
- this.host = host;
729
- this.normalizeImports = function (script, elementPath) {
730
- var regexp = new RegExp("import([ \\n\\t]*(?:[^ \\n\\t\\{\\}]+[ \\n\\t]*,?)?(?:[ \\n\\t]*\\{(?:[ \\n\\t]*[^ \\n\\t\"'\\{\\}]+[ \\n\\t]*,?)+\\})?[ \\n\\t]*)from[ \\n\\t]*(['\"])([^'\"\\n]+)(?:['\"]);", 'g');
731
- var result = script.replace(regexp, function (match, g1, g2, src) {
732
- var imports = g1
733
- .trim()
734
- .slice(1, -1)
735
- .split(',')
736
- .map(function (item) { return item.trim(); });
737
- imports.forEach(function (item) {
738
- var _a;
739
- if (!((_a = _this.vendorMap[src]) === null || _a === void 0 ? void 0 : _a[item])) {
740
- throw new Error("Failed to import " + item + " from '" + src + "' in " + elementPath + "/script.ts");
741
- }
742
- });
743
- return "const " + g1 + " = vendor['" + src + "'];";
744
- });
745
- return result;
746
- };
747
- this.document = this.host.injector.get(i7.DOCUMENT);
748
- this.vendorMap = this.host.injector.get(VENDOR_MAP);
749
- var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
750
- var sharedElementMetadata = this.host.injector.get(SHARED_ELEMENT_METADATA);
751
- this.addScript(sharedElementMetadata);
752
- this.addScript(elementMetadata);
914
+ var ResourcesService = /** @class */ (function () {
915
+ function ResourcesService() {
916
+ this.scripts = new Map();
917
+ this.loaded$ = new rxjs.ReplaySubject();
753
918
  }
754
- ScriptPlugin.prototype.addScript = function (metadata) {
755
- var _a;
756
- if (!(metadata === null || metadata === void 0 ? void 0 : metadata.script)) {
757
- return;
758
- }
759
- var id = btoa(core.UUID.UUID());
760
- var script = this.document.createElement('script');
761
- script.type = "text/javascript";
762
- var scriptContent = this.normalizeImports(metadata.script, (_a = metadata.path) !== null && _a !== void 0 ? _a : metadata.name);
763
- var classMatch = /export class (\S+)/.exec(scriptContent);
764
- var className = classMatch === null || classMatch === void 0 ? void 0 : classMatch[1];
765
- if (!classMatch || !className) {
766
- console.error("Script doesn't have exported class");
767
- return;
919
+ ResourcesService.prototype.loadScript = function (url) {
920
+ var _this = this;
921
+ var loaded = this.scripts.get(url);
922
+ if (loaded === true) {
923
+ return rxjs.of(rxjs.noop());
768
924
  }
769
- scriptContent = scriptContent.replace(classMatch[0], "class " + className);
770
- script.text = "var " + id + " = function(vendor) {" + scriptContent + "\n return " + className + "; };";
771
- this.document.body.appendChild(script);
772
- var ScriptClass = window[id](this.vendorMap);
773
- if (ScriptClass instanceof Object) {
774
- this.host.registerPlugin(new ScriptClass(this.host));
925
+ if (loaded == null) {
926
+ this.scripts.set(url, false);
927
+ var script = document.createElement('script');
928
+ script.src = url;
929
+ script.onload = function () {
930
+ _this.scripts.set(url, true);
931
+ _this.loaded$.next();
932
+ };
933
+ document.body.appendChild(script);
775
934
  }
776
- this.document.body.removeChild(script);
935
+ return this.loaded$.pipe(rxjs.filter(function () { return _this.scripts.get(url) === true; }), rxjs.take(1));
777
936
  };
778
- return ScriptPlugin;
937
+ ResourcesService.prototype.loadStyles = function (url) {
938
+ var _a, _b;
939
+ var previewEl = document.querySelector('vl-cms-preview');
940
+ var rootEl = (_b = (_a = previewEl === null || previewEl === void 0 ? void 0 : previewEl.shadowRoot) !== null && _a !== void 0 ? _a : previewEl) !== null && _b !== void 0 ? _b : document.body;
941
+ return new rxjs.Observable(function (subscriber) {
942
+ var link = document.createElement('link');
943
+ link.rel = 'stylesheet';
944
+ link.type = 'text/css';
945
+ link.href = url;
946
+ link.media = 'all';
947
+ link.onload = function () {
948
+ subscriber.next();
949
+ subscriber.complete();
950
+ };
951
+ rootEl.appendChild(link);
952
+ });
953
+ };
954
+ return ResourcesService;
779
955
  }());
780
- ScriptPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ScriptPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
781
- ScriptPlugindir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: ScriptPlugin, ngImport: i0__namespace });
782
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ScriptPlugin, decorators: [{
783
- type: i0.Directive
784
- }], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
785
-
786
- /*
787
- * ScriptPlugin must always be the last plugin in the list to make sure user code is running after all pre-initializers.
788
- */
789
- var CONFIG = {
790
- CUSTOM: {
791
- component: exports.ElementComponent,
792
- plugins: [IOPlugin, ScriptPlugin],
793
- },
794
- CONTAINER: {
795
- component: exports.ElementComponent,
796
- defaultTemplate: '<element-children></element-children>',
797
- plugins: [ScriptPlugin],
798
- },
799
- SERVICE: {
800
- component: exports.ElementComponent,
801
- plugins: [IOPlugin, ScriptPlugin],
802
- suppressTemplate: true,
803
- suppressStyles: true,
804
- },
805
- REFERENCE: {
806
- component: exports.ElementComponent,
807
- plugins: [IOPlugin, ScriptPlugin],
808
- suppressTemplate: true,
809
- },
810
- };
811
-
812
- var EXPORTED_CLASS_REGEX = /export class (\S+)/;
813
- var METADATA_DECORATOR_REGEX = /@ElementDefinition\(([\s\S]+)\)(\n|\r\n|.)*export class/g;
814
- var UiBuildError = /** @class */ (function (_super) {
815
- __extends(UiBuildError, _super);
816
- function UiBuildError(message, affectedMetadata) {
817
- var _this = _super.call(this, message) || this;
818
- _this.name = _this.constructor.name;
819
- _this.affectedMetadata = affectedMetadata;
820
- return _this;
821
- }
822
- return UiBuildError;
823
- }(Error));
824
- var elementToMetadata = function (el, parentPath) {
825
- var _a;
826
- var script = el.script && window.atob(el.script);
827
- var template = el.template && window.atob(el.template);
828
- var styles = el.styles && window.atob(el.styles);
829
- var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
830
- if (!exportedClassName) {
831
- throw new Error("Script doesn't have exported class");
832
- }
833
- var elementMetadata = extractElementMetadata(script || '');
834
- var path = (parentPath ? parentPath + '/' : '') + elementMetadata.name;
835
- return Object.assign(Object.assign({}, elementMetadata), { path: path, script: script === null || script === void 0 ? void 0 : script.replace(METADATA_DECORATOR_REGEX, 'export class'), template: template, styles: styles, children: el.children.map(function (child) { return elementToMetadata(child, path); }) });
836
- };
837
- var metadataToElement = function (metadata, recursive) {
838
- if (recursive === void 0) { recursive = true; }
839
- var elMetadata = {
840
- name: metadata.name,
841
- isShared: metadata.isShared,
842
- type: metadata.type,
843
- model: metadata.model,
844
- module: metadata.module,
845
- reference: metadata.reference,
846
- inputs: metadata.inputs,
847
- outputs: metadata.outputs,
848
- children: metadata.children.map(function (_e) {
849
- var name = _e.name;
850
- return name;
851
- }),
852
- configuredStyles: metadata.configuredStyles,
853
- };
854
- var normalizedElMetadata = normalizeElementMetadata(elMetadata);
855
- if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
856
- throw new UiBuildError("'" + metadata.name + "' component script is missing an exported class", metadata);
857
- }
858
- var script = metadata.script &&
859
- window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, "@ElementDefinition(" + stringifyElementMetadata(normalizedElMetadata) + ")\nexport class Script"));
860
- var template = metadata.template && window.btoa(metadata.template);
861
- var styles = metadata.styles && window.btoa(metadata.styles);
862
- return {
863
- script: script,
864
- template: template,
865
- styles: styles,
866
- children: recursive ? metadata.children.map(function (meta) { return metadataToElement(meta); }) : [],
867
- };
868
- };
869
- var normalizeElementMetadata = function (elementMetadata) {
870
- var _a, _b, _c, _d;
871
- var metadata = Object.assign({}, elementMetadata);
872
- // model
873
- var _e = (_a = metadata.model) !== null && _a !== void 0 ? _a : {}, lineItem = _e.lineItem, path = _e.path;
874
- var model = lineItem ? { lineItem: lineItem } : path ? { path: path } : undefined;
875
- if (model) {
876
- metadata.model = model;
877
- }
878
- else {
879
- delete metadata.model;
880
- }
881
- // module
882
- if (!metadata.module) {
883
- delete metadata.module;
884
- }
885
- // reference
886
- if (!metadata.reference) {
887
- delete metadata.reference;
888
- }
889
- // inputs
890
- var inputs = Object.entries((_b = metadata.inputs) !== null && _b !== void 0 ? _b : {}).reduce(function (acc, _e) {
891
- var _f;
892
- var _g = __read(_e, 2), key = _g[0], value = _g[1];
893
- return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
894
- }, {});
895
- if (inputs && Object.keys(inputs).length > 0) {
896
- metadata.inputs = inputs;
897
- }
898
- else {
899
- delete metadata.inputs;
900
- }
901
- // outputs
902
- var outputs = Object.entries((_c = metadata.outputs) !== null && _c !== void 0 ? _c : {}).reduce(function (acc, _e) {
903
- var _f;
904
- var _g = __read(_e, 2), key = _g[0], value = _g[1];
905
- return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
906
- }, {});
907
- if (outputs && Object.keys(outputs).length > 0) {
908
- metadata.outputs = outputs;
909
- }
910
- else {
911
- delete metadata.outputs;
912
- }
913
- // children
914
- if (!((_d = metadata.children) === null || _d === void 0 ? void 0 : _d.length)) {
915
- delete metadata.children;
916
- }
917
- // isShared
918
- if (!metadata.isShared) {
919
- delete metadata.isShared;
920
- }
921
- // configuredStyles
922
- if (!metadata.configuredStyles) {
923
- delete metadata.configuredStyles;
924
- }
925
- return metadata;
926
- };
927
- var extractElementMetadata = function (script) {
928
- var _a;
929
- var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
930
- // need to reset regex last index to prevent null result for next execution
931
- METADATA_DECORATOR_REGEX.lastIndex = 0;
932
- return new Function("return " + metadataString)();
933
- };
934
- var extendElementMetadata = function (script, extend) {
935
- var _a;
936
- var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
937
- // need to reset regex last index to prevent null result for next execution
938
- METADATA_DECORATOR_REGEX.lastIndex = 0;
939
- if (!metadataString) {
940
- return script;
941
- }
942
- var updated = Object.assign(Object.assign({}, new Function("return " + metadataString)()), extend);
943
- return script.replace(metadataString, stringifyElementMetadata(updated));
944
- };
945
- var getElementConfig = function (type) {
946
- return CONFIG[type];
947
- };
948
- var doesElementSupportIO = function (type) {
949
- var _a, _b;
950
- return (_b = (_a = getElementConfig(type).plugins) === null || _a === void 0 ? void 0 : _a.includes(IOPlugin)) !== null && _b !== void 0 ? _b : false;
951
- };
952
- function stringifyElementMetadata(elementMetadata) {
953
- var cleaned = JSON.stringify(elementMetadata, null, 2);
954
- return cleaned.replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm, function (match) {
955
- return match.replace(/"/g, '');
956
- });
957
- }
958
- var isValidScript = function (script) {
959
- var _a;
960
- if (!script) {
961
- return false;
962
- }
963
- var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
964
- if (!exportedClassName) {
965
- return false;
966
- }
967
- var meta = extractElementMetadata(script);
968
- if (!meta.name || !meta.type) {
969
- return false;
970
- }
971
- return true;
972
- };
973
- function flattenElements(elements) {
974
- return lodash.flatten(elements.map(function (el) { return __spreadArray([el], __read(flattenElements(el.children))); }));
975
- }
976
- function isSharedElement(el) {
977
- return Boolean(el.isShared) && el.type !== 'REFERENCE';
978
- }
956
+ ResourcesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ResourcesService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
957
+ ResourcesServiceprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ResourcesService, providedIn: 'root' });
958
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ResourcesService, decorators: [{
959
+ type: i0.Injectable,
960
+ args: [{ providedIn: 'root' }]
961
+ }] });
979
962
 
980
963
  var ElementContextService = /** @class */ (function () {
981
964
  function ElementContextService() {
982
965
  }
983
966
  return ElementContextService;
984
967
  }());
985
- ElementContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementContextService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
986
- ElementContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementContextService });
987
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementContextService, decorators: [{
968
+ ElementContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
969
+ ElementContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService });
970
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService, decorators: [{
988
971
  type: i0.Injectable
989
972
  }] });
990
973
 
991
974
  var ElementRendererComponent = /** @class */ (function () {
992
- function ElementRendererComponent(parentInjector, dynamicModuleService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
975
+ function ElementRendererComponent(parentInjector, runtimeService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
993
976
  this.parentInjector = parentInjector;
994
- this.dynamicModuleService = dynamicModuleService;
977
+ this.runtimeService = runtimeService;
995
978
  this.elementContext = elementContext;
996
979
  this.ioProviderService = ioProviderService;
997
980
  this.configurationService = configurationService;
@@ -1002,7 +985,7 @@
1002
985
  }
1003
986
  ElementRendererComponent.prototype.ngOnInit = function () {
1004
987
  this.elementContext.metadata = this.meta;
1005
- this.factory = this.dynamicModuleService.getComponentFactory(this.meta);
988
+ this.factory = this.meta.path ? this.runtimeService.componentFactories[this.meta.path] : undefined;
1006
989
  this.createComponents();
1007
990
  };
1008
991
  ElementRendererComponent.prototype.ngOnDestroy = function () {
@@ -1135,9 +1118,9 @@
1135
1118
  };
1136
1119
  return ElementRendererComponent;
1137
1120
  }());
1138
- ElementRendererComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementRendererComponent, deps: [{ token: i0__namespace.Injector, skipSelf: true }, { token: DynamicModuleService }, { token: ElementContextService }, { token: IOProviderService }, { token: i2__namespace.ConfigurationService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1139
- ElementRendererComponent.ɵcmp = i0__namespace.ɵɵ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: i0.ViewContainerRef, static: true }], ngImport: i0__namespace, template: "<ng-template #el></ng-template>\n", styles: [":host{display:contents}\n"], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1140
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementRendererComponent, decorators: [{
1121
+ ElementRendererComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererComponent, deps: [{ token: i0__namespace.Injector, skipSelf: true }, { token: RuntimeService }, { token: ElementContextService }, { token: IOProviderService }, { token: i2__namespace.ConfigurationService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1122
+ ElementRendererComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: { meta: "meta" }, providers: [ElementContextService], viewQueries: [{ propertyName: "el", first: true, predicate: ["el"], descendants: true, read: i0.ViewContainerRef, static: true }], ngImport: i0__namespace, template: "<ng-template #el></ng-template>\n", styles: [":host{display:contents}\n"], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1123
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererComponent, decorators: [{
1141
1124
  type: i0.Component,
1142
1125
  args: [{
1143
1126
  selector: 'vl-cms-element-renderer',
@@ -1149,7 +1132,7 @@
1149
1132
  }], ctorParameters: function () {
1150
1133
  return [{ type: i0__namespace.Injector, decorators: [{
1151
1134
  type: i0.SkipSelf
1152
- }] }, { type: DynamicModuleService }, { type: ElementContextService }, { type: IOProviderService }, { type: i2__namespace.ConfigurationService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }];
1135
+ }] }, { type: RuntimeService }, { type: ElementContextService }, { type: IOProviderService }, { type: i2__namespace.ConfigurationService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }];
1153
1136
  }, propDecorators: { el: [{
1154
1137
  type: i0.ViewChild,
1155
1138
  args: ['el', { read: i0.ViewContainerRef, static: true }]
@@ -1157,25 +1140,252 @@
1157
1140
  type: i0.Input
1158
1141
  }] } });
1159
1142
 
1160
- var ElementChildrenComponent = /** @class */ (function () {
1161
- function ElementChildrenComponent(elementContext) {
1162
- this.elementContext = elementContext;
1163
- this.metadata = this.elementContext.metadata;
1143
+ var PreviewComponent = /** @class */ (function () {
1144
+ function PreviewComponent(runtimeService, configurationService, messageService, configurationRuntimeService, integrationState, cdr) {
1145
+ var _this = this;
1146
+ this.runtimeService = runtimeService;
1147
+ this.configurationService = configurationService;
1148
+ this.messageService = messageService;
1149
+ this.configurationRuntimeService = configurationRuntimeService;
1150
+ this.integrationState = integrationState;
1151
+ this.cdr = cdr;
1152
+ this.state$ = new rxjs.BehaviorSubject({ loading: true, failure: false });
1153
+ this.elements = [];
1154
+ this.destroy$ = new rxjs.Subject();
1155
+ this.runtimeService.updated$.pipe(rxjs.takeUntil(this.destroy$)).subscribe(function () { return _this.cdr.detectChanges(); });
1164
1156
  }
1165
- return ElementChildrenComponent;
1157
+ PreviewComponent.prototype.ngOnInit = function () {
1158
+ var _a;
1159
+ if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.clearStateOnInit) {
1160
+ this.integrationState.clear();
1161
+ }
1162
+ this.startPreview();
1163
+ };
1164
+ PreviewComponent.prototype.ngOnDestroy = function () {
1165
+ this.destroy$.next();
1166
+ this.destroy$.complete();
1167
+ this.configurationService.reset();
1168
+ this.runtimeService.clear();
1169
+ };
1170
+ PreviewComponent.prototype.initializeConfiguration$ = function () {
1171
+ var _this = this;
1172
+ var isAlreadyInitialized = this.configurationRuntimeService.isInitialized;
1173
+ if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
1174
+ return rxjs.of({});
1175
+ }
1176
+ if (!this.modelId) {
1177
+ console.warn("No modelId is given for uiDefinition with '" + this.uiDefinition.type + "' type");
1178
+ return rxjs.of({});
1179
+ }
1180
+ // If still not initialized - init configuration in Test mode
1181
+ return this.configurationRuntimeService
1182
+ .initTestMode(this.modelId, this.uiDefinition)
1183
+ .pipe(rxjs.switchMap(function () { return _this.configurationService.configure(); }));
1184
+ };
1185
+ PreviewComponent.prototype.startPreview = function () {
1186
+ var _this = this;
1187
+ if (!this.uiDefinition) {
1188
+ return;
1189
+ }
1190
+ rxjs.forkJoin([this.runtimeService.initialize$(this.uiDefinition, this.config), this.initializeConfiguration$()])
1191
+ .pipe(rxjs.tap(function (_c) {
1192
+ var _d = __read(_c, 1), elements = _d[0];
1193
+ _this.elements = elements;
1194
+ _this.state$.next({ loading: false, failure: false });
1195
+ }), rxjs.catchError(function (error) {
1196
+ var _a, _b;
1197
+ console.error(error);
1198
+ if (!((_b = (_a = _this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
1199
+ _this.messageService.add({ severity: 'error', summary: error });
1200
+ }
1201
+ _this.state$.next({ loading: false, failure: true });
1202
+ return rxjs.of();
1203
+ }), rxjs.takeUntil(this.destroy$))
1204
+ .subscribe();
1205
+ };
1206
+ return PreviewComponent;
1166
1207
  }());
1167
- ElementChildrenComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenComponent, deps: [{ token: ElementContextService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1168
- ElementChildrenComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: ElementChildrenComponent, selector: "element-children", ngImport: i0__namespace, 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__namespace.ChangeDetectionStrategy.OnPush });
1169
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenComponent, decorators: [{
1208
+ PreviewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewComponent, deps: [{ token: RuntimeService }, { token: i2__namespace.ConfigurationService }, { token: i3__namespace.MessageService }, { token: i2__namespace.ConfigurationRuntimeService }, { token: IntegrationState }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1209
+ PreviewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition", config: "config" }, providers: [IOProviderService, TemplatesService], ngImport: i0__namespace, 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: i1__namespace.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i7__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush, encapsulation: i0__namespace.ViewEncapsulation.ShadowDom });
1210
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewComponent, decorators: [{
1170
1211
  type: i0.Component,
1171
1212
  args: [{
1172
- // eslint-disable-next-line @angular-eslint/component-selector
1213
+ selector: 'vl-cms-preview',
1214
+ templateUrl: './preview.component.html',
1215
+ styleUrls: ['./preview.component.scss'],
1216
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1217
+ providers: [IOProviderService, TemplatesService],
1218
+ // use shadow DOM to prevent UI from being affected by global styles
1219
+ encapsulation: i0.ViewEncapsulation.ShadowDom,
1220
+ }]
1221
+ }], ctorParameters: function () { return [{ type: RuntimeService }, { type: i2__namespace.ConfigurationService }, { type: i3__namespace.MessageService }, { type: i2__namespace.ConfigurationRuntimeService }, { type: IntegrationState }, { type: i0__namespace.ChangeDetectorRef }]; }, propDecorators: { modelId: [{
1222
+ type: i0.Input
1223
+ }], uiDefinition: [{
1224
+ type: i0.Input
1225
+ }], config: [{
1226
+ type: i0.Input
1227
+ }] } });
1228
+
1229
+ var RuntimeEditorService = /** @class */ (function () {
1230
+ function RuntimeEditorService(runtimeService) {
1231
+ var _this = this;
1232
+ this.runtimeService = runtimeService;
1233
+ this.editorModeSubj$ = new rxjs.BehaviorSubject(false);
1234
+ this.dragMode$ = new rxjs.BehaviorSubject(false);
1235
+ this.elementDropped$ = new rxjs.ReplaySubject();
1236
+ this.elementDeleted$ = new rxjs.ReplaySubject();
1237
+ this.editorMode$ = this.editorModeSubj$.asObservable();
1238
+ this.runtimeService.isInitialized$.subscribe(function () { var _a; return _this.editorModeSubj$.next(Boolean((_a = _this.runtimeService.config) === null || _a === void 0 ? void 0 : _a.uiBuilderMode)); });
1239
+ }
1240
+ RuntimeEditorService.prototype.applyPatch$ = function (patch) {
1241
+ return this.runtimeService.applyPatch$(patch);
1242
+ };
1243
+ RuntimeEditorService.prototype.toggleEditorMode = function () {
1244
+ this.editorModeSubj$.next(!this.editorModeSubj$.value);
1245
+ };
1246
+ return RuntimeEditorService;
1247
+ }());
1248
+ RuntimeEditorService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeEditorService, deps: [{ token: RuntimeService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1249
+ RuntimeEditorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeEditorService });
1250
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeEditorService, decorators: [{
1251
+ type: i0.Injectable
1252
+ }], ctorParameters: function () { return [{ type: RuntimeService }]; } });
1253
+
1254
+ var ElementDropHandleComponent = /** @class */ (function () {
1255
+ function ElementDropHandleComponent(runtimeService) {
1256
+ this.runtimeService = runtimeService;
1257
+ }
1258
+ ElementDropHandleComponent.prototype.handleDrop = function (e) {
1259
+ this.runtimeService.elementDropped$.next({
1260
+ element: e.data,
1261
+ index: this.index,
1262
+ path: this.parentPath,
1263
+ });
1264
+ };
1265
+ return ElementDropHandleComponent;
1266
+ }());
1267
+ ElementDropHandleComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleComponent, deps: [{ token: RuntimeEditorService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1268
+ ElementDropHandleComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ElementDropHandleComponent, selector: "vl-element-drop-handle", inputs: { index: "index", parentPath: "parentPath" }, ngImport: i0__namespace, template: "<div class=\"container\" dndDropzone (dndDrop)=\"handleDrop($event)\">\n <div class=\"handle\"></div>\n</div>\n", styles: [":host{width:0;position:relative}.container{width:40px;height:100%;position:absolute;transform:translate(-50%);display:flex;justify-content:center;align-items:center}.handle{display:none;background:red;height:calc(100% - 10px);width:2px;pointer-events:none}.container.dndDragover .handle{display:block}\n"], directives: [{ type: i2__namespace$1.DndDropzoneDirective, selector: "[dndDropzone]", inputs: ["dndDropzone", "dndEffectAllowed", "dndAllowExternal", "dndHorizontal", "dndDragoverClass", "dndDropzoneDisabledClass", "dndDisableIf", "dndDisableDropIf"], outputs: ["dndDragover", "dndDrop"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1269
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleComponent, decorators: [{
1270
+ type: i0.Component,
1271
+ args: [{
1272
+ selector: 'vl-element-drop-handle',
1273
+ templateUrl: './element-drop-handle.component.html',
1274
+ styleUrls: ['./element-drop-handle.component.scss'],
1275
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1276
+ }]
1277
+ }], ctorParameters: function () { return [{ type: RuntimeEditorService }]; }, propDecorators: { index: [{
1278
+ type: i0.Input
1279
+ }], parentPath: [{
1280
+ type: i0.Input
1281
+ }] } });
1282
+
1283
+ var ElementDropHandleModule = /** @class */ (function () {
1284
+ function ElementDropHandleModule() {
1285
+ }
1286
+ return ElementDropHandleModule;
1287
+ }());
1288
+ ElementDropHandleModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1289
+ ElementDropHandleModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, declarations: [ElementDropHandleComponent], imports: [i7.CommonModule, i2$1.DndModule], exports: [ElementDropHandleComponent] });
1290
+ ElementDropHandleModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, imports: [[i7.CommonModule, i2$1.DndModule]] });
1291
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, decorators: [{
1292
+ type: i0.NgModule,
1293
+ args: [{
1294
+ declarations: [ElementDropHandleComponent],
1295
+ imports: [i7.CommonModule, i2$1.DndModule],
1296
+ exports: [ElementDropHandleComponent],
1297
+ }]
1298
+ }] });
1299
+
1300
+ var ElementRendererModule = /** @class */ (function () {
1301
+ function ElementRendererModule() {
1302
+ }
1303
+ return ElementRendererModule;
1304
+ }());
1305
+ ElementRendererModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1306
+ ElementRendererModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, declarations: [ElementRendererComponent], exports: [ElementRendererComponent] });
1307
+ ElementRendererModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule });
1308
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, decorators: [{
1309
+ type: i0.NgModule,
1310
+ args: [{
1311
+ declarations: [ElementRendererComponent],
1312
+ exports: [ElementRendererComponent],
1313
+ }]
1314
+ }] });
1315
+
1316
+ var ElementChildrenComponent = /** @class */ (function () {
1317
+ function ElementChildrenComponent(elementContext, runtimeService, runtimeEditorService, cdr) {
1318
+ var _this = this;
1319
+ var _a, _b;
1320
+ this.elementContext = elementContext;
1321
+ this.runtimeService = runtimeService;
1322
+ this.runtimeEditorService = runtimeEditorService;
1323
+ this.cdr = cdr;
1324
+ this.destroyed$ = new rxjs.Subject();
1325
+ var path = (_b = (_a = this.elementContext) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.path;
1326
+ this.metadata$ = path ? this.runtimeService.getCompiledElement$(path) : rxjs.of(undefined);
1327
+ this.dragMode$ = rxjs.combineLatest([this.runtimeEditorService.editorMode$, this.runtimeEditorService.dragMode$]).pipe(rxjs.map(function (flags) { return flags.every(Boolean); }));
1328
+ this.runtimeService.updated$.pipe(rxjs.takeUntil(this.destroyed$)).subscribe(function () { return _this.cdr.detectChanges(); });
1329
+ }
1330
+ ElementChildrenComponent.prototype.ngOnDestroy = function () {
1331
+ this.destroyed$.next();
1332
+ this.destroyed$.complete();
1333
+ };
1334
+ return ElementChildrenComponent;
1335
+ }());
1336
+ ElementChildrenComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenComponent, deps: [{ token: ElementContextService }, { token: RuntimeService }, { token: RuntimeEditorService }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1337
+ ElementChildrenComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ElementChildrenComponent, selector: "element-children", ngImport: i0__namespace, template: "<ng-container *ngIf=\"metadata$ | async as metadata\">\n <vl-element-drop-handle *ngIf=\"dragMode$ | async\" [index]=\"0\" [parentPath]=\"metadata.path\"></vl-element-drop-handle>\n <ng-container *ngFor=\"let child of metadata.children; let i = index\">\n <vl-cms-element-renderer [meta]=\"child\"></vl-cms-element-renderer>\n <vl-element-drop-handle\n *ngIf=\"dragMode$ | async\"\n [index]=\"i + 1\"\n [parentPath]=\"metadata.path\"\n ></vl-element-drop-handle>\n </ng-container>\n</ng-container>\n", styles: [":host{display:contents}\n"], components: [{ type: ElementDropHandleComponent, selector: "vl-element-drop-handle", inputs: ["index", "parentPath"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1338
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenComponent, decorators: [{
1339
+ type: i0.Component,
1340
+ args: [{
1341
+ // eslint-disable-next-line @angular-eslint/component-selector
1173
1342
  selector: 'element-children',
1174
1343
  templateUrl: 'element-children.component.html',
1175
1344
  styleUrls: ['./element-children.component.scss'],
1176
1345
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
1177
1346
  }]
1178
- }], ctorParameters: function () { return [{ type: ElementContextService }]; } });
1347
+ }], ctorParameters: function () { return [{ type: ElementContextService }, { type: RuntimeService }, { type: RuntimeEditorService }, { type: i0__namespace.ChangeDetectorRef }]; } });
1348
+
1349
+ var ElementChildrenModule = /** @class */ (function () {
1350
+ function ElementChildrenModule() {
1351
+ }
1352
+ return ElementChildrenModule;
1353
+ }());
1354
+ ElementChildrenModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1355
+ ElementChildrenModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, declarations: [ElementChildrenComponent], imports: [i1.LetDirectiveModule, ElementRendererModule, ElementDropHandleModule], exports: [ElementChildrenComponent] });
1356
+ ElementChildrenModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, imports: [[i1.LetDirectiveModule, ElementRendererModule, ElementDropHandleModule]] });
1357
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, decorators: [{
1358
+ type: i0.NgModule,
1359
+ args: [{
1360
+ declarations: [ElementChildrenComponent],
1361
+ imports: [i1.LetDirectiveModule, ElementRendererModule, ElementDropHandleModule],
1362
+ exports: [ElementChildrenComponent],
1363
+ }]
1364
+ }] });
1365
+
1366
+ var PreviewModule = /** @class */ (function () {
1367
+ function PreviewModule() {
1368
+ }
1369
+ return PreviewModule;
1370
+ }());
1371
+ PreviewModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1372
+ PreviewModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, declarations: [PreviewComponent], imports: [i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule, ElementDropHandleModule], exports: [PreviewComponent] });
1373
+ PreviewModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, providers: [IntegrationState], imports: [[i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule, ElementDropHandleModule]] });
1374
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, decorators: [{
1375
+ type: i0.NgModule,
1376
+ args: [{
1377
+ declarations: [PreviewComponent],
1378
+ imports: [i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule, ElementDropHandleModule],
1379
+ providers: [IntegrationState],
1380
+ exports: [PreviewComponent],
1381
+ }]
1382
+ }] });
1383
+
1384
+ function ElementDefinition(definition) {
1385
+ return function (constructor) {
1386
+ return constructor;
1387
+ };
1388
+ }
1179
1389
 
1180
1390
  // eslint-disable-next-line @angular-eslint/directive-selector
1181
1391
  var CustomTemplateDirective = /** @class */ (function () {
@@ -1191,170 +1401,305 @@
1191
1401
  };
1192
1402
  return CustomTemplateDirective;
1193
1403
  }());
1194
- CustomTemplateDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CustomTemplateDirective, deps: [{ token: i0__namespace.TemplateRef }, { token: TemplatesService }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1195
- CustomTemplateDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0__namespace });
1196
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: CustomTemplateDirective, decorators: [{
1404
+ CustomTemplateDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CustomTemplateDirective, deps: [{ token: i0__namespace.TemplateRef }, { token: TemplatesService }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1405
+ CustomTemplateDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0__namespace });
1406
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CustomTemplateDirective, decorators: [{
1197
1407
  type: i0.Directive,
1198
1408
  args: [{ selector: '[customTemplate]' }]
1199
1409
  }], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }, { type: TemplatesService }]; }, propDecorators: { customTemplate: [{
1200
1410
  type: i0.Input
1201
1411
  }] } });
1202
1412
 
1203
- var defaultOptions = {
1204
- suppressLoading: false,
1205
- loadingLabel: 'LOADING',
1206
- };
1207
-
1208
- var moduleMap = {};
1209
- function loadRemoteEntry(remoteEntry) {
1210
- return new Promise(function (resolve, reject) {
1211
- if (moduleMap[remoteEntry]) {
1212
- resolve();
1213
- return;
1214
- }
1215
- var script = document.createElement('script');
1216
- script.src = remoteEntry;
1217
- script.onerror = reject;
1218
- script.onload = function () {
1219
- moduleMap[remoteEntry] = true;
1220
- resolve(); // window is the global namespace
1221
- };
1222
- document.body.append(script);
1223
- });
1224
- }
1225
- function lookupExposedModule(remoteName, exposedModule) {
1226
- return __awaiter(this, void 0, void 0, function () {
1227
- var container, factory, Module;
1228
- return __generator(this, function (_a) {
1229
- switch (_a.label) {
1230
- case 0:
1231
- // Initializes the share scope. This fills it with known provided modules from this build and all remotes
1232
- return [4 /*yield*/, __webpack_init_sharing__('default')];
1233
- case 1:
1234
- // Initializes the share scope. This fills it with known provided modules from this build and all remotes
1235
- _a.sent();
1236
- container = window[remoteName];
1237
- // Initialize the container, it may provide shared modules
1238
- return [4 /*yield*/, container.init(__webpack_share_scopes__.default)];
1239
- case 2:
1240
- // Initialize the container, it may provide shared modules
1241
- _a.sent();
1242
- return [4 /*yield*/, container.get(exposedModule)];
1243
- case 3:
1244
- factory = _a.sent();
1245
- Module = factory();
1246
- return [2 /*return*/, Module];
1413
+ var IOPlugin = /** @class */ (function () {
1414
+ function IOPlugin(host) {
1415
+ var _this = this;
1416
+ var _a, _b;
1417
+ this.host = host;
1418
+ var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
1419
+ var inputProvider = this.host.injector.get(IOProviderService);
1420
+ var inputs = Object.entries((_a = elementMetadata.inputs) !== null && _a !== void 0 ? _a : {});
1421
+ var outputs = Object.entries((_b = elementMetadata.outputs) !== null && _b !== void 0 ? _b : {});
1422
+ inputs.forEach(function (_c) {
1423
+ var _d = __read(_c, 2), key = _d[0], path = _d[1];
1424
+ var _a;
1425
+ if (path && typeof path !== 'string') {
1426
+ console.error("The value of '" + key + "' input should be a string");
1427
+ }
1428
+ if (((_a = elementMetadata.outputs) === null || _a === void 0 ? void 0 : _a[key]) !== undefined) {
1429
+ console.warn("'" + key + "' appears both in inputs and outputs. To prevent inconsistent behavior please keep them unique ");
1247
1430
  }
1431
+ _this.host[key] = inputProvider.connect(elementMetadata, key, path);
1248
1432
  });
1249
- });
1250
- }
1251
- function loadRemoteModule(remoteEntry, remoteName, exposedModule) {
1252
- return __awaiter(this, void 0, void 0, function () {
1253
- return __generator(this, function (_a) {
1254
- switch (_a.label) {
1255
- case 0: return [4 /*yield*/, loadRemoteEntry(remoteEntry)];
1256
- case 1:
1257
- _a.sent();
1258
- return [4 /*yield*/, lookupExposedModule(remoteName, exposedModule)];
1259
- case 2: return [2 /*return*/, _a.sent()];
1433
+ outputs.forEach(function (_c) {
1434
+ var _d = __read(_c, 2), key = _d[0], path = _d[1];
1435
+ if (path && typeof path !== 'string') {
1436
+ console.error("The value of '" + key + "' output should be a string");
1260
1437
  }
1438
+ _this.host[key] = inputProvider.provide(elementMetadata, key, path);
1261
1439
  });
1440
+ }
1441
+ return IOPlugin;
1442
+ }());
1443
+ IOPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1444
+ IOPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: IOPlugin, ngImport: i0__namespace });
1445
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOPlugin, decorators: [{
1446
+ type: i0.Directive
1447
+ }], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
1448
+
1449
+ var ScriptPlugin = /** @class */ (function () {
1450
+ function ScriptPlugin(host) {
1451
+ var _this = this;
1452
+ this.host = host;
1453
+ this.normalizeImports = function (script, elementPath) {
1454
+ var regexp = new RegExp("import([ \\n\\t]*(?:[^ \\n\\t\\{\\}]+[ \\n\\t]*,?)?(?:[ \\n\\t]*\\{(?:[ \\n\\t]*[^ \\n\\t\"'\\{\\}]+[ \\n\\t]*,?)+\\})?[ \\n\\t]*)from[ \\n\\t]*(['\"])([^'\"\\n]+)(?:['\"]);", 'g');
1455
+ var result = script.replace(regexp, function (match, g1, g2, src) {
1456
+ var imports = g1
1457
+ .trim()
1458
+ .slice(1, -1)
1459
+ .split(',')
1460
+ .map(function (item) { return item.trim(); });
1461
+ imports.forEach(function (item) {
1462
+ var _a;
1463
+ if (!((_a = _this.vendorMap[src]) === null || _a === void 0 ? void 0 : _a[item])) {
1464
+ throw new Error("Failed to import " + item + " from '" + src + "' in " + elementPath + "/script.ts");
1465
+ }
1466
+ });
1467
+ return "const " + g1 + " = vendor['" + src + "'];";
1468
+ });
1469
+ return result;
1470
+ };
1471
+ this.document = this.host.injector.get(i7.DOCUMENT);
1472
+ this.vendorMap = this.host.injector.get(VENDOR_MAP);
1473
+ var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
1474
+ var sharedElementMetadata = this.host.injector.get(SHARED_ELEMENT_METADATA);
1475
+ this.addScript(sharedElementMetadata);
1476
+ this.addScript(elementMetadata);
1477
+ }
1478
+ ScriptPlugin.prototype.addScript = function (metadata) {
1479
+ var _a;
1480
+ if (!(metadata === null || metadata === void 0 ? void 0 : metadata.script)) {
1481
+ return;
1482
+ }
1483
+ var id = btoa(core.UUID.UUID());
1484
+ var script = this.document.createElement('script');
1485
+ script.type = "text/javascript";
1486
+ var scriptContent = this.normalizeImports(metadata.script, (_a = metadata.path) !== null && _a !== void 0 ? _a : metadata.name);
1487
+ var classMatch = /export class (\S+)/.exec(scriptContent);
1488
+ var className = classMatch === null || classMatch === void 0 ? void 0 : classMatch[1];
1489
+ if (!classMatch || !className) {
1490
+ console.error("Script doesn't have exported class");
1491
+ return;
1492
+ }
1493
+ scriptContent = scriptContent.replace(classMatch[0], "class " + className);
1494
+ script.text = "var " + id + " = function(vendor) {" + scriptContent + "\n return " + className + "; };";
1495
+ this.document.body.appendChild(script);
1496
+ var ScriptClass = window[id](this.vendorMap);
1497
+ if (ScriptClass instanceof Object) {
1498
+ this.host.registerPlugin(new ScriptClass(this.host));
1499
+ }
1500
+ this.document.body.removeChild(script);
1501
+ };
1502
+ return ScriptPlugin;
1503
+ }());
1504
+ ScriptPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ScriptPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1505
+ ScriptPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: ScriptPlugin, ngImport: i0__namespace });
1506
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ScriptPlugin, decorators: [{
1507
+ type: i0.Directive
1508
+ }], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
1509
+
1510
+ /*
1511
+ * ScriptPlugin must always be the last plugin in the list to make sure user code is running after all pre-initializers.
1512
+ */
1513
+ var CONFIG = {
1514
+ CUSTOM: {
1515
+ component: exports.ElementComponent,
1516
+ plugins: [IOPlugin, ScriptPlugin],
1517
+ },
1518
+ CONTAINER: {
1519
+ component: exports.ElementComponent,
1520
+ defaultTemplate: '<element-children></element-children>',
1521
+ plugins: [ScriptPlugin],
1522
+ },
1523
+ SERVICE: {
1524
+ component: exports.ElementComponent,
1525
+ plugins: [IOPlugin, ScriptPlugin],
1526
+ suppressTemplate: true,
1527
+ suppressStyles: true,
1528
+ },
1529
+ REFERENCE: {
1530
+ component: exports.ElementComponent,
1531
+ plugins: [IOPlugin, ScriptPlugin],
1532
+ suppressTemplate: true,
1533
+ },
1534
+ };
1535
+
1536
+ var EXPORTED_CLASS_REGEX = /export class (\S+)/;
1537
+ var METADATA_DECORATOR_REGEX = /@ElementDefinition\(([\s\S]+)\)(\n|\r\n|.)*export class/g;
1538
+ var UiBuildError = /** @class */ (function (_super) {
1539
+ __extends(UiBuildError, _super);
1540
+ function UiBuildError(message, affectedMetadata) {
1541
+ var _this = _super.call(this, message) || this;
1542
+ _this.name = _this.constructor.name;
1543
+ _this.affectedMetadata = affectedMetadata;
1544
+ return _this;
1545
+ }
1546
+ return UiBuildError;
1547
+ }(Error));
1548
+ var elementToMetadata = function (el, parentPath) {
1549
+ var _a;
1550
+ var script = el.script && window.atob(el.script);
1551
+ var template = el.template && window.atob(el.template);
1552
+ var styles = el.styles && window.atob(el.styles);
1553
+ var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
1554
+ if (!exportedClassName) {
1555
+ throw new Error("Script doesn't have exported class");
1556
+ }
1557
+ var elementMetadata = extractElementMetadata(script || '');
1558
+ var path = (parentPath ? parentPath + '/' : '') + elementMetadata.name;
1559
+ return Object.assign(Object.assign({}, elementMetadata), { path: path, script: script === null || script === void 0 ? void 0 : script.replace(METADATA_DECORATOR_REGEX, 'export class'), template: template, styles: styles, children: el.children.map(function (child) { return elementToMetadata(child, path); }) });
1560
+ };
1561
+ var metadataToElement = function (metadata, recursive) {
1562
+ if (recursive === void 0) { recursive = true; }
1563
+ var elMetadata = {
1564
+ name: metadata.name,
1565
+ isShared: metadata.isShared,
1566
+ type: metadata.type,
1567
+ model: metadata.model,
1568
+ module: metadata.module,
1569
+ reference: metadata.reference,
1570
+ inputs: metadata.inputs,
1571
+ outputs: metadata.outputs,
1572
+ children: metadata.children.map(function (_e) {
1573
+ var name = _e.name;
1574
+ return name;
1575
+ }),
1576
+ configuredStyles: metadata.configuredStyles,
1577
+ };
1578
+ var normalizedElMetadata = normalizeElementMetadata(elMetadata);
1579
+ if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
1580
+ throw new UiBuildError("'" + metadata.name + "' component script is missing an exported class", metadata);
1581
+ }
1582
+ var script = metadata.script &&
1583
+ window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, "@ElementDefinition(" + stringifyElementMetadata(normalizedElMetadata) + ")\nexport class Script"));
1584
+ var template = metadata.template && window.btoa(metadata.template);
1585
+ var styles = metadata.styles && window.btoa(metadata.styles);
1586
+ return {
1587
+ script: script,
1588
+ template: template,
1589
+ styles: styles,
1590
+ children: recursive ? metadata.children.map(function (meta) { return metadataToElement(meta); }) : [],
1591
+ };
1592
+ };
1593
+ var normalizeElementMetadata = function (elementMetadata) {
1594
+ var _a, _b, _c, _d;
1595
+ var metadata = Object.assign({}, elementMetadata);
1596
+ // model
1597
+ var _e = (_a = metadata.model) !== null && _a !== void 0 ? _a : {}, lineItem = _e.lineItem, path = _e.path;
1598
+ var model = lineItem ? { lineItem: lineItem } : path ? { path: path } : undefined;
1599
+ if (model) {
1600
+ metadata.model = model;
1601
+ }
1602
+ else {
1603
+ delete metadata.model;
1604
+ }
1605
+ // module
1606
+ if (!metadata.module) {
1607
+ delete metadata.module;
1608
+ }
1609
+ // reference
1610
+ if (!metadata.reference) {
1611
+ delete metadata.reference;
1612
+ }
1613
+ // inputs
1614
+ var inputs = Object.entries((_b = metadata.inputs) !== null && _b !== void 0 ? _b : {}).reduce(function (acc, _e) {
1615
+ var _f;
1616
+ var _g = __read(_e, 2), key = _g[0], value = _g[1];
1617
+ return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
1618
+ }, {});
1619
+ if (inputs && Object.keys(inputs).length > 0) {
1620
+ metadata.inputs = inputs;
1621
+ }
1622
+ else {
1623
+ delete metadata.inputs;
1624
+ }
1625
+ // outputs
1626
+ var outputs = Object.entries((_c = metadata.outputs) !== null && _c !== void 0 ? _c : {}).reduce(function (acc, _e) {
1627
+ var _f;
1628
+ var _g = __read(_e, 2), key = _g[0], value = _g[1];
1629
+ return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
1630
+ }, {});
1631
+ if (outputs && Object.keys(outputs).length > 0) {
1632
+ metadata.outputs = outputs;
1633
+ }
1634
+ else {
1635
+ delete metadata.outputs;
1636
+ }
1637
+ // children
1638
+ if (!((_d = metadata.children) === null || _d === void 0 ? void 0 : _d.length)) {
1639
+ delete metadata.children;
1640
+ }
1641
+ // isShared
1642
+ if (!metadata.isShared) {
1643
+ delete metadata.isShared;
1644
+ }
1645
+ // configuredStyles
1646
+ if (!metadata.configuredStyles) {
1647
+ delete metadata.configuredStyles;
1648
+ }
1649
+ return metadata;
1650
+ };
1651
+ var extractElementMetadata = function (script) {
1652
+ var _a;
1653
+ var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
1654
+ // need to reset regex last index to prevent null result for next execution
1655
+ METADATA_DECORATOR_REGEX.lastIndex = 0;
1656
+ return new Function("return " + metadataString)();
1657
+ };
1658
+ var extendElementMetadata = function (script, extend) {
1659
+ var _a;
1660
+ var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
1661
+ // need to reset regex last index to prevent null result for next execution
1662
+ METADATA_DECORATOR_REGEX.lastIndex = 0;
1663
+ if (!metadataString) {
1664
+ return script;
1665
+ }
1666
+ var updated = Object.assign(Object.assign({}, new Function("return " + metadataString)()), extend);
1667
+ return script.replace(metadataString, stringifyElementMetadata(updated));
1668
+ };
1669
+ var getElementConfig = function (type) {
1670
+ return CONFIG[type];
1671
+ };
1672
+ var doesElementSupportIO = function (type) {
1673
+ var _a, _b;
1674
+ return (_b = (_a = getElementConfig(type).plugins) === null || _a === void 0 ? void 0 : _a.includes(IOPlugin)) !== null && _b !== void 0 ? _b : false;
1675
+ };
1676
+ function stringifyElementMetadata(elementMetadata) {
1677
+ var cleaned = JSON.stringify(elementMetadata, null, 2);
1678
+ return cleaned.replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm, function (match) {
1679
+ return match.replace(/"/g, '');
1262
1680
  });
1263
1681
  }
1264
-
1265
- var FederatedComponent = /** @class */ (function () {
1266
- function FederatedComponent(injector, compiler, appRef, renderer) {
1267
- this.injector = injector;
1268
- this.compiler = compiler;
1269
- this.appRef = appRef;
1270
- this.renderer = renderer;
1271
- this.isLoading$ = new rxjs.BehaviorSubject(false);
1272
- // configs
1273
- this.suppressLoading = defaultOptions.suppressLoading;
1274
- this.loadingLabel = defaultOptions.loadingLabel;
1682
+ var isValidScript = function (script) {
1683
+ var _a;
1684
+ if (!script) {
1685
+ return false;
1275
1686
  }
1276
- FederatedComponent.prototype.ngOnChanges = function (changes) {
1277
- var _a, _b, _c, _d;
1278
- if (changes.data && this.instance) {
1279
- this.instance.data = this.data;
1280
- }
1281
- if (changes.options) {
1282
- this.suppressLoading = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.suppressLoading) !== null && _b !== void 0 ? _b : defaultOptions.suppressLoading;
1283
- this.loadingLabel = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.loadingLabel) !== null && _d !== void 0 ? _d : defaultOptions.loadingLabel;
1284
- }
1285
- };
1286
- FederatedComponent.prototype.ngOnInit = function () {
1287
- this.isLoading$.next(true);
1288
- };
1289
- FederatedComponent.prototype.ngAfterViewInit = function () {
1290
- var _this = this;
1291
- var _a, _b, _c, _d, _e, _f;
1292
- var remoteEntry = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.remoteEntry) !== null && _b !== void 0 ? _b : this.remoteEntry;
1293
- var remoteName = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.remoteName) !== null && _d !== void 0 ? _d : this.remoteName;
1294
- var exposedModule = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.exposedModule) !== null && _f !== void 0 ? _f : this.exposedModule;
1295
- if (!remoteEntry || !remoteName || !exposedModule) {
1296
- return;
1297
- }
1298
- loadRemoteModule(remoteEntry, remoteName, exposedModule).then(function (federated) {
1299
- _this.compiler.compileModuleAsync(federated[exposedModule]).then(function (moduleFactory) {
1300
- var _a, _b, _c;
1301
- var rootModuleRef = moduleFactory.create(_this.injector);
1302
- var rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[exposedModule].rootComponent);
1303
- var node = document.createElement('div');
1304
- var _g = rootComponentFactory.create(_this.injector, [], node), instance = _g.instance, hostView = _g.hostView;
1305
- _this.instance = instance;
1306
- _this.instance.data = _this.data;
1307
- _this.renderer.appendChild((_a = _this.moduleHostRef) === null || _a === void 0 ? void 0 : _a.nativeElement, node);
1308
- _this.appRef.attachView(hostView);
1309
- (_c = (_b = _this.options) === null || _b === void 0 ? void 0 : _b.onReady) === null || _c === void 0 ? void 0 : _c.call(_b);
1310
- _this.isLoading$.next(false);
1311
- });
1312
- });
1313
- };
1314
- return FederatedComponent;
1315
- }());
1316
- FederatedComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedComponent, deps: [{ token: i0__namespace.Injector }, { token: i0__namespace.Compiler }, { token: i0__namespace.ApplicationRef }, { token: i0__namespace.Renderer2 }], target: i0__namespace.ɵɵFactoryTarget.Component });
1317
- FederatedComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", options: "options" }, viewQueries: [{ propertyName: "moduleHostRef", first: true, predicate: ["moduleHost"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div #moduleHost></div>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"], components: [{ type: i1__namespace.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i7__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1318
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedComponent, decorators: [{
1319
- type: i0.Component,
1320
- args: [{
1321
- // eslint-disable-next-line @angular-eslint/component-selector
1322
- selector: 'veloce-host-federated',
1323
- templateUrl: './federated.component.html',
1324
- styleUrls: ['./federated.component.scss'],
1325
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1326
- }]
1327
- }], ctorParameters: function () { return [{ type: i0__namespace.Injector }, { type: i0__namespace.Compiler }, { type: i0__namespace.ApplicationRef }, { type: i0__namespace.Renderer2 }]; }, propDecorators: { moduleHostRef: [{
1328
- type: i0.ViewChild,
1329
- args: ['moduleHost', { static: false }]
1330
- }], remoteEntry: [{
1331
- type: i0.Input
1332
- }], remoteName: [{
1333
- type: i0.Input
1334
- }], exposedModule: [{
1335
- type: i0.Input
1336
- }], data: [{
1337
- type: i0.Input
1338
- }], options: [{
1339
- type: i0.Input
1340
- }] } });
1341
-
1342
- var FederatedModule = /** @class */ (function () {
1343
- function FederatedModule() {
1687
+ var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
1688
+ if (!exportedClassName) {
1689
+ return false;
1344
1690
  }
1345
- return FederatedModule;
1346
- }());
1347
- FederatedModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1348
- FederatedModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedModule, declarations: [FederatedComponent], imports: [i7.CommonModule, i1.LoaderModule], exports: [FederatedComponent] });
1349
- FederatedModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedModule, imports: [[i7.CommonModule, i1.LoaderModule]] });
1350
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FederatedModule, decorators: [{
1351
- type: i0.NgModule,
1352
- args: [{
1353
- declarations: [FederatedComponent],
1354
- imports: [i7.CommonModule, i1.LoaderModule],
1355
- exports: [FederatedComponent],
1356
- }]
1357
- }] });
1691
+ var meta = extractElementMetadata(script);
1692
+ if (!meta.name || !meta.type) {
1693
+ return false;
1694
+ }
1695
+ return true;
1696
+ };
1697
+ function flattenElements(elements) {
1698
+ return lodash.flatten(elements.map(function (el) { return __spreadArray([el], __read(flattenElements(el.children))); }));
1699
+ }
1700
+ function isSharedElement(el) {
1701
+ return Boolean(el.isShared) && el.type !== 'REFERENCE';
1702
+ }
1358
1703
 
1359
1704
  var ConfigurationPlugin = /** @class */ (function () {
1360
1705
  function ConfigurationPlugin(host) {
@@ -1399,7 +1744,15 @@
1399
1744
  }
1400
1745
  _this.configurationService.patch(new i2.LineItemWorker(rootLineItem).remove(_this.modelSnapshot.id).li);
1401
1746
  };
1747
+ var updateQty = function (qty) {
1748
+ var rootLineItem = _this.configurationService.getSnapshot();
1749
+ if (!rootLineItem || !_this.modelSnapshot) {
1750
+ return;
1751
+ }
1752
+ _this.configurationService.patch(new i2.LineItemWorker(rootLineItem).replace(Object.assign(Object.assign({}, _this.modelSnapshot), { qty: qty })).li);
1753
+ };
1402
1754
  this.typeHost.remove = remove;
1755
+ this.typeHost.updateQty = updateQty;
1403
1756
  };
1404
1757
  ConfigurationPlugin.prototype.registerPort = function (name) {
1405
1758
  var _this = this;
@@ -1460,9 +1813,9 @@
1460
1813
  });
1461
1814
  return ConfigurationPlugin;
1462
1815
  }());
1463
- ConfigurationPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationPlugin, deps: "invalid", target: i0__namespace.ɵɵFactoryTarget.Directive });
1464
- ConfigurationPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: ConfigurationPlugin, ngImport: i0__namespace });
1465
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ConfigurationPlugin, decorators: [{
1816
+ ConfigurationPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationPlugin, deps: "invalid", target: i0__namespace.ɵɵFactoryTarget.Directive });
1817
+ ConfigurationPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: ConfigurationPlugin, ngImport: i0__namespace });
1818
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationPlugin, decorators: [{
1466
1819
  type: i0.Directive
1467
1820
  }], ctorParameters: function () { return [{ type: undefined }]; } });
1468
1821
 
@@ -1471,55 +1824,16 @@
1471
1824
  DEFAULT: [],
1472
1825
  };
1473
1826
 
1474
- var InitAction = { type: 'INIT' };
1475
- var ClearAction = { type: 'CLEAR' };
1476
- var IntegrationState = /** @class */ (function () {
1477
- function IntegrationState() {
1478
- this.stateSubj$ = new rxjs.BehaviorSubject({});
1479
- this.action$ = new rxjs.BehaviorSubject(InitAction);
1480
- }
1481
- Object.defineProperty(IntegrationState.prototype, "state$", {
1482
- get: function () {
1483
- return this.stateSubj$.asObservable();
1484
- },
1485
- enumerable: false,
1486
- configurable: true
1487
- });
1488
- Object.defineProperty(IntegrationState.prototype, "state", {
1489
- get: function () {
1490
- return this.stateSubj$.getValue();
1491
- },
1492
- enumerable: false,
1493
- configurable: true
1494
- });
1495
- IntegrationState.prototype.patchState = function (update) {
1496
- this.stateSubj$.next(Object.assign(Object.assign({}, this.stateSubj$.getValue()), update));
1497
- };
1498
- IntegrationState.prototype.dispatch = function (action) {
1499
- this.action$.next(action);
1500
- };
1501
- IntegrationState.prototype.listen$ = function (actionType) {
1502
- return this.action$.pipe(rxjs.filter(function (action) { return action.type === actionType; }), rxjs.map(function (action) { return action.payload; }));
1503
- };
1504
- IntegrationState.prototype.listenAll$ = function () {
1505
- return this.action$.asObservable();
1506
- };
1507
- IntegrationState.prototype.clear = function () {
1508
- this.stateSubj$.next({});
1509
- this.action$.next(ClearAction);
1510
- };
1511
- return IntegrationState;
1512
- }());
1513
- IntegrationState.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IntegrationState, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1514
- IntegrationState.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IntegrationState, providedIn: 'root' });
1515
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: IntegrationState, decorators: [{
1516
- type: i0.Injectable,
1517
- args: [{ providedIn: 'root' }]
1518
- }] });
1519
-
1520
1827
  var VELOCE_LIBS = {
1521
- '@veloceapps/sdk/core': Object.assign({ ConfigurationService: i2.ConfigurationService, QuoteDraftService: i2.QuoteDraftService, FlowConfigurationService: i2.FlowConfigurationService, LineItemWorker: i2.LineItemWorker, ProductImagesService: i2.ProductImagesService }, i2.lineItemUtils),
1522
- '@veloceapps/sdk/cms': Object.assign(Object.assign(Object.assign({}, cmsInjectionTokens), cmsActions), { TemplatesService: TemplatesService, IntegrationState: IntegrationState }),
1828
+ '@veloceapps/core': {
1829
+ isDefined: core.isDefined,
1830
+ Operator: core.Operator,
1831
+ Predicate: core.Predicate,
1832
+ parseJsonSafely: core.parseJsonSafely,
1833
+ },
1834
+ '@veloceapps/components': {
1835
+ ToastService: i1.ToastService,
1836
+ },
1523
1837
  '@veloceapps/api': {
1524
1838
  SalesforceApiService: api.SalesforceApiService,
1525
1839
  QuoteApiService: api.QuoteApiService,
@@ -1531,7 +1845,11 @@
1531
1845
  PicklistsApiService: api.PicklistsApiService,
1532
1846
  PriceApiService: api.PriceApiService,
1533
1847
  ShoppingCartSettingsApiService: api.ShoppingCartSettingsApiService,
1848
+ ConfigurationSettingsApiService: api.ConfigurationSettingsApiService,
1849
+ GuidedSellingApiService: api.GuidedSellingApiService,
1534
1850
  },
1851
+ '@veloceapps/sdk/core': Object.assign({ ConfigurationService: i2.ConfigurationService, QuoteDraftService: i2.QuoteDraftService, FlowConfigurationService: i2.FlowConfigurationService, LineItemWorker: i2.LineItemWorker, ProductImagesService: i2.ProductImagesService, ContextService: i2.ContextService }, i2.lineItemUtils),
1852
+ '@veloceapps/sdk/cms': Object.assign(Object.assign(Object.assign({}, cmsInjectionTokens), cmsActions), { TemplatesService: TemplatesService, IntegrationState: IntegrationState, ResourcesService: ResourcesService }),
1535
1853
  };
1536
1854
  var VELOCE_LIBS_BACKWARDS_COMPATIBLE = Object.entries(VELOCE_LIBS).reduce(function (trunk, _a) {
1537
1855
  var _b;
@@ -1541,19 +1859,32 @@
1541
1859
  var vendorMap = Object.assign(Object.assign(Object.assign({}, VELOCE_LIBS), VELOCE_LIBS_BACKWARDS_COMPATIBLE), { '@angular/core': i0__namespace, '@angular/forms': angularForms__namespace, rxjs: rxjs__namespace, 'rxjs/operators': rxjsOperators__namespace, lodash: lodash__namespace });
1542
1860
 
1543
1861
  var ElementsResolver = /** @class */ (function () {
1544
- function ElementsResolver(uiDef, elements) {
1862
+ function ElementsResolver(uiDef, elements, sharedElements) {
1545
1863
  var _this = this;
1864
+ if (sharedElements === void 0) { sharedElements = []; }
1546
1865
  this.uiDef = uiDef;
1547
1866
  this.renderableElements = [];
1548
1867
  this.sharedElements = [];
1549
1868
  var transpiledElements = this.transpileScripts(elements);
1550
- this.sharedElements = this.flattenElements(transpiledElements).filter(function (el) { return _this.isSharedElement(el); });
1551
- this.elements = transpiledElements.map(function (el) { return _this.processElementMetadata(el); }).filter(Boolean);
1869
+ var transpiledSharedElements = this.transpileScripts(sharedElements);
1870
+ this.sharedElements = this.flattenElements(transpiledElements)
1871
+ .filter(function (el) { return _this.isSharedElement(el); })
1872
+ .concat(transpiledSharedElements);
1873
+ this.elements = transpiledElements.map(function (el) { return _this.processElementMetadata(el); }).filter(core.isDefined);
1552
1874
  this.renderableElements = this.getRenderableElements(this.elements);
1553
1875
  }
1876
+ ElementsResolver.prototype.addElement = function (element) {
1877
+ var _this = this;
1878
+ if (element.isShared) {
1879
+ return;
1880
+ }
1881
+ var transpiledElements = this.transpileScripts([element]);
1882
+ this.elements = transpiledElements.map(function (el) { return _this.processElementMetadata(el); }).filter(core.isDefined);
1883
+ this.renderableElements = this.getRenderableElements(this.elements);
1884
+ };
1554
1885
  ElementsResolver.prototype.getNgComponents = function () {
1555
1886
  var _this = this;
1556
- return this.renderableElements.map(function (el) { return _this.resolveElement(el); }).filter(Boolean);
1887
+ return this.renderableElements.map(function (el) { return _this.resolveElement(el); }).filter(core.isDefined);
1557
1888
  };
1558
1889
  ElementsResolver.prototype.transpile = function (el) {
1559
1890
  var _a;
@@ -1635,9 +1966,7 @@
1635
1966
  }
1636
1967
  finalElement.template = this.resolveElementTemplate(finalElement);
1637
1968
  finalElement.styles = this.resolveElementStyles(finalElement);
1638
- return Object.assign(Object.assign({}, finalElement), { children: finalElement.children
1639
- .map(function (child) { return _this.processElementMetadata(child); })
1640
- .filter(Boolean) });
1969
+ return Object.assign(Object.assign({}, finalElement), { children: finalElement.children.map(function (child) { return _this.processElementMetadata(child); }).filter(core.isDefined) });
1641
1970
  };
1642
1971
  ElementsResolver.prototype.getSharedChildren = function (children, parentPath) {
1643
1972
  var _this = this;
@@ -1672,256 +2001,391 @@
1672
2001
  function C() {
1673
2002
  return _super !== null && _super.apply(this, arguments) || this;
1674
2003
  }
1675
- return C;
1676
- }(config.component)));
1677
- lodash.set(cmp, 'path', element.path);
1678
- return cmp;
1679
- };
1680
- ElementsResolver.prototype.getElementStyles = function (element) {
1681
- var result = '';
1682
- var configuredStyles = this.convertInlineStylesToCSS(element.configuredStyles);
1683
- if (configuredStyles) {
1684
- // order is important: styles written by user in CSS code should has higher priority
1685
- result += configuredStyles;
1686
- }
1687
- if (element.styles) {
1688
- result += element.styles;
1689
- }
1690
- return result || undefined;
1691
- };
1692
- ElementsResolver.prototype.convertInlineStylesToCSS = function (styles) {
1693
- if (!styles) {
1694
- return '';
1695
- }
1696
- var entries = Object.entries(styles);
1697
- var result = ':host {\n';
1698
- entries.forEach(function (_c) {
1699
- var _d = __read(_c, 2), style = _d[0], value = _d[1];
1700
- result += " " + lodash.kebabCase(style) + ":" + value + ";\n";
2004
+ return C;
2005
+ }(config.component)));
2006
+ lodash.set(cmp, 'path', element.path);
2007
+ return cmp;
2008
+ };
2009
+ ElementsResolver.prototype.getElementStyles = function (element) {
2010
+ var result = '';
2011
+ var configuredStyles = this.convertInlineStylesToCSS(element.configuredStyles);
2012
+ if (configuredStyles) {
2013
+ // order is important: styles written by user in CSS code should has higher priority
2014
+ result += configuredStyles;
2015
+ }
2016
+ if (element.styles) {
2017
+ result += element.styles;
2018
+ }
2019
+ return result || undefined;
2020
+ };
2021
+ ElementsResolver.prototype.convertInlineStylesToCSS = function (styles) {
2022
+ if (!styles) {
2023
+ return '';
2024
+ }
2025
+ var entries = Object.entries(styles);
2026
+ var result = ':host {\n';
2027
+ entries.forEach(function (_c) {
2028
+ var _d = __read(_c, 2), style = _d[0], value = _d[1];
2029
+ result += " " + lodash.kebabCase(style) + ":" + value + ";\n";
2030
+ });
2031
+ result += '}\n';
2032
+ return result;
2033
+ };
2034
+ return ElementsResolver;
2035
+ }());
2036
+
2037
+ var defaultOptions = {
2038
+ suppressLoading: false,
2039
+ loadingLabel: 'LOADING',
2040
+ };
2041
+
2042
+ var moduleMap = {};
2043
+ function loadRemoteEntry(remoteEntry) {
2044
+ return new Promise(function (resolve, reject) {
2045
+ if (moduleMap[remoteEntry]) {
2046
+ resolve();
2047
+ return;
2048
+ }
2049
+ var script = document.createElement('script');
2050
+ script.src = remoteEntry;
2051
+ script.onerror = reject;
2052
+ script.onload = function () {
2053
+ moduleMap[remoteEntry] = true;
2054
+ resolve(); // window is the global namespace
2055
+ };
2056
+ document.body.append(script);
2057
+ });
2058
+ }
2059
+ function lookupExposedModule(remoteName, exposedModule) {
2060
+ return __awaiter(this, void 0, void 0, function () {
2061
+ var container, factory, Module;
2062
+ return __generator(this, function (_a) {
2063
+ switch (_a.label) {
2064
+ case 0:
2065
+ // Initializes the share scope. This fills it with known provided modules from this build and all remotes
2066
+ return [4 /*yield*/, __webpack_init_sharing__('default')];
2067
+ case 1:
2068
+ // Initializes the share scope. This fills it with known provided modules from this build and all remotes
2069
+ _a.sent();
2070
+ container = window[remoteName];
2071
+ // Initialize the container, it may provide shared modules
2072
+ return [4 /*yield*/, container.init(__webpack_share_scopes__.default)];
2073
+ case 2:
2074
+ // Initialize the container, it may provide shared modules
2075
+ _a.sent();
2076
+ return [4 /*yield*/, container.get(exposedModule)];
2077
+ case 3:
2078
+ factory = _a.sent();
2079
+ Module = factory();
2080
+ return [2 /*return*/, Module];
2081
+ }
1701
2082
  });
1702
- result += '}\n';
1703
- return result;
1704
- };
1705
- return ElementsResolver;
1706
- }());
1707
-
1708
- var LauncherService = /** @class */ (function () {
1709
- function LauncherService(compiler, dynamicModuleService) {
1710
- this.compiler = compiler;
1711
- this.dynamicModuleService = dynamicModuleService;
1712
- }
1713
- LauncherService.prototype.compileModule = function (uiDef, elements) {
1714
- var _this = this;
1715
- var elementsResolver = new ElementsResolver(uiDef, elements);
1716
- this.dynamicModuleService.elementsTree = elementsResolver.elements;
1717
- this.module = this.getModule(elementsResolver.getNgComponents());
1718
- return rxjs.from(this.compiler.compileModuleAndAllComponentsAsync(this.module)).pipe(rxjs.tap(function (m) {
1719
- _this.dynamicModuleService.componentFactories = m.componentFactories;
1720
- _this.moduleInstance = m;
1721
- }), rxjs.map(function (m) { return ({ module: m, elements: elementsResolver.elements }); }));
1722
- };
1723
- LauncherService.prototype.destroy = function () {
1724
- if (this.moduleInstance) {
1725
- this.dynamicModuleService.clear();
1726
- this.moduleInstance = undefined;
1727
- }
1728
- if (this.module) {
1729
- this.compiler.clearCacheFor(this.module);
1730
- this.module = undefined;
1731
- }
1732
- };
1733
- LauncherService.prototype.getModule = function (components) {
1734
- var staticComponents = [ElementChildrenComponent, ElementRendererComponent, CustomTemplateDirective];
1735
- var DynamicModule = /** @class */ (function () {
1736
- function DynamicModule() {
2083
+ });
2084
+ }
2085
+ function loadRemoteModule(remoteEntry, remoteName, exposedModule) {
2086
+ return __awaiter(this, void 0, void 0, function () {
2087
+ return __generator(this, function (_a) {
2088
+ switch (_a.label) {
2089
+ case 0: return [4 /*yield*/, loadRemoteEntry(remoteEntry)];
2090
+ case 1:
2091
+ _a.sent();
2092
+ return [4 /*yield*/, lookupExposedModule(remoteName, exposedModule)];
2093
+ case 2: return [2 /*return*/, _a.sent()];
1737
2094
  }
1738
- return DynamicModule;
1739
- }());
1740
- DynamicModule = __decorate([
1741
- i0.NgModule({
1742
- imports: [i7.CommonModule, angularForms.FormsModule, angularForms.ReactiveFormsModule, FederatedModule, dragDrop.DragDropModule, scrolling.ScrollingModule],
1743
- declarations: __spreadArray(__spreadArray([], __read(staticComponents)), __read(components)),
1744
- jit: true,
1745
- })
1746
- ], DynamicModule);
1747
- return DynamicModule;
1748
- };
1749
- return LauncherService;
1750
- }());
1751
- LauncherService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherService, deps: [{ token: i0__namespace.Compiler }, { token: DynamicModuleService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1752
- LauncherService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherService });
1753
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherService, decorators: [{
1754
- type: i0.Injectable
1755
- }], ctorParameters: function () { return [{ type: i0__namespace.Compiler }, { type: DynamicModuleService }]; } });
2095
+ });
2096
+ });
2097
+ }
1756
2098
 
1757
- var PreviewComponent = /** @class */ (function () {
1758
- function PreviewComponent(launcherService, configurationService, messageService, runtimeService, integrationState) {
1759
- this.launcherService = launcherService;
1760
- this.configurationService = configurationService;
1761
- this.messageService = messageService;
1762
- this.runtimeService = runtimeService;
1763
- this.integrationState = integrationState;
1764
- this.clearState = false;
1765
- this.state$ = new rxjs.BehaviorSubject({ loading: true, failure: false });
1766
- this.elements = [];
1767
- this.destroy$ = new rxjs.Subject();
2099
+ var FederatedComponent = /** @class */ (function () {
2100
+ function FederatedComponent(injector, compiler, appRef, renderer) {
2101
+ this.injector = injector;
2102
+ this.compiler = compiler;
2103
+ this.appRef = appRef;
2104
+ this.renderer = renderer;
2105
+ this.isLoading$ = new rxjs.BehaviorSubject(false);
2106
+ // configs
2107
+ this.suppressLoading = defaultOptions.suppressLoading;
2108
+ this.loadingLabel = defaultOptions.loadingLabel;
1768
2109
  }
1769
- PreviewComponent.prototype.ngOnInit = function () {
1770
- if (this.clearState) {
1771
- this.integrationState.clear();
1772
- }
1773
- this.startPreview();
1774
- };
1775
- PreviewComponent.prototype.ngOnDestroy = function () {
1776
- this.destroy$.next();
1777
- this.destroy$.complete();
1778
- this.configurationService.reset();
1779
- };
1780
- PreviewComponent.prototype.initializeConfiguration$ = function () {
1781
- var _this = this;
1782
- var isAlreadyInitialized = this.runtimeService.isInitialized;
1783
- if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
1784
- return rxjs.of({});
2110
+ FederatedComponent.prototype.ngOnChanges = function (changes) {
2111
+ var _a, _b, _c, _d;
2112
+ if (changes.data && this.instance) {
2113
+ this.instance.data = this.data;
1785
2114
  }
1786
- if (!this.modelId) {
1787
- console.warn("No modelId is given for uiDefinition with '" + this.uiDefinition.type + "' type");
1788
- return rxjs.of({});
2115
+ if (changes.options) {
2116
+ this.suppressLoading = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.suppressLoading) !== null && _b !== void 0 ? _b : defaultOptions.suppressLoading;
2117
+ this.loadingLabel = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.loadingLabel) !== null && _d !== void 0 ? _d : defaultOptions.loadingLabel;
1789
2118
  }
1790
- // If still not initialized - init configuration in Test mode
1791
- return this.runtimeService
1792
- .initTestMode(this.modelId, this.uiDefinition)
1793
- .pipe(rxjs.switchMap(function () { return _this.configurationService.configure(); }));
1794
2119
  };
1795
- PreviewComponent.prototype.elementToMetadataSafe = function (elements) {
1796
- var _a, _b;
1797
- try {
1798
- return elements.map(function (element) { return elementToMetadata(element); });
1799
- }
1800
- catch (e) {
1801
- console.error(e);
1802
- if (!((_b = (_a = this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
1803
- this.messageService.add({ severity: 'error', summary: String(e) });
1804
- }
1805
- return [];
1806
- }
2120
+ FederatedComponent.prototype.ngOnInit = function () {
2121
+ this.isLoading$.next(true);
1807
2122
  };
1808
- PreviewComponent.prototype.startPreview = function () {
2123
+ FederatedComponent.prototype.ngAfterViewInit = function () {
1809
2124
  var _this = this;
1810
- if (!this.uiDefinition) {
2125
+ var _a, _b, _c, _d, _e, _f;
2126
+ var remoteEntry = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.remoteEntry) !== null && _b !== void 0 ? _b : this.remoteEntry;
2127
+ var remoteName = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.remoteName) !== null && _d !== void 0 ? _d : this.remoteName;
2128
+ var exposedModule = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.exposedModule) !== null && _f !== void 0 ? _f : this.exposedModule;
2129
+ if (!remoteEntry || !remoteName || !exposedModule) {
1811
2130
  return;
1812
2131
  }
1813
- var _a = this.uiDefinition, children = _a.children, uiDefinitionMeta = __rest(_a, ["children"]);
1814
- var elements = this.elementToMetadataSafe(children);
1815
- var compilation$ = this.launcherService.compileModule(uiDefinitionMeta, elements);
1816
- rxjs.forkJoin([compilation$, this.initializeConfiguration$()])
1817
- .pipe(rxjs.tap(function (_c) {
1818
- var _d = __read(_c, 1), result = _d[0];
1819
- _this.elements = result.elements;
1820
- _this.state$.next({ loading: false, failure: false });
1821
- }), rxjs.catchError(function (error) {
1822
- var _a, _b;
1823
- console.error(error);
1824
- if (!((_b = (_a = _this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
1825
- _this.messageService.add({ severity: 'error', summary: error });
1826
- }
1827
- _this.state$.next({ loading: false, failure: true });
1828
- return rxjs.of();
1829
- }), rxjs.takeUntil(this.destroy$))
1830
- .subscribe();
2132
+ loadRemoteModule(remoteEntry, remoteName, exposedModule).then(function (federated) {
2133
+ _this.compiler.compileModuleAsync(federated[exposedModule]).then(function (moduleFactory) {
2134
+ var _a, _b, _c;
2135
+ var rootModuleRef = moduleFactory.create(_this.injector);
2136
+ var rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[exposedModule].rootComponent);
2137
+ var node = document.createElement('div');
2138
+ var _g = rootComponentFactory.create(_this.injector, [], node), instance = _g.instance, hostView = _g.hostView;
2139
+ _this.instance = instance;
2140
+ _this.instance.data = _this.data;
2141
+ _this.renderer.appendChild((_a = _this.moduleHostRef) === null || _a === void 0 ? void 0 : _a.nativeElement, node);
2142
+ _this.appRef.attachView(hostView);
2143
+ (_c = (_b = _this.options) === null || _b === void 0 ? void 0 : _b.onReady) === null || _c === void 0 ? void 0 : _c.call(_b);
2144
+ _this.isLoading$.next(false);
2145
+ });
2146
+ });
1831
2147
  };
1832
- return PreviewComponent;
2148
+ return FederatedComponent;
1833
2149
  }());
1834
- PreviewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewComponent, deps: [{ token: LauncherService }, { token: i2__namespace.ConfigurationService }, { token: i3__namespace.MessageService }, { token: i2__namespace.ConfigurationRuntimeService }, { token: IntegrationState }], target: i0__namespace.ɵɵFactoryTarget.Component });
1835
- PreviewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition", clearState: "clearState" }, providers: [IOProviderService, TemplatesService], ngImport: i0__namespace, 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: i1__namespace.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i7__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush, encapsulation: i0__namespace.ViewEncapsulation.ShadowDom });
1836
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewComponent, decorators: [{
2150
+ FederatedComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedComponent, deps: [{ token: i0__namespace.Injector }, { token: i0__namespace.Compiler }, { token: i0__namespace.ApplicationRef }, { token: i0__namespace.Renderer2 }], target: i0__namespace.ɵɵFactoryTarget.Component });
2151
+ FederatedComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", options: "options" }, viewQueries: [{ propertyName: "moduleHostRef", first: true, predicate: ["moduleHost"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div #moduleHost></div>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"], components: [{ type: i1__namespace.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i7__namespace.AsyncPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
2152
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedComponent, decorators: [{
1837
2153
  type: i0.Component,
1838
2154
  args: [{
1839
- selector: 'vl-cms-preview',
1840
- templateUrl: './preview.component.html',
1841
- styleUrls: ['./preview.component.scss'],
2155
+ // eslint-disable-next-line @angular-eslint/component-selector
2156
+ selector: 'veloce-host-federated',
2157
+ templateUrl: './federated.component.html',
2158
+ styleUrls: ['./federated.component.scss'],
1842
2159
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
1843
- providers: [IOProviderService, TemplatesService],
1844
- // use shadow DOM to prevent UI from being affected by global styles
1845
- encapsulation: i0.ViewEncapsulation.ShadowDom,
1846
2160
  }]
1847
- }], ctorParameters: function () { return [{ type: LauncherService }, { type: i2__namespace.ConfigurationService }, { type: i3__namespace.MessageService }, { type: i2__namespace.ConfigurationRuntimeService }, { type: IntegrationState }]; }, propDecorators: { modelId: [{
2161
+ }], ctorParameters: function () { return [{ type: i0__namespace.Injector }, { type: i0__namespace.Compiler }, { type: i0__namespace.ApplicationRef }, { type: i0__namespace.Renderer2 }]; }, propDecorators: { moduleHostRef: [{
2162
+ type: i0.ViewChild,
2163
+ args: ['moduleHost', { static: false }]
2164
+ }], remoteEntry: [{
1848
2165
  type: i0.Input
1849
- }], uiDefinition: [{
2166
+ }], remoteName: [{
2167
+ type: i0.Input
2168
+ }], exposedModule: [{
1850
2169
  type: i0.Input
1851
- }], clearState: [{
2170
+ }], data: [{
2171
+ type: i0.Input
2172
+ }], options: [{
1852
2173
  type: i0.Input
1853
2174
  }] } });
1854
2175
 
1855
- var ElementRendererModule = /** @class */ (function () {
1856
- function ElementRendererModule() {
2176
+ var FederatedModule = /** @class */ (function () {
2177
+ function FederatedModule() {
1857
2178
  }
1858
- return ElementRendererModule;
2179
+ return FederatedModule;
1859
2180
  }());
1860
- ElementRendererModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementRendererModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1861
- ElementRendererModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementRendererModule, declarations: [ElementRendererComponent], exports: [ElementRendererComponent] });
1862
- ElementRendererModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementRendererModule });
1863
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementRendererModule, decorators: [{
2181
+ FederatedModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2182
+ FederatedModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, declarations: [FederatedComponent], imports: [i7.CommonModule, i1.LoaderModule], exports: [FederatedComponent] });
2183
+ FederatedModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, imports: [[i7.CommonModule, i1.LoaderModule]] });
2184
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, decorators: [{
1864
2185
  type: i0.NgModule,
1865
2186
  args: [{
1866
- declarations: [ElementRendererComponent],
1867
- exports: [ElementRendererComponent],
2187
+ declarations: [FederatedComponent],
2188
+ imports: [i7.CommonModule, i1.LoaderModule],
2189
+ exports: [FederatedComponent],
1868
2190
  }]
1869
2191
  }] });
1870
2192
 
1871
- var ElementChildrenModule = /** @class */ (function () {
1872
- function ElementChildrenModule() {
2193
+ var CompilationService = /** @class */ (function () {
2194
+ function CompilationService(compiler) {
2195
+ this.compiler = compiler;
1873
2196
  }
1874
- return ElementChildrenModule;
2197
+ CompilationService.prototype.compileUIDefinition$ = function (uiDefinition) {
2198
+ var _this = this;
2199
+ return rxjs.of([]).pipe(rxjs.switchMap(function () {
2200
+ var children = uiDefinition.children, pages = uiDefinition.pages, components = uiDefinition.components, uiDefinitionMeta = __rest(uiDefinition, ["children", "pages", "components"]);
2201
+ _this.uiDefinitionMeta = uiDefinitionMeta;
2202
+ var elements = __spreadArray(__spreadArray([], __read((children !== null && children !== void 0 ? children : []))), __read((pages !== null && pages !== void 0 ? pages : [])));
2203
+ var sharedElements = components !== null && components !== void 0 ? components : [];
2204
+ var metadata = elements.map(function (element) { return elementToMetadata(element); });
2205
+ var sharedMetadata = sharedElements.map(function (element) { return elementToMetadata(element); });
2206
+ _this.elementsResolver = new ElementsResolver(uiDefinition, metadata, sharedMetadata);
2207
+ var module = _this.getModule(_this.elementsResolver.getNgComponents());
2208
+ return rxjs.combineLatest([
2209
+ rxjs.from(_this.compiler.compileModuleAndAllComponentsAsync(module)),
2210
+ rxjs.of(_this.elementsResolver),
2211
+ ]);
2212
+ }), rxjs.map(function (_b) {
2213
+ var _c = __read(_b, 2), module = _c[0], elementsResolver = _c[1];
2214
+ return ({ module: module, elements: elementsResolver.elements });
2215
+ }));
2216
+ };
2217
+ CompilationService.prototype.compileElement$ = function (element) {
2218
+ var _this = this;
2219
+ if (!this.uiDefinitionMeta) {
2220
+ throw 'No UI Definition context';
2221
+ }
2222
+ return rxjs.of(this.uiDefinitionMeta).pipe(rxjs.switchMap(function (uiDefinition) {
2223
+ var _a;
2224
+ var elementsResolver = (_a = _this.elementsResolver) !== null && _a !== void 0 ? _a : new ElementsResolver(uiDefinition, []);
2225
+ elementsResolver.addElement(element);
2226
+ var module = _this.getModule(elementsResolver.getNgComponents());
2227
+ return rxjs.combineLatest([rxjs.from(_this.compiler.compileModuleAndAllComponentsAsync(module)), rxjs.of(elementsResolver)]);
2228
+ }), rxjs.map(function (_b) {
2229
+ var _c = __read(_b, 2), module = _c[0], elementsResolver = _c[1];
2230
+ return ({ module: module, elements: elementsResolver.elements });
2231
+ }));
2232
+ };
2233
+ CompilationService.prototype.clearModuleCache = function (modules) {
2234
+ var _this = this;
2235
+ modules.forEach(function (module) { return _this.compiler.clearCacheFor(module); });
2236
+ this.uiDefinitionMeta = undefined;
2237
+ };
2238
+ CompilationService.prototype.getModule = function (components) {
2239
+ var staticComponents = [
2240
+ ElementChildrenComponent,
2241
+ ElementRendererComponent,
2242
+ ElementDropHandleComponent,
2243
+ CustomTemplateDirective,
2244
+ ];
2245
+ var DynamicModule = /** @class */ (function () {
2246
+ function DynamicModule() {
2247
+ }
2248
+ return DynamicModule;
2249
+ }());
2250
+ DynamicModule = __decorate([
2251
+ i0.NgModule({
2252
+ imports: [
2253
+ i7.CommonModule,
2254
+ angularForms.FormsModule,
2255
+ angularForms.ReactiveFormsModule,
2256
+ FederatedModule,
2257
+ dragDrop.DragDropModule,
2258
+ i2$1.DndModule,
2259
+ scrolling.ScrollingModule,
2260
+ ],
2261
+ declarations: __spreadArray(__spreadArray([], __read(staticComponents)), __read(components)),
2262
+ jit: true,
2263
+ })
2264
+ ], DynamicModule);
2265
+ return DynamicModule;
2266
+ };
2267
+ return CompilationService;
2268
+ }());
2269
+ CompilationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CompilationService, deps: [{ token: i0__namespace.Compiler }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2270
+ CompilationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CompilationService });
2271
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CompilationService, decorators: [{
2272
+ type: i0.Injectable
2273
+ }], ctorParameters: function () { return [{ type: i0__namespace.Compiler }]; } });
2274
+
2275
+ var RuntimeModule = /** @class */ (function () {
2276
+ function RuntimeModule() {
2277
+ }
2278
+ return RuntimeModule;
1875
2279
  }());
1876
- ElementChildrenModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1877
- ElementChildrenModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenModule, declarations: [ElementChildrenComponent], imports: [ElementRendererModule], exports: [ElementChildrenComponent] });
1878
- ElementChildrenModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenModule, imports: [[ElementRendererModule]] });
1879
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: ElementChildrenModule, decorators: [{
2280
+ RuntimeModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2281
+ RuntimeModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, imports: [i7.CommonModule, core.CoreModule] });
2282
+ RuntimeModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, providers: [
2283
+ dynamicdialog.DialogService,
2284
+ RuntimeService,
2285
+ RuntimeEditorService,
2286
+ { provide: CMS_COMPILATION_SERVICE, useClass: CompilationService },
2287
+ ], imports: [[i7.CommonModule, core.CoreModule]] });
2288
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, decorators: [{
1880
2289
  type: i0.NgModule,
1881
2290
  args: [{
1882
- declarations: [ElementChildrenComponent],
1883
- imports: [ElementRendererModule],
1884
- exports: [ElementChildrenComponent],
2291
+ imports: [i7.CommonModule, core.CoreModule],
2292
+ providers: [
2293
+ dynamicdialog.DialogService,
2294
+ RuntimeService,
2295
+ RuntimeEditorService,
2296
+ { provide: CMS_COMPILATION_SERVICE, useClass: CompilationService },
2297
+ ],
1885
2298
  }]
1886
2299
  }] });
1887
2300
 
1888
- var PreviewModule = /** @class */ (function () {
1889
- function PreviewModule() {
2301
+ var LauncherModule = /** @class */ (function () {
2302
+ function LauncherModule() {
1890
2303
  }
1891
- return PreviewModule;
2304
+ return LauncherModule;
1892
2305
  }());
1893
- PreviewModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1894
- PreviewModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewModule, declarations: [PreviewComponent], imports: [i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule], exports: [PreviewComponent] });
1895
- PreviewModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewModule, providers: [IntegrationState], imports: [[i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule]] });
1896
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: PreviewModule, decorators: [{
2306
+ LauncherModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2307
+ LauncherModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, imports: [i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule], exports: [PreviewModule] });
2308
+ LauncherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, providers: [IntegrationState, dynamicdialog.DialogService, ResourcesService], imports: [[i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule], PreviewModule] });
2309
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, decorators: [{
1897
2310
  type: i0.NgModule,
1898
2311
  args: [{
1899
- declarations: [PreviewComponent],
1900
- imports: [i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule],
1901
- providers: [IntegrationState],
1902
- exports: [PreviewComponent],
2312
+ imports: [i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule],
2313
+ providers: [IntegrationState, dynamicdialog.DialogService, ResourcesService],
2314
+ exports: [PreviewModule],
1903
2315
  }]
1904
2316
  }] });
1905
2317
 
1906
- function ElementDefinition(definition) {
1907
- return function (constructor) {
1908
- return constructor;
2318
+ var migrations = {
2319
+ 2: function () {
2320
+ throw 'Migration from Legacy UI definition is not possible';
2321
+ },
2322
+ 3: function (uiDef) {
2323
+ var _a;
2324
+ var children = (_a = uiDef.children) !== null && _a !== void 0 ? _a : [];
2325
+ return Object.assign(Object.assign({}, uiDef), { children: undefined, pages: children, version: 3 });
2326
+ },
2327
+ };
2328
+
2329
+ var MigrationsService = /** @class */ (function () {
2330
+ function MigrationsService(toastService) {
2331
+ this.toastService = toastService;
2332
+ }
2333
+ MigrationsService.prototype.migrateUIDefinition = function (uiDef) {
2334
+ var e_1, _a;
2335
+ var currentVersion = uiDef.version;
2336
+ var targetVersion = i2.UI_DEFINITION_VERSION;
2337
+ var migrateVersions = Object.keys(migrations)
2338
+ .reduce(function (acc, version) {
2339
+ var v = Number(version);
2340
+ if (v > currentVersion && v <= targetVersion) {
2341
+ acc.push(v);
2342
+ }
2343
+ return acc;
2344
+ }, [])
2345
+ .sort();
2346
+ try {
2347
+ var result = lodash.cloneDeep(uiDef);
2348
+ try {
2349
+ for (var migrateVersions_1 = __values(migrateVersions), migrateVersions_1_1 = migrateVersions_1.next(); !migrateVersions_1_1.done; migrateVersions_1_1 = migrateVersions_1.next()) {
2350
+ var version = migrateVersions_1_1.value;
2351
+ result = migrations[version](result);
2352
+ }
2353
+ }
2354
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2355
+ finally {
2356
+ try {
2357
+ if (migrateVersions_1_1 && !migrateVersions_1_1.done && (_a = migrateVersions_1.return)) _a.call(migrateVersions_1);
2358
+ }
2359
+ finally { if (e_1) throw e_1.error; }
2360
+ }
2361
+ return result;
2362
+ }
2363
+ catch (e) {
2364
+ this.toastService.add({ summary: String(e), severity: i1.ToastType.error });
2365
+ return;
2366
+ }
1909
2367
  };
1910
- }
2368
+ return MigrationsService;
2369
+ }());
2370
+ MigrationsService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsService, deps: [{ token: i1__namespace.ToastService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
2371
+ MigrationsService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsService, providedIn: 'root' });
2372
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsService, decorators: [{
2373
+ type: i0.Injectable,
2374
+ args: [{ providedIn: 'root' }]
2375
+ }], ctorParameters: function () { return [{ type: i1__namespace.ToastService }]; } });
1911
2376
 
1912
- var LauncherModule = /** @class */ (function () {
1913
- function LauncherModule() {
2377
+ var MigrationsModule = /** @class */ (function () {
2378
+ function MigrationsModule() {
1914
2379
  }
1915
- return LauncherModule;
2380
+ return MigrationsModule;
1916
2381
  }());
1917
- LauncherModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1918
- LauncherModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, imports: [i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule] });
1919
- LauncherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, providers: [LauncherService, IntegrationState, DynamicModuleService, dynamicdialog.DialogService], imports: [[i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule]] });
1920
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: LauncherModule, decorators: [{
2382
+ MigrationsModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2383
+ MigrationsModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsModule });
2384
+ MigrationsModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsModule, providers: [MigrationsService] });
2385
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MigrationsModule, decorators: [{
1921
2386
  type: i0.NgModule,
1922
2387
  args: [{
1923
- imports: [i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule],
1924
- providers: [LauncherService, IntegrationState, DynamicModuleService, dynamicdialog.DialogService],
2388
+ providers: [MigrationsService],
1925
2389
  }]
1926
2390
  }] });
1927
2391
 
@@ -1939,7 +2403,8 @@
1939
2403
  exports.ElementsResolver = ElementsResolver;
1940
2404
  exports.IntegrationState = IntegrationState;
1941
2405
  exports.LauncherModule = LauncherModule;
1942
- exports.LauncherService = LauncherService;
2406
+ exports.MigrationsModule = MigrationsModule;
2407
+ exports.MigrationsService = MigrationsService;
1943
2408
  exports.NavigateBackAction = NavigateBackAction;
1944
2409
  exports.NavigateToCatalogAction = NavigateToCatalogAction;
1945
2410
  exports.OpenDocGenAction = OpenDocGenAction;
@@ -1947,8 +2412,10 @@
1947
2412
  exports.PreviewModule = PreviewModule;
1948
2413
  exports.RemoteApplyAction = RemoteApplyAction;
1949
2414
  exports.RemoteCancelAction = RemoteCancelAction;
2415
+ exports.ResourcesService = ResourcesService;
2416
+ exports.RuntimeEditorService = RuntimeEditorService;
2417
+ exports.RuntimeModule = RuntimeModule;
1950
2418
  exports.SHARED_ELEMENT_METADATA = SHARED_ELEMENT_METADATA;
1951
- exports.SetDefaultMetrics = SetDefaultMetrics;
1952
2419
  exports.SwitchObjectAction = SwitchObjectAction;
1953
2420
  exports.TemplatesService = TemplatesService;
1954
2421
  exports.UI_DEFINITION_METADATA = UI_DEFINITION_METADATA;
@@ -1959,15 +2426,19 @@
1959
2426
  exports.extendElementMetadata = extendElementMetadata;
1960
2427
  exports.extractElementMetadata = extractElementMetadata;
1961
2428
  exports.findElementByModule = findElementByModule;
2429
+ exports.findElementByPath = findElementByPath;
1962
2430
  exports.flattenElements = flattenElements;
1963
2431
  exports.getAbsolutePath = getAbsolutePath;
1964
2432
  exports.getElementConfig = getElementConfig;
2433
+ exports.getElementUniqueName = getElementUniqueName;
2434
+ exports.insertElement = insertElement;
1965
2435
  exports.isSharedElement = isSharedElement;
1966
2436
  exports.isValidScript = isValidScript;
1967
2437
  exports.metadataToElement = metadataToElement;
1968
2438
  exports.normalizeElementMetadata = normalizeElementMetadata;
1969
2439
  exports.parseBoundPath = parseBoundPath;
1970
2440
  exports.parsePath = parsePath;
2441
+ exports.removeElement = removeElement;
1971
2442
  exports.stringifyElementMetadata = stringifyElementMetadata;
1972
2443
 
1973
2444
  Object.defineProperty(exports, '__esModule', { value: true });