@opexa/portal-components 0.0.495 → 0.0.496
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
3
|
import Sumsub from '@sumsub/websdk-react';
|
|
3
4
|
import { isObject } from 'lodash-es';
|
|
@@ -18,7 +19,10 @@ export async function KYCSumsub(props) {
|
|
|
18
19
|
const { mutate, mutateAsync, reset, isPending, isIdle } = useGenerateSumsubVerificationTokenMutation();
|
|
19
20
|
const [token, setToken] = useState('');
|
|
20
21
|
useEffect(() => {
|
|
21
|
-
if (
|
|
22
|
+
if (session?.status === 'authenticated' &&
|
|
23
|
+
open === true &&
|
|
24
|
+
isIdle &&
|
|
25
|
+
!token) {
|
|
22
26
|
mutate(undefined, {
|
|
23
27
|
onSuccess(token) {
|
|
24
28
|
setToken(token);
|
|
@@ -31,13 +35,14 @@ export async function KYCSumsub(props) {
|
|
|
31
35
|
token,
|
|
32
36
|
isIdle,
|
|
33
37
|
mutate,
|
|
38
|
+
session?.status,
|
|
34
39
|
]);
|
|
35
40
|
return (_jsxs(_Fragment, { children: [_jsx(Dialog.Root, { open: open && session?.status === 'authenticated', onOpenChange: (details) => {
|
|
36
41
|
setOpen(details.open);
|
|
37
|
-
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
|
|
42
|
+
}, lazyMount: true, unmountOnExit: true, closeOnEscape: false, initialFocusEl: undefined, closeOnInteractOutside: false, onExitComplete: () => {
|
|
38
43
|
reset();
|
|
39
44
|
setToken('');
|
|
40
|
-
}, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { className: "flex items-center justify-center lg:block", children: _jsx(Dialog.Content, {
|
|
45
|
+
}, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { className: "flex items-center justify-center lg:block", children: _jsx(Dialog.Content, { className: "mx-auto flex h-full w-[calc(100%-2rem)] flex-col items-center justify-center overflow-y-auto rounded-md bg-transparent p-0 lg:mt-3 lg:block lg:h-auto lg:w-[600px]", children: isPending ? (_jsx("div", { className: "w-full rounded-md bg-[#20252c] px-4 py-12", children: _jsx(Spinner02Icon, { className: "mx-auto size-8" }) })) : (_jsx("div", { className: "max-h-[calc(96dvh-2rem)] w-full overflow-y-auto lg:h-auto lg:max-h-[unset]", children: _jsx(Sumsub, { accessToken: token, expirationHandler: async () => {
|
|
41
46
|
const token = await mutateAsync();
|
|
42
47
|
return token;
|
|
43
48
|
}, config: {
|