@elliemae/pui-app-sdk 3.0.0-beta.2 → 3.0.0-beta.3

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.
@@ -25,9 +25,18 @@ __export(exports, {
25
25
  pageViewEvent: () => pageViewEvent
26
26
  });
27
27
  var import__ = __toModule(require("."));
28
+ const getWindow = () => {
29
+ try {
30
+ window.top?.document;
31
+ return window.top || window.self;
32
+ } catch (e) {
33
+ return window.self;
34
+ }
35
+ };
28
36
  const pageViewEvent = ({ pageTitle }) => {
29
- const { pathname, href } = (window.top || window.self).location;
30
- const { title } = (window.top || window.self).document;
37
+ const pageWindow = getWindow();
38
+ const { pathname, href } = pageWindow.location;
39
+ const { title } = pageWindow.document;
31
40
  const { pathname: guestPagePath, href: guestPageUrl } = window.location;
32
41
  const { title: guestPageTitle } = document;
33
42
  (0, import__.sendBAEvent)({
package/dist/cjs/index.js CHANGED
@@ -62,6 +62,7 @@ __export(exports, {
62
62
  enableReactAppForHostIntegration: () => import_react.enableReactAppForHostIntegration,
63
63
  error: () => import_error.actions,
64
64
  fetchHostAppData: () => import_fetch_host_app_data.fetchHostAppData,
65
+ fetchUserSettings: () => import_users.getUser,
65
66
  getApiActionCreator: () => import_helpers2.getApiActionCreator,
66
67
  getAppConfigValue: () => import_config.getAppConfigValue,
67
68
  getAuthHTTPClient: () => import_http_client.getAuthHTTPClient,
@@ -156,6 +157,7 @@ var import_render_with_redux = __toModule(require("./utils/testing/render-with-r
156
157
  var import_render_with_router = __toModule(require("./utils/testing/render-with-router"));
157
158
  var import_render_with_state_addons = __toModule(require("./utils/testing/render-with-state-addons"));
158
159
  var import_helpers2 = __toModule(require("./api/helpers"));
160
+ var import_users = __toModule(require("./api/users"));
159
161
  var import_useMediaBreakpoints = __toModule(require("./view/useMediaBreakpoints"));
160
162
  var import_decorator = __toModule(require("./view/storybook/decorator"));
161
163
  var import_header = __toModule(require("./view/header"));
@@ -36,6 +36,7 @@ const useAppWillRender = ({
36
36
  documentEle,
37
37
  history,
38
38
  theme,
39
+ homeRoute,
39
40
  onUnloadComplete
40
41
  }) => {
41
42
  const dispatch = import_react_redux.useDispatch ? (0, import_react_redux.useDispatch)() : null;
@@ -75,11 +76,12 @@ const useAppWillRender = ({
75
76
  const appConfig = (0, import_lodash.merge)(getConfig(), {
76
77
  documentEle,
77
78
  history,
78
- theme
79
+ theme,
80
+ homeRoute
79
81
  });
80
82
  load(appConfig);
81
83
  return () => {
82
84
  ref.current = unload(appConfig);
83
85
  };
84
- }, [documentEle, getConfig, history, theme, load, unload]);
86
+ }, [documentEle, getConfig, history, theme, homeRoute, load, unload]);
85
87
  };
@@ -29,12 +29,16 @@ var import_pubsub_js = __toModule(require("pubsub-js"));
29
29
  var import_constants = __toModule(require("../../utils/constants"));
30
30
  const WindowSize = () => {
31
31
  (0, import_react.useEffect)(() => {
32
- const observer = new ResizeObserver((entries) => {
33
- (0, import_pubsub_js.publish)(import_constants.HOST_WINDOW_RESIZED, entries && entries[0]);
34
- });
35
- observer.observe(window.document.documentElement);
32
+ if (window.ResizeObserver) {
33
+ const observer = new ResizeObserver((entries) => {
34
+ (0, import_pubsub_js.publish)(import_constants.HOST_WINDOW_RESIZED, entries && entries[0]);
35
+ });
36
+ observer.observe(window.document.documentElement);
37
+ return () => {
38
+ observer.unobserve(window.document.documentElement);
39
+ };
40
+ }
36
41
  return () => {
37
- observer.unobserve(window.document.documentElement);
38
42
  };
39
43
  }, []);
40
44
  return /* @__PURE__ */ React.createElement(React.Fragment, null);
@@ -1,7 +1,16 @@
1
1
  import { sendBAEvent } from ".";
2
+ const getWindow = () => {
3
+ try {
4
+ window.top?.document;
5
+ return window.top || window.self;
6
+ } catch (e) {
7
+ return window.self;
8
+ }
9
+ };
2
10
  const pageViewEvent = ({ pageTitle }) => {
3
- const { pathname, href } = (window.top || window.self).location;
4
- const { title } = (window.top || window.self).document;
11
+ const pageWindow = getWindow();
12
+ const { pathname, href } = pageWindow.location;
13
+ const { title } = pageWindow.document;
5
14
  const { pathname: guestPagePath, href: guestPageUrl } = window.location;
6
15
  const { title: guestPageTitle } = document;
7
16
  sendBAEvent({
package/dist/es/index.js CHANGED
@@ -55,6 +55,7 @@ import { renderWithRedux } from "./utils/testing/render-with-redux";
55
55
  import { renderWithRouter } from "./utils/testing/render-with-router";
56
56
  import { RenderWithStateAddOns } from "./utils/testing/render-with-state-addons";
57
57
  import { getApiActionCreator, getSelectField } from "./api/helpers";
58
+ import { getUser } from "./api/users";
58
59
  import { useMediaBreakpoints } from "./view/useMediaBreakpoints";
59
60
  import { withAppDecorator } from "./view/storybook/decorator";
60
61
  import { Header } from "./view/header";
@@ -127,6 +128,7 @@ export {
127
128
  enableReactAppForHostIntegration,
128
129
  actions2 as error,
129
130
  fetchHostAppData,
131
+ getUser as fetchUserSettings,
130
132
  getApiActionCreator,
131
133
  getAppConfigValue,
132
134
  getAuthHTTPClient,
@@ -13,6 +13,7 @@ const useAppWillRender = ({
13
13
  documentEle,
14
14
  history,
15
15
  theme,
16
+ homeRoute,
16
17
  onUnloadComplete
17
18
  }) => {
18
19
  const dispatch = useDispatch ? useDispatch() : null;
@@ -52,13 +53,14 @@ const useAppWillRender = ({
52
53
  const appConfig = merge(getConfig(), {
53
54
  documentEle,
54
55
  history,
55
- theme
56
+ theme,
57
+ homeRoute
56
58
  });
57
59
  load(appConfig);
58
60
  return () => {
59
61
  ref.current = unload(appConfig);
60
62
  };
61
- }, [documentEle, getConfig, history, theme, load, unload]);
63
+ }, [documentEle, getConfig, history, theme, homeRoute, load, unload]);
62
64
  };
63
65
  export {
64
66
  useAppWillRender
@@ -3,12 +3,16 @@ import { publish } from "pubsub-js";
3
3
  import { HOST_WINDOW_RESIZED } from "../../utils/constants";
4
4
  const WindowSize = () => {
5
5
  useEffect(() => {
6
- const observer = new ResizeObserver((entries) => {
7
- publish(HOST_WINDOW_RESIZED, entries && entries[0]);
8
- });
9
- observer.observe(window.document.documentElement);
6
+ if (window.ResizeObserver) {
7
+ const observer = new ResizeObserver((entries) => {
8
+ publish(HOST_WINDOW_RESIZED, entries && entries[0]);
9
+ });
10
+ observer.observe(window.document.documentElement);
11
+ return () => {
12
+ observer.unobserve(window.document.documentElement);
13
+ };
14
+ }
10
15
  return () => {
11
- observer.unobserve(window.document.documentElement);
12
16
  };
13
17
  }, []);
14
18
  return /* @__PURE__ */ React.createElement(React.Fragment, null);
@@ -40,6 +40,7 @@ export { renderWithRedux } from './utils/testing/render-with-redux';
40
40
  export { renderWithRouter } from './utils/testing/render-with-router';
41
41
  export { RenderWithStateAddOns } from './utils/testing/render-with-state-addons';
42
42
  export { getApiActionCreator, getSelectField } from './api/helpers';
43
+ export { getUser as fetchUserSettings } from './api/users';
43
44
  export { useMediaBreakpoints } from './view/useMediaBreakpoints';
44
45
  export { withAppDecorator } from './view/storybook/decorator';
45
46
  export { Header } from './view/header';
@@ -5,4 +5,5 @@ export declare type MicroAppProps = {
5
5
  documentEle?: HTMLDocument | null;
6
6
  history?: History;
7
7
  theme?: Theme;
8
+ homeRoute?: string;
8
9
  };
@@ -3,5 +3,5 @@ export declare type OnUnloadCompleteFn = () => void;
3
3
  declare type UseAppWillRenderArgs = MicroAppProps & {
4
4
  onUnloadComplete?: OnUnloadCompleteFn;
5
5
  };
6
- export declare const useAppWillRender: ({ id, documentEle, history, theme, onUnloadComplete, }: UseAppWillRenderArgs) => void;
6
+ export declare const useAppWillRender: ({ id, documentEle, history, theme, homeRoute, onUnloadComplete, }: UseAppWillRenderArgs) => void;
7
7
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-app-sdk",
3
- "version": "3.0.0-beta.2",
3
+ "version": "3.0.0-beta.3",
4
4
  "description": "ICE MT UI Platform Application SDK ",
5
5
  "sideEffects": [
6
6
  "*.css",