@worldcoin/idkit 2.2.0 → 2.2.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/build/config-BRFx4nLT.d.cts +45 -0
- package/build/index.cjs +2356 -0
- package/build/index.d.cts +56 -0
- package/build/internal.cjs +269 -0
- package/build/internal.d.cts +53 -0
- package/package.json +17 -5
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { IDKitConfig, ISuccessResult, IErrorState } from '@worldcoin/idkit-core';
|
|
2
|
+
|
|
3
|
+
declare enum IDKITStage {
|
|
4
|
+
WORLD_ID = "WORLD_ID",
|
|
5
|
+
SUCCESS = "SUCCESS",
|
|
6
|
+
ERROR = "ERROR",
|
|
7
|
+
HOST_APP_VERIFICATION = "HOST_APP_VERIFICATION"
|
|
8
|
+
}
|
|
9
|
+
type CallbackFn<T> = (result: T) => Promise<void> | void;
|
|
10
|
+
|
|
11
|
+
declare enum ConfigSource {
|
|
12
|
+
HOOK = "hook",
|
|
13
|
+
PROPS = "props",
|
|
14
|
+
MANUAL = "manual"
|
|
15
|
+
}
|
|
16
|
+
type WidgetConfig = {
|
|
17
|
+
/** Whether to automatically close the widget after a successful verification. Defaults to `false`. */
|
|
18
|
+
autoClose?: boolean;
|
|
19
|
+
/** Function to trigger when verification is successful. Should receive a single parameter of type `ISuccessResult` which contains the proof details. */
|
|
20
|
+
onSuccess: CallbackFn<ISuccessResult>;
|
|
21
|
+
/** Called after the proof is returned from the World App, but before showing the success screen. Throwing in this screen will show the user a custom error. Used to perform additional validation when needed. */
|
|
22
|
+
handleVerify?: CallbackFn<ISuccessResult>;
|
|
23
|
+
/** Function to trigger when verification is not successful. Should receive a single parameter of type `IErrorState` which contains the error details. */
|
|
24
|
+
onError?: CallbackFn<IErrorState>;
|
|
25
|
+
};
|
|
26
|
+
type Config = Required<Pick<IDKitConfig, 'action'>> & WidgetConfig & ((Exclude<IDKitConfig, 'app_id'> & {
|
|
27
|
+
advanced: {
|
|
28
|
+
self_hosted: true;
|
|
29
|
+
};
|
|
30
|
+
}) | (IDKitConfig & {
|
|
31
|
+
advanced?: {
|
|
32
|
+
self_hosted?: false;
|
|
33
|
+
};
|
|
34
|
+
}));
|
|
35
|
+
type WidgetProps = Config & {
|
|
36
|
+
children?: ({ open }: {
|
|
37
|
+
open: () => void;
|
|
38
|
+
}) => JSX.Element;
|
|
39
|
+
show_modal?: boolean;
|
|
40
|
+
/** Whether to disable the default modal behavior. Defaults to `false`. */
|
|
41
|
+
disable_default_modal_behavior?: boolean;
|
|
42
|
+
container_id?: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { type Config as C, IDKITStage as I, type WidgetProps as W, ConfigSource as a, type CallbackFn as b };
|