@unlayer/types 1.390.0 → 1.392.0

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.
@@ -33,7 +33,7 @@ import type { BodyValues } from '../containers/body';
33
33
  import type { ColumnValues } from '../containers/column';
34
34
  import type { RowValues } from '../containers/row';
35
35
  import type { MergeTagsValues } from '../editor/merge-tags';
36
- import type { Variant } from '../editor/types';
36
+ import type { ExporterConfig, Variant } from '../editor/types';
37
37
 
38
38
  type ContentExporter = (
39
39
  innerHTML: string,
@@ -48,6 +48,8 @@ type ContentExporter = (
48
48
  rowValues: RowValues;
49
49
  bodyValues: BodyValues;
50
50
 
51
+ defaultDevice: Device;
52
+ exporterConfig: ExporterConfig;
51
53
  variant: Variant | undefined;
52
54
  language: string | undefined;
53
55
  embeddedValues: Record<string, unknown>;
@@ -79,7 +79,7 @@ export type RowValues<
79
79
  : never;
80
80
 
81
81
  import type { BodyValues } from '../containers/body';
82
- import type { Collection, Variant } from '../editor/types';
82
+ import type { Collection, ExporterConfig, Variant } from '../editor/types';
83
83
 
84
84
  type RowExporter = (
85
85
  innerHTML: string,
@@ -91,9 +91,11 @@ type RowExporter = (
91
91
  rowValues: RowValues;
92
92
  bodyValues: BodyValues;
93
93
 
94
+ defaultDevice: Device;
94
95
  variant: Variant | undefined;
95
96
  language: string | undefined;
96
97
  collection: Collection;
98
+ exporterConfig: ExporterConfig;
97
99
  },
98
100
  ) => string;
99
101
 
@@ -12,11 +12,17 @@ import type { LinkTypes, LinkTypesSharedConfig, SpecialLink, SpecialLinks } from
12
12
  import type { MergeTags, MergeTagsConfig, MergeTagsValues } from './merge-tags';
13
13
  import type { StyleGuideConfig } from './style-guide';
14
14
  import type { AppearanceConfig, Theme } from './theme';
15
- import type { CallbackTypeMap, Collection, Device, DisplayMode, Location, Variant } from './types';
15
+ import type { CallbackTypeMap, Collection, Device, DisplayMode, ExporterConfig, Location, Variant } from './types';
16
16
  import type { DeepPartial, LanguagesValue } from './utils';
17
17
  import type { BodyValues } from '../containers/body';
18
18
  import type { ColumnValues } from '../containers/column';
19
- import type { RowValues } from '../containers/row';
19
+
20
+ type RowValues = any;
21
+
22
+ /**
23
+ * Server-safe configuration for exporters.
24
+ * Passed via meta to allow dependency injection instead of importing config directly.
25
+ */
20
26
 
21
27
  export type Container = 'body' | 'row' | 'column' | 'content';
22
28
 
@@ -46,9 +52,11 @@ meta: {
46
52
  rowCells: number[];
47
53
  rowValues: RowValues;
48
54
  bodyValues: BodyValues;
55
+ defaultDevice: Device;
49
56
  variant: Variant | undefined;
50
57
  language: string | undefined;
51
58
  collection: Collection;
59
+ exporterConfig: ExporterConfig;
52
60
  }) => string;
53
61
 
54
62
  export type ColumnContainerExporter = (innerHTML: string, columnValues: Record<string, any>, // @deprecated use last param instead
@@ -77,6 +85,8 @@ meta: {
77
85
  rowCells: number[];
78
86
  rowValues: RowValues;
79
87
  bodyValues: BodyValues;
88
+ defaultDevice: Device;
89
+ exporterConfig: ExporterConfig;
80
90
  variant: Variant | undefined;
81
91
  language: string | undefined;
82
92
  embeddedValues: Record<string, unknown>;
@@ -101,6 +111,7 @@ meta: {
101
111
  rowCells: number[];
102
112
  rowValues: RowValues;
103
113
  bodyValues: BodyValues;
114
+ exporterConfig: ExporterConfig;
104
115
  embeddedValues: Record<string, unknown>;
105
116
  mergeTagState: {
106
117
  mergeTagGroup: string;
@@ -3,6 +3,13 @@
3
3
  import type { JSONTemplate } from './design';
4
4
  import type { MergeTags } from './merge-tags';
5
5
 
6
+ export interface ExporterConfig {
7
+ toSafeHtml?: (text: string | undefined, options?: any) => string;
8
+ textDirection?: string | undefined;
9
+ generateHtmlFromTextJson?: (textJson: any) => string;
10
+ cdnBaseUrl?: string;
11
+ }
12
+
6
13
  export type Device = 'desktop' | 'mobile' | 'tablet';
7
14
 
8
15
  export type Resolution = {
@@ -80,6 +80,7 @@ import type { ColumnValues } from '../containers/column';
80
80
  import type { ContentValues } from '../containers/content';
81
81
  import type { RowValues } from '../containers/row';
82
82
  import type { MergeTagsValues } from '../editor/merge-tags';
83
+ import type { ExporterConfig } from '../editor/types';
83
84
 
84
85
  type ButtonExporter = (
85
86
  renderValues: ContentValues & ButtonValues,
@@ -97,6 +98,7 @@ type ButtonExporter = (
97
98
  rowCells: number[];
98
99
  rowValues: RowValues;
99
100
  bodyValues: BodyValues;
101
+ exporterConfig: ExporterConfig;
100
102
 
101
103
  embeddedValues: Record<string, unknown>;
102
104
  mergeTagState: {
@@ -22,6 +22,7 @@ import type { ColumnValues } from '../containers/column';
22
22
  import type { ContentValues } from '../containers/content';
23
23
  import type { RowValues } from '../containers/row';
24
24
  import type { MergeTagsValues } from '../editor/merge-tags';
25
+ import type { ExporterConfig } from '../editor/types';
25
26
 
26
27
  type CarouselExporter = (
27
28
  renderValues: ContentValues & CarouselValues,
@@ -39,6 +40,7 @@ type CarouselExporter = (
39
40
  rowCells: number[];
40
41
  rowValues: RowValues;
41
42
  bodyValues: BodyValues;
43
+ exporterConfig: ExporterConfig;
42
44
 
43
45
  embeddedValues: Record<string, unknown>;
44
46
  mergeTagState: {
@@ -24,6 +24,7 @@ import type { ColumnValues } from '../containers/column';
24
24
  import type { ContentValues } from '../containers/content';
25
25
  import type { RowValues } from '../containers/row';
26
26
  import type { MergeTagsValues } from '../editor/merge-tags';
27
+ import type { ExporterConfig } from '../editor/types';
27
28
 
28
29
  type DividerExporter = (
29
30
  renderValues: ContentValues & DividerValues,
@@ -41,6 +42,7 @@ type DividerExporter = (
41
42
  rowCells: number[];
42
43
  rowValues: RowValues;
43
44
  bodyValues: BodyValues;
45
+ exporterConfig: ExporterConfig;
44
46
 
45
47
  embeddedValues: Record<string, unknown>;
46
48
  mergeTagState: {
@@ -128,6 +128,7 @@ import type { ColumnValues } from '../containers/column';
128
128
  import type { ContentValues } from '../containers/content';
129
129
  import type { RowValues } from '../containers/row';
130
130
  import type { MergeTagsValues } from '../editor/merge-tags';
131
+ import type { ExporterConfig } from '../editor/types';
131
132
 
132
133
  type FormExporter = (
133
134
  renderValues: ContentValues & FormValues,
@@ -145,6 +146,7 @@ type FormExporter = (
145
146
  rowCells: number[];
146
147
  rowValues: RowValues;
147
148
  bodyValues: BodyValues;
149
+ exporterConfig: ExporterConfig;
148
150
 
149
151
  embeddedValues: Record<string, unknown>;
150
152
  mergeTagState: {
@@ -49,6 +49,7 @@ import type { ColumnValues } from '../containers/column';
49
49
  import type { ContentValues } from '../containers/content';
50
50
  import type { RowValues } from '../containers/row';
51
51
  import type { MergeTagsValues } from '../editor/merge-tags';
52
+ import type { ExporterConfig } from '../editor/types';
52
53
 
53
54
  type HeadingExporter = (
54
55
  renderValues: ContentValues & HeadingValues,
@@ -66,6 +67,7 @@ type HeadingExporter = (
66
67
  rowCells: number[];
67
68
  rowValues: RowValues;
68
69
  bodyValues: BodyValues;
70
+ exporterConfig: ExporterConfig;
69
71
 
70
72
  embeddedValues: Record<string, unknown>;
71
73
  mergeTagState: {
@@ -18,6 +18,7 @@ import type { ColumnValues } from '../containers/column';
18
18
  import type { ContentValues } from '../containers/content';
19
19
  import type { RowValues } from '../containers/row';
20
20
  import type { MergeTagsValues } from '../editor/merge-tags';
21
+ import type { ExporterConfig } from '../editor/types';
21
22
 
22
23
  type HtmlExporter = (
23
24
  renderValues: ContentValues & HtmlValues,
@@ -35,6 +36,7 @@ type HtmlExporter = (
35
36
  rowCells: number[];
36
37
  rowValues: RowValues;
37
38
  bodyValues: BodyValues;
39
+ exporterConfig: ExporterConfig;
38
40
 
39
41
  embeddedValues: Record<string, unknown>;
40
42
  mergeTagState: {
@@ -45,6 +45,7 @@ import type { ColumnValues } from '../containers/column';
45
45
  import type { ContentValues } from '../containers/content';
46
46
  import type { RowValues } from '../containers/row';
47
47
  import type { MergeTagsValues } from '../editor/merge-tags';
48
+ import type { ExporterConfig } from '../editor/types';
48
49
 
49
50
  type ImageExporter = (
50
51
  renderValues: ContentValues & ImageValues,
@@ -62,6 +63,7 @@ type ImageExporter = (
62
63
  rowCells: number[];
63
64
  rowValues: RowValues;
64
65
  bodyValues: BodyValues;
66
+ exporterConfig: ExporterConfig;
65
67
 
66
68
  embeddedValues: Record<string, unknown>;
67
69
  mergeTagState: {
@@ -61,6 +61,7 @@ import type { ColumnValues } from '../containers/column';
61
61
  import type { ContentValues } from '../containers/content';
62
62
  import type { RowValues } from '../containers/row';
63
63
  import type { MergeTagsValues } from '../editor/merge-tags';
64
+ import type { ExporterConfig } from '../editor/types';
64
65
 
65
66
  type MenuExporter = (
66
67
  renderValues: ContentValues & MenuValues,
@@ -78,6 +79,7 @@ type MenuExporter = (
78
79
  rowCells: number[];
79
80
  rowValues: RowValues;
80
81
  bodyValues: BodyValues;
82
+ exporterConfig: ExporterConfig;
81
83
 
82
84
  embeddedValues: Record<string, unknown>;
83
85
  mergeTagState: {
@@ -27,6 +27,7 @@ import type { ColumnValues } from '../containers/column';
27
27
  import type { ContentValues } from '../containers/content';
28
28
  import type { RowValues } from '../containers/row';
29
29
  import type { MergeTagsValues } from '../editor/merge-tags';
30
+ import type { ExporterConfig } from '../editor/types';
30
31
 
31
32
  type PageBreakExporter = (
32
33
  renderValues: ContentValues & PageBreakValues,
@@ -44,6 +45,7 @@ type PageBreakExporter = (
44
45
  rowCells: number[];
45
46
  rowValues: RowValues;
46
47
  bodyValues: BodyValues;
48
+ exporterConfig: ExporterConfig;
47
49
 
48
50
  embeddedValues: Record<string, unknown>;
49
51
  mergeTagState: {
@@ -46,6 +46,7 @@ import type { ColumnValues } from '../containers/column';
46
46
  import type { ContentValues } from '../containers/content';
47
47
  import type { RowValues } from '../containers/row';
48
48
  import type { MergeTagsValues } from '../editor/merge-tags';
49
+ import type { ExporterConfig } from '../editor/types';
49
50
 
50
51
  type ParagraphExporter = (
51
52
  renderValues: ContentValues & ParagraphValues,
@@ -63,6 +64,7 @@ type ParagraphExporter = (
63
64
  rowCells: number[];
64
65
  rowValues: RowValues;
65
66
  bodyValues: BodyValues;
67
+ exporterConfig: ExporterConfig;
66
68
 
67
69
  embeddedValues: Record<string, unknown>;
68
70
  mergeTagState: {
@@ -28,6 +28,7 @@ import type { ColumnValues } from '../containers/column';
28
28
  import type { ContentValues } from '../containers/content';
29
29
  import type { RowValues } from '../containers/row';
30
30
  import type { MergeTagsValues } from '../editor/merge-tags';
31
+ import type { ExporterConfig } from '../editor/types';
31
32
 
32
33
  type SocialExporter = (
33
34
  renderValues: ContentValues & SocialValues,
@@ -45,6 +46,7 @@ type SocialExporter = (
45
46
  rowCells: number[];
46
47
  rowValues: RowValues;
47
48
  bodyValues: BodyValues;
49
+ exporterConfig: ExporterConfig;
48
50
 
49
51
  embeddedValues: Record<string, unknown>;
50
52
  mergeTagState: {
@@ -148,6 +148,7 @@ import type { ColumnValues } from '../containers/column';
148
148
  import type { ContentValues } from '../containers/content';
149
149
  import type { RowValues } from '../containers/row';
150
150
  import type { MergeTagsValues } from '../editor/merge-tags';
151
+ import type { ExporterConfig } from '../editor/types';
151
152
 
152
153
  type TableExporter = (
153
154
  renderValues: ContentValues & TableValues,
@@ -165,6 +166,7 @@ type TableExporter = (
165
166
  rowCells: number[];
166
167
  rowValues: RowValues;
167
168
  bodyValues: BodyValues;
169
+ exporterConfig: ExporterConfig;
168
170
 
169
171
  embeddedValues: Record<string, unknown>;
170
172
  mergeTagState: {
@@ -46,6 +46,7 @@ import type { ColumnValues } from '../containers/column';
46
46
  import type { ContentValues } from '../containers/content';
47
47
  import type { RowValues } from '../containers/row';
48
48
  import type { MergeTagsValues } from '../editor/merge-tags';
49
+ import type { ExporterConfig } from '../editor/types';
49
50
 
50
51
  type TextExporter = (
51
52
  renderValues: ContentValues & TextValues,
@@ -63,6 +64,7 @@ type TextExporter = (
63
64
  rowCells: number[];
64
65
  rowValues: RowValues;
65
66
  bodyValues: BodyValues;
67
+ exporterConfig: ExporterConfig;
66
68
 
67
69
  embeddedValues: Record<string, unknown>;
68
70
  mergeTagState: {
@@ -57,6 +57,7 @@ import type { ColumnValues } from '../containers/column';
57
57
  import type { ContentValues } from '../containers/content';
58
58
  import type { RowValues } from '../containers/row';
59
59
  import type { MergeTagsValues } from '../editor/merge-tags';
60
+ import type { ExporterConfig } from '../editor/types';
60
61
 
61
62
  type TimerExporter = (
62
63
  renderValues: ContentValues & TimerValues,
@@ -74,6 +75,7 @@ type TimerExporter = (
74
75
  rowCells: number[];
75
76
  rowValues: RowValues;
76
77
  bodyValues: BodyValues;
78
+ exporterConfig: ExporterConfig;
77
79
 
78
80
  embeddedValues: Record<string, unknown>;
79
81
  mergeTagState: {
@@ -42,6 +42,7 @@ import type { ColumnValues } from '../containers/column';
42
42
  import type { ContentValues } from '../containers/content';
43
43
  import type { RowValues } from '../containers/row';
44
44
  import type { MergeTagsValues } from '../editor/merge-tags';
45
+ import type { ExporterConfig } from '../editor/types';
45
46
 
46
47
  type VideoExporter = (
47
48
  renderValues: ContentValues & VideoValues,
@@ -59,6 +60,7 @@ type VideoExporter = (
59
60
  rowCells: number[];
60
61
  rowValues: RowValues;
61
62
  bodyValues: BodyValues;
63
+ exporterConfig: ExporterConfig;
62
64
 
63
65
  embeddedValues: Record<string, unknown>;
64
66
  mergeTagState: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unlayer/types",
3
- "version": "1.390.0",
3
+ "version": "1.392.0",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "types": "./dist/index.d.ts",