@veloceapps/sdk 6.0.0-32 → 6.0.0-34

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 (79) hide show
  1. package/bundles/veloceapps-sdk-cms.umd.js +1214 -783
  2. package/bundles/veloceapps-sdk-cms.umd.js.map +1 -1
  3. package/bundles/veloceapps-sdk.umd.js +5 -5
  4. package/bundles/veloceapps-sdk.umd.js.map +1 -1
  5. package/cms/components/element-children/element-children.component.d.ts +13 -3
  6. package/cms/components/element-children/element-children.module.d.ts +4 -2
  7. package/cms/components/element-drop-handle/element-drop-handle.component.d.ts +12 -0
  8. package/cms/components/element-drop-handle/element-drop-handle.module.d.ts +9 -0
  9. package/cms/components/element-renderer/element-renderer.component.d.ts +3 -3
  10. package/cms/components/preview/index.d.ts +1 -0
  11. package/cms/components/preview/preview.component.d.ts +9 -8
  12. package/cms/components/preview/preview.module.d.ts +2 -1
  13. package/cms/components/preview/preview.types.d.ts +11 -0
  14. package/cms/index.d.ts +1 -0
  15. package/cms/launcher.module.d.ts +3 -1
  16. package/cms/modules/runtime/index.d.ts +2 -0
  17. package/cms/modules/runtime/runtime.module.d.ts +8 -0
  18. package/cms/modules/runtime/services/compilation.service.d.ts +18 -0
  19. package/cms/modules/runtime/services/runtime-editor.service.d.ts +18 -0
  20. package/cms/modules/runtime/services/runtime.service.d.ts +27 -0
  21. package/cms/modules/runtime/tokens.d.ts +3 -0
  22. package/cms/{types → modules/runtime/types}/compilation.types.d.ts +1 -1
  23. package/cms/modules/runtime/types/runtime.actions.d.ts +9 -0
  24. package/cms/plugins/element-hover.plugin.d.ts +32 -0
  25. package/cms/services/index.d.ts +0 -1
  26. package/cms/services/io-provider.service.d.ts +3 -3
  27. package/cms/types/common.types.d.ts +1 -1
  28. package/cms/types/configuration.types.d.ts +1 -0
  29. package/cms/types/index.d.ts +1 -1
  30. package/cms/utils/elements-resolver.d.ts +2 -1
  31. package/cms/utils/index.d.ts +1 -0
  32. package/cms/utils/path.utils.d.ts +0 -1
  33. package/cms/utils/ui-definition.utils.d.ts +6 -0
  34. package/esm2015/cms/cms.elements.js +17 -4
  35. package/esm2015/cms/components/element-children/element-children.component.js +23 -7
  36. package/esm2015/cms/components/element-children/element-children.module.js +6 -4
  37. package/esm2015/cms/components/element-drop-handle/element-drop-handle.component.js +32 -0
  38. package/esm2015/cms/components/element-drop-handle/element-drop-handle.module.js +19 -0
  39. package/esm2015/cms/components/element-renderer/element-renderer.component.js +7 -7
  40. package/esm2015/cms/components/preview/index.js +2 -1
  41. package/esm2015/cms/components/preview/preview.component.js +20 -35
  42. package/esm2015/cms/components/preview/preview.module.js +5 -4
  43. package/esm2015/cms/components/preview/preview.types.js +2 -0
  44. package/esm2015/cms/index.js +2 -1
  45. package/esm2015/cms/launcher.module.js +8 -7
  46. package/esm2015/cms/modules/runtime/index.js +3 -0
  47. package/esm2015/cms/modules/runtime/runtime.module.js +32 -0
  48. package/esm2015/cms/modules/runtime/services/compilation.service.js +81 -0
  49. package/esm2015/cms/modules/runtime/services/runtime-editor.service.js +27 -0
  50. package/esm2015/cms/modules/runtime/services/runtime.service.js +74 -0
  51. package/esm2015/cms/modules/runtime/tokens.js +3 -0
  52. package/esm2015/cms/modules/runtime/types/compilation.types.js +2 -0
  53. package/esm2015/cms/modules/runtime/types/runtime.actions.js +2 -0
  54. package/esm2015/cms/plugins/configuration.plugin.js +9 -1
  55. package/esm2015/cms/plugins/element-hover.plugin.js +157 -0
  56. package/esm2015/cms/services/index.js +1 -2
  57. package/esm2015/cms/services/io-provider.service.js +7 -7
  58. package/esm2015/cms/types/common.types.js +1 -1
  59. package/esm2015/cms/types/configuration.types.js +1 -1
  60. package/esm2015/cms/types/index.js +2 -2
  61. package/esm2015/cms/utils/elements-resolver.js +13 -6
  62. package/esm2015/cms/utils/index.js +2 -1
  63. package/esm2015/cms/utils/path.utils.js +2 -13
  64. package/esm2015/cms/utils/ui-definition.utils.js +82 -0
  65. package/esm2015/src/components/doc-gen/doc-gen.component.js +1 -1
  66. package/esm2015/src/pages/catalog/catalog.component.js +1 -1
  67. package/esm2015/src/pages/product/product.component.js +1 -1
  68. package/esm2015/src/pages/remote/remote.component.js +1 -1
  69. package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +1 -1
  70. package/fesm2015/veloceapps-sdk-cms.js +1109 -713
  71. package/fesm2015/veloceapps-sdk-cms.js.map +1 -1
  72. package/fesm2015/veloceapps-sdk.js +5 -5
  73. package/fesm2015/veloceapps-sdk.js.map +1 -1
  74. package/package.json +5 -3
  75. package/cms/services/dynamic-module.service.d.ts +0 -15
  76. package/cms/services/launcher.service.d.ts +0 -18
  77. package/esm2015/cms/services/dynamic-module.service.js +0 -33
  78. package/esm2015/cms/services/launcher.service.js +0 -58
  79. package/esm2015/cms/types/compilation.types.js +0 -2
@@ -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, i5, 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 i2__namespace = /*#__PURE__*/_interopNamespace(i2);
29
+ var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
30
+ var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
28
31
  var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
32
+ var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
29
33
  var angularForms__namespace = /*#__PURE__*/_interopNamespace(angularForms);
30
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
31
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
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) {
@@ -559,6 +560,110 @@
559
560
  __param(0, i0.Inject(i0.Injector))
560
561
  ], exports.ElementComponent);
561
562
 
563
+ function getElementUniqueName(collection, name, comparator) {
564
+ var result = '';
565
+ var index = 0;
566
+ while (!result) {
567
+ var candidate = name + (index ? " (" + index + ")" : '');
568
+ var exists = collection.some(comparator(candidate));
569
+ if (!exists) {
570
+ result = candidate;
571
+ }
572
+ else {
573
+ index++;
574
+ }
575
+ }
576
+ return result;
577
+ }
578
+ var insertElementAt = function (source, target, parentPath, index) {
579
+ var result = __spreadArray([], __read(source));
580
+ var name = getElementUniqueName(result, target.name, function (name) { return function (el) { return el.name === name; }; });
581
+ var path = parentPath ? parentPath + "/" + name : name;
582
+ result.splice(index, 0, Object.assign(Object.assign({}, target), { path: path, name: name }));
583
+ return result;
584
+ };
585
+ var insertElement = function (source, target, path, index) {
586
+ if (!path) {
587
+ return insertElementAt(source, target, '', index);
588
+ }
589
+ return source.map(function (element) {
590
+ var _a;
591
+ if (element.path === path) {
592
+ return Object.assign(Object.assign({}, element), { children: insertElementAt(element.children, target, element.path, index) });
593
+ }
594
+ else if ((_a = element.path) === null || _a === void 0 ? void 0 : _a.startsWith(path)) {
595
+ return Object.assign(Object.assign({}, element), { children: insertElement(element.children, target, path, index) });
596
+ }
597
+ else {
598
+ return element;
599
+ }
600
+ });
601
+ };
602
+ var removeElement = function (source, path) {
603
+ return source.reduce(function (trunk, element) {
604
+ if (path === element.path) {
605
+ return trunk;
606
+ }
607
+ if (element.path) {
608
+ if (path.startsWith(element.path)) {
609
+ trunk.push(Object.assign(Object.assign({}, element), { children: removeElement(element.children, path) }));
610
+ }
611
+ else {
612
+ trunk.push(element);
613
+ }
614
+ }
615
+ return trunk;
616
+ }, []);
617
+ };
618
+ var findElementByPath = function (source, path) {
619
+ var e_1, _b;
620
+ try {
621
+ for (var source_1 = __values(source), source_1_1 = source_1.next(); !source_1_1.done; source_1_1 = source_1.next()) {
622
+ var el = source_1_1.value;
623
+ if (el.path === path) {
624
+ return el;
625
+ }
626
+ if (el.path && path.startsWith(el.path)) {
627
+ var found = findElementByPath(el.children, path);
628
+ if (found) {
629
+ return found;
630
+ }
631
+ }
632
+ }
633
+ }
634
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
635
+ finally {
636
+ try {
637
+ if (source_1_1 && !source_1_1.done && (_b = source_1.return)) _b.call(source_1);
638
+ }
639
+ finally { if (e_1) throw e_1.error; }
640
+ }
641
+ return;
642
+ };
643
+ var findElementByModule = function (elements, module, elementName) {
644
+ var e_2, _b;
645
+ try {
646
+ for (var elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
647
+ var el = elements_1_1.value;
648
+ if (el.module === module && el.name === elementName) {
649
+ return el;
650
+ }
651
+ var child = findElementByModule(el.children, module, elementName);
652
+ if (child) {
653
+ return child;
654
+ }
655
+ }
656
+ }
657
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
658
+ finally {
659
+ try {
660
+ if (elements_1_1 && !elements_1_1.done && (_b = elements_1.return)) _b.call(elements_1);
661
+ }
662
+ finally { if (e_2) throw e_2.error; }
663
+ }
664
+ return;
665
+ };
666
+
562
667
  var parseBoundPath = function (path) {
563
668
  var _a, _b;
564
669
  var regexp = new RegExp("(?:\\/)(?:\\w+)(?:\\/)(?:ports|attributes)(?:\\/)(?:\\w+)|(?:\\/)(?:\\w+)", 'g');
@@ -591,29 +696,6 @@
591
696
  variable: variable,
592
697
  };
593
698
  };
594
- var findElementByModule = function (elements, module, elementName) {
595
- var e_1, _e;
596
- try {
597
- for (var elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
598
- var el = elements_1_1.value;
599
- if (el.module === module && el.name === elementName) {
600
- return el;
601
- }
602
- var child = findElementByModule(el.children, module, elementName);
603
- if (child) {
604
- return child;
605
- }
606
- }
607
- }
608
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
609
- finally {
610
- try {
611
- if (elements_1_1 && !elements_1_1.done && (_e = elements_1.return)) _e.call(elements_1);
612
- }
613
- finally { if (e_1) throw e_1.error; }
614
- }
615
- return;
616
- };
617
699
  var getAbsolutePath = function (elements, subject, path) {
618
700
  var _a, _b, _c;
619
701
  if (path.module) {
@@ -636,49 +718,85 @@
636
718
  return subjectSegments.join('/');
637
719
  };
638
720
 
639
- var DynamicModuleService = /** @class */ (function () {
640
- function DynamicModuleService() {
641
- this._elementsTree = [];
642
- this._componentFactories = [];
721
+ var CMS_COMPILATION_SERVICE = new i0.InjectionToken('VENDOR_MAP');
722
+
723
+ var RuntimeService = /** @class */ (function () {
724
+ function RuntimeService(injector) {
725
+ this.injector = injector;
726
+ this.modules = [];
727
+ this.componentFactories = {};
728
+ this.applicationTree = [];
729
+ this.isInitialized$ = new rxjs.BehaviorSubject(false);
730
+ this.updated$ = new rxjs.Subject();
731
+ this.compilationService = this.injector.get(CMS_COMPILATION_SERVICE);
643
732
  }
644
- Object.defineProperty(DynamicModuleService.prototype, "componentFactories", {
645
- get: function () {
646
- return this._componentFactories;
647
- },
648
- set: function (data) {
649
- this._componentFactories = data;
650
- },
651
- enumerable: false,
652
- configurable: true
653
- });
654
- DynamicModuleService.prototype.getComponentFactory = function (element) {
655
- return this.componentFactories.find(function (f) { return f.componentType.path === element.path; });
733
+ RuntimeService.prototype.initialize$ = function (uiDefinition, config) {
734
+ var _this = this;
735
+ this.config = config;
736
+ if (!uiDefinition) {
737
+ return rxjs.of([]);
738
+ }
739
+ return this.compilationService.compileUIDefinition$(uiDefinition).pipe(rxjs.map(function (result) {
740
+ _this.applicationTree = result.elements;
741
+ _this.addComponentFactories(result.module.componentFactories);
742
+ return result.elements;
743
+ }), rxjs.tap(function () { return _this.isInitialized$.next(true); }));
656
744
  };
657
- Object.defineProperty(DynamicModuleService.prototype, "elementsTree", {
658
- get: function () {
659
- return this._elementsTree;
660
- },
661
- set: function (tree) {
662
- this._elementsTree = tree;
663
- },
664
- enumerable: false,
665
- configurable: true
666
- });
667
- DynamicModuleService.prototype.clear = function () {
668
- this._elementsTree = [];
669
- this.componentFactories = [];
745
+ RuntimeService.prototype.applyPatch$ = function (patch) {
746
+ var _this = this;
747
+ var observable$ = rxjs.of(undefined);
748
+ patch.forEach(function (operation) {
749
+ switch (operation.op) {
750
+ case 'add': {
751
+ observable$ = observable$.pipe(rxjs.switchMap(function () { return _this.addElement$(operation); }));
752
+ break;
753
+ }
754
+ case 'remove': {
755
+ observable$ = observable$.pipe(rxjs.map(function () { return _this.deleteElement(operation); }));
756
+ break;
757
+ }
758
+ default:
759
+ observable$ = rxjs.of();
760
+ }
761
+ });
762
+ return observable$.pipe(rxjs.tap(function () { return _this.updated$.next(); }));
763
+ };
764
+ RuntimeService.prototype.getCompiledElement$ = function (path) {
765
+ var _this = this;
766
+ return this.updated$.pipe(rxjs.startWith(undefined), rxjs.map(function () { return findElementByPath(_this.applicationTree, path); }), rxjs.distinctUntilChanged());
767
+ };
768
+ RuntimeService.prototype.clear = function () {
769
+ this.compilationService.clearModuleCache(this.modules);
770
+ this.modules = [];
771
+ this.applicationTree = [];
772
+ this.componentFactories = {};
773
+ this.isInitialized$.next(false);
774
+ };
775
+ RuntimeService.prototype.addElement$ = function (operation) {
776
+ var _this = this;
777
+ return this.compilationService.compileElement$(operation.value).pipe(rxjs.map(function (result) {
778
+ _this.addComponentFactories(result.module.componentFactories);
779
+ rfc6902.applyPatch(_this.applicationTree, [Object.assign(Object.assign({}, operation), { value: result.elements[0] })]);
780
+ }));
781
+ };
782
+ RuntimeService.prototype.deleteElement = function (operation) {
783
+ rfc6902.applyPatch(this.applicationTree, [operation]);
784
+ };
785
+ RuntimeService.prototype.addComponentFactories = function (list) {
786
+ var _this = this;
787
+ list.forEach(function (item) { return (_this.componentFactories[item.componentType.path] = item); });
670
788
  };
671
- return DynamicModuleService;
789
+ return RuntimeService;
672
790
  }());
673
- DynamicModuleService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DynamicModuleService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
674
- DynamicModuleService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DynamicModuleService });
675
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DynamicModuleService, decorators: [{
791
+ 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 });
792
+ RuntimeService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeService });
793
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeService, decorators: [{
676
794
  type: i0.Injectable
677
- }] });
795
+ }], ctorParameters: function () { return [{ type: i0__namespace.Injector }]; } });
678
796
 
679
797
  var IOProviderService = /** @class */ (function () {
680
- function IOProviderService(dynamicModuleService) {
681
- this.dynamicModuleService = dynamicModuleService;
798
+ function IOProviderService(runtimeService) {
799
+ this.runtimeService = runtimeService;
682
800
  this.inputs = {};
683
801
  }
684
802
  IOProviderService.prototype.connect = function (el, name, target) {
@@ -698,7 +816,7 @@
698
816
  var pathIsValue = elPath.segments.length === 1 && elPath.segments[0].startsWith('"') && elPath.segments[0].endsWith('"');
699
817
  var finalName = (_b = elPath.variable) !== null && _b !== void 0 ? _b : name;
700
818
  var value = pathIsValue ? new rxjs.BehaviorSubject(elPath.segments[0].slice(1, -1)) : undefined;
701
- var absolutePath = !pathIsValue ? getAbsolutePath(this.dynamicModuleService.elementsTree, el, elPath) : el.path;
819
+ var absolutePath = !pathIsValue ? getAbsolutePath(this.runtimeService.applicationTree, el, elPath) : el.path;
702
820
  return this.createSubjectSafe(absolutePath !== null && absolutePath !== void 0 ? absolutePath : '', finalName, value);
703
821
  };
704
822
  IOProviderService.prototype.createSubjectSafe = function (path, name, subject) {
@@ -718,11 +836,11 @@
718
836
  };
719
837
  return IOProviderService;
720
838
  }());
721
- IOProviderService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOProviderService, deps: [{ token: DynamicModuleService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
839
+ 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 });
722
840
  IOProviderService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOProviderService });
723
841
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOProviderService, decorators: [{
724
842
  type: i0.Injectable
725
- }], ctorParameters: function () { return [{ type: DynamicModuleService }]; } });
843
+ }], ctorParameters: function () { return [{ type: RuntimeService }]; } });
726
844
 
727
845
  var TemplatesService = /** @class */ (function () {
728
846
  function TemplatesService() {
@@ -753,312 +871,67 @@
753
871
  type: i0.Injectable
754
872
  }] });
755
873
 
756
- var IOPlugin = /** @class */ (function () {
757
- function IOPlugin(host) {
758
- var _this = this;
759
- var _a, _b;
760
- this.host = host;
761
- var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
762
- var inputProvider = this.host.injector.get(IOProviderService);
763
- var inputs = Object.entries((_a = elementMetadata.inputs) !== null && _a !== void 0 ? _a : {});
764
- var outputs = Object.entries((_b = elementMetadata.outputs) !== null && _b !== void 0 ? _b : {});
765
- inputs.forEach(function (_c) {
766
- var _d = __read(_c, 2), key = _d[0], path = _d[1];
767
- var _a;
768
- if (path && typeof path !== 'string') {
769
- console.error("The value of '" + key + "' input should be a string");
770
- }
771
- if (((_a = elementMetadata.outputs) === null || _a === void 0 ? void 0 : _a[key]) !== undefined) {
772
- console.warn("'" + key + "' appears both in inputs and outputs. To prevent inconsistent behavior please keep them unique ");
773
- }
774
- _this.host[key] = inputProvider.connect(elementMetadata, key, path);
775
- });
776
- outputs.forEach(function (_c) {
777
- var _d = __read(_c, 2), key = _d[0], path = _d[1];
778
- if (path && typeof path !== 'string') {
779
- console.error("The value of '" + key + "' output should be a string");
780
- }
781
- _this.host[key] = inputProvider.provide(elementMetadata, key, path);
782
- });
874
+ var InitAction = { type: 'INIT' };
875
+ var ClearAction = { type: 'CLEAR' };
876
+ var IntegrationState = /** @class */ (function () {
877
+ function IntegrationState() {
878
+ this.stateSubj$ = new rxjs.BehaviorSubject({});
879
+ this.action$ = new rxjs.BehaviorSubject(InitAction);
783
880
  }
784
- return IOPlugin;
881
+ Object.defineProperty(IntegrationState.prototype, "state$", {
882
+ get: function () {
883
+ return this.stateSubj$.asObservable();
884
+ },
885
+ enumerable: false,
886
+ configurable: true
887
+ });
888
+ Object.defineProperty(IntegrationState.prototype, "state", {
889
+ get: function () {
890
+ return this.stateSubj$.getValue();
891
+ },
892
+ enumerable: false,
893
+ configurable: true
894
+ });
895
+ IntegrationState.prototype.patchState = function (update) {
896
+ this.stateSubj$.next(Object.assign(Object.assign({}, this.stateSubj$.getValue()), update));
897
+ };
898
+ IntegrationState.prototype.dispatch = function (action) {
899
+ this.action$.next(action);
900
+ };
901
+ IntegrationState.prototype.listen$ = function (actionType) {
902
+ return this.action$.pipe(rxjs.filter(function (action) { return action.type === actionType; }), rxjs.map(function (action) { return action.payload; }));
903
+ };
904
+ IntegrationState.prototype.listenAll$ = function () {
905
+ return this.action$.asObservable();
906
+ };
907
+ IntegrationState.prototype.clear = function () {
908
+ this.stateSubj$.next({});
909
+ this.action$.next(ClearAction);
910
+ };
911
+ return IntegrationState;
785
912
  }());
786
- 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 });
787
- IOPlugindir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: IOPlugin, ngImport: i0__namespace });
788
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOPlugin, decorators: [{
789
- type: i0.Directive
790
- }], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
913
+ IntegrationState.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IntegrationState, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
914
+ IntegrationStateprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IntegrationState, providedIn: 'root' });
915
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IntegrationState, decorators: [{
916
+ type: i0.Injectable,
917
+ args: [{ providedIn: 'root' }]
918
+ }] });
791
919
 
792
- var ScriptPlugin = /** @class */ (function () {
793
- function ScriptPlugin(host) {
794
- var _this = this;
795
- this.host = host;
796
- this.normalizeImports = function (script, elementPath) {
797
- 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');
798
- var result = script.replace(regexp, function (match, g1, g2, src) {
799
- var imports = g1
800
- .trim()
801
- .slice(1, -1)
802
- .split(',')
803
- .map(function (item) { return item.trim(); });
804
- imports.forEach(function (item) {
805
- var _a;
806
- if (!((_a = _this.vendorMap[src]) === null || _a === void 0 ? void 0 : _a[item])) {
807
- throw new Error("Failed to import " + item + " from '" + src + "' in " + elementPath + "/script.ts");
808
- }
809
- });
810
- return "const " + g1 + " = vendor['" + src + "'];";
811
- });
812
- return result;
813
- };
814
- this.document = this.host.injector.get(i7.DOCUMENT);
815
- this.vendorMap = this.host.injector.get(VENDOR_MAP);
816
- var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
817
- var sharedElementMetadata = this.host.injector.get(SHARED_ELEMENT_METADATA);
818
- this.addScript(sharedElementMetadata);
819
- this.addScript(elementMetadata);
920
+ var ElementContextService = /** @class */ (function () {
921
+ function ElementContextService() {
820
922
  }
821
- ScriptPlugin.prototype.addScript = function (metadata) {
822
- var _a;
823
- if (!(metadata === null || metadata === void 0 ? void 0 : metadata.script)) {
824
- return;
825
- }
826
- var id = btoa(core.UUID.UUID());
827
- var script = this.document.createElement('script');
828
- script.type = "text/javascript";
829
- var scriptContent = this.normalizeImports(metadata.script, (_a = metadata.path) !== null && _a !== void 0 ? _a : metadata.name);
830
- var classMatch = /export class (\S+)/.exec(scriptContent);
831
- var className = classMatch === null || classMatch === void 0 ? void 0 : classMatch[1];
832
- if (!classMatch || !className) {
833
- console.error("Script doesn't have exported class");
834
- return;
835
- }
836
- scriptContent = scriptContent.replace(classMatch[0], "class " + className);
837
- script.text = "var " + id + " = function(vendor) {" + scriptContent + "\n return " + className + "; };";
838
- this.document.body.appendChild(script);
839
- var ScriptClass = window[id](this.vendorMap);
840
- if (ScriptClass instanceof Object) {
841
- this.host.registerPlugin(new ScriptClass(this.host));
842
- }
843
- this.document.body.removeChild(script);
844
- };
845
- return ScriptPlugin;
923
+ return ElementContextService;
846
924
  }());
847
- 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 });
848
- ScriptPlugindir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: ScriptPlugin, ngImport: i0__namespace });
849
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ScriptPlugin, decorators: [{
850
- type: i0.Directive
851
- }], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
852
-
853
- /*
854
- * ScriptPlugin must always be the last plugin in the list to make sure user code is running after all pre-initializers.
855
- */
856
- var CONFIG = {
857
- CUSTOM: {
858
- component: exports.ElementComponent,
859
- plugins: [IOPlugin, ScriptPlugin],
860
- },
861
- CONTAINER: {
862
- component: exports.ElementComponent,
863
- defaultTemplate: '<element-children></element-children>',
864
- plugins: [ScriptPlugin],
865
- },
866
- SERVICE: {
867
- component: exports.ElementComponent,
868
- plugins: [IOPlugin, ScriptPlugin],
869
- suppressTemplate: true,
870
- suppressStyles: true,
871
- },
872
- REFERENCE: {
873
- component: exports.ElementComponent,
874
- plugins: [IOPlugin, ScriptPlugin],
875
- suppressTemplate: true,
876
- },
877
- };
878
-
879
- var EXPORTED_CLASS_REGEX = /export class (\S+)/;
880
- var METADATA_DECORATOR_REGEX = /@ElementDefinition\(([\s\S]+)\)(\n|\r\n|.)*export class/g;
881
- var UiBuildError = /** @class */ (function (_super) {
882
- __extends(UiBuildError, _super);
883
- function UiBuildError(message, affectedMetadata) {
884
- var _this = _super.call(this, message) || this;
885
- _this.name = _this.constructor.name;
886
- _this.affectedMetadata = affectedMetadata;
887
- return _this;
888
- }
889
- return UiBuildError;
890
- }(Error));
891
- var elementToMetadata = function (el, parentPath) {
892
- var _a;
893
- var script = el.script && window.atob(el.script);
894
- var template = el.template && window.atob(el.template);
895
- var styles = el.styles && window.atob(el.styles);
896
- var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
897
- if (!exportedClassName) {
898
- throw new Error("Script doesn't have exported class");
899
- }
900
- var elementMetadata = extractElementMetadata(script || '');
901
- var path = (parentPath ? parentPath + '/' : '') + elementMetadata.name;
902
- 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); }) });
903
- };
904
- var metadataToElement = function (metadata, recursive) {
905
- if (recursive === void 0) { recursive = true; }
906
- var elMetadata = {
907
- name: metadata.name,
908
- isShared: metadata.isShared,
909
- type: metadata.type,
910
- model: metadata.model,
911
- module: metadata.module,
912
- reference: metadata.reference,
913
- inputs: metadata.inputs,
914
- outputs: metadata.outputs,
915
- children: metadata.children.map(function (_e) {
916
- var name = _e.name;
917
- return name;
918
- }),
919
- configuredStyles: metadata.configuredStyles,
920
- };
921
- var normalizedElMetadata = normalizeElementMetadata(elMetadata);
922
- if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
923
- throw new UiBuildError("'" + metadata.name + "' component script is missing an exported class", metadata);
924
- }
925
- var script = metadata.script &&
926
- window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, "@ElementDefinition(" + stringifyElementMetadata(normalizedElMetadata) + ")\nexport class Script"));
927
- var template = metadata.template && window.btoa(metadata.template);
928
- var styles = metadata.styles && window.btoa(metadata.styles);
929
- return {
930
- script: script,
931
- template: template,
932
- styles: styles,
933
- children: recursive ? metadata.children.map(function (meta) { return metadataToElement(meta); }) : [],
934
- };
935
- };
936
- var normalizeElementMetadata = function (elementMetadata) {
937
- var _a, _b, _c, _d;
938
- var metadata = Object.assign({}, elementMetadata);
939
- // model
940
- var _e = (_a = metadata.model) !== null && _a !== void 0 ? _a : {}, lineItem = _e.lineItem, path = _e.path;
941
- var model = lineItem ? { lineItem: lineItem } : path ? { path: path } : undefined;
942
- if (model) {
943
- metadata.model = model;
944
- }
945
- else {
946
- delete metadata.model;
947
- }
948
- // module
949
- if (!metadata.module) {
950
- delete metadata.module;
951
- }
952
- // reference
953
- if (!metadata.reference) {
954
- delete metadata.reference;
955
- }
956
- // inputs
957
- var inputs = Object.entries((_b = metadata.inputs) !== null && _b !== void 0 ? _b : {}).reduce(function (acc, _e) {
958
- var _f;
959
- var _g = __read(_e, 2), key = _g[0], value = _g[1];
960
- return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
961
- }, {});
962
- if (inputs && Object.keys(inputs).length > 0) {
963
- metadata.inputs = inputs;
964
- }
965
- else {
966
- delete metadata.inputs;
967
- }
968
- // outputs
969
- var outputs = Object.entries((_c = metadata.outputs) !== null && _c !== void 0 ? _c : {}).reduce(function (acc, _e) {
970
- var _f;
971
- var _g = __read(_e, 2), key = _g[0], value = _g[1];
972
- return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
973
- }, {});
974
- if (outputs && Object.keys(outputs).length > 0) {
975
- metadata.outputs = outputs;
976
- }
977
- else {
978
- delete metadata.outputs;
979
- }
980
- // children
981
- if (!((_d = metadata.children) === null || _d === void 0 ? void 0 : _d.length)) {
982
- delete metadata.children;
983
- }
984
- // isShared
985
- if (!metadata.isShared) {
986
- delete metadata.isShared;
987
- }
988
- // configuredStyles
989
- if (!metadata.configuredStyles) {
990
- delete metadata.configuredStyles;
991
- }
992
- return metadata;
993
- };
994
- var extractElementMetadata = function (script) {
995
- var _a;
996
- var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
997
- // need to reset regex last index to prevent null result for next execution
998
- METADATA_DECORATOR_REGEX.lastIndex = 0;
999
- return new Function("return " + metadataString)();
1000
- };
1001
- var extendElementMetadata = function (script, extend) {
1002
- var _a;
1003
- var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
1004
- // need to reset regex last index to prevent null result for next execution
1005
- METADATA_DECORATOR_REGEX.lastIndex = 0;
1006
- if (!metadataString) {
1007
- return script;
1008
- }
1009
- var updated = Object.assign(Object.assign({}, new Function("return " + metadataString)()), extend);
1010
- return script.replace(metadataString, stringifyElementMetadata(updated));
1011
- };
1012
- var getElementConfig = function (type) {
1013
- return CONFIG[type];
1014
- };
1015
- var doesElementSupportIO = function (type) {
1016
- var _a, _b;
1017
- return (_b = (_a = getElementConfig(type).plugins) === null || _a === void 0 ? void 0 : _a.includes(IOPlugin)) !== null && _b !== void 0 ? _b : false;
1018
- };
1019
- function stringifyElementMetadata(elementMetadata) {
1020
- var cleaned = JSON.stringify(elementMetadata, null, 2);
1021
- return cleaned.replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm, function (match) {
1022
- return match.replace(/"/g, '');
1023
- });
1024
- }
1025
- var isValidScript = function (script) {
1026
- var _a;
1027
- if (!script) {
1028
- return false;
1029
- }
1030
- var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
1031
- if (!exportedClassName) {
1032
- return false;
1033
- }
1034
- var meta = extractElementMetadata(script);
1035
- if (!meta.name || !meta.type) {
1036
- return false;
1037
- }
1038
- return true;
1039
- };
1040
- function flattenElements(elements) {
1041
- return lodash.flatten(elements.map(function (el) { return __spreadArray([el], __read(flattenElements(el.children))); }));
1042
- }
1043
- function isSharedElement(el) {
1044
- return Boolean(el.isShared) && el.type !== 'REFERENCE';
1045
- }
1046
-
1047
- var ElementContextService = /** @class */ (function () {
1048
- function ElementContextService() {
1049
- }
1050
- return ElementContextService;
1051
- }());
1052
- ElementContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1053
- ElementContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService });
1054
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService, decorators: [{
1055
- type: i0.Injectable
1056
- }] });
925
+ ElementContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
926
+ ElementContextServiceprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService });
927
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementContextService, decorators: [{
928
+ type: i0.Injectable
929
+ }] });
1057
930
 
1058
931
  var ElementRendererComponent = /** @class */ (function () {
1059
- function ElementRendererComponent(parentInjector, dynamicModuleService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
932
+ function ElementRendererComponent(parentInjector, runtimeService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
1060
933
  this.parentInjector = parentInjector;
1061
- this.dynamicModuleService = dynamicModuleService;
934
+ this.runtimeService = runtimeService;
1062
935
  this.elementContext = elementContext;
1063
936
  this.ioProviderService = ioProviderService;
1064
937
  this.configurationService = configurationService;
@@ -1069,7 +942,7 @@
1069
942
  }
1070
943
  ElementRendererComponent.prototype.ngOnInit = function () {
1071
944
  this.elementContext.metadata = this.meta;
1072
- this.factory = this.dynamicModuleService.getComponentFactory(this.meta);
945
+ this.factory = this.meta.path ? this.runtimeService.componentFactories[this.meta.path] : undefined;
1073
946
  this.createComponents();
1074
947
  };
1075
948
  ElementRendererComponent.prototype.ngOnDestroy = function () {
@@ -1202,7 +1075,7 @@
1202
1075
  };
1203
1076
  return ElementRendererComponent;
1204
1077
  }());
1205
- 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: DynamicModuleService }, { token: ElementContextService }, { token: IOProviderService }, { token: i2__namespace.ConfigurationService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
1078
+ 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 });
1206
1079
  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 });
1207
1080
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererComponent, decorators: [{
1208
1081
  type: i0.Component,
@@ -1216,7 +1089,7 @@
1216
1089
  }], ctorParameters: function () {
1217
1090
  return [{ type: i0__namespace.Injector, decorators: [{
1218
1091
  type: i0.SkipSelf
1219
- }] }, { type: DynamicModuleService }, { type: ElementContextService }, { type: IOProviderService }, { type: i2__namespace.ConfigurationService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }];
1092
+ }] }, { type: RuntimeService }, { type: ElementContextService }, { type: IOProviderService }, { type: i2__namespace.ConfigurationService }, { type: i0__namespace.ElementRef }, { type: i0__namespace.ChangeDetectorRef }];
1220
1093
  }, propDecorators: { el: [{
1221
1094
  type: i0.ViewChild,
1222
1095
  args: ['el', { read: i0.ViewContainerRef, static: true }]
@@ -1224,204 +1097,731 @@
1224
1097
  type: i0.Input
1225
1098
  }] } });
1226
1099
 
1227
- var ElementChildrenComponent = /** @class */ (function () {
1228
- function ElementChildrenComponent(elementContext) {
1229
- this.elementContext = elementContext;
1230
- this.metadata = this.elementContext.metadata;
1231
- }
1232
- return ElementChildrenComponent;
1233
- }());
1234
- ElementChildrenComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenComponent, deps: [{ token: ElementContextService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1235
- 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?.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 });
1236
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenComponent, decorators: [{
1237
- type: i0.Component,
1238
- args: [{
1239
- // eslint-disable-next-line @angular-eslint/component-selector
1240
- selector: 'element-children',
1241
- templateUrl: 'element-children.component.html',
1242
- styleUrls: ['./element-children.component.scss'],
1243
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1244
- }]
1245
- }], ctorParameters: function () { return [{ type: ElementContextService }]; } });
1246
-
1247
- // eslint-disable-next-line @angular-eslint/directive-selector
1248
- var CustomTemplateDirective = /** @class */ (function () {
1249
- function CustomTemplateDirective(templateRef, templatesService) {
1250
- this.templateRef = templateRef;
1251
- this.templatesService = templatesService;
1100
+ var PreviewComponent = /** @class */ (function () {
1101
+ function PreviewComponent(runtimeService, configurationService, messageService, configurationRuntimeService, integrationState, cdr) {
1102
+ var _this = this;
1103
+ this.runtimeService = runtimeService;
1104
+ this.configurationService = configurationService;
1105
+ this.messageService = messageService;
1106
+ this.configurationRuntimeService = configurationRuntimeService;
1107
+ this.integrationState = integrationState;
1108
+ this.cdr = cdr;
1109
+ this.state$ = new rxjs.BehaviorSubject({ loading: true, failure: false });
1110
+ this.elements = [];
1111
+ this.destroy$ = new rxjs.Subject();
1112
+ this.runtimeService.updated$.pipe(rxjs.takeUntil(this.destroy$)).subscribe(function () { return _this.cdr.detectChanges(); });
1252
1113
  }
1253
- CustomTemplateDirective.prototype.ngAfterViewInit = function () {
1254
- if (!this.customTemplate) {
1255
- return;
1114
+ PreviewComponent.prototype.ngOnInit = function () {
1115
+ var _a;
1116
+ if (!((_a = this.config) === null || _a === void 0 ? void 0 : _a.suppressClearState)) {
1117
+ this.integrationState.clear();
1256
1118
  }
1257
- this.templatesService.register(this.customTemplate, this.templateRef);
1119
+ this.startPreview();
1258
1120
  };
1259
- return CustomTemplateDirective;
1260
- }());
1261
- 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 });
1262
- CustomTemplateDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0__namespace });
1263
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CustomTemplateDirective, decorators: [{
1264
- type: i0.Directive,
1265
- args: [{ selector: '[customTemplate]' }]
1266
- }], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }, { type: TemplatesService }]; }, propDecorators: { customTemplate: [{
1267
- type: i0.Input
1268
- }] } });
1269
-
1270
- var defaultOptions = {
1271
- suppressLoading: false,
1272
- loadingLabel: 'LOADING',
1121
+ PreviewComponent.prototype.ngOnDestroy = function () {
1122
+ this.destroy$.next();
1123
+ this.destroy$.complete();
1124
+ this.configurationService.reset();
1125
+ this.runtimeService.clear();
1126
+ };
1127
+ PreviewComponent.prototype.initializeConfiguration$ = function () {
1128
+ var _this = this;
1129
+ var isAlreadyInitialized = this.configurationRuntimeService.isInitialized;
1130
+ if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
1131
+ return rxjs.of({});
1132
+ }
1133
+ if (!this.modelId) {
1134
+ console.warn("No modelId is given for uiDefinition with '" + this.uiDefinition.type + "' type");
1135
+ return rxjs.of({});
1136
+ }
1137
+ // If still not initialized - init configuration in Test mode
1138
+ return this.configurationRuntimeService
1139
+ .initTestMode(this.modelId, this.uiDefinition)
1140
+ .pipe(rxjs.switchMap(function () { return _this.configurationService.configure(); }));
1141
+ };
1142
+ PreviewComponent.prototype.startPreview = function () {
1143
+ var _this = this;
1144
+ if (!this.uiDefinition) {
1145
+ return;
1146
+ }
1147
+ rxjs.forkJoin([this.runtimeService.initialize$(this.uiDefinition, this.config), this.initializeConfiguration$()])
1148
+ .pipe(rxjs.tap(function (_c) {
1149
+ var _d = __read(_c, 1), elements = _d[0];
1150
+ _this.elements = elements;
1151
+ _this.state$.next({ loading: false, failure: false });
1152
+ }), rxjs.catchError(function (error) {
1153
+ var _a, _b;
1154
+ console.error(error);
1155
+ if (!((_b = (_a = _this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
1156
+ _this.messageService.add({ severity: 'error', summary: error });
1157
+ }
1158
+ _this.state$.next({ loading: false, failure: true });
1159
+ return rxjs.of();
1160
+ }), rxjs.takeUntil(this.destroy$))
1161
+ .subscribe();
1162
+ };
1163
+ return PreviewComponent;
1164
+ }());
1165
+ 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 });
1166
+ 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: i5__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 });
1167
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewComponent, decorators: [{
1168
+ type: i0.Component,
1169
+ args: [{
1170
+ selector: 'vl-cms-preview',
1171
+ templateUrl: './preview.component.html',
1172
+ styleUrls: ['./preview.component.scss'],
1173
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1174
+ providers: [IOProviderService, TemplatesService],
1175
+ // use shadow DOM to prevent UI from being affected by global styles
1176
+ encapsulation: i0.ViewEncapsulation.ShadowDom,
1177
+ }]
1178
+ }], 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: [{
1179
+ type: i0.Input
1180
+ }], uiDefinition: [{
1181
+ type: i0.Input
1182
+ }], config: [{
1183
+ type: i0.Input
1184
+ }] } });
1185
+
1186
+ var RuntimeEditorService = /** @class */ (function () {
1187
+ function RuntimeEditorService(runtimeService) {
1188
+ var _this = this;
1189
+ this.runtimeService = runtimeService;
1190
+ this.editorModeSubj$ = new rxjs.BehaviorSubject(false);
1191
+ this.dragMode$ = new rxjs.BehaviorSubject(false);
1192
+ this.elementDropped$ = new rxjs.ReplaySubject();
1193
+ this.elementDeleted$ = new rxjs.ReplaySubject();
1194
+ this.editorMode$ = this.editorModeSubj$.asObservable();
1195
+ this.runtimeService.isInitialized$.subscribe(function () { var _a; return _this.editorModeSubj$.next(Boolean((_a = _this.runtimeService.config) === null || _a === void 0 ? void 0 : _a.uiBuilderMode)); });
1196
+ }
1197
+ RuntimeEditorService.prototype.applyPatch$ = function (patch) {
1198
+ return this.runtimeService.applyPatch$(patch);
1199
+ };
1200
+ RuntimeEditorService.prototype.toggleEditorMode = function () {
1201
+ this.editorModeSubj$.next(!this.editorModeSubj$.value);
1202
+ };
1203
+ return RuntimeEditorService;
1204
+ }());
1205
+ 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 });
1206
+ RuntimeEditorService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeEditorService });
1207
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeEditorService, decorators: [{
1208
+ type: i0.Injectable
1209
+ }], ctorParameters: function () { return [{ type: RuntimeService }]; } });
1210
+
1211
+ var ElementDropHandleComponent = /** @class */ (function () {
1212
+ function ElementDropHandleComponent(runtimeService) {
1213
+ this.runtimeService = runtimeService;
1214
+ }
1215
+ ElementDropHandleComponent.prototype.handleDrop = function (e) {
1216
+ this.runtimeService.elementDropped$.next({
1217
+ element: e.data,
1218
+ index: this.index,
1219
+ path: this.parentPath,
1220
+ });
1221
+ };
1222
+ return ElementDropHandleComponent;
1223
+ }());
1224
+ 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 });
1225
+ 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 });
1226
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleComponent, decorators: [{
1227
+ type: i0.Component,
1228
+ args: [{
1229
+ selector: 'vl-element-drop-handle',
1230
+ templateUrl: './element-drop-handle.component.html',
1231
+ styleUrls: ['./element-drop-handle.component.scss'],
1232
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1233
+ }]
1234
+ }], ctorParameters: function () { return [{ type: RuntimeEditorService }]; }, propDecorators: { index: [{
1235
+ type: i0.Input
1236
+ }], parentPath: [{
1237
+ type: i0.Input
1238
+ }] } });
1239
+
1240
+ var ElementDropHandleModule = /** @class */ (function () {
1241
+ function ElementDropHandleModule() {
1242
+ }
1243
+ return ElementDropHandleModule;
1244
+ }());
1245
+ ElementDropHandleModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1246
+ 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] });
1247
+ ElementDropHandleModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, imports: [[i7.CommonModule, i2$1.DndModule]] });
1248
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementDropHandleModule, decorators: [{
1249
+ type: i0.NgModule,
1250
+ args: [{
1251
+ declarations: [ElementDropHandleComponent],
1252
+ imports: [i7.CommonModule, i2$1.DndModule],
1253
+ exports: [ElementDropHandleComponent],
1254
+ }]
1255
+ }] });
1256
+
1257
+ var ElementRendererModule = /** @class */ (function () {
1258
+ function ElementRendererModule() {
1259
+ }
1260
+ return ElementRendererModule;
1261
+ }());
1262
+ ElementRendererModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1263
+ ElementRendererModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, declarations: [ElementRendererComponent], exports: [ElementRendererComponent] });
1264
+ ElementRendererModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule });
1265
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, decorators: [{
1266
+ type: i0.NgModule,
1267
+ args: [{
1268
+ declarations: [ElementRendererComponent],
1269
+ exports: [ElementRendererComponent],
1270
+ }]
1271
+ }] });
1272
+
1273
+ var ElementChildrenComponent = /** @class */ (function () {
1274
+ function ElementChildrenComponent(elementContext, runtimeService, runtimeEditorService, cdr) {
1275
+ var _this = this;
1276
+ var _a, _b;
1277
+ this.elementContext = elementContext;
1278
+ this.runtimeService = runtimeService;
1279
+ this.runtimeEditorService = runtimeEditorService;
1280
+ this.cdr = cdr;
1281
+ this.destroyed$ = new rxjs.Subject();
1282
+ var path = (_b = (_a = this.elementContext) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.path;
1283
+ this.metadata$ = path ? this.runtimeService.getCompiledElement$(path) : rxjs.of(undefined);
1284
+ this.dragMode$ = rxjs.combineLatest([this.runtimeEditorService.editorMode$, this.runtimeEditorService.dragMode$]).pipe(rxjs.map(function (flags) { return flags.every(Boolean); }));
1285
+ this.runtimeService.updated$.pipe(rxjs.takeUntil(this.destroyed$)).subscribe(function () { return _this.cdr.detectChanges(); });
1286
+ }
1287
+ ElementChildrenComponent.prototype.ngOnDestroy = function () {
1288
+ this.destroyed$.next();
1289
+ this.destroyed$.complete();
1290
+ };
1291
+ return ElementChildrenComponent;
1292
+ }());
1293
+ 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 });
1294
+ 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 });
1295
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenComponent, decorators: [{
1296
+ type: i0.Component,
1297
+ args: [{
1298
+ // eslint-disable-next-line @angular-eslint/component-selector
1299
+ selector: 'element-children',
1300
+ templateUrl: 'element-children.component.html',
1301
+ styleUrls: ['./element-children.component.scss'],
1302
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
1303
+ }]
1304
+ }], ctorParameters: function () { return [{ type: ElementContextService }, { type: RuntimeService }, { type: RuntimeEditorService }, { type: i0__namespace.ChangeDetectorRef }]; } });
1305
+
1306
+ var ElementChildrenModule = /** @class */ (function () {
1307
+ function ElementChildrenModule() {
1308
+ }
1309
+ return ElementChildrenModule;
1310
+ }());
1311
+ ElementChildrenModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1312
+ ElementChildrenModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, declarations: [ElementChildrenComponent], imports: [i5.LetDirectiveModule, ElementRendererModule, ElementDropHandleModule], exports: [ElementChildrenComponent] });
1313
+ ElementChildrenModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, imports: [[i5.LetDirectiveModule, ElementRendererModule, ElementDropHandleModule]] });
1314
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, decorators: [{
1315
+ type: i0.NgModule,
1316
+ args: [{
1317
+ declarations: [ElementChildrenComponent],
1318
+ imports: [i5.LetDirectiveModule, ElementRendererModule, ElementDropHandleModule],
1319
+ exports: [ElementChildrenComponent],
1320
+ }]
1321
+ }] });
1322
+
1323
+ var PreviewModule = /** @class */ (function () {
1324
+ function PreviewModule() {
1325
+ }
1326
+ return PreviewModule;
1327
+ }());
1328
+ PreviewModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1329
+ PreviewModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, declarations: [PreviewComponent], imports: [i7.CommonModule, i5.LoaderModule, ElementRendererModule, ElementChildrenModule, ElementDropHandleModule], exports: [PreviewComponent] });
1330
+ PreviewModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, providers: [IntegrationState], imports: [[i7.CommonModule, i5.LoaderModule, ElementRendererModule, ElementChildrenModule, ElementDropHandleModule]] });
1331
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, decorators: [{
1332
+ type: i0.NgModule,
1333
+ args: [{
1334
+ declarations: [PreviewComponent],
1335
+ imports: [i7.CommonModule, i5.LoaderModule, ElementRendererModule, ElementChildrenModule, ElementDropHandleModule],
1336
+ providers: [IntegrationState],
1337
+ exports: [PreviewComponent],
1338
+ }]
1339
+ }] });
1340
+
1341
+ function ElementDefinition(definition) {
1342
+ return function (constructor) {
1343
+ return constructor;
1344
+ };
1345
+ }
1346
+
1347
+ // eslint-disable-next-line @angular-eslint/directive-selector
1348
+ var CustomTemplateDirective = /** @class */ (function () {
1349
+ function CustomTemplateDirective(templateRef, templatesService) {
1350
+ this.templateRef = templateRef;
1351
+ this.templatesService = templatesService;
1352
+ }
1353
+ CustomTemplateDirective.prototype.ngAfterViewInit = function () {
1354
+ if (!this.customTemplate) {
1355
+ return;
1356
+ }
1357
+ this.templatesService.register(this.customTemplate, this.templateRef);
1358
+ };
1359
+ return CustomTemplateDirective;
1360
+ }());
1361
+ 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 });
1362
+ CustomTemplateDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0__namespace });
1363
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CustomTemplateDirective, decorators: [{
1364
+ type: i0.Directive,
1365
+ args: [{ selector: '[customTemplate]' }]
1366
+ }], ctorParameters: function () { return [{ type: i0__namespace.TemplateRef }, { type: TemplatesService }]; }, propDecorators: { customTemplate: [{
1367
+ type: i0.Input
1368
+ }] } });
1369
+
1370
+ var ElementHoverPlugin = /** @class */ (function () {
1371
+ function ElementHoverPlugin(host) {
1372
+ var _this = this;
1373
+ this.host = host;
1374
+ this.hoverClassName = 'element-hover';
1375
+ this.color = 'red';
1376
+ this.highlighted = false;
1377
+ this.destroyed$ = new rxjs.Subject();
1378
+ this.el = this.host.injector.get(i0.ElementRef);
1379
+ this.metadata = this.host.injector.get(ELEMENT_METADATA);
1380
+ this.document = this.host.injector.get(i7.DOCUMENT);
1381
+ this.runtimeEditorService = this.host.injector.get(RuntimeEditorService);
1382
+ this.mouseOverListenerBound = this.mouseOverListener.bind(this);
1383
+ this.mouseLeaveListenerBound = this.mouseLeaveListener.bind(this);
1384
+ this.runtimeEditorService.editorMode$.pipe(rxjs.takeUntil(this.destroyed$)).subscribe(function (editorMode) {
1385
+ if (editorMode) {
1386
+ _this.attachListeners();
1387
+ }
1388
+ else {
1389
+ _this.detachListeners();
1390
+ }
1391
+ });
1392
+ }
1393
+ ElementHoverPlugin.prototype.ngOnDestroy = function () {
1394
+ this.destroyed$.next();
1395
+ this.destroyed$.complete();
1396
+ this.detachListeners();
1397
+ };
1398
+ ElementHoverPlugin.prototype.attachListeners = function () {
1399
+ this.el.nativeElement.addEventListener('mouseover', this.mouseOverListenerBound);
1400
+ this.el.nativeElement.addEventListener('mouseleave', this.mouseLeaveListenerBound);
1401
+ };
1402
+ ElementHoverPlugin.prototype.detachListeners = function () {
1403
+ this.el.nativeElement.removeEventListener('mouseover', this.mouseOverListenerBound);
1404
+ this.el.nativeElement.removeEventListener('mouseleave', this.mouseLeaveListenerBound);
1405
+ };
1406
+ ElementHoverPlugin.prototype.mouseOverListener = function (e) {
1407
+ var _this = this;
1408
+ var path = e.composedPath();
1409
+ var innerPath = path.slice(0, path.indexOf(this.el.nativeElement));
1410
+ var hasChildHovered = innerPath.some(function (target) {
1411
+ var t = target;
1412
+ return t.tagName === 'VL-ELEMENT' && t.classList.contains(_this.hoverClassName);
1413
+ });
1414
+ if (hasChildHovered) {
1415
+ this.removeHighlight();
1416
+ }
1417
+ else {
1418
+ this.addHighlight();
1419
+ }
1420
+ };
1421
+ ElementHoverPlugin.prototype.mouseLeaveListener = function () {
1422
+ this.removeHighlight();
1423
+ };
1424
+ ElementHoverPlugin.prototype.addHighlight = function () {
1425
+ if (this.highlighted) {
1426
+ return;
1427
+ }
1428
+ this.highlighted = true;
1429
+ this.el.nativeElement.classList.add(this.hoverClassName);
1430
+ var overlay = this.createContainer();
1431
+ this.addRemoveButton(overlay);
1432
+ this.addElementName(overlay);
1433
+ this.el.nativeElement.appendChild(overlay);
1434
+ this.overlayEl = overlay;
1435
+ };
1436
+ ElementHoverPlugin.prototype.removeHighlight = function () {
1437
+ if (!this.highlighted) {
1438
+ return;
1439
+ }
1440
+ this.highlighted = false;
1441
+ this.el.nativeElement.style.boxShadow = '';
1442
+ this.el.nativeElement.classList.remove(this.hoverClassName);
1443
+ this.deleteRemoveButton();
1444
+ };
1445
+ ElementHoverPlugin.prototype.createContainer = function () {
1446
+ var hostRect = this.el.nativeElement.getBoundingClientRect();
1447
+ var div = this.document.createElement('div');
1448
+ lodash.merge(div.style, {
1449
+ position: 'fixed',
1450
+ display: 'block',
1451
+ pointerEvents: 'none',
1452
+ left: '0',
1453
+ top: '0',
1454
+ fontSize: '10px',
1455
+ lineHeight: "12px",
1456
+ fontWeight: '400',
1457
+ color: '#fff',
1458
+ width: hostRect.width + "px",
1459
+ height: hostRect.height + "px",
1460
+ transform: "translate(" + hostRect.left + "px, " + hostRect.top + "px)",
1461
+ boxSizing: 'border-box',
1462
+ boxShadow: "inset 0 0 0 1px " + this.color,
1463
+ });
1464
+ return div;
1465
+ };
1466
+ ElementHoverPlugin.prototype.addRemoveButton = function (container) {
1467
+ var _this = this;
1468
+ if (this.metadata.type === 'LAYOUT_REGION') {
1469
+ return;
1470
+ }
1471
+ var buttonEl = this.document.createElement('div');
1472
+ var buttonSize = 12;
1473
+ lodash.merge(buttonEl.style, {
1474
+ bottom: '100%',
1475
+ right: '0',
1476
+ width: buttonSize + "px",
1477
+ height: buttonSize + "px",
1478
+ padding: '1px',
1479
+ textAlign: 'center',
1480
+ backgroundColor: this.color,
1481
+ position: 'absolute',
1482
+ cursor: 'pointer',
1483
+ display: 'block',
1484
+ pointerEvents: 'all',
1485
+ });
1486
+ buttonEl.innerHTML = '&#10005;';
1487
+ buttonEl.addEventListener('click', function () {
1488
+ if (_this.metadata.path) {
1489
+ _this.runtimeEditorService.elementDeleted$.next({ path: _this.metadata.path });
1490
+ }
1491
+ });
1492
+ container.appendChild(buttonEl);
1493
+ };
1494
+ ElementHoverPlugin.prototype.addElementName = function (container) {
1495
+ var nameEl = this.document.createElement('div');
1496
+ lodash.merge(nameEl.style, {
1497
+ bottom: '100%',
1498
+ left: '0',
1499
+ height: "12px",
1500
+ backgroundColor: this.color,
1501
+ position: 'absolute',
1502
+ padding: '1px 2px',
1503
+ display: 'block',
1504
+ pointerEvents: 'all',
1505
+ });
1506
+ nameEl.innerHTML = this.metadata.name;
1507
+ container.appendChild(nameEl);
1508
+ };
1509
+ ElementHoverPlugin.prototype.deleteRemoveButton = function () {
1510
+ if (this.overlayEl) {
1511
+ this.el.nativeElement.removeChild(this.overlayEl);
1512
+ this.overlayEl = undefined;
1513
+ }
1514
+ };
1515
+ return ElementHoverPlugin;
1516
+ }());
1517
+ ElementHoverPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementHoverPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
1518
+ ElementHoverPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: ElementHoverPlugin, ngImport: i0__namespace });
1519
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementHoverPlugin, decorators: [{
1520
+ type: i0.Directive
1521
+ }], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
1522
+
1523
+ var IOPlugin = /** @class */ (function () {
1524
+ function IOPlugin(host) {
1525
+ var _this = this;
1526
+ var _a, _b;
1527
+ this.host = host;
1528
+ var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
1529
+ var inputProvider = this.host.injector.get(IOProviderService);
1530
+ var inputs = Object.entries((_a = elementMetadata.inputs) !== null && _a !== void 0 ? _a : {});
1531
+ var outputs = Object.entries((_b = elementMetadata.outputs) !== null && _b !== void 0 ? _b : {});
1532
+ inputs.forEach(function (_c) {
1533
+ var _d = __read(_c, 2), key = _d[0], path = _d[1];
1534
+ var _a;
1535
+ if (path && typeof path !== 'string') {
1536
+ console.error("The value of '" + key + "' input should be a string");
1537
+ }
1538
+ if (((_a = elementMetadata.outputs) === null || _a === void 0 ? void 0 : _a[key]) !== undefined) {
1539
+ console.warn("'" + key + "' appears both in inputs and outputs. To prevent inconsistent behavior please keep them unique ");
1540
+ }
1541
+ _this.host[key] = inputProvider.connect(elementMetadata, key, path);
1542
+ });
1543
+ outputs.forEach(function (_c) {
1544
+ var _d = __read(_c, 2), key = _d[0], path = _d[1];
1545
+ if (path && typeof path !== 'string') {
1546
+ console.error("The value of '" + key + "' output should be a string");
1547
+ }
1548
+ _this.host[key] = inputProvider.provide(elementMetadata, key, path);
1549
+ });
1550
+ }
1551
+ return IOPlugin;
1552
+ }());
1553
+ 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 });
1554
+ IOPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: IOPlugin, ngImport: i0__namespace });
1555
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IOPlugin, decorators: [{
1556
+ type: i0.Directive
1557
+ }], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
1558
+
1559
+ var ScriptPlugin = /** @class */ (function () {
1560
+ function ScriptPlugin(host) {
1561
+ var _this = this;
1562
+ this.host = host;
1563
+ this.normalizeImports = function (script, elementPath) {
1564
+ 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');
1565
+ var result = script.replace(regexp, function (match, g1, g2, src) {
1566
+ var imports = g1
1567
+ .trim()
1568
+ .slice(1, -1)
1569
+ .split(',')
1570
+ .map(function (item) { return item.trim(); });
1571
+ imports.forEach(function (item) {
1572
+ var _a;
1573
+ if (!((_a = _this.vendorMap[src]) === null || _a === void 0 ? void 0 : _a[item])) {
1574
+ throw new Error("Failed to import " + item + " from '" + src + "' in " + elementPath + "/script.ts");
1575
+ }
1576
+ });
1577
+ return "const " + g1 + " = vendor['" + src + "'];";
1578
+ });
1579
+ return result;
1580
+ };
1581
+ this.document = this.host.injector.get(i7.DOCUMENT);
1582
+ this.vendorMap = this.host.injector.get(VENDOR_MAP);
1583
+ var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
1584
+ var sharedElementMetadata = this.host.injector.get(SHARED_ELEMENT_METADATA);
1585
+ this.addScript(sharedElementMetadata);
1586
+ this.addScript(elementMetadata);
1587
+ }
1588
+ ScriptPlugin.prototype.addScript = function (metadata) {
1589
+ var _a;
1590
+ if (!(metadata === null || metadata === void 0 ? void 0 : metadata.script)) {
1591
+ return;
1592
+ }
1593
+ var id = btoa(core.UUID.UUID());
1594
+ var script = this.document.createElement('script');
1595
+ script.type = "text/javascript";
1596
+ var scriptContent = this.normalizeImports(metadata.script, (_a = metadata.path) !== null && _a !== void 0 ? _a : metadata.name);
1597
+ var classMatch = /export class (\S+)/.exec(scriptContent);
1598
+ var className = classMatch === null || classMatch === void 0 ? void 0 : classMatch[1];
1599
+ if (!classMatch || !className) {
1600
+ console.error("Script doesn't have exported class");
1601
+ return;
1602
+ }
1603
+ scriptContent = scriptContent.replace(classMatch[0], "class " + className);
1604
+ script.text = "var " + id + " = function(vendor) {" + scriptContent + "\n return " + className + "; };";
1605
+ this.document.body.appendChild(script);
1606
+ var ScriptClass = window[id](this.vendorMap);
1607
+ if (ScriptClass instanceof Object) {
1608
+ this.host.registerPlugin(new ScriptClass(this.host));
1609
+ }
1610
+ this.document.body.removeChild(script);
1611
+ };
1612
+ return ScriptPlugin;
1613
+ }());
1614
+ 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 });
1615
+ ScriptPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.17", type: ScriptPlugin, ngImport: i0__namespace });
1616
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ScriptPlugin, decorators: [{
1617
+ type: i0.Directive
1618
+ }], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
1619
+
1620
+ /*
1621
+ * ScriptPlugin must always be the last plugin in the list to make sure user code is running after all pre-initializers.
1622
+ */
1623
+ var CONFIG = {
1624
+ CUSTOM: {
1625
+ component: exports.ElementComponent,
1626
+ plugins: [ElementHoverPlugin, IOPlugin, ScriptPlugin],
1627
+ },
1628
+ CONTAINER: {
1629
+ component: exports.ElementComponent,
1630
+ defaultTemplate: '<element-children></element-children>',
1631
+ plugins: [ElementHoverPlugin, ScriptPlugin],
1632
+ },
1633
+ SERVICE: {
1634
+ component: exports.ElementComponent,
1635
+ plugins: [IOPlugin, ScriptPlugin],
1636
+ suppressTemplate: true,
1637
+ suppressStyles: true,
1638
+ },
1639
+ REFERENCE: {
1640
+ component: exports.ElementComponent,
1641
+ plugins: [ElementHoverPlugin, IOPlugin, ScriptPlugin],
1642
+ suppressTemplate: true,
1643
+ },
1644
+ PAGE: {
1645
+ component: exports.ElementComponent,
1646
+ plugins: [ElementHoverPlugin, IOPlugin, ScriptPlugin],
1647
+ },
1648
+ PAGE_LAYOUT: {
1649
+ component: exports.ElementComponent,
1650
+ plugins: [ElementHoverPlugin, IOPlugin, ScriptPlugin],
1651
+ },
1652
+ LAYOUT_REGION: {
1653
+ component: exports.ElementComponent,
1654
+ plugins: [ElementHoverPlugin, IOPlugin, ScriptPlugin],
1655
+ },
1656
+ };
1657
+
1658
+ var EXPORTED_CLASS_REGEX = /export class (\S+)/;
1659
+ var METADATA_DECORATOR_REGEX = /@ElementDefinition\(([\s\S]+)\)(\n|\r\n|.)*export class/g;
1660
+ var UiBuildError = /** @class */ (function (_super) {
1661
+ __extends(UiBuildError, _super);
1662
+ function UiBuildError(message, affectedMetadata) {
1663
+ var _this = _super.call(this, message) || this;
1664
+ _this.name = _this.constructor.name;
1665
+ _this.affectedMetadata = affectedMetadata;
1666
+ return _this;
1667
+ }
1668
+ return UiBuildError;
1669
+ }(Error));
1670
+ var elementToMetadata = function (el, parentPath) {
1671
+ var _a;
1672
+ var script = el.script && window.atob(el.script);
1673
+ var template = el.template && window.atob(el.template);
1674
+ var styles = el.styles && window.atob(el.styles);
1675
+ var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
1676
+ if (!exportedClassName) {
1677
+ throw new Error("Script doesn't have exported class");
1678
+ }
1679
+ var elementMetadata = extractElementMetadata(script || '');
1680
+ var path = (parentPath ? parentPath + '/' : '') + elementMetadata.name;
1681
+ 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); }) });
1682
+ };
1683
+ var metadataToElement = function (metadata, recursive) {
1684
+ if (recursive === void 0) { recursive = true; }
1685
+ var elMetadata = {
1686
+ name: metadata.name,
1687
+ isShared: metadata.isShared,
1688
+ type: metadata.type,
1689
+ model: metadata.model,
1690
+ module: metadata.module,
1691
+ reference: metadata.reference,
1692
+ inputs: metadata.inputs,
1693
+ outputs: metadata.outputs,
1694
+ children: metadata.children.map(function (_e) {
1695
+ var name = _e.name;
1696
+ return name;
1697
+ }),
1698
+ configuredStyles: metadata.configuredStyles,
1699
+ };
1700
+ var normalizedElMetadata = normalizeElementMetadata(elMetadata);
1701
+ if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
1702
+ throw new UiBuildError("'" + metadata.name + "' component script is missing an exported class", metadata);
1703
+ }
1704
+ var script = metadata.script &&
1705
+ window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, "@ElementDefinition(" + stringifyElementMetadata(normalizedElMetadata) + ")\nexport class Script"));
1706
+ var template = metadata.template && window.btoa(metadata.template);
1707
+ var styles = metadata.styles && window.btoa(metadata.styles);
1708
+ return {
1709
+ script: script,
1710
+ template: template,
1711
+ styles: styles,
1712
+ children: recursive ? metadata.children.map(function (meta) { return metadataToElement(meta); }) : [],
1713
+ };
1714
+ };
1715
+ var normalizeElementMetadata = function (elementMetadata) {
1716
+ var _a, _b, _c, _d;
1717
+ var metadata = Object.assign({}, elementMetadata);
1718
+ // model
1719
+ var _e = (_a = metadata.model) !== null && _a !== void 0 ? _a : {}, lineItem = _e.lineItem, path = _e.path;
1720
+ var model = lineItem ? { lineItem: lineItem } : path ? { path: path } : undefined;
1721
+ if (model) {
1722
+ metadata.model = model;
1723
+ }
1724
+ else {
1725
+ delete metadata.model;
1726
+ }
1727
+ // module
1728
+ if (!metadata.module) {
1729
+ delete metadata.module;
1730
+ }
1731
+ // reference
1732
+ if (!metadata.reference) {
1733
+ delete metadata.reference;
1734
+ }
1735
+ // inputs
1736
+ var inputs = Object.entries((_b = metadata.inputs) !== null && _b !== void 0 ? _b : {}).reduce(function (acc, _e) {
1737
+ var _f;
1738
+ var _g = __read(_e, 2), key = _g[0], value = _g[1];
1739
+ return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
1740
+ }, {});
1741
+ if (inputs && Object.keys(inputs).length > 0) {
1742
+ metadata.inputs = inputs;
1743
+ }
1744
+ else {
1745
+ delete metadata.inputs;
1746
+ }
1747
+ // outputs
1748
+ var outputs = Object.entries((_c = metadata.outputs) !== null && _c !== void 0 ? _c : {}).reduce(function (acc, _e) {
1749
+ var _f;
1750
+ var _g = __read(_e, 2), key = _g[0], value = _g[1];
1751
+ return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
1752
+ }, {});
1753
+ if (outputs && Object.keys(outputs).length > 0) {
1754
+ metadata.outputs = outputs;
1755
+ }
1756
+ else {
1757
+ delete metadata.outputs;
1758
+ }
1759
+ // children
1760
+ if (!((_d = metadata.children) === null || _d === void 0 ? void 0 : _d.length)) {
1761
+ delete metadata.children;
1762
+ }
1763
+ // isShared
1764
+ if (!metadata.isShared) {
1765
+ delete metadata.isShared;
1766
+ }
1767
+ // configuredStyles
1768
+ if (!metadata.configuredStyles) {
1769
+ delete metadata.configuredStyles;
1770
+ }
1771
+ return metadata;
1273
1772
  };
1274
-
1275
- var moduleMap = {};
1276
- function loadRemoteEntry(remoteEntry) {
1277
- return new Promise(function (resolve, reject) {
1278
- if (moduleMap[remoteEntry]) {
1279
- resolve();
1280
- return;
1281
- }
1282
- var script = document.createElement('script');
1283
- script.src = remoteEntry;
1284
- script.onerror = reject;
1285
- script.onload = function () {
1286
- moduleMap[remoteEntry] = true;
1287
- resolve(); // window is the global namespace
1288
- };
1289
- document.body.append(script);
1290
- });
1291
- }
1292
- function lookupExposedModule(remoteName, exposedModule) {
1293
- return __awaiter(this, void 0, void 0, function () {
1294
- var container, factory, Module;
1295
- return __generator(this, function (_a) {
1296
- switch (_a.label) {
1297
- case 0:
1298
- // Initializes the share scope. This fills it with known provided modules from this build and all remotes
1299
- return [4 /*yield*/, __webpack_init_sharing__('default')];
1300
- case 1:
1301
- // Initializes the share scope. This fills it with known provided modules from this build and all remotes
1302
- _a.sent();
1303
- container = window[remoteName];
1304
- // Initialize the container, it may provide shared modules
1305
- return [4 /*yield*/, container.init(__webpack_share_scopes__.default)];
1306
- case 2:
1307
- // Initialize the container, it may provide shared modules
1308
- _a.sent();
1309
- return [4 /*yield*/, container.get(exposedModule)];
1310
- case 3:
1311
- factory = _a.sent();
1312
- Module = factory();
1313
- return [2 /*return*/, Module];
1314
- }
1315
- });
1316
- });
1317
- }
1318
- function loadRemoteModule(remoteEntry, remoteName, exposedModule) {
1319
- return __awaiter(this, void 0, void 0, function () {
1320
- return __generator(this, function (_a) {
1321
- switch (_a.label) {
1322
- case 0: return [4 /*yield*/, loadRemoteEntry(remoteEntry)];
1323
- case 1:
1324
- _a.sent();
1325
- return [4 /*yield*/, lookupExposedModule(remoteName, exposedModule)];
1326
- case 2: return [2 /*return*/, _a.sent()];
1327
- }
1328
- });
1773
+ var extractElementMetadata = function (script) {
1774
+ var _a;
1775
+ var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
1776
+ // need to reset regex last index to prevent null result for next execution
1777
+ METADATA_DECORATOR_REGEX.lastIndex = 0;
1778
+ return new Function("return " + metadataString)();
1779
+ };
1780
+ var extendElementMetadata = function (script, extend) {
1781
+ var _a;
1782
+ var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
1783
+ // need to reset regex last index to prevent null result for next execution
1784
+ METADATA_DECORATOR_REGEX.lastIndex = 0;
1785
+ if (!metadataString) {
1786
+ return script;
1787
+ }
1788
+ var updated = Object.assign(Object.assign({}, new Function("return " + metadataString)()), extend);
1789
+ return script.replace(metadataString, stringifyElementMetadata(updated));
1790
+ };
1791
+ var getElementConfig = function (type) {
1792
+ return CONFIG[type];
1793
+ };
1794
+ var doesElementSupportIO = function (type) {
1795
+ var _a, _b;
1796
+ return (_b = (_a = getElementConfig(type).plugins) === null || _a === void 0 ? void 0 : _a.includes(IOPlugin)) !== null && _b !== void 0 ? _b : false;
1797
+ };
1798
+ function stringifyElementMetadata(elementMetadata) {
1799
+ var cleaned = JSON.stringify(elementMetadata, null, 2);
1800
+ return cleaned.replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm, function (match) {
1801
+ return match.replace(/"/g, '');
1329
1802
  });
1330
1803
  }
1331
-
1332
- var FederatedComponent = /** @class */ (function () {
1333
- function FederatedComponent(injector, compiler, appRef, renderer) {
1334
- this.injector = injector;
1335
- this.compiler = compiler;
1336
- this.appRef = appRef;
1337
- this.renderer = renderer;
1338
- this.isLoading$ = new rxjs.BehaviorSubject(false);
1339
- // configs
1340
- this.suppressLoading = defaultOptions.suppressLoading;
1341
- this.loadingLabel = defaultOptions.loadingLabel;
1804
+ var isValidScript = function (script) {
1805
+ var _a;
1806
+ if (!script) {
1807
+ return false;
1342
1808
  }
1343
- FederatedComponent.prototype.ngOnChanges = function (changes) {
1344
- var _a, _b, _c, _d;
1345
- if (changes.data && this.instance) {
1346
- this.instance.data = this.data;
1347
- }
1348
- if (changes.options) {
1349
- this.suppressLoading = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.suppressLoading) !== null && _b !== void 0 ? _b : defaultOptions.suppressLoading;
1350
- this.loadingLabel = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.loadingLabel) !== null && _d !== void 0 ? _d : defaultOptions.loadingLabel;
1351
- }
1352
- };
1353
- FederatedComponent.prototype.ngOnInit = function () {
1354
- this.isLoading$.next(true);
1355
- };
1356
- FederatedComponent.prototype.ngAfterViewInit = function () {
1357
- var _this = this;
1358
- var _a, _b, _c, _d, _e, _f;
1359
- var remoteEntry = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.remoteEntry) !== null && _b !== void 0 ? _b : this.remoteEntry;
1360
- var remoteName = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.remoteName) !== null && _d !== void 0 ? _d : this.remoteName;
1361
- var exposedModule = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.exposedModule) !== null && _f !== void 0 ? _f : this.exposedModule;
1362
- if (!remoteEntry || !remoteName || !exposedModule) {
1363
- return;
1364
- }
1365
- loadRemoteModule(remoteEntry, remoteName, exposedModule).then(function (federated) {
1366
- _this.compiler.compileModuleAsync(federated[exposedModule]).then(function (moduleFactory) {
1367
- var _a, _b, _c;
1368
- var rootModuleRef = moduleFactory.create(_this.injector);
1369
- var rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[exposedModule].rootComponent);
1370
- var node = document.createElement('div');
1371
- var _g = rootComponentFactory.create(_this.injector, [], node), instance = _g.instance, hostView = _g.hostView;
1372
- _this.instance = instance;
1373
- _this.instance.data = _this.data;
1374
- _this.renderer.appendChild((_a = _this.moduleHostRef) === null || _a === void 0 ? void 0 : _a.nativeElement, node);
1375
- _this.appRef.attachView(hostView);
1376
- (_c = (_b = _this.options) === null || _b === void 0 ? void 0 : _b.onReady) === null || _c === void 0 ? void 0 : _c.call(_b);
1377
- _this.isLoading$.next(false);
1378
- });
1379
- });
1380
- };
1381
- return FederatedComponent;
1382
- }());
1383
- 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 });
1384
- 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 });
1385
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedComponent, decorators: [{
1386
- type: i0.Component,
1387
- args: [{
1388
- // eslint-disable-next-line @angular-eslint/component-selector
1389
- selector: 'veloce-host-federated',
1390
- templateUrl: './federated.component.html',
1391
- styleUrls: ['./federated.component.scss'],
1392
- changeDetection: i0.ChangeDetectionStrategy.OnPush,
1393
- }]
1394
- }], ctorParameters: function () { return [{ type: i0__namespace.Injector }, { type: i0__namespace.Compiler }, { type: i0__namespace.ApplicationRef }, { type: i0__namespace.Renderer2 }]; }, propDecorators: { moduleHostRef: [{
1395
- type: i0.ViewChild,
1396
- args: ['moduleHost', { static: false }]
1397
- }], remoteEntry: [{
1398
- type: i0.Input
1399
- }], remoteName: [{
1400
- type: i0.Input
1401
- }], exposedModule: [{
1402
- type: i0.Input
1403
- }], data: [{
1404
- type: i0.Input
1405
- }], options: [{
1406
- type: i0.Input
1407
- }] } });
1408
-
1409
- var FederatedModule = /** @class */ (function () {
1410
- function FederatedModule() {
1809
+ var exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
1810
+ if (!exportedClassName) {
1811
+ return false;
1411
1812
  }
1412
- return FederatedModule;
1413
- }());
1414
- FederatedModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1415
- 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] });
1416
- FederatedModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, imports: [[i7.CommonModule, i1.LoaderModule]] });
1417
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, decorators: [{
1418
- type: i0.NgModule,
1419
- args: [{
1420
- declarations: [FederatedComponent],
1421
- imports: [i7.CommonModule, i1.LoaderModule],
1422
- exports: [FederatedComponent],
1423
- }]
1424
- }] });
1813
+ var meta = extractElementMetadata(script);
1814
+ if (!meta.name || !meta.type) {
1815
+ return false;
1816
+ }
1817
+ return true;
1818
+ };
1819
+ function flattenElements(elements) {
1820
+ return lodash.flatten(elements.map(function (el) { return __spreadArray([el], __read(flattenElements(el.children))); }));
1821
+ }
1822
+ function isSharedElement(el) {
1823
+ return Boolean(el.isShared) && el.type !== 'REFERENCE';
1824
+ }
1425
1825
 
1426
1826
  var ConfigurationPlugin = /** @class */ (function () {
1427
1827
  function ConfigurationPlugin(host) {
@@ -1466,7 +1866,15 @@
1466
1866
  }
1467
1867
  _this.configurationService.patch(new i2.LineItemWorker(rootLineItem).remove(_this.modelSnapshot.id).li);
1468
1868
  };
1869
+ var updateQty = function (qty) {
1870
+ var rootLineItem = _this.configurationService.getSnapshot();
1871
+ if (!rootLineItem || !_this.modelSnapshot) {
1872
+ return;
1873
+ }
1874
+ _this.configurationService.patch(new i2.LineItemWorker(rootLineItem).replace(Object.assign(Object.assign({}, _this.modelSnapshot), { qty: qty })).li);
1875
+ };
1469
1876
  this.typeHost.remove = remove;
1877
+ this.typeHost.updateQty = updateQty;
1470
1878
  };
1471
1879
  ConfigurationPlugin.prototype.registerPort = function (name) {
1472
1880
  var _this = this;
@@ -1538,52 +1946,6 @@
1538
1946
  DEFAULT: [],
1539
1947
  };
1540
1948
 
1541
- var InitAction = { type: 'INIT' };
1542
- var ClearAction = { type: 'CLEAR' };
1543
- var IntegrationState = /** @class */ (function () {
1544
- function IntegrationState() {
1545
- this.stateSubj$ = new rxjs.BehaviorSubject({});
1546
- this.action$ = new rxjs.BehaviorSubject(InitAction);
1547
- }
1548
- Object.defineProperty(IntegrationState.prototype, "state$", {
1549
- get: function () {
1550
- return this.stateSubj$.asObservable();
1551
- },
1552
- enumerable: false,
1553
- configurable: true
1554
- });
1555
- Object.defineProperty(IntegrationState.prototype, "state", {
1556
- get: function () {
1557
- return this.stateSubj$.getValue();
1558
- },
1559
- enumerable: false,
1560
- configurable: true
1561
- });
1562
- IntegrationState.prototype.patchState = function (update) {
1563
- this.stateSubj$.next(Object.assign(Object.assign({}, this.stateSubj$.getValue()), update));
1564
- };
1565
- IntegrationState.prototype.dispatch = function (action) {
1566
- this.action$.next(action);
1567
- };
1568
- IntegrationState.prototype.listen$ = function (actionType) {
1569
- return this.action$.pipe(rxjs.filter(function (action) { return action.type === actionType; }), rxjs.map(function (action) { return action.payload; }));
1570
- };
1571
- IntegrationState.prototype.listenAll$ = function () {
1572
- return this.action$.asObservable();
1573
- };
1574
- IntegrationState.prototype.clear = function () {
1575
- this.stateSubj$.next({});
1576
- this.action$.next(ClearAction);
1577
- };
1578
- return IntegrationState;
1579
- }());
1580
- IntegrationState.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IntegrationState, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1581
- IntegrationState.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IntegrationState, providedIn: 'root' });
1582
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: IntegrationState, decorators: [{
1583
- type: i0.Injectable,
1584
- args: [{ providedIn: 'root' }]
1585
- }] });
1586
-
1587
1949
  var VELOCE_LIBS = {
1588
1950
  '@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),
1589
1951
  '@veloceapps/sdk/cms': Object.assign(Object.assign(Object.assign({}, cmsInjectionTokens), cmsActions), { TemplatesService: TemplatesService, IntegrationState: IntegrationState }),
@@ -1601,7 +1963,7 @@
1601
1963
  ConfigurationSettingsApiService: api.ConfigurationSettingsApiService,
1602
1964
  },
1603
1965
  '@veloceapps/components': {
1604
- ToastService: i1.ToastService,
1966
+ ToastService: i5.ToastService,
1605
1967
  },
1606
1968
  };
1607
1969
  var VELOCE_LIBS_BACKWARDS_COMPATIBLE = Object.entries(VELOCE_LIBS).reduce(function (trunk, _a) {
@@ -1619,12 +1981,21 @@
1619
1981
  this.sharedElements = [];
1620
1982
  var transpiledElements = this.transpileScripts(elements);
1621
1983
  this.sharedElements = this.flattenElements(transpiledElements).filter(function (el) { return _this.isSharedElement(el); });
1622
- this.elements = transpiledElements.map(function (el) { return _this.processElementMetadata(el); }).filter(Boolean);
1984
+ this.elements = transpiledElements.map(function (el) { return _this.processElementMetadata(el); }).filter(core.isDefined);
1623
1985
  this.renderableElements = this.getRenderableElements(this.elements);
1624
1986
  }
1987
+ ElementsResolver.prototype.addElement = function (element) {
1988
+ var _this = this;
1989
+ if (element.isShared) {
1990
+ return;
1991
+ }
1992
+ var transpiledElements = this.transpileScripts([element]);
1993
+ this.elements = transpiledElements.map(function (el) { return _this.processElementMetadata(el); }).filter(core.isDefined);
1994
+ this.renderableElements = this.getRenderableElements(this.elements);
1995
+ };
1625
1996
  ElementsResolver.prototype.getNgComponents = function () {
1626
1997
  var _this = this;
1627
- return this.renderableElements.map(function (el) { return _this.resolveElement(el); }).filter(Boolean);
1998
+ return this.renderableElements.map(function (el) { return _this.resolveElement(el); }).filter(core.isDefined);
1628
1999
  };
1629
2000
  ElementsResolver.prototype.transpile = function (el) {
1630
2001
  var _a;
@@ -1706,9 +2077,7 @@
1706
2077
  }
1707
2078
  finalElement.template = this.resolveElementTemplate(finalElement);
1708
2079
  finalElement.styles = this.resolveElementStyles(finalElement);
1709
- return Object.assign(Object.assign({}, finalElement), { children: finalElement.children
1710
- .map(function (child) { return _this.processElementMetadata(child); })
1711
- .filter(Boolean) });
2080
+ return Object.assign(Object.assign({}, finalElement), { children: finalElement.children.map(function (child) { return _this.processElementMetadata(child); }).filter(core.isDefined) });
1712
2081
  };
1713
2082
  ElementsResolver.prototype.getSharedChildren = function (children, parentPath) {
1714
2083
  var _this = this;
@@ -1776,223 +2145,280 @@
1776
2145
  return ElementsResolver;
1777
2146
  }());
1778
2147
 
1779
- var LauncherService = /** @class */ (function () {
1780
- function LauncherService(compiler, dynamicModuleService) {
1781
- this.compiler = compiler;
1782
- this.dynamicModuleService = dynamicModuleService;
1783
- }
1784
- LauncherService.prototype.compileModule = function (uiDef, elements) {
1785
- var _this = this;
1786
- var elementsResolver = new ElementsResolver(uiDef, elements);
1787
- this.dynamicModuleService.elementsTree = elementsResolver.elements;
1788
- this.module = this.getModule(elementsResolver.getNgComponents());
1789
- return rxjs.from(this.compiler.compileModuleAndAllComponentsAsync(this.module)).pipe(rxjs.tap(function (m) {
1790
- _this.dynamicModuleService.componentFactories = m.componentFactories;
1791
- _this.moduleInstance = m;
1792
- }), rxjs.map(function (m) { return ({ module: m, elements: elementsResolver.elements }); }));
1793
- };
1794
- LauncherService.prototype.destroy = function () {
1795
- if (this.moduleInstance) {
1796
- this.dynamicModuleService.clear();
1797
- this.moduleInstance = undefined;
1798
- }
1799
- if (this.module) {
1800
- this.compiler.clearCacheFor(this.module);
1801
- this.module = undefined;
1802
- }
1803
- };
1804
- LauncherService.prototype.getModule = function (components) {
1805
- var staticComponents = [ElementChildrenComponent, ElementRendererComponent, CustomTemplateDirective];
1806
- var DynamicModule = /** @class */ (function () {
1807
- function DynamicModule() {
2148
+ var defaultOptions = {
2149
+ suppressLoading: false,
2150
+ loadingLabel: 'LOADING',
2151
+ };
2152
+
2153
+ var moduleMap = {};
2154
+ function loadRemoteEntry(remoteEntry) {
2155
+ return new Promise(function (resolve, reject) {
2156
+ if (moduleMap[remoteEntry]) {
2157
+ resolve();
2158
+ return;
2159
+ }
2160
+ var script = document.createElement('script');
2161
+ script.src = remoteEntry;
2162
+ script.onerror = reject;
2163
+ script.onload = function () {
2164
+ moduleMap[remoteEntry] = true;
2165
+ resolve(); // window is the global namespace
2166
+ };
2167
+ document.body.append(script);
2168
+ });
2169
+ }
2170
+ function lookupExposedModule(remoteName, exposedModule) {
2171
+ return __awaiter(this, void 0, void 0, function () {
2172
+ var container, factory, Module;
2173
+ return __generator(this, function (_a) {
2174
+ switch (_a.label) {
2175
+ case 0:
2176
+ // Initializes the share scope. This fills it with known provided modules from this build and all remotes
2177
+ return [4 /*yield*/, __webpack_init_sharing__('default')];
2178
+ case 1:
2179
+ // Initializes the share scope. This fills it with known provided modules from this build and all remotes
2180
+ _a.sent();
2181
+ container = window[remoteName];
2182
+ // Initialize the container, it may provide shared modules
2183
+ return [4 /*yield*/, container.init(__webpack_share_scopes__.default)];
2184
+ case 2:
2185
+ // Initialize the container, it may provide shared modules
2186
+ _a.sent();
2187
+ return [4 /*yield*/, container.get(exposedModule)];
2188
+ case 3:
2189
+ factory = _a.sent();
2190
+ Module = factory();
2191
+ return [2 /*return*/, Module];
1808
2192
  }
1809
- return DynamicModule;
1810
- }());
1811
- DynamicModule = __decorate([
1812
- i0.NgModule({
1813
- imports: [i7.CommonModule, angularForms.FormsModule, angularForms.ReactiveFormsModule, FederatedModule, dragDrop.DragDropModule, scrolling.ScrollingModule],
1814
- declarations: __spreadArray(__spreadArray([], __read(staticComponents)), __read(components)),
1815
- jit: true,
1816
- })
1817
- ], DynamicModule);
1818
- return DynamicModule;
1819
- };
1820
- return LauncherService;
1821
- }());
1822
- LauncherService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherService, deps: [{ token: i0__namespace.Compiler }, { token: DynamicModuleService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1823
- LauncherService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherService });
1824
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherService, decorators: [{
1825
- type: i0.Injectable
1826
- }], ctorParameters: function () { return [{ type: i0__namespace.Compiler }, { type: DynamicModuleService }]; } });
2193
+ });
2194
+ });
2195
+ }
2196
+ function loadRemoteModule(remoteEntry, remoteName, exposedModule) {
2197
+ return __awaiter(this, void 0, void 0, function () {
2198
+ return __generator(this, function (_a) {
2199
+ switch (_a.label) {
2200
+ case 0: return [4 /*yield*/, loadRemoteEntry(remoteEntry)];
2201
+ case 1:
2202
+ _a.sent();
2203
+ return [4 /*yield*/, lookupExposedModule(remoteName, exposedModule)];
2204
+ case 2: return [2 /*return*/, _a.sent()];
2205
+ }
2206
+ });
2207
+ });
2208
+ }
1827
2209
 
1828
- var PreviewComponent = /** @class */ (function () {
1829
- function PreviewComponent(launcherService, configurationService, messageService, runtimeService, integrationState) {
1830
- this.launcherService = launcherService;
1831
- this.configurationService = configurationService;
1832
- this.messageService = messageService;
1833
- this.runtimeService = runtimeService;
1834
- this.integrationState = integrationState;
1835
- this.clearState = false;
1836
- this.state$ = new rxjs.BehaviorSubject({ loading: true, failure: false });
1837
- this.elements = [];
1838
- this.destroy$ = new rxjs.Subject();
2210
+ var FederatedComponent = /** @class */ (function () {
2211
+ function FederatedComponent(injector, compiler, appRef, renderer) {
2212
+ this.injector = injector;
2213
+ this.compiler = compiler;
2214
+ this.appRef = appRef;
2215
+ this.renderer = renderer;
2216
+ this.isLoading$ = new rxjs.BehaviorSubject(false);
2217
+ // configs
2218
+ this.suppressLoading = defaultOptions.suppressLoading;
2219
+ this.loadingLabel = defaultOptions.loadingLabel;
1839
2220
  }
1840
- PreviewComponent.prototype.ngOnInit = function () {
1841
- if (this.clearState) {
1842
- this.integrationState.clear();
1843
- }
1844
- this.startPreview();
1845
- };
1846
- PreviewComponent.prototype.ngOnDestroy = function () {
1847
- this.destroy$.next();
1848
- this.destroy$.complete();
1849
- this.configurationService.reset();
1850
- };
1851
- PreviewComponent.prototype.initializeConfiguration$ = function () {
1852
- var _this = this;
1853
- var isAlreadyInitialized = this.runtimeService.isInitialized;
1854
- if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
1855
- return rxjs.of({});
2221
+ FederatedComponent.prototype.ngOnChanges = function (changes) {
2222
+ var _a, _b, _c, _d;
2223
+ if (changes.data && this.instance) {
2224
+ this.instance.data = this.data;
1856
2225
  }
1857
- if (!this.modelId) {
1858
- console.warn("No modelId is given for uiDefinition with '" + this.uiDefinition.type + "' type");
1859
- return rxjs.of({});
2226
+ if (changes.options) {
2227
+ this.suppressLoading = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.suppressLoading) !== null && _b !== void 0 ? _b : defaultOptions.suppressLoading;
2228
+ this.loadingLabel = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.loadingLabel) !== null && _d !== void 0 ? _d : defaultOptions.loadingLabel;
1860
2229
  }
1861
- // If still not initialized - init configuration in Test mode
1862
- return this.runtimeService
1863
- .initTestMode(this.modelId, this.uiDefinition)
1864
- .pipe(rxjs.switchMap(function () { return _this.configurationService.configure(); }));
1865
2230
  };
1866
- PreviewComponent.prototype.elementToMetadataSafe = function (elements) {
1867
- var _a, _b;
1868
- try {
1869
- return elements.map(function (element) { return elementToMetadata(element); });
1870
- }
1871
- catch (e) {
1872
- console.error(e);
1873
- if (!((_b = (_a = this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
1874
- this.messageService.add({ severity: 'error', summary: String(e) });
1875
- }
1876
- return [];
1877
- }
2231
+ FederatedComponent.prototype.ngOnInit = function () {
2232
+ this.isLoading$.next(true);
1878
2233
  };
1879
- PreviewComponent.prototype.startPreview = function () {
2234
+ FederatedComponent.prototype.ngAfterViewInit = function () {
1880
2235
  var _this = this;
1881
- if (!this.uiDefinition) {
2236
+ var _a, _b, _c, _d, _e, _f;
2237
+ var remoteEntry = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.remoteEntry) !== null && _b !== void 0 ? _b : this.remoteEntry;
2238
+ var remoteName = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.remoteName) !== null && _d !== void 0 ? _d : this.remoteName;
2239
+ var exposedModule = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.exposedModule) !== null && _f !== void 0 ? _f : this.exposedModule;
2240
+ if (!remoteEntry || !remoteName || !exposedModule) {
1882
2241
  return;
1883
2242
  }
1884
- var _a = this.uiDefinition, children = _a.children, uiDefinitionMeta = __rest(_a, ["children"]);
1885
- var elements = this.elementToMetadataSafe(children);
1886
- var compilation$ = this.launcherService.compileModule(uiDefinitionMeta, elements);
1887
- rxjs.forkJoin([compilation$, this.initializeConfiguration$()])
1888
- .pipe(rxjs.tap(function (_c) {
1889
- var _d = __read(_c, 1), result = _d[0];
1890
- _this.elements = result.elements;
1891
- _this.state$.next({ loading: false, failure: false });
1892
- }), rxjs.catchError(function (error) {
1893
- var _a, _b;
1894
- console.error(error);
1895
- if (!((_b = (_a = _this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
1896
- _this.messageService.add({ severity: 'error', summary: error });
1897
- }
1898
- _this.state$.next({ loading: false, failure: true });
1899
- return rxjs.of();
1900
- }), rxjs.takeUntil(this.destroy$))
1901
- .subscribe();
2243
+ loadRemoteModule(remoteEntry, remoteName, exposedModule).then(function (federated) {
2244
+ _this.compiler.compileModuleAsync(federated[exposedModule]).then(function (moduleFactory) {
2245
+ var _a, _b, _c;
2246
+ var rootModuleRef = moduleFactory.create(_this.injector);
2247
+ var rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[exposedModule].rootComponent);
2248
+ var node = document.createElement('div');
2249
+ var _g = rootComponentFactory.create(_this.injector, [], node), instance = _g.instance, hostView = _g.hostView;
2250
+ _this.instance = instance;
2251
+ _this.instance.data = _this.data;
2252
+ _this.renderer.appendChild((_a = _this.moduleHostRef) === null || _a === void 0 ? void 0 : _a.nativeElement, node);
2253
+ _this.appRef.attachView(hostView);
2254
+ (_c = (_b = _this.options) === null || _b === void 0 ? void 0 : _b.onReady) === null || _c === void 0 ? void 0 : _c.call(_b);
2255
+ _this.isLoading$.next(false);
2256
+ });
2257
+ });
1902
2258
  };
1903
- return PreviewComponent;
2259
+ return FederatedComponent;
1904
2260
  }());
1905
- PreviewComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", 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 });
1906
- PreviewComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", 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 });
1907
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewComponent, decorators: [{
2261
+ 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 });
2262
+ 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: i5__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 });
2263
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedComponent, decorators: [{
1908
2264
  type: i0.Component,
1909
2265
  args: [{
1910
- selector: 'vl-cms-preview',
1911
- templateUrl: './preview.component.html',
1912
- styleUrls: ['./preview.component.scss'],
2266
+ // eslint-disable-next-line @angular-eslint/component-selector
2267
+ selector: 'veloce-host-federated',
2268
+ templateUrl: './federated.component.html',
2269
+ styleUrls: ['./federated.component.scss'],
1913
2270
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
1914
- providers: [IOProviderService, TemplatesService],
1915
- // use shadow DOM to prevent UI from being affected by global styles
1916
- encapsulation: i0.ViewEncapsulation.ShadowDom,
1917
2271
  }]
1918
- }], ctorParameters: function () { return [{ type: LauncherService }, { type: i2__namespace.ConfigurationService }, { type: i3__namespace.MessageService }, { type: i2__namespace.ConfigurationRuntimeService }, { type: IntegrationState }]; }, propDecorators: { modelId: [{
2272
+ }], ctorParameters: function () { return [{ type: i0__namespace.Injector }, { type: i0__namespace.Compiler }, { type: i0__namespace.ApplicationRef }, { type: i0__namespace.Renderer2 }]; }, propDecorators: { moduleHostRef: [{
2273
+ type: i0.ViewChild,
2274
+ args: ['moduleHost', { static: false }]
2275
+ }], remoteEntry: [{
1919
2276
  type: i0.Input
1920
- }], uiDefinition: [{
2277
+ }], remoteName: [{
2278
+ type: i0.Input
2279
+ }], exposedModule: [{
1921
2280
  type: i0.Input
1922
- }], clearState: [{
2281
+ }], data: [{
2282
+ type: i0.Input
2283
+ }], options: [{
1923
2284
  type: i0.Input
1924
2285
  }] } });
1925
2286
 
1926
- var ElementRendererModule = /** @class */ (function () {
1927
- function ElementRendererModule() {
2287
+ var FederatedModule = /** @class */ (function () {
2288
+ function FederatedModule() {
1928
2289
  }
1929
- return ElementRendererModule;
2290
+ return FederatedModule;
1930
2291
  }());
1931
- ElementRendererModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1932
- ElementRendererModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, declarations: [ElementRendererComponent], exports: [ElementRendererComponent] });
1933
- ElementRendererModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule });
1934
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementRendererModule, decorators: [{
2292
+ FederatedModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2293
+ FederatedModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, declarations: [FederatedComponent], imports: [i7.CommonModule, i5.LoaderModule], exports: [FederatedComponent] });
2294
+ FederatedModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, imports: [[i7.CommonModule, i5.LoaderModule]] });
2295
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FederatedModule, decorators: [{
1935
2296
  type: i0.NgModule,
1936
2297
  args: [{
1937
- declarations: [ElementRendererComponent],
1938
- exports: [ElementRendererComponent],
2298
+ declarations: [FederatedComponent],
2299
+ imports: [i7.CommonModule, i5.LoaderModule],
2300
+ exports: [FederatedComponent],
1939
2301
  }]
1940
2302
  }] });
1941
2303
 
1942
- var ElementChildrenModule = /** @class */ (function () {
1943
- function ElementChildrenModule() {
2304
+ var CompilationService = /** @class */ (function () {
2305
+ function CompilationService(compiler) {
2306
+ this.compiler = compiler;
1944
2307
  }
1945
- return ElementChildrenModule;
2308
+ CompilationService.prototype.compileUIDefinition$ = function (uiDefinition) {
2309
+ var _this = this;
2310
+ this.uiDefinitionMeta = lodash.omit(uiDefinition, 'children');
2311
+ return rxjs.of([]).pipe(rxjs.switchMap(function () {
2312
+ var metadata = uiDefinition.children.map(function (element) { return elementToMetadata(element); });
2313
+ _this.elementsResolver = new ElementsResolver(uiDefinition, metadata);
2314
+ var module = _this.getModule(_this.elementsResolver.getNgComponents());
2315
+ return rxjs.combineLatest([
2316
+ rxjs.from(_this.compiler.compileModuleAndAllComponentsAsync(module)),
2317
+ rxjs.of(_this.elementsResolver),
2318
+ ]);
2319
+ }), rxjs.map(function (_b) {
2320
+ var _c = __read(_b, 2), module = _c[0], elementsResolver = _c[1];
2321
+ return ({ module: module, elements: elementsResolver.elements });
2322
+ }));
2323
+ };
2324
+ CompilationService.prototype.compileElement$ = function (element) {
2325
+ var _this = this;
2326
+ if (!this.uiDefinitionMeta) {
2327
+ throw 'No UI Definition context';
2328
+ }
2329
+ return rxjs.of(this.uiDefinitionMeta).pipe(rxjs.switchMap(function (uiDefinition) {
2330
+ var _a;
2331
+ var elementsResolver = (_a = _this.elementsResolver) !== null && _a !== void 0 ? _a : new ElementsResolver(uiDefinition, []);
2332
+ elementsResolver.addElement(element);
2333
+ var module = _this.getModule(elementsResolver.getNgComponents());
2334
+ return rxjs.combineLatest([rxjs.from(_this.compiler.compileModuleAndAllComponentsAsync(module)), rxjs.of(elementsResolver)]);
2335
+ }), rxjs.map(function (_b) {
2336
+ var _c = __read(_b, 2), module = _c[0], elementsResolver = _c[1];
2337
+ return ({ module: module, elements: elementsResolver.elements });
2338
+ }));
2339
+ };
2340
+ CompilationService.prototype.clearModuleCache = function (modules) {
2341
+ var _this = this;
2342
+ modules.forEach(function (module) { return _this.compiler.clearCacheFor(module); });
2343
+ this.uiDefinitionMeta = undefined;
2344
+ };
2345
+ CompilationService.prototype.getModule = function (components) {
2346
+ var staticComponents = [
2347
+ ElementChildrenComponent,
2348
+ ElementRendererComponent,
2349
+ ElementDropHandleComponent,
2350
+ CustomTemplateDirective,
2351
+ ];
2352
+ var DynamicModule = /** @class */ (function () {
2353
+ function DynamicModule() {
2354
+ }
2355
+ return DynamicModule;
2356
+ }());
2357
+ DynamicModule = __decorate([
2358
+ i0.NgModule({
2359
+ imports: [
2360
+ i7.CommonModule,
2361
+ angularForms.FormsModule,
2362
+ angularForms.ReactiveFormsModule,
2363
+ FederatedModule,
2364
+ dragDrop.DragDropModule,
2365
+ i2$1.DndModule,
2366
+ scrolling.ScrollingModule,
2367
+ ],
2368
+ declarations: __spreadArray(__spreadArray([], __read(staticComponents)), __read(components)),
2369
+ jit: true,
2370
+ })
2371
+ ], DynamicModule);
2372
+ return DynamicModule;
2373
+ };
2374
+ return CompilationService;
1946
2375
  }());
1947
- ElementChildrenModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1948
- ElementChildrenModulemod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, declarations: [ElementChildrenComponent], imports: [ElementRendererModule], exports: [ElementChildrenComponent] });
1949
- ElementChildrenModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, imports: [[ElementRendererModule]] });
1950
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ElementChildrenModule, decorators: [{
1951
- type: i0.NgModule,
1952
- args: [{
1953
- declarations: [ElementChildrenComponent],
1954
- imports: [ElementRendererModule],
1955
- exports: [ElementChildrenComponent],
1956
- }]
1957
- }] });
2376
+ 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 });
2377
+ CompilationServiceprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CompilationService });
2378
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: CompilationService, decorators: [{
2379
+ type: i0.Injectable
2380
+ }], ctorParameters: function () { return [{ type: i0__namespace.Compiler }]; } });
1958
2381
 
1959
- var PreviewModule = /** @class */ (function () {
1960
- function PreviewModule() {
2382
+ var RuntimeModule = /** @class */ (function () {
2383
+ function RuntimeModule() {
1961
2384
  }
1962
- return PreviewModule;
2385
+ return RuntimeModule;
1963
2386
  }());
1964
- PreviewModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1965
- 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], exports: [PreviewComponent] });
1966
- 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]] });
1967
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: PreviewModule, decorators: [{
2387
+ RuntimeModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2388
+ RuntimeModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, imports: [i7.CommonModule, core.CoreModule] });
2389
+ RuntimeModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, providers: [
2390
+ dynamicdialog.DialogService,
2391
+ RuntimeService,
2392
+ RuntimeEditorService,
2393
+ { provide: CMS_COMPILATION_SERVICE, useClass: CompilationService },
2394
+ ], imports: [[i7.CommonModule, core.CoreModule]] });
2395
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeModule, decorators: [{
1968
2396
  type: i0.NgModule,
1969
2397
  args: [{
1970
- declarations: [PreviewComponent],
1971
- imports: [i7.CommonModule, i1.LoaderModule, ElementRendererModule, ElementChildrenModule],
1972
- providers: [IntegrationState],
1973
- exports: [PreviewComponent],
2398
+ imports: [i7.CommonModule, core.CoreModule],
2399
+ providers: [
2400
+ dynamicdialog.DialogService,
2401
+ RuntimeService,
2402
+ RuntimeEditorService,
2403
+ { provide: CMS_COMPILATION_SERVICE, useClass: CompilationService },
2404
+ ],
1974
2405
  }]
1975
2406
  }] });
1976
2407
 
1977
- function ElementDefinition(definition) {
1978
- return function (constructor) {
1979
- return constructor;
1980
- };
1981
- }
1982
-
1983
2408
  var LauncherModule = /** @class */ (function () {
1984
2409
  function LauncherModule() {
1985
2410
  }
1986
2411
  return LauncherModule;
1987
2412
  }());
1988
2413
  LauncherModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1989
- 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] });
1990
- LauncherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, providers: [LauncherService, IntegrationState, DynamicModuleService, dynamicdialog.DialogService], imports: [[i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule]] });
2414
+ 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] });
2415
+ LauncherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, providers: [IntegrationState, dynamicdialog.DialogService], imports: [[i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule], PreviewModule] });
1991
2416
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, decorators: [{
1992
2417
  type: i0.NgModule,
1993
2418
  args: [{
1994
- imports: [i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule],
1995
- providers: [LauncherService, IntegrationState, DynamicModuleService, dynamicdialog.DialogService],
2419
+ imports: [i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule],
2420
+ providers: [IntegrationState, dynamicdialog.DialogService],
2421
+ exports: [PreviewModule],
1996
2422
  }]
1997
2423
  }] });
1998
2424
 
@@ -2010,7 +2436,6 @@
2010
2436
  exports.ElementsResolver = ElementsResolver;
2011
2437
  exports.IntegrationState = IntegrationState;
2012
2438
  exports.LauncherModule = LauncherModule;
2013
- exports.LauncherService = LauncherService;
2014
2439
  exports.NavigateBackAction = NavigateBackAction;
2015
2440
  exports.NavigateToCatalogAction = NavigateToCatalogAction;
2016
2441
  exports.OpenDocGenAction = OpenDocGenAction;
@@ -2018,6 +2443,8 @@
2018
2443
  exports.PreviewModule = PreviewModule;
2019
2444
  exports.RemoteApplyAction = RemoteApplyAction;
2020
2445
  exports.RemoteCancelAction = RemoteCancelAction;
2446
+ exports.RuntimeEditorService = RuntimeEditorService;
2447
+ exports.RuntimeModule = RuntimeModule;
2021
2448
  exports.SHARED_ELEMENT_METADATA = SHARED_ELEMENT_METADATA;
2022
2449
  exports.SetDefaultMetrics = SetDefaultMetrics;
2023
2450
  exports.SwitchObjectAction = SwitchObjectAction;
@@ -2030,15 +2457,19 @@
2030
2457
  exports.extendElementMetadata = extendElementMetadata;
2031
2458
  exports.extractElementMetadata = extractElementMetadata;
2032
2459
  exports.findElementByModule = findElementByModule;
2460
+ exports.findElementByPath = findElementByPath;
2033
2461
  exports.flattenElements = flattenElements;
2034
2462
  exports.getAbsolutePath = getAbsolutePath;
2035
2463
  exports.getElementConfig = getElementConfig;
2464
+ exports.getElementUniqueName = getElementUniqueName;
2465
+ exports.insertElement = insertElement;
2036
2466
  exports.isSharedElement = isSharedElement;
2037
2467
  exports.isValidScript = isValidScript;
2038
2468
  exports.metadataToElement = metadataToElement;
2039
2469
  exports.normalizeElementMetadata = normalizeElementMetadata;
2040
2470
  exports.parseBoundPath = parseBoundPath;
2041
2471
  exports.parsePath = parsePath;
2472
+ exports.removeElement = removeElement;
2042
2473
  exports.stringifyElementMetadata = stringifyElementMetadata;
2043
2474
 
2044
2475
  Object.defineProperty(exports, '__esModule', { value: true });