@worldcoin/idkit 1.2.2 → 1.4.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.
|
@@ -156,11 +156,14 @@ import { jsx } from "react/jsx-runtime";
|
|
|
156
156
|
var generateMatrix = (data) => {
|
|
157
157
|
const arr = QRCodeUtil.create(data, { errorCorrectionLevel: "M" }).modules.data;
|
|
158
158
|
const sqrt = Math.sqrt(arr.length);
|
|
159
|
-
return arr.reduce(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
159
|
+
return arr.reduce(
|
|
160
|
+
(rows, key, index) => {
|
|
161
|
+
if (index % sqrt === 0) rows.push([key]);
|
|
162
|
+
else rows[rows.length - 1].push(key);
|
|
163
|
+
return rows;
|
|
164
|
+
},
|
|
165
|
+
[]
|
|
166
|
+
);
|
|
164
167
|
};
|
|
165
168
|
var Qrcode = ({ data, size = 300 }) => {
|
|
166
169
|
const dots = useMemo(() => {
|
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-YN64HCS2.js";
|
|
6
6
|
|
|
7
7
|
// src/hooks/useIDKit.ts
|
|
8
8
|
import { useEffect } from "react";
|
|
@@ -692,6 +692,9 @@ select{
|
|
|
692
692
|
.mb-12{
|
|
693
693
|
margin-bottom: 48px;
|
|
694
694
|
}
|
|
695
|
+
.mb-3{
|
|
696
|
+
margin-bottom: 12px;
|
|
697
|
+
}
|
|
695
698
|
.mb-4{
|
|
696
699
|
margin-bottom: 16px;
|
|
697
700
|
}
|
|
@@ -722,6 +725,18 @@ select{
|
|
|
722
725
|
.hidden{
|
|
723
726
|
display: none;
|
|
724
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
|
+
}
|
|
725
740
|
.h-10{
|
|
726
741
|
height: 40px;
|
|
727
742
|
}
|
|
@@ -731,12 +746,6 @@ select{
|
|
|
731
746
|
.h-5{
|
|
732
747
|
height: 20px;
|
|
733
748
|
}
|
|
734
|
-
.h-6{
|
|
735
|
-
height: 24px;
|
|
736
|
-
}
|
|
737
|
-
.h-\\[244px\\]{
|
|
738
|
-
height: 244px;
|
|
739
|
-
}
|
|
740
749
|
.min-h-full{
|
|
741
750
|
min-height: 100%;
|
|
742
751
|
}
|
|
@@ -752,12 +761,6 @@ select{
|
|
|
752
761
|
.w-5{
|
|
753
762
|
width: 20px;
|
|
754
763
|
}
|
|
755
|
-
.w-6{
|
|
756
|
-
width: 24px;
|
|
757
|
-
}
|
|
758
|
-
.w-\\[244px\\]{
|
|
759
|
-
width: 244px;
|
|
760
|
-
}
|
|
761
764
|
.w-full{
|
|
762
765
|
width: 100%;
|
|
763
766
|
}
|
|
@@ -824,6 +827,11 @@ select{
|
|
|
824
827
|
margin-top: calc(16px * calc(1 - var(--tw-space-y-reverse)));
|
|
825
828
|
margin-bottom: calc(16px * var(--tw-space-y-reverse));
|
|
826
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
|
+
}
|
|
827
835
|
.space-y-6 > :not([hidden]) ~ :not([hidden]){
|
|
828
836
|
--tw-space-y-reverse: 0;
|
|
829
837
|
margin-top: calc(24px * calc(1 - var(--tw-space-y-reverse)));
|
|
@@ -894,10 +902,6 @@ select{
|
|
|
894
902
|
padding-left: 8px;
|
|
895
903
|
padding-right: 8px;
|
|
896
904
|
}
|
|
897
|
-
.px-4{
|
|
898
|
-
padding-left: 16px;
|
|
899
|
-
padding-right: 16px;
|
|
900
|
-
}
|
|
901
905
|
.px-8{
|
|
902
906
|
padding-left: 32px;
|
|
903
907
|
padding-right: 32px;
|
|
@@ -910,10 +914,6 @@ select{
|
|
|
910
914
|
padding-top: 12px;
|
|
911
915
|
padding-bottom: 12px;
|
|
912
916
|
}
|
|
913
|
-
.py-4{
|
|
914
|
-
padding-top: 16px;
|
|
915
|
-
padding-bottom: 16px;
|
|
916
|
-
}
|
|
917
917
|
.pt-6{
|
|
918
918
|
padding-top: 24px;
|
|
919
919
|
}
|
|
@@ -1425,15 +1425,24 @@ var SuccessState = () => {
|
|
|
1425
1425
|
};
|
|
1426
1426
|
var SuccessState_default = SuccessState;
|
|
1427
1427
|
|
|
1428
|
-
//
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1428
|
+
// ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
1429
|
+
function r(e) {
|
|
1430
|
+
var t, f, n = "";
|
|
1431
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
1432
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
1433
|
+
var o = e.length;
|
|
1434
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
1435
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
1436
|
+
return n;
|
|
1437
|
+
}
|
|
1438
|
+
function clsx() {
|
|
1439
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
1440
|
+
return n;
|
|
1441
|
+
}
|
|
1442
|
+
var clsx_default = clsx;
|
|
1435
1443
|
|
|
1436
1444
|
// src/components/IDKitWidget/States/WorldID/QRState.tsx
|
|
1445
|
+
import copy from "copy-to-clipboard";
|
|
1437
1446
|
import { useCallback, useState as useState2 } from "react";
|
|
1438
1447
|
import { AnimatePresence, motion } from "framer-motion";
|
|
1439
1448
|
|
|
@@ -1571,7 +1580,7 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
|
|
|
1571
1580
|
setTimeout(() => setCopiedLink(false), 2e3);
|
|
1572
1581
|
}, [qrData]);
|
|
1573
1582
|
return /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
1574
|
-
/* @__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: [
|
|
1575
1584
|
/* @__PURE__ */ jsxs7(
|
|
1576
1585
|
motion.a,
|
|
1577
1586
|
{
|
|
@@ -1580,12 +1589,13 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
|
|
|
1580
1589
|
whileHover: { scale: 1.05 },
|
|
1581
1590
|
transition: { layout: { duration: 0.15 } },
|
|
1582
1591
|
layoutId: media == "desktop" ? void 0 : "worldid-button",
|
|
1583
|
-
className:
|
|
1584
|
-
"flex w-full space-x-2
|
|
1585
|
-
"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 }
|
|
1586
1596
|
),
|
|
1587
1597
|
children: [
|
|
1588
|
-
/* @__PURE__ */ jsx11(WorldcoinIcon_default, { className: "
|
|
1598
|
+
/* @__PURE__ */ jsx11(WorldcoinIcon_default, { className: "size-5" }),
|
|
1589
1599
|
/* @__PURE__ */ jsx11(
|
|
1590
1600
|
motion.span,
|
|
1591
1601
|
{
|
|
@@ -1598,8 +1608,8 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
|
|
|
1598
1608
|
]
|
|
1599
1609
|
}
|
|
1600
1610
|
),
|
|
1601
|
-
/* @__PURE__ */ jsxs7("div", { className: "space-y-4", children: [
|
|
1602
|
-
/* @__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: [
|
|
1603
1613
|
/* @__PURE__ */ jsx11("hr", { className: "flex-1" }),
|
|
1604
1614
|
/* @__PURE__ */ jsx11("span", { className: "text-xs font-medium text-9ba3ae", children: "or" }),
|
|
1605
1615
|
/* @__PURE__ */ jsx11("hr", { className: "flex-1" })
|
|
@@ -1655,7 +1665,7 @@ var QRState = ({ qrData, showQR, setShowQR }) => {
|
|
|
1655
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 ? (
|
|
1656
1666
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
1657
1667
|
/* @__PURE__ */ jsx11("div", { onClick: copyLink, className: "cursor-pointer", children: /* @__PURE__ */ jsx11(QRCode_default, { data: qrData, size: 244 }) })
|
|
1658
|
-
) : /* @__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" }) }) }) })
|
|
1659
1669
|
] })
|
|
1660
1670
|
] });
|
|
1661
1671
|
};
|
|
@@ -1768,7 +1778,7 @@ var WorldIDState = () => {
|
|
|
1768
1778
|
return handleVerify(result);
|
|
1769
1779
|
}
|
|
1770
1780
|
}, [result, handleVerify, verificationState, setStage, errorCode, setErrorState, verification_level]);
|
|
1771
|
-
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: [
|
|
1772
1782
|
/* @__PURE__ */ jsxs9("div", { children: [
|
|
1773
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" }) }),
|
|
1774
1784
|
/* @__PURE__ */ jsx13("p", { className: "text-center font-sora text-2xl font-semibold text-gray-900 dark:text-white", children: __("Verify with World ID") }),
|
|
@@ -1776,7 +1786,7 @@ var WorldIDState = () => {
|
|
|
1776
1786
|
] }),
|
|
1777
1787
|
/* @__PURE__ */ jsxs9("div", { className: "relative", children: [
|
|
1778
1788
|
verificationState == VerificationState.WaitingForApp && /* @__PURE__ */ jsxs9("div", { className: "absolute inset-0 flex flex-col items-center justify-center space-y-6", children: [
|
|
1779
|
-
/* @__PURE__ */ jsx13(LoadingIcon_default, { className: "
|
|
1789
|
+
/* @__PURE__ */ jsx13(LoadingIcon_default, { className: "size-6" }),
|
|
1780
1790
|
/* @__PURE__ */ jsxs9("div", { children: [
|
|
1781
1791
|
/* @__PURE__ */ jsx13("p", { className: "font-bold text-657080", children: "Verifying" }),
|
|
1782
1792
|
/* @__PURE__ */ jsx13("p", { className: "text-sm text-657080", children: "Please continue in app" })
|
|
@@ -1874,7 +1884,7 @@ var IDKitWidget = ({ children, ...config }) => {
|
|
|
1874
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",
|
|
1875
1885
|
children: /* @__PURE__ */ jsxs11(Toast.Provider, { children: [
|
|
1876
1886
|
/* @__PURE__ */ jsx15(Toast.Viewport, { className: "flex justify-center" }),
|
|
1877
|
-
/* @__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 text-black dark:text-white", children: /* @__PURE__ */ jsx15(XMarkIcon_default, { className: "size-5" }) }) }),
|
|
1878
1888
|
/* @__PURE__ */ jsx15("div", { className: "relative mx-6 mb-6 flex flex-1 flex-col items-center justify-center", children: /* @__PURE__ */ jsx15(StageContent, {}) }),
|
|
1879
1889
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between border-t border-f5f5f7 p-7 md:rounded-b-2xl", children: [
|
|
1880
1890
|
/* @__PURE__ */ jsxs11(
|
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.4.0",
|
|
4
4
|
"homepage": "https://docs.worldcoin.org/id/idkit",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"qrcode": "^1.5.3",
|
|
62
62
|
"react-shadow": "^19.1.0",
|
|
63
63
|
"zustand": "^4.5.4",
|
|
64
|
-
"@worldcoin/idkit-core": "1.
|
|
64
|
+
"@worldcoin/idkit-core": "1.4.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/node": "18.11.9",
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
72
72
|
"@typescript-eslint/parser": "^6.21.0",
|
|
73
73
|
"autoprefixer": "^10.4.19",
|
|
74
|
+
"clsx": "^2.1.1",
|
|
74
75
|
"eslint": "8.54.0",
|
|
75
76
|
"eslint-config-prettier": "^8.10.0",
|
|
76
77
|
"eslint-plugin-compat": "^4.2.0",
|