@worldcoin/minikit-js 1.8.0 → 1.9.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.
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ type MiniKitProps = {
5
+ appId: string;
6
+ };
7
+ declare const MiniKitProvider: ({ children, props, }: {
8
+ children: ReactNode;
9
+ props?: MiniKitProps;
10
+ }) => react_jsx_runtime.JSX.Element;
11
+ declare const useMiniKit: () => {
12
+ isInstalled: boolean;
13
+ };
14
+
15
+ export { MiniKitProvider, useMiniKit };
@@ -0,0 +1,15 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ type MiniKitProps = {
5
+ appId: string;
6
+ };
7
+ declare const MiniKitProvider: ({ children, props, }: {
8
+ children: ReactNode;
9
+ props?: MiniKitProps;
10
+ }) => react_jsx_runtime.JSX.Element;
11
+ declare const useMiniKit: () => {
12
+ isInstalled: boolean;
13
+ };
14
+
15
+ export { MiniKitProvider, useMiniKit };
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import {
3
+ MiniKit
4
+ } from "./chunk-7FYGA6HX.js";
5
+
6
+ // minikit-provider.tsx
7
+ import {
8
+ createContext,
9
+ useContext,
10
+ useEffect,
11
+ useState
12
+ } from "react";
13
+ import { jsx } from "react/jsx-runtime";
14
+ var MiniKitContext = createContext({
15
+ isInstalled: false
16
+ });
17
+ var MiniKitProvider = ({
18
+ children,
19
+ props
20
+ }) => {
21
+ const [isInstalled, setIsInstalled] = useState(false);
22
+ useEffect(() => {
23
+ MiniKit.install(props?.appId);
24
+ MiniKit.commandsAsync.getPermissions().then(({ commandPayload: _, finalPayload }) => {
25
+ if (finalPayload.status === "success") {
26
+ MiniKit.user.permissions = {
27
+ notifications: finalPayload.permissions.notifications,
28
+ contacts: finalPayload.permissions.contacts
29
+ };
30
+ }
31
+ });
32
+ setIsInstalled(true);
33
+ }, [props?.appId]);
34
+ return /* @__PURE__ */ jsx(MiniKitContext.Provider, { value: { isInstalled }, children });
35
+ };
36
+ var useMiniKit = () => {
37
+ const context = useContext(MiniKitContext);
38
+ if (context === void 0) {
39
+ throw new Error("useMiniKit must be used within a MiniKitProvider");
40
+ }
41
+ return context;
42
+ };
43
+ export {
44
+ MiniKitProvider,
45
+ useMiniKit
46
+ };
package/index.ts CHANGED
@@ -4,6 +4,7 @@ export * from './types/commands';
4
4
  export * from './types/errors';
5
5
  export * from './types/payment';
6
6
  export * from './types/responses';
7
+ export * from './types/user';
7
8
  export * from './types/wallet-auth';
8
9
 
9
10
  export { tokenToDecimals } from 'helpers/payment/client';
@@ -14,10 +15,6 @@ export {
14
15
  type IVerifyResponse,
15
16
  } from '@worldcoin/idkit-core/backend';
16
17
 
17
- export {
18
- SAFE_CONTRACT_ABI,
19
- parseSiweMessage,
20
- verifySiweMessage,
21
- } from 'helpers/siwe/siwe';
18
+ export { parseSiweMessage, verifySiweMessage } from 'helpers/siwe/siwe';
22
19
 
23
20
  export { getIsUserVerified } from 'helpers/address-book';
package/package.json CHANGED
@@ -7,11 +7,13 @@
7
7
  "devDependencies": {
8
8
  "@types/jest": "^29.5.14",
9
9
  "@types/node": "^20",
10
+ "@types/react": "^17.0.0",
10
11
  "@typescript-eslint/eslint-plugin": "^7.7.0",
11
12
  "@typescript-eslint/parser": "^7.7.0",
12
13
  "jest": "^29.7.0",
13
14
  "prettier": "^3.2.5",
14
15
  "prettier-plugin-sort-imports-desc": "^1.0.0",
16
+ "react": "^17.0.0",
15
17
  "ts-jest": "^29.2.5",
16
18
  "ts-node": "^10.9.2",
17
19
  "tsup": "^8.0.2",
@@ -31,6 +33,16 @@
31
33
  "types": "./build/index.d.cts",
32
34
  "default": "./build/index.cjs"
33
35
  }
36
+ },
37
+ "./minikit-provider": {
38
+ "import": {
39
+ "types": "./build/minikit-provider.d.ts",
40
+ "default": "./build/minikit-provider.js"
41
+ },
42
+ "require": {
43
+ "types": "./build/minikit-provider.d.cts",
44
+ "default": "./build/minikit-provider.cjs"
45
+ }
34
46
  }
35
47
  },
36
48
  "files": [
@@ -46,6 +58,7 @@
46
58
  "main": "index.ts",
47
59
  "name": "@worldcoin/minikit-js",
48
60
  "peerDependencies": {
61
+ "react": "^17 || ^18 || ^19",
49
62
  "viem": "^2.23.5"
50
63
  },
51
64
  "private": false,
@@ -59,7 +72,7 @@
59
72
  ]
60
73
  }
61
74
  },
62
- "version": "1.8.0",
75
+ "version": "1.9.1",
63
76
  "scripts": {
64
77
  "build": "tsup",
65
78
  "dev": "tsup --watch",