@veloceapps/sdk 2.0.8 → 2.0.10
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.
- package/bundles/veloce-sdk-cms.umd.js +322 -258
- package/bundles/veloce-sdk-cms.umd.js.map +1 -1
- package/bundles/veloce-sdk-runtime.umd.js +1 -1
- package/bundles/veloce-sdk-runtime.umd.js.map +1 -1
- package/cms/injection-tokens.d.ts +2 -0
- package/cms/modules/configuration/services/configuration-runtime.service.d.ts +1 -1
- package/cms/plugins/configuration.plugin.d.ts +2 -3
- package/cms/plugins/script.plugin.d.ts +1 -0
- package/cms/utils/element.utils.d.ts +2 -0
- package/cms/vendor-map.d.ts +2 -0
- package/esm2015/cms/cms.default.js +3 -4
- package/esm2015/cms/cms.elements.js +9 -5
- package/esm2015/cms/injection-tokens.js +2 -1
- package/esm2015/cms/modules/configuration/helpers.js +2 -2
- package/esm2015/cms/modules/configuration/services/configuration-runtime.service.js +23 -14
- package/esm2015/cms/modules/configuration/services/configuration.service.js +3 -23
- package/esm2015/cms/modules/configuration/services/runtime-context.service.js +5 -3
- package/esm2015/cms/plugins/configuration.plugin.js +2 -4
- package/esm2015/cms/plugins/script.plugin.js +4 -26
- package/esm2015/cms/services/launcher.service.js +2 -2
- package/esm2015/cms/utils/element.utils.js +60 -3
- package/esm2015/cms/utils/elements-resolver.js +4 -2
- package/esm2015/cms/vendor-map.js +24 -0
- package/esm2015/runtime/services/context.service.js +3 -3
- package/fesm2015/veloce-sdk-cms.js +283 -226
- package/fesm2015/veloce-sdk-cms.js.map +1 -1
- package/fesm2015/veloce-sdk-runtime.js +1 -1
- package/fesm2015/veloce-sdk-runtime.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/common'), require('@
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@veloce/sdk/cms', ['exports', '@angular/core', 'rxjs', '@angular/common', '@
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloce = global.veloce || {}, global.veloce.sdk = global.veloce.sdk || {}, global.veloce.sdk.cms = {}), global.ng.core, global.rxjs, global.ng.common, global
|
|
5
|
-
})(this, (function (exports, i0, rxjs, i7,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/common'), require('@veloce/core'), require('@angular/forms'), require('lodash'), require('@veloce/sdk/runtime'), require('rxjs/operators'), require('@veloce/api'), require('primeng/api'), require('@babel/standalone'), require('@veloce/components')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@veloce/sdk/cms', ['exports', '@angular/core', 'rxjs', '@angular/common', '@veloce/core', '@angular/forms', 'lodash', '@veloce/sdk/runtime', 'rxjs/operators', '@veloce/api', 'primeng/api', '@babel/standalone', '@veloce/components'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloce = global.veloce || {}, global.veloce.sdk = global.veloce.sdk || {}, global.veloce.sdk.cms = {}), global.ng.core, global.rxjs, global.ng.common, global["@veloce/core"], global.ng.forms, global.lodash, global.veloce.sdk.runtime, global.rxjs.operators, global["@veloce/api"], global["primeng/api"], global["@babel/standalone"], global["@veloce/components"]));
|
|
5
|
+
})(this, (function (exports, i0, rxjs, i7, core, angularForms, lodash, i2, rxjsOperators, i1, i2$1, standalone, i5) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -356,6 +356,7 @@
|
|
|
356
356
|
var ELEMENT_METADATA = new i0.InjectionToken('ELEMENT_METADATA_TOKEN');
|
|
357
357
|
var SHARED_ELEMENT_METADATA = new i0.InjectionToken('SHARED_ELEMENT_METADATA_TOKEN');
|
|
358
358
|
var ELEMENT_CONFIG = new i0.InjectionToken('ELEMENT_CONFIG_TOKEN');
|
|
359
|
+
var VENDOR_MAP = new i0.InjectionToken('VENDOR_MAP');
|
|
359
360
|
|
|
360
361
|
var vlInjectionTokens = /*#__PURE__*/Object.freeze({
|
|
361
362
|
__proto__: null,
|
|
@@ -363,7 +364,8 @@
|
|
|
363
364
|
UI_DEFINITION_METADATA: UI_DEFINITION_METADATA,
|
|
364
365
|
ELEMENT_METADATA: ELEMENT_METADATA,
|
|
365
366
|
SHARED_ELEMENT_METADATA: SHARED_ELEMENT_METADATA,
|
|
366
|
-
ELEMENT_CONFIG: ELEMENT_CONFIG
|
|
367
|
+
ELEMENT_CONFIG: ELEMENT_CONFIG,
|
|
368
|
+
VENDOR_MAP: VENDOR_MAP
|
|
367
369
|
});
|
|
368
370
|
|
|
369
371
|
var Entity = /** @class */ (function () {
|
|
@@ -613,25 +615,75 @@
|
|
|
613
615
|
type: i0.Directive
|
|
614
616
|
}], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
|
|
615
617
|
|
|
618
|
+
var normalizeImports = function (script) {
|
|
619
|
+
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');
|
|
620
|
+
var result = script.replace(regexp, function (match, g1, g2, src) { return "const " + g1 + " = vendor['" + src + "'];"; });
|
|
621
|
+
return result;
|
|
622
|
+
};
|
|
623
|
+
var ScriptPlugin = /** @class */ (function () {
|
|
624
|
+
function ScriptPlugin(host) {
|
|
625
|
+
this.host = host;
|
|
626
|
+
this.document = this.host.injector.get(i7.DOCUMENT);
|
|
627
|
+
this.vendorMap = this.host.injector.get(VENDOR_MAP);
|
|
628
|
+
var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
|
629
|
+
var sharedElementMetadata = this.host.injector.get(SHARED_ELEMENT_METADATA);
|
|
630
|
+
if (sharedElementMetadata === null || sharedElementMetadata === void 0 ? void 0 : sharedElementMetadata.script) {
|
|
631
|
+
this.addScript(sharedElementMetadata.script);
|
|
632
|
+
}
|
|
633
|
+
if (elementMetadata.script) {
|
|
634
|
+
this.addScript(elementMetadata.script);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
ScriptPlugin.prototype.addScript = function (scriptStr) {
|
|
638
|
+
var id = btoa(core.UUID.UUID());
|
|
639
|
+
var script = this.document.createElement('script');
|
|
640
|
+
script.type = "text/javascript";
|
|
641
|
+
var scriptContent = normalizeImports(scriptStr);
|
|
642
|
+
var classMatch = /export class (\S+)/.exec(scriptContent);
|
|
643
|
+
var className = classMatch === null || classMatch === void 0 ? void 0 : classMatch[1];
|
|
644
|
+
if (!classMatch || !className) {
|
|
645
|
+
console.error("Script doesn't have exported class");
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
scriptContent = scriptContent.replace(classMatch[0], "class " + className);
|
|
649
|
+
script.text = "var " + id + " = function(vendor) {" + scriptContent + "\n return " + className + "; };";
|
|
650
|
+
this.document.body.appendChild(script);
|
|
651
|
+
var ScriptClass = window[id](this.vendorMap);
|
|
652
|
+
if (ScriptClass instanceof Object) {
|
|
653
|
+
this.host.registerPlugin(new ScriptClass(this.host));
|
|
654
|
+
}
|
|
655
|
+
this.document.body.removeChild(script);
|
|
656
|
+
};
|
|
657
|
+
return ScriptPlugin;
|
|
658
|
+
}());
|
|
659
|
+
ScriptPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ScriptPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
660
|
+
ScriptPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: ScriptPlugin, ngImport: i0__namespace });
|
|
661
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ScriptPlugin, decorators: [{
|
|
662
|
+
type: i0.Directive
|
|
663
|
+
}], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
|
|
664
|
+
|
|
665
|
+
/*
|
|
666
|
+
* ScriptPlugin must always be the last plugin in the list to make sure user code is running after all pre-initializers.
|
|
667
|
+
*/
|
|
616
668
|
var CONFIG = {
|
|
617
669
|
CUSTOM: {
|
|
618
670
|
component: exports.ElementComponent,
|
|
619
|
-
plugins: [IOPlugin],
|
|
671
|
+
plugins: [IOPlugin, ScriptPlugin],
|
|
620
672
|
},
|
|
621
673
|
CONTAINER: {
|
|
622
674
|
component: exports.ElementComponent,
|
|
623
675
|
defaultTemplate: '<element-children></element-children>',
|
|
624
|
-
plugins: [],
|
|
676
|
+
plugins: [ScriptPlugin],
|
|
625
677
|
},
|
|
626
678
|
SERVICE: {
|
|
627
679
|
component: exports.ElementComponent,
|
|
628
|
-
plugins: [IOPlugin],
|
|
680
|
+
plugins: [IOPlugin, ScriptPlugin],
|
|
629
681
|
suppressTemplate: true,
|
|
630
682
|
suppressStyles: true,
|
|
631
683
|
},
|
|
632
684
|
REFERENCE: {
|
|
633
685
|
component: exports.ElementComponent,
|
|
634
|
-
plugins: [IOPlugin],
|
|
686
|
+
plugins: [IOPlugin, ScriptPlugin],
|
|
635
687
|
suppressTemplate: true,
|
|
636
688
|
},
|
|
637
689
|
};
|
|
@@ -661,16 +713,17 @@
|
|
|
661
713
|
reference: metadata.reference,
|
|
662
714
|
inputs: metadata.inputs,
|
|
663
715
|
outputs: metadata.outputs,
|
|
664
|
-
children: metadata.children.map(function (
|
|
665
|
-
var name =
|
|
716
|
+
children: metadata.children.map(function (_e) {
|
|
717
|
+
var name = _e.name;
|
|
666
718
|
return name;
|
|
667
719
|
}),
|
|
668
720
|
};
|
|
721
|
+
var normalizedElMetadata = normalizeElementMetadata(elMetadata);
|
|
669
722
|
if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
|
|
670
723
|
throw new Error("'" + metadata.name + "' element script doesn't have exported class");
|
|
671
724
|
}
|
|
672
725
|
var script = metadata.script &&
|
|
673
|
-
window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, "@ElementDefinition(" +
|
|
726
|
+
window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, "@ElementDefinition(" + stringifyElementMetadata(normalizedElMetadata) + ")\nexport class Script"));
|
|
674
727
|
var template = metadata.template && window.btoa(metadata.template);
|
|
675
728
|
var styles = metadata.styles && window.btoa(metadata.styles);
|
|
676
729
|
return {
|
|
@@ -680,6 +733,60 @@
|
|
|
680
733
|
children: metadata.children.map(function (meta) { return metadataToElement(meta); }),
|
|
681
734
|
};
|
|
682
735
|
};
|
|
736
|
+
var normalizeElementMetadata = function (elementMetadata) {
|
|
737
|
+
var _a, _b, _c, _d;
|
|
738
|
+
var metadata = Object.assign({}, elementMetadata);
|
|
739
|
+
// model
|
|
740
|
+
var _e = (_a = metadata.model) !== null && _a !== void 0 ? _a : {}, lineItem = _e.lineItem, path = _e.path;
|
|
741
|
+
var model = lineItem ? { lineItem: lineItem } : path ? { path: path } : undefined;
|
|
742
|
+
if (model) {
|
|
743
|
+
metadata.model = model;
|
|
744
|
+
}
|
|
745
|
+
else {
|
|
746
|
+
delete metadata.model;
|
|
747
|
+
}
|
|
748
|
+
// module
|
|
749
|
+
if (!metadata.module) {
|
|
750
|
+
delete metadata.module;
|
|
751
|
+
}
|
|
752
|
+
// reference
|
|
753
|
+
if (!metadata.reference) {
|
|
754
|
+
delete metadata.reference;
|
|
755
|
+
}
|
|
756
|
+
// inputs
|
|
757
|
+
var inputs = Object.entries((_b = metadata.inputs) !== null && _b !== void 0 ? _b : {}).reduce(function (acc, _e) {
|
|
758
|
+
var _f;
|
|
759
|
+
var _g = __read(_e, 2), key = _g[0], value = _g[1];
|
|
760
|
+
return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
|
|
761
|
+
}, {});
|
|
762
|
+
if (inputs && Object.keys(inputs).length > 0) {
|
|
763
|
+
metadata.inputs = inputs;
|
|
764
|
+
}
|
|
765
|
+
else {
|
|
766
|
+
delete metadata.inputs;
|
|
767
|
+
}
|
|
768
|
+
// outputs
|
|
769
|
+
var outputs = Object.entries((_c = metadata.outputs) !== null && _c !== void 0 ? _c : {}).reduce(function (acc, _e) {
|
|
770
|
+
var _f;
|
|
771
|
+
var _g = __read(_e, 2), key = _g[0], value = _g[1];
|
|
772
|
+
return Object.assign(Object.assign({}, acc), (_f = {}, _f[key] = value || null, _f));
|
|
773
|
+
}, {});
|
|
774
|
+
if (outputs && Object.keys(outputs).length > 0) {
|
|
775
|
+
metadata.outputs = outputs;
|
|
776
|
+
}
|
|
777
|
+
else {
|
|
778
|
+
delete metadata.outputs;
|
|
779
|
+
}
|
|
780
|
+
// children
|
|
781
|
+
if (!((_d = metadata.children) === null || _d === void 0 ? void 0 : _d.length)) {
|
|
782
|
+
delete metadata.children;
|
|
783
|
+
}
|
|
784
|
+
// isShared
|
|
785
|
+
if (!metadata.isShared) {
|
|
786
|
+
delete metadata.isShared;
|
|
787
|
+
}
|
|
788
|
+
return metadata;
|
|
789
|
+
};
|
|
683
790
|
var extractElementMetadata = function (script) {
|
|
684
791
|
var _a;
|
|
685
792
|
var metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
|
@@ -696,7 +803,7 @@
|
|
|
696
803
|
return script;
|
|
697
804
|
}
|
|
698
805
|
var updated = Object.assign(Object.assign({}, eval("(" + metadataString + ")")), extend);
|
|
699
|
-
return script.replace(metadataString,
|
|
806
|
+
return script.replace(metadataString, stringifyElementMetadata(updated));
|
|
700
807
|
};
|
|
701
808
|
var getElementConfig = function (type) {
|
|
702
809
|
return CONFIG[type];
|
|
@@ -705,6 +812,12 @@
|
|
|
705
812
|
var _a, _b;
|
|
706
813
|
return (_b = (_a = getElementConfig(type).plugins) === null || _a === void 0 ? void 0 : _a.includes(IOPlugin)) !== null && _b !== void 0 ? _b : false;
|
|
707
814
|
};
|
|
815
|
+
function stringifyElementMetadata(elementMetadata) {
|
|
816
|
+
var cleaned = JSON.stringify(elementMetadata, null, 2);
|
|
817
|
+
return cleaned.replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm, function (match) {
|
|
818
|
+
return match.replace(/"/g, '');
|
|
819
|
+
});
|
|
820
|
+
}
|
|
708
821
|
|
|
709
822
|
var ElementContextService = /** @class */ (function () {
|
|
710
823
|
function ElementContextService() {
|
|
@@ -858,7 +971,7 @@
|
|
|
858
971
|
var getDefaultLineItem = function (context, uiDefinitionProperties) {
|
|
859
972
|
var _a, _b, _c;
|
|
860
973
|
var id = core.UUID.UUID();
|
|
861
|
-
var lineItem = Object.assign({ id: id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', qty: 1, productName: ((_b = context.properties) === null || _b === void 0 ? void 0 : _b.displayName) || context.productName, productId: (_c = context.productId) !== null && _c !== void 0 ? _c : ''
|
|
974
|
+
var lineItem = Object.assign({ id: id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', qty: 1, productName: ((_b = context.properties) === null || _b === void 0 ? void 0 : _b.displayName) || context.productName, productId: (_c = context.productId) !== null && _c !== void 0 ? _c : '' }, (context.offeringId
|
|
862
975
|
? { offeringId: context.offeringId, offeringInstanceId: context.offeringInstanceId || id }
|
|
863
976
|
: {}));
|
|
864
977
|
return lineItem;
|
|
@@ -872,10 +985,10 @@
|
|
|
872
985
|
RuntimeContextService.prototype.getRuntimeContext = function (productId, offeringId) {
|
|
873
986
|
var _this = this;
|
|
874
987
|
return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(rxjsOperators.map(function (runtimeData) {
|
|
875
|
-
var _a, _b;
|
|
988
|
+
var _a, _b, _c, _d;
|
|
876
989
|
var uiDefinition = _this.getUIDefinition(runtimeData);
|
|
877
990
|
var runtimeModel = core.RuntimeModel.create(runtimeData.types, runtimeData.products);
|
|
878
|
-
var
|
|
991
|
+
var _e = (_a = Array.from(runtimeModel.components.values()).find(function (c) { return c.productId === productId; })) !== null && _a !== void 0 ? _a : {}, productName = _e.productName, properties = _e.properties;
|
|
879
992
|
return {
|
|
880
993
|
modelId: runtimeData.modelId,
|
|
881
994
|
uiDefinition: uiDefinition,
|
|
@@ -884,8 +997,10 @@
|
|
|
884
997
|
productId: productId,
|
|
885
998
|
productType: (properties === null || properties === void 0 ? void 0 : properties.displayName) || productName,
|
|
886
999
|
offeringId: offeringId,
|
|
1000
|
+
priceListId: (_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.priceList,
|
|
887
1001
|
properties: {
|
|
888
|
-
PricingEnabled: (
|
|
1002
|
+
PricingEnabled: (_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _c === void 0 ? void 0 : _c.pricingEnabled,
|
|
1003
|
+
PriceListId: (_d = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _d === void 0 ? void 0 : _d.priceList,
|
|
889
1004
|
},
|
|
890
1005
|
};
|
|
891
1006
|
}));
|
|
@@ -940,14 +1055,17 @@
|
|
|
940
1055
|
this.apiService.getRuntimeDataByModelId(modelId),
|
|
941
1056
|
this.contextService.create('TestId', core.ConfigurationContextMode.TEST),
|
|
942
1057
|
]).pipe(rxjsOperators.first(), rxjsOperators.tap(function (_d) {
|
|
943
|
-
var _e = __read(_d,
|
|
944
|
-
var
|
|
945
|
-
|
|
1058
|
+
var _e = __read(_d, 2), runtimeData = _e[0], configurationContext = _e[1];
|
|
1059
|
+
var _a;
|
|
1060
|
+
_this._runtimeContext = {
|
|
946
1061
|
modelId: modelId,
|
|
947
|
-
runtimeModel:
|
|
1062
|
+
runtimeModel: core.RuntimeModel.create(runtimeData.types, runtimeData.products),
|
|
948
1063
|
runtimeMode: i2.RuntimeMode.TEST,
|
|
949
1064
|
};
|
|
950
|
-
_this.
|
|
1065
|
+
_this.contextService.update({
|
|
1066
|
+
priceListId: uiDefinitionProperties.priceList,
|
|
1067
|
+
properties: Object.assign(Object.assign(Object.assign({}, (_a = _this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), configurationContext.properties), { ModelId: modelId, RuntimeMode: core.ConfigurationContextMode.TEST, PricingEnabled: String(uiDefinitionProperties.pricingEnabled), StartDate: new Date().toISOString().substring(0, 10), PriceListId: uiDefinitionProperties.priceList }),
|
|
1068
|
+
});
|
|
951
1069
|
_this._isInitialized = true;
|
|
952
1070
|
}));
|
|
953
1071
|
};
|
|
@@ -962,18 +1080,25 @@
|
|
|
962
1080
|
var _a, _b, _c;
|
|
963
1081
|
_this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {};
|
|
964
1082
|
var mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign({}, runtimeContext.properties), configurationContext.properties) });
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
1083
|
+
_this.id15to18('AccountId', mergeContext.properties);
|
|
1084
|
+
_this._runtimeContext = mergeContext;
|
|
1085
|
+
if (configurationContext.properties && ((_c = runtimeContext.properties) === null || _c === void 0 ? void 0 : _c.StartDate)) {
|
|
1086
|
+
_this.contextService.update({
|
|
1087
|
+
priceListId: _this.uiDefinitionProperties.priceList,
|
|
1088
|
+
properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), configurationContext.properties), { PricingEnabled: String(_this.uiDefinitionProperties.pricingEnabled), PriceListId: _this.uiDefinitionProperties.priceList }),
|
|
969
1089
|
});
|
|
970
1090
|
}
|
|
971
|
-
_this._runtimeContext = mergeContext;
|
|
972
1091
|
_this._isInitialized = true;
|
|
973
1092
|
}));
|
|
974
1093
|
};
|
|
975
|
-
ConfigurationRuntimeService.prototype.
|
|
976
|
-
|
|
1094
|
+
ConfigurationRuntimeService.prototype.id15to18 = function (propertyName, source) {
|
|
1095
|
+
if (!source) {
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
var value = source[propertyName];
|
|
1099
|
+
if (typeof value === 'string' && value.length === 15) {
|
|
1100
|
+
source[propertyName] = core.SalesforceIdUtils.generateId18FromId15(value);
|
|
1101
|
+
}
|
|
977
1102
|
};
|
|
978
1103
|
ConfigurationRuntimeService.prototype.getAsset = function (lineItem) {
|
|
979
1104
|
return this._assets && this._assets.find(function (a) { return a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId; });
|
|
@@ -1105,26 +1230,6 @@
|
|
|
1105
1230
|
return request$.pipe(rxjsOperators.tap(function (lineItem) { return lineItem && _this.lineItem.next(lineItem); }), rxjsOperators.catchError(function (error) { return rxjs.throwError(function () { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); }); }));
|
|
1106
1231
|
};
|
|
1107
1232
|
ConfigurationService.prototype.createRequest = function (lineItem) {
|
|
1108
|
-
var _a, _b, _c;
|
|
1109
|
-
var runtimeContext = this.getRuntimeContext();
|
|
1110
|
-
var uiDefinitionProperties = this.runtimeService.uiDefinitionProperties;
|
|
1111
|
-
if (runtimeContext.runtimeMode === i2.RuntimeMode.TEST) {
|
|
1112
|
-
var properties = Object.assign(Object.assign({}, runtimeContext.properties), { ModelId: runtimeContext.modelId, RuntimeMode: core.ConfigurationContextMode.TEST, PricingEnabled: String(uiDefinitionProperties.pricingEnabled), StartDate: (_b = (_a = runtimeContext.properties) === null || _a === void 0 ? void 0 : _a.StartDate) !== null && _b !== void 0 ? _b : new Date().toISOString().substring(0, 10), PriceListId: uiDefinitionProperties.priceList });
|
|
1113
|
-
var ctx = {
|
|
1114
|
-
priceListId: uiDefinitionProperties.priceList,
|
|
1115
|
-
properties: properties,
|
|
1116
|
-
};
|
|
1117
|
-
this.contextService.update(ctx);
|
|
1118
|
-
}
|
|
1119
|
-
else {
|
|
1120
|
-
var context = this.contextService.resolve();
|
|
1121
|
-
if ((context === null || context === void 0 ? void 0 : context.properties) && ((_c = runtimeContext.properties) === null || _c === void 0 ? void 0 : _c.StartDate)) {
|
|
1122
|
-
this.contextService.update({
|
|
1123
|
-
priceListId: uiDefinitionProperties.priceList,
|
|
1124
|
-
properties: Object.assign(Object.assign(Object.assign({}, context.properties), runtimeContext.properties), { PricingEnabled: String(uiDefinitionProperties.pricingEnabled), PriceListId: uiDefinitionProperties.priceList }),
|
|
1125
|
-
});
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
1233
|
return {
|
|
1129
1234
|
lineItem: lineItem,
|
|
1130
1235
|
mode: this.mode,
|
|
@@ -1304,6 +1409,159 @@
|
|
|
1304
1409
|
}]
|
|
1305
1410
|
}], ctorParameters: function () { return [{ type: ElementContextService }]; } });
|
|
1306
1411
|
|
|
1412
|
+
var moduleMap = {};
|
|
1413
|
+
function loadRemoteEntry(remoteEntry) {
|
|
1414
|
+
return new Promise(function (resolve, reject) {
|
|
1415
|
+
if (moduleMap[remoteEntry]) {
|
|
1416
|
+
resolve();
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
var script = document.createElement('script');
|
|
1420
|
+
script.src = remoteEntry;
|
|
1421
|
+
script.onerror = reject;
|
|
1422
|
+
script.onload = function () {
|
|
1423
|
+
moduleMap[remoteEntry] = true;
|
|
1424
|
+
resolve(); // window is the global namespace
|
|
1425
|
+
};
|
|
1426
|
+
document.body.append(script);
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
function lookupExposedModule(remoteName, exposedModule) {
|
|
1430
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1431
|
+
var container, factory, Module;
|
|
1432
|
+
return __generator(this, function (_a) {
|
|
1433
|
+
switch (_a.label) {
|
|
1434
|
+
case 0:
|
|
1435
|
+
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
|
1436
|
+
return [4 /*yield*/, __webpack_init_sharing__('default')];
|
|
1437
|
+
case 1:
|
|
1438
|
+
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
|
1439
|
+
_a.sent();
|
|
1440
|
+
container = window[remoteName];
|
|
1441
|
+
// Initialize the container, it may provide shared modules
|
|
1442
|
+
return [4 /*yield*/, container.init(__webpack_share_scopes__.default)];
|
|
1443
|
+
case 2:
|
|
1444
|
+
// Initialize the container, it may provide shared modules
|
|
1445
|
+
_a.sent();
|
|
1446
|
+
return [4 /*yield*/, container.get(exposedModule)];
|
|
1447
|
+
case 3:
|
|
1448
|
+
factory = _a.sent();
|
|
1449
|
+
Module = factory();
|
|
1450
|
+
return [2 /*return*/, Module];
|
|
1451
|
+
}
|
|
1452
|
+
});
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
function loadRemoteModule(options) {
|
|
1456
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1457
|
+
return __generator(this, function (_a) {
|
|
1458
|
+
switch (_a.label) {
|
|
1459
|
+
case 0: return [4 /*yield*/, loadRemoteEntry(options.remoteEntry)];
|
|
1460
|
+
case 1:
|
|
1461
|
+
_a.sent();
|
|
1462
|
+
return [4 /*yield*/, lookupExposedModule(options.remoteName, options.exposedModule)];
|
|
1463
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
var IntegrationEvent;
|
|
1470
|
+
(function (IntegrationEvent) {
|
|
1471
|
+
IntegrationEvent["Init"] = "Init";
|
|
1472
|
+
})(IntegrationEvent || (IntegrationEvent = {}));
|
|
1473
|
+
var FederatedComponent = /** @class */ (function () {
|
|
1474
|
+
function FederatedComponent(injector, compiler, appRef, renderer) {
|
|
1475
|
+
this.injector = injector;
|
|
1476
|
+
this.compiler = compiler;
|
|
1477
|
+
this.appRef = appRef;
|
|
1478
|
+
this.renderer = renderer;
|
|
1479
|
+
this.integrationEvent = new i0.EventEmitter();
|
|
1480
|
+
this.moduleReady = false;
|
|
1481
|
+
}
|
|
1482
|
+
FederatedComponent.prototype.ngAfterViewInit = function () {
|
|
1483
|
+
var _this = this;
|
|
1484
|
+
if (!this.remoteEntry || !this.remoteName || !this.exposedModule) {
|
|
1485
|
+
return;
|
|
1486
|
+
}
|
|
1487
|
+
loadRemoteModule({
|
|
1488
|
+
remoteEntry: this.remoteEntry,
|
|
1489
|
+
remoteName: this.remoteName,
|
|
1490
|
+
exposedModule: this.exposedModule,
|
|
1491
|
+
}).then(function (federated) {
|
|
1492
|
+
_this.compiler.compileModuleAsync(federated[_this.exposedModule]).then(function (moduleFactory) {
|
|
1493
|
+
var _a;
|
|
1494
|
+
var rootModuleRef = moduleFactory.create(_this.injector);
|
|
1495
|
+
var rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[_this.exposedModule].rootComponent);
|
|
1496
|
+
var node = document.createElement('div');
|
|
1497
|
+
var _b = rootComponentFactory.create(_this.injector, [], node), instance = _b.instance, hostView = _b.hostView;
|
|
1498
|
+
_this.instance = instance;
|
|
1499
|
+
_this.instance.data = _this.data;
|
|
1500
|
+
_this.instance.eventData = _this.eventData;
|
|
1501
|
+
_this.instance.integrationEvent = _this.integrationEvent;
|
|
1502
|
+
_this.renderer.appendChild((_a = _this.moduleHostRef) === null || _a === void 0 ? void 0 : _a.nativeElement, node);
|
|
1503
|
+
_this.appRef.attachView(hostView);
|
|
1504
|
+
});
|
|
1505
|
+
});
|
|
1506
|
+
};
|
|
1507
|
+
FederatedComponent.prototype.ngOnChanges = function (changes) {
|
|
1508
|
+
if (!this.instance) {
|
|
1509
|
+
return;
|
|
1510
|
+
}
|
|
1511
|
+
this.instance.ngOnChanges(changes);
|
|
1512
|
+
};
|
|
1513
|
+
return FederatedComponent;
|
|
1514
|
+
}());
|
|
1515
|
+
FederatedComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", 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 });
|
|
1516
|
+
FederatedComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", eventData: "eventData" }, outputs: { integrationEvent: "integrationEvent" }, viewQueries: [{ propertyName: "federatedComponent", first: true, predicate: ["federatedComponent"], descendants: true, read: i0.ViewContainerRef }, { propertyName: "foo", first: true, predicate: ["foo"], descendants: true, read: i0.TemplateRef }, { propertyName: "moduleHostRef", first: true, predicate: ["moduleHost"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div #moduleHost></div>\n", styles: [":host{display:block}div{height:100%}\n"], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1517
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FederatedComponent, decorators: [{
|
|
1518
|
+
type: i0.Component,
|
|
1519
|
+
args: [{
|
|
1520
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
|
1521
|
+
selector: 'veloce-host-federated',
|
|
1522
|
+
templateUrl: './federated.component.html',
|
|
1523
|
+
styleUrls: ['./federated.component.scss'],
|
|
1524
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1525
|
+
}]
|
|
1526
|
+
}], ctorParameters: function () { return [{ type: i0__namespace.Injector }, { type: i0__namespace.Compiler }, { type: i0__namespace.ApplicationRef }, { type: i0__namespace.Renderer2 }]; }, propDecorators: { federatedComponent: [{
|
|
1527
|
+
type: i0.ViewChild,
|
|
1528
|
+
args: ['federatedComponent', { read: i0.ViewContainerRef }]
|
|
1529
|
+
}], foo: [{
|
|
1530
|
+
type: i0.ViewChild,
|
|
1531
|
+
args: ['foo', { read: i0.TemplateRef }]
|
|
1532
|
+
}], moduleHostRef: [{
|
|
1533
|
+
type: i0.ViewChild,
|
|
1534
|
+
args: ['moduleHost', { static: false }]
|
|
1535
|
+
}], remoteEntry: [{
|
|
1536
|
+
type: i0.Input
|
|
1537
|
+
}], remoteName: [{
|
|
1538
|
+
type: i0.Input
|
|
1539
|
+
}], exposedModule: [{
|
|
1540
|
+
type: i0.Input
|
|
1541
|
+
}], data: [{
|
|
1542
|
+
type: i0.Input
|
|
1543
|
+
}], eventData: [{
|
|
1544
|
+
type: i0.Input
|
|
1545
|
+
}], integrationEvent: [{
|
|
1546
|
+
type: i0.Output
|
|
1547
|
+
}] } });
|
|
1548
|
+
|
|
1549
|
+
var FederatedModule = /** @class */ (function () {
|
|
1550
|
+
function FederatedModule() {
|
|
1551
|
+
}
|
|
1552
|
+
return FederatedModule;
|
|
1553
|
+
}());
|
|
1554
|
+
FederatedModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FederatedModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1555
|
+
FederatedModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FederatedModule, declarations: [FederatedComponent], exports: [FederatedComponent] });
|
|
1556
|
+
FederatedModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FederatedModule });
|
|
1557
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FederatedModule, decorators: [{
|
|
1558
|
+
type: i0.NgModule,
|
|
1559
|
+
args: [{
|
|
1560
|
+
declarations: [FederatedComponent],
|
|
1561
|
+
exports: [FederatedComponent],
|
|
1562
|
+
}]
|
|
1563
|
+
}] });
|
|
1564
|
+
|
|
1307
1565
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1308
1566
|
var CustomTemplateDirective = /** @class */ (function () {
|
|
1309
1567
|
function CustomTemplateDirective(templateRef, templatesService) {
|
|
@@ -1329,14 +1587,12 @@
|
|
|
1329
1587
|
|
|
1330
1588
|
var ConfigurationPlugin = /** @class */ (function () {
|
|
1331
1589
|
function ConfigurationPlugin(host) {
|
|
1590
|
+
var _this = this;
|
|
1591
|
+
var _a, _b;
|
|
1332
1592
|
this.host = host;
|
|
1333
1593
|
this.destroy$ = new rxjs.Subject();
|
|
1334
1594
|
this.elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
|
1335
1595
|
this.configurationService = this.host.injector.get(ConfigurationService);
|
|
1336
|
-
}
|
|
1337
|
-
ConfigurationPlugin.prototype.ngOnInit = function () {
|
|
1338
|
-
var _this = this;
|
|
1339
|
-
var _a, _b;
|
|
1340
1596
|
if ((_a = this.elementMetadata.model) === null || _a === void 0 ? void 0 : _a.lineItem) {
|
|
1341
1597
|
this.host.model$.pipe(rxjs.takeUntil(this.destroy$)).subscribe(function (model) { return (_this.modelSnapshot = model); });
|
|
1342
1598
|
var pathBlocks = parseBoundPath((_b = this.elementMetadata.model) === null || _b === void 0 ? void 0 : _b.lineItem);
|
|
@@ -1344,7 +1600,7 @@
|
|
|
1344
1600
|
this.host.boundName = name !== null && name !== void 0 ? name : type;
|
|
1345
1601
|
this.register(type, property, name);
|
|
1346
1602
|
}
|
|
1347
|
-
}
|
|
1603
|
+
}
|
|
1348
1604
|
ConfigurationPlugin.prototype.ngOnDestroy = function () {
|
|
1349
1605
|
this.destroy$.next();
|
|
1350
1606
|
this.destroy$.complete();
|
|
@@ -1435,6 +1691,11 @@
|
|
|
1435
1691
|
type: i0.Directive
|
|
1436
1692
|
}], ctorParameters: function () { return [{ type: undefined }]; } });
|
|
1437
1693
|
|
|
1694
|
+
var DEFAULT_PLUGINS = {
|
|
1695
|
+
CONFIGURATION: [ConfigurationPlugin],
|
|
1696
|
+
DEFAULT: [],
|
|
1697
|
+
};
|
|
1698
|
+
|
|
1438
1699
|
var vlCmsModules = /*#__PURE__*/Object.freeze({
|
|
1439
1700
|
__proto__: null,
|
|
1440
1701
|
getDefaultLineItem: getDefaultLineItem,
|
|
@@ -1446,10 +1707,12 @@
|
|
|
1446
1707
|
__proto__: null,
|
|
1447
1708
|
elementToMetadata: elementToMetadata,
|
|
1448
1709
|
metadataToElement: metadataToElement,
|
|
1710
|
+
normalizeElementMetadata: normalizeElementMetadata,
|
|
1449
1711
|
extractElementMetadata: extractElementMetadata,
|
|
1450
1712
|
extendElementMetadata: extendElementMetadata,
|
|
1451
1713
|
getElementConfig: getElementConfig,
|
|
1452
1714
|
doesElementSupportIO: doesElementSupportIO,
|
|
1715
|
+
stringifyElementMetadata: stringifyElementMetadata,
|
|
1453
1716
|
parseBoundPath: parseBoundPath,
|
|
1454
1717
|
findLineItem: findLineItem,
|
|
1455
1718
|
insertLineItem: insertLineItem,
|
|
@@ -1468,7 +1731,7 @@
|
|
|
1468
1731
|
'@veloce/sdk/cms': Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, vlCmsModules), vlCmsUtils), vlCmsLineItemTypes), vlInjectionTokens), { TemplatesService: TemplatesService }),
|
|
1469
1732
|
'@veloce/api': {
|
|
1470
1733
|
SalesforceApiService: i1.SalesforceApiService,
|
|
1471
|
-
QuoteApiService: i1.QuoteApiService
|
|
1734
|
+
QuoteApiService: i1.QuoteApiService,
|
|
1472
1735
|
},
|
|
1473
1736
|
'@angular/core': i0__namespace,
|
|
1474
1737
|
'@angular/forms': angularForms__namespace,
|
|
@@ -1476,56 +1739,6 @@
|
|
|
1476
1739
|
'rxjs/operators': rxjsOperators__namespace,
|
|
1477
1740
|
lodash: lodash__namespace,
|
|
1478
1741
|
};
|
|
1479
|
-
var normalizeImports = function (script) {
|
|
1480
|
-
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');
|
|
1481
|
-
var result = script.replace(regexp, function (match, g1, g2, src) { return "const " + g1 + " = vendor['" + src + "'];"; });
|
|
1482
|
-
return result;
|
|
1483
|
-
};
|
|
1484
|
-
var ScriptPlugin = /** @class */ (function () {
|
|
1485
|
-
function ScriptPlugin(host) {
|
|
1486
|
-
this.host = host;
|
|
1487
|
-
this.document = this.host.injector.get(i7.DOCUMENT);
|
|
1488
|
-
var elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
|
1489
|
-
var sharedElementMetadata = this.host.injector.get(SHARED_ELEMENT_METADATA);
|
|
1490
|
-
if (sharedElementMetadata === null || sharedElementMetadata === void 0 ? void 0 : sharedElementMetadata.script) {
|
|
1491
|
-
this.addScript(sharedElementMetadata.script);
|
|
1492
|
-
}
|
|
1493
|
-
if (elementMetadata.script) {
|
|
1494
|
-
this.addScript(elementMetadata.script);
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
ScriptPlugin.prototype.addScript = function (scriptStr) {
|
|
1498
|
-
var id = btoa(core.UUID.UUID());
|
|
1499
|
-
var script = this.document.createElement('script');
|
|
1500
|
-
script.type = "text/javascript";
|
|
1501
|
-
var scriptContent = normalizeImports(scriptStr);
|
|
1502
|
-
var classMatch = /export class (\S+)/.exec(scriptContent);
|
|
1503
|
-
var className = classMatch === null || classMatch === void 0 ? void 0 : classMatch[1];
|
|
1504
|
-
if (!classMatch || !className) {
|
|
1505
|
-
console.error("Script doesn't have exported class");
|
|
1506
|
-
return;
|
|
1507
|
-
}
|
|
1508
|
-
scriptContent = scriptContent.replace(classMatch[0], "class " + className);
|
|
1509
|
-
script.text = "var " + id + " = function(vendor) {" + scriptContent + "\n return " + className + "; };";
|
|
1510
|
-
this.document.body.appendChild(script);
|
|
1511
|
-
var ScriptClass = window[id](vendorMap);
|
|
1512
|
-
if (ScriptClass instanceof Object) {
|
|
1513
|
-
this.host.registerPlugin(new ScriptClass(this.host));
|
|
1514
|
-
}
|
|
1515
|
-
this.document.body.removeChild(script);
|
|
1516
|
-
};
|
|
1517
|
-
return ScriptPlugin;
|
|
1518
|
-
}());
|
|
1519
|
-
ScriptPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ScriptPlugin, deps: [{ token: exports.ElementComponent }], target: i0__namespace.ɵɵFactoryTarget.Directive });
|
|
1520
|
-
ScriptPlugin.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: ScriptPlugin, ngImport: i0__namespace });
|
|
1521
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: ScriptPlugin, decorators: [{
|
|
1522
|
-
type: i0.Directive
|
|
1523
|
-
}], ctorParameters: function () { return [{ type: exports.ElementComponent }]; } });
|
|
1524
|
-
|
|
1525
|
-
var DEFAULT_PLUGINS = {
|
|
1526
|
-
CONFIGURATION: [ScriptPlugin, ConfigurationPlugin],
|
|
1527
|
-
DEFAULT: [ScriptPlugin],
|
|
1528
|
-
};
|
|
1529
1742
|
|
|
1530
1743
|
var ElementsResolver = /** @class */ (function () {
|
|
1531
1744
|
function ElementsResolver(uiDef, elements) {
|
|
@@ -1628,6 +1841,7 @@
|
|
|
1628
1841
|
{ provide: ELEMENT_METADATA, useValue: element },
|
|
1629
1842
|
{ provide: SHARED_ELEMENT_METADATA, useValue: this.getSharedElement(sourceElement) },
|
|
1630
1843
|
{ provide: ELEMENT_CONFIG, useValue: config },
|
|
1844
|
+
{ provide: VENDOR_MAP, useValue: vendorMap },
|
|
1631
1845
|
] });
|
|
1632
1846
|
var cmp = i0.Component(component)(/** @class */ (function (_super) {
|
|
1633
1847
|
__extends(C, _super);
|
|
@@ -1646,159 +1860,6 @@
|
|
|
1646
1860
|
return ElementsResolver;
|
|
1647
1861
|
}());
|
|
1648
1862
|
|
|
1649
|
-
var moduleMap = {};
|
|
1650
|
-
function loadRemoteEntry(remoteEntry) {
|
|
1651
|
-
return new Promise(function (resolve, reject) {
|
|
1652
|
-
if (moduleMap[remoteEntry]) {
|
|
1653
|
-
resolve();
|
|
1654
|
-
return;
|
|
1655
|
-
}
|
|
1656
|
-
var script = document.createElement('script');
|
|
1657
|
-
script.src = remoteEntry;
|
|
1658
|
-
script.onerror = reject;
|
|
1659
|
-
script.onload = function () {
|
|
1660
|
-
moduleMap[remoteEntry] = true;
|
|
1661
|
-
resolve(); // window is the global namespace
|
|
1662
|
-
};
|
|
1663
|
-
document.body.append(script);
|
|
1664
|
-
});
|
|
1665
|
-
}
|
|
1666
|
-
function lookupExposedModule(remoteName, exposedModule) {
|
|
1667
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1668
|
-
var container, factory, Module;
|
|
1669
|
-
return __generator(this, function (_a) {
|
|
1670
|
-
switch (_a.label) {
|
|
1671
|
-
case 0:
|
|
1672
|
-
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
|
1673
|
-
return [4 /*yield*/, __webpack_init_sharing__('default')];
|
|
1674
|
-
case 1:
|
|
1675
|
-
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
|
1676
|
-
_a.sent();
|
|
1677
|
-
container = window[remoteName];
|
|
1678
|
-
// Initialize the container, it may provide shared modules
|
|
1679
|
-
return [4 /*yield*/, container.init(__webpack_share_scopes__.default)];
|
|
1680
|
-
case 2:
|
|
1681
|
-
// Initialize the container, it may provide shared modules
|
|
1682
|
-
_a.sent();
|
|
1683
|
-
return [4 /*yield*/, container.get(exposedModule)];
|
|
1684
|
-
case 3:
|
|
1685
|
-
factory = _a.sent();
|
|
1686
|
-
Module = factory();
|
|
1687
|
-
return [2 /*return*/, Module];
|
|
1688
|
-
}
|
|
1689
|
-
});
|
|
1690
|
-
});
|
|
1691
|
-
}
|
|
1692
|
-
function loadRemoteModule(options) {
|
|
1693
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1694
|
-
return __generator(this, function (_a) {
|
|
1695
|
-
switch (_a.label) {
|
|
1696
|
-
case 0: return [4 /*yield*/, loadRemoteEntry(options.remoteEntry)];
|
|
1697
|
-
case 1:
|
|
1698
|
-
_a.sent();
|
|
1699
|
-
return [4 /*yield*/, lookupExposedModule(options.remoteName, options.exposedModule)];
|
|
1700
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
1701
|
-
}
|
|
1702
|
-
});
|
|
1703
|
-
});
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
var IntegrationEvent;
|
|
1707
|
-
(function (IntegrationEvent) {
|
|
1708
|
-
IntegrationEvent["Init"] = "Init";
|
|
1709
|
-
})(IntegrationEvent || (IntegrationEvent = {}));
|
|
1710
|
-
var FederatedComponent = /** @class */ (function () {
|
|
1711
|
-
function FederatedComponent(injector, compiler, appRef, renderer) {
|
|
1712
|
-
this.injector = injector;
|
|
1713
|
-
this.compiler = compiler;
|
|
1714
|
-
this.appRef = appRef;
|
|
1715
|
-
this.renderer = renderer;
|
|
1716
|
-
this.integrationEvent = new i0.EventEmitter();
|
|
1717
|
-
this.moduleReady = false;
|
|
1718
|
-
}
|
|
1719
|
-
FederatedComponent.prototype.ngAfterViewInit = function () {
|
|
1720
|
-
var _this = this;
|
|
1721
|
-
if (!this.remoteEntry || !this.remoteName || !this.exposedModule) {
|
|
1722
|
-
return;
|
|
1723
|
-
}
|
|
1724
|
-
loadRemoteModule({
|
|
1725
|
-
remoteEntry: this.remoteEntry,
|
|
1726
|
-
remoteName: this.remoteName,
|
|
1727
|
-
exposedModule: this.exposedModule,
|
|
1728
|
-
}).then(function (federated) {
|
|
1729
|
-
_this.compiler.compileModuleAsync(federated[_this.exposedModule]).then(function (moduleFactory) {
|
|
1730
|
-
var _a;
|
|
1731
|
-
var rootModuleRef = moduleFactory.create(_this.injector);
|
|
1732
|
-
var rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[_this.exposedModule].rootComponent);
|
|
1733
|
-
var node = document.createElement('div');
|
|
1734
|
-
var _b = rootComponentFactory.create(_this.injector, [], node), instance = _b.instance, hostView = _b.hostView;
|
|
1735
|
-
_this.instance = instance;
|
|
1736
|
-
_this.instance.data = _this.data;
|
|
1737
|
-
_this.instance.eventData = _this.eventData;
|
|
1738
|
-
_this.instance.integrationEvent = _this.integrationEvent;
|
|
1739
|
-
_this.renderer.appendChild((_a = _this.moduleHostRef) === null || _a === void 0 ? void 0 : _a.nativeElement, node);
|
|
1740
|
-
_this.appRef.attachView(hostView);
|
|
1741
|
-
});
|
|
1742
|
-
});
|
|
1743
|
-
};
|
|
1744
|
-
FederatedComponent.prototype.ngOnChanges = function (changes) {
|
|
1745
|
-
if (!this.instance) {
|
|
1746
|
-
return;
|
|
1747
|
-
}
|
|
1748
|
-
this.instance.ngOnChanges(changes);
|
|
1749
|
-
};
|
|
1750
|
-
return FederatedComponent;
|
|
1751
|
-
}());
|
|
1752
|
-
FederatedComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", 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 });
|
|
1753
|
-
FederatedComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", eventData: "eventData" }, outputs: { integrationEvent: "integrationEvent" }, viewQueries: [{ propertyName: "federatedComponent", first: true, predicate: ["federatedComponent"], descendants: true, read: i0.ViewContainerRef }, { propertyName: "foo", first: true, predicate: ["foo"], descendants: true, read: i0.TemplateRef }, { propertyName: "moduleHostRef", first: true, predicate: ["moduleHost"], descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div #moduleHost></div>\n", styles: [":host{display:block}div{height:100%}\n"], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
1754
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FederatedComponent, decorators: [{
|
|
1755
|
-
type: i0.Component,
|
|
1756
|
-
args: [{
|
|
1757
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
1758
|
-
selector: 'veloce-host-federated',
|
|
1759
|
-
templateUrl: './federated.component.html',
|
|
1760
|
-
styleUrls: ['./federated.component.scss'],
|
|
1761
|
-
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
1762
|
-
}]
|
|
1763
|
-
}], ctorParameters: function () { return [{ type: i0__namespace.Injector }, { type: i0__namespace.Compiler }, { type: i0__namespace.ApplicationRef }, { type: i0__namespace.Renderer2 }]; }, propDecorators: { federatedComponent: [{
|
|
1764
|
-
type: i0.ViewChild,
|
|
1765
|
-
args: ['federatedComponent', { read: i0.ViewContainerRef }]
|
|
1766
|
-
}], foo: [{
|
|
1767
|
-
type: i0.ViewChild,
|
|
1768
|
-
args: ['foo', { read: i0.TemplateRef }]
|
|
1769
|
-
}], moduleHostRef: [{
|
|
1770
|
-
type: i0.ViewChild,
|
|
1771
|
-
args: ['moduleHost', { static: false }]
|
|
1772
|
-
}], remoteEntry: [{
|
|
1773
|
-
type: i0.Input
|
|
1774
|
-
}], remoteName: [{
|
|
1775
|
-
type: i0.Input
|
|
1776
|
-
}], exposedModule: [{
|
|
1777
|
-
type: i0.Input
|
|
1778
|
-
}], data: [{
|
|
1779
|
-
type: i0.Input
|
|
1780
|
-
}], eventData: [{
|
|
1781
|
-
type: i0.Input
|
|
1782
|
-
}], integrationEvent: [{
|
|
1783
|
-
type: i0.Output
|
|
1784
|
-
}] } });
|
|
1785
|
-
|
|
1786
|
-
var FederatedModule = /** @class */ (function () {
|
|
1787
|
-
function FederatedModule() {
|
|
1788
|
-
}
|
|
1789
|
-
return FederatedModule;
|
|
1790
|
-
}());
|
|
1791
|
-
FederatedModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FederatedModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
1792
|
-
FederatedModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FederatedModule, declarations: [FederatedComponent], exports: [FederatedComponent] });
|
|
1793
|
-
FederatedModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FederatedModule });
|
|
1794
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: FederatedModule, decorators: [{
|
|
1795
|
-
type: i0.NgModule,
|
|
1796
|
-
args: [{
|
|
1797
|
-
declarations: [FederatedComponent],
|
|
1798
|
-
exports: [FederatedComponent],
|
|
1799
|
-
}]
|
|
1800
|
-
}] });
|
|
1801
|
-
|
|
1802
1863
|
var LauncherService = /** @class */ (function () {
|
|
1803
1864
|
function LauncherService(compiler, dynamicModuleService) {
|
|
1804
1865
|
this.compiler = compiler;
|
|
@@ -2052,6 +2113,7 @@
|
|
|
2052
2113
|
exports.SHARED_ELEMENT_METADATA = SHARED_ELEMENT_METADATA;
|
|
2053
2114
|
exports.TemplatesService = TemplatesService;
|
|
2054
2115
|
exports.UI_DEFINITION_METADATA = UI_DEFINITION_METADATA;
|
|
2116
|
+
exports.VENDOR_MAP = VENDOR_MAP;
|
|
2055
2117
|
exports.doesElementSupportIO = doesElementSupportIO;
|
|
2056
2118
|
exports.elementToMetadata = elementToMetadata;
|
|
2057
2119
|
exports.extendElementMetadata = extendElementMetadata;
|
|
@@ -2066,10 +2128,12 @@
|
|
|
2066
2128
|
exports.insertLineItem = insertLineItem;
|
|
2067
2129
|
exports.mapAttributes = mapAttributes;
|
|
2068
2130
|
exports.metadataToElement = metadataToElement;
|
|
2131
|
+
exports.normalizeElementMetadata = normalizeElementMetadata;
|
|
2069
2132
|
exports.parseBoundPath = parseBoundPath;
|
|
2070
2133
|
exports.patchAttributes = patchAttributes;
|
|
2071
2134
|
exports.removeLineItem = removeLineItem;
|
|
2072
2135
|
exports.replaceLineItem = replaceLineItem;
|
|
2136
|
+
exports.stringifyElementMetadata = stringifyElementMetadata;
|
|
2073
2137
|
exports.upsertAttributes = upsertAttributes;
|
|
2074
2138
|
|
|
2075
2139
|
Object.defineProperty(exports, '__esModule', { value: true });
|