@moonbase.sh/gorilla-engine 0.1.0 → 0.2.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.
- package/README.md +77 -8
- package/dist/index.cjs +514 -122
- package/dist/index.d.cts +147 -12
- package/dist/index.d.ts +147 -12
- package/dist/index.js +508 -120
- package/dist/moonbase-gorilla-engine.js +801 -0
- package/package.json +7 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ActivationUiOptions, ActivationControllerOptions, ActivationScreen, ActivationController, ActivationState } from '@moonbase.sh/licensing';
|
|
2
|
-
export { ActivationScreen, ActivationState, ActivationStrings, ActivationUiOptions, TrialFeature } from '@moonbase.sh/licensing';
|
|
1
|
+
import { ActivationStatus, ActivationUiOptions, ActivationControllerOptions, ActivationScreen, ActivationController, ActivationState } from '@moonbase.sh/licensing';
|
|
2
|
+
export { ActivationError, ActivationErrorKind, ActivationLogger, ActivationScreen, ActivationState, ActivationStatus, ActivationStrings, ActivationUiOptions, LicenseView, LockReason, MoonbaseError, ReleaseNotCoveredError, TrialFeature } from '@moonbase.sh/licensing';
|
|
3
3
|
import { ReactElement } from 'react';
|
|
4
4
|
|
|
5
5
|
/** How the update download is going, as the update screen shows it. */
|
|
@@ -13,13 +13,97 @@ interface DownloadState {
|
|
|
13
13
|
upgradeUrl: string | null;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/** An open or save dialog, as Gorilla Engine's `openFileChooser` takes it. */
|
|
17
|
+
interface FileDialogOptions {
|
|
18
|
+
allowMultiple?: boolean;
|
|
19
|
+
saveDialog?: boolean;
|
|
20
|
+
warnOnOverwrite?: boolean;
|
|
21
|
+
hint?: string;
|
|
22
|
+
allowedExtensions?: string;
|
|
23
|
+
defaultLocation?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* What the module needs from the plugin's host. Every plugin gets Gorilla
|
|
27
|
+
* Engine's ({@link gorillaEngineHost}); pass parts of your own as `host` for
|
|
28
|
+
* tests, or to route them elsewhere.
|
|
29
|
+
*/
|
|
30
|
+
interface GorillaEngineHost {
|
|
31
|
+
/** The plugin's name, as it was built. Empty when not known. */
|
|
32
|
+
pluginName: () => string;
|
|
33
|
+
/** The plugin's manufacturer, as it was built. Empty when not known. */
|
|
34
|
+
manufacturerName: () => string;
|
|
35
|
+
/** Open a link in the browser. */
|
|
36
|
+
openUrl: (url: string) => void | Promise<void>;
|
|
37
|
+
/** Put text on the clipboard. */
|
|
38
|
+
copyText: (text: string) => Promise<void>;
|
|
39
|
+
/** Show an open or save dialog: the paths chosen, none when cancelled. Absent when there is no dialog. */
|
|
40
|
+
chooseFile?: (options: FileDialogOptions) => Promise<string[]>;
|
|
41
|
+
/** Show a file in the file manager. */
|
|
42
|
+
reveal: (file: string) => Promise<void>;
|
|
43
|
+
/** The folder downloads go to, and the machine file when there is no dialog. */
|
|
44
|
+
downloadsFolder: () => string;
|
|
45
|
+
/** Turn the plugin's MIDI and audio on or off. Absent when the host can't. */
|
|
46
|
+
setAudioAndMidi?: (enabled: boolean) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Calls the listener when the plugin's window gains or loses focus, and
|
|
49
|
+
* returns a function that stops it. Absent when the host doesn't say, as
|
|
50
|
+
* Gorilla Engine doesn't: the overlay then goes by the pointer entering it.
|
|
51
|
+
*/
|
|
52
|
+
onFocusChange?: (listener: (focused: boolean) => void) => () => void;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Gorilla Engine's host: its browser call, file dialogs and MIDI and audio
|
|
56
|
+
* switches, and the system's clipboard and file manager, which Gorilla Engine
|
|
57
|
+
* has no calls for.
|
|
58
|
+
*/
|
|
59
|
+
declare function gorillaEngineHost(): GorillaEngineHost;
|
|
60
|
+
/** The names of the folder a license is kept in, apart from how the plugin is branded. */
|
|
61
|
+
interface LicenseStorage {
|
|
62
|
+
manufacturer: string;
|
|
63
|
+
plugin: string;
|
|
64
|
+
}
|
|
16
65
|
/**
|
|
17
66
|
* Where a Gorilla Engine plugin keeps the license by default: the manufacturer's
|
|
18
67
|
* folder for user data, as Gorilla Engine's own Product Hub library does.
|
|
19
68
|
* `~/Library/Application Support/<manufacturer>/<plugin>/license.mb` on macOS and
|
|
20
|
-
* `%APPDATA%\<manufacturer>\<plugin>\license.mb` on Windows.
|
|
69
|
+
* `%APPDATA%\<manufacturer>\<plugin>\license.mb` on Windows. The names are
|
|
70
|
+
* `storage`'s, or else the ones the plugin was built with. Throws when there
|
|
71
|
+
* are neither, as in a test without Gorilla Engine, rather than pick a folder
|
|
72
|
+
* another plugin could share.
|
|
21
73
|
*/
|
|
22
|
-
declare function defaultLicenseFile(): string;
|
|
74
|
+
declare function defaultLicenseFile(storage?: LicenseStorage, host?: Pick<GorillaEngineHost, 'pluginName' | 'manufacturerName'>): string;
|
|
75
|
+
/** Something the overlay or the host could not do, as `onError` hears of it. */
|
|
76
|
+
interface GorillaEngineFailure {
|
|
77
|
+
/** What failed: the overlay's action, such as `openLink`, or `audioAndMidi`. */
|
|
78
|
+
action: string;
|
|
79
|
+
/** The SDK's error type, the module's error kind (`notLicensed`, `busy`, ...), or `internal`. */
|
|
80
|
+
kind: string;
|
|
81
|
+
message: string;
|
|
82
|
+
error: unknown;
|
|
83
|
+
}
|
|
84
|
+
/** A report for support, without the license, links, personal details or the device's identity. */
|
|
85
|
+
interface GorillaEngineDiagnostics {
|
|
86
|
+
module: string;
|
|
87
|
+
licensing: string;
|
|
88
|
+
platform: string;
|
|
89
|
+
/** Where the license is kept, with the home folder as `~`. */
|
|
90
|
+
licenseFile: string;
|
|
91
|
+
status: ActivationStatus;
|
|
92
|
+
licensed: boolean;
|
|
93
|
+
/** Which of the host's optional parts are there. */
|
|
94
|
+
host: {
|
|
95
|
+
gorillaEngine: boolean;
|
|
96
|
+
fileDialog: boolean;
|
|
97
|
+
audioAndMidi: boolean;
|
|
98
|
+
focus: boolean;
|
|
99
|
+
};
|
|
100
|
+
/** Whether the module gates MIDI and audio, and whether it last turned them on. Null before it has. */
|
|
101
|
+
audioAndMidi: {
|
|
102
|
+
gated: boolean;
|
|
103
|
+
enabled: boolean | null;
|
|
104
|
+
};
|
|
105
|
+
overlayVisible: boolean;
|
|
106
|
+
}
|
|
23
107
|
/** Branding and behaviour of the built-in activation overlay. */
|
|
24
108
|
interface GorillaEngineUiOptions extends ActivationUiOptions {
|
|
25
109
|
/**
|
|
@@ -42,15 +126,37 @@ interface GorillaEngineUiOptions extends ActivationUiOptions {
|
|
|
42
126
|
interface MoonbaseGorillaEngineOptions extends Omit<ActivationControllerOptions, 'licenseFile' | 'openUrl' | 'productName' | 'accountName'> {
|
|
43
127
|
/** Where the license is kept. Defaults to {@link defaultLicenseFile}. */
|
|
44
128
|
licenseFile?: string;
|
|
45
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* The names of the folder the license is kept in, instead of the names the
|
|
131
|
+
* plugin was built with. Set them once and keep them, so that renaming the
|
|
132
|
+
* plugin keeps its customers' licenses.
|
|
133
|
+
*/
|
|
134
|
+
storage?: LicenseStorage;
|
|
135
|
+
/**
|
|
136
|
+
* Where earlier versions of the plugin kept the license. When the license
|
|
137
|
+
* file is missing, the first of these that exists is copied to it at startup
|
|
138
|
+
* and checked like any stored license. The old file stays, for versions still
|
|
139
|
+
* installed beside this one.
|
|
140
|
+
*/
|
|
141
|
+
previousLicenseFiles?: string[];
|
|
142
|
+
/** Opens a link in the browser: `host.openUrl`, for short. */
|
|
46
143
|
openUrl?: (url: string) => void | Promise<void>;
|
|
144
|
+
/** The host's browser, clipboard, dialogs and MIDI and audio switches. Defaults to Gorilla Engine's. */
|
|
145
|
+
host?: Partial<GorillaEngineHost>;
|
|
47
146
|
/**
|
|
48
147
|
* Turn the plugin's MIDI and audio on while it is licensed (a license or a
|
|
49
148
|
* trial) and off while it is not, through `GorillaEngine.getPluginMM` and
|
|
50
|
-
* `getPluginAE
|
|
51
|
-
*
|
|
149
|
+
* `getPluginAE`: off from `start()`, until the stored license is checked. Pair
|
|
150
|
+
* it with the project's `audioEnabledOnStartup` and `midiEnabledOnStartup`
|
|
151
|
+
* set to false, which cover the moment before the plugin's JavaScript runs.
|
|
152
|
+
* On by default.
|
|
52
153
|
*/
|
|
53
154
|
lockAudioAndMidi?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Called with whatever the overlay or the host could not do, such as open the
|
|
157
|
+
* browser. Defaults to a warning in the log.
|
|
158
|
+
*/
|
|
159
|
+
onError?: (failure: GorillaEngineFailure) => void;
|
|
54
160
|
/** The built-in activation overlay's branding and behaviour. */
|
|
55
161
|
ui?: GorillaEngineUiOptions;
|
|
56
162
|
}
|
|
@@ -68,9 +174,11 @@ interface ActivationUiState {
|
|
|
68
174
|
* with Gorilla Engine's runtime for the browser, file dialogs and the plugin's
|
|
69
175
|
* MIDI and audio, and the state behind the `MoonbaseActivation` overlay.
|
|
70
176
|
*
|
|
71
|
-
* Create one per plugin instance,
|
|
72
|
-
*
|
|
73
|
-
*
|
|
177
|
+
* Create one per plugin instance, at the top level of the plugin's script
|
|
178
|
+
* rather than in a component, and call {@link start}. It lives as long as the
|
|
179
|
+
* plugin does: closing the plugin's window leaves it running, and nothing needs
|
|
180
|
+
* to dispose it. Instances share the license file, so activating in one unlocks
|
|
181
|
+
* the others within a few seconds.
|
|
74
182
|
*/
|
|
75
183
|
declare class MoonbaseGorillaEngine extends ActivationController {
|
|
76
184
|
/** The overlay's branding and behaviour. */
|
|
@@ -78,18 +186,43 @@ declare class MoonbaseGorillaEngine extends ActivationController {
|
|
|
78
186
|
/** The endpoint, for the overlay's links. */
|
|
79
187
|
readonly endpoint: string;
|
|
80
188
|
private readonly lockAudioAndMidi;
|
|
189
|
+
private readonly host;
|
|
190
|
+
private readonly previousLicenseFiles;
|
|
191
|
+
private readonly onError;
|
|
81
192
|
private readonly uiListeners;
|
|
82
193
|
private uiState;
|
|
83
194
|
private lastLicensed;
|
|
84
195
|
private gated;
|
|
196
|
+
private gateMissingReported;
|
|
85
197
|
private downloaded;
|
|
86
198
|
private name;
|
|
199
|
+
private hasStarted;
|
|
200
|
+
private disposed;
|
|
201
|
+
private stopFocus;
|
|
202
|
+
/** Aborts the update download when the instance is disposed. */
|
|
203
|
+
private readonly aborts;
|
|
87
204
|
constructor(options: MoonbaseGorillaEngineOptions);
|
|
88
205
|
/**
|
|
89
206
|
* Validate the stored license, start watching it, and bring the overlay up
|
|
90
|
-
* when the plugin has no license. Call once per plugin instance
|
|
207
|
+
* when the plugin has no license. Call once per plugin instance; a disposed
|
|
208
|
+
* instance can't start again.
|
|
91
209
|
*/
|
|
92
210
|
start(): void;
|
|
211
|
+
/**
|
|
212
|
+
* Stop watching the license and stop telling the overlay anything. For tests
|
|
213
|
+
* and development reloads: a plugin does not need it. Safe to call twice;
|
|
214
|
+
* afterwards the overlay calls do nothing and {@link start} throws.
|
|
215
|
+
*/
|
|
216
|
+
dispose(): void;
|
|
217
|
+
/** When the license file is missing, take the one an earlier version kept. */
|
|
218
|
+
private importPreviousLicense;
|
|
219
|
+
/**
|
|
220
|
+
* Hand a failure to `onError`: the overlay does with every action that
|
|
221
|
+
* fails, and the module with the host's.
|
|
222
|
+
*/
|
|
223
|
+
reportError(action: string, error: unknown): void;
|
|
224
|
+
/** A report for support: versions, where the license is kept and what the host can do, but nothing personal. */
|
|
225
|
+
diagnostics(): GorillaEngineDiagnostics;
|
|
93
226
|
/** This computer's name, as the activation screen shows it. */
|
|
94
227
|
get deviceName(): string;
|
|
95
228
|
/** What the overlay shows, besides the license state. */
|
|
@@ -98,6 +231,8 @@ declare class MoonbaseGorillaEngine extends ActivationController {
|
|
|
98
231
|
subscribeUi(listener: () => void): () => void;
|
|
99
232
|
private setUi;
|
|
100
233
|
private afterStateChange;
|
|
234
|
+
/** Turn MIDI and audio on or off, saying so when the host can't. */
|
|
235
|
+
private gate;
|
|
101
236
|
/**
|
|
102
237
|
* Show the activation overlay, optionally on a particular screen. Without one
|
|
103
238
|
* it shows whatever the license state calls for.
|
|
@@ -184,4 +319,4 @@ interface MoonbaseActivationProps {
|
|
|
184
319
|
*/
|
|
185
320
|
declare function MoonbaseActivation(props: MoonbaseActivationProps): ReactElement | null;
|
|
186
321
|
|
|
187
|
-
export { type ActivationUiState, type GorillaEngineUiOptions, MoonbaseActivation, type MoonbaseActivationProps, MoonbaseGorillaEngine, type MoonbaseGorillaEngineOptions, createMoonbase, defaultLicenseFile, useMoonbaseState };
|
|
322
|
+
export { type ActivationUiState, type FileDialogOptions, type GorillaEngineDiagnostics, type GorillaEngineFailure, type GorillaEngineHost, type GorillaEngineUiOptions, type LicenseStorage, MoonbaseActivation, type MoonbaseActivationProps, MoonbaseGorillaEngine, type MoonbaseGorillaEngineOptions, createMoonbase, defaultLicenseFile, gorillaEngineHost, useMoonbaseState };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ActivationUiOptions, ActivationControllerOptions, ActivationScreen, ActivationController, ActivationState } from '@moonbase.sh/licensing';
|
|
2
|
-
export { ActivationScreen, ActivationState, ActivationStrings, ActivationUiOptions, TrialFeature } from '@moonbase.sh/licensing';
|
|
1
|
+
import { ActivationStatus, ActivationUiOptions, ActivationControllerOptions, ActivationScreen, ActivationController, ActivationState } from '@moonbase.sh/licensing';
|
|
2
|
+
export { ActivationError, ActivationErrorKind, ActivationLogger, ActivationScreen, ActivationState, ActivationStatus, ActivationStrings, ActivationUiOptions, LicenseView, LockReason, MoonbaseError, ReleaseNotCoveredError, TrialFeature } from '@moonbase.sh/licensing';
|
|
3
3
|
import { ReactElement } from 'react';
|
|
4
4
|
|
|
5
5
|
/** How the update download is going, as the update screen shows it. */
|
|
@@ -13,13 +13,97 @@ interface DownloadState {
|
|
|
13
13
|
upgradeUrl: string | null;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/** An open or save dialog, as Gorilla Engine's `openFileChooser` takes it. */
|
|
17
|
+
interface FileDialogOptions {
|
|
18
|
+
allowMultiple?: boolean;
|
|
19
|
+
saveDialog?: boolean;
|
|
20
|
+
warnOnOverwrite?: boolean;
|
|
21
|
+
hint?: string;
|
|
22
|
+
allowedExtensions?: string;
|
|
23
|
+
defaultLocation?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* What the module needs from the plugin's host. Every plugin gets Gorilla
|
|
27
|
+
* Engine's ({@link gorillaEngineHost}); pass parts of your own as `host` for
|
|
28
|
+
* tests, or to route them elsewhere.
|
|
29
|
+
*/
|
|
30
|
+
interface GorillaEngineHost {
|
|
31
|
+
/** The plugin's name, as it was built. Empty when not known. */
|
|
32
|
+
pluginName: () => string;
|
|
33
|
+
/** The plugin's manufacturer, as it was built. Empty when not known. */
|
|
34
|
+
manufacturerName: () => string;
|
|
35
|
+
/** Open a link in the browser. */
|
|
36
|
+
openUrl: (url: string) => void | Promise<void>;
|
|
37
|
+
/** Put text on the clipboard. */
|
|
38
|
+
copyText: (text: string) => Promise<void>;
|
|
39
|
+
/** Show an open or save dialog: the paths chosen, none when cancelled. Absent when there is no dialog. */
|
|
40
|
+
chooseFile?: (options: FileDialogOptions) => Promise<string[]>;
|
|
41
|
+
/** Show a file in the file manager. */
|
|
42
|
+
reveal: (file: string) => Promise<void>;
|
|
43
|
+
/** The folder downloads go to, and the machine file when there is no dialog. */
|
|
44
|
+
downloadsFolder: () => string;
|
|
45
|
+
/** Turn the plugin's MIDI and audio on or off. Absent when the host can't. */
|
|
46
|
+
setAudioAndMidi?: (enabled: boolean) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Calls the listener when the plugin's window gains or loses focus, and
|
|
49
|
+
* returns a function that stops it. Absent when the host doesn't say, as
|
|
50
|
+
* Gorilla Engine doesn't: the overlay then goes by the pointer entering it.
|
|
51
|
+
*/
|
|
52
|
+
onFocusChange?: (listener: (focused: boolean) => void) => () => void;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Gorilla Engine's host: its browser call, file dialogs and MIDI and audio
|
|
56
|
+
* switches, and the system's clipboard and file manager, which Gorilla Engine
|
|
57
|
+
* has no calls for.
|
|
58
|
+
*/
|
|
59
|
+
declare function gorillaEngineHost(): GorillaEngineHost;
|
|
60
|
+
/** The names of the folder a license is kept in, apart from how the plugin is branded. */
|
|
61
|
+
interface LicenseStorage {
|
|
62
|
+
manufacturer: string;
|
|
63
|
+
plugin: string;
|
|
64
|
+
}
|
|
16
65
|
/**
|
|
17
66
|
* Where a Gorilla Engine plugin keeps the license by default: the manufacturer's
|
|
18
67
|
* folder for user data, as Gorilla Engine's own Product Hub library does.
|
|
19
68
|
* `~/Library/Application Support/<manufacturer>/<plugin>/license.mb` on macOS and
|
|
20
|
-
* `%APPDATA%\<manufacturer>\<plugin>\license.mb` on Windows.
|
|
69
|
+
* `%APPDATA%\<manufacturer>\<plugin>\license.mb` on Windows. The names are
|
|
70
|
+
* `storage`'s, or else the ones the plugin was built with. Throws when there
|
|
71
|
+
* are neither, as in a test without Gorilla Engine, rather than pick a folder
|
|
72
|
+
* another plugin could share.
|
|
21
73
|
*/
|
|
22
|
-
declare function defaultLicenseFile(): string;
|
|
74
|
+
declare function defaultLicenseFile(storage?: LicenseStorage, host?: Pick<GorillaEngineHost, 'pluginName' | 'manufacturerName'>): string;
|
|
75
|
+
/** Something the overlay or the host could not do, as `onError` hears of it. */
|
|
76
|
+
interface GorillaEngineFailure {
|
|
77
|
+
/** What failed: the overlay's action, such as `openLink`, or `audioAndMidi`. */
|
|
78
|
+
action: string;
|
|
79
|
+
/** The SDK's error type, the module's error kind (`notLicensed`, `busy`, ...), or `internal`. */
|
|
80
|
+
kind: string;
|
|
81
|
+
message: string;
|
|
82
|
+
error: unknown;
|
|
83
|
+
}
|
|
84
|
+
/** A report for support, without the license, links, personal details or the device's identity. */
|
|
85
|
+
interface GorillaEngineDiagnostics {
|
|
86
|
+
module: string;
|
|
87
|
+
licensing: string;
|
|
88
|
+
platform: string;
|
|
89
|
+
/** Where the license is kept, with the home folder as `~`. */
|
|
90
|
+
licenseFile: string;
|
|
91
|
+
status: ActivationStatus;
|
|
92
|
+
licensed: boolean;
|
|
93
|
+
/** Which of the host's optional parts are there. */
|
|
94
|
+
host: {
|
|
95
|
+
gorillaEngine: boolean;
|
|
96
|
+
fileDialog: boolean;
|
|
97
|
+
audioAndMidi: boolean;
|
|
98
|
+
focus: boolean;
|
|
99
|
+
};
|
|
100
|
+
/** Whether the module gates MIDI and audio, and whether it last turned them on. Null before it has. */
|
|
101
|
+
audioAndMidi: {
|
|
102
|
+
gated: boolean;
|
|
103
|
+
enabled: boolean | null;
|
|
104
|
+
};
|
|
105
|
+
overlayVisible: boolean;
|
|
106
|
+
}
|
|
23
107
|
/** Branding and behaviour of the built-in activation overlay. */
|
|
24
108
|
interface GorillaEngineUiOptions extends ActivationUiOptions {
|
|
25
109
|
/**
|
|
@@ -42,15 +126,37 @@ interface GorillaEngineUiOptions extends ActivationUiOptions {
|
|
|
42
126
|
interface MoonbaseGorillaEngineOptions extends Omit<ActivationControllerOptions, 'licenseFile' | 'openUrl' | 'productName' | 'accountName'> {
|
|
43
127
|
/** Where the license is kept. Defaults to {@link defaultLicenseFile}. */
|
|
44
128
|
licenseFile?: string;
|
|
45
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* The names of the folder the license is kept in, instead of the names the
|
|
131
|
+
* plugin was built with. Set them once and keep them, so that renaming the
|
|
132
|
+
* plugin keeps its customers' licenses.
|
|
133
|
+
*/
|
|
134
|
+
storage?: LicenseStorage;
|
|
135
|
+
/**
|
|
136
|
+
* Where earlier versions of the plugin kept the license. When the license
|
|
137
|
+
* file is missing, the first of these that exists is copied to it at startup
|
|
138
|
+
* and checked like any stored license. The old file stays, for versions still
|
|
139
|
+
* installed beside this one.
|
|
140
|
+
*/
|
|
141
|
+
previousLicenseFiles?: string[];
|
|
142
|
+
/** Opens a link in the browser: `host.openUrl`, for short. */
|
|
46
143
|
openUrl?: (url: string) => void | Promise<void>;
|
|
144
|
+
/** The host's browser, clipboard, dialogs and MIDI and audio switches. Defaults to Gorilla Engine's. */
|
|
145
|
+
host?: Partial<GorillaEngineHost>;
|
|
47
146
|
/**
|
|
48
147
|
* Turn the plugin's MIDI and audio on while it is licensed (a license or a
|
|
49
148
|
* trial) and off while it is not, through `GorillaEngine.getPluginMM` and
|
|
50
|
-
* `getPluginAE
|
|
51
|
-
*
|
|
149
|
+
* `getPluginAE`: off from `start()`, until the stored license is checked. Pair
|
|
150
|
+
* it with the project's `audioEnabledOnStartup` and `midiEnabledOnStartup`
|
|
151
|
+
* set to false, which cover the moment before the plugin's JavaScript runs.
|
|
152
|
+
* On by default.
|
|
52
153
|
*/
|
|
53
154
|
lockAudioAndMidi?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Called with whatever the overlay or the host could not do, such as open the
|
|
157
|
+
* browser. Defaults to a warning in the log.
|
|
158
|
+
*/
|
|
159
|
+
onError?: (failure: GorillaEngineFailure) => void;
|
|
54
160
|
/** The built-in activation overlay's branding and behaviour. */
|
|
55
161
|
ui?: GorillaEngineUiOptions;
|
|
56
162
|
}
|
|
@@ -68,9 +174,11 @@ interface ActivationUiState {
|
|
|
68
174
|
* with Gorilla Engine's runtime for the browser, file dialogs and the plugin's
|
|
69
175
|
* MIDI and audio, and the state behind the `MoonbaseActivation` overlay.
|
|
70
176
|
*
|
|
71
|
-
* Create one per plugin instance,
|
|
72
|
-
*
|
|
73
|
-
*
|
|
177
|
+
* Create one per plugin instance, at the top level of the plugin's script
|
|
178
|
+
* rather than in a component, and call {@link start}. It lives as long as the
|
|
179
|
+
* plugin does: closing the plugin's window leaves it running, and nothing needs
|
|
180
|
+
* to dispose it. Instances share the license file, so activating in one unlocks
|
|
181
|
+
* the others within a few seconds.
|
|
74
182
|
*/
|
|
75
183
|
declare class MoonbaseGorillaEngine extends ActivationController {
|
|
76
184
|
/** The overlay's branding and behaviour. */
|
|
@@ -78,18 +186,43 @@ declare class MoonbaseGorillaEngine extends ActivationController {
|
|
|
78
186
|
/** The endpoint, for the overlay's links. */
|
|
79
187
|
readonly endpoint: string;
|
|
80
188
|
private readonly lockAudioAndMidi;
|
|
189
|
+
private readonly host;
|
|
190
|
+
private readonly previousLicenseFiles;
|
|
191
|
+
private readonly onError;
|
|
81
192
|
private readonly uiListeners;
|
|
82
193
|
private uiState;
|
|
83
194
|
private lastLicensed;
|
|
84
195
|
private gated;
|
|
196
|
+
private gateMissingReported;
|
|
85
197
|
private downloaded;
|
|
86
198
|
private name;
|
|
199
|
+
private hasStarted;
|
|
200
|
+
private disposed;
|
|
201
|
+
private stopFocus;
|
|
202
|
+
/** Aborts the update download when the instance is disposed. */
|
|
203
|
+
private readonly aborts;
|
|
87
204
|
constructor(options: MoonbaseGorillaEngineOptions);
|
|
88
205
|
/**
|
|
89
206
|
* Validate the stored license, start watching it, and bring the overlay up
|
|
90
|
-
* when the plugin has no license. Call once per plugin instance
|
|
207
|
+
* when the plugin has no license. Call once per plugin instance; a disposed
|
|
208
|
+
* instance can't start again.
|
|
91
209
|
*/
|
|
92
210
|
start(): void;
|
|
211
|
+
/**
|
|
212
|
+
* Stop watching the license and stop telling the overlay anything. For tests
|
|
213
|
+
* and development reloads: a plugin does not need it. Safe to call twice;
|
|
214
|
+
* afterwards the overlay calls do nothing and {@link start} throws.
|
|
215
|
+
*/
|
|
216
|
+
dispose(): void;
|
|
217
|
+
/** When the license file is missing, take the one an earlier version kept. */
|
|
218
|
+
private importPreviousLicense;
|
|
219
|
+
/**
|
|
220
|
+
* Hand a failure to `onError`: the overlay does with every action that
|
|
221
|
+
* fails, and the module with the host's.
|
|
222
|
+
*/
|
|
223
|
+
reportError(action: string, error: unknown): void;
|
|
224
|
+
/** A report for support: versions, where the license is kept and what the host can do, but nothing personal. */
|
|
225
|
+
diagnostics(): GorillaEngineDiagnostics;
|
|
93
226
|
/** This computer's name, as the activation screen shows it. */
|
|
94
227
|
get deviceName(): string;
|
|
95
228
|
/** What the overlay shows, besides the license state. */
|
|
@@ -98,6 +231,8 @@ declare class MoonbaseGorillaEngine extends ActivationController {
|
|
|
98
231
|
subscribeUi(listener: () => void): () => void;
|
|
99
232
|
private setUi;
|
|
100
233
|
private afterStateChange;
|
|
234
|
+
/** Turn MIDI and audio on or off, saying so when the host can't. */
|
|
235
|
+
private gate;
|
|
101
236
|
/**
|
|
102
237
|
* Show the activation overlay, optionally on a particular screen. Without one
|
|
103
238
|
* it shows whatever the license state calls for.
|
|
@@ -184,4 +319,4 @@ interface MoonbaseActivationProps {
|
|
|
184
319
|
*/
|
|
185
320
|
declare function MoonbaseActivation(props: MoonbaseActivationProps): ReactElement | null;
|
|
186
321
|
|
|
187
|
-
export { type ActivationUiState, type GorillaEngineUiOptions, MoonbaseActivation, type MoonbaseActivationProps, MoonbaseGorillaEngine, type MoonbaseGorillaEngineOptions, createMoonbase, defaultLicenseFile, useMoonbaseState };
|
|
322
|
+
export { type ActivationUiState, type FileDialogOptions, type GorillaEngineDiagnostics, type GorillaEngineFailure, type GorillaEngineHost, type GorillaEngineUiOptions, type LicenseStorage, MoonbaseActivation, type MoonbaseActivationProps, MoonbaseGorillaEngine, type MoonbaseGorillaEngineOptions, createMoonbase, defaultLicenseFile, gorillaEngineHost, useMoonbaseState };
|