unlayer-types 1.5.46 → 1.5.48

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 (2) hide show
  1. package/embed.d.ts +198 -164
  2. package/package.json +1 -1
package/embed.d.ts CHANGED
@@ -305,6 +305,7 @@ declare module "state/types/index" {
305
305
  location: Location | null;
306
306
  parent: Location | null;
307
307
  threadId: CollaborationThread['id'] | null;
308
+ openedPanel?: 'images' | 'content' | 'uploads' | 'audit' | 'blocks';
308
309
  }
309
310
  export interface Placeholder {
310
311
  active: boolean;
@@ -677,14 +678,6 @@ declare module "editor/components/common/Loader" {
677
678
  }
678
679
  export function Loader(props: LoaderProps): JSX.Element;
679
680
  }
680
- declare module "editor/hooks/useDynamicRef" {
681
- export function useDynamicRef<T>(value: T): import("react").MutableRefObject<T>;
682
- }
683
- declare module "state/types/RootState" {
684
- import { StateType } from 'typesafe-actions';
685
- import reducer from '../reducer';
686
- export type RootState = StateType<typeof reducer>;
687
- }
688
681
  declare module "engine/config/env" {
689
682
  export const env: {
690
683
  API_V1_BASE_URL: string;
@@ -725,6 +718,172 @@ declare module "editor/helpers/image" {
725
718
  }>;
726
719
  export function imageHasTransparency(imageSrcOrBlob: string | Blob): Promise<boolean | null>;
727
720
  }
721
+ declare module "engine/utils/withHook" {
722
+ import React from 'react';
723
+ export function withHook<P extends object, C extends React.ComponentType<P>, HookName extends string, HookFn extends (props: P) => any>(Component: C, hookName: HookName, useHook: HookFn): React.MemoExoticComponent<React.ForwardRefExoticComponent<React.PropsWithoutRef<P & Record<HookName, ReturnType<HookFn>>> & React.RefAttributes<unknown>>>;
724
+ }
725
+ declare module "editor/hooks/useForceRerender" {
726
+ export function useForceRerender({ debounce, throttle, }?: {
727
+ debounce?: boolean | number;
728
+ throttle?: boolean | number;
729
+ }): () => void;
730
+ }
731
+ declare module "editor/hooks/useConfig" {
732
+ import React from 'react';
733
+ export function useConfig(): any;
734
+ export function withConfig<C extends React.ComponentType>(Component: C): React.MemoExoticComponent<React.ForwardRefExoticComponent<object & Record<"config", any> & React.RefAttributes<unknown>>>;
735
+ }
736
+ declare module "engine/utils/position" {
737
+ import { DisplayMode } from '../../state/types';
738
+ export const ENABLE_BACKGROUND_POSITION_FOR_EMAILS = true;
739
+ export type Position = 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
740
+ export function positionToMarginArray(position: Position | undefined): string[] | readonly [0, "auto", "auto", 0] | readonly [0, "auto", "auto", "auto"] | readonly [0, 0, "auto", "auto"] | readonly ["auto", "auto", "auto", 0] | readonly ["auto"] | readonly ["auto", 0, "auto", "auto"] | readonly ["auto", "auto", 0, 0] | readonly ["auto", "auto", 0, "auto"] | readonly ["auto", 0, 0, "auto"];
741
+ export function positionToBackgroundPosition(position: Position | undefined): 'top left' | 'top center' | 'top right' | 'center left' | 'center center' | 'center right' | 'bottom left' | 'bottom center' | 'bottom right' | 'auto auto';
742
+ export function valuesToBackgroundPositionCSS(values: {
743
+ position: Position | 'custom' | undefined;
744
+ customPosition: [string, string] | undefined;
745
+ }, { displayMode }: {
746
+ displayMode: DisplayMode;
747
+ }): string;
748
+ export function positionToPercentages(position: Position | 'custom' | undefined): [x: string, y: string] | undefined;
749
+ export function normalizePosition(position: 'top' | 'top-left' | 'top-center' | 'top-right' | 'center' | 'center-left' | 'center-center' | 'center-right' | 'center-top' | 'center-bottom' | 'bottom' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'left' | 'left-top' | 'left-center' | 'left-bottom' | 'right' | 'right-top' | 'right-center' | 'right-bottom' | 'custom' | undefined): Position | undefined;
750
+ }
751
+ declare module "editor/components/editors/PositionEditor" {
752
+ import { EditorProps } from "editor/components/editors/types";
753
+ import { Position } from "engine/utils/position";
754
+ export type PositionEditorValue = Position | 'custom';
755
+ export type PositionEditorProps = EditorProps<PositionEditorValue, {
756
+ positions?: Position[];
757
+ }>;
758
+ export function PositionEditor(props: PositionEditorProps): JSX.Element;
759
+ export function PositionEditorBase(props: Pick<PositionEditorProps, 'updateValue' | 'value' | 'widgetParams'> & {
760
+ className?: string;
761
+ itemSize?: number;
762
+ spacing?: number;
763
+ valueLabelPosition?: 'left' | 'right' | 'none';
764
+ }): JSX.Element;
765
+ }
766
+ declare module "editor/hooks/useDynamicRef" {
767
+ export function useDynamicRef<T>(value: T): import("react").MutableRefObject<T>;
768
+ }
769
+ declare module "editor/components/editors/common/Counter" {
770
+ import React from 'react';
771
+ export interface CounterProps {
772
+ absoluteBaseValue?: number;
773
+ buttonSize?: 'lg' | 'md' | 'sm' | undefined;
774
+ children?: React.ReactNode;
775
+ defaultUnit?: string;
776
+ disabled?: boolean;
777
+ maxValue?: number | null;
778
+ minValue?: number | null;
779
+ onChange: (value: number | string) => void;
780
+ shouldRenderIncrementDecrementButtons?: boolean;
781
+ step?: number;
782
+ unitSupportedDisplayModes?: string[];
783
+ units?: string[];
784
+ value: number | string;
785
+ }
786
+ export default function Counter(props: CounterProps): JSX.Element;
787
+ }
788
+ declare module "engine/utils/sizeUtils" {
789
+ import { DisplayMode } from '../../state/types';
790
+ export const ENABLE_BACKGROUND_SIZE_FOR_EMAILS = false;
791
+ export function normalizeFloat(n: number | string | undefined, decimalsPlace?: number): number;
792
+ export function normalizeSize(size: number | string | undefined, { decimalsPlace }?: {
793
+ decimalsPlace?: number;
794
+ }): string;
795
+ export function calculateExactSize(size: number | string, maxSize: number | undefined, options?: {
796
+ decimalsPlace?: number;
797
+ ifNumberConsiderAsPercentage?: boolean;
798
+ }): number | undefined;
799
+ export function valuesToBackgroundSizeCSS(values: {
800
+ size: 'contain' | 'cover' | 'custom' | undefined;
801
+ customSize: [string, string];
802
+ }, { displayMode }: {
803
+ displayMode: DisplayMode;
804
+ }): string;
805
+ }
806
+ declare module "engine/config/mergeTags" {
807
+ import { MergeTags } from '../../state/types';
808
+ export function getMergeTags(): MergeTags;
809
+ export function getMergeTagsVersion(): number;
810
+ export function setMergeTags(_mergeTags: MergeTags): void;
811
+ }
812
+ declare module "engine/utils/htmlEntities" {
813
+ export function encodeHtmlEntities(str: string | undefined, { modes }?: {
814
+ modes?: Array<keyof typeof replacers>;
815
+ }): string;
816
+ const replacers: {
817
+ accents: (str: string | undefined) => string;
818
+ all: (str: string | undefined) => string;
819
+ others: (str: string | undefined) => string;
820
+ tags: (str: string | undefined) => string;
821
+ };
822
+ }
823
+ declare module "engine/utils/encodeMergeTag" {
824
+ export function encodeMergeTag(str: string | undefined): string;
825
+ }
826
+ declare module "engine/utils/escapeHtml" {
827
+ export function escapeHtml(str: string | undefined, { escapeAndOperator, // This was causing issues by changing & in links to &amp;
828
+ escapeLT, escapeGT, escapeDoubleQuotes, escapeSingleQuotes, }?: {
829
+ escapeAndOperator?: boolean;
830
+ escapeLT?: boolean;
831
+ escapeGT?: boolean;
832
+ escapeDoubleQuotes?: boolean;
833
+ escapeSingleQuotes?: boolean;
834
+ }): string;
835
+ }
836
+ declare module "engine/utils/escapeRegexString" {
837
+ export function escapeRegexString(str: string): string;
838
+ }
839
+ declare module "engine/utils/getNumberOrString" {
840
+ export function getNumberOrString(str: string | number): string | number;
841
+ }
842
+ declare module "engine/utils/flattenMergeTags" {
843
+ import { MergeTag, MergeTags, MergeTagsConfig } from '../../state/types';
844
+ export type MergeTagWithMeta = MergeTag & {
845
+ _meta: {
846
+ key: string;
847
+ tree: Array<Omit<MergeTag, 'mergeTags'> & {
848
+ _meta?: Omit<MergeTagWithMeta['_meta'], 'tree'>;
849
+ }>;
850
+ };
851
+ };
852
+ function _flattenMergeTags(mergeTags: Array<MergeTag | MergeTagWithMeta> | MergeTags, mergeTagsConfig?: Pick<MergeTagsConfig, 'sort'>, _internal?: Pick<MergeTagWithMeta['_meta'], 'tree'>): Array<MergeTagWithMeta>;
853
+ export const flattenMergeTags: typeof _flattenMergeTags & import("lodash").MemoizedFunction;
854
+ export function getMergeTagLabel(mergeTag: MergeTagWithMeta['_meta']['tree'][0] | undefined): string;
855
+ export function getMergeTagFlatLabel(mergeTag: MergeTagWithMeta | undefined): string;
856
+ }
857
+ declare module "engine/utils/testBrowserFeatures" {
858
+ export function supportsRegexLookAheadLookBehind(): boolean;
859
+ export function replaceWithLookBehind(str: string, lookbBehindStr: string, regex: RegExp, replacement: string): string;
860
+ }
861
+ declare module "engine/utils/applyMergeTagsToHtml" {
862
+ import { MergeTags, MergeTagsValues } from '../../state/types';
863
+ export function applyMergeTagsToHtml(html: string | undefined, { mergeTagsSchema, mergeTagsValues: _mergeTagsValues, _skipTags, _useRawValue, }: {
864
+ mergeTagsSchema: MergeTags | undefined;
865
+ mergeTagsValues: MergeTagsValues | undefined;
866
+ _skipTags?: boolean;
867
+ _useRawValue?: boolean;
868
+ }): string;
869
+ }
870
+ declare module "engine/utils/generateMergeTagHtml" {
871
+ import { Icon, MergeTag } from '../../state/types';
872
+ export function generateMergeTagHtml(mergeTag: Pick<MergeTag, 'name' | 'value' | 'sample'> & {
873
+ icon?: Icon | string;
874
+ }): string;
875
+ }
876
+ declare module "engine/utils/applyMergeTagPreviewHtmlToText" {
877
+ function _applyMergeTagPreviewHtmlToText(text: string | undefined, { type }?: {
878
+ type?: 'smart' | 'raw';
879
+ }): string;
880
+ export const applyMergeTagPreviewHtmlToText: typeof _applyMergeTagPreviewHtmlToText & import("lodash").MemoizedFunction;
881
+ }
882
+ declare module "state/types/RootState" {
883
+ import { StateType } from 'typesafe-actions';
884
+ import reducer from '../reducer';
885
+ export type RootState = StateType<typeof reducer>;
886
+ }
728
887
  declare module "editor/hooks/useImageUploader" {
729
888
  import { useStore } from 'react-redux';
730
889
  import { ImageSource } from '../../state/types';
@@ -795,21 +954,6 @@ declare module "editor/hooks/useImageUploader" {
795
954
  }, message?: string, ...params: any[]);
796
955
  }
797
956
  }
798
- declare module "engine/utils/withHook" {
799
- import React from 'react';
800
- export function withHook<P extends object, C extends React.ComponentType<P>, HookName extends string, HookFn extends (props: P) => any>(Component: C, hookName: HookName, useHook: HookFn): React.MemoExoticComponent<React.ForwardRefExoticComponent<React.PropsWithoutRef<P & Record<HookName, ReturnType<HookFn>>> & React.RefAttributes<unknown>>>;
801
- }
802
- declare module "editor/hooks/useForceRerender" {
803
- export function useForceRerender({ debounce, throttle, }?: {
804
- debounce?: boolean | number;
805
- throttle?: boolean | number;
806
- }): () => void;
807
- }
808
- declare module "editor/hooks/useConfig" {
809
- import React from 'react';
810
- export function useConfig(): any;
811
- export function withConfig<C extends React.ComponentType>(Component: C): React.MemoExoticComponent<React.ForwardRefExoticComponent<object & Record<"config", any> & React.RefAttributes<unknown>>>;
812
- }
813
957
  declare module "editor/components/common/ImageUploadButton" {
814
958
  import React from 'react';
815
959
  import { ButtonProps } from 'reactstrap';
@@ -845,82 +989,6 @@ declare module "editor/components/common/ImageUploadButton" {
845
989
  declare module "engine/tools/content/image" {
846
990
  export const DEFAULT_IMAGE_PLACEHOLDER = "https://cdn.tools.unlayer.com/image/placeholder.png";
847
991
  }
848
- declare module "engine/config/mergeTags" {
849
- import { MergeTags } from '../../state/types';
850
- export function getMergeTags(): MergeTags;
851
- export function getMergeTagsVersion(): number;
852
- export function setMergeTags(_mergeTags: MergeTags): void;
853
- }
854
- declare module "engine/utils/htmlEntities" {
855
- export function encodeHtmlEntities(str: string | undefined, { modes }?: {
856
- modes?: Array<keyof typeof replacers>;
857
- }): string;
858
- const replacers: {
859
- accents: (str: string | undefined) => string;
860
- all: (str: string | undefined) => string;
861
- others: (str: string | undefined) => string;
862
- tags: (str: string | undefined) => string;
863
- };
864
- }
865
- declare module "engine/utils/encodeMergeTag" {
866
- export function encodeMergeTag(str: string | undefined): string;
867
- }
868
- declare module "engine/utils/escapeHtml" {
869
- export function escapeHtml(str: string | undefined, { escapeAndOperator, // This was causing issues by changing & in links to &amp;
870
- escapeLT, escapeGT, escapeDoubleQuotes, escapeSingleQuotes, }?: {
871
- escapeAndOperator?: boolean;
872
- escapeLT?: boolean;
873
- escapeGT?: boolean;
874
- escapeDoubleQuotes?: boolean;
875
- escapeSingleQuotes?: boolean;
876
- }): string;
877
- }
878
- declare module "engine/utils/escapeRegexString" {
879
- export function escapeRegexString(str: string): string;
880
- }
881
- declare module "engine/utils/getNumberOrString" {
882
- export function getNumberOrString(str: string | number): string | number;
883
- }
884
- declare module "engine/utils/flattenMergeTags" {
885
- import { MergeTag, MergeTags, MergeTagsConfig } from '../../state/types';
886
- export type MergeTagWithMeta = MergeTag & {
887
- _meta: {
888
- key: string;
889
- tree: Array<Omit<MergeTag, 'mergeTags'> & {
890
- _meta?: Omit<MergeTagWithMeta['_meta'], 'tree'>;
891
- }>;
892
- };
893
- };
894
- function _flattenMergeTags(mergeTags: Array<MergeTag | MergeTagWithMeta> | MergeTags, mergeTagsConfig?: Pick<MergeTagsConfig, 'sort'>, _internal?: Pick<MergeTagWithMeta['_meta'], 'tree'>): Array<MergeTagWithMeta>;
895
- export const flattenMergeTags: typeof _flattenMergeTags & import("lodash").MemoizedFunction;
896
- export function getMergeTagLabel(mergeTag: MergeTagWithMeta['_meta']['tree'][0] | undefined): string;
897
- export function getMergeTagFlatLabel(mergeTag: MergeTagWithMeta | undefined): string;
898
- }
899
- declare module "engine/utils/testBrowserFeatures" {
900
- export function supportsRegexLookAheadLookBehind(): boolean;
901
- export function replaceWithLookBehind(str: string, lookbBehindStr: string, regex: RegExp, replacement: string): string;
902
- }
903
- declare module "engine/utils/applyMergeTagsToHtml" {
904
- import { MergeTags, MergeTagsValues } from '../../state/types';
905
- export function applyMergeTagsToHtml(html: string | undefined, { mergeTagsSchema, mergeTagsValues: _mergeTagsValues, _skipTags, _useRawValue, }: {
906
- mergeTagsSchema: MergeTags | undefined;
907
- mergeTagsValues: MergeTagsValues | undefined;
908
- _skipTags?: boolean;
909
- _useRawValue?: boolean;
910
- }): string;
911
- }
912
- declare module "engine/utils/generateMergeTagHtml" {
913
- import { Icon, MergeTag } from '../../state/types';
914
- export function generateMergeTagHtml(mergeTag: Pick<MergeTag, 'name' | 'value' | 'sample'> & {
915
- icon?: Icon | string;
916
- }): string;
917
- }
918
- declare module "engine/utils/applyMergeTagPreviewHtmlToText" {
919
- function _applyMergeTagPreviewHtmlToText(text: string | undefined, { type }?: {
920
- type?: 'smart' | 'raw';
921
- }): string;
922
- export const applyMergeTagPreviewHtmlToText: typeof _applyMergeTagPreviewHtmlToText & import("lodash").MemoizedFunction;
923
- }
924
992
  declare module "editor/components/common/Dropzone" {
925
993
  import React from 'react';
926
994
  import { DropzoneOptions } from 'react-dropzone';
@@ -953,72 +1021,38 @@ declare module "editor/components/common/ImageUploadErrorMessage" {
953
1021
  }): any;
954
1022
  export function ImageUploadErrorMessage(props: ImageUploadErrorMessageProps): JSX.Element;
955
1023
  }
956
- declare module "engine/utils/position" {
957
- import { DisplayMode } from '../../state/types';
958
- export const ENABLE_BACKGROUND_POSITION_FOR_EMAILS = true;
959
- export type Position = 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
960
- export function positionToMarginArray(position: Position | undefined): string[] | readonly [0, "auto", "auto", 0] | readonly [0, "auto", "auto", "auto"] | readonly [0, 0, "auto", "auto"] | readonly ["auto", "auto", "auto", 0] | readonly ["auto"] | readonly ["auto", 0, "auto", "auto"] | readonly ["auto", "auto", 0, 0] | readonly ["auto", "auto", 0, "auto"] | readonly ["auto", 0, 0, "auto"];
961
- export function positionToBackgroundPosition(position: Position | undefined): 'top left' | 'top center' | 'top right' | 'center left' | 'center center' | 'center right' | 'bottom left' | 'bottom center' | 'bottom right' | 'auto auto';
962
- export function valuesToBackgroundPositionCSS(values: {
963
- position: Position | 'custom' | undefined;
964
- customPosition: [string, string] | undefined;
965
- }, { displayMode }: {
966
- displayMode: DisplayMode;
967
- }): string;
968
- export function positionToPercentages(position: Position | 'custom' | undefined): [x: string, y: string] | undefined;
969
- export function normalizePosition(position: 'top' | 'top-left' | 'top-center' | 'top-right' | 'center' | 'center-left' | 'center-center' | 'center-right' | 'center-top' | 'center-bottom' | 'bottom' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'left' | 'left-top' | 'left-center' | 'left-bottom' | 'right' | 'right-top' | 'right-center' | 'right-bottom' | 'custom' | undefined): Position | undefined;
970
- }
971
- declare module "editor/components/editors/PositionEditor" {
972
- import { EditorProps } from "editor/components/editors/types";
973
- import { Position } from "engine/utils/position";
974
- export type PositionEditorValue = Position | 'custom';
975
- export type PositionEditorProps = EditorProps<PositionEditorValue, {
976
- positions?: Position[];
977
- }>;
978
- export function PositionEditor(props: PositionEditorProps): JSX.Element;
979
- export function PositionEditorBase(props: Pick<PositionEditorProps, 'updateValue' | 'value' | 'widgetParams'> & {
980
- className?: string;
981
- itemSize?: number;
982
- spacing?: number;
983
- valueLabelPosition?: 'left' | 'right' | 'none';
984
- }): JSX.Element;
985
- }
986
- declare module "editor/components/editors/common/Counter" {
987
- import React from 'react';
988
- export interface CounterProps {
989
- absoluteBaseValue?: number;
990
- buttonSize?: 'lg' | 'md' | 'sm' | undefined;
991
- children?: React.ReactNode;
992
- defaultUnit?: string;
993
- disabled?: boolean;
994
- maxValue?: number | null;
995
- minValue?: number | null;
996
- onChange: (value: number | string) => void;
997
- shouldRenderIncrementDecrementButtons?: boolean;
998
- step?: number;
999
- unitSupportedDisplayModes?: string[];
1000
- units?: string[];
1001
- value: number | string;
1024
+ declare module "editor/components/editors/ImageUploader" {
1025
+ import { RefObject } from 'react';
1026
+ import { ImageUploadButtonInstance } from "editor/components/common/ImageUploadButton";
1027
+ import { DropEvent, FileRejection } from 'react-dropzone';
1028
+ interface ImageUploaderProps {
1029
+ shouldRender: {
1030
+ uploadButton?: boolean;
1031
+ dropzone?: boolean;
1032
+ effects?: boolean;
1033
+ };
1034
+ label: string;
1035
+ maxSize: number;
1036
+ updateImage: (image: any) => void;
1037
+ showImagesDropdown?: boolean;
1038
+ showUploadsDropdown?: boolean;
1039
+ intl: any;
1040
+ onDropAccepted: (files: File[]) => void;
1041
+ onDropRejected: (fileRejections: FileRejection[], event: DropEvent) => void;
1042
+ isUploading?: boolean;
1043
+ uploadProgress?: number;
1044
+ postprocessedImageUrl?: string;
1045
+ togglePixieModal: () => void;
1046
+ imageExists?: boolean;
1047
+ error: boolean | Error | null;
1048
+ onImageSelect: (image: any) => void;
1049
+ onImageUpload: (image: any) => void;
1050
+ onUploadProgressChange: (image: any) => void;
1051
+ onUploadStatusChange: (image: any) => void;
1052
+ onErrorChange: (error: Error | null) => void;
1053
+ imageUploadButtonRef: RefObject<ImageUploadButtonInstance>;
1002
1054
  }
1003
- export default function Counter(props: CounterProps): JSX.Element;
1004
- }
1005
- declare module "engine/utils/sizeUtils" {
1006
- import { DisplayMode } from '../../state/types';
1007
- export const ENABLE_BACKGROUND_SIZE_FOR_EMAILS = false;
1008
- export function normalizeFloat(n: number | string | undefined, decimalsPlace?: number): number;
1009
- export function normalizeSize(size: number | string | undefined, { decimalsPlace }?: {
1010
- decimalsPlace?: number;
1011
- }): string;
1012
- export function calculateExactSize(size: number | string, maxSize: number | undefined, options?: {
1013
- decimalsPlace?: number;
1014
- ifNumberConsiderAsPercentage?: boolean;
1015
- }): number | undefined;
1016
- export function valuesToBackgroundSizeCSS(values: {
1017
- size: 'contain' | 'cover' | 'custom' | undefined;
1018
- customSize: [string, string];
1019
- }, { displayMode }: {
1020
- displayMode: DisplayMode;
1021
- }): string;
1055
+ export const ImageUploader: ({ shouldRender, label, maxSize, updateImage, showImagesDropdown, showUploadsDropdown, intl, onDropAccepted, onDropRejected, isUploading, uploadProgress, postprocessedImageUrl, togglePixieModal, imageExists, error, onImageSelect, onImageUpload, onUploadProgressChange, onUploadStatusChange, onErrorChange, imageUploadButtonRef, ...restProps }: ImageUploaderProps) => JSX.Element;
1022
1056
  }
1023
1057
  declare module "editor/components/editors/pixie/pixie.umd" {
1024
1058
  const _exports: {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "unlayer-types",
3
- "version": "1.5.46",
3
+ "version": "1.5.48",
4
4
  "license": "MIT"
5
5
  }