import { AuthContext } from "@/authContext"; import { GlobalContext } from "@/globalContext"; import MkdSDK from "@/utils/MkdSDK"; import { Dialog, Transition } from "@headlessui/react"; import React, { Fragment, useContext, useEffect, useState } from "react"; import { useLocation, useNavigate } from "react-router"; import { Link } from "react-router-dom"; import { useTour } from "@reactour/tour"; export default function CustomerGettingStartedTour() { const navigate = useNavigate(); const { dispatch: globalDispatch, state: globalState } = useContext(GlobalContext); const { dispatch } = useContext(AuthContext); const [modalOpen, setModalOpen] = useState(true); const [gettingStarted, setGettingStarted] = useState(); const { pathname } = useLocation(); const sdk = new MkdSDK(); const { setIsOpen } = useTour() async function markAsNotFirstTimeUser() { try { await sdk.callRawAPI("/v2/api/custom/ergo/edit-self", { profile: { getting_started: 1 } }, "POST"); globalDispatch({ type: "SET_USER_DATA", payload: { ...globalState.user, getting_started: 1, }, }); } catch (err) { tokenExpireError(dispatch, err.message); console.log("err", err); } } if (!globalState.user.id) return null; const fetchUser = async () => { const result = await sdk.callRawAPI("/rest/profile/GETALL", { "payload": { "user_id": Number(globalState.user.id) }, "selectStr": "*" }, "POST"); setGettingStarted(result.list[0]?.getting_started) } fetchUser() return ( <> setModalOpen(false)} >
First time login?

Would you like a tour of the site?

); }