unlayer-types 1.5.12

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 +1465 -0
  2. package/package.json +4 -0
package/embed.d.ts ADDED
@@ -0,0 +1,1465 @@
1
+ /// <reference types="react" />
2
+ /// <reference types="react-modal" />
3
+ /// <reference types="lodash" />
4
+ declare module "engine/config/offline" {
5
+ export function enableOffline(): void;
6
+ export function isOffline(): boolean;
7
+ }
8
+ declare module "engine/config/callbacks" {
9
+ import { Handler } from 'mitt';
10
+ export type CallbackData = any;
11
+ export type CallbackDoneFn = (result: any) => void;
12
+ export type CallbackFn = (data?: CallbackData, done?: CallbackDoneFn) => void;
13
+ export type CallbackMap = {
14
+ [name: string]: CallbackFn | undefined;
15
+ };
16
+ export function getCallback(type: string): CallbackFn;
17
+ export function hasCallback(type: string): boolean;
18
+ export function registerCallback(type: string, callback: CallbackFn | null | undefined): void;
19
+ export function unregisterCallback(type: string): void;
20
+ export function triggerCallback(type: string, ...args: [...any[], CallbackDoneFn]): void;
21
+ export function onRegisterCallback(handler: Handler<{
22
+ type: string;
23
+ callback: CallbackFn;
24
+ }>): {
25
+ remove: () => void;
26
+ };
27
+ export function onTriggerCallback(handler: Handler<{
28
+ type: string;
29
+ callback: CallbackFn;
30
+ }>): {
31
+ remove: () => void;
32
+ };
33
+ export function onUnregisterCallback(handler: Handler<{
34
+ type: string;
35
+ }>): {
36
+ remove: () => void;
37
+ };
38
+ }
39
+ declare module "engine/config/fonts" {
40
+ export interface Font {
41
+ defaultFont?: boolean;
42
+ type?: 'google' | string;
43
+ label: string;
44
+ value: string;
45
+ url?: string;
46
+ weights: number[];
47
+ }
48
+ export type FontList = Font[];
49
+ export interface FontConfig {
50
+ showDefaultFonts?: boolean;
51
+ customFonts?: FontList;
52
+ }
53
+ export interface FontOptions {
54
+ showCustomFonts?: boolean;
55
+ showGlobalFont?: boolean;
56
+ }
57
+ export function loadFontConfig(newFontConfig?: FontConfig): void;
58
+ export function disableBuiltinFonts(): void;
59
+ export function setFonts(newFonts?: FontList): void;
60
+ export function getFonts(options?: FontOptions): FontList;
61
+ export function getCustomFontsCount(): number;
62
+ export const defaultFontWeights: number[];
63
+ }
64
+ declare module "engine/config/intl" {
65
+ import stockTranslations from '../translations';
66
+ export type Locale = keyof typeof stockTranslations | 'en-US';
67
+ export type TextDirection = 'ltr' | 'rtl';
68
+ export const DEFAULT_LOCALE = "en-US";
69
+ export const RTL_COUNTRIES: string[];
70
+ export function getLocale(): Locale;
71
+ export function setLocale(locale: Locale | null): void;
72
+ export function getTextDirection(): TextDirection | undefined;
73
+ export function getTextDirectionForLocale(locale: Locale): TextDirection | undefined;
74
+ export function setTextDirection(textDirection: TextDirection | null): void;
75
+ export function isRTL(locale: Locale): boolean;
76
+ }
77
+ declare module "editor/components/editors/types" {
78
+ import { IconDefinition } from '@fortawesome/pro-regular-svg-icons';
79
+ import { AppearanceConfig, Device, DisplayMode, Location, Variant } from '../../../state/types';
80
+ export type LoadingState = 'not-loaded' | 'loading' | 'loaded';
81
+ export type UpdatingState = 'updating' | undefined;
82
+ export type DeletionState = 'deleting' | 'failed' | undefined;
83
+ export interface EditorProps<Value, WidgetParams = object> {
84
+ value: Value | undefined;
85
+ defaultValue: Value | undefined;
86
+ updateValue: (newValue: Value | undefined, data?: object, options?: {
87
+ deviceOverride?: Device;
88
+ skipFromUndoRedo?: boolean;
89
+ }) => void;
90
+ name: string;
91
+ data?: object;
92
+ widgetParams?: WidgetParams;
93
+ displayMode: DisplayMode;
94
+ label?: string;
95
+ location: Location;
96
+ values: {
97
+ [key: string]: unknown;
98
+ containerPadding?: string;
99
+ };
100
+ rootValues: {
101
+ [key: string]: any;
102
+ _override?: {
103
+ [key: string]: any;
104
+ };
105
+ };
106
+ appearance: AppearanceConfig;
107
+ entitlements: {
108
+ audit?: boolean;
109
+ allowedDomains?: number;
110
+ branding?: boolean;
111
+ collaboration?: boolean;
112
+ displayConditions?: boolean;
113
+ customBlocks?: number;
114
+ customCSS?: boolean;
115
+ customFonts?: boolean;
116
+ customJS?: boolean;
117
+ customTools?: number;
118
+ customTabs?: number;
119
+ imageEditor?: boolean;
120
+ userUploads?: boolean;
121
+ stockImages?: boolean;
122
+ uploadMaxSize?: number;
123
+ };
124
+ item: object;
125
+ project: object;
126
+ onImageClick?: (url: string) => void;
127
+ }
128
+ export type HeadArguments = [
129
+ Record<string, any>,
130
+ Record<string, any>,
131
+ {
132
+ displayMode: DisplayMode;
133
+ embeddedValues: Record<string, any>;
134
+ isViewer: boolean;
135
+ variant: Variant;
136
+ }
137
+ ];
138
+ export interface Head {
139
+ css?: (...args: HeadArguments) => string | void;
140
+ js?: (...args: HeadArguments) => string | void;
141
+ tags?: (...args: HeadArguments) => string[] | void;
142
+ }
143
+ export type CollaborationFilter = 'only_yours' | 'resolved';
144
+ export interface CollaborationFilterDetails {
145
+ label?: string;
146
+ }
147
+ export type CollaborationType = 'feedback' | 'idea' | 'question' | 'urgent';
148
+ export interface CollaborationTypeDetails {
149
+ label?: string;
150
+ icon: IconDefinition;
151
+ color: string | undefined;
152
+ }
153
+ export type CollaborationThreadStatus = 'open' | 'resolved';
154
+ export interface CollaborationThread {
155
+ id: number;
156
+ projectId: string | number;
157
+ designId: string;
158
+ user: CollaborationUser;
159
+ itemId: string;
160
+ type: CollaborationType;
161
+ status: CollaborationThreadStatus | null | undefined;
162
+ commentCount: number;
163
+ firstComment: CollaborationThreadComment;
164
+ createdAt: string;
165
+ updatedAt: string;
166
+ }
167
+ export interface CollaborationThreadComment {
168
+ id: number;
169
+ threadId: CollaborationThread['id'];
170
+ user: CollaborationUser;
171
+ text: string;
172
+ createdAt: string;
173
+ updatedAt: string;
174
+ }
175
+ export interface CollaborationUser {
176
+ id: string;
177
+ name: string | undefined;
178
+ avatar: string | undefined;
179
+ }
180
+ export type DeepPartial<T> = T extends object ? {
181
+ [P in keyof T]?: DeepPartial<T[P]>;
182
+ } : T;
183
+ }
184
+ declare module "state/types/index" {
185
+ import { InputType } from 'reactstrap/lib/Input';
186
+ import { CollaborationThread } from "editor/components/editors/types";
187
+ export type DesignMode = 'live' | 'edit';
188
+ export type DisplayMode = 'web' | 'email' | 'popup';
189
+ export type Variant = 'amp' | null;
190
+ export type Device = 'desktop' | 'mobile' | 'tablet';
191
+ export type Theme = 'light' | 'dark';
192
+ export interface MergeTag {
193
+ name: string;
194
+ value?: string;
195
+ sample?: string;
196
+ icon?: string;
197
+ mergeTags?: MergeTags;
198
+ rules?: {
199
+ [key: string]: {
200
+ name: string;
201
+ before: string;
202
+ after: string;
203
+ sample?: boolean | Array<Record<string, string>>;
204
+ };
205
+ };
206
+ }
207
+ export interface MergeTags {
208
+ [name: string]: MergeTag;
209
+ }
210
+ export type MergeTagsValues = Record<string, string | number | Record<string, boolean | Array<Record<string, string | number>>>>;
211
+ export interface MergeTagsConfig {
212
+ autocompleteTriggerChar?: string;
213
+ sort?: boolean;
214
+ }
215
+ export interface DisplayCondition {
216
+ type: string;
217
+ label: string;
218
+ description: string;
219
+ before?: string;
220
+ after?: string;
221
+ }
222
+ export type DisplayConditions = DisplayCondition[];
223
+ export type SpecialLink = {
224
+ name: string;
225
+ href: string;
226
+ target?: string;
227
+ specialLinks?: undefined;
228
+ } | {
229
+ name: string;
230
+ href?: undefined;
231
+ target?: undefined;
232
+ specialLinks: SpecialLinks;
233
+ };
234
+ export interface SpecialLinks {
235
+ [name: string]: SpecialLink;
236
+ }
237
+ export type LinkTypeFieldOption = {
238
+ value: string;
239
+ label: string;
240
+ enabled?: boolean;
241
+ };
242
+ export interface LinkTypeField {
243
+ name: string;
244
+ label: string;
245
+ defaultValue?: string | LinkTypeFieldOption[] | undefined;
246
+ enabled?: boolean;
247
+ placeholderText?: string;
248
+ inputType?: InputType;
249
+ isClearable?: boolean;
250
+ isCreatable?: boolean;
251
+ isMulti?: boolean;
252
+ limit?: number;
253
+ limitMessage?: string;
254
+ validationRegex?: string;
255
+ options?: LinkTypeFieldOption[];
256
+ onCreateOption?: (inputValue: string, meta: object, done: (newOption: LinkTypeFieldOption) => void) => void;
257
+ }
258
+ export interface LinkType {
259
+ name: string;
260
+ label: string;
261
+ enabled?: boolean;
262
+ attrs?: {
263
+ href?: string;
264
+ target?: string;
265
+ onClick?: string | Function;
266
+ class?: string;
267
+ [key: string]: any;
268
+ };
269
+ fields?: LinkTypeField[];
270
+ }
271
+ export type LinkTypes = LinkType[];
272
+ export type LinkTypesSharedConfig = Pick<LinkType, 'attrs' | 'fields'>;
273
+ export interface CustomFont {
274
+ label: string;
275
+ value: string;
276
+ url: string;
277
+ weights?: number[];
278
+ }
279
+ export interface CustomFonts {
280
+ [label: string]: CustomFont;
281
+ }
282
+ export type DesignTag = string;
283
+ export interface DesignTags {
284
+ [name: string]: DesignTag;
285
+ }
286
+ export interface DesignTagsConfig {
287
+ delimiter: [string, string];
288
+ }
289
+ export type CustomCSS = string | string[] | undefined | null;
290
+ export type CustomJS = string | string[] | undefined | null;
291
+ export interface Translations {
292
+ [name: string]: object;
293
+ }
294
+ export type Collection = 'bodies' | 'columns' | 'contents' | 'pages' | 'rows';
295
+ export type Container = 'body' | 'row' | 'column' | 'content';
296
+ export interface Location {
297
+ collection: Collection;
298
+ id: number | string;
299
+ }
300
+ export interface Selection {
301
+ active: boolean;
302
+ location: Location | null;
303
+ parent: Location | null;
304
+ threadId: CollaborationThread['id'] | null;
305
+ }
306
+ export interface Placeholder {
307
+ active: boolean;
308
+ layerGroup: Location | null;
309
+ index: number | null;
310
+ }
311
+ export interface Tool {
312
+ active: boolean;
313
+ type: string | null;
314
+ slug: string | null;
315
+ }
316
+ export interface Usage {
317
+ displayMode?: DisplayMode;
318
+ designMode?: DesignMode;
319
+ customTools?: number;
320
+ customTabs?: number;
321
+ customBlocks?: number;
322
+ customFonts?: number;
323
+ linkTypes?: number;
324
+ mergeTags?: number;
325
+ specialLinks?: number;
326
+ displayConditions?: number;
327
+ designTags?: number;
328
+ customCSS?: boolean;
329
+ customJS?: boolean;
330
+ fileStorage?: boolean;
331
+ }
332
+ export type ImageSource = 'unsplash' | 'pixabay' | 'pexel' | 'user';
333
+ export interface Image {
334
+ id: number;
335
+ location: string;
336
+ contentType: string;
337
+ size: number;
338
+ width: number | null;
339
+ height: number | null;
340
+ source: ImageSource | null;
341
+ optimistic?: boolean;
342
+ }
343
+ export type ArrayItem<T> = T extends (infer I)[] ? I : T extends readonly (infer I)[] ? I : unknown;
344
+ export type JSONTemplate = {
345
+ counters: Record<string, number>;
346
+ body: {
347
+ id: string | undefined;
348
+ rows: Array<{
349
+ id: string;
350
+ cells: number[];
351
+ columns: Array<{
352
+ id: string;
353
+ contents: Array<{}>;
354
+ values: {};
355
+ }>;
356
+ values: {};
357
+ }>;
358
+ values: {};
359
+ };
360
+ schemaVersion?: number;
361
+ };
362
+ export type Fonts = {
363
+ showDefaultFonts?: boolean;
364
+ customFonts?: CustomFont[];
365
+ };
366
+ export type Icon = {
367
+ name?: string;
368
+ data?: string;
369
+ url?: string;
370
+ };
371
+ export type AuditTool = {
372
+ type: string;
373
+ name?: string;
374
+ };
375
+ export type Rule = {
376
+ id: string;
377
+ icon: string | undefined;
378
+ title: string;
379
+ description: string;
380
+ severity: 'ERROR' | 'WARNING';
381
+ };
382
+ export type Audit = {
383
+ location?: Location;
384
+ tool?: AuditTool;
385
+ } & Rule;
386
+ export type Validator = (info: {
387
+ [id: string]: unknown;
388
+ html?: string;
389
+ defaultErrors?: Audit[];
390
+ }) => Audit[];
391
+ export type AsyncValidator = (...args: Parameters<Validator>) => Promise<ReturnType<Validator>>;
392
+ type GroupedAuditError = {
393
+ location: Location;
394
+ tool?: AuditTool;
395
+ };
396
+ export type GroupedAudit = {
397
+ [id: string]: {
398
+ icon: string;
399
+ title: string;
400
+ description: string;
401
+ errors: GroupedAuditError[];
402
+ };
403
+ };
404
+ export type AuditApiResult = {
405
+ status: 'FAIL' | 'PASS';
406
+ errors: Audit[];
407
+ };
408
+ export type Tabs = {
409
+ [tabName: string]: {
410
+ enabled?: boolean;
411
+ type?: string;
412
+ position?: number;
413
+ icon?: string;
414
+ active?: boolean;
415
+ };
416
+ };
417
+ export type SocialIcon = {
418
+ name: string;
419
+ url: string;
420
+ imgUrl?: string;
421
+ };
422
+ export type SocialCustomIcon = {
423
+ name: string;
424
+ url: string;
425
+ icons: {
426
+ [key: string]: string;
427
+ }[];
428
+ };
429
+ export type AppearanceConfig = {
430
+ theme: Theme;
431
+ panels: {
432
+ tools: {
433
+ dock: 'left' | 'right';
434
+ collapsible: boolean;
435
+ tabs: {
436
+ body: {
437
+ visible: boolean;
438
+ };
439
+ };
440
+ };
441
+ };
442
+ features: {
443
+ preview: boolean;
444
+ };
445
+ };
446
+ export interface ToolConfig {
447
+ enabled?: boolean | undefined;
448
+ position?: number | undefined;
449
+ properties?: {
450
+ [key: string]: {
451
+ value: string;
452
+ };
453
+ } | {
454
+ [key: string]: string;
455
+ } | undefined;
456
+ }
457
+ export interface ToolsConfig {
458
+ [key: string]: ToolConfig;
459
+ }
460
+ export type User = {
461
+ id?: string | number;
462
+ name?: string | null | undefined;
463
+ avatar?: string | null | undefined;
464
+ email?: string;
465
+ signature?: string;
466
+ };
467
+ }
468
+ declare module "embed/Config" {
469
+ import { ValidationResult } from 'amphtml-validator';
470
+ import { FontList } from "engine/config/fonts";
471
+ import { TextDirection } from "engine/config/intl";
472
+ import { AppearanceConfig, Audit, Device, DisplayConditions, DisplayMode, Fonts, JSONTemplate, LinkTypes, LinkTypesSharedConfig, MergeTags, MergeTagsConfig, MergeTagsValues, SpecialLinks, Tabs, ToolsConfig, User } from "state/types/index";
473
+ export interface Config {
474
+ id?: string;
475
+ className?: string;
476
+ version?: string;
477
+ source?: {
478
+ name: string;
479
+ version: string;
480
+ };
481
+ offline?: boolean;
482
+ render?: boolean;
483
+ amp?: boolean;
484
+ defaultDevice?: Device;
485
+ devices?: Device[];
486
+ designId?: string;
487
+ designMode?: string;
488
+ displayMode?: DisplayMode;
489
+ env?: Record<'API_V1_BASE_URL' | 'API_V2_BASE_URL' | 'EVENTS_API_BASE_URL' | 'TOOLS_API_V1_BASE_URL' | 'TOOLS_CDN_BASE_URL', string | undefined>;
490
+ projectId?: number | null;
491
+ user?: User;
492
+ templateId?: number;
493
+ stockTemplateId?: string;
494
+ loadTimeout?: number;
495
+ safeHtml?: boolean | object;
496
+ safeHTML?: boolean | object;
497
+ options?: object;
498
+ tools?: ToolsConfig;
499
+ excludeTools?: string[];
500
+ blocks?: object[];
501
+ editor?: object;
502
+ fonts?: Fonts;
503
+ linkTypes?: LinkTypes;
504
+ linkTypesSharedConfig?: LinkTypesSharedConfig;
505
+ mergeTags?: MergeTags;
506
+ displayConditions?: DisplayConditions;
507
+ specialLinks?: SpecialLinks;
508
+ designTags?: object;
509
+ customCSS?: string | string[];
510
+ customJS?: string | string[];
511
+ locale?: string;
512
+ textDirection?: TextDirection;
513
+ translations?: object;
514
+ appearance?: AppearanceConfig;
515
+ features?: object;
516
+ designTagsConfig?: object;
517
+ mergeTagsConfig?: MergeTagsConfig;
518
+ validator?: (info: {
519
+ html: ExportHtmlResult;
520
+ design: JSONTemplate;
521
+ defaultErrors: Audit[];
522
+ }) => Audit[];
523
+ tabs?: Tabs;
524
+ }
525
+ export interface SaveDesignOptions {
526
+ }
527
+ export interface ExportHtmlOptions {
528
+ amp?: boolean;
529
+ cleanup?: boolean;
530
+ textDirection?: TextDirection;
531
+ isPreview?: boolean;
532
+ live?: boolean;
533
+ mergeTags?: MergeTagsValues;
534
+ minify?: boolean;
535
+ popupId?: string;
536
+ title?: string;
537
+ validateAmp?: boolean;
538
+ }
539
+ export interface ExportHtmlResult {
540
+ html: string;
541
+ amp: {
542
+ enabled: boolean;
543
+ format: 'AMP' | 'AMP4EMAIL';
544
+ html: string | undefined;
545
+ validation: ValidationResult;
546
+ };
547
+ chunks: ExportChunksResult;
548
+ design: JSONTemplate;
549
+ }
550
+ export interface ExportPlainTextOptions extends Omit<ExportHtmlOptions, 'cleanup' | 'minify'> {
551
+ ignorePreheader?: boolean;
552
+ }
553
+ export interface HtmlToPlainTextOptions {
554
+ ignoreLinks?: boolean;
555
+ ignoreImages?: boolean;
556
+ }
557
+ export interface ExportChunksResult {
558
+ css: string;
559
+ js: string;
560
+ tags: string[];
561
+ fonts: FontList;
562
+ body: any;
563
+ }
564
+ export interface ExportPlainTextOptions {
565
+ ignoreLinks?: boolean;
566
+ ignoreImages?: boolean;
567
+ ignorePreheader?: boolean;
568
+ mergeTags?: Record<string, string>;
569
+ }
570
+ export interface ExportLiveHtmlOptions extends Omit<ExportHtmlOptions, 'live'> {
571
+ }
572
+ export interface ExportFromApiResult {
573
+ [key: string]: any;
574
+ url: string | null;
575
+ error?: string;
576
+ }
577
+ interface BaseExportFromApiOptions {
578
+ mergeTags?: Record<string, string>;
579
+ }
580
+ export interface ExportImageFromApiOptions extends BaseExportFromApiOptions {
581
+ width?: number;
582
+ height?: number;
583
+ fullPage?: boolean;
584
+ deviceScaleFactor?: number;
585
+ }
586
+ export interface ExportPdfFromApiOptions extends BaseExportFromApiOptions {
587
+ }
588
+ export interface ExportZipFromApiOptions extends BaseExportFromApiOptions {
589
+ }
590
+ }
591
+ declare module "engine/utils/findDeep" {
592
+ export function findDeep<T = any>(item: Record<string, T> | Array<T> | T, eq: ((item: T) => boolean) | unknown, { _path }?: {
593
+ _path?: string[];
594
+ }): string[][];
595
+ }
596
+ declare module "embed/Frame" {
597
+ export type Message = object;
598
+ export interface MessageData {
599
+ action: string;
600
+ callbackId: number;
601
+ doneId: number;
602
+ result: unknown | undefined;
603
+ resultArgs: unknown[] | undefined;
604
+ }
605
+ export class Frame {
606
+ id: number;
607
+ ready: boolean;
608
+ iframe: HTMLIFrameElement | undefined;
609
+ messages: any[];
610
+ callbackId: number;
611
+ callbacks: {
612
+ [key: number]: Function | undefined;
613
+ };
614
+ constructor(src: string);
615
+ createIframe(src: string): HTMLIFrameElement;
616
+ destroy: () => void;
617
+ appendTo(el: Element): void;
618
+ onWindowMessage: (event: MessageEvent<any>) => void;
619
+ postMessage(action: string, message: Message): void;
620
+ withMessage(action: string, message: Message | undefined, callback?: Function): void;
621
+ preprocessMessage(message: Message): Message;
622
+ scheduleMessage(message: Message): void;
623
+ flushMessages(): void;
624
+ handleMessage({ action, callbackId, doneId, result: _result, resultArgs: _resultArgs, }: MessageData): void;
625
+ receiveMessage(event: any): void;
626
+ }
627
+ export const disableMultipleEditors: () => void;
628
+ global {
629
+ interface Window {
630
+ __unlayer_lastFrameId: number;
631
+ __unlayer_multipleEditors: boolean;
632
+ }
633
+ }
634
+ }
635
+ declare module "editor/components/common/Modal" {
636
+ import React from 'react';
637
+ import _Modal from 'react-modal';
638
+ type Props = _Modal['props'] & {
639
+ className?: string;
640
+ children: React.ReactNode;
641
+ };
642
+ export function Modal(_props: Props): JSX.Element;
643
+ }
644
+ declare module "editor/components/common/ConditionalWrap" {
645
+ import React from 'react';
646
+ export interface ConditionalWrapProps {
647
+ children: any;
648
+ condition: boolean;
649
+ wrap: (children: React.ReactElement<any>) => React.ReactNode;
650
+ }
651
+ export function ConditionalWrap(props: ConditionalWrapProps): any;
652
+ }
653
+ declare module "editor/components/common/Loader" {
654
+ import React from 'react';
655
+ export interface LoaderProps {
656
+ children?: React.ReactNode;
657
+ color?: boolean | string | ((props: {
658
+ theme: any;
659
+ }) => string);
660
+ fadeIn?: boolean;
661
+ loaded?: boolean;
662
+ loadedClassName?: string;
663
+ loadingClassName?: string;
664
+ size?: 'small' | 'normal';
665
+ }
666
+ export function Loader(props: LoaderProps): JSX.Element;
667
+ }
668
+ declare module "editor/hooks/useDynamicRef" {
669
+ export function useDynamicRef<T>(value: T): import("react").MutableRefObject<T>;
670
+ }
671
+ declare module "state/types/RootState" {
672
+ import { StateType } from 'typesafe-actions';
673
+ import reducer from '../reducer';
674
+ export type RootState = StateType<typeof reducer>;
675
+ }
676
+ declare module "engine/config/env" {
677
+ export const env: {
678
+ API_V1_BASE_URL: string;
679
+ API_V2_BASE_URL: string;
680
+ EVENTS_API_BASE_URL: string;
681
+ TOOLS_API_V1_BASE_URL: string;
682
+ TOOLS_CDN_BASE_URL: string;
683
+ };
684
+ export function setIsTest(isTest: boolean): void;
685
+ export function isTest(): boolean;
686
+ global {
687
+ interface Window {
688
+ Cypress?: unknown;
689
+ }
690
+ }
691
+ }
692
+ declare module "editor/helpers/image" {
693
+ export function fetchImage(imageURL: string, { proxyURL, retryWithoutProxy, }?: {
694
+ proxyURL?: string;
695
+ retryWithoutProxy?: boolean;
696
+ }): Promise<Blob>;
697
+ export function fetchImageViaProxy(imageURL: string, { proxyURL, retryWithoutProxy, }?: {
698
+ proxyURL?: string;
699
+ retryWithoutProxy?: boolean;
700
+ }): Promise<Blob>;
701
+ export function tryLoadImageFromStringOrBlob(imageSrcOrBlob: string | Blob): Promise<{
702
+ image: {
703
+ width: number;
704
+ height: number;
705
+ src: string;
706
+ };
707
+ imgElement: HTMLImageElement;
708
+ }>;
709
+ export function loadImageDimensions(imageSrcOrBlob: string | Blob): Promise<{
710
+ width: number | undefined;
711
+ height: number | undefined;
712
+ error?: string;
713
+ }>;
714
+ export function imageHasTransparency(imageSrcOrBlob: string | Blob): Promise<boolean | null>;
715
+ }
716
+ declare module "editor/hooks/useImageUploader" {
717
+ import { useStore } from 'react-redux';
718
+ import { ImageSource } from '../../state/types';
719
+ type Store = Pick<ReturnType<typeof useStore>, 'dispatch' | 'getState'>;
720
+ export interface Params {
721
+ maxSize?: number | null;
722
+ onErrorChange?: (error: Error | null) => void;
723
+ onImageSelect?: (image?: {
724
+ url: string;
725
+ width?: number;
726
+ height?: number;
727
+ size?: number;
728
+ }) => void;
729
+ onImageUpload?: (image: {
730
+ url: string;
731
+ width?: number;
732
+ height?: number;
733
+ }) => void;
734
+ onUploadProgressChange?: (progress: number) => void;
735
+ onUploadStatusChange?: (isUploading: boolean) => void;
736
+ shouldReloadUserUploadsAfterUpload?: boolean;
737
+ shouldTriggerReduxOptimisticUpdate?: boolean;
738
+ }
739
+ export function useImageUploader(params: Params): {
740
+ error: Error;
741
+ isUploading: boolean;
742
+ startUploadFlow: (images: FileList | Array<File | Blob | string> | null, source: ImageSource) => void;
743
+ setError: import("react").Dispatch<import("react").SetStateAction<Error>>;
744
+ triggerSelectImageCallback: () => void;
745
+ uploadProgress: number;
746
+ };
747
+ function triggerImageUploadCallback(images: FileList | Array<File | Blob | string>, source: ImageSource, { maxSize, onError, onImageUpload, project, setIsUploading, setUploadProgress, shouldReloadUserUploadsAfterUpload, shouldTriggerReduxOptimisticUpdate, store, userId, }: {
748
+ maxSize?: Params['maxSize'];
749
+ onError?: (error: Error | null) => void;
750
+ onImageUpload?: Params['onImageUpload'];
751
+ project: {
752
+ id?: number;
753
+ } | null;
754
+ setIsUploading?: Params['onUploadStatusChange'];
755
+ setUploadProgress?: Params['onUploadProgressChange'];
756
+ shouldReloadUserUploadsAfterUpload?: Params['shouldReloadUserUploadsAfterUpload'];
757
+ shouldTriggerReduxOptimisticUpdate?: Params['shouldTriggerReduxOptimisticUpdate'];
758
+ store: Store;
759
+ userId: string;
760
+ }): Promise<void>;
761
+ function uploadFiles(images: FileList | Array<File | Blob | string>, source: ImageSource, { maxSize, onError, onImageUpload, project, setIsUploading, setUploadProgress, shouldReloadUserUploadsAfterUpload, shouldTriggerReduxOptimisticUpdate, store, userId, }: {
762
+ maxSize?: Params['maxSize'];
763
+ onError?: (error: Error | null) => void;
764
+ onImageUpload?: Params['onImageUpload'];
765
+ project: {
766
+ id?: number;
767
+ storage?: boolean;
768
+ } | null;
769
+ setIsUploading?: Params['onUploadStatusChange'];
770
+ setUploadProgress?: Params['onUploadProgressChange'];
771
+ shouldReloadUserUploadsAfterUpload?: Params['shouldReloadUserUploadsAfterUpload'];
772
+ shouldTriggerReduxOptimisticUpdate?: Params['shouldTriggerReduxOptimisticUpdate'];
773
+ store: Store;
774
+ userId: string;
775
+ }): Promise<void>;
776
+ export function startUploadFlow(images: FileList | Array<File | Blob | string> | null, source: ImageSource, params: Parameters<typeof triggerImageUploadCallback>[2] & Parameters<typeof uploadFiles>[2]): Promise<void>;
777
+ export class ImageMaxSizeExceededError extends Error {
778
+ maxSize: number;
779
+ size: number;
780
+ constructor({ size, maxSize }: {
781
+ size: number;
782
+ maxSize: number;
783
+ }, message?: string, ...params: any[]);
784
+ }
785
+ }
786
+ declare module "engine/utils/withHook" {
787
+ import React from 'react';
788
+ 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>>>;
789
+ }
790
+ declare module "editor/hooks/useForceRerender" {
791
+ export function useForceRerender({ debounce, throttle, }?: {
792
+ debounce?: boolean | number;
793
+ throttle?: boolean | number;
794
+ }): () => void;
795
+ }
796
+ declare module "editor/hooks/useConfig" {
797
+ import React from 'react';
798
+ export function useConfig(): any;
799
+ export function withConfig<C extends React.ComponentType>(Component: C): React.MemoExoticComponent<React.ForwardRefExoticComponent<object & Record<"config", any> & React.RefAttributes<unknown>>>;
800
+ }
801
+ declare module "editor/components/common/ImageUploadButton" {
802
+ import React from 'react';
803
+ import { ButtonProps } from 'reactstrap';
804
+ import { ImageSource } from '../../../state/types';
805
+ export interface ImageUploadButtonInstance {
806
+ clearError: () => void;
807
+ openPicker: () => void;
808
+ startUploadFlow: (images: FileList | Array<File | Blob | string> | null, source: ImageSource) => void;
809
+ }
810
+ export interface ImageUploadButtonProps {
811
+ buttonProps?: ButtonProps;
812
+ disableProgressIndicator?: boolean;
813
+ maxSize?: number;
814
+ onErrorChange?: (error: Error | null) => void;
815
+ onImageSelect?: (image?: {
816
+ url: string;
817
+ width?: number;
818
+ height?: number;
819
+ }) => void;
820
+ onImageUpload?: (image: {
821
+ url: string;
822
+ width?: number;
823
+ height?: number;
824
+ }) => void;
825
+ onUploadProgressChange?: (progress: number) => void;
826
+ onUploadStatusChange?: (isUploading: boolean) => void;
827
+ shouldReloadUserUploadsAfterUpload?: boolean;
828
+ shouldTriggerReduxOptimisticUpdate?: boolean;
829
+ showError?: boolean;
830
+ }
831
+ export const ImageUploadButton: React.ForwardRefExoticComponent<ImageUploadButtonProps & React.RefAttributes<ImageUploadButtonInstance>>;
832
+ }
833
+ declare module "engine/tools/content/image" {
834
+ export const DEFAULT_IMAGE_PLACEHOLDER = "https://cdn.tools.unlayer.com/image/placeholder.png";
835
+ }
836
+ declare module "engine/config/mergeTags" {
837
+ import { MergeTags } from '../../state/types';
838
+ export function getMergeTags(): MergeTags;
839
+ export function getMergeTagsVersion(): number;
840
+ export function setMergeTags(_mergeTags: MergeTags): void;
841
+ }
842
+ declare module "engine/utils/htmlEntities" {
843
+ export function encodeHtmlEntities(str: string | undefined, { modes }?: {
844
+ modes?: Array<keyof typeof replacers>;
845
+ }): string;
846
+ const replacers: {
847
+ accents: (str: string | undefined) => string;
848
+ all: (str: string | undefined) => string;
849
+ others: (str: string | undefined) => string;
850
+ tags: (str: string | undefined) => string;
851
+ };
852
+ }
853
+ declare module "engine/utils/encodeMergeTag" {
854
+ export function encodeMergeTag(str: string | undefined): string;
855
+ }
856
+ declare module "engine/utils/escapeHtml" {
857
+ export function escapeHtml(str: string | undefined, { escapeAndOperator, // This was causing issues by changing & in links to &amp;
858
+ escapeLT, escapeGT, escapeDoubleQuotes, escapeSingleQuotes, }?: {
859
+ escapeAndOperator?: boolean;
860
+ escapeLT?: boolean;
861
+ escapeGT?: boolean;
862
+ escapeDoubleQuotes?: boolean;
863
+ escapeSingleQuotes?: boolean;
864
+ }): string;
865
+ }
866
+ declare module "engine/utils/escapeRegexString" {
867
+ export function escapeRegexString(str: string): string;
868
+ }
869
+ declare module "engine/utils/getNumberOrString" {
870
+ export function getNumberOrString(str: string | number): string | number;
871
+ }
872
+ declare module "engine/utils/flattenMergeTags" {
873
+ import { MergeTag, MergeTags, MergeTagsConfig } from '../../state/types';
874
+ export type MergeTagWithMeta = MergeTag & {
875
+ _meta: {
876
+ key: string;
877
+ tree: Array<Omit<MergeTag, 'mergeTags'> & {
878
+ _meta?: Omit<MergeTagWithMeta['_meta'], 'tree'>;
879
+ }>;
880
+ };
881
+ };
882
+ function _flattenMergeTags(mergeTags: Array<MergeTag | MergeTagWithMeta> | MergeTags, mergeTagsConfig?: Pick<MergeTagsConfig, 'sort'>, _internal?: Pick<MergeTagWithMeta['_meta'], 'tree'>): Array<MergeTagWithMeta>;
883
+ export const flattenMergeTags: typeof _flattenMergeTags & import("lodash").MemoizedFunction;
884
+ export function getMergeTagLabel(mergeTag: MergeTagWithMeta['_meta']['tree'][0] | undefined): string;
885
+ export function getMergeTagFlatLabel(mergeTag: MergeTagWithMeta | undefined): string;
886
+ }
887
+ declare module "engine/utils/testBrowserFeatures" {
888
+ export function supportsRegexLookAheadLookBehind(): boolean;
889
+ export function replaceWithLookBehind(str: string, lookbBehindStr: string, regex: RegExp, replacement: string): string;
890
+ }
891
+ declare module "engine/utils/applyMergeTagsToHtml" {
892
+ import { MergeTags, MergeTagsValues } from '../../state/types';
893
+ export function applyMergeTagsToHtml(html: string | undefined, { mergeTagsSchema, mergeTagsValues: _mergeTagsValues, _skipTags, _useRawValue, }: {
894
+ mergeTagsSchema: MergeTags | undefined;
895
+ mergeTagsValues: MergeTagsValues | undefined;
896
+ _skipTags?: boolean;
897
+ _useRawValue?: boolean;
898
+ }): string;
899
+ }
900
+ declare module "engine/utils/generateMergeTagHtml" {
901
+ import { Icon, MergeTag } from '../../state/types';
902
+ export function generateMergeTagHtml(mergeTag: Pick<MergeTag, 'name' | 'value' | 'sample'> & {
903
+ icon?: Icon | string;
904
+ }): string;
905
+ }
906
+ declare module "engine/utils/applyMergeTagPreviewHtmlToText" {
907
+ function _applyMergeTagPreviewHtmlToText(text: string | undefined, { type }?: {
908
+ type?: 'smart' | 'raw';
909
+ }): string;
910
+ export const applyMergeTagPreviewHtmlToText: typeof _applyMergeTagPreviewHtmlToText & import("lodash").MemoizedFunction;
911
+ }
912
+ declare module "editor/components/common/Dropzone" {
913
+ import React from 'react';
914
+ import { DropzoneOptions } from 'react-dropzone';
915
+ export interface DropzoneProps {
916
+ children?: React.ReactNode;
917
+ isUploading?: boolean;
918
+ maxSize?: number;
919
+ options?: DropzoneOptions;
920
+ uploadProgress?: number;
921
+ currentImage?: string;
922
+ shouldRenderEffects?: boolean;
923
+ onEffectsClick?: () => void;
924
+ isEffectsButtonDisabled?: boolean;
925
+ showImageInfo?: boolean;
926
+ shouldRenderDropzone: boolean;
927
+ isNotImageTool?: boolean;
928
+ }
929
+ export function Dropzone(props: DropzoneProps): JSX.Element;
930
+ }
931
+ declare module "editor/components/common/ImageUploadErrorMessage" {
932
+ import { IntlShape } from 'react-intl';
933
+ export interface ImageUploadErrorMessageProps {
934
+ error: Error | boolean | null | undefined;
935
+ maxSize?: number;
936
+ onClick?: () => void;
937
+ }
938
+ export function getImageUploadErrorMessage(error: ImageUploadErrorMessageProps['error'], { maxSize, intl }: {
939
+ maxSize: number;
940
+ intl: IntlShape;
941
+ }): any;
942
+ export function ImageUploadErrorMessage(props: ImageUploadErrorMessageProps): JSX.Element;
943
+ }
944
+ declare module "engine/utils/position" {
945
+ import { DisplayMode } from '../../state/types';
946
+ export const ENABLE_BACKGROUND_POSITION_FOR_EMAILS = true;
947
+ export type Position = 'top-left' | 'top-center' | 'top-right' | 'center-left' | 'center' | 'center-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
948
+ 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"];
949
+ 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';
950
+ export function valuesToBackgroundPositionCSS(values: {
951
+ position: Position | 'custom' | undefined;
952
+ customPosition: [string, string] | undefined;
953
+ }, { displayMode }: {
954
+ displayMode: DisplayMode;
955
+ }): string;
956
+ export function positionToPercentages(position: Position | 'custom' | undefined): [x: string, y: string] | undefined;
957
+ 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;
958
+ }
959
+ declare module "editor/components/editors/PositionEditor" {
960
+ import { EditorProps } from "editor/components/editors/types";
961
+ import { Position } from "engine/utils/position";
962
+ export type PositionEditorValue = Position | 'custom';
963
+ export type PositionEditorProps = EditorProps<PositionEditorValue, {
964
+ positions?: Position[];
965
+ }>;
966
+ export function PositionEditor(props: PositionEditorProps): JSX.Element;
967
+ export function PositionEditorBase(props: Pick<PositionEditorProps, 'updateValue' | 'value' | 'widgetParams'> & {
968
+ className?: string;
969
+ itemSize?: number;
970
+ spacing?: number;
971
+ valueLabelPosition?: 'left' | 'right' | 'none';
972
+ }): JSX.Element;
973
+ }
974
+ declare module "editor/components/editors/common/Counter" {
975
+ import React from 'react';
976
+ export interface CounterProps {
977
+ absoluteBaseValue?: number;
978
+ buttonSize?: 'lg' | 'md' | 'sm' | undefined;
979
+ children?: React.ReactNode;
980
+ defaultUnit?: string;
981
+ disabled?: boolean;
982
+ maxValue?: number | null;
983
+ minValue?: number | null;
984
+ onChange: (value: number | string) => void;
985
+ shouldRenderIncrementDecrementButtons?: boolean;
986
+ step?: number;
987
+ unitSupportedDisplayModes?: string[];
988
+ units?: string[];
989
+ value: number | string;
990
+ }
991
+ export default function Counter(props: CounterProps): JSX.Element;
992
+ }
993
+ declare module "engine/utils/sizeUtils" {
994
+ import { DisplayMode } from '../../state/types';
995
+ export const ENABLE_BACKGROUND_SIZE_FOR_EMAILS = false;
996
+ export function normalizeFloat(n: number | string | undefined, decimalsPlace?: number): number;
997
+ export function normalizeSize(size: number | string | undefined, { decimalsPlace }?: {
998
+ decimalsPlace?: number;
999
+ }): string;
1000
+ export function calculateExactSize(size: number | string, maxSize: number | undefined, options?: {
1001
+ decimalsPlace?: number;
1002
+ ifNumberConsiderAsPercentage?: boolean;
1003
+ }): number | undefined;
1004
+ export function valuesToBackgroundSizeCSS(values: {
1005
+ size: 'contain' | 'cover' | 'custom' | undefined;
1006
+ customSize: [string, string];
1007
+ }, { displayMode }: {
1008
+ displayMode: DisplayMode;
1009
+ }): string;
1010
+ }
1011
+ declare module "editor/components/editors/pixie/pixie.umd" {
1012
+ const _exports: {
1013
+ new (t: any): {
1014
+ readonly state: any;
1015
+ readonly version: string;
1016
+ readonly defaultConfig: {
1017
+ selector: string;
1018
+ textureSize: number;
1019
+ ui: {
1020
+ visible: boolean;
1021
+ mode: any;
1022
+ forceOverlayModeOnMobile: boolean;
1023
+ activeTheme: any;
1024
+ themes: ({
1025
+ name: any;
1026
+ colors: {
1027
+ "--be-foreground-base": string;
1028
+ "--be-primary-light": string;
1029
+ "--be-primary": string;
1030
+ "--be-primary-dark": string;
1031
+ "--be-on-primary": string;
1032
+ "--be-error": string;
1033
+ "--be-on-error": string;
1034
+ "--be-background": string;
1035
+ "--be-background-alt": string;
1036
+ "--be-paper": string;
1037
+ "--be-disabled-bg-opacity": string;
1038
+ "--be-disabled-fg-opacity": string;
1039
+ "--be-hover-opacity": string;
1040
+ "--be-focus-opacity": string;
1041
+ "--be-selected-opacity": string;
1042
+ "--be-text-main-opacity": string;
1043
+ "--be-text-muted-opacity": string;
1044
+ "--be-divider-opacity": string;
1045
+ };
1046
+ isDark?: undefined;
1047
+ } | {
1048
+ name: any;
1049
+ isDark: boolean;
1050
+ colors: {
1051
+ "--be-foreground-base": string;
1052
+ "--be-primary-light": string;
1053
+ "--be-primary": string;
1054
+ "--be-primary-dark": string;
1055
+ "--be-on-primary": string;
1056
+ "--be-error": string;
1057
+ "--be-on-error": string;
1058
+ "--be-background": string;
1059
+ "--be-background-alt": string;
1060
+ "--be-paper": string;
1061
+ "--be-disabled-bg-opacity": string;
1062
+ "--be-disabled-fg-opacity": string;
1063
+ "--be-hover-opacity": string;
1064
+ "--be-focus-opacity": string;
1065
+ "--be-selected-opacity": string;
1066
+ "--be-text-main-opacity": string;
1067
+ "--be-text-muted-opacity": string;
1068
+ "--be-divider-opacity": string;
1069
+ };
1070
+ })[];
1071
+ allowEditorClose: boolean;
1072
+ menubar: {
1073
+ items: ({
1074
+ type: string;
1075
+ align: string;
1076
+ desktopOnly?: undefined;
1077
+ icon?: undefined;
1078
+ action?: undefined;
1079
+ label?: undefined;
1080
+ } | {
1081
+ type: string;
1082
+ align: string;
1083
+ desktopOnly: boolean;
1084
+ icon?: undefined;
1085
+ action?: undefined;
1086
+ label?: undefined;
1087
+ } | {
1088
+ type: string;
1089
+ icon: any;
1090
+ align: string;
1091
+ desktopOnly: boolean;
1092
+ action: (e: any) => void;
1093
+ label?: undefined;
1094
+ } | {
1095
+ type: string;
1096
+ icon: any;
1097
+ label: {
1098
+ id: string;
1099
+ defaultMessage: {
1100
+ type: number;
1101
+ value: string;
1102
+ }[];
1103
+ };
1104
+ align: string;
1105
+ action: (e: any) => void;
1106
+ desktopOnly?: undefined;
1107
+ })[];
1108
+ };
1109
+ nav: {
1110
+ position: any;
1111
+ items: {
1112
+ name: any;
1113
+ icon: any;
1114
+ action: any;
1115
+ }[];
1116
+ };
1117
+ openImageDialog: {
1118
+ show: boolean;
1119
+ sampleImages: {
1120
+ url: string;
1121
+ thumbnail: string;
1122
+ }[];
1123
+ };
1124
+ colorPresets: {
1125
+ items: string[];
1126
+ };
1127
+ };
1128
+ objectDefaults: {
1129
+ global: any;
1130
+ sticker: {
1131
+ fill: any;
1132
+ };
1133
+ text: {
1134
+ textAlign: string;
1135
+ underline: boolean;
1136
+ linethrough: boolean;
1137
+ fontStyle: string;
1138
+ fontFamily: string;
1139
+ fontWeight: string;
1140
+ stroke: any;
1141
+ fontSize: number;
1142
+ };
1143
+ };
1144
+ tools: {
1145
+ filter: {
1146
+ items: string[];
1147
+ };
1148
+ zoom: {
1149
+ allowUserZoom: boolean;
1150
+ fitImageToScreen: boolean;
1151
+ };
1152
+ crop: {
1153
+ allowCustomRatio: boolean;
1154
+ defaultRatio: string;
1155
+ presets: ({
1156
+ ratio: string;
1157
+ name: string;
1158
+ } | {
1159
+ ratio: string;
1160
+ name?: undefined;
1161
+ })[];
1162
+ };
1163
+ text: {
1164
+ defaultText: string;
1165
+ items: ({
1166
+ family: string;
1167
+ src: string;
1168
+ descriptors?: undefined;
1169
+ } | {
1170
+ family: string;
1171
+ src: string;
1172
+ descriptors: {
1173
+ weight: string;
1174
+ };
1175
+ })[];
1176
+ };
1177
+ draw: {
1178
+ brushSizes: number[];
1179
+ brushTypes: string[];
1180
+ };
1181
+ shapes: {
1182
+ items: ({
1183
+ name: string;
1184
+ type: string;
1185
+ options?: undefined;
1186
+ } | {
1187
+ name: string;
1188
+ type: string;
1189
+ options: {
1190
+ lockUniScaling: boolean;
1191
+ path?: undefined;
1192
+ strokeWidth?: undefined;
1193
+ stroke?: undefined;
1194
+ padding?: undefined;
1195
+ };
1196
+ } | {
1197
+ name: string;
1198
+ type: string;
1199
+ options: {
1200
+ path: string;
1201
+ lockUniScaling?: undefined;
1202
+ strokeWidth?: undefined;
1203
+ stroke?: undefined;
1204
+ padding?: undefined;
1205
+ };
1206
+ } | {
1207
+ name: string;
1208
+ type: string;
1209
+ options: {
1210
+ path: string;
1211
+ strokeWidth: number;
1212
+ stroke: string;
1213
+ padding: number;
1214
+ lockUniScaling?: undefined;
1215
+ };
1216
+ })[];
1217
+ };
1218
+ stickers: {
1219
+ items: ({
1220
+ name: string;
1221
+ list: string[];
1222
+ type: string;
1223
+ thumbnailUrl: string;
1224
+ items?: undefined;
1225
+ invertPreview?: undefined;
1226
+ } | {
1227
+ name: string;
1228
+ items: number;
1229
+ type: string;
1230
+ thumbnailUrl: string;
1231
+ list?: undefined;
1232
+ invertPreview?: undefined;
1233
+ } | {
1234
+ name: string;
1235
+ items: number;
1236
+ type: string;
1237
+ thumbnailUrl: string;
1238
+ invertPreview: boolean;
1239
+ list?: undefined;
1240
+ })[];
1241
+ };
1242
+ import: {
1243
+ validImgExtensions: string[];
1244
+ fitOverlayToScreen: boolean;
1245
+ openDroppedImageAsBackground: boolean;
1246
+ };
1247
+ export: {
1248
+ defaultFormat: string;
1249
+ defaultQuality: number;
1250
+ defaultName: string;
1251
+ };
1252
+ frame: {
1253
+ items: ({
1254
+ name: string;
1255
+ mode: string;
1256
+ size: {
1257
+ min: number;
1258
+ max: number;
1259
+ default: number;
1260
+ };
1261
+ display_name?: undefined;
1262
+ } | {
1263
+ name: string;
1264
+ display_name: string;
1265
+ mode: string;
1266
+ size: {
1267
+ min: number;
1268
+ max: number;
1269
+ default: number;
1270
+ };
1271
+ })[];
1272
+ };
1273
+ };
1274
+ };
1275
+ open(t?: {}): void;
1276
+ close(): void;
1277
+ setConfig(t: any): void;
1278
+ uploadAndAddImage(): any;
1279
+ uploadAndReplaceMainImage(): any;
1280
+ uploadAndOpenStateFile(): any;
1281
+ newCanvas(t: any, r: any, n: any): any;
1282
+ getState(t: any): string;
1283
+ setState(t: any): any;
1284
+ setStateFromUrl(t: any): Promise<any>;
1285
+ openTool(t: any): void;
1286
+ applyChanges(): void;
1287
+ cancelChanges(): void;
1288
+ resetEditor(t: any): Promise<void>;
1289
+ togglePanel(t: any, r: any): void;
1290
+ on(t: any, r: any): void;
1291
+ isDirty(): any;
1292
+ get(t: any): any;
1293
+ notify(t: any): any;
1294
+ };
1295
+ init(t: any): Promise<any>;
1296
+ };
1297
+ export = _exports;
1298
+ }
1299
+ declare module "editor/components/editors/pixie/PixieImageEditor" {
1300
+ export default PixieImageEditor;
1301
+ class PixieImageEditor extends React.Component<any, any, any> {
1302
+ constructor(props: any);
1303
+ constructor(props: any, context: any);
1304
+ state: {
1305
+ loading: boolean;
1306
+ saving: boolean;
1307
+ errorMessage: string;
1308
+ };
1309
+ componentDidMount(): void;
1310
+ componentDidUpdate(prevProps: any): void;
1311
+ loadPixieEditor: () => Promise<void>;
1312
+ updateImage: () => Promise<void>;
1313
+ componentWillUnmount(): Promise<void>;
1314
+ render(): JSX.Element;
1315
+ b64toBlob: (b64Data: any, contentType: any, sliceSize: any) => Blob;
1316
+ }
1317
+ import React from "react";
1318
+ }
1319
+ declare module "editor/components/editors/BackgroundImageEditor" {
1320
+ import { EditorProps } from "editor/components/editors/types";
1321
+ import { Position } from "engine/utils/position";
1322
+ export type BackgroundImageEditorValue = {
1323
+ url: string | undefined;
1324
+ width: number | undefined;
1325
+ height: number | undefined;
1326
+ fullWidth: boolean | undefined;
1327
+ size: 'contain' | 'cover' | 'custom' | undefined;
1328
+ customSize: [string, string];
1329
+ repeat: 'no-repeat' | 'repeat-x' | 'repeat-y' | 'repeat' | undefined;
1330
+ position: Position | 'custom' | undefined;
1331
+ customPosition: [string, string];
1332
+ };
1333
+ export type BackgroundImageProps = EditorProps<BackgroundImageEditorValue, {
1334
+ shouldRender?: false | {
1335
+ dropzone?: boolean;
1336
+ effects?: boolean;
1337
+ uploadButton?: boolean;
1338
+ url?: boolean;
1339
+ options?: false | {
1340
+ containerWidth?: boolean;
1341
+ size?: boolean;
1342
+ repeat?: boolean;
1343
+ position?: boolean;
1344
+ };
1345
+ };
1346
+ }>;
1347
+ }
1348
+ declare module "engine/options/bodies" {
1349
+ import { BackgroundImageEditorValue } from "editor/components/editors/BackgroundImageEditor";
1350
+ export type BodyValues = {
1351
+ backgroundColor: string;
1352
+ backgroundImage: BackgroundImageEditorValue;
1353
+ contentWidth: string;
1354
+ fontFamily: {
1355
+ label: string;
1356
+ value: string;
1357
+ };
1358
+ linkStyle: {
1359
+ body: boolean;
1360
+ linkColor: string;
1361
+ linkHoverColor: string;
1362
+ linkUnderline: boolean;
1363
+ linkHoverUnderline: boolean;
1364
+ };
1365
+ preheaderText: string;
1366
+ };
1367
+ }
1368
+ declare module "engine/utils/stringifyFunction" {
1369
+ export function stringifyFunction(fn: Function): string;
1370
+ export function stringifyFunctionsFromObject(obj: object): {};
1371
+ }
1372
+ declare module "engine/utils/normalizeLinkTypes" {
1373
+ import { LinkType, LinkTypes, LinkTypesSharedConfig } from '../../state/types';
1374
+ export function normalizeLinkTypeSharedConfig(linkType: LinkTypesSharedConfig | null | undefined): any;
1375
+ export function normalizeLinkType(linkType: LinkType): any;
1376
+ export function normalizeLinkTypes(linkTypes: LinkTypes): any[];
1377
+ }
1378
+ declare module "engine/utils/makeClassMethodsEnumerable" {
1379
+ export function makeClassMethodsEnumerable(instance: InstanceType<any>, ignoreList?: string[]): void;
1380
+ }
1381
+ declare module "embed/Editor" {
1382
+ import { Frame } from "embed/Frame";
1383
+ import { Config, ExportFromApiResult, ExportHtmlOptions, ExportHtmlResult, ExportImageFromApiOptions, ExportLiveHtmlOptions, ExportPdfFromApiOptions, ExportPlainTextOptions, ExportZipFromApiOptions, SaveDesignOptions } from "embed/Config";
1384
+ import { AppearanceConfig, Audit, DesignTagsConfig, Device, DisplayConditions, DisplayMode, JSONTemplate, LinkTypes, LinkTypesSharedConfig, MergeTags, MergeTagsConfig, SpecialLink, Tabs, Translations, User, Validator } from "state/types/index";
1385
+ import { BodyValues } from "engine/options/bodies";
1386
+ import { Locale, TextDirection } from "engine/config/intl";
1387
+ export class Editor {
1388
+ frame: Frame | null;
1389
+ constructor(config?: Config);
1390
+ init(config?: Config): void;
1391
+ destroy(): void;
1392
+ loadEditor(config: Config): void;
1393
+ renderEditor(config: Config): void;
1394
+ initEditor(config: Config): void;
1395
+ registerColumns(cells: number[]): void;
1396
+ registerCallback(type: string, callback: Function): void;
1397
+ unregisterCallback(type: string): void;
1398
+ registerProvider(type: string, callback: Function): void;
1399
+ unregisterProvider(type: string): void;
1400
+ reloadProvider(type: string): void;
1401
+ addEventListener(type: string, callback: Function): void;
1402
+ removeEventListener(type: string): void;
1403
+ setDesignId(id: string | null): void;
1404
+ setDesignMode(designMode: string): void;
1405
+ setDisplayMode(displayMode: DisplayMode): void;
1406
+ loadProject(projectId: number): void;
1407
+ loadUser(user: User): void;
1408
+ loadTemplate(templateId: number): void;
1409
+ loadStockTemplate(stockTemplateId: string): void;
1410
+ setLinkTypes(linkTypes: LinkTypes): void;
1411
+ setLinkTypesSharedConfig(linkTypesSharedConfig: LinkTypesSharedConfig | null): void;
1412
+ setMergeTags(mergeTags: MergeTags): void;
1413
+ setSpecialLinks(specialLinks: SpecialLink[]): void;
1414
+ setDisplayConditions(displayConditions: DisplayConditions): void;
1415
+ setLocale(locale: Locale | null): void;
1416
+ setTextDirection(textDirection: TextDirection | null): void;
1417
+ setTranslations(translations: Translations): void;
1418
+ loadBlank(bodyValues?: object): void;
1419
+ loadDesign(design: JSONTemplate): void;
1420
+ saveDesign(callback: Function, options?: SaveDesignOptions): void;
1421
+ exportHtml(callback: (data: ExportHtmlResult) => void, options?: ExportHtmlOptions): void;
1422
+ exportLiveHtml(callback: Function, options?: ExportLiveHtmlOptions): void;
1423
+ exportPlainText(callback: (data: {
1424
+ text: string;
1425
+ }) => void, options?: ExportPlainTextOptions): void;
1426
+ exportImage(callback: (data: ExportFromApiResult) => void, options: ExportImageFromApiOptions): void;
1427
+ exportPdf(callback: (data: ExportFromApiResult) => void, options: ExportPdfFromApiOptions): void;
1428
+ exportZip(callback: (data: ExportFromApiResult) => void, options: ExportZipFromApiOptions): void;
1429
+ setAppearance(appearance: AppearanceConfig): void;
1430
+ setBodyValues(bodyValues: Partial<BodyValues>, bodyId?: number): void;
1431
+ setDesignTagsConfig(designTagsConfig: DesignTagsConfig): void;
1432
+ setMergeTagsConfig(mergeTagsConfig: MergeTagsConfig): void;
1433
+ showPreview(device?: Device): void;
1434
+ hidePreview(): void;
1435
+ canUndo(callback: (result: boolean) => void): void;
1436
+ canRedo(callback: (result: boolean) => void): void;
1437
+ undo(): void;
1438
+ redo(): void;
1439
+ audit(callback: (data: {
1440
+ status: 'FAIL' | 'PASS';
1441
+ errors: Audit[];
1442
+ }) => void): void;
1443
+ setValidator(validator: Validator | null): void;
1444
+ setToolValidator(tool: string, validator: Validator | null): void;
1445
+ updateTabs(tabs: Tabs): void;
1446
+ clearValidators(): void;
1447
+ registerContainerExporter(): void;
1448
+ registerItemExporter(): void;
1449
+ registerTool(): void;
1450
+ registerPropertyEditor(): void;
1451
+ registerTab(): void;
1452
+ createPanel(): void;
1453
+ createViewer(): void;
1454
+ createWidget(): void;
1455
+ }
1456
+ }
1457
+ declare module "embed/index" {
1458
+ import { Editor } from "embed/Editor";
1459
+ import { Config } from "embed/Config";
1460
+ class Embed extends Editor {
1461
+ createEditor(config: Config): Editor;
1462
+ }
1463
+ const _default: Embed;
1464
+ export default _default;
1465
+ }