dromo-uploader-js 1.3.16 → 2.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.
@@ -1,166 +1,206 @@
1
- declare type MaybeAsync<T> = T | Promise<T>;
2
- export interface IConnectionMethods {
3
- init: (licenseKey: string, fields: IDeveloperField[], settings: IDeveloperSettings, user: IUser, appHost?: string) => void;
4
- initFromSavedSchema: (licenseKey: string, schemaName: string, appHost: string, options?: IImporterOptions) => void;
5
- setHeaderRowOverride: (headerRowOverride: number | null) => void;
6
- setNumRegisteredColHooks: (numColHooks: number) => void;
7
- setNumRegisteredRowHooks: (numRowHooks: number) => void;
8
- setNumRegisteredRowDeleteHooks: (numRowDeleteHooks: number) => void;
9
- setUser: (user: IUser) => void;
10
- addField: (field: IDeveloperField, position?: IPositionSpec) => void;
11
- removeField: (fieldKey: string) => void;
12
- updateInfoMessages: (messages: IMessagesForCell[]) => void;
13
- setDevelopmentMode: (developmentMode: boolean) => void;
14
- rehydrate: (rehydrateState: any, headlessImportId?: string) => void;
15
- }
16
- export declare type IPublicConnectionMethods = Pick<IConnectionMethods, "addField" | "updateInfoMessages" | "setHeaderRowOverride" | "setUser" | "removeField" | "setDevelopmentMode">;
17
- export declare type IDeveloperFieldType = "string" | "checkbox" | "select" | "number" | "date" | "datetime" | "time" | "email";
18
- export interface IAbstractDeveloperFieldUntyped {
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 = {
19
45
  label: string;
20
46
  key: string;
21
- type?: never;
22
- description?: string;
23
- alternateMatches?: string[];
47
+ description?: string | undefined;
48
+ alternateMatches?: string[] | undefined;
24
49
  validators?: IValidatorField[];
25
- invalidValueMessage?: string;
50
+ invalidValueMessage?: string | undefined;
26
51
  readOnly?: boolean;
27
52
  hidden?: boolean;
28
- requireMapping?: boolean;
29
- }
30
- export interface IAbstractDeveloperField<FieldType extends IDeveloperFieldType, FieldOpts = Record<string, never>> extends Omit<IAbstractDeveloperFieldUntyped, "type"> {
31
- type: FieldType | [FieldType, FieldOpts];
32
- }
33
- declare type IStringField = IAbstractDeveloperFieldUntyped | IAbstractDeveloperField<"string">;
34
- declare type ICheckboxField = IAbstractDeveloperField<"checkbox">;
35
- export interface IDeveloperSelectOption {
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 = {
36
87
  label: string;
37
88
  value: string;
38
- alternateMatches?: string[];
39
- }
40
- export interface ISelectField extends IAbstractDeveloperField<"select"> {
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
+ }];
41
104
  selectOptions: IDeveloperSelectOption[];
42
- }
43
- declare type INumberPreset = "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";
44
- interface INumbroFormat {
45
- output?: "currency" | "percent" | "byte" | "time" | "ordinal" | "number";
46
- base?: "decimal" | "binary" | "general";
47
- characteristic?: number;
48
- prefix?: string;
49
- postfix?: string;
50
- forceAverage?: "trillion" | "billion" | "million" | "thousand";
51
- average?: boolean;
52
- currencyPosition?: "prefix" | "infix" | "postfix";
53
- currencySymbol?: string;
54
- totalLength?: number;
55
- mantissa?: number;
56
- optionalMantissa?: boolean;
57
- trimMantissa?: boolean;
58
- optionalCharacteristic?: boolean;
59
- thousandSeparated?: boolean;
60
- abbreviations?: {
61
- thousand?: string;
62
- million?: string;
63
- billion?: string;
64
- trillion?: string;
65
- };
66
- negative?: "sign" | "parenthesis";
67
- forceSign?: boolean;
68
- spaceSeparated?: boolean;
69
- spaceSeparatedCurrency?: boolean;
70
- spaceSeparatedAbbreviation?: boolean;
71
- exponential?: boolean;
72
- prefixSymbol?: boolean;
73
- lowPrecision?: boolean;
74
- roundingFunction?: (num: number) => number;
75
- }
76
- interface INumberOpts {
77
- preset?: INumberPreset;
78
- round?: number;
79
- displayFormat?: INumbroFormat;
80
- outputFormat?: INumbroFormat;
81
- }
82
- declare type INumberField = IAbstractDeveloperField<"number", INumberPreset | INumberOpts>;
83
- interface IDateTimeOpts {
84
- displayFormat?: string;
85
- outputFormat?: string;
86
- locale?: string;
87
- withSeconds?: boolean;
88
- }
89
- declare type IDateTimeField = IAbstractDeveloperField<"date" | "time" | "datetime", IDateTimeOpts>;
90
- declare type IEmailField = IAbstractDeveloperField<"email">;
91
- export declare type IDeveloperField = IStringField | ICheckboxField | ISelectField | INumberField | IDateTimeField | IEmailField;
92
- interface IAbstractValidator<ValidateKey> {
93
- validate: ValidateKey;
94
- errorMessage?: string;
95
- level?: "info" | "warning" | "error";
96
- }
97
- export declare type IRequiredValidator = IAbstractValidator<"required">;
98
- export declare type IUniqueValidator = IAbstractValidator<"unique" | "unique_case_insensitive">;
99
- export interface IUniqueWithValidator extends IAbstractValidator<"unique_with"> {
100
- uniqueKey: string;
101
- }
102
- export interface IRegexValidator extends IAbstractValidator<"regex_match" | "regex_exclude"> {
103
- regex: string | RegExp;
104
- regexOptions?: {
105
- ignoreCase?: boolean;
106
- dotAll?: boolean;
107
- multiline?: boolean;
108
- unicode?: boolean;
109
- };
110
- }
111
- export interface IRequireWithValidator extends IAbstractValidator<"require_with" | "require_without" | "require_with_all" | "require_without_all"> {
112
- fields: string[];
113
- }
114
- export interface IRequireWithValuesValidator extends IAbstractValidator<"require_with_values" | "require_without_values" | "require_with_all_values" | "require_without_all_values"> {
115
- fieldValues: {
116
- [key: string]: string;
117
- };
118
- }
119
- export declare type IValidatorField = IRequiredValidator | IUniqueValidator | IUniqueWithValidator | IRegexValidator | IRequireWithValidator | IRequireWithValuesValidator;
120
- export interface IDeveloperSettings {
121
- importIdentifier: string;
122
- title?: string;
123
- allowInvalidSubmit?: boolean;
124
- invalidDataBehavior?: keyof typeof EInvalidDataBehavior;
125
- backendSync?: boolean;
126
- backendSyncMode?: keyof typeof EBackendSyncMode;
127
- manualInputDisabled?: boolean;
128
- manualInputOnly?: boolean;
129
- allowCustomFields?: boolean;
130
- maxRecords?: number | null;
131
- developmentMode?: boolean;
132
- displayEncoding?: boolean;
133
- styleOverrides?: IDeveloperStyleOverrides;
134
- webhookUrl?: string;
135
- initialData?: {
136
- [key: string]: string;
137
- }[] | any[][] | null;
138
- uploadStep?: {
139
- helpText?: string;
140
- };
141
- matchingStep?: {
142
- helpText?: string;
143
- headerRowOverride?: number | null;
144
- fuzzyMatchHeaders?: boolean;
145
- alwaysMatchSelectFields?: boolean;
146
- };
147
- reviewStep?: {
148
- helpText?: string;
149
- processingText?: string;
150
- saveForLater?: boolean;
151
- };
152
- autoMapHeaders?: boolean;
153
- delimiter?: string;
154
- backendOverride?: {
155
- url: string;
156
- type: "AWS" | "AZURE";
157
- } | null;
158
- locale?: TLocaleShorthand;
159
- templateDownloadFilename?: string;
160
- browserExcelParsing?: boolean;
161
- version?: string;
162
- }
163
- export interface IDeveloperStyleOverrides {
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?: string | undefined;
200
+ }];
201
+ };
202
+ export declare type IDeveloperField = IStringField | ICheckboxField | IEmailField | ISelectField | INumberField | IDateTimeField;
203
+ export declare type IDeveloperStyleOverrides = {
164
204
  global?: {
165
205
  textColor?: string;
166
206
  primaryTextColor?: string;
@@ -170,6 +210,12 @@ export interface IDeveloperStyleOverrides {
170
210
  customFontURL?: string | null;
171
211
  customFontFamily?: string | null;
172
212
  };
213
+ modal?: {
214
+ backgroundColor?: string;
215
+ borderRadius?: string;
216
+ headerBackgroundColor?: string;
217
+ headerBorderBottom?: string;
218
+ };
173
219
  primaryButton?: {
174
220
  borderRadius?: string;
175
221
  backgroundColor?: string;
@@ -202,6 +248,7 @@ export interface IDeveloperStyleOverrides {
202
248
  borderRadius?: number;
203
249
  borderColor?: string;
204
250
  borderStyle?: string;
251
+ backgroundColor?: string;
205
252
  color?: string;
206
253
  outline?: string;
207
254
  };
@@ -213,15 +260,80 @@ export interface IDeveloperStyleOverrides {
213
260
  completeColor?: string;
214
261
  incompleteColor?: string;
215
262
  currentColor?: string;
263
+ fontSize?: string;
264
+ completeFontWeight?: string;
265
+ incompleteFontWeight?: string;
266
+ currentFontWeight?: string;
216
267
  };
217
- }
218
- export interface IUser {
268
+ };
269
+ export declare type TLocaleShorthand = "de" | "en" | "es" | "fr" | "id" | "in" | "it" | "ja" | "ko" | "pt" | "th" | "vi" | "zh_CN" | "zh_TW";
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 = {
219
314
  id: string;
220
- name?: string;
221
- email?: string;
222
- companyId?: string;
223
- companyName?: 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;
224
334
  }
335
+ export declare type IPublicConnectionMethods = Pick<IConnectionMethods, "addField" | "updateInfoMessages" | "setHeaderRowOverride" | "setUser" | "removeField" | "setDevelopmentMode">;
336
+ export declare type IDeveloperFieldType = "string" | "checkbox" | "select" | "number" | "date" | "datetime" | "time" | "email";
225
337
  export interface ICellRef {
226
338
  rowIndex: number;
227
339
  fieldKey: string;
@@ -291,7 +403,6 @@ export interface IResultMetadata {
291
403
  fields: IFieldMetadata;
292
404
  saveForLater?: boolean;
293
405
  }
294
- export declare type TLocaleShorthand = "de" | "en" | "es" | "fr" | "id" | "in" | "it" | "ja" | "ko" | "pt" | "th" | "vi" | "zh_CN" | "zh_TW";
295
406
  export declare enum EStepHook {
296
407
  UPLOAD_STEP = "UPLOAD_STEP",
297
408
  REVIEW_STEP = "REVIEW_STEP",
@@ -342,6 +453,5 @@ export declare type IImporterOptions = {
342
453
  user?: IUser;
343
454
  developmentMode?: boolean;
344
455
  headerRowOverride?: number | null;
345
- version?: string;
346
456
  };
347
457
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dromo-uploader-js",
3
- "version": "1.3.16",
3
+ "version": "2.0.0",
4
4
  "description": "Easy to use data (CSV, TSV, Excel) importer",
5
5
  "author": "ankitgoyal100",
6
6
  "license": "MIT",
@@ -8,6 +8,7 @@
8
8
  "main": "dist/index.js",
9
9
  "scripts": {
10
10
  "start": "rollup -c -w",
11
+ "start-test-project": "cd sdk-test && npm install && npm run start",
11
12
  "build": "rollup -c",
12
13
  "serve": "serve -l 5050 dist"
13
14
  },