@openfin/core 34.78.19 → 34.78.21
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/out/mock-alpha.d.ts +1425 -55
- package/out/mock-beta.d.ts +1425 -55
- package/out/mock-public.d.ts +1425 -55
- package/out/mock.d.ts +1426 -56
- package/out/mock.js +69 -70
- package/package.json +1 -1
package/out/mock.js
CHANGED
|
@@ -560,7 +560,7 @@ class InternalError extends Error {
|
|
|
560
560
|
const { message, name, stack, ...rest } = err;
|
|
561
561
|
super(message);
|
|
562
562
|
this.name = name || 'Error';
|
|
563
|
-
this.stack = stack
|
|
563
|
+
this.stack = stack ?? this.toString();
|
|
564
564
|
Object.keys(rest).forEach(key => {
|
|
565
565
|
this[key] = rest[key];
|
|
566
566
|
});
|
|
@@ -569,7 +569,6 @@ class InternalError extends Error {
|
|
|
569
569
|
// For documentation of the error methods being used see here: https://v8.dev/docs/stack-trace-api
|
|
570
570
|
class RuntimeError extends Error {
|
|
571
571
|
static getCallSite(callsToRemove = 0) {
|
|
572
|
-
var _a, _b;
|
|
573
572
|
const length = Error.stackTraceLimit;
|
|
574
573
|
const realCallsToRemove = callsToRemove + 1; // remove this call;
|
|
575
574
|
Error.stackTraceLimit = length + realCallsToRemove;
|
|
@@ -578,7 +577,7 @@ class RuntimeError extends Error {
|
|
|
578
577
|
// This will be called when we access the `stack` property
|
|
579
578
|
Error.prepareStackTrace = (_, stack) => stack;
|
|
580
579
|
// stack is optional in non chromium contexts
|
|
581
|
-
const stack =
|
|
580
|
+
const stack = new Error().stack?.slice(realCallsToRemove) ?? [];
|
|
582
581
|
Error.prepareStackTrace = _prepareStackTrace;
|
|
583
582
|
Error.stackTraceLimit = length;
|
|
584
583
|
return stack;
|
|
@@ -600,7 +599,7 @@ class RuntimeError extends Error {
|
|
|
600
599
|
const { reason, error } = payload;
|
|
601
600
|
super(reason);
|
|
602
601
|
this.name = 'RuntimeError';
|
|
603
|
-
if (error
|
|
602
|
+
if (error?.stack) {
|
|
604
603
|
this.cause = new InternalError(error);
|
|
605
604
|
}
|
|
606
605
|
if (callSites) {
|
|
@@ -973,7 +972,7 @@ class ChannelsExposer {
|
|
|
973
972
|
this.exposeFunction = async (target, config) => {
|
|
974
973
|
const { key, options, meta } = config;
|
|
975
974
|
const { id } = meta;
|
|
976
|
-
const action = `${id}.${
|
|
975
|
+
const action = `${id}.${options?.action || key}`;
|
|
977
976
|
await this.channelProviderOrClient.register(action, async ({ args }) => {
|
|
978
977
|
return target(...args);
|
|
979
978
|
});
|
|
@@ -2607,7 +2606,7 @@ class WebContents extends base_1$k.EmitterBase {
|
|
|
2607
2606
|
this.wire.sendAction(`${this.entityType}-show-popup-window`, this.identity).catch(() => {
|
|
2608
2607
|
// we do not want to expose this error, just continue if this analytics-only call fails
|
|
2609
2608
|
});
|
|
2610
|
-
if (options
|
|
2609
|
+
if (options?.onPopupReady) {
|
|
2611
2610
|
const readyListener = async ({ popupName }) => {
|
|
2612
2611
|
try {
|
|
2613
2612
|
const popupWindow = this.fin.Window.wrapSync({ uuid: this.fin.me.uuid, name: popupName });
|
|
@@ -2626,8 +2625,8 @@ class WebContents extends base_1$k.EmitterBase {
|
|
|
2626
2625
|
...options,
|
|
2627
2626
|
// Internal use only.
|
|
2628
2627
|
// @ts-expect-error
|
|
2629
|
-
hasResultCallback: !!
|
|
2630
|
-
hasReadyCallback: !!
|
|
2628
|
+
hasResultCallback: !!options?.onPopupResult,
|
|
2629
|
+
hasReadyCallback: !!options?.onPopupReady
|
|
2631
2630
|
},
|
|
2632
2631
|
...this.identity
|
|
2633
2632
|
});
|
|
@@ -2652,7 +2651,7 @@ class WebContents extends base_1$k.EmitterBase {
|
|
|
2652
2651
|
}
|
|
2653
2652
|
return popupResult;
|
|
2654
2653
|
};
|
|
2655
|
-
if (options
|
|
2654
|
+
if (options?.onPopupResult) {
|
|
2656
2655
|
const dispatchResultListener = async (payload) => {
|
|
2657
2656
|
await options.onPopupResult(normalizePopupResult(payload));
|
|
2658
2657
|
};
|
|
@@ -8532,7 +8531,7 @@ class ChannelBase {
|
|
|
8532
8531
|
try {
|
|
8533
8532
|
const mainAction = this.subscriptions.has(topic)
|
|
8534
8533
|
? this.subscriptions.get(topic)
|
|
8535
|
-
: (currentPayload, id) =>
|
|
8534
|
+
: (currentPayload, id) => (this.defaultAction ?? ChannelBase.defaultAction)(topic, currentPayload, id);
|
|
8536
8535
|
const preActionProcessed = this.preAction ? await this.preAction(topic, payload, senderIdentity) : payload;
|
|
8537
8536
|
const actionProcessed = await mainAction(preActionProcessed, senderIdentity);
|
|
8538
8537
|
return this.postAction ? await this.postAction(topic, actionProcessed, senderIdentity) : actionProcessed;
|
|
@@ -9065,7 +9064,6 @@ class ClassicStrategy {
|
|
|
9065
9064
|
// connection problems occur
|
|
9066
9065
|
_ClassicStrategy_pendingMessagesByEndpointId.set(this, new Map);
|
|
9067
9066
|
this.send = async (endpointId, action, payload) => {
|
|
9068
|
-
var _a;
|
|
9069
9067
|
const to = __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
9070
9068
|
if (!to) {
|
|
9071
9069
|
throw new Error(`Could not locate routing info for endpoint ${endpointId}`);
|
|
@@ -9085,13 +9083,12 @@ class ClassicStrategy {
|
|
|
9085
9083
|
action,
|
|
9086
9084
|
payload
|
|
9087
9085
|
});
|
|
9088
|
-
|
|
9086
|
+
__classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.add(p);
|
|
9089
9087
|
const raw = await p.catch((error) => {
|
|
9090
9088
|
throw new Error(error.message);
|
|
9091
9089
|
}).finally(() => {
|
|
9092
|
-
var _a;
|
|
9093
9090
|
// clean up the pending promise
|
|
9094
|
-
|
|
9091
|
+
__classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId)?.delete(p);
|
|
9095
9092
|
});
|
|
9096
9093
|
return raw.payload.data.result;
|
|
9097
9094
|
};
|
|
@@ -9112,8 +9109,8 @@ class ClassicStrategy {
|
|
|
9112
9109
|
const id = __classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").get(endpointId);
|
|
9113
9110
|
__classPrivateFieldGet$c(this, _ClassicStrategy_endpointIdentityMap, "f").delete(endpointId);
|
|
9114
9111
|
const pendingSet = __classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").get(endpointId);
|
|
9115
|
-
pendingSet
|
|
9116
|
-
const errorMsg = `Channel connection with identity uuid: ${id
|
|
9112
|
+
pendingSet?.forEach((p) => {
|
|
9113
|
+
const errorMsg = `Channel connection with identity uuid: ${id?.uuid} / name: ${id?.name} / endpointId: ${endpointId} no longer connected.`;
|
|
9117
9114
|
p.cancel(new Error(errorMsg));
|
|
9118
9115
|
});
|
|
9119
9116
|
}
|
|
@@ -9125,9 +9122,8 @@ class ClassicStrategy {
|
|
|
9125
9122
|
__classPrivateFieldGet$c(this, _ClassicStrategy_pendingMessagesByEndpointId, "f").set(endpointId, new Set());
|
|
9126
9123
|
}
|
|
9127
9124
|
isValidEndpointPayload(payload) {
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
typeof ((_b = payload === null || payload === void 0 ? void 0 : payload.endpointIdentity) === null || _b === void 0 ? void 0 : _b.channelId) === 'string');
|
|
9125
|
+
return (typeof payload?.endpointIdentity?.endpointId === 'string' ||
|
|
9126
|
+
typeof payload?.endpointIdentity?.channelId === 'string');
|
|
9131
9127
|
}
|
|
9132
9128
|
}
|
|
9133
9129
|
strategy$2.ClassicStrategy = ClassicStrategy;
|
|
@@ -9204,13 +9200,12 @@ class RTCEndpoint {
|
|
|
9204
9200
|
this.rtc.rtcClient.close();
|
|
9205
9201
|
};
|
|
9206
9202
|
this.rtc.channels.response.addEventListener('message', (e) => {
|
|
9207
|
-
var _a;
|
|
9208
9203
|
let { data } = e;
|
|
9209
9204
|
if (e.data instanceof ArrayBuffer) {
|
|
9210
9205
|
data = new TextDecoder().decode(e.data);
|
|
9211
9206
|
}
|
|
9212
9207
|
const { messageId, payload, success, error } = JSON.parse(data);
|
|
9213
|
-
const { resolve, reject } =
|
|
9208
|
+
const { resolve, reject } = this.responseMap.get(messageId) ?? {};
|
|
9214
9209
|
if (resolve && reject) {
|
|
9215
9210
|
this.responseMap.delete(messageId);
|
|
9216
9211
|
if (success) {
|
|
@@ -9459,9 +9454,8 @@ class RTCICEManager extends base_1$i.EmitterBase {
|
|
|
9459
9454
|
const rtcConnectionId = Math.random().toString();
|
|
9460
9455
|
const rtcClient = this.createRtcPeer();
|
|
9461
9456
|
rtcClient.addEventListener('icecandidate', async (e) => {
|
|
9462
|
-
var _a;
|
|
9463
9457
|
if (e.candidate) {
|
|
9464
|
-
await this.raiseClientIce(rtcConnectionId, { candidate:
|
|
9458
|
+
await this.raiseClientIce(rtcConnectionId, { candidate: e.candidate?.toJSON() });
|
|
9465
9459
|
}
|
|
9466
9460
|
});
|
|
9467
9461
|
await this.listenForProviderIce(rtcConnectionId, async (payload) => {
|
|
@@ -9486,9 +9480,8 @@ class RTCICEManager extends base_1$i.EmitterBase {
|
|
|
9486
9480
|
const requestChannelPromise = RTCICEManager.createDataChannelPromise('request', rtcClient);
|
|
9487
9481
|
const responseChannelPromise = RTCICEManager.createDataChannelPromise('response', rtcClient);
|
|
9488
9482
|
rtcClient.addEventListener('icecandidate', async (e) => {
|
|
9489
|
-
var _a;
|
|
9490
9483
|
if (e.candidate) {
|
|
9491
|
-
await this.raiseProviderIce(rtcConnectionId, { candidate:
|
|
9484
|
+
await this.raiseProviderIce(rtcConnectionId, { candidate: e.candidate?.toJSON() });
|
|
9492
9485
|
}
|
|
9493
9486
|
});
|
|
9494
9487
|
await this.listenForClientIce(rtcConnectionId, async (payload) => {
|
|
@@ -9670,8 +9663,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
9670
9663
|
* ```
|
|
9671
9664
|
*/
|
|
9672
9665
|
dispatch(to, action, payload) {
|
|
9673
|
-
|
|
9674
|
-
const endpointId = (_a = to.endpointId) !== null && _a !== void 0 ? _a : this.getEndpointIdForOpenFinId(to, action);
|
|
9666
|
+
const endpointId = to.endpointId ?? this.getEndpointIdForOpenFinId(to, action);
|
|
9675
9667
|
if (endpointId && __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").isEndpointConnected(endpointId)) {
|
|
9676
9668
|
return __classPrivateFieldGet$9(this, _ChannelProvider_strategy, "f").send(endpointId, action, payload);
|
|
9677
9669
|
}
|
|
@@ -9847,13 +9839,12 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
9847
9839
|
}
|
|
9848
9840
|
}
|
|
9849
9841
|
getEndpointIdForOpenFinId(clientIdentity, action) {
|
|
9850
|
-
var _a;
|
|
9851
9842
|
const matchingConnections = this.connections.filter((c) => c.name === clientIdentity.name && c.uuid === clientIdentity.uuid);
|
|
9852
9843
|
if (matchingConnections.length >= 2) {
|
|
9853
9844
|
const protectedObj = __classPrivateFieldGet$9(this, _ChannelProvider_protectedObj, "f");
|
|
9854
9845
|
const { uuid, name } = clientIdentity;
|
|
9855
|
-
const providerUuid = protectedObj
|
|
9856
|
-
const providerName = protectedObj
|
|
9846
|
+
const providerUuid = protectedObj?.providerIdentity.uuid;
|
|
9847
|
+
const providerName = protectedObj?.providerIdentity.name;
|
|
9857
9848
|
// eslint-disable-next-line no-console
|
|
9858
9849
|
console.warn(`WARNING: Dispatch call may have unintended results. The "to" argument of your dispatch call is missing the
|
|
9859
9850
|
"endpointId" parameter. The identity you are dispatching to ({uuid: ${uuid}, name: ${name}})
|
|
@@ -9861,7 +9852,7 @@ class ChannelProvider extends channel_1.ChannelBase {
|
|
|
9861
9852
|
({uuid: ${providerUuid}, name: ${providerName}}) will only be processed by the most recently-created client.`);
|
|
9862
9853
|
}
|
|
9863
9854
|
// Pop to return the most recently created endpointId.
|
|
9864
|
-
return
|
|
9855
|
+
return matchingConnections.pop()?.endpointId;
|
|
9865
9856
|
}
|
|
9866
9857
|
// eslint-disable-next-line class-methods-use-this
|
|
9867
9858
|
static clientIdentityIncludesEndpointId(subscriptionIdentity) {
|
|
@@ -9904,9 +9895,10 @@ class MessageReceiver extends base_1$h.Base {
|
|
|
9904
9895
|
wire.registerMessageHandler(this.onmessage.bind(this));
|
|
9905
9896
|
}
|
|
9906
9897
|
async processChannelMessage(msg) {
|
|
9907
|
-
var _a, _b;
|
|
9908
9898
|
const { senderIdentity, providerIdentity, action, ackToSender, payload, intendedTargetIdentity } = msg.payload;
|
|
9909
|
-
const key =
|
|
9899
|
+
const key = intendedTargetIdentity.channelId ?? // The recipient is a provider
|
|
9900
|
+
intendedTargetIdentity.endpointId ?? // The recipient is a client
|
|
9901
|
+
this.latestEndpointIdByChannelId.get(providerIdentity.channelId); // No endpointId was passed, make best attempt
|
|
9910
9902
|
const handler = this.endpointMap.get(key);
|
|
9911
9903
|
if (!handler) {
|
|
9912
9904
|
ackToSender.payload.success = false;
|
|
@@ -9986,12 +9978,9 @@ class ProtocolManager {
|
|
|
9986
9978
|
return supported;
|
|
9987
9979
|
};
|
|
9988
9980
|
this.getCompatibleProtocols = (providerProtocols, clientOffer) => {
|
|
9989
|
-
const supported = clientOffer.supportedProtocols.filter((clientProtocol) => providerProtocols.some((providerProtocol) =>
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
clientProtocol.version >= providerProtocol.minimumVersion &&
|
|
9993
|
-
providerProtocol.version >= ((_a = clientProtocol.minimumVersion) !== null && _a !== void 0 ? _a : 0);
|
|
9994
|
-
}));
|
|
9981
|
+
const supported = clientOffer.supportedProtocols.filter((clientProtocol) => providerProtocols.some((providerProtocol) => providerProtocol.type === clientProtocol.type &&
|
|
9982
|
+
clientProtocol.version >= providerProtocol.minimumVersion &&
|
|
9983
|
+
providerProtocol.version >= (clientProtocol.minimumVersion ?? 0)));
|
|
9995
9984
|
return supported.slice(0, clientOffer.maxProtocols);
|
|
9996
9985
|
};
|
|
9997
9986
|
}
|
|
@@ -10116,7 +10105,7 @@ class ConnectionManager extends base_1$g.Base {
|
|
|
10116
10105
|
}
|
|
10117
10106
|
createProvider(options, providerIdentity) {
|
|
10118
10107
|
const opts = Object.assign(this.wire.environment.getDefaultChannelOptions().create, options || {});
|
|
10119
|
-
const protocols = this.protocolManager.getProviderProtocols(opts
|
|
10108
|
+
const protocols = this.protocolManager.getProviderProtocols(opts?.protocols);
|
|
10120
10109
|
const createSingleStrategy = (stratType) => {
|
|
10121
10110
|
switch (stratType) {
|
|
10122
10111
|
case 'rtc':
|
|
@@ -10153,7 +10142,7 @@ class ConnectionManager extends base_1$g.Base {
|
|
|
10153
10142
|
return channel;
|
|
10154
10143
|
}
|
|
10155
10144
|
async createClientOffer(options) {
|
|
10156
|
-
const protocols = this.protocolManager.getClientProtocols(options
|
|
10145
|
+
const protocols = this.protocolManager.getClientProtocols(options?.protocols);
|
|
10157
10146
|
let rtcPacket;
|
|
10158
10147
|
const supportedProtocols = await Promise.all(protocols.map(async (type) => {
|
|
10159
10148
|
switch (type) {
|
|
@@ -10181,14 +10170,13 @@ class ConnectionManager extends base_1$g.Base {
|
|
|
10181
10170
|
};
|
|
10182
10171
|
}
|
|
10183
10172
|
async createClientStrategy(rtcPacket, routingInfo) {
|
|
10184
|
-
var _a;
|
|
10185
10173
|
if (!routingInfo.endpointId) {
|
|
10186
10174
|
routingInfo.endpointId = this.wire.environment.getNextMessageId();
|
|
10187
10175
|
// For New Clients connecting to Old Providers. To prevent multi-dispatching and publishing, we delete previously-connected
|
|
10188
10176
|
// clients that are in the same context as the newly-connected client.
|
|
10189
10177
|
__classPrivateFieldGet$8(this, _ConnectionManager_messageReceiver, "f").checkForPreviousClientConnection(routingInfo.channelId);
|
|
10190
10178
|
}
|
|
10191
|
-
const answer =
|
|
10179
|
+
const answer = routingInfo.answer ?? {
|
|
10192
10180
|
supportedProtocols: [{ type: 'classic', version: 1 }]
|
|
10193
10181
|
};
|
|
10194
10182
|
const createStrategyFromAnswer = async (protocol) => {
|
|
@@ -10246,7 +10234,7 @@ class ConnectionManager extends base_1$g.Base {
|
|
|
10246
10234
|
if (!(provider instanceof provider_1$1.ChannelProvider)) {
|
|
10247
10235
|
throw Error('Cannot connect to a channel client');
|
|
10248
10236
|
}
|
|
10249
|
-
const offer = clientOffer
|
|
10237
|
+
const offer = clientOffer ?? {
|
|
10250
10238
|
supportedProtocols: [{ type: 'classic', version: 1 }],
|
|
10251
10239
|
maxProtocols: 1
|
|
10252
10240
|
};
|
|
@@ -12065,7 +12053,6 @@ class Platform extends base_1$7.EmitterBase {
|
|
|
12065
12053
|
*
|
|
12066
12054
|
*/
|
|
12067
12055
|
async reparentView(viewIdentity, target) {
|
|
12068
|
-
var _a;
|
|
12069
12056
|
// eslint-disable-next-line no-console
|
|
12070
12057
|
console.warn('Platform.reparentView has been deprecated, please use Platform.createView');
|
|
12071
12058
|
this.wire.sendAction('platform-reparent-view', this.identity).catch((e) => {
|
|
@@ -12073,7 +12060,7 @@ class Platform extends base_1$7.EmitterBase {
|
|
|
12073
12060
|
});
|
|
12074
12061
|
const normalizedViewIdentity = {
|
|
12075
12062
|
...viewIdentity,
|
|
12076
|
-
uuid:
|
|
12063
|
+
uuid: viewIdentity.uuid ?? this.identity.uuid
|
|
12077
12064
|
};
|
|
12078
12065
|
const view = await this.fin.View.wrap(normalizedViewIdentity);
|
|
12079
12066
|
const viewOptions = await view.getOptions();
|
|
@@ -12865,6 +12852,25 @@ class Layout extends base_1$6.Base {
|
|
|
12865
12852
|
target: this.identity
|
|
12866
12853
|
});
|
|
12867
12854
|
}
|
|
12855
|
+
/**
|
|
12856
|
+
* Retrieves the attached views in current window layout.
|
|
12857
|
+
*
|
|
12858
|
+
* @example
|
|
12859
|
+
* ```js
|
|
12860
|
+
* const layout = fin.Platform.Layout.getCurrentSync();
|
|
12861
|
+
* const views = await layout.getCurrentViews();
|
|
12862
|
+
* ```
|
|
12863
|
+
*/
|
|
12864
|
+
async getCurrentViews() {
|
|
12865
|
+
this.wire.sendAction('layout-get-views').catch((e) => {
|
|
12866
|
+
// don't expose
|
|
12867
|
+
});
|
|
12868
|
+
const client = await this.platform.getClient();
|
|
12869
|
+
const viewIdentities = await client.dispatch('get-layout-views', {
|
|
12870
|
+
target: this.identity
|
|
12871
|
+
});
|
|
12872
|
+
return viewIdentities.map((identity) => this.fin.View.wrapSync(identity));
|
|
12873
|
+
}
|
|
12868
12874
|
/**
|
|
12869
12875
|
* Retrieves the top level content item of the layout.
|
|
12870
12876
|
*
|
|
@@ -13606,9 +13612,8 @@ function requireSessionContextGroupBroker () {
|
|
|
13606
13612
|
this.lastContext = context;
|
|
13607
13613
|
const clientSubscriptionStates = Array.from(this.clients.values());
|
|
13608
13614
|
clientSubscriptionStates.forEach((client) => {
|
|
13609
|
-
var _a;
|
|
13610
13615
|
// eslint-disable-next-line no-unused-expressions
|
|
13611
|
-
|
|
13616
|
+
client.contextHandlers.get(context.type)?.forEach((handlerId) => {
|
|
13612
13617
|
this.provider.dispatch(client.clientIdentity, handlerId, context);
|
|
13613
13618
|
});
|
|
13614
13619
|
if (client.globalHandler) {
|
|
@@ -14215,10 +14220,10 @@ function requireInteropBroker () {
|
|
|
14215
14220
|
this.getProvider = getProvider;
|
|
14216
14221
|
this.interopClients = new Map();
|
|
14217
14222
|
this.contextGroupsById = new Map();
|
|
14218
|
-
if (options
|
|
14223
|
+
if (options?.contextGroups) {
|
|
14219
14224
|
contextGroups = options.contextGroups;
|
|
14220
14225
|
}
|
|
14221
|
-
if (options
|
|
14226
|
+
if (options?.logging) {
|
|
14222
14227
|
this.logging = options.logging;
|
|
14223
14228
|
}
|
|
14224
14229
|
this.intentClientMap = new Map();
|
|
@@ -14353,18 +14358,17 @@ function requireInteropBroker () {
|
|
|
14353
14358
|
*
|
|
14354
14359
|
*/
|
|
14355
14360
|
getCurrentContext(getCurrentContextOptions, clientIdentity) {
|
|
14356
|
-
var _a;
|
|
14357
14361
|
this.wire.sendAction('interop-broker-get-current-context').catch((e) => {
|
|
14358
14362
|
// don't expose, analytics-only call
|
|
14359
14363
|
});
|
|
14360
14364
|
const clientState = this.getClientState(clientIdentity);
|
|
14361
|
-
if (!
|
|
14365
|
+
if (!clientState?.contextGroupId) {
|
|
14362
14366
|
throw new Error('You must be a member of a context group to call getCurrentContext');
|
|
14363
14367
|
}
|
|
14364
14368
|
const { contextGroupId } = clientState;
|
|
14365
14369
|
const contextGroupState = this.contextGroupsById.get(contextGroupId);
|
|
14366
14370
|
const lastContextType = this.lastContextMap.get(contextGroupId);
|
|
14367
|
-
const contextType =
|
|
14371
|
+
const contextType = getCurrentContextOptions?.contextType ?? lastContextType;
|
|
14368
14372
|
return contextGroupState && contextType ? contextGroupState.get(contextType) : undefined;
|
|
14369
14373
|
}
|
|
14370
14374
|
/*
|
|
@@ -15015,10 +15019,9 @@ function requireInteropBroker () {
|
|
|
15015
15019
|
}
|
|
15016
15020
|
// Used to restore interop broker state in snapshots.
|
|
15017
15021
|
applySnapshot(snapshot, options) {
|
|
15018
|
-
|
|
15019
|
-
const contextGroupStates = (_a = snapshot === null || snapshot === void 0 ? void 0 : snapshot.interopSnapshotDetails) === null || _a === void 0 ? void 0 : _a.contextGroupStates;
|
|
15022
|
+
const contextGroupStates = snapshot?.interopSnapshotDetails?.contextGroupStates;
|
|
15020
15023
|
if (contextGroupStates) {
|
|
15021
|
-
if (!
|
|
15024
|
+
if (!options?.closeExistingWindows) {
|
|
15022
15025
|
this.updateExistingClients(contextGroupStates);
|
|
15023
15026
|
}
|
|
15024
15027
|
this.rehydrateContextGroupStates(contextGroupStates);
|
|
@@ -15069,7 +15072,7 @@ function requireInteropBroker () {
|
|
|
15069
15072
|
contextHandlerRegistered({ contextType, handlerId }, clientIdentity) {
|
|
15070
15073
|
const handlerInfo = { contextType, handlerId };
|
|
15071
15074
|
const clientState = this.getClientState(clientIdentity);
|
|
15072
|
-
clientState
|
|
15075
|
+
clientState?.contextHandlers.set(handlerId, handlerInfo);
|
|
15073
15076
|
if (clientState && clientState.contextGroupId) {
|
|
15074
15077
|
const { contextGroupId } = clientState;
|
|
15075
15078
|
const contextGroupMap = this.contextGroupsById.get(contextGroupId);
|
|
@@ -15091,7 +15094,7 @@ function requireInteropBroker () {
|
|
|
15091
15094
|
async intentHandlerRegistered(payload, clientIdentity) {
|
|
15092
15095
|
const { handlerId } = payload;
|
|
15093
15096
|
const clientIntentInfo = this.intentClientMap.get(clientIdentity.name);
|
|
15094
|
-
const handlerInfo = clientIntentInfo
|
|
15097
|
+
const handlerInfo = clientIntentInfo?.get(handlerId);
|
|
15095
15098
|
if (!clientIntentInfo) {
|
|
15096
15099
|
this.intentClientMap.set(clientIdentity.name, new Map());
|
|
15097
15100
|
const newHandlerInfoMap = this.intentClientMap.get(clientIdentity.name);
|
|
@@ -15260,8 +15263,8 @@ function requireInteropBroker () {
|
|
|
15260
15263
|
clientIdentity
|
|
15261
15264
|
};
|
|
15262
15265
|
// Only allow the client to join a contextGroup that actually exists.
|
|
15263
|
-
if (
|
|
15264
|
-
clientSubscriptionState.contextGroupId = payload
|
|
15266
|
+
if (payload?.currentContextGroup && this.contextGroupsById.has(payload.currentContextGroup)) {
|
|
15267
|
+
clientSubscriptionState.contextGroupId = payload?.currentContextGroup;
|
|
15265
15268
|
}
|
|
15266
15269
|
this.interopClients.set(clientIdentity.endpointId, clientSubscriptionState);
|
|
15267
15270
|
});
|
|
@@ -15279,17 +15282,15 @@ function requireInteropBroker () {
|
|
|
15279
15282
|
this.clientDisconnected(clientIdentity);
|
|
15280
15283
|
});
|
|
15281
15284
|
channel.beforeAction(async (action, payload, clientIdentity) => {
|
|
15282
|
-
var _a, _b;
|
|
15283
15285
|
if (!(await this.isActionAuthorized(action, payload, clientIdentity))) {
|
|
15284
15286
|
throw new Error(`Action (${action}) not authorized for ${clientIdentity.uuid}, ${clientIdentity.name}`);
|
|
15285
15287
|
}
|
|
15286
|
-
if (
|
|
15288
|
+
if (this.logging?.beforeAction?.enabled) {
|
|
15287
15289
|
console.log(action, payload, clientIdentity);
|
|
15288
15290
|
}
|
|
15289
15291
|
});
|
|
15290
15292
|
channel.afterAction((action, payload, clientIdentity) => {
|
|
15291
|
-
|
|
15292
|
-
if ((_b = (_a = this.logging) === null || _a === void 0 ? void 0 : _a.afterAction) === null || _b === void 0 ? void 0 : _b.enabled) {
|
|
15293
|
+
if (this.logging?.afterAction?.enabled) {
|
|
15293
15294
|
console.log(action, payload, clientIdentity);
|
|
15294
15295
|
}
|
|
15295
15296
|
});
|
|
@@ -16138,9 +16139,8 @@ function requireOverrideCheck () {
|
|
|
16138
16139
|
overrideCheck.overrideCheck = overrideCheck.getDefaultViewFdc3VersionFromAppInfo = void 0;
|
|
16139
16140
|
const InteropBroker_1 = requireInteropBroker();
|
|
16140
16141
|
function getDefaultViewFdc3VersionFromAppInfo({ manifest, initialOptions }) {
|
|
16141
|
-
|
|
16142
|
-
|
|
16143
|
-
return ['1.2', '2.0'].includes(setVersion !== null && setVersion !== void 0 ? setVersion : '') ? setVersion : undefined;
|
|
16142
|
+
const setVersion = manifest.platform?.defaultViewOptions?.fdc3InteropApi ?? initialOptions.defaultViewOptions?.fdc3InteropApi;
|
|
16143
|
+
return ['1.2', '2.0'].includes(setVersion ?? '') ? setVersion : undefined;
|
|
16144
16144
|
}
|
|
16145
16145
|
overrideCheck.getDefaultViewFdc3VersionFromAppInfo = getDefaultViewFdc3VersionFromAppInfo;
|
|
16146
16146
|
// TODO: Unit test this
|
|
@@ -16213,13 +16213,12 @@ function requireFactory () {
|
|
|
16213
16213
|
* ```
|
|
16214
16214
|
*/
|
|
16215
16215
|
async init(name, override = defaultOverride) {
|
|
16216
|
-
var _a;
|
|
16217
16216
|
this.wire.sendAction('interop-init').catch(() => {
|
|
16218
16217
|
// don't expose, analytics-only call
|
|
16219
16218
|
});
|
|
16220
16219
|
// Allows for manifest-level configuration, without having to override. (e.g. specifying custom context groups)
|
|
16221
16220
|
const options = await this.fin.Application.getCurrentSync().getInfo();
|
|
16222
|
-
const opts =
|
|
16221
|
+
const opts = options.initialOptions.interopBrokerConfiguration ?? {};
|
|
16223
16222
|
const objectThatThrows = (0, inaccessibleObject_1.createUnusableObject)(BrokerParamAccessError);
|
|
16224
16223
|
const warningOptsClone = (0, inaccessibleObject_1.createWarningObject)(BrokerParamAccessError, (0, lodash_1.cloneDeep)(opts));
|
|
16225
16224
|
let provider;
|
|
@@ -17080,7 +17079,7 @@ const fin_1 = fin;
|
|
|
17080
17079
|
const transport_1 = transport;
|
|
17081
17080
|
const mockEnvironment_1 = mockEnvironment;
|
|
17082
17081
|
const mockWire_1 = mockWire;
|
|
17083
|
-
exports.fin = mock.fin = ((typeof window !== 'undefined' &&
|
|
17082
|
+
exports.fin = mock.fin = ((typeof window !== 'undefined' && window?.fin) ||
|
|
17084
17083
|
(() => {
|
|
17085
17084
|
const environment = new mockEnvironment_1.MockEnvironment();
|
|
17086
17085
|
const transport = new transport_1.Transport(mockWire_1.MockWire, environment, {
|