@expresscsv/react 0.1.20 → 0.1.22

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@expresscsv/react.svg)](https://www.npmjs.com/package/@expresscsv/react)
4
4
  ![license](https://img.shields.io/npm/l/@expresscsv/react.svg)
5
5
 
6
- React hook for embedding the [ExpressCSV](https://expresscsv.com) CSV import widget. Wraps [`@expresscsv/sdk`](https://www.npmjs.com/package/@expresscsv/sdk) with automatic lifecycle management and reactive state.
6
+ React hook for embedding the [ExpressCSV](https://expresscsv.com) CSV importer. Wraps [`@expresscsv/sdk`](https://www.npmjs.com/package/@expresscsv/sdk) with automatic lifecycle management and reactive state.
7
7
 
8
8
  If you want to define schemas in shared or backend code without any frontend dependencies, use [`@expresscsv/schemas`](https://www.npmjs.com/package/@expresscsv/schemas) for the schema definition itself, then pass that schema into `@expresscsv/react`.
9
9
 
@@ -36,7 +36,7 @@ const schema = x.row({
36
36
  function App() {
37
37
  const { open, isOpen } = useExpressCSV({
38
38
  schema,
39
- publishableKey: "your-publishable-key",
39
+ getSessionToken: async () => fetchSessionToken(),
40
40
  importIdentifier: "user-import",
41
41
  title: "Import Users",
42
42
  });
@@ -71,20 +71,20 @@ function App() {
71
71
  }
72
72
  ```
73
73
 
74
- Your `publishableKey` is available from the [ExpressCSV dashboard](https://expresscsv.com). Two key types are available: **production** keys for live usage, and **dev/testing** keys that provide unlimited test imports.
74
+ Have your backend keep the ExpressCSV secret key, call the ExpressCSV session-creation endpoint, and return a short-lived importer session token to the browser via `getSessionToken`.
75
75
 
76
76
  ## Preloading
77
77
 
78
- By default the widget preloads in a hidden iframe so it appears instantly when `open()` is called:
78
+ By default the importer preloads in a hidden iframe so it appears instantly when `open()` is called:
79
79
 
80
80
  ```tsx
81
81
  const { open } = useExpressCSV({
82
82
  schema,
83
- publishableKey: "your-publishable-key",
83
+ getSessionToken: async () => fetchSessionToken(),
84
84
  importIdentifier: "user-import",
85
85
  });
86
86
 
87
- // Widget displays instantly
87
+ // Importer displays instantly
88
88
  const handleImport = () => {
89
89
  open({
90
90
  onData: (chunk, next) => {
@@ -100,7 +100,7 @@ To disable preloading (there will be a brief loading screen instead):
100
100
  ```tsx
101
101
  const { open } = useExpressCSV({
102
102
  schema,
103
- publishableKey: "your-publishable-key",
103
+ getSessionToken: async () => fetchSessionToken(),
104
104
  importIdentifier: "user-import",
105
105
  preload: false,
106
106
  });
@@ -124,7 +124,7 @@ const candidateSchema = x.row({
124
124
 
125
125
  const { open } = useExpressCSV({
126
126
  schema: candidateSchema,
127
- publishableKey: "your-publishable-key",
127
+ getSessionToken: async () => fetchSessionToken(),
128
128
  importIdentifier: "candidate-import",
129
129
  templateDownload: {
130
130
  source: "generate",
@@ -142,7 +142,7 @@ const { open } = useExpressCSV({
142
142
 
143
143
  ## Theming and Styling
144
144
 
145
- Customize the widget's appearance with the `theme`, `colorMode`, `customCSS`, and `fonts` options.
145
+ Customize the importer's appearance with the `theme`, `colorMode`, `customCSS`, and `fonts` options.
146
146
 
147
147
  ### Theme
148
148
 
@@ -181,7 +181,7 @@ const dualTheme: ECSVTheme = {
181
181
  function App() {
182
182
  const { open } = useExpressCSV({
183
183
  schema,
184
- publishableKey: "your-publishable-key",
184
+ getSessionToken: async () => fetchSessionToken(),
185
185
  importIdentifier: "user-import",
186
186
  theme,
187
187
  });
@@ -227,7 +227,7 @@ Control light/dark mode with `colorMode`:
227
227
  ```tsx
228
228
  const { open } = useExpressCSV({
229
229
  schema,
230
- publishableKey: "your-publishable-key",
230
+ getSessionToken: async () => fetchSessionToken(),
231
231
  importIdentifier: "user-import",
232
232
  colorMode: "system", // 'light' | 'dark' | 'system'
233
233
  });
@@ -240,7 +240,7 @@ Inject custom CSS for fine-grained styling overrides.
240
240
  ```tsx
241
241
  const { open } = useExpressCSV({
242
242
  schema,
243
- publishableKey: "your-publishable-key",
243
+ getSessionToken: async () => fetchSessionToken(),
244
244
  importIdentifier: "user-import",
245
245
  customCSS: `
246
246
  .ecsv [data-step="upload"] {
@@ -260,7 +260,7 @@ Load custom fonts via the `fonts` option:
260
260
  ```tsx
261
261
  const { open } = useExpressCSV({
262
262
  schema,
263
- publishableKey: "your-publishable-key",
263
+ getSessionToken: async () => fetchSessionToken(),
264
264
  importIdentifier: "user-import",
265
265
  fonts: {
266
266
  title: { source: "google", name: "Space Grotesk", weights: [400, 600, 700] },
@@ -288,7 +288,7 @@ const schema = x.row({
288
288
  function App() {
289
289
  const { open } = useExpressCSV({
290
290
  schema,
291
- publishableKey: "your-publishable-key",
291
+ getSessionToken: async () => fetchSessionToken(),
292
292
  importIdentifier: "user-import",
293
293
  title: "Import Users",
294
294
  });
@@ -337,7 +337,6 @@ interface WebhookPayload {
337
337
  metadata?: Record<string, unknown>;
338
338
  /** Delivery context added by ExpressCSV */
339
339
  delivery: {
340
- publishableKey: string;
341
340
  environmentName: string;
342
341
  environmentType: string;
343
342
  teamSlug: string;
@@ -366,7 +365,6 @@ Example payload:
366
365
  "userId": "user-123"
367
366
  },
368
367
  "delivery": {
369
- "publishableKey": "pk_live_abc123",
370
368
  "environmentName": "Production",
371
369
  "environmentType": "production",
372
370
  "teamSlug": "my-team",
@@ -494,7 +492,7 @@ function CandidateImporter() {
494
492
 
495
493
  const { open, isOpen } = useExpressCSV({
496
494
  schema: candidateSchema,
497
- publishableKey: "your-publishable-key",
495
+ getSessionToken: async () => fetchSessionToken(),
498
496
  importIdentifier: "candidate-import",
499
497
  title: "Import Candidates",
500
498
  });
@@ -542,7 +540,7 @@ function useExpressCSV<TSchema>(
542
540
  options: UseExpressCSVOptions<TSchema>
543
541
  ): {
544
542
  open: (options: OpenOptions<Infer<TSchema>>) => void;
545
- widgetState: WidgetState;
543
+ importerState: ImporterState;
546
544
  isInitialising: boolean;
547
545
  isOpen: boolean;
548
546
  };
@@ -553,14 +551,14 @@ function useExpressCSV<TSchema>(
553
551
  | Option | Type | Required | Default | Description |
554
552
  |---|---|---|---|---|
555
553
  | `schema` | Schema | Yes | - | Schema definition created with `x.row()` |
556
- | `publishableKey` | `string` | Yes | - | Your publishable key from the [dashboard](https://expresscsv.com) |
554
+ | `getSessionToken` | `() => Promise<string>` | Yes | - | Async callback that asks your backend for a short-lived importer session token |
557
555
  | `importIdentifier` | `string` | Yes | - | Unique identifier for this import type |
558
- | `title` | `string` | No | - | Title shown in the widget header |
559
- | `preload` | `boolean` | No | `true` | Preload widget for instant display |
556
+ | `title` | `string` | No | - | Title shown in the importer header |
557
+ | `preload` | `boolean` | No | `true` | Preload the importer for instant display |
560
558
  | `debug` | `boolean` | No | `false` | Enable debug logging |
561
559
  | `theme` | `ECSVTheme` | No | - | Custom theme configuration |
562
560
  | `colorMode` | `ColorModePref` | No | - | Light/dark mode (`'light'`, `'dark'`, or `'system'`) |
563
- | `customCSS` | `string` | No | - | Custom CSS to inject into the widget |
561
+ | `customCSS` | `string` | No | - | Custom CSS to inject into the importer |
564
562
  | `fonts` | `Record<string, ECSVFontSource>` | No | - | Custom font sources |
565
563
  | `stepDisplay` | `'progressBar' \| 'segmented' \| 'numbered'` | No | `'progressBar'` | Step indicator style |
566
564
  | `previewSchemaBeforeUpload` | `boolean` | No | `true` | Show schema preview before upload |
@@ -572,10 +570,10 @@ function useExpressCSV<TSchema>(
572
570
 
573
571
  | Property | Type | Description |
574
572
  |---|---|---|
575
- | `open` | `(options: OpenOptions) => void` | Opens the widget. Requires at least one of `onData` or `webhook`. |
576
- | `widgetState` | `WidgetState` | Current widget state (reactive) |
577
- | `isInitialising` | `boolean` | `true` while the widget is initializing or opening |
578
- | `isOpen` | `boolean` | `true` while the widget is open |
573
+ | `open` | `(options: OpenOptions) => void` | Opens the importer. Requires at least one of `onData` or `webhook`. |
574
+ | `importerState` | `ImporterState` | Current importer lifecycle state (reactive) |
575
+ | `isInitialising` | `boolean` | `true` while the importer is initializing or opening |
576
+ | `isOpen` | `boolean` | `true` while the importer is open |
579
577
 
580
578
  ### `OpenOptions<T>`
581
579
 
@@ -589,8 +587,8 @@ Options passed to `open()`. At least one of `onData` or `webhook` must be provid
589
587
  | `onComplete` | `() => void` | No | Called when all chunks have been processed |
590
588
  | `onCancel` | `() => void` | No | Called when the user cancels the import |
591
589
  | `onError` | `(error: Error) => void` | No | Called when an error occurs |
592
- | `onWidgetOpen` | `() => void` | No | Called when the widget opens |
593
- | `onWidgetClose` | `(reason: string) => void` | No | Called when the widget closes |
590
+ | `onImporterOpen` | `() => void` | No | Called when the importer opens |
591
+ | `onImporterClose` | `(reason: string) => void` | No | Called when the importer closes |
594
592
  | `onStepChange` | `(stepId, previousStepId?) => void` | No | Called when the wizard step changes |
595
593
 
596
594
  \* At least one of `onData` or `webhook` is required.
@@ -623,7 +621,7 @@ interface WebhookConfig {
623
621
 
624
622
  The `x` schema builder provides a type-safe, fluent API for defining your CSV structure.
625
623
 
626
- For apps that share schemas with backend code or webhook receivers, prefer defining the schema in `@expresscsv/schemas` and importing it into your React app. That keeps schema authoring free of React and widget dependencies, while also giving your backend access to `InferWebhookPayload<typeof schema>`.
624
+ For apps that share schemas with backend code or webhook receivers, prefer defining the schema in `@expresscsv/schemas` and importing it into your React app. That keeps schema authoring free of React and importer dependencies, while also giving your backend access to `InferWebhookPayload<typeof schema>`.
627
625
 
628
626
  #### Field Types
629
627
 
@@ -728,7 +726,7 @@ All field types support:
728
726
 
729
727
  | Modifier | Description |
730
728
  |---|---|
731
- | `.label(text)` | User-facing label shown in the widget |
729
+ | `.label(text)` | User-facing label shown in the importer |
732
730
  | `.description(text)` | Help text for the field |
733
731
  | `.example(text)` | Example value shown as placeholder |
734
732
  | `.optional()` | Makes the field optional (default is required) |
@@ -780,7 +778,7 @@ x.string().refine(
780
778
  )
781
779
  ```
782
780
 
783
- **Object-returning validator** — inline `valid`, `message`, and an optional `suggestedFix` the widget can offer the user:
781
+ **Object-returning validator** — inline `valid`, `message`, and an optional `suggestedFix` the importer can offer the user:
784
782
 
785
783
  ```tsx
786
784
  x.string().refine((value) => ({
@@ -847,7 +845,7 @@ x.string().refineBatch((values) => {
847
845
 
848
846
  ### `suggestedFix`
849
847
 
850
- Both `.refine()` and `.refineBatch()` support returning a `suggestedFix` object that the widget offers as a one-click fix for the user:
848
+ Both `.refine()` and `.refineBatch()` support returning a `suggestedFix` object that the importer offers as a one-click fix for the user:
851
849
 
852
850
  ```tsx
853
851
  interface SuggestedFix {
package/dist/index.d.cts CHANGED
@@ -2754,7 +2754,7 @@ declare interface ExpressCSVLocale {
2754
2754
  nextDisabledReviewValidating: string;
2755
2755
  nextDisabledReviewInvalid: string;
2756
2756
  };
2757
- widget: {
2757
+ importer: {
2758
2758
  title: string;
2759
2759
  loading: string;
2760
2760
  closeConfirmTitle: string;
@@ -2763,7 +2763,6 @@ declare interface ExpressCSVLocale {
2763
2763
  closeConfirmContinue: string;
2764
2764
  errorTitle: string;
2765
2765
  startOver: string;
2766
- invalidPublishableKey: string;
2767
2766
  };
2768
2767
  sessionRecovery: {
2769
2768
  message: string;
@@ -2883,6 +2882,7 @@ declare interface ExpressCSVLocale {
2883
2882
  };
2884
2883
  review: {
2885
2884
  completing: string;
2885
+ processing: string;
2886
2886
  loading: string;
2887
2887
  title: string;
2888
2888
  subtitle: string;
@@ -3475,6 +3475,29 @@ export declare class ImportCancelledError extends Error {
3475
3475
  constructor(message?: string);
3476
3476
  }
3477
3477
 
3478
+ /**
3479
+ * Importer preload mode
3480
+ */
3481
+ export declare enum ImporterMode {
3482
+ NORMAL = "normal",
3483
+ PRELOAD = "preload"
3484
+ }
3485
+
3486
+ /**
3487
+ * Importer lifecycle state
3488
+ */
3489
+ export declare enum ImporterState {
3490
+ UNINITIALIZED = "uninitialized",
3491
+ INITIALIZING = "initializing",
3492
+ READY = "ready",
3493
+ OPENING = "opening",
3494
+ OPEN = "open",
3495
+ CLOSING = "closing",
3496
+ RESETTING = "resetting",
3497
+ ERROR = "error",
3498
+ DESTROYED = "destroyed"
3499
+ }
3500
+
3478
3501
  export declare type Infer<T extends ExType<unknown, ExBaseDef, unknown>> = T extends ExType<infer Output, ExBaseDef, unknown> ? Output : never;
3479
3502
 
3480
3503
  declare type IPAddressVersion = 'v4' | 'v6' | 'all';
@@ -3497,12 +3520,12 @@ export declare type OpenOptions<T> = RequireAtLeastOne<DeliveryOptionsBase<T>, '
3497
3520
  onCancel?: () => void;
3498
3521
  /** Called when an error occurs */
3499
3522
  onError?: (error: Error) => void;
3500
- /** Called when the widget opens */
3501
- onWidgetOpen?: () => void;
3523
+ /** Called when the importer opens */
3524
+ onImporterOpen?: () => void;
3525
+ /** Called when the importer closes */
3526
+ onImporterClose?: (reason: 'user_close' | 'cancel' | 'complete' | 'error') => void;
3502
3527
  /** Called when the step changes in the wizard */
3503
3528
  onStepChange?: (stepId: ExpressCSVStep, previousStepId?: ExpressCSVStep) => void;
3504
- /** Called when the widget closes */
3505
- onWidgetClose?: (reason: 'user_close' | 'cancel' | 'complete' | 'error') => void;
3506
3529
  };
3507
3530
 
3508
3531
  declare type PhoneNumberFormat = 'international' | 'national' | 'both';
@@ -3725,7 +3748,7 @@ export declare type TemplateDownloadOptions<TSchema extends ExType<unknown, ExBa
3725
3748
 
3726
3749
  /**
3727
3750
  * A branded string type for locale entries that require interpolation via `{variable}` syntax.
3728
- * Widget code cannot render a `TemplateString` directly in JSX — it must go through the `t()` function.
3751
+ * Importer code cannot render a `TemplateString` directly in JSX — it must go through the `t()` function.
3729
3752
  * The generic `TVars` encodes the expected variable names so `t()` enforces the correct vars argument.
3730
3753
  */
3731
3754
  declare type TemplateString<TVars extends string = string> = string & {
@@ -3749,9 +3772,9 @@ declare interface URLOptions {
3749
3772
  message?: string;
3750
3773
  }
3751
3774
 
3752
- export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title, importIdentifier, publishableKey, debug, preload, theme, colorMode, customCSS, fonts, stepDisplay, previewSchemaBeforeUpload, templateDownload, saveSession, locale, disableStatusStep, }: UseExpressCSVOptions<TSchema>): {
3775
+ export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title, importIdentifier, getSessionToken, debug, preload, theme, colorMode, customCSS, fonts, stepDisplay, previewSchemaBeforeUpload, templateDownload, saveSession, locale, disableStatusStep, }: UseExpressCSVOptions<TSchema>): {
3753
3776
  open: (options: OpenOptions<Infer<TSchema>>) => void;
3754
- widgetState: WidgetState;
3777
+ importerState: ImporterState;
3755
3778
  isInitialising: boolean;
3756
3779
  isOpen: boolean;
3757
3780
  };
@@ -3760,7 +3783,7 @@ export declare interface UseExpressCSVOptions<TSchema extends ExType<unknown, Ex
3760
3783
  schema: TSchema;
3761
3784
  title?: string;
3762
3785
  importIdentifier: string;
3763
- publishableKey: string;
3786
+ getSessionToken: () => Promise<string>;
3764
3787
  debug?: boolean;
3765
3788
  preload?: boolean;
3766
3789
  theme?: ECSVTheme;
@@ -3803,34 +3826,11 @@ export declare interface WebhookConfig {
3803
3826
  * Whether to wait for the delivery service to confirm the webhook was
3804
3827
  * successfully received before considering the import complete.
3805
3828
  * When false, the import completes as soon as all chunks are queued.
3806
- * Default: true
3829
+ * Default: false
3807
3830
  */
3808
3831
  awaitWebhookArrival?: boolean;
3809
3832
  }
3810
3833
 
3811
- /**
3812
- * Widget mode enumeration
3813
- */
3814
- export declare enum WidgetMode {
3815
- NORMAL = "normal",
3816
- PRELOAD = "preload"
3817
- }
3818
-
3819
- /**
3820
- * Widget state enumeration for consistent state management
3821
- */
3822
- export declare enum WidgetState {
3823
- UNINITIALIZED = "uninitialized",
3824
- INITIALIZING = "initializing",
3825
- READY = "ready",
3826
- OPENING = "opening",
3827
- OPEN = "open",
3828
- CLOSING = "closing",
3829
- RESETTING = "resetting",
3830
- ERROR = "error",
3831
- DESTROYED = "destroyed"
3832
- }
3833
-
3834
3834
  export declare const x: {
3835
3835
  string: typeof ExString.create;
3836
3836
  number: typeof ExNumber.create;
package/dist/index.d.mts CHANGED
@@ -2754,7 +2754,7 @@ declare interface ExpressCSVLocale {
2754
2754
  nextDisabledReviewValidating: string;
2755
2755
  nextDisabledReviewInvalid: string;
2756
2756
  };
2757
- widget: {
2757
+ importer: {
2758
2758
  title: string;
2759
2759
  loading: string;
2760
2760
  closeConfirmTitle: string;
@@ -2763,7 +2763,6 @@ declare interface ExpressCSVLocale {
2763
2763
  closeConfirmContinue: string;
2764
2764
  errorTitle: string;
2765
2765
  startOver: string;
2766
- invalidPublishableKey: string;
2767
2766
  };
2768
2767
  sessionRecovery: {
2769
2768
  message: string;
@@ -2883,6 +2882,7 @@ declare interface ExpressCSVLocale {
2883
2882
  };
2884
2883
  review: {
2885
2884
  completing: string;
2885
+ processing: string;
2886
2886
  loading: string;
2887
2887
  title: string;
2888
2888
  subtitle: string;
@@ -3475,6 +3475,29 @@ export declare class ImportCancelledError extends Error {
3475
3475
  constructor(message?: string);
3476
3476
  }
3477
3477
 
3478
+ /**
3479
+ * Importer preload mode
3480
+ */
3481
+ export declare enum ImporterMode {
3482
+ NORMAL = "normal",
3483
+ PRELOAD = "preload"
3484
+ }
3485
+
3486
+ /**
3487
+ * Importer lifecycle state
3488
+ */
3489
+ export declare enum ImporterState {
3490
+ UNINITIALIZED = "uninitialized",
3491
+ INITIALIZING = "initializing",
3492
+ READY = "ready",
3493
+ OPENING = "opening",
3494
+ OPEN = "open",
3495
+ CLOSING = "closing",
3496
+ RESETTING = "resetting",
3497
+ ERROR = "error",
3498
+ DESTROYED = "destroyed"
3499
+ }
3500
+
3478
3501
  export declare type Infer<T extends ExType<unknown, ExBaseDef, unknown>> = T extends ExType<infer Output, ExBaseDef, unknown> ? Output : never;
3479
3502
 
3480
3503
  declare type IPAddressVersion = 'v4' | 'v6' | 'all';
@@ -3497,12 +3520,12 @@ export declare type OpenOptions<T> = RequireAtLeastOne<DeliveryOptionsBase<T>, '
3497
3520
  onCancel?: () => void;
3498
3521
  /** Called when an error occurs */
3499
3522
  onError?: (error: Error) => void;
3500
- /** Called when the widget opens */
3501
- onWidgetOpen?: () => void;
3523
+ /** Called when the importer opens */
3524
+ onImporterOpen?: () => void;
3525
+ /** Called when the importer closes */
3526
+ onImporterClose?: (reason: 'user_close' | 'cancel' | 'complete' | 'error') => void;
3502
3527
  /** Called when the step changes in the wizard */
3503
3528
  onStepChange?: (stepId: ExpressCSVStep, previousStepId?: ExpressCSVStep) => void;
3504
- /** Called when the widget closes */
3505
- onWidgetClose?: (reason: 'user_close' | 'cancel' | 'complete' | 'error') => void;
3506
3529
  };
3507
3530
 
3508
3531
  declare type PhoneNumberFormat = 'international' | 'national' | 'both';
@@ -3725,7 +3748,7 @@ export declare type TemplateDownloadOptions<TSchema extends ExType<unknown, ExBa
3725
3748
 
3726
3749
  /**
3727
3750
  * A branded string type for locale entries that require interpolation via `{variable}` syntax.
3728
- * Widget code cannot render a `TemplateString` directly in JSX — it must go through the `t()` function.
3751
+ * Importer code cannot render a `TemplateString` directly in JSX — it must go through the `t()` function.
3729
3752
  * The generic `TVars` encodes the expected variable names so `t()` enforces the correct vars argument.
3730
3753
  */
3731
3754
  declare type TemplateString<TVars extends string = string> = string & {
@@ -3749,9 +3772,9 @@ declare interface URLOptions {
3749
3772
  message?: string;
3750
3773
  }
3751
3774
 
3752
- export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title, importIdentifier, publishableKey, debug, preload, theme, colorMode, customCSS, fonts, stepDisplay, previewSchemaBeforeUpload, templateDownload, saveSession, locale, disableStatusStep, }: UseExpressCSVOptions<TSchema>): {
3775
+ export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title, importIdentifier, getSessionToken, debug, preload, theme, colorMode, customCSS, fonts, stepDisplay, previewSchemaBeforeUpload, templateDownload, saveSession, locale, disableStatusStep, }: UseExpressCSVOptions<TSchema>): {
3753
3776
  open: (options: OpenOptions<Infer<TSchema>>) => void;
3754
- widgetState: WidgetState;
3777
+ importerState: ImporterState;
3755
3778
  isInitialising: boolean;
3756
3779
  isOpen: boolean;
3757
3780
  };
@@ -3760,7 +3783,7 @@ export declare interface UseExpressCSVOptions<TSchema extends ExType<unknown, Ex
3760
3783
  schema: TSchema;
3761
3784
  title?: string;
3762
3785
  importIdentifier: string;
3763
- publishableKey: string;
3786
+ getSessionToken: () => Promise<string>;
3764
3787
  debug?: boolean;
3765
3788
  preload?: boolean;
3766
3789
  theme?: ECSVTheme;
@@ -3803,34 +3826,11 @@ export declare interface WebhookConfig {
3803
3826
  * Whether to wait for the delivery service to confirm the webhook was
3804
3827
  * successfully received before considering the import complete.
3805
3828
  * When false, the import completes as soon as all chunks are queued.
3806
- * Default: true
3829
+ * Default: false
3807
3830
  */
3808
3831
  awaitWebhookArrival?: boolean;
3809
3832
  }
3810
3833
 
3811
- /**
3812
- * Widget mode enumeration
3813
- */
3814
- export declare enum WidgetMode {
3815
- NORMAL = "normal",
3816
- PRELOAD = "preload"
3817
- }
3818
-
3819
- /**
3820
- * Widget state enumeration for consistent state management
3821
- */
3822
- export declare enum WidgetState {
3823
- UNINITIALIZED = "uninitialized",
3824
- INITIALIZING = "initializing",
3825
- READY = "ready",
3826
- OPENING = "opening",
3827
- OPEN = "open",
3828
- CLOSING = "closing",
3829
- RESETTING = "resetting",
3830
- ERROR = "error",
3831
- DESTROYED = "destroyed"
3832
- }
3833
-
3834
3834
  export declare const x: {
3835
3835
  string: typeof ExString.create;
3836
3836
  number: typeof ExNumber.create;
package/dist/index.d.ts CHANGED
@@ -2754,7 +2754,7 @@ declare interface ExpressCSVLocale {
2754
2754
  nextDisabledReviewValidating: string;
2755
2755
  nextDisabledReviewInvalid: string;
2756
2756
  };
2757
- widget: {
2757
+ importer: {
2758
2758
  title: string;
2759
2759
  loading: string;
2760
2760
  closeConfirmTitle: string;
@@ -2763,7 +2763,6 @@ declare interface ExpressCSVLocale {
2763
2763
  closeConfirmContinue: string;
2764
2764
  errorTitle: string;
2765
2765
  startOver: string;
2766
- invalidPublishableKey: string;
2767
2766
  };
2768
2767
  sessionRecovery: {
2769
2768
  message: string;
@@ -2883,6 +2882,7 @@ declare interface ExpressCSVLocale {
2883
2882
  };
2884
2883
  review: {
2885
2884
  completing: string;
2885
+ processing: string;
2886
2886
  loading: string;
2887
2887
  title: string;
2888
2888
  subtitle: string;
@@ -3475,6 +3475,29 @@ export declare class ImportCancelledError extends Error {
3475
3475
  constructor(message?: string);
3476
3476
  }
3477
3477
 
3478
+ /**
3479
+ * Importer preload mode
3480
+ */
3481
+ export declare enum ImporterMode {
3482
+ NORMAL = "normal",
3483
+ PRELOAD = "preload"
3484
+ }
3485
+
3486
+ /**
3487
+ * Importer lifecycle state
3488
+ */
3489
+ export declare enum ImporterState {
3490
+ UNINITIALIZED = "uninitialized",
3491
+ INITIALIZING = "initializing",
3492
+ READY = "ready",
3493
+ OPENING = "opening",
3494
+ OPEN = "open",
3495
+ CLOSING = "closing",
3496
+ RESETTING = "resetting",
3497
+ ERROR = "error",
3498
+ DESTROYED = "destroyed"
3499
+ }
3500
+
3478
3501
  export declare type Infer<T extends ExType<unknown, ExBaseDef, unknown>> = T extends ExType<infer Output, ExBaseDef, unknown> ? Output : never;
3479
3502
 
3480
3503
  declare type IPAddressVersion = 'v4' | 'v6' | 'all';
@@ -3497,12 +3520,12 @@ export declare type OpenOptions<T> = RequireAtLeastOne<DeliveryOptionsBase<T>, '
3497
3520
  onCancel?: () => void;
3498
3521
  /** Called when an error occurs */
3499
3522
  onError?: (error: Error) => void;
3500
- /** Called when the widget opens */
3501
- onWidgetOpen?: () => void;
3523
+ /** Called when the importer opens */
3524
+ onImporterOpen?: () => void;
3525
+ /** Called when the importer closes */
3526
+ onImporterClose?: (reason: 'user_close' | 'cancel' | 'complete' | 'error') => void;
3502
3527
  /** Called when the step changes in the wizard */
3503
3528
  onStepChange?: (stepId: ExpressCSVStep, previousStepId?: ExpressCSVStep) => void;
3504
- /** Called when the widget closes */
3505
- onWidgetClose?: (reason: 'user_close' | 'cancel' | 'complete' | 'error') => void;
3506
3529
  };
3507
3530
 
3508
3531
  declare type PhoneNumberFormat = 'international' | 'national' | 'both';
@@ -3725,7 +3748,7 @@ export declare type TemplateDownloadOptions<TSchema extends ExType<unknown, ExBa
3725
3748
 
3726
3749
  /**
3727
3750
  * A branded string type for locale entries that require interpolation via `{variable}` syntax.
3728
- * Widget code cannot render a `TemplateString` directly in JSX — it must go through the `t()` function.
3751
+ * Importer code cannot render a `TemplateString` directly in JSX — it must go through the `t()` function.
3729
3752
  * The generic `TVars` encodes the expected variable names so `t()` enforces the correct vars argument.
3730
3753
  */
3731
3754
  declare type TemplateString<TVars extends string = string> = string & {
@@ -3749,9 +3772,9 @@ declare interface URLOptions {
3749
3772
  message?: string;
3750
3773
  }
3751
3774
 
3752
- export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title, importIdentifier, publishableKey, debug, preload, theme, colorMode, customCSS, fonts, stepDisplay, previewSchemaBeforeUpload, templateDownload, saveSession, locale, disableStatusStep, }: UseExpressCSVOptions<TSchema>): {
3775
+ export declare function useExpressCSV<TSchema extends ExType<unknown, ExBaseDef, unknown>>({ schema, title, importIdentifier, getSessionToken, debug, preload, theme, colorMode, customCSS, fonts, stepDisplay, previewSchemaBeforeUpload, templateDownload, saveSession, locale, disableStatusStep, }: UseExpressCSVOptions<TSchema>): {
3753
3776
  open: (options: OpenOptions<Infer<TSchema>>) => void;
3754
- widgetState: WidgetState;
3777
+ importerState: ImporterState;
3755
3778
  isInitialising: boolean;
3756
3779
  isOpen: boolean;
3757
3780
  };
@@ -3760,7 +3783,7 @@ export declare interface UseExpressCSVOptions<TSchema extends ExType<unknown, Ex
3760
3783
  schema: TSchema;
3761
3784
  title?: string;
3762
3785
  importIdentifier: string;
3763
- publishableKey: string;
3786
+ getSessionToken: () => Promise<string>;
3764
3787
  debug?: boolean;
3765
3788
  preload?: boolean;
3766
3789
  theme?: ECSVTheme;
@@ -3803,34 +3826,11 @@ export declare interface WebhookConfig {
3803
3826
  * Whether to wait for the delivery service to confirm the webhook was
3804
3827
  * successfully received before considering the import complete.
3805
3828
  * When false, the import completes as soon as all chunks are queued.
3806
- * Default: true
3829
+ * Default: false
3807
3830
  */
3808
3831
  awaitWebhookArrival?: boolean;
3809
3832
  }
3810
3833
 
3811
- /**
3812
- * Widget mode enumeration
3813
- */
3814
- export declare enum WidgetMode {
3815
- NORMAL = "normal",
3816
- PRELOAD = "preload"
3817
- }
3818
-
3819
- /**
3820
- * Widget state enumeration for consistent state management
3821
- */
3822
- export declare enum WidgetState {
3823
- UNINITIALIZED = "uninitialized",
3824
- INITIALIZING = "initializing",
3825
- READY = "ready",
3826
- OPENING = "opening",
3827
- OPEN = "open",
3828
- CLOSING = "closing",
3829
- RESETTING = "resetting",
3830
- ERROR = "error",
3831
- DESTROYED = "destroyed"
3832
- }
3833
-
3834
3834
  export declare const x: {
3835
3835
  string: typeof ExString.create;
3836
3836
  number: typeof ExNumber.create;