@expresscsv/sdk 0.1.21 → 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 +32 -34
- package/dist/index.d.cts +59 -47
- package/dist/index.d.mts +59 -47
- package/dist/index.d.ts +59 -47
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1244,12 +1244,16 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1244
1244
|
private debug;
|
|
1245
1245
|
private importIdentifier;
|
|
1246
1246
|
private sessionId;
|
|
1247
|
+
private currentSessionToken;
|
|
1248
|
+
private currentSessionTokenExpiresAt;
|
|
1249
|
+
private sessionTokenRefreshTimer;
|
|
1250
|
+
private sessionTokenRefreshPromise;
|
|
1247
1251
|
private _destroyTimer;
|
|
1248
1252
|
private _beforeUnloadHandler;
|
|
1249
|
-
private
|
|
1253
|
+
private importerUrl;
|
|
1250
1254
|
private appUrl;
|
|
1251
|
-
private
|
|
1252
|
-
private
|
|
1255
|
+
private importerState;
|
|
1256
|
+
private importerMode;
|
|
1253
1257
|
private canRestart;
|
|
1254
1258
|
private lastError;
|
|
1255
1259
|
private openOptions;
|
|
@@ -1257,6 +1261,7 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1257
1261
|
private initCompletePromise;
|
|
1258
1262
|
private resolveInitComplete;
|
|
1259
1263
|
private resolvedTemplateDownload;
|
|
1264
|
+
private importerStartupGeneration;
|
|
1260
1265
|
constructor(options: SDKOptions<TSchema>);
|
|
1261
1266
|
/**
|
|
1262
1267
|
* Enhanced state management
|
|
@@ -1266,9 +1271,22 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1266
1271
|
private handleError;
|
|
1267
1272
|
private sendImportProgress;
|
|
1268
1273
|
private waitForEvent;
|
|
1274
|
+
private fetchImporterSessionToken;
|
|
1275
|
+
private updateSessionToken;
|
|
1276
|
+
private clearSessionTokenRefreshTimer;
|
|
1277
|
+
private scheduleSessionTokenRefresh;
|
|
1278
|
+
private ensureActiveSessionToken;
|
|
1279
|
+
private refreshSessionBoundToken;
|
|
1280
|
+
private beginImporterStartup;
|
|
1281
|
+
private cancelImporterStartup;
|
|
1282
|
+
private assertActiveImporterStartup;
|
|
1283
|
+
private withTimeout;
|
|
1284
|
+
private sendSessionDetailsToImporter;
|
|
1285
|
+
private sendStartupErrorToImporter;
|
|
1286
|
+
private bootstrapImporterSession;
|
|
1269
1287
|
/**
|
|
1270
1288
|
* Open the import flow with chunk-based data processing.
|
|
1271
|
-
* Automatically opens the
|
|
1289
|
+
* Automatically opens the importer if not already open.
|
|
1272
1290
|
*
|
|
1273
1291
|
* @param options Configuration including onData callback for processing chunks
|
|
1274
1292
|
*/
|
|
@@ -1283,11 +1301,6 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1283
1301
|
* Chunks data using SDK-determined chunk size (independent of customer's chunkSize)
|
|
1284
1302
|
*/
|
|
1285
1303
|
private deliverToWebhook;
|
|
1286
|
-
/**
|
|
1287
|
-
* Poll the delivery status endpoint until the delivery reaches a terminal state
|
|
1288
|
-
* ('success' or 'failed'), or until the timeout is exceeded.
|
|
1289
|
-
*/
|
|
1290
|
-
private pollDeliveryStatus;
|
|
1291
1304
|
/**
|
|
1292
1305
|
* Send a single chunk to backend webhook API with retry logic
|
|
1293
1306
|
*/
|
|
@@ -1313,7 +1326,7 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1313
1326
|
private removeBeforeUnloadListener;
|
|
1314
1327
|
private waitForIframeLoad;
|
|
1315
1328
|
private setupConnectionAndInit;
|
|
1316
|
-
|
|
1329
|
+
openImporter(options?: {
|
|
1317
1330
|
reset?: boolean;
|
|
1318
1331
|
}): Promise<void>;
|
|
1319
1332
|
/**
|
|
@@ -1324,20 +1337,20 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1324
1337
|
private createAndAppendIframe;
|
|
1325
1338
|
private destroy;
|
|
1326
1339
|
close(reason?: 'user_close' | 'cancel' | 'complete' | 'error'): Promise<void>;
|
|
1327
|
-
private
|
|
1340
|
+
private resetImporter;
|
|
1328
1341
|
restart(newOptions?: Partial<SDKOptions<TSchema>>): Promise<void>;
|
|
1329
|
-
private
|
|
1342
|
+
private handleImporterClosed;
|
|
1330
1343
|
private hideContainer;
|
|
1331
1344
|
getConnectionStatus(): boolean;
|
|
1332
|
-
getState():
|
|
1333
|
-
getMode():
|
|
1345
|
+
getState(): ImporterState;
|
|
1346
|
+
getMode(): ImporterMode;
|
|
1334
1347
|
getIsReady(): boolean;
|
|
1335
1348
|
getIsOpen(): boolean;
|
|
1336
1349
|
getCanRestart(): boolean;
|
|
1337
1350
|
getLastError(): Error | null;
|
|
1338
1351
|
getStatus(): {
|
|
1339
|
-
state:
|
|
1340
|
-
mode:
|
|
1352
|
+
state: ImporterState;
|
|
1353
|
+
mode: ImporterMode;
|
|
1341
1354
|
isReady: boolean;
|
|
1342
1355
|
isOpen: boolean;
|
|
1343
1356
|
canRestart: boolean;
|
|
@@ -2867,7 +2880,7 @@ declare interface ExpressCSVLocale {
|
|
|
2867
2880
|
nextDisabledReviewValidating: string;
|
|
2868
2881
|
nextDisabledReviewInvalid: string;
|
|
2869
2882
|
};
|
|
2870
|
-
|
|
2883
|
+
importer: {
|
|
2871
2884
|
title: string;
|
|
2872
2885
|
loading: string;
|
|
2873
2886
|
closeConfirmTitle: string;
|
|
@@ -2876,7 +2889,6 @@ declare interface ExpressCSVLocale {
|
|
|
2876
2889
|
closeConfirmContinue: string;
|
|
2877
2890
|
errorTitle: string;
|
|
2878
2891
|
startOver: string;
|
|
2879
|
-
invalidPublishableKey: string;
|
|
2880
2892
|
};
|
|
2881
2893
|
sessionRecovery: {
|
|
2882
2894
|
message: string;
|
|
@@ -3589,6 +3601,29 @@ export declare class ImportCancelledError extends Error {
|
|
|
3589
3601
|
constructor(message?: string);
|
|
3590
3602
|
}
|
|
3591
3603
|
|
|
3604
|
+
/**
|
|
3605
|
+
* Importer preload mode
|
|
3606
|
+
*/
|
|
3607
|
+
export declare enum ImporterMode {
|
|
3608
|
+
NORMAL = "normal",
|
|
3609
|
+
PRELOAD = "preload"
|
|
3610
|
+
}
|
|
3611
|
+
|
|
3612
|
+
/**
|
|
3613
|
+
* Importer lifecycle state
|
|
3614
|
+
*/
|
|
3615
|
+
export declare enum ImporterState {
|
|
3616
|
+
UNINITIALIZED = "uninitialized",
|
|
3617
|
+
INITIALIZING = "initializing",
|
|
3618
|
+
READY = "ready",
|
|
3619
|
+
OPENING = "opening",
|
|
3620
|
+
OPEN = "open",
|
|
3621
|
+
CLOSING = "closing",
|
|
3622
|
+
RESETTING = "resetting",
|
|
3623
|
+
ERROR = "error",
|
|
3624
|
+
DESTROYED = "destroyed"
|
|
3625
|
+
}
|
|
3626
|
+
|
|
3592
3627
|
export declare type Infer<T extends ExType<unknown, ExBaseDef, unknown>> = T extends ExType<infer Output, ExBaseDef, unknown> ? Output : never;
|
|
3593
3628
|
|
|
3594
3629
|
export declare type InferCSVImporter<TSchema extends ExType<unknown, ExBaseDef, unknown>> = CSVImporter<TSchema>;
|
|
@@ -3613,12 +3648,12 @@ export declare type OpenOptions<T> = RequireAtLeastOne<DeliveryOptionsBase<T>, '
|
|
|
3613
3648
|
onCancel?: () => void;
|
|
3614
3649
|
/** Called when an error occurs */
|
|
3615
3650
|
onError?: (error: Error) => void;
|
|
3616
|
-
/** Called when the
|
|
3617
|
-
|
|
3651
|
+
/** Called when the importer opens */
|
|
3652
|
+
onImporterOpen?: () => void;
|
|
3653
|
+
/** Called when the importer closes */
|
|
3654
|
+
onImporterClose?: (reason: 'user_close' | 'cancel' | 'complete' | 'error') => void;
|
|
3618
3655
|
/** Called when the step changes in the wizard */
|
|
3619
3656
|
onStepChange?: (stepId: ExpressCSVStep, previousStepId?: ExpressCSVStep) => void;
|
|
3620
|
-
/** Called when the widget closes */
|
|
3621
|
-
onWidgetClose?: (reason: 'user_close' | 'cancel' | 'complete' | 'error') => void;
|
|
3622
3657
|
};
|
|
3623
3658
|
|
|
3624
3659
|
declare type PhoneNumberFormat = 'international' | 'national' | 'both';
|
|
@@ -3767,7 +3802,7 @@ declare type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Excl
|
|
|
3767
3802
|
|
|
3768
3803
|
export declare interface SDKOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> {
|
|
3769
3804
|
schema: TSchema;
|
|
3770
|
-
|
|
3805
|
+
getSessionToken: () => Promise<string>;
|
|
3771
3806
|
importIdentifier: string;
|
|
3772
3807
|
title?: string;
|
|
3773
3808
|
debug?: boolean;
|
|
@@ -3860,7 +3895,7 @@ export declare type TemplateDownloadOptions<TSchema extends ExType<unknown, ExBa
|
|
|
3860
3895
|
|
|
3861
3896
|
/**
|
|
3862
3897
|
* A branded string type for locale entries that require interpolation via `{variable}` syntax.
|
|
3863
|
-
*
|
|
3898
|
+
* Importer code cannot render a `TemplateString` directly in JSX — it must go through the `t()` function.
|
|
3864
3899
|
* The generic `TVars` encodes the expected variable names so `t()` enforces the correct vars argument.
|
|
3865
3900
|
*/
|
|
3866
3901
|
declare type TemplateString<TVars extends string = string> = string & {
|
|
@@ -3917,29 +3952,6 @@ export declare interface WebhookConfig {
|
|
|
3917
3952
|
awaitWebhookArrival?: boolean;
|
|
3918
3953
|
}
|
|
3919
3954
|
|
|
3920
|
-
/**
|
|
3921
|
-
* Widget mode enumeration
|
|
3922
|
-
*/
|
|
3923
|
-
export declare enum WidgetMode {
|
|
3924
|
-
NORMAL = "normal",
|
|
3925
|
-
PRELOAD = "preload"
|
|
3926
|
-
}
|
|
3927
|
-
|
|
3928
|
-
/**
|
|
3929
|
-
* Widget state enumeration for consistent state management
|
|
3930
|
-
*/
|
|
3931
|
-
export declare enum WidgetState {
|
|
3932
|
-
UNINITIALIZED = "uninitialized",
|
|
3933
|
-
INITIALIZING = "initializing",
|
|
3934
|
-
READY = "ready",
|
|
3935
|
-
OPENING = "opening",
|
|
3936
|
-
OPEN = "open",
|
|
3937
|
-
CLOSING = "closing",
|
|
3938
|
-
RESETTING = "resetting",
|
|
3939
|
-
ERROR = "error",
|
|
3940
|
-
DESTROYED = "destroyed"
|
|
3941
|
-
}
|
|
3942
|
-
|
|
3943
3955
|
export declare const x: {
|
|
3944
3956
|
string: typeof ExString.create;
|
|
3945
3957
|
number: typeof ExNumber.create;
|