@openfin/core 45.100.99 → 45.100.101
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 +123 -1
- package/out/mock-beta.d.ts +123 -1
- package/out/mock-public.d.ts +123 -1
- package/out/stub.d.ts +123 -1
- package/out/stub.js +27 -0
- package/out/stub.mjs +27 -0
- package/package.json +1 -1
package/out/mock-alpha.d.ts
CHANGED
|
@@ -5360,7 +5360,7 @@ declare type Event_4 = (WebContentsEvents.Event<'view'> & {
|
|
|
5360
5360
|
*/
|
|
5361
5361
|
declare type Event_5<Topic extends string> = {
|
|
5362
5362
|
topic: Topic;
|
|
5363
|
-
} & (BlurredEvent | CertificateSelectionShownEvent | CrashedEvent_2 | DidChangeThemeColorEvent | FocusedEvent | NavigationRejectedEvent | UrlChangedEvent | DidFailLoadEvent | DidFinishLoadEvent | DidStartLoadingEvent | PageFaviconUpdatedEvent | PageTitleUpdatedEvent | ResourceLoadFailedEvent | ResourceResponseReceivedEvent | ChildContentBlockedEvent | ChildContentOpenedInBrowserEvent | ChildViewCreatedEvent | ChildWindowCreatedEvent | FileDownloadStartedEvent | FileDownloadProgressEvent | FileDownloadCompletedEvent | FoundInPageEvent | CertificateErrorEvent | ContentBlockedEvent | WillRedirectEvent | ClipboardCopyBlockedEvent | ClipboardPasteBlockedEvent);
|
|
5363
|
+
} & (BlurredEvent | CertificateSelectionShownEvent | CrashedEvent_2 | DidChangeThemeColorEvent | FocusedEvent | NavigationRejectedEvent | UrlChangedEvent | DidFailLoadEvent | DidFinishLoadEvent | DidStartLoadingEvent | PageFaviconUpdatedEvent | PageTitleUpdatedEvent | ResourceLoadFailedEvent | ResourceResponseReceivedEvent | ChildContentBlockedEvent | ChildContentOpenedInBrowserEvent | ChildViewCreatedEvent | ChildWindowCreatedEvent | FileDownloadStartedEvent | FileDownloadProgressEvent | FileDownloadCompletedEvent | FoundInPageEvent | CertificateErrorEvent | ContentBlockedEvent | WillRedirectEvent | ClipboardCopyBlockedEvent | ClipboardPasteBlockedEvent | TranslationStateChangedEvent);
|
|
5364
5364
|
|
|
5365
5365
|
/**
|
|
5366
5366
|
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing every possible event that can be emitted by a {@link Window}. Events are
|
|
@@ -5844,6 +5844,19 @@ declare type ExternalProcessStartedEvent = BaseEvent_5 & {
|
|
|
5844
5844
|
processUuid: string;
|
|
5845
5845
|
};
|
|
5846
5846
|
|
|
5847
|
+
/**
|
|
5848
|
+
* Translation status of a translatable WebContents whose translation attempt has failed.
|
|
5849
|
+
*/
|
|
5850
|
+
declare type FailedTranslationStatus = {
|
|
5851
|
+
status: 'translation-failed';
|
|
5852
|
+
/** The language the page was being translated from. */
|
|
5853
|
+
sourceLanguage: LanguageInfo;
|
|
5854
|
+
/** The language the page was being translated to. */
|
|
5855
|
+
targetLanguage: LanguageInfo;
|
|
5856
|
+
/** Human-readable description of why the translation failed. */
|
|
5857
|
+
errorMessage: string;
|
|
5858
|
+
};
|
|
5859
|
+
|
|
5847
5860
|
/**
|
|
5848
5861
|
* @deprecated, use {@link PageFaviconUpdatedEvent}.
|
|
5849
5862
|
*/
|
|
@@ -8174,6 +8187,18 @@ declare type JumpListTask = {
|
|
|
8174
8187
|
iconIndex?: number;
|
|
8175
8188
|
};
|
|
8176
8189
|
|
|
8190
|
+
/**
|
|
8191
|
+
* Language metadata for content translation.
|
|
8192
|
+
*/
|
|
8193
|
+
declare type LanguageInfo = {
|
|
8194
|
+
/** ISO language code (e.g. "fr"). */
|
|
8195
|
+
code: string;
|
|
8196
|
+
/** English display name of the language (e.g. "French"). */
|
|
8197
|
+
nameEn: string;
|
|
8198
|
+
/** Localized display name of the language (e.g. "Français"). */
|
|
8199
|
+
nameI18N: string;
|
|
8200
|
+
};
|
|
8201
|
+
|
|
8177
8202
|
/**
|
|
8178
8203
|
* The LaunchEmitter is an `EventEmitter`. It can listen to app version resolver events.
|
|
8179
8204
|
*
|
|
@@ -10800,6 +10825,14 @@ declare namespace OpenFin_2 {
|
|
|
10800
10825
|
ClientChangedContextGroup,
|
|
10801
10826
|
InteropClientEvents,
|
|
10802
10827
|
ChromeBrowser,
|
|
10828
|
+
LanguageInfo,
|
|
10829
|
+
PageTranslateOptions,
|
|
10830
|
+
FailedTranslationStatus,
|
|
10831
|
+
TranslatedPageStatus,
|
|
10832
|
+
TranslationStatus,
|
|
10833
|
+
UntranslatableWebContentInfo,
|
|
10834
|
+
TranslatableWebContentInfo,
|
|
10835
|
+
WebContentTranslationInfo,
|
|
10803
10836
|
ApplicationEvents,
|
|
10804
10837
|
BaseEvents,
|
|
10805
10838
|
ExternalApplicationEvents,
|
|
@@ -10868,6 +10901,16 @@ declare type PageTitleUpdatedEvent = NamedEvent & {
|
|
|
10868
10901
|
title: string;
|
|
10869
10902
|
};
|
|
10870
10903
|
|
|
10904
|
+
/**
|
|
10905
|
+
* Options for {@link OpenFin.WebContents.translatePage}.
|
|
10906
|
+
*/
|
|
10907
|
+
declare type PageTranslateOptions = {
|
|
10908
|
+
/** BCP-47 language code of the source language, or empty string for auto-detect. */
|
|
10909
|
+
sourceLang: string;
|
|
10910
|
+
/** BCP-47 language code of the target language. */
|
|
10911
|
+
targetLang: string;
|
|
10912
|
+
};
|
|
10913
|
+
|
|
10871
10914
|
/**
|
|
10872
10915
|
* Reasons for a paste operation being blocked
|
|
10873
10916
|
*
|
|
@@ -13916,6 +13959,12 @@ declare type ProtocolMap = ExternalAdapterOnlyCallsMap & AnalyticsProtocolMap &
|
|
|
13916
13959
|
request: OpenFin_2.Identity;
|
|
13917
13960
|
response: OpenFin_2.ScreenCapturePermission;
|
|
13918
13961
|
};
|
|
13962
|
+
'translate-page': IdentityCall<{
|
|
13963
|
+
sourceLang: string;
|
|
13964
|
+
targetLang: string;
|
|
13965
|
+
}, void>;
|
|
13966
|
+
'revert-translation': IdentityCall<{}, void>;
|
|
13967
|
+
'get-translation-state': IdentityCall<{}, OpenFin_2.WebContentTranslationInfo>;
|
|
13919
13968
|
'render-overlay': {
|
|
13920
13969
|
request: {
|
|
13921
13970
|
bounds: OpenFin_2.Bounds;
|
|
@@ -17410,6 +17459,45 @@ declare type TransitionOptions = {
|
|
|
17410
17459
|
tween?: tween;
|
|
17411
17460
|
};
|
|
17412
17461
|
|
|
17462
|
+
/**
|
|
17463
|
+
* Describes a WebContents on which content translation is supported.
|
|
17464
|
+
*/
|
|
17465
|
+
declare type TranslatableWebContentInfo = {
|
|
17466
|
+
/** Whether translation is supported on this WebContents. */
|
|
17467
|
+
translationEnabled: true;
|
|
17468
|
+
/** Detected WebContents language, or undefined if not yet determined. */
|
|
17469
|
+
detectedLanguage?: LanguageInfo;
|
|
17470
|
+
/** Translation status of the WebContents. */
|
|
17471
|
+
state: TranslationStatus;
|
|
17472
|
+
};
|
|
17473
|
+
|
|
17474
|
+
/**
|
|
17475
|
+
* Translation status of a translatable WebContents that is translated or is being translated.
|
|
17476
|
+
*/
|
|
17477
|
+
declare type TranslatedPageStatus = {
|
|
17478
|
+
status: 'pending-translation' | 'translated';
|
|
17479
|
+
/** The language the page is being translated from. */
|
|
17480
|
+
sourceLanguage: LanguageInfo;
|
|
17481
|
+
/** The language the page is being translated to. */
|
|
17482
|
+
targetLanguage: LanguageInfo;
|
|
17483
|
+
};
|
|
17484
|
+
|
|
17485
|
+
/**
|
|
17486
|
+
* Generated when the translation state of a WebContents changes, such as when a page in a
|
|
17487
|
+
* foreign language is detected or when a translation completes.
|
|
17488
|
+
* @interface
|
|
17489
|
+
*/
|
|
17490
|
+
declare type TranslationStateChangedEvent = NamedEvent & {
|
|
17491
|
+
type: 'translation-state-changed';
|
|
17492
|
+
} & OpenFin_2.WebContentTranslationInfo;
|
|
17493
|
+
|
|
17494
|
+
/**
|
|
17495
|
+
* The translation status of a translatable WebContents.
|
|
17496
|
+
*/
|
|
17497
|
+
declare type TranslationStatus = {
|
|
17498
|
+
status: 'untranslated';
|
|
17499
|
+
} | FailedTranslationStatus | TranslatedPageStatus;
|
|
17500
|
+
|
|
17413
17501
|
declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
|
|
17414
17502
|
#private;
|
|
17415
17503
|
protected wireListeners: Map<number, {
|
|
@@ -17509,6 +17597,14 @@ declare type UnregisteredEvent = BaseEvent_8 & {
|
|
|
17509
17597
|
type: 'unregistered';
|
|
17510
17598
|
};
|
|
17511
17599
|
|
|
17600
|
+
/**
|
|
17601
|
+
* Describes a WebContents on which content translation is not supported (for example because no
|
|
17602
|
+
* translation API key is configured on the machine, or the current page is not translatable).
|
|
17603
|
+
*/
|
|
17604
|
+
declare type UntranslatableWebContentInfo = {
|
|
17605
|
+
translationEnabled: false;
|
|
17606
|
+
};
|
|
17607
|
+
|
|
17512
17608
|
/**
|
|
17513
17609
|
* View options that can be updated after creation.
|
|
17514
17610
|
*
|
|
@@ -18609,6 +18705,26 @@ declare class WebContents<T extends BaseEvent> extends EmitterBase<T> {
|
|
|
18609
18705
|
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
18610
18706
|
*/
|
|
18611
18707
|
setZoomLevel(level: number): Promise<void>;
|
|
18708
|
+
/**
|
|
18709
|
+
* Translates the WebContents from the source language to the target language.
|
|
18710
|
+
*
|
|
18711
|
+
* Translation requires a translation API key to be configured on the machine. If translation is
|
|
18712
|
+
* unavailable, the call is a no-op and a `translation-state-changed` event is emitted describing
|
|
18713
|
+
* the failure.
|
|
18714
|
+
*
|
|
18715
|
+
* @param options Source and target languages for the translation.
|
|
18716
|
+
*/
|
|
18717
|
+
translatePage(options: OpenFin_2.PageTranslateOptions): Promise<void>;
|
|
18718
|
+
/**
|
|
18719
|
+
* Reverts a previously translated WebContents back to its original language.
|
|
18720
|
+
*
|
|
18721
|
+
* If the WebContents is not currently translated, this is a no-op and resolves successfully.
|
|
18722
|
+
*/
|
|
18723
|
+
revertTranslation(): Promise<void>;
|
|
18724
|
+
/**
|
|
18725
|
+
* Gets the current content-translation state of the WebContents.
|
|
18726
|
+
*/
|
|
18727
|
+
getTranslationState(): Promise<OpenFin_2.WebContentTranslationInfo>;
|
|
18612
18728
|
/**
|
|
18613
18729
|
* Navigates the WebContents to a specified URL.
|
|
18614
18730
|
*
|
|
@@ -19426,6 +19542,7 @@ declare namespace WebContentsEvents {
|
|
|
19426
19542
|
ContentBlockedEvent,
|
|
19427
19543
|
ClipboardCopyBlockedEvent,
|
|
19428
19544
|
ClipboardPasteBlockedEvent,
|
|
19545
|
+
TranslationStateChangedEvent,
|
|
19429
19546
|
Event_5 as Event,
|
|
19430
19547
|
WebContentsEvent,
|
|
19431
19548
|
WillPropagateWebContentsEvent,
|
|
@@ -19434,6 +19551,11 @@ declare namespace WebContentsEvents {
|
|
|
19434
19551
|
}
|
|
19435
19552
|
}
|
|
19436
19553
|
|
|
19554
|
+
/**
|
|
19555
|
+
* Describes the current content-translation state of a WebContents.
|
|
19556
|
+
*/
|
|
19557
|
+
declare type WebContentTranslationInfo = UntranslatableWebContentInfo | TranslatableWebContentInfo;
|
|
19558
|
+
|
|
19437
19559
|
declare type WebNotificationInfo = {
|
|
19438
19560
|
notificationId: string;
|
|
19439
19561
|
properties: WebNotificationProperties;
|
package/out/mock-beta.d.ts
CHANGED
|
@@ -5360,7 +5360,7 @@ declare type Event_4 = (WebContentsEvents.Event<'view'> & {
|
|
|
5360
5360
|
*/
|
|
5361
5361
|
declare type Event_5<Topic extends string> = {
|
|
5362
5362
|
topic: Topic;
|
|
5363
|
-
} & (BlurredEvent | CertificateSelectionShownEvent | CrashedEvent_2 | DidChangeThemeColorEvent | FocusedEvent | NavigationRejectedEvent | UrlChangedEvent | DidFailLoadEvent | DidFinishLoadEvent | DidStartLoadingEvent | PageFaviconUpdatedEvent | PageTitleUpdatedEvent | ResourceLoadFailedEvent | ResourceResponseReceivedEvent | ChildContentBlockedEvent | ChildContentOpenedInBrowserEvent | ChildViewCreatedEvent | ChildWindowCreatedEvent | FileDownloadStartedEvent | FileDownloadProgressEvent | FileDownloadCompletedEvent | FoundInPageEvent | CertificateErrorEvent | ContentBlockedEvent | WillRedirectEvent | ClipboardCopyBlockedEvent | ClipboardPasteBlockedEvent);
|
|
5363
|
+
} & (BlurredEvent | CertificateSelectionShownEvent | CrashedEvent_2 | DidChangeThemeColorEvent | FocusedEvent | NavigationRejectedEvent | UrlChangedEvent | DidFailLoadEvent | DidFinishLoadEvent | DidStartLoadingEvent | PageFaviconUpdatedEvent | PageTitleUpdatedEvent | ResourceLoadFailedEvent | ResourceResponseReceivedEvent | ChildContentBlockedEvent | ChildContentOpenedInBrowserEvent | ChildViewCreatedEvent | ChildWindowCreatedEvent | FileDownloadStartedEvent | FileDownloadProgressEvent | FileDownloadCompletedEvent | FoundInPageEvent | CertificateErrorEvent | ContentBlockedEvent | WillRedirectEvent | ClipboardCopyBlockedEvent | ClipboardPasteBlockedEvent | TranslationStateChangedEvent);
|
|
5364
5364
|
|
|
5365
5365
|
/**
|
|
5366
5366
|
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing every possible event that can be emitted by a {@link Window}. Events are
|
|
@@ -5844,6 +5844,19 @@ declare type ExternalProcessStartedEvent = BaseEvent_5 & {
|
|
|
5844
5844
|
processUuid: string;
|
|
5845
5845
|
};
|
|
5846
5846
|
|
|
5847
|
+
/**
|
|
5848
|
+
* Translation status of a translatable WebContents whose translation attempt has failed.
|
|
5849
|
+
*/
|
|
5850
|
+
declare type FailedTranslationStatus = {
|
|
5851
|
+
status: 'translation-failed';
|
|
5852
|
+
/** The language the page was being translated from. */
|
|
5853
|
+
sourceLanguage: LanguageInfo;
|
|
5854
|
+
/** The language the page was being translated to. */
|
|
5855
|
+
targetLanguage: LanguageInfo;
|
|
5856
|
+
/** Human-readable description of why the translation failed. */
|
|
5857
|
+
errorMessage: string;
|
|
5858
|
+
};
|
|
5859
|
+
|
|
5847
5860
|
/**
|
|
5848
5861
|
* @deprecated, use {@link PageFaviconUpdatedEvent}.
|
|
5849
5862
|
*/
|
|
@@ -8174,6 +8187,18 @@ declare type JumpListTask = {
|
|
|
8174
8187
|
iconIndex?: number;
|
|
8175
8188
|
};
|
|
8176
8189
|
|
|
8190
|
+
/**
|
|
8191
|
+
* Language metadata for content translation.
|
|
8192
|
+
*/
|
|
8193
|
+
declare type LanguageInfo = {
|
|
8194
|
+
/** ISO language code (e.g. "fr"). */
|
|
8195
|
+
code: string;
|
|
8196
|
+
/** English display name of the language (e.g. "French"). */
|
|
8197
|
+
nameEn: string;
|
|
8198
|
+
/** Localized display name of the language (e.g. "Français"). */
|
|
8199
|
+
nameI18N: string;
|
|
8200
|
+
};
|
|
8201
|
+
|
|
8177
8202
|
/**
|
|
8178
8203
|
* The LaunchEmitter is an `EventEmitter`. It can listen to app version resolver events.
|
|
8179
8204
|
*
|
|
@@ -10800,6 +10825,14 @@ declare namespace OpenFin_2 {
|
|
|
10800
10825
|
ClientChangedContextGroup,
|
|
10801
10826
|
InteropClientEvents,
|
|
10802
10827
|
ChromeBrowser,
|
|
10828
|
+
LanguageInfo,
|
|
10829
|
+
PageTranslateOptions,
|
|
10830
|
+
FailedTranslationStatus,
|
|
10831
|
+
TranslatedPageStatus,
|
|
10832
|
+
TranslationStatus,
|
|
10833
|
+
UntranslatableWebContentInfo,
|
|
10834
|
+
TranslatableWebContentInfo,
|
|
10835
|
+
WebContentTranslationInfo,
|
|
10803
10836
|
ApplicationEvents,
|
|
10804
10837
|
BaseEvents,
|
|
10805
10838
|
ExternalApplicationEvents,
|
|
@@ -10868,6 +10901,16 @@ declare type PageTitleUpdatedEvent = NamedEvent & {
|
|
|
10868
10901
|
title: string;
|
|
10869
10902
|
};
|
|
10870
10903
|
|
|
10904
|
+
/**
|
|
10905
|
+
* Options for {@link OpenFin.WebContents.translatePage}.
|
|
10906
|
+
*/
|
|
10907
|
+
declare type PageTranslateOptions = {
|
|
10908
|
+
/** BCP-47 language code of the source language, or empty string for auto-detect. */
|
|
10909
|
+
sourceLang: string;
|
|
10910
|
+
/** BCP-47 language code of the target language. */
|
|
10911
|
+
targetLang: string;
|
|
10912
|
+
};
|
|
10913
|
+
|
|
10871
10914
|
/**
|
|
10872
10915
|
* Reasons for a paste operation being blocked
|
|
10873
10916
|
*
|
|
@@ -13916,6 +13959,12 @@ declare type ProtocolMap = ExternalAdapterOnlyCallsMap & AnalyticsProtocolMap &
|
|
|
13916
13959
|
request: OpenFin_2.Identity;
|
|
13917
13960
|
response: OpenFin_2.ScreenCapturePermission;
|
|
13918
13961
|
};
|
|
13962
|
+
'translate-page': IdentityCall<{
|
|
13963
|
+
sourceLang: string;
|
|
13964
|
+
targetLang: string;
|
|
13965
|
+
}, void>;
|
|
13966
|
+
'revert-translation': IdentityCall<{}, void>;
|
|
13967
|
+
'get-translation-state': IdentityCall<{}, OpenFin_2.WebContentTranslationInfo>;
|
|
13919
13968
|
'render-overlay': {
|
|
13920
13969
|
request: {
|
|
13921
13970
|
bounds: OpenFin_2.Bounds;
|
|
@@ -17410,6 +17459,45 @@ declare type TransitionOptions = {
|
|
|
17410
17459
|
tween?: tween;
|
|
17411
17460
|
};
|
|
17412
17461
|
|
|
17462
|
+
/**
|
|
17463
|
+
* Describes a WebContents on which content translation is supported.
|
|
17464
|
+
*/
|
|
17465
|
+
declare type TranslatableWebContentInfo = {
|
|
17466
|
+
/** Whether translation is supported on this WebContents. */
|
|
17467
|
+
translationEnabled: true;
|
|
17468
|
+
/** Detected WebContents language, or undefined if not yet determined. */
|
|
17469
|
+
detectedLanguage?: LanguageInfo;
|
|
17470
|
+
/** Translation status of the WebContents. */
|
|
17471
|
+
state: TranslationStatus;
|
|
17472
|
+
};
|
|
17473
|
+
|
|
17474
|
+
/**
|
|
17475
|
+
* Translation status of a translatable WebContents that is translated or is being translated.
|
|
17476
|
+
*/
|
|
17477
|
+
declare type TranslatedPageStatus = {
|
|
17478
|
+
status: 'pending-translation' | 'translated';
|
|
17479
|
+
/** The language the page is being translated from. */
|
|
17480
|
+
sourceLanguage: LanguageInfo;
|
|
17481
|
+
/** The language the page is being translated to. */
|
|
17482
|
+
targetLanguage: LanguageInfo;
|
|
17483
|
+
};
|
|
17484
|
+
|
|
17485
|
+
/**
|
|
17486
|
+
* Generated when the translation state of a WebContents changes, such as when a page in a
|
|
17487
|
+
* foreign language is detected or when a translation completes.
|
|
17488
|
+
* @interface
|
|
17489
|
+
*/
|
|
17490
|
+
declare type TranslationStateChangedEvent = NamedEvent & {
|
|
17491
|
+
type: 'translation-state-changed';
|
|
17492
|
+
} & OpenFin_2.WebContentTranslationInfo;
|
|
17493
|
+
|
|
17494
|
+
/**
|
|
17495
|
+
* The translation status of a translatable WebContents.
|
|
17496
|
+
*/
|
|
17497
|
+
declare type TranslationStatus = {
|
|
17498
|
+
status: 'untranslated';
|
|
17499
|
+
} | FailedTranslationStatus | TranslatedPageStatus;
|
|
17500
|
+
|
|
17413
17501
|
declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
|
|
17414
17502
|
#private;
|
|
17415
17503
|
protected wireListeners: Map<number, {
|
|
@@ -17509,6 +17597,14 @@ declare type UnregisteredEvent = BaseEvent_8 & {
|
|
|
17509
17597
|
type: 'unregistered';
|
|
17510
17598
|
};
|
|
17511
17599
|
|
|
17600
|
+
/**
|
|
17601
|
+
* Describes a WebContents on which content translation is not supported (for example because no
|
|
17602
|
+
* translation API key is configured on the machine, or the current page is not translatable).
|
|
17603
|
+
*/
|
|
17604
|
+
declare type UntranslatableWebContentInfo = {
|
|
17605
|
+
translationEnabled: false;
|
|
17606
|
+
};
|
|
17607
|
+
|
|
17512
17608
|
/**
|
|
17513
17609
|
* View options that can be updated after creation.
|
|
17514
17610
|
*
|
|
@@ -18609,6 +18705,26 @@ declare class WebContents<T extends BaseEvent> extends EmitterBase<T> {
|
|
|
18609
18705
|
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
18610
18706
|
*/
|
|
18611
18707
|
setZoomLevel(level: number): Promise<void>;
|
|
18708
|
+
/**
|
|
18709
|
+
* Translates the WebContents from the source language to the target language.
|
|
18710
|
+
*
|
|
18711
|
+
* Translation requires a translation API key to be configured on the machine. If translation is
|
|
18712
|
+
* unavailable, the call is a no-op and a `translation-state-changed` event is emitted describing
|
|
18713
|
+
* the failure.
|
|
18714
|
+
*
|
|
18715
|
+
* @param options Source and target languages for the translation.
|
|
18716
|
+
*/
|
|
18717
|
+
translatePage(options: OpenFin_2.PageTranslateOptions): Promise<void>;
|
|
18718
|
+
/**
|
|
18719
|
+
* Reverts a previously translated WebContents back to its original language.
|
|
18720
|
+
*
|
|
18721
|
+
* If the WebContents is not currently translated, this is a no-op and resolves successfully.
|
|
18722
|
+
*/
|
|
18723
|
+
revertTranslation(): Promise<void>;
|
|
18724
|
+
/**
|
|
18725
|
+
* Gets the current content-translation state of the WebContents.
|
|
18726
|
+
*/
|
|
18727
|
+
getTranslationState(): Promise<OpenFin_2.WebContentTranslationInfo>;
|
|
18612
18728
|
/**
|
|
18613
18729
|
* Navigates the WebContents to a specified URL.
|
|
18614
18730
|
*
|
|
@@ -19426,6 +19542,7 @@ declare namespace WebContentsEvents {
|
|
|
19426
19542
|
ContentBlockedEvent,
|
|
19427
19543
|
ClipboardCopyBlockedEvent,
|
|
19428
19544
|
ClipboardPasteBlockedEvent,
|
|
19545
|
+
TranslationStateChangedEvent,
|
|
19429
19546
|
Event_5 as Event,
|
|
19430
19547
|
WebContentsEvent,
|
|
19431
19548
|
WillPropagateWebContentsEvent,
|
|
@@ -19434,6 +19551,11 @@ declare namespace WebContentsEvents {
|
|
|
19434
19551
|
}
|
|
19435
19552
|
}
|
|
19436
19553
|
|
|
19554
|
+
/**
|
|
19555
|
+
* Describes the current content-translation state of a WebContents.
|
|
19556
|
+
*/
|
|
19557
|
+
declare type WebContentTranslationInfo = UntranslatableWebContentInfo | TranslatableWebContentInfo;
|
|
19558
|
+
|
|
19437
19559
|
declare type WebNotificationInfo = {
|
|
19438
19560
|
notificationId: string;
|
|
19439
19561
|
properties: WebNotificationProperties;
|
package/out/mock-public.d.ts
CHANGED
|
@@ -5360,7 +5360,7 @@ declare type Event_4 = (WebContentsEvents.Event<'view'> & {
|
|
|
5360
5360
|
*/
|
|
5361
5361
|
declare type Event_5<Topic extends string> = {
|
|
5362
5362
|
topic: Topic;
|
|
5363
|
-
} & (BlurredEvent | CertificateSelectionShownEvent | CrashedEvent_2 | DidChangeThemeColorEvent | FocusedEvent | NavigationRejectedEvent | UrlChangedEvent | DidFailLoadEvent | DidFinishLoadEvent | DidStartLoadingEvent | PageFaviconUpdatedEvent | PageTitleUpdatedEvent | ResourceLoadFailedEvent | ResourceResponseReceivedEvent | ChildContentBlockedEvent | ChildContentOpenedInBrowserEvent | ChildViewCreatedEvent | ChildWindowCreatedEvent | FileDownloadStartedEvent | FileDownloadProgressEvent | FileDownloadCompletedEvent | FoundInPageEvent | CertificateErrorEvent | ContentBlockedEvent | WillRedirectEvent | ClipboardCopyBlockedEvent | ClipboardPasteBlockedEvent);
|
|
5363
|
+
} & (BlurredEvent | CertificateSelectionShownEvent | CrashedEvent_2 | DidChangeThemeColorEvent | FocusedEvent | NavigationRejectedEvent | UrlChangedEvent | DidFailLoadEvent | DidFinishLoadEvent | DidStartLoadingEvent | PageFaviconUpdatedEvent | PageTitleUpdatedEvent | ResourceLoadFailedEvent | ResourceResponseReceivedEvent | ChildContentBlockedEvent | ChildContentOpenedInBrowserEvent | ChildViewCreatedEvent | ChildWindowCreatedEvent | FileDownloadStartedEvent | FileDownloadProgressEvent | FileDownloadCompletedEvent | FoundInPageEvent | CertificateErrorEvent | ContentBlockedEvent | WillRedirectEvent | ClipboardCopyBlockedEvent | ClipboardPasteBlockedEvent | TranslationStateChangedEvent);
|
|
5364
5364
|
|
|
5365
5365
|
/**
|
|
5366
5366
|
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing every possible event that can be emitted by a {@link Window}. Events are
|
|
@@ -5844,6 +5844,19 @@ declare type ExternalProcessStartedEvent = BaseEvent_5 & {
|
|
|
5844
5844
|
processUuid: string;
|
|
5845
5845
|
};
|
|
5846
5846
|
|
|
5847
|
+
/**
|
|
5848
|
+
* Translation status of a translatable WebContents whose translation attempt has failed.
|
|
5849
|
+
*/
|
|
5850
|
+
declare type FailedTranslationStatus = {
|
|
5851
|
+
status: 'translation-failed';
|
|
5852
|
+
/** The language the page was being translated from. */
|
|
5853
|
+
sourceLanguage: LanguageInfo;
|
|
5854
|
+
/** The language the page was being translated to. */
|
|
5855
|
+
targetLanguage: LanguageInfo;
|
|
5856
|
+
/** Human-readable description of why the translation failed. */
|
|
5857
|
+
errorMessage: string;
|
|
5858
|
+
};
|
|
5859
|
+
|
|
5847
5860
|
/**
|
|
5848
5861
|
* @deprecated, use {@link PageFaviconUpdatedEvent}.
|
|
5849
5862
|
*/
|
|
@@ -8174,6 +8187,18 @@ declare type JumpListTask = {
|
|
|
8174
8187
|
iconIndex?: number;
|
|
8175
8188
|
};
|
|
8176
8189
|
|
|
8190
|
+
/**
|
|
8191
|
+
* Language metadata for content translation.
|
|
8192
|
+
*/
|
|
8193
|
+
declare type LanguageInfo = {
|
|
8194
|
+
/** ISO language code (e.g. "fr"). */
|
|
8195
|
+
code: string;
|
|
8196
|
+
/** English display name of the language (e.g. "French"). */
|
|
8197
|
+
nameEn: string;
|
|
8198
|
+
/** Localized display name of the language (e.g. "Français"). */
|
|
8199
|
+
nameI18N: string;
|
|
8200
|
+
};
|
|
8201
|
+
|
|
8177
8202
|
/**
|
|
8178
8203
|
* The LaunchEmitter is an `EventEmitter`. It can listen to app version resolver events.
|
|
8179
8204
|
*
|
|
@@ -10800,6 +10825,14 @@ declare namespace OpenFin_2 {
|
|
|
10800
10825
|
ClientChangedContextGroup,
|
|
10801
10826
|
InteropClientEvents,
|
|
10802
10827
|
ChromeBrowser,
|
|
10828
|
+
LanguageInfo,
|
|
10829
|
+
PageTranslateOptions,
|
|
10830
|
+
FailedTranslationStatus,
|
|
10831
|
+
TranslatedPageStatus,
|
|
10832
|
+
TranslationStatus,
|
|
10833
|
+
UntranslatableWebContentInfo,
|
|
10834
|
+
TranslatableWebContentInfo,
|
|
10835
|
+
WebContentTranslationInfo,
|
|
10803
10836
|
ApplicationEvents,
|
|
10804
10837
|
BaseEvents,
|
|
10805
10838
|
ExternalApplicationEvents,
|
|
@@ -10868,6 +10901,16 @@ declare type PageTitleUpdatedEvent = NamedEvent & {
|
|
|
10868
10901
|
title: string;
|
|
10869
10902
|
};
|
|
10870
10903
|
|
|
10904
|
+
/**
|
|
10905
|
+
* Options for {@link OpenFin.WebContents.translatePage}.
|
|
10906
|
+
*/
|
|
10907
|
+
declare type PageTranslateOptions = {
|
|
10908
|
+
/** BCP-47 language code of the source language, or empty string for auto-detect. */
|
|
10909
|
+
sourceLang: string;
|
|
10910
|
+
/** BCP-47 language code of the target language. */
|
|
10911
|
+
targetLang: string;
|
|
10912
|
+
};
|
|
10913
|
+
|
|
10871
10914
|
/**
|
|
10872
10915
|
* Reasons for a paste operation being blocked
|
|
10873
10916
|
*
|
|
@@ -13916,6 +13959,12 @@ declare type ProtocolMap = ExternalAdapterOnlyCallsMap & AnalyticsProtocolMap &
|
|
|
13916
13959
|
request: OpenFin_2.Identity;
|
|
13917
13960
|
response: OpenFin_2.ScreenCapturePermission;
|
|
13918
13961
|
};
|
|
13962
|
+
'translate-page': IdentityCall<{
|
|
13963
|
+
sourceLang: string;
|
|
13964
|
+
targetLang: string;
|
|
13965
|
+
}, void>;
|
|
13966
|
+
'revert-translation': IdentityCall<{}, void>;
|
|
13967
|
+
'get-translation-state': IdentityCall<{}, OpenFin_2.WebContentTranslationInfo>;
|
|
13919
13968
|
'render-overlay': {
|
|
13920
13969
|
request: {
|
|
13921
13970
|
bounds: OpenFin_2.Bounds;
|
|
@@ -17410,6 +17459,45 @@ declare type TransitionOptions = {
|
|
|
17410
17459
|
tween?: tween;
|
|
17411
17460
|
};
|
|
17412
17461
|
|
|
17462
|
+
/**
|
|
17463
|
+
* Describes a WebContents on which content translation is supported.
|
|
17464
|
+
*/
|
|
17465
|
+
declare type TranslatableWebContentInfo = {
|
|
17466
|
+
/** Whether translation is supported on this WebContents. */
|
|
17467
|
+
translationEnabled: true;
|
|
17468
|
+
/** Detected WebContents language, or undefined if not yet determined. */
|
|
17469
|
+
detectedLanguage?: LanguageInfo;
|
|
17470
|
+
/** Translation status of the WebContents. */
|
|
17471
|
+
state: TranslationStatus;
|
|
17472
|
+
};
|
|
17473
|
+
|
|
17474
|
+
/**
|
|
17475
|
+
* Translation status of a translatable WebContents that is translated or is being translated.
|
|
17476
|
+
*/
|
|
17477
|
+
declare type TranslatedPageStatus = {
|
|
17478
|
+
status: 'pending-translation' | 'translated';
|
|
17479
|
+
/** The language the page is being translated from. */
|
|
17480
|
+
sourceLanguage: LanguageInfo;
|
|
17481
|
+
/** The language the page is being translated to. */
|
|
17482
|
+
targetLanguage: LanguageInfo;
|
|
17483
|
+
};
|
|
17484
|
+
|
|
17485
|
+
/**
|
|
17486
|
+
* Generated when the translation state of a WebContents changes, such as when a page in a
|
|
17487
|
+
* foreign language is detected or when a translation completes.
|
|
17488
|
+
* @interface
|
|
17489
|
+
*/
|
|
17490
|
+
declare type TranslationStateChangedEvent = NamedEvent & {
|
|
17491
|
+
type: 'translation-state-changed';
|
|
17492
|
+
} & OpenFin_2.WebContentTranslationInfo;
|
|
17493
|
+
|
|
17494
|
+
/**
|
|
17495
|
+
* The translation status of a translatable WebContents.
|
|
17496
|
+
*/
|
|
17497
|
+
declare type TranslationStatus = {
|
|
17498
|
+
status: 'untranslated';
|
|
17499
|
+
} | FailedTranslationStatus | TranslatedPageStatus;
|
|
17500
|
+
|
|
17413
17501
|
declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
|
|
17414
17502
|
#private;
|
|
17415
17503
|
protected wireListeners: Map<number, {
|
|
@@ -17509,6 +17597,14 @@ declare type UnregisteredEvent = BaseEvent_8 & {
|
|
|
17509
17597
|
type: 'unregistered';
|
|
17510
17598
|
};
|
|
17511
17599
|
|
|
17600
|
+
/**
|
|
17601
|
+
* Describes a WebContents on which content translation is not supported (for example because no
|
|
17602
|
+
* translation API key is configured on the machine, or the current page is not translatable).
|
|
17603
|
+
*/
|
|
17604
|
+
declare type UntranslatableWebContentInfo = {
|
|
17605
|
+
translationEnabled: false;
|
|
17606
|
+
};
|
|
17607
|
+
|
|
17512
17608
|
/**
|
|
17513
17609
|
* View options that can be updated after creation.
|
|
17514
17610
|
*
|
|
@@ -18609,6 +18705,26 @@ declare class WebContents<T extends BaseEvent> extends EmitterBase<T> {
|
|
|
18609
18705
|
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
18610
18706
|
*/
|
|
18611
18707
|
setZoomLevel(level: number): Promise<void>;
|
|
18708
|
+
/**
|
|
18709
|
+
* Translates the WebContents from the source language to the target language.
|
|
18710
|
+
*
|
|
18711
|
+
* Translation requires a translation API key to be configured on the machine. If translation is
|
|
18712
|
+
* unavailable, the call is a no-op and a `translation-state-changed` event is emitted describing
|
|
18713
|
+
* the failure.
|
|
18714
|
+
*
|
|
18715
|
+
* @param options Source and target languages for the translation.
|
|
18716
|
+
*/
|
|
18717
|
+
translatePage(options: OpenFin_2.PageTranslateOptions): Promise<void>;
|
|
18718
|
+
/**
|
|
18719
|
+
* Reverts a previously translated WebContents back to its original language.
|
|
18720
|
+
*
|
|
18721
|
+
* If the WebContents is not currently translated, this is a no-op and resolves successfully.
|
|
18722
|
+
*/
|
|
18723
|
+
revertTranslation(): Promise<void>;
|
|
18724
|
+
/**
|
|
18725
|
+
* Gets the current content-translation state of the WebContents.
|
|
18726
|
+
*/
|
|
18727
|
+
getTranslationState(): Promise<OpenFin_2.WebContentTranslationInfo>;
|
|
18612
18728
|
/**
|
|
18613
18729
|
* Navigates the WebContents to a specified URL.
|
|
18614
18730
|
*
|
|
@@ -19426,6 +19542,7 @@ declare namespace WebContentsEvents {
|
|
|
19426
19542
|
ContentBlockedEvent,
|
|
19427
19543
|
ClipboardCopyBlockedEvent,
|
|
19428
19544
|
ClipboardPasteBlockedEvent,
|
|
19545
|
+
TranslationStateChangedEvent,
|
|
19429
19546
|
Event_5 as Event,
|
|
19430
19547
|
WebContentsEvent,
|
|
19431
19548
|
WillPropagateWebContentsEvent,
|
|
@@ -19434,6 +19551,11 @@ declare namespace WebContentsEvents {
|
|
|
19434
19551
|
}
|
|
19435
19552
|
}
|
|
19436
19553
|
|
|
19554
|
+
/**
|
|
19555
|
+
* Describes the current content-translation state of a WebContents.
|
|
19556
|
+
*/
|
|
19557
|
+
declare type WebContentTranslationInfo = UntranslatableWebContentInfo | TranslatableWebContentInfo;
|
|
19558
|
+
|
|
19437
19559
|
declare type WebNotificationInfo = {
|
|
19438
19560
|
notificationId: string;
|
|
19439
19561
|
properties: WebNotificationProperties;
|
package/out/stub.d.ts
CHANGED
|
@@ -5424,7 +5424,7 @@ declare type Event_4 = (WebContentsEvents.Event<'view'> & {
|
|
|
5424
5424
|
*/
|
|
5425
5425
|
declare type Event_5<Topic extends string> = {
|
|
5426
5426
|
topic: Topic;
|
|
5427
|
-
} & (BlurredEvent | CertificateSelectionShownEvent | CrashedEvent_2 | DidChangeThemeColorEvent | FocusedEvent | NavigationRejectedEvent | UrlChangedEvent | DidFailLoadEvent | DidFinishLoadEvent | DidStartLoadingEvent | PageFaviconUpdatedEvent | PageTitleUpdatedEvent | ResourceLoadFailedEvent | ResourceResponseReceivedEvent | ChildContentBlockedEvent | ChildContentOpenedInBrowserEvent | ChildViewCreatedEvent | ChildWindowCreatedEvent | FileDownloadStartedEvent | FileDownloadProgressEvent | FileDownloadCompletedEvent | FoundInPageEvent | CertificateErrorEvent | ContentBlockedEvent | WillRedirectEvent | ClipboardCopyBlockedEvent | ClipboardPasteBlockedEvent);
|
|
5427
|
+
} & (BlurredEvent | CertificateSelectionShownEvent | CrashedEvent_2 | DidChangeThemeColorEvent | FocusedEvent | NavigationRejectedEvent | UrlChangedEvent | DidFailLoadEvent | DidFinishLoadEvent | DidStartLoadingEvent | PageFaviconUpdatedEvent | PageTitleUpdatedEvent | ResourceLoadFailedEvent | ResourceResponseReceivedEvent | ChildContentBlockedEvent | ChildContentOpenedInBrowserEvent | ChildViewCreatedEvent | ChildWindowCreatedEvent | FileDownloadStartedEvent | FileDownloadProgressEvent | FileDownloadCompletedEvent | FoundInPageEvent | CertificateErrorEvent | ContentBlockedEvent | WillRedirectEvent | ClipboardCopyBlockedEvent | ClipboardPasteBlockedEvent | TranslationStateChangedEvent);
|
|
5428
5428
|
|
|
5429
5429
|
/**
|
|
5430
5430
|
* [Union](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) containing every possible event that can be emitted by a {@link Window}. Events are
|
|
@@ -5929,6 +5929,19 @@ declare type ExternalProcessStartedEvent = BaseEvent_5 & {
|
|
|
5929
5929
|
processUuid: string;
|
|
5930
5930
|
};
|
|
5931
5931
|
|
|
5932
|
+
/**
|
|
5933
|
+
* Translation status of a translatable WebContents whose translation attempt has failed.
|
|
5934
|
+
*/
|
|
5935
|
+
declare type FailedTranslationStatus = {
|
|
5936
|
+
status: 'translation-failed';
|
|
5937
|
+
/** The language the page was being translated from. */
|
|
5938
|
+
sourceLanguage: LanguageInfo;
|
|
5939
|
+
/** The language the page was being translated to. */
|
|
5940
|
+
targetLanguage: LanguageInfo;
|
|
5941
|
+
/** Human-readable description of why the translation failed. */
|
|
5942
|
+
errorMessage: string;
|
|
5943
|
+
};
|
|
5944
|
+
|
|
5932
5945
|
/**
|
|
5933
5946
|
* @deprecated, use {@link PageFaviconUpdatedEvent}.
|
|
5934
5947
|
*/
|
|
@@ -8291,6 +8304,18 @@ declare type JumpListTask = {
|
|
|
8291
8304
|
iconIndex?: number;
|
|
8292
8305
|
};
|
|
8293
8306
|
|
|
8307
|
+
/**
|
|
8308
|
+
* Language metadata for content translation.
|
|
8309
|
+
*/
|
|
8310
|
+
declare type LanguageInfo = {
|
|
8311
|
+
/** ISO language code (e.g. "fr"). */
|
|
8312
|
+
code: string;
|
|
8313
|
+
/** English display name of the language (e.g. "French"). */
|
|
8314
|
+
nameEn: string;
|
|
8315
|
+
/** Localized display name of the language (e.g. "Français"). */
|
|
8316
|
+
nameI18N: string;
|
|
8317
|
+
};
|
|
8318
|
+
|
|
8294
8319
|
/**
|
|
8295
8320
|
* The LaunchEmitter is an `EventEmitter`. It can listen to app version resolver events.
|
|
8296
8321
|
*
|
|
@@ -11134,6 +11159,14 @@ declare namespace OpenFin_2 {
|
|
|
11134
11159
|
ClientChangedContextGroup,
|
|
11135
11160
|
InteropClientEvents,
|
|
11136
11161
|
ChromeBrowser,
|
|
11162
|
+
LanguageInfo,
|
|
11163
|
+
PageTranslateOptions,
|
|
11164
|
+
FailedTranslationStatus,
|
|
11165
|
+
TranslatedPageStatus,
|
|
11166
|
+
TranslationStatus,
|
|
11167
|
+
UntranslatableWebContentInfo,
|
|
11168
|
+
TranslatableWebContentInfo,
|
|
11169
|
+
WebContentTranslationInfo,
|
|
11137
11170
|
ApplicationEvents,
|
|
11138
11171
|
BaseEvents,
|
|
11139
11172
|
ExternalApplicationEvents,
|
|
@@ -11202,6 +11235,16 @@ declare type PageTitleUpdatedEvent = NamedEvent & {
|
|
|
11202
11235
|
title: string;
|
|
11203
11236
|
};
|
|
11204
11237
|
|
|
11238
|
+
/**
|
|
11239
|
+
* Options for {@link OpenFin.WebContents.translatePage}.
|
|
11240
|
+
*/
|
|
11241
|
+
declare type PageTranslateOptions = {
|
|
11242
|
+
/** BCP-47 language code of the source language, or empty string for auto-detect. */
|
|
11243
|
+
sourceLang: string;
|
|
11244
|
+
/** BCP-47 language code of the target language. */
|
|
11245
|
+
targetLang: string;
|
|
11246
|
+
};
|
|
11247
|
+
|
|
11205
11248
|
/**
|
|
11206
11249
|
* Reasons for a paste operation being blocked
|
|
11207
11250
|
*
|
|
@@ -14333,6 +14376,12 @@ declare type ProtocolMap = ExternalAdapterOnlyCallsMap & AnalyticsProtocolMap &
|
|
|
14333
14376
|
request: OpenFin_2.Identity;
|
|
14334
14377
|
response: OpenFin_2.ScreenCapturePermission;
|
|
14335
14378
|
};
|
|
14379
|
+
'translate-page': IdentityCall<{
|
|
14380
|
+
sourceLang: string;
|
|
14381
|
+
targetLang: string;
|
|
14382
|
+
}, void>;
|
|
14383
|
+
'revert-translation': IdentityCall<{}, void>;
|
|
14384
|
+
'get-translation-state': IdentityCall<{}, OpenFin_2.WebContentTranslationInfo>;
|
|
14336
14385
|
'render-overlay': {
|
|
14337
14386
|
request: {
|
|
14338
14387
|
bounds: OpenFin_2.Bounds;
|
|
@@ -17840,6 +17889,45 @@ declare type TransitionOptions = {
|
|
|
17840
17889
|
tween?: tween;
|
|
17841
17890
|
};
|
|
17842
17891
|
|
|
17892
|
+
/**
|
|
17893
|
+
* Describes a WebContents on which content translation is supported.
|
|
17894
|
+
*/
|
|
17895
|
+
declare type TranslatableWebContentInfo = {
|
|
17896
|
+
/** Whether translation is supported on this WebContents. */
|
|
17897
|
+
translationEnabled: true;
|
|
17898
|
+
/** Detected WebContents language, or undefined if not yet determined. */
|
|
17899
|
+
detectedLanguage?: LanguageInfo;
|
|
17900
|
+
/** Translation status of the WebContents. */
|
|
17901
|
+
state: TranslationStatus;
|
|
17902
|
+
};
|
|
17903
|
+
|
|
17904
|
+
/**
|
|
17905
|
+
* Translation status of a translatable WebContents that is translated or is being translated.
|
|
17906
|
+
*/
|
|
17907
|
+
declare type TranslatedPageStatus = {
|
|
17908
|
+
status: 'pending-translation' | 'translated';
|
|
17909
|
+
/** The language the page is being translated from. */
|
|
17910
|
+
sourceLanguage: LanguageInfo;
|
|
17911
|
+
/** The language the page is being translated to. */
|
|
17912
|
+
targetLanguage: LanguageInfo;
|
|
17913
|
+
};
|
|
17914
|
+
|
|
17915
|
+
/**
|
|
17916
|
+
* Generated when the translation state of a WebContents changes, such as when a page in a
|
|
17917
|
+
* foreign language is detected or when a translation completes.
|
|
17918
|
+
* @interface
|
|
17919
|
+
*/
|
|
17920
|
+
declare type TranslationStateChangedEvent = NamedEvent & {
|
|
17921
|
+
type: 'translation-state-changed';
|
|
17922
|
+
} & OpenFin_2.WebContentTranslationInfo;
|
|
17923
|
+
|
|
17924
|
+
/**
|
|
17925
|
+
* The translation status of a translatable WebContents.
|
|
17926
|
+
*/
|
|
17927
|
+
declare type TranslationStatus = {
|
|
17928
|
+
status: 'untranslated';
|
|
17929
|
+
} | FailedTranslationStatus | TranslatedPageStatus;
|
|
17930
|
+
|
|
17843
17931
|
declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
|
|
17844
17932
|
#private;
|
|
17845
17933
|
protected wireListeners: Map<number, {
|
|
@@ -17939,6 +18027,14 @@ declare type UnregisteredEvent = BaseEvent_8 & {
|
|
|
17939
18027
|
type: 'unregistered';
|
|
17940
18028
|
};
|
|
17941
18029
|
|
|
18030
|
+
/**
|
|
18031
|
+
* Describes a WebContents on which content translation is not supported (for example because no
|
|
18032
|
+
* translation API key is configured on the machine, or the current page is not translatable).
|
|
18033
|
+
*/
|
|
18034
|
+
declare type UntranslatableWebContentInfo = {
|
|
18035
|
+
translationEnabled: false;
|
|
18036
|
+
};
|
|
18037
|
+
|
|
17942
18038
|
/**
|
|
17943
18039
|
* View options that can be updated after creation.
|
|
17944
18040
|
*
|
|
@@ -19076,6 +19172,26 @@ declare class WebContents<T extends BaseEvent> extends EmitterBase<T> {
|
|
|
19076
19172
|
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
19077
19173
|
*/
|
|
19078
19174
|
setZoomLevel(level: number): Promise<void>;
|
|
19175
|
+
/**
|
|
19176
|
+
* Translates the WebContents from the source language to the target language.
|
|
19177
|
+
*
|
|
19178
|
+
* Translation requires a translation API key to be configured on the machine. If translation is
|
|
19179
|
+
* unavailable, the call is a no-op and a `translation-state-changed` event is emitted describing
|
|
19180
|
+
* the failure.
|
|
19181
|
+
*
|
|
19182
|
+
* @param options Source and target languages for the translation.
|
|
19183
|
+
*/
|
|
19184
|
+
translatePage(options: OpenFin_2.PageTranslateOptions): Promise<void>;
|
|
19185
|
+
/**
|
|
19186
|
+
* Reverts a previously translated WebContents back to its original language.
|
|
19187
|
+
*
|
|
19188
|
+
* If the WebContents is not currently translated, this is a no-op and resolves successfully.
|
|
19189
|
+
*/
|
|
19190
|
+
revertTranslation(): Promise<void>;
|
|
19191
|
+
/**
|
|
19192
|
+
* Gets the current content-translation state of the WebContents.
|
|
19193
|
+
*/
|
|
19194
|
+
getTranslationState(): Promise<OpenFin_2.WebContentTranslationInfo>;
|
|
19079
19195
|
/**
|
|
19080
19196
|
* Navigates the WebContents to a specified URL.
|
|
19081
19197
|
*
|
|
@@ -19893,6 +20009,7 @@ declare namespace WebContentsEvents {
|
|
|
19893
20009
|
ContentBlockedEvent,
|
|
19894
20010
|
ClipboardCopyBlockedEvent,
|
|
19895
20011
|
ClipboardPasteBlockedEvent,
|
|
20012
|
+
TranslationStateChangedEvent,
|
|
19896
20013
|
Event_5 as Event,
|
|
19897
20014
|
WebContentsEvent,
|
|
19898
20015
|
WillPropagateWebContentsEvent,
|
|
@@ -19901,6 +20018,11 @@ declare namespace WebContentsEvents {
|
|
|
19901
20018
|
}
|
|
19902
20019
|
}
|
|
19903
20020
|
|
|
20021
|
+
/**
|
|
20022
|
+
* Describes the current content-translation state of a WebContents.
|
|
20023
|
+
*/
|
|
20024
|
+
declare type WebContentTranslationInfo = UntranslatableWebContentInfo | TranslatableWebContentInfo;
|
|
20025
|
+
|
|
19904
20026
|
declare type WebNotificationInfo = {
|
|
19905
20027
|
notificationId: string;
|
|
19906
20028
|
properties: WebNotificationProperties;
|
package/out/stub.js
CHANGED
|
@@ -1021,6 +1021,33 @@ class WebContents extends EmitterBase {
|
|
|
1021
1021
|
setZoomLevel(level) {
|
|
1022
1022
|
return this.wire.sendAction('set-zoom-level', { ...this.identity, level }).then(() => undefined);
|
|
1023
1023
|
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Translates the WebContents from the source language to the target language.
|
|
1026
|
+
*
|
|
1027
|
+
* Translation requires a translation API key to be configured on the machine. If translation is
|
|
1028
|
+
* unavailable, the call is a no-op and a `translation-state-changed` event is emitted describing
|
|
1029
|
+
* the failure.
|
|
1030
|
+
*
|
|
1031
|
+
* @param options Source and target languages for the translation.
|
|
1032
|
+
*/
|
|
1033
|
+
async translatePage(options) {
|
|
1034
|
+
await this.wire.sendAction('translate-page', { ...this.identity, ...options });
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Reverts a previously translated WebContents back to its original language.
|
|
1038
|
+
*
|
|
1039
|
+
* If the WebContents is not currently translated, this is a no-op and resolves successfully.
|
|
1040
|
+
*/
|
|
1041
|
+
async revertTranslation() {
|
|
1042
|
+
await this.wire.sendAction('revert-translation', this.identity);
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Gets the current content-translation state of the WebContents.
|
|
1046
|
+
*/
|
|
1047
|
+
async getTranslationState() {
|
|
1048
|
+
const { payload } = await this.wire.sendAction('get-translation-state', this.identity);
|
|
1049
|
+
return payload.data;
|
|
1050
|
+
}
|
|
1024
1051
|
/**
|
|
1025
1052
|
* Navigates the WebContents to a specified URL.
|
|
1026
1053
|
*
|
package/out/stub.mjs
CHANGED
|
@@ -1017,6 +1017,33 @@ class WebContents extends EmitterBase {
|
|
|
1017
1017
|
setZoomLevel(level) {
|
|
1018
1018
|
return this.wire.sendAction('set-zoom-level', { ...this.identity, level }).then(() => undefined);
|
|
1019
1019
|
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Translates the WebContents from the source language to the target language.
|
|
1022
|
+
*
|
|
1023
|
+
* Translation requires a translation API key to be configured on the machine. If translation is
|
|
1024
|
+
* unavailable, the call is a no-op and a `translation-state-changed` event is emitted describing
|
|
1025
|
+
* the failure.
|
|
1026
|
+
*
|
|
1027
|
+
* @param options Source and target languages for the translation.
|
|
1028
|
+
*/
|
|
1029
|
+
async translatePage(options) {
|
|
1030
|
+
await this.wire.sendAction('translate-page', { ...this.identity, ...options });
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Reverts a previously translated WebContents back to its original language.
|
|
1034
|
+
*
|
|
1035
|
+
* If the WebContents is not currently translated, this is a no-op and resolves successfully.
|
|
1036
|
+
*/
|
|
1037
|
+
async revertTranslation() {
|
|
1038
|
+
await this.wire.sendAction('revert-translation', this.identity);
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* Gets the current content-translation state of the WebContents.
|
|
1042
|
+
*/
|
|
1043
|
+
async getTranslationState() {
|
|
1044
|
+
const { payload } = await this.wire.sendAction('get-translation-state', this.identity);
|
|
1045
|
+
return payload.data;
|
|
1046
|
+
}
|
|
1020
1047
|
/**
|
|
1021
1048
|
* Navigates the WebContents to a specified URL.
|
|
1022
1049
|
*
|