@elliemae/ssf-host 2.0.0-next.39 → 2.0.0-next.41
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/dist/cjs/host.js +32 -45
- package/dist/cjs/tests/scriptingObjects/constant.js +4 -0
- package/dist/esm/host.js +34 -46
- package/dist/esm/tests/scriptingObjects/constant.js +4 -0
- package/dist/public/autoFill.js.map +1 -1
- package/dist/public/index.html +1 -1
- package/dist/public/init.js +1 -1
- package/dist/public/init.js.br +0 -0
- package/dist/public/init.js.gz +0 -0
- package/dist/public/init.js.map +1 -1
- package/dist/public/js/emuiSsfHost.c5817b40dbe7ca11b52d.js +3 -0
- package/dist/public/js/emuiSsfHost.c5817b40dbe7ca11b52d.js.br +0 -0
- package/dist/public/js/emuiSsfHost.c5817b40dbe7ca11b52d.js.gz +0 -0
- package/dist/public/js/emuiSsfHost.c5817b40dbe7ca11b52d.js.map +1 -0
- package/dist/public/loan-object.js +1 -1
- package/dist/public/loan-object.js.br +0 -0
- package/dist/public/loan-object.js.gz +0 -0
- package/dist/public/loan-object.js.map +1 -1
- package/dist/public/utils.js +1 -1
- package/dist/public/utils.js.br +0 -0
- package/dist/public/utils.js.gz +0 -0
- package/dist/public/utils.js.map +1 -1
- package/dist/types/host.d.ts +11 -8
- package/dist/types/ihost.d.ts +10 -4
- package/dist/types/tests/scriptingObjects/constant.d.ts +2 -0
- package/dist/umd/autoFill.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.br +0 -0
- package/dist/umd/index.js.gz +0 -0
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/init.js +1 -1
- package/dist/umd/init.js.br +0 -0
- package/dist/umd/init.js.gz +0 -0
- package/dist/umd/init.js.map +1 -1
- package/dist/umd/loan-object.js +1 -1
- package/dist/umd/loan-object.js.br +0 -0
- package/dist/umd/loan-object.js.gz +0 -0
- package/dist/umd/loan-object.js.map +1 -1
- package/dist/umd/utils.js +1 -1
- package/dist/umd/utils.js.br +0 -0
- package/dist/umd/utils.js.gz +0 -0
- package/dist/umd/utils.js.map +1 -1
- package/package.json +3 -3
- package/dist/public/js/emuiSsfHost.442f50c42583d524d78b.js +0 -3
- package/dist/public/js/emuiSsfHost.442f50c42583d524d78b.js.br +0 -0
- package/dist/public/js/emuiSsfHost.442f50c42583d524d78b.js.gz +0 -0
- package/dist/public/js/emuiSsfHost.442f50c42583d524d78b.js.map +0 -1
package/dist/cjs/host.js
CHANGED
|
@@ -49,7 +49,7 @@ var import_microfe_common = require("@elliemae/microfe-common");
|
|
|
49
49
|
var import_types = require("./types.js");
|
|
50
50
|
var import_guest = require("./guest.js");
|
|
51
51
|
var import_utils = require("./utils.js");
|
|
52
|
-
var _remoting, _correlationId, _logger,
|
|
52
|
+
var _remoting, _correlationId, _logger, _guests, _soManager, _readyStateCallback, _popupGuestMonitor, _closeAllPopupGuests, _getGuestForWindow, _getGuestForUrl, _isScriptingObject, _encodeResponse, _encodeException, _dispatchConfigEvent, _invoke, _handleGuestReadyComplete, _handleGuestReady, _handleGuestClose, _handleObjectGet, _handleGuestResize, _handleObjectInvoke, _subscribeToGuestResizeEvent, _connect, _isProxyEvent, _attachGuest, _monitorPopupGuests, _openPopupGuest, _openEmbedGuest, _getGuestUrl;
|
|
53
53
|
const SANDBOX_DEFAULT = [
|
|
54
54
|
import_types.IFrameSandboxValues.AllowScripts,
|
|
55
55
|
import_types.IFrameSandboxValues.AllowPopups,
|
|
@@ -80,18 +80,14 @@ class SSFHost {
|
|
|
80
80
|
* reference to the logger
|
|
81
81
|
*/
|
|
82
82
|
__privateAdd(this, _logger, void 0);
|
|
83
|
-
/**
|
|
84
|
-
* next guest id
|
|
85
|
-
*/
|
|
86
|
-
__privateAdd(this, _nextGuestId, 1);
|
|
87
83
|
/**
|
|
88
84
|
* list of guests
|
|
89
85
|
*/
|
|
90
86
|
__privateAdd(this, _guests, /* @__PURE__ */ new Map());
|
|
91
87
|
/**
|
|
92
|
-
*
|
|
88
|
+
* scripting object manager
|
|
93
89
|
*/
|
|
94
|
-
__privateAdd(this,
|
|
90
|
+
__privateAdd(this, _soManager, void 0);
|
|
95
91
|
/**
|
|
96
92
|
* callback for ready state
|
|
97
93
|
*/
|
|
@@ -145,7 +141,6 @@ class SSFHost {
|
|
|
145
141
|
));
|
|
146
142
|
__privateAdd(this, _encodeResponse, (val) => {
|
|
147
143
|
if (__privateGet(this, _isScriptingObject).call(this, val)) {
|
|
148
|
-
this.addScriptingObject(val);
|
|
149
144
|
return { type: "object", object: val._toJSON() };
|
|
150
145
|
}
|
|
151
146
|
return { type: "value", value: val };
|
|
@@ -580,20 +575,13 @@ class SSFHost {
|
|
|
580
575
|
return url + (!querystring ? "" : (url.indexOf("?") >= 0 ? "&" : "?") + querystring);
|
|
581
576
|
});
|
|
582
577
|
/**
|
|
583
|
-
*
|
|
578
|
+
* registers scripting object to the host
|
|
584
579
|
*
|
|
585
|
-
* @param so scripting object
|
|
586
|
-
* @
|
|
580
|
+
* @param {ValueOf<AppObjects>} so scripting object to be registered
|
|
581
|
+
* @param {AddScriptingObjectParams} params params to add scripting object
|
|
587
582
|
*/
|
|
588
|
-
__publicField(this, "addScriptingObject", (so) => {
|
|
589
|
-
|
|
590
|
-
throw new Error("Object is not derived from ScriptingObject");
|
|
591
|
-
}
|
|
592
|
-
if (so.id.toLowerCase() === "module")
|
|
593
|
-
throw new Error(
|
|
594
|
-
"Do not publish the module object. Create a concrete object derived from it."
|
|
595
|
-
);
|
|
596
|
-
__privateGet(this, _publishedObjects).set(so.id, so);
|
|
583
|
+
__publicField(this, "addScriptingObject", (so, params) => {
|
|
584
|
+
__privateGet(this, _soManager).addScriptingObject(so, params);
|
|
597
585
|
});
|
|
598
586
|
/**
|
|
599
587
|
* Clone parent host's scripting object for exposing to grand children
|
|
@@ -766,13 +754,10 @@ class SSFHost {
|
|
|
766
754
|
* get the scripting object by id
|
|
767
755
|
*
|
|
768
756
|
* @param objectId - id of the scripting object
|
|
757
|
+
* @param params
|
|
769
758
|
* @returns scripting object
|
|
770
759
|
*/
|
|
771
|
-
__publicField(this, "getScriptingObject", (objectId) =>
|
|
772
|
-
if (!__privateGet(this, _publishedObjects).has(objectId))
|
|
773
|
-
return null;
|
|
774
|
-
return __privateGet(this, _publishedObjects).get(objectId);
|
|
775
|
-
});
|
|
760
|
+
__publicField(this, "getScriptingObject", (objectId) => __privateGet(this, _soManager).getObject(objectId));
|
|
776
761
|
/**
|
|
777
762
|
* loads guest application inside sandboxed iframe
|
|
778
763
|
*
|
|
@@ -781,15 +766,16 @@ class SSFHost {
|
|
|
781
766
|
*/
|
|
782
767
|
__publicField(this, "loadGuest", (param) => {
|
|
783
768
|
const {
|
|
769
|
+
id: guestId,
|
|
784
770
|
url,
|
|
785
771
|
targetElement,
|
|
786
772
|
title,
|
|
787
773
|
searchParams = {},
|
|
788
774
|
options = {}
|
|
789
775
|
} = param;
|
|
776
|
+
if (!guestId)
|
|
777
|
+
throw new Error("id for guest application is required");
|
|
790
778
|
const { openMode = import_types.OpenMode.Embed, popupWindowFeatures = {} } = options;
|
|
791
|
-
const guestId = `guest-${this.hostId}-sandbox-${__privateGet(this, _nextGuestId)}`;
|
|
792
|
-
__privateSet(this, _nextGuestId, __privateGet(this, _nextGuestId) + 1);
|
|
793
779
|
const srcUrl = __privateGet(this, _getGuestUrl).call(this, url, searchParams);
|
|
794
780
|
let guest = null;
|
|
795
781
|
if (openMode === import_types.OpenMode.Popup) {
|
|
@@ -825,39 +811,40 @@ class SSFHost {
|
|
|
825
811
|
*/
|
|
826
812
|
__publicField(this, "loadGuests", (param) => {
|
|
827
813
|
const {
|
|
814
|
+
id,
|
|
828
815
|
url,
|
|
829
816
|
targetElement,
|
|
830
817
|
title,
|
|
831
818
|
searchParamsList = [],
|
|
832
819
|
options = {}
|
|
833
820
|
} = param;
|
|
834
|
-
searchParamsList.forEach((searchParams) => {
|
|
835
|
-
this.loadGuest({
|
|
821
|
+
searchParamsList.forEach((searchParams, index) => {
|
|
822
|
+
this.loadGuest({
|
|
823
|
+
id: `${id}-${index}`,
|
|
824
|
+
url,
|
|
825
|
+
title,
|
|
826
|
+
targetElement,
|
|
827
|
+
searchParams,
|
|
828
|
+
options
|
|
829
|
+
});
|
|
836
830
|
}, this);
|
|
837
831
|
});
|
|
838
832
|
/**
|
|
839
833
|
* removes all scripting objects from host
|
|
840
834
|
*
|
|
835
|
+
* @param guestId unique id of the guest application
|
|
841
836
|
*/
|
|
842
|
-
__publicField(this, "removeAllScriptingObjects", () => {
|
|
843
|
-
|
|
844
|
-
objectIds.forEach((objectId) => {
|
|
845
|
-
this.removeScriptingObject(objectId);
|
|
846
|
-
});
|
|
837
|
+
__publicField(this, "removeAllScriptingObjects", (guestId) => {
|
|
838
|
+
__privateGet(this, _soManager).removeAllScriptingObjects(guestId);
|
|
847
839
|
});
|
|
848
840
|
/**
|
|
849
|
-
* removes scripting object from host
|
|
841
|
+
* removes scripting object from the host
|
|
850
842
|
*
|
|
851
843
|
* @param objectId unique id of the scripting object
|
|
844
|
+
* @param guestId unique id of the guest application
|
|
852
845
|
*/
|
|
853
|
-
__publicField(this, "removeScriptingObject", (objectId) => {
|
|
854
|
-
|
|
855
|
-
if (obj) {
|
|
856
|
-
if (obj._dispose && typeof obj._dispose === "function") {
|
|
857
|
-
obj._dispose();
|
|
858
|
-
}
|
|
859
|
-
__privateGet(this, _publishedObjects).delete(objectId);
|
|
860
|
-
}
|
|
846
|
+
__publicField(this, "removeScriptingObject", (objectId, guestId) => {
|
|
847
|
+
__privateGet(this, _soManager).removeScriptingObject(objectId, guestId);
|
|
861
848
|
});
|
|
862
849
|
/**
|
|
863
850
|
* set the log level for the host application
|
|
@@ -901,6 +888,7 @@ class SSFHost {
|
|
|
901
888
|
if (option?.readyStateCallback && typeof option?.readyStateCallback !== "function")
|
|
902
889
|
throw new Error("readyStateCallback must be a function");
|
|
903
890
|
__privateSet(this, _readyStateCallback, option?.readyStateCallback || null);
|
|
891
|
+
__privateSet(this, _soManager, new import_microfe_common.ScriptingObjectManager());
|
|
904
892
|
__privateGet(this, _remoting).initialize(window);
|
|
905
893
|
__privateGet(this, _connect).call(this);
|
|
906
894
|
__privateGet(this, _monitorPopupGuests).call(this);
|
|
@@ -912,9 +900,8 @@ class SSFHost {
|
|
|
912
900
|
_remoting = new WeakMap();
|
|
913
901
|
_correlationId = new WeakMap();
|
|
914
902
|
_logger = new WeakMap();
|
|
915
|
-
_nextGuestId = new WeakMap();
|
|
916
903
|
_guests = new WeakMap();
|
|
917
|
-
|
|
904
|
+
_soManager = new WeakMap();
|
|
918
905
|
_readyStateCallback = new WeakMap();
|
|
919
906
|
_popupGuestMonitor = new WeakMap();
|
|
920
907
|
_closeAllPopupGuests = new WeakMap();
|
|
@@ -20,11 +20,13 @@ var constant_exports = {};
|
|
|
20
20
|
__export(constant_exports, {
|
|
21
21
|
ABOUT_BLANK: () => ABOUT_BLANK,
|
|
22
22
|
EVENT_OBJECT: () => EVENT_OBJECT,
|
|
23
|
+
LOAN_APP_ID: () => LOAN_APP_ID,
|
|
23
24
|
PRE_COMMIT_EVENT_NAME: () => PRE_COMMIT_EVENT_NAME,
|
|
24
25
|
REMOTING: () => REMOTING,
|
|
25
26
|
REMOTING_EXCEPTION: () => REMOTING_EXCEPTION,
|
|
26
27
|
REMOTING_RESPONSE: () => REMOTING_RESPONSE,
|
|
27
28
|
SAVED_EVENT_NAME: () => SAVED_EVENT_NAME,
|
|
29
|
+
TASK_APP_ID: () => TASK_APP_ID,
|
|
28
30
|
UNLOADING_EVENT_NAME: () => UNLOADING_EVENT_NAME
|
|
29
31
|
});
|
|
30
32
|
module.exports = __toCommonJS(constant_exports);
|
|
@@ -36,3 +38,5 @@ const REMOTING_RESPONSE = "elli:remoting:response";
|
|
|
36
38
|
const REMOTING_EXCEPTION = "elli:remoting:exception";
|
|
37
39
|
const EVENT_OBJECT = "object:event";
|
|
38
40
|
const ABOUT_BLANK = "about:blank";
|
|
41
|
+
const LOAN_APP_ID = "loanApp";
|
|
42
|
+
const TASK_APP_ID = "taskApp";
|
package/dist/esm/host.js
CHANGED
|
@@ -22,13 +22,14 @@ var __privateSet = (obj, member, value, setter) => {
|
|
|
22
22
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
23
23
|
return value;
|
|
24
24
|
};
|
|
25
|
-
var _remoting, _correlationId, _logger,
|
|
25
|
+
var _remoting, _correlationId, _logger, _guests, _soManager, _readyStateCallback, _popupGuestMonitor, _closeAllPopupGuests, _getGuestForWindow, _getGuestForUrl, _isScriptingObject, _encodeResponse, _encodeException, _dispatchConfigEvent, _invoke, _handleGuestReadyComplete, _handleGuestReady, _handleGuestClose, _handleObjectGet, _handleGuestResize, _handleObjectInvoke, _subscribeToGuestResizeEvent, _connect, _isProxyEvent, _attachGuest, _monitorPopupGuests, _openPopupGuest, _openEmbedGuest, _getGuestUrl;
|
|
26
26
|
import { v4 as uuidv4 } from "uuid";
|
|
27
27
|
import {
|
|
28
28
|
Remoting,
|
|
29
29
|
ScriptingObject,
|
|
30
30
|
MessageType,
|
|
31
|
-
Event
|
|
31
|
+
Event,
|
|
32
|
+
ScriptingObjectManager
|
|
32
33
|
} from "@elliemae/microfe-common";
|
|
33
34
|
import {
|
|
34
35
|
IFrameSandboxValues,
|
|
@@ -66,18 +67,14 @@ class SSFHost {
|
|
|
66
67
|
* reference to the logger
|
|
67
68
|
*/
|
|
68
69
|
__privateAdd(this, _logger, void 0);
|
|
69
|
-
/**
|
|
70
|
-
* next guest id
|
|
71
|
-
*/
|
|
72
|
-
__privateAdd(this, _nextGuestId, 1);
|
|
73
70
|
/**
|
|
74
71
|
* list of guests
|
|
75
72
|
*/
|
|
76
73
|
__privateAdd(this, _guests, /* @__PURE__ */ new Map());
|
|
77
74
|
/**
|
|
78
|
-
*
|
|
75
|
+
* scripting object manager
|
|
79
76
|
*/
|
|
80
|
-
__privateAdd(this,
|
|
77
|
+
__privateAdd(this, _soManager, void 0);
|
|
81
78
|
/**
|
|
82
79
|
* callback for ready state
|
|
83
80
|
*/
|
|
@@ -131,7 +128,6 @@ class SSFHost {
|
|
|
131
128
|
));
|
|
132
129
|
__privateAdd(this, _encodeResponse, (val) => {
|
|
133
130
|
if (__privateGet(this, _isScriptingObject).call(this, val)) {
|
|
134
|
-
this.addScriptingObject(val);
|
|
135
131
|
return { type: "object", object: val._toJSON() };
|
|
136
132
|
}
|
|
137
133
|
return { type: "value", value: val };
|
|
@@ -566,20 +562,13 @@ class SSFHost {
|
|
|
566
562
|
return url + (!querystring ? "" : (url.indexOf("?") >= 0 ? "&" : "?") + querystring);
|
|
567
563
|
});
|
|
568
564
|
/**
|
|
569
|
-
*
|
|
565
|
+
* registers scripting object to the host
|
|
570
566
|
*
|
|
571
|
-
* @param so scripting object
|
|
572
|
-
* @
|
|
567
|
+
* @param {ValueOf<AppObjects>} so scripting object to be registered
|
|
568
|
+
* @param {AddScriptingObjectParams} params params to add scripting object
|
|
573
569
|
*/
|
|
574
|
-
__publicField(this, "addScriptingObject", (so) => {
|
|
575
|
-
|
|
576
|
-
throw new Error("Object is not derived from ScriptingObject");
|
|
577
|
-
}
|
|
578
|
-
if (so.id.toLowerCase() === "module")
|
|
579
|
-
throw new Error(
|
|
580
|
-
"Do not publish the module object. Create a concrete object derived from it."
|
|
581
|
-
);
|
|
582
|
-
__privateGet(this, _publishedObjects).set(so.id, so);
|
|
570
|
+
__publicField(this, "addScriptingObject", (so, params) => {
|
|
571
|
+
__privateGet(this, _soManager).addScriptingObject(so, params);
|
|
583
572
|
});
|
|
584
573
|
/**
|
|
585
574
|
* Clone parent host's scripting object for exposing to grand children
|
|
@@ -752,13 +741,10 @@ class SSFHost {
|
|
|
752
741
|
* get the scripting object by id
|
|
753
742
|
*
|
|
754
743
|
* @param objectId - id of the scripting object
|
|
744
|
+
* @param params
|
|
755
745
|
* @returns scripting object
|
|
756
746
|
*/
|
|
757
|
-
__publicField(this, "getScriptingObject", (objectId) =>
|
|
758
|
-
if (!__privateGet(this, _publishedObjects).has(objectId))
|
|
759
|
-
return null;
|
|
760
|
-
return __privateGet(this, _publishedObjects).get(objectId);
|
|
761
|
-
});
|
|
747
|
+
__publicField(this, "getScriptingObject", (objectId) => __privateGet(this, _soManager).getObject(objectId));
|
|
762
748
|
/**
|
|
763
749
|
* loads guest application inside sandboxed iframe
|
|
764
750
|
*
|
|
@@ -767,15 +753,16 @@ class SSFHost {
|
|
|
767
753
|
*/
|
|
768
754
|
__publicField(this, "loadGuest", (param) => {
|
|
769
755
|
const {
|
|
756
|
+
id: guestId,
|
|
770
757
|
url,
|
|
771
758
|
targetElement,
|
|
772
759
|
title,
|
|
773
760
|
searchParams = {},
|
|
774
761
|
options = {}
|
|
775
762
|
} = param;
|
|
763
|
+
if (!guestId)
|
|
764
|
+
throw new Error("id for guest application is required");
|
|
776
765
|
const { openMode = OpenMode.Embed, popupWindowFeatures = {} } = options;
|
|
777
|
-
const guestId = `guest-${this.hostId}-sandbox-${__privateGet(this, _nextGuestId)}`;
|
|
778
|
-
__privateSet(this, _nextGuestId, __privateGet(this, _nextGuestId) + 1);
|
|
779
766
|
const srcUrl = __privateGet(this, _getGuestUrl).call(this, url, searchParams);
|
|
780
767
|
let guest = null;
|
|
781
768
|
if (openMode === OpenMode.Popup) {
|
|
@@ -811,39 +798,40 @@ class SSFHost {
|
|
|
811
798
|
*/
|
|
812
799
|
__publicField(this, "loadGuests", (param) => {
|
|
813
800
|
const {
|
|
801
|
+
id,
|
|
814
802
|
url,
|
|
815
803
|
targetElement,
|
|
816
804
|
title,
|
|
817
805
|
searchParamsList = [],
|
|
818
806
|
options = {}
|
|
819
807
|
} = param;
|
|
820
|
-
searchParamsList.forEach((searchParams) => {
|
|
821
|
-
this.loadGuest({
|
|
808
|
+
searchParamsList.forEach((searchParams, index) => {
|
|
809
|
+
this.loadGuest({
|
|
810
|
+
id: `${id}-${index}`,
|
|
811
|
+
url,
|
|
812
|
+
title,
|
|
813
|
+
targetElement,
|
|
814
|
+
searchParams,
|
|
815
|
+
options
|
|
816
|
+
});
|
|
822
817
|
}, this);
|
|
823
818
|
});
|
|
824
819
|
/**
|
|
825
820
|
* removes all scripting objects from host
|
|
826
821
|
*
|
|
822
|
+
* @param guestId unique id of the guest application
|
|
827
823
|
*/
|
|
828
|
-
__publicField(this, "removeAllScriptingObjects", () => {
|
|
829
|
-
|
|
830
|
-
objectIds.forEach((objectId) => {
|
|
831
|
-
this.removeScriptingObject(objectId);
|
|
832
|
-
});
|
|
824
|
+
__publicField(this, "removeAllScriptingObjects", (guestId) => {
|
|
825
|
+
__privateGet(this, _soManager).removeAllScriptingObjects(guestId);
|
|
833
826
|
});
|
|
834
827
|
/**
|
|
835
|
-
* removes scripting object from host
|
|
828
|
+
* removes scripting object from the host
|
|
836
829
|
*
|
|
837
830
|
* @param objectId unique id of the scripting object
|
|
831
|
+
* @param guestId unique id of the guest application
|
|
838
832
|
*/
|
|
839
|
-
__publicField(this, "removeScriptingObject", (objectId) => {
|
|
840
|
-
|
|
841
|
-
if (obj) {
|
|
842
|
-
if (obj._dispose && typeof obj._dispose === "function") {
|
|
843
|
-
obj._dispose();
|
|
844
|
-
}
|
|
845
|
-
__privateGet(this, _publishedObjects).delete(objectId);
|
|
846
|
-
}
|
|
833
|
+
__publicField(this, "removeScriptingObject", (objectId, guestId) => {
|
|
834
|
+
__privateGet(this, _soManager).removeScriptingObject(objectId, guestId);
|
|
847
835
|
});
|
|
848
836
|
/**
|
|
849
837
|
* set the log level for the host application
|
|
@@ -887,6 +875,7 @@ class SSFHost {
|
|
|
887
875
|
if (option?.readyStateCallback && typeof option?.readyStateCallback !== "function")
|
|
888
876
|
throw new Error("readyStateCallback must be a function");
|
|
889
877
|
__privateSet(this, _readyStateCallback, option?.readyStateCallback || null);
|
|
878
|
+
__privateSet(this, _soManager, new ScriptingObjectManager());
|
|
890
879
|
__privateGet(this, _remoting).initialize(window);
|
|
891
880
|
__privateGet(this, _connect).call(this);
|
|
892
881
|
__privateGet(this, _monitorPopupGuests).call(this);
|
|
@@ -898,9 +887,8 @@ class SSFHost {
|
|
|
898
887
|
_remoting = new WeakMap();
|
|
899
888
|
_correlationId = new WeakMap();
|
|
900
889
|
_logger = new WeakMap();
|
|
901
|
-
_nextGuestId = new WeakMap();
|
|
902
890
|
_guests = new WeakMap();
|
|
903
|
-
|
|
891
|
+
_soManager = new WeakMap();
|
|
904
892
|
_readyStateCallback = new WeakMap();
|
|
905
893
|
_popupGuestMonitor = new WeakMap();
|
|
906
894
|
_closeAllPopupGuests = new WeakMap();
|
|
@@ -6,13 +6,17 @@ const REMOTING_RESPONSE = "elli:remoting:response";
|
|
|
6
6
|
const REMOTING_EXCEPTION = "elli:remoting:exception";
|
|
7
7
|
const EVENT_OBJECT = "object:event";
|
|
8
8
|
const ABOUT_BLANK = "about:blank";
|
|
9
|
+
const LOAN_APP_ID = "loanApp";
|
|
10
|
+
const TASK_APP_ID = "taskApp";
|
|
9
11
|
export {
|
|
10
12
|
ABOUT_BLANK,
|
|
11
13
|
EVENT_OBJECT,
|
|
14
|
+
LOAN_APP_ID,
|
|
12
15
|
PRE_COMMIT_EVENT_NAME,
|
|
13
16
|
REMOTING,
|
|
14
17
|
REMOTING_EXCEPTION,
|
|
15
18
|
REMOTING_RESPONSE,
|
|
16
19
|
SAVED_EVENT_NAME,
|
|
20
|
+
TASK_APP_ID,
|
|
17
21
|
UNLOADING_EVENT_NAME
|
|
18
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://ice/autoFill.js"],"sourcesContent":["import { faker } from 'https://cdn.skypack.dev/@faker-js/faker';\n\nexport const getBorrowerDetails = () => {\n const firstName = faker.name.firstName();\n const lastName = faker.name.lastName();\n const email = faker.internet.email();\n const phone = faker.phone.phoneNumber();\n const address = faker.address.streetAddress();\n const city = faker.address.city();\n const state = faker.address.state();\n const zip = faker.address.zipCode();\n return {\n firstName,\n lastName,\n email,\n phone,\n address,\n city,\n state,\n zip,\n };\n};"],"mappings":"AAAA,OAAS,SAAAA,MAAa,0CAEf,aAAM,mBAAqB,IAAM,CACtC,MAAMC,EAAYD,EAAM,KAAK,UAAU,EACjCE,EAAWF,EAAM,KAAK,SAAS,EAC/BG,EAAQH,EAAM,SAAS,MAAM,EAC7BI,EAAQJ,EAAM,MAAM,YAAY,EAChCK,EAAUL,EAAM,QAAQ,cAAc,EACtCM,EAAON,EAAM,QAAQ,KAAK,EAC1BO,EAAQP,EAAM,QAAQ,MAAM,EAC5BQ,EAAMR,EAAM,QAAQ,QAAQ,EAClC,MAAO,CACL,UAAAC,EACA,SAAAC,EACA,MAAAC,EACA,MAAAC,EACA,QAAAC,EACA,KAAAC,EACA,MAAAC,EACA,IAAAC,CACF,CACF","names":["faker","firstName","lastName","email","phone","address","city","state","zip"],"sourceRoot":"","file":"autoFill.js"}
|
|
1
|
+
{"version":3,"sources":["webpack://ice.host/autoFill.js"],"sourcesContent":["import { faker } from 'https://cdn.skypack.dev/@faker-js/faker';\n\nexport const getBorrowerDetails = () => {\n const firstName = faker.name.firstName();\n const lastName = faker.name.lastName();\n const email = faker.internet.email();\n const phone = faker.phone.phoneNumber();\n const address = faker.address.streetAddress();\n const city = faker.address.city();\n const state = faker.address.state();\n const zip = faker.address.zipCode();\n return {\n firstName,\n lastName,\n email,\n phone,\n address,\n city,\n state,\n zip,\n };\n};"],"mappings":"AAAA,OAAS,SAAAA,MAAa,0CAEf,aAAM,mBAAqB,IAAM,CACtC,MAAMC,EAAYD,EAAM,KAAK,UAAU,EACjCE,EAAWF,EAAM,KAAK,SAAS,EAC/BG,EAAQH,EAAM,SAAS,MAAM,EAC7BI,EAAQJ,EAAM,MAAM,YAAY,EAChCK,EAAUL,EAAM,QAAQ,cAAc,EACtCM,EAAON,EAAM,QAAQ,KAAK,EAC1BO,EAAQP,EAAM,QAAQ,MAAM,EAC5BQ,EAAMR,EAAM,QAAQ,QAAQ,EAClC,MAAO,CACL,UAAAC,EACA,SAAAC,EACA,MAAAC,EACA,MAAAC,EACA,QAAAC,EACA,KAAAC,EACA,MAAAC,EACA,IAAAC,CACF,CACF","names":["faker","firstName","lastName","email","phone","address","city","state","zip"],"sourceRoot":"","file":"autoFill.js"}
|
package/dist/public/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>Host</title><script src="https://cdn.tailwindcss.com?plugins=forms"></script><script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script><script defer="defer" src="js/emuiSsfHost.c5817b40dbe7ca11b52d.js"></script></head><body><header class="bg-indigo-300 h-10 flex place-items-center"><div class="px-2">ICE Mortgage Product</div></header><main class="mx-auto max-w-7xl px-2 sm:px-6 lg:px-8"><div class="min-w-0 flex-1 mt-4"><h1 class="text-2xl font-bold leading-7 text-gray-900 sm:truncate sm:text-3xl sm:tracking-tight">Loan Application</h1></div><div id="successFeedback" class="hidden rounded-md bg-green-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"/></svg></div><div class="ml-3"><p class="text-sm font-medium text-green-800">Loan Saved Successfully</p></div></div></div><div id="errorFeedback" class="hidden rounded-md bg-red-50 p-4"><div class="flex"><div class="flex-shrink-0"><svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd"/></svg></div><div class="ml-3"><h3 class="text-sm font-medium text-red-800">Credit Score is not meeting the requirement</h3></div></div></div><div class="mt-2 sm:grid sm:grid-cols-2 sm:gap-2"><form class="px-2 py-2 space-y-8 divide-y divide-gray-200 bg-gray-50"><div class="space-y-8 divide-y divide-gray-200 sm:space-y-5"><div class="space-y-6 sm:space-y-5"><div><h3 class="text-lg font-medium leading-6 text-gray-900">Personal Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="firstName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">First name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="firstName" id="firstName" autocomplete="given-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="John" placeholder="John"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="lastName" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Last name</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input name="lastName" id="lastName" autocomplete="family-name" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="Doe" placeholder="Doe"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="ssn" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">SSN</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="ssn" id="ssn" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="123456789" placeholder="123456789"/></div></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Loan Information</h3></div><div class="space-y-6 sm:space-y-5"><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="amount" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Amount</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="amount" id="amount" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="500000" placeholder="500000"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="Term" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Term (years)</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="term" id="term" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="30" placeholder="30"/></div></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><label for="downPayment" class="block text-sm font-medium text-gray-700 sm:mt-px sm:pt-2">Down Payment</label><div class="mt-1 sm:col-span-2 sm:mt-0"><input type="number" name="downPayment" id="downPayment" class="block w-full max-w-lg rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:max-w-xs sm:text-sm" value="50000" placeholder="50000"/></div></div><div><h3 class="text-lg font-medium leading-6 text-gray-900">Order Services</h3></div><div class="sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-gray-200"><div class="mt-1 sm:mt-0"><button id="title" type="button" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M7.502 6h7.128A3.375 3.375 0 0118 9.375v9.375a3 3 0 003-3V6.108c0-1.505-1.125-2.811-2.664-2.94a48.972 48.972 0 00-.673-.05A3 3 0 0015 1.5h-1.5a3 3 0 00-2.663 1.618c-.225.015-.45.032-.673.05C8.662 3.295 7.554 4.542 7.502 6zM13.5 3A1.5 1.5 0 0012 4.5h4.5A1.5 1.5 0 0015 3h-1.5z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M3 9.375C3 8.339 3.84 7.5 4.875 7.5h9.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-9.75A1.875 1.875 0 013 20.625V9.375zM6 12a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V12zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 15a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V15zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75zM6 18a.75.75 0 01.75-.75h.008a.75.75 0 01.75.75v.008a.75.75 0 01-.75.75H6.75a.75.75 0 01-.75-.75V18zm2.25 0a.75.75 0 01.75-.75h3.75a.75.75 0 010 1.5H9a.75.75 0 01-.75-.75z" clip-rule="evenodd"/></svg> Title</button></div><div class="mt-1 sm:mt-0"><button id="credit" type="button" class="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 disabled:opacity-50 disabled:cursor-not-allowed focus:ring-offset-2"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"><path fill-rule="evenodd" d="M2.25 13.5a8.25 8.25 0 018.25-8.25.75.75 0 01.75.75v6.75H18a.75.75 0 01.75.75 8.25 8.25 0 01-16.5 0z" clip-rule="evenodd"/><path fill-rule="evenodd" d="M12.75 3a.75.75 0 01.75-.75 8.25 8.25 0 018.25 8.25.75.75 0 01-.75.75h-7.5a.75.75 0 01-.75-.75V3z" clip-rule="evenodd"/></svg> Credit Score</button></div></div></div></div></div><div class="flex flex-col"><button id="saveLoan" type="button" class="rounded-md border border-transparent bg-indigo-600 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2">Save</button></div></form><div id="aside-container" class="flex flex-col gap-4 items-start mt-4 border-2 p-2 rounded-lg border-dashed border-cyan-300 sm:mt-0"></div></div><div id="bottom-container" class="flex flex-col gap-4 items-start mt-4 p-2 sm:mt-0"></div></main><script src="./init.js" type="module"></script></body></html>
|
package/dist/public/init.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{Loan as c}from"./loan-object.js";import{getGuestBaseUrl as o,getHost as
|
|
1
|
+
import{Loan as c}from"./loan-object.js";import{getGuestBaseUrl as o,getHost as a}from"./utils.js";let n=null,i=null;const r=async()=>{const e=await o();document.getElementById("credit").addEventListener("click",()=>{const{id:t}=n.loadGuest({id:"creditService",url:new URL("./creditService.html",e).href,title:"Credit Service Corp",searchParams:{src:new URL("./creditScoreService.js",e).href},targetElement:document.getElementById("bottom-container"),options:{fitToContent:!0}})})},d=async()=>{const e=await o(),t={};n.loadGuest({id:"pricingService",url:new URL("./pricingService.html",e).href,title:"Pricing Service Corp",params:t,targetElement:document.getElementById("aside-container"),options:{fitToContent:!0}})},l=async()=>{const e=await o(),t={};n.loadGuest({id:"loanValidation",url:new URL("./loanValidation.html",e).href,title:"Loan Validation Service Corp",params:t,targetElement:document.getElementById("bottom-container"),options:{fitToContent:!0}})},m=async()=>{const e=await o(),t={};n.loadGuest({id:"titleService",url:new URL("./titleService.html",e).href,title:"Title Service Corp",params:t,targetElement:document.getElementById("aside-container"),options:{openMode:ice.host.OpenMode.Popup}})},u=()=>{i=new c,n.addScriptingObject(i)},v=async()=>{const e=i.getLoanDetails();(await n.dispatchEvent({event:i.onPreSave,eventParams:e,eventOptions:{timeout:1e3}})).some(s=>s===!1)?document.getElementById("errorFeedback").classList.remove("hidden"):document.getElementById("successFeedback").classList.remove("hidden")},p=()=>{n=a(),u();const e=document.getElementById("saveLoan");e&&e.addEventListener("click",v),r(),d(),l(),document.getElementById("title")?.addEventListener?.("click",m)};window.addEventListener("DOMContentLoaded",p);
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=init.js.map
|
package/dist/public/init.js.br
CHANGED
|
Binary file
|
package/dist/public/init.js.gz
CHANGED
|
Binary file
|
package/dist/public/init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://ice/init.js"],"sourcesContent":["import { Loan } from './loan-object.js';\nimport { getGuestBaseUrl, getHost } from './utils.js';\n\nlet host = null;\nlet loanObj = null;\n\nconst setupCreditService = async () => {\n const baseUrl = await getGuestBaseUrl();\n document.getElementById('credit').addEventListener('click', () => {\n const { id } = host.loadGuest({\n url: new URL('./creditService.html', baseUrl).href,\n title: 'Credit Service Corp',\n searchParams: { src: new URL('./creditScoreService.js', baseUrl).href },\n targetElement: document.getElementById('bottom-container'),\n options: { fitToContent: true },\n });\n });\n};\n\nconst setupPricingService = async () => {\n const baseUrl = await getGuestBaseUrl();\n const params = {};\n host.loadGuest({\n url: new URL('./pricingService.html', baseUrl).href,\n title: 'Pricing Service Corp',\n params,\n targetElement: document.getElementById('aside-container'),\n options: { fitToContent: true },\n });\n};\n\nconst setupLoanValidationService = async () => {\n const baseUrl = await getGuestBaseUrl();\n const params = {};\n host.loadGuest({\n url: new URL('./loanValidation.html', baseUrl).href,\n title: 'Loan Validation Service Corp',\n params,\n targetElement: document.getElementById('bottom-container'),\n options: { fitToContent: true },\n });\n};\n\nconst setupTitleService = async () => {\n const baseUrl = await getGuestBaseUrl();\n const params = {};\n host.loadGuest({\n url: new URL('./titleService.html', baseUrl).href,\n title: 'Title Service Corp',\n params,\n targetElement: document.getElementById('aside-container'),\n options: { openMode: ice.OpenMode.Popup },\n });\n};\n\nconst setupLoanObject = () => {\n loanObj = new Loan();\n host.addScriptingObject(loanObj);\n};\n\nconst saveLoan = async () => {\n const loanDetails = loanObj.getLoanDetails();\n const results = await host.dispatchEvent({\n event: loanObj.onPreSave,\n eventParams: loanDetails,\n eventOptions: {\n timeout: 1000,\n },\n });\n if (results.some((result) => result === false)) {\n const errorFeedback = document.getElementById('errorFeedback');\n errorFeedback.classList.remove('hidden');\n } else {\n const successFeedback = document.getElementById('successFeedback');\n successFeedback.classList.remove('hidden');\n }\n};\n\nconst init = () => {\n // elli.ssf.setLogLevel(0);\n host = getHost();\n setupLoanObject();\n const saveLoanButton = document.getElementById('saveLoan');\n if (saveLoanButton) saveLoanButton.addEventListener('click', saveLoan);\n setupCreditService();\n setupPricingService();\n setupLoanValidationService();\n document\n .getElementById('title')\n ?.addEventListener?.('click', setupTitleService);\n};\n\nwindow.addEventListener('DOMContentLoaded', init);\n"],"mappings":"AAAA,OAAS,QAAAA,MAAY,mBACrB,OAAS,mBAAAC,EAAiB,WAAAC,MAAe,aAEzC,IAAIC,EAAO,KACPC,EAAU,KAEd,MAAMC,EAAqB,SAAY,CACrC,MAAMC,EAAU,MAAML,EAAgB,EACtC,SAAS,eAAe,QAAQ,EAAE,iBAAiB,QAAS,IAAM,CAChE,KAAM,CAAE,GAAAM,CAAG,EAAIJ,EAAK,UAAU,CAC5B,IAAK,IAAI,IAAI,uBAAwBG,CAAO,EAAE,KAC9C,MAAO,sBACP,aAAc,CAAE,IAAK,IAAI,IAAI,0BAA2BA,CAAO,EAAE,IAAK,EACtE,cAAe,SAAS,eAAe,kBAAkB,EACzD,QAAS,CAAE,aAAc,EAAK,CAChC,CAAC,CACH,CAAC,CACH,EAEME,EAAsB,SAAY,CACtC,MAAMF,EAAU,MAAML,EAAgB,EAChCQ,EAAS,CAAC,EAChBN,EAAK,UAAU,CACb,IAAK,IAAI,IAAI,wBAAyBG,CAAO,EAAE,KAC/C,MAAO,uBACP,OAAAG,EACA,cAAe,SAAS,eAAe,iBAAiB,EACxD,QAAS,CAAE,aAAc,EAAK,CAChC,CAAC,CACH,EAEMC,EAA6B,SAAY,CAC7C,MAAMJ,EAAU,MAAML,EAAgB,EAChCQ,EAAS,CAAC,EAChBN,EAAK,UAAU,CACb,IAAK,IAAI,IAAI,wBAAyBG,CAAO,EAAE,KAC/C,MAAO,+BACP,OAAAG,EACA,cAAe,SAAS,eAAe,kBAAkB,EACzD,QAAS,CAAE,aAAc,EAAK,CAChC,CAAC,CACH,EAEME,EAAoB,SAAY,CACpC,MAAML,EAAU,MAAML,EAAgB,EAChCQ,EAAS,CAAC,EAChBN,EAAK,UAAU,CACb,IAAK,IAAI,IAAI,sBAAuBG,CAAO,EAAE,KAC7C,MAAO,qBACP,OAAAG,EACA,cAAe,SAAS,eAAe,iBAAiB,EACxD,QAAS,CAAE,SAAU,IAAI,SAAS,KAAM,
|
|
1
|
+
{"version":3,"sources":["webpack://ice.host/init.js"],"sourcesContent":["import { Loan } from './loan-object.js';\nimport { getGuestBaseUrl, getHost } from './utils.js';\n\nlet host = null;\nlet loanObj = null;\n\nconst setupCreditService = async () => {\n const baseUrl = await getGuestBaseUrl();\n document.getElementById('credit').addEventListener('click', () => {\n const { id } = host.loadGuest({\n id: 'creditService',\n url: new URL('./creditService.html', baseUrl).href,\n title: 'Credit Service Corp',\n searchParams: { src: new URL('./creditScoreService.js', baseUrl).href },\n targetElement: document.getElementById('bottom-container'),\n options: { fitToContent: true },\n });\n });\n};\n\nconst setupPricingService = async () => {\n const baseUrl = await getGuestBaseUrl();\n const params = {};\n host.loadGuest({\n id: 'pricingService',\n url: new URL('./pricingService.html', baseUrl).href,\n title: 'Pricing Service Corp',\n params,\n targetElement: document.getElementById('aside-container'),\n options: { fitToContent: true },\n });\n};\n\nconst setupLoanValidationService = async () => {\n const baseUrl = await getGuestBaseUrl();\n const params = {};\n host.loadGuest({\n id: 'loanValidation',\n url: new URL('./loanValidation.html', baseUrl).href,\n title: 'Loan Validation Service Corp',\n params,\n targetElement: document.getElementById('bottom-container'),\n options: { fitToContent: true },\n });\n};\n\nconst setupTitleService = async () => {\n const baseUrl = await getGuestBaseUrl();\n const params = {};\n host.loadGuest({\n id: 'titleService',\n url: new URL('./titleService.html', baseUrl).href,\n title: 'Title Service Corp',\n params,\n targetElement: document.getElementById('aside-container'),\n options: { openMode: ice.host.OpenMode.Popup },\n });\n};\n\nconst setupLoanObject = () => {\n loanObj = new Loan();\n host.addScriptingObject(loanObj);\n};\n\nconst saveLoan = async () => {\n const loanDetails = loanObj.getLoanDetails();\n const results = await host.dispatchEvent({\n event: loanObj.onPreSave,\n eventParams: loanDetails,\n eventOptions: {\n timeout: 1000,\n },\n });\n if (results.some((result) => result === false)) {\n const errorFeedback = document.getElementById('errorFeedback');\n errorFeedback.classList.remove('hidden');\n } else {\n const successFeedback = document.getElementById('successFeedback');\n successFeedback.classList.remove('hidden');\n }\n};\n\nconst init = () => {\n // elli.ssf.setLogLevel(0);\n host = getHost();\n setupLoanObject();\n const saveLoanButton = document.getElementById('saveLoan');\n if (saveLoanButton) saveLoanButton.addEventListener('click', saveLoan);\n setupCreditService();\n setupPricingService();\n setupLoanValidationService();\n document\n .getElementById('title')\n ?.addEventListener?.('click', setupTitleService);\n};\n\nwindow.addEventListener('DOMContentLoaded', init);\n"],"mappings":"AAAA,OAAS,QAAAA,MAAY,mBACrB,OAAS,mBAAAC,EAAiB,WAAAC,MAAe,aAEzC,IAAIC,EAAO,KACPC,EAAU,KAEd,MAAMC,EAAqB,SAAY,CACrC,MAAMC,EAAU,MAAML,EAAgB,EACtC,SAAS,eAAe,QAAQ,EAAE,iBAAiB,QAAS,IAAM,CAChE,KAAM,CAAE,GAAAM,CAAG,EAAIJ,EAAK,UAAU,CAC5B,GAAI,gBACJ,IAAK,IAAI,IAAI,uBAAwBG,CAAO,EAAE,KAC9C,MAAO,sBACP,aAAc,CAAE,IAAK,IAAI,IAAI,0BAA2BA,CAAO,EAAE,IAAK,EACtE,cAAe,SAAS,eAAe,kBAAkB,EACzD,QAAS,CAAE,aAAc,EAAK,CAChC,CAAC,CACH,CAAC,CACH,EAEME,EAAsB,SAAY,CACtC,MAAMF,EAAU,MAAML,EAAgB,EAChCQ,EAAS,CAAC,EAChBN,EAAK,UAAU,CACb,GAAI,iBACJ,IAAK,IAAI,IAAI,wBAAyBG,CAAO,EAAE,KAC/C,MAAO,uBACP,OAAAG,EACA,cAAe,SAAS,eAAe,iBAAiB,EACxD,QAAS,CAAE,aAAc,EAAK,CAChC,CAAC,CACH,EAEMC,EAA6B,SAAY,CAC7C,MAAMJ,EAAU,MAAML,EAAgB,EAChCQ,EAAS,CAAC,EAChBN,EAAK,UAAU,CACb,GAAI,iBACJ,IAAK,IAAI,IAAI,wBAAyBG,CAAO,EAAE,KAC/C,MAAO,+BACP,OAAAG,EACA,cAAe,SAAS,eAAe,kBAAkB,EACzD,QAAS,CAAE,aAAc,EAAK,CAChC,CAAC,CACH,EAEME,EAAoB,SAAY,CACpC,MAAML,EAAU,MAAML,EAAgB,EAChCQ,EAAS,CAAC,EAChBN,EAAK,UAAU,CACb,GAAI,eACJ,IAAK,IAAI,IAAI,sBAAuBG,CAAO,EAAE,KAC7C,MAAO,qBACP,OAAAG,EACA,cAAe,SAAS,eAAe,iBAAiB,EACxD,QAAS,CAAE,SAAU,IAAI,KAAK,SAAS,KAAM,CAC/C,CAAC,CACH,EAEMG,EAAkB,IAAM,CAC5BR,EAAU,IAAIJ,EACdG,EAAK,mBAAmBC,CAAO,CACjC,EAEMS,EAAW,SAAY,CAC3B,MAAMC,EAAcV,EAAQ,eAAe,GAC3B,MAAMD,EAAK,cAAc,CACvC,MAAOC,EAAQ,UACf,YAAaU,EACb,aAAc,CACZ,QAAS,GACX,CACF,CAAC,GACW,KAAMC,GAAWA,IAAW,EAAK,EACrB,SAAS,eAAe,eAAe,EAC/C,UAAU,OAAO,QAAQ,EAEf,SAAS,eAAe,iBAAiB,EACjD,UAAU,OAAO,QAAQ,CAE7C,EAEMC,EAAO,IAAM,CAEjBb,EAAOD,EAAQ,EACfU,EAAgB,EAChB,MAAMK,EAAiB,SAAS,eAAe,UAAU,EACrDA,GAAgBA,EAAe,iBAAiB,QAASJ,CAAQ,EACrER,EAAmB,EACnBG,EAAoB,EACpBE,EAA2B,EAC3B,SACG,eAAe,OAAO,GACrB,mBAAmB,QAASC,CAAiB,CACnD,EAEA,OAAO,iBAAiB,mBAAoBK,CAAI","names":["Loan","getGuestBaseUrl","getHost","host","loanObj","setupCreditService","baseUrl","id","setupPricingService","params","setupLoanValidationService","setupTitleService","setupLoanObject","saveLoan","loanDetails","result","init","saveLoanButton"],"sourceRoot":"","file":"init.js"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(function(q,T){typeof exports=="object"&&typeof module=="object"?module.exports=T():typeof define=="function"&&define.amd?define([],T):typeof exports=="object"?exports.ice=T():(q.ice=q.ice||{},q.ice.host=T())})(globalThis,()=>(()=>{"use strict";var A={};A.d=(e,i)=>{for(var n in i)A.o(i,n)&&!A.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},A.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),A.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var q={};A.r(q),A.d(q,{Event:()=>T,Guest:()=>Xe,IFrameSandboxValues:()=>C,OpenMode:()=>j,SSFHost:()=>jt,ScriptingObject:()=>De});class T{scriptingObject;name;objectId;requiresFeedback;id;constructor(i){const{name:n,requiresFeedback:t=!1,so:s}=i;if(!n)throw new Error("Event name is required");if(!s)throw new Error("Scripting object is required");this.scriptingObject=s,this.objectId=s.id,this.name=n,this.id=`${this.objectId}.${this.name}`.toLowerCase(),this.requiresFeedback=t}}const st=e=>e instanceof T,$t=(e,i)=>`${e.toLowerCase()}.${i.toLowerCase()}`;var nt=Object.defineProperty,rt=(e,i,n)=>i in e?nt(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,we=(e,i,n)=>(rt(e,typeof i!="symbol"?i+"":i,n),n),Ne=(e,i,n)=>{if(!i.has(e))throw TypeError("Cannot "+n)},Y=(e,i,n)=>(Ne(e,i,"read from private field"),n?n.call(e):i.get(e)),ze=(e,i,n)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,n)},Fe=(e,i,n,t)=>(Ne(e,i,"write to private field"),t?t.call(e,n):i.set(e,n),n),K,F;const ot="function",at=(e,i)=>typeof e===ot&&!!i&&!i.startsWith("_");class De{constructor(i,n){ze(this,K,void 0),ze(this,F,"Object"),we(this,"_toJSON",()=>{const t=[],s=[];return Object.keys(this).forEach(r=>{const a=this[r];st(a)?s.push(r):at(a,r)&&t.push(r)}),{objectId:Y(this,K),objectType:Y(this,F),functions:t,events:s}}),we(this,"_dispose",()=>{}),we(this,"dispose",()=>{}),Fe(this,K,i),Fe(this,F,n||Y(this,F))}get id(){return Y(this,K)}get objectType(){return Y(this,F)}}K=new WeakMap,F=new WeakMap;var M=(e=>(e.GuestReady="guest:ready",e.GuestClose="guest:close",e.GuestReadyComplete="guest:readyComplete",e.GuestResize="guest:resize",e.GuestFocus="guest:focus",e.HandShake="handshake",e.HandShakeAck="handshake:ack",e.ObjectInvoke="object:invoke",e.ObjectGet="object:get",e.ObjectEvent="object:event",e.HostConfig="host:config",e))(M||{}),j=(e=>(e.Popup="popup",e.Embed="embed",e))(j||{}),C=(e=>(e.AllowDownloadsWithoutUserActivation="allow-downloads-without-user-activation",e.AllowDownloads="allow-downloads",e.AllowForms="allow-forms",e.AllowModals="allow-modals",e.AllowOrientationLock="allow-orientation-lock",e.AllowPointerLock="allow-pointer-lock",e.AllowPopups="allow-popups",e.AllowPopupsToEscapeSandbox="allow-popups-to-escape-sandbox",e.AllowPresentation="allow-presentation",e.AllowSameOrigin="allow-same-origin",e.AllowScripts="allow-scripts",e.AllowStorageAccessByUserActivation="allow-storage-access-by-user-activation",e.AllowTopNavigation="allow-top-navigation",e.AllowTopNavigationByUserActivation="allow-top-navigation-by-user-activation",e))(C||{});const ct=e=>{if(e==="about:blank")return"*";const{origin:i}=new URL(e);return i==="null"||!i?e:i},Be=(e,i=[])=>{const n=i||[];return e&&e.forEach?e.forEach(t=>{Be(t,n)}):typeof e<"u"&&n.push(e),n},Pt=e=>typeof e?._toJSON=="function";function He(e){return typeof e=="function"}const lt=e=>e?.constructor?.name==="Proxy",Gt=e=>e?.id??e;var ht=Object.defineProperty,dt=(e,i,n)=>i in e?ht(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,E=(e,i,n)=>(dt(e,typeof i!="symbol"?i+"":i,n),n),Je=(e,i,n)=>{if(!i.has(e))throw TypeError("Cannot "+n)},D=(e,i,n)=>(Je(e,i,"read from private field"),n?n.call(e):i.get(e)),ut=(e,i,n)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,n)},pt=(e,i,n,t)=>(Je(e,i,"write to private field"),t?t.call(e,n):i.set(e,n),n),W;class Xe{constructor(i){E(this,"id"),E(this,"title"),E(this,"url"),E(this,"searchParams"),E(this,"domElement"),E(this,"window"),E(this,"openMode"),E(this,"origin"),E(this,"initialized",!1),E(this,"ready",!1),E(this,"capabilities"),ut(this,W,void 0),E(this,"dispose",()=>{D(this,W).removeSender({origin:this.origin,window:this.window}),this.openMode===j.Popup?this.window.close():this.domElement?.remove?.()}),E(this,"getInfo",()=>({guestId:this.id,guestTitle:this.title,guestUrl:this.url})),E(this,"init",()=>{if(D(this,W).addSender({origin:this.origin,window:this.window}),this.openMode===j.Popup){const u=setInterval(()=>{D(this,W).send({targetWin:this.window,targetOrigin:this.origin,messageType:M.HandShake,messageBody:{}})},1e3);D(this,W).listen({messageType:M.HandShakeAck,callback:()=>{clearInterval(u)}})}}),E(this,"dispatchEvent",(u,b)=>D(this,W).invoke({targetWin:this.window,targetOrigin:this.origin,messageType:M.ObjectEvent,messageBody:u,responseTimeoutMs:b})),E(this,"send",u=>{D(this,W).send({targetWin:this.window,targetOrigin:this.origin,...u})});const{guestId:n,domElement:t=null,title:s,url:r,window:a,searchParams:c={},openMode:l=j.Embed,remoting:g}=i;this.id=n,this.title=s,this.url=r,this.origin=ct(r),this.searchParams=c,this.domElement=t,this.window=a,this.openMode=l,this.capabilities={},pt(this,W,g)}}W=new WeakMap;const Ye={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let ie;const gt=new Uint8Array(16);function wt(){if(!ie&&(ie=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ie))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ie(gt)}const _=[];for(let e=0;e<256;++e)_.push((e+256).toString(16).slice(1));function Ke(e,i=0){return(_[e[i+0]]+_[e[i+1]]+_[e[i+2]]+_[e[i+3]]+"-"+_[e[i+4]]+_[e[i+5]]+"-"+_[e[i+6]]+_[e[i+7]]+"-"+_[e[i+8]]+_[e[i+9]]+"-"+_[e[i+10]]+_[e[i+11]]+_[e[i+12]]+_[e[i+13]]+_[e[i+14]]+_[e[i+15]]).toLowerCase()}function Tt(e,i=0){const n=Ke(e,i);if(!validate(n))throw TypeError("Stringified UUID is invalid");return n}const Ct=null;function ft(e,i,n){if(Ye.randomUUID&&!i&&!e)return Ye.randomUUID();e=e||{};const t=e.random||(e.rng||wt)();if(t[6]=t[6]&15|64,t[8]=t[8]&63|128,i){n=n||0;for(let s=0;s<16;++s)i[n+s]=t[s];return i}return Ke(t)}const Qe=ft;var vt=Object.defineProperty,mt=(e,i,n)=>i in e?vt(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,$=(e,i,n)=>(mt(e,typeof i!="symbol"?i+"":i,n),n),Ze=(e,i,n)=>{if(!i.has(e))throw TypeError("Cannot "+n)},h=(e,i,n)=>(Ze(e,i,"read from private field"),n?n.call(e):i.get(e)),k=(e,i,n)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,n)},se=(e,i,n,t)=>(Ze(e,i,"write to private field"),t?t.call(e,n):i.set(e,n),n),Q,w,Z,R,x,B,fe,ve,me,ne,be,_e,ye,V;const Ve="elli:remoting",et="elli:remoting:response",tt="elli:remoting:exception",ee=({messageType:e,messageBody:i,onewayMsg:n=!1})=>({requestId:n?null:Qe(),source:Ve,type:e,body:i}),Rt=e=>{const{targetWin:i,targetOrigin:n,messageType:t,messageBody:s}=e,r=ee({messageType:t,messageBody:s});i.postMessage(r,n)};class bt{constructor(i,n){if(k(this,Q,void 0),k(this,w,void 0),k(this,Z,new Map),k(this,R,new Map),k(this,x,null),k(this,B,new Map),k(this,fe,()=>{const t=Date.now(),s=[];h(this,R).forEach((r,a)=>{const{requestId:c,cancelTime:l}=r;h(this,w).debug(`Checking response timeout for requestId: ${c}) @ ${l??""}`),r.cancelTime&&r.cancelTime<t&&(h(this,w).debug(`Detected response timeout for requestId: ${c}...`),s.push(a),r.resolve(),h(this,w).debug(`Aborted waiting for response to requestid: ${c})`))}),s.forEach(r=>{h(this,w).debug(`removing invocations with requestId ${r} from cache since response time has expired`),h(this,R).delete(r)}),h(this,R).size===0&&(h(this,w).debug("stopping response monitor"),h(this,me).call(this))}),k(this,ve,()=>{h(this,x)===null&&(h(this,w).debug("Staring response timeout evaluator"),se(this,x,window.setInterval(h(this,fe),200)))}),k(this,me,()=>{h(this,x)!==null&&(window.clearInterval(h(this,x)),se(this,x,null),h(this,w).debug("Stopped response timeout evaluator"))}),k(this,ne,t=>{const s=h(this,R).get(t);return h(this,w).debug(`serving requestId: ${t}`),h(this,R).delete(t),s}),k(this,be,t=>{const{requestId:s}=t;h(this,w).debug(`Response received for invocation requestId: ${s}`);const r=h(this,ne).call(this,s);return r?(r.resolve(t.body),!0):(h(this,w).warn(`Received response to stale/invalid request with requestId: ${s}`),!1)}),k(this,_e,t=>{h(this,w).debug(`Exception received for invocation (requestId = ${t.requestId})`);const s=h(this,ne).call(this,t.requestId);return s?(s.reject(new Error(t.body)),!0):(h(this,w).warn(`Received exception for stale/invalid request (requestId = ${t.requestId})`),!1)}),k(this,ye,({sourceWin:t,sourceOrigin:s,message:r})=>{h(this,w).debug(`Received message of type "${r.type}"`);const a=h(this,Z).get(r.type);return a?(a.forEach(c=>{h(this,w).debug(`Invoking message handler ${c.name}`),c({sourceWin:t,sourceOrigin:s,requestId:r.requestId,type:r.type,body:r.body})}),!0):!1}),k(this,V,t=>{if(h(this,w).debug(`Remoting: Received message ${JSON.stringify(t.data)}`),h(this,B).size===0||!t.source)return!1;const s=h(this,B).get(t.source);return!s||t?.data?.source!==Ve?!1:(t.data.type===et?h(this,be).call(this,t.data):t.data.type===tt?h(this,_e).call(this,t.data):h(this,ye).call(this,{sourceWin:t.source,sourceOrigin:s,message:t.data}),!0)}),$(this,"addSender",t=>{const{origin:s,window:r}=t;if(!s)throw new Error("origin is required");if(!r)throw new Error("window is required");h(this,B).set(r,s)}),$(this,"initialize",t=>{t.removeEventListener("message",h(this,V)),t.addEventListener("message",h(this,V)),h(this,w).debug(`initialized remoting id: ${h(this,Q)}`)}),$(this,"close",()=>{window.removeEventListener("message",h(this,V)),h(this,w).debug(`closed remoting id: ${h(this,Q)}`)}),$(this,"invoke",t=>{const{targetWin:s,targetOrigin:r,messageType:a,messageBody:c,responseTimeoutMs:l}=t;return new Promise((g,u)=>{const b=ee({messageType:a,messageBody:c});h(this,R).set(b.requestId,{requestId:b.requestId,resolve:g,reject:u,cancelTime:l?Date.now()+Number.parseInt(l,10):null}),s.postMessage(b,r);const{requestId:O}=b;h(this,w).debug(`Posted invocation message of type ${a} requestId: ${O||""}`),l&&(h(this,w).debug(`starting response monitor for requestId: ${O||""} for ${l} ms`),h(this,ve).call(this))})}),$(this,"listen",t=>{const{messageType:s,callback:r}=t,a=h(this,Z).get(s)||[];a.push(r),h(this,Z).set(s,a)}),$(this,"send",t=>{const{targetWin:s,targetOrigin:r,messageType:a,messageBody:c}=t,l=ee({messageType:a,messageBody:c,onewayMsg:!0});s.postMessage(l,r),h(this,w).debug(`Posted one-way message of type "${a}"`)}),$(this,"removeSender",t=>{const{window:s}=t;s&&h(this,B).delete(s)}),$(this,"respond",t=>{const{targetWin:s,targetOrigin:r,requestId:a,response:c}=t,l=ee({messageType:et,messageBody:c});l.requestId=a,s.postMessage(l,r),h(this,w).debug(`Response sent to caller for invocation requestId: ${a}`)}),$(this,"raiseException",t=>{const{targetWin:s,targetOrigin:r,requestId:a,ex:c}=t,l=ee({messageType:tt,messageBody:c});l.requestId=a,s.postMessage(l,r),h(this,w).debug(`Exception sent to caller for invocation. requestId: ${a}`)}),!i)throw new Error("logger is required");if(!n)throw new Error("correlationId is required");se(this,Q,n),se(this,w,i)}}Q=new WeakMap,w=new WeakMap,Z=new WeakMap,R=new WeakMap,x=new WeakMap,B=new WeakMap,fe=new WeakMap,ve=new WeakMap,me=new WeakMap,ne=new WeakMap,be=new WeakMap,_e=new WeakMap,ye=new WeakMap,V=new WeakMap;var _t=Object.defineProperty,yt=(e,i,n)=>i in e?_t(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,re=(e,i,n)=>(yt(e,typeof i!="symbol"?i+"":i,n),n),Et=(e,i,n)=>{if(!i.has(e))throw TypeError("Cannot "+n)},f=(e,i,n)=>(Et(e,i,"read from private field"),n?n.call(e):i.get(e)),U=(e,i,n)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,n)},P,G,Ee,L,Oe,te,ke,Ot=(e=>(e.USER="USER",e.PARTNER="PARTNER",e))(Ot||{});class kt{constructor(){U(this,P,new Map),U(this,G,new Map),U(this,Ee,i=>{const{so:n,guestId:t}=i,s=n.id.toLowerCase(),r=f(this,G).get(t);if(!r)f(this,G).set(t,new Map([[s,i]]));else{if(r.has(s))throw new Error(`Scripting Object ${n.id} already exists for guest ${t}`);r.set(s,i)}}),U(this,L,({so:i})=>{i._dispose&&typeof i._dispose=="function"&&i._dispose()}),U(this,Oe,({objectId:i,guestId:n})=>{const t=f(this,G).get(n);return t?t.get(i)??null:null}),U(this,te,({objectId:i,guestId:n}={})=>{if(n){if(!i){const s=f(this,G).get(n);s&&s.forEach(f(this,L)),f(this,G).delete(n);return}const t=f(this,G).get(n);if(t){const s=t.get(i);s&&f(this,L).call(this,s),t.delete(i)}}else i&&f(this,G).forEach(t=>{const s=t.get(i);s&&f(this,L).call(this,s),t.delete(i)})}),U(this,ke,({so:i,guest:n})=>new Proxy(i,{get(t,s,r){const a=t[s];return a instanceof Function&&s!=="constructor"?function(...c){const l=this;return Object.defineProperty(a,"callContext",{value:n,enumerable:!1,writable:!0}),a.apply(l===r?t:l,c)}:a}})),re(this,"addScriptingObject",(i,n)=>{const{guestId:t}=n||{};if(!i?.id||!i?._toJSON)throw new Error("Object is not derived from ScriptingObject");const s=i.id.toLowerCase();if(s==="module"&&!t)throw new Error("Guest id is required to add Module scripting object");if(t){f(this,Ee).call(this,{so:i,...n,guestId:t});return}if(f(this,P).has(s))throw new Error(`Scripting Object ${i.id} already exists`);f(this,P).set(s,{so:i,...n})}),re(this,"getObject",(i,n)=>{const t=i.toLowerCase();let s=null;n?.id&&(s=f(this,Oe).call(this,{objectId:t,guestId:n.id})),s=s??f(this,P).get(t);const{so:r}=s||{};if(!r)return null;if(!n)return r;const a=f(this,ke).call(this,{so:r,guest:n});return Object.defineProperty(a,"target",{value:r,enumerable:!1,configurable:!1,writable:!0}),a}),re(this,"removeScriptingObject",(i,n)=>{const t=i.toLowerCase();if(n)f(this,te).call(this,{objectId:t,guestId:n});else{f(this,te).call(this,{objectId:t});const s=f(this,P).get(t);s&&f(this,L).call(this,s),f(this,P).delete(t)}}),re(this,"removeAllScriptingObjects",i=>{i?f(this,te).call(this,{guestId:i}):(f(this,P).forEach(f(this,L)),f(this,P).clear())})}}P=new WeakMap,G=new WeakMap,Ee=new WeakMap,L=new WeakMap,Oe=new WeakMap,te=new WeakMap,ke=new WeakMap;var Mt=Object.defineProperty,St=(e,i,n)=>i in e?Mt(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n,S=(e,i,n)=>(St(e,typeof i!="symbol"?i+"":i,n),n),it=(e,i,n)=>{if(!i.has(e))throw TypeError("Cannot "+n)},o=(e,i,n)=>(it(e,i,"read from private field"),n?n.call(e):i.get(e)),p=(e,i,n)=>{if(i.has(e))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(e):i.set(e,n)},H=(e,i,n,t)=>(it(e,i,"write to private field"),t?t.call(e,n):i.set(e,n),n),m,J,d,I,N,oe,ae,ce,z,Me,Se,le,Ie,he,je,de,We,$e,Pe,Ge,Ae,Te,Ce,Re,ue,qe,xe,Ue,Le;const It=[C.AllowScripts,C.AllowPopups,C.AllowModals,C.AllowForms,C.AllowDownloads,C.AllowSameOrigin].join(" ");class jt{constructor(i,n){if(S(this,"hostId"),p(this,m,void 0),p(this,J,void 0),p(this,d,void 0),p(this,I,new Map),p(this,N,void 0),p(this,oe,null),p(this,ae,null),p(this,ce,()=>{for(const t of o(this,I).values())t.openMode===j.Popup&&this.unloadGuest(t.id)}),p(this,z,t=>{for(const s of o(this,I).values())if(s.window===t)return s;return null}),p(this,Me,t=>{for(const s of o(this,I).values())if(s.url===t)return s;return null}),p(this,Se,t=>typeof t?._toJSON=="function"),p(this,le,t=>o(this,Se).call(this,t)?{type:"object",object:t._toJSON()}:{type:"value",value:t}),p(this,Ie,t=>typeof t=="string"?t:t instanceof Error?t.message:"An unexpected error occurred in the host application"),p(this,he,t=>{t.ready&&o(this,m).send({targetWin:t.window,targetOrigin:t.origin,messageType:M.HostConfig,messageBody:{logLevel:o(this,d).getLogLevel(),...t.getInfo()}})}),p(this,je,({guest:t,obj:s,functionName:r,functionParams:a})=>{const c=s[r];return He(c)?(o(this,d).debug(`Invoking host implementation of ${s.id}.${String(r)}()`),new Promise(l=>{Object.prototype.hasOwnProperty.call(c,"callContext")||Object.defineProperty(c,"callContext",{value:{guest:t},enumerable:!0}),l(c(...a))})):(o(this,d).warn(`Attempt to call invalid function on object type ${s.objectType}: ${String(r)}`),Promise.reject(new Error(`Method '${r}' not found in Scripting Object '${s.id}'`)))}),p(this,de,({sourceWin:t,sourceOrigin:s,requestId:r})=>{var a;const c=o(this,z).call(this,t);if(!c){o(this,d).warn(`Received ready event for unknown guest. requestId: ${r}`);return}if(!c.initialized){o(this,d).warn("Guest must be initialized before it is marked as ready"),o(this,m).raiseException({targetWin:t,targetOrigin:s,requestId:r,ex:"Guest must be initialized before it is marked as ready"});return}c.ready||(c.ready=!0,o(this,he).call(this,c),(a=o(this,oe))==null||a.call(this,c),o(this,d).audit({message:"Guest is ready",...c.getInfo()}))}),p(this,We,({sourceWin:t,sourceOrigin:s,requestId:r,body:a})=>{const c=o(this,z).call(this,t);if(!c){o(this,d).warn(`Received ready event for unknown guest. requestid = ${r}`);return}c.initialized||(c.initialized=!0,c.capabilities=a||{},o(this,d).audit({message:"Guest is initialized",...c.getInfo()})),(!a||!a.onReady)&&o(this,de).call(this,{sourceWin:t,sourceOrigin:s,requestId:r,type:"",body:null})}),p(this,$e,({sourceWin:t})=>{t?.window&&this.unloadGuest(t)}),p(this,Pe,({sourceWin:t,sourceOrigin:s,requestId:r,body:a})=>{const{objectId:c}=a;o(this,d).debug(`Processing getObject request for object ${c}. requestId = ${r}`);const l=o(this,z).call(this,t);if(!l)return o(this,d).warn("Rejected object request from unknown guest window"),o(this,m).raiseException({targetWin:t,targetOrigin:s,requestId:r,ex:"Specified window is not a known guest"}),!1;const g=this.getScriptingObject(c);return g?(o(this,m).respond({targetWin:t,targetOrigin:s,requestId:r,response:o(this,le).call(this,g)}),o(this,d).audit({message:"Scripting Object returned",requestId:r,scriptingObject:c,...l.getInfo()}),!0):(o(this,d).warn(`unknown or unauthorized object ${c} from guest ${l.id}`),o(this,m).raiseException({targetWin:t,targetOrigin:s,requestId:r,ex:`The requested object (${c}) is not available`}),!1)}),p(this,Ge,({sourceWin:t,requestId:s,body:r})=>{const a=o(this,z).call(this,t);if(!a){o(this,d).warn(`Received resize event from unknown guest. requestid = ${s}`);return}a.domElement&&(a.domElement.style.height=`${r.height}px`),o(this,d).debug(`Guest ${a.id} resized to ${r.width}x${r.height}`)}),p(this,Ae,({sourceWin:t,sourceOrigin:s,requestId:r,body:a})=>{const{objectId:c}=a,l=o(this,z).call(this,t);if(!l)return o(this,d).warn("Rejected method invocation request from unknown guest window"),o(this,m).raiseException({targetWin:t,targetOrigin:s,requestId:r,ex:"Specified window is not a known guest"}),!1;o(this,d).debug(`Function ${c}.${String(a.functionName)}() called from guest "${l.id}" (requestId = ${r})`);const g=this.getScriptingObject(c);return g?(o(this,je).call(this,{guest:l,obj:g,functionName:a.functionName,functionParams:a.functionParams}).then(u=>{o(this,m).respond({targetWin:t,targetOrigin:s,requestId:r,response:o(this,le).call(this,u)}),o(this,d).audit({message:"Value returned for Scripting Object method call",requestId:r,scriptingObject:c,scriptingMethod:a.functionName,...l.getInfo()})}).catch(u=>{o(this,m).raiseException({targetWin:t,targetOrigin:l.origin,requestId:r,ex:o(this,Ie).call(this,u)}),o(this,d).audit({message:"Exception thrown for Scripting Object method call",requestId:r,scriptingObject:c,scriptingMethod:a.functionName,...l.getInfo()})}),!0):(o(this,d).warn(`Invocation of unknown or unauthorized object ${c} from guest ${l.id}`),o(this,m).raiseException({targetWin:t,targetOrigin:s,requestId:r,ex:`The requested object (${c}) is not available`}),!1)}),p(this,Te,()=>{o(this,m).listen({messageType:M.GuestResize,callback:o(this,Ge)})}),p(this,Ce,()=>{o(this,m).listen({messageType:M.GuestReady,callback:o(this,We)}),o(this,m).listen({messageType:M.GuestReadyComplete,callback:o(this,de)}),o(this,m).listen({messageType:M.GuestClose,callback:o(this,$e)}),o(this,m).listen({messageType:M.ObjectGet,callback:o(this,Pe)}),o(this,m).listen({messageType:M.ObjectInvoke,callback:o(this,Ae)}),window.addEventListener("visibilitychange",o(this,ce))}),p(this,Re,t=>t?.constructor?.name==="ProxyEvent"),p(this,ue,t=>{const s=new Xe({...t,remoting:o(this,m)});return s.init(),o(this,I).set(t.guestId,s),s}),p(this,qe,()=>{H(this,ae,setInterval(()=>{const t=[];o(this,I).forEach(s=>{s.openMode===j.Popup&&s.window.closed&&t.push(s)}),t.forEach(s=>{this.unloadGuest(s.id)})},1e3))}),p(this,xe,t=>{const{url:s,title:r,popupWindowFeatures:a={},searchParams:c,guestId:l}=t,{width:g=800,height:u=600,top:b=100,left:O=100}=a;let y=o(this,Me).call(this,s);if(y)y.window.closed||y.send({messageType:M.GuestFocus,messageBody:{}});else{const pe=[{key:"width",value:g},{key:"height",value:u},{key:"top",value:b},{key:"left",value:O}].reduce((X,ge,Wt)=>(Wt>0&&ge.value&&(X+=","),ge.value?`${X}${ge.key}=${ge.value}`:X),""),v=window.open(s,r,`popup, ${pe}`);if(!v)throw new Error("Failed to open guest application in popup window");v.opener=null,y=o(this,ue).call(this,{guestId:l,window:v,title:r,url:s,searchParams:c,openMode:j.Popup})}return y}),p(this,Ue,t=>{const{url:s,title:r,targetElement:a,searchParams:c,guestId:l,options:g={}}=t,u=a.ownerDocument??document,{fitToContent:b=!1,disableSandbox:O=!1,sandboxValues:y=[],style:pe=""}=g;if(!r)throw new Error("title is required");b&&o(this,Te).call(this);const v=u.createElement("iframe");v.setAttribute("id",l),v.addEventListener("load",()=>{o(this,d).debug(`frame loaded for guest with id '${l}'`)}),v.setAttribute("style",`min-width: 100%; height: 100%; border: 0px; ${pe}`),O||v.setAttribute("sandbox",`${It} ${y.join(" ")}`),v.setAttribute("title",r),v.setAttribute("src",s),a.appendChild(v);const X=u.getElementById(l);return o(this,ue).call(this,{guestId:l,domElement:X,window:X.contentWindow,title:r,url:s,searchParams:c,openMode:j.Embed})}),p(this,Le,(t,s)=>{let r="";return Object.keys(s).forEach(a=>{r+=`${(r.length?"&":"")+encodeURIComponent(a)}=${encodeURIComponent(s[a])}`}),t+(r?(t.indexOf("?")>=0?"&":"?")+r:"")}),S(this,"addScriptingObject",(t,s)=>{o(this,N).addScriptingObject(t,s)}),S(this,"cloneScriptingObject",(t,s)=>{if(!t)throw new Error("proxy is required");if(!s)throw new Error("guest is required");const r=new De(t.id,t.objectType);let a=[];return Object.keys(t).forEach(c=>{const l=t[c];if(o(this,Re).call(this,l)){const g=new T({name:l.name,requiresFeedback:!1,so:r});Object.defineProperty(r,c,{value:g,enumerable:!0});const u=({eventParams:O,eventOptions:y})=>this.dispatchEvent({event:g,eventParams:O,eventOptions:y}),b=s.subscribe({eventId:l.id,callback:u});a.push(()=>{s.unsubscribe({eventId:l.id,token:b})})}else if(He(l)&&(Object.defineProperty(r,c,{value:async(...g)=>{const u=await l(...g);return lt(u)?this.cloneScriptingObject(u,s):u},enumerable:!0}),c==="dispose")){const g=r.dispose;Object.defineProperty(r,c,{value:()=>(r._dispose(),g.apply(r)),enumerable:!0})}}),r._dispose=()=>{a.forEach(c=>{c?.()}),a=[]},r}),S(this,"close",()=>{clearInterval(o(this,ae)),o(this,m).close(),window.removeEventListener("visibilitychange",o(this,ce)),o(this,d).debug(`host is closed. hostId: ${this.hostId}, correlationId: ${o(this,J)}`)}),S(this,"dispatchEvent",async t=>{const{event:{id:s,name:r,scriptingObject:a},eventParams:c,eventOptions:l={}}=t,{eventHandler:g=null,timeout:u=null,window:b=null}=l,O={object:a._toJSON(),eventName:r,eventParams:c,eventHandler:g,eventOptions:{allowsFeedback:!1}};u&&!Number.isNaN(u)&&(O.eventOptions={allowsFeedback:!0,timeout:Number(u)});const y=[];return o(this,I).forEach(v=>{(!b||b===v.window)&&(u&&v?.capabilities?.eventFeedback?(y.push(v.dispatchEvent(O,u)),o(this,d).audit({message:"Event dispatched and awaiting feedback",scriptingEventId:s,...v.getInfo()})):(v.send({messageType:M.ObjectEvent,messageBody:O}),o(this,d).audit({message:"Event dispatched",scriptingEventId:s,...v.getInfo()})))}),await Promise.all(y).then(v=>(o(this,d).audit({message:"Event feedback received",scriptingEventId:s}),Be(v))).catch(v=>{throw o(this,d).error({message:"Error processing event",eventId:s,exception:v}),v})}),S(this,"getGuests",()=>{const t=[];return o(this,I).forEach(s=>{t.push(s)}),t}),S(this,"getScriptingObject",t=>o(this,N).getObject(t)),S(this,"loadGuest",t=>{const{id:s,url:r,targetElement:a,title:c,searchParams:l={},options:g={}}=t;if(!s)throw new Error("id for guest application is required");const{openMode:u=j.Embed,popupWindowFeatures:b={}}=g,O=o(this,Le).call(this,r,l);let y=null;if(u===j.Popup)y=o(this,xe).call(this,{guestId:s,url:O,title:c,searchParams:l,popupWindowFeatures:b});else if(u===j.Embed)y=o(this,Ue).call(this,{guestId:s,url:O,title:c,targetElement:a,searchParams:l,options:g});else throw new Error(`Invalid openMode: ${u}`);return o(this,d).audit({message:"Guest loaded",...y.getInfo()}),y}),S(this,"loadGuests",t=>{const{id:s,url:r,targetElement:a,title:c,searchParamsList:l=[],options:g={}}=t;l.forEach((u,b)=>{this.loadGuest({id:`${s}-${b}`,url:r,title:c,targetElement:a,searchParams:u,options:g})},this)}),S(this,"removeAllScriptingObjects",t=>{o(this,N).removeAllScriptingObjects(t)}),S(this,"removeScriptingObject",(t,s)=>{o(this,N).removeScriptingObject(t,s)}),S(this,"setLogLevel",t=>{o(this,d).setLogLevel(t),o(this,I).forEach(o(this,he)),o(this,d).debug("Dispatched config events to all guests")}),S(this,"unloadGuest",t=>{let s=typeof t=="string"?o(this,I).get(t):null;if(!s&&(s=Array.from(o(this,I).values()).find(r=>r.window===t||r.domElement===t),!s))throw new Error("Invalid guestId or guestWindow reference");s.dispose(),o(this,I).delete(s.id),o(this,d).audit({message:"Guest is removed from host",...s.getInfo()})}),this.hostId=i,!n?.logger)throw new Error("Logger is required");if(H(this,d,n.logger),H(this,J,Qe()),H(this,m,new bt(o(this,d),o(this,J))),n?.readyStateCallback&&typeof n?.readyStateCallback!="function")throw new Error("readyStateCallback must be a function");H(this,oe,n?.readyStateCallback||null),H(this,N,new kt),o(this,m).initialize(window),o(this,Ce).call(this),o(this,qe).call(this),o(this,d).debug(`host is initialized. hostId: ${this.hostId}, correlationId: ${o(this,J)}`)}}return m=new WeakMap,J=new WeakMap,d=new WeakMap,I=new WeakMap,N=new WeakMap,oe=new WeakMap,ae=new WeakMap,ce=new WeakMap,z=new WeakMap,Me=new WeakMap,Se=new WeakMap,le=new WeakMap,Ie=new WeakMap,he=new WeakMap,je=new WeakMap,de=new WeakMap,We=new WeakMap,$e=new WeakMap,Pe=new WeakMap,Ge=new WeakMap,Ae=new WeakMap,Te=new WeakMap,Ce=new WeakMap,Re=new WeakMap,ue=new WeakMap,qe=new WeakMap,xe=new WeakMap,Ue=new WeakMap,Le=new WeakMap,q})());
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=emuiSsfHost.c5817b40dbe7ca11b52d.js.map
|
|
Binary file
|
|
Binary file
|