@wix/auto_sdk_multilingual_machine-translation 1.0.21 → 1.0.22

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.
Files changed (25) hide show
  1. package/build/cjs/index.d.ts +8 -4
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/cjs/{multilingual-machine-v3-translatable-content-machine-translation.universal-Crv8uhBN.d.ts → index.typings.d.ts} +104 -1
  4. package/build/cjs/index.typings.js +886 -0
  5. package/build/cjs/index.typings.js.map +1 -0
  6. package/build/cjs/meta.d.ts +2 -1
  7. package/build/es/index.d.mts +8 -4
  8. package/build/es/index.mjs.map +1 -1
  9. package/build/es/{multilingual-machine-v3-translatable-content-machine-translation.universal-Crv8uhBN.d.mts → index.typings.d.mts} +104 -1
  10. package/build/es/index.typings.mjs +829 -0
  11. package/build/es/index.typings.mjs.map +1 -0
  12. package/build/es/meta.d.mts +2 -1
  13. package/build/internal/cjs/index.d.ts +8 -4
  14. package/build/internal/cjs/index.js.map +1 -1
  15. package/build/internal/cjs/{multilingual-machine-v3-translatable-content-machine-translation.universal-Crv8uhBN.d.ts → index.typings.d.ts} +104 -1
  16. package/build/internal/cjs/index.typings.js +886 -0
  17. package/build/internal/cjs/index.typings.js.map +1 -0
  18. package/build/internal/cjs/meta.d.ts +2 -1
  19. package/build/internal/es/index.d.mts +8 -4
  20. package/build/internal/es/index.mjs.map +1 -1
  21. package/build/internal/es/{multilingual-machine-v3-translatable-content-machine-translation.universal-Crv8uhBN.d.mts → index.typings.d.mts} +104 -1
  22. package/build/internal/es/index.typings.mjs +829 -0
  23. package/build/internal/es/index.typings.mjs.map +1 -0
  24. package/build/internal/es/meta.d.mts +2 -1
  25. package/package.json +2 -2
@@ -1,3 +1,5 @@
1
+ import { NonNullablePaths } from '@wix/sdk-types';
2
+
1
3
  /**
2
4
  * A translatable content is a unit of content to translate.
3
5
  *
@@ -1457,6 +1459,8 @@ declare enum NullValue {
1457
1459
  /** Null value. */
1458
1460
  NULL_VALUE = "NULL_VALUE"
1459
1461
  }
1462
+ /** @enumType */
1463
+ type NullValueWithLiterals = NullValue | 'NULL_VALUE';
1460
1464
  /**
1461
1465
  * `ListValue` is a wrapper around a repeated field of values.
1462
1466
  *
@@ -1913,12 +1917,111 @@ interface BulkActionMetadata {
1913
1917
  /** Number of failures without details because detailed failure threshold was exceeded. */
1914
1918
  undetailedFailures?: number;
1915
1919
  }
1920
+ type MachineTranslateApplicationErrors = {
1921
+ code?: 'NOT_ENOUGH_CREDITS';
1922
+ description?: string;
1923
+ data?: NotEnoughCreditsError;
1924
+ } | {
1925
+ code?: 'TEXT_TOO_LONG';
1926
+ description?: string;
1927
+ data?: TextTooLongError;
1928
+ } | {
1929
+ code?: 'UNKNOWN_FORMAT';
1930
+ description?: string;
1931
+ data?: UnknownFormatError;
1932
+ } | {
1933
+ code?: 'SAME_LANGUAGE_ARGUMENTS';
1934
+ description?: string;
1935
+ data?: SameLanguageArgumentsError;
1936
+ };
1937
+ type BulkMachineTranslateApplicationErrors = {
1938
+ code?: 'NOT_ENOUGH_CREDITS';
1939
+ description?: string;
1940
+ data?: NotEnoughCreditsError;
1941
+ } | {
1942
+ code?: 'SAME_LANGUAGE_ARGUMENTS';
1943
+ description?: string;
1944
+ data?: SameLanguageArgumentsError;
1945
+ };
1946
+ type TranslatableContentNonNullablePaths = `plainTextContent` | `htmlContent` | `format`;
1947
+ /**
1948
+ * Translates the text of a translatable unit of content from one supported language to another.
1949
+ *
1950
+ * The `translatedContent` object returns with the same `id` used for `contentToTranslate.id` but the text within the
1951
+ * content fields is replaced with the translated text. Note that Wix does not overwrite the original content object.
1952
+ * To retrieve the translated content later, make sure to store it separately.
1953
+ *
1954
+ * Only text content is translated, even if the content is `htmlContent` or `richContent`. Note that [collapsible text](https://support.wix.com/en/article/adding-and-setting-up-collapsible-text)
1955
+ * cannot be translated using this method.
1956
+ *
1957
+ * The translatable content must not exceed 5,000 characters. If this limit is exceeded, the method returns a `TEXT_TOO_LONG` error.
1958
+ * For `richContent`, the 5,000-character limit applies separately to each node in `richContent.nodes`.
1959
+ * The total translatable content may be more than 5,000 characters as long as no individual node surpasses this limit.
1960
+ * If any node exceeds 5,000 characters, the entire request fails.
1961
+ *
1962
+ * Each site has a word credit balance indicating the number of words available for translation. Successful translation requests reduce the word credits by the number of words in `contentToTranslate`.
1963
+ * If the site does not have sufficient word credits to translate all of the text in the request, the request fails
1964
+ * with a `NOT_ENOUGH_CREDITS` error. You can also call the [Credit Data API](https://dev.wix.com/docs/rest/business-management/multilingual/machine-translation/credit-data/introduction)'s [Check Sufficient Credits](https://dev.wix.com/docs/rest/business-management/multilingual/machine-translation/credit-data/check-sufficient-credits) method at any time to check whether the site has enough credits to translate the specified number of words.
1965
+ * Wix users can receive additional word credits by [purchasing a translation package](https://support.wix.com/en/article/wix-multilingual-auto-translating-your-site#purchasing-translation-packages) in the [Translation Manager](https://support.wix.com/en/article/wix-multilingual-using-the-translation-manager) at any time.
1966
+ *
1967
+ * To translate up to 1,000 `translatableContent` units at once, use [Bulk Machine Translate](/machine-translation/bulk-machine-translate).
1968
+ * @param sourceLanguage - Language of the source text to translate.
1969
+ * @public
1970
+ * @requiredField options
1971
+ * @requiredField options.contentToTranslate
1972
+ * @requiredField options.targetLanguage
1973
+ * @requiredField sourceLanguage
1974
+ * @permissionId WIX_MULTILINGUAL.MACHINE_TRANSLATE
1975
+ * @applicableIdentity APP
1976
+ * @fqn wix.multilingual.machine.v3.MachineTranslation.MachineTranslate
1977
+ */
1978
+ declare function machineTranslate(sourceLanguage: SupportedLanguageWithLiterals, options: NonNullablePaths<MachineTranslateOptions, `contentToTranslate` | `targetLanguage`>): Promise<NonNullablePaths<MachineTranslateResponse, {
1979
+ [P in TranslatableContentNonNullablePaths]: `translatedContent.${P}`;
1980
+ }[TranslatableContentNonNullablePaths]> & {
1981
+ __applicationErrorsType?: MachineTranslateApplicationErrors;
1982
+ }>;
1916
1983
  interface MachineTranslateOptions {
1917
1984
  /** Language to translate text into. */
1918
1985
  targetLanguage: SupportedLanguageWithLiterals;
1919
1986
  /** The content to translate. */
1920
1987
  contentToTranslate: TranslatableContent;
1921
1988
  }
1989
+ /**
1990
+ * Translates the text of multiple units of translatable content from one supported language to another.
1991
+ *
1992
+ * Each translated content item in the `results` array returns with the same `id` as the corresponding `contentToTranslate.id`, but with the text in the
1993
+ * content fields replaced with the translated text. Note that Wix does not overwrite the original content source,
1994
+ * to retrieve the translated content later, make sure to store it separately.
1995
+ *
1996
+ * Only text content is translated, even if the content is `htmlContent` or `richContent`. Note that [collapsible text](https://support.wix.com/en/article/adding-and-setting-up-collapsible-text)
1997
+ * cannot be translated using this method.
1998
+ *
1999
+ * Each unit of translatable content must not exceed 5,000 characters. If this limit is exceeded, the method returns a `TEXT_TOO_LONG` error.
2000
+ * For `richContent`, the 5,000-character limit applies separately to each node in `richContent.nodes`.
2001
+ * The total request may exceed 5,000 characters as long as no individual node surpasses this limit.
2002
+ * If any node exceeds 5,000 characters, then the request fails for that specific `contentToTranslate` item and the error details for that
2003
+ * error are returned in `itemMetadata`. Even if some translations fail due to the character limit,
2004
+ * the machine translation for other items will succeed if they are under the character limit.
2005
+ *
2006
+ * Each site has a [word credit](/machine-translation/introduction#terminology) balance, starting at 3,000 words.
2007
+ * Each successful translation request reduces the word credits by the number of words included in `contentToTranslate`.
2008
+ * If the site does not have sufficient word credits to complete the translation, then the entire request fails
2009
+ * with a `NOT_ENOUGH_CREDITS` error. Additional credits can be [purchased through the Dashboard](https://support.wix.com/en/article/wix-multilingual-auto-translating-your-site?tabs=Dashboard-5#purchasing-translation-packages).
2010
+ *
2011
+ * To translate a single unit of `translatableContent`, use [Machine Translate](/machine-translation/machine-translate).
2012
+ * @param sourceLanguage - Language of the source text to translate.
2013
+ * @public
2014
+ * @requiredField options.targetLanguage
2015
+ * @requiredField sourceLanguage
2016
+ * @permissionId WIX_MULTILINGUAL.MACHINE_TRANSLATE
2017
+ * @applicableIdentity APP
2018
+ * @fqn wix.multilingual.machine.v3.MachineTranslation.BulkMachineTranslate
2019
+ */
2020
+ declare function bulkMachineTranslate(sourceLanguage: SupportedLanguageWithLiterals, options?: NonNullablePaths<BulkMachineTranslateOptions, `targetLanguage`>): Promise<NonNullablePaths<BulkMachineTranslateResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | {
2021
+ [P in TranslatableContentNonNullablePaths]: `results.${number}.item.${P}`;
2022
+ }[TranslatableContentNonNullablePaths] | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`> & {
2023
+ __applicationErrorsType?: BulkMachineTranslateApplicationErrors;
2024
+ }>;
1922
2025
  interface BulkMachineTranslateOptions {
1923
2026
  /** Language to translate text into. */
1924
2027
  targetLanguage: SupportedLanguageWithLiterals;
@@ -1930,4 +2033,4 @@ interface BulkMachineTranslateOptions {
1930
2033
  contentToTranslate?: TranslatableContent[];
1931
2034
  }
1932
2035
 
1933
- export { type LinkDataOneOf as $, Alignment as A, type BulkMachineTranslateOptions as B, Crop as C, DecorationType as D, type ButtonData as E, Format as F, GIFType as G, type Border as H, InitialExpandedItems as I, type Colors as J, type PluginContainerData as K, LineStyle as L, type MachineTranslateOptions as M, NodeType as N, Orientation as O, PluginContainerDataAlignment as P, type PluginContainerDataWidth as Q, type RichContent as R, type SupportedLanguageWithLiterals as S, Type as T, type PluginContainerDataWidthDataOneOf as U, ViewMode as V, WidthType as W, type Spoiler as X, type Height as Y, type Styles as Z, type Link as _, type MachineTranslateResponse as a, type TableData as a$, type Rel as a0, type CodeBlockData as a1, type TextStyle as a2, type DividerData as a3, type FileData as a4, type FileSource as a5, type FileSourceDataOneOf as a6, type PDFSettings as a7, type GalleryData as a8, type Media as a9, type OptionLayout as aA, type Gradient as aB, type Background as aC, type BackgroundBackgroundOneOf as aD, type PollDesign as aE, type OptionDesign as aF, type Poll as aG, type PollDataLayout as aH, type Design as aI, type TextData as aJ, type Decoration as aK, type DecorationDataOneOf as aL, type AnchorData as aM, type ColorData as aN, type LinkData as aO, type MentionData as aP, type FontSizeData as aQ, type SpoilerData as aR, type AppEmbedData as aS, type AppEmbedDataAppDataOneOf as aT, type BookingData as aU, type EventData as aV, type VideoData as aW, type PlaybackOptions as aX, type EmbedData as aY, type Oembed as aZ, type CollapsibleListData as a_, type Image as aa, type Video as ab, type Item as ac, type ItemDataOneOf as ad, type GalleryOptions as ae, type Layout as af, type ItemStyle as ag, type Thumbnails as ah, type GIFData as ai, type GIF as aj, type HeadingData as ak, type HTMLData as al, type HTMLDataDataOneOf as am, type ImageData as an, type StylesBorder as ao, type ImageDataStyles as ap, type LinkPreviewData as aq, type LinkPreviewDataStyles as ar, type MapData as as, type MapSettings as at, type ParagraphData as au, type PollData as av, type Permissions as aw, type Option as ax, type Settings as ay, type PollLayout as az, type BulkMachineTranslateResponse as b, type Dimensions as b0, type TableCellData as b1, type CellStyle as b2, type BorderColors as b3, type ListValue as b4, type AudioData as b5, type OrderedListData as b6, type BulletedListData as b7, type BlockquoteData as b8, type CaptionData as b9, type LayoutCellData as ba, type Metadata as bb, type DocumentStyle as bc, type TextNodeStyle as bd, type MachineTranslateRequest as be, type NotEnoughCreditsError as bf, type TextTooLongError as bg, type UnknownFormatError as bh, type SameLanguageArgumentsError as bi, type BulkMachineTranslateRequest as bj, type BulkTranslateResult as bk, type ItemMetadata as bl, type ApplicationError as bm, type BulkActionMetadata as bn, Target as c, TextAlignment as d, Width as e, LayoutType as f, ThumbnailsAlignment as g, Source as h, Position as i, MapType as j, ViewRole as k, VoteRole as l, PollLayoutType as m, PollLayoutDirection as n, BackgroundType as o, FontType as p, AppType as q, Direction as r, VerticalAlignment as s, NullValue as t, SupportedLanguage as u, type TranslatableContent as v, type TranslatableContentContentOneOf as w, type Node as x, type NodeDataOneOf as y, type NodeStyle as z };
2036
+ export { Alignment, type AlignmentWithLiterals, type AnchorData, type AppEmbedData, type AppEmbedDataAppDataOneOf, AppType, type AppTypeWithLiterals, type ApplicationError, type AudioData, type Background, type BackgroundBackgroundOneOf, BackgroundType, type BackgroundTypeWithLiterals, type BlockquoteData, type BookingData, type Border, type BorderColors, type BulkActionMetadata, type BulkMachineTranslateApplicationErrors, type BulkMachineTranslateOptions, type BulkMachineTranslateRequest, type BulkMachineTranslateResponse, type BulkTranslateResult, type BulletedListData, type ButtonData, type CaptionData, type CellStyle, type CodeBlockData, type CollapsibleListData, type ColorData, type Colors, Crop, type CropWithLiterals, type Decoration, type DecorationDataOneOf, DecorationType, type DecorationTypeWithLiterals, type Design, type Dimensions, Direction, type DirectionWithLiterals, type DividerData, type DocumentStyle, type EmbedData, type EventData, type FileData, type FileSource, type FileSourceDataOneOf, type FontSizeData, FontType, type FontTypeWithLiterals, Format, type FormatWithLiterals, type GIF, type GIFData, GIFType, type GIFTypeWithLiterals, type GalleryData, type GalleryOptions, type Gradient, type HTMLData, type HTMLDataDataOneOf, type HeadingData, type Height, type Image, type ImageData, type ImageDataStyles, InitialExpandedItems, type InitialExpandedItemsWithLiterals, type Item, type ItemDataOneOf, type ItemMetadata, type ItemStyle, type Layout, type LayoutCellData, LayoutType, type LayoutTypeWithLiterals, LineStyle, type LineStyleWithLiterals, type Link, type LinkData, type LinkDataOneOf, type LinkPreviewData, type LinkPreviewDataStyles, type ListValue, type MachineTranslateApplicationErrors, type MachineTranslateOptions, type MachineTranslateRequest, type MachineTranslateResponse, type MapData, type MapSettings, MapType, type MapTypeWithLiterals, type Media, type MentionData, type Metadata, type Node, type NodeDataOneOf, type NodeStyle, NodeType, type NodeTypeWithLiterals, type NotEnoughCreditsError, NullValue, type NullValueWithLiterals, type Oembed, type Option, type OptionDesign, type OptionLayout, type OrderedListData, Orientation, type OrientationWithLiterals, type PDFSettings, type ParagraphData, type Permissions, type PlaybackOptions, type PluginContainerData, PluginContainerDataAlignment, type PluginContainerDataAlignmentWithLiterals, type PluginContainerDataWidth, type PluginContainerDataWidthDataOneOf, type Poll, type PollData, type PollDataLayout, type PollDesign, type PollLayout, PollLayoutDirection, type PollLayoutDirectionWithLiterals, PollLayoutType, type PollLayoutTypeWithLiterals, Position, type PositionWithLiterals, type Rel, type RichContent, type SameLanguageArgumentsError, type Settings, Source, type SourceWithLiterals, type Spoiler, type SpoilerData, type Styles, type StylesBorder, SupportedLanguage, type SupportedLanguageWithLiterals, type TableCellData, type TableData, Target, type TargetWithLiterals, TextAlignment, type TextAlignmentWithLiterals, type TextData, type TextNodeStyle, type TextStyle, type TextTooLongError, type Thumbnails, ThumbnailsAlignment, type ThumbnailsAlignmentWithLiterals, type TranslatableContent, type TranslatableContentContentOneOf, Type, type TypeWithLiterals, type UnknownFormatError, VerticalAlignment, type VerticalAlignmentWithLiterals, type Video, type VideoData, ViewMode, type ViewModeWithLiterals, ViewRole, type ViewRoleWithLiterals, VoteRole, type VoteRoleWithLiterals, Width, WidthType, type WidthTypeWithLiterals, type WidthWithLiterals, bulkMachineTranslate, machineTranslate };