@worldcoin/idkit 1.1.4 → 1.2.2
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/{chunk-JCPD6J62.js → chunk-OPIVJQZ6.js} +10 -25
- package/build/{config-71e4be16.d.ts → config-Cp9MWjvm.d.ts} +1 -2
- package/build/index.d.ts +2 -1
- package/build/index.js +182 -407
- package/build/internal.d.ts +3 -6
- package/build/internal.js +1 -1
- package/package.json +23 -26
- package/src/index.ts +4 -2
- package/build/verified-O6D4JQCX.webp +0 -0
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
// src/lang/index.ts
|
|
2
2
|
var translations = {};
|
|
3
3
|
var getLang = () => {
|
|
4
|
-
if (!navigator?.languages)
|
|
5
|
-
return;
|
|
4
|
+
if (!navigator?.languages) return;
|
|
6
5
|
const supportedLang = navigator.languages.find((l) => translations[l] != void 0) ?? "";
|
|
7
6
|
return translations[supportedLang];
|
|
8
7
|
};
|
|
9
8
|
var replaceParams = (str, params) => {
|
|
10
9
|
let replaced = str;
|
|
11
|
-
for (const [key, value] of Object.entries(params ?? {}))
|
|
12
|
-
replaced = str.replace(`:${key}`, value);
|
|
10
|
+
for (const [key, value] of Object.entries(params ?? {})) replaced = str.replace(`:${key}`, value);
|
|
13
11
|
return replaced;
|
|
14
12
|
};
|
|
15
13
|
function __(str, params) {
|
|
16
|
-
if (typeof navigator === "undefined")
|
|
17
|
-
return str;
|
|
14
|
+
if (typeof navigator === "undefined") return str;
|
|
18
15
|
return replaceParams(getLang()?.[str] ?? str, params);
|
|
19
16
|
}
|
|
20
17
|
|
|
@@ -45,11 +42,6 @@ var useIDKitStore = createWithEqualityFn()(
|
|
|
45
42
|
verifyCallbacks: {},
|
|
46
43
|
successCallbacks: {},
|
|
47
44
|
stage: "WORLD_ID" /* WORLD_ID */,
|
|
48
|
-
computed: {
|
|
49
|
-
canGoBack: (stage) => {
|
|
50
|
-
return stage == "PRIVACY" /* PRIVACY */;
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
45
|
setStage: (stage) => set({ stage }),
|
|
54
46
|
setErrorState: (errorState) => set({ errorState }),
|
|
55
47
|
setProcessing: (processing) => set({ processing }),
|
|
@@ -97,18 +89,15 @@ var useIDKitStore = createWithEqualityFn()(
|
|
|
97
89
|
verification_level: verification_level ?? DEFAULT_VERIFICATION_LEVEL
|
|
98
90
|
});
|
|
99
91
|
get().addSuccessCallback(onSuccess, source);
|
|
100
|
-
if (onError)
|
|
101
|
-
|
|
102
|
-
if (handleVerify)
|
|
103
|
-
get().addVerificationCallback(handleVerify, source);
|
|
92
|
+
if (onError) get().addErrorCallback(onError, source);
|
|
93
|
+
if (handleVerify) get().addVerificationCallback(handleVerify, source);
|
|
104
94
|
},
|
|
105
95
|
handleVerify: (result) => {
|
|
106
96
|
set({ stage: "HOST_APP_VERIFICATION" /* HOST_APP_VERIFICATION */, processing: false });
|
|
107
97
|
Promise.all(Object.values(get().verifyCallbacks).map(async (cb) => cb?.(result))).then(
|
|
108
98
|
() => {
|
|
109
99
|
set({ stage: "SUCCESS" /* SUCCESS */, result });
|
|
110
|
-
if (get().autoClose)
|
|
111
|
-
setTimeout(() => get().onOpenChange(false), 2500);
|
|
100
|
+
if (get().autoClose) setTimeout(() => get().onOpenChange(false), 2500);
|
|
112
101
|
},
|
|
113
102
|
(response) => {
|
|
114
103
|
let errorMessage = void 0;
|
|
@@ -168,10 +157,8 @@ var generateMatrix = (data) => {
|
|
|
168
157
|
const arr = QRCodeUtil.create(data, { errorCorrectionLevel: "M" }).modules.data;
|
|
169
158
|
const sqrt = Math.sqrt(arr.length);
|
|
170
159
|
return arr.reduce((rows, key, index) => {
|
|
171
|
-
if (index % sqrt === 0)
|
|
172
|
-
|
|
173
|
-
else
|
|
174
|
-
rows[rows.length - 1].push(key);
|
|
160
|
+
if (index % sqrt === 0) rows.push([key]);
|
|
161
|
+
else rows[rows.length - 1].push(key);
|
|
175
162
|
return rows;
|
|
176
163
|
}, []);
|
|
177
164
|
};
|
|
@@ -209,10 +196,8 @@ var Qrcode = ({ data, size = 300 }) => {
|
|
|
209
196
|
});
|
|
210
197
|
matrix.forEach((row, i) => {
|
|
211
198
|
row.forEach((_, j) => {
|
|
212
|
-
if (!matrix[i][j])
|
|
213
|
-
|
|
214
|
-
if (i < 7 && j < 7 || i > matrix.length - 8 && j < 7 || i < 7 && j > matrix.length - 8)
|
|
215
|
-
return;
|
|
199
|
+
if (!matrix[i][j]) return;
|
|
200
|
+
if (i < 7 && j < 7 || i > matrix.length - 8 && j < 7 || i < 7 && j > matrix.length - 8) return;
|
|
216
201
|
dots2.push(
|
|
217
202
|
/* @__PURE__ */ jsx(
|
|
218
203
|
"circle",
|
|
@@ -2,7 +2,6 @@ import { IDKitConfig, ISuccessResult, IErrorState } from '@worldcoin/idkit-core'
|
|
|
2
2
|
|
|
3
3
|
declare enum IDKITStage {
|
|
4
4
|
WORLD_ID = "WORLD_ID",
|
|
5
|
-
PRIVACY = "PRIVACY",
|
|
6
5
|
SUCCESS = "SUCCESS",
|
|
7
6
|
ERROR = "ERROR",
|
|
8
7
|
HOST_APP_VERIFICATION = "HOST_APP_VERIFICATION"
|
|
@@ -39,4 +38,4 @@ type WidgetProps = Config & {
|
|
|
39
38
|
}) => JSX.Element;
|
|
40
39
|
};
|
|
41
40
|
|
|
42
|
-
export { Config as C, IDKITStage as I, WidgetProps as W, ConfigSource as a, CallbackFn as b };
|
|
41
|
+
export { type Config as C, IDKITStage as I, type WidgetProps as W, ConfigSource as a, type CallbackFn as b };
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { C as Config, W as WidgetProps } from './config-
|
|
1
|
+
import { C as Config, W as WidgetProps } from './config-Cp9MWjvm.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
export { IErrorState, ISuccessResult, VerificationLevel } from '@worldcoin/idkit-core';
|
|
4
4
|
export { solidityEncode } from '@worldcoin/idkit-core/hashing';
|
|
5
|
+
export { IVerifyResponse, verifyCloudProof } from '@worldcoin/idkit-core/backend';
|
|
5
6
|
|
|
6
7
|
type HookConfig = Partial<Pick<Config, 'handleVerify' | 'onSuccess'>>;
|
|
7
8
|
declare const useIDKit: ({ handleVerify, onSuccess }?: HookConfig) => {
|