@expresscsv/react 0.1.26 → 1.0.1
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.
- package/README.md +73 -63
- package/dist/index.d.cts +93 -74
- package/dist/index.d.mts +93 -74
- package/dist/index.d.ts +93 -74
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,18 @@ declare interface BICOptions {
|
|
|
4
4
|
|
|
5
5
|
declare type BooleanControlType = 'toggle' | 'checkbox' | 'dropdown';
|
|
6
6
|
|
|
7
|
+
export declare type ChunkSize = {
|
|
8
|
+
/** Size quota unit. */
|
|
9
|
+
unit: 'kb';
|
|
10
|
+
/** KB quota. Values <= 0 send all rows in one chunk. */
|
|
11
|
+
value: number;
|
|
12
|
+
} | {
|
|
13
|
+
/** Chunk by row count. */
|
|
14
|
+
unit: 'rows';
|
|
15
|
+
/** Rows per chunk. Values <= 0 send all rows in one chunk. */
|
|
16
|
+
value: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
7
19
|
/**
|
|
8
20
|
* Color mode preference
|
|
9
21
|
*/
|
|
@@ -14,6 +26,10 @@ export declare interface ColumnMatch<TTargetField extends string = string> {
|
|
|
14
26
|
targetField: TTargetField;
|
|
15
27
|
}
|
|
16
28
|
|
|
29
|
+
export declare type ColumnMatchHandler<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = ColumnMatchingFn<SchemaFieldName<TSchema>>;
|
|
30
|
+
|
|
31
|
+
export declare type ColumnMatchHandlerResult<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = ColumnMatchingResult<SchemaFieldName<TSchema>>;
|
|
32
|
+
|
|
17
33
|
export declare type ColumnMatchingFn<TTargetField extends string = string> = (data: ColumnMatchingParams) => Promise<ColumnMatchingResult<TTargetField>>;
|
|
18
34
|
|
|
19
35
|
export declare type ColumnMatchingOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = ManagedColumnMatchingOptions | CustomColumnMatchingOptions<TSchema>;
|
|
@@ -1913,12 +1929,12 @@ declare const CurrencyCodes: readonly [{
|
|
|
1913
1929
|
|
|
1914
1930
|
declare type CustomColumnMatchingOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = {
|
|
1915
1931
|
type: 'custom';
|
|
1916
|
-
|
|
1932
|
+
columnMatchHandler: ColumnMatchHandler<TSchema>;
|
|
1917
1933
|
};
|
|
1918
1934
|
|
|
1919
1935
|
declare type CustomPromptedEditsOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = {
|
|
1920
1936
|
type: 'custom';
|
|
1921
|
-
|
|
1937
|
+
promptedEditHandler: PromptedEditHandler<TSchema>;
|
|
1922
1938
|
};
|
|
1923
1939
|
|
|
1924
1940
|
export declare type CustomSessionRecoveryOptions = {
|
|
@@ -1936,39 +1952,6 @@ export declare type DeepPartial<T> = {
|
|
|
1936
1952
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
1937
1953
|
};
|
|
1938
1954
|
|
|
1939
|
-
/**
|
|
1940
|
-
* Font source configuration for custom fonts
|
|
1941
|
-
*/
|
|
1942
|
-
export declare type ECSVFontSource = {
|
|
1943
|
-
source: 'google';
|
|
1944
|
-
name: string;
|
|
1945
|
-
weights?: (number | string)[];
|
|
1946
|
-
} | {
|
|
1947
|
-
source: 'custom';
|
|
1948
|
-
url: string;
|
|
1949
|
-
format?: 'woff2' | 'woff';
|
|
1950
|
-
};
|
|
1951
|
-
|
|
1952
|
-
/**
|
|
1953
|
-
* Theme - can be either dual-mode (light/dark) or single-mode (applies to both)
|
|
1954
|
-
*/
|
|
1955
|
-
export declare type ECSVTheme = ECSVThemeWithModes | ECSVThemeSingle;
|
|
1956
|
-
|
|
1957
|
-
/**
|
|
1958
|
-
* Single theme that applies to both light and dark modes
|
|
1959
|
-
*/
|
|
1960
|
-
declare type ECSVThemeSingle = TailwindThemeVars;
|
|
1961
|
-
|
|
1962
|
-
/**
|
|
1963
|
-
* Theme with light and dark mode support
|
|
1964
|
-
*/
|
|
1965
|
-
declare interface ECSVThemeWithModes {
|
|
1966
|
-
modes: {
|
|
1967
|
-
light: TailwindThemeVars;
|
|
1968
|
-
dark: TailwindThemeVars;
|
|
1969
|
-
};
|
|
1970
|
-
}
|
|
1971
|
-
|
|
1972
1955
|
declare interface ExBaseDef {
|
|
1973
1956
|
typeName: string;
|
|
1974
1957
|
}
|
|
@@ -3044,11 +3027,6 @@ declare interface ExpressCSVLocale {
|
|
|
3044
3027
|
/** User-facing locale type where every leaf is a plain `string`. */
|
|
3045
3028
|
export declare type ExpressCSVLocaleInput = StripBrand<ExpressCSVLocale>;
|
|
3046
3029
|
|
|
3047
|
-
/**
|
|
3048
|
-
* Core step identifiers for the CSV import wizard
|
|
3049
|
-
*/
|
|
3050
|
-
export declare type ExpressCSVStep = 'upload' | 'select-sheet' | 'select-header' | 'match-columns' | 'match-options' | 'review';
|
|
3051
|
-
|
|
3052
3030
|
declare type ExPrimitiveType = ExString | ExNumber | ExCurrencyNumber | ExPercentageNumber | ExBoolean | ExDate | ExTime | ExDatetime | ExSelect<string | number> | ExMultiselect<string | number> | ExOptionalPrimitiveType;
|
|
3053
3031
|
|
|
3054
3032
|
declare class ExRow<T extends ExRowShape> extends ExType<{
|
|
@@ -3504,6 +3482,19 @@ declare abstract class ExType<Output, Def extends ExBaseDef, Input = Output> {
|
|
|
3504
3482
|
protected _addCheck(type: string, params?: Record<string, unknown>, message?: string): ValidatorCheck;
|
|
3505
3483
|
}
|
|
3506
3484
|
|
|
3485
|
+
/**
|
|
3486
|
+
* Font source configuration for custom fonts
|
|
3487
|
+
*/
|
|
3488
|
+
export declare type FontSource = {
|
|
3489
|
+
source: 'google';
|
|
3490
|
+
name: string;
|
|
3491
|
+
weights?: (number | string)[];
|
|
3492
|
+
} | {
|
|
3493
|
+
source: 'custom';
|
|
3494
|
+
url: string;
|
|
3495
|
+
format?: 'woff2' | 'woff';
|
|
3496
|
+
};
|
|
3497
|
+
|
|
3507
3498
|
declare interface GTINOptions {
|
|
3508
3499
|
message?: string;
|
|
3509
3500
|
}
|
|
@@ -3520,6 +3511,11 @@ export declare class ImportCancelledError extends Error {
|
|
|
3520
3511
|
constructor(message?: string);
|
|
3521
3512
|
}
|
|
3522
3513
|
|
|
3514
|
+
export declare interface ImportDeliveryContext extends ImportSessionContext {
|
|
3515
|
+
/** Stable ID for the delivery attempt that completed or failed */
|
|
3516
|
+
deliveryId: string;
|
|
3517
|
+
}
|
|
3518
|
+
|
|
3523
3519
|
/**
|
|
3524
3520
|
* Importer preload mode
|
|
3525
3521
|
*/
|
|
@@ -3528,10 +3524,15 @@ export declare enum ImporterMode {
|
|
|
3528
3524
|
PRELOAD = "preload"
|
|
3529
3525
|
}
|
|
3530
3526
|
|
|
3527
|
+
export declare type ImportErrorContext = ImportSessionContext & {
|
|
3528
|
+
/** Present when an error occurs while delivering records */
|
|
3529
|
+
deliveryId?: string;
|
|
3530
|
+
};
|
|
3531
|
+
|
|
3531
3532
|
/**
|
|
3532
|
-
* Importer lifecycle
|
|
3533
|
+
* Importer lifecycle status
|
|
3533
3534
|
*/
|
|
3534
|
-
export declare enum
|
|
3535
|
+
export declare enum ImporterStatus {
|
|
3535
3536
|
UNINITIALIZED = "uninitialized",
|
|
3536
3537
|
INITIALIZING = "initializing",
|
|
3537
3538
|
READY = "ready",
|
|
@@ -3543,8 +3544,13 @@ export declare enum ImporterState {
|
|
|
3543
3544
|
DESTROYED = "destroyed"
|
|
3544
3545
|
}
|
|
3545
3546
|
|
|
3547
|
+
/**
|
|
3548
|
+
* Core step identifiers for the CSV importer
|
|
3549
|
+
*/
|
|
3550
|
+
export declare type ImporterStep = 'upload' | 'select-sheet' | 'select-header' | 'match-columns' | 'match-options' | 'review';
|
|
3551
|
+
|
|
3546
3552
|
export declare interface ImportSessionContext {
|
|
3547
|
-
/**
|
|
3553
|
+
/** Stable ID that groups one import run across chunks and lifecycle callbacks */
|
|
3548
3554
|
sessionId: string;
|
|
3549
3555
|
}
|
|
3550
3556
|
|
|
@@ -3580,20 +3586,18 @@ declare interface MultiselectOptions {
|
|
|
3580
3586
|
export declare type OpenOptions<T> = {
|
|
3581
3587
|
/** Callback for processing delivered chunks */
|
|
3582
3588
|
onData: (chunk: RecordsChunk<T>, next: () => void) => void | Promise<void>;
|
|
3583
|
-
/**
|
|
3584
|
-
chunkSize?:
|
|
3589
|
+
/** Chunk size by KB quota or row count. Defaults to 500 KB. Values <= 0 send one chunk. */
|
|
3590
|
+
chunkSize?: ChunkSize;
|
|
3585
3591
|
/** Called when all chunks have been processed */
|
|
3586
|
-
onComplete?: (context:
|
|
3592
|
+
onComplete?: (context: ImportDeliveryContext) => void;
|
|
3587
3593
|
/** Called when the user cancels the import */
|
|
3588
3594
|
onCancel?: (context: ImportSessionContext) => void;
|
|
3589
3595
|
/** Called when an error occurs */
|
|
3590
|
-
onError?: (error: Error, context:
|
|
3596
|
+
onError?: (error: Error, context: ImportErrorContext) => void;
|
|
3591
3597
|
/** Called when the importer opens */
|
|
3592
|
-
|
|
3593
|
-
/** Called when the importer
|
|
3594
|
-
|
|
3595
|
-
/** Called when the step changes in the wizard */
|
|
3596
|
-
onStepChange?: (stepId: ExpressCSVStep, previousStepId?: ExpressCSVStep) => void;
|
|
3598
|
+
onOpen?: (context: ImportSessionContext) => void;
|
|
3599
|
+
/** Called when the importer step changes */
|
|
3600
|
+
onStepChange?: (stepId: ImporterStep, previousStepId?: ImporterStep) => void;
|
|
3597
3601
|
};
|
|
3598
3602
|
|
|
3599
3603
|
declare interface PersistedImportSessionData {
|
|
@@ -3622,7 +3626,6 @@ declare interface PrimitiveExBaseDef extends ExBaseDef {
|
|
|
3622
3626
|
columnNameAliases?: string[];
|
|
3623
3627
|
description?: string;
|
|
3624
3628
|
label?: string;
|
|
3625
|
-
example?: string;
|
|
3626
3629
|
message?: string;
|
|
3627
3630
|
checks?: ValidatorCheck[];
|
|
3628
3631
|
defaultValue?: unknown | (() => unknown);
|
|
@@ -3650,13 +3653,6 @@ declare abstract class PrimitiveExType<Output, Def extends PrimitiveExBaseDef, I
|
|
|
3650
3653
|
* @returns The type instance for method chaining
|
|
3651
3654
|
*/
|
|
3652
3655
|
label(text: string): this;
|
|
3653
|
-
/**
|
|
3654
|
-
* Sets an example value for this field
|
|
3655
|
-
*
|
|
3656
|
-
* @param text - Example text
|
|
3657
|
-
* @returns The type instance for method chaining
|
|
3658
|
-
*/
|
|
3659
|
-
example(text: string): this;
|
|
3660
3656
|
/**
|
|
3661
3657
|
* Adds a custom refinement validator to this field.
|
|
3662
3658
|
*
|
|
@@ -3699,6 +3695,10 @@ declare abstract class PrimitiveExType<Output, Def extends PrimitiveExBaseDef, I
|
|
|
3699
3695
|
protected _replaceOrAddCheck(check: ValidatorCheck, existingIndex: number): void;
|
|
3700
3696
|
}
|
|
3701
3697
|
|
|
3698
|
+
export declare type PromptedEditHandler<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = PromptedEditsFn<SchemaFieldName<TSchema>>;
|
|
3699
|
+
|
|
3700
|
+
export declare type PromptedEditResult<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = PromptedEditsResult<SchemaFieldName<TSchema>>;
|
|
3701
|
+
|
|
3702
3702
|
export declare type PromptedEditsChange<TField extends string = string> = {
|
|
3703
3703
|
type: 'add';
|
|
3704
3704
|
values: Partial<Record<TField, unknown>>;
|
|
@@ -3754,14 +3754,14 @@ export declare interface RecordsChunk<T> {
|
|
|
3754
3754
|
records: T[];
|
|
3755
3755
|
/** Total number of chunks */
|
|
3756
3756
|
totalChunks: number;
|
|
3757
|
-
/**
|
|
3758
|
-
|
|
3757
|
+
/** Chunk index within this delivery (0-based) */
|
|
3758
|
+
chunkIndex: number;
|
|
3759
3759
|
/** Total number of records across all chunks */
|
|
3760
3760
|
totalRecords: number;
|
|
3761
|
-
/**
|
|
3761
|
+
/** Stable ID that groups one import run across chunks and lifecycle callbacks */
|
|
3762
3762
|
sessionId: string;
|
|
3763
|
-
/** Stable
|
|
3764
|
-
|
|
3763
|
+
/** Stable ID for this delivery attempt within the import session */
|
|
3764
|
+
deliveryId: string;
|
|
3765
3765
|
}
|
|
3766
3766
|
|
|
3767
3767
|
export declare type RecoveredSession = PersistedImportSessionData;
|
|
@@ -3797,19 +3797,20 @@ declare type RefineResultItem = {
|
|
|
3797
3797
|
};
|
|
3798
3798
|
};
|
|
3799
3799
|
|
|
3800
|
-
declare type SchemaFieldName<TSchema extends ExType<unknown, ExBaseDef, unknown>> = Extract<keyof Infer<TSchema>, string>;
|
|
3800
|
+
export declare type SchemaFieldName<TSchema extends ExType<unknown, ExBaseDef, unknown>> = Extract<keyof Infer<TSchema>, string>;
|
|
3801
3801
|
|
|
3802
3802
|
export declare interface SDKOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> {
|
|
3803
3803
|
schema: TSchema;
|
|
3804
|
-
|
|
3805
|
-
|
|
3804
|
+
getAuthToken: () => Promise<string>;
|
|
3805
|
+
/** Stable namespace string your app assigns to this importer configuration or workflow */
|
|
3806
|
+
importNamespace: string;
|
|
3806
3807
|
title?: string;
|
|
3807
3808
|
debug?: boolean;
|
|
3808
3809
|
preload?: boolean;
|
|
3809
|
-
theme?:
|
|
3810
|
+
theme?: Theme;
|
|
3810
3811
|
colorMode?: ColorModePref;
|
|
3811
3812
|
customCSS?: string;
|
|
3812
|
-
fonts?: Record<string,
|
|
3813
|
+
fonts?: Record<string, FontSource>;
|
|
3813
3814
|
stepDisplay?: 'progressBar' | 'segmented' | 'numbered';
|
|
3814
3815
|
previewSchemaBeforeUpload?: boolean;
|
|
3815
3816
|
columnMatching?: ColumnMatchingOptions<TSchema>;
|
|
@@ -3908,6 +3909,26 @@ declare type TemplateString<TVars extends string = string> = string & {
|
|
|
3908
3909
|
readonly __vars: TVars;
|
|
3909
3910
|
};
|
|
3910
3911
|
|
|
3912
|
+
/**
|
|
3913
|
+
* Theme - can be either dual-mode (light/dark) or single-mode (applies to both)
|
|
3914
|
+
*/
|
|
3915
|
+
export declare type Theme = ThemeWithModes | ThemeSingle;
|
|
3916
|
+
|
|
3917
|
+
/**
|
|
3918
|
+
* Single theme that applies to both light and dark modes
|
|
3919
|
+
*/
|
|
3920
|
+
declare type ThemeSingle = TailwindThemeVars;
|
|
3921
|
+
|
|
3922
|
+
/**
|
|
3923
|
+
* Theme with light and dark mode support
|
|
3924
|
+
*/
|
|
3925
|
+
declare interface ThemeWithModes {
|
|
3926
|
+
modes: {
|
|
3927
|
+
light: TailwindThemeVars;
|
|
3928
|
+
dark: TailwindThemeVars;
|
|
3929
|
+
};
|
|
3930
|
+
}
|
|
3931
|
+
|
|
3911
3932
|
/**
|
|
3912
3933
|
* Time validation options
|
|
3913
3934
|
*/
|
|
@@ -3924,11 +3945,9 @@ declare interface URLOptions {
|
|
|
3924
3945
|
message?: string;
|
|
3925
3946
|
}
|
|
3926
3947
|
|
|
3927
|
-
export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title,
|
|
3948
|
+
export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title, importNamespace, getAuthToken, debug, preload, theme, colorMode, customCSS, fonts, stepDisplay, previewSchemaBeforeUpload, columnMatching, promptedEdits, templateDownload, sessionRecovery, locale, disableStatusStep, }: UseExpressCSVOptions<TSchema>): {
|
|
3928
3949
|
open: (options: OpenOptions<Infer<TSchema>>) => void;
|
|
3929
|
-
|
|
3930
|
-
isInitialising: boolean;
|
|
3931
|
-
isOpen: boolean;
|
|
3950
|
+
status: ImporterStatus;
|
|
3932
3951
|
};
|
|
3933
3952
|
|
|
3934
3953
|
export declare type UseExpressCSVOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> = SDKOptions<TSchema>;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,18 @@ declare interface BICOptions {
|
|
|
4
4
|
|
|
5
5
|
declare type BooleanControlType = 'toggle' | 'checkbox' | 'dropdown';
|
|
6
6
|
|
|
7
|
+
export declare type ChunkSize = {
|
|
8
|
+
/** Size quota unit. */
|
|
9
|
+
unit: 'kb';
|
|
10
|
+
/** KB quota. Values <= 0 send all rows in one chunk. */
|
|
11
|
+
value: number;
|
|
12
|
+
} | {
|
|
13
|
+
/** Chunk by row count. */
|
|
14
|
+
unit: 'rows';
|
|
15
|
+
/** Rows per chunk. Values <= 0 send all rows in one chunk. */
|
|
16
|
+
value: number;
|
|
17
|
+
};
|
|
18
|
+
|
|
7
19
|
/**
|
|
8
20
|
* Color mode preference
|
|
9
21
|
*/
|
|
@@ -14,6 +26,10 @@ export declare interface ColumnMatch<TTargetField extends string = string> {
|
|
|
14
26
|
targetField: TTargetField;
|
|
15
27
|
}
|
|
16
28
|
|
|
29
|
+
export declare type ColumnMatchHandler<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = ColumnMatchingFn<SchemaFieldName<TSchema>>;
|
|
30
|
+
|
|
31
|
+
export declare type ColumnMatchHandlerResult<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = ColumnMatchingResult<SchemaFieldName<TSchema>>;
|
|
32
|
+
|
|
17
33
|
export declare type ColumnMatchingFn<TTargetField extends string = string> = (data: ColumnMatchingParams) => Promise<ColumnMatchingResult<TTargetField>>;
|
|
18
34
|
|
|
19
35
|
export declare type ColumnMatchingOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = ManagedColumnMatchingOptions | CustomColumnMatchingOptions<TSchema>;
|
|
@@ -1913,12 +1929,12 @@ declare const CurrencyCodes: readonly [{
|
|
|
1913
1929
|
|
|
1914
1930
|
declare type CustomColumnMatchingOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = {
|
|
1915
1931
|
type: 'custom';
|
|
1916
|
-
|
|
1932
|
+
columnMatchHandler: ColumnMatchHandler<TSchema>;
|
|
1917
1933
|
};
|
|
1918
1934
|
|
|
1919
1935
|
declare type CustomPromptedEditsOptions<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = {
|
|
1920
1936
|
type: 'custom';
|
|
1921
|
-
|
|
1937
|
+
promptedEditHandler: PromptedEditHandler<TSchema>;
|
|
1922
1938
|
};
|
|
1923
1939
|
|
|
1924
1940
|
export declare type CustomSessionRecoveryOptions = {
|
|
@@ -1936,39 +1952,6 @@ export declare type DeepPartial<T> = {
|
|
|
1936
1952
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
1937
1953
|
};
|
|
1938
1954
|
|
|
1939
|
-
/**
|
|
1940
|
-
* Font source configuration for custom fonts
|
|
1941
|
-
*/
|
|
1942
|
-
export declare type ECSVFontSource = {
|
|
1943
|
-
source: 'google';
|
|
1944
|
-
name: string;
|
|
1945
|
-
weights?: (number | string)[];
|
|
1946
|
-
} | {
|
|
1947
|
-
source: 'custom';
|
|
1948
|
-
url: string;
|
|
1949
|
-
format?: 'woff2' | 'woff';
|
|
1950
|
-
};
|
|
1951
|
-
|
|
1952
|
-
/**
|
|
1953
|
-
* Theme - can be either dual-mode (light/dark) or single-mode (applies to both)
|
|
1954
|
-
*/
|
|
1955
|
-
export declare type ECSVTheme = ECSVThemeWithModes | ECSVThemeSingle;
|
|
1956
|
-
|
|
1957
|
-
/**
|
|
1958
|
-
* Single theme that applies to both light and dark modes
|
|
1959
|
-
*/
|
|
1960
|
-
declare type ECSVThemeSingle = TailwindThemeVars;
|
|
1961
|
-
|
|
1962
|
-
/**
|
|
1963
|
-
* Theme with light and dark mode support
|
|
1964
|
-
*/
|
|
1965
|
-
declare interface ECSVThemeWithModes {
|
|
1966
|
-
modes: {
|
|
1967
|
-
light: TailwindThemeVars;
|
|
1968
|
-
dark: TailwindThemeVars;
|
|
1969
|
-
};
|
|
1970
|
-
}
|
|
1971
|
-
|
|
1972
1955
|
declare interface ExBaseDef {
|
|
1973
1956
|
typeName: string;
|
|
1974
1957
|
}
|
|
@@ -3044,11 +3027,6 @@ declare interface ExpressCSVLocale {
|
|
|
3044
3027
|
/** User-facing locale type where every leaf is a plain `string`. */
|
|
3045
3028
|
export declare type ExpressCSVLocaleInput = StripBrand<ExpressCSVLocale>;
|
|
3046
3029
|
|
|
3047
|
-
/**
|
|
3048
|
-
* Core step identifiers for the CSV import wizard
|
|
3049
|
-
*/
|
|
3050
|
-
export declare type ExpressCSVStep = 'upload' | 'select-sheet' | 'select-header' | 'match-columns' | 'match-options' | 'review';
|
|
3051
|
-
|
|
3052
3030
|
declare type ExPrimitiveType = ExString | ExNumber | ExCurrencyNumber | ExPercentageNumber | ExBoolean | ExDate | ExTime | ExDatetime | ExSelect<string | number> | ExMultiselect<string | number> | ExOptionalPrimitiveType;
|
|
3053
3031
|
|
|
3054
3032
|
declare class ExRow<T extends ExRowShape> extends ExType<{
|
|
@@ -3504,6 +3482,19 @@ declare abstract class ExType<Output, Def extends ExBaseDef, Input = Output> {
|
|
|
3504
3482
|
protected _addCheck(type: string, params?: Record<string, unknown>, message?: string): ValidatorCheck;
|
|
3505
3483
|
}
|
|
3506
3484
|
|
|
3485
|
+
/**
|
|
3486
|
+
* Font source configuration for custom fonts
|
|
3487
|
+
*/
|
|
3488
|
+
export declare type FontSource = {
|
|
3489
|
+
source: 'google';
|
|
3490
|
+
name: string;
|
|
3491
|
+
weights?: (number | string)[];
|
|
3492
|
+
} | {
|
|
3493
|
+
source: 'custom';
|
|
3494
|
+
url: string;
|
|
3495
|
+
format?: 'woff2' | 'woff';
|
|
3496
|
+
};
|
|
3497
|
+
|
|
3507
3498
|
declare interface GTINOptions {
|
|
3508
3499
|
message?: string;
|
|
3509
3500
|
}
|
|
@@ -3520,6 +3511,11 @@ export declare class ImportCancelledError extends Error {
|
|
|
3520
3511
|
constructor(message?: string);
|
|
3521
3512
|
}
|
|
3522
3513
|
|
|
3514
|
+
export declare interface ImportDeliveryContext extends ImportSessionContext {
|
|
3515
|
+
/** Stable ID for the delivery attempt that completed or failed */
|
|
3516
|
+
deliveryId: string;
|
|
3517
|
+
}
|
|
3518
|
+
|
|
3523
3519
|
/**
|
|
3524
3520
|
* Importer preload mode
|
|
3525
3521
|
*/
|
|
@@ -3528,10 +3524,15 @@ export declare enum ImporterMode {
|
|
|
3528
3524
|
PRELOAD = "preload"
|
|
3529
3525
|
}
|
|
3530
3526
|
|
|
3527
|
+
export declare type ImportErrorContext = ImportSessionContext & {
|
|
3528
|
+
/** Present when an error occurs while delivering records */
|
|
3529
|
+
deliveryId?: string;
|
|
3530
|
+
};
|
|
3531
|
+
|
|
3531
3532
|
/**
|
|
3532
|
-
* Importer lifecycle
|
|
3533
|
+
* Importer lifecycle status
|
|
3533
3534
|
*/
|
|
3534
|
-
export declare enum
|
|
3535
|
+
export declare enum ImporterStatus {
|
|
3535
3536
|
UNINITIALIZED = "uninitialized",
|
|
3536
3537
|
INITIALIZING = "initializing",
|
|
3537
3538
|
READY = "ready",
|
|
@@ -3543,8 +3544,13 @@ export declare enum ImporterState {
|
|
|
3543
3544
|
DESTROYED = "destroyed"
|
|
3544
3545
|
}
|
|
3545
3546
|
|
|
3547
|
+
/**
|
|
3548
|
+
* Core step identifiers for the CSV importer
|
|
3549
|
+
*/
|
|
3550
|
+
export declare type ImporterStep = 'upload' | 'select-sheet' | 'select-header' | 'match-columns' | 'match-options' | 'review';
|
|
3551
|
+
|
|
3546
3552
|
export declare interface ImportSessionContext {
|
|
3547
|
-
/**
|
|
3553
|
+
/** Stable ID that groups one import run across chunks and lifecycle callbacks */
|
|
3548
3554
|
sessionId: string;
|
|
3549
3555
|
}
|
|
3550
3556
|
|
|
@@ -3580,20 +3586,18 @@ declare interface MultiselectOptions {
|
|
|
3580
3586
|
export declare type OpenOptions<T> = {
|
|
3581
3587
|
/** Callback for processing delivered chunks */
|
|
3582
3588
|
onData: (chunk: RecordsChunk<T>, next: () => void) => void | Promise<void>;
|
|
3583
|
-
/**
|
|
3584
|
-
chunkSize?:
|
|
3589
|
+
/** Chunk size by KB quota or row count. Defaults to 500 KB. Values <= 0 send one chunk. */
|
|
3590
|
+
chunkSize?: ChunkSize;
|
|
3585
3591
|
/** Called when all chunks have been processed */
|
|
3586
|
-
onComplete?: (context:
|
|
3592
|
+
onComplete?: (context: ImportDeliveryContext) => void;
|
|
3587
3593
|
/** Called when the user cancels the import */
|
|
3588
3594
|
onCancel?: (context: ImportSessionContext) => void;
|
|
3589
3595
|
/** Called when an error occurs */
|
|
3590
|
-
onError?: (error: Error, context:
|
|
3596
|
+
onError?: (error: Error, context: ImportErrorContext) => void;
|
|
3591
3597
|
/** Called when the importer opens */
|
|
3592
|
-
|
|
3593
|
-
/** Called when the importer
|
|
3594
|
-
|
|
3595
|
-
/** Called when the step changes in the wizard */
|
|
3596
|
-
onStepChange?: (stepId: ExpressCSVStep, previousStepId?: ExpressCSVStep) => void;
|
|
3598
|
+
onOpen?: (context: ImportSessionContext) => void;
|
|
3599
|
+
/** Called when the importer step changes */
|
|
3600
|
+
onStepChange?: (stepId: ImporterStep, previousStepId?: ImporterStep) => void;
|
|
3597
3601
|
};
|
|
3598
3602
|
|
|
3599
3603
|
declare interface PersistedImportSessionData {
|
|
@@ -3622,7 +3626,6 @@ declare interface PrimitiveExBaseDef extends ExBaseDef {
|
|
|
3622
3626
|
columnNameAliases?: string[];
|
|
3623
3627
|
description?: string;
|
|
3624
3628
|
label?: string;
|
|
3625
|
-
example?: string;
|
|
3626
3629
|
message?: string;
|
|
3627
3630
|
checks?: ValidatorCheck[];
|
|
3628
3631
|
defaultValue?: unknown | (() => unknown);
|
|
@@ -3650,13 +3653,6 @@ declare abstract class PrimitiveExType<Output, Def extends PrimitiveExBaseDef, I
|
|
|
3650
3653
|
* @returns The type instance for method chaining
|
|
3651
3654
|
*/
|
|
3652
3655
|
label(text: string): this;
|
|
3653
|
-
/**
|
|
3654
|
-
* Sets an example value for this field
|
|
3655
|
-
*
|
|
3656
|
-
* @param text - Example text
|
|
3657
|
-
* @returns The type instance for method chaining
|
|
3658
|
-
*/
|
|
3659
|
-
example(text: string): this;
|
|
3660
3656
|
/**
|
|
3661
3657
|
* Adds a custom refinement validator to this field.
|
|
3662
3658
|
*
|
|
@@ -3699,6 +3695,10 @@ declare abstract class PrimitiveExType<Output, Def extends PrimitiveExBaseDef, I
|
|
|
3699
3695
|
protected _replaceOrAddCheck(check: ValidatorCheck, existingIndex: number): void;
|
|
3700
3696
|
}
|
|
3701
3697
|
|
|
3698
|
+
export declare type PromptedEditHandler<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = PromptedEditsFn<SchemaFieldName<TSchema>>;
|
|
3699
|
+
|
|
3700
|
+
export declare type PromptedEditResult<TSchema extends ExType<unknown, ExBaseDef, unknown> = ExRow<ExRowShape>> = PromptedEditsResult<SchemaFieldName<TSchema>>;
|
|
3701
|
+
|
|
3702
3702
|
export declare type PromptedEditsChange<TField extends string = string> = {
|
|
3703
3703
|
type: 'add';
|
|
3704
3704
|
values: Partial<Record<TField, unknown>>;
|
|
@@ -3754,14 +3754,14 @@ export declare interface RecordsChunk<T> {
|
|
|
3754
3754
|
records: T[];
|
|
3755
3755
|
/** Total number of chunks */
|
|
3756
3756
|
totalChunks: number;
|
|
3757
|
-
/**
|
|
3758
|
-
|
|
3757
|
+
/** Chunk index within this delivery (0-based) */
|
|
3758
|
+
chunkIndex: number;
|
|
3759
3759
|
/** Total number of records across all chunks */
|
|
3760
3760
|
totalRecords: number;
|
|
3761
|
-
/**
|
|
3761
|
+
/** Stable ID that groups one import run across chunks and lifecycle callbacks */
|
|
3762
3762
|
sessionId: string;
|
|
3763
|
-
/** Stable
|
|
3764
|
-
|
|
3763
|
+
/** Stable ID for this delivery attempt within the import session */
|
|
3764
|
+
deliveryId: string;
|
|
3765
3765
|
}
|
|
3766
3766
|
|
|
3767
3767
|
export declare type RecoveredSession = PersistedImportSessionData;
|
|
@@ -3797,19 +3797,20 @@ declare type RefineResultItem = {
|
|
|
3797
3797
|
};
|
|
3798
3798
|
};
|
|
3799
3799
|
|
|
3800
|
-
declare type SchemaFieldName<TSchema extends ExType<unknown, ExBaseDef, unknown>> = Extract<keyof Infer<TSchema>, string>;
|
|
3800
|
+
export declare type SchemaFieldName<TSchema extends ExType<unknown, ExBaseDef, unknown>> = Extract<keyof Infer<TSchema>, string>;
|
|
3801
3801
|
|
|
3802
3802
|
export declare interface SDKOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> {
|
|
3803
3803
|
schema: TSchema;
|
|
3804
|
-
|
|
3805
|
-
|
|
3804
|
+
getAuthToken: () => Promise<string>;
|
|
3805
|
+
/** Stable namespace string your app assigns to this importer configuration or workflow */
|
|
3806
|
+
importNamespace: string;
|
|
3806
3807
|
title?: string;
|
|
3807
3808
|
debug?: boolean;
|
|
3808
3809
|
preload?: boolean;
|
|
3809
|
-
theme?:
|
|
3810
|
+
theme?: Theme;
|
|
3810
3811
|
colorMode?: ColorModePref;
|
|
3811
3812
|
customCSS?: string;
|
|
3812
|
-
fonts?: Record<string,
|
|
3813
|
+
fonts?: Record<string, FontSource>;
|
|
3813
3814
|
stepDisplay?: 'progressBar' | 'segmented' | 'numbered';
|
|
3814
3815
|
previewSchemaBeforeUpload?: boolean;
|
|
3815
3816
|
columnMatching?: ColumnMatchingOptions<TSchema>;
|
|
@@ -3908,6 +3909,26 @@ declare type TemplateString<TVars extends string = string> = string & {
|
|
|
3908
3909
|
readonly __vars: TVars;
|
|
3909
3910
|
};
|
|
3910
3911
|
|
|
3912
|
+
/**
|
|
3913
|
+
* Theme - can be either dual-mode (light/dark) or single-mode (applies to both)
|
|
3914
|
+
*/
|
|
3915
|
+
export declare type Theme = ThemeWithModes | ThemeSingle;
|
|
3916
|
+
|
|
3917
|
+
/**
|
|
3918
|
+
* Single theme that applies to both light and dark modes
|
|
3919
|
+
*/
|
|
3920
|
+
declare type ThemeSingle = TailwindThemeVars;
|
|
3921
|
+
|
|
3922
|
+
/**
|
|
3923
|
+
* Theme with light and dark mode support
|
|
3924
|
+
*/
|
|
3925
|
+
declare interface ThemeWithModes {
|
|
3926
|
+
modes: {
|
|
3927
|
+
light: TailwindThemeVars;
|
|
3928
|
+
dark: TailwindThemeVars;
|
|
3929
|
+
};
|
|
3930
|
+
}
|
|
3931
|
+
|
|
3911
3932
|
/**
|
|
3912
3933
|
* Time validation options
|
|
3913
3934
|
*/
|
|
@@ -3924,11 +3945,9 @@ declare interface URLOptions {
|
|
|
3924
3945
|
message?: string;
|
|
3925
3946
|
}
|
|
3926
3947
|
|
|
3927
|
-
export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title,
|
|
3948
|
+
export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title, importNamespace, getAuthToken, debug, preload, theme, colorMode, customCSS, fonts, stepDisplay, previewSchemaBeforeUpload, columnMatching, promptedEdits, templateDownload, sessionRecovery, locale, disableStatusStep, }: UseExpressCSVOptions<TSchema>): {
|
|
3928
3949
|
open: (options: OpenOptions<Infer<TSchema>>) => void;
|
|
3929
|
-
|
|
3930
|
-
isInitialising: boolean;
|
|
3931
|
-
isOpen: boolean;
|
|
3950
|
+
status: ImporterStatus;
|
|
3932
3951
|
};
|
|
3933
3952
|
|
|
3934
3953
|
export declare type UseExpressCSVOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> = SDKOptions<TSchema>;
|