@elliemae/ssf-host 2.2.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/cjs/guest.js +0 -4
  2. package/dist/cjs/host.js +46 -40
  3. package/dist/cjs/v1-guest-v2-host.html +67 -0
  4. package/dist/cjs/v2-host-v1-guest.html +77 -0
  5. package/dist/esm/guest.js +0 -4
  6. package/dist/esm/host.js +46 -40
  7. package/dist/esm/v1-guest-v2-host.html +67 -0
  8. package/dist/esm/v2-host-v1-guest.html +77 -0
  9. package/dist/public/index.html +1 -1
  10. package/dist/public/js/{emuiSsfHost.b9fc3b6ba3c602646972.js → emuiSsfHost.574002466a68fa2d7031.js} +2 -2
  11. package/dist/public/js/emuiSsfHost.574002466a68fa2d7031.js.br +0 -0
  12. package/dist/public/js/emuiSsfHost.574002466a68fa2d7031.js.gz +0 -0
  13. package/dist/public/js/emuiSsfHost.574002466a68fa2d7031.js.map +1 -0
  14. package/dist/public/loan-object-v1.js +3 -0
  15. package/dist/public/loan-object-v1.js.br +0 -0
  16. package/dist/public/loan-object-v1.js.gz +0 -0
  17. package/dist/public/loan-object-v1.js.map +1 -0
  18. package/dist/public/loan-object.js +1 -1
  19. package/dist/public/loan-object.js.br +0 -0
  20. package/dist/public/loan-object.js.gz +0 -0
  21. package/dist/public/loan-object.js.map +1 -1
  22. package/dist/public/utils.js +1 -1
  23. package/dist/public/utils.js.br +0 -0
  24. package/dist/public/utils.js.gz +0 -0
  25. package/dist/public/utils.js.map +1 -1
  26. package/dist/public/v1-guest-v2-host.html +1 -0
  27. package/dist/public/v1-guest.html +65 -0
  28. package/dist/public/v1-host.html +69 -0
  29. package/dist/public/v2-host-v1-guest.html +1 -0
  30. package/dist/types/guest.d.ts +0 -4
  31. package/dist/types/host.d.ts +0 -13
  32. package/dist/types/ihost.d.ts +0 -12
  33. package/dist/types/types.d.ts +0 -5
  34. package/dist/umd/index.js +1 -1
  35. package/dist/umd/index.js.br +0 -0
  36. package/dist/umd/index.js.gz +0 -0
  37. package/dist/umd/index.js.map +1 -1
  38. package/dist/umd/loan-object-v1.js +3 -0
  39. package/dist/umd/loan-object-v1.js.br +0 -0
  40. package/dist/umd/loan-object-v1.js.gz +0 -0
  41. package/dist/umd/loan-object-v1.js.map +1 -0
  42. package/dist/umd/loan-object.js +1 -1
  43. package/dist/umd/loan-object.js.br +0 -0
  44. package/dist/umd/loan-object.js.gz +0 -0
  45. package/dist/umd/loan-object.js.map +1 -1
  46. package/dist/umd/utils.js +1 -1
  47. package/dist/umd/utils.js.br +0 -0
  48. package/dist/umd/utils.js.gz +0 -0
  49. package/dist/umd/utils.js.map +1 -1
  50. package/dist/umd/v1-guest-v2-host.html +1 -0
  51. package/dist/umd/v1-guest.html +65 -0
  52. package/dist/umd/v1-host.html +69 -0
  53. package/dist/umd/v2-host-v1-guest.html +1 -0
  54. package/package.json +5 -5
  55. package/dist/public/js/emuiSsfHost.b9fc3b6ba3c602646972.js.br +0 -0
  56. package/dist/public/js/emuiSsfHost.b9fc3b6ba3c602646972.js.gz +0 -0
  57. package/dist/public/js/emuiSsfHost.b9fc3b6ba3c602646972.js.map +0 -1
package/dist/cjs/guest.js CHANGED
@@ -75,7 +75,6 @@ class Guest {
75
75
  #remoting;
76
76
  /**
77
77
  * Create object representing guest application
78
- *
79
78
  * @param {GuestOption} option - options for creating a guest application
80
79
  */
81
80
  constructor(option) {
@@ -113,7 +112,6 @@ class Guest {
113
112
  };
114
113
  /**
115
114
  * Get information about the guest application
116
- *
117
115
  * @returns guest properties
118
116
  */
119
117
  getInfo = () => ({
@@ -145,7 +143,6 @@ class Guest {
145
143
  };
146
144
  /**
147
145
  * invokes event callback on the guest application
148
- *
149
146
  * @param {EventObject} event - event object
150
147
  * @param {number} timeout - timeout in milliseconds
151
148
  */
@@ -158,7 +155,6 @@ class Guest {
158
155
  });
159
156
  /**
160
157
  * Send a message without any form of response. fire and forget
161
- *
162
158
  * @param {MessageParam} param - message to be sent
163
159
  */
164
160
  send = (param) => {
package/dist/cjs/host.js CHANGED
@@ -67,7 +67,6 @@ class SSFHost {
67
67
  #popupGuestMonitor = null;
68
68
  /**
69
69
  * Create a new host
70
- *
71
70
  * @param hostId unique identifier for the host
72
71
  * @param {HostOption} option - options for the host
73
72
  */
@@ -98,7 +97,6 @@ class SSFHost {
98
97
  };
99
98
  /**
100
99
  * get the reference to the guest application by its window
101
- *
102
100
  * @param guestWindow reference to the guest window
103
101
  * @returns reference to the guest
104
102
  */
@@ -111,7 +109,6 @@ class SSFHost {
111
109
  };
112
110
  /**
113
111
  * get the reference to the guest application by its window
114
- *
115
112
  * @param url url of the guest application
116
113
  * @returns reference to the guest
117
114
  */
@@ -124,7 +121,6 @@ class SSFHost {
124
121
  };
125
122
  /**
126
123
  * check if a object is a scripting object
127
- *
128
124
  * @param value javascript object
129
125
  * @returns true if the object is a scripting object
130
126
  */
@@ -433,11 +429,12 @@ class SSFHost {
433
429
  };
434
430
  #isProxyEvent = (value) => (
435
431
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
436
- value?.constructor?.name === "ProxyEvent"
432
+ value?.constructor?.name === "ProxyEvent" || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
433
+ typeof value?.subscribe === "function"
437
434
  );
435
+ // support v1 scripting objects
438
436
  /**
439
437
  * Register pre-rendered guest application to host
440
- *
441
438
  * @param {AttachParam} param - parameters for attaching the guest
442
439
  * @returns reference to the guest object
443
440
  */
@@ -568,7 +565,6 @@ class SSFHost {
568
565
  };
569
566
  /**
570
567
  * registers scripting object to the host
571
- *
572
568
  * @param {ValueOf<AppObjects>} so scripting object to be registered
573
569
  * @param {AddScriptingObjectParams} params params to add scripting object
574
570
  */
@@ -577,7 +573,6 @@ class SSFHost {
577
573
  };
578
574
  /**
579
575
  * Clone parent host's scripting object for exposing to grand children
580
- *
581
576
  * @param proxy - reference to the scripting object obtained through getObject method
582
577
  * @param guest - reference to the ssf guest
583
578
  * @returns cloned version of the scripting object
@@ -592,33 +587,53 @@ class SSFHost {
592
587
  Object.keys(proxy).forEach((propName) => {
593
588
  const propValue = proxy[propName];
594
589
  if (this.#isProxyEvent(propValue)) {
595
- const event = new import_microfe_common.Event({
596
- name: propValue.name,
597
- requiresFeedback: false,
598
- so
599
- });
590
+ let event;
591
+ if (propValue?.subscribe !== "function") {
592
+ event = new import_microfe_common.Event({
593
+ name: propValue.name || propName,
594
+ requiresFeedback: false,
595
+ so
596
+ });
597
+ } else {
598
+ event = new automation.Event();
599
+ }
600
600
  Object.defineProperty(so, propName, {
601
601
  value: event,
602
602
  enumerable: true
603
603
  });
604
- const listener = ({
605
- eventParams,
606
- eventOptions
607
- }) => this.dispatchEvent({
608
- event,
609
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
610
- eventParams,
611
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
612
- eventOptions
613
- });
614
- const token = guest.subscribe({
615
- eventId: propValue.id,
616
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
617
- callback: listener
618
- });
619
- unsubscribers.push(() => {
620
- guest.unsubscribe({ eventId: propValue.id, token });
621
- });
604
+ if (guest.subscribe) {
605
+ const listener = ({
606
+ eventParams,
607
+ eventOptions
608
+ }) => this.dispatchEvent({
609
+ event,
610
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
611
+ eventParams,
612
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
613
+ eventOptions
614
+ });
615
+ const token = guest.subscribe({
616
+ eventId: propValue.id,
617
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
618
+ callback: listener
619
+ });
620
+ unsubscribers.push(() => {
621
+ guest.unsubscribe({ eventId: propValue.id, token });
622
+ });
623
+ } else {
624
+ const token = propValue.subscribe?.(
625
+ (obj, params, options) => this.dispatchEvent({
626
+ event,
627
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
628
+ eventParams: params,
629
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
630
+ eventOptions: options
631
+ })
632
+ );
633
+ unsubscribers.push(() => {
634
+ propValue.unsubscribe?.(token);
635
+ });
636
+ }
622
637
  } else if ((0, import_utils.isFunction)(propValue)) {
623
638
  Object.defineProperty(so, propName, {
624
639
  value: async (...args) => {
@@ -660,7 +675,6 @@ class SSFHost {
660
675
  };
661
676
  /**
662
677
  * dispatch event to guest application(s)
663
- *
664
678
  * @param {EventDetail} details details of the event to be dispatched
665
679
  * @returns promise that resolves to an array with result from each guest application
666
680
  */
@@ -732,7 +746,6 @@ class SSFHost {
732
746
  };
733
747
  /**
734
748
  * get reference to all guest applications
735
- *
736
749
  * @returns list of guest application references
737
750
  */
738
751
  getGuests = () => {
@@ -744,7 +757,6 @@ class SSFHost {
744
757
  };
745
758
  /**
746
759
  * get the scripting object by id
747
- *
748
760
  * @param objectId - id of the scripting object
749
761
  * @param params
750
762
  * @returns scripting object
@@ -752,7 +764,6 @@ class SSFHost {
752
764
  getScriptingObject = (objectId) => this.#soManager.getObject(objectId);
753
765
  /**
754
766
  * loads guest application inside sandboxed iframe
755
- *
756
767
  * @param {LoadGuestParam} param - parameters for loading the guest application
757
768
  * @returns reference to the guest object
758
769
  */
@@ -798,7 +809,6 @@ class SSFHost {
798
809
  };
799
810
  /**
800
811
  * loads guest application inside sandboxed iframe with different params
801
- *
802
812
  * @param {LoadGuestsParam} param - parameters for loading the guest application
803
813
  */
804
814
  loadGuests = (param) => {
@@ -823,7 +833,6 @@ class SSFHost {
823
833
  };
824
834
  /**
825
835
  * removes all scripting objects from host
826
- *
827
836
  * @param guestId unique id of the guest application
828
837
  */
829
838
  removeAllScriptingObjects = (guestId) => {
@@ -831,7 +840,6 @@ class SSFHost {
831
840
  };
832
841
  /**
833
842
  * removes scripting object from the host
834
- *
835
843
  * @param objectId unique id of the scripting object
836
844
  * @param guestId unique id of the guest application
837
845
  */
@@ -840,7 +848,6 @@ class SSFHost {
840
848
  };
841
849
  /**
842
850
  * set the log level for the host application
843
- *
844
851
  * @param level - log level
845
852
  */
846
853
  setLogLevel = (level) => {
@@ -850,7 +857,6 @@ class SSFHost {
850
857
  };
851
858
  /**
852
859
  * unloads guest application from host
853
- *
854
860
  * @param guestIdOrWindowOrEle unique id of the guest application or window object or dom element of the guest application
855
861
  * @throws Error if guestId or Window reference is invalid
856
862
  */
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Guest V1 -> V2 Host</title>
7
+ <style>
8
+ html,
9
+ body,
10
+ main {
11
+ height: 100%;
12
+ margin: 2px;
13
+ padding: 0;
14
+ }
15
+ iframe {
16
+ width: 100%;
17
+ height: 100%;
18
+ border: none;
19
+ }
20
+ #guest-container {
21
+ height: 100%;
22
+ }
23
+ </style>
24
+ <script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script>
25
+ <script src="https://cdn.elliemae.io/elliemae/core/ssf/1.0/elli.ssf.guest.js"></script>
26
+ </head>
27
+ <body>
28
+ <h2>Guest V1 nesting Host V2</h2>
29
+ <div id="result">
30
+ <p id="loan-details"></p>
31
+ <p id="loan-pre-save-event-details"></p>
32
+ </div>
33
+ <div id="guest-container"></div>
34
+ <script type="module">
35
+ import { getGuestBaseUrl, getHost } from './utils.js';
36
+
37
+ const hostV2 = getHost();
38
+
39
+ const loadV2Guest = async () => {
40
+ const guestBaseUrl = await getGuestBaseUrl();
41
+ const { id } = hostV2.loadGuest({
42
+ id: 'guestV2',
43
+ url: new URL('./v2-guest.html', guestBaseUrl).href,
44
+ title: 'Guest V2',
45
+ targetElement: document.getElementById('guest-container'),
46
+ });
47
+ };
48
+
49
+ window.addEventListener('load', async () => {
50
+ await elli.script.connect();
51
+ const loan = await elli.script.getObject('Loan');
52
+ const details = await loan.getLoanDetails();
53
+ document.getElementById(
54
+ 'loan-details',
55
+ ).innerText = `Loan Data: ${JSON.stringify(details)}`;
56
+ elli.script.subscribe('loan', 'onPreSave', (loan, eventData) => {
57
+ document.getElementById(
58
+ 'loan-pre-save-event-details',
59
+ ).innerText = `Presave event data: ${JSON.stringify(eventData)}`;
60
+ return false;
61
+ });
62
+ hostV2.addScriptingObject(hostV2.cloneScriptingObject(loan, {}));
63
+ await loadV2Guest();
64
+ });
65
+ </script>
66
+ </body>
67
+ </html>
@@ -0,0 +1,77 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Host V2 -> V1 Guest</title>
7
+ <style>
8
+ html,
9
+ body,
10
+ main {
11
+ height: 100%;
12
+ margin: 4px;
13
+ padding: 0;
14
+ }
15
+ iframe {
16
+ width: 100%;
17
+ height: 100%;
18
+ border: none;
19
+ }
20
+ #guest-container {
21
+ height: 100%;
22
+ }
23
+ </style>
24
+ <script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script>
25
+ </head>
26
+ <body>
27
+ <main>
28
+ <h1>Host V2 nesting V1 Guest</h1>
29
+ <button id="save-btn" type="button" onclick="saveLoan()">
30
+ Save Loan
31
+ </button>
32
+ <div id="results">
33
+ <p id="pre-save-feedback-result"></p>
34
+ </div>
35
+ <div id="guest-container"></div>
36
+ </main>
37
+ <script type="module">
38
+ import { Loan } from './loan-object.js';
39
+ import { getGuestBaseUrl, getHost } from './utils.js';
40
+
41
+ const hostV2 = getHost();
42
+ const loanObj = new Loan();
43
+ hostV2.addScriptingObject(loanObj);
44
+ const params = new URLSearchParams(document.location.search);
45
+ const { id } = hostV2.loadGuest({
46
+ id: 'guestV1',
47
+ url: new URL(
48
+ params.get('nestV1GuestV2Host') !== 'true'
49
+ ? './v1-guest.html'
50
+ : './v1-guest-v2-host.html',
51
+ window.location.href,
52
+ ).href,
53
+ searchParams: { nestHostV1: true },
54
+ title: 'Guest V1',
55
+ targetElement: document.getElementById('guest-container'),
56
+ });
57
+
58
+ window.saveLoan = async () => {
59
+ const loanDetails = loanObj.getLoanDetails();
60
+ const results = await hostV2.dispatchEvent({
61
+ event: loanObj.onPreSave,
62
+ eventParams: loanDetails,
63
+ eventOptions: {
64
+ timeout: 1000,
65
+ },
66
+ });
67
+ if (results.some((result) => result === false)) {
68
+ document.getElementById('pre-save-feedback-result').innerText =
69
+ 'Pre save failed';
70
+ } else {
71
+ document.getElementById('pre-save-feedback-result').innerText =
72
+ 'Pre save succeeded';
73
+ }
74
+ };
75
+ </script>
76
+ </body>
77
+ </html>
package/dist/esm/guest.js CHANGED
@@ -52,7 +52,6 @@ class Guest {
52
52
  #remoting;
53
53
  /**
54
54
  * Create object representing guest application
55
- *
56
55
  * @param {GuestOption} option - options for creating a guest application
57
56
  */
58
57
  constructor(option) {
@@ -90,7 +89,6 @@ class Guest {
90
89
  };
91
90
  /**
92
91
  * Get information about the guest application
93
- *
94
92
  * @returns guest properties
95
93
  */
96
94
  getInfo = () => ({
@@ -122,7 +120,6 @@ class Guest {
122
120
  };
123
121
  /**
124
122
  * invokes event callback on the guest application
125
- *
126
123
  * @param {EventObject} event - event object
127
124
  * @param {number} timeout - timeout in milliseconds
128
125
  */
@@ -135,7 +132,6 @@ class Guest {
135
132
  });
136
133
  /**
137
134
  * Send a message without any form of response. fire and forget
138
- *
139
135
  * @param {MessageParam} param - message to be sent
140
136
  */
141
137
  send = (param) => {
package/dist/esm/host.js CHANGED
@@ -53,7 +53,6 @@ class SSFHost {
53
53
  #popupGuestMonitor = null;
54
54
  /**
55
55
  * Create a new host
56
- *
57
56
  * @param hostId unique identifier for the host
58
57
  * @param {HostOption} option - options for the host
59
58
  */
@@ -84,7 +83,6 @@ class SSFHost {
84
83
  };
85
84
  /**
86
85
  * get the reference to the guest application by its window
87
- *
88
86
  * @param guestWindow reference to the guest window
89
87
  * @returns reference to the guest
90
88
  */
@@ -97,7 +95,6 @@ class SSFHost {
97
95
  };
98
96
  /**
99
97
  * get the reference to the guest application by its window
100
- *
101
98
  * @param url url of the guest application
102
99
  * @returns reference to the guest
103
100
  */
@@ -110,7 +107,6 @@ class SSFHost {
110
107
  };
111
108
  /**
112
109
  * check if a object is a scripting object
113
- *
114
110
  * @param value javascript object
115
111
  * @returns true if the object is a scripting object
116
112
  */
@@ -419,11 +415,12 @@ class SSFHost {
419
415
  };
420
416
  #isProxyEvent = (value) => (
421
417
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
422
- value?.constructor?.name === "ProxyEvent"
418
+ value?.constructor?.name === "ProxyEvent" || // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
419
+ typeof value?.subscribe === "function"
423
420
  );
421
+ // support v1 scripting objects
424
422
  /**
425
423
  * Register pre-rendered guest application to host
426
- *
427
424
  * @param {AttachParam} param - parameters for attaching the guest
428
425
  * @returns reference to the guest object
429
426
  */
@@ -554,7 +551,6 @@ class SSFHost {
554
551
  };
555
552
  /**
556
553
  * registers scripting object to the host
557
- *
558
554
  * @param {ValueOf<AppObjects>} so scripting object to be registered
559
555
  * @param {AddScriptingObjectParams} params params to add scripting object
560
556
  */
@@ -563,7 +559,6 @@ class SSFHost {
563
559
  };
564
560
  /**
565
561
  * Clone parent host's scripting object for exposing to grand children
566
- *
567
562
  * @param proxy - reference to the scripting object obtained through getObject method
568
563
  * @param guest - reference to the ssf guest
569
564
  * @returns cloned version of the scripting object
@@ -578,33 +573,53 @@ class SSFHost {
578
573
  Object.keys(proxy).forEach((propName) => {
579
574
  const propValue = proxy[propName];
580
575
  if (this.#isProxyEvent(propValue)) {
581
- const event = new Event({
582
- name: propValue.name,
583
- requiresFeedback: false,
584
- so
585
- });
576
+ let event;
577
+ if (propValue?.subscribe !== "function") {
578
+ event = new Event({
579
+ name: propValue.name || propName,
580
+ requiresFeedback: false,
581
+ so
582
+ });
583
+ } else {
584
+ event = new automation.Event();
585
+ }
586
586
  Object.defineProperty(so, propName, {
587
587
  value: event,
588
588
  enumerable: true
589
589
  });
590
- const listener = ({
591
- eventParams,
592
- eventOptions
593
- }) => this.dispatchEvent({
594
- event,
595
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
596
- eventParams,
597
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
598
- eventOptions
599
- });
600
- const token = guest.subscribe({
601
- eventId: propValue.id,
602
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
603
- callback: listener
604
- });
605
- unsubscribers.push(() => {
606
- guest.unsubscribe({ eventId: propValue.id, token });
607
- });
590
+ if (guest.subscribe) {
591
+ const listener = ({
592
+ eventParams,
593
+ eventOptions
594
+ }) => this.dispatchEvent({
595
+ event,
596
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
597
+ eventParams,
598
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
599
+ eventOptions
600
+ });
601
+ const token = guest.subscribe({
602
+ eventId: propValue.id,
603
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
604
+ callback: listener
605
+ });
606
+ unsubscribers.push(() => {
607
+ guest.unsubscribe({ eventId: propValue.id, token });
608
+ });
609
+ } else {
610
+ const token = propValue.subscribe?.(
611
+ (obj, params, options) => this.dispatchEvent({
612
+ event,
613
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
614
+ eventParams: params,
615
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
616
+ eventOptions: options
617
+ })
618
+ );
619
+ unsubscribers.push(() => {
620
+ propValue.unsubscribe?.(token);
621
+ });
622
+ }
608
623
  } else if (isFunction(propValue)) {
609
624
  Object.defineProperty(so, propName, {
610
625
  value: async (...args) => {
@@ -646,7 +661,6 @@ class SSFHost {
646
661
  };
647
662
  /**
648
663
  * dispatch event to guest application(s)
649
- *
650
664
  * @param {EventDetail} details details of the event to be dispatched
651
665
  * @returns promise that resolves to an array with result from each guest application
652
666
  */
@@ -718,7 +732,6 @@ class SSFHost {
718
732
  };
719
733
  /**
720
734
  * get reference to all guest applications
721
- *
722
735
  * @returns list of guest application references
723
736
  */
724
737
  getGuests = () => {
@@ -730,7 +743,6 @@ class SSFHost {
730
743
  };
731
744
  /**
732
745
  * get the scripting object by id
733
- *
734
746
  * @param objectId - id of the scripting object
735
747
  * @param params
736
748
  * @returns scripting object
@@ -738,7 +750,6 @@ class SSFHost {
738
750
  getScriptingObject = (objectId) => this.#soManager.getObject(objectId);
739
751
  /**
740
752
  * loads guest application inside sandboxed iframe
741
- *
742
753
  * @param {LoadGuestParam} param - parameters for loading the guest application
743
754
  * @returns reference to the guest object
744
755
  */
@@ -784,7 +795,6 @@ class SSFHost {
784
795
  };
785
796
  /**
786
797
  * loads guest application inside sandboxed iframe with different params
787
- *
788
798
  * @param {LoadGuestsParam} param - parameters for loading the guest application
789
799
  */
790
800
  loadGuests = (param) => {
@@ -809,7 +819,6 @@ class SSFHost {
809
819
  };
810
820
  /**
811
821
  * removes all scripting objects from host
812
- *
813
822
  * @param guestId unique id of the guest application
814
823
  */
815
824
  removeAllScriptingObjects = (guestId) => {
@@ -817,7 +826,6 @@ class SSFHost {
817
826
  };
818
827
  /**
819
828
  * removes scripting object from the host
820
- *
821
829
  * @param objectId unique id of the scripting object
822
830
  * @param guestId unique id of the guest application
823
831
  */
@@ -826,7 +834,6 @@ class SSFHost {
826
834
  };
827
835
  /**
828
836
  * set the log level for the host application
829
- *
830
837
  * @param level - log level
831
838
  */
832
839
  setLogLevel = (level) => {
@@ -836,7 +843,6 @@ class SSFHost {
836
843
  };
837
844
  /**
838
845
  * unloads guest application from host
839
- *
840
846
  * @param guestIdOrWindowOrEle unique id of the guest application or window object or dom element of the guest application
841
847
  * @throws Error if guestId or Window reference is invalid
842
848
  */
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Guest V1 -> V2 Host</title>
7
+ <style>
8
+ html,
9
+ body,
10
+ main {
11
+ height: 100%;
12
+ margin: 2px;
13
+ padding: 0;
14
+ }
15
+ iframe {
16
+ width: 100%;
17
+ height: 100%;
18
+ border: none;
19
+ }
20
+ #guest-container {
21
+ height: 100%;
22
+ }
23
+ </style>
24
+ <script src="https://qa.assets.rd.elliemae.io/pui-diagnostics@3"></script>
25
+ <script src="https://cdn.elliemae.io/elliemae/core/ssf/1.0/elli.ssf.guest.js"></script>
26
+ </head>
27
+ <body>
28
+ <h2>Guest V1 nesting Host V2</h2>
29
+ <div id="result">
30
+ <p id="loan-details"></p>
31
+ <p id="loan-pre-save-event-details"></p>
32
+ </div>
33
+ <div id="guest-container"></div>
34
+ <script type="module">
35
+ import { getGuestBaseUrl, getHost } from './utils.js';
36
+
37
+ const hostV2 = getHost();
38
+
39
+ const loadV2Guest = async () => {
40
+ const guestBaseUrl = await getGuestBaseUrl();
41
+ const { id } = hostV2.loadGuest({
42
+ id: 'guestV2',
43
+ url: new URL('./v2-guest.html', guestBaseUrl).href,
44
+ title: 'Guest V2',
45
+ targetElement: document.getElementById('guest-container'),
46
+ });
47
+ };
48
+
49
+ window.addEventListener('load', async () => {
50
+ await elli.script.connect();
51
+ const loan = await elli.script.getObject('Loan');
52
+ const details = await loan.getLoanDetails();
53
+ document.getElementById(
54
+ 'loan-details',
55
+ ).innerText = `Loan Data: ${JSON.stringify(details)}`;
56
+ elli.script.subscribe('loan', 'onPreSave', (loan, eventData) => {
57
+ document.getElementById(
58
+ 'loan-pre-save-event-details',
59
+ ).innerText = `Presave event data: ${JSON.stringify(eventData)}`;
60
+ return false;
61
+ });
62
+ hostV2.addScriptingObject(hostV2.cloneScriptingObject(loan, {}));
63
+ await loadV2Guest();
64
+ });
65
+ </script>
66
+ </body>
67
+ </html>