@elliemae/pui-app-sdk 4.2.5 → 4.2.6

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.
@@ -36,6 +36,7 @@ var import_manifest = require("../resources/manifest.js");
36
36
  const cssType = /\.css$/;
37
37
  const isCss = (fileName) => cssType.test(fileName);
38
38
  const activeApps = {};
39
+ const getPathName = (url) => url ? new URL(url).pathname : "";
39
40
  const initApplication = async ({
40
41
  id,
41
42
  name,
@@ -45,7 +46,12 @@ const initApplication = async ({
45
46
  manifestPath,
46
47
  homeRoute
47
48
  }) => {
48
- const app = (window.emui || {})[id] || {};
49
+ const app = window.emui?.[id];
50
+ if (!app) {
51
+ throw new Error(
52
+ `Application ${name} with ${id} is not found. Most probably the appId property of app.config.json is not set to ${id}`
53
+ );
54
+ }
49
55
  const { init } = app;
50
56
  if (!init || typeof init !== "function")
51
57
  throw new Error(
@@ -56,7 +62,7 @@ const initApplication = async ({
56
62
  host: import_host.CMicroAppHost.getInstance(),
57
63
  hostUrl,
58
64
  manifestPath,
59
- homeRoute,
65
+ homeRoute: homeRoute ?? getPathName(hostUrl),
60
66
  prevState,
61
67
  history,
62
68
  theme,
@@ -23,6 +23,7 @@ import {
23
23
  const cssType = /\.css$/;
24
24
  const isCss = (fileName) => cssType.test(fileName);
25
25
  const activeApps = {};
26
+ const getPathName = (url) => url ? new URL(url).pathname : "";
26
27
  const initApplication = async ({
27
28
  id,
28
29
  name,
@@ -32,7 +33,12 @@ const initApplication = async ({
32
33
  manifestPath,
33
34
  homeRoute
34
35
  }) => {
35
- const app = (window.emui || {})[id] || {};
36
+ const app = window.emui?.[id];
37
+ if (!app) {
38
+ throw new Error(
39
+ `Application ${name} with ${id} is not found. Most probably the appId property of app.config.json is not set to ${id}`
40
+ );
41
+ }
36
42
  const { init } = app;
37
43
  if (!init || typeof init !== "function")
38
44
  throw new Error(
@@ -43,7 +49,7 @@ const initApplication = async ({
43
49
  host: CMicroAppHost.getInstance(),
44
50
  hostUrl,
45
51
  manifestPath,
46
- homeRoute,
52
+ homeRoute: homeRoute ?? getPathName(hostUrl),
47
53
  prevState,
48
54
  history,
49
55
  theme,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-app-sdk",
3
- "version": "4.2.5",
3
+ "version": "4.2.6",
4
4
  "description": "ICE MT UI Platform Application SDK ",
5
5
  "sideEffects": [
6
6
  "*.css",