From 3b10c3f08453ba353784237b47a04a397e6de468 Mon Sep 17 00:00:00 2001 From: Andy Wang <41224501+andy-t-wang@users.noreply.github.com> Date: Thu, 8 Aug 2024 14:31:39 -0700 Subject: [PATCH] adds close to standalone --- packages/standalone/src/index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/standalone/src/index.tsx b/packages/standalone/src/index.tsx index f781aea..603c718 100644 --- a/packages/standalone/src/index.tsx +++ b/packages/standalone/src/index.tsx @@ -54,6 +54,13 @@ const open = () => { }) } +const close = () => { + return new Promise((_, reject) => { + if (!isInitialized) return reject(__('IDKitWidget is not initialized')) + useIDKitStore.setState({ open: false }) + }) +} + /** * Reset internal state. Useful for unit-testing */ @@ -69,6 +76,7 @@ const IDKit = { init, update, open, + close, reset, get isInitialized() { return isInitialized