dromo-uploader-js 2.0.7 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,480 +1,514 @@
1
- export declare type IRequiredValidator = {
2
- errorMessage?: string | undefined;
3
- level?: ("info" | "warning" | "error") | undefined;
4
- validate: "required";
5
- };
6
- export declare type IUniqueValidator = {
7
- errorMessage?: string | undefined;
8
- level?: ("info" | "warning" | "error") | undefined;
9
- validate: "unique" | "unique_case_insensitive";
10
- };
11
- export declare type IUniqueWithValidator = {
12
- errorMessage?: string | undefined;
13
- level?: ("info" | "warning" | "error") | undefined;
14
- validate: "unique_with";
15
- uniqueKey: string;
16
- };
17
- export declare type IRegexValidator = {
18
- errorMessage?: string | undefined;
19
- level?: ("info" | "warning" | "error") | undefined;
20
- validate: "regex_match" | "regex_exclude";
21
- regex: string | RegExp;
22
- regexOptions?: {
23
- ignoreCase?: boolean | undefined;
24
- dotAll?: boolean | undefined;
25
- multiline?: boolean | undefined;
26
- unicode?: boolean | undefined;
27
- } | undefined;
28
- };
29
- export declare type IRequireWithValidator = {
30
- errorMessage?: string | undefined;
31
- level?: ("info" | "warning" | "error") | undefined;
32
- validate: "require_with" | "require_without" | "require_with_all" | "require_without_all";
33
- fields: string[];
34
- };
35
- export declare type IRequireWithValuesValidator = {
36
- errorMessage?: string | undefined;
37
- level?: ("info" | "warning" | "error") | undefined;
38
- validate: "require_with_values" | "require_without_values" | "require_with_all_values" | "require_without_all_values";
39
- fieldValues: {
40
- [x: string]: any;
41
- };
42
- };
43
- export declare type IValidatorField = IRequiredValidator | IUniqueValidator | IUniqueWithValidator | IRegexValidator | IRequireWithValidator | IRequireWithValuesValidator;
44
- export declare type IStringField = {
45
- label: string;
46
- key: string;
47
- description?: string | undefined;
48
- alternateMatches?: string[] | undefined;
49
- validators?: IValidatorField[];
50
- invalidValueMessage?: string | undefined;
51
- readOnly?: boolean;
52
- hidden?: boolean;
53
- requireMapping?: boolean | undefined;
54
- type?: ("string" | ["string", {
55
- [x: string]: never;
56
- }]) | undefined;
57
- };
58
- export declare type ICheckboxField = {
59
- label: string;
60
- key: string;
61
- description?: string | undefined;
62
- alternateMatches?: string[] | undefined;
63
- validators?: IValidatorField[];
64
- invalidValueMessage?: string | undefined;
65
- readOnly?: boolean;
66
- hidden?: boolean;
67
- requireMapping?: boolean | undefined;
68
- type: "checkbox" | ["checkbox", {
69
- [x: string]: never;
70
- }];
71
- };
72
- export declare type IEmailField = {
73
- label: string;
74
- key: string;
75
- description?: string | undefined;
76
- alternateMatches?: string[] | undefined;
77
- validators?: IValidatorField[];
78
- invalidValueMessage?: string | undefined;
79
- readOnly?: boolean;
80
- hidden?: boolean;
81
- requireMapping?: boolean | undefined;
82
- type: "email" | ["email", {
83
- [x: string]: never;
84
- }];
85
- };
86
- export declare type IDeveloperSelectOption = {
87
- label: string;
88
- value: string;
89
- alternateMatches?: string[] | undefined;
90
- };
91
- export declare type ISelectField = {
92
- label: string;
93
- key: string;
94
- description?: string | undefined;
95
- alternateMatches?: string[] | undefined;
96
- validators?: IValidatorField[];
97
- invalidValueMessage?: string | undefined;
98
- readOnly?: boolean;
99
- hidden?: boolean;
100
- requireMapping?: boolean | undefined;
101
- type: "select" | ["select", {
102
- [x: string]: never;
103
- }];
104
- selectOptions: IDeveloperSelectOption[];
105
- };
106
- export declare type INumberField = {
107
- label: string;
108
- key: string;
109
- description?: string | undefined;
110
- alternateMatches?: string[] | undefined;
111
- validators?: IValidatorField[];
112
- invalidValueMessage?: string | undefined;
113
- readOnly?: boolean;
114
- hidden?: boolean;
115
- requireMapping?: boolean | undefined;
116
- type: "number" | ["number", (("default" | "percent" | "percent_0" | "percent_1" | "percent_2" | "percent_3" | "percent_4" | "decimal_0" | "decimal_1" | "decimal_2" | "decimal_3" | "decimal_4" | "integer" | "plain" | "usd" | "usd_accounting" | "eur" | "gbp") | {
117
- preset?: ("default" | "percent" | "percent_0" | "percent_1" | "percent_2" | "percent_3" | "percent_4" | "decimal_0" | "decimal_1" | "decimal_2" | "decimal_3" | "decimal_4" | "integer" | "plain" | "usd" | "usd_accounting" | "eur" | "gbp") | undefined;
118
- round?: number | undefined;
119
- displayFormat?: {
120
- output?: ("currency" | "percent" | "byte" | "time" | "ordinal" | "number") | undefined;
121
- base?: ("decimal" | "binary" | "general") | undefined;
122
- characteristic?: number | undefined;
123
- prefix?: string | undefined;
124
- postfix?: string | undefined;
125
- forceAverage?: ("trillion" | "billion" | "million" | "thousand") | undefined;
126
- average?: boolean | undefined;
127
- currencyPosition?: ("prefix" | "infix" | "postfix") | undefined;
128
- currencySymbol?: string | undefined;
129
- totalLength?: number | undefined;
130
- mantissa?: number | undefined;
131
- optionalMantissa?: boolean | undefined;
132
- trimMantissa?: boolean | undefined;
133
- optionalCharacteristic?: boolean | undefined;
134
- thousandSeparated?: boolean | undefined;
135
- abbreviations?: {
136
- thousand?: string | undefined;
137
- million?: string | undefined;
138
- billion?: string | undefined;
139
- trillion?: string | undefined;
140
- } | undefined;
141
- negative?: ("sign" | "parenthesis") | undefined;
142
- forceSign?: boolean | undefined;
143
- spaceSeparated?: boolean | undefined;
144
- spaceSeparatedCurrency?: boolean | undefined;
145
- spaceSeparatedAbbreviation?: boolean | undefined;
146
- exponential?: boolean | undefined;
147
- prefixSymbol?: boolean | undefined;
148
- lowPrecision?: boolean | undefined;
149
- roundingFunction?: ((args0: number, ...args1: unknown[]) => number) | undefined;
150
- } | undefined;
151
- outputFormat?: {
152
- output?: ("currency" | "percent" | "byte" | "time" | "ordinal" | "number") | undefined;
153
- base?: ("decimal" | "binary" | "general") | undefined;
154
- characteristic?: number | undefined;
155
- prefix?: string | undefined;
156
- postfix?: string | undefined;
157
- forceAverage?: ("trillion" | "billion" | "million" | "thousand") | undefined;
158
- average?: boolean | undefined;
159
- currencyPosition?: ("prefix" | "infix" | "postfix") | undefined;
160
- currencySymbol?: string | undefined;
161
- totalLength?: number | undefined;
162
- mantissa?: number | undefined;
163
- optionalMantissa?: boolean | undefined;
164
- trimMantissa?: boolean | undefined;
165
- optionalCharacteristic?: boolean | undefined;
166
- thousandSeparated?: boolean | undefined;
167
- abbreviations?: {
168
- thousand?: string | undefined;
169
- million?: string | undefined;
170
- billion?: string | undefined;
171
- trillion?: string | undefined;
172
- } | undefined;
173
- negative?: ("sign" | "parenthesis") | undefined;
174
- forceSign?: boolean | undefined;
175
- spaceSeparated?: boolean | undefined;
176
- spaceSeparatedCurrency?: boolean | undefined;
177
- spaceSeparatedAbbreviation?: boolean | undefined;
178
- exponential?: boolean | undefined;
179
- prefixSymbol?: boolean | undefined;
180
- lowPrecision?: boolean | undefined;
181
- roundingFunction?: ((args0: number, ...args1: unknown[]) => number) | undefined;
182
- } | undefined;
183
- })];
184
- };
185
- export declare type IDateTimeField = {
186
- label: string;
187
- key: string;
188
- description?: string | undefined;
189
- alternateMatches?: string[] | undefined;
190
- validators?: IValidatorField[];
191
- invalidValueMessage?: string | undefined;
192
- readOnly?: boolean;
193
- hidden?: boolean;
194
- requireMapping?: boolean | undefined;
195
- type: ("date" | "time" | "datetime") | ["date" | "time" | "datetime", {
196
- displayFormat?: string | undefined;
197
- outputFormat?: string | undefined;
198
- locale?: string | undefined;
199
- withSeconds?: boolean | undefined;
200
- }];
201
- };
202
- export declare type IDeveloperField = IStringField | ICheckboxField | IEmailField | ISelectField | INumberField | IDateTimeField;
203
- export declare type IDeveloperStyleOverrides = {
204
- global?: {
205
- textColor?: string;
206
- primaryTextColor?: string;
207
- secondaryTextColor?: string;
208
- successColor?: string;
209
- warningColor?: string;
210
- customFontURL?: string | null;
211
- customFontFamily?: string | null;
212
- };
213
- modal?: {
214
- backgroundColor?: string;
215
- borderRadius?: string;
216
- headerBackgroundColor?: string;
217
- headerBorderBottom?: string;
218
- };
219
- primaryButton?: {
220
- borderRadius?: string;
221
- backgroundColor?: string;
222
- textColor?: string;
223
- border?: string;
224
- hoverBackgroundColor?: string;
225
- hoverTextColor?: string;
226
- hoverBorder?: string;
227
- };
228
- secondaryButton?: {
229
- borderRadius?: string;
230
- backgroundColor?: string;
231
- textColor?: string;
232
- border?: string;
233
- hoverBackgroundColor?: string;
234
- hoverTextColor?: string;
235
- hoverBorder?: string;
236
- };
237
- tertiaryButton?: {
238
- borderRadius?: string;
239
- backgroundColor?: string;
240
- textColor?: string;
241
- border?: string;
242
- hoverBackgroundColor?: string;
243
- hoverTextColor?: string;
244
- hoverBorder?: string;
245
- };
246
- dropzone?: {
247
- borderWidth?: number;
248
- borderRadius?: number;
249
- borderColor?: string;
250
- borderStyle?: string;
251
- backgroundColor?: string;
252
- color?: string;
253
- outline?: string;
254
- };
255
- helpText?: {
256
- textColor?: string;
257
- backgroundColor?: string;
258
- };
259
- stepperBar?: {
260
- completeColor?: string;
261
- incompleteColor?: string;
262
- currentColor?: string;
263
- fontSize?: string;
264
- completeFontWeight?: string;
265
- incompleteFontWeight?: string;
266
- currentFontWeight?: string;
267
- };
268
- };
269
- export declare type TLocaleShorthand = "bn" | "en" | "hr" | "ja" | "nl" | "ru" | "uk" | "cs" | "es" | "hu" | "ko" | "no" | "sv" | "vi" | "da" | "fi" | "id" | "lt" | "pl" | "sw" | "zh_CN" | "de" | "fr" | "is" | "lv" | "pt" | "th" | "zh_TW" | "el" | "hi" | "it" | "ms" | "ro" | "tr";
270
- export declare type IDeveloperSettings = {
271
- importIdentifier: string;
272
- title?: string | undefined;
273
- allowInvalidSubmit?: boolean | undefined;
274
- invalidDataBehavior?: ("BLOCK_SUBMIT" | "INCLUDE_INVALID_ROWS" | "REMOVE_INVALID_ROWS") | undefined;
275
- backendSync?: boolean | undefined;
276
- backendSyncMode?: ("DISABLED" | "FULL_DATA" | "MAPPINGS_ONLY") | undefined;
277
- manualInputDisabled?: boolean;
278
- manualInputOnly?: boolean;
279
- allowCustomFields?: boolean;
280
- maxRecords?: number | null;
281
- developmentMode?: boolean | undefined;
282
- displayEncoding?: boolean;
283
- styleOverrides?: IDeveloperStyleOverrides;
284
- webhookUrl?: string | null;
285
- initialData?: ({
286
- [x: string]: any;
287
- }[] | any[][]) | null;
288
- uploadStep?: {
289
- helpText?: string | null;
290
- };
291
- matchingStep?: {
292
- helpText?: string | null;
293
- headerRowOverride?: number | null;
294
- fuzzyMatchHeaders?: boolean;
295
- alwaysMatchSelectFields?: boolean;
296
- };
297
- reviewStep?: {
298
- helpText?: string | null;
299
- processingText?: string | null;
300
- saveForLater?: boolean;
301
- };
302
- autoMapHeaders?: boolean;
303
- delimiter?: string | undefined;
304
- backendOverride?: {
305
- url: string;
306
- type: "AWS" | "AZURE";
307
- };
308
- locale?: TLocaleShorthand;
309
- templateDownloadFilename?: string | null;
310
- browserExcelParsing?: boolean;
311
- version?: string;
312
- };
313
- export declare type IUser = {
314
- id: string;
315
- name?: string | undefined;
316
- email?: string | undefined;
317
- companyId?: string | undefined;
318
- companyName?: string | undefined;
319
- };
320
- declare type MaybeAsync<T> = T | Promise<T>;
321
- export interface IConnectionMethods {
322
- init: (licenseKey: string, fields: IDeveloperField[], settings: IDeveloperSettings, user: IUser, appHost?: string) => void;
323
- initFromSavedSchema: (licenseKey: string, schemaName: string, appHost: string, options?: IImporterOptions) => void;
324
- setHeaderRowOverride: (headerRowOverride: number | null) => void;
325
- setNumRegisteredColHooks: (numColHooks: number) => void;
326
- setNumRegisteredRowHooks: (numRowHooks: number) => void;
327
- setNumRegisteredRowDeleteHooks: (numRowDeleteHooks: number) => void;
328
- setUser: (user: IUser) => void;
329
- addField: (field: IDeveloperField, position?: IPositionSpec) => void;
330
- removeField: (fieldKey: string) => void;
331
- updateInfoMessages: (messages: IMessagesForCell[]) => void;
332
- setDevelopmentMode: (developmentMode: boolean) => void;
333
- rehydrate: (rehydrateState: any, headlessImportId?: string) => void;
334
- addRows: (rows: IRowToAdd[]) => void;
335
- removeRows: (rowIds: string[]) => void;
336
- }
337
- export declare type IPublicConnectionMethods = Pick<IConnectionMethods, "addField" | "updateInfoMessages" | "setHeaderRowOverride" | "setUser" | "removeField" | "setDevelopmentMode" | "addRows" | "removeRows">;
338
- export declare type IDeveloperFieldType = "string" | "checkbox" | "select" | "number" | "date" | "datetime" | "time" | "email";
339
- export interface ICellRef {
340
- rowIndex: number;
341
- fieldKey: string;
342
- }
343
- export interface ITableMessage {
344
- message: string;
345
- level: "info" | "warning" | "error";
346
- }
347
- export interface IMessagesForCell extends ICellRef {
348
- messages: ITableMessage[];
349
- }
350
- export interface IColumnHook {
351
- fieldName: string;
352
- callback: (values: IColumnHookInput[]) => MaybeAsync<IColumnHookOutput[]>;
353
- }
354
- export interface IRowHook {
355
- (data: IRowHookInput, mode: "init" | "update"): MaybeAsync<IRowHookOutput>;
356
- }
357
- export declare type IBulkRowHook = (data: IRowHookInput[], mode: "init" | "update") => IRowHookOutputInternal[] | Promise<IRowHookOutputInternal[]>;
358
- export interface IRowDeleteHook {
359
- (data: IRowHookInput): MaybeAsync<void>;
360
- }
361
- export interface IColumnHookInput {
362
- index: number;
363
- value: any;
364
- rowId: string;
365
- }
366
- export interface IColumnHookOutput {
367
- index: number;
368
- value?: any;
369
- info?: ITableMessage[];
370
- }
371
- export interface IRowHookInput {
372
- row: {
373
- [key: string]: {
374
- value: any;
375
- resultValue: any;
376
- info?: ITableMessage[];
377
- selectOptions?: ISelectField["selectOptions"];
378
- };
379
- };
380
- index: number;
381
- rowId: string;
382
- }
383
- export interface IRowHookOutput {
384
- row: IRow;
385
- }
386
- export interface IRow {
387
- [key: string]: {
388
- value?: any;
389
- info?: ITableMessage[];
390
- selectOptions?: ISelectField["selectOptions"];
391
- };
392
- }
393
- export interface IRowToAdd {
394
- index?: number;
395
- row: IRow;
396
- }
397
- export interface IRowHookOutputInternal extends IRowHookOutput {
398
- index: number;
399
- }
400
- export declare type IFieldMetadata = Record<string, {
401
- fileHeader: string | null;
402
- fileHeaderIndex: number | null;
403
- isCustom: boolean;
404
- }>;
405
- export declare type IError = {
406
- fieldKey: string;
407
- rowIndex: number;
408
- message: string;
409
- };
410
- export interface IResultMetadata {
411
- id: string | null;
412
- filename: string | null;
413
- importIdentifier: string;
414
- user: IUser;
415
- rowsWithError: number[];
416
- rawHeaders: string[] | null;
417
- fields: IFieldMetadata;
418
- saveForLater?: boolean;
419
- errors: IError[];
420
- }
421
- export declare enum EStepHook {
422
- UPLOAD_STEP = "UPLOAD_STEP",
423
- REVIEW_STEP = "REVIEW_STEP",
424
- REVIEW_STEP_POST_HOOKS = "REVIEW_STEP_POST_HOOKS"
425
- }
426
- export interface IUploadStepData {
427
- filename: string | null;
428
- dataPreview: any[][];
429
- }
430
- export interface IReviewStepData {
431
- rawHeaders: string[] | null;
432
- headerMapping: {
433
- [header: string]: string | undefined;
434
- };
435
- fields: IFieldMetadata;
436
- }
437
- export interface IReviewStepPostHooksData {
438
- headerMapping: {
439
- [header: string]: string | undefined;
440
- };
441
- fields: IFieldMetadata;
442
- }
443
- export interface IStepHook {
444
- type: keyof typeof EStepHook;
445
- callback: (uploader: IPublicConnectionMethods, data: IUploadStepData | IReviewStepData | IReviewStepPostHooksData) => MaybeAsync<void>;
446
- }
447
- export declare type IBeforeFinishCallback = (data: Record<string, any>[], metadata: IResultMetadata, instance: IPublicConnectionMethods) => MaybeAsync<IBeforeFinishOutput>;
448
- export declare type IBeforeFinishOutput = void | {
449
- cancel: true;
450
- message: string;
451
- };
452
- export interface IAllHooks {
453
- rowHooks?: IRowHook[];
454
- bulkRowHooks?: IBulkRowHook[];
455
- columnHooks?: IColumnHook[];
456
- stepHooks?: IStepHook[];
457
- rowDeleteHooks?: IRowDeleteHook[];
458
- beforeFinishCallback?: IBeforeFinishCallback;
459
- }
460
- export declare enum EInvalidDataBehavior {
461
- BLOCK_SUBMIT = "BLOCK_SUBMIT",
462
- REMOVE_INVALID_ROWS = "REMOVE_INVALID_ROWS",
463
- INCLUDE_INVALID_ROWS = "INCLUDE_INVALID_ROWS"
464
- }
465
- export declare enum EBackendSyncMode {
466
- DISABLED = "DISABLED",
467
- MAPPINGS_ONLY = "MAPPINGS_ONLY",
468
- FULL_DATA = "FULL_DATA"
469
- }
470
- export declare type IPositionSpec = {
471
- before: string;
472
- } | {
473
- after: string;
474
- };
475
- export declare type IImporterOptions = {
476
- user?: IUser;
477
- developmentMode?: boolean;
478
- headerRowOverride?: number | null;
479
- };
480
- export {};
1
+ export type IRequiredValidator = {
2
+ errorMessage?: string | undefined;
3
+ level?: ("info" | "warning" | "error") | undefined;
4
+ validate: "required";
5
+ };
6
+ export type IUniqueValidator = {
7
+ errorMessage?: string | undefined;
8
+ level?: ("info" | "warning" | "error") | undefined;
9
+ validate: "unique" | "unique_case_insensitive";
10
+ };
11
+ export type IUniqueWithValidator = {
12
+ errorMessage?: string | undefined;
13
+ level?: ("info" | "warning" | "error") | undefined;
14
+ validate: "unique_with";
15
+ uniqueKey: string;
16
+ };
17
+ export type IRegexValidator = {
18
+ errorMessage?: string | undefined;
19
+ level?: ("info" | "warning" | "error") | undefined;
20
+ validate: "regex_match" | "regex_exclude";
21
+ regex: string | RegExp;
22
+ regexOptions?: {
23
+ ignoreCase?: boolean | undefined;
24
+ dotAll?: boolean | undefined;
25
+ multiline?: boolean | undefined;
26
+ unicode?: boolean | undefined;
27
+ } | undefined;
28
+ };
29
+ export type IRequireWithValidator = {
30
+ errorMessage?: string | undefined;
31
+ level?: ("info" | "warning" | "error") | undefined;
32
+ validate: "require_with" | "require_without" | "require_with_all" | "require_without_all";
33
+ fields: string[];
34
+ };
35
+ export type IRequireWithValuesValidator = {
36
+ errorMessage?: string | undefined;
37
+ level?: ("info" | "warning" | "error") | undefined;
38
+ validate: "require_with_values" | "require_without_values" | "require_with_all_values" | "require_without_all_values";
39
+ fieldValues: {
40
+ [x: string]: any;
41
+ };
42
+ };
43
+ export type IValidatorField = IRequiredValidator | IUniqueValidator | IUniqueWithValidator | IRegexValidator | IRequireWithValidator | IRequireWithValuesValidator;
44
+ export type IStringField = {
45
+ label: string;
46
+ key: string;
47
+ description?: string | undefined;
48
+ alternateMatches?: string[] | undefined;
49
+ validators?: IValidatorField[];
50
+ invalidValueMessage?: string | undefined;
51
+ readOnly?: boolean;
52
+ hidden?: boolean;
53
+ requireMapping?: boolean | undefined;
54
+ type?: ("string" | [
55
+ "string",
56
+ {
57
+ [x: string]: never;
58
+ }
59
+ ]) | undefined;
60
+ };
61
+ export type ICheckboxField = {
62
+ label: string;
63
+ key: string;
64
+ description?: string | undefined;
65
+ alternateMatches?: string[] | undefined;
66
+ validators?: IValidatorField[];
67
+ invalidValueMessage?: string | undefined;
68
+ readOnly?: boolean;
69
+ hidden?: boolean;
70
+ requireMapping?: boolean | undefined;
71
+ type: "checkbox" | [
72
+ "checkbox",
73
+ {
74
+ [x: string]: never;
75
+ }
76
+ ];
77
+ };
78
+ export type IEmailField = {
79
+ label: string;
80
+ key: string;
81
+ description?: string | undefined;
82
+ alternateMatches?: string[] | undefined;
83
+ validators?: IValidatorField[];
84
+ invalidValueMessage?: string | undefined;
85
+ readOnly?: boolean;
86
+ hidden?: boolean;
87
+ requireMapping?: boolean | undefined;
88
+ type: "email" | [
89
+ "email",
90
+ {
91
+ [x: string]: never;
92
+ }
93
+ ];
94
+ };
95
+ export type IDeveloperSelectOption = {
96
+ label: string;
97
+ value: string;
98
+ alternateMatches?: string[] | undefined;
99
+ };
100
+ export type ISelectField = {
101
+ label: string;
102
+ key: string;
103
+ description?: string | undefined;
104
+ alternateMatches?: string[] | undefined;
105
+ validators?: IValidatorField[];
106
+ invalidValueMessage?: string | undefined;
107
+ readOnly?: boolean;
108
+ hidden?: boolean;
109
+ requireMapping?: boolean | undefined;
110
+ type: "select" | [
111
+ "select",
112
+ {
113
+ [x: string]: never;
114
+ }
115
+ ];
116
+ selectOptions: IDeveloperSelectOption[];
117
+ };
118
+ export type INumberField = {
119
+ label: string;
120
+ key: string;
121
+ description?: string | undefined;
122
+ alternateMatches?: string[] | undefined;
123
+ validators?: IValidatorField[];
124
+ invalidValueMessage?: string | undefined;
125
+ readOnly?: boolean;
126
+ hidden?: boolean;
127
+ requireMapping?: boolean | undefined;
128
+ type: "number" | [
129
+ "number",
130
+ (("default" | "percent" | "percent_0" | "percent_1" | "percent_2" | "percent_3" | "percent_4" | "decimal_0" | "decimal_1" | "decimal_2" | "decimal_3" | "decimal_4" | "integer" | "plain" | "usd" | "usd_accounting" | "eur" | "gbp") | {
131
+ preset?: ("default" | "percent" | "percent_0" | "percent_1" | "percent_2" | "percent_3" | "percent_4" | "decimal_0" | "decimal_1" | "decimal_2" | "decimal_3" | "decimal_4" | "integer" | "plain" | "usd" | "usd_accounting" | "eur" | "gbp") | undefined;
132
+ round?: number | undefined;
133
+ displayFormat?: {
134
+ output?: ("currency" | "percent" | "byte" | "time" | "ordinal" | "number") | undefined;
135
+ base?: ("decimal" | "binary" | "general") | undefined;
136
+ characteristic?: number | undefined;
137
+ prefix?: string | undefined;
138
+ postfix?: string | undefined;
139
+ forceAverage?: ("trillion" | "billion" | "million" | "thousand") | undefined;
140
+ average?: boolean | undefined;
141
+ currencyPosition?: ("prefix" | "infix" | "postfix") | undefined;
142
+ currencySymbol?: string | undefined;
143
+ totalLength?: number | undefined;
144
+ mantissa?: number | undefined;
145
+ optionalMantissa?: boolean | undefined;
146
+ trimMantissa?: boolean | undefined;
147
+ optionalCharacteristic?: boolean | undefined;
148
+ thousandSeparated?: boolean | undefined;
149
+ abbreviations?: {
150
+ thousand?: string | undefined;
151
+ million?: string | undefined;
152
+ billion?: string | undefined;
153
+ trillion?: string | undefined;
154
+ } | undefined;
155
+ negative?: ("sign" | "parenthesis") | undefined;
156
+ forceSign?: boolean | undefined;
157
+ spaceSeparated?: boolean | undefined;
158
+ spaceSeparatedCurrency?: boolean | undefined;
159
+ spaceSeparatedAbbreviation?: boolean | undefined;
160
+ exponential?: boolean | undefined;
161
+ prefixSymbol?: boolean | undefined;
162
+ lowPrecision?: boolean | undefined;
163
+ roundingFunction?: ((args0: number, ...args1: unknown[]) => number) | undefined;
164
+ } | undefined;
165
+ outputFormat?: {
166
+ output?: ("currency" | "percent" | "byte" | "time" | "ordinal" | "number") | undefined;
167
+ base?: ("decimal" | "binary" | "general") | undefined;
168
+ characteristic?: number | undefined;
169
+ prefix?: string | undefined;
170
+ postfix?: string | undefined;
171
+ forceAverage?: ("trillion" | "billion" | "million" | "thousand") | undefined;
172
+ average?: boolean | undefined;
173
+ currencyPosition?: ("prefix" | "infix" | "postfix") | undefined;
174
+ currencySymbol?: string | undefined;
175
+ totalLength?: number | undefined;
176
+ mantissa?: number | undefined;
177
+ optionalMantissa?: boolean | undefined;
178
+ trimMantissa?: boolean | undefined;
179
+ optionalCharacteristic?: boolean | undefined;
180
+ thousandSeparated?: boolean | undefined;
181
+ abbreviations?: {
182
+ thousand?: string | undefined;
183
+ million?: string | undefined;
184
+ billion?: string | undefined;
185
+ trillion?: string | undefined;
186
+ } | undefined;
187
+ negative?: ("sign" | "parenthesis") | undefined;
188
+ forceSign?: boolean | undefined;
189
+ spaceSeparated?: boolean | undefined;
190
+ spaceSeparatedCurrency?: boolean | undefined;
191
+ spaceSeparatedAbbreviation?: boolean | undefined;
192
+ exponential?: boolean | undefined;
193
+ prefixSymbol?: boolean | undefined;
194
+ lowPrecision?: boolean | undefined;
195
+ roundingFunction?: ((args0: number, ...args1: unknown[]) => number) | undefined;
196
+ } | undefined;
197
+ })
198
+ ];
199
+ };
200
+ export type IDateTimeField = {
201
+ label: string;
202
+ key: string;
203
+ description?: string | undefined;
204
+ alternateMatches?: string[] | undefined;
205
+ validators?: IValidatorField[];
206
+ invalidValueMessage?: string | undefined;
207
+ readOnly?: boolean;
208
+ hidden?: boolean;
209
+ requireMapping?: boolean | undefined;
210
+ type: ("date" | "time" | "datetime") | [
211
+ "date" | "time" | "datetime",
212
+ {
213
+ displayFormat?: string | undefined;
214
+ outputFormat?: string | undefined;
215
+ locale?: string | undefined;
216
+ withSeconds?: boolean | undefined;
217
+ }
218
+ ];
219
+ };
220
+ export type IDeveloperField = IStringField | ICheckboxField | IEmailField | ISelectField | INumberField | IDateTimeField;
221
+ export type IDeveloperStyleOverrides = {
222
+ global?: {
223
+ textColor?: string;
224
+ primaryTextColor?: string;
225
+ secondaryTextColor?: string;
226
+ successColor?: string;
227
+ warningColor?: string;
228
+ customFontURL?: string | null;
229
+ customFontFamily?: string | null;
230
+ backgroundColor?: string;
231
+ borderRadius?: string;
232
+ borderWidth?: string;
233
+ borderColor?: string;
234
+ borderStyle?: string;
235
+ };
236
+ primaryButton?: {
237
+ borderRadius?: string;
238
+ backgroundColor?: string;
239
+ textColor?: string;
240
+ border?: string;
241
+ hoverBackgroundColor?: string;
242
+ hoverTextColor?: string;
243
+ hoverBorder?: string;
244
+ };
245
+ secondaryButton?: {
246
+ borderRadius?: string;
247
+ backgroundColor?: string;
248
+ textColor?: string;
249
+ border?: string;
250
+ hoverBackgroundColor?: string;
251
+ hoverTextColor?: string;
252
+ hoverBorder?: string;
253
+ };
254
+ tertiaryButton?: {
255
+ borderRadius?: string;
256
+ backgroundColor?: string;
257
+ textColor?: string;
258
+ border?: string;
259
+ hoverBackgroundColor?: string;
260
+ hoverTextColor?: string;
261
+ hoverBorder?: string;
262
+ };
263
+ dropzone?: {
264
+ borderWidth?: number;
265
+ borderRadius?: number;
266
+ borderColor?: string;
267
+ borderStyle?: string;
268
+ backgroundColor?: string;
269
+ color?: string;
270
+ outline?: string;
271
+ };
272
+ helpText?: {
273
+ textColor?: string;
274
+ backgroundColor?: string;
275
+ };
276
+ stepperBar?: {
277
+ completeColor?: string;
278
+ incompleteColor?: string;
279
+ currentColor?: string;
280
+ fontSize?: string;
281
+ completeFontWeight?: string;
282
+ incompleteFontWeight?: string;
283
+ currentFontWeight?: string;
284
+ backgroundColor?: string;
285
+ borderBottom?: string;
286
+ };
287
+ dataTable?: {
288
+ headerFontWeight?: string;
289
+ };
290
+ };
291
+ export type TLocaleShorthand = "bn" | "en" | "hr" | "ja" | "nl" | "ru" | "uk" | "cs" | "es" | "hu" | "ko" | "no" | "sv" | "vi" | "da" | "fi" | "id" | "lt" | "pl" | "sw" | "zh_CN" | "de" | "fr" | "is" | "lv" | "pt" | "th" | "zh_TW" | "el" | "hi" | "it" | "ms" | "ro" | "tr";
292
+ export type IDeveloperSettings = {
293
+ importIdentifier: string;
294
+ title?: string | undefined;
295
+ allowInvalidSubmit?: boolean | undefined;
296
+ invalidDataBehavior?: ("BLOCK_SUBMIT" | "INCLUDE_INVALID_ROWS" | "REMOVE_INVALID_ROWS") | undefined;
297
+ backendSync?: boolean | undefined;
298
+ backendSyncMode?: ("DISABLED" | "FULL_DATA" | "MAPPINGS_ONLY") | undefined;
299
+ manualInputDisabled?: boolean;
300
+ manualInputOnly?: boolean;
301
+ allowCustomFields?: boolean;
302
+ maxRecords?: number | null;
303
+ developmentMode?: boolean | undefined;
304
+ displayEncoding?: boolean;
305
+ styleOverrides?: IDeveloperStyleOverrides;
306
+ maxFileSize?: number;
307
+ webhookUrl?: string | null;
308
+ needsReviewWebhookUrl?: string | null;
309
+ initialData?: ({
310
+ [x: string]: any;
311
+ }[] | any[][]) | null;
312
+ uploadStep?: {
313
+ helpText?: string | null;
314
+ };
315
+ matchingStep?: {
316
+ helpText?: string | null;
317
+ headerRowOverride?: number | null;
318
+ fuzzyMatchHeaders?: boolean;
319
+ alwaysMatchSelectFields?: boolean;
320
+ matchToSchema?: boolean;
321
+ };
322
+ reviewStep?: {
323
+ helpText?: string | null;
324
+ processingText?: string | null;
325
+ };
326
+ autoMapHeaders?: boolean;
327
+ delimiter?: string | undefined;
328
+ backendOverride?: {
329
+ url: string;
330
+ type: "AWS" | "AZURE";
331
+ };
332
+ locale?: TLocaleShorthand;
333
+ templateDownloadFilename?: string | null;
334
+ browserExcelParsing?: boolean;
335
+ version?: string;
336
+ };
337
+ export type IUser = {
338
+ id: string;
339
+ name?: string | undefined;
340
+ email?: string | undefined;
341
+ companyId?: string | undefined;
342
+ companyName?: string | undefined;
343
+ };
344
+ type MaybeAsync<T> = T | Promise<T>;
345
+ export interface IParentConnectionMethods {
346
+ handleColumnHooks: (fieldName: string, data: IColumnHookInput[]) => Promise<IColumnHookOutput[]>;
347
+ handleRowHooks: (data: IRowHookInput[], mode: "init" | "update") => Promise<IRowHookOutputInternal[]>;
348
+ handleStepHook: (step: EStepHook, data: IUploadStepData | IReviewStepData) => void;
349
+ handleRowDeleteHooks: (deletedRows: IRowHookInput[]) => Promise<void>;
350
+ handleBeforeFinishCallback: (data: Record<string, any>[], metadata: IResultMetadata) => Promise<IBeforeFinishOutput>;
351
+ handleResults: (data: any, metadata: IResultMetadata) => Promise<void>;
352
+ handleCloseModal: () => void;
353
+ handleCancel: () => void;
354
+ }
355
+ export interface IConnectionMethods {
356
+ init: (licenseKey: string, fields: IDeveloperField[], settings: IDeveloperSettings, user: IUser, appHost?: string) => void;
357
+ initFromSavedSchema: (licenseKey: string, schemaName: string, appHost: string, options?: IImporterOptions) => void;
358
+ setHeaderRowOverride: (headerRowOverride: number | null) => void;
359
+ setNumRegisteredColHooks: (numColHooks: number) => void;
360
+ setNumRegisteredRowHooks: (numRowHooks: number) => void;
361
+ setNumRegisteredRowDeleteHooks: (numRowDeleteHooks: number) => void;
362
+ setUser: (user: IUser) => void;
363
+ addField: (field: IDeveloperField, position?: IPositionSpec) => void;
364
+ removeField: (fieldKey: string) => void;
365
+ updateInfoMessages: (messages: IMessagesForCell[]) => void;
366
+ setDevelopmentMode: (developmentMode: boolean) => void;
367
+ rehydrate: (rehydrateState: any, headlessImportId?: string) => void;
368
+ addRows: (rows: IRowToAdd[]) => void;
369
+ removeRows: (rowIds: string[]) => void;
370
+ }
371
+ export type IPublicConnectionMethods = Pick<IConnectionMethods, "addField" | "updateInfoMessages" | "setHeaderRowOverride" | "setUser" | "removeField" | "setDevelopmentMode" | "addRows" | "removeRows">;
372
+ export type IDeveloperFieldType = "string" | "checkbox" | "select" | "number" | "date" | "datetime" | "time" | "email";
373
+ export interface ICellRef {
374
+ rowIndex: number;
375
+ fieldKey: string;
376
+ }
377
+ export interface ITableMessage {
378
+ message: string;
379
+ level: "info" | "warning" | "error";
380
+ }
381
+ export interface IMessagesForCell extends ICellRef {
382
+ messages: ITableMessage[];
383
+ }
384
+ export interface IColumnHook {
385
+ fieldName: string;
386
+ callback: (values: IColumnHookInput[]) => MaybeAsync<IColumnHookOutput[]>;
387
+ }
388
+ export interface IRowHook {
389
+ (data: IRowHookInput, mode: "init" | "update"): MaybeAsync<IRowHookOutput>;
390
+ }
391
+ export type IBulkRowHook = (data: IRowHookInput[], mode: "init" | "update") => IRowHookOutputInternal[] | Promise<IRowHookOutputInternal[]>;
392
+ export interface IRowDeleteHook {
393
+ (data: IRowHookInput): MaybeAsync<void>;
394
+ }
395
+ export interface IColumnHookInput {
396
+ index: number;
397
+ value: any;
398
+ rowId: string;
399
+ }
400
+ export interface IColumnHookOutput {
401
+ index: number;
402
+ value?: any;
403
+ info?: ITableMessage[];
404
+ }
405
+ export interface IRowHookInput {
406
+ row: {
407
+ [key: string]: {
408
+ value: any;
409
+ resultValue: any;
410
+ info?: ITableMessage[];
411
+ selectOptions?: ISelectField["selectOptions"];
412
+ };
413
+ };
414
+ index: number;
415
+ rowId: string;
416
+ }
417
+ export interface IRowHookOutput {
418
+ row: IRow;
419
+ }
420
+ export interface IRow {
421
+ [key: string]: {
422
+ value?: any;
423
+ info?: ITableMessage[];
424
+ selectOptions?: ISelectField["selectOptions"];
425
+ };
426
+ }
427
+ export interface IRowToAdd {
428
+ index?: number;
429
+ row: IRow;
430
+ }
431
+ export interface IRowHookOutputInternal extends IRowHookOutput {
432
+ index: number;
433
+ }
434
+ export type IFieldMetadata = Record<string, {
435
+ fileHeader: string | null;
436
+ fileHeaderIndex: number | null;
437
+ isCustom: boolean;
438
+ }>;
439
+ export type IError = {
440
+ fieldKey: string;
441
+ rowIndex: number;
442
+ message: string;
443
+ };
444
+ export interface IResultMetadata {
445
+ id: string | null;
446
+ filename: string | null;
447
+ importIdentifier: string;
448
+ user: IUser;
449
+ rowsWithError: number[];
450
+ rawHeaders: string[] | null;
451
+ fields: IFieldMetadata;
452
+ saveForLater?: boolean;
453
+ errors: IError[];
454
+ }
455
+ export declare enum EStepHook {
456
+ UPLOAD_STEP = "UPLOAD_STEP",
457
+ REVIEW_STEP = "REVIEW_STEP",
458
+ REVIEW_STEP_POST_HOOKS = "REVIEW_STEP_POST_HOOKS"
459
+ }
460
+ export interface IUploadStepData {
461
+ filename: string | null;
462
+ dataPreview: any[][];
463
+ }
464
+ export interface IReviewStepData {
465
+ rawHeaders: string[] | null;
466
+ headerMapping: {
467
+ [header: string]: string | undefined;
468
+ };
469
+ fields: IFieldMetadata;
470
+ }
471
+ export interface IReviewStepPostHooksData {
472
+ headerMapping: {
473
+ [header: string]: string | undefined;
474
+ };
475
+ fields: IFieldMetadata;
476
+ }
477
+ export interface IStepHook {
478
+ type: keyof typeof EStepHook;
479
+ callback: (uploader: IPublicConnectionMethods, data: IUploadStepData | IReviewStepData | IReviewStepPostHooksData) => MaybeAsync<void>;
480
+ }
481
+ export type IBeforeFinishCallback = (data: Record<string, any>[], metadata: IResultMetadata, instance: IPublicConnectionMethods) => MaybeAsync<IBeforeFinishOutput>;
482
+ export type IBeforeFinishOutput = void | {
483
+ cancel: true;
484
+ message: string;
485
+ };
486
+ export interface IAllHooks {
487
+ rowHooks?: IRowHook[];
488
+ bulkRowHooks?: IBulkRowHook[];
489
+ columnHooks?: IColumnHook[];
490
+ stepHooks?: IStepHook[];
491
+ rowDeleteHooks?: IRowDeleteHook[];
492
+ beforeFinishCallback?: IBeforeFinishCallback;
493
+ }
494
+ export declare enum EInvalidDataBehavior {
495
+ BLOCK_SUBMIT = "BLOCK_SUBMIT",
496
+ REMOVE_INVALID_ROWS = "REMOVE_INVALID_ROWS",
497
+ INCLUDE_INVALID_ROWS = "INCLUDE_INVALID_ROWS"
498
+ }
499
+ export declare enum EBackendSyncMode {
500
+ DISABLED = "DISABLED",
501
+ MAPPINGS_ONLY = "MAPPINGS_ONLY",
502
+ FULL_DATA = "FULL_DATA"
503
+ }
504
+ export type IPositionSpec = {
505
+ before: string;
506
+ } | {
507
+ after: string;
508
+ };
509
+ export type IImporterOptions = {
510
+ user?: IUser;
511
+ developmentMode?: boolean;
512
+ headerRowOverride?: number | null;
513
+ };
514
+ export {};