From bae6d76735be04cd19637f38f3f833ae164c452f Mon Sep 17 00:00:00 2001 From: Andy Wang <41224501+andy-t-wang@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:18:52 -0800 Subject: [PATCH] feat: share contacts command (#104) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * share contacts command (#103) * dev * usernames example * remove username file * links test * update url * add path param * Add Send Haptic Feedback command (#82) * Add Send Haptic Feedback command * add haptics to demo, improve dx * fix: add haptic feedback async handler, simplify payloads * Revert "Add Send Haptic Feedback command (#82)" (#114) This reverts commit 072798abb02165fa8dff19214edf53b360d699bf. --------- Co-authored-by: MichaƂ Struck <98230431+michalstruck@users.noreply.github.com> --- .../ClientContent/ExternalLinks.tsx | 8 +- .../ClientContent/ShareContacts.tsx | 145 ++++++++++++++++++ .../components/ClientContent/index.tsx | 56 +++++++ demo/with-next/next.config.mjs | 6 +- packages/core/minikit.ts | 47 ++++++ packages/core/types/commands.ts | 8 + packages/core/types/errors.ts | 10 ++ packages/core/types/responses.ts | 27 ++++ 8 files changed, 305 insertions(+), 2 deletions(-) create mode 100644 demo/with-next/components/ClientContent/ShareContacts.tsx diff --git a/demo/with-next/components/ClientContent/ExternalLinks.tsx b/demo/with-next/components/ClientContent/ExternalLinks.tsx index 174d4e7..a9ca781 100644 --- a/demo/with-next/components/ClientContent/ExternalLinks.tsx +++ b/demo/with-next/components/ClientContent/ExternalLinks.tsx @@ -11,10 +11,16 @@ export const ExternalLinks = () => { > Valid Associated Domain (Link) + + worldapp:// deep link + + + + + +
+ +
+

Message from "{ResponseEvent.MiniAppShareContacts}"

+ +
+
+            {shareContactsAppPayload ?? JSON.stringify(null)}
+          
+
+ +
+

Response Validation:

+

+ {shareContactsPayloadValidationMessage ?? "No validation"} +

+
+
+ + ); +}; diff --git a/demo/with-next/components/ClientContent/index.tsx b/demo/with-next/components/ClientContent/index.tsx index 52fc79b..2e210c0 100644 --- a/demo/with-next/components/ClientContent/index.tsx +++ b/demo/with-next/components/ClientContent/index.tsx @@ -11,6 +11,13 @@ import { CameraComponent } from "./Camera"; import { SendTransaction } from "./Transaction"; import { SignMessage } from "./SignMessage"; import { SignTypedData } from "./SignTypedMessage"; +import { ShareContacts } from "./ShareContacts"; +import { + GetSearchedUsernameResult, + UsernameSearch, +} from "@worldcoin/minikit-react"; +import { useState } from "react"; +import Image from "next/image"; const VersionsNoSSR = dynamic( () => import("./Versions").then((comp) => comp.Versions), @@ -18,6 +25,14 @@ const VersionsNoSSR = dynamic( ); export const ClientContent = () => { + const [searchValue, setSearchValue] = useState(""); + const [searchResults, setSearchResults] = + useState(); + + const handleChange = (e: React.ChangeEvent) => { + setSearchValue(e.target.value); + }; + return (