frontbacked-svg 5.0.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.
@@ -0,0 +1,316 @@
1
+ import { INode } from 'svgson';
2
+ import { Timestamp } from 'firebase/firestore';
3
+
4
+ interface Doc {
5
+ [x: string]: any;
6
+ }
7
+ interface FileMap {
8
+ [x: string]: string;
9
+ }
10
+ interface FileImage {
11
+ id: string;
12
+ image: File;
13
+ }
14
+ interface FilterArgs {
15
+ [x: string]: any;
16
+ }
17
+ interface Filters {
18
+ [x: string]: {
19
+ id: string;
20
+ filter: (base64ImageString: string, args?: FilterArgs | null) => Promise<string>;
21
+ isAutomatic?: boolean;
22
+ render?: any;
23
+ };
24
+ }
25
+ interface Declaration {
26
+ property: string;
27
+ value: string;
28
+ }
29
+ interface CssDeclarations {
30
+ declarations: Declaration[];
31
+ shouldReplace?: boolean;
32
+ }
33
+ interface CssAction {
34
+ [identifier: string]: CssDeclarations;
35
+ }
36
+ interface CssActions {
37
+ if_selector?: CssAction | null;
38
+ if_property?: CssAction | null;
39
+ if_property_and_value?: CssAction | null;
40
+ }
41
+ interface Mask {
42
+ filter_id: string;
43
+ args?: FilterArgs | null;
44
+ }
45
+ interface Filter {
46
+ [filterId: string]: Mask | null;
47
+ }
48
+ interface TextSelectSettings {
49
+ [x: string]: {
50
+ name: string;
51
+ value: string;
52
+ };
53
+ }
54
+ interface MaskMap {
55
+ [fieldId: string]: Filter | null;
56
+ }
57
+ interface MapWithName {
58
+ [x: string]: {
59
+ name: string;
60
+ [x: string]: any;
61
+ };
62
+ }
63
+ interface FieldsData {
64
+ is_freemium: boolean;
65
+ template_id: string;
66
+ [x: string]: any;
67
+ }
68
+ interface Fields extends MapWithName {
69
+ [x: string]: Field;
70
+ }
71
+ interface Field {
72
+ id: string;
73
+ name: string;
74
+ type: string;
75
+ isEditable?: boolean;
76
+ index?: number | string | null;
77
+ options?: {
78
+ [x: string]: Field;
79
+ };
80
+ selections?: {
81
+ [x: string]: {
82
+ name: string;
83
+ value: string;
84
+ };
85
+ };
86
+ useImageText?: string | null;
87
+ optional?: boolean | null;
88
+ [x: string]: any;
89
+ }
90
+ interface Template {
91
+ id: string;
92
+ name: string;
93
+ logo: string;
94
+ is_default: boolean;
95
+ data_url: string;
96
+ split_on_download?: boolean;
97
+ split_on_download_hr?: boolean;
98
+ [x: string]: any;
99
+ }
100
+ interface TemplateData {
101
+ svg: string;
102
+ fields: Fields;
103
+ images: FileMap;
104
+ masks?: MaskMap | null;
105
+ cssActions?: CssActions | null;
106
+ }
107
+ interface Templates extends MapWithName {
108
+ [x: string]: Template;
109
+ }
110
+ interface TemplatesResults {
111
+ templatesLoading: boolean;
112
+ templatesError?: string | null;
113
+ selectedTemplateLoading: boolean;
114
+ selectedTemplateError?: string | null;
115
+ parsingTemplate: boolean;
116
+ templates: Templates;
117
+ selectedTemplate?: Template | null;
118
+ selectedTemplateData?: TemplateData | null;
119
+ workingTemplate?: Template | null;
120
+ workingTemplateData?: TemplateData | null;
121
+ setAsDefaulTemplate: (is_default: boolean) => void;
122
+ setWorkingTemplate: (template: Template | null | undefined) => void;
123
+ setWorkingTemplateData: (template: TemplateData | null | undefined) => void;
124
+ selectTemplate: (selectedTemplateId: string) => void;
125
+ parseTemplateSvg: (svg: string, isNew: boolean) => Promise<{
126
+ template: Template;
127
+ templateData: TemplateData;
128
+ } | null>;
129
+ saveTemplate: (onSetProgressStatus?: (message: string, pct?: number | null) => void) => Promise<string | null>;
130
+ deleteTemplate: (id: string) => void;
131
+ getDefaultTemplateId: (templates: Templates) => string;
132
+ currentTemplateId?: string | null;
133
+ }
134
+ interface Font {
135
+ name: string;
136
+ id: string;
137
+ file?: File | null;
138
+ ext?: string | null;
139
+ url?: string | null;
140
+ dataUrl?: string | null;
141
+ readError?: string | null;
142
+ writeError?: string | null;
143
+ }
144
+ interface FontsMap {
145
+ [x: string]: Font;
146
+ }
147
+ interface ImageUploadMaskInfo {
148
+ imageId: string;
149
+ filterId: string;
150
+ mask: Mask;
151
+ }
152
+
153
+ declare const isVoid: (value: any) => boolean;
154
+ declare const nullOrEmpty: (value: any) => boolean;
155
+ declare function base64ToSvg(base64String: string): string;
156
+ declare function genId(length: number): string;
157
+ declare function base64ToFile(id: string, base64String: string): File | Buffer;
158
+ declare function arrayToMap(attr: string, arr: {
159
+ [x: string]: any;
160
+ }[], keyParser?: (key: string) => string): {
161
+ [x: string]: {
162
+ [x: string]: any;
163
+ };
164
+ };
165
+ declare function orderOptions(obj: {
166
+ [x: string]: Field;
167
+ }): {
168
+ [x: string]: Field;
169
+ };
170
+ declare const orderByName: (dataMap: MapWithName) => MapWithName;
171
+ declare function isTheSameUrl(url?: string, url2?: string): boolean;
172
+ declare function expandImagesMap(imagesMap: FileMap, onFile: (id: string, image: string) => Promise<FileMap | null>): Promise<FileMap>;
173
+ declare const mergeTemplateData: (storageHost: string, newTemplateData: TemplateData, oldTemplateData?: TemplateData | null) => Promise<TemplateData>;
174
+ declare const isUploadedFileUrl: (url: string) => boolean;
175
+ declare const isImageDataUrl: (url: string) => boolean;
176
+ declare const getImage: (id: string, images: FileMap, suffix?: string | null) => string;
177
+ declare const getImageMask: (id: string, masks?: MaskMap | null) => Filter | null;
178
+ declare function cleanFilename(text: string): string;
179
+ declare function convertPngBase64ImagesToJpeg(base64Map: {
180
+ [x: string]: string;
181
+ }): Promise<{
182
+ [x: string]: string;
183
+ }>;
184
+ declare function convertPngBase64ImagesWithUPNG(base64Map: {
185
+ [x: string]: string;
186
+ }): Promise<{
187
+ [x: string]: string;
188
+ }>;
189
+ declare const buildImageSelectName: (fieldName: string, name: string) => string;
190
+ declare const buildImageSelectNameReverse: (fieldName: string, formattedName: string) => string;
191
+ declare const breakName: (name: string) => string;
192
+ declare const showField: (field: Field, fields: Fields, data: Doc) => boolean;
193
+ declare const splitSvgElementId: (id: string) => {
194
+ name: string;
195
+ type?: undefined;
196
+ selectIndex?: undefined;
197
+ typeAndSelectIndex?: undefined;
198
+ } | {
199
+ name: string;
200
+ type: string;
201
+ selectIndex: string;
202
+ typeAndSelectIndex: string;
203
+ };
204
+ declare const useDataForRandSeed: (key: string) => boolean;
205
+ declare const valueOfParseValue: (key: string, value: string, data?: FieldsData, fields?: Fields) => string;
206
+ declare const actionsStorageKey: (collectionName: string, id: string) => string;
207
+ declare const fileFieldStorageKey: (collectionName: string, id: string, fieldName: string) => string;
208
+ declare const fileDocStorageKey: (collectionName: string, id: string) => string;
209
+ declare const fileCollectionStorageKey: (collectionName: string) => string;
210
+ declare const isBrowser: () => boolean;
211
+ declare const saveFileFieldFile: (collectionName: string, id: string, fieldName: string, value: string) => void;
212
+ declare const getFileFieldFile: (collectionName: string, id: string, fieldName: string) => string | null;
213
+ declare const moveFileFieldFile: (collectionName: string, oldId: string, newId: string, fieldName: string) => Promise<void>;
214
+ declare const deleteFileFieldFile: (collectionName: string, id: string, fieldName: string) => Promise<void>;
215
+ declare const deleteDataWithKeyPrefix: (keyPrefix: string) => void;
216
+ declare const setR2Host: (url: string, r2Domain: string) => string;
217
+
218
+ declare const fetchImageForBase64: (storageHost: string, url: string, alwaysResolve?: boolean) => Promise<string | null>;
219
+ declare function compareBase64(base64A: string, base64B: string): boolean;
220
+ declare function removeQueryString(url: string, queryString: string): string;
221
+ declare function removeUpdateQueryString(url: string): string;
222
+ declare function incrementUpdateQueryString(url: string): string;
223
+ declare function getUrlUpdatesCount(url: string): number;
224
+ declare function mergeImages(storageHost: string, oldImages: FileMap, newImages: FileMap): Promise<FileMap>;
225
+ declare function generateWatermark(imageUrl: string, width: number, height: number, opacity?: number): Promise<string>;
226
+
227
+ interface Point {
228
+ x: number;
229
+ y: number;
230
+ }
231
+ interface Quadrilateral {
232
+ topLeft: Point;
233
+ topRight: Point;
234
+ bottomRight: Point;
235
+ bottomLeft: Point;
236
+ }
237
+ interface AnalyzeResult {
238
+ rotationAngle: number;
239
+ scaleX: number;
240
+ scaleY: number;
241
+ shearX: number;
242
+ shearY: number;
243
+ center: Point;
244
+ width: number;
245
+ height: number;
246
+ corners: Quadrilateral;
247
+ }
248
+ declare function base64ToImage(base64: string): Promise<any>;
249
+ declare function analyzeImage(imageA: any, debug?: boolean): Promise<AnalyzeResult>;
250
+
251
+ declare const FILTERS: Filters;
252
+
253
+ declare const getIdentifier: (selectorOrProperty: string, propertyValue?: string) => string;
254
+ declare function parseValueUnit(input: string): {
255
+ value: string;
256
+ unit: string;
257
+ };
258
+ declare function parseAndModifyCSS(cssString: string, callback: (selector: string, declarations: Declaration[]) => Declaration[]): string;
259
+
260
+ declare function collectFontFamilies(node: INode, fontFamilies?: Set<string>): Set<string>;
261
+ declare function extractFontFamiliesFromCSS(cssContent: string, fontFamilies: Set<string>): void;
262
+ declare function getFontFamiliesFromSVG(svgString: string): Promise<string[]>;
263
+ declare function getFontId(fontName: string): string;
264
+ declare function generateFontMap(fontsLocationDomain: string, fontNames: string[], fontExtensions?: string[]): Promise<FontsMap>;
265
+ declare function getFontFormat(extension: string): string;
266
+ declare function createFontThumbnail(fontBase64: string, fontFormat: string): Promise<string>;
267
+
268
+ declare const downloadSvgAsImage: (svgString: string, format?: "png" | "jpeg" | "pdf" | string, fileName?: string, downloadSide?: "front" | "back" | "front_hr" | "back_hr", skipBrowserDownload?: boolean | null) => Promise<string>;
269
+
270
+ declare const getDefaultFieldsValue: (fieldsData?: FieldsData, fields?: Fields | null, templateId?: string | null, fieldString?: string | null, currentTemplateId?: string | null) => {
271
+ newFieldString: string | undefined;
272
+ newCurrentTemplateId: string | undefined;
273
+ defaultFieldsData: {
274
+ is_freemium: boolean;
275
+ template_id: string;
276
+ } | undefined;
277
+ };
278
+
279
+ interface Format {
280
+ [x: string]: string;
281
+ }
282
+ declare const timestampToDate: (timestamp: Timestamp | Date | null | undefined) => Date;
283
+ declare const dateToTimestamp: (date: Date | Timestamp | null | undefined) => Timestamp;
284
+ declare function joinTimeSegments(date: Date, formats: (Format | number | string)[], separator: string): string;
285
+ declare const secondsToTimeSegments: (seconds: number, onSegmentsFrame?: (timeFrame: string, timeFrameUnit: "Y" | "M" | "D" | "H" | "Min" | "S", timeFrameIndex: number) => string) => string;
286
+ declare const parsePaymentWindow: (seconds: number) => {
287
+ time: string;
288
+ time_unit: string;
289
+ };
290
+ declare const timestampToGmt: (localTimestamp: number) => number;
291
+ declare const gmtTimestampToLocal: (gmtTimestamp: number) => number;
292
+
293
+ declare function cropImage(imageUrl: string): Promise<string>;
294
+ declare function isBlankImage(imageUrl: string): Promise<boolean>;
295
+ declare function getImageDimension(imageUrl: string): Promise<{
296
+ width: number;
297
+ height: number;
298
+ }>;
299
+ declare function imageToStamp(base64Image: string, color: [number, number, number], holePct: number): Promise<string | null>;
300
+ declare function getImageColor(base64ImageUrl: string, useDominantColor?: boolean): Promise<[number, number, number] | null>;
301
+ declare function reduceBase64Image(base64: string, targetWidth: number, quality?: number): Promise<unknown>;
302
+
303
+ declare function rotateTransformValue(degree: number, x: number, y: number, width: number, height: number): string;
304
+ declare const getTextAreaMaxLength: (textAreaNode: INode, textInput?: string, tag?: string, maxCharsPerLine?: number, showWatermark?: boolean | null) => {
305
+ maxLines: number;
306
+ defaultInputLines: string[];
307
+ };
308
+ declare const getSvg: (storageHost: string, data: FieldsData, templateData: TemplateData, fonts?: FontsMap | null, showWatermark?: boolean | null, width?: number | "max" | null, tempMask?: MaskMap | null) => Promise<string>;
309
+ declare const trimId: (name: string) => string;
310
+ declare const splitElementNameWithDirective: (nameWithDirective: string) => {
311
+ name: string;
312
+ directive: string;
313
+ };
314
+ declare const buildTemplateDataFromSvg: (base64?: string | null) => Promise<TemplateData | null>;
315
+
316
+ export { type AnalyzeResult, type CssAction, type CssActions, type CssDeclarations, type Declaration, type Doc, FILTERS, type Field, type Fields, type FieldsData, type FileImage, type FileMap, type Filter, type FilterArgs, type Filters, type Font, type FontsMap, type ImageUploadMaskInfo, type MapWithName, type Mask, type MaskMap, type Template, type TemplateData, type Templates, type TemplatesResults, type TextSelectSettings, actionsStorageKey, analyzeImage, arrayToMap, base64ToFile, base64ToImage, base64ToSvg, breakName, buildImageSelectName, buildImageSelectNameReverse, buildTemplateDataFromSvg, cleanFilename, collectFontFamilies, compareBase64, convertPngBase64ImagesToJpeg, convertPngBase64ImagesWithUPNG, createFontThumbnail, cropImage, dateToTimestamp, deleteDataWithKeyPrefix, deleteFileFieldFile, downloadSvgAsImage, expandImagesMap, extractFontFamiliesFromCSS, fetchImageForBase64, fileCollectionStorageKey, fileDocStorageKey, fileFieldStorageKey, genId, generateFontMap, generateWatermark, getDefaultFieldsValue, getFileFieldFile, getFontFamiliesFromSVG, getFontFormat, getFontId, getIdentifier, getImage, getImageColor, getImageDimension, getImageMask, getSvg, getTextAreaMaxLength, getUrlUpdatesCount, gmtTimestampToLocal, imageToStamp, incrementUpdateQueryString, isBlankImage, isBrowser, isImageDataUrl, isTheSameUrl, isUploadedFileUrl, isVoid, joinTimeSegments, mergeImages, mergeTemplateData, moveFileFieldFile, nullOrEmpty, orderByName, orderOptions, parseAndModifyCSS, parsePaymentWindow, parseValueUnit, reduceBase64Image, removeQueryString, removeUpdateQueryString, rotateTransformValue, saveFileFieldFile, secondsToTimeSegments, setR2Host, showField, splitElementNameWithDirective, splitSvgElementId, timestampToDate, timestampToGmt, trimId, useDataForRandSeed, valueOfParseValue };
package/dist/main.d.ts ADDED
@@ -0,0 +1,316 @@
1
+ import { INode } from 'svgson';
2
+ import { Timestamp } from 'firebase/firestore';
3
+
4
+ interface Doc {
5
+ [x: string]: any;
6
+ }
7
+ interface FileMap {
8
+ [x: string]: string;
9
+ }
10
+ interface FileImage {
11
+ id: string;
12
+ image: File;
13
+ }
14
+ interface FilterArgs {
15
+ [x: string]: any;
16
+ }
17
+ interface Filters {
18
+ [x: string]: {
19
+ id: string;
20
+ filter: (base64ImageString: string, args?: FilterArgs | null) => Promise<string>;
21
+ isAutomatic?: boolean;
22
+ render?: any;
23
+ };
24
+ }
25
+ interface Declaration {
26
+ property: string;
27
+ value: string;
28
+ }
29
+ interface CssDeclarations {
30
+ declarations: Declaration[];
31
+ shouldReplace?: boolean;
32
+ }
33
+ interface CssAction {
34
+ [identifier: string]: CssDeclarations;
35
+ }
36
+ interface CssActions {
37
+ if_selector?: CssAction | null;
38
+ if_property?: CssAction | null;
39
+ if_property_and_value?: CssAction | null;
40
+ }
41
+ interface Mask {
42
+ filter_id: string;
43
+ args?: FilterArgs | null;
44
+ }
45
+ interface Filter {
46
+ [filterId: string]: Mask | null;
47
+ }
48
+ interface TextSelectSettings {
49
+ [x: string]: {
50
+ name: string;
51
+ value: string;
52
+ };
53
+ }
54
+ interface MaskMap {
55
+ [fieldId: string]: Filter | null;
56
+ }
57
+ interface MapWithName {
58
+ [x: string]: {
59
+ name: string;
60
+ [x: string]: any;
61
+ };
62
+ }
63
+ interface FieldsData {
64
+ is_freemium: boolean;
65
+ template_id: string;
66
+ [x: string]: any;
67
+ }
68
+ interface Fields extends MapWithName {
69
+ [x: string]: Field;
70
+ }
71
+ interface Field {
72
+ id: string;
73
+ name: string;
74
+ type: string;
75
+ isEditable?: boolean;
76
+ index?: number | string | null;
77
+ options?: {
78
+ [x: string]: Field;
79
+ };
80
+ selections?: {
81
+ [x: string]: {
82
+ name: string;
83
+ value: string;
84
+ };
85
+ };
86
+ useImageText?: string | null;
87
+ optional?: boolean | null;
88
+ [x: string]: any;
89
+ }
90
+ interface Template {
91
+ id: string;
92
+ name: string;
93
+ logo: string;
94
+ is_default: boolean;
95
+ data_url: string;
96
+ split_on_download?: boolean;
97
+ split_on_download_hr?: boolean;
98
+ [x: string]: any;
99
+ }
100
+ interface TemplateData {
101
+ svg: string;
102
+ fields: Fields;
103
+ images: FileMap;
104
+ masks?: MaskMap | null;
105
+ cssActions?: CssActions | null;
106
+ }
107
+ interface Templates extends MapWithName {
108
+ [x: string]: Template;
109
+ }
110
+ interface TemplatesResults {
111
+ templatesLoading: boolean;
112
+ templatesError?: string | null;
113
+ selectedTemplateLoading: boolean;
114
+ selectedTemplateError?: string | null;
115
+ parsingTemplate: boolean;
116
+ templates: Templates;
117
+ selectedTemplate?: Template | null;
118
+ selectedTemplateData?: TemplateData | null;
119
+ workingTemplate?: Template | null;
120
+ workingTemplateData?: TemplateData | null;
121
+ setAsDefaulTemplate: (is_default: boolean) => void;
122
+ setWorkingTemplate: (template: Template | null | undefined) => void;
123
+ setWorkingTemplateData: (template: TemplateData | null | undefined) => void;
124
+ selectTemplate: (selectedTemplateId: string) => void;
125
+ parseTemplateSvg: (svg: string, isNew: boolean) => Promise<{
126
+ template: Template;
127
+ templateData: TemplateData;
128
+ } | null>;
129
+ saveTemplate: (onSetProgressStatus?: (message: string, pct?: number | null) => void) => Promise<string | null>;
130
+ deleteTemplate: (id: string) => void;
131
+ getDefaultTemplateId: (templates: Templates) => string;
132
+ currentTemplateId?: string | null;
133
+ }
134
+ interface Font {
135
+ name: string;
136
+ id: string;
137
+ file?: File | null;
138
+ ext?: string | null;
139
+ url?: string | null;
140
+ dataUrl?: string | null;
141
+ readError?: string | null;
142
+ writeError?: string | null;
143
+ }
144
+ interface FontsMap {
145
+ [x: string]: Font;
146
+ }
147
+ interface ImageUploadMaskInfo {
148
+ imageId: string;
149
+ filterId: string;
150
+ mask: Mask;
151
+ }
152
+
153
+ declare const isVoid: (value: any) => boolean;
154
+ declare const nullOrEmpty: (value: any) => boolean;
155
+ declare function base64ToSvg(base64String: string): string;
156
+ declare function genId(length: number): string;
157
+ declare function base64ToFile(id: string, base64String: string): File | Buffer;
158
+ declare function arrayToMap(attr: string, arr: {
159
+ [x: string]: any;
160
+ }[], keyParser?: (key: string) => string): {
161
+ [x: string]: {
162
+ [x: string]: any;
163
+ };
164
+ };
165
+ declare function orderOptions(obj: {
166
+ [x: string]: Field;
167
+ }): {
168
+ [x: string]: Field;
169
+ };
170
+ declare const orderByName: (dataMap: MapWithName) => MapWithName;
171
+ declare function isTheSameUrl(url?: string, url2?: string): boolean;
172
+ declare function expandImagesMap(imagesMap: FileMap, onFile: (id: string, image: string) => Promise<FileMap | null>): Promise<FileMap>;
173
+ declare const mergeTemplateData: (storageHost: string, newTemplateData: TemplateData, oldTemplateData?: TemplateData | null) => Promise<TemplateData>;
174
+ declare const isUploadedFileUrl: (url: string) => boolean;
175
+ declare const isImageDataUrl: (url: string) => boolean;
176
+ declare const getImage: (id: string, images: FileMap, suffix?: string | null) => string;
177
+ declare const getImageMask: (id: string, masks?: MaskMap | null) => Filter | null;
178
+ declare function cleanFilename(text: string): string;
179
+ declare function convertPngBase64ImagesToJpeg(base64Map: {
180
+ [x: string]: string;
181
+ }): Promise<{
182
+ [x: string]: string;
183
+ }>;
184
+ declare function convertPngBase64ImagesWithUPNG(base64Map: {
185
+ [x: string]: string;
186
+ }): Promise<{
187
+ [x: string]: string;
188
+ }>;
189
+ declare const buildImageSelectName: (fieldName: string, name: string) => string;
190
+ declare const buildImageSelectNameReverse: (fieldName: string, formattedName: string) => string;
191
+ declare const breakName: (name: string) => string;
192
+ declare const showField: (field: Field, fields: Fields, data: Doc) => boolean;
193
+ declare const splitSvgElementId: (id: string) => {
194
+ name: string;
195
+ type?: undefined;
196
+ selectIndex?: undefined;
197
+ typeAndSelectIndex?: undefined;
198
+ } | {
199
+ name: string;
200
+ type: string;
201
+ selectIndex: string;
202
+ typeAndSelectIndex: string;
203
+ };
204
+ declare const useDataForRandSeed: (key: string) => boolean;
205
+ declare const valueOfParseValue: (key: string, value: string, data?: FieldsData, fields?: Fields) => string;
206
+ declare const actionsStorageKey: (collectionName: string, id: string) => string;
207
+ declare const fileFieldStorageKey: (collectionName: string, id: string, fieldName: string) => string;
208
+ declare const fileDocStorageKey: (collectionName: string, id: string) => string;
209
+ declare const fileCollectionStorageKey: (collectionName: string) => string;
210
+ declare const isBrowser: () => boolean;
211
+ declare const saveFileFieldFile: (collectionName: string, id: string, fieldName: string, value: string) => void;
212
+ declare const getFileFieldFile: (collectionName: string, id: string, fieldName: string) => string | null;
213
+ declare const moveFileFieldFile: (collectionName: string, oldId: string, newId: string, fieldName: string) => Promise<void>;
214
+ declare const deleteFileFieldFile: (collectionName: string, id: string, fieldName: string) => Promise<void>;
215
+ declare const deleteDataWithKeyPrefix: (keyPrefix: string) => void;
216
+ declare const setR2Host: (url: string, r2Domain: string) => string;
217
+
218
+ declare const fetchImageForBase64: (storageHost: string, url: string, alwaysResolve?: boolean) => Promise<string | null>;
219
+ declare function compareBase64(base64A: string, base64B: string): boolean;
220
+ declare function removeQueryString(url: string, queryString: string): string;
221
+ declare function removeUpdateQueryString(url: string): string;
222
+ declare function incrementUpdateQueryString(url: string): string;
223
+ declare function getUrlUpdatesCount(url: string): number;
224
+ declare function mergeImages(storageHost: string, oldImages: FileMap, newImages: FileMap): Promise<FileMap>;
225
+ declare function generateWatermark(imageUrl: string, width: number, height: number, opacity?: number): Promise<string>;
226
+
227
+ interface Point {
228
+ x: number;
229
+ y: number;
230
+ }
231
+ interface Quadrilateral {
232
+ topLeft: Point;
233
+ topRight: Point;
234
+ bottomRight: Point;
235
+ bottomLeft: Point;
236
+ }
237
+ interface AnalyzeResult {
238
+ rotationAngle: number;
239
+ scaleX: number;
240
+ scaleY: number;
241
+ shearX: number;
242
+ shearY: number;
243
+ center: Point;
244
+ width: number;
245
+ height: number;
246
+ corners: Quadrilateral;
247
+ }
248
+ declare function base64ToImage(base64: string): Promise<any>;
249
+ declare function analyzeImage(imageA: any, debug?: boolean): Promise<AnalyzeResult>;
250
+
251
+ declare const FILTERS: Filters;
252
+
253
+ declare const getIdentifier: (selectorOrProperty: string, propertyValue?: string) => string;
254
+ declare function parseValueUnit(input: string): {
255
+ value: string;
256
+ unit: string;
257
+ };
258
+ declare function parseAndModifyCSS(cssString: string, callback: (selector: string, declarations: Declaration[]) => Declaration[]): string;
259
+
260
+ declare function collectFontFamilies(node: INode, fontFamilies?: Set<string>): Set<string>;
261
+ declare function extractFontFamiliesFromCSS(cssContent: string, fontFamilies: Set<string>): void;
262
+ declare function getFontFamiliesFromSVG(svgString: string): Promise<string[]>;
263
+ declare function getFontId(fontName: string): string;
264
+ declare function generateFontMap(fontsLocationDomain: string, fontNames: string[], fontExtensions?: string[]): Promise<FontsMap>;
265
+ declare function getFontFormat(extension: string): string;
266
+ declare function createFontThumbnail(fontBase64: string, fontFormat: string): Promise<string>;
267
+
268
+ declare const downloadSvgAsImage: (svgString: string, format?: "png" | "jpeg" | "pdf" | string, fileName?: string, downloadSide?: "front" | "back" | "front_hr" | "back_hr", skipBrowserDownload?: boolean | null) => Promise<string>;
269
+
270
+ declare const getDefaultFieldsValue: (fieldsData?: FieldsData, fields?: Fields | null, templateId?: string | null, fieldString?: string | null, currentTemplateId?: string | null) => {
271
+ newFieldString: string | undefined;
272
+ newCurrentTemplateId: string | undefined;
273
+ defaultFieldsData: {
274
+ is_freemium: boolean;
275
+ template_id: string;
276
+ } | undefined;
277
+ };
278
+
279
+ interface Format {
280
+ [x: string]: string;
281
+ }
282
+ declare const timestampToDate: (timestamp: Timestamp | Date | null | undefined) => Date;
283
+ declare const dateToTimestamp: (date: Date | Timestamp | null | undefined) => Timestamp;
284
+ declare function joinTimeSegments(date: Date, formats: (Format | number | string)[], separator: string): string;
285
+ declare const secondsToTimeSegments: (seconds: number, onSegmentsFrame?: (timeFrame: string, timeFrameUnit: "Y" | "M" | "D" | "H" | "Min" | "S", timeFrameIndex: number) => string) => string;
286
+ declare const parsePaymentWindow: (seconds: number) => {
287
+ time: string;
288
+ time_unit: string;
289
+ };
290
+ declare const timestampToGmt: (localTimestamp: number) => number;
291
+ declare const gmtTimestampToLocal: (gmtTimestamp: number) => number;
292
+
293
+ declare function cropImage(imageUrl: string): Promise<string>;
294
+ declare function isBlankImage(imageUrl: string): Promise<boolean>;
295
+ declare function getImageDimension(imageUrl: string): Promise<{
296
+ width: number;
297
+ height: number;
298
+ }>;
299
+ declare function imageToStamp(base64Image: string, color: [number, number, number], holePct: number): Promise<string | null>;
300
+ declare function getImageColor(base64ImageUrl: string, useDominantColor?: boolean): Promise<[number, number, number] | null>;
301
+ declare function reduceBase64Image(base64: string, targetWidth: number, quality?: number): Promise<unknown>;
302
+
303
+ declare function rotateTransformValue(degree: number, x: number, y: number, width: number, height: number): string;
304
+ declare const getTextAreaMaxLength: (textAreaNode: INode, textInput?: string, tag?: string, maxCharsPerLine?: number, showWatermark?: boolean | null) => {
305
+ maxLines: number;
306
+ defaultInputLines: string[];
307
+ };
308
+ declare const getSvg: (storageHost: string, data: FieldsData, templateData: TemplateData, fonts?: FontsMap | null, showWatermark?: boolean | null, width?: number | "max" | null, tempMask?: MaskMap | null) => Promise<string>;
309
+ declare const trimId: (name: string) => string;
310
+ declare const splitElementNameWithDirective: (nameWithDirective: string) => {
311
+ name: string;
312
+ directive: string;
313
+ };
314
+ declare const buildTemplateDataFromSvg: (base64?: string | null) => Promise<TemplateData | null>;
315
+
316
+ export { type AnalyzeResult, type CssAction, type CssActions, type CssDeclarations, type Declaration, type Doc, FILTERS, type Field, type Fields, type FieldsData, type FileImage, type FileMap, type Filter, type FilterArgs, type Filters, type Font, type FontsMap, type ImageUploadMaskInfo, type MapWithName, type Mask, type MaskMap, type Template, type TemplateData, type Templates, type TemplatesResults, type TextSelectSettings, actionsStorageKey, analyzeImage, arrayToMap, base64ToFile, base64ToImage, base64ToSvg, breakName, buildImageSelectName, buildImageSelectNameReverse, buildTemplateDataFromSvg, cleanFilename, collectFontFamilies, compareBase64, convertPngBase64ImagesToJpeg, convertPngBase64ImagesWithUPNG, createFontThumbnail, cropImage, dateToTimestamp, deleteDataWithKeyPrefix, deleteFileFieldFile, downloadSvgAsImage, expandImagesMap, extractFontFamiliesFromCSS, fetchImageForBase64, fileCollectionStorageKey, fileDocStorageKey, fileFieldStorageKey, genId, generateFontMap, generateWatermark, getDefaultFieldsValue, getFileFieldFile, getFontFamiliesFromSVG, getFontFormat, getFontId, getIdentifier, getImage, getImageColor, getImageDimension, getImageMask, getSvg, getTextAreaMaxLength, getUrlUpdatesCount, gmtTimestampToLocal, imageToStamp, incrementUpdateQueryString, isBlankImage, isBrowser, isImageDataUrl, isTheSameUrl, isUploadedFileUrl, isVoid, joinTimeSegments, mergeImages, mergeTemplateData, moveFileFieldFile, nullOrEmpty, orderByName, orderOptions, parseAndModifyCSS, parsePaymentWindow, parseValueUnit, reduceBase64Image, removeQueryString, removeUpdateQueryString, rotateTransformValue, saveFileFieldFile, secondsToTimeSegments, setR2Host, showField, splitElementNameWithDirective, splitSvgElementId, timestampToDate, timestampToGmt, trimId, useDataForRandSeed, valueOfParseValue };