diff --git a/.npmrc b/.npmrc index 4343c8ca..90ed8716 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ -shared-workspace-lockfile=false \ No newline at end of file +shared-workspace-lockfile=false +package-manager-strict=false \ No newline at end of file diff --git a/apps/web/.eslintrc b/apps/web/.eslintrc index e562b59a..38fc69f2 100644 --- a/apps/web/.eslintrc +++ b/apps/web/.eslintrc @@ -4,7 +4,8 @@ "react/no-unescaped-entities": "off", "@next/next/no-page-custom-font": "off", "@next/next/no-img-element": "off", - "unused-imports/no-unused-imports": "warn" + "unused-imports/no-unused-imports": "warn", + "no-console": "warn" }, "plugins": ["unused-imports"] } diff --git a/apps/web/app/editor/course/[courseid]/activity/[activityuuid]/edit/page.tsx b/apps/web/app/editor/course/[courseid]/activity/[activityuuid]/edit/page.tsx index b8e36ade..72183f3a 100644 --- a/apps/web/app/editor/course/[courseid]/activity/[activityuuid]/edit/page.tsx +++ b/apps/web/app/editor/course/[courseid]/activity/[activityuuid]/edit/page.tsx @@ -52,17 +52,17 @@ const EditActivity = async (params: any) => { const org = await getOrganizationContextInfoWithId(courseInfo.org_id, { revalidate: 180, tags: ['organizations'], - }) + }, access_token) return ( - + ) diff --git a/apps/web/app/organizations/new/page.tsx b/apps/web/app/organizations/new/page.tsx deleted file mode 100644 index 800bc838..00000000 --- a/apps/web/app/organizations/new/page.tsx +++ /dev/null @@ -1,58 +0,0 @@ -'use client' -import React from 'react' -import { createNewOrganization } from '../../../services/organizations/orgs' - -const Organizations = () => { - const [name, setName] = React.useState('') - const [description, setDescription] = React.useState('') - const [email, setEmail] = React.useState('') - const [slug, setSlug] = React.useState('') - - const handleNameChange = (e: any) => { - setName(e.target.value) - } - - const handleDescriptionChange = (e: any) => { - setDescription(e.target.value) - } - - const handleEmailChange = (e: any) => { - setEmail(e.target.value) - } - - const handleSlugChange = (e: any) => { - setSlug(e.target.value) - } - - const handleSubmit = async (e: any) => { - e.preventDefault() - - let logo = '' - const status = await createNewOrganization({ - name, - description, - email, - logo, - slug, - default: false, - }) - alert(JSON.stringify(status)) - } - - return ( -
-
New Organization
- Name: -
- Description: -
- Slug: -
- Email Address: -
- -
- ) -} - -export default Organizations diff --git a/apps/web/app/organizations/page.tsx b/apps/web/app/organizations/page.tsx deleted file mode 100644 index ae2b9e18..00000000 --- a/apps/web/app/organizations/page.tsx +++ /dev/null @@ -1,65 +0,0 @@ -'use client' //todo: use server components -import Link from 'next/link' -import React from 'react' -import { deleteOrganizationFromBackend } from '@services/organizations/orgs' -import useSWR, { mutate } from 'swr' -import { swrFetcher } from '@services/utils/ts/requests' -import { getAPIUrl, getUriWithOrg } from '@services/config/config' - -const Organizations = () => { - const { data: organizations, error } = useSWR( - `${getAPIUrl()}orgs/user/page/1/limit/10`, - swrFetcher - ) - - async function deleteOrganization(org_id: any) { - const response = await deleteOrganizationFromBackend(org_id) - response && - mutate( - `${getAPIUrl()}orgs/user/page/1/limit/10`, - organizations.filter((org: any) => org.org_id !== org_id) - ) - } - - return ( - <> -
- Your Organizations{' '} - - - -
-
- - {error &&

Failed to load

} - {!organizations ? ( -

Loading...

- ) : ( -
- {organizations.map((org: any) => ( -
- -

- {org.name} -

- - -
- ))} -
- )} - - ) -} - -export default Organizations diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/collection/[collectionid]/page.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/collection/[collectionid]/page.tsx index f2182c38..523ca9bd 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/collection/[collectionid]/page.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/collection/[collectionid]/page.tsx @@ -6,7 +6,6 @@ import { getOrganizationContextInfo } from '@services/organizations/orgs' import { nextAuthOptions } from 'app/auth/options' import { Metadata } from 'next' import { getServerSession } from 'next-auth' -import { cookies } from 'next/headers' import Link from 'next/link' type MetadataProps = { diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/collections/page.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/collections/page.tsx index 50f02a06..9ff96216 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/collections/page.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/collections/page.tsx @@ -4,9 +4,7 @@ import GeneralWrapperStyled from '@components/StyledElements/Wrappers/GeneralWra import { getUriWithOrg } from '@services/config/config' import { getOrganizationContextInfo } from '@services/organizations/orgs' import { Metadata } from 'next' -import { cookies } from 'next/headers' import Link from 'next/link' -import { getAccessTokenFromRefreshTokenCookie } from '@services/auth/auth' import CollectionThumbnail from '@components/Objects/Thumbnails/CollectionThumbnail' import NewCollectionButton from '@components/StyledElements/Buttons/NewCollectionButton' import ContentPlaceHolderIfUserIsNotAdmin from '@components/ContentPlaceHolder' diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/activity.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/activity.tsx index aa2641eb..9bc369cd 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/activity.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/activity.tsx @@ -147,8 +147,7 @@ export function MarkStatus(props: { orgslug: string }) { const router = useRouter() - const session = useLHSession() - console.log(props.course.trail) + const session = useLHSession() as any; async function markActivityAsCompleteFront() { const trail = await markActivityAsComplete( @@ -171,8 +170,6 @@ export function MarkStatus(props: { } } - console.log('isActivityCompleted', isActivityCompleted()) - return ( <> {isActivityCompleted() ? ( diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/page.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/page.tsx index b834eae6..9f4b0935 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/page.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/activity/[activityid]/page.tsx @@ -1,10 +1,8 @@ import { getActivityWithAuthHeader } from '@services/courses/activities' import { getCourseMetadata } from '@services/courses/courses' -import { cookies } from 'next/headers' import ActivityClient from './activity' import { getOrganizationContextInfo } from '@services/organizations/orgs' import { Metadata } from 'next' -import { getAccessTokenFromRefreshTokenCookie } from '@services/auth/auth' import { getServerSession } from 'next-auth' import { nextAuthOptions } from 'app/auth/options' diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/course.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/course.tsx index d7c48e59..26a23c5c 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/course.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/course.tsx @@ -22,7 +22,7 @@ import { useLHSession } from '@components/Contexts/LHSessionContext' const CourseClient = (props: any) => { const [user, setUser] = useState({}) const [learnings, setLearnings] = useState([]) - const session = useLHSession() + const session = useLHSession() as any; const courseuuid = props.courseuuid const orgslug = props.orgslug const course = props.course diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/page.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/page.tsx index ae96404e..ca4180d6 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/page.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/page.tsx @@ -1,10 +1,8 @@ import React from 'react' import CourseClient from './course' -import { cookies } from 'next/headers' import { getCourseMetadata } from '@services/courses/courses' import { getOrganizationContextInfo } from '@services/organizations/orgs' import { Metadata } from 'next' -import { getAccessTokenFromRefreshTokenCookie } from '@services/auth/auth' import { getCourseThumbnailMediaDirectory } from '@services/media/media' import { nextAuthOptions } from 'app/auth/options' import { getServerSession } from 'next-auth' diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/courses/page.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/courses/page.tsx index 6f15306d..a339cd02 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/courses/page.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/courses/page.tsx @@ -2,8 +2,6 @@ import React from 'react' import Courses from './courses' import { Metadata } from 'next' import { getOrganizationContextInfo } from '@services/organizations/orgs' -import { cookies } from 'next/headers' -import { getAccessTokenFromRefreshTokenCookie } from '@services/auth/auth' import { nextAuthOptions } from 'app/auth/options' import { getServerSession } from 'next-auth' import { getOrgCourses } from '@services/courses/courses' diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/trail/page.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/trail/page.tsx index 2a327ddd..637156d7 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/trail/page.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/trail/page.tsx @@ -2,6 +2,8 @@ import React from 'react' import { Metadata } from 'next' import { getOrganizationContextInfo } from '@services/organizations/orgs' import Trail from './trail' +import { getServerSession } from 'next-auth' +import { nextAuthOptions } from 'app/auth/options' type MetadataProps = { params: { orgslug: string } @@ -11,11 +13,13 @@ type MetadataProps = { export async function generateMetadata({ params, }: MetadataProps): Promise { + const session = await getServerSession(nextAuthOptions) + const access_token = session?.tokens?.access_token // Get Org context information const org = await getOrganizationContextInfo(params.orgslug, { revalidate: 1800, tags: ['organizations'], - }) + }, access_token) return { title: 'Trail — ' + org.name, description: diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/trail/trail.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/trail/trail.tsx index 8cbfcf93..b562c0d2 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/trail/trail.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/trail/trail.tsx @@ -1,4 +1,5 @@ 'use client' +import { useLHSession } from '@components/Contexts/LHSessionContext' import { useOrg } from '@components/Contexts/OrgContext' import PageLoading from '@components/Objects/Loaders/PageLoading' import TrailCourseElement from '@components/Pages/Trail/TrailCourseElement' @@ -11,14 +12,16 @@ import useSWR from 'swr' function Trail(params: any) { let orgslug = params.orgslug + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const org = useOrg() as any const orgID = org?.id const { data: trail, error: error } = useSWR( `${getAPIUrl()}trail/org/${orgID}/trail`, - swrFetcher + (url) => swrFetcher(url, access_token) ) - useEffect(() => {}, [trail, org]) + useEffect(() => { }, [trail, org]) return ( diff --git a/apps/web/app/orgs/[orgslug]/dash/courses/course/[courseuuid]/[subpage]/page.tsx b/apps/web/app/orgs/[orgslug]/dash/courses/course/[courseuuid]/[subpage]/page.tsx index b4cab9d6..9de28441 100644 --- a/apps/web/app/orgs/[orgslug]/dash/courses/course/[courseuuid]/[subpage]/page.tsx +++ b/apps/web/app/orgs/[orgslug]/dash/courses/course/[courseuuid]/[subpage]/page.tsx @@ -7,7 +7,7 @@ import Link from 'next/link' import { CourseOverviewTop } from '@components/Dashboard/UI/CourseOverviewTop' import { motion } from 'framer-motion' import EditCourseGeneral from '@components/Dashboard/Course/EditCourseGeneral/EditCourseGeneral' -import { GalleryVerticalEnd, Info, Lock, UserRoundCog } from 'lucide-react' +import { GalleryVerticalEnd, Info, UserRoundCog } from 'lucide-react' import EditCourseAccess from '@components/Dashboard/Course/EditCourseAccess/EditCourseAccess' export type CourseOverviewParams = { diff --git a/apps/web/app/orgs/[orgslug]/dash/layout.tsx b/apps/web/app/orgs/[orgslug]/dash/layout.tsx index 443480c7..9277cd03 100644 --- a/apps/web/app/orgs/[orgslug]/dash/layout.tsx +++ b/apps/web/app/orgs/[orgslug]/dash/layout.tsx @@ -1,8 +1,4 @@ -import LeftMenu from '@components/Dashboard/UI/LeftMenu' -import AdminAuthorization from '@components/Security/AdminAuthorization' -import ClientComponentSkeleton from '@components/Utils/ClientComp' import { Metadata } from 'next' -import { SessionProvider } from 'next-auth/react' import React from 'react' import ClientAdminLayout from './ClientAdminLayout' diff --git a/apps/web/app/orgs/[orgslug]/layout.tsx b/apps/web/app/orgs/[orgslug]/layout.tsx index bdef53c9..d722fb9f 100644 --- a/apps/web/app/orgs/[orgslug]/layout.tsx +++ b/apps/web/app/orgs/[orgslug]/layout.tsx @@ -1,5 +1,4 @@ 'use client' -import LHSessionProvider from '@components/Contexts/LHSessionContext' import { OrgProvider } from '@components/Contexts/OrgContext' import Toast from '@components/StyledElements/Toast/Toast' import '@styles/globals.css' diff --git a/apps/web/app/orgs/[orgslug]/login/login.tsx b/apps/web/app/orgs/[orgslug]/login/login.tsx index 2cfebac8..ec533a31 100644 --- a/apps/web/app/orgs/[orgslug]/login/login.tsx +++ b/apps/web/app/orgs/[orgslug]/login/login.tsx @@ -13,7 +13,7 @@ import React from 'react' import { AlertTriangle } from 'lucide-react' import { useRouter } from 'next/navigation' import Link from 'next/link' -import { signIn, useSession } from "next-auth/react" +import { signIn } from "next-auth/react" import { getUriWithOrg } from '@services/config/config' import { useLHSession } from '@components/Contexts/LHSessionContext' @@ -42,7 +42,7 @@ const validate = (values: any) => { const LoginClient = (props: LoginClientProps) => { const [isSubmitting, setIsSubmitting] = React.useState(false) const router = useRouter(); - const session = useLHSession(); + const session = useLHSession() as any; const [error, setError] = React.useState('') const formik = useFormik({ diff --git a/apps/web/app/orgs/[orgslug]/reset/reset.tsx b/apps/web/app/orgs/[orgslug]/reset/reset.tsx index f29d9a36..c275f98f 100644 --- a/apps/web/app/orgs/[orgslug]/reset/reset.tsx +++ b/apps/web/app/orgs/[orgslug]/reset/reset.tsx @@ -15,7 +15,7 @@ import { getUriWithOrg } from '@services/config/config' import { useOrg } from '@components/Contexts/OrgContext' import { useRouter, useSearchParams } from 'next/navigation' import { useFormik } from 'formik' -import { resetPassword, sendResetLink } from '@services/auth/auth' +import { resetPassword } from '@services/auth/auth' const validate = (values: any) => { const errors: any = {} diff --git a/apps/web/app/orgs/[orgslug]/signup/signup.tsx b/apps/web/app/orgs/[orgslug]/signup/signup.tsx index 128b46b6..9eb87d4a 100644 --- a/apps/web/app/orgs/[orgslug]/signup/signup.tsx +++ b/apps/web/app/orgs/[orgslug]/signup/signup.tsx @@ -6,7 +6,7 @@ import Link from 'next/link' import { getUriWithOrg } from '@services/config/config' import { useLHSession } from '@components/Contexts/LHSessionContext' import React, { useEffect } from 'react' -import { MailWarning, Shield, Ticket, UserPlus } from 'lucide-react' +import { MailWarning, Ticket, UserPlus } from 'lucide-react' import { useOrg } from '@components/Contexts/OrgContext' import UserAvatar from '@components/Objects/UserAvatar' import OpenSignUpComponent from './OpenSignup' @@ -33,9 +33,6 @@ function SignUpClient(props: SignUpClientProps) { setJoinMethod( props.org?.config?.config?.GeneralConfig.users.signup_mechanism ) - console.log( - props.org?.config?.config?.GeneralConfig.users.signup_mechanism - ) } if (inviteCodeParam) { setInviteCode(inviteCodeParam) diff --git a/apps/web/components/AI/Hooks/useGetAIFeatures.tsx b/apps/web/components/AI/Hooks/useGetAIFeatures.tsx index 19702019..e7c0afb5 100644 --- a/apps/web/components/AI/Hooks/useGetAIFeatures.tsx +++ b/apps/web/components/AI/Hooks/useGetAIFeatures.tsx @@ -13,17 +13,14 @@ function useGetAIFeatures(props: UseGetAIFeatures) { const config = org?.config?.config?.AIConfig if (!config) { - console.log('AI or Organization config is not defined.') return false } if (!config.enabled) { - console.log('AI is not enabled for this Organization.') return false } if (!config.features[feature]) { - console.log(`Feature ${feature} is not enabled for this Organization.`) return false } diff --git a/apps/web/components/Dashboard/Course/EditCourseAccess/EditCourseAccess.tsx b/apps/web/components/Dashboard/Course/EditCourseAccess/EditCourseAccess.tsx index 1f5eceaf..6cb3ab10 100644 --- a/apps/web/components/Dashboard/Course/EditCourseAccess/EditCourseAccess.tsx +++ b/apps/web/components/Dashboard/Course/EditCourseAccess/EditCourseAccess.tsx @@ -5,7 +5,7 @@ import Modal from '@components/StyledElements/Modal/Modal' import { getAPIUrl } from '@services/config/config' import { unLinkResourcesToUserGroup } from '@services/usergroups/usergroups' import { swrFetcher } from '@services/utils/ts/requests' -import { Globe, SquareUserRound, Users, UsersRound, X } from 'lucide-react' +import { Globe, SquareUserRound, Users, X } from 'lucide-react' import { useLHSession } from '@components/Contexts/LHSessionContext' import React from 'react' import toast from 'react-hot-toast' @@ -122,9 +122,11 @@ function EditCourseAccess(props: EditCourseAccessProps) { function UserGroupsSection({ usergroups }: { usergroups: any[] }) { const course = useCourse() as any const [userGroupModal, setUserGroupModal] = React.useState(false) + const session = useLHSession() as any; + const access_token = session?.data?.tokens?.access_token; const removeUserGroupLink = async (usergroup_id: number) => { - const res = await unLinkResourcesToUserGroup(usergroup_id, course.courseStructure.course_uuid) + const res = await unLinkResourcesToUserGroup(usergroup_id, course.courseStructure.course_uuid,access_token) if (res.status === 200) { toast.success('Successfully unliked from usergroup') mutate(`${getAPIUrl()}usergroups/resource/${course.courseStructure.course_uuid}`) diff --git a/apps/web/components/Dashboard/Course/EditCourseGeneral/EditCourseGeneral.tsx b/apps/web/components/Dashboard/Course/EditCourseGeneral/EditCourseGeneral.tsx index 84129421..1f6d5ddc 100644 --- a/apps/web/components/Dashboard/Course/EditCourseGeneral/EditCourseGeneral.tsx +++ b/apps/web/components/Dashboard/Course/EditCourseGeneral/EditCourseGeneral.tsx @@ -6,7 +6,6 @@ import FormLayout, { } from '@components/StyledElements/Form/Form' import { useFormik } from 'formik' import { AlertTriangle } from 'lucide-react' -import * as Switch from '@radix-ui/react-switch' import * as Form from '@radix-ui/react-form' import React from 'react' import { useCourse, useCourseDispatch } from '../../../Contexts/CourseContext' diff --git a/apps/web/components/Dashboard/Course/EditCourseGeneral/ThumbnailUpdate.tsx b/apps/web/components/Dashboard/Course/EditCourseGeneral/ThumbnailUpdate.tsx index 85c47764..980fd6bb 100644 --- a/apps/web/components/Dashboard/Course/EditCourseGeneral/ThumbnailUpdate.tsx +++ b/apps/web/components/Dashboard/Course/EditCourseGeneral/ThumbnailUpdate.tsx @@ -10,7 +10,7 @@ import { mutate } from 'swr' function ThumbnailUpdate() { const course = useCourse() as any - const session = useLHSession() + const session = useLHSession() as any; const org = useOrg() as any const [localThumbnail, setLocalThumbnail] = React.useState(null) as any const [isLoading, setIsLoading] = React.useState(false) as any diff --git a/apps/web/components/Dashboard/Org/OrgEditGeneral/OrgEditGeneral.tsx b/apps/web/components/Dashboard/Org/OrgEditGeneral/OrgEditGeneral.tsx index 82fa7e5a..118eec41 100644 --- a/apps/web/components/Dashboard/Org/OrgEditGeneral/OrgEditGeneral.tsx +++ b/apps/web/components/Dashboard/Org/OrgEditGeneral/OrgEditGeneral.tsx @@ -9,6 +9,7 @@ import { UploadCloud } from 'lucide-react' import { revalidateTags } from '@services/utils/ts/requests' import { useRouter } from 'next/navigation' import { useOrg } from '@components/Contexts/OrgContext' +import { useLHSession } from '@components/Contexts/LHSessionContext' interface OrganizationValues { name: string @@ -20,7 +21,9 @@ interface OrganizationValues { function OrgEditGeneral(props: any) { const [selectedFile, setSelectedFile] = useState(null) - const router = useRouter() + const router = useRouter(); + const session = useLHSession() as any; + const access_token = session?.data?.tokens?.access_token; const org = useOrg() as any // ... @@ -34,7 +37,7 @@ function OrgEditGeneral(props: any) { const uploadLogo = async () => { if (selectedFile) { let org_id = org.id - await uploadOrganizationLogo(org_id, selectedFile) + await uploadOrganizationLogo(org_id, selectedFile, access_token) setSelectedFile(null) // Reset the selected file await revalidateTags(['organizations'], org.slug) router.refresh() @@ -51,14 +54,14 @@ function OrgEditGeneral(props: any) { const updateOrg = async (values: OrganizationValues) => { let org_id = org.id - await updateOrganization(org_id, values) + await updateOrganization(org_id, values, access_token) // Mutate the org await revalidateTags(['organizations'], org.slug) router.refresh() } - useEffect(() => {}, [org]) + useEffect(() => { }, [org]) return (
diff --git a/apps/web/components/Dashboard/UserAccount/UserEditGeneral/UserEditGeneral.tsx b/apps/web/components/Dashboard/UserAccount/UserEditGeneral/UserEditGeneral.tsx index aa74203a..eb465d22 100644 --- a/apps/web/components/Dashboard/UserAccount/UserEditGeneral/UserEditGeneral.tsx +++ b/apps/web/components/Dashboard/UserAccount/UserEditGeneral/UserEditGeneral.tsx @@ -14,7 +14,8 @@ import UserAvatar from '@components/Objects/UserAvatar' import { updateUserAvatar } from '@services/users/users' function UserEditGeneral() { - const session = useLHSession() as any + const session = useLHSession() as any; + const access_token = session.data.tokens.access_token; const [localAvatar, setLocalAvatar] = React.useState(null) as any const [isLoading, setIsLoading] = React.useState(false) as any const [error, setError] = React.useState() as any @@ -24,7 +25,7 @@ function UserEditGeneral() { const file = event.target.files[0] setLocalAvatar(file) setIsLoading(true) - const res = await updateUserAvatar(session.data.user_uuid, file) + const res = await updateUserAvatar(session.data.user_uuid, file, access_token) // wait for 1 second to show loading animation await new Promise((r) => setTimeout(r, 1500)) if (res.success === false) { @@ -36,7 +37,7 @@ function UserEditGeneral() { } } - useEffect(() => {}, [session, session.data]) + useEffect(() => { }, [session, session.data]) return (
@@ -53,7 +54,7 @@ function UserEditGeneral() { onSubmit={(values, { setSubmitting }) => { setTimeout(() => { setSubmitting(false) - updateProfile(values, session.data.user.id) + updateProfile(values, session.data.user.id, access_token) }, 400) }} > diff --git a/apps/web/components/Dashboard/UserAccount/UserEditPassword/UserEditPassword.tsx b/apps/web/components/Dashboard/UserAccount/UserEditPassword/UserEditPassword.tsx index e57d0302..3f8a80b4 100644 --- a/apps/web/components/Dashboard/UserAccount/UserEditPassword/UserEditPassword.tsx +++ b/apps/web/components/Dashboard/UserAccount/UserEditPassword/UserEditPassword.tsx @@ -5,13 +5,14 @@ import React, { useEffect } from 'react' function UserEditPassword() { const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const updatePasswordUI = async (values: any) => { let user_id = session.data.user.id - await updatePassword(user_id, values) + await updatePassword(user_id, values, access_token) } - useEffect(() => {}, [session]) + useEffect(() => { }, [session]) return (
diff --git a/apps/web/components/Dashboard/Users/OrgAccess/OrgAccess.tsx b/apps/web/components/Dashboard/Users/OrgAccess/OrgAccess.tsx index 82273e35..fd5a86b6 100644 --- a/apps/web/components/Dashboard/Users/OrgAccess/OrgAccess.tsx +++ b/apps/web/components/Dashboard/Users/OrgAccess/OrgAccess.tsx @@ -3,27 +3,28 @@ import PageLoading from '@components/Objects/Loaders/PageLoading' import ConfirmationModal from '@components/StyledElements/ConfirmationModal/ConfirmationModal' import { getAPIUrl, getUriWithOrg } from '@services/config/config' import { swrFetcher } from '@services/utils/ts/requests' -import { Globe, Shield, Ticket, User, UserSquare, Users, X } from 'lucide-react' +import { Globe, Ticket, UserSquare, Users, X } from 'lucide-react' import Link from 'next/link' import React, { useEffect } from 'react' import useSWR, { mutate } from 'swr' import dayjs from 'dayjs' import { changeSignupMechanism, - createInviteCode, deleteInviteCode, } from '@services/organizations/invites' -import Toast from '@components/StyledElements/Toast/Toast' import toast from 'react-hot-toast' import { useRouter } from 'next/navigation' import Modal from '@components/StyledElements/Modal/Modal' import OrgInviteCodeGenerate from '@components/Objects/Modals/Dash/OrgAccess/OrgInviteCodeGenerate' +import { useLHSession } from '@components/Contexts/LHSessionContext' function OrgAccess() { const org = useOrg() as any + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const { data: invites } = useSWR( org ? `${getAPIUrl()}orgs/${org?.id}/invites` : null, - swrFetcher + (url) => swrFetcher(url, access_token) ) const [isLoading, setIsLoading] = React.useState(false) const [joinMethod, setJoinMethod] = React.useState('closed') @@ -40,10 +41,8 @@ function OrgAccess() { } } - - async function deleteInvite(invite: any) { - let res = await deleteInviteCode(org.id, invite.invite_code_uuid) + let res = await deleteInviteCode(org.id, invite.invite_code_uuid, access_token) if (res.status == 200) { mutate(`${getAPIUrl()}orgs/${org.id}/invites`) } else { @@ -52,7 +51,7 @@ function OrgAccess() { } async function changeJoinMethod(method: 'open' | 'inviteOnly') { - let res = await changeSignupMechanism(org.id, method) + let res = await changeSignupMechanism(org.id, method, access_token) if (res.status == 200) { router.refresh() mutate(`${getAPIUrl()}orgs/slug/${org?.slug}`) diff --git a/apps/web/components/Dashboard/Users/OrgUserGroups/OrgUserGroups.tsx b/apps/web/components/Dashboard/Users/OrgUserGroups/OrgUserGroups.tsx index 8a874b95..4d357dd4 100644 --- a/apps/web/components/Dashboard/Users/OrgUserGroups/OrgUserGroups.tsx +++ b/apps/web/components/Dashboard/Users/OrgUserGroups/OrgUserGroups.tsx @@ -1,4 +1,5 @@ 'use client' +import { useLHSession } from '@components/Contexts/LHSessionContext' import { useOrg } from '@components/Contexts/OrgContext' import AddUserGroup from '@components/Objects/Modals/Dash/OrgUserGroups/AddUserGroup' import ManageUsers from '@components/Objects/Modals/Dash/OrgUserGroups/ManageUsers' @@ -14,17 +15,19 @@ import useSWR, { mutate } from 'swr' function OrgUserGroups() { const org = useOrg() as any + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const [userGroupManagementModal, setUserGroupManagementModal] = React.useState(false) const [createUserGroupModal, setCreateUserGroupModal] = React.useState(false) const [selectedUserGroup, setSelectedUserGroup] = React.useState(null) as any const { data: usergroups } = useSWR( org ? `${getAPIUrl()}usergroups/org/${org.id}` : null, - swrFetcher + (url) => swrFetcher(url, access_token) ) const deleteUserGroupUI = async (usergroup_id: any) => { - const res = await deleteUserGroup(usergroup_id) + const res = await deleteUserGroup(usergroup_id, access_token) if (res.status == 200) { mutate(`${getAPIUrl()}usergroups/org/${org.id}`) } diff --git a/apps/web/components/Dashboard/Users/OrgUsers/OrgUsers.tsx b/apps/web/components/Dashboard/Users/OrgUsers/OrgUsers.tsx index 1b394e36..6048816d 100644 --- a/apps/web/components/Dashboard/Users/OrgUsers/OrgUsers.tsx +++ b/apps/web/components/Dashboard/Users/OrgUsers/OrgUsers.tsx @@ -1,3 +1,4 @@ +import { useLHSession } from '@components/Contexts/LHSessionContext' import { useOrg } from '@components/Contexts/OrgContext' import PageLoading from '@components/Objects/Loaders/PageLoading' import RolesUpdate from '@components/Objects/Modals/Dash/OrgUsers/RolesUpdate' @@ -14,9 +15,11 @@ import useSWR, { mutate } from 'swr' function OrgUsers() { const org = useOrg() as any + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const { data: orgUsers } = useSWR( org ? `${getAPIUrl()}orgs/${org?.id}/users` : null, - swrFetcher + (url) => swrFetcher(url, access_token) ) const [rolesModal, setRolesModal] = React.useState(false) const [selectedUser, setSelectedUser] = React.useState(null) as any @@ -28,7 +31,7 @@ function OrgUsers() { } const handleRemoveUser = async (user_id: any) => { - const res = await removeUserFromOrg(org.id, user_id) + const res = await removeUserFromOrg(org.id, user_id,access_token) if (res.status === 200) { await mutate(`${getAPIUrl()}orgs/${org.id}/users`) } else { @@ -39,7 +42,6 @@ function OrgUsers() { useEffect(() => { if (orgUsers) { setIsLoading(false) - console.log(orgUsers) } }, [org, orgUsers]) diff --git a/apps/web/components/Dashboard/Users/OrgUsersAdd/OrgUsersAdd.tsx b/apps/web/components/Dashboard/Users/OrgUsersAdd/OrgUsersAdd.tsx index d0217849..08bac53b 100644 --- a/apps/web/components/Dashboard/Users/OrgUsersAdd/OrgUsersAdd.tsx +++ b/apps/web/components/Dashboard/Users/OrgUsersAdd/OrgUsersAdd.tsx @@ -1,3 +1,4 @@ +import { useLHSession } from '@components/Contexts/LHSessionContext' import { useOrg } from '@components/Contexts/OrgContext' import PageLoading from '@components/Objects/Loaders/PageLoading' import Toast from '@components/StyledElements/Toast/Toast' @@ -5,20 +6,22 @@ import ToolTip from '@components/StyledElements/Tooltip/Tooltip' import { getAPIUrl } from '@services/config/config' import { inviteBatchUsers } from '@services/organizations/invites' import { swrFetcher } from '@services/utils/ts/requests' -import { Info, Shield, UserPlus } from 'lucide-react' +import { Info, UserPlus } from 'lucide-react' import React, { useEffect } from 'react' import toast from 'react-hot-toast' import useSWR, { mutate } from 'swr' function OrgUsersAdd() { const org = useOrg() as any + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const [isLoading, setIsLoading] = React.useState(false) const [invitedUsers, setInvitedUsers] = React.useState(''); const [selectedInviteCode, setSelectedInviteCode] = React.useState(''); async function sendInvites() { setIsLoading(true) - let res = await inviteBatchUsers(org.id, invitedUsers, selectedInviteCode) + let res = await inviteBatchUsers(org.id, invitedUsers, selectedInviteCode,access_token) if (res.status == 200) { mutate(`${getAPIUrl()}orgs/${org?.id}/invites/users`) setIsLoading(false) @@ -31,18 +34,17 @@ function OrgUsersAdd() { const { data: invites } = useSWR( org ? `${getAPIUrl()}orgs/${org?.id}/invites` : null, - swrFetcher + (url) => swrFetcher(url, access_token) ) const { data: invited_users } = useSWR( org ? `${getAPIUrl()}orgs/${org?.id}/invites/users` : null, - swrFetcher + (url) => swrFetcher(url, access_token) ) useEffect(() => { if (invites) { setSelectedInviteCode(invites?.[0]?.invite_code_uuid) } - console.log('dev,',selectedInviteCode) } , [invites, invited_users]) diff --git a/apps/web/components/Objects/Activities/AI/AIActivityAsk.tsx b/apps/web/components/Objects/Activities/AI/AIActivityAsk.tsx index 057cb986..a0a00582 100644 --- a/apps/web/components/Objects/Activities/AI/AIActivityAsk.tsx +++ b/apps/web/components/Objects/Activities/AI/AIActivityAsk.tsx @@ -75,6 +75,7 @@ type ActivityChatMessageBoxProps = { function ActivityChatMessageBox(props: ActivityChatMessageBoxProps) { const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const aiChatBotState = useAIChatBot() as AIChatBotStateTypes const dispatchAIChatBot = useAIChatBotDispatch() as any @@ -115,7 +116,8 @@ function ActivityChatMessageBox(props: ActivityChatMessageBoxProps) { const response = await sendActivityAIChatMessage( message, aiChatBotState.aichat_uuid, - props.activity.activity_uuid + props.activity.activity_uuid, + access_token ) if (response.success == false) { await dispatchAIChatBot({ type: 'setIsNoLongerWaitingForResponse' }) @@ -143,8 +145,9 @@ function ActivityChatMessageBox(props: ActivityChatMessageBoxProps) { }) await dispatchAIChatBot({ type: 'setIsWaitingForResponse' }) const response = await startActivityAIChatSession( - message, + message,access_token, props.activity.activity_uuid + ) if (response.success == false) { await dispatchAIChatBot({ type: 'setIsNoLongerWaitingForResponse' }) @@ -219,14 +222,12 @@ function ActivityChatMessageBox(props: ActivityChatMessageBoxProps) { />
{aiChatBotState.messages.length > 0 && - !aiChatBotState.error.isError ? ( + !aiChatBotState.error.isError ? (
{aiChatBotState.messages.map( (message: AIMessage, index: number) => { diff --git a/apps/web/components/Objects/Activities/DocumentPdf/DocumentPdf.tsx b/apps/web/components/Objects/Activities/DocumentPdf/DocumentPdf.tsx index 2dc84193..0e753369 100644 --- a/apps/web/components/Objects/Activities/DocumentPdf/DocumentPdf.tsx +++ b/apps/web/components/Objects/Activities/DocumentPdf/DocumentPdf.tsx @@ -12,7 +12,6 @@ function DocumentPdfActivity({ const org = useOrg() as any React.useEffect(() => { - console.log(activity) }, [activity, org]) return ( diff --git a/apps/web/components/Objects/Activities/DynamicCanva/AI/AICanvaToolkit.tsx b/apps/web/components/Objects/Activities/DynamicCanva/AI/AICanvaToolkit.tsx index 040041a5..7792e1ee 100644 --- a/apps/web/components/Objects/Activities/DynamicCanva/AI/AICanvaToolkit.tsx +++ b/apps/web/components/Objects/Activities/DynamicCanva/AI/AICanvaToolkit.tsx @@ -15,6 +15,7 @@ import { startActivityAIChatSession, } from '@services/ai/ai' import useGetAIFeatures from '../../../../AI/Hooks/useGetAIFeatures' +import { useLHSession } from '@components/Contexts/LHSessionContext' type AICanvaToolkitProps = { editor: Editor @@ -92,6 +93,8 @@ function AIActionButton(props: { label: string activity: any }) { + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const dispatchAIChatBot = useAIChatBotDispatch() as any const aiChatBotState = useAIChatBot() as AIChatBotStateTypes @@ -132,7 +135,7 @@ function AIActionButton(props: { const response = await sendActivityAIChatMessage( message, aiChatBotState.aichat_uuid, - props.activity.activity_uuid + props.activity.activity_uuid, access_token ) if (response.success == false) { await dispatchAIChatBot({ type: 'setIsNoLongerWaitingForResponse' }) @@ -160,8 +163,7 @@ function AIActionButton(props: { }) await dispatchAIChatBot({ type: 'setIsWaitingForResponse' }) const response = await startActivityAIChatSession( - message, - props.activity.activity_uuid + message, access_token ) if (response.success == false) { await dispatchAIChatBot({ type: 'setIsNoLongerWaitingForResponse' }) @@ -193,10 +195,10 @@ function AIActionButton(props: { props.label === 'Explain' ? 'Explain a word or a sentence with AI' : props.label === 'Summarize' - ? 'Summarize a long paragraph or text with AI' - : props.label === 'Translate' - ? 'Translate to different languages with AI' - : 'Give examples to understand better with AI' + ? 'Summarize a long paragraph or text with AI' + : props.label === 'Translate' + ? 'Translate to different languages with AI' + : 'Give examples to understand better with AI' return (
diff --git a/apps/web/components/Objects/Activities/Video/Video.tsx b/apps/web/components/Objects/Activities/Video/Video.tsx index f2d205d8..e523f43b 100644 --- a/apps/web/components/Objects/Activities/Video/Video.tsx +++ b/apps/web/components/Objects/Activities/Video/Video.tsx @@ -7,22 +7,6 @@ function VideoActivity({ activity, course }: { activity: any; course: any }) { const org = useOrg() as any const [videoId, setVideoId] = React.useState('') - function getYouTubeEmbed(url: any) { - // Extract video ID from the YouTube URL - var videoId = url.match( - /(?:\?v=|\/embed\/|\/\d\/|\/vi\/|\/v\/|https?:\/\/(?:www\.)?youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([^#\&\?\/]+)/ - )[1] - - // Create the embed object - var embedObject = { - videoId: videoId, - width: 560, - height: 315, - } - - return embedObject - } - React.useEffect(() => { if (activity && activity.content && activity.content.uri) { var getYouTubeID = require('get-youtube-id'); diff --git a/apps/web/components/Objects/CourseUpdates/CourseUpdates.tsx b/apps/web/components/Objects/CourseUpdates/CourseUpdates.tsx index 33e96b5b..62085e29 100644 --- a/apps/web/components/Objects/CourseUpdates/CourseUpdates.tsx +++ b/apps/web/components/Objects/CourseUpdates/CourseUpdates.tsx @@ -38,7 +38,6 @@ function CourseUpdates() { // if user clicks outside the model, close the model React.useLayoutEffect(() => { function handleClickOutside(event: any) { - console.log(event.target.id) if (event.target.closest('.bg-white') || event.target.id === 'delete-update-button') return; setIsModelOpen(false); } diff --git a/apps/web/components/Objects/Editor/AI/AIEditorToolkit.tsx b/apps/web/components/Objects/Editor/AI/AIEditorToolkit.tsx index 1807c4ab..fd287fe0 100644 --- a/apps/web/components/Objects/Editor/AI/AIEditorToolkit.tsx +++ b/apps/web/components/Objects/Editor/AI/AIEditorToolkit.tsx @@ -24,6 +24,7 @@ import { startActivityAIChatSession, } from '@services/ai/ai' import useGetAIFeatures from '@components/AI/Hooks/useGetAIFeatures' +import { useLHSession } from '@components/Contexts/LHSessionContext' type AIEditorToolkitProps = { editor: Editor @@ -32,11 +33,11 @@ type AIEditorToolkitProps = { type AIPromptsLabels = { label: - | 'Writer' - | 'ContinueWriting' - | 'MakeLonger' - | 'GenerateQuiz' - | 'Translate' + | 'Writer' + | 'ContinueWriting' + | 'MakeLonger' + | 'GenerateQuiz' + | 'Translate' selection: string } @@ -141,6 +142,8 @@ function AIEditorToolkit(props: AIEditorToolkitProps) { const UserFeedbackModal = (props: AIEditorToolkitProps) => { const dispatchAIEditor = useAIEditorDispatch() as any const aiEditorState = useAIEditor() as AIEditorStateTypes + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const handleChange = async (event: React.ChangeEvent) => { await dispatchAIEditor({ @@ -159,7 +162,7 @@ const UserFeedbackModal = (props: AIEditorToolkitProps) => { const response = await sendActivityAIChatMessage( message, aiEditorState.aichat_uuid, - props.activity.activity_uuid + props.activity.activity_uuid, access_token ) if (response.success === false) { await dispatchAIEditor({ type: 'setIsNoLongerWaitingForResponse' }) @@ -191,7 +194,7 @@ const UserFeedbackModal = (props: AIEditorToolkitProps) => { }) await dispatchAIEditor({ type: 'setIsWaitingForResponse' }) const response = await startActivityAIChatSession( - message, + message, access_token, props.activity.activity_uuid ) if (response.success === false) { diff --git a/apps/web/components/Objects/Editor/Editor.tsx b/apps/web/components/Objects/Editor/Editor.tsx index 1a31c0e4..d66d92d5 100644 --- a/apps/web/components/Objects/Editor/Editor.tsx +++ b/apps/web/components/Objects/Editor/Editor.tsx @@ -44,8 +44,6 @@ import { CourseProvider } from '@components/Contexts/CourseContext' import { useLHSession } from '@components/Contexts/LHSessionContext' import AIEditorToolkit from './AI/AIEditorToolkit' import useGetAIFeatures from '@components/AI/Hooks/useGetAIFeatures' -import UserAvatar from '../UserAvatar' -import randomColor from 'randomcolor' import Collaboration from '@tiptap/extension-collaboration' import CollaborationCursor from '@tiptap/extension-collaboration-cursor' import ActiveAvatars from './ActiveAvatars' diff --git a/apps/web/components/Objects/Editor/EditorWrapper.tsx b/apps/web/components/Objects/Editor/EditorWrapper.tsx index 2e3a8f59..d6502d58 100644 --- a/apps/web/components/Objects/Editor/EditorWrapper.tsx +++ b/apps/web/components/Objects/Editor/EditorWrapper.tsx @@ -25,6 +25,7 @@ interface EditorWrapperProps { function EditorWrapper(props: EditorWrapperProps): JSX.Element { const session = useLHSession() as any + const access_token = session.data.tokens.access_token; // Define provider in the state const [provider, setProvider] = React.useState(null); const [thisPageColor, setThisPageColor] = useState(randomColor({ luminosity: 'light' }) as string) @@ -79,7 +80,7 @@ function EditorWrapper(props: EditorWrapperProps): JSX.Element { } }); - toast.promise(updateActivity(activity, activity.activity_uuid), { + toast.promise(updateActivity(activity, activity.activity_uuid,access_token), { loading: 'Saving...', success: Activity saved!, error: Could not save., diff --git a/apps/web/components/Objects/Editor/Extensions/Image/ImageBlockComponent.tsx b/apps/web/components/Objects/Editor/Extensions/Image/ImageBlockComponent.tsx index 426dcfdb..1f1beca7 100644 --- a/apps/web/components/Objects/Editor/Extensions/Image/ImageBlockComponent.tsx +++ b/apps/web/components/Objects/Editor/Extensions/Image/ImageBlockComponent.tsx @@ -9,11 +9,14 @@ import { getActivityBlockMediaDirectory } from '@services/media/media' import { useOrg } from '@components/Contexts/OrgContext' import { useCourse } from '@components/Contexts/CourseContext' import { useEditorProvider } from '@components/Contexts/Editor/EditorContext' +import { useLHSession } from '@components/Contexts/LHSessionContext' function ImageBlockComponent(props: any) { const org = useOrg() as any const course = useCourse() as any const editorState = useEditorProvider() as any + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const isEditable = editorState.isEditable const [image, setImage] = React.useState(null) @@ -36,7 +39,7 @@ function ImageBlockComponent(props: any) { setIsLoading(true) let object = await uploadNewImageFile( image, - props.extension.options.activity.activity_uuid + props.extension.options.activity.activity_uuid,access_token ) setIsLoading(false) setblockObject(object) diff --git a/apps/web/components/Objects/Editor/Extensions/PDF/PDFBlockComponent.tsx b/apps/web/components/Objects/Editor/Extensions/PDF/PDFBlockComponent.tsx index c0e11903..c6c61fbe 100644 --- a/apps/web/components/Objects/Editor/Extensions/PDF/PDFBlockComponent.tsx +++ b/apps/web/components/Objects/Editor/Extensions/PDF/PDFBlockComponent.tsx @@ -8,10 +8,13 @@ import { getActivityBlockMediaDirectory } from '@services/media/media' import { useOrg } from '@components/Contexts/OrgContext' import { useCourse } from '@components/Contexts/CourseContext' import { useEditorProvider } from '@components/Contexts/Editor/EditorContext' +import { useLHSession } from '@components/Contexts/LHSessionContext' function PDFBlockComponent(props: any) { const org = useOrg() as any const course = useCourse() as any + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const [pdf, setPDF] = React.useState(null) const [isLoading, setIsLoading] = React.useState(false) const [blockObject, setblockObject] = React.useState( @@ -32,7 +35,7 @@ function PDFBlockComponent(props: any) { setIsLoading(true) let object = await uploadNewPDFFile( pdf, - props.extension.options.activity.activity_uuid + props.extension.options.activity.activity_uuid, access_token ) setIsLoading(false) setblockObject(object) @@ -41,7 +44,7 @@ function PDFBlockComponent(props: any) { }) } - useEffect(() => {}, [course, org]) + useEffect(() => { }, [course, org]) return ( diff --git a/apps/web/components/Objects/Editor/Extensions/Quiz/QuizBlockComponent.tsx b/apps/web/components/Objects/Editor/Extensions/Quiz/QuizBlockComponent.tsx index 26d0dfa4..a33aab0e 100644 --- a/apps/web/components/Objects/Editor/Extensions/Quiz/QuizBlockComponent.tsx +++ b/apps/web/components/Objects/Editor/Extensions/Quiz/QuizBlockComponent.tsx @@ -86,10 +86,8 @@ function QuizBlockComponent(props: any) { if (allCorrect) { setSubmissionMessage('All answers are correct!') - console.log('All answers are correct!') } else { setSubmissionMessage('Some answers are incorrect!') - console.log('Some answers are incorrect!') } } diff --git a/apps/web/components/Objects/Editor/Extensions/Video/VideoBlockComponent.tsx b/apps/web/components/Objects/Editor/Extensions/Video/VideoBlockComponent.tsx index 42063263..f90923bd 100644 --- a/apps/web/components/Objects/Editor/Extensions/Video/VideoBlockComponent.tsx +++ b/apps/web/components/Objects/Editor/Extensions/Video/VideoBlockComponent.tsx @@ -8,6 +8,7 @@ import { UploadIcon } from '@radix-ui/react-icons' import { useOrg } from '@components/Contexts/OrgContext' import { useCourse } from '@components/Contexts/CourseContext' import { useEditorProvider } from '@components/Contexts/Editor/EditorContext' +import { useLHSession } from '@components/Contexts/LHSessionContext' function VideoBlockComponents(props: any) { const org = useOrg() as any @@ -15,6 +16,8 @@ function VideoBlockComponents(props: any) { const editorState = useEditorProvider() as any const isEditable = editorState.isEditable const [video, setVideo] = React.useState(null) + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const [isLoading, setIsLoading] = React.useState(false) const [blockObject, setblockObject] = React.useState( props.node.attrs.blockObject @@ -32,7 +35,7 @@ function VideoBlockComponents(props: any) { setIsLoading(true) let object = await uploadNewVideoFile( video, - props.extension.options.activity.activity_uuid + props.extension.options.activity.activity_uuid, access_token ) setIsLoading(false) setblockObject(object) @@ -41,7 +44,7 @@ function VideoBlockComponents(props: any) { }) } - useEffect(() => {}, [course, org]) + useEffect(() => { }, [course, org]) return ( @@ -98,7 +101,7 @@ function VideoBlockComponents(props: any) { ) } const BlockVideoWrapper = styled.div` - //border: ${(props) => + border: ${(props) => props.contentEditable ? '2px dashed #713f1117' : 'none'}; // center diff --git a/apps/web/components/Objects/Menu/Menu.tsx b/apps/web/components/Objects/Menu/Menu.tsx index 8bf3df13..1b77a619 100644 --- a/apps/web/components/Objects/Menu/Menu.tsx +++ b/apps/web/components/Objects/Menu/Menu.tsx @@ -1,12 +1,10 @@ 'use client' import React from 'react' import Link from 'next/link' -import { getAPIUrl, getUriWithOrg } from '@services/config/config' +import { getUriWithOrg } from '@services/config/config' import { HeaderProfileBox } from '@components/Security/HeaderProfileBox' import MenuLinks from './MenuLinks' import { getOrgLogoMediaDirectory } from '@services/media/media' -import useSWR from 'swr' -import { swrFetcher } from '@services/utils/ts/requests' import { useLHSession } from '@components/Contexts/LHSessionContext' import { useOrg } from '@components/Contexts/OrgContext' diff --git a/apps/web/components/Objects/Modals/Course/Create/CreateCourse.tsx b/apps/web/components/Objects/Modals/Course/Create/CreateCourse.tsx index 2c68a242..51bfe5f5 100644 --- a/apps/web/components/Objects/Modals/Course/Create/CreateCourse.tsx +++ b/apps/web/components/Objects/Modals/Course/Create/CreateCourse.tsx @@ -19,7 +19,7 @@ import { useLHSession } from '@components/Contexts/LHSessionContext' function CreateCourseModal({ closeModal, orgslug }: any) { const [isSubmitting, setIsSubmitting] = useState(false) - const session = useLHSession() + const session = useLHSession() as any; const [name, setName] = React.useState('') const [description, setDescription] = React.useState('') const [learnings, setLearnings] = React.useState('') @@ -55,7 +55,6 @@ function CreateCourseModal({ closeModal, orgslug }: any) { const handleVisibilityChange = (event: React.ChangeEvent) => { setVisibility(event.target.value) - console.log(visibility) } const handleTagsChange = (event: React.ChangeEvent) => { diff --git a/apps/web/components/Objects/Modals/Dash/EditCourseAccess/LinkToUserGroup.tsx b/apps/web/components/Objects/Modals/Dash/EditCourseAccess/LinkToUserGroup.tsx index 56976fba..6cefeeda 100644 --- a/apps/web/components/Objects/Modals/Dash/EditCourseAccess/LinkToUserGroup.tsx +++ b/apps/web/components/Objects/Modals/Dash/EditCourseAccess/LinkToUserGroup.tsx @@ -1,10 +1,11 @@ 'use client'; import { useCourse } from '@components/Contexts/CourseContext'; +import { useLHSession } from '@components/Contexts/LHSessionContext'; import { useOrg } from '@components/Contexts/OrgContext'; import { getAPIUrl } from '@services/config/config'; import { linkResourcesToUserGroup } from '@services/usergroups/usergroups'; import { swrFetcher } from '@services/utils/ts/requests'; -import { AlertTriangle, Info } from 'lucide-react'; +import { Info } from 'lucide-react'; import React, { useEffect } from 'react' import toast from 'react-hot-toast'; import useSWR, { mutate } from 'swr' @@ -17,6 +18,8 @@ type LinkToUserGroupProps = { function LinkToUserGroup(props: LinkToUserGroupProps) { const course = useCourse() as any const org = useOrg() as any + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const courseStructure = course.courseStructure const { data: usergroups } = useSWR( @@ -27,8 +30,7 @@ function LinkToUserGroup(props: LinkToUserGroupProps) { const handleLink = async () => { - console.log('selectedUserGroup', selectedUserGroup) - const res = await linkResourcesToUserGroup(selectedUserGroup, courseStructure.course_uuid) + const res = await linkResourcesToUserGroup(selectedUserGroup, courseStructure.course_uuid, access_token) if (res.status === 200) { props.setUserGroupModal(false) toast.success('Successfully linked to usergroup') @@ -37,7 +39,6 @@ function LinkToUserGroup(props: LinkToUserGroupProps) { else { toast.error('Error ' + res.status + ': ' + res.data.detail) } - } useEffect(() => { @@ -54,25 +55,25 @@ function LinkToUserGroup(props: LinkToUserGroupProps) {

Users that are not part of the UserGroup will no longer have access to this course

- -
- UserGroup Name - -
-
- +
+ UserGroup Name + +
+
+ +
-
- + ) } diff --git a/apps/web/components/Objects/Modals/Dash/OrgAccess/OrgInviteCodeGenerate.tsx b/apps/web/components/Objects/Modals/Dash/OrgAccess/OrgInviteCodeGenerate.tsx index 5197de72..06834009 100644 --- a/apps/web/components/Objects/Modals/Dash/OrgAccess/OrgInviteCodeGenerate.tsx +++ b/apps/web/components/Objects/Modals/Dash/OrgAccess/OrgInviteCodeGenerate.tsx @@ -2,7 +2,7 @@ import { useOrg } from '@components/Contexts/OrgContext' import { getAPIUrl } from '@services/config/config' import { createInviteCode, createInviteCodeWithUserGroup } from '@services/organizations/invites' import { swrFetcher } from '@services/utils/ts/requests' -import { Shield, Ticket } from 'lucide-react' +import { Ticket } from 'lucide-react' import { useLHSession } from '@components/Contexts/LHSessionContext' import React, { useEffect } from 'react' import toast from 'react-hot-toast' @@ -14,7 +14,8 @@ type OrgInviteCodeGenerateProps = { function OrgInviteCodeGenerate(props: OrgInviteCodeGenerateProps) { const org = useOrg() as any - const session = useLHSession() + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const [usergroup_id, setUsergroup_id] = React.useState(0); const { data: usergroups } = useSWR( org ? `${getAPIUrl()}usergroups/org/${org.id}` : null, diff --git a/apps/web/components/Objects/Modals/Dash/OrgUserGroups/AddUserGroup.tsx b/apps/web/components/Objects/Modals/Dash/OrgUserGroups/AddUserGroup.tsx index e7e4f28b..df4677bd 100644 --- a/apps/web/components/Objects/Modals/Dash/OrgUserGroups/AddUserGroup.tsx +++ b/apps/web/components/Objects/Modals/Dash/OrgUserGroups/AddUserGroup.tsx @@ -14,13 +14,16 @@ import { BarLoader } from 'react-spinners' import { createUserGroup } from '@services/usergroups/usergroups' import { mutate } from 'swr' import { getAPIUrl } from '@services/config/config' +import { useLHSession } from '@components/Contexts/LHSessionContext' type AddUserGroupProps = { setCreateUserGroupModal: any } function AddUserGroup(props: AddUserGroupProps) { - const org = useOrg() as any + const org = useOrg() as any; + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const [userGroupName, setUserGroupName] = React.useState('') const [userGroupDescription, setUserGroupDescription] = React.useState('') const [isSubmitting, setIsSubmitting] = React.useState(false) @@ -42,7 +45,7 @@ function AddUserGroup(props: AddUserGroupProps) { description: userGroupDescription, org_id: org.id } - const res = await createUserGroup(obj) + const res = await createUserGroup(obj, access_token) if (res.status == 200) { setIsSubmitting(false) mutate(`${getAPIUrl()}usergroups/org/${org.id}`) diff --git a/apps/web/components/Objects/Modals/Dash/OrgUserGroups/ManageUsers.tsx b/apps/web/components/Objects/Modals/Dash/OrgUserGroups/ManageUsers.tsx index ce7d35e2..71eb8390 100644 --- a/apps/web/components/Objects/Modals/Dash/OrgUserGroups/ManageUsers.tsx +++ b/apps/web/components/Objects/Modals/Dash/OrgUserGroups/ManageUsers.tsx @@ -1,3 +1,4 @@ +import { useLHSession } from '@components/Contexts/LHSessionContext' import { useOrg } from '@components/Contexts/OrgContext' import { getAPIUrl } from '@services/config/config' import { linkUserToUserGroup, unLinkUserToUserGroup } from '@services/usergroups/usergroups' @@ -14,6 +15,8 @@ type ManageUsersProps = { function ManageUsers(props: ManageUsersProps) { const org = useOrg() as any + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const { data: OrgUsers } = useSWR( org ? `${getAPIUrl()}orgs/${org.id}/users` : null, swrFetcher @@ -31,7 +34,7 @@ function ManageUsers(props: ManageUsersProps) { } const handleLinkUser = async (user_id: any) => { - const res = await linkUserToUserGroup(props.usergroup_id, user_id) + const res = await linkUserToUserGroup(props.usergroup_id, user_id,access_token) if (res.status === 200) { toast.success('User linked successfully') mutate(`${getAPIUrl()}usergroups/${props.usergroup_id}/users`) @@ -41,7 +44,7 @@ function ManageUsers(props: ManageUsersProps) { } const handleUnlinkUser = async (user_id: any) => { - const res = await unLinkUserToUserGroup(props.usergroup_id, user_id) + const res = await unLinkUserToUserGroup(props.usergroup_id, user_id,access_token) if (res.status === 200) { toast.success('User unlinked successfully') mutate(`${getAPIUrl()}usergroups/${props.usergroup_id}/users`) diff --git a/apps/web/components/Objects/Modals/Dash/OrgUsers/RolesUpdate.tsx b/apps/web/components/Objects/Modals/Dash/OrgUsers/RolesUpdate.tsx index 3ee7e6ef..1712ab19 100644 --- a/apps/web/components/Objects/Modals/Dash/OrgUsers/RolesUpdate.tsx +++ b/apps/web/components/Objects/Modals/Dash/OrgUsers/RolesUpdate.tsx @@ -1,4 +1,5 @@ 'use client' +import { useLHSession } from '@components/Contexts/LHSessionContext' import { useOrg } from '@components/Contexts/OrgContext' import FormLayout, { ButtonBlack, @@ -22,6 +23,8 @@ interface Props { function RolesUpdate(props: Props) { const org = useOrg() as any + const session = useLHSession() as any + const access_token = session.data.tokens.access_token; const [isSubmitting, setIsSubmitting] = React.useState(false) const [assignedRole, setAssignedRole] = React.useState( props.alreadyAssignedRole @@ -36,7 +39,7 @@ function RolesUpdate(props: Props) { const handleSubmit = async (e: any) => { e.preventDefault() setIsSubmitting(true) - const res = await updateUserRole(org.id, props.user.user.id, assignedRole) + const res = await updateUserRole(org.id, props.user.user.id, assignedRole,access_token) if (res.status === 200) { await mutate(`${getAPIUrl()}orgs/${org.id}/users`) diff --git a/apps/web/components/Objects/Thumbnails/CollectionThumbnail.tsx b/apps/web/components/Objects/Thumbnails/CollectionThumbnail.tsx index 73ff2554..df27f05a 100644 --- a/apps/web/components/Objects/Thumbnails/CollectionThumbnail.tsx +++ b/apps/web/components/Objects/Thumbnails/CollectionThumbnail.tsx @@ -34,7 +34,7 @@ function CollectionThumbnail(props: PropsType) { href={getUriWithOrg( props.orgslug, '/collection/' + - removeCollectionPrefix(props.collection.collection_uuid) + removeCollectionPrefix(props.collection.collection_uuid) )} >

@@ -75,7 +75,7 @@ function CollectionThumbnail(props: PropsType) { const CollectionAdminEditsArea = (props: any) => { const router = useRouter() - const session = useLHSession() ; + const session = useLHSession() as any; const deleteCollectionUI = async (collectionId: number) => { await deleteCollection(collectionId, session.data?.tokens?.access_token) diff --git a/apps/web/components/Objects/Thumbnails/CourseThumbnail.tsx b/apps/web/components/Objects/Thumbnails/CourseThumbnail.tsx index c9373eb5..174b63ae 100644 --- a/apps/web/components/Objects/Thumbnails/CourseThumbnail.tsx +++ b/apps/web/components/Objects/Thumbnails/CourseThumbnail.tsx @@ -25,7 +25,7 @@ function removeCoursePrefix(course_uuid: string) { function CourseThumbnail(props: PropsType) { const router = useRouter() const org = useOrg() as any - const session = useLHSession(); + const session = useLHSession() as any; async function deleteCourses(course_uuid: any) { await deleteCourseFromBackend(course_uuid, session.data?.tokens?.access_token) diff --git a/apps/web/components/Security/AdminAuthorization.tsx b/apps/web/components/Security/AdminAuthorization.tsx index 05a7737e..7840317f 100644 --- a/apps/web/components/Security/AdminAuthorization.tsx +++ b/apps/web/components/Security/AdminAuthorization.tsx @@ -1,9 +1,9 @@ 'use client'; import React, { useEffect, useState, useCallback, useMemo } from 'react'; -import { useOrg } from '@components/Contexts/OrgContext'; import { useLHSession } from '@components/Contexts/LHSessionContext'; import useAdminStatus from '@components/Hooks/useAdminStatus'; import { usePathname, useRouter } from 'next/navigation'; +import PageLoading from '@components/Objects/Loaders/PageLoading'; type AuthorizationProps = { children: React.ReactNode; @@ -30,10 +30,19 @@ const AdminAuthorization: React.FC = ({ children, authorizat const isUserAuthenticated = useMemo(() => session.status === 'authenticated', [session.status]); const checkPathname = useCallback((pattern: string, pathname: string) => { - const regexPattern = new RegExp(`^${pattern.replace(/\//g, '\\/').replace(/\*/g, '.*')}$`); + // Ensure the inputs are strings + if (typeof pattern !== 'string' || typeof pathname !== 'string') { + return false; + } + + // Convert pattern to a regex pattern + const regexPattern = new RegExp(`^${pattern.replace(/[\/.*+?^${}()|[\]\\]/g, '\\$&').replace(/\\\*/g, '.*')}$`); + + // Test the pathname against the regex pattern return regexPattern.test(pathname); }, []); + const isAdminPath = useMemo(() => ADMIN_PATHS.some(path => checkPathname(path, pathname)), [pathname, checkPathname]); const authorizeUser = useCallback(() => { @@ -69,7 +78,7 @@ const AdminAuthorization: React.FC = ({ children, authorizat if (loading) { return (
-

Loading...

+
); } diff --git a/apps/web/components/Security/HeaderProfileBox.tsx b/apps/web/components/Security/HeaderProfileBox.tsx index f6427c0f..0bd3ca53 100644 --- a/apps/web/components/Security/HeaderProfileBox.tsx +++ b/apps/web/components/Security/HeaderProfileBox.tsx @@ -11,9 +11,7 @@ export const HeaderProfileBox = () => { const session = useLHSession() as any const isUserAdmin = useAdminStatus() as any - useEffect(() => { - console.log(session) - } + useEffect(() => {} , [session]) return ( diff --git a/apps/web/services/ai/ai.ts b/apps/web/services/ai/ai.ts index 4d1542ce..e9707f6e 100644 --- a/apps/web/services/ai/ai.ts +++ b/apps/web/services/ai/ai.ts @@ -1,9 +1,10 @@ import { getAPIUrl } from '@services/config/config' -import { RequestBody } from '@services/utils/ts/requests' +import { RequestBodyWithAuthHeader } from '@services/utils/ts/requests' export async function startActivityAIChatSession( message: string, - activity_uuid: string + access_token: string, + activity_uuid?: string ) { const data = { message, @@ -11,7 +12,7 @@ export async function startActivityAIChatSession( } const result = await fetch( `${getAPIUrl()}ai/start/activity_chat_session`, - RequestBody('POST', data, null) + RequestBodyWithAuthHeader('POST', data, null, access_token) ) const json = await result.json() if (result.status === 200) { @@ -34,7 +35,8 @@ export async function startActivityAIChatSession( export async function sendActivityAIChatMessage( message: string, aichat_uuid: string, - activity_uuid: string + activity_uuid: string, + access_token: string ) { const data = { aichat_uuid, @@ -43,7 +45,7 @@ export async function sendActivityAIChatMessage( } const result = await fetch( `${getAPIUrl()}ai/send/activity_chat_message`, - RequestBody('POST', data, null) + RequestBodyWithAuthHeader('POST', data, null, access_token) ) const json = await result.json() diff --git a/apps/web/services/blocks/Image/images.ts b/apps/web/services/blocks/Image/images.ts index 6a578adf..454d87fa 100644 --- a/apps/web/services/blocks/Image/images.ts +++ b/apps/web/services/blocks/Image/images.ts @@ -1,7 +1,16 @@ import { getAPIUrl } from '@services/config/config' -import { RequestBody, RequestBodyForm } from '@services/utils/ts/requests' +import { + RequestBody, + RequestBodyForm, + RequestBodyFormWithAuthHeader, + RequestBodyWithAuthHeader, +} from '@services/utils/ts/requests' -export async function uploadNewImageFile(file: any, activity_uuid: string) { +export async function uploadNewImageFile( + file: any, + activity_uuid: string, + access_token: string +) { // Send file thumbnail as form data const formData = new FormData() formData.append('file_object', file) @@ -9,17 +18,17 @@ export async function uploadNewImageFile(file: any, activity_uuid: string) { return fetch( `${getAPIUrl()}blocks/image`, - RequestBodyForm('POST', formData, null) + RequestBodyFormWithAuthHeader('POST', formData, null, access_token) ) .then((result) => result.json()) .catch((error) => console.log('error', error)) } -export async function getImageFile(file_id: string) { +export async function getImageFile(file_id: string, access_token: string) { // todo : add course id to url return fetch( `${getAPIUrl()}blocks/image?file_id=${file_id}`, - RequestBody('GET', null, null) + RequestBodyWithAuthHeader('GET', null, null, access_token) ) .then((result) => result.json()) .catch((error) => console.log('error', error)) diff --git a/apps/web/services/blocks/Pdf/pdf.ts b/apps/web/services/blocks/Pdf/pdf.ts index 06b053c7..99c1e3f0 100644 --- a/apps/web/services/blocks/Pdf/pdf.ts +++ b/apps/web/services/blocks/Pdf/pdf.ts @@ -1,7 +1,16 @@ import { getAPIUrl } from '@services/config/config' -import { RequestBody, RequestBodyForm } from '@services/utils/ts/requests' +import { + RequestBody, + RequestBodyForm, + RequestBodyFormWithAuthHeader, + RequestBodyWithAuthHeader, +} from '@services/utils/ts/requests' -export async function uploadNewPDFFile(file: any, activity_uuid: string) { +export async function uploadNewPDFFile( + file: any, + activity_uuid: string, + access_token: string +) { // Send file thumbnail as form data const formData = new FormData() formData.append('file_object', file) @@ -9,17 +18,17 @@ export async function uploadNewPDFFile(file: any, activity_uuid: string) { return fetch( `${getAPIUrl()}blocks/pdf`, - RequestBodyForm('POST', formData, null) + RequestBodyFormWithAuthHeader('POST', formData, null, access_token) ) .then((result) => result.json()) .catch((error) => console.log('error', error)) } -export async function getPDFFile(file_id: string) { +export async function getPDFFile(file_id: string, access_token: string) { // todo : add course id to url return fetch( `${getAPIUrl()}blocks/pdf?file_id=${file_id}`, - RequestBody('GET', null, null) + RequestBodyWithAuthHeader('GET', null, null, access_token) ) .then((result) => result.json()) .catch((error) => console.log('error', error)) diff --git a/apps/web/services/blocks/Quiz/quiz.ts b/apps/web/services/blocks/Quiz/quiz.ts index 0928ffd5..5d4eb093 100644 --- a/apps/web/services/blocks/Quiz/quiz.ts +++ b/apps/web/services/blocks/Quiz/quiz.ts @@ -1,10 +1,10 @@ import { getAPIUrl } from '@services/config/config' -import { RequestBody } from '@services/utils/ts/requests' +import { RequestBody, RequestBodyWithAuthHeader } from '@services/utils/ts/requests' -export async function submitQuizBlock(activity_id: string, data: any) { +export async function submitQuizBlock(activity_id: string, data: any,access_token:string) { const result: any = await fetch( `${getAPIUrl()}blocks/quiz/${activity_id}"`, - RequestBody('POST', data, null) + RequestBodyWithAuthHeader('POST', data, null,access_token) ) .then((result) => result.json()) .catch((error) => console.log('error', error)) diff --git a/apps/web/services/blocks/Video/video.ts b/apps/web/services/blocks/Video/video.ts index fff4a502..ff8e9bd6 100644 --- a/apps/web/services/blocks/Video/video.ts +++ b/apps/web/services/blocks/Video/video.ts @@ -1,7 +1,16 @@ import { getAPIUrl } from '@services/config/config' -import { RequestBody, RequestBodyForm } from '@services/utils/ts/requests' +import { + RequestBody, + RequestBodyForm, + RequestBodyFormWithAuthHeader, + RequestBodyWithAuthHeader, +} from '@services/utils/ts/requests' -export async function uploadNewVideoFile(file: any, activity_uuid: string) { +export async function uploadNewVideoFile( + file: any, + activity_uuid: string, + access_token: string +) { // Send file thumbnail as form data const formData = new FormData() formData.append('file_object', file) @@ -9,17 +18,17 @@ export async function uploadNewVideoFile(file: any, activity_uuid: string) { return fetch( `${getAPIUrl()}blocks/video`, - RequestBodyForm('POST', formData, null) + RequestBodyFormWithAuthHeader('POST', formData, null, access_token) ) .then((result) => result.json()) - .catch((error) => console.log('error', error)) + .catch((error) => console.error('error', error)) } -export async function getVideoFile(file_id: string) { +export async function getVideoFile(file_id: string, access_token: string) { return fetch( `${getAPIUrl()}blocks/video?file_id=${file_id}`, - RequestBody('GET', null, null) + RequestBodyWithAuthHeader('GET', null, null, access_token) ) .then((result) => result.json()) - .catch((error) => console.log('error', error)) + .catch((error) => console.error('error', error)) } diff --git a/apps/web/services/courses/activity.ts b/apps/web/services/courses/activity.ts index b571741d..35240cf5 100644 --- a/apps/web/services/courses/activity.ts +++ b/apps/web/services/courses/activity.ts @@ -1,4 +1,4 @@ -import { RequestBody, RequestBodyWithAuthHeader, errorHandling } from '@services/utils/ts/requests' +import { RequestBodyWithAuthHeader, errorHandling } from '@services/utils/ts/requests' import { getAPIUrl } from '@services/config/config' /* diff --git a/apps/web/services/courses/collections.ts b/apps/web/services/courses/collections.ts index 5439f61a..93051fbf 100644 --- a/apps/web/services/courses/collections.ts +++ b/apps/web/services/courses/collections.ts @@ -23,7 +23,6 @@ export async function deleteCollection( // Create a new collection export async function createCollection(collection: any, access_token: any) { - console.log(collection) const result: any = await fetch( `${getAPIUrl()}collections/`, RequestBodyWithAuthHeader('POST', collection, null, access_token) diff --git a/apps/web/services/courses/courses.ts b/apps/web/services/courses/courses.ts index 40dbeaf8..7c9313ed 100644 --- a/apps/web/services/courses/courses.ts +++ b/apps/web/services/courses/courses.ts @@ -1,7 +1,5 @@ import { getAPIUrl } from '@services/config/config' import { - RequestBody, - RequestBodyForm, RequestBodyFormWithAuthHeader, RequestBodyWithAuthHeader, errorHandling, diff --git a/apps/web/services/courses/updates.ts b/apps/web/services/courses/updates.ts index 061d6a33..440ae0fd 100644 --- a/apps/web/services/courses/updates.ts +++ b/apps/web/services/courses/updates.ts @@ -1,6 +1,5 @@ import { getAPIUrl } from '@services/config/config' import { - RequestBody, RequestBodyWithAuthHeader, getResponseMetadata, } from '@services/utils/ts/requests' diff --git a/apps/web/services/organizations/invites.ts b/apps/web/services/organizations/invites.ts index 8207f538..dd082d1f 100644 --- a/apps/web/services/organizations/invites.ts +++ b/apps/web/services/organizations/invites.ts @@ -1,6 +1,5 @@ import { getAPIUrl } from '@services/config/config' import { - RequestBody, RequestBodyWithAuthHeader, getResponseMetadata, } from '@services/utils/ts/requests' diff --git a/apps/web/services/organizations/orgs.ts b/apps/web/services/organizations/orgs.ts index a08e38cf..e8cd4771 100644 --- a/apps/web/services/organizations/orgs.ts +++ b/apps/web/services/organizations/orgs.ts @@ -1,6 +1,6 @@ import { getAPIUrl } from '@services/config/config' import { - RequestBody, + RequestBodyWithAuthHeader, errorHandling, getResponseMetadata, } from '@services/utils/ts/requests' @@ -10,37 +10,48 @@ import { GET requests are called from the frontend using SWR (https://swr.vercel.app/) */ -export async function createNewOrganization(body: any) { +export async function createNewOrganization(body: any, access_token: string) { const result = await fetch( `${getAPIUrl()}orgs/`, - RequestBody('POST', body, null) + RequestBodyWithAuthHeader('POST', body, null,access_token) ) const res = await errorHandling(result) return res } -export async function deleteOrganizationFromBackend(org_id: any) { +export async function deleteOrganizationFromBackend( + org_id: any, + access_token: string +) { const result = await fetch( `${getAPIUrl()}orgs/${org_id}`, - RequestBody('DELETE', null, null) + RequestBodyWithAuthHeader('DELETE', null, null, access_token) ) const res = await errorHandling(result) return res } -export async function getOrganizationContextInfo(org_slug: any, next: any) { +export async function getOrganizationContextInfo( + org_slug: any, + next: any, + access_token?: string +) { const result = await fetch( `${getAPIUrl()}orgs/slug/${org_slug}`, - RequestBody('GET', null, next) + RequestBodyWithAuthHeader('GET', null, next, access_token) ) const res = await errorHandling(result) return res } -export async function getOrganizationContextInfoWithId(org_id: any, next: any) { +export async function getOrganizationContextInfoWithId( + org_id: any, + next: any, + access_token: string +) { const result = await fetch( `${getAPIUrl()}orgs/${org_id}`, - RequestBody('GET', null, next) + RequestBodyWithAuthHeader('GET', null, next, access_token) ) const res = await errorHandling(result) return res @@ -64,10 +75,14 @@ export async function getOrganizationContextInfoWithoutCredentials( return res } -export function getOrganizationContextInfoNoAsync(org_slug: any, next: any) { +export function getOrganizationContextInfoNoAsync( + org_slug: any, + next: any, + access_token: string +) { const result = fetch( `${getAPIUrl()}orgs/slug/${org_slug}`, - RequestBody('GET', null, next) + RequestBodyWithAuthHeader('GET', null, next, access_token) ) return result } @@ -75,20 +90,25 @@ export function getOrganizationContextInfoNoAsync(org_slug: any, next: any) { export async function updateUserRole( org_id: any, user_id: any, - role_uuid: any + role_uuid: any, + access_token: string ) { const result = await fetch( `${getAPIUrl()}orgs/${org_id}/users/${user_id}/role/${role_uuid}`, - RequestBody('PUT', null, null) + RequestBodyWithAuthHeader('PUT', null, null, access_token) ) const res = await getResponseMetadata(result) return res } -export async function removeUserFromOrg(org_id: any, user_id: any) { +export async function removeUserFromOrg( + org_id: any, + user_id: any, + access_token: any +) { const result = await fetch( `${getAPIUrl()}orgs/${org_id}/users/${user_id}`, - RequestBody('DELETE', null, null) + RequestBodyWithAuthHeader('DELETE', null, null, access_token) ) const res = await getResponseMetadata(result) return res diff --git a/apps/web/services/settings/org.ts b/apps/web/services/settings/org.ts index 7aaedb5c..c74450eb 100644 --- a/apps/web/services/settings/org.ts +++ b/apps/web/services/settings/org.ts @@ -1,8 +1,8 @@ import { getAPIUrl } from '@services/config/config' import { - RequestBody, errorHandling, - RequestBodyForm, + RequestBodyWithAuthHeader, + RequestBodyFormWithAuthHeader, } from '@services/utils/ts/requests' /* @@ -10,22 +10,30 @@ import { GET requests are called from the frontend using SWR (https://swr.vercel.app/) */ -export async function updateOrganization(org_id: string, data: any) { +export async function updateOrganization( + org_id: string, + data: any, + access_token: string +) { const result: any = await fetch( `${getAPIUrl()}orgs/` + org_id, - RequestBody('PUT', data, null) + RequestBodyWithAuthHeader('PUT', data, null, access_token) ) const res = await errorHandling(result) return res } -export async function uploadOrganizationLogo(org_id: string, logo_file: any) { +export async function uploadOrganizationLogo( + org_id: string, + logo_file: any, + access_token: string +) { // Send file thumbnail as form data const formData = new FormData() formData.append('logo_file', logo_file) const result: any = await fetch( `${getAPIUrl()}orgs/` + org_id + '/logo', - RequestBodyForm('PUT', formData, null) + RequestBodyFormWithAuthHeader('PUT', formData, null, access_token) ) const res = await errorHandling(result) return res diff --git a/apps/web/services/settings/password.ts b/apps/web/services/settings/password.ts index b5ff0331..9bf84618 100644 --- a/apps/web/services/settings/password.ts +++ b/apps/web/services/settings/password.ts @@ -1,15 +1,22 @@ import { getAPIUrl } from '@services/config/config' -import { RequestBody, errorHandling } from '@services/utils/ts/requests' +import { + RequestBodyWithAuthHeader, + errorHandling, +} from '@services/utils/ts/requests' /* This file includes only POST, PUT, DELETE requests GET requests are called from the frontend using SWR (https://swr.vercel.app/) */ -export async function updatePassword(user_id: string, data: any) { +export async function updatePassword( + user_id: string, + data: any, + access_token: any +) { const result: any = await fetch( `${getAPIUrl()}users/change_password/` + user_id, - RequestBody('PUT', data, null) + RequestBodyWithAuthHeader('PUT', data, null, access_token) ) const res = await errorHandling(result) return res diff --git a/apps/web/services/settings/profile.ts b/apps/web/services/settings/profile.ts index 10fec223..68bd5d57 100644 --- a/apps/web/services/settings/profile.ts +++ b/apps/web/services/settings/profile.ts @@ -1,15 +1,22 @@ import { getAPIUrl } from '@services/config/config' -import { RequestBody, errorHandling } from '@services/utils/ts/requests' +import { + RequestBodyWithAuthHeader, + errorHandling, +} from '@services/utils/ts/requests' /* This file includes only POST, PUT, DELETE requests GET requests are called from the frontend using SWR (https://swr.vercel.app/) */ -export async function updateProfile(data: any, user_id: number) { +export async function updateProfile( + data: any, + user_id: number, + access_token: string +) { const result: any = await fetch( `${getAPIUrl()}users/` + user_id, - RequestBody('PUT', data, null) + RequestBodyWithAuthHeader('PUT', data, null, access_token) ) const res = await errorHandling(result) return res diff --git a/apps/web/services/usergroups/usergroups.ts b/apps/web/services/usergroups/usergroups.ts index c4eaa599..b7f9e50c 100644 --- a/apps/web/services/usergroups/usergroups.ts +++ b/apps/web/services/usergroups/usergroups.ts @@ -1,46 +1,60 @@ import { getAPIUrl } from '@services/config/config' -import { RequestBody, getResponseMetadata } from '@services/utils/ts/requests' +import { + RequestBodyWithAuthHeader, + getResponseMetadata, +} from '@services/utils/ts/requests' -export async function getUserGroups(org_id: any) { +export async function getUserGroups(org_id: any, access_token: string) { const result: any = await fetch( `${getAPIUrl()}usergroups/org/${org_id}`, - RequestBody('GET', null, null) + RequestBodyWithAuthHeader('GET', null, null, access_token) ) const res = await getResponseMetadata(result) return res } -export async function createUserGroup(body: any) { +export async function createUserGroup(body: any, access_token: string) { const result: any = await fetch( `${getAPIUrl()}usergroups/`, - RequestBody('POST', body, null) + RequestBodyWithAuthHeader('POST', body, null, access_token) ) const res = await getResponseMetadata(result) return res } -export async function linkUserToUserGroup(usergroup_id: any, user_id: any) { +export async function linkUserToUserGroup( + usergroup_id: any, + user_id: any, + access_token: string +) { const result: any = await fetch( `${getAPIUrl()}usergroups/${usergroup_id}/add_users?user_ids=${user_id}`, - RequestBody('POST', null, null) + RequestBodyWithAuthHeader('POST', null, null, access_token) ) const res = await getResponseMetadata(result) return res } -export async function unLinkUserToUserGroup(usergroup_id: any, user_id: any) { +export async function unLinkUserToUserGroup( + usergroup_id: any, + user_id: any, + access_token: string +) { const result: any = await fetch( `${getAPIUrl()}usergroups/${usergroup_id}/remove_users?user_ids=${user_id}`, - RequestBody('DELETE', null, null) + RequestBodyWithAuthHeader('DELETE', null, null, access_token) ) const res = await getResponseMetadata(result) return res } -export async function deleteUserGroup(usergroup_id: number) { +export async function deleteUserGroup( + usergroup_id: number, + access_token: string +) { const result: any = await fetch( `${getAPIUrl()}usergroups/${usergroup_id}`, - RequestBody('DELETE', null, null) + RequestBodyWithAuthHeader('DELETE', null, null, access_token) ) const res = await getResponseMetadata(result) return res @@ -48,11 +62,12 @@ export async function deleteUserGroup(usergroup_id: number) { export async function linkResourcesToUserGroup( usergroup_id: any, - resource_uuids: any + resource_uuids: any, + access_token: string ) { const result: any = await fetch( `${getAPIUrl()}usergroups/${usergroup_id}/add_resources?resource_uuids=${resource_uuids}`, - RequestBody('POST', null, null) + RequestBodyWithAuthHeader('POST', null, null, access_token) ) const res = await getResponseMetadata(result) return res @@ -60,11 +75,12 @@ export async function linkResourcesToUserGroup( export async function unLinkResourcesToUserGroup( usergroup_id: any, - resource_uuids: any + resource_uuids: any, + access_token: string ) { const result: any = await fetch( `${getAPIUrl()}usergroups/${usergroup_id}/remove_resources?resource_uuids=${resource_uuids}`, - RequestBody('DELETE', null, null) + RequestBodyWithAuthHeader('DELETE', null, null, access_token) ) const res = await getResponseMetadata(result) return res diff --git a/apps/web/services/users/users.ts b/apps/web/services/users/users.ts index 468ad56c..7596e208 100644 --- a/apps/web/services/users/users.ts +++ b/apps/web/services/users/users.ts @@ -1,7 +1,7 @@ import { getAPIUrl } from '@services/config/config' import { RequestBody, - RequestBodyForm, + RequestBodyFormWithAuthHeader, errorHandling, getResponseMetadata, } from '@services/utils/ts/requests' @@ -15,12 +15,16 @@ export async function getUser(user_id: string) { return res } -export async function updateUserAvatar(user_uuid: any, avatar_file: any) { +export async function updateUserAvatar( + user_uuid: any, + avatar_file: any, + access_token: any +) { const formData = new FormData() formData.append('avatar_file', avatar_file) const result: any = await fetch( `${getAPIUrl()}users/update_avatar/${user_uuid}`, - RequestBodyForm('PUT', formData, null) + RequestBodyFormWithAuthHeader('PUT', formData, null, access_token) ) const res = await getResponseMetadata(result) return res diff --git a/apps/web/services/utils/ts/requests.ts b/apps/web/services/utils/ts/requests.ts index 1ac8fd8b..0c68a945 100644 --- a/apps/web/services/utils/ts/requests.ts +++ b/apps/web/services/utils/ts/requests.ts @@ -20,7 +20,7 @@ export const RequestBodyWithAuthHeader = ( method: string, data: any, next: any, - token: string + token?: string ) => { let HeadersConfig = new Headers( token diff --git a/apps/web/types/next-auth.d.ts b/apps/web/types/next-auth.d.ts index 5287cbc2..ece81eac 100644 --- a/apps/web/types/next-auth.d.ts +++ b/apps/web/types/next-auth.d.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line unused-imports/no-unused-imports import type { NextAuthOptions } from 'next-auth/index'; // next-auth.d.ts diff --git a/package.json b/package.json index 7174e3cc..6043f5a9 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,15 @@ "private": true, "scripts": { "build": "turbo run build", - "start" : "turbo run start", + "start": "turbo run start", "dev": "turbo run dev", "lint": "turbo run lint", "format": "prettier --write \"**/*.{ts,tsx,md}\"" }, "devDependencies": { "eslint": "^8.57.0", - "prettier": "^3.2.5", - "turbo": "^1.13.2" + "prettier": "^3.3.0", + "turbo": "^1.13.3" }, "packageManager": "pnpm@9.0.6" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f7c0cf81..a5b4d0ae 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,18 +12,14 @@ importers: specifier: ^8.57.0 version: 8.57.0 prettier: - specifier: ^3.2.5 - version: 3.2.5 + specifier: ^3.3.0 + version: 3.3.0 turbo: - specifier: ^1.13.2 - version: 1.13.2 + specifier: ^1.13.3 + version: 1.13.3 packages: - '@aashutoshrathi/word-wrap@1.2.6': - resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==} - engines: {node: '>=0.10.0'} - '@eslint-community/eslint-utils@4.4.0': resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -50,8 +46,8 @@ packages: resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} engines: {node: '>=12.22'} - '@humanwhocodes/object-schema@2.0.2': - resolution: {integrity: sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==} + '@humanwhocodes/object-schema@2.0.3': + resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} @@ -73,8 +69,8 @@ packages: peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - acorn@8.10.0: - resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} + acorn@8.11.3: + resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==} engines: {node: '>=0.4.0'} hasBin: true @@ -120,8 +116,8 @@ packages: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} - debug@4.3.4: - resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + debug@4.3.5: + resolution: {integrity: sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==} engines: {node: '>=6.0'} peerDependencies: supports-color: '*' @@ -209,6 +205,7 @@ packages: glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + deprecated: Glob versions prior to v9 are no longer supported globals@13.24.0: resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} @@ -235,6 +232,7 @@ packages: inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} @@ -293,8 +291,8 @@ packages: once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} - optionator@0.9.3: - resolution: {integrity: sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==} + optionator@0.9.4: + resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} p-limit@3.1.0: @@ -325,13 +323,13 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} - prettier@3.2.5: - resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==} + prettier@3.3.0: + resolution: {integrity: sha512-J9odKxERhCQ10OC2yb93583f6UnYutOeiV5i0zEDS7UGTdUt0u+y8erxl3lBKvwo/JHyyoEdXjwp4dke9oyZ/g==} engines: {node: '>=14'} hasBin: true - punycode@2.3.0: - resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==} + punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} queue-microtask@1.2.3: @@ -347,6 +345,7 @@ packages: rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true run-parallel@1.2.0: @@ -375,38 +374,38 @@ packages: text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} - turbo-darwin-64@1.13.2: - resolution: {integrity: sha512-CCSuD8CfmtncpohCuIgq7eAzUas0IwSbHfI8/Q3vKObTdXyN8vAo01gwqXjDGpzG9bTEVedD0GmLbD23dR0MLA==} + turbo-darwin-64@1.13.3: + resolution: {integrity: sha512-glup8Qx1qEFB5jerAnXbS8WrL92OKyMmg5Hnd4PleLljAeYmx+cmmnsmLT7tpaVZIN58EAAwu8wHC6kIIqhbWA==} cpu: [x64] os: [darwin] - turbo-darwin-arm64@1.13.2: - resolution: {integrity: sha512-0HySm06/D2N91rJJ89FbiI/AodmY8B3WDSFTVEpu2+8spUw7hOJ8okWOT0e5iGlyayUP9gr31eOeL3VFZkpfCw==} + turbo-darwin-arm64@1.13.3: + resolution: {integrity: sha512-/np2xD+f/+9qY8BVtuOQXRq5f9LehCFxamiQnwdqWm5iZmdjygC5T3uVSYuagVFsZKMvX3ycySwh8dylGTl6lg==} cpu: [arm64] os: [darwin] - turbo-linux-64@1.13.2: - resolution: {integrity: sha512-7HnibgbqZrjn4lcfIouzlPu8ZHSBtURG4c7Bedu7WJUDeZo+RE1crlrQm8wuwO54S0siYqUqo7GNHxu4IXbioQ==} + turbo-linux-64@1.13.3: + resolution: {integrity: sha512-G+HGrau54iAnbXLfl+N/PynqpDwi/uDzb6iM9hXEDG+yJnSJxaHMShhOkXYJPk9offm9prH33Khx2scXrYVW1g==} cpu: [x64] os: [linux] - turbo-linux-arm64@1.13.2: - resolution: {integrity: sha512-sUq4dbpk6SNKg/Hkwn256Vj2AEYSQdG96repio894h5/LEfauIK2QYiC/xxAeW3WBMc6BngmvNyURIg7ltrePg==} + turbo-linux-arm64@1.13.3: + resolution: {integrity: sha512-qWwEl5VR02NqRyl68/3pwp3c/olZuSp+vwlwrunuoNTm6JXGLG5pTeme4zoHNnk0qn4cCX7DFrOboArlYxv0wQ==} cpu: [arm64] os: [linux] - turbo-windows-64@1.13.2: - resolution: {integrity: sha512-DqzhcrciWq3dpzllJR2VVIyOhSlXYCo4mNEWl98DJ3FZ08PEzcI3ceudlH6F0t/nIcfSItK1bDP39cs7YoZHEA==} + turbo-windows-64@1.13.3: + resolution: {integrity: sha512-Nudr4bRChfJzBPzEmpVV85VwUYRCGKecwkBFpbp2a4NtrJ3+UP1VZES653ckqCu2FRyRuS0n03v9euMbAvzH+Q==} cpu: [x64] os: [win32] - turbo-windows-arm64@1.13.2: - resolution: {integrity: sha512-WnPMrwfCXxK69CdDfS1/j2DlzcKxSmycgDAqV0XCYpK/812KB0KlvsVAt5PjEbZGXkY88pCJ1BLZHAjF5FcbqA==} + turbo-windows-arm64@1.13.3: + resolution: {integrity: sha512-ouJCgsVLd3icjRLmRvHQDDZnmGzT64GBupM1Y+TjtYn2LVaEBoV6hicFy8x5DUpnqdLy+YpCzRMkWlwhmkX7sQ==} cpu: [arm64] os: [win32] - turbo@1.13.2: - resolution: {integrity: sha512-rX/d9f4MgRT3yK6cERPAkfavIxbpBZowDQpgvkYwGMGDQ0Nvw1nc0NVjruE76GrzXQqoxR1UpnmEP54vBARFHQ==} + turbo@1.13.3: + resolution: {integrity: sha512-n17HJv4F4CpsYTvKzUJhLbyewbXjq1oLCi90i5tW1TiWDz16ML1eDG7wi5dHaKxzh5efIM56SITnuVbMq5dk4g==} hasBin: true type-check@0.4.0: @@ -425,6 +424,10 @@ packages: engines: {node: '>= 8'} hasBin: true + word-wrap@1.2.5: + resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} + engines: {node: '>=0.10.0'} + wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} @@ -434,8 +437,6 @@ packages: snapshots: - '@aashutoshrathi/word-wrap@1.2.6': {} - '@eslint-community/eslint-utils@4.4.0(eslint@8.57.0)': dependencies: eslint: 8.57.0 @@ -446,7 +447,7 @@ snapshots: '@eslint/eslintrc@2.1.4': dependencies: ajv: 6.12.6 - debug: 4.3.4 + debug: 4.3.5 espree: 9.6.1 globals: 13.24.0 ignore: 5.3.1 @@ -461,15 +462,15 @@ snapshots: '@humanwhocodes/config-array@0.11.14': dependencies: - '@humanwhocodes/object-schema': 2.0.2 - debug: 4.3.4 + '@humanwhocodes/object-schema': 2.0.3 + debug: 4.3.5 minimatch: 3.1.2 transitivePeerDependencies: - supports-color '@humanwhocodes/module-importer@1.0.1': {} - '@humanwhocodes/object-schema@2.0.2': {} + '@humanwhocodes/object-schema@2.0.3': {} '@nodelib/fs.scandir@2.1.5': dependencies: @@ -485,11 +486,11 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - acorn-jsx@5.3.2(acorn@8.10.0): + acorn-jsx@5.3.2(acorn@8.11.3): dependencies: - acorn: 8.10.0 + acorn: 8.11.3 - acorn@8.10.0: {} + acorn@8.11.3: {} ajv@6.12.6: dependencies: @@ -534,7 +535,7 @@ snapshots: shebang-command: 2.0.0 which: 2.0.2 - debug@4.3.4: + debug@4.3.5: dependencies: ms: 2.1.2 @@ -566,7 +567,7 @@ snapshots: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4 + debug: 4.3.5 doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -590,7 +591,7 @@ snapshots: lodash.merge: 4.6.2 minimatch: 3.1.2 natural-compare: 1.4.0 - optionator: 0.9.3 + optionator: 0.9.4 strip-ansi: 6.0.1 text-table: 0.2.0 transitivePeerDependencies: @@ -598,8 +599,8 @@ snapshots: espree@9.6.1: dependencies: - acorn: 8.10.0 - acorn-jsx: 5.3.2(acorn@8.10.0) + acorn: 8.11.3 + acorn-jsx: 5.3.2(acorn@8.11.3) eslint-visitor-keys: 3.4.3 esquery@1.5.0: @@ -727,14 +728,14 @@ snapshots: dependencies: wrappy: 1.0.2 - optionator@0.9.3: + optionator@0.9.4: dependencies: - '@aashutoshrathi/word-wrap': 1.2.6 deep-is: 0.1.4 fast-levenshtein: 2.0.6 levn: 0.4.1 prelude-ls: 1.2.1 type-check: 0.4.0 + word-wrap: 1.2.5 p-limit@3.1.0: dependencies: @@ -756,9 +757,9 @@ snapshots: prelude-ls@1.2.1: {} - prettier@3.2.5: {} + prettier@3.3.0: {} - punycode@2.3.0: {} + punycode@2.3.1: {} queue-microtask@1.2.3: {} @@ -792,32 +793,32 @@ snapshots: text-table@0.2.0: {} - turbo-darwin-64@1.13.2: + turbo-darwin-64@1.13.3: optional: true - turbo-darwin-arm64@1.13.2: + turbo-darwin-arm64@1.13.3: optional: true - turbo-linux-64@1.13.2: + turbo-linux-64@1.13.3: optional: true - turbo-linux-arm64@1.13.2: + turbo-linux-arm64@1.13.3: optional: true - turbo-windows-64@1.13.2: + turbo-windows-64@1.13.3: optional: true - turbo-windows-arm64@1.13.2: + turbo-windows-arm64@1.13.3: optional: true - turbo@1.13.2: + turbo@1.13.3: optionalDependencies: - turbo-darwin-64: 1.13.2 - turbo-darwin-arm64: 1.13.2 - turbo-linux-64: 1.13.2 - turbo-linux-arm64: 1.13.2 - turbo-windows-64: 1.13.2 - turbo-windows-arm64: 1.13.2 + turbo-darwin-64: 1.13.3 + turbo-darwin-arm64: 1.13.3 + turbo-linux-64: 1.13.3 + turbo-linux-arm64: 1.13.3 + turbo-windows-64: 1.13.3 + turbo-windows-arm64: 1.13.3 type-check@0.4.0: dependencies: @@ -827,12 +828,14 @@ snapshots: uri-js@4.4.1: dependencies: - punycode: 2.3.0 + punycode: 2.3.1 which@2.0.2: dependencies: isexe: 2.0.0 + word-wrap@1.2.5: {} + wrappy@1.0.2: {} yocto-queue@0.1.0: {}