@elliemae/pui-app-sdk 5.31.0-beta.5 → 5.31.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.
@@ -79,14 +79,19 @@ const useAppRenderer = (props) => {
79
79
  microappManager = import_types.MicroAppManager.APPSDK,
80
80
  hostUrl,
81
81
  title,
82
- name
82
+ name,
83
+ ssfAppOptions: configSsfAppOptions = {}
83
84
  } = getConfig();
85
+ const mergedSsfAppOptions = {
86
+ ...configSsfAppOptions,
87
+ ...ssfAppOptions
88
+ };
84
89
  if (microappManager === import_types.MicroAppManager.SSF) {
85
90
  ssfHost = (0, import_ssf_host2.getSSFHost)();
86
91
  if (!ssfHost)
87
92
  throw new Error(`Failed to load ${id}, SSFHost not initialized`);
88
93
  if (isMounted) {
89
- const { searchParams, ...guestOptions } = ssfAppOptions;
94
+ const { searchParams, ...guestOptions } = mergedSsfAppOptions;
90
95
  const guest = ssfHost.loadGuest({
91
96
  id,
92
97
  url: hostUrl,
@@ -1,6 +1,33 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`GuestMicroApp with SSFHost should accept ssfAppOptions 1`] = `
4
+ @media only screen and (max-width:480px) {
5
+
6
+ }
7
+
8
+ <iframe
9
+ id="ssfapp"
10
+ sandbox="allow-scripts allow-popups allow-modals allow-forms allow-downloads allow-same-origin "
11
+ src="http://localhost:3111/ssfapp/?testParam=testValue"
12
+ style="min-width: 100%; height: 100%; border: 0px; border: 10px solid blue;"
13
+ title="SSF App"
14
+ />
15
+ `;
16
+
3
17
  exports[`GuestMicroApp with SSFHost should open ssfapp 1`] = `
18
+ @media only screen and (max-width:480px) {
19
+
20
+ }
21
+
22
+ <iframe
23
+ id="ssfapp"
24
+ src="http://localhost:3111/ssfapp/"
25
+ style="min-width: 100%; height: 100%; border: 0px; border: 2px solid red;"
26
+ title="SSF App"
27
+ />
28
+ `;
29
+
30
+ exports[`GuestMicroApp with SSFHost should open ssfapp 2`] = `
4
31
  "<html lang="en"><head>
5
32
  <meta charset="UTF-8">
6
33
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -16,6 +43,33 @@ ssfapp loaded</output>
16
43
  </body></html>"
17
44
  `;
18
45
 
46
+ exports[`GuestMicroApp with SSFHost should prefer ssfAppOptions sent in params instead of from app.config.json 1`] = `
47
+ @media only screen and (max-width:480px) {
48
+
49
+ }
50
+
51
+ <iframe
52
+ id="ssfapp"
53
+ sandbox="allow-scripts allow-popups allow-modals allow-forms allow-downloads allow-same-origin "
54
+ src="http://localhost:3111/ssfapp/?testParam=testValue"
55
+ style="min-width: 100%; height: 100%; border: 0px; border: 2px solid red;"
56
+ title="SSF App"
57
+ />
58
+ `;
59
+
60
+ exports[`GuestMicroApp with SSFHost should use ssfAppOptions from app.config.json 1`] = `
61
+ @media only screen and (max-width:480px) {
62
+
63
+ }
64
+
65
+ <iframe
66
+ id="ssfapp"
67
+ src="http://localhost:3111/ssfapp/"
68
+ style="min-width: 100%; height: 100%; border: 0px; border: 2px solid red;"
69
+ title="SSF App"
70
+ />
71
+ `;
72
+
19
73
  exports[`MicroAppV2 should open loanapp and call init and mount methods 1`] = `
20
74
  Document {
21
75
  "location": Location {
@@ -18,7 +18,12 @@
18
18
  "ssfapp": {
19
19
  "name": "SSF App",
20
20
  "hostUrl": "./ssfapp",
21
- "microappManager": "ssf"
21
+ "microappManager": "ssf",
22
+ "ssfAppOptions": {
23
+ "openMode": "embed",
24
+ "disableSandbox": true,
25
+ "style": "border: 2px solid red;"
26
+ }
22
27
  },
23
28
  "taskapp": {
24
29
  "name": "Task",
@@ -2,7 +2,9 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { memo, useLayoutEffect, useRef, useCallback } from "react";
3
3
  import styled from "styled-components";
4
4
  import { useDispatch } from "react-redux";
5
- import { MicroAppManager } from "../utils/micro-frontend/types.js";
5
+ import {
6
+ MicroAppManager
7
+ } from "../utils/micro-frontend/types.js";
6
8
  import { getAppBridge } from "../utils/micro-frontend/app-bridge.js";
7
9
  import { getSSFHost } from "../utils/micro-frontend/ssf-host.js";
8
10
  import { waitMessage } from "../data/wait-message/actions.js";
@@ -49,14 +51,19 @@ const useAppRenderer = (props) => {
49
51
  microappManager = MicroAppManager.APPSDK,
50
52
  hostUrl,
51
53
  title,
52
- name
54
+ name,
55
+ ssfAppOptions: configSsfAppOptions = {}
53
56
  } = getConfig();
57
+ const mergedSsfAppOptions = {
58
+ ...configSsfAppOptions,
59
+ ...ssfAppOptions
60
+ };
54
61
  if (microappManager === MicroAppManager.SSF) {
55
62
  ssfHost = getSSFHost();
56
63
  if (!ssfHost)
57
64
  throw new Error(`Failed to load ${id}, SSFHost not initialized`);
58
65
  if (isMounted) {
59
- const { searchParams, ...guestOptions } = ssfAppOptions;
66
+ const { searchParams, ...guestOptions } = mergedSsfAppOptions;
60
67
  const guest = ssfHost.loadGuest({
61
68
  id,
62
69
  url: hostUrl,
@@ -1,6 +1,33 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`GuestMicroApp with SSFHost should accept ssfAppOptions 1`] = `
4
+ @media only screen and (max-width:480px) {
5
+
6
+ }
7
+
8
+ <iframe
9
+ id="ssfapp"
10
+ sandbox="allow-scripts allow-popups allow-modals allow-forms allow-downloads allow-same-origin "
11
+ src="http://localhost:3111/ssfapp/?testParam=testValue"
12
+ style="min-width: 100%; height: 100%; border: 0px; border: 10px solid blue;"
13
+ title="SSF App"
14
+ />
15
+ `;
16
+
3
17
  exports[`GuestMicroApp with SSFHost should open ssfapp 1`] = `
18
+ @media only screen and (max-width:480px) {
19
+
20
+ }
21
+
22
+ <iframe
23
+ id="ssfapp"
24
+ src="http://localhost:3111/ssfapp/"
25
+ style="min-width: 100%; height: 100%; border: 0px; border: 2px solid red;"
26
+ title="SSF App"
27
+ />
28
+ `;
29
+
30
+ exports[`GuestMicroApp with SSFHost should open ssfapp 2`] = `
4
31
  "<html lang="en"><head>
5
32
  <meta charset="UTF-8">
6
33
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -16,6 +43,33 @@ ssfapp loaded</output>
16
43
  </body></html>"
17
44
  `;
18
45
 
46
+ exports[`GuestMicroApp with SSFHost should prefer ssfAppOptions sent in params instead of from app.config.json 1`] = `
47
+ @media only screen and (max-width:480px) {
48
+
49
+ }
50
+
51
+ <iframe
52
+ id="ssfapp"
53
+ sandbox="allow-scripts allow-popups allow-modals allow-forms allow-downloads allow-same-origin "
54
+ src="http://localhost:3111/ssfapp/?testParam=testValue"
55
+ style="min-width: 100%; height: 100%; border: 0px; border: 2px solid red;"
56
+ title="SSF App"
57
+ />
58
+ `;
59
+
60
+ exports[`GuestMicroApp with SSFHost should use ssfAppOptions from app.config.json 1`] = `
61
+ @media only screen and (max-width:480px) {
62
+
63
+ }
64
+
65
+ <iframe
66
+ id="ssfapp"
67
+ src="http://localhost:3111/ssfapp/"
68
+ style="min-width: 100%; height: 100%; border: 0px; border: 2px solid red;"
69
+ title="SSF App"
70
+ />
71
+ `;
72
+
19
73
  exports[`MicroAppV2 should open loanapp and call init and mount methods 1`] = `
20
74
  Document {
21
75
  "location": Location {
@@ -18,7 +18,12 @@
18
18
  "ssfapp": {
19
19
  "name": "SSF App",
20
20
  "hostUrl": "./ssfapp",
21
- "microappManager": "ssf"
21
+ "microappManager": "ssf",
22
+ "ssfAppOptions": {
23
+ "openMode": "embed",
24
+ "disableSandbox": true,
25
+ "style": "border: 2px solid red;"
26
+ }
22
27
  },
23
28
  "taskapp": {
24
29
  "name": "Task",
@@ -1,5 +1,6 @@
1
1
  import { InitOptions } from '@elliemae/pui-micro-frontend-base';
2
2
  import { Events, ScriptingObjectTypes } from '@elliemae/pui-scripting-object';
3
+ import { IFrameSandboxValues, WindowFeatures, OpenMode } from '@elliemae/ssf-host';
3
4
  /**
4
5
  * Files specific to the mode of the micro-frontend application.
5
6
  */
@@ -24,6 +25,50 @@ export declare enum MicroAppManager {
24
25
  SSF = "ssf",
25
26
  APPSDK = "appsdk"
26
27
  }
28
+ /**
29
+ * additional options for ssf based micro-frontend applications.
30
+ */
31
+ export type SSFAppOptions<SearchParams> = {
32
+ /**
33
+ * individual query parameters indicating guest application's url parameter string
34
+ */
35
+ searchParams?: SearchParams;
36
+ /**
37
+ * mode of opening the guest application, popup or embed
38
+ * @default OpenMode.Embed
39
+ */
40
+ openMode?: OpenMode;
41
+ /**
42
+ * flag to disable sandboxing for iframe
43
+ * @default false
44
+ */
45
+ disableSandbox?: boolean;
46
+ /**
47
+ * sandbox values for iframe
48
+ * @default [IFrameSandboxValues.AllowScripts, IFrameSandboxValues.AllowPopups, IFrameSandboxValues.AllowModals, IFrameSandboxValues.AllowForms, IFrameSandboxValues.AllowDownloads, IFrameSandboxValues.AllowSameOrigin ]
49
+ */
50
+ sandboxValues?: Array<IFrameSandboxValues>;
51
+ /**
52
+ * resize the iframe to fit the content inside
53
+ * @default true
54
+ */
55
+ fitToContent?: boolean;
56
+ /**
57
+ * css style for the microapp iframe
58
+ */
59
+ style?: string;
60
+ /**
61
+ * features for the popup window
62
+ * @default { width: 800, height: 600, top: 100, left: 100 }
63
+ */
64
+ popupWindowFeatures?: WindowFeatures;
65
+ /**
66
+ * permission policy for the guest iframe
67
+ * check https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#allow for more details
68
+ * @example "microphone 'self' https://example.com; geolocation 'none'"
69
+ */
70
+ permissionPolicy?: string;
71
+ };
27
72
  /**
28
73
  * Configuration object for a micro-frontend application.
29
74
  */
@@ -78,6 +123,10 @@ export type MicroAppConfig = {
78
123
  * files specific to the production build.
79
124
  */
80
125
  production?: EnvConfig;
126
+ /**
127
+ * options for ssf based micro-frontend applications.
128
+ */
129
+ ssfAppOptions?: SSFAppOptions<Record<string, string | number | boolean>>;
81
130
  /**
82
131
  * The Document object associated with the micro-frontend application.
83
132
  */
@@ -1,51 +1,7 @@
1
- import { OpenMode, IFrameSandboxValues, WindowFeatures } from '@elliemae/ssf-host';
2
1
  import { OpenAppParams } from '@elliemae/pui-app-bridge';
2
+ import { SSFAppOptions } from '../utils/micro-frontend/types.js';
3
3
  export type OnLoadCompleteFn = (instanceId: string) => void;
4
4
  export type OnUnloadCompleteFn = () => void;
5
- /**
6
- * parameters for the ssf microapp components
7
- */
8
- export type SSFMicroAppParams<SearchParams> = {
9
- /**
10
- * individual query parameters indicating guest application's url parameter string
11
- */
12
- searchParams?: SearchParams;
13
- /**
14
- * mode of opening the guest application, popup or embed
15
- * @default OpenMode.Embed
16
- */
17
- openMode?: OpenMode;
18
- /**
19
- * flag to disable sandboxing for iframe
20
- * @default false
21
- */
22
- disableSandbox?: boolean;
23
- /**
24
- * sandbox values for iframe
25
- * @default [IFrameSandboxValues.AllowScripts, IFrameSandboxValues.AllowPopups, IFrameSandboxValues.AllowModals, IFrameSandboxValues.AllowForms, IFrameSandboxValues.AllowDownloads, IFrameSandboxValues.AllowSameOrigin ]
26
- */
27
- sandboxValues?: Array<IFrameSandboxValues>;
28
- /**
29
- * resize the iframe to fit the content inside
30
- * @default true
31
- */
32
- fitToContent?: boolean;
33
- /**
34
- * css style for the microapp iframe
35
- */
36
- style?: string;
37
- /**
38
- * features for the popup window
39
- * @default { width: 800, height: 600, top: 100, left: 100 }
40
- */
41
- popupWindowFeatures?: WindowFeatures;
42
- /**
43
- * permission policy for the guest iframe
44
- * check https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#allow for more details
45
- * @example "microphone 'self' https://example.com; geolocation 'none'"
46
- */
47
- permissionPolicy?: string;
48
- };
49
5
  /**
50
6
  * Parameters for the GuestMicroApp component.
51
7
  */
@@ -53,7 +9,7 @@ export type GuestMicroAppParams = OpenAppParams & {
53
9
  onLoadComplete?: OnLoadCompleteFn;
54
10
  onUnloadComplete?: OnUnloadCompleteFn;
55
11
  containerId?: string;
56
- ssfAppOptions?: SSFMicroAppParams<Record<string, string | number | boolean>>;
12
+ ssfAppOptions?: SSFAppOptions<Record<string, string | number | boolean>>;
57
13
  };
58
14
  /**
59
15
  * Component to load a guest microapp