@elliemae/pui-app-sdk 5.31.0 → 5.31.1

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.
@@ -82,6 +82,10 @@ class CMicroAppGuest {
82
82
  * reference to SSFHost instance
83
83
  */
84
84
  #ssfHostRef;
85
+ /**
86
+ * true if the app prefers to use SSF V2 Guest from App SDK to communicate with host(optional, default: true)
87
+ */
88
+ #useV2Guest;
85
89
  /**
86
90
  * AppBridge instance
87
91
  */
@@ -111,6 +115,7 @@ class CMicroAppGuest {
111
115
  (0, import_logrocket.setLogRocket)(this.#logRocket);
112
116
  if (params?.ssfHostRef) (0, import_ssf_host2.setSSFHost)(params.ssfHostRef);
113
117
  this.#ssfHostRef = (0, import_ssf_host2.getSSFHost)();
118
+ this.#useV2Guest = params?.useV2Guest !== false;
114
119
  this.onInit = params?.onInit;
115
120
  this.onMount = params?.onMount;
116
121
  this.onUnmount = params?.onUnmount;
@@ -253,7 +258,7 @@ class CMicroAppGuest {
253
258
  if (!isCrossDomain()) {
254
259
  host = window.parent?.emui?.MicroAppHost ?? null;
255
260
  }
256
- if (!host) {
261
+ if (!host && this.#useV2Guest) {
257
262
  host = new import_ssf_guest.SSFGuest({ appLogger: this.logger });
258
263
  if (await (0, import_helpers.abortPromise)({
259
264
  promise: host.connect(),
@@ -49,6 +49,10 @@ class CMicroAppGuest {
49
49
  * reference to SSFHost instance
50
50
  */
51
51
  #ssfHostRef;
52
+ /**
53
+ * true if the app prefers to use SSF V2 Guest from App SDK to communicate with host(optional, default: true)
54
+ */
55
+ #useV2Guest;
52
56
  /**
53
57
  * AppBridge instance
54
58
  */
@@ -78,6 +82,7 @@ class CMicroAppGuest {
78
82
  setLogRocket(this.#logRocket);
79
83
  if (params?.ssfHostRef) setSSFHost(params.ssfHostRef);
80
84
  this.#ssfHostRef = getSSFHost();
85
+ this.#useV2Guest = params?.useV2Guest !== false;
81
86
  this.onInit = params?.onInit;
82
87
  this.onMount = params?.onMount;
83
88
  this.onUnmount = params?.onUnmount;
@@ -220,7 +225,7 @@ class CMicroAppGuest {
220
225
  if (!isCrossDomain()) {
221
226
  host = window.parent?.emui?.MicroAppHost ?? null;
222
227
  }
223
- if (!host) {
228
+ if (!host && this.#useV2Guest) {
224
229
  host = new SSFGuest({ appLogger: this.logger });
225
230
  if (await abortPromise({
226
231
  promise: host.connect(),
@@ -26,6 +26,10 @@ interface ConstructorParams {
26
26
  onGetRef?: OnGetRefCallback;
27
27
  history?: History;
28
28
  ssfHostRef?: SSFHost<ScriptingObjectTypes, Events> | null;
29
+ /**
30
+ * true if the app prefers to use SSF V2 Guest from App SDK to communicate with host(optional, default: true)
31
+ */
32
+ useV2Guest?: boolean;
29
33
  }
30
34
  export declare class CMicroAppGuest<AppObjects extends ScriptingObjects = Partial<ScriptingObjectTypes>, AppEvents extends EventListeners = Events> implements IMicroAppGuest<AppObjects, AppEvents> {
31
35
  #private;