@worldcoin/idkit 1.4.3 → 2.0.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-Cp9MWjvm.d.ts → config-BRFx4nLT.d.ts} +4 -0
- package/build/index.d.ts +1 -1
- package/build/index.js +203 -117
- package/build/internal.d.ts +1 -1
- package/package.json +4 -4
|
@@ -36,6 +36,10 @@ type WidgetProps = Config & {
|
|
|
36
36
|
children?: ({ open }: {
|
|
37
37
|
open: () => void;
|
|
38
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;
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
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-BRFx4nLT.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
|
@@ -23,7 +23,7 @@ var useIDKit = ({ handleVerify, onSuccess } = {}) => {
|
|
|
23
23
|
var useIDKit_default = useIDKit;
|
|
24
24
|
|
|
25
25
|
// src/components/IDKitWidget/index.tsx
|
|
26
|
-
import { memo
|
|
26
|
+
import { memo } from "react";
|
|
27
27
|
|
|
28
28
|
// src/components/IDKitWidget/BaseWidget.tsx
|
|
29
29
|
import root from "react-shadow";
|
|
@@ -31,7 +31,13 @@ import root from "react-shadow";
|
|
|
31
31
|
// src/hooks/useMedia.ts
|
|
32
32
|
import { useEffect as useEffect2, useState } from "react";
|
|
33
33
|
var useMedia = () => {
|
|
34
|
-
const
|
|
34
|
+
const getInitialState = () => {
|
|
35
|
+
if (typeof window !== "undefined") {
|
|
36
|
+
return window.matchMedia("(max-width: 768px)").matches ? "mobile" : "desktop";
|
|
37
|
+
}
|
|
38
|
+
return "desktop";
|
|
39
|
+
};
|
|
40
|
+
const [media, setMedia] = useState(getInitialState());
|
|
35
41
|
useEffect2(() => {
|
|
36
42
|
const mql = window.matchMedia("(max-width: 768px)");
|
|
37
43
|
const handleChange = (mql2) => setMedia(mql2.matches ? "mobile" : "desktop");
|
|
@@ -45,6 +51,9 @@ var useMedia = () => {
|
|
|
45
51
|
};
|
|
46
52
|
var useMedia_default = useMedia;
|
|
47
53
|
|
|
54
|
+
// src/components/IDKitWidget/BaseWidget.tsx
|
|
55
|
+
import { createPortal } from "react-dom";
|
|
56
|
+
|
|
48
57
|
// src/styles/styles.css
|
|
49
58
|
var styles_default = `/* TODO: Use an alternative to avoid the extra request to Google (e.g. hosting ourselves, or local file) */
|
|
50
59
|
@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;600;700&family=Sora:wght@600&display=swap');
|
|
@@ -651,6 +660,39 @@ select{
|
|
|
651
660
|
--tw-contain-paint: ;
|
|
652
661
|
--tw-contain-style: ;
|
|
653
662
|
}
|
|
663
|
+
.container{
|
|
664
|
+
width: 100%;
|
|
665
|
+
}
|
|
666
|
+
@media (min-width: 414px){
|
|
667
|
+
.container{
|
|
668
|
+
max-width: 414px;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
@media (min-width: 640px){
|
|
672
|
+
.container{
|
|
673
|
+
max-width: 640px;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
@media (min-width: 768px){
|
|
677
|
+
.container{
|
|
678
|
+
max-width: 768px;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
@media (min-width: 1024px){
|
|
682
|
+
.container{
|
|
683
|
+
max-width: 1024px;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
@media (min-width: 1280px){
|
|
687
|
+
.container{
|
|
688
|
+
max-width: 1280px;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
@media (min-width: 1536px){
|
|
692
|
+
.container{
|
|
693
|
+
max-width: 1536px;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
654
696
|
.visible{
|
|
655
697
|
visibility: visible;
|
|
656
698
|
}
|
|
@@ -666,12 +708,12 @@ select{
|
|
|
666
708
|
.inset-0{
|
|
667
709
|
inset: 0;
|
|
668
710
|
}
|
|
669
|
-
.z-10{
|
|
670
|
-
z-index: 10;
|
|
671
|
-
}
|
|
672
711
|
.z-50{
|
|
673
712
|
z-index: 50;
|
|
674
713
|
}
|
|
714
|
+
.z-\\[9999\\]{
|
|
715
|
+
z-index: 9999;
|
|
716
|
+
}
|
|
675
717
|
.mx-6{
|
|
676
718
|
margin-left: 24px;
|
|
677
719
|
margin-right: 24px;
|
|
@@ -716,6 +758,9 @@ select{
|
|
|
716
758
|
.mt-4{
|
|
717
759
|
margin-top: 16px;
|
|
718
760
|
}
|
|
761
|
+
.inline{
|
|
762
|
+
display: inline;
|
|
763
|
+
}
|
|
719
764
|
.flex{
|
|
720
765
|
display: flex;
|
|
721
766
|
}
|
|
@@ -725,6 +770,14 @@ select{
|
|
|
725
770
|
.hidden{
|
|
726
771
|
display: none;
|
|
727
772
|
}
|
|
773
|
+
.size-11{
|
|
774
|
+
width: 44px;
|
|
775
|
+
height: 44px;
|
|
776
|
+
}
|
|
777
|
+
.size-24{
|
|
778
|
+
width: 96px;
|
|
779
|
+
height: 96px;
|
|
780
|
+
}
|
|
728
781
|
.size-5{
|
|
729
782
|
width: 20px;
|
|
730
783
|
height: 20px;
|
|
@@ -740,9 +793,6 @@ select{
|
|
|
740
793
|
.h-10{
|
|
741
794
|
height: 40px;
|
|
742
795
|
}
|
|
743
|
-
.h-24{
|
|
744
|
-
height: 96px;
|
|
745
|
-
}
|
|
746
796
|
.min-h-full{
|
|
747
797
|
min-height: 100%;
|
|
748
798
|
}
|
|
@@ -752,9 +802,6 @@ select{
|
|
|
752
802
|
.w-24{
|
|
753
803
|
width: 96px;
|
|
754
804
|
}
|
|
755
|
-
.w-4{
|
|
756
|
-
width: 16px;
|
|
757
|
-
}
|
|
758
805
|
.w-full{
|
|
759
806
|
width: 100%;
|
|
760
807
|
}
|
|
@@ -798,9 +845,6 @@ select{
|
|
|
798
845
|
.justify-between{
|
|
799
846
|
justify-content: space-between;
|
|
800
847
|
}
|
|
801
|
-
.gap-1{
|
|
802
|
-
gap: 4px;
|
|
803
|
-
}
|
|
804
848
|
.space-x-2 > :not([hidden]) ~ :not([hidden]){
|
|
805
849
|
--tw-space-x-reverse: 0;
|
|
806
850
|
margin-right: calc(8px * var(--tw-space-x-reverse));
|
|
@@ -981,6 +1025,10 @@ select{
|
|
|
981
1025
|
--tw-text-opacity: 1;
|
|
982
1026
|
color: rgb(17 24 39 / var(--tw-text-opacity));
|
|
983
1027
|
}
|
|
1028
|
+
.text-red-500{
|
|
1029
|
+
--tw-text-opacity: 1;
|
|
1030
|
+
color: rgb(239 68 68 / var(--tw-text-opacity));
|
|
1031
|
+
}
|
|
984
1032
|
.text-white{
|
|
985
1033
|
--tw-text-opacity: 1;
|
|
986
1034
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
@@ -1156,6 +1204,22 @@ var XMarkIcon = (props) => /* @__PURE__ */ jsx2("svg", { ...props, xmlns: "http:
|
|
|
1156
1204
|
) });
|
|
1157
1205
|
var XMarkIcon_default = XMarkIcon;
|
|
1158
1206
|
|
|
1207
|
+
// ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
1208
|
+
function r(e) {
|
|
1209
|
+
var t, f, n = "";
|
|
1210
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
1211
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
1212
|
+
var o = e.length;
|
|
1213
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
1214
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
1215
|
+
return n;
|
|
1216
|
+
}
|
|
1217
|
+
function clsx() {
|
|
1218
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
1219
|
+
return n;
|
|
1220
|
+
}
|
|
1221
|
+
var clsx_default = clsx;
|
|
1222
|
+
|
|
1159
1223
|
// src/components/Icons/ErrorIcon.tsx
|
|
1160
1224
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
1161
1225
|
var ErrorIcon = (props) => /* @__PURE__ */ jsxs("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 100 100", children: [
|
|
@@ -1316,10 +1380,11 @@ var ERROR_MESSAGES = {
|
|
|
1316
1380
|
[AppErrorCodes.UnexpectedResponse]: __("Unexpected response from your wallet. Please try again."),
|
|
1317
1381
|
[AppErrorCodes.FailedByHostApp]: __("Verification failed by the app. Please contact the app owner for details.")
|
|
1318
1382
|
};
|
|
1319
|
-
var ErrorState = () => {
|
|
1383
|
+
var ErrorState = (props) => {
|
|
1320
1384
|
const { retryFlow, errorState } = idkit_default(getParams);
|
|
1385
|
+
const { show_modal } = props;
|
|
1321
1386
|
return /* @__PURE__ */ jsxs3("div", { className: "space-y-8", children: [
|
|
1322
|
-
/* @__PURE__ */ jsx6("div", { className: "
|
|
1387
|
+
/* @__PURE__ */ jsx6("div", { className: clsx_default("flex items-center justify-center", show_modal ? "-mt-5" : ""), children: errorState?.code == AppErrorCodes.VerificationRejected ? /* @__PURE__ */ jsx6(WarningIcon_default, { className: "w-24" }) : /* @__PURE__ */ jsx6(ErrorIcon_default, { className: "w-24" }) }),
|
|
1323
1388
|
/* @__PURE__ */ jsxs3("div", { children: [
|
|
1324
1389
|
/* @__PURE__ */ jsx6("p", { className: "text-center text-2xl font-semibold text-gray-900 dark:text-white", children: (errorState?.code && ERROR_TITLES[errorState.code]) ?? ERROR_TITLES[AppErrorCodes.GenericError] }),
|
|
1325
1390
|
/* @__PURE__ */ jsx6("p", { className: "mx-auto mt-2 max-w-[224px] text-center text-657080", children: errorState?.message ?? ERROR_MESSAGES[errorState?.code ?? AppErrorCodes.GenericError] })
|
|
@@ -1408,9 +1473,9 @@ var CheckIcon_default = CheckIcon;
|
|
|
1408
1473
|
|
|
1409
1474
|
// src/components/IDKitWidget/States/SuccessState.tsx
|
|
1410
1475
|
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1411
|
-
var SuccessState = () => {
|
|
1476
|
+
var SuccessState = (props) => {
|
|
1412
1477
|
return /* @__PURE__ */ jsxs5("div", { className: "space-y-6", children: [
|
|
1413
|
-
/* @__PURE__ */ jsx8("div", { className: "
|
|
1478
|
+
/* @__PURE__ */ jsx8("div", { className: clsx_default("flex items-center justify-center", props.show_modal ? "-mt-5" : ""), children: /* @__PURE__ */ jsx8(CheckIcon_default, { className: "w-24 text-white" }) }),
|
|
1414
1479
|
/* @__PURE__ */ jsxs5("div", { children: [
|
|
1415
1480
|
/* @__PURE__ */ jsx8("p", { className: "text-center text-2xl font-semibold text-gray-900 dark:text-white", children: __("Successfully verified") }),
|
|
1416
1481
|
/* @__PURE__ */ jsx8("p", { className: "mx-auto mt-2 max-w-[224px] text-center text-lg text-657080", children: __("Your World ID verification was successful") })
|
|
@@ -1419,22 +1484,6 @@ var SuccessState = () => {
|
|
|
1419
1484
|
};
|
|
1420
1485
|
var SuccessState_default = SuccessState;
|
|
1421
1486
|
|
|
1422
|
-
// ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
1423
|
-
function r(e) {
|
|
1424
|
-
var t, f, n = "";
|
|
1425
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
1426
|
-
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
1427
|
-
var o = e.length;
|
|
1428
|
-
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
1429
|
-
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
1430
|
-
return n;
|
|
1431
|
-
}
|
|
1432
|
-
function clsx() {
|
|
1433
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
1434
|
-
return n;
|
|
1435
|
-
}
|
|
1436
|
-
var clsx_default = clsx;
|
|
1437
|
-
|
|
1438
1487
|
// src/components/IDKitWidget/States/WorldID/QRState.tsx
|
|
1439
1488
|
import copy from "copy-to-clipboard";
|
|
1440
1489
|
import { useCallback, useState as useState2 } from "react";
|
|
@@ -1745,7 +1794,8 @@ var getOptions = (store) => ({
|
|
|
1745
1794
|
action_description: store.action_description,
|
|
1746
1795
|
partner: store.partner
|
|
1747
1796
|
});
|
|
1748
|
-
var WorldIDState = () => {
|
|
1797
|
+
var WorldIDState = (props) => {
|
|
1798
|
+
const media = useMedia_default();
|
|
1749
1799
|
const [showQR, setShowQR] = useState3(false);
|
|
1750
1800
|
const {
|
|
1751
1801
|
app_id,
|
|
@@ -1775,10 +1825,8 @@ var WorldIDState = () => {
|
|
|
1775
1825
|
setErrorState({ code: errorCode ?? AppErrorCodes2.GenericError });
|
|
1776
1826
|
}
|
|
1777
1827
|
if (result) {
|
|
1778
|
-
if (verification_level
|
|
1779
|
-
console.error(
|
|
1780
|
-
"Credential type received from wallet does not match configured credential_types. This should only happen when manually selecting disallowed credentials in the Worldcoin Simulator."
|
|
1781
|
-
);
|
|
1828
|
+
if (verification_level === VerificationLevel.Orb && result.verification_level === VerificationLevel.Device) {
|
|
1829
|
+
console.error("Credential type received from wallet does not match configured credential_types.");
|
|
1782
1830
|
setStage("ERROR" /* ERROR */);
|
|
1783
1831
|
setErrorState({ code: AppErrorCodes2.CredentialUnavailable });
|
|
1784
1832
|
return;
|
|
@@ -1786,29 +1834,43 @@ var WorldIDState = () => {
|
|
|
1786
1834
|
return handleVerify(result);
|
|
1787
1835
|
}
|
|
1788
1836
|
}, [result, handleVerify, verificationState, setStage, errorCode, setErrorState, verification_level]);
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
/* @__PURE__ */ jsxs9("div", { children: [
|
|
1799
|
-
/* @__PURE__ */ jsx13("
|
|
1800
|
-
/* @__PURE__ */ jsx13("p", { className: "text-
|
|
1837
|
+
const { show_modal } = props;
|
|
1838
|
+
return /* @__PURE__ */ jsxs9(
|
|
1839
|
+
"div",
|
|
1840
|
+
{
|
|
1841
|
+
className: clsx_default(
|
|
1842
|
+
"flex flex-col items-center text-center",
|
|
1843
|
+
show_modal ? showQR ? "-mt-6 space-y-5 " : "-mt-6 space-y-10 " : ""
|
|
1844
|
+
),
|
|
1845
|
+
children: [
|
|
1846
|
+
/* @__PURE__ */ jsxs9("div", { className: clsx_default(!show_modal ? "hidden" : ""), children: [
|
|
1847
|
+
/* @__PURE__ */ jsx13("div", { className: "mb-4 flex items-center justify-center", children: /* @__PURE__ */ jsx13(WorldcoinIcon_default, { className: "h-10 text-0d151d dark:text-white" }) }),
|
|
1848
|
+
/* @__PURE__ */ jsx13("p", { className: "font-sora text-2xl font-semibold text-gray-900 dark:text-white", children: __("Verify with World ID") }),
|
|
1849
|
+
/* @__PURE__ */ jsx13("p", { className: clsx_default("mt-3 text-657080 dark:text-9eafc0 md:mt-2", { hidden: media === "mobile" }), children: "Please use your World App to scan the QR code" })
|
|
1850
|
+
] }),
|
|
1851
|
+
/* @__PURE__ */ jsxs9("div", { className: "relative w-full", children: [
|
|
1852
|
+
verificationState === VerificationState.WaitingForApp && /* @__PURE__ */ jsxs9("div", { className: "absolute inset-0 flex flex-col items-center justify-center space-y-6", children: [
|
|
1853
|
+
/* @__PURE__ */ jsx13(LoadingIcon_default, { className: "size-6" }),
|
|
1854
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
1855
|
+
/* @__PURE__ */ jsx13("p", { className: "font-bold text-657080", children: "Verifying" }),
|
|
1856
|
+
/* @__PURE__ */ jsx13("p", { className: "text-sm text-657080", children: "Please continue in app" }),
|
|
1857
|
+
/* @__PURE__ */ jsx13("p", { className: clsx_default(show_modal ? "" : "hidden", "mt-2 text-sm font-bold text-red-500"), children: "Don't close this window" })
|
|
1858
|
+
] })
|
|
1859
|
+
] }),
|
|
1860
|
+
/* @__PURE__ */ jsx13(
|
|
1861
|
+
"div",
|
|
1862
|
+
{
|
|
1863
|
+
className: clsx_default(
|
|
1864
|
+
"transition duration-500 ease-in-out",
|
|
1865
|
+
verificationState === VerificationState.WaitingForApp && "opacity-40 blur-lg"
|
|
1866
|
+
),
|
|
1867
|
+
children: /* @__PURE__ */ jsx13("div", { className: "mx-auto", children: /* @__PURE__ */ jsx13(QRState_default, { showQR, setShowQR, qrData: connectorURI }) })
|
|
1868
|
+
}
|
|
1869
|
+
)
|
|
1801
1870
|
] })
|
|
1802
|
-
]
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
{
|
|
1806
|
-
className: verificationState === VerificationState.WaitingForApp ? "opacity-40 blur-lg transition duration-500 ease-in-out" : "transition duration-500 ease-in-out",
|
|
1807
|
-
children: /* @__PURE__ */ jsx13(QRState_default, { showQR, setShowQR, qrData: connectorURI })
|
|
1808
|
-
}
|
|
1809
|
-
)
|
|
1810
|
-
] })
|
|
1811
|
-
] });
|
|
1871
|
+
]
|
|
1872
|
+
}
|
|
1873
|
+
);
|
|
1812
1874
|
};
|
|
1813
1875
|
var WorldIDState_default = WorldIDState;
|
|
1814
1876
|
|
|
@@ -1818,15 +1880,14 @@ import { Fragment as Fragment2, useEffect as useEffect5, useMemo } from "react";
|
|
|
1818
1880
|
import { AnimatePresence as AnimatePresence2, motion as motion2 } from "framer-motion";
|
|
1819
1881
|
|
|
1820
1882
|
// src/components/IDKitWidget/States/HostAppVerificationState.tsx
|
|
1821
|
-
import { memo } from "react";
|
|
1822
1883
|
import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1823
1884
|
var HostAppVerificationState = () => {
|
|
1824
1885
|
return /* @__PURE__ */ jsxs10("div", { className: "space-y-6", children: [
|
|
1825
|
-
/* @__PURE__ */ jsx14("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx14(LoadingIcon_default, { className: "
|
|
1886
|
+
/* @__PURE__ */ jsx14("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx14(LoadingIcon_default, { className: "size-24" }) }),
|
|
1826
1887
|
/* @__PURE__ */ jsx14("div", { className: "mt-4 text-70868f", children: __("Transmitting verification to host app. Please wait...") })
|
|
1827
1888
|
] });
|
|
1828
1889
|
};
|
|
1829
|
-
var HostAppVerificationState_default =
|
|
1890
|
+
var HostAppVerificationState_default = HostAppVerificationState;
|
|
1830
1891
|
|
|
1831
1892
|
// src/components/IDKitWidget/BaseWidget.tsx
|
|
1832
1893
|
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
@@ -1838,7 +1899,13 @@ var getParams2 = ({ open, processing, onOpenChange, stage, setStage, setOptions
|
|
|
1838
1899
|
isOpen: open,
|
|
1839
1900
|
onOpenChange
|
|
1840
1901
|
});
|
|
1841
|
-
var IDKitWidget = ({
|
|
1902
|
+
var IDKitWidget = ({
|
|
1903
|
+
children,
|
|
1904
|
+
show_modal = true,
|
|
1905
|
+
container_id,
|
|
1906
|
+
disable_default_modal_behavior = false,
|
|
1907
|
+
...config
|
|
1908
|
+
}) => {
|
|
1842
1909
|
const media = useMedia_default();
|
|
1843
1910
|
const { isOpen, onOpenChange, stage, setOptions } = idkit_default(getParams2, shallow2);
|
|
1844
1911
|
useEffect5(() => {
|
|
@@ -1850,22 +1917,48 @@ var IDKitWidget = ({ children, ...config }) => {
|
|
|
1850
1917
|
const StageContent = useMemo(() => {
|
|
1851
1918
|
switch (stage) {
|
|
1852
1919
|
case "WORLD_ID" /* WORLD_ID */:
|
|
1853
|
-
return WorldIDState_default;
|
|
1920
|
+
return /* @__PURE__ */ jsx15(WorldIDState_default, { show_modal });
|
|
1854
1921
|
case "SUCCESS" /* SUCCESS */:
|
|
1855
|
-
return SuccessState_default;
|
|
1922
|
+
return /* @__PURE__ */ jsx15(SuccessState_default, {});
|
|
1856
1923
|
case "ERROR" /* ERROR */:
|
|
1857
|
-
return ErrorState_default;
|
|
1924
|
+
return /* @__PURE__ */ jsx15(ErrorState_default, {});
|
|
1858
1925
|
case "HOST_APP_VERIFICATION" /* HOST_APP_VERIFICATION */:
|
|
1859
|
-
return HostAppVerificationState_default;
|
|
1926
|
+
return /* @__PURE__ */ jsx15(HostAppVerificationState_default, {});
|
|
1860
1927
|
default:
|
|
1861
1928
|
throw new Error(__("Invalid IDKitStage :stage.", { stage }));
|
|
1862
1929
|
}
|
|
1863
|
-
}, [stage]);
|
|
1930
|
+
}, [stage, show_modal]);
|
|
1931
|
+
const widgetContent = /* @__PURE__ */ jsxs11(root.div, { mode: "open", id: "idkit-widget", children: [
|
|
1932
|
+
/* @__PURE__ */ jsx15(Styles_default, {}),
|
|
1933
|
+
/* @__PURE__ */ jsxs11(Toast.Provider, { children: [
|
|
1934
|
+
/* @__PURE__ */ jsx15(Toast.Viewport, { className: "flex justify-center" }),
|
|
1935
|
+
/* @__PURE__ */ jsx15(
|
|
1936
|
+
"div",
|
|
1937
|
+
{
|
|
1938
|
+
id: "widget-content-inline",
|
|
1939
|
+
className: "relative flex flex-col bg-white p-4 focus:outline-none dark:bg-0d151d",
|
|
1940
|
+
children: StageContent
|
|
1941
|
+
}
|
|
1942
|
+
)
|
|
1943
|
+
] })
|
|
1944
|
+
] });
|
|
1945
|
+
if (!show_modal && container_id) {
|
|
1946
|
+
const containerElement = document.getElementById(container_id);
|
|
1947
|
+
if (containerElement) {
|
|
1948
|
+
return createPortal(widgetContent, containerElement);
|
|
1949
|
+
}
|
|
1950
|
+
console.warn(`Container element with id "${container_id}" not found. Rendering widget inline.`);
|
|
1951
|
+
}
|
|
1952
|
+
const avoidDefaultDomBehavior = (e) => {
|
|
1953
|
+
if (disable_default_modal_behavior) {
|
|
1954
|
+
e.preventDefault();
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1864
1957
|
return /* @__PURE__ */ jsxs11(Dialog.Root, { open: isOpen, onOpenChange, children: [
|
|
1865
1958
|
children?.({ open: () => onOpenChange(true) }),
|
|
1866
1959
|
/* @__PURE__ */ jsx15(Dialog.Portal, { forceMount: true, children: /* @__PURE__ */ jsx15(Fragment2, { children: /* @__PURE__ */ jsx15(AnimatePresence2, { children: isOpen && /* @__PURE__ */ jsxs11(root.div, { mode: "open", id: "idkit-widget", children: [
|
|
1867
1960
|
/* @__PURE__ */ jsx15(Styles_default, {}),
|
|
1868
|
-
/* @__PURE__ */ jsxs11("div", { id: "modal", className: "fixed z-
|
|
1961
|
+
/* @__PURE__ */ jsxs11("div", { id: "modal", className: "fixed z-[9999] font-sans", children: [
|
|
1869
1962
|
/* @__PURE__ */ jsx15(Dialog.Overlay, { asChild: true, children: /* @__PURE__ */ jsx15(
|
|
1870
1963
|
motion2.div,
|
|
1871
1964
|
{
|
|
@@ -1875,53 +1968,46 @@ var IDKitWidget = ({ children, ...config }) => {
|
|
|
1875
1968
|
className: "fixed inset-0 bg-black/50 backdrop-blur-lg"
|
|
1876
1969
|
}
|
|
1877
1970
|
) }),
|
|
1878
|
-
/* @__PURE__ */ jsx15("div", { className: "fixed inset-0 z-
|
|
1879
|
-
|
|
1971
|
+
/* @__PURE__ */ jsx15("div", { className: "fixed inset-0 z-[9999] overflow-y-hidden md:overflow-y-auto", children: /* @__PURE__ */ jsx15("div", { className: "flex min-h-full items-end justify-center text-center md:items-center md:p-4", children: /* @__PURE__ */ jsx15(
|
|
1972
|
+
Dialog.Content,
|
|
1880
1973
|
{
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
{
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
rel: "noreferrer",
|
|
1917
|
-
className: "text-sm text-9eafc0 hover:underline",
|
|
1918
|
-
children: __("Terms & Privacy")
|
|
1919
|
-
}
|
|
1920
|
-
)
|
|
1921
|
-
] })
|
|
1922
|
-
] })
|
|
1974
|
+
asChild: true,
|
|
1975
|
+
onPointerDownOutside: avoidDefaultDomBehavior,
|
|
1976
|
+
onInteractOutside: avoidDefaultDomBehavior,
|
|
1977
|
+
children: /* @__PURE__ */ jsx15(
|
|
1978
|
+
motion2.div,
|
|
1979
|
+
{
|
|
1980
|
+
layout: media == "mobile" ? "position" : true,
|
|
1981
|
+
exit: media == "mobile" ? "initMob" : "init",
|
|
1982
|
+
initial: media == "mobile" ? "initMob" : "init",
|
|
1983
|
+
animate: media == "mobile" ? "animateMob" : "animate",
|
|
1984
|
+
variants: {
|
|
1985
|
+
init: { opacity: 0, scale: 0.9 },
|
|
1986
|
+
initMob: { translateY: "100%" },
|
|
1987
|
+
animate: { opacity: 1, scale: 1 },
|
|
1988
|
+
animateMob: { translateY: 0 }
|
|
1989
|
+
},
|
|
1990
|
+
transition: { layout: { duration: 0.15 } },
|
|
1991
|
+
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",
|
|
1992
|
+
children: /* @__PURE__ */ jsxs11(Toast.Provider, { children: [
|
|
1993
|
+
/* @__PURE__ */ jsx15(Toast.Viewport, { className: "flex justify-center" }),
|
|
1994
|
+
/* @__PURE__ */ jsx15("div", { className: "mx-6 mb-12 flex items-center justify-between", children: /* @__PURE__ */ jsx15(Dialog.Close, { className: "flex size-11 items-center justify-center rounded-full text-black dark:text-white", children: /* @__PURE__ */ jsx15(XMarkIcon_default, { className: "size-5" }) }) }),
|
|
1995
|
+
/* @__PURE__ */ jsx15("div", { className: "relative mx-6 mb-6 flex flex-1 flex-col items-center justify-center", children: StageContent }),
|
|
1996
|
+
/* @__PURE__ */ jsx15("div", { className: "flex items-center justify-center border-t border-f5f5f7 p-7 md:rounded-b-2xl", children: /* @__PURE__ */ jsx15(
|
|
1997
|
+
"a",
|
|
1998
|
+
{
|
|
1999
|
+
href: "https://developer.worldcoin.org/privacy-statement",
|
|
2000
|
+
target: "_blank",
|
|
2001
|
+
rel: "noreferrer",
|
|
2002
|
+
className: "text-sm text-657080 hover:underline",
|
|
2003
|
+
children: __("Terms & Privacy")
|
|
2004
|
+
}
|
|
2005
|
+
) })
|
|
2006
|
+
] })
|
|
2007
|
+
}
|
|
2008
|
+
)
|
|
1923
2009
|
}
|
|
1924
|
-
) }) })
|
|
2010
|
+
) }) })
|
|
1925
2011
|
] })
|
|
1926
2012
|
] }) }) }) })
|
|
1927
2013
|
] });
|
|
@@ -1929,7 +2015,7 @@ var IDKitWidget = ({ children, ...config }) => {
|
|
|
1929
2015
|
var BaseWidget_default = IDKitWidget;
|
|
1930
2016
|
|
|
1931
2017
|
// src/components/IDKitWidget/index.tsx
|
|
1932
|
-
var IDKitWidget_default =
|
|
2018
|
+
var IDKitWidget_default = memo(BaseWidget_default);
|
|
1933
2019
|
|
|
1934
2020
|
// src/index.ts
|
|
1935
2021
|
import { VerificationLevel as VerificationLevel2 } from "@worldcoin/idkit-core";
|
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
3
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
4
|
-
import { I as IDKITStage, a as ConfigSource, b as CallbackFn, C as Config } from './config-
|
|
4
|
+
import { I as IDKITStage, a as ConfigSource, b as CallbackFn, C as Config } from './config-BRFx4nLT.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;
|
package/package.json
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"copy-to-clipboard": "^3.3.3",
|
|
7
7
|
"framer-motion": "^11.2.14",
|
|
8
8
|
"qrcode": "^1.5.3",
|
|
9
|
-
"react-shadow": "^
|
|
9
|
+
"react-shadow": "^19.1.0",
|
|
10
10
|
"zustand": "^4.5.4",
|
|
11
|
-
"@worldcoin/idkit-core": "1.
|
|
11
|
+
"@worldcoin/idkit-core": "2.0.1-rc.1"
|
|
12
12
|
},
|
|
13
13
|
"description": "The identity SDK. Privacy-preserving identity and proof of personhood with World ID.",
|
|
14
14
|
"devDependencies": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"build",
|
|
56
56
|
"README.md"
|
|
57
57
|
],
|
|
58
|
-
"homepage": "https://docs.
|
|
58
|
+
"homepage": "https://docs.worldcoin.org/id/idkit",
|
|
59
59
|
"keywords": [
|
|
60
60
|
"identity",
|
|
61
61
|
"ID",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
]
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
|
-
"version": "
|
|
95
|
+
"version": "2.0.1",
|
|
96
96
|
"scripts": {
|
|
97
97
|
"build": "npm run build:css && tsup",
|
|
98
98
|
"build:css": "npx tailwindcss -i ./src/styles/styles.css -o ./build/index.css --minify",
|