@elliemae/pui-app-sdk 3.6.0 → 3.9.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Software Development Kit / API for developing React Web applications. Implements cross cutting concerns as reusable APIs
4
4
 
5
- Build: [![Build Status](https://jenkins.dco.elmae/job/Platform%20UI/job/App%20SDK/job/build/job/master/badge/icon)](https://jenkins.dco.elmae/job/Platform%20UI/job/App%20SDK/job/build/job/master/) Deploy: [![Deploy Status](https://jenkins.dco.elmae/job/Platform%20UI/job/App%20SDK/job/deploy/badge/icon)](https://jenkins.dco.elmae/job/Platform%20UI/job/App%20SDK/job/deploy/) Test: [![Test Status](https://jenkins.dco.elmae/job/Platform%20UI/job/App%20SDK/job/test/badge/icon)](https://jenkins.dco.elmae/job/Platform%20UI/job/App%20SDK/job/test/) Infra: [![Infra Status](https://jenkins.dco.elmae/job/Platform%20UI/job/App%20SDK/job/infra/badge/icon)](https://jenkins.dco.elmae/job/Platform%20UI/job/App%20SDK/job/infra/)
5
+ Build: [![Build Status](https://jenkins.dco.elmae/buildStatus/icon?job=UIPlatform/Dev/AppSDK/build/master)](https://jenkins.dco.elmae/job/UIPlatform/job/Dev/job/AppSDK/job/build/job/master/) Deploy: [![Build Status](https://jenkins.dco.elmae/buildStatus/icon?job=UIPlatform/Dev/AppSDK/deploy)](https://jenkins.dco.elmae/job/UIPlatform/Dev/AppSDK/deploy) Test: [![Build Status](https://jenkins.dco.elmae/buildStatus/icon?job=UIPlatform/QA/AppSDK/test)](https://jenkins.dco.elmae/job/UIPlatform/QA/AppSDK/test) SecScan: [![Build Status](https://jenkins.dco.elmae/buildStatus/icon?job=UIPlatform/Dev/AppSDK/secscan)](https://jenkins.dco.elmae/job/UIPlatform/job/Dev/job/AppSDK/job/secscan/)
6
6
 
7
7
  [SonarQube Report](https://sonar.ellielabs.com/overview?id=elliemae.pui.app.sdk-master)
8
8
 
@@ -25,7 +25,6 @@ __export(guest_exports, {
25
25
  module.exports = __toCommonJS(guest_exports);
26
26
  var import_react_dom = __toESM(require("react-dom"));
27
27
  var import_lodash = __toESM(require("lodash"));
28
- var import_em_ssf_guest = __toESM(require("@elliemae/em-ssf-guest"));
29
28
  var import_pui_theme = require("@elliemae/pui-theme");
30
29
  var import_window = require("../window.js");
31
30
  var import_app_config = require("../app-config/index.js");
@@ -35,6 +34,7 @@ var import_console_logger = require("./console-logger.js");
35
34
  var import_web_storage = require("../web-storage.js");
36
35
  var import_web_analytics = require("../../analytics/web-analytics.js");
37
36
  var import_appdynamics = require("../../analytics/appdynamics.js");
37
+ var import_ssfguest_adapter = require("./ssfguest-adapter.js");
38
38
  const isCrossDomain = () => {
39
39
  try {
40
40
  window.parent.document;
@@ -101,20 +101,16 @@ class CMicroAppGuest {
101
101
  }
102
102
  return value;
103
103
  }
104
- async getSSFHost() {
104
+ async getSSFAdapter() {
105
105
  let host = null;
106
106
  if (window.parent !== window) {
107
107
  if (!isCrossDomain()) {
108
108
  host = window.parent?.emui?.MicroAppHost || null;
109
- } else if (import_em_ssf_guest.default && this.props.hostName) {
110
- await import_em_ssf_guest.default.connect();
111
- const timeout = new Promise((resolve) => {
112
- setTimeout(resolve, 100, null);
113
- });
114
- host = await Promise.race([
115
- import_em_ssf_guest.default.getObject(this.props.hostName),
116
- timeout
117
- ]);
109
+ } else {
110
+ const ssfAdapter = new import_ssfguest_adapter.SSFGuestAdapter();
111
+ if (!await ssfAdapter.init())
112
+ return null;
113
+ host = ssfAdapter;
118
114
  }
119
115
  }
120
116
  return host;
@@ -123,7 +119,7 @@ class CMicroAppGuest {
123
119
  this.props = import_lodash.default.merge(this.props, options);
124
120
  this.props.history = options?.history || this.props.history;
125
121
  if (!this.props.host) {
126
- const host = await this.getSSFHost();
122
+ const host = await this.getSSFAdapter();
127
123
  if (host)
128
124
  this.props.host = host;
129
125
  }
@@ -48,10 +48,12 @@ class CMicroAppHost {
48
48
  theme: (0, import_pui_theme.getDefaultTheme)()
49
49
  };
50
50
  this.activeGuests = {};
51
+ this.domainObjects = {};
51
52
  this.getProps = this.getProps.bind(this);
52
53
  this.getLogger = this.getLogger.bind(this);
53
54
  this.getGuests = this.getGuests.bind(this);
54
55
  this.getGuest = this.getGuest.bind(this);
56
+ this.getObject = this.getObject.bind(this);
55
57
  this.renewSessionTimer = this.renewSessionTimer.bind(this);
56
58
  this.setSystemVersion = this.setSystemVersion.bind(this);
57
59
  (0, import_app_config.loadAppConfig)(__webpack_public_path__).then(() => {
@@ -154,4 +156,7 @@ class CMicroAppHost {
154
156
  sendBAEvent(data) {
155
157
  (0, import_analytics.sendBAEvent)({ data, self: true });
156
158
  }
159
+ getObject(name) {
160
+ return this.domainObjects[name];
161
+ }
157
162
  }
@@ -0,0 +1,47 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var ssfguest_adapter_exports = {};
22
+ __export(ssfguest_adapter_exports, {
23
+ SSFGuestAdapter: () => SSFGuestAdapter
24
+ });
25
+ module.exports = __toCommonJS(ssfguest_adapter_exports);
26
+ var import_em_ssf_guest = __toESM(require("@elliemae/em-ssf-guest"));
27
+ class SSFGuestAdapter {
28
+ async init() {
29
+ if (!import_em_ssf_guest.default)
30
+ return false;
31
+ await import_em_ssf_guest.default.connect();
32
+ return true;
33
+ }
34
+ async getObject(name) {
35
+ return import_em_ssf_guest.default.getObject(name);
36
+ }
37
+ subscribe(message, func) {
38
+ const callback = (domainObject, eventData) => {
39
+ func(message, eventData);
40
+ };
41
+ const [objectId, eventName] = message.split(".");
42
+ return import_em_ssf_guest.default.subscribe(objectId, eventName || "", callback);
43
+ }
44
+ unsubscribe(token, objectId, eventName) {
45
+ return import_em_ssf_guest.default.unsubscribe(objectId, eventName, token);
46
+ }
47
+ }
@@ -1,6 +1,5 @@
1
1
  import ReactDOM from "react-dom";
2
2
  import _ from "lodash";
3
- import ssfGuest from "@elliemae/em-ssf-guest";
4
3
  import { getDefaultTheme } from "@elliemae/pui-theme";
5
4
  import { getWindow } from "../window.js";
6
5
  import { loadAppConfig } from "../app-config/index.js";
@@ -10,6 +9,7 @@ import { logger } from "./console-logger.js";
10
9
  import { removeStorageEvents } from "../web-storage.js";
11
10
  import { updateBAEventParameters } from "../../analytics/web-analytics.js";
12
11
  import { setAppDynamicsUserData } from "../../analytics/appdynamics.js";
12
+ import { SSFGuestAdapter } from "./ssfguest-adapter.js";
13
13
  const isCrossDomain = () => {
14
14
  try {
15
15
  window.parent.document;
@@ -76,20 +76,16 @@ class CMicroAppGuest {
76
76
  }
77
77
  return value;
78
78
  }
79
- async getSSFHost() {
79
+ async getSSFAdapter() {
80
80
  let host = null;
81
81
  if (window.parent !== window) {
82
82
  if (!isCrossDomain()) {
83
83
  host = window.parent?.emui?.MicroAppHost || null;
84
- } else if (ssfGuest && this.props.hostName) {
85
- await ssfGuest.connect();
86
- const timeout = new Promise((resolve) => {
87
- setTimeout(resolve, 100, null);
88
- });
89
- host = await Promise.race([
90
- ssfGuest.getObject(this.props.hostName),
91
- timeout
92
- ]);
84
+ } else {
85
+ const ssfAdapter = new SSFGuestAdapter();
86
+ if (!await ssfAdapter.init())
87
+ return null;
88
+ host = ssfAdapter;
93
89
  }
94
90
  }
95
91
  return host;
@@ -98,7 +94,7 @@ class CMicroAppGuest {
98
94
  this.props = _.merge(this.props, options);
99
95
  this.props.history = options?.history || this.props.history;
100
96
  if (!this.props.host) {
101
- const host = await this.getSSFHost();
97
+ const host = await this.getSSFAdapter();
102
98
  if (host)
103
99
  this.props.host = host;
104
100
  }
@@ -33,10 +33,12 @@ class CMicroAppHost {
33
33
  theme: getDefaultTheme()
34
34
  };
35
35
  this.activeGuests = {};
36
+ this.domainObjects = {};
36
37
  this.getProps = this.getProps.bind(this);
37
38
  this.getLogger = this.getLogger.bind(this);
38
39
  this.getGuests = this.getGuests.bind(this);
39
40
  this.getGuest = this.getGuest.bind(this);
41
+ this.getObject = this.getObject.bind(this);
40
42
  this.renewSessionTimer = this.renewSessionTimer.bind(this);
41
43
  this.setSystemVersion = this.setSystemVersion.bind(this);
42
44
  loadAppConfig(__webpack_public_path__).then(() => {
@@ -139,6 +141,9 @@ class CMicroAppHost {
139
141
  sendBAEvent(data) {
140
142
  sendBAEvent({ data, self: true });
141
143
  }
144
+ getObject(name) {
145
+ return this.domainObjects[name];
146
+ }
142
147
  }
143
148
  export {
144
149
  CMicroAppHost
@@ -0,0 +1,25 @@
1
+ import ssfGuest from "@elliemae/em-ssf-guest";
2
+ class SSFGuestAdapter {
3
+ async init() {
4
+ if (!ssfGuest)
5
+ return false;
6
+ await ssfGuest.connect();
7
+ return true;
8
+ }
9
+ async getObject(name) {
10
+ return ssfGuest.getObject(name);
11
+ }
12
+ subscribe(message, func) {
13
+ const callback = (domainObject, eventData) => {
14
+ func(message, eventData);
15
+ };
16
+ const [objectId, eventName] = message.split(".");
17
+ return ssfGuest.subscribe(objectId, eventName || "", callback);
18
+ }
19
+ unsubscribe(token, objectId, eventName) {
20
+ return ssfGuest.unsubscribe(objectId, eventName, token);
21
+ }
22
+ }
23
+ export {
24
+ SSFGuestAdapter
25
+ };
@@ -38,7 +38,7 @@ export declare class CMicroAppGuest implements IMicroAppGuest {
38
38
  getLogger(): MicroFrontEndLogger;
39
39
  getProps(): GuestProps;
40
40
  private getSessionStorageItem;
41
- private getSSFHost;
41
+ private getSSFAdapter;
42
42
  init(this: CMicroAppGuest, options: InitOptions): Promise<void>;
43
43
  mount(this: CMicroAppGuest, options?: MountOptions): Promise<void>;
44
44
  unmount(this: CMicroAppGuest, options: MountOptions): Promise<JSONValue>;
@@ -1,4 +1,4 @@
1
- import { IMicroAppHost, ResizeEventHandler, BreakpointChangeEventHandler, SubscriptionListener, BAEvent } from '@elliemae/pui-micro-frontend-base';
1
+ import { IMicroAppHost, ResizeEventHandler, BreakpointChangeEventHandler, SubscriptionListener, BAEvent, IDomainObject } from '@elliemae/pui-micro-frontend-base';
2
2
  import { History, To } from 'history';
3
3
  import { DefaultTheme } from 'styled-components';
4
4
  import { MicroFrontEndLogger } from './console-logger.js';
@@ -21,6 +21,7 @@ export declare class CMicroAppHost implements IMicroAppHost {
21
21
  activeGuests: Record<string, unknown>;
22
22
  private readonly onInit?;
23
23
  private readonly onRenewSessionTimer?;
24
+ domainObjects: Record<string, IDomainObject>;
24
25
  private constructor();
25
26
  static getInstance(params?: ConstructorParams): CMicroAppHost;
26
27
  static isInitialized(): boolean;
@@ -50,5 +51,6 @@ export declare class CMicroAppHost implements IMicroAppHost {
50
51
  onBreakpointChangeEvent(eventHandler: BreakpointChangeEventHandler): string;
51
52
  setSystemVersion(version?: string): void;
52
53
  sendBAEvent(this: void, data: BAEvent): void;
54
+ getObject<T extends IDomainObject>(name: string): T;
53
55
  }
54
56
  export {};
@@ -0,0 +1,7 @@
1
+ import { SubscriptionListener, IDomainObject } from '@elliemae/pui-micro-frontend-base';
2
+ export declare class SSFGuestAdapter {
3
+ init(): Promise<boolean>;
4
+ getObject<T extends IDomainObject>(name: string): Promise<T>;
5
+ subscribe<T>(message: string, func: SubscriptionListener<T>): string | number;
6
+ unsubscribe(token: string, objectId: string, eventName: string): void;
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-app-sdk",
3
- "version": "3.6.0",
3
+ "version": "3.9.0",
4
4
  "description": "ICE MT UI Platform Application SDK ",
5
5
  "sideEffects": [
6
6
  "*.css",
@@ -103,48 +103,48 @@
103
103
  "indent": 4
104
104
  },
105
105
  "peerDependencies": {
106
- "@elliemae/app-react-dependencies": "^3.5.0",
107
- "@elliemae/ds-basic": "^2.4.19",
108
- "@elliemae/ds-button": "^2.4.19",
109
- "@elliemae/ds-controlled-form": "^2.4.19",
110
- "@elliemae/ds-date-picker": "^2.4.19",
111
- "@elliemae/ds-date-range-picker": "^2.4.19",
112
- "@elliemae/ds-dialog": "^2.4.19",
113
- "@elliemae/ds-form": "^2.4.19",
114
- "@elliemae/ds-form-layout-blocks": "^2.4.19",
115
- "@elliemae/ds-grid": "^2.4.19",
116
- "@elliemae/ds-loading-indicator": "^2.4.19",
117
- "@elliemae/ds-modal": "^2.4.19",
118
- "@elliemae/ds-popperjs": "^2.4.19",
119
- "@elliemae/ds-toast": "^2.4.19",
120
- "@elliemae/em-ssf-guest": "^1.11.1",
121
- "@elliemae/pui-diagnostics": "^2.7.3",
122
- "@elliemae/pui-micro-frontend-base": "^1.10.1",
123
- "@elliemae/pui-theme": "^2.4.1",
124
- "@elliemae/pui-user-monitoring": "^1.15.0"
106
+ "@elliemae/app-react-dependencies": "^3.7.0",
107
+ "@elliemae/ds-basic": "^3.1.4",
108
+ "@elliemae/ds-button": "^3.1.4",
109
+ "@elliemae/ds-controlled-form": "^3.1.4",
110
+ "@elliemae/ds-date-picker": "^3.1.4",
111
+ "@elliemae/ds-date-range-picker": "^3.1.4",
112
+ "@elliemae/ds-dialog": "^3.1.4",
113
+ "@elliemae/ds-form": "^3.1.4",
114
+ "@elliemae/ds-form-layout-blocks": "^3.1.4",
115
+ "@elliemae/ds-grid": "^3.1.4",
116
+ "@elliemae/ds-loading-indicator": "^3.1.4",
117
+ "@elliemae/ds-modal": "^3.1.4",
118
+ "@elliemae/ds-popperjs": "^3.1.4",
119
+ "@elliemae/ds-toast": "^3.1.4",
120
+ "@elliemae/em-ssf-guest": "^1.11.2",
121
+ "@elliemae/pui-diagnostics": "^2.7.4",
122
+ "@elliemae/pui-micro-frontend-base": "^1.11.2",
123
+ "@elliemae/pui-theme": "^2.6.0",
124
+ "@elliemae/pui-user-monitoring": "^1.15.1"
125
125
  },
126
126
  "devDependencies": {
127
- "@elliemae/app-react-dependencies": "~3.5.0",
127
+ "@elliemae/app-react-dependencies": "~3.7.0",
128
128
  "@elliemae/browserslist-config-elliemae-latest-browsers": "~1.4.2",
129
- "@elliemae/ds-basic": "2.4.19",
130
- "@elliemae/ds-button": "2.4.19",
131
- "@elliemae/ds-controlled-form": "2.4.19",
132
- "@elliemae/ds-date-picker": "2.4.19",
133
- "@elliemae/ds-date-range-picker": "2.4.19",
134
- "@elliemae/ds-dialog": "2.4.19",
135
- "@elliemae/ds-form": "2.4.19",
136
- "@elliemae/ds-form-layout-blocks": "2.4.19",
137
- "@elliemae/ds-grid": "2.4.19",
138
- "@elliemae/ds-loading-indicator": "2.4.19",
139
- "@elliemae/ds-modal": "2.4.19",
140
- "@elliemae/ds-popperjs": "2.4.19",
141
- "@elliemae/ds-toast": "2.4.19",
142
- "@elliemae/em-ssf-guest": "~1.11.1",
143
- "@elliemae/pui-cli": "~6.14.2",
144
- "@elliemae/pui-diagnostics": "~2.7.3",
145
- "@elliemae/pui-e2e-test-sdk": "~7.3.3",
146
- "@elliemae/pui-micro-frontend-base": "~1.10.1",
147
- "@elliemae/pui-theme": "2.4.1",
148
- "@elliemae/pui-user-monitoring": "~1.15.0"
129
+ "@elliemae/ds-basic": "~3.1.4",
130
+ "@elliemae/ds-button": "~3.1.4",
131
+ "@elliemae/ds-controlled-form": "~3.1.4",
132
+ "@elliemae/ds-date-picker": "~3.1.4",
133
+ "@elliemae/ds-date-range-picker": "~3.1.4",
134
+ "@elliemae/ds-dialog": "~3.1.4",
135
+ "@elliemae/ds-form": "~3.1.4",
136
+ "@elliemae/ds-form-layout-blocks": "~3.1.4",
137
+ "@elliemae/ds-grid": "~3.1.4",
138
+ "@elliemae/ds-loading-indicator": "~3.1.4",
139
+ "@elliemae/ds-modal": "~3.1.4",
140
+ "@elliemae/ds-popperjs": "~3.1.4",
141
+ "@elliemae/ds-toast": "~3.1.4",
142
+ "@elliemae/em-ssf-guest": "~1.11.2",
143
+ "@elliemae/pui-cli": "~6.19.0",
144
+ "@elliemae/pui-diagnostics": "~2.7.4",
145
+ "@elliemae/pui-e2e-test-sdk": "~7.3.4",
146
+ "@elliemae/pui-micro-frontend-base": "~1.11.2",
147
+ "@elliemae/pui-theme": "2.6.0",
148
+ "@elliemae/pui-user-monitoring": "~1.15.1"
149
149
  }
150
150
  }