diff --git a/how-to/workspace-platform-starter/CHANGELOG.md b/how-to/workspace-platform-starter/CHANGELOG.md index 81a8badeba..e208fa915d 100644 --- a/how-to/workspace-platform-starter/CHANGELOG.md +++ b/how-to/workspace-platform-starter/CHANGELOG.md @@ -2,6 +2,7 @@ ## v18.0.0 +- Update the interop broker override module pattern so that it is now passed a PlatformInteropBrokerHelpers object instead of the standard ModuleHelpers object. There are no additional functions at the moment but getApps returns all apps (even private ones) for the interop broker as it needs access to everything in order to perform intent resolution. - Added example of supporting workspace and desktop browser (through openfin/core-web as part of OpenFin anywhere) to our contact and manager portal examples in public/common by importing the fin/fdc3 api if it is not available (will require being rendered in an OpenFin Web Layout: ). - More efficient validation of appIds associated with views/windows for faster interop based actions. The appId validation in our wps module (modules directory) has extracted into its own file and tests to ensure it continues to behave as expected across future updates have been added to the test directory. - Module Helpers now provide a getAnalyticsClient (it is marked as optional and the result could be undefined so it leaves the option for it to be denied to a module or removed). This client supports a ModuleAnalytic event which will have a source of Module assigned to it (you can still specify type and use the data property to provide additional module specific information). This data will be passed to the analyticProviders that receive the Workspace Analytic events. See [How to Configure Analytics](./docs/how-to-configure-analytics.md). diff --git a/how-to/workspace-platform-starter/client/src/framework/platform/interop.ts b/how-to/workspace-platform-starter/client/src/framework/platform/interop.ts index 4419db0616..c7b2d77cb5 100644 --- a/how-to/workspace-platform-starter/client/src/framework/platform/interop.ts +++ b/how-to/workspace-platform-starter/client/src/framework/platform/interop.ts @@ -1,11 +1,15 @@ import type OpenFin from "@openfin/core"; +import { getApps } from "../apps"; import { createLogger } from "../logger-provider"; import { initializeModules, loadModules } from "../modules"; import type { WindowPositioningOptions } from "../shapes/browser-shapes"; -import type { PlatformInteropOverride, PlatformInteropOverrideOptions } from "../shapes/interopbroker-shapes"; +import type { + PlatformInteropBrokerHelpers, + PlatformInteropOverride, + PlatformInteropOverrideOptions +} from "../shapes/interopbroker-shapes"; import type { ModuleDefinition, ModuleEntry, ModuleHelpers } from "../shapes/module-shapes"; import type { PlatformProviderOptions } from "../shapes/platform-shapes"; - const logger = createLogger("InteropProvider"); const allOverrides: OpenFin.ConstructorOverride[] = []; let modules: ModuleEntry[] = []; @@ -43,9 +47,17 @@ export async function init( ...interopOverrideSettings?.openOptions }; + // interop broker will need access to all apps where as general modules + // have access to public apps and will need the specific appId or intent + // if they want to read/launch them. + const platformInteropBrokeHelpers: PlatformInteropBrokerHelpers = { + ...helpers, + getApps + }; + if (Array.isArray(moduleOptions)) { modules = await loadModules(options.interop, "interopOverride"); - await initializeModules(modules, helpers); + await initializeModules(modules, platformInteropBrokeHelpers); } logger.info("Getting interop overrides..."); diff --git a/how-to/workspace-platform-starter/client/src/framework/shapes/interopbroker-shapes.ts b/how-to/workspace-platform-starter/client/src/framework/shapes/interopbroker-shapes.ts index b4017ae78c..2df06b82e4 100644 --- a/how-to/workspace-platform-starter/client/src/framework/shapes/interopbroker-shapes.ts +++ b/how-to/workspace-platform-starter/client/src/framework/shapes/interopbroker-shapes.ts @@ -282,3 +282,8 @@ export interface OpenOptions { */ connectionTimeout?: number; } + +/** + * Interop Broker helpers provides environment methods and data. + */ +export type PlatformInteropBrokerHelpers = ModuleHelpers; diff --git a/how-to/workspace-platform-starter/client/src/modules/interop-override/openfin-cloud-interop/interop-override.ts b/how-to/workspace-platform-starter/client/src/modules/interop-override/openfin-cloud-interop/interop-override.ts index 602bc38c26..73b39fa032 100644 --- a/how-to/workspace-platform-starter/client/src/modules/interop-override/openfin-cloud-interop/interop-override.ts +++ b/how-to/workspace-platform-starter/client/src/modules/interop-override/openfin-cloud-interop/interop-override.ts @@ -3,10 +3,11 @@ import { cloudInteropOverride } from "@openfin/cloud-interop"; import type OpenFin from "@openfin/core"; import type { PlatformInteropOverride, - PlatformInteropOverrideOptions + PlatformInteropOverrideOptions, + PlatformInteropBrokerHelpers } from "workspace-platform-starter/shapes/interopbroker-shapes"; import type { Logger, LoggerCreator } from "workspace-platform-starter/shapes/logger-shapes"; -import type { ModuleDefinition, ModuleHelpers } from "workspace-platform-starter/shapes/module-shapes"; +import type { ModuleDefinition } from "workspace-platform-starter/shapes/module-shapes"; import { isStringValue } from "workspace-platform-starter/utils"; import type { OpenFinCloudInteropOptions } from "./shapes"; @@ -30,7 +31,7 @@ export class OpenFinCloudInterop implements PlatformInteropOverride, loggerCreator: LoggerCreator, - helpers: ModuleHelpers + helpers: PlatformInteropBrokerHelpers ): Promise { this._definition = definition; const loggerName = definition.data?.loggerName ?? "OpenfinCloudInterop"; diff --git a/how-to/workspace-platform-starter/client/src/modules/interop-override/wps-interop-override/broker/wps-interop-override.ts b/how-to/workspace-platform-starter/client/src/modules/interop-override/wps-interop-override/broker/wps-interop-override.ts index afffb82eae..9cf44f7a73 100644 --- a/how-to/workspace-platform-starter/client/src/modules/interop-override/wps-interop-override/broker/wps-interop-override.ts +++ b/how-to/workspace-platform-starter/client/src/modules/interop-override/wps-interop-override/broker/wps-interop-override.ts @@ -30,10 +30,10 @@ import type { IntentRegistrationPayload, IntentTargetMetaData, ProcessedContext, - PlatformInteropOverrideOptions + PlatformInteropOverrideOptions, + PlatformInteropBrokerHelpers } from "workspace-platform-starter/shapes/interopbroker-shapes"; import type { Logger } from "workspace-platform-starter/shapes/logger-shapes"; -import type { ModuleHelpers } from "workspace-platform-starter/shapes/module-shapes"; import { formatError, isEmpty, @@ -58,7 +58,7 @@ import { IntentResolverHelper } from "./intent-resolver-helper"; export async function getConstructorOverride( options: PlatformInteropOverrideOptions, logger: Logger, - helpers: ModuleHelpers + helpers: PlatformInteropBrokerHelpers ): Promise> { if (!helpers?.getApp || !helpers?.getApps || !helpers.launchApp) { throw new Error( diff --git a/how-to/workspace-platform-starter/client/src/modules/interop-override/wps-interop-override/interop-override.ts b/how-to/workspace-platform-starter/client/src/modules/interop-override/wps-interop-override/interop-override.ts index 869804bdd4..8ba1d9a611 100644 --- a/how-to/workspace-platform-starter/client/src/modules/interop-override/wps-interop-override/interop-override.ts +++ b/how-to/workspace-platform-starter/client/src/modules/interop-override/wps-interop-override/interop-override.ts @@ -2,10 +2,11 @@ import type OpenFin from "@openfin/core"; import type { PlatformInteropOverride, - PlatformInteropOverrideOptions + PlatformInteropOverrideOptions, + PlatformInteropBrokerHelpers } from "workspace-platform-starter/shapes/interopbroker-shapes"; import type { Logger, LoggerCreator } from "workspace-platform-starter/shapes/logger-shapes"; -import type { ModuleDefinition, ModuleHelpers } from "workspace-platform-starter/shapes/module-shapes"; +import type { ModuleDefinition } from "workspace-platform-starter/shapes/module-shapes"; import { getConstructorOverride as wpsConstructorOverride } from "./broker/wps-interop-override"; import type { WpsInteropOverrideOptions } from "./shapes"; /** @@ -28,7 +29,7 @@ export class WpsInteropOverride implements PlatformInteropOverride, loggerCreator: LoggerCreator, - helpers: ModuleHelpers + helpers: PlatformInteropBrokerHelpers ): Promise { this._definition = definition; const loggerName = definition.data?.loggerName ?? "WpsInteropOverride"; diff --git a/how-to/workspace-platform-starter/client/types/module/shapes/interopbroker-shapes.d.ts b/how-to/workspace-platform-starter/client/types/module/shapes/interopbroker-shapes.d.ts index dd9f497026..8ec09221fe 100644 --- a/how-to/workspace-platform-starter/client/types/module/shapes/interopbroker-shapes.d.ts +++ b/how-to/workspace-platform-starter/client/types/module/shapes/interopbroker-shapes.d.ts @@ -252,3 +252,7 @@ export interface OpenOptions { */ connectionTimeout?: number; } +/** + * Interop Broker helpers provides environment methods and data. + */ +export type PlatformInteropBrokerHelpers = ModuleHelpers; diff --git a/how-to/workspace-platform-starter/templates/src/interop-override/interop-override.ts b/how-to/workspace-platform-starter/templates/src/interop-override/interop-override.ts index 72f63d234f..db0aebb878 100644 --- a/how-to/workspace-platform-starter/templates/src/interop-override/interop-override.ts +++ b/how-to/workspace-platform-starter/templates/src/interop-override/interop-override.ts @@ -2,10 +2,11 @@ import type OpenFin from "@openfin/core"; import type { PlatformInteropOverride, - PlatformInteropOverrideOptions + PlatformInteropOverrideOptions, + PlatformInteropBrokerHelpers } from "workspace-platform-starter/shapes/interopbroker-shapes"; import type { Logger, LoggerCreator } from "workspace-platform-starter/shapes/logger-shapes"; -import type { ModuleDefinition, ModuleHelpers } from "workspace-platform-starter/shapes/module-shapes"; +import type { ModuleDefinition } from "workspace-platform-starter/shapes/module-shapes"; import type { ExampleInteropOverrideOptions } from "./shapes"; /** @@ -28,7 +29,7 @@ export class ExampleInteropOverride implements PlatformInteropOverride, loggerCreator: LoggerCreator, - helpers: ModuleHelpers + helpers: PlatformInteropBrokerHelpers ): Promise { this._definition = definition; this._logger = loggerCreator("ExampleInteropOverride");