@elliemae/pui-app-sdk 5.21.0-beta.6 → 5.21.0-beta.8

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/index.js CHANGED
@@ -32,6 +32,7 @@ __export(index_exports, {
32
32
  Analytics: () => import_analytics2.Analytics,
33
33
  AppRoot: () => import_app_root.AppRoot,
34
34
  Autocomplete: () => import_autocomplete.Autocomplete,
35
+ CMicroApp: () => import_guest.CMicroAppGuest,
35
36
  CMicroAppGuest: () => import_guest.CMicroAppGuest,
36
37
  CMicroAppHost: () => import_host.CMicroAppHost,
37
38
  CheckBox: () => import_check_box.CheckBox,
@@ -48,6 +49,7 @@ __export(index_exports, {
48
49
  FormItemLayout: () => import_form_item_layout.FormItemLayout,
49
50
  FormLayoutBlockItem: () => import_form_layout_block_item.FormLayoutBlockItem,
50
51
  FormSubmitButton: () => import_submit_button.FormSubmitButton,
52
+ GuestMicroApp: () => import_guest_microapp.GuestMicroApp,
51
53
  InputMask: () => import_input_mask.InputMask,
52
54
  InputText: () => import_input_text.InputText,
53
55
  LargeTextBox: () => import_large_text_box.LargeTextBox,
@@ -55,7 +57,6 @@ __export(index_exports, {
55
57
  MASK_TYPES: () => import_input_mask.MASK_TYPES,
56
58
  MaskedInputText: () => import_masked_input_text.MaskedInputText,
57
59
  MicroApp: () => import_micro_app.MicroApp,
58
- MicroApp2: () => import_microapp_v2.MicroApp2,
59
60
  MicroIFrameApp: () => import_micro_iframe_app.MicroIFrameApp,
60
61
  NavigationPrompt: () => import_navigation_prompt.NavigationPrompt,
61
62
  NavigationPromptActions: () => import_actions2.ACTIONS,
@@ -234,7 +235,7 @@ var import_live_message = require("./data/live-message/index.js");
234
235
  var import_error = require("./data/error/index.js");
235
236
  var import_actions4 = require("./data/logout/actions.js");
236
237
  var import_micro_app = require("./view/micro-app/index.js");
237
- var import_microapp_v2 = require("./view/microapp-v2.js");
238
+ var import_guest_microapp = require("./view/guest-microapp.js");
238
239
  var import_micro_iframe_app = require("./view/micro-iframe-app/index.js");
239
240
  var import_utils = require("./view/micro-app/utils.js");
240
241
  var import_store3 = require("./data/store.js");
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,19 +17,43 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var microapp_v2_exports = {};
20
- __export(microapp_v2_exports, {
21
- MicroApp2: () => MicroApp2
29
+ var guest_microapp_exports = {};
30
+ __export(guest_microapp_exports, {
31
+ GuestMicroApp: () => GuestMicroApp
22
32
  });
23
- module.exports = __toCommonJS(microapp_v2_exports);
33
+ module.exports = __toCommonJS(guest_microapp_exports);
34
+ var import_jsx_runtime = require("react/jsx-runtime");
24
35
  var import_react = require("react");
36
+ var import_styled_components = __toESM(require("styled-components"));
25
37
  var import_react_redux = require("react-redux");
26
38
  var import_app_bridge = require("../utils/micro-frontend/app-bridge.js");
27
39
  var import_actions = require("../data/wait-message/actions.js");
28
40
  var import_micro_frontend = require("../utils/micro-frontend/index.js");
41
+ const Div = import_styled_components.default.div`
42
+ display: flex;
43
+ width: 100%;
44
+ height: 100%;
45
+ flex-direction: column;
46
+ overflow: hidden;
47
+ `;
29
48
  const useAppRenderer = (props) => {
30
- const { id, frameOptions, history, onLoadComplete, onUnloadComplete } = props;
49
+ const {
50
+ id,
51
+ frameOptions,
52
+ history,
53
+ onLoadComplete,
54
+ onUnloadComplete,
55
+ containerId
56
+ } = props;
31
57
  const dispatch = (0, import_react_redux.useDispatch)();
32
58
  (0, import_react.useLayoutEffect)(() => {
33
59
  let isMounted = true;
@@ -44,7 +70,7 @@ const useAppRenderer = (props) => {
44
70
  if (isMounted) {
45
71
  instanceId = await appBridge.openApp({
46
72
  id,
47
- frameOptions,
73
+ frameOptions: { containerId, ...frameOptions },
48
74
  history
49
75
  });
50
76
  setTimeout(() => {
@@ -83,9 +109,18 @@ const useAppRenderer = (props) => {
83
109
  });
84
110
  }
85
111
  };
86
- }, [dispatch, frameOptions, history, id, onLoadComplete, onUnloadComplete]);
112
+ }, [
113
+ containerId,
114
+ dispatch,
115
+ frameOptions,
116
+ history,
117
+ id,
118
+ onLoadComplete,
119
+ onUnloadComplete
120
+ ]);
87
121
  };
88
- const MicroApp2 = (0, import_react.memo)((props) => {
89
- useAppRenderer(props);
90
- return null;
122
+ const GuestMicroApp = (0, import_react.memo)((props) => {
123
+ const containerId = (0, import_react.useRef)(crypto.randomUUID());
124
+ useAppRenderer({ ...props, containerId: containerId.current });
125
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Div, { id: containerId.current });
91
126
  });
@@ -28,23 +28,19 @@ class AppraisalService extends import_microfe_common.ScriptingObject {
28
28
  #creditScore;
29
29
  Close = new import_microfe_common.Event({
30
30
  name: "Close",
31
- requiresFeedback: false,
32
- so: this
31
+ objectId: import_pui_scripting_object.ScriptingObjectNames.Module
33
32
  });
34
33
  Unloading = new import_microfe_common.Event({
35
34
  name: "Unloading",
36
- requiresFeedback: false,
37
- so: this
35
+ objectId: import_pui_scripting_object.ScriptingObjectNames.Module
38
36
  });
39
37
  onPreCommit = new import_microfe_common.Event({
40
38
  name: "onPreCommit",
41
- requiresFeedback: true,
42
- so: this
39
+ objectId: import_pui_scripting_object.ScriptingObjectNames.Module
43
40
  });
44
41
  onSaved = new import_microfe_common.Event({
45
42
  name: "onSaved",
46
- requiresFeedback: false,
47
- so: this
43
+ objectId: import_pui_scripting_object.ScriptingObjectNames.Module
48
44
  });
49
45
  constructor({
50
46
  loanId,
@@ -21,6 +21,7 @@ __export(global_exports, {
21
21
  Global: () => Global
22
22
  });
23
23
  module.exports = __toCommonJS(global_exports);
24
+ var import_pui_scripting_object = require("@elliemae/pui-scripting-object");
24
25
  var import_microfe_common = require("@elliemae/microfe-common");
25
26
  class Global extends import_microfe_common.ScriptingObject {
26
27
  #data = /* @__PURE__ */ new Map();
@@ -29,8 +30,7 @@ class Global extends import_microfe_common.ScriptingObject {
29
30
  }
30
31
  Change = new import_microfe_common.Event({
31
32
  name: "Change",
32
- requiresFeedback: false,
33
- so: this
33
+ objectId: import_pui_scripting_object.ScriptingObjectNames.Global
34
34
  });
35
35
  set = (key, value) => {
36
36
  this.#data.set(key, value);
@@ -43,72 +43,65 @@ class Loan extends import_pui_app_bridge.ScriptingObject {
43
43
  }
44
44
  ApplicationSelected = new import_pui_app_bridge.Event({
45
45
  name: "applicationselected",
46
- requiresFeedback: false,
47
- so: this
46
+ objectId: "loan"
48
47
  });
49
48
  Close = new import_pui_app_bridge.Event({
50
49
  name: "close",
51
- requiresFeedback: false,
52
- so: this
50
+ objectId: "loan"
53
51
  });
54
52
  Change = new import_pui_app_bridge.Event({
55
53
  name: "change",
56
- requiresFeedback: false,
57
- so: this
54
+ objectId: "loan"
58
55
  });
59
56
  Committed = new import_pui_app_bridge.Event({
60
57
  name: "committed",
61
- requiresFeedback: false,
62
- so: this
58
+ objectId: "loan"
63
59
  });
64
60
  EditModeChange = new import_pui_app_bridge.Event({
65
61
  name: "editmodechange",
66
- requiresFeedback: false,
67
- so: this
62
+ objectId: "loan"
68
63
  });
69
64
  MilestoneCompleted = new import_pui_app_bridge.Event({
70
65
  name: "milestonecompleted",
71
- requiresFeedback: false,
72
- so: this
66
+ objectId: "loan"
73
67
  });
74
68
  Open = new import_pui_app_bridge.Event({
75
69
  name: "open",
76
- requiresFeedback: false,
77
- so: this
70
+ objectId: "loan"
78
71
  });
79
72
  PreCommit = new import_pui_app_bridge.Event({
80
73
  name: "precommit",
81
- requiresFeedback: true,
82
- so: this
74
+ objectId: "loan"
83
75
  });
84
76
  PreMilestoneComplete = new import_pui_app_bridge.Event({
85
77
  name: "premilestonecomplete",
86
- requiresFeedback: true,
87
- so: this
78
+ objectId: "loan"
88
79
  });
89
80
  Sync = new import_pui_app_bridge.Event({
90
81
  name: "sync",
91
- requiresFeedback: false,
92
- so: this
82
+ objectId: "loan"
93
83
  });
94
- all() {
84
+ all = () => {
95
85
  this.#log("loan.all");
96
86
  return Promise.resolve(this.#loanData);
97
- }
98
- applyLock(fieldId, lock) {
87
+ };
88
+ applyLock = (fieldId, lock) => {
99
89
  this.#log(`loan.applyLock: fieldId: ${fieldId}, lock: ${String(lock)}`);
100
90
  return Promise.resolve();
101
- }
102
- calculate() {
91
+ };
92
+ calculate = () => {
103
93
  this.#log("loan.calculate");
104
94
  return Promise.resolve(this.#loanData);
105
- }
106
- async commit() {
95
+ };
96
+ commit = async () => {
107
97
  this.#log("loan.commit");
108
98
  const feedBack = await this.#appBridge.dispatchEvent({
109
99
  event: this.PreCommit,
110
100
  eventParams: {
111
101
  id: this.#loanData.id
102
+ },
103
+ eventOptions: {
104
+ timeout: 1e3
112
105
  }
113
106
  });
114
107
  this.#log(`loan.precommit:event:feedback: ${JSON.stringify(feedBack)}`);
@@ -118,8 +111,8 @@ class Loan extends import_pui_app_bridge.ScriptingObject {
118
111
  this.#log("loan.commit:failed");
119
112
  }
120
113
  return this.#loanData.id;
121
- }
122
- execAction(type, params) {
114
+ };
115
+ execAction = (type, params) => {
123
116
  this.#log(
124
117
  `loan.execAction: type: ${type}, params: ${JSON.stringify(params)}`
125
118
  );
@@ -127,8 +120,8 @@ class Loan extends import_pui_app_bridge.ScriptingObject {
127
120
  status: "success",
128
121
  message: "Action executed successfully"
129
122
  });
130
- }
131
- getCollection(name) {
123
+ };
124
+ getCollection = (name) => {
132
125
  this.#log(`loan.getCollection: name: ${name}`);
133
126
  return Promise.resolve({
134
127
  name,
@@ -139,20 +132,20 @@ class Loan extends import_pui_app_bridge.ScriptingObject {
139
132
  this.#log(`loan.getCollection.removeAt: index: ${index}`);
140
133
  }
141
134
  });
142
- }
143
- getCurrentApplication() {
135
+ };
136
+ getCurrentApplication = () => {
144
137
  this.#log("loan.getCurrentApplication");
145
138
  return Promise.resolve({
146
139
  ...this.#loanData,
147
140
  index: 0,
148
141
  legacyId: "legacy-id"
149
142
  });
150
- }
151
- getField(id) {
143
+ };
144
+ getField = (id) => {
152
145
  this.#log(`loan.getField: id: ${id}`);
153
146
  return Promise.resolve(this.#loanData.name);
154
- }
155
- getFieldOptions(param) {
147
+ };
148
+ getFieldOptions = (param) => {
156
149
  this.#log(`loan.getFieldOptions: param: ${JSON.stringify(param)}`);
157
150
  return Promise.resolve({
158
151
  fieldId: [
@@ -170,38 +163,38 @@ class Loan extends import_pui_app_bridge.ScriptingObject {
170
163
  }
171
164
  ]
172
165
  });
173
- }
174
- getFields(ids) {
166
+ };
167
+ getFields = (ids) => {
175
168
  this.#log(`loan.getFields: ids: ${JSON.stringify(ids)}`);
176
169
  const fields = ids.reduce((acc, id) => {
177
170
  acc[id] = this.#loanData.name;
178
171
  return acc;
179
172
  }, {});
180
173
  return Promise.resolve(fields);
181
- }
182
- isReadOnly() {
174
+ };
175
+ isReadOnly = () => {
183
176
  this.#log("loan.isReadOnly");
184
177
  return Promise.resolve(false);
185
- }
186
- merge() {
178
+ };
179
+ merge = () => {
187
180
  this.#log("loan.merge");
188
181
  return Promise.resolve();
189
- }
190
- setCurrentApplication(options) {
182
+ };
183
+ setCurrentApplication = (options) => {
191
184
  this.#log(
192
185
  `loan.setCurrentApplication: options: ${JSON.stringify(options)}`
193
186
  );
194
187
  return Promise.resolve();
195
- }
196
- setEditMode(options) {
188
+ };
189
+ setEditMode = (options) => {
197
190
  this.#log(`loan.setEditMode: options: ${JSON.stringify(options)}`);
198
191
  return Promise.resolve();
199
- }
200
- setFields(fields) {
192
+ };
193
+ setFields = (fields) => {
201
194
  this.#log(`loan.setFields: fields: ${JSON.stringify(fields)}`);
202
195
  Object.keys(fields).forEach((key) => {
203
196
  const field = fields[key];
204
197
  });
205
198
  return Promise.resolve();
206
- }
199
+ };
207
200
  }
package/dist/esm/index.js CHANGED
@@ -60,7 +60,10 @@ import {
60
60
  } from "./utils/session.js";
61
61
  import { waitMessage } from "./data/wait-message/actions.js";
62
62
  import { initServiceWorker } from "./utils/service-worker.js";
63
- import { CMicroAppGuest } from "./utils/micro-frontend/guest.js";
63
+ import {
64
+ CMicroAppGuest,
65
+ CMicroAppGuest as CMicroAppGuest2
66
+ } from "./utils/micro-frontend/guest.js";
64
67
  import { CMicroAppHost } from "./utils/micro-frontend/host.js";
65
68
  import { enableReactAppForHostIntegration } from "./utils/app-host-integration/react.js";
66
69
  import {
@@ -132,7 +135,7 @@ import { actions } from "./data/live-message/index.js";
132
135
  import { actions as actions2 } from "./data/error/index.js";
133
136
  import { actions as actions3 } from "./data/logout/actions.js";
134
137
  import { MicroApp } from "./view/micro-app/index.js";
135
- import { MicroApp2 } from "./view/microapp-v2.js";
138
+ import { GuestMicroApp } from "./view/guest-microapp.js";
136
139
  import { MicroIFrameApp } from "./view/micro-iframe-app/index.js";
137
140
  import { getNavigationLinks } from "./view/micro-app/utils.js";
138
141
  import { getStore } from "./data/store.js";
@@ -146,6 +149,7 @@ export {
146
149
  Analytics,
147
150
  AppRoot,
148
151
  Autocomplete,
152
+ CMicroAppGuest2 as CMicroApp,
149
153
  CMicroAppGuest,
150
154
  CMicroAppHost,
151
155
  CheckBox,
@@ -162,6 +166,7 @@ export {
162
166
  FormItemLayout,
163
167
  FormLayoutBlockItem,
164
168
  FormSubmitButton,
169
+ GuestMicroApp,
165
170
  InputMask,
166
171
  InputText,
167
172
  LargeTextBox,
@@ -169,7 +174,6 @@ export {
169
174
  MASK_TYPES,
170
175
  MaskedInputText,
171
176
  MicroApp,
172
- MicroApp2,
173
177
  MicroIFrameApp,
174
178
  NavigationPrompt,
175
179
  ACTIONS as NavigationPromptActions,
@@ -1,10 +1,26 @@
1
- import { memo, useLayoutEffect } from "react";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { memo, useLayoutEffect, useRef } from "react";
3
+ import styled from "styled-components";
2
4
  import { useDispatch } from "react-redux";
3
5
  import { getAppBridge } from "../utils/micro-frontend/app-bridge.js";
4
6
  import { waitMessage } from "../data/wait-message/actions.js";
5
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
+ `;
6
15
  const useAppRenderer = (props) => {
7
- const { id, frameOptions, history, onLoadComplete, onUnloadComplete } = props;
16
+ const {
17
+ id,
18
+ frameOptions,
19
+ history,
20
+ onLoadComplete,
21
+ onUnloadComplete,
22
+ containerId
23
+ } = props;
8
24
  const dispatch = useDispatch();
9
25
  useLayoutEffect(() => {
10
26
  let isMounted = true;
@@ -21,7 +37,7 @@ const useAppRenderer = (props) => {
21
37
  if (isMounted) {
22
38
  instanceId = await appBridge.openApp({
23
39
  id,
24
- frameOptions,
40
+ frameOptions: { containerId, ...frameOptions },
25
41
  history
26
42
  });
27
43
  setTimeout(() => {
@@ -60,12 +76,21 @@ const useAppRenderer = (props) => {
60
76
  });
61
77
  }
62
78
  };
63
- }, [dispatch, frameOptions, history, id, onLoadComplete, onUnloadComplete]);
79
+ }, [
80
+ containerId,
81
+ dispatch,
82
+ frameOptions,
83
+ history,
84
+ id,
85
+ onLoadComplete,
86
+ onUnloadComplete
87
+ ]);
64
88
  };
65
- const MicroApp2 = memo((props) => {
66
- useAppRenderer(props);
67
- return null;
89
+ const GuestMicroApp = memo((props) => {
90
+ const containerId = useRef(crypto.randomUUID());
91
+ useAppRenderer({ ...props, containerId: containerId.current });
92
+ return /* @__PURE__ */ jsx(Div, { id: containerId.current });
68
93
  });
69
94
  export {
70
- MicroApp2
95
+ GuestMicroApp
71
96
  };
@@ -7,23 +7,19 @@ class AppraisalService extends ScriptingObject {
7
7
  #creditScore;
8
8
  Close = new Event({
9
9
  name: "Close",
10
- requiresFeedback: false,
11
- so: this
10
+ objectId: ScriptingObjectNames.Module
12
11
  });
13
12
  Unloading = new Event({
14
13
  name: "Unloading",
15
- requiresFeedback: false,
16
- so: this
14
+ objectId: ScriptingObjectNames.Module
17
15
  });
18
16
  onPreCommit = new Event({
19
17
  name: "onPreCommit",
20
- requiresFeedback: true,
21
- so: this
18
+ objectId: ScriptingObjectNames.Module
22
19
  });
23
20
  onSaved = new Event({
24
21
  name: "onSaved",
25
- requiresFeedback: false,
26
- so: this
22
+ objectId: ScriptingObjectNames.Module
27
23
  });
28
24
  constructor({
29
25
  loanId,
@@ -1,3 +1,6 @@
1
+ import {
2
+ ScriptingObjectNames
3
+ } from "@elliemae/pui-scripting-object";
1
4
  import { ScriptingObject, Event } from "@elliemae/microfe-common";
2
5
  class Global extends ScriptingObject {
3
6
  #data = /* @__PURE__ */ new Map();
@@ -6,8 +9,7 @@ class Global extends ScriptingObject {
6
9
  }
7
10
  Change = new Event({
8
11
  name: "Change",
9
- requiresFeedback: false,
10
- so: this
12
+ objectId: ScriptingObjectNames.Global
11
13
  });
12
14
  set = (key, value) => {
13
15
  this.#data.set(key, value);