@elliemae/pui-app-sdk 5.22.0 → 5.23.0
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/analytics/index.js +2 -1
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/utils/micro-frontend/app-bridge.js +38 -0
- package/dist/cjs/utils/micro-frontend/guest.js +101 -14
- package/dist/cjs/utils/micro-frontend/host.js +36 -3
- package/dist/cjs/utils/micro-frontend/scripting-objects/analytics.js +8 -14
- package/dist/cjs/utils/micro-frontend/tests/app.config.json +200 -0
- package/dist/cjs/utils/micro-frontend/tests/utils.js +116 -0
- package/dist/cjs/utils/testing/index.js +15 -1
- package/dist/cjs/view/guest-microapp.js +113 -0
- package/dist/cjs/view/micro-iframe-app/iframe/index.js +1 -1
- package/dist/cjs/view/micro-iframe-app/iframe.html +5 -1
- package/dist/cjs/view/micro-iframe-app/use-frame-loaded.js +3 -1
- package/dist/cjs/view/tests/__snapshots__/guest-microapp.test.tsx.snap +21 -0
- package/dist/cjs/view/tests/__snapshots__/micro-iframe-app.test.tsx.snap +208 -0
- package/dist/cjs/view/tests/app.config.json +200 -0
- package/dist/cjs/view/tests/constants.js +44 -0
- package/dist/cjs/view/tests/flights/23.1/app.checksum1.css +3 -0
- package/dist/cjs/view/tests/flights/23.1/app.checksum1.js +52 -0
- package/dist/cjs/view/tests/flights/23.1/manifest.json +4 -0
- package/dist/cjs/view/tests/flights/latest/app.checksum.css +3 -0
- package/dist/cjs/view/tests/flights/latest/app.checksum.js +52 -0
- package/dist/cjs/view/tests/flights/latest/manifest.json +4 -0
- package/dist/cjs/view/tests/hotels/23.1/app.checksum.css +3 -0
- package/dist/cjs/view/tests/hotels/23.1/app.checksum.js +52 -0
- package/dist/cjs/view/tests/hotels/23.1/manifest.json +4 -0
- package/dist/cjs/view/tests/hotels/latest/app.checksum.css +3 -0
- package/dist/cjs/view/tests/hotels/latest/app.checksum.js +52 -0
- package/dist/cjs/view/tests/hotels/latest/manifest.json +4 -0
- package/dist/cjs/view/tests/loan/latest/index.js +116 -0
- package/dist/cjs/view/tests/loan/latest/manifest.json +3 -0
- package/dist/cjs/view/tests/scriptingObjects/appraisalServiceModule.js +81 -0
- package/dist/cjs/{utils/micro-frontend/host-app.js → view/tests/scriptingObjects/constant.js} +5 -10
- package/dist/cjs/view/tests/scriptingObjects/global.js +40 -0
- package/dist/cjs/view/tests/scriptingObjects/loan.js +200 -0
- package/dist/cjs/view/tests/server.js +29 -0
- package/dist/cjs/view/tests/serverHandlers.js +210 -0
- package/dist/cjs/view/tests/task/latest/index.dev.js +67 -0
- package/dist/cjs/view/tests/task/latest/index.js +67 -0
- package/dist/cjs/view/tests/task/latest/manifest.json +4 -0
- package/dist/cjs/view/tests/travelhub/23.1/app.checksum.css +3 -0
- package/dist/cjs/view/tests/travelhub/23.1/app.checksum.js +25 -0
- package/dist/cjs/view/tests/travelhub/23.1/landing.checksum1.css +3 -0
- package/dist/cjs/view/tests/travelhub/23.1/landing.checksum1.js +6 -0
- package/dist/cjs/view/tests/travelhub/23.1/manifest.json +6 -0
- package/dist/cjs/view/tests/travelhub/latest/app.checksum.css +3 -0
- package/dist/cjs/view/tests/travelhub/latest/app.checksum.js +30 -0
- package/dist/cjs/view/tests/travelhub/latest/landing.checksum.css +3 -0
- package/dist/cjs/view/tests/travelhub/latest/landing.checksum.js +8 -0
- package/dist/cjs/view/tests/travelhub/latest/manifest.json +6 -0
- package/dist/cjs/{utils/micro-frontend/ssfguest-adapter.js → view/tests/utils.js} +34 -29
- package/dist/esm/analytics/index.js +2 -1
- package/dist/esm/index.js +7 -1
- package/dist/esm/utils/micro-frontend/app-bridge.js +18 -0
- package/dist/esm/utils/micro-frontend/guest.js +101 -14
- package/dist/esm/utils/micro-frontend/host.js +36 -3
- package/dist/esm/utils/micro-frontend/scripting-objects/analytics.js +8 -4
- package/dist/esm/utils/micro-frontend/tests/app.config.json +200 -0
- package/dist/esm/utils/micro-frontend/tests/utils.js +96 -0
- package/dist/esm/utils/testing/index.js +5 -1
- package/dist/esm/view/guest-microapp.js +83 -0
- package/dist/esm/view/micro-iframe-app/iframe/index.js +1 -1
- package/dist/esm/view/micro-iframe-app/iframe.html +5 -1
- package/dist/esm/view/micro-iframe-app/use-frame-loaded.js +3 -1
- package/dist/esm/view/tests/__snapshots__/guest-microapp.test.tsx.snap +21 -0
- package/dist/esm/view/tests/__snapshots__/micro-iframe-app.test.tsx.snap +208 -0
- package/dist/esm/view/tests/app.config.json +200 -0
- package/dist/esm/view/tests/constants.js +24 -0
- package/dist/esm/view/tests/flights/23.1/app.checksum1.css +3 -0
- package/dist/esm/view/tests/flights/23.1/app.checksum1.js +51 -0
- package/dist/esm/view/tests/flights/23.1/manifest.json +4 -0
- package/dist/esm/view/tests/flights/latest/app.checksum.css +3 -0
- package/dist/esm/view/tests/flights/latest/app.checksum.js +51 -0
- package/dist/esm/view/tests/flights/latest/manifest.json +4 -0
- package/dist/esm/view/tests/hotels/23.1/app.checksum.css +3 -0
- package/dist/esm/view/tests/hotels/23.1/app.checksum.js +51 -0
- package/dist/esm/view/tests/hotels/23.1/manifest.json +4 -0
- package/dist/esm/view/tests/hotels/latest/app.checksum.css +3 -0
- package/dist/esm/view/tests/hotels/latest/app.checksum.js +51 -0
- package/dist/esm/view/tests/hotels/latest/manifest.json +4 -0
- package/dist/esm/view/tests/loan/latest/index.js +115 -0
- package/dist/esm/view/tests/loan/latest/manifest.json +3 -0
- package/dist/esm/view/tests/scriptingObjects/appraisalServiceModule.js +63 -0
- package/dist/esm/view/tests/scriptingObjects/constant.js +4 -0
- package/dist/esm/view/tests/scriptingObjects/global.js +22 -0
- package/dist/esm/view/tests/scriptingObjects/loan.js +180 -0
- package/dist/esm/view/tests/server.js +9 -0
- package/dist/esm/view/tests/serverHandlers.js +180 -0
- package/dist/esm/view/tests/task/latest/index.dev.js +66 -0
- package/dist/esm/view/tests/task/latest/index.js +66 -0
- package/dist/esm/view/tests/task/latest/manifest.json +4 -0
- package/dist/esm/view/tests/travelhub/23.1/app.checksum.css +3 -0
- package/dist/esm/view/tests/travelhub/23.1/app.checksum.js +24 -0
- package/dist/esm/view/tests/travelhub/23.1/landing.checksum1.css +3 -0
- package/dist/esm/view/tests/travelhub/23.1/landing.checksum1.js +5 -0
- package/dist/esm/view/tests/travelhub/23.1/manifest.json +6 -0
- package/dist/esm/view/tests/travelhub/latest/app.checksum.css +3 -0
- package/dist/esm/view/tests/travelhub/latest/app.checksum.js +29 -0
- package/dist/esm/view/tests/travelhub/latest/landing.checksum.css +3 -0
- package/dist/esm/view/tests/travelhub/latest/landing.checksum.js +7 -0
- package/dist/esm/view/tests/travelhub/latest/manifest.json +6 -0
- package/dist/esm/view/tests/utils.js +33 -0
- package/dist/types/lib/index.d.ts +2 -1
- package/dist/types/lib/utils/micro-frontend/app-bridge.d.ts +4 -0
- package/dist/types/lib/utils/micro-frontend/guest.d.ts +46 -11
- package/dist/types/lib/utils/micro-frontend/host.d.ts +27 -10
- package/dist/types/lib/utils/micro-frontend/scripting-objects/analytics.d.ts +8 -5
- package/dist/types/lib/utils/micro-frontend/tests/utils.d.ts +39 -0
- package/dist/types/lib/utils/micro-frontend/types.d.ts +2 -1
- package/dist/types/lib/utils/testing/index.d.ts +57 -1
- package/dist/types/lib/utils/window.d.ts +13 -6
- package/dist/types/lib/view/guest-microapp.d.ts +13 -0
- package/dist/types/lib/view/micro-app/index.d.ts +5 -0
- package/dist/types/lib/view/micro-iframe-app/index.d.ts +5 -0
- package/dist/types/lib/view/tests/constants.d.ts +11 -0
- package/dist/types/lib/view/tests/flights/23.1/app.checksum1.d.ts +7 -0
- package/dist/types/lib/view/tests/flights/latest/app.checksum.d.ts +7 -0
- package/dist/types/lib/view/tests/hotels/23.1/app.checksum.d.ts +7 -0
- package/dist/types/lib/view/tests/hotels/latest/app.checksum.d.ts +7 -0
- package/dist/types/lib/view/tests/loan/latest/index.d.ts +11 -0
- package/dist/types/lib/view/tests/micro-iframe-app.test.d.ts +1 -0
- package/dist/types/lib/view/tests/scriptingObjects/appraisalServiceModule.d.ts +36 -0
- package/dist/types/lib/view/tests/scriptingObjects/constant.d.ts +1 -0
- package/dist/types/lib/view/tests/scriptingObjects/global.d.ts +9 -0
- package/dist/types/lib/view/tests/scriptingObjects/loan.d.ts +31 -0
- package/dist/types/lib/view/tests/server.d.ts +1 -0
- package/dist/types/lib/view/tests/serverHandlers.d.ts +5 -0
- package/dist/types/lib/view/tests/task/latest/index.d.ts +10 -0
- package/dist/types/lib/view/tests/task/latest/index.dev.d.ts +10 -0
- package/dist/types/lib/view/tests/travelhub/23.1/app.checksum.d.ts +7 -0
- package/dist/types/lib/view/tests/travelhub/23.1/landing.checksum1.d.ts +2 -0
- package/dist/types/lib/view/tests/travelhub/latest/app.checksum.d.ts +0 -0
- package/dist/types/lib/view/tests/travelhub/latest/landing.checksum.d.ts +0 -0
- package/dist/types/lib/view/tests/utils.d.ts +7 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -44
- package/dist/esm/utils/micro-frontend/host-app.js +0 -9
- package/dist/esm/utils/micro-frontend/ssfguest-adapter.js +0 -28
- package/dist/types/lib/utils/micro-frontend/host-app.d.ts +0 -11
- package/dist/types/lib/utils/micro-frontend/ssfguest-adapter.d.ts +0 -7
- /package/dist/types/lib/{utils/micro-frontend/tests/guest-ssf-host.test.d.ts → view/tests/guest-microapp.test.d.ts} +0 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
{
|
|
2
|
+
"appId": "microfe",
|
|
3
|
+
"activeEnv": "localhost",
|
|
4
|
+
"googleTagManager": true,
|
|
5
|
+
"sessionTimeoutWarnInterval": "7200000",
|
|
6
|
+
"sessionTimeoutInterval": "9000000",
|
|
7
|
+
"microFrontendApps": {
|
|
8
|
+
"loanapp": {
|
|
9
|
+
"name": "Loan",
|
|
10
|
+
"hostUrl": "./loan",
|
|
11
|
+
"development": {
|
|
12
|
+
"files": ["index.js"]
|
|
13
|
+
},
|
|
14
|
+
"production": {
|
|
15
|
+
"files": ["index.js"]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"taskapp": {
|
|
19
|
+
"name": "Task",
|
|
20
|
+
"hostUrl": "./task",
|
|
21
|
+
"mode": "development",
|
|
22
|
+
"development": {
|
|
23
|
+
"files": ["index.dev.js"]
|
|
24
|
+
},
|
|
25
|
+
"production": {
|
|
26
|
+
"files": ["index.js"]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"travelhub": {
|
|
30
|
+
"name": "TravelHub",
|
|
31
|
+
"hostUrl": "./travelhub",
|
|
32
|
+
"development": {
|
|
33
|
+
"files": ["app.js", "landing.js", "app.css", "landing.css"]
|
|
34
|
+
},
|
|
35
|
+
"production": {
|
|
36
|
+
"files": ["app.js", "landing.js", "app.css", "landing.css"]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"flights": {
|
|
40
|
+
"name": "Flights",
|
|
41
|
+
"hostUrl": "./flights",
|
|
42
|
+
"development": {
|
|
43
|
+
"files": ["app.js", "app.css"]
|
|
44
|
+
},
|
|
45
|
+
"production": {
|
|
46
|
+
"files": ["app.js", "app.css"]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"hotels": {
|
|
50
|
+
"name": "Hotels",
|
|
51
|
+
"hostUrl": "./hotels",
|
|
52
|
+
"development": {
|
|
53
|
+
"files": ["app.js", "app.css"]
|
|
54
|
+
},
|
|
55
|
+
"production": {
|
|
56
|
+
"files": ["app.js", "app.css"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"serviceEndpoints": {
|
|
61
|
+
"api": "",
|
|
62
|
+
"idp": "https://int.idp.ellielabs.com",
|
|
63
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
64
|
+
},
|
|
65
|
+
"env": {
|
|
66
|
+
"localhost": {
|
|
67
|
+
"serviceEndpoints": {
|
|
68
|
+
"api": "",
|
|
69
|
+
"idp": "https://int.idp.ellielabs.com",
|
|
70
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"dev": {
|
|
74
|
+
"serviceEndpoints": {
|
|
75
|
+
"api": "https://dev.api.puiservice.rd.elliemae.io",
|
|
76
|
+
"idp": "https://int.idp.ellielabs.com",
|
|
77
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"dev2": {
|
|
81
|
+
"serviceEndpoints": {
|
|
82
|
+
"api": "https://int.api.ellielabs.com",
|
|
83
|
+
"idp": "https://int.idp.ellielabs.com",
|
|
84
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"qa": {
|
|
88
|
+
"serviceEndpoints": {
|
|
89
|
+
"api": "https://dev.api.puiservice.rd.elliemae.io",
|
|
90
|
+
"idp": "https://int.idp.ellielabs.com",
|
|
91
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"qa2": {
|
|
95
|
+
"serviceEndpoints": {
|
|
96
|
+
"api": "https://int.api.ellielabs.com",
|
|
97
|
+
"idp": "https://int.idp.ellielabs.com",
|
|
98
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"qa3": {
|
|
102
|
+
"serviceEndpoints": {
|
|
103
|
+
"api": "https://int.api.ellielabs.com",
|
|
104
|
+
"idp": "https://int.idp.ellielabs.com",
|
|
105
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"int": {
|
|
109
|
+
"serviceEndpoints": {
|
|
110
|
+
"api": "https://int.api.ellielabs.com",
|
|
111
|
+
"idp": "https://int.idp.ellielabs.com",
|
|
112
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"peg-osb1": {
|
|
116
|
+
"serviceEndpoints": {
|
|
117
|
+
"api": "https://encompass-peg-api.elliemae.com",
|
|
118
|
+
"idp": "https://peg.idp.ellielabs.com/authorize",
|
|
119
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"peg-osb2": {
|
|
123
|
+
"serviceEndpoints": {
|
|
124
|
+
"api": "https://encompass-peg2-api.elliemae.com",
|
|
125
|
+
"idp": "https://peg.idp.ellielabs.com/authorize",
|
|
126
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"peg": {
|
|
130
|
+
"serviceEndpoints": {
|
|
131
|
+
"api": "https://peg2-west.api.ellielabs.com",
|
|
132
|
+
"idp": "https://peg.idp.ellielabs.com/authorize",
|
|
133
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"peg-oapi-west": {
|
|
137
|
+
"serviceEndpoints": {
|
|
138
|
+
"api": "https://peg2-west.api.ellielabs.com",
|
|
139
|
+
"idp": "https://peg.idp.ellielabs.com/authorize",
|
|
140
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"peg-oapi-east": {
|
|
144
|
+
"serviceEndpoints": {
|
|
145
|
+
"api": "https://peg2-east.api.ellielabs.com",
|
|
146
|
+
"idp": "https://peg.idp.ellielabs.com/authorize",
|
|
147
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"peg2-oapi-east": {
|
|
151
|
+
"serviceEndpoints": {
|
|
152
|
+
"api": "https://peg2-east.api.ellielabs.com",
|
|
153
|
+
"idp": "https://peg.idp.ellielabs.com/authorize",
|
|
154
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"peg3": {
|
|
158
|
+
"serviceEndpoints": {
|
|
159
|
+
"api": "https://pel1.api.ellielabs.com",
|
|
160
|
+
"idp": "https://peg3.idp.ellielabs.com/authorize",
|
|
161
|
+
"logger": "https://int.api.ellielabs.com/diagnostics/v2/logging"
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"stage": {
|
|
165
|
+
"serviceEndpoints": {
|
|
166
|
+
"api": "https://stg.api.elliemae.com",
|
|
167
|
+
"idp": "https://stg.idp.elliemae.com/authorize",
|
|
168
|
+
"logger": "https://api.ellielabs.com/diagnostics/v2/logging"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"beta": {
|
|
172
|
+
"serviceEndpoints": {
|
|
173
|
+
"api": "https://concept.api.elliemae.com",
|
|
174
|
+
"idp": "https://concept.idp.elliemae.com/authorize",
|
|
175
|
+
"logger": "https://api.ellielabs.com/diagnostics/v2/logging"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
"demo": {
|
|
179
|
+
"serviceEndpoints": {
|
|
180
|
+
"api": "https://concept.api.elliemae.com",
|
|
181
|
+
"idp": "https://concept.idp.elliemae.com/authorize",
|
|
182
|
+
"logger": "https://api.ellielabs.com/diagnostics/v2/logging"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"epc": {
|
|
186
|
+
"serviceEndpoints": {
|
|
187
|
+
"api": "https://concept.api.elliemae.com",
|
|
188
|
+
"idp": "https://concept.idp.elliemae.com/authorize",
|
|
189
|
+
"logger": "https://api.ellielabs.com/diagnostics/v2/logging"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"prod": {
|
|
193
|
+
"serviceEndpoints": {
|
|
194
|
+
"api": "https://api.elliemae.com",
|
|
195
|
+
"idp": "https://idp.elliemae.com/authorize",
|
|
196
|
+
"logger": "https://api.ellielabs.com/diagnostics/v2/logging"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { MessageType } from "@elliemae/microfe-common";
|
|
2
|
+
const applicationScriptingObject = {
|
|
3
|
+
object: {
|
|
4
|
+
events: [],
|
|
5
|
+
functions: [
|
|
6
|
+
"closeModal",
|
|
7
|
+
"extend",
|
|
8
|
+
"getApplicationContext",
|
|
9
|
+
"getCapabilities",
|
|
10
|
+
"getCompanySettings",
|
|
11
|
+
"getDescriptor",
|
|
12
|
+
"getPersonaAccess",
|
|
13
|
+
"getPoliciesDetails",
|
|
14
|
+
"getUserAccessRights",
|
|
15
|
+
"hideSpinner",
|
|
16
|
+
"keepSessionAlive",
|
|
17
|
+
"log",
|
|
18
|
+
"navigate",
|
|
19
|
+
"open",
|
|
20
|
+
"openModal",
|
|
21
|
+
"performAction",
|
|
22
|
+
"print",
|
|
23
|
+
"showError",
|
|
24
|
+
"showSpinner",
|
|
25
|
+
"supportsAction",
|
|
26
|
+
"supportsNavigateTo"
|
|
27
|
+
],
|
|
28
|
+
objectId: "application",
|
|
29
|
+
objectType: "Object"
|
|
30
|
+
},
|
|
31
|
+
type: "object"
|
|
32
|
+
};
|
|
33
|
+
const authScriptingObject = {
|
|
34
|
+
object: {
|
|
35
|
+
events: [],
|
|
36
|
+
functions: ["getAccessToken", "createAuthCode", "getUser"],
|
|
37
|
+
objectId: "auth",
|
|
38
|
+
objectType: "Object"
|
|
39
|
+
},
|
|
40
|
+
type: "object"
|
|
41
|
+
};
|
|
42
|
+
const hostObjects = {
|
|
43
|
+
application: applicationScriptingObject,
|
|
44
|
+
auth: authScriptingObject
|
|
45
|
+
};
|
|
46
|
+
const getOrigin = (url) => {
|
|
47
|
+
if (!url || url === "about:blank") return "*";
|
|
48
|
+
try {
|
|
49
|
+
const { origin } = new URL(url);
|
|
50
|
+
return origin === "null" || !origin ? url : origin;
|
|
51
|
+
} catch (e) {
|
|
52
|
+
const { origin } = new URL(url, document.baseURI);
|
|
53
|
+
return origin;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const postMessage = ({
|
|
57
|
+
srcWindow,
|
|
58
|
+
targetWindow,
|
|
59
|
+
message
|
|
60
|
+
}) => {
|
|
61
|
+
targetWindow.dispatchEvent(
|
|
62
|
+
new MessageEvent("message", {
|
|
63
|
+
source: srcWindow,
|
|
64
|
+
origin: getOrigin(srcWindow.location.href),
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
66
|
+
data: {
|
|
67
|
+
source: "elli:remoting",
|
|
68
|
+
...message
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
const setupHost = (hostWindow) => {
|
|
74
|
+
const onMessage = ({ data }) => {
|
|
75
|
+
if (data?.type !== MessageType.ObjectGet) return;
|
|
76
|
+
const scriptingObject = hostObjects[data?.body?.objectId ?? ""] ?? null;
|
|
77
|
+
if (scriptingObject)
|
|
78
|
+
postMessage({
|
|
79
|
+
srcWindow: hostWindow,
|
|
80
|
+
targetWindow: window,
|
|
81
|
+
message: {
|
|
82
|
+
body: scriptingObject,
|
|
83
|
+
type: "elli:remoting:response",
|
|
84
|
+
requestId: data.requestId
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
hostWindow?.addEventListener?.("message", onMessage);
|
|
89
|
+
return () => hostWindow?.removeEventListener?.("message", onMessage);
|
|
90
|
+
};
|
|
91
|
+
export {
|
|
92
|
+
applicationScriptingObject,
|
|
93
|
+
authScriptingObject,
|
|
94
|
+
postMessage,
|
|
95
|
+
setupHost
|
|
96
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { render } from "@testing-library/react";
|
|
3
|
+
import userEvent from "@testing-library/user-event";
|
|
3
4
|
import { getDefaultTheme } from "@elliemae/pui-theme";
|
|
4
5
|
import { createAppStore } from "../../data/store.js";
|
|
5
6
|
import { AppRoot } from "../../view/app-root/index.js";
|
|
@@ -11,7 +12,10 @@ const AllTheProviders = ({
|
|
|
11
12
|
theme = defaultTheme,
|
|
12
13
|
children
|
|
13
14
|
}) => /* @__PURE__ */ jsx(AppRoot, { store, history: browserHistory, theme, children });
|
|
14
|
-
const customRender = (ui, options) =>
|
|
15
|
+
const customRender = (ui, options) => ({
|
|
16
|
+
user: userEvent.setup(),
|
|
17
|
+
...render(ui, { wrapper: AllTheProviders, ...options })
|
|
18
|
+
});
|
|
15
19
|
export * from "@testing-library/react";
|
|
16
20
|
export {
|
|
17
21
|
customRender as render
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useLayoutEffect, useRef } from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { useDispatch } from "react-redux";
|
|
5
|
+
import { getAppBridge } from "../utils/micro-frontend/app-bridge.js";
|
|
6
|
+
import { waitMessage } from "../data/wait-message/actions.js";
|
|
7
|
+
import { getLogger } from "../utils/micro-frontend/index.js";
|
|
8
|
+
const Div = styled.div`
|
|
9
|
+
display: flex;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
`;
|
|
15
|
+
const useAppRenderer = (props) => {
|
|
16
|
+
const { id, history, onLoadComplete, onUnloadComplete, containerId } = props;
|
|
17
|
+
const dispatch = useDispatch();
|
|
18
|
+
useLayoutEffect(() => {
|
|
19
|
+
let isMounted = true;
|
|
20
|
+
let appBridge = null;
|
|
21
|
+
let unloadInProgress = Promise.resolve();
|
|
22
|
+
let instanceId = null;
|
|
23
|
+
(async () => {
|
|
24
|
+
await unloadInProgress;
|
|
25
|
+
dispatch(waitMessage.open());
|
|
26
|
+
try {
|
|
27
|
+
appBridge = await getAppBridge();
|
|
28
|
+
if (!appBridge)
|
|
29
|
+
throw new Error(`Failed to load ${id}, AppBridge not initialized`);
|
|
30
|
+
if (isMounted) {
|
|
31
|
+
instanceId = await appBridge.openApp({
|
|
32
|
+
id,
|
|
33
|
+
frameOptions: { containerId },
|
|
34
|
+
history
|
|
35
|
+
});
|
|
36
|
+
setTimeout(() => {
|
|
37
|
+
try {
|
|
38
|
+
onLoadComplete?.(instanceId);
|
|
39
|
+
} catch (ex) {
|
|
40
|
+
}
|
|
41
|
+
}, 0);
|
|
42
|
+
}
|
|
43
|
+
} catch (ex) {
|
|
44
|
+
getLogger().error({
|
|
45
|
+
message: `Failed to load ${id}`,
|
|
46
|
+
exception: ex
|
|
47
|
+
});
|
|
48
|
+
isMounted = false;
|
|
49
|
+
if (appBridge && instanceId)
|
|
50
|
+
unloadInProgress = appBridge.closeApp(instanceId);
|
|
51
|
+
throw ex;
|
|
52
|
+
} finally {
|
|
53
|
+
dispatch(waitMessage.close());
|
|
54
|
+
}
|
|
55
|
+
})();
|
|
56
|
+
return () => {
|
|
57
|
+
isMounted = false;
|
|
58
|
+
if (appBridge) {
|
|
59
|
+
unloadInProgress = appBridge.closeApp(instanceId);
|
|
60
|
+
unloadInProgress.then(() => {
|
|
61
|
+
instanceId = null;
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
try {
|
|
64
|
+
onUnloadComplete?.();
|
|
65
|
+
} catch (ex) {
|
|
66
|
+
}
|
|
67
|
+
}, 0);
|
|
68
|
+
}).catch(() => {
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}, [containerId, dispatch, history, id, onLoadComplete, onUnloadComplete]);
|
|
73
|
+
};
|
|
74
|
+
const GuestMicroApp = memo(
|
|
75
|
+
(props) => {
|
|
76
|
+
const containerId = useRef(crypto.randomUUID());
|
|
77
|
+
useAppRenderer({ ...props, containerId: containerId.current });
|
|
78
|
+
return /* @__PURE__ */ jsx(Div, { id: containerId.current });
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
export {
|
|
82
|
+
GuestMicroApp
|
|
83
|
+
};
|
|
@@ -69,6 +69,10 @@
|
|
|
69
69
|
<strong>JavaScript has been disabled on your browser</strong>, please
|
|
70
70
|
<strong>enable JS</strong> to make this app work.</noscript
|
|
71
71
|
>
|
|
72
|
-
<div
|
|
72
|
+
<div
|
|
73
|
+
id="pui-app-container-"
|
|
74
|
+
data-testid="pui-app-container-"
|
|
75
|
+
class="full-width full-height"
|
|
76
|
+
></div>
|
|
73
77
|
</body>
|
|
74
78
|
</html>
|
|
@@ -2,6 +2,7 @@ import { useEffect } from "react";
|
|
|
2
2
|
import { trackActivity } from "../../utils/session.js";
|
|
3
3
|
import { CMicroAppHost } from "../../utils/micro-frontend/host.js";
|
|
4
4
|
import { getMicroFrontEndAppConfig } from "../../utils/micro-frontend/index.js";
|
|
5
|
+
import { APP_CONTAINER_ID_PREFIX } from "../micro-app/const.js";
|
|
5
6
|
const addBaseTag = (id, documentEle) => {
|
|
6
7
|
const { hostUrl, manifestPath } = getMicroFrontEndAppConfig({
|
|
7
8
|
id
|
|
@@ -13,9 +14,10 @@ const addBaseTag = (id, documentEle) => {
|
|
|
13
14
|
documentEle.getElementsByTagName("head")[0].appendChild(base);
|
|
14
15
|
};
|
|
15
16
|
const updateContainerId = (id, documentEle) => {
|
|
16
|
-
const ele = documentEle.getElementById(
|
|
17
|
+
const ele = documentEle.getElementById(APP_CONTAINER_ID_PREFIX);
|
|
17
18
|
if (ele) {
|
|
18
19
|
ele.id = `${ele.id}${id}`;
|
|
20
|
+
ele.dataset.testid = ele.id;
|
|
19
21
|
}
|
|
20
22
|
};
|
|
21
23
|
const useFrameLoaded = ({ id, documentEle }) => {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`MicroAppV2 should open loanapp and call init and mount methods 1`] = `
|
|
4
|
+
Document {
|
|
5
|
+
"location": Location {
|
|
6
|
+
"assign": [Function],
|
|
7
|
+
"hash": "",
|
|
8
|
+
"host": "localhost:3111",
|
|
9
|
+
"hostname": "localhost",
|
|
10
|
+
"href": "http://localhost:3111/frame.html",
|
|
11
|
+
"origin": "http://localhost:3111",
|
|
12
|
+
"pathname": "/frame.html",
|
|
13
|
+
"port": "3111",
|
|
14
|
+
"protocol": "http:",
|
|
15
|
+
"reload": [Function],
|
|
16
|
+
"replace": [Function],
|
|
17
|
+
"search": "",
|
|
18
|
+
"toString": [Function],
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`MicroIFrameApp should close previous instance of app before loading new instance 2`] = `
|
|
4
|
+
<body
|
|
5
|
+
class="full-width full-height"
|
|
6
|
+
>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<!-- Display a message if JS has been disabled on the browser. -->
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<noscript>
|
|
13
|
+
If you're seeing this message, that means
|
|
14
|
+
<strong>JavaScript has been disabled on your browser</strong>, please
|
|
15
|
+
<strong>enable JS</strong> to make this app work.
|
|
16
|
+
</noscript>
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<div
|
|
20
|
+
class="full-width full-height"
|
|
21
|
+
data-testid="pui-app-container-loanapp"
|
|
22
|
+
id="pui-app-container-loanapp"
|
|
23
|
+
>
|
|
24
|
+
<main>
|
|
25
|
+
<h1>
|
|
26
|
+
Loan App
|
|
27
|
+
</h1>
|
|
28
|
+
<p>
|
|
29
|
+
Go to
|
|
30
|
+
<a
|
|
31
|
+
href="#"
|
|
32
|
+
>
|
|
33
|
+
Pipeline
|
|
34
|
+
</a>
|
|
35
|
+
</p>
|
|
36
|
+
</main>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<script
|
|
43
|
+
id="emui-script-Loan-1"
|
|
44
|
+
src="http://localhost:3111/loan/latest/index.js"
|
|
45
|
+
/>
|
|
46
|
+
</body>
|
|
47
|
+
`;
|
|
48
|
+
|
|
49
|
+
exports[`MicroIFrameApp should open loanapp and call init and mount methods 1`] = `
|
|
50
|
+
<head>
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
<!-- The first thing in any HTML file should be the charset -->
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
<meta
|
|
57
|
+
charset="utf-8"
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
<!-- Make the page mobile compatible -->
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
<meta
|
|
65
|
+
content="width=device-width, initial-scale=1"
|
|
66
|
+
name="viewport"
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
<!-- Allow installing the app to the homescreen -->
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<meta
|
|
74
|
+
content="yes"
|
|
75
|
+
name="mobile-web-app-capable"
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<link
|
|
80
|
+
href="/favicon.ico"
|
|
81
|
+
rel="icon"
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<title>
|
|
86
|
+
Application
|
|
87
|
+
</title>
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
<!-- Google Tag Manager -->
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
<!-- <script nonce="__CSP_NONCE__">
|
|
94
|
+
(function (w, d, s, l, i) {
|
|
95
|
+
w[l] = w[l] || [];
|
|
96
|
+
w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
|
|
97
|
+
var f = d.getElementsByTagName(s)[0],
|
|
98
|
+
j = d.createElement(s),
|
|
99
|
+
dl = l != 'dataLayer' ? '&l=' + l : '';
|
|
100
|
+
j.async = true;
|
|
101
|
+
j.src =
|
|
102
|
+
'https://www.googletagmanager.com/gtm.js?id=' +
|
|
103
|
+
i +
|
|
104
|
+
dl;
|
|
105
|
+
f.parentNode.insertBefore(j, f);
|
|
106
|
+
})(window, document, 'script', 'dataLayer', window.emui.gtm.id);
|
|
107
|
+
</script> -->
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<!-- <script nonce="__CSP_NONCE__">
|
|
111
|
+
window.emuiUserMonitoring = window.parent.emuiUserMonitoring || {
|
|
112
|
+
setCustomVirtualPageName: function () {},
|
|
113
|
+
startVirtualPageMonitoringWithAutoEnd: function () {},
|
|
114
|
+
};
|
|
115
|
+
</script> -->
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
<script
|
|
119
|
+
src="https://www.google-analytics.com/analytics.js"
|
|
120
|
+
/>
|
|
121
|
+
<script>
|
|
122
|
+
|
|
123
|
+
(function (i, s, o, g, r, a, m) {
|
|
124
|
+
i['GoogleAnalyticsObject'] = r;
|
|
125
|
+
(i[r] =
|
|
126
|
+
i[r] ||
|
|
127
|
+
function () {
|
|
128
|
+
(i[r].q = i[r].q || []).push(arguments);
|
|
129
|
+
}),
|
|
130
|
+
(i[r].l = 1 * new Date());
|
|
131
|
+
(a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);
|
|
132
|
+
a.async = 1;
|
|
133
|
+
a.src = g;
|
|
134
|
+
m.parentNode.insertBefore(a, m);
|
|
135
|
+
})(
|
|
136
|
+
window,
|
|
137
|
+
document,
|
|
138
|
+
'script',
|
|
139
|
+
'https://www.google-analytics.com/analytics.js',
|
|
140
|
+
'ga',
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
</script>
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
<style>
|
|
147
|
+
|
|
148
|
+
.full-width {
|
|
149
|
+
width: 100%;
|
|
150
|
+
}
|
|
151
|
+
.full-height {
|
|
152
|
+
height: 100%;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
</style>
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
<base
|
|
159
|
+
href="http://localhost:3111/loan/latest"
|
|
160
|
+
/>
|
|
161
|
+
</head>
|
|
162
|
+
`;
|
|
163
|
+
|
|
164
|
+
exports[`MicroIFrameApp should open loanapp and call init and mount methods 2`] = `
|
|
165
|
+
<body
|
|
166
|
+
class="full-width full-height"
|
|
167
|
+
>
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
<!-- Display a message if JS has been disabled on the browser. -->
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
<noscript>
|
|
174
|
+
If you're seeing this message, that means
|
|
175
|
+
<strong>JavaScript has been disabled on your browser</strong>, please
|
|
176
|
+
<strong>enable JS</strong> to make this app work.
|
|
177
|
+
</noscript>
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
<div
|
|
181
|
+
class="full-width full-height"
|
|
182
|
+
data-testid="pui-app-container-loanapp"
|
|
183
|
+
id="pui-app-container-loanapp"
|
|
184
|
+
>
|
|
185
|
+
<main>
|
|
186
|
+
<h1>
|
|
187
|
+
Loan App
|
|
188
|
+
</h1>
|
|
189
|
+
<p>
|
|
190
|
+
Go to
|
|
191
|
+
<a
|
|
192
|
+
href="#"
|
|
193
|
+
>
|
|
194
|
+
Pipeline
|
|
195
|
+
</a>
|
|
196
|
+
</p>
|
|
197
|
+
</main>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
<script
|
|
204
|
+
id="emui-script-Loan-1"
|
|
205
|
+
src="http://localhost:3111/loan/latest/index.js"
|
|
206
|
+
/>
|
|
207
|
+
</body>
|
|
208
|
+
`;
|