@wix/auto_sdk_rich-content_ricos-documents 1.0.54 → 1.0.56

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.
@@ -1,6 +1,6 @@
1
1
  import { HttpClient, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
- import { ValidateDocumentOptions, ValidateDocumentResponse, ConvertToRicosDocumentOptions, ConvertToRicosDocumentResponse, RichContent, TargetFormatWithLiterals, ConvertFromRicosDocumentOptions, ConvertFromRicosDocumentResponse, GenerateFileDownloadUrlResponse, GenerateFileDownloadUrlApplicationErrors } from './index.typings.js';
3
- export { Alignment, AlignmentWithLiterals, AnchorData, Animation, AppEmbedData, AppEmbedDataAppDataOneOf, AppType, AppTypeWithLiterals, AspectRatio, AspectRatioWithLiterals, AudioData, Backdrop, BackdropType, BackdropTypeWithLiterals, Background, BackgroundGradient, BackgroundImage, BackgroundType, BackgroundTypeWithLiterals, Banner, BannerOriginPresenceOneOf, BannerPosition, BannerPositionWithLiterals, BlockquoteData, BookingData, Border, BorderColors, BorderWidths, BulletedListData, ButtonData, ButtonDataType, ButtonDataTypeWithLiterals, ButtonStyles, CaptionData, CardData, CardDataBackground, CardDataBackgroundType, CardDataBackgroundTypeWithLiterals, CardStyles, CardStylesType, CardStylesTypeWithLiterals, CellStyle, CheckboxListData, CodeBlockData, CollapsibleListData, ColorData, ColorDataBackground, ColorDataBackgroundType, ColorDataBackgroundTypeWithLiterals, Colors, ColumnSize, ColumnSizeWithLiterals, ConvertFromRicosDocumentOptionsOptionsOneOf, ConvertFromRicosDocumentRequest, ConvertFromRicosDocumentRequestOptionsOneOf, ConvertFromRicosDocumentResponseResultOneOf, ConvertToRicosDocumentOptionsSourceOneOf, ConvertToRicosDocumentRequest, ConvertToRicosDocumentRequestSourceOneOf, Crop, CropWithLiterals, Decoration, DecorationDataOneOf, DecorationType, DecorationTypeWithLiterals, Design, DesignTarget, DesignTargetWithLiterals, Dimensions, Direction, DirectionWithLiterals, DividerData, DividerDataAlignment, DividerDataAlignmentWithLiterals, DividerDataStyles, DocumentStyle, EmbedData, EntranceAnimation, EntranceEffect, EntranceEffectType, EntranceEffectTypeWithLiterals, EventData, FileData, FileDownloadUrl, FileSource, FileSourceDataOneOf, FontFamilyData, FontSizeData, FontType, FontTypeWithLiterals, GIF, GIFData, GIFType, GIFTypeWithLiterals, GalleryData, GalleryOptions, GalleryOptionsLayout, GenerateFileDownloadUrlRequest, Gradient, GradientType, GradientTypeWithLiterals, HTMLData, HTMLDataDataOneOf, HeadingData, Height, Image, ImageData, ImageDataCrop, ImageDataStyles, ImagePosition, ImagePositionPosition, ImagePositionPositionWithLiterals, ImagePositionWithLiterals, ImageScalingScaling, ImageScalingScalingWithLiterals, ImageStyles, Indentation, IndentationWithLiterals, InitialExpandedItems, InitialExpandedItemsWithLiterals, Item, ItemDataOneOf, ItemStyle, LayerEffect, LayerEffectWithLiterals, Layers, Layout, LayoutCellData, LayoutData, LayoutDataBackground, LayoutDataBackgroundImage, LayoutDataBackgroundType, LayoutDataBackgroundTypeWithLiterals, LayoutType, LayoutTypeWithLiterals, LayoutWithLiterals, LineCap, LineCapWithLiterals, LineStyle, LineStyleWithLiterals, Link, LinkData, LinkDataOneOf, LinkPreviewData, LinkPreviewDataStyles, ListItemNodeData, ListStyle, ListStyleWithLiterals, ListValue, LoopAnimation, LoopEffect, LoopEffectType, LoopEffectTypeWithLiterals, MapData, MapSettings, MapType, MapTypeWithLiterals, Media, MentionData, Metadata, Node, NodeDataOneOf, NodeStyle, NodeType, NodeTypeWithLiterals, NullValue, NullValueWithLiterals, Oembed, Option, OptionDesign, OptionLayout, OrderedListData, Orientation, OrientationWithLiterals, Origin, OriginWithLiterals, PDFSettings, ParagraphData, Permissions, Placement, PlacementWithLiterals, PlainTextOptions, PlaybackOptions, Plugin, PluginContainerData, PluginContainerDataAlignment, PluginContainerDataAlignmentWithLiterals, PluginContainerDataWidth, PluginContainerDataWidthDataOneOf, PluginWithLiterals, PointerEffect, PointerEffectType, PointerEffectTypeWithLiterals, Poll, PollData, PollDataLayout, PollDesign, PollDesignBackground, PollDesignBackgroundBackgroundOneOf, PollDesignBackgroundType, PollDesignBackgroundTypeWithLiterals, PollLayout, PollLayoutDirection, PollLayoutDirectionWithLiterals, PollLayoutType, PollLayoutTypeWithLiterals, Position, PositionWithLiterals, PricingData, Rel, Resizing, ResizingWithLiterals, ResponsivenessBehaviour, ResponsivenessBehaviourWithLiterals, RibbonStyles, RicosDocumentOptions, RicosDocumentPlaceholder, RicosDocumentViolation, Scaling, ScalingWithLiterals, SectionDivider, Settings, Shape, ShapeData, ShapeDataStyles, ShapeWithLiterals, SketchData, SlotData, SlotDesign, SmartBlockCellData, SmartBlockData, SmartBlockDataType, SmartBlockDataTypeWithLiterals, Source, SourceWithLiterals, Spoiler, SpoilerData, Stop, Styles, StylesBorder, StylesPosition, StylesPositionWithLiterals, TableCellData, TableData, Target, TargetFormat, TargetWithLiterals, TextAlignment, TextAlignmentWithLiterals, TextData, TextNodeStyle, TextStyle, Thumbnails, ThumbnailsAlignment, ThumbnailsAlignmentWithLiterals, TocData, Type, TypeWithLiterals, ValidateDocumentRequest, Variant, VariantWithLiterals, VerticalAlignment, VerticalAlignmentAlignment, VerticalAlignmentAlignmentWithLiterals, VerticalAlignmentWithLiterals, Video, VideoData, ViewMode, ViewModeWithLiterals, ViewRole, ViewRoleWithLiterals, VoteRole, VoteRoleWithLiterals, Width, WidthType, WidthTypeWithLiterals, WidthWithLiterals } from './index.typings.js';
2
+ import { ValidateDocumentOptions, ValidateDocumentResponse, ConvertToRicosDocumentOptions, ConvertToRicosDocumentResponse, RichContent, TargetFormatWithLiterals, ConvertFromRicosDocumentOptions, ConvertFromRicosDocumentResponse, GenerateFileDownloadUrlResponse, GenerateFileDownloadUrlApplicationErrors, GenerateFileUploadUrlOptions, GenerateFileUploadUrlResponse } from './index.typings.js';
3
+ export { Alignment, AlignmentWithLiterals, AnchorData, Animation, AppEmbedData, AppEmbedDataAppDataOneOf, AppType, AppTypeWithLiterals, AspectRatio, AspectRatioWithLiterals, AudioData, Backdrop, BackdropType, BackdropTypeWithLiterals, Background, BackgroundGradient, BackgroundImage, BackgroundType, BackgroundTypeWithLiterals, Banner, BannerOriginPresenceOneOf, BannerPosition, BannerPositionWithLiterals, BlockquoteData, BookingData, Border, BorderColors, BorderWidths, BulletedListData, ButtonData, ButtonDataType, ButtonDataTypeWithLiterals, ButtonStyles, CaptionData, CardData, CardDataBackground, CardDataBackgroundType, CardDataBackgroundTypeWithLiterals, CardStyles, CardStylesType, CardStylesTypeWithLiterals, CellStyle, CheckboxListData, CodeBlockData, CollapsibleListData, ColorData, ColorDataBackground, ColorDataBackgroundType, ColorDataBackgroundTypeWithLiterals, Colors, ColumnSize, ColumnSizeWithLiterals, ConvertFromRicosDocumentOptionsOptionsOneOf, ConvertFromRicosDocumentRequest, ConvertFromRicosDocumentRequestOptionsOneOf, ConvertFromRicosDocumentResponseResultOneOf, ConvertToRicosDocumentOptionsSourceOneOf, ConvertToRicosDocumentRequest, ConvertToRicosDocumentRequestSourceOneOf, Crop, CropWithLiterals, Decoration, DecorationDataOneOf, DecorationType, DecorationTypeWithLiterals, Design, DesignTarget, DesignTargetWithLiterals, Dimensions, Direction, DirectionWithLiterals, DividerData, DividerDataAlignment, DividerDataAlignmentWithLiterals, DividerDataStyles, DocumentStyle, EmbedData, EntranceAnimation, EntranceEffect, EntranceEffectType, EntranceEffectTypeWithLiterals, EventData, FileData, FileDownloadUrl, FileSource, FileSourceDataOneOf, FontFamilyData, FontSizeData, FontType, FontTypeWithLiterals, GIF, GIFData, GIFType, GIFTypeWithLiterals, GalleryData, GalleryOptions, GalleryOptionsLayout, GenerateFileDownloadUrlRequest, GenerateFileUploadUrlRequest, Gradient, GradientType, GradientTypeWithLiterals, HTMLData, HTMLDataDataOneOf, HeadingData, Height, Image, ImageData, ImageDataCrop, ImageDataStyles, ImagePosition, ImagePositionPosition, ImagePositionPositionWithLiterals, ImagePositionWithLiterals, ImageScalingScaling, ImageScalingScalingWithLiterals, ImageStyles, Indentation, IndentationWithLiterals, InitialExpandedItems, InitialExpandedItemsWithLiterals, Item, ItemDataOneOf, ItemStyle, LayerEffect, LayerEffectWithLiterals, Layers, Layout, LayoutCellData, LayoutData, LayoutDataBackground, LayoutDataBackgroundImage, LayoutDataBackgroundType, LayoutDataBackgroundTypeWithLiterals, LayoutType, LayoutTypeWithLiterals, LayoutWithLiterals, LineCap, LineCapWithLiterals, LineStyle, LineStyleWithLiterals, Link, LinkData, LinkDataOneOf, LinkPreviewData, LinkPreviewDataStyles, ListItemNodeData, ListStyle, ListStyleWithLiterals, ListValue, LoopAnimation, LoopEffect, LoopEffectType, LoopEffectTypeWithLiterals, MapData, MapSettings, MapType, MapTypeWithLiterals, Media, MentionData, Metadata, Node, NodeDataOneOf, NodeStyle, NodeType, NodeTypeWithLiterals, NullValue, NullValueWithLiterals, Oembed, Option, OptionDesign, OptionLayout, OrderedListData, Orientation, OrientationWithLiterals, Origin, OriginWithLiterals, PDFSettings, ParagraphData, Permissions, Placement, PlacementWithLiterals, PlainTextOptions, PlaybackOptions, Plugin, PluginContainerData, PluginContainerDataAlignment, PluginContainerDataAlignmentWithLiterals, PluginContainerDataWidth, PluginContainerDataWidthDataOneOf, PluginWithLiterals, PointerEffect, PointerEffectType, PointerEffectTypeWithLiterals, Poll, PollData, PollDataLayout, PollDesign, PollDesignBackground, PollDesignBackgroundBackgroundOneOf, PollDesignBackgroundType, PollDesignBackgroundTypeWithLiterals, PollLayout, PollLayoutDirection, PollLayoutDirectionWithLiterals, PollLayoutType, PollLayoutTypeWithLiterals, Position, PositionWithLiterals, PricingData, Rel, Resizing, ResizingWithLiterals, ResponsivenessBehaviour, ResponsivenessBehaviourWithLiterals, RibbonStyles, RicosDocumentOptions, RicosDocumentPlaceholder, RicosDocumentViolation, Scaling, ScalingWithLiterals, SectionDivider, Settings, Shape, ShapeData, ShapeDataStyles, ShapeWithLiterals, SketchData, SlotData, SlotDesign, SmartBlockCellData, SmartBlockData, SmartBlockDataType, SmartBlockDataTypeWithLiterals, Source, SourceWithLiterals, Spoiler, SpoilerData, Stop, Styles, StylesBorder, StylesPosition, StylesPositionWithLiterals, TableCellData, TableData, Target, TargetFormat, TargetWithLiterals, TextAlignment, TextAlignmentWithLiterals, TextData, TextNodeStyle, TextStyle, Thumbnails, ThumbnailsAlignment, ThumbnailsAlignmentWithLiterals, TocData, Type, TypeWithLiterals, ValidateDocumentRequest, Variant, VariantWithLiterals, VerticalAlignment, VerticalAlignmentAlignment, VerticalAlignmentAlignmentWithLiterals, VerticalAlignmentWithLiterals, Video, VideoData, ViewMode, ViewModeWithLiterals, ViewRole, ViewRoleWithLiterals, VoteRole, VoteRoleWithLiterals, Width, WidthType, WidthTypeWithLiterals, WidthWithLiterals } from './index.typings.js';
4
4
 
5
5
  declare function validateDocument$1(httpClient: HttpClient): ValidateDocumentSignature;
6
6
  interface ValidateDocumentSignature {
@@ -54,10 +54,37 @@ interface GenerateFileDownloadUrlSignature {
54
54
  __applicationErrorsType?: GenerateFileDownloadUrlApplicationErrors;
55
55
  }>;
56
56
  }
57
+ declare function generateFileUploadUrl$1(httpClient: HttpClient): GenerateFileUploadUrlSignature;
58
+ interface GenerateFileUploadUrlSignature {
59
+ /**
60
+ * Generates a URL for uploading a file to the site's Media Manager, so you can add the file to a Ricos document.
61
+ *
62
+ * To upload the file, send a `PUT` request to `uploadUrl` with the file content as the request body and a
63
+ * `Content-Type` header that matches `mimeType`. If you didn't specify `fileName`, add the file name as the
64
+ * `filename` query parameter. For example, `PUT {uploadUrl}?filename=report.pdf`. The URL expires after 24 hours.
65
+ * Learn more about the [Upload API](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/upload-api).
66
+ *
67
+ * The upload response contains the uploaded file's
68
+ * [file descriptor](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/file-descriptor-object).
69
+ * Specify its `file.id` as the file node's `fileData.src.id` in the Ricos document.
70
+ * A successful upload response doesn't mean the file is ready. To run code when it's ready, listen for the
71
+ * [File Ready](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/file-descriptor-file-ready) and
72
+ * [File Failed](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/file-descriptor-file-failed) events.
73
+ *
74
+ * Use this method to let site visitors and members add files to the content they create.
75
+ * To download a private file, call [Generate File Download URL](https://dev.wix.com/docs/api-reference/assets/rich-content/ricos-documents/generate-file-download-url).
76
+ *
77
+ * This method doesn't support resumable uploads. For the supported file types and sizes, see
78
+ * [Wix Media: Supported Media File Types and File Sizes](https://support.wix.com/en/article/wix-media-supported-media-file-types-and-file-sizes).
79
+ * @param - MIME type of the file to upload. For example, `application/pdf`.
80
+ */
81
+ (mimeType: string, options?: GenerateFileUploadUrlOptions): Promise<GenerateFileUploadUrlResponse>;
82
+ }
57
83
 
58
84
  declare const validateDocument: MaybeContext<BuildRESTFunction<typeof validateDocument$1> & typeof validateDocument$1>;
59
85
  declare const convertToRicosDocument: MaybeContext<BuildRESTFunction<typeof convertToRicosDocument$1> & typeof convertToRicosDocument$1>;
60
86
  declare const convertFromRicosDocument: MaybeContext<BuildRESTFunction<typeof convertFromRicosDocument$1> & typeof convertFromRicosDocument$1>;
61
87
  declare const generateFileDownloadUrl: MaybeContext<BuildRESTFunction<typeof generateFileDownloadUrl$1> & typeof generateFileDownloadUrl$1>;
88
+ declare const generateFileUploadUrl: MaybeContext<BuildRESTFunction<typeof generateFileUploadUrl$1> & typeof generateFileUploadUrl$1>;
62
89
 
63
- export { ConvertFromRicosDocumentOptions, ConvertFromRicosDocumentResponse, ConvertToRicosDocumentOptions, ConvertToRicosDocumentResponse, GenerateFileDownloadUrlApplicationErrors, GenerateFileDownloadUrlResponse, RichContent, TargetFormatWithLiterals, ValidateDocumentOptions, ValidateDocumentResponse, convertFromRicosDocument, convertToRicosDocument, generateFileDownloadUrl, validateDocument };
90
+ export { ConvertFromRicosDocumentOptions, ConvertFromRicosDocumentResponse, ConvertToRicosDocumentOptions, ConvertToRicosDocumentResponse, GenerateFileDownloadUrlApplicationErrors, GenerateFileDownloadUrlResponse, GenerateFileUploadUrlOptions, GenerateFileUploadUrlResponse, RichContent, TargetFormatWithLiterals, ValidateDocumentOptions, ValidateDocumentResponse, convertFromRicosDocument, convertToRicosDocument, generateFileDownloadUrl, generateFileUploadUrl, validateDocument };
@@ -89,6 +89,7 @@ __export(index_exports, {
89
89
  convertFromRicosDocument: () => convertFromRicosDocument4,
90
90
  convertToRicosDocument: () => convertToRicosDocument4,
91
91
  generateFileDownloadUrl: () => generateFileDownloadUrl4,
92
+ generateFileUploadUrl: () => generateFileUploadUrl4,
92
93
  validateDocument: () => validateDocument4
93
94
  });
94
95
  module.exports = __toCommonJS(index_exports);
@@ -780,6 +781,27 @@ function generateFileDownloadUrl(payload) {
780
781
  }
781
782
  return __generateFileDownloadUrl;
782
783
  }
784
+ function generateFileUploadUrl(payload) {
785
+ function __generateFileUploadUrl({ host }) {
786
+ const metadata = {
787
+ entityFqdn: "wix.ricos.v1.document",
788
+ method: "POST",
789
+ methodFqn: "wix.ricos.v1.RicosDocument.GenerateFileUploadUrl",
790
+ packageName: PACKAGE_NAME,
791
+ migrationOptions: {
792
+ optInTransformResponse: true
793
+ },
794
+ url: resolveWixRicosV1RicosDocumentUrl({
795
+ protoPath: "/v1/ricos-document/generate-file-upload-url",
796
+ data: payload,
797
+ host
798
+ }),
799
+ data: payload
800
+ };
801
+ return metadata;
802
+ }
803
+ return __generateFileUploadUrl;
804
+ }
783
805
 
784
806
  // src/ricos-v1-document-ricos-documents.universal.ts
785
807
  var Plugin = /* @__PURE__ */ ((Plugin2) => {
@@ -1457,6 +1479,39 @@ async function generateFileDownloadUrl2(fileId) {
1457
1479
  throw transformedError;
1458
1480
  }
1459
1481
  }
1482
+ async function generateFileUploadUrl2(mimeType, options) {
1483
+ const { httpClient, sideEffects } = arguments[2];
1484
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
1485
+ mimeType,
1486
+ fileName: options?.fileName,
1487
+ parentFolderId: options?.parentFolderId,
1488
+ private: options?.private
1489
+ });
1490
+ const reqOpts = generateFileUploadUrl(payload);
1491
+ sideEffects?.onSiteCall?.();
1492
+ try {
1493
+ const result = await httpClient.request(reqOpts);
1494
+ sideEffects?.onSuccess?.(result);
1495
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
1496
+ } catch (err) {
1497
+ const transformedError = (0, import_transform_error.transformError)(
1498
+ err,
1499
+ {
1500
+ spreadPathsToArguments: {},
1501
+ explicitPathsToArguments: {
1502
+ mimeType: "$[0]",
1503
+ fileName: "$[1].fileName",
1504
+ parentFolderId: "$[1].parentFolderId",
1505
+ private: "$[1].private"
1506
+ },
1507
+ singleArgumentUnchanged: false
1508
+ },
1509
+ ["mimeType", "options"]
1510
+ );
1511
+ sideEffects?.onError?.(err);
1512
+ throw transformedError;
1513
+ }
1514
+ }
1460
1515
 
1461
1516
  // src/ricos-v1-document-ricos-documents.public.ts
1462
1517
  function validateDocument3(httpClient) {
@@ -1490,6 +1545,14 @@ function generateFileDownloadUrl3(httpClient) {
1490
1545
  { httpClient }
1491
1546
  );
1492
1547
  }
1548
+ function generateFileUploadUrl3(httpClient) {
1549
+ return (mimeType, options) => generateFileUploadUrl2(
1550
+ mimeType,
1551
+ options,
1552
+ // @ts-ignore
1553
+ { httpClient }
1554
+ );
1555
+ }
1493
1556
 
1494
1557
  // src/ricos-v1-document-ricos-documents.context.ts
1495
1558
  var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
@@ -1497,6 +1560,7 @@ var validateDocument4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModul
1497
1560
  var convertToRicosDocument4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(convertToRicosDocument3);
1498
1561
  var convertFromRicosDocument4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(convertFromRicosDocument3);
1499
1562
  var generateFileDownloadUrl4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(generateFileDownloadUrl3);
1563
+ var generateFileUploadUrl4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(generateFileUploadUrl3);
1500
1564
  // Annotate the CommonJS export names for ESM import in node:
1501
1565
  0 && (module.exports = {
1502
1566
  Alignment,
@@ -1568,6 +1632,7 @@ var generateFileDownloadUrl4 = /* @__PURE__ */ (0, import_rest_modules2.createRE
1568
1632
  convertFromRicosDocument,
1569
1633
  convertToRicosDocument,
1570
1634
  generateFileDownloadUrl,
1635
+ generateFileUploadUrl,
1571
1636
  validateDocument
1572
1637
  });
1573
1638
  //# sourceMappingURL=index.js.map