@worldcoin/idkit 1.2.0 → 1.3.0
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.
|
@@ -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
|
|
|
@@ -92,18 +89,15 @@ var useIDKitStore = createWithEqualityFn()(
|
|
|
92
89
|
verification_level: verification_level ?? DEFAULT_VERIFICATION_LEVEL
|
|
93
90
|
});
|
|
94
91
|
get().addSuccessCallback(onSuccess, source);
|
|
95
|
-
if (onError)
|
|
96
|
-
|
|
97
|
-
if (handleVerify)
|
|
98
|
-
get().addVerificationCallback(handleVerify, source);
|
|
92
|
+
if (onError) get().addErrorCallback(onError, source);
|
|
93
|
+
if (handleVerify) get().addVerificationCallback(handleVerify, source);
|
|
99
94
|
},
|
|
100
95
|
handleVerify: (result) => {
|
|
101
96
|
set({ stage: "HOST_APP_VERIFICATION" /* HOST_APP_VERIFICATION */, processing: false });
|
|
102
97
|
Promise.all(Object.values(get().verifyCallbacks).map(async (cb) => cb?.(result))).then(
|
|
103
98
|
() => {
|
|
104
99
|
set({ stage: "SUCCESS" /* SUCCESS */, result });
|
|
105
|
-
if (get().autoClose)
|
|
106
|
-
setTimeout(() => get().onOpenChange(false), 2500);
|
|
100
|
+
if (get().autoClose) setTimeout(() => get().onOpenChange(false), 2500);
|
|
107
101
|
},
|
|
108
102
|
(response) => {
|
|
109
103
|
let errorMessage = void 0;
|
|
@@ -163,10 +157,8 @@ var generateMatrix = (data) => {
|
|
|
163
157
|
const arr = QRCodeUtil.create(data, { errorCorrectionLevel: "M" }).modules.data;
|
|
164
158
|
const sqrt = Math.sqrt(arr.length);
|
|
165
159
|
return arr.reduce((rows, key, index) => {
|
|
166
|
-
if (index % sqrt === 0)
|
|
167
|
-
|
|
168
|
-
else
|
|
169
|
-
rows[rows.length - 1].push(key);
|
|
160
|
+
if (index % sqrt === 0) rows.push([key]);
|
|
161
|
+
else rows[rows.length - 1].push(key);
|
|
170
162
|
return rows;
|
|
171
163
|
}, []);
|
|
172
164
|
};
|
|
@@ -204,10 +196,8 @@ var Qrcode = ({ data, size = 300 }) => {
|
|
|
204
196
|
});
|
|
205
197
|
matrix.forEach((row, i) => {
|
|
206
198
|
row.forEach((_, j) => {
|
|
207
|
-
if (!matrix[i][j])
|
|
208
|
-
|
|
209
|
-
if (i < 7 && j < 7 || i > matrix.length - 8 && j < 7 || i < 7 && j > matrix.length - 8)
|
|
210
|
-
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;
|
|
211
201
|
dots2.push(
|
|
212
202
|
/* @__PURE__ */ jsx(
|
|
213
203
|
"circle",
|
|
@@ -38,4 +38,4 @@ type WidgetProps = Config & {
|
|
|
38
38
|
}) => JSX.Element;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
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,4 +1,4 @@
|
|
|
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';
|
package/build/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
QRCode_default,
|
|
3
3
|
__,
|
|
4
4
|
idkit_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OPIVJQZ6.js";
|
|
6
6
|
|
|
7
7
|
// src/hooks/useIDKit.ts
|
|
8
8
|
import { useEffect } from "react";
|
|
@@ -15,10 +15,8 @@ var getStore = ({ open, onOpenChange, addSuccessCallback, addVerificationCallbac
|
|
|
15
15
|
var useIDKit = ({ handleVerify, onSuccess } = {}) => {
|
|
16
16
|
const { open, onOpenChange, addSuccessCallback, addVerificationCallback } = idkit_default(getStore);
|
|
17
17
|
useEffect(() => {
|
|
18
|
-
if (onSuccess)
|
|
19
|
-
|
|
20
|
-
if (handleVerify)
|
|
21
|
-
addVerificationCallback(handleVerify, "hook" /* HOOK */);
|
|
18
|
+
if (onSuccess) addSuccessCallback(onSuccess, "hook" /* HOOK */);
|
|
19
|
+
if (handleVerify) addVerificationCallback(handleVerify, "hook" /* HOOK */);
|
|
22
20
|
}, [handleVerify, onSuccess]);
|
|
23
21
|
return { open, setOpen: onOpenChange };
|
|
24
22
|
};
|
|
@@ -50,7 +48,7 @@ var useMedia_default = useMedia;
|
|
|
50
48
|
// src/styles/styles.css
|
|
51
49
|
var styles_default = `/* TODO: Use an alternative to avoid the extra request to Google (e.g. hosting ourselves, or local file) */
|
|
52
50
|
@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;600;700&family=Sora:wght@600&display=swap');
|
|
53
|
-
/* ! tailwindcss v3.
|
|
51
|
+
/* ! tailwindcss v3.4.4 | MIT License | https://tailwindcss.com */
|
|
54
52
|
/*
|
|
55
53
|
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
|
|
56
54
|
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
|
|
@@ -74,16 +72,19 @@ var styles_default = `/* TODO: Use an alternative to avoid the extra request to
|
|
|
74
72
|
4. Use the user's configured \`sans\` font-family by default.
|
|
75
73
|
5. Use the user's configured \`sans\` font-feature-settings by default.
|
|
76
74
|
6. Use the user's configured \`sans\` font-variation-settings by default.
|
|
75
|
+
7. Disable tap highlights on iOS
|
|
77
76
|
*/
|
|
78
|
-
html
|
|
77
|
+
html,
|
|
78
|
+
:host {
|
|
79
79
|
line-height: 1.5; /* 1 */
|
|
80
80
|
-webkit-text-size-adjust: 100%; /* 2 */
|
|
81
81
|
-moz-tab-size: 4; /* 3 */
|
|
82
82
|
-o-tab-size: 4;
|
|
83
83
|
tab-size: 4; /* 3 */
|
|
84
|
-
font-family: Rubik, ui-sans-serif, system-ui,
|
|
84
|
+
font-family: Rubik, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */
|
|
85
85
|
font-feature-settings: normal; /* 5 */
|
|
86
86
|
font-variation-settings: normal; /* 6 */
|
|
87
|
+
-webkit-tap-highlight-color: transparent; /* 7 */
|
|
87
88
|
}
|
|
88
89
|
/*
|
|
89
90
|
1. Remove the margin in all browsers.
|
|
@@ -137,15 +138,19 @@ strong {
|
|
|
137
138
|
font-weight: bolder;
|
|
138
139
|
}
|
|
139
140
|
/*
|
|
140
|
-
1. Use the user's configured \`mono\` font
|
|
141
|
-
2.
|
|
141
|
+
1. Use the user's configured \`mono\` font-family by default.
|
|
142
|
+
2. Use the user's configured \`mono\` font-feature-settings by default.
|
|
143
|
+
3. Use the user's configured \`mono\` font-variation-settings by default.
|
|
144
|
+
4. Correct the odd \`em\` font sizing in all browsers.
|
|
142
145
|
*/
|
|
143
146
|
code,
|
|
144
147
|
kbd,
|
|
145
148
|
samp,
|
|
146
149
|
pre {
|
|
147
150
|
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */
|
|
148
|
-
font-
|
|
151
|
+
font-feature-settings: normal; /* 2 */
|
|
152
|
+
font-variation-settings: normal; /* 3 */
|
|
153
|
+
font-size: 1em; /* 4 */
|
|
149
154
|
}
|
|
150
155
|
/*
|
|
151
156
|
Add the correct font size in all browsers.
|
|
@@ -195,6 +200,7 @@ textarea {
|
|
|
195
200
|
font-size: 100%; /* 1 */
|
|
196
201
|
font-weight: inherit; /* 1 */
|
|
197
202
|
line-height: inherit; /* 1 */
|
|
203
|
+
letter-spacing: inherit; /* 1 */
|
|
198
204
|
color: inherit; /* 1 */
|
|
199
205
|
margin: 0; /* 2 */
|
|
200
206
|
padding: 0; /* 3 */
|
|
@@ -211,9 +217,9 @@ select {
|
|
|
211
217
|
2. Remove default button styles.
|
|
212
218
|
*/
|
|
213
219
|
button,
|
|
214
|
-
[type='button'],
|
|
215
|
-
[type='reset'],
|
|
216
|
-
[type='submit'] {
|
|
220
|
+
input:where([type='button']),
|
|
221
|
+
input:where([type='reset']),
|
|
222
|
+
input:where([type='submit']) {
|
|
217
223
|
-webkit-appearance: button; /* 1 */
|
|
218
224
|
background-color: transparent; /* 2 */
|
|
219
225
|
background-image: none; /* 2 */
|
|
@@ -486,9 +492,23 @@ select{
|
|
|
486
492
|
[type='checkbox']:checked{
|
|
487
493
|
background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
|
|
488
494
|
}
|
|
495
|
+
@media (forced-colors: active) {
|
|
496
|
+
[type='checkbox']:checked{
|
|
497
|
+
-webkit-appearance: auto;
|
|
498
|
+
-moz-appearance: auto;
|
|
499
|
+
appearance: auto;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
489
502
|
[type='radio']:checked{
|
|
490
503
|
background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
|
|
491
504
|
}
|
|
505
|
+
@media (forced-colors: active) {
|
|
506
|
+
[type='radio']:checked{
|
|
507
|
+
-webkit-appearance: auto;
|
|
508
|
+
-moz-appearance: auto;
|
|
509
|
+
appearance: auto;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
492
512
|
[type='checkbox']:checked:hover,[type='checkbox']:checked:focus,[type='radio']:checked:hover,[type='radio']:checked:focus{
|
|
493
513
|
border-color: transparent;
|
|
494
514
|
background-color: currentColor;
|
|
@@ -501,6 +521,13 @@ select{
|
|
|
501
521
|
background-position: center;
|
|
502
522
|
background-repeat: no-repeat;
|
|
503
523
|
}
|
|
524
|
+
@media (forced-colors: active) {
|
|
525
|
+
[type='checkbox']:indeterminate{
|
|
526
|
+
-webkit-appearance: auto;
|
|
527
|
+
-moz-appearance: auto;
|
|
528
|
+
appearance: auto;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
504
531
|
[type='checkbox']:indeterminate:hover,[type='checkbox']:indeterminate:focus{
|
|
505
532
|
border-color: transparent;
|
|
506
533
|
background-color: currentColor;
|
|
@@ -566,6 +593,10 @@ select{
|
|
|
566
593
|
--tw-backdrop-opacity: ;
|
|
567
594
|
--tw-backdrop-saturate: ;
|
|
568
595
|
--tw-backdrop-sepia: ;
|
|
596
|
+
--tw-contain-size: ;
|
|
597
|
+
--tw-contain-layout: ;
|
|
598
|
+
--tw-contain-paint: ;
|
|
599
|
+
--tw-contain-style: ;
|
|
569
600
|
}
|
|
570
601
|
::backdrop{
|
|
571
602
|
--tw-border-spacing-x: 0;
|
|
@@ -615,6 +646,10 @@ select{
|
|
|
615
646
|
--tw-backdrop-opacity: ;
|
|
616
647
|
--tw-backdrop-saturate: ;
|
|
617
648
|
--tw-backdrop-sepia: ;
|
|
649
|
+
--tw-contain-size: ;
|
|
650
|
+
--tw-contain-layout: ;
|
|
651
|
+
--tw-contain-paint: ;
|
|
652
|
+
--tw-contain-style: ;
|
|
618
653
|
}
|
|
619
654
|
.visible{
|
|
620
655
|
visibility: visible;
|
|
@@ -657,6 +692,9 @@ select{
|
|
|
657
692
|
.mb-12{
|
|
658
693
|
margin-bottom: 48px;
|
|
659
694
|
}
|
|
695
|
+
.mb-3{
|
|
696
|
+
margin-bottom: 12px;
|
|
697
|
+
}
|
|
660
698
|
.mb-4{
|
|
661
699
|
margin-bottom: 16px;
|
|
662
700
|
}
|
|
@@ -687,6 +725,18 @@ select{
|
|
|
687
725
|
.hidden{
|
|
688
726
|
display: none;
|
|
689
727
|
}
|
|
728
|
+
.size-5{
|
|
729
|
+
width: 20px;
|
|
730
|
+
height: 20px;
|
|
731
|
+
}
|
|
732
|
+
.size-6{
|
|
733
|
+
width: 24px;
|
|
734
|
+
height: 24px;
|
|
735
|
+
}
|
|
736
|
+
.size-\\[244px\\]{
|
|
737
|
+
width: 244px;
|
|
738
|
+
height: 244px;
|
|
739
|
+
}
|
|
690
740
|
.h-10{
|
|
691
741
|
height: 40px;
|
|
692
742
|
}
|
|
@@ -696,12 +746,6 @@ select{
|
|
|
696
746
|
.h-5{
|
|
697
747
|
height: 20px;
|
|
698
748
|
}
|
|
699
|
-
.h-6{
|
|
700
|
-
height: 24px;
|
|
701
|
-
}
|
|
702
|
-
.h-\\[244px\\]{
|
|
703
|
-
height: 244px;
|
|
704
|
-
}
|
|
705
749
|
.min-h-full{
|
|
706
750
|
min-height: 100%;
|
|
707
751
|
}
|
|
@@ -717,12 +761,6 @@ select{
|
|
|
717
761
|
.w-5{
|
|
718
762
|
width: 20px;
|
|
719
763
|
}
|
|
720
|
-
.w-6{
|
|
721
|
-
width: 24px;
|
|
722
|
-
}
|
|
723
|
-
.w-\\[244px\\]{
|
|
724
|
-
width: 244px;
|
|
725
|
-
}
|
|
726
764
|
.w-full{
|
|
727
765
|
width: 100%;
|
|
728
766
|
}
|
|
@@ -789,6 +827,11 @@ select{
|
|
|
789
827
|
margin-top: calc(16px * calc(1 - var(--tw-space-y-reverse)));
|
|
790
828
|
margin-bottom: calc(16px * var(--tw-space-y-reverse));
|
|
791
829
|
}
|
|
830
|
+
.space-y-5 > :not([hidden]) ~ :not([hidden]){
|
|
831
|
+
--tw-space-y-reverse: 0;
|
|
832
|
+
margin-top: calc(20px * calc(1 - var(--tw-space-y-reverse)));
|
|
833
|
+
margin-bottom: calc(20px * var(--tw-space-y-reverse));
|
|
834
|
+
}
|
|
792
835
|
.space-y-6 > :not([hidden]) ~ :not([hidden]){
|
|
793
836
|
--tw-space-y-reverse: 0;
|
|
794
837
|
margin-top: calc(24px * calc(1 - var(--tw-space-y-reverse)));
|
|
@@ -859,10 +902,6 @@ select{
|
|
|
859
902
|
padding-left: 8px;
|
|
860
903
|
padding-right: 8px;
|
|
861
904
|
}
|
|
862
|
-
.px-4{
|
|
863
|
-
padding-left: 16px;
|
|
864
|
-
padding-right: 16px;
|
|
865
|
-
}
|
|
866
905
|
.px-8{
|
|
867
906
|
padding-left: 32px;
|
|
868
907
|
padding-right: 32px;
|
|
@@ -875,10 +914,6 @@ select{
|
|
|
875
914
|
padding-top: 12px;
|
|
876
915
|
padding-bottom: 12px;
|
|
877
916
|
}
|
|
878
|
-
.py-4{
|
|
879
|
-
padding-top: 16px;
|
|
880
|
-
padding-bottom: 16px;
|
|
881
|
-
}
|
|
882
917
|
.pt-6{
|
|
883
918
|
padding-top: 24px;
|
|
884
919
|
}
|
|
@@ -886,10 +921,10 @@ select{
|
|
|
886
921
|
text-align: center;
|
|
887
922
|
}
|
|
888
923
|
.font-sans{
|
|
889
|
-
font-family: Rubik, ui-sans-serif, system-ui,
|
|
924
|
+
font-family: Rubik, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
890
925
|
}
|
|
891
926
|
.font-sora{
|
|
892
|
-
font-family: Sora, ui-sans-serif, system-ui,
|
|
927
|
+
font-family: Sora, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
893
928
|
}
|
|
894
929
|
.text-2xl{
|
|
895
930
|
font-size: 24px;
|
|
@@ -1050,26 +1085,26 @@ input[type='number']::-webkit-inner-spin-button,
|
|
|
1050
1085
|
animation: spin 1.5s linear infinite;
|
|
1051
1086
|
}
|
|
1052
1087
|
}
|
|
1053
|
-
|
|
1088
|
+
.dark\\:border-f1f5f8\\/10:is(.dark *){
|
|
1054
1089
|
border-color: rgb(241 245 248 / 0.1);
|
|
1055
1090
|
}
|
|
1056
|
-
:is(.dark
|
|
1091
|
+
.dark\\:bg-0d151d:is(.dark *){
|
|
1057
1092
|
--tw-bg-opacity: 1;
|
|
1058
1093
|
background-color: rgb(13 21 29 / var(--tw-bg-opacity));
|
|
1059
1094
|
}
|
|
1060
|
-
:is(.dark
|
|
1095
|
+
.dark\\:bg-white:is(.dark *){
|
|
1061
1096
|
--tw-bg-opacity: 1;
|
|
1062
1097
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
1063
1098
|
}
|
|
1064
|
-
:is(.dark
|
|
1099
|
+
.dark\\:text-0d151d:is(.dark *){
|
|
1065
1100
|
--tw-text-opacity: 1;
|
|
1066
1101
|
color: rgb(13 21 29 / var(--tw-text-opacity));
|
|
1067
1102
|
}
|
|
1068
|
-
:is(.dark
|
|
1103
|
+
.dark\\:text-9eafc0:is(.dark *){
|
|
1069
1104
|
--tw-text-opacity: 1;
|
|
1070
1105
|
color: rgb(158 175 192 / var(--tw-text-opacity));
|
|
1071
1106
|
}
|
|
1072
|
-
:is(.dark
|
|
1107
|
+
.dark\\:text-white:is(.dark *){
|
|
1073
1108
|
--tw-text-opacity: 1;
|
|
1074
1109
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
1075
1110
|
}
|
|
@@ -1392,13 +1427,6 @@ var SuccessState_default = SuccessState;
|
|
|
1392
1427
|
|
|
1393
1428
|
// src/components/IDKitWidget/States/WorldID/QRState.tsx
|
|
1394
1429
|
import copy from "copy-to-clipboard";
|
|
1395
|
-
|
|
1396
|
-
// src/lib/utils.ts
|
|
1397
|
-
var classNames = (...classes) => {
|
|
1398
|
-
return classes.filter(Boolean).join(" ");
|
|
1399
|
-
};
|
|
1400
|
-
|
|
1401
|
-
// src/components/IDKitWidget/States/WorldID/QRState.tsx
|
|
1402
1430
|
import { useCallback, useState as useState2 } from "react";
|
|
1403
1431
|
import { AnimatePresence, motion } from "framer-motion";
|
|
1404
1432
|
|
|
@@ -1525,6 +1553,22 @@ var QRPlaceholderIcon = (props) => /* @__PURE__ */ jsxs6("svg", { ...props, xmln
|
|
|
1525
1553
|
] });
|
|
1526
1554
|
var QRPlaceholderIcon_default = QRPlaceholderIcon;
|
|
1527
1555
|
|
|
1556
|
+
// ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
1557
|
+
function r(e) {
|
|
1558
|
+
var t, f, n = "";
|
|
1559
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
1560
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
1561
|
+
var o = e.length;
|
|
1562
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
1563
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
1564
|
+
return n;
|
|
1565
|
+
}
|
|
1566
|
+
function clsx() {
|
|
1567
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
1568
|
+
return n;
|
|
1569
|
+
}
|
|
1570
|
+
var clsx_default = clsx;
|
|
1571
|
+
|
|
1528
1572
|
// src/components/IDKitWidget/States/WorldID/QRState.tsx
|
|
1529
1573
|
import { Fragment, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1530
1574
|
var QRState = ({ qrData, showQR, setShowQR }) => {
|
|
@@ -1536,7 +1580,7 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
|
|
|
1536
1580
|
setTimeout(() => setCopiedLink(false), 2e3);
|
|
1537
1581
|
}, [qrData]);
|
|
1538
1582
|
return /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
1539
|
-
/* @__PURE__ */ jsxs7("div", { className: "mb-10 space-y-4
|
|
1583
|
+
/* @__PURE__ */ jsxs7("div", { className: clsx_default("md:hidden", { "mb-10 space-y-4": !showQR }), children: [
|
|
1540
1584
|
/* @__PURE__ */ jsxs7(
|
|
1541
1585
|
motion.a,
|
|
1542
1586
|
{
|
|
@@ -1545,12 +1589,13 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
|
|
|
1545
1589
|
whileHover: { scale: 1.05 },
|
|
1546
1590
|
transition: { layout: { duration: 0.15 } },
|
|
1547
1591
|
layoutId: media == "desktop" ? void 0 : "worldid-button",
|
|
1548
|
-
className:
|
|
1549
|
-
"flex w-full space-x-2
|
|
1550
|
-
"bg-0d151d dark:bg-white
|
|
1592
|
+
className: clsx_default(
|
|
1593
|
+
"flex w-full items-center space-x-2 rounded-2xl border border-transparent p-4 font-medium shadow-sm",
|
|
1594
|
+
"bg-0d151d text-white dark:bg-white dark:text-0d151d",
|
|
1595
|
+
{ hidden: showQR }
|
|
1551
1596
|
),
|
|
1552
1597
|
children: [
|
|
1553
|
-
/* @__PURE__ */ jsx11(WorldcoinIcon_default, { className: "
|
|
1598
|
+
/* @__PURE__ */ jsx11(WorldcoinIcon_default, { className: "size-5" }),
|
|
1554
1599
|
/* @__PURE__ */ jsx11(
|
|
1555
1600
|
motion.span,
|
|
1556
1601
|
{
|
|
@@ -1563,8 +1608,8 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
|
|
|
1563
1608
|
]
|
|
1564
1609
|
}
|
|
1565
1610
|
),
|
|
1566
|
-
/* @__PURE__ */ jsxs7("div", { className: "space-y-4", children: [
|
|
1567
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex items-center space-x-4 ", children: [
|
|
1611
|
+
/* @__PURE__ */ jsxs7("div", { className: clsx_default("mb-3", { "space-y-4": !showQR }), children: [
|
|
1612
|
+
/* @__PURE__ */ jsxs7("div", { className: clsx_default("flex items-center space-x-4 ", { hidden: showQR }), children: [
|
|
1568
1613
|
/* @__PURE__ */ jsx11("hr", { className: "flex-1" }),
|
|
1569
1614
|
/* @__PURE__ */ jsx11("span", { className: "text-xs font-medium text-9ba3ae", children: "or" }),
|
|
1570
1615
|
/* @__PURE__ */ jsx11("hr", { className: "flex-1" })
|
|
@@ -1620,7 +1665,7 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
|
|
|
1620
1665
|
/* @__PURE__ */ jsx11("div", { className: "relative inline-flex items-center justify-center rounded-2xl border border-f1f5f8 p-2 dark:border-f1f5f8/10", children: /* @__PURE__ */ jsx11("div", { className: "text-29343f dark:text-white", children: qrData ? (
|
|
1621
1666
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
1622
1667
|
/* @__PURE__ */ jsx11("div", { onClick: copyLink, className: "cursor-pointer", children: /* @__PURE__ */ jsx11(QRCode_default, { data: qrData, size: 244 }) })
|
|
1623
|
-
) : /* @__PURE__ */ jsx11("div", { className: "flex
|
|
1668
|
+
) : /* @__PURE__ */ jsx11("div", { className: "flex size-[244px] items-center justify-center", children: /* @__PURE__ */ jsx11(QRPlaceholderIcon_default, { className: "size-[244px] animate-pulse" }) }) }) })
|
|
1624
1669
|
] })
|
|
1625
1670
|
] });
|
|
1626
1671
|
};
|
|
@@ -1649,8 +1694,7 @@ var useWorldBridge = (app_id, action, signal, bridge_url, verification_level, ac
|
|
|
1649
1694
|
}
|
|
1650
1695
|
}, [app_id, action, signal, action_description, createClient, ref_verification_level, bridge_url, connectorURI]);
|
|
1651
1696
|
useEffect3(() => {
|
|
1652
|
-
if (!connectorURI || result || errorCode)
|
|
1653
|
-
return;
|
|
1697
|
+
if (!connectorURI || result || errorCode) return;
|
|
1654
1698
|
const interval = setInterval(() => void pollForUpdates(), 3e3);
|
|
1655
1699
|
return () => clearInterval(interval);
|
|
1656
1700
|
}, [connectorURI, pollForUpdates, errorCode, result]);
|
|
@@ -1734,7 +1778,7 @@ var WorldIDState = () => {
|
|
|
1734
1778
|
return handleVerify(result);
|
|
1735
1779
|
}
|
|
1736
1780
|
}, [result, handleVerify, verificationState, setStage, errorCode, setErrorState, verification_level]);
|
|
1737
|
-
return /* @__PURE__ */ jsxs9("div", { className: "-mt-6 space-y-10", children: [
|
|
1781
|
+
return /* @__PURE__ */ jsxs9("div", { className: clsx_default("-mt-6 space-y-5", { "space-y-10": !showQR }), children: [
|
|
1738
1782
|
/* @__PURE__ */ jsxs9("div", { children: [
|
|
1739
1783
|
/* @__PURE__ */ jsx13("div", { className: "mb-4 flex items-center justify-center", children: /* @__PURE__ */ jsx13(WorldcoinIcon_default, { className: "h-10 text-0d151d dark:text-white" }) }),
|
|
1740
1784
|
/* @__PURE__ */ jsx13("p", { className: "text-center font-sora text-2xl font-semibold text-gray-900 dark:text-white", children: __("Verify with World ID") }),
|
|
@@ -1742,7 +1786,7 @@ var WorldIDState = () => {
|
|
|
1742
1786
|
] }),
|
|
1743
1787
|
/* @__PURE__ */ jsxs9("div", { className: "relative", children: [
|
|
1744
1788
|
verificationState == VerificationState.WaitingForApp && /* @__PURE__ */ jsxs9("div", { className: "absolute inset-0 flex flex-col items-center justify-center space-y-6", children: [
|
|
1745
|
-
/* @__PURE__ */ jsx13(LoadingIcon_default, { className: "
|
|
1789
|
+
/* @__PURE__ */ jsx13(LoadingIcon_default, { className: "size-6" }),
|
|
1746
1790
|
/* @__PURE__ */ jsxs9("div", { children: [
|
|
1747
1791
|
/* @__PURE__ */ jsx13("p", { className: "font-bold text-657080", children: "Verifying" }),
|
|
1748
1792
|
/* @__PURE__ */ jsx13("p", { className: "text-sm text-657080", children: "Please continue in app" })
|
|
@@ -1840,7 +1884,7 @@ var IDKitWidget = ({ children, ...config }) => {
|
|
|
1840
1884
|
className: "relative z-50 flex min-h-screen w-full flex-col bg-white pt-6 shadow focus:outline-none focus-visible:ring focus-visible:ring-purple-500/75 dark:bg-0d151d md:min-h-[35rem] md:max-w-md md:rounded-2xl",
|
|
1841
1885
|
children: /* @__PURE__ */ jsxs11(Toast.Provider, { children: [
|
|
1842
1886
|
/* @__PURE__ */ jsx15(Toast.Viewport, { className: "flex justify-center" }),
|
|
1843
|
-
/* @__PURE__ */ jsx15("div", { className: "mx-6 mb-12 flex items-center justify-between", children: /* @__PURE__ */ jsx15(Dialog.Close, { className: "flex items-center justify-center rounded-full dark:text-white", children: /* @__PURE__ */ jsx15(XMarkIcon_default, { className: "
|
|
1887
|
+
/* @__PURE__ */ jsx15("div", { className: "mx-6 mb-12 flex items-center justify-between", children: /* @__PURE__ */ jsx15(Dialog.Close, { className: "flex items-center justify-center rounded-full dark:text-white", children: /* @__PURE__ */ jsx15(XMarkIcon_default, { className: "size-5" }) }) }),
|
|
1844
1888
|
/* @__PURE__ */ jsx15("div", { className: "relative mx-6 mb-6 flex flex-1 flex-col items-center justify-center", children: /* @__PURE__ */ jsx15(StageContent, {}) }),
|
|
1845
1889
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between border-t border-f5f5f7 p-7 md:rounded-b-2xl", children: [
|
|
1846
1890
|
/* @__PURE__ */ jsxs11(
|
package/build/internal.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import * as zustand_traditional from 'zustand/traditional';
|
|
3
|
-
import * as
|
|
4
|
-
import { I as IDKITStage, a as ConfigSource, b as CallbackFn, C as Config } from './config-
|
|
3
|
+
import * as zustand_vanilla from 'zustand/vanilla';
|
|
4
|
+
import { I as IDKITStage, a as ConfigSource, b as CallbackFn, C as Config } from './config-Cp9MWjvm.js';
|
|
5
5
|
import { IDKitConfig, ISuccessResult, IErrorState } from '@worldcoin/idkit-core';
|
|
6
6
|
|
|
7
7
|
type CleanWord<T> = T extends `${string}${' ' | ',' | '!' | '?' | '.' | '`'}${string}` ? never : T extends '' ? never : T;
|
|
@@ -47,6 +47,6 @@ type IDKitStore = {
|
|
|
47
47
|
addSuccessCallback: (cb: CallbackFn<ISuccessResult>, source: ConfigSource) => void;
|
|
48
48
|
addVerificationCallback: (cb: CallbackFn<ISuccessResult>, source: ConfigSource) => void;
|
|
49
49
|
};
|
|
50
|
-
declare const useIDKitStore: zustand_traditional.UseBoundStoreWithEqualityFn<
|
|
50
|
+
declare const useIDKitStore: zustand_traditional.UseBoundStoreWithEqualityFn<zustand_vanilla.StoreApi<IDKitStore>>;
|
|
51
51
|
|
|
52
52
|
export { ConfigSource, _default as QRCode, __, useIDKitStore };
|
package/build/internal.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@worldcoin/idkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"homepage": "https://docs.worldcoin.org/id/idkit",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -53,41 +53,42 @@
|
|
|
53
53
|
"react-dom": ">18.0.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@radix-ui/react-dialog": "^1.
|
|
57
|
-
"@radix-ui/react-toast": "^1.1
|
|
58
|
-
"@tailwindcss/forms": "^0.5.
|
|
56
|
+
"@radix-ui/react-dialog": "^1.1.1",
|
|
57
|
+
"@radix-ui/react-toast": "^1.2.1",
|
|
58
|
+
"@tailwindcss/forms": "^0.5.7",
|
|
59
59
|
"copy-to-clipboard": "^3.3.3",
|
|
60
|
-
"framer-motion": "^
|
|
61
|
-
"qrcode": "^1.5.
|
|
60
|
+
"framer-motion": "^11.2.14",
|
|
61
|
+
"qrcode": "^1.5.3",
|
|
62
62
|
"react-shadow": "^19.1.0",
|
|
63
|
-
"zustand": "^4.5",
|
|
64
|
-
"@worldcoin/idkit-core": "1.
|
|
63
|
+
"zustand": "^4.5.4",
|
|
64
|
+
"@worldcoin/idkit-core": "1.3.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/node": "18.11.9",
|
|
68
|
-
"@types/qrcode": "^1.5.
|
|
68
|
+
"@types/qrcode": "^1.5.5",
|
|
69
69
|
"@types/react": "18.0.25",
|
|
70
70
|
"@types/react-dom": "18.0.9",
|
|
71
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
72
|
-
"@typescript-eslint/parser": "^6.
|
|
73
|
-
"autoprefixer": "^10.4.
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
72
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
73
|
+
"autoprefixer": "^10.4.19",
|
|
74
|
+
"clsx": "^2.1.1",
|
|
74
75
|
"eslint": "8.54.0",
|
|
75
|
-
"eslint-config-prettier": "^8.
|
|
76
|
-
"eslint-plugin-compat": "^4.
|
|
76
|
+
"eslint-config-prettier": "^8.10.0",
|
|
77
|
+
"eslint-plugin-compat": "^4.2.0",
|
|
77
78
|
"eslint-plugin-import": "2.26.0",
|
|
78
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
79
|
+
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
79
80
|
"eslint-plugin-prettier": "^4.2.1",
|
|
80
|
-
"eslint-plugin-react": "^7.
|
|
81
|
-
"eslint-plugin-react-hooks": "^4.6.
|
|
82
|
-
"eslint-plugin-tailwindcss": "^3.
|
|
83
|
-
"postcss": "^8.4.
|
|
84
|
-
"prettier": "^
|
|
81
|
+
"eslint-plugin-react": "^7.34.3",
|
|
82
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
83
|
+
"eslint-plugin-tailwindcss": "^3.17.4",
|
|
84
|
+
"postcss": "^8.4.39",
|
|
85
|
+
"prettier": "^3.3.2",
|
|
85
86
|
"prettier-plugin-sort-imports-desc": "^1.0.0",
|
|
86
87
|
"react": "18.2.0",
|
|
87
88
|
"react-dom": "18.2.0",
|
|
88
|
-
"tailwindcss": "^3.
|
|
89
|
-
"tsup": "^
|
|
90
|
-
"typescript": "^5.3
|
|
89
|
+
"tailwindcss": "^3.4.4",
|
|
90
|
+
"tsup": "^8.1.0",
|
|
91
|
+
"typescript": "^5.5.3"
|
|
91
92
|
},
|
|
92
93
|
"scripts": {
|
|
93
94
|
"dev": "tsup --watch",
|