Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: React component (Temp) #31

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion demo/with-next/app/api/verify-siwe/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
MiniAppWalletAuthSuccessPayload,
verifySiweMessage,
} from "@worldcoin/minikit-js";
} from "../../../../../packages/src/build";
import { NextRequest } from "next/server";
import * as yup from "yup";

Expand Down
2 changes: 1 addition & 1 deletion demo/with-next/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import { MiniKitProvider } from "../components/MiniKitProvider";
import { getServerSession } from "next-auth";
import SessionProvider from "@/components/SessionProvider";
import { MiniKitProvider } from "@worldcoin/minikit-js-react";

const inter = Inter({ subsets: ["latin"] });

Expand Down
2 changes: 1 addition & 1 deletion demo/with-next/components/ClientContent/Pay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ResponseEvent,
Tokens,
tokenToDecimals,
} from "@worldcoin/minikit-js";
} from "../../../../packages/src/build";
import { useCallback, useEffect, useState } from "react";
import { validateSchema } from "./helpers/validate-schema";
import * as yup from "yup";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ResponseEvent,
VerificationErrorCodes,
VerifyCommandInput,
} from "@worldcoin/minikit-js";
} from "../../../../../packages/src/build";
import { useCallback, useEffect, useState } from "react";
import * as yup from "yup";
import { validateSchema } from "../helpers/validate-schema";
Expand Down
2 changes: 1 addition & 1 deletion demo/with-next/components/ClientContent/WalletAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
MiniKit,
ResponseEvent,
WalletAuthErrorCodes,
} from "@worldcoin/minikit-js";
} from "../../../../packages/src/build";
import { useCallback, useEffect, useState } from "react";
import * as yup from "yup";
import { validateSchema } from "./helpers/validate-schema";
Expand Down
1 change: 1 addition & 0 deletions demo/with-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"@worldcoin/idkit-core": "^1.2.0",
"@worldcoin/minikit-js": "workspace:*",
"@worldcoin/minikit-js-react": "workspace:*",
"clsx": "^2.1.1",
"next": "14.2.1",
"next-auth": "^4.24.7",
Expand Down
19 changes: 19 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ packages:
- "demo/*"
- "src"
- "tests"
- "react"
9 changes: 9 additions & 0 deletions react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# minikit-js/react

MiniKit - SDK for Mini Apps in World App.

React package for minikit. This includes the providers to use minikit with a react app.

```
turbo build
```
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"use client";

import { MiniKit } from "@worldcoin/minikit-js";
import { useEffect, ReactNode } from "react";
import { ReactNode, useEffect } from "react";

export const MiniKitProvider = ({ children }: { children: ReactNode }) => {
useEffect(() => {
Expand Down
1 change: 1 addition & 0 deletions react/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { MiniKitProvider } from "./components/MinikitProvider";
43 changes: 43 additions & 0 deletions react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "@worldcoin/minikit-js-react",
"version": "0.0.1",
"description": "Internal Alpha: React components for Minikit",
"main": "index.tsx",
"private": false,
"type": "module",
"exports": {
".": {
"import": "./build/index.js",
"types": "./build/index.d.ts",
"require": "./build/index.cjs"
}
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsup"
},
"engines": {
"node": ">=12.4"
},
"keywords": [
"react",
"minikit"
],
"author": "",
"license": "MIT",
"devDependencies": {
"@worldcoin/minikit-js": "link:../src",
"react": "18.2.0",
"tsup": "^8.0.2"
},
"peerDependencies": {
"@types/react": ">=18.2.0",
"@worldcoin/minikit-js": "*",
"react": ">=18.2.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
}
}
32 changes: 32 additions & 0 deletions react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"compilerOptions": {
"strict": true,
"rootDir": ".",
"outDir": "build",
"declaration": true,
"declarationDir": "build",
"module": "ESNext",
"moduleResolution": "node",
"target": "ES2020",
"lib": ["es6", "dom", "es2016", "es2017", "es2021"],
"sourceMap": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"noImplicitAny": false,
"jsx": "react-jsx",
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}
},
"include": ["."],
"exclude": ["node_modules", "build"],
"watchOptions": {
"watchFile": "useFsEvents",
"watchDirectory": "useFsEvents",
"fallbackPolling": "dynamicPriority",
"synchronousWatchDirectory": true,
"excludeDirectories": ["../node_modules", "build"]
}
}
10 changes: 10 additions & 0 deletions react/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "tsup";

export default defineConfig({
dts: true,
clean: true,
outDir: "build",
format: ["esm", "cjs"],
entry: ["index.ts"],
define: { "process.env.NODE_ENV": '"production"' },
});
4 changes: 0 additions & 4 deletions src/minikit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,5 @@ export class MiniKit {

return walletAuthPayload;
},

closeWebview: () => {
sendWebviewEvent<{ command: string }>({ command: "close" });
},
};
}
Loading