@expresscsv/react 1.0.0 → 1.3.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.
- package/README.md +11 -11
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ const schema = x.row({
|
|
|
36
36
|
function App() {
|
|
37
37
|
const { open, status } = useExpressCSV({
|
|
38
38
|
schema,
|
|
39
|
-
|
|
39
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
40
40
|
importNamespace: "user-import",
|
|
41
41
|
title: "Import Users",
|
|
42
42
|
});
|
|
@@ -73,7 +73,7 @@ function App() {
|
|
|
73
73
|
}
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
Have your backend keep the ExpressCSV secret key, call the ExpressCSV session-creation endpoint, and return a short-lived importer
|
|
76
|
+
Have your backend keep the ExpressCSV secret key, call the ExpressCSV session-creation endpoint, and return a short-lived importer auth token to the browser via `getAuthToken`.
|
|
77
77
|
|
|
78
78
|
## Preloading
|
|
79
79
|
|
|
@@ -82,7 +82,7 @@ By default the importer preloads in a hidden iframe so it appears instantly when
|
|
|
82
82
|
```tsx
|
|
83
83
|
const { open } = useExpressCSV({
|
|
84
84
|
schema,
|
|
85
|
-
|
|
85
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
86
86
|
importNamespace: "user-import",
|
|
87
87
|
});
|
|
88
88
|
|
|
@@ -102,7 +102,7 @@ To disable preloading (there will be a brief loading screen instead):
|
|
|
102
102
|
```tsx
|
|
103
103
|
const { open } = useExpressCSV({
|
|
104
104
|
schema,
|
|
105
|
-
|
|
105
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
106
106
|
importNamespace: "user-import",
|
|
107
107
|
preload: false,
|
|
108
108
|
});
|
|
@@ -126,7 +126,7 @@ const candidateSchema = x.row({
|
|
|
126
126
|
|
|
127
127
|
const { open } = useExpressCSV({
|
|
128
128
|
schema: candidateSchema,
|
|
129
|
-
|
|
129
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
130
130
|
importNamespace: "candidate-import",
|
|
131
131
|
templateDownload: {
|
|
132
132
|
source: "generate",
|
|
@@ -183,7 +183,7 @@ const dualTheme: Theme = {
|
|
|
183
183
|
function App() {
|
|
184
184
|
const { open } = useExpressCSV({
|
|
185
185
|
schema,
|
|
186
|
-
|
|
186
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
187
187
|
importNamespace: "user-import",
|
|
188
188
|
theme,
|
|
189
189
|
});
|
|
@@ -229,7 +229,7 @@ Control light/dark mode with `colorMode`:
|
|
|
229
229
|
```tsx
|
|
230
230
|
const { open } = useExpressCSV({
|
|
231
231
|
schema,
|
|
232
|
-
|
|
232
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
233
233
|
importNamespace: "user-import",
|
|
234
234
|
colorMode: "system", // 'light' | 'dark' | 'system'
|
|
235
235
|
});
|
|
@@ -242,7 +242,7 @@ Inject custom CSS for fine-grained styling overrides.
|
|
|
242
242
|
```tsx
|
|
243
243
|
const { open } = useExpressCSV({
|
|
244
244
|
schema,
|
|
245
|
-
|
|
245
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
246
246
|
importNamespace: "user-import",
|
|
247
247
|
customCSS: `
|
|
248
248
|
.ecsv [data-step="upload"] {
|
|
@@ -262,7 +262,7 @@ Load custom fonts via the `fonts` option:
|
|
|
262
262
|
```tsx
|
|
263
263
|
const { open } = useExpressCSV({
|
|
264
264
|
schema,
|
|
265
|
-
|
|
265
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
266
266
|
importNamespace: "user-import",
|
|
267
267
|
fonts: {
|
|
268
268
|
title: { source: "google", name: "Space Grotesk", weights: [400, 600, 700] },
|
|
@@ -355,7 +355,7 @@ function CandidateImporter() {
|
|
|
355
355
|
|
|
356
356
|
const { open, status: importerStatus } = useExpressCSV({
|
|
357
357
|
schema: candidateSchema,
|
|
358
|
-
|
|
358
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
359
359
|
importNamespace: "candidate-import",
|
|
360
360
|
title: "Import Candidates",
|
|
361
361
|
});
|
|
@@ -418,7 +418,7 @@ function useExpressCSV<TSchema>(
|
|
|
418
418
|
| Option | Type | Required | Default | Description |
|
|
419
419
|
|---|---|---|---|---|
|
|
420
420
|
| `schema` | Schema | Yes | - | Schema definition created with `x.row()` |
|
|
421
|
-
| `
|
|
421
|
+
| `getAuthToken` | `() => Promise<string>` | Yes | - | Async callback that asks your backend for a short-lived importer auth token |
|
|
422
422
|
| `importNamespace` | `string` | Yes | - | Stable namespace string your app assigns to this importer configuration. Keep it the same for the same workflow; use a different value for different importers. |
|
|
423
423
|
| `title` | `string` | No | - | Title shown in the importer header |
|
|
424
424
|
| `preload` | `boolean` | No | `true` | Preload the importer for instant display |
|
package/dist/index.d.cts
CHANGED
|
@@ -3801,7 +3801,7 @@ export declare type SchemaFieldName<TSchema extends ExType<unknown, ExBaseDef, u
|
|
|
3801
3801
|
|
|
3802
3802
|
export declare interface SDKOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> {
|
|
3803
3803
|
schema: TSchema;
|
|
3804
|
-
|
|
3804
|
+
getAuthToken: () => Promise<string>;
|
|
3805
3805
|
/** Stable namespace string your app assigns to this importer configuration or workflow */
|
|
3806
3806
|
importNamespace: string;
|
|
3807
3807
|
title?: string;
|
|
@@ -3945,7 +3945,7 @@ declare interface URLOptions {
|
|
|
3945
3945
|
message?: string;
|
|
3946
3946
|
}
|
|
3947
3947
|
|
|
3948
|
-
export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title, importNamespace,
|
|
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>): {
|
|
3949
3949
|
open: (options: OpenOptions<Infer<TSchema>>) => void;
|
|
3950
3950
|
status: ImporterStatus;
|
|
3951
3951
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -3801,7 +3801,7 @@ export declare type SchemaFieldName<TSchema extends ExType<unknown, ExBaseDef, u
|
|
|
3801
3801
|
|
|
3802
3802
|
export declare interface SDKOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> {
|
|
3803
3803
|
schema: TSchema;
|
|
3804
|
-
|
|
3804
|
+
getAuthToken: () => Promise<string>;
|
|
3805
3805
|
/** Stable namespace string your app assigns to this importer configuration or workflow */
|
|
3806
3806
|
importNamespace: string;
|
|
3807
3807
|
title?: string;
|
|
@@ -3945,7 +3945,7 @@ declare interface URLOptions {
|
|
|
3945
3945
|
message?: string;
|
|
3946
3946
|
}
|
|
3947
3947
|
|
|
3948
|
-
export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title, importNamespace,
|
|
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>): {
|
|
3949
3949
|
open: (options: OpenOptions<Infer<TSchema>>) => void;
|
|
3950
3950
|
status: ImporterStatus;
|
|
3951
3951
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -3801,7 +3801,7 @@ export declare type SchemaFieldName<TSchema extends ExType<unknown, ExBaseDef, u
|
|
|
3801
3801
|
|
|
3802
3802
|
export declare interface SDKOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> {
|
|
3803
3803
|
schema: TSchema;
|
|
3804
|
-
|
|
3804
|
+
getAuthToken: () => Promise<string>;
|
|
3805
3805
|
/** Stable namespace string your app assigns to this importer configuration or workflow */
|
|
3806
3806
|
importNamespace: string;
|
|
3807
3807
|
title?: string;
|
|
@@ -3945,7 +3945,7 @@ declare interface URLOptions {
|
|
|
3945
3945
|
message?: string;
|
|
3946
3946
|
}
|
|
3947
3947
|
|
|
3948
|
-
export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title, importNamespace,
|
|
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>): {
|
|
3949
3949
|
open: (options: OpenOptions<Infer<TSchema>>) => void;
|
|
3950
3950
|
status: ImporterStatus;
|
|
3951
3951
|
};
|