@interopio/browser-platform 3.0.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.
- package/browser.platform.d.ts +455 -0
- package/changelog.md +69 -0
- package/dist/browser.platform.es.js +46074 -0
- package/dist/browser.platform.es.js.map +1 -0
- package/dist/browser.platform.umd.js +46082 -0
- package/dist/browser.platform.umd.js.map +1 -0
- package/license.md +21 -0
- package/package.json +78 -0
- package/readme.md +9 -0
- package/rollup.config.js +45 -0
- package/src/common/constants.ts +46 -0
- package/src/common/defaultConfig.ts +56 -0
- package/src/common/gateway.d.ts +32 -0
- package/src/common/types.ts +222 -0
- package/src/connection/gateway.ts +132 -0
- package/src/connection/no-gateway.ts +1 -0
- package/src/connection/portsBridge.ts +441 -0
- package/src/connection/preferred.ts +247 -0
- package/src/controllers/domains.ts +156 -0
- package/src/controllers/glue.ts +604 -0
- package/src/controllers/interception.ts +53 -0
- package/src/controllers/license.ts +50 -0
- package/src/controllers/main.ts +256 -0
- package/src/controllers/plugins.ts +121 -0
- package/src/controllers/serviceWorker.ts +193 -0
- package/src/controllers/state.ts +84 -0
- package/src/controllers/system.ts +99 -0
- package/src/controllers/transactions.ts +80 -0
- package/src/factory.ts +40 -0
- package/src/fallbacks/browser.ts +47 -0
- package/src/fallbacks/dekstop.ts +21 -0
- package/src/index.ts +18 -0
- package/src/libs/applications/appStore/directory.ts +235 -0
- package/src/libs/applications/appStore/remoteWatcher.ts +112 -0
- package/src/libs/applications/controller.ts +469 -0
- package/src/libs/applications/decoders.ts +98 -0
- package/src/libs/applications/defaults.ts +6 -0
- package/src/libs/applications/types.ts +98 -0
- package/src/libs/channels/controller.ts +109 -0
- package/src/libs/channels/decoders.ts +19 -0
- package/src/libs/extension/controller.ts +120 -0
- package/src/libs/extension/decoders.ts +18 -0
- package/src/libs/extension/types.ts +11 -0
- package/src/libs/intents/constants.ts +9 -0
- package/src/libs/intents/controller.ts +500 -0
- package/src/libs/intents/decoders.ts +96 -0
- package/src/libs/intents/resolverHelper.ts +264 -0
- package/src/libs/intents/types.ts +119 -0
- package/src/libs/layouts/constants.ts +3 -0
- package/src/libs/layouts/controller.ts +476 -0
- package/src/libs/layouts/decoders.ts +132 -0
- package/src/libs/layouts/global/builder.ts +400 -0
- package/src/libs/layouts/global/resetter.ts +116 -0
- package/src/libs/layouts/global/restorer.ts +217 -0
- package/src/libs/layouts/global/validator.ts +169 -0
- package/src/libs/layouts/idbStore.ts +63 -0
- package/src/libs/layouts/types.ts +133 -0
- package/src/libs/manager/controller.ts +175 -0
- package/src/libs/manager/decoders.ts +6 -0
- package/src/libs/manager/defaults.ts +5 -0
- package/src/libs/manager/identity.ts +92 -0
- package/src/libs/manager/session.ts +195 -0
- package/src/libs/manager/types.ts +51 -0
- package/src/libs/notifications/controller.ts +447 -0
- package/src/libs/notifications/decoders.ts +166 -0
- package/src/libs/notifications/types.ts +49 -0
- package/src/libs/notifications/utils.ts +7 -0
- package/src/libs/search/controller.ts +232 -0
- package/src/libs/search/decoders.ts +6 -0
- package/src/libs/search/repositories/applications.ts +62 -0
- package/src/libs/search/repositories/layouts.ts +48 -0
- package/src/libs/search/repositories/workspaces.ts +47 -0
- package/src/libs/search/types.ts +9 -0
- package/src/libs/themes/constants.ts +9 -0
- package/src/libs/themes/controller.ts +153 -0
- package/src/libs/themes/decoders.ts +28 -0
- package/src/libs/themes/types.ts +28 -0
- package/src/libs/windows/controller.ts +498 -0
- package/src/libs/windows/decoders.ts +64 -0
- package/src/libs/windows/types.ts +59 -0
- package/src/libs/workspaces/controller.ts +922 -0
- package/src/libs/workspaces/decoders.ts +868 -0
- package/src/libs/workspaces/defaultConfig.ts +11 -0
- package/src/libs/workspaces/frames.ts +239 -0
- package/src/libs/workspaces/hibernationWatcher.ts +231 -0
- package/src/libs/workspaces/types.ts +506 -0
- package/src/platform.ts +156 -0
- package/src/shared/decoders.ts +479 -0
- package/src/shared/fetchTimeout.ts +25 -0
- package/src/shared/ioc.ts +580 -0
- package/src/shared/logger.ts +19 -0
- package/src/shared/promisePlus.ts +62 -0
- package/src/shared/sequelizer.ts +48 -0
- package/src/shared/utils.ts +86 -0
- package/src/storage/local.ts +111 -0
- package/src/storage/session.ts +436 -0
- package/tsconfig.json +16 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { IOConnectBrowser } from "@interopio/browser";
|
|
2
|
+
import { IOConnectBrowserPlatform } from "../../../browser.platform";
|
|
3
|
+
import { InternalApplicationsConfig } from "../../common/types";
|
|
4
|
+
import { AsyncSequelizer } from "../../shared/sequelizer";
|
|
5
|
+
|
|
6
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
7
|
+
export type AppManagerOperationTypes = "appHello" | "applicationStart" | "instanceStop" |
|
|
8
|
+
"registerWorkspaceApp" | "unregisterWorkspaceApp" | "export" | "import" | "remove" | "clear" | "registerRemoteApps" | "operationCheck";
|
|
9
|
+
|
|
10
|
+
export interface AppDirectoryStateChange {
|
|
11
|
+
appsAdded: BaseApplicationData[];
|
|
12
|
+
appsChanged: BaseApplicationData[];
|
|
13
|
+
appsRemoved: BaseApplicationData[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ApplicationsMergeResult {
|
|
17
|
+
readyApps: BaseApplicationData[];
|
|
18
|
+
addedApps: BaseApplicationData[];
|
|
19
|
+
changedApps: BaseApplicationData[];
|
|
20
|
+
removedApps: BaseApplicationData[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface BaseApplicationData {
|
|
24
|
+
name: string;
|
|
25
|
+
type: string;
|
|
26
|
+
createOptions: IOConnectBrowser.AppManager.DefinitionDetails;
|
|
27
|
+
userProperties?: any;
|
|
28
|
+
title?: string;
|
|
29
|
+
version?: string;
|
|
30
|
+
icon?: string;
|
|
31
|
+
caption?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface InstanceProcessInfo {
|
|
35
|
+
data: InstanceData;
|
|
36
|
+
context?: any;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface BasicInstanceData {
|
|
40
|
+
id: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface InstanceData {
|
|
44
|
+
id: string;
|
|
45
|
+
applicationName: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface BridgeInstanceData {
|
|
49
|
+
windowId: string;
|
|
50
|
+
appName: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ApplicationData extends BaseApplicationData {
|
|
54
|
+
instances: InstanceData[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface AppHelloSuccess {
|
|
58
|
+
apps: ApplicationData[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface AppHello {
|
|
62
|
+
windowId?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface InstanceLock {
|
|
66
|
+
keyOne: Promise<void>;
|
|
67
|
+
keyTwo: Promise<void>;
|
|
68
|
+
openKeyOne: (value?: void | PromiseLike<void> | undefined) => void;
|
|
69
|
+
openKeyTwo: (value?: void | PromiseLike<void> | undefined) => void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface AppRemoveConfig {
|
|
73
|
+
name: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface AppsImportOperation {
|
|
77
|
+
definitions: Array<IOConnectBrowser.AppManager.Definition | IOConnectBrowserPlatform.Applications.FDC3Definition>;
|
|
78
|
+
mode: "replace" | "merge";
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface AppsExportOperation {
|
|
82
|
+
definitions: IOConnectBrowser.AppManager.Definition[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface AppDirSetup {
|
|
86
|
+
config: InternalApplicationsConfig;
|
|
87
|
+
appsStateChange: (data: AppDirectoryStateChange) => void;
|
|
88
|
+
sequelizer: AsyncSequelizer;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface AppDirProcessingConfig {
|
|
92
|
+
type: "remote" | "inmemory";
|
|
93
|
+
mode: "merge" | "replace";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface AppsRemoteRegistration {
|
|
97
|
+
definitions: Array<IOConnectBrowser.AppManager.Definition | IOConnectBrowserPlatform.Applications.FDC3Definition>;
|
|
98
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { IOConnectBrowser } from "@interopio/browser";
|
|
3
|
+
import { IOConnectCore } from "@interopio/core";
|
|
4
|
+
import { IOConnectBrowserPlatform } from "../../../browser.platform";
|
|
5
|
+
import { BridgeOperation, InternalPlatformConfig, LibController, OperationCheckConfig, OperationCheckResult } from "../../common/types";
|
|
6
|
+
import { GlueController } from "../../controllers/glue";
|
|
7
|
+
import logger from "../../shared/logger";
|
|
8
|
+
import { ChannelContextPrefix } from "../../common/constants";
|
|
9
|
+
import { channelContextDecoder, channelOperationDecoder, ChannelOperationTypes } from "./decoders";
|
|
10
|
+
import { operationCheckConfigDecoder, operationCheckResultDecoder } from "../../shared/decoders";
|
|
11
|
+
|
|
12
|
+
export class ChannelsController implements LibController {
|
|
13
|
+
private operations: { [key in ChannelOperationTypes]: BridgeOperation } = {
|
|
14
|
+
addChannel: { name: "addChannel", execute: this.addChannel.bind(this), dataDecoder: channelContextDecoder },
|
|
15
|
+
operationCheck: { name: "operationCheck", dataDecoder: operationCheckConfigDecoder, resultDecoder: operationCheckResultDecoder, execute: this.handleOperationCheck.bind(this) }
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
constructor(
|
|
19
|
+
private readonly glueController: GlueController
|
|
20
|
+
) { }
|
|
21
|
+
|
|
22
|
+
private get logger(): IOConnectCore.Logger.API | undefined {
|
|
23
|
+
return logger.get("channels.controller");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public async start(config: InternalPlatformConfig): Promise<void> {
|
|
27
|
+
const channelDefinitions = config.channels.definitions;
|
|
28
|
+
|
|
29
|
+
this.logger?.trace("initializing channels");
|
|
30
|
+
|
|
31
|
+
await this.setupChannels(channelDefinitions);
|
|
32
|
+
|
|
33
|
+
this.logger?.trace("initialization is completed");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public async handleControl(args: any): Promise<any> {
|
|
37
|
+
const channelsData = args.data;
|
|
38
|
+
|
|
39
|
+
const commandId = args.commandId;
|
|
40
|
+
|
|
41
|
+
const operationValidation = channelOperationDecoder.run(args.operation);
|
|
42
|
+
|
|
43
|
+
if (!operationValidation.ok) {
|
|
44
|
+
throw new Error(`This channels request cannot be completed, because the operation name did not pass validation: ${JSON.stringify(operationValidation.error)}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const operationName: ChannelOperationTypes = operationValidation.result;
|
|
48
|
+
|
|
49
|
+
const incomingValidation = this.operations[operationName].dataDecoder?.run(channelsData);
|
|
50
|
+
|
|
51
|
+
if (incomingValidation && !incomingValidation.ok) {
|
|
52
|
+
throw new Error(`Channels request for ${operationName} rejected, because the provided arguments did not pass the validation: ${JSON.stringify(incomingValidation.error)}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
this.logger?.debug(`[${commandId}] ${operationName} command is valid with data: ${JSON.stringify(channelsData)}`);
|
|
56
|
+
|
|
57
|
+
const result = await this.operations[operationName].execute(channelsData, commandId);
|
|
58
|
+
|
|
59
|
+
const resultValidation = this.operations[operationName].resultDecoder?.run(result);
|
|
60
|
+
|
|
61
|
+
if (resultValidation && !resultValidation.ok) {
|
|
62
|
+
throw new Error(`Channels request for ${operationName} could not be completed, because the operation result did not pass the validation: ${JSON.stringify(resultValidation.error)}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
this.logger?.trace(`[${commandId}] ${operationName} command was executed successfully`);
|
|
66
|
+
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private async handleOperationCheck(config: OperationCheckConfig): Promise<OperationCheckResult> {
|
|
71
|
+
const operations = Object.keys(this.operations);
|
|
72
|
+
|
|
73
|
+
const isSupported = operations.some((operation) => operation.toLowerCase() === config.operation.toLowerCase());
|
|
74
|
+
|
|
75
|
+
return { isSupported };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private async setupChannels(channels: IOConnectBrowserPlatform.Channels.ChannelDefinition[]): Promise<void> {
|
|
79
|
+
await Promise.all(channels.map((channel) => this.addChannel(channel)));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private async addChannel(info: IOConnectBrowserPlatform.Channels.ChannelDefinition, commandId?: string): Promise<void> {
|
|
83
|
+
this.trace(`[${commandId}] handling addChannel command with a valid name: ${info.name}, color: ${info.meta.color} and data: ${JSON.stringify(info.data)}`, commandId);
|
|
84
|
+
|
|
85
|
+
const context: IOConnectBrowser.Channels.ChannelContext = {
|
|
86
|
+
name: info.name,
|
|
87
|
+
meta: info.meta,
|
|
88
|
+
data: info.data || {}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const contextName = this.createContextName(context.name);
|
|
92
|
+
|
|
93
|
+
this.trace(`[${commandId}] setting a new channel context with name: ${contextName}`, commandId);
|
|
94
|
+
|
|
95
|
+
await this.glueController.setContext(contextName, context);
|
|
96
|
+
|
|
97
|
+
this.trace(`[${commandId}] channel context with name: ${contextName} created successfully`, commandId);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private createContextName(channelName: string): string {
|
|
101
|
+
return `${ChannelContextPrefix}${channelName}`;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
private trace(msg: string, commandId?: string): void {
|
|
105
|
+
if (commandId) {
|
|
106
|
+
this.logger?.trace(msg);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { anyJson, constant, Decoder, object, oneOf, optional } from 'decoder-validate';
|
|
2
|
+
import { nonEmptyStringDecoder } from '../../shared/decoders';
|
|
3
|
+
|
|
4
|
+
type ChannelContext = { name: string, meta: { color: string }, data?: any };
|
|
5
|
+
|
|
6
|
+
export type ChannelOperationTypes = "addChannel" | "operationCheck";
|
|
7
|
+
|
|
8
|
+
export const channelOperationDecoder: Decoder<ChannelOperationTypes> = oneOf<"addChannel" | "operationCheck">(
|
|
9
|
+
constant("addChannel"),
|
|
10
|
+
constant("operationCheck")
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const channelContextDecoder: Decoder<ChannelContext> = object({
|
|
14
|
+
name: nonEmptyStringDecoder,
|
|
15
|
+
meta: object({
|
|
16
|
+
color: nonEmptyStringDecoder
|
|
17
|
+
}),
|
|
18
|
+
data: optional(anyJson()),
|
|
19
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
import { BridgeOperation, LibController, OperationCheckConfig, OperationCheckResult } from "../../common/types";
|
|
4
|
+
import { IOConnectCore } from "@interopio/core";
|
|
5
|
+
import { ClientHello, ClientHelloResponse, ExtensionOperationTypes } from "./types";
|
|
6
|
+
import logger from "../../shared/logger";
|
|
7
|
+
import { clientHelloDecoder, clientHelloResponseDecoder, extensionOperationTypesDecoder } from "./decoders";
|
|
8
|
+
import { SessionStorageController } from "../../storage/session";
|
|
9
|
+
import { operationCheckConfigDecoder, operationCheckResultDecoder } from "../../shared/decoders";
|
|
10
|
+
|
|
11
|
+
export class ExtensionController implements LibController {
|
|
12
|
+
|
|
13
|
+
private started = false;
|
|
14
|
+
|
|
15
|
+
private operations: { [key in ExtensionOperationTypes]: BridgeOperation } = {
|
|
16
|
+
clientHello: { name: "appHello", resultDecoder: clientHelloResponseDecoder, dataDecoder: clientHelloDecoder, execute: this.handleClientHello.bind(this) },
|
|
17
|
+
operationCheck: { name: "operationCheck", dataDecoder: operationCheckConfigDecoder, resultDecoder: operationCheckResultDecoder, execute: this.handleOperationCheck.bind(this) }
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
constructor(
|
|
21
|
+
private readonly session: SessionStorageController
|
|
22
|
+
) { }
|
|
23
|
+
|
|
24
|
+
private get logger(): IOConnectCore.Logger.API | undefined {
|
|
25
|
+
return logger.get("extension.controller");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public handlePlatformShutdown(): void {
|
|
29
|
+
this.started = false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public async start(): Promise<void> {
|
|
33
|
+
|
|
34
|
+
this.started = true;
|
|
35
|
+
|
|
36
|
+
this.logger?.trace("initialization is completed");
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public async handleControl(args: any): Promise<any> {
|
|
41
|
+
if (!this.started) {
|
|
42
|
+
new Error("Cannot handle this extension control message, because the controller has not been started");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const applicationData = args.data;
|
|
46
|
+
|
|
47
|
+
const commandId = args.commandId;
|
|
48
|
+
|
|
49
|
+
const operationValidation = extensionOperationTypesDecoder.run(args.operation);
|
|
50
|
+
|
|
51
|
+
if (!operationValidation.ok) {
|
|
52
|
+
throw new Error(`This extension request cannot be completed, because the operation name did not pass validation: ${JSON.stringify(operationValidation.error)}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const operationName: ExtensionOperationTypes = operationValidation.result;
|
|
56
|
+
|
|
57
|
+
const incomingValidation = this.operations[operationName].dataDecoder?.run(applicationData);
|
|
58
|
+
|
|
59
|
+
if (incomingValidation && !incomingValidation.ok) {
|
|
60
|
+
throw new Error(`Extension request for ${operationName} rejected, because the provided arguments did not pass the validation: ${JSON.stringify(incomingValidation.error)}`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this.logger?.debug(`[${commandId}] ${operationName} command is valid with data: ${JSON.stringify(applicationData)}`);
|
|
64
|
+
|
|
65
|
+
const result = await this.operations[operationName].execute(applicationData, commandId);
|
|
66
|
+
|
|
67
|
+
const resultValidation = this.operations[operationName].resultDecoder?.run(result);
|
|
68
|
+
|
|
69
|
+
if (resultValidation && !resultValidation.ok) {
|
|
70
|
+
throw new Error(`Extension request for ${operationName} could not be completed, because the operation result did not pass the validation: ${JSON.stringify(resultValidation.error)}`);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
this.logger?.trace(`[${commandId}] ${operationName} command was executed successfully`);
|
|
74
|
+
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public async handleClientHello(config: ClientHello, commandId: string): Promise<ClientHelloResponse> {
|
|
79
|
+
this.logger?.trace(`[${commandId}] handling client hello command`);
|
|
80
|
+
|
|
81
|
+
const widgetConfig = (await this.getWidgetConfig()).widget;
|
|
82
|
+
|
|
83
|
+
const isWorkspaceFrame = config.windowId ? !!this.session.getFrameData(config.windowId) : false;
|
|
84
|
+
|
|
85
|
+
const shouldInjectWidget = isWorkspaceFrame ? false :
|
|
86
|
+
widgetConfig ? widgetConfig.enable : false;
|
|
87
|
+
|
|
88
|
+
const response = {
|
|
89
|
+
widget: {
|
|
90
|
+
inject: shouldInjectWidget
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
this.logger?.trace(`[${commandId}] responding to client hello command with: ${JSON.stringify(response)}`);
|
|
95
|
+
|
|
96
|
+
return response;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private async handleOperationCheck(config: OperationCheckConfig): Promise<OperationCheckResult> {
|
|
100
|
+
const operations = Object.keys(this.operations);
|
|
101
|
+
|
|
102
|
+
const isSupported = operations.some((operation) => operation.toLowerCase() === config.operation.toLowerCase());
|
|
103
|
+
|
|
104
|
+
return { isSupported };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private getWidgetConfig(): Promise<{ widget: { enable: boolean } }> {
|
|
108
|
+
const currentProtocol = (new URL(window.location.href)).protocol;
|
|
109
|
+
|
|
110
|
+
if (!currentProtocol.includes("extension")) {
|
|
111
|
+
return Promise.resolve({ widget: { enable: false } });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return new Promise((resolve) => {
|
|
115
|
+
chrome.storage.local.get("widget", (entry: any) => {
|
|
116
|
+
resolve(entry);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Decoder, oneOf, constant, object, boolean, optional } from "decoder-validate";
|
|
2
|
+
import { nonEmptyStringDecoder } from "../../shared/decoders";
|
|
3
|
+
import { ClientHello, ClientHelloResponse, ExtensionOperationTypes } from "./types";
|
|
4
|
+
|
|
5
|
+
export const extensionOperationTypesDecoder: Decoder<ExtensionOperationTypes> = oneOf<"clientHello" | "operationCheck">(
|
|
6
|
+
constant("clientHello"),
|
|
7
|
+
constant("operationCheck")
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
export const clientHelloResponseDecoder: Decoder<ClientHelloResponse> = object({
|
|
11
|
+
widget: object({
|
|
12
|
+
inject: boolean()
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const clientHelloDecoder: Decoder<ClientHello> = object({
|
|
17
|
+
windowId: optional(nonEmptyStringDecoder)
|
|
18
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const INTENTS_RESOLVER_INTEROP_PREFIX = "T42.Intents.Resolver.Control.";
|
|
2
|
+
|
|
3
|
+
export const INTENTS_RESOLVER_WIDTH = 400;
|
|
4
|
+
|
|
5
|
+
export const INTENTS_RESOLVER_HEIGHT = 440;
|
|
6
|
+
|
|
7
|
+
export const DEFAULT_METHOD_RESPONSE_TIMEOUT_MS = 60000;
|
|
8
|
+
|
|
9
|
+
export const DEFAULT_RAISE_TIMEOUT_MS = 90000;
|