@worldcoin/idkit 1.0.0-alpha.5 → 1.0.0-alpha.7

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.
@@ -23,9 +23,9 @@ import { shallow } from "zustand/shallow";
23
23
  import { createWithEqualityFn } from "zustand/traditional";
24
24
  import {
25
25
  AppErrorCodes,
26
- CredentialType,
27
- DEFAULT_CREDENTIAL_TYPES
26
+ DEFAULT_VERIFICATION_LEVEL
28
27
  } from "@worldcoin/idkit-core";
28
+ var SELF_HOSTED_APP_ID = "self_hosted";
29
29
  var useIDKitStore = createWithEqualityFn()(
30
30
  (set, get) => ({
31
31
  app_id: "",
@@ -33,7 +33,7 @@ var useIDKitStore = createWithEqualityFn()(
33
33
  action: "",
34
34
  action_description: "",
35
35
  bridge_url: "",
36
- credential_types: DEFAULT_CREDENTIAL_TYPES,
36
+ verification_level: DEFAULT_VERIFICATION_LEVEL,
37
37
  open: false,
38
38
  result: null,
39
39
  theme: "light",
@@ -82,22 +82,22 @@ var useIDKitStore = createWithEqualityFn()(
82
82
  action,
83
83
  app_id,
84
84
  onError,
85
- credential_types,
85
+ verification_level,
86
86
  action_description,
87
87
  bridge_url,
88
88
  autoClose,
89
- theme
89
+ theme,
90
+ advanced
90
91
  }, source) => {
91
- const sanitizedCredentialTypes = credential_types?.filter((type) => Object.values(CredentialType).includes(type)) ?? [];
92
92
  set({
93
93
  theme,
94
94
  signal,
95
95
  action,
96
- app_id,
97
96
  autoClose,
98
97
  bridge_url,
99
- credential_types: sanitizedCredentialTypes.length ? sanitizedCredentialTypes : DEFAULT_CREDENTIAL_TYPES,
100
- action_description
98
+ action_description,
99
+ app_id: advanced?.self_hosted ? SELF_HOSTED_APP_ID : app_id,
100
+ verification_level: verification_level ?? DEFAULT_VERIFICATION_LEVEL
101
101
  });
102
102
  get().addSuccessCallback(onSuccess, source);
103
103
  if (onError)
@@ -233,7 +233,7 @@ var Qrcode = ({ data, size = 300 }) => {
233
233
  });
234
234
  return dots2;
235
235
  }, [size, data]);
236
- return /* @__PURE__ */ jsx("svg", { height: size, width: size, children: dots });
236
+ return /* @__PURE__ */ jsx("svg", { height: size, width: size, "data-test-id": "qr-code", children: dots });
237
237
  };
238
238
  var QRCode_default = memo(Qrcode);
239
239
 
@@ -26,7 +26,15 @@ type WidgetConfig = {
26
26
  /** Function to trigger when verification is not successful. Should receive a single parameter of type `IErrorState` which contains the error details. */
27
27
  onError?: CallbackFn<IErrorState>;
28
28
  };
29
- type Config = IDKitConfig & Required<Pick<IDKitConfig, 'action'>> & WidgetConfig;
29
+ type Config = Required<Pick<IDKitConfig, 'action'>> & WidgetConfig & ((Exclude<IDKitConfig, 'app_id'> & {
30
+ advanced: {
31
+ self_hosted: true;
32
+ };
33
+ }) | (IDKitConfig & {
34
+ advanced?: {
35
+ self_hosted?: false;
36
+ };
37
+ }));
30
38
  type WidgetProps = Config & {
31
39
  children?: ({ open }: {
32
40
  open: () => void;
package/build/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { C as Config, W as WidgetProps, a as WidgetConfig } from './config-cd2f02fe.js';
1
+ import { C as Config, W as WidgetProps, a as WidgetConfig } from './config-6a355d3b.js';
2
2
  import { MotionProps } from 'framer-motion';
3
3
  import * as react from 'react';
4
4
  import { FC, ButtonHTMLAttributes } from 'react';
5
- import { IDKitConfig } from '@worldcoin/idkit-core';
6
- export { CredentialType, IErrorState, ISuccessResult } from '@worldcoin/idkit-core';
7
5
  export { solidityEncode } from '@worldcoin/idkit-core/hashing';
6
+ import { IDKitConfig } from '@worldcoin/idkit-core';
7
+ export { CredentialType, IErrorState, ISuccessResult, VerificationLevel } from '@worldcoin/idkit-core';
8
8
 
9
9
  type HookConfig = Partial<Pick<Config, 'handleVerify' | 'onSuccess'>>;
10
10
  declare const useIDKit: ({ handleVerify, onSuccess }?: HookConfig) => {