@worldcoin/idkit 1.2.0 → 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.
@@ -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
- get().addErrorCallback(onError, source);
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
- rows.push([key]);
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
- return;
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-19dfed99.js';
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-YVDL3YIJ.js";
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
- addSuccessCallback(onSuccess, "hook" /* HOOK */);
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.3.3 | MIT License | https://tailwindcss.com */
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, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */
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 family by default.
141
- 2. Correct the odd \`em\` font sizing in all browsers.
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-size: 1em; /* 2 */
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;
@@ -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, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
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, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
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
- :is(.dark .dark\\:border-f1f5f8\\/10){
1088
+ .dark\\:border-f1f5f8\\/10:is(.dark *){
1054
1089
  border-color: rgb(241 245 248 / 0.1);
1055
1090
  }
1056
- :is(.dark .dark\\:bg-0d151d){
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 .dark\\:bg-white){
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 .dark\\:text-0d151d){
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 .dark\\:text-9eafc0){
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 .dark\\:text-white){
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
  }
@@ -1649,8 +1684,7 @@ var useWorldBridge = (app_id, action, signal, bridge_url, verification_level, ac
1649
1684
  }
1650
1685
  }, [app_id, action, signal, action_description, createClient, ref_verification_level, bridge_url, connectorURI]);
1651
1686
  useEffect3(() => {
1652
- if (!connectorURI || result || errorCode)
1653
- return;
1687
+ if (!connectorURI || result || errorCode) return;
1654
1688
  const interval = setInterval(() => void pollForUpdates(), 3e3);
1655
1689
  return () => clearInterval(interval);
1656
1690
  }, [connectorURI, pollForUpdates, errorCode, result]);
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import * as zustand_traditional from 'zustand/traditional';
3
- import * as zustand from 'zustand';
4
- import { I as IDKITStage, a as ConfigSource, b as CallbackFn, C as Config } from './config-19dfed99.js';
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<zustand.StoreApi<IDKitStore>>;
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
@@ -3,7 +3,7 @@ import {
3
3
  QRCode_default,
4
4
  __,
5
5
  idkit_default
6
- } from "./chunk-YVDL3YIJ.js";
6
+ } from "./chunk-OPIVJQZ6.js";
7
7
  export {
8
8
  ConfigSource,
9
9
  QRCode_default as QRCode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worldcoin/idkit",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "homepage": "https://docs.worldcoin.org/id/idkit",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -53,41 +53,41 @@
53
53
  "react-dom": ">18.0.0"
54
54
  },
55
55
  "dependencies": {
56
- "@radix-ui/react-dialog": "^1.0.3",
57
- "@radix-ui/react-toast": "^1.1.3",
58
- "@tailwindcss/forms": "^0.5.3",
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": "^7.6.7",
61
- "qrcode": "^1.5.1",
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.2.0"
63
+ "zustand": "^4.5.4",
64
+ "@worldcoin/idkit-core": "1.2.2"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@types/node": "18.11.9",
68
- "@types/qrcode": "^1.5.0",
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.13.1",
72
- "@typescript-eslint/parser": "^6.13.1",
73
- "autoprefixer": "^10.4.13",
71
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
72
+ "@typescript-eslint/parser": "^6.21.0",
73
+ "autoprefixer": "^10.4.19",
74
74
  "eslint": "8.54.0",
75
- "eslint-config-prettier": "^8.5.0",
76
- "eslint-plugin-compat": "^4.1.1",
75
+ "eslint-config-prettier": "^8.10.0",
76
+ "eslint-plugin-compat": "^4.2.0",
77
77
  "eslint-plugin-import": "2.26.0",
78
- "eslint-plugin-jsx-a11y": "^6.6.1",
78
+ "eslint-plugin-jsx-a11y": "^6.9.0",
79
79
  "eslint-plugin-prettier": "^4.2.1",
80
- "eslint-plugin-react": "^7.31.11",
81
- "eslint-plugin-react-hooks": "^4.6.0",
82
- "eslint-plugin-tailwindcss": "^3.7.1",
83
- "postcss": "^8.4.31",
84
- "prettier": "^2.7.1",
80
+ "eslint-plugin-react": "^7.34.3",
81
+ "eslint-plugin-react-hooks": "^4.6.2",
82
+ "eslint-plugin-tailwindcss": "^3.17.4",
83
+ "postcss": "^8.4.39",
84
+ "prettier": "^3.3.2",
85
85
  "prettier-plugin-sort-imports-desc": "^1.0.0",
86
86
  "react": "18.2.0",
87
87
  "react-dom": "18.2.0",
88
- "tailwindcss": "^3.2.4",
89
- "tsup": "^7.2.0",
90
- "typescript": "^5.3.2"
88
+ "tailwindcss": "^3.4.4",
89
+ "tsup": "^8.1.0",
90
+ "typescript": "^5.5.3"
91
91
  },
92
92
  "scripts": {
93
93
  "dev": "tsup --watch",