@worldcoin/idkit 0.4.2 → 0.4.5
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/idkit-js.js +22 -22
- package/build/index.cjs +9 -0
- package/build/index.cjs.map +7 -0
- package/build/index.css +2 -2
- package/build/index.js +2 -2
- package/build/index.js.map +3 -3
- package/build/src/components/QRCode.d.ts +1 -2
- package/build/src/components/SignInWithWorldID.d.ts +1 -1
- package/build/src/index.d.ts +20 -1
- package/build/src/lib/telemetry.d.ts +0 -3
- package/build/src/lib/utils.d.ts +0 -3
- package/build/src/services/walletconnect.d.ts +5 -5
- package/build/src/store/idkit.d.ts +1 -2
- package/build/src/types/{orb.d.ts → app.d.ts} +1 -3
- package/build/src/types/config.d.ts +2 -7
- package/build/src/types/index.d.ts +4 -17
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -8
- package/build/src/components/IDKitWidget/States/AboutState.d.ts +0 -2
- package/build/src/components/Icons/DevicePhoneMobileIcon.d.ts +0 -3
- package/build/src/components/Icons/WorldIDQR.d.ts +0 -4
- package/build/src/components/Icons/WorldcoinLogomark.d.ts +0 -3
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
type Props = {
|
|
3
3
|
data: string;
|
|
4
4
|
size?: number;
|
|
5
|
-
logoSize?: number;
|
|
6
5
|
};
|
|
7
|
-
declare const _default: import("react").MemoExoticComponent<({ data,
|
|
6
|
+
declare const _default: import("react").MemoExoticComponent<({ data, size }: Props) => JSX.Element>;
|
|
8
7
|
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
2
|
import type { IDKitConfig, WidgetConfig } from '../types/config';
|
|
3
|
-
type Props = Pick<IDKitConfig, 'app_id' | 'walletConnectProjectId'> &
|
|
3
|
+
type Props = Omit<WidgetConfig, 'autoClose'> & Pick<IDKitConfig, 'app_id' | 'walletConnectProjectId'> & {
|
|
4
4
|
nonce?: string;
|
|
5
5
|
onSuccess: (jwt: string) => void;
|
|
6
6
|
children?: ({ open }: {
|
package/build/src/index.d.ts
CHANGED
|
@@ -1,14 +1,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import useIDKit from './hooks/useIDKit';
|
|
3
|
+
import { CredentialType } from './types';
|
|
2
4
|
import type { ISuccessResult } from './types';
|
|
3
5
|
import { solidityEncode } from './lib/hashing';
|
|
4
6
|
import IDKitWidget from './components/IDKitWidget';
|
|
5
7
|
import type { WidgetProps, Config } from './types/config';
|
|
8
|
+
import { VerificationState, AppErrorCodes } from './types/app';
|
|
6
9
|
import SignInWithWorldID from './components/SignInWithWorldID';
|
|
7
10
|
import { hashToField } from './lib/hashing';
|
|
8
11
|
declare const internal: {
|
|
9
12
|
hashToField: typeof hashToField;
|
|
10
13
|
validateABILikeEncoding: (value: string) => boolean;
|
|
11
14
|
generateExternalNullifier: (app_id: string, action: string | import("./types").AbiEncodedValue | undefined) => import("./lib/hashing").HashFunctionOutput;
|
|
15
|
+
QRCode: import("react").MemoExoticComponent<({ data, size }: {
|
|
16
|
+
data: string;
|
|
17
|
+
size?: number | undefined;
|
|
18
|
+
}) => JSX.Element>;
|
|
19
|
+
useAppConnection: (app_id: string, action: string | import("./types").AbiEncodedValue | undefined, signal?: string | import("./types").AbiEncodedValue | undefined, credential_types?: CredentialType[] | undefined, action_description?: string | undefined, walletConnectProjectId?: string | undefined) => {
|
|
20
|
+
reset: () => void;
|
|
21
|
+
result: ISuccessResult | null;
|
|
22
|
+
errorCode: AppErrorCodes | null;
|
|
23
|
+
verificationState: VerificationState;
|
|
24
|
+
qrData: {
|
|
25
|
+
default: string;
|
|
26
|
+
mobile: string;
|
|
27
|
+
} | null;
|
|
28
|
+
};
|
|
29
|
+
VerificationState: typeof VerificationState;
|
|
30
|
+
AppErrorCodes: typeof AppErrorCodes;
|
|
12
31
|
};
|
|
13
|
-
export { IDKitWidget, useIDKit, solidityEncode, internal, SignInWithWorldID };
|
|
32
|
+
export { IDKitWidget, useIDKit, solidityEncode, internal, SignInWithWorldID, CredentialType };
|
|
14
33
|
export type { ISuccessResult, Config, WidgetProps };
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type { PhoneVerificationChannel } from '../types';
|
|
2
1
|
export declare const getTelemetryId: () => string;
|
|
3
2
|
export declare const initTelemetry: (enableTelemetry?: boolean) => void;
|
|
4
3
|
export declare const telemetryModalOpened: () => void;
|
|
5
|
-
export declare const telemetryPhoneTyped: () => void;
|
|
6
|
-
export declare const telemetryRetryCode: (channel: PhoneVerificationChannel) => void;
|
package/build/src/lib/utils.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import type { Config } from '../types/config';
|
|
2
|
-
import { DEFAULT_COPY } from '../types/config';
|
|
3
1
|
export declare const classNames: (...classes: unknown[]) => string;
|
|
4
2
|
export declare const randomNumber: (min: number, max: number) => number;
|
|
5
|
-
export declare const getCopy: (copy: Config['copy'], key: keyof typeof DEFAULT_COPY) => string;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { IDKitConfig } from '../types/config';
|
|
2
|
-
import {
|
|
2
|
+
import { AppErrorCodes, VerificationState } from '../types/app';
|
|
3
3
|
import type { ISuccessResult } from '../types';
|
|
4
|
-
type
|
|
4
|
+
type UseAppConnectionResponse = {
|
|
5
5
|
reset: () => void;
|
|
6
6
|
result: ISuccessResult | null;
|
|
7
|
-
errorCode:
|
|
7
|
+
errorCode: AppErrorCodes | null;
|
|
8
8
|
verificationState: VerificationState;
|
|
9
9
|
qrData: {
|
|
10
10
|
default: string;
|
|
11
11
|
mobile: string;
|
|
12
12
|
} | null;
|
|
13
13
|
};
|
|
14
|
-
declare const
|
|
15
|
-
export default
|
|
14
|
+
declare const useAppConnection: (app_id: IDKitConfig['app_id'], action: IDKitConfig['action'], signal?: IDKitConfig['signal'], credential_types?: IDKitConfig['credential_types'], action_description?: IDKitConfig['action_description'], walletConnectProjectId?: IDKitConfig['walletConnectProjectId']) => UseAppConnectionResponse;
|
|
15
|
+
export default useAppConnection;
|
|
@@ -7,11 +7,11 @@ export type IDKitStore = {
|
|
|
7
7
|
signal: IDKitConfig['signal'];
|
|
8
8
|
action_description?: IDKitConfig['action_description'];
|
|
9
9
|
walletConnectProjectId?: IDKitConfig['walletConnectProjectId'];
|
|
10
|
+
credential_types?: IDKitConfig['credential_types'];
|
|
10
11
|
code: string;
|
|
11
12
|
open: boolean;
|
|
12
13
|
stage: IDKITStage;
|
|
13
14
|
autoClose: boolean;
|
|
14
|
-
phoneNumber: string;
|
|
15
15
|
processing: boolean;
|
|
16
16
|
copy: Config['copy'];
|
|
17
17
|
theme: Config['theme'];
|
|
@@ -27,7 +27,6 @@ export type IDKitStore = {
|
|
|
27
27
|
setStage: (stage: IDKITStage) => void;
|
|
28
28
|
onOpenChange: (open: boolean) => void;
|
|
29
29
|
setProcessing: (processing: boolean) => void;
|
|
30
|
-
setPhoneNumber: (phoneNumber: string) => void;
|
|
31
30
|
handleVerify: (result: ISuccessResult) => void;
|
|
32
31
|
setErrorState: (state: IErrorState | null) => void;
|
|
33
32
|
setOptions: (options: Config, source: ConfigSource) => void;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
export declare enum
|
|
1
|
+
export declare enum AppErrorCodes {
|
|
2
2
|
ConnectionFailed = "connection_failed",
|
|
3
3
|
VerificationRejected = "verification_rejected",
|
|
4
4
|
AlreadySigned = "already_signed",
|
|
5
|
-
InvalidActionID = "invalid_action_id",
|
|
6
|
-
InvalidSignal = "invalid_signal",
|
|
7
5
|
UnexpectedResponse = "unexpected_response",
|
|
8
6
|
GenericError = "generic_error"
|
|
9
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CallbackFn, AbiEncodedValue } from '.';
|
|
1
|
+
import type { CallbackFn, AbiEncodedValue, CredentialType } from '.';
|
|
2
2
|
export declare enum ConfigSource {
|
|
3
3
|
HOOK = "hook",
|
|
4
4
|
PROPS = "props",
|
|
@@ -10,6 +10,7 @@ export type IDKitConfig = {
|
|
|
10
10
|
walletConnectProjectId?: string;
|
|
11
11
|
signal?: AbiEncodedValue | string;
|
|
12
12
|
action?: AbiEncodedValue | string;
|
|
13
|
+
credential_types?: CredentialType[];
|
|
13
14
|
};
|
|
14
15
|
export type WidgetConfig = {
|
|
15
16
|
autoClose?: boolean;
|
|
@@ -30,9 +31,3 @@ export type WidgetProps = Config & {
|
|
|
30
31
|
open: () => void;
|
|
31
32
|
}) => JSX.Element;
|
|
32
33
|
};
|
|
33
|
-
export declare const DEFAULT_COPY: {
|
|
34
|
-
readonly title: "World ID";
|
|
35
|
-
readonly heading: "Verify your identity";
|
|
36
|
-
readonly subheading: "Unlock additional benefits by verifying you're a unique human doing this action once.";
|
|
37
|
-
readonly success: "Your phone number has been verified";
|
|
38
|
-
};
|
|
@@ -11,7 +11,6 @@ export declare enum IDKITStage {
|
|
|
11
11
|
PRIVACY = "PRIVACY",
|
|
12
12
|
SUCCESS = "SUCCESS",
|
|
13
13
|
ERROR = "ERROR",
|
|
14
|
-
ABOUT = "ABOUT",
|
|
15
14
|
HOST_APP_VERIFICATION = "HOST_APP_VERIFICATION"
|
|
16
15
|
}
|
|
17
16
|
export declare enum CredentialType {
|
|
@@ -25,28 +24,16 @@ export interface ISuccessResult {
|
|
|
25
24
|
credential_type: CredentialType;
|
|
26
25
|
}
|
|
27
26
|
export type CallbackFn = (result: ISuccessResult) => Promise<void> | void;
|
|
27
|
+
export interface ExpectedErrorResponse {
|
|
28
|
+
message: string;
|
|
29
|
+
stack: string;
|
|
30
|
+
}
|
|
28
31
|
export interface IErrorState {
|
|
29
32
|
code: ErrorCodes;
|
|
30
33
|
message?: string;
|
|
31
34
|
}
|
|
32
35
|
export declare enum ErrorCodes {
|
|
33
36
|
GENERIC_ERROR = "GENERIC_ERROR",
|
|
34
|
-
PHONE_OTP_REQUEST_ERROR = "PHONE_OTP_REQUEST_ERROR",
|
|
35
|
-
INVALID_CODE = "INVALID_CODE",
|
|
36
37
|
REJECTED_BY_HOST_APP = "REJECTED_BY_HOST_APP"
|
|
37
38
|
}
|
|
38
|
-
export interface ExpectedErrorResponse {
|
|
39
|
-
message: string;
|
|
40
|
-
stack: string;
|
|
41
|
-
}
|
|
42
|
-
export declare enum PhoneVerificationChannel {
|
|
43
|
-
SMS = "sms",
|
|
44
|
-
Call = "call"
|
|
45
|
-
}
|
|
46
|
-
export declare enum PhoneRequestErrorCodes {
|
|
47
|
-
MAX_ATTEMPTS = "max_attempts",
|
|
48
|
-
TIMEOUT = "timeout",
|
|
49
|
-
UNSUPPORTED_COUNTRY = "unsupported_country",
|
|
50
|
-
SERVER_ERROR = "server_error"
|
|
51
|
-
}
|
|
52
39
|
export {};
|