@openfin/core 46.100.40 → 46.100.43
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 +124 -2
- package/out/mock-beta.d.ts +124 -2
- package/out/mock-public.d.ts +124 -2
- package/out/stub.d.ts +124 -2
- package/out/stub.js +27 -0
- package/out/stub.mjs +27 -0
- package/package.json +1 -1
package/out/mock-alpha.d.ts
CHANGED
|
@@ -5363,7 +5363,7 @@ declare type Event_4 = (WebContentsEvents.Event<'view'> & {
|
|
|
5363
5363
|
*/
|
|
5364
5364
|
declare type Event_5<Topic extends string> = {
|
|
5365
5365
|
topic: Topic;
|
|
5366
|
-
} & (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);
|
|
5366
|
+
} & (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);
|
|
5367
5367
|
|
|
5368
5368
|
/**
|
|
5369
5369
|
* [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
|
|
@@ -5883,6 +5883,19 @@ declare type ExternalProcessStartedEvent = BaseEvent_5 & {
|
|
|
5883
5883
|
processUuid: string;
|
|
5884
5884
|
};
|
|
5885
5885
|
|
|
5886
|
+
/**
|
|
5887
|
+
* Translation status of a translatable WebContents whose translation attempt has failed.
|
|
5888
|
+
*/
|
|
5889
|
+
declare type FailedTranslationStatus = {
|
|
5890
|
+
status: 'translation-failed';
|
|
5891
|
+
/** The language the page was being translated from. */
|
|
5892
|
+
sourceLanguage: LanguageInfo;
|
|
5893
|
+
/** The language the page was being translated to. */
|
|
5894
|
+
targetLanguage: LanguageInfo;
|
|
5895
|
+
/** Human-readable description of why the translation failed. */
|
|
5896
|
+
errorMessage: string;
|
|
5897
|
+
};
|
|
5898
|
+
|
|
5886
5899
|
/**
|
|
5887
5900
|
* @deprecated, use {@link PageFaviconUpdatedEvent}.
|
|
5888
5901
|
*/
|
|
@@ -6570,7 +6583,7 @@ declare type HostSpecs = {
|
|
|
6570
6583
|
*/
|
|
6571
6584
|
aeroGlassEnabled?: boolean;
|
|
6572
6585
|
/**
|
|
6573
|
-
* "
|
|
6586
|
+
* "x86_64" for 64-bit
|
|
6574
6587
|
*/
|
|
6575
6588
|
arch: string;
|
|
6576
6589
|
/**
|
|
@@ -8213,6 +8226,18 @@ declare type JumpListTask = {
|
|
|
8213
8226
|
iconIndex?: number;
|
|
8214
8227
|
};
|
|
8215
8228
|
|
|
8229
|
+
/**
|
|
8230
|
+
* Language metadata for content translation.
|
|
8231
|
+
*/
|
|
8232
|
+
declare type LanguageInfo = {
|
|
8233
|
+
/** ISO language code (e.g. "fr"). */
|
|
8234
|
+
code: string;
|
|
8235
|
+
/** English display name of the language (e.g. "French"). */
|
|
8236
|
+
nameEn: string;
|
|
8237
|
+
/** Localized display name of the language (e.g. "Français"). */
|
|
8238
|
+
nameI18N: string;
|
|
8239
|
+
};
|
|
8240
|
+
|
|
8216
8241
|
/**
|
|
8217
8242
|
* The LaunchEmitter is an `EventEmitter`. It can listen to app version resolver events.
|
|
8218
8243
|
*
|
|
@@ -10829,6 +10854,14 @@ declare namespace OpenFin_2 {
|
|
|
10829
10854
|
ClientChangedContextGroup,
|
|
10830
10855
|
InteropClientEvents,
|
|
10831
10856
|
ChromeBrowser,
|
|
10857
|
+
LanguageInfo,
|
|
10858
|
+
PageTranslateOptions,
|
|
10859
|
+
FailedTranslationStatus,
|
|
10860
|
+
TranslatedPageStatus,
|
|
10861
|
+
TranslationStatus,
|
|
10862
|
+
UntranslatableWebContentInfo,
|
|
10863
|
+
TranslatableWebContentInfo,
|
|
10864
|
+
WebContentTranslationInfo,
|
|
10832
10865
|
ApplicationEvents,
|
|
10833
10866
|
BaseEvents,
|
|
10834
10867
|
ExternalApplicationEvents,
|
|
@@ -10897,6 +10930,16 @@ declare type PageTitleUpdatedEvent = NamedEvent & {
|
|
|
10897
10930
|
title: string;
|
|
10898
10931
|
};
|
|
10899
10932
|
|
|
10933
|
+
/**
|
|
10934
|
+
* Options for {@link OpenFin.WebContents.translatePage}.
|
|
10935
|
+
*/
|
|
10936
|
+
declare type PageTranslateOptions = {
|
|
10937
|
+
/** BCP-47 language code of the source language, or empty string for auto-detect. */
|
|
10938
|
+
sourceLang: string;
|
|
10939
|
+
/** BCP-47 language code of the target language. */
|
|
10940
|
+
targetLang: string;
|
|
10941
|
+
};
|
|
10942
|
+
|
|
10900
10943
|
/**
|
|
10901
10944
|
* Reasons for a paste operation being blocked
|
|
10902
10945
|
*
|
|
@@ -13945,6 +13988,12 @@ declare type ProtocolMap = ExternalAdapterOnlyCallsMap & AnalyticsProtocolMap &
|
|
|
13945
13988
|
request: OpenFin_2.Identity;
|
|
13946
13989
|
response: OpenFin_2.ScreenCapturePermission;
|
|
13947
13990
|
};
|
|
13991
|
+
'translate-page': IdentityCall<{
|
|
13992
|
+
sourceLang: string;
|
|
13993
|
+
targetLang: string;
|
|
13994
|
+
}, void>;
|
|
13995
|
+
'revert-translation': IdentityCall<{}, void>;
|
|
13996
|
+
'get-translation-state': IdentityCall<{}, OpenFin_2.WebContentTranslationInfo>;
|
|
13948
13997
|
'render-overlay': {
|
|
13949
13998
|
request: {
|
|
13950
13999
|
bounds: OpenFin_2.Bounds;
|
|
@@ -17438,6 +17487,45 @@ declare type TransitionOptions = {
|
|
|
17438
17487
|
tween?: tween;
|
|
17439
17488
|
};
|
|
17440
17489
|
|
|
17490
|
+
/**
|
|
17491
|
+
* Describes a WebContents on which content translation is supported.
|
|
17492
|
+
*/
|
|
17493
|
+
declare type TranslatableWebContentInfo = {
|
|
17494
|
+
/** Whether translation is supported on this WebContents. */
|
|
17495
|
+
translationEnabled: true;
|
|
17496
|
+
/** Detected WebContents language, or undefined if not yet determined. */
|
|
17497
|
+
detectedLanguage?: LanguageInfo;
|
|
17498
|
+
/** Translation status of the WebContents. */
|
|
17499
|
+
state: TranslationStatus;
|
|
17500
|
+
};
|
|
17501
|
+
|
|
17502
|
+
/**
|
|
17503
|
+
* Translation status of a translatable WebContents that is translated or is being translated.
|
|
17504
|
+
*/
|
|
17505
|
+
declare type TranslatedPageStatus = {
|
|
17506
|
+
status: 'pending-translation' | 'translated';
|
|
17507
|
+
/** The language the page is being translated from. */
|
|
17508
|
+
sourceLanguage: LanguageInfo;
|
|
17509
|
+
/** The language the page is being translated to. */
|
|
17510
|
+
targetLanguage: LanguageInfo;
|
|
17511
|
+
};
|
|
17512
|
+
|
|
17513
|
+
/**
|
|
17514
|
+
* Generated when the translation state of a WebContents changes, such as when a page in a
|
|
17515
|
+
* foreign language is detected or when a translation completes.
|
|
17516
|
+
* @interface
|
|
17517
|
+
*/
|
|
17518
|
+
declare type TranslationStateChangedEvent = NamedEvent & {
|
|
17519
|
+
type: 'translation-state-changed';
|
|
17520
|
+
} & OpenFin_2.WebContentTranslationInfo;
|
|
17521
|
+
|
|
17522
|
+
/**
|
|
17523
|
+
* The translation status of a translatable WebContents.
|
|
17524
|
+
*/
|
|
17525
|
+
declare type TranslationStatus = {
|
|
17526
|
+
status: 'untranslated';
|
|
17527
|
+
} | FailedTranslationStatus | TranslatedPageStatus;
|
|
17528
|
+
|
|
17441
17529
|
declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
|
|
17442
17530
|
#private;
|
|
17443
17531
|
protected wireListeners: Map<number, {
|
|
@@ -17537,6 +17625,14 @@ declare type UnregisteredEvent = BaseEvent_8 & {
|
|
|
17537
17625
|
type: 'unregistered';
|
|
17538
17626
|
};
|
|
17539
17627
|
|
|
17628
|
+
/**
|
|
17629
|
+
* Describes a WebContents on which content translation is not supported (for example because no
|
|
17630
|
+
* translation API key is configured on the machine, or the current page is not translatable).
|
|
17631
|
+
*/
|
|
17632
|
+
declare type UntranslatableWebContentInfo = {
|
|
17633
|
+
translationEnabled: false;
|
|
17634
|
+
};
|
|
17635
|
+
|
|
17540
17636
|
/**
|
|
17541
17637
|
* View options that can be updated after creation.
|
|
17542
17638
|
*
|
|
@@ -18637,6 +18733,26 @@ declare class WebContents<T extends BaseEvent> extends EmitterBase<T> {
|
|
|
18637
18733
|
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
18638
18734
|
*/
|
|
18639
18735
|
setZoomLevel(level: number): Promise<void>;
|
|
18736
|
+
/**
|
|
18737
|
+
* Translates the WebContents from the source language to the target language.
|
|
18738
|
+
*
|
|
18739
|
+
* Translation requires a translation API key to be configured on the machine. If translation is
|
|
18740
|
+
* unavailable, the call is a no-op and a `translation-state-changed` event is emitted describing
|
|
18741
|
+
* the failure.
|
|
18742
|
+
*
|
|
18743
|
+
* @param options Source and target languages for the translation.
|
|
18744
|
+
*/
|
|
18745
|
+
translatePage(options: OpenFin_2.PageTranslateOptions): Promise<void>;
|
|
18746
|
+
/**
|
|
18747
|
+
* Reverts a previously translated WebContents back to its original language.
|
|
18748
|
+
*
|
|
18749
|
+
* If the WebContents is not currently translated, this is a no-op and resolves successfully.
|
|
18750
|
+
*/
|
|
18751
|
+
revertTranslation(): Promise<void>;
|
|
18752
|
+
/**
|
|
18753
|
+
* Gets the current content-translation state of the WebContents.
|
|
18754
|
+
*/
|
|
18755
|
+
getTranslationState(): Promise<OpenFin_2.WebContentTranslationInfo>;
|
|
18640
18756
|
/**
|
|
18641
18757
|
* Navigates the WebContents to a specified URL.
|
|
18642
18758
|
*
|
|
@@ -19455,6 +19571,7 @@ declare namespace WebContentsEvents {
|
|
|
19455
19571
|
ContentBlockedEvent,
|
|
19456
19572
|
ClipboardCopyBlockedEvent,
|
|
19457
19573
|
ClipboardPasteBlockedEvent,
|
|
19574
|
+
TranslationStateChangedEvent,
|
|
19458
19575
|
Event_5 as Event,
|
|
19459
19576
|
WebContentsEvent,
|
|
19460
19577
|
WillPropagateWebContentsEvent,
|
|
@@ -19463,6 +19580,11 @@ declare namespace WebContentsEvents {
|
|
|
19463
19580
|
}
|
|
19464
19581
|
}
|
|
19465
19582
|
|
|
19583
|
+
/**
|
|
19584
|
+
* Describes the current content-translation state of a WebContents.
|
|
19585
|
+
*/
|
|
19586
|
+
declare type WebContentTranslationInfo = UntranslatableWebContentInfo | TranslatableWebContentInfo;
|
|
19587
|
+
|
|
19466
19588
|
declare type WebNotificationInfo = {
|
|
19467
19589
|
notificationId: string;
|
|
19468
19590
|
properties: WebNotificationProperties;
|
package/out/mock-beta.d.ts
CHANGED
|
@@ -5363,7 +5363,7 @@ declare type Event_4 = (WebContentsEvents.Event<'view'> & {
|
|
|
5363
5363
|
*/
|
|
5364
5364
|
declare type Event_5<Topic extends string> = {
|
|
5365
5365
|
topic: Topic;
|
|
5366
|
-
} & (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);
|
|
5366
|
+
} & (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);
|
|
5367
5367
|
|
|
5368
5368
|
/**
|
|
5369
5369
|
* [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
|
|
@@ -5883,6 +5883,19 @@ declare type ExternalProcessStartedEvent = BaseEvent_5 & {
|
|
|
5883
5883
|
processUuid: string;
|
|
5884
5884
|
};
|
|
5885
5885
|
|
|
5886
|
+
/**
|
|
5887
|
+
* Translation status of a translatable WebContents whose translation attempt has failed.
|
|
5888
|
+
*/
|
|
5889
|
+
declare type FailedTranslationStatus = {
|
|
5890
|
+
status: 'translation-failed';
|
|
5891
|
+
/** The language the page was being translated from. */
|
|
5892
|
+
sourceLanguage: LanguageInfo;
|
|
5893
|
+
/** The language the page was being translated to. */
|
|
5894
|
+
targetLanguage: LanguageInfo;
|
|
5895
|
+
/** Human-readable description of why the translation failed. */
|
|
5896
|
+
errorMessage: string;
|
|
5897
|
+
};
|
|
5898
|
+
|
|
5886
5899
|
/**
|
|
5887
5900
|
* @deprecated, use {@link PageFaviconUpdatedEvent}.
|
|
5888
5901
|
*/
|
|
@@ -6570,7 +6583,7 @@ declare type HostSpecs = {
|
|
|
6570
6583
|
*/
|
|
6571
6584
|
aeroGlassEnabled?: boolean;
|
|
6572
6585
|
/**
|
|
6573
|
-
* "
|
|
6586
|
+
* "x86_64" for 64-bit
|
|
6574
6587
|
*/
|
|
6575
6588
|
arch: string;
|
|
6576
6589
|
/**
|
|
@@ -8213,6 +8226,18 @@ declare type JumpListTask = {
|
|
|
8213
8226
|
iconIndex?: number;
|
|
8214
8227
|
};
|
|
8215
8228
|
|
|
8229
|
+
/**
|
|
8230
|
+
* Language metadata for content translation.
|
|
8231
|
+
*/
|
|
8232
|
+
declare type LanguageInfo = {
|
|
8233
|
+
/** ISO language code (e.g. "fr"). */
|
|
8234
|
+
code: string;
|
|
8235
|
+
/** English display name of the language (e.g. "French"). */
|
|
8236
|
+
nameEn: string;
|
|
8237
|
+
/** Localized display name of the language (e.g. "Français"). */
|
|
8238
|
+
nameI18N: string;
|
|
8239
|
+
};
|
|
8240
|
+
|
|
8216
8241
|
/**
|
|
8217
8242
|
* The LaunchEmitter is an `EventEmitter`. It can listen to app version resolver events.
|
|
8218
8243
|
*
|
|
@@ -10829,6 +10854,14 @@ declare namespace OpenFin_2 {
|
|
|
10829
10854
|
ClientChangedContextGroup,
|
|
10830
10855
|
InteropClientEvents,
|
|
10831
10856
|
ChromeBrowser,
|
|
10857
|
+
LanguageInfo,
|
|
10858
|
+
PageTranslateOptions,
|
|
10859
|
+
FailedTranslationStatus,
|
|
10860
|
+
TranslatedPageStatus,
|
|
10861
|
+
TranslationStatus,
|
|
10862
|
+
UntranslatableWebContentInfo,
|
|
10863
|
+
TranslatableWebContentInfo,
|
|
10864
|
+
WebContentTranslationInfo,
|
|
10832
10865
|
ApplicationEvents,
|
|
10833
10866
|
BaseEvents,
|
|
10834
10867
|
ExternalApplicationEvents,
|
|
@@ -10897,6 +10930,16 @@ declare type PageTitleUpdatedEvent = NamedEvent & {
|
|
|
10897
10930
|
title: string;
|
|
10898
10931
|
};
|
|
10899
10932
|
|
|
10933
|
+
/**
|
|
10934
|
+
* Options for {@link OpenFin.WebContents.translatePage}.
|
|
10935
|
+
*/
|
|
10936
|
+
declare type PageTranslateOptions = {
|
|
10937
|
+
/** BCP-47 language code of the source language, or empty string for auto-detect. */
|
|
10938
|
+
sourceLang: string;
|
|
10939
|
+
/** BCP-47 language code of the target language. */
|
|
10940
|
+
targetLang: string;
|
|
10941
|
+
};
|
|
10942
|
+
|
|
10900
10943
|
/**
|
|
10901
10944
|
* Reasons for a paste operation being blocked
|
|
10902
10945
|
*
|
|
@@ -13945,6 +13988,12 @@ declare type ProtocolMap = ExternalAdapterOnlyCallsMap & AnalyticsProtocolMap &
|
|
|
13945
13988
|
request: OpenFin_2.Identity;
|
|
13946
13989
|
response: OpenFin_2.ScreenCapturePermission;
|
|
13947
13990
|
};
|
|
13991
|
+
'translate-page': IdentityCall<{
|
|
13992
|
+
sourceLang: string;
|
|
13993
|
+
targetLang: string;
|
|
13994
|
+
}, void>;
|
|
13995
|
+
'revert-translation': IdentityCall<{}, void>;
|
|
13996
|
+
'get-translation-state': IdentityCall<{}, OpenFin_2.WebContentTranslationInfo>;
|
|
13948
13997
|
'render-overlay': {
|
|
13949
13998
|
request: {
|
|
13950
13999
|
bounds: OpenFin_2.Bounds;
|
|
@@ -17438,6 +17487,45 @@ declare type TransitionOptions = {
|
|
|
17438
17487
|
tween?: tween;
|
|
17439
17488
|
};
|
|
17440
17489
|
|
|
17490
|
+
/**
|
|
17491
|
+
* Describes a WebContents on which content translation is supported.
|
|
17492
|
+
*/
|
|
17493
|
+
declare type TranslatableWebContentInfo = {
|
|
17494
|
+
/** Whether translation is supported on this WebContents. */
|
|
17495
|
+
translationEnabled: true;
|
|
17496
|
+
/** Detected WebContents language, or undefined if not yet determined. */
|
|
17497
|
+
detectedLanguage?: LanguageInfo;
|
|
17498
|
+
/** Translation status of the WebContents. */
|
|
17499
|
+
state: TranslationStatus;
|
|
17500
|
+
};
|
|
17501
|
+
|
|
17502
|
+
/**
|
|
17503
|
+
* Translation status of a translatable WebContents that is translated or is being translated.
|
|
17504
|
+
*/
|
|
17505
|
+
declare type TranslatedPageStatus = {
|
|
17506
|
+
status: 'pending-translation' | 'translated';
|
|
17507
|
+
/** The language the page is being translated from. */
|
|
17508
|
+
sourceLanguage: LanguageInfo;
|
|
17509
|
+
/** The language the page is being translated to. */
|
|
17510
|
+
targetLanguage: LanguageInfo;
|
|
17511
|
+
};
|
|
17512
|
+
|
|
17513
|
+
/**
|
|
17514
|
+
* Generated when the translation state of a WebContents changes, such as when a page in a
|
|
17515
|
+
* foreign language is detected or when a translation completes.
|
|
17516
|
+
* @interface
|
|
17517
|
+
*/
|
|
17518
|
+
declare type TranslationStateChangedEvent = NamedEvent & {
|
|
17519
|
+
type: 'translation-state-changed';
|
|
17520
|
+
} & OpenFin_2.WebContentTranslationInfo;
|
|
17521
|
+
|
|
17522
|
+
/**
|
|
17523
|
+
* The translation status of a translatable WebContents.
|
|
17524
|
+
*/
|
|
17525
|
+
declare type TranslationStatus = {
|
|
17526
|
+
status: 'untranslated';
|
|
17527
|
+
} | FailedTranslationStatus | TranslatedPageStatus;
|
|
17528
|
+
|
|
17441
17529
|
declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
|
|
17442
17530
|
#private;
|
|
17443
17531
|
protected wireListeners: Map<number, {
|
|
@@ -17537,6 +17625,14 @@ declare type UnregisteredEvent = BaseEvent_8 & {
|
|
|
17537
17625
|
type: 'unregistered';
|
|
17538
17626
|
};
|
|
17539
17627
|
|
|
17628
|
+
/**
|
|
17629
|
+
* Describes a WebContents on which content translation is not supported (for example because no
|
|
17630
|
+
* translation API key is configured on the machine, or the current page is not translatable).
|
|
17631
|
+
*/
|
|
17632
|
+
declare type UntranslatableWebContentInfo = {
|
|
17633
|
+
translationEnabled: false;
|
|
17634
|
+
};
|
|
17635
|
+
|
|
17540
17636
|
/**
|
|
17541
17637
|
* View options that can be updated after creation.
|
|
17542
17638
|
*
|
|
@@ -18637,6 +18733,26 @@ declare class WebContents<T extends BaseEvent> extends EmitterBase<T> {
|
|
|
18637
18733
|
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
18638
18734
|
*/
|
|
18639
18735
|
setZoomLevel(level: number): Promise<void>;
|
|
18736
|
+
/**
|
|
18737
|
+
* Translates the WebContents from the source language to the target language.
|
|
18738
|
+
*
|
|
18739
|
+
* Translation requires a translation API key to be configured on the machine. If translation is
|
|
18740
|
+
* unavailable, the call is a no-op and a `translation-state-changed` event is emitted describing
|
|
18741
|
+
* the failure.
|
|
18742
|
+
*
|
|
18743
|
+
* @param options Source and target languages for the translation.
|
|
18744
|
+
*/
|
|
18745
|
+
translatePage(options: OpenFin_2.PageTranslateOptions): Promise<void>;
|
|
18746
|
+
/**
|
|
18747
|
+
* Reverts a previously translated WebContents back to its original language.
|
|
18748
|
+
*
|
|
18749
|
+
* If the WebContents is not currently translated, this is a no-op and resolves successfully.
|
|
18750
|
+
*/
|
|
18751
|
+
revertTranslation(): Promise<void>;
|
|
18752
|
+
/**
|
|
18753
|
+
* Gets the current content-translation state of the WebContents.
|
|
18754
|
+
*/
|
|
18755
|
+
getTranslationState(): Promise<OpenFin_2.WebContentTranslationInfo>;
|
|
18640
18756
|
/**
|
|
18641
18757
|
* Navigates the WebContents to a specified URL.
|
|
18642
18758
|
*
|
|
@@ -19455,6 +19571,7 @@ declare namespace WebContentsEvents {
|
|
|
19455
19571
|
ContentBlockedEvent,
|
|
19456
19572
|
ClipboardCopyBlockedEvent,
|
|
19457
19573
|
ClipboardPasteBlockedEvent,
|
|
19574
|
+
TranslationStateChangedEvent,
|
|
19458
19575
|
Event_5 as Event,
|
|
19459
19576
|
WebContentsEvent,
|
|
19460
19577
|
WillPropagateWebContentsEvent,
|
|
@@ -19463,6 +19580,11 @@ declare namespace WebContentsEvents {
|
|
|
19463
19580
|
}
|
|
19464
19581
|
}
|
|
19465
19582
|
|
|
19583
|
+
/**
|
|
19584
|
+
* Describes the current content-translation state of a WebContents.
|
|
19585
|
+
*/
|
|
19586
|
+
declare type WebContentTranslationInfo = UntranslatableWebContentInfo | TranslatableWebContentInfo;
|
|
19587
|
+
|
|
19466
19588
|
declare type WebNotificationInfo = {
|
|
19467
19589
|
notificationId: string;
|
|
19468
19590
|
properties: WebNotificationProperties;
|
package/out/mock-public.d.ts
CHANGED
|
@@ -5363,7 +5363,7 @@ declare type Event_4 = (WebContentsEvents.Event<'view'> & {
|
|
|
5363
5363
|
*/
|
|
5364
5364
|
declare type Event_5<Topic extends string> = {
|
|
5365
5365
|
topic: Topic;
|
|
5366
|
-
} & (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);
|
|
5366
|
+
} & (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);
|
|
5367
5367
|
|
|
5368
5368
|
/**
|
|
5369
5369
|
* [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
|
|
@@ -5883,6 +5883,19 @@ declare type ExternalProcessStartedEvent = BaseEvent_5 & {
|
|
|
5883
5883
|
processUuid: string;
|
|
5884
5884
|
};
|
|
5885
5885
|
|
|
5886
|
+
/**
|
|
5887
|
+
* Translation status of a translatable WebContents whose translation attempt has failed.
|
|
5888
|
+
*/
|
|
5889
|
+
declare type FailedTranslationStatus = {
|
|
5890
|
+
status: 'translation-failed';
|
|
5891
|
+
/** The language the page was being translated from. */
|
|
5892
|
+
sourceLanguage: LanguageInfo;
|
|
5893
|
+
/** The language the page was being translated to. */
|
|
5894
|
+
targetLanguage: LanguageInfo;
|
|
5895
|
+
/** Human-readable description of why the translation failed. */
|
|
5896
|
+
errorMessage: string;
|
|
5897
|
+
};
|
|
5898
|
+
|
|
5886
5899
|
/**
|
|
5887
5900
|
* @deprecated, use {@link PageFaviconUpdatedEvent}.
|
|
5888
5901
|
*/
|
|
@@ -6570,7 +6583,7 @@ declare type HostSpecs = {
|
|
|
6570
6583
|
*/
|
|
6571
6584
|
aeroGlassEnabled?: boolean;
|
|
6572
6585
|
/**
|
|
6573
|
-
* "
|
|
6586
|
+
* "x86_64" for 64-bit
|
|
6574
6587
|
*/
|
|
6575
6588
|
arch: string;
|
|
6576
6589
|
/**
|
|
@@ -8213,6 +8226,18 @@ declare type JumpListTask = {
|
|
|
8213
8226
|
iconIndex?: number;
|
|
8214
8227
|
};
|
|
8215
8228
|
|
|
8229
|
+
/**
|
|
8230
|
+
* Language metadata for content translation.
|
|
8231
|
+
*/
|
|
8232
|
+
declare type LanguageInfo = {
|
|
8233
|
+
/** ISO language code (e.g. "fr"). */
|
|
8234
|
+
code: string;
|
|
8235
|
+
/** English display name of the language (e.g. "French"). */
|
|
8236
|
+
nameEn: string;
|
|
8237
|
+
/** Localized display name of the language (e.g. "Français"). */
|
|
8238
|
+
nameI18N: string;
|
|
8239
|
+
};
|
|
8240
|
+
|
|
8216
8241
|
/**
|
|
8217
8242
|
* The LaunchEmitter is an `EventEmitter`. It can listen to app version resolver events.
|
|
8218
8243
|
*
|
|
@@ -10829,6 +10854,14 @@ declare namespace OpenFin_2 {
|
|
|
10829
10854
|
ClientChangedContextGroup,
|
|
10830
10855
|
InteropClientEvents,
|
|
10831
10856
|
ChromeBrowser,
|
|
10857
|
+
LanguageInfo,
|
|
10858
|
+
PageTranslateOptions,
|
|
10859
|
+
FailedTranslationStatus,
|
|
10860
|
+
TranslatedPageStatus,
|
|
10861
|
+
TranslationStatus,
|
|
10862
|
+
UntranslatableWebContentInfo,
|
|
10863
|
+
TranslatableWebContentInfo,
|
|
10864
|
+
WebContentTranslationInfo,
|
|
10832
10865
|
ApplicationEvents,
|
|
10833
10866
|
BaseEvents,
|
|
10834
10867
|
ExternalApplicationEvents,
|
|
@@ -10897,6 +10930,16 @@ declare type PageTitleUpdatedEvent = NamedEvent & {
|
|
|
10897
10930
|
title: string;
|
|
10898
10931
|
};
|
|
10899
10932
|
|
|
10933
|
+
/**
|
|
10934
|
+
* Options for {@link OpenFin.WebContents.translatePage}.
|
|
10935
|
+
*/
|
|
10936
|
+
declare type PageTranslateOptions = {
|
|
10937
|
+
/** BCP-47 language code of the source language, or empty string for auto-detect. */
|
|
10938
|
+
sourceLang: string;
|
|
10939
|
+
/** BCP-47 language code of the target language. */
|
|
10940
|
+
targetLang: string;
|
|
10941
|
+
};
|
|
10942
|
+
|
|
10900
10943
|
/**
|
|
10901
10944
|
* Reasons for a paste operation being blocked
|
|
10902
10945
|
*
|
|
@@ -13945,6 +13988,12 @@ declare type ProtocolMap = ExternalAdapterOnlyCallsMap & AnalyticsProtocolMap &
|
|
|
13945
13988
|
request: OpenFin_2.Identity;
|
|
13946
13989
|
response: OpenFin_2.ScreenCapturePermission;
|
|
13947
13990
|
};
|
|
13991
|
+
'translate-page': IdentityCall<{
|
|
13992
|
+
sourceLang: string;
|
|
13993
|
+
targetLang: string;
|
|
13994
|
+
}, void>;
|
|
13995
|
+
'revert-translation': IdentityCall<{}, void>;
|
|
13996
|
+
'get-translation-state': IdentityCall<{}, OpenFin_2.WebContentTranslationInfo>;
|
|
13948
13997
|
'render-overlay': {
|
|
13949
13998
|
request: {
|
|
13950
13999
|
bounds: OpenFin_2.Bounds;
|
|
@@ -17438,6 +17487,45 @@ declare type TransitionOptions = {
|
|
|
17438
17487
|
tween?: tween;
|
|
17439
17488
|
};
|
|
17440
17489
|
|
|
17490
|
+
/**
|
|
17491
|
+
* Describes a WebContents on which content translation is supported.
|
|
17492
|
+
*/
|
|
17493
|
+
declare type TranslatableWebContentInfo = {
|
|
17494
|
+
/** Whether translation is supported on this WebContents. */
|
|
17495
|
+
translationEnabled: true;
|
|
17496
|
+
/** Detected WebContents language, or undefined if not yet determined. */
|
|
17497
|
+
detectedLanguage?: LanguageInfo;
|
|
17498
|
+
/** Translation status of the WebContents. */
|
|
17499
|
+
state: TranslationStatus;
|
|
17500
|
+
};
|
|
17501
|
+
|
|
17502
|
+
/**
|
|
17503
|
+
* Translation status of a translatable WebContents that is translated or is being translated.
|
|
17504
|
+
*/
|
|
17505
|
+
declare type TranslatedPageStatus = {
|
|
17506
|
+
status: 'pending-translation' | 'translated';
|
|
17507
|
+
/** The language the page is being translated from. */
|
|
17508
|
+
sourceLanguage: LanguageInfo;
|
|
17509
|
+
/** The language the page is being translated to. */
|
|
17510
|
+
targetLanguage: LanguageInfo;
|
|
17511
|
+
};
|
|
17512
|
+
|
|
17513
|
+
/**
|
|
17514
|
+
* Generated when the translation state of a WebContents changes, such as when a page in a
|
|
17515
|
+
* foreign language is detected or when a translation completes.
|
|
17516
|
+
* @interface
|
|
17517
|
+
*/
|
|
17518
|
+
declare type TranslationStateChangedEvent = NamedEvent & {
|
|
17519
|
+
type: 'translation-state-changed';
|
|
17520
|
+
} & OpenFin_2.WebContentTranslationInfo;
|
|
17521
|
+
|
|
17522
|
+
/**
|
|
17523
|
+
* The translation status of a translatable WebContents.
|
|
17524
|
+
*/
|
|
17525
|
+
declare type TranslationStatus = {
|
|
17526
|
+
status: 'untranslated';
|
|
17527
|
+
} | FailedTranslationStatus | TranslatedPageStatus;
|
|
17528
|
+
|
|
17441
17529
|
declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
|
|
17442
17530
|
#private;
|
|
17443
17531
|
protected wireListeners: Map<number, {
|
|
@@ -17537,6 +17625,14 @@ declare type UnregisteredEvent = BaseEvent_8 & {
|
|
|
17537
17625
|
type: 'unregistered';
|
|
17538
17626
|
};
|
|
17539
17627
|
|
|
17628
|
+
/**
|
|
17629
|
+
* Describes a WebContents on which content translation is not supported (for example because no
|
|
17630
|
+
* translation API key is configured on the machine, or the current page is not translatable).
|
|
17631
|
+
*/
|
|
17632
|
+
declare type UntranslatableWebContentInfo = {
|
|
17633
|
+
translationEnabled: false;
|
|
17634
|
+
};
|
|
17635
|
+
|
|
17540
17636
|
/**
|
|
17541
17637
|
* View options that can be updated after creation.
|
|
17542
17638
|
*
|
|
@@ -18637,6 +18733,26 @@ declare class WebContents<T extends BaseEvent> extends EmitterBase<T> {
|
|
|
18637
18733
|
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
18638
18734
|
*/
|
|
18639
18735
|
setZoomLevel(level: number): Promise<void>;
|
|
18736
|
+
/**
|
|
18737
|
+
* Translates the WebContents from the source language to the target language.
|
|
18738
|
+
*
|
|
18739
|
+
* Translation requires a translation API key to be configured on the machine. If translation is
|
|
18740
|
+
* unavailable, the call is a no-op and a `translation-state-changed` event is emitted describing
|
|
18741
|
+
* the failure.
|
|
18742
|
+
*
|
|
18743
|
+
* @param options Source and target languages for the translation.
|
|
18744
|
+
*/
|
|
18745
|
+
translatePage(options: OpenFin_2.PageTranslateOptions): Promise<void>;
|
|
18746
|
+
/**
|
|
18747
|
+
* Reverts a previously translated WebContents back to its original language.
|
|
18748
|
+
*
|
|
18749
|
+
* If the WebContents is not currently translated, this is a no-op and resolves successfully.
|
|
18750
|
+
*/
|
|
18751
|
+
revertTranslation(): Promise<void>;
|
|
18752
|
+
/**
|
|
18753
|
+
* Gets the current content-translation state of the WebContents.
|
|
18754
|
+
*/
|
|
18755
|
+
getTranslationState(): Promise<OpenFin_2.WebContentTranslationInfo>;
|
|
18640
18756
|
/**
|
|
18641
18757
|
* Navigates the WebContents to a specified URL.
|
|
18642
18758
|
*
|
|
@@ -19455,6 +19571,7 @@ declare namespace WebContentsEvents {
|
|
|
19455
19571
|
ContentBlockedEvent,
|
|
19456
19572
|
ClipboardCopyBlockedEvent,
|
|
19457
19573
|
ClipboardPasteBlockedEvent,
|
|
19574
|
+
TranslationStateChangedEvent,
|
|
19458
19575
|
Event_5 as Event,
|
|
19459
19576
|
WebContentsEvent,
|
|
19460
19577
|
WillPropagateWebContentsEvent,
|
|
@@ -19463,6 +19580,11 @@ declare namespace WebContentsEvents {
|
|
|
19463
19580
|
}
|
|
19464
19581
|
}
|
|
19465
19582
|
|
|
19583
|
+
/**
|
|
19584
|
+
* Describes the current content-translation state of a WebContents.
|
|
19585
|
+
*/
|
|
19586
|
+
declare type WebContentTranslationInfo = UntranslatableWebContentInfo | TranslatableWebContentInfo;
|
|
19587
|
+
|
|
19466
19588
|
declare type WebNotificationInfo = {
|
|
19467
19589
|
notificationId: string;
|
|
19468
19590
|
properties: WebNotificationProperties;
|
package/out/stub.d.ts
CHANGED
|
@@ -5470,7 +5470,7 @@ declare type Event_4 = (WebContentsEvents.Event<'view'> & {
|
|
|
5470
5470
|
*/
|
|
5471
5471
|
declare type Event_5<Topic extends string> = {
|
|
5472
5472
|
topic: Topic;
|
|
5473
|
-
} & (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);
|
|
5473
|
+
} & (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);
|
|
5474
5474
|
|
|
5475
5475
|
/**
|
|
5476
5476
|
* [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
|
|
@@ -6011,6 +6011,19 @@ declare type ExternalProcessStartedEvent = BaseEvent_5 & {
|
|
|
6011
6011
|
processUuid: string;
|
|
6012
6012
|
};
|
|
6013
6013
|
|
|
6014
|
+
/**
|
|
6015
|
+
* Translation status of a translatable WebContents whose translation attempt has failed.
|
|
6016
|
+
*/
|
|
6017
|
+
declare type FailedTranslationStatus = {
|
|
6018
|
+
status: 'translation-failed';
|
|
6019
|
+
/** The language the page was being translated from. */
|
|
6020
|
+
sourceLanguage: LanguageInfo;
|
|
6021
|
+
/** The language the page was being translated to. */
|
|
6022
|
+
targetLanguage: LanguageInfo;
|
|
6023
|
+
/** Human-readable description of why the translation failed. */
|
|
6024
|
+
errorMessage: string;
|
|
6025
|
+
};
|
|
6026
|
+
|
|
6014
6027
|
/**
|
|
6015
6028
|
* @deprecated, use {@link PageFaviconUpdatedEvent}.
|
|
6016
6029
|
*/
|
|
@@ -6710,7 +6723,7 @@ declare type HostSpecs = {
|
|
|
6710
6723
|
*/
|
|
6711
6724
|
aeroGlassEnabled?: boolean;
|
|
6712
6725
|
/**
|
|
6713
|
-
* "
|
|
6726
|
+
* "x86_64" for 64-bit
|
|
6714
6727
|
*/
|
|
6715
6728
|
arch: string;
|
|
6716
6729
|
/**
|
|
@@ -8379,6 +8392,18 @@ declare type JumpListTask = {
|
|
|
8379
8392
|
iconIndex?: number;
|
|
8380
8393
|
};
|
|
8381
8394
|
|
|
8395
|
+
/**
|
|
8396
|
+
* Language metadata for content translation.
|
|
8397
|
+
*/
|
|
8398
|
+
declare type LanguageInfo = {
|
|
8399
|
+
/** ISO language code (e.g. "fr"). */
|
|
8400
|
+
code: string;
|
|
8401
|
+
/** English display name of the language (e.g. "French"). */
|
|
8402
|
+
nameEn: string;
|
|
8403
|
+
/** Localized display name of the language (e.g. "Français"). */
|
|
8404
|
+
nameI18N: string;
|
|
8405
|
+
};
|
|
8406
|
+
|
|
8382
8407
|
/**
|
|
8383
8408
|
* The LaunchEmitter is an `EventEmitter`. It can listen to app version resolver events.
|
|
8384
8409
|
*
|
|
@@ -11212,6 +11237,14 @@ declare namespace OpenFin_2 {
|
|
|
11212
11237
|
ClientChangedContextGroup,
|
|
11213
11238
|
InteropClientEvents,
|
|
11214
11239
|
ChromeBrowser,
|
|
11240
|
+
LanguageInfo,
|
|
11241
|
+
PageTranslateOptions,
|
|
11242
|
+
FailedTranslationStatus,
|
|
11243
|
+
TranslatedPageStatus,
|
|
11244
|
+
TranslationStatus,
|
|
11245
|
+
UntranslatableWebContentInfo,
|
|
11246
|
+
TranslatableWebContentInfo,
|
|
11247
|
+
WebContentTranslationInfo,
|
|
11215
11248
|
ApplicationEvents,
|
|
11216
11249
|
BaseEvents,
|
|
11217
11250
|
ExternalApplicationEvents,
|
|
@@ -11280,6 +11313,16 @@ declare type PageTitleUpdatedEvent = NamedEvent & {
|
|
|
11280
11313
|
title: string;
|
|
11281
11314
|
};
|
|
11282
11315
|
|
|
11316
|
+
/**
|
|
11317
|
+
* Options for {@link OpenFin.WebContents.translatePage}.
|
|
11318
|
+
*/
|
|
11319
|
+
declare type PageTranslateOptions = {
|
|
11320
|
+
/** BCP-47 language code of the source language, or empty string for auto-detect. */
|
|
11321
|
+
sourceLang: string;
|
|
11322
|
+
/** BCP-47 language code of the target language. */
|
|
11323
|
+
targetLang: string;
|
|
11324
|
+
};
|
|
11325
|
+
|
|
11283
11326
|
/**
|
|
11284
11327
|
* Reasons for a paste operation being blocked
|
|
11285
11328
|
*
|
|
@@ -14411,6 +14454,12 @@ declare type ProtocolMap = ExternalAdapterOnlyCallsMap & AnalyticsProtocolMap &
|
|
|
14411
14454
|
request: OpenFin_2.Identity;
|
|
14412
14455
|
response: OpenFin_2.ScreenCapturePermission;
|
|
14413
14456
|
};
|
|
14457
|
+
'translate-page': IdentityCall<{
|
|
14458
|
+
sourceLang: string;
|
|
14459
|
+
targetLang: string;
|
|
14460
|
+
}, void>;
|
|
14461
|
+
'revert-translation': IdentityCall<{}, void>;
|
|
14462
|
+
'get-translation-state': IdentityCall<{}, OpenFin_2.WebContentTranslationInfo>;
|
|
14414
14463
|
'render-overlay': {
|
|
14415
14464
|
request: {
|
|
14416
14465
|
bounds: OpenFin_2.Bounds;
|
|
@@ -17917,6 +17966,45 @@ declare type TransitionOptions = {
|
|
|
17917
17966
|
tween?: tween;
|
|
17918
17967
|
};
|
|
17919
17968
|
|
|
17969
|
+
/**
|
|
17970
|
+
* Describes a WebContents on which content translation is supported.
|
|
17971
|
+
*/
|
|
17972
|
+
declare type TranslatableWebContentInfo = {
|
|
17973
|
+
/** Whether translation is supported on this WebContents. */
|
|
17974
|
+
translationEnabled: true;
|
|
17975
|
+
/** Detected WebContents language, or undefined if not yet determined. */
|
|
17976
|
+
detectedLanguage?: LanguageInfo;
|
|
17977
|
+
/** Translation status of the WebContents. */
|
|
17978
|
+
state: TranslationStatus;
|
|
17979
|
+
};
|
|
17980
|
+
|
|
17981
|
+
/**
|
|
17982
|
+
* Translation status of a translatable WebContents that is translated or is being translated.
|
|
17983
|
+
*/
|
|
17984
|
+
declare type TranslatedPageStatus = {
|
|
17985
|
+
status: 'pending-translation' | 'translated';
|
|
17986
|
+
/** The language the page is being translated from. */
|
|
17987
|
+
sourceLanguage: LanguageInfo;
|
|
17988
|
+
/** The language the page is being translated to. */
|
|
17989
|
+
targetLanguage: LanguageInfo;
|
|
17990
|
+
};
|
|
17991
|
+
|
|
17992
|
+
/**
|
|
17993
|
+
* Generated when the translation state of a WebContents changes, such as when a page in a
|
|
17994
|
+
* foreign language is detected or when a translation completes.
|
|
17995
|
+
* @interface
|
|
17996
|
+
*/
|
|
17997
|
+
declare type TranslationStateChangedEvent = NamedEvent & {
|
|
17998
|
+
type: 'translation-state-changed';
|
|
17999
|
+
} & OpenFin_2.WebContentTranslationInfo;
|
|
18000
|
+
|
|
18001
|
+
/**
|
|
18002
|
+
* The translation status of a translatable WebContents.
|
|
18003
|
+
*/
|
|
18004
|
+
declare type TranslationStatus = {
|
|
18005
|
+
status: 'untranslated';
|
|
18006
|
+
} | FailedTranslationStatus | TranslatedPageStatus;
|
|
18007
|
+
|
|
17920
18008
|
declare class Transport<MeType extends EntityType = EntityType> extends EventEmitter {
|
|
17921
18009
|
#private;
|
|
17922
18010
|
protected wireListeners: Map<number, {
|
|
@@ -18016,6 +18104,14 @@ declare type UnregisteredEvent = BaseEvent_8 & {
|
|
|
18016
18104
|
type: 'unregistered';
|
|
18017
18105
|
};
|
|
18018
18106
|
|
|
18107
|
+
/**
|
|
18108
|
+
* Describes a WebContents on which content translation is not supported (for example because no
|
|
18109
|
+
* translation API key is configured on the machine, or the current page is not translatable).
|
|
18110
|
+
*/
|
|
18111
|
+
declare type UntranslatableWebContentInfo = {
|
|
18112
|
+
translationEnabled: false;
|
|
18113
|
+
};
|
|
18114
|
+
|
|
18019
18115
|
/**
|
|
18020
18116
|
* View options that can be updated after creation.
|
|
18021
18117
|
*
|
|
@@ -19153,6 +19249,26 @@ declare class WebContents<T extends BaseEvent> extends EmitterBase<T> {
|
|
|
19153
19249
|
* {@link OpenFin.WebContentsEvents event namespace}.
|
|
19154
19250
|
*/
|
|
19155
19251
|
setZoomLevel(level: number): Promise<void>;
|
|
19252
|
+
/**
|
|
19253
|
+
* Translates the WebContents from the source language to the target language.
|
|
19254
|
+
*
|
|
19255
|
+
* Translation requires a translation API key to be configured on the machine. If translation is
|
|
19256
|
+
* unavailable, the call is a no-op and a `translation-state-changed` event is emitted describing
|
|
19257
|
+
* the failure.
|
|
19258
|
+
*
|
|
19259
|
+
* @param options Source and target languages for the translation.
|
|
19260
|
+
*/
|
|
19261
|
+
translatePage(options: OpenFin_2.PageTranslateOptions): Promise<void>;
|
|
19262
|
+
/**
|
|
19263
|
+
* Reverts a previously translated WebContents back to its original language.
|
|
19264
|
+
*
|
|
19265
|
+
* If the WebContents is not currently translated, this is a no-op and resolves successfully.
|
|
19266
|
+
*/
|
|
19267
|
+
revertTranslation(): Promise<void>;
|
|
19268
|
+
/**
|
|
19269
|
+
* Gets the current content-translation state of the WebContents.
|
|
19270
|
+
*/
|
|
19271
|
+
getTranslationState(): Promise<OpenFin_2.WebContentTranslationInfo>;
|
|
19156
19272
|
/**
|
|
19157
19273
|
* Navigates the WebContents to a specified URL.
|
|
19158
19274
|
*
|
|
@@ -19971,6 +20087,7 @@ declare namespace WebContentsEvents {
|
|
|
19971
20087
|
ContentBlockedEvent,
|
|
19972
20088
|
ClipboardCopyBlockedEvent,
|
|
19973
20089
|
ClipboardPasteBlockedEvent,
|
|
20090
|
+
TranslationStateChangedEvent,
|
|
19974
20091
|
Event_5 as Event,
|
|
19975
20092
|
WebContentsEvent,
|
|
19976
20093
|
WillPropagateWebContentsEvent,
|
|
@@ -19979,6 +20096,11 @@ declare namespace WebContentsEvents {
|
|
|
19979
20096
|
}
|
|
19980
20097
|
}
|
|
19981
20098
|
|
|
20099
|
+
/**
|
|
20100
|
+
* Describes the current content-translation state of a WebContents.
|
|
20101
|
+
*/
|
|
20102
|
+
declare type WebContentTranslationInfo = UntranslatableWebContentInfo | TranslatableWebContentInfo;
|
|
20103
|
+
|
|
19982
20104
|
declare type WebNotificationInfo = {
|
|
19983
20105
|
notificationId: string;
|
|
19984
20106
|
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
|
*
|