diff --git a/web/components/molecules/Pagination/Pagination.tsx b/web/components/molecules/Pagination/Pagination.tsx new file mode 100644 index 00000000..6935a702 --- /dev/null +++ b/web/components/molecules/Pagination/Pagination.tsx @@ -0,0 +1,96 @@ +import { PAGINATION_PAGE_SIZE } from "db/consts"; +import React from "react"; + +const pageSize = PAGINATION_PAGE_SIZE; + +const getFirstRecordOnPage = (currPage: number) => + (currPage - 1) * pageSize + 1; + +const getLastRecordOnPage = ( + firstRecordOnPage: number, + totalRecords: number +) => Math.min(firstRecordOnPage + pageSize - 1, totalRecords); + +const isValidPage = (firstRecordOnPage: number, totalRecords: number) => + firstRecordOnPage > 0 && firstRecordOnPage <= totalRecords; + +const LeftArrow = () => ( + + + +); + +const RightArrow = () => ( + + + +); + +const getArrows = ( + firstRecordOnPage: number, + totalRecords: number, + currPage: number, + onNextPage: any, + onPrevPage: any +) => [ + { symbol: , disabled: firstRecordOnPage <= pageSize, onClick: onPrevPage }, + { symbol: , disabled: totalRecords <= currPage * pageSize, onClick: onNextPage }, +]; + +const ArrowButton = ({ + symbol, + disabled, + onClick +}: { + symbol: JSX.Element; + disabled: boolean; + onClick: () => void; +}) => ( +
+ {symbol} +
+); + +function Pagination({ + totalRecords, + currPage, + onNextPage, + onPrevPage +}: { + totalRecords: number; + currPage: number; + onNextPage: any; + onPrevPage: any; +}) { + const firstRecordOnPage = getFirstRecordOnPage(currPage); + const lastRecordOnPage = getLastRecordOnPage( + firstRecordOnPage, + totalRecords + ); + + if (!isValidPage(firstRecordOnPage, totalRecords)) { + return null; + } + + const arrows = getArrows(firstRecordOnPage, totalRecords, currPage, onNextPage, onPrevPage); + + return ( +
+

+ {firstRecordOnPage} - {lastRecordOnPage} of {totalRecords} +

+
+ {arrows.map(({ symbol, disabled, onClick }, index) => ( + + ))} +
+
+ ); +} + +export default Pagination; diff --git a/web/components/molecules/Pagination/PaginationHooks.ts b/web/components/molecules/Pagination/PaginationHooks.ts new file mode 100644 index 00000000..4661b219 --- /dev/null +++ b/web/components/molecules/Pagination/PaginationHooks.ts @@ -0,0 +1,49 @@ +import { CollectionPath } from "@lib/types/db"; +import { getTotalRecords } from "db/firebase/getSize"; +import { useEffect, useState } from "react"; + +export function usePaginatedData(fetchPage: (page: number, paginationReferences: Map) => Promise<{ data: T[], paginationInfo: any }>, type: CollectionPath) { + const [paginationReferences, setPaginationReferences] = useState>(new Map()); + const [currPage, setCurrPage] = useState(1); + const [data, setData] = useState([]); + const [totalRecords, setTotalRecords] = useState(0); + + const fetchTotalRecords = async () => { + try { + const numRecords = await getTotalRecords(type); + if (numRecords) { + setTotalRecords(numRecords); + } + } catch (error) { + console.error('Error fetching records.'); + } + }; + + const updatePaginationReferences = async (paginationInfo: any) => { + setPaginationReferences(prev => { + const newRefs = new Map(prev); + newRefs.set(currPage, paginationInfo); + return newRefs; + }); + }; + + const fetchPageData = async () => { + const newPageData = await fetchPage(currPage, paginationReferences); + setData(newPageData.data); + updatePaginationReferences(newPageData.paginationInfo); + }; + + useEffect(() => { + fetchPageData(); + fetchTotalRecords(); + }, [currPage]); + + return { + data, + totalRecords, + currPage, + setCurrPage, + onNextPage: () => setCurrPage(prev => prev + 1), + onPrevPage: () => setCurrPage(prev => prev - 1) + }; +} diff --git a/web/components/BabiesTable.tsx b/web/components/tables/BabiesTable.tsx similarity index 94% rename from web/components/BabiesTable.tsx rename to web/components/tables/BabiesTable.tsx index 71899116..65a0e5e0 100644 --- a/web/components/BabiesTable.tsx +++ b/web/components/tables/BabiesTable.tsx @@ -2,11 +2,16 @@ import ChildModal from "@components/modals/addChildModal"; import Image from "next/image"; import React, { useState } from "react"; import { useTable } from "react-table"; -import book from "../public/book.svg"; -import dots from "../public/dots.png"; -import Modal from "./modal"; +import book from "../../public/book.svg"; +import dots from "../../public/dots.png"; +import Modal from "@components/modal"; -function BabiesTable({ columns, data, onEdit, caretakers, onDelete }: any) { +function BabiesTable({props}: any) { + if (!props) { + return <>; + } + + const { columns, data, onEdit, caretakers, onDelete } = props; const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = useTable({ columns, @@ -107,7 +112,7 @@ function BabiesTable({ columns, data, onEdit, caretakers, onDelete }: any) { onClick={() => { confirm( "Are you sure you want to delete this baby?" - ) && onDelete(row.original); + ) && onDelete(row.original) && setSelectedOptionsPanel(-1); }} className="block px-4 py-2 text-red-500 hover:bg-gray-100 cursor-pointer" > diff --git a/web/components/CaretakerTable.tsx b/web/components/tables/CaretakerTable.tsx similarity index 97% rename from web/components/CaretakerTable.tsx rename to web/components/tables/CaretakerTable.tsx index 80bb0ee9..43dc0992 100644 --- a/web/components/CaretakerTable.tsx +++ b/web/components/tables/CaretakerTable.tsx @@ -2,20 +2,24 @@ import React from "react"; import { useTable } from "react-table"; import { HiOutlineTrash } from "react-icons/hi"; import { RiArrowDropDownLine } from "react-icons/ri"; -import Tooltip from "./ToolTip"; +import Tooltip from "../ToolTip"; import Link from "next/link"; -function CaretakerTable({ columns, data, onDelete }: any) { +function CaretakerTable({props}: any) { + if (!props) { + return <>; + } + + const { columns, data, onDelete } = props; const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = useTable({ columns, data, }); - const [open, setOpen] = React.useState(Array(data.length).fill(false)); const metadata = { - Address: "address", + "Address": "address", "Pref. Communication": "prefferedCommunication", "Child Name": "childName", "Household Info": "houseHoldInfo", diff --git a/web/components/tables/PaginatedTable.tsx b/web/components/tables/PaginatedTable.tsx new file mode 100644 index 00000000..39dbc4b2 --- /dev/null +++ b/web/components/tables/PaginatedTable.tsx @@ -0,0 +1,23 @@ +import React from "react"; +import Pagination from "@components/molecules/Pagination/Pagination"; +import CaretakerTable from "@components/tables/CaretakerTable"; +import BabiesTable from "@components/tables/BabiesTable"; +import { BABIES_TAB, CAREGIVERS_TAB } from "@lib/utils/consts"; + +export default function PaginatedTable({type, tableProps, paginatedProps, onNextPage, onPrevPage}: any) { + return ( +
+
+ {(type == BABIES_TAB) ? : + (type == CAREGIVERS_TAB)? : <>} +
+
+ +
+
) +} diff --git a/web/db/actions/admin/Baby.ts b/web/db/actions/admin/Baby.ts index 659bcc21..c2052bef 100644 --- a/web/db/actions/admin/Baby.ts +++ b/web/db/actions/admin/Baby.ts @@ -7,47 +7,30 @@ import { serverTimestamp, updateDoc, query, - Timestamp, } from "firebase/firestore"; import { Baby } from "@lib/types/baby"; -import { encrypt } from "@lib/utils/encryption"; import { db } from "db/firebase"; +import { PaginationInfoType, PaginationReferencesType } from "@lib/types/common"; +import { BABIES_COLLECTION_PATH, CAREGIVERS_COLLECTION_PATH } from "db/consts"; +import { getQueryConstraintsFromPagination } from "@lib/utils/pagination"; +import getBabiesFromBabyDocs from "@lib/utils/baby"; -export async function getBabies() { - const itemsRef = query(collection(db, "babies")); - const babyDocs = await getDocs(itemsRef); - - const babies = await Promise.all( - babyDocs?.docs.map(async (babyDoc: any) => { - const data = babyDoc.data() as Baby; - - const dobDate = new Timestamp( - data.dob.seconds, - data.dob.nanoseconds - ).toDate(); +const path = BABIES_COLLECTION_PATH; +const caregiverPath = CAREGIVERS_COLLECTION_PATH; - const { iv, content } = encrypt(babyDoc.id); - - return { - id: babyDoc.id, - firstName: data.firstName, - lastName: data.lastName, - name: data?.firstName ?? "" + " " + data?.lastName ?? "", - motherName: data?.motherName || null, - birthday: dobDate?.toLocaleDateString("en-us") || null, - sex: data?.sex || null, - babyBook: `/admin/book/${content}?iv=${iv}`, - }; - }) - ); - - return babies; +export async function getBabyPage(pageNumber: number, paginationReferences: PaginationReferencesType) { + const constraints = getQueryConstraintsFromPagination(path, pageNumber, paginationReferences); + const itemsRef = query(collection(db, path), ...constraints); + const babyDocs = await getDocs(itemsRef); + const babies = await getBabiesFromBabyDocs(babyDocs); + const paginationInfo: PaginationInfoType = {pageNumber: pageNumber, startAfter: babyDocs?.docs[babies.length - 1]} + return {data: babies, paginationInfo: paginationInfo}; } export async function getCaregiversInfo() { - const q = query(collection(db, "caregivers")); + const q = query(collection(db, caregiverPath)); const res = await getDocs(q); const caregivers = res.docs.map((doc) => ({ @@ -61,10 +44,10 @@ export async function getCaregiversInfo() { export const addNewChild = async (child: Baby) => { let caretakerRef = null; if (child.caretakerID) { - caretakerRef = doc(db, "caregivers", child.caretakerID); + caretakerRef = doc(db, caregiverPath, child.caretakerID); } - const newBaby = await addDoc(collection(db, "babies"), { + const newBaby = await addDoc(collection(db, path), { ...child, dob: child.dob, createdAt: serverTimestamp(), @@ -83,10 +66,10 @@ export const editBaby = async (baby: any) => { // TODO find out why deleting baby.id and if needed const babyID = baby.id; delete baby.id; - await updateDoc(doc(db, "babies", babyID), baby); + await updateDoc(doc(db, path, babyID), baby); }; export const deleteBaby = async (baby: any) => { const babyID = baby.id; - await deleteDoc(doc(db, "babies", babyID)); + await deleteDoc(doc(db, path, babyID)); }; diff --git a/web/db/actions/admin/Caregiver.ts b/web/db/actions/admin/Caregiver.ts index b100f2ba..9b28e3c5 100644 --- a/web/db/actions/admin/Caregiver.ts +++ b/web/db/actions/admin/Caregiver.ts @@ -2,52 +2,39 @@ import { doc, deleteDoc, collection, - getDoc, getDocs, query, } from "firebase/firestore"; -import { formatPhoneNumber } from "@lib/utils/contactInfo"; import { db } from "db/firebase"; -import { CaregiverDisplay } from "pages/admin/caregivers"; +import { PaginationInfoType, PaginationReferencesType } from "@lib/types/common"; +import { getQueryConstraintsFromPagination } from "@lib/utils/pagination"; +import { CAREGIVERS_COLLECTION_PATH } from "db/consts"; +import getCaregiversFromCaregiverDocs from "@lib/utils/caregiver"; + +const path = CAREGIVERS_COLLECTION_PATH; export async function getCaregivers() { - const itemsRef = query(collection(db, "caregivers")); + const itemsRef = query(collection(db, path)); const caregiverDocs = await getDocs(itemsRef); - const caregivers: Partial[] = []; - - // TODO update for multiple children - caregiverDocs.forEach(async (doc) => { - const data = doc.data(); - const child: any = data.baby ? (await getDoc(data.baby)).data() : null; - caregivers.push({ - id: doc.id, - name: data.firstName + " " + data.lastName, - email: data.email || "N/A", - phone: (data.phoneNumber && formatPhoneNumber(data.phoneNumber)) || "N/A", - registeredDate: data.createdAt - ? data.createdAt.toDate().toLocaleDateString() - : null, - assigned: child ? true : false, - address: `${data.address}, ${ - data.apartment ? `${data.apartment}, ` : "" - }${data.city}, ${data.state}`, - prefferedCommunication: data.prefferedCommunication || "N/A", - childName: child ? child.firstName + " " + child.lastName : null, - houseHoldInfo: `${data.numAdults} adults, ${data.numChildren} children`, - // liabilityWaiver: data.signedWaivers?.at(-1).id || null, - liabilityWaiver: "", - }); - }); - - // TODO catch errors + const caregivers = await getCaregiversFromCaregiverDocs(caregiverDocs); return caregivers; } + +export async function getCaregiverPage(pageNumber: number, paginationReferences: PaginationReferencesType) { + const constraints = getQueryConstraintsFromPagination(path, pageNumber, paginationReferences) + const itemsRef = query(collection(db, path), ...constraints); + const caregiverDocs = await getDocs(itemsRef); + const caregivers = await getCaregiversFromCaregiverDocs(caregiverDocs); + const paginationInfo: PaginationInfoType = {pageNumber: pageNumber, startAfter: caregiverDocs?.docs[caregivers.length - 1]} + return {data: caregivers, paginationInfo: paginationInfo}; +} + export const deleteCaretaker = async (caretakerID: string) => { // TODO catch errors - await deleteDoc(doc(db, "caregivers", caretakerID)); + await deleteDoc(doc(db, path, caretakerID)); }; diff --git a/web/db/consts.ts b/web/db/consts.ts new file mode 100644 index 00000000..05668143 --- /dev/null +++ b/web/db/consts.ts @@ -0,0 +1,11 @@ +import { CollectionPath } from "@lib/types/db"; + +export const BABIES_COLLECTION_PATH = 'babies'; +export const CAREGIVERS_COLLECTION_PATH = 'caregivers'; + +export const PAGINATION_PAGE_SIZE = 5; + +export const COLLECTION_ORDER_KEYS: Record = { + [BABIES_COLLECTION_PATH]: 'firstName', + [CAREGIVERS_COLLECTION_PATH]: 'firstName' +} \ No newline at end of file diff --git a/web/db/firebase/getSize.ts b/web/db/firebase/getSize.ts new file mode 100644 index 00000000..d92c393d --- /dev/null +++ b/web/db/firebase/getSize.ts @@ -0,0 +1,19 @@ +import { collection } from "firebase/firestore"; +import { db } from "."; +import { getCountFromServer } from "@firebase/firestore"; +import { GenericDatabaseErrorException, PathNotFoundError } from "@lib/exceptions/DatabaseExceptions"; +import { CollectionPath } from "@lib/types/db"; + + +export async function getTotalRecords(path: CollectionPath) { + try { + const coll = collection(db, path); + const snapshot = await getCountFromServer(coll); + return snapshot.data().count; + } catch (e) { + if (e instanceof Error && e.message.includes("path")) { + throw new PathNotFoundError(path); + } + throw new GenericDatabaseErrorException(); + } +} \ No newline at end of file diff --git a/web/lib/consts.ts b/web/lib/consts.ts new file mode 100644 index 00000000..e73dd29b --- /dev/null +++ b/web/lib/consts.ts @@ -0,0 +1,10 @@ +export enum HTTP_STATUS_CODE { + BAD_REQUEST = 400, + OK = 200, + CREATED = 201, + UNAUTHORIZED = 401, + FORBIDDEN = 403, + NOT_FOUND = 404, + METHOD_NOT_ALLOWED = 405, + INTERNAL_SERVER_ERROR = 500, +} \ No newline at end of file diff --git a/web/lib/exceptions/DatabaseExceptions.ts b/web/lib/exceptions/DatabaseExceptions.ts new file mode 100644 index 00000000..99edff3e --- /dev/null +++ b/web/lib/exceptions/DatabaseExceptions.ts @@ -0,0 +1,21 @@ +import { HTTP_STATUS_CODE } from "../consts"; + +export abstract class DatabaseException extends Error { + code: HTTP_STATUS_CODE; + constructor(message: string, code: HTTP_STATUS_CODE) { + super(message); + this.code = code; + } +} + +export class GenericDatabaseErrorException extends DatabaseException { + constructor(message = "An error has occurred") { + super(message, HTTP_STATUS_CODE.INTERNAL_SERVER_ERROR); + } +} + +export class PathNotFoundError extends DatabaseException { + constructor(path: string) { + super(`Path not found: ${path}`, HTTP_STATUS_CODE.INTERNAL_SERVER_ERROR); + } +} \ No newline at end of file diff --git a/web/lib/types/common.ts b/web/lib/types/common.ts index 67feb765..a8320399 100644 --- a/web/lib/types/common.ts +++ b/web/lib/types/common.ts @@ -1,4 +1,5 @@ -import { Timestamp } from "firebase/firestore"; +import { DocumentData, QueryDocumentSnapshot, Timestamp } from "firebase/firestore"; +import { BABIES_TAB, CAREGIVERS_TAB } from "@lib/utils/consts"; export interface User { name: string; @@ -19,3 +20,12 @@ export type AuthFormValues = { email: string; password: string; }; + +export interface PaginationInfoType { + pageNumber: number, + startAfter: QueryDocumentSnapshot +} + +export type PaginationReferencesType = Map>; + +export type TabType = typeof BABIES_TAB | typeof CAREGIVERS_TAB; \ No newline at end of file diff --git a/web/lib/types/db.ts b/web/lib/types/db.ts new file mode 100644 index 00000000..05c4a2b6 --- /dev/null +++ b/web/lib/types/db.ts @@ -0,0 +1,6 @@ +import { BABIES_COLLECTION_PATH, CAREGIVERS_COLLECTION_PATH } from "db/consts" +import { DocumentData, QuerySnapshot } from "firebase/firestore"; + +export type CollectionPath = typeof BABIES_COLLECTION_PATH | typeof CAREGIVERS_COLLECTION_PATH; + +export type FBDocs = QuerySnapshot; \ No newline at end of file diff --git a/web/lib/utils/baby.ts b/web/lib/utils/baby.ts new file mode 100644 index 00000000..7d945a71 --- /dev/null +++ b/web/lib/utils/baby.ts @@ -0,0 +1,32 @@ +import { Timestamp } from "@firebase/firestore"; +import { encrypt } from "./encryption"; +import { Baby } from "@lib/types/baby"; +import { FBDocs } from "@lib/types/db"; + +export default async function getBabiesFromBabyDocs(babyDocs: FBDocs) { + const babies = await Promise.all( + babyDocs?.docs.map((babyDoc) => { + const data = babyDoc.data() as Baby; + + const dobDate = new Timestamp( + data.dob.seconds, + data.dob.nanoseconds + ).toDate(); + + const { iv, content } = encrypt(babyDoc.id); + + return { + id: babyDoc.id, + firstName: data.firstName, + lastName: data.lastName, + name: data?.firstName ?? "" + " " + data?.lastName ?? "", + motherName: data?.motherName || null, + birthday: dobDate?.toLocaleDateString("en-us") || null, + sex: data?.sex || null, + babyBook: `/admin/book/${content}?iv=${iv}`, + }; + }) + ); + + return babies; +} \ No newline at end of file diff --git a/web/lib/utils/caregiver.ts b/web/lib/utils/caregiver.ts new file mode 100644 index 00000000..050f654a --- /dev/null +++ b/web/lib/utils/caregiver.ts @@ -0,0 +1,34 @@ +import { getDoc } from "firebase/firestore"; +import { formatPhoneNumber } from "./contactInfo"; +import { FBDocs } from "@lib/types/db"; + +export default async function getCaregiversFromCaregiverDocs(caregiverDocs: FBDocs) { + + // TODO update for multiple children + const caregivers = await Promise.all( + caregiverDocs?.docs.map(async (doc) => { + const data = doc.data(); + const child: any = data.baby ? (await getDoc(data.baby)).data() : null; + return { + id: doc.id, + name: data.firstName + " " + data.lastName, + email: data.email || "N/A", + phone: (data.phoneNumber && formatPhoneNumber(data.phoneNumber)) || "N/A", + registeredDate: data.createdAt + ? data.createdAt.toDate().toLocaleDateString() + : null, + assigned: child ? true : false, + address: `${data.address}, ${ + data.apartment ? `${data.apartment}, ` : "" + }${data.city}, ${data.state}`, + prefferedCommunication: data.prefferedCommunication || "N/A", + childName: child ? child.firstName + " " + child.lastName : null, + houseHoldInfo: `${data.numAdults} adults, ${data.numChildren} children`, + // liabilityWaiver: data.signedWaivers?.at(-1).id || null, + liabilityWaiver: "", + } + }) + ); + + return caregivers; +} \ No newline at end of file diff --git a/web/lib/utils/consts.ts b/web/lib/utils/consts.ts new file mode 100644 index 00000000..d3a19fbb --- /dev/null +++ b/web/lib/utils/consts.ts @@ -0,0 +1,2 @@ +export const BABIES_TAB = "babies"; +export const CAREGIVERS_TAB = "caregivers"; \ No newline at end of file diff --git a/web/lib/utils/contactInfo.ts b/web/lib/utils/contactInfo.ts index f6294819..749dd81e 100644 --- a/web/lib/utils/contactInfo.ts +++ b/web/lib/utils/contactInfo.ts @@ -1,5 +1,5 @@ export const isValidEmail = (email: string) => { - /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email); + /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(email); }; export const isValidPhoneNumber = (phone: string) => { diff --git a/web/lib/utils/pagination.ts b/web/lib/utils/pagination.ts new file mode 100644 index 00000000..c573571a --- /dev/null +++ b/web/lib/utils/pagination.ts @@ -0,0 +1,19 @@ +import { CollectionPath } from "@lib/types/db"; +import { COLLECTION_ORDER_KEYS, PAGINATION_PAGE_SIZE } from "db/consts"; +import { limit, orderBy, QueryConstraint, startAfter } from "firebase/firestore"; + +export function getQueryConstraintsFromPagination(path: CollectionPath, pageNumber: number, paginationReferences: Map): QueryConstraint[] { + const constraints: QueryConstraint[] = [ + orderBy(COLLECTION_ORDER_KEYS[path]), + limit(PAGINATION_PAGE_SIZE) + ]; + + if (pageNumber != 1 && paginationReferences) { + const prevPage = paginationReferences.get(pageNumber - 1); + if (prevPage?.startAfter) { + constraints.push(startAfter(prevPage.startAfter)); + } + } + + return constraints; +} diff --git a/web/package-lock.json b/web/package-lock.json index 6830dd5a..878a4634 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -11,7 +11,7 @@ "@types/react-icons": "^3.0.0", "autoprefixer": "^10.4.2", "crypto": "^1.0.1", - "firebase": "^9.6.4", + "firebase": "^9.23.0", "firebase-admin": "^11.2.0", "firebase-functions": "^4.0.2", "jszip": "^3.10.1", @@ -382,13 +382,14 @@ } }, "node_modules/@firebase/analytics": { - "version": "0.8.0", - "license": "Apache-2.0", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@firebase/analytics/-/analytics-0.10.0.tgz", + "integrity": "sha512-Locv8gAqx0e+GX/0SI3dzmBY5e9kjVDtD+3zCFLJ0tH2hJwuCAiL+5WkHuxKj92rqQj/rvkBUCfA1ewlX2hehg==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/installations": "0.5.12", - "@firebase/logger": "0.3.3", - "@firebase/util": "1.6.3", + "@firebase/component": "0.6.4", + "@firebase/installations": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" }, "peerDependencies": { @@ -396,41 +397,87 @@ } }, "node_modules/@firebase/analytics-compat": { - "version": "0.1.13", - "license": "Apache-2.0", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@firebase/analytics-compat/-/analytics-compat-0.2.6.tgz", + "integrity": "sha512-4MqpVLFkGK7NJf/5wPEEP7ePBJatwYpyjgJ+wQHQGHfzaCDgntOnl9rL2vbVGGKCnRqWtZDIWhctB86UWXaX2Q==", "dependencies": { - "@firebase/analytics": "0.8.0", - "@firebase/analytics-types": "0.7.0", - "@firebase/component": "0.5.17", - "@firebase/util": "1.6.3", + "@firebase/analytics": "0.10.0", + "@firebase/analytics-types": "0.8.0", + "@firebase/component": "0.6.4", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" }, "peerDependencies": { "@firebase/app-compat": "0.x" } }, + "node_modules/@firebase/analytics-compat/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/analytics-compat/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/@firebase/analytics-types": { - "version": "0.7.0", - "license": "Apache-2.0" + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@firebase/analytics-types/-/analytics-types-0.8.0.tgz", + "integrity": "sha512-iRP+QKI2+oz3UAh4nPEq14CsEjrjD6a5+fuypjScisAh9kXKFvdJOZJDwk7kikLvWVLGEs9+kIUS4LPQV7VZVw==" + }, + "node_modules/@firebase/analytics/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/analytics/node_modules/@firebase/logger": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.4.0.tgz", + "integrity": "sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/analytics/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } }, "node_modules/@firebase/app": { - "version": "0.7.33", - "license": "Apache-2.0", + "version": "0.9.13", + "resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.9.13.tgz", + "integrity": "sha512-GfiI1JxJ7ecluEmDjPzseRXk/PX31hS7+tjgBopL7XjB2hLUdR+0FTMXy2Q3/hXezypDvU6or7gVFizDESrkXw==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/logger": "0.3.3", - "@firebase/util": "1.6.3", - "idb": "7.0.1", + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "idb": "7.1.1", "tslib": "^2.1.0" } }, "node_modules/@firebase/app-check": { - "version": "0.5.12", - "license": "Apache-2.0", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@firebase/app-check/-/app-check-0.8.0.tgz", + "integrity": "sha512-dRDnhkcaC2FspMiRK/Vbp+PfsOAEP6ZElGm9iGFJ9fDqHoPs0HOPn7dwpJ51lCFi1+2/7n5pRPGhqF/F03I97g==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/logger": "0.3.3", - "@firebase/util": "1.6.3", + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" }, "peerDependencies": { @@ -438,36 +485,115 @@ } }, "node_modules/@firebase/app-check-compat": { - "version": "0.2.12", - "license": "Apache-2.0", + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/@firebase/app-check-compat/-/app-check-compat-0.3.7.tgz", + "integrity": "sha512-cW682AxsyP1G+Z0/P7pO/WT2CzYlNxoNe5QejVarW2o5ZxeWSSPAiVEwpEpQR/bUlUmdeWThYTMvBWaopdBsqw==", "dependencies": { - "@firebase/app-check": "0.5.12", - "@firebase/app-check-types": "0.4.0", - "@firebase/component": "0.5.17", - "@firebase/logger": "0.3.3", - "@firebase/util": "1.6.3", + "@firebase/app-check": "0.8.0", + "@firebase/app-check-types": "0.5.0", + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" }, "peerDependencies": { "@firebase/app-compat": "0.x" } }, + "node_modules/@firebase/app-check-compat/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/app-check-compat/node_modules/@firebase/logger": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.4.0.tgz", + "integrity": "sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/app-check-compat/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/@firebase/app-check-interop-types": { - "version": "0.1.0", - "license": "Apache-2.0" + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@firebase/app-check-interop-types/-/app-check-interop-types-0.3.0.tgz", + "integrity": "sha512-xAxHPZPIgFXnI+vb4sbBjZcde7ZluzPPaSK7Lx3/nmuVk4TjZvnL8ONnkd4ERQKL8WePQySU+pRcWkh8rDf5Sg==" }, "node_modules/@firebase/app-check-types": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@firebase/app-check-types/-/app-check-types-0.5.0.tgz", + "integrity": "sha512-uwSUj32Mlubybw7tedRzR24RP8M8JUVR3NPiMk3/Z4bCmgEKTlQBwMXrehDAZ2wF+TsBq0SN1c6ema71U/JPyQ==" + }, + "node_modules/@firebase/app-check/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/app-check/node_modules/@firebase/logger": { "version": "0.4.0", - "license": "Apache-2.0" + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.4.0.tgz", + "integrity": "sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/app-check/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } }, "node_modules/@firebase/app-compat": { - "version": "0.1.34", - "license": "Apache-2.0", + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/@firebase/app-compat/-/app-compat-0.2.13.tgz", + "integrity": "sha512-j6ANZaWjeVy5zg6X7uiqh6lM6o3n3LD1+/SJFNs9V781xyryyZWXe+tmnWNWPkP086QfJoNkWN9pMQRqSG4vMg==", + "dependencies": { + "@firebase/app": "0.9.13", + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/app-compat/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/app-compat/node_modules/@firebase/logger": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.4.0.tgz", + "integrity": "sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/app-compat/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", "dependencies": { - "@firebase/app": "0.7.33", - "@firebase/component": "0.5.17", - "@firebase/logger": "0.3.3", - "@firebase/util": "1.6.3", "tslib": "^2.1.0" } }, @@ -475,15 +601,40 @@ "version": "0.7.0", "license": "Apache-2.0" }, + "node_modules/@firebase/app/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/app/node_modules/@firebase/logger": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.4.0.tgz", + "integrity": "sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/app/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/@firebase/auth": { - "version": "0.20.7", - "license": "Apache-2.0", + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/@firebase/auth/-/auth-0.23.2.tgz", + "integrity": "sha512-dM9iJ0R6tI1JczuGSxXmQbXAgtYie0K4WvKcuyuSTCu9V8eEDiz4tfa1sO3txsfvwg7nOY3AjoCyMYEdqZ8hdg==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/logger": "0.3.3", - "@firebase/util": "1.6.3", + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", "node-fetch": "2.6.7", - "selenium-webdriver": "4.1.2", "tslib": "^2.1.0" }, "peerDependencies": { @@ -491,21 +642,38 @@ } }, "node_modules/@firebase/auth-compat": { - "version": "0.2.20", - "license": "Apache-2.0", - "dependencies": { - "@firebase/auth": "0.20.7", - "@firebase/auth-types": "0.11.0", - "@firebase/component": "0.5.17", - "@firebase/util": "1.6.3", + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@firebase/auth-compat/-/auth-compat-0.4.2.tgz", + "integrity": "sha512-Q30e77DWXFmXEt5dg5JbqEDpjw9y3/PcP9LslDPR7fARmAOTIY9MM6HXzm9KC+dlrKH/+p6l8g9ifJiam9mc4A==", + "dependencies": { + "@firebase/auth": "0.23.2", + "@firebase/auth-types": "0.12.0", + "@firebase/component": "0.6.4", + "@firebase/util": "1.9.3", "node-fetch": "2.6.7", - "selenium-webdriver": "4.1.2", "tslib": "^2.1.0" }, "peerDependencies": { "@firebase/app-compat": "0.x" } }, + "node_modules/@firebase/auth-compat/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/auth-compat/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/@firebase/auth-interop-types": { "version": "0.1.6", "license": "Apache-2.0", @@ -515,13 +683,39 @@ } }, "node_modules/@firebase/auth-types": { - "version": "0.11.0", - "license": "Apache-2.0", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@firebase/auth-types/-/auth-types-0.12.0.tgz", + "integrity": "sha512-pPwaZt+SPOshK8xNoiQlK5XIrS97kFYc3Rc7xmy373QsOJ9MmqXxLaYssP5Kcds4wd2qK//amx/c+A8O2fVeZA==", "peerDependencies": { "@firebase/app-types": "0.x", "@firebase/util": "1.x" } }, + "node_modules/@firebase/auth/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/auth/node_modules/@firebase/logger": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.4.0.tgz", + "integrity": "sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/auth/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/@firebase/component": { "version": "0.5.17", "license": "Apache-2.0", @@ -563,14 +757,14 @@ } }, "node_modules/@firebase/firestore": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-3.8.0.tgz", - "integrity": "sha512-aKwfZ73FmOV8e/dN0anDtrq6+1IhX4zmjxUcXcgaypZ14q6bq0QpUdlRxjsfiUQ5m3H3MwWWIFOcT5Xa89sIkw==", + "version": "3.13.0", + "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-3.13.0.tgz", + "integrity": "sha512-NwcnU+madJXQ4fbLkGx1bWvL612IJN/qO6bZ6dlPmyf7QRyu5azUosijdAN675r+bOOJxMtP1Bv981bHBXAbUg==", "dependencies": { - "@firebase/component": "0.6.0", + "@firebase/component": "0.6.4", "@firebase/logger": "0.4.0", - "@firebase/util": "1.8.0", - "@firebase/webchannel-wrapper": "0.9.0", + "@firebase/util": "1.9.3", + "@firebase/webchannel-wrapper": "0.10.1", "@grpc/grpc-js": "~1.7.0", "@grpc/proto-loader": "^0.6.13", "node-fetch": "2.6.7", @@ -584,59 +778,52 @@ } }, "node_modules/@firebase/firestore-compat": { - "version": "0.1.25", - "license": "Apache-2.0", - "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/firestore": "3.5.0", - "@firebase/firestore-types": "2.5.0", - "@firebase/util": "1.6.3", + "version": "0.3.12", + "resolved": "https://registry.npmjs.org/@firebase/firestore-compat/-/firestore-compat-0.3.12.tgz", + "integrity": "sha512-mazuNGAx5Kt9Nph0pm6ULJFp/+j7GSsx+Ncw1GrnKl+ft1CQ4q2LcUssXnjqkX2Ry0fNGqUzC1mfIUrk9bYtjQ==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/firestore": "3.13.0", + "@firebase/firestore-types": "2.5.1", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" }, "peerDependencies": { "@firebase/app-compat": "0.x" } }, - "node_modules/@firebase/firestore-compat/node_modules/@firebase/firestore": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-3.5.0.tgz", - "integrity": "sha512-ZwpZROpHDAwX4dvthkYv5WTqzWMPDNIVFWifDYpelWclsRN0cBxqLZPzh2wBtOWwMLIOoau7QIltzapqLZaScw==", + "node_modules/@firebase/firestore-compat/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/logger": "0.3.3", - "@firebase/util": "1.6.3", - "@firebase/webchannel-wrapper": "0.7.0", - "@grpc/grpc-js": "^1.3.2", - "@grpc/proto-loader": "^0.6.13", - "node-fetch": "2.6.7", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" - }, - "engines": { - "node": ">=10.10.0" - }, - "peerDependencies": { - "@firebase/app": "0.x" } }, - "node_modules/@firebase/firestore-compat/node_modules/@firebase/webchannel-wrapper": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@firebase/webchannel-wrapper/-/webchannel-wrapper-0.7.0.tgz", - "integrity": "sha512-4ACd/c6ushrLuhn0+yjB9hznhnsc2IML6pf0Ulb1Q7w8SvR1jNGPu/Y7i4kvOm6R+WJkMHwyy5z3i3gN+Tawug==" + "node_modules/@firebase/firestore-compat/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } }, "node_modules/@firebase/firestore-types": { - "version": "2.5.0", - "license": "Apache-2.0", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@firebase/firestore-types/-/firestore-types-2.5.1.tgz", + "integrity": "sha512-xG0CA6EMfYo8YeUxC8FeDzf6W3FX1cLlcAGBYV6Cku12sZRI81oWcu61RSKM66K6kUENP+78Qm8mvroBcm1whw==", "peerDependencies": { "@firebase/app-types": "0.x", "@firebase/util": "1.x" } }, "node_modules/@firebase/firestore/node_modules/@firebase/component": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.0.tgz", - "integrity": "sha512-9hyNc4OmrXMtthDJq6zyJHll/UIYBWYmMG3rXty2eMeWxHWB0vlsq3AOI+k14PL15aSBAQolv0EZJWVJv/gCEg==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", "dependencies": { - "@firebase/util": "1.8.0", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" } }, @@ -649,22 +836,23 @@ } }, "node_modules/@firebase/firestore/node_modules/@firebase/util": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.8.0.tgz", - "integrity": "sha512-clK6pTTxIiLMYz4UrvDTVAs2rIaOiroAuFdX67C0JalvEwzi6Vv8li6xAGj38tkj7Qax06mosM1fQkxf2h4VTg==", + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", "dependencies": { "tslib": "^2.1.0" } }, "node_modules/@firebase/functions": { - "version": "0.8.4", - "license": "Apache-2.0", - "dependencies": { - "@firebase/app-check-interop-types": "0.1.0", - "@firebase/auth-interop-types": "0.1.6", - "@firebase/component": "0.5.17", - "@firebase/messaging-interop-types": "0.1.0", - "@firebase/util": "1.6.3", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@firebase/functions/-/functions-0.10.0.tgz", + "integrity": "sha512-2U+fMNxTYhtwSpkkR6WbBcuNMOVaI7MaH3cZ6UAeNfj7AgEwHwMIFLPpC13YNZhno219F0lfxzTAA0N62ndWzA==", + "dependencies": { + "@firebase/app-check-interop-types": "0.3.0", + "@firebase/auth-interop-types": "0.2.1", + "@firebase/component": "0.6.4", + "@firebase/messaging-interop-types": "0.2.0", + "@firebase/util": "1.9.3", "node-fetch": "2.6.7", "tslib": "^2.1.0" }, @@ -673,29 +861,71 @@ } }, "node_modules/@firebase/functions-compat": { - "version": "0.2.4", - "license": "Apache-2.0", - "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/functions": "0.8.4", - "@firebase/functions-types": "0.5.0", - "@firebase/util": "1.6.3", + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@firebase/functions-compat/-/functions-compat-0.3.5.tgz", + "integrity": "sha512-uD4jwgwVqdWf6uc3NRKF8cSZ0JwGqSlyhPgackyUPe+GAtnERpS4+Vr66g0b3Gge0ezG4iyHo/EXW/Hjx7QhHw==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/functions": "0.10.0", + "@firebase/functions-types": "0.6.0", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" }, "peerDependencies": { "@firebase/app-compat": "0.x" } }, + "node_modules/@firebase/functions-compat/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/functions-compat/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/@firebase/functions-types": { - "version": "0.5.0", - "license": "Apache-2.0" + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@firebase/functions-types/-/functions-types-0.6.0.tgz", + "integrity": "sha512-hfEw5VJtgWXIRf92ImLkgENqpL6IWpYaXVYiRkFY1jJ9+6tIhWM7IzzwbevwIIud/jaxKVdRzD7QBWfPmkwCYw==" + }, + "node_modules/@firebase/functions/node_modules/@firebase/auth-interop-types": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@firebase/auth-interop-types/-/auth-interop-types-0.2.1.tgz", + "integrity": "sha512-VOaGzKp65MY6P5FI84TfYKBXEPi6LmOCSMMzys6o2BN2LOsqy7pCuZCup7NYnfbk5OkkQKzvIfHOzTm0UDpkyg==" + }, + "node_modules/@firebase/functions/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/functions/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } }, "node_modules/@firebase/installations": { - "version": "0.5.12", - "license": "Apache-2.0", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/installations/-/installations-0.6.4.tgz", + "integrity": "sha512-u5y88rtsp7NYkCHC3ElbFBrPtieUybZluXyzl7+4BsIz4sqb4vSAuwHEUgCgCeaQhvsnxDEU6icly8U9zsJigA==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/util": "1.6.3", + "@firebase/component": "0.6.4", + "@firebase/util": "1.9.3", "idb": "7.0.1", "tslib": "^2.1.0" }, @@ -704,26 +934,67 @@ } }, "node_modules/@firebase/installations-compat": { - "version": "0.1.12", - "license": "Apache-2.0", + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@firebase/installations-compat/-/installations-compat-0.2.4.tgz", + "integrity": "sha512-LI9dYjp0aT9Njkn9U4JRrDqQ6KXeAmFbRC0E7jI7+hxl5YmRWysq5qgQl22hcWpTk+cm3es66d/apoDU/A9n6Q==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/installations": "0.5.12", - "@firebase/installations-types": "0.4.0", - "@firebase/util": "1.6.3", + "@firebase/component": "0.6.4", + "@firebase/installations": "0.6.4", + "@firebase/installations-types": "0.5.0", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" }, "peerDependencies": { "@firebase/app-compat": "0.x" } }, + "node_modules/@firebase/installations-compat/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/installations-compat/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/@firebase/installations-types": { - "version": "0.4.0", - "license": "Apache-2.0", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@firebase/installations-types/-/installations-types-0.5.0.tgz", + "integrity": "sha512-9DP+RGfzoI2jH7gY4SlzqvZ+hr7gYzPODrbzVD82Y12kScZ6ZpRg/i3j6rleto8vTFC8n6Len4560FnV1w2IRg==", "peerDependencies": { "@firebase/app-types": "0.x" } }, + "node_modules/@firebase/installations/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/installations/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/installations/node_modules/idb": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/idb/-/idb-7.0.1.tgz", + "integrity": "sha512-UUxlE7vGWK5RfB/fDwEGgRf84DY/ieqNha6msMV99UsEMQhJ1RwbCd8AYBj3QMgnE3VZnfQvm4oKVCJTYlqIgg==" + }, "node_modules/@firebase/logger": { "version": "0.3.3", "license": "Apache-2.0", @@ -732,13 +1003,14 @@ } }, "node_modules/@firebase/messaging": { - "version": "0.9.16", - "license": "Apache-2.0", - "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/installations": "0.5.12", - "@firebase/messaging-interop-types": "0.1.0", - "@firebase/util": "1.6.3", + "version": "0.12.4", + "resolved": "https://registry.npmjs.org/@firebase/messaging/-/messaging-0.12.4.tgz", + "integrity": "sha512-6JLZct6zUaex4g7HI3QbzeUrg9xcnmDAPTWpkoMpd/GoSVWH98zDoWXMGrcvHeCAIsLpFMe4MPoZkJbrPhaASw==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/installations": "0.6.4", + "@firebase/messaging-interop-types": "0.2.0", + "@firebase/util": "1.9.3", "idb": "7.0.1", "tslib": "^2.1.0" }, @@ -747,30 +1019,72 @@ } }, "node_modules/@firebase/messaging-compat": { - "version": "0.1.16", - "license": "Apache-2.0", + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@firebase/messaging-compat/-/messaging-compat-0.2.4.tgz", + "integrity": "sha512-lyFjeUhIsPRYDPNIkYX1LcZMpoVbBWXX4rPl7c/rqc7G+EUea7IEtSt4MxTvh6fDfPuzLn7+FZADfscC+tNMfg==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/messaging": "0.9.16", - "@firebase/util": "1.6.3", + "@firebase/component": "0.6.4", + "@firebase/messaging": "0.12.4", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" }, "peerDependencies": { "@firebase/app-compat": "0.x" } }, + "node_modules/@firebase/messaging-compat/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/messaging-compat/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/@firebase/messaging-interop-types": { - "version": "0.1.0", - "license": "Apache-2.0" + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@firebase/messaging-interop-types/-/messaging-interop-types-0.2.0.tgz", + "integrity": "sha512-ujA8dcRuVeBixGR9CtegfpU4YmZf3Lt7QYkcj693FFannwNuZgfAYaTmbJ40dtjB81SAu6tbFPL9YLNT15KmOQ==" + }, + "node_modules/@firebase/messaging/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/messaging/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/messaging/node_modules/idb": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/idb/-/idb-7.0.1.tgz", + "integrity": "sha512-UUxlE7vGWK5RfB/fDwEGgRf84DY/ieqNha6msMV99UsEMQhJ1RwbCd8AYBj3QMgnE3VZnfQvm4oKVCJTYlqIgg==" }, "node_modules/@firebase/performance": { - "version": "0.5.12", - "license": "Apache-2.0", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/performance/-/performance-0.6.4.tgz", + "integrity": "sha512-HfTn/bd8mfy/61vEqaBelNiNnvAbUtME2S25A67Nb34zVuCSCRIX4SseXY6zBnOFj3oLisaEqhVcJmVPAej67g==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/installations": "0.5.12", - "@firebase/logger": "0.3.3", - "@firebase/util": "1.6.3", + "@firebase/component": "0.6.4", + "@firebase/installations": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" }, "peerDependencies": { @@ -778,32 +1092,85 @@ } }, "node_modules/@firebase/performance-compat": { - "version": "0.1.12", - "license": "Apache-2.0", + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@firebase/performance-compat/-/performance-compat-0.2.4.tgz", + "integrity": "sha512-nnHUb8uP9G8islzcld/k6Bg5RhX62VpbAb/Anj7IXs/hp32Eb2LqFPZK4sy3pKkBUO5wcrlRWQa6wKOxqlUqsg==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/logger": "0.3.3", - "@firebase/performance": "0.5.12", - "@firebase/performance-types": "0.1.0", - "@firebase/util": "1.6.3", + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/performance": "0.6.4", + "@firebase/performance-types": "0.2.0", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" }, "peerDependencies": { "@firebase/app-compat": "0.x" } }, + "node_modules/@firebase/performance-compat/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/performance-compat/node_modules/@firebase/logger": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.4.0.tgz", + "integrity": "sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/performance-compat/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/@firebase/performance-types": { - "version": "0.1.0", - "license": "Apache-2.0" + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@firebase/performance-types/-/performance-types-0.2.0.tgz", + "integrity": "sha512-kYrbr8e/CYr1KLrLYZZt2noNnf+pRwDq2KK9Au9jHrBMnb0/C9X9yWSXmZkFt4UIdsQknBq8uBB7fsybZdOBTA==" + }, + "node_modules/@firebase/performance/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/performance/node_modules/@firebase/logger": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.4.0.tgz", + "integrity": "sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/performance/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } }, "node_modules/@firebase/remote-config": { - "version": "0.3.11", - "license": "Apache-2.0", + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@firebase/remote-config/-/remote-config-0.4.4.tgz", + "integrity": "sha512-x1ioTHGX8ZwDSTOVp8PBLv2/wfwKzb4pxi0gFezS5GCJwbLlloUH4YYZHHS83IPxnua8b6l0IXUaWd0RgbWwzQ==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/installations": "0.5.12", - "@firebase/logger": "0.3.3", - "@firebase/util": "1.6.3", + "@firebase/component": "0.6.4", + "@firebase/installations": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" }, "peerDependencies": { @@ -811,30 +1178,83 @@ } }, "node_modules/@firebase/remote-config-compat": { - "version": "0.1.12", - "license": "Apache-2.0", + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@firebase/remote-config-compat/-/remote-config-compat-0.2.4.tgz", + "integrity": "sha512-FKiki53jZirrDFkBHglB3C07j5wBpitAaj8kLME6g8Mx+aq7u9P7qfmuSRytiOItADhWUj7O1JIv7n9q87SuwA==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/logger": "0.3.3", - "@firebase/remote-config": "0.3.11", - "@firebase/remote-config-types": "0.2.0", - "@firebase/util": "1.6.3", + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/remote-config": "0.4.4", + "@firebase/remote-config-types": "0.3.0", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" }, "peerDependencies": { "@firebase/app-compat": "0.x" } }, + "node_modules/@firebase/remote-config-compat/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/remote-config-compat/node_modules/@firebase/logger": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.4.0.tgz", + "integrity": "sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/remote-config-compat/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/@firebase/remote-config-types": { - "version": "0.2.0", - "license": "Apache-2.0" + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@firebase/remote-config-types/-/remote-config-types-0.3.0.tgz", + "integrity": "sha512-RtEH4vdcbXZuZWRZbIRmQVBNsE7VDQpet2qFvq6vwKLBIQRQR5Kh58M4ok3A3US8Sr3rubYnaGqZSurCwI8uMA==" + }, + "node_modules/@firebase/remote-config/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/remote-config/node_modules/@firebase/logger": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.4.0.tgz", + "integrity": "sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/remote-config/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } }, "node_modules/@firebase/storage": { - "version": "0.9.9", - "license": "Apache-2.0", + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/@firebase/storage/-/storage-0.11.2.tgz", + "integrity": "sha512-CtvoFaBI4hGXlXbaCHf8humajkbXhs39Nbh6MbNxtwJiCqxPy9iH3D3CCfXAvP0QvAAwmJUTK3+z9a++Kc4nkA==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/util": "1.6.3", + "@firebase/component": "0.6.4", + "@firebase/util": "1.9.3", "node-fetch": "2.6.7", "tslib": "^2.1.0" }, @@ -843,27 +1263,63 @@ } }, "node_modules/@firebase/storage-compat": { - "version": "0.1.17", - "license": "Apache-2.0", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@firebase/storage-compat/-/storage-compat-0.3.2.tgz", + "integrity": "sha512-wvsXlLa9DVOMQJckbDNhXKKxRNNewyUhhbXev3t8kSgoCotd1v3MmqhKKz93ePhDnhHnDs7bYHy+Qa8dRY6BXw==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/storage": "0.9.9", - "@firebase/storage-types": "0.6.0", - "@firebase/util": "1.6.3", + "@firebase/component": "0.6.4", + "@firebase/storage": "0.11.2", + "@firebase/storage-types": "0.8.0", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" }, "peerDependencies": { "@firebase/app-compat": "0.x" } }, + "node_modules/@firebase/storage-compat/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/storage-compat/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/@firebase/storage-types": { - "version": "0.6.0", - "license": "Apache-2.0", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@firebase/storage-types/-/storage-types-0.8.0.tgz", + "integrity": "sha512-isRHcGrTs9kITJC0AVehHfpraWFui39MPaU7Eo8QfWlqW7YPymBmRgjDrlOgFdURh6Cdeg07zmkLP5tzTKRSpg==", "peerDependencies": { "@firebase/app-types": "0.x", "@firebase/util": "1.x" } }, + "node_modules/@firebase/storage/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", + "dependencies": { + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/@firebase/storage/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/@firebase/util": { "version": "1.6.3", "license": "Apache-2.0", @@ -872,9 +1328,9 @@ } }, "node_modules/@firebase/webchannel-wrapper": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@firebase/webchannel-wrapper/-/webchannel-wrapper-0.9.0.tgz", - "integrity": "sha512-BpiZLBWdLFw+qFel9p3Zs1jD6QmH7Ii4aTDu6+vx8ShdidChZUXqDhYJly4ZjSgQh54miXbBgBrk0S+jTIh/Qg==" + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@firebase/webchannel-wrapper/-/webchannel-wrapper-0.10.1.tgz", + "integrity": "sha512-Dq5rYfEpdeel0bLVN+nfD1VWmzCkK+pJbSjIawGE+RY4+NIJqhbUDDQjvV0NUK84fMfwxvtFoCtEe70HfZjFcw==" }, "node_modules/@floating-ui/core": { "version": "1.6.7", @@ -2297,6 +2753,7 @@ }, "node_modules/balanced-match": { "version": "1.0.2", + "devOptional": true, "license": "MIT" }, "node_modules/base64-js": { @@ -2392,6 +2849,7 @@ }, "node_modules/brace-expansion": { "version": "1.1.11", + "devOptional": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -2642,6 +3100,7 @@ }, "node_modules/concat-map": { "version": "0.0.1", + "devOptional": true, "license": "MIT" }, "node_modules/content-disposition": { @@ -4065,35 +4524,36 @@ } }, "node_modules/firebase": { - "version": "9.10.0", - "license": "Apache-2.0", - "dependencies": { - "@firebase/analytics": "0.8.0", - "@firebase/analytics-compat": "0.1.13", - "@firebase/app": "0.7.33", - "@firebase/app-check": "0.5.12", - "@firebase/app-check-compat": "0.2.12", - "@firebase/app-compat": "0.1.34", - "@firebase/app-types": "0.7.0", - "@firebase/auth": "0.20.7", - "@firebase/auth-compat": "0.2.20", - "@firebase/database": "0.13.6", - "@firebase/database-compat": "0.2.6", - "@firebase/firestore": "3.5.0", - "@firebase/firestore-compat": "0.1.25", - "@firebase/functions": "0.8.4", - "@firebase/functions-compat": "0.2.4", - "@firebase/installations": "0.5.12", - "@firebase/installations-compat": "0.1.12", - "@firebase/messaging": "0.9.16", - "@firebase/messaging-compat": "0.1.16", - "@firebase/performance": "0.5.12", - "@firebase/performance-compat": "0.1.12", - "@firebase/remote-config": "0.3.11", - "@firebase/remote-config-compat": "0.1.12", - "@firebase/storage": "0.9.9", - "@firebase/storage-compat": "0.1.17", - "@firebase/util": "1.6.3" + "version": "9.23.0", + "resolved": "https://registry.npmjs.org/firebase/-/firebase-9.23.0.tgz", + "integrity": "sha512-/4lUVY0lUvBDIaeY1q6dUYhS8Sd18Qb9CgWkPZICUo9IXpJNCEagfNZXBBFCkMTTN5L5gx2Hjr27y21a9NzUcA==", + "dependencies": { + "@firebase/analytics": "0.10.0", + "@firebase/analytics-compat": "0.2.6", + "@firebase/app": "0.9.13", + "@firebase/app-check": "0.8.0", + "@firebase/app-check-compat": "0.3.7", + "@firebase/app-compat": "0.2.13", + "@firebase/app-types": "0.9.0", + "@firebase/auth": "0.23.2", + "@firebase/auth-compat": "0.4.2", + "@firebase/database": "0.14.4", + "@firebase/database-compat": "0.3.4", + "@firebase/firestore": "3.13.0", + "@firebase/firestore-compat": "0.3.12", + "@firebase/functions": "0.10.0", + "@firebase/functions-compat": "0.3.5", + "@firebase/installations": "0.6.4", + "@firebase/installations-compat": "0.2.4", + "@firebase/messaging": "0.12.4", + "@firebase/messaging-compat": "0.2.4", + "@firebase/performance": "0.6.4", + "@firebase/performance-compat": "0.2.4", + "@firebase/remote-config": "0.4.4", + "@firebase/remote-config-compat": "0.2.4", + "@firebase/storage": "0.11.2", + "@firebase/storage-compat": "0.3.2", + "@firebase/util": "1.9.3" } }, "node_modules/firebase-admin": { @@ -4153,31 +4613,75 @@ "@types/serve-static": "*" } }, - "node_modules/firebase/node_modules/@firebase/firestore": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-3.5.0.tgz", - "integrity": "sha512-ZwpZROpHDAwX4dvthkYv5WTqzWMPDNIVFWifDYpelWclsRN0cBxqLZPzh2wBtOWwMLIOoau7QIltzapqLZaScw==", + "node_modules/firebase/node_modules/@firebase/app-types": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@firebase/app-types/-/app-types-0.9.0.tgz", + "integrity": "sha512-AeweANOIo0Mb8GiYm3xhTEBVCmPwTYAu9Hcd2qSkLuga/6+j9b1Jskl5bpiSQWy9eJ/j5pavxj6eYogmnuzm+Q==" + }, + "node_modules/firebase/node_modules/@firebase/auth-interop-types": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@firebase/auth-interop-types/-/auth-interop-types-0.2.1.tgz", + "integrity": "sha512-VOaGzKp65MY6P5FI84TfYKBXEPi6LmOCSMMzys6o2BN2LOsqy7pCuZCup7NYnfbk5OkkQKzvIfHOzTm0UDpkyg==" + }, + "node_modules/firebase/node_modules/@firebase/component": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.6.4.tgz", + "integrity": "sha512-rLMyrXuO9jcAUCaQXCMjCMUsWrba5fzHlNK24xz5j2W6A/SRmK8mZJ/hn7V0fViLbxC0lPMtrK1eYzk6Fg03jA==", "dependencies": { - "@firebase/component": "0.5.17", - "@firebase/logger": "0.3.3", - "@firebase/util": "1.6.3", - "@firebase/webchannel-wrapper": "0.7.0", - "@grpc/grpc-js": "^1.3.2", - "@grpc/proto-loader": "^0.6.13", - "node-fetch": "2.6.7", + "@firebase/util": "1.9.3", "tslib": "^2.1.0" - }, - "engines": { - "node": ">=10.10.0" - }, - "peerDependencies": { - "@firebase/app": "0.x" } }, - "node_modules/firebase/node_modules/@firebase/webchannel-wrapper": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@firebase/webchannel-wrapper/-/webchannel-wrapper-0.7.0.tgz", - "integrity": "sha512-4ACd/c6ushrLuhn0+yjB9hznhnsc2IML6pf0Ulb1Q7w8SvR1jNGPu/Y7i4kvOm6R+WJkMHwyy5z3i3gN+Tawug==" + "node_modules/firebase/node_modules/@firebase/database": { + "version": "0.14.4", + "resolved": "https://registry.npmjs.org/@firebase/database/-/database-0.14.4.tgz", + "integrity": "sha512-+Ea/IKGwh42jwdjCyzTmeZeLM3oy1h0mFPsTy6OqCWzcu/KFqRAr5Tt1HRCOBlNOdbh84JPZC47WLU18n2VbxQ==", + "dependencies": { + "@firebase/auth-interop-types": "0.2.1", + "@firebase/component": "0.6.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "faye-websocket": "0.11.4", + "tslib": "^2.1.0" + } + }, + "node_modules/firebase/node_modules/@firebase/database-compat": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@firebase/database-compat/-/database-compat-0.3.4.tgz", + "integrity": "sha512-kuAW+l+sLMUKBThnvxvUZ+Q1ZrF/vFJ58iUY9kAcbX48U03nVzIF6Tmkf0p3WVQwMqiXguSgtOPIB6ZCeF+5Gg==", + "dependencies": { + "@firebase/component": "0.6.4", + "@firebase/database": "0.14.4", + "@firebase/database-types": "0.10.4", + "@firebase/logger": "0.4.0", + "@firebase/util": "1.9.3", + "tslib": "^2.1.0" + } + }, + "node_modules/firebase/node_modules/@firebase/database-types": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/@firebase/database-types/-/database-types-0.10.4.tgz", + "integrity": "sha512-dPySn0vJ/89ZeBac70T+2tWWPiJXWbmRygYv0smT5TfE3hDrQ09eKMF3Y+vMlTdrMWq7mUdYW5REWPSGH4kAZQ==", + "dependencies": { + "@firebase/app-types": "0.9.0", + "@firebase/util": "1.9.3" + } + }, + "node_modules/firebase/node_modules/@firebase/logger": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.4.0.tgz", + "integrity": "sha512-eRKSeykumZ5+cJPdxxJRgAC3G5NknY2GwEbKfymdnXtnT0Ucm4pspfR6GT4MUQEDuJwRVbVcSx85kgJulMoFFA==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/firebase/node_modules/@firebase/util": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.9.3.tgz", + "integrity": "sha512-DY02CRhOZwpzO36fHpuVysz6JZrscPiBXD0fXp6qSrL9oNOx5KWICKdR95C0lSITzxp0TZosVyHqzatE8JbcjA==", + "dependencies": { + "tslib": "^2.1.0" + } }, "node_modules/flat-cache": { "version": "3.0.4", @@ -4246,6 +4750,7 @@ }, "node_modules/fs.realpath": { "version": "1.0.0", + "devOptional": true, "license": "ISC" }, "node_modules/fsevents": { @@ -4365,6 +4870,7 @@ }, "node_modules/glob": { "version": "7.2.3", + "devOptional": true, "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", @@ -4858,8 +5364,9 @@ } }, "node_modules/idb": { - "version": "7.0.1", - "license": "ISC" + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz", + "integrity": "sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==" }, "node_modules/ignore": { "version": "5.3.2", @@ -4900,6 +5407,7 @@ }, "node_modules/inflight": { "version": "1.0.6", + "devOptional": true, "license": "ISC", "dependencies": { "once": "^1.3.0", @@ -5750,6 +6258,7 @@ }, "node_modules/minimatch": { "version": "3.1.2", + "devOptional": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -6067,6 +6576,7 @@ }, "node_modules/once": { "version": "1.4.0", + "devOptional": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -6165,6 +6675,7 @@ }, "node_modules/path-is-absolute": { "version": "1.0.1", + "devOptional": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -6852,6 +7363,7 @@ }, "node_modules/rimraf": { "version": "3.0.2", + "devOptional": true, "license": "ISC", "dependencies": { "glob": "^7.1.3" @@ -6928,18 +7440,6 @@ "object-assign": "^4.1.1" } }, - "node_modules/selenium-webdriver": { - "version": "4.1.2", - "license": "Apache-2.0", - "dependencies": { - "jszip": "^3.6.0", - "tmp": "^0.2.1", - "ws": ">=7.4.6" - }, - "engines": { - "node": ">= 10.15.0" - } - }, "node_modules/semver": { "version": "6.3.0", "dev": true, @@ -7369,6 +7869,7 @@ "node_modules/tmp": { "version": "0.2.1", "license": "MIT", + "optional": true, "dependencies": { "rimraf": "^3.0.0" }, @@ -7754,27 +8255,9 @@ }, "node_modules/wrappy": { "version": "1.0.2", + "devOptional": true, "license": "ISC" }, - "node_modules/ws": { - "version": "8.9.0", - "license": "MIT", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/xmlcreate": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", diff --git a/web/package.json b/web/package.json index 16ca1e3e..ed657731 100644 --- a/web/package.json +++ b/web/package.json @@ -14,7 +14,7 @@ "@types/react-icons": "^3.0.0", "autoprefixer": "^10.4.2", "crypto": "^1.0.1", - "firebase": "^9.6.4", + "firebase": "^9.23.0", "firebase-admin": "^11.2.0", "firebase-functions": "^4.0.2", "jszip": "^3.10.1", diff --git a/web/pages/admin/babies.tsx b/web/pages/admin/babies.tsx index b656ce07..86debf54 100644 --- a/web/pages/admin/babies.tsx +++ b/web/pages/admin/babies.tsx @@ -1,67 +1,59 @@ import { GetServerSideProps } from "next"; -import { useRouter } from "next/router"; import React, { useState } from "react"; import { FaPlus } from "react-icons/fa"; - -import { Baby } from "@lib/types/baby"; import { addNewChild, editBaby, deleteBaby, - getBabies, getCaregiversInfo, + getBabyPage, } from "db/actions/admin/Baby"; -import BabiesTable from "@components/BabiesTable"; +import PaginatedTable from "@components/tables/PaginatedTable"; import ButtonWithIcon from "@components/buttonWithIcon"; import Modal from "@components/modal"; import ChildModal from "@components/modals/addChildModal"; +import { usePaginatedData } from "@components/molecules/Pagination/PaginationHooks"; +import { BABIES_TAB } from "@lib/utils/consts"; + +const tab = BABIES_TAB; + +interface CaregiverInfo { + id: string; + name: string; +} -export default function genChildrenAndBabyBooksTab({ - babies, - caregivers, -}: { - babies: Baby[]; - caregivers: any[]; -}) { - const getData = () => babies; +export default function genChildrenAndBabyBooksTab(caregivers: CaregiverInfo[]) { + + const { data: babies, totalRecords, currPage, setCurrPage } = usePaginatedData(getBabyPage, tab); const columns = React.useMemo( () => [ - { - Header: "Name", - accessor: "name", - }, - { - Header: "Mother's Name", - accessor: "motherName", - }, - { - Header: "Date of Birth", - accessor: "birthday", - }, - { - Header: "Sex", - accessor: "sex", - }, - { - Header: "", - accessor: "babyBook", - }, + { Header: "Name", accessor: "name" }, + { Header: "Mother's Name", accessor: "motherName" }, + { Header: "Date of Birth", accessor: "birthday" }, + { Header: "Sex", accessor: "sex" }, + { Header: "", accessor: "babyBook" }, ], [] ); - const router = useRouter(); + const [addModal, toggleAddModal] = useState(false); - // TODO this doesn't work, need better way to update table after adding/deleting objects - const refreshData = () => { - router.replace(router.asPath); + const handleEdit = async (baby: any) => { + await editBaby(baby); + alert("Baby has been updated!"); + setCurrPage(1); }; - const data = React.useMemo(() => getData(), []); + const handleDelete = async (baby: any) => { + await deleteBaby(baby); + alert("Baby has been deleted!"); + setCurrPage(1); + }; - const [addModal, toggleAddModal] = useState(false); + const paginatedProps = {totalRecords: totalRecords, pageNumber: currPage} + const tableProps = {columns: columns, data: babies, onEdit: handleEdit, onDelete: handleDelete} return (
@@ -71,7 +63,7 @@ export default function genChildrenAndBabyBooksTab({

Children

- {babies.length + " Children"} + {totalRecords + " Children"}

@@ -83,23 +75,14 @@ export default function genChildrenAndBabyBooksTab({
- - editBaby(baby).then(() => { - toggleAddModal(false); - alert("Baby has been updated!"); - refreshData(); - }) - } - onDelete={(baby: any) => - deleteBaby(baby).then(() => { - alert("Baby has been deleted!"); - refreshData(); - }) - } - caretakers={caregivers} + setCurrPage(currPage + 1)} + onPrevPage={() => setCurrPage(currPage - 1)} />
@@ -114,7 +97,7 @@ export default function genChildrenAndBabyBooksTab({ addNewChild(baby).then(() => { toggleAddModal(false); alert(`${baby.firstName} ${baby.lastName} has been added!`); - refreshData(); + setCurrPage(1); }) } caretakers={caregivers} @@ -127,12 +110,10 @@ export default function genChildrenAndBabyBooksTab({ } export const getServerSideProps: GetServerSideProps = async (context) => { - const babies = await getBabies(); const caregivers = await getCaregiversInfo(); return { props: { - babies, caregivers, }, }; diff --git a/web/pages/admin/caregivers.tsx b/web/pages/admin/caregivers.tsx index e5916176..d8ed254d 100644 --- a/web/pages/admin/caregivers.tsx +++ b/web/pages/admin/caregivers.tsx @@ -1,98 +1,54 @@ -import { GetServerSideProps } from "next"; -import { useRouter } from "next/router"; - -import React, { useMemo, useState } from "react"; - -import { Caregiver } from "@lib/types/users"; -import { deleteCaretaker, getCaregivers } from "db/actions/admin/Caregiver"; - -import CaretakerTable from "@components/CaretakerTable"; - -export enum CommunicationType { - "N/A" = "N/A", - Email = "Email", - Text = "Text", - Phone = "Phone", -} - -export type CaregiverDisplay = Caregiver & { - name: string; - phone: string; - registeredDate?: Date; - assigned: boolean; - address: string; - prefferedCommunication: CommunicationType; - childName: string | null; - houseHoldInfo: string; - liabilityWaiver: string; -}; - -export default function genCaretakersTab({ - caregivers: caretakers, -}: { - caregivers: any[]; -}) { - const [caregivers, setCaretakers] = - useState[]>(caretakers); - - const columns = useMemo( - () => [ - { - Header: "Name", - accessor: "name", - }, - { - Header: "Email", - accessor: "email", - }, - { - Header: "Phone", - accessor: "phone", - }, - ], - [] - ); - - const data = React.useMemo(() => caregivers, [caregivers]); - - const router = useRouter(); - - const refreshData = () => { - router.replace(router.asPath); - }; - - return ( -
-
-
-
-
-

Caregivers

-

- {caregivers?.length + " People"} -

-
-
-
- - deleteCaretaker(caregiver.id).then(() => { - setCaretakers(caretakers.filter((c) => c.id !== caregiver.id)); - alert("Caretaker deleted"); - refreshData(); - }) - } - /> +import React from "react"; +import { deleteCaretaker, getCaregiverPage } from "db/actions/admin/Caregiver"; +import PaginatedTable from "@components/tables/PaginatedTable"; +import { usePaginatedData } from "@components/molecules/Pagination/PaginationHooks"; +import { CAREGIVERS_TAB } from "@lib/utils/consts"; + +const tab = CAREGIVERS_TAB; + +export default function genCaregiversTab() { + const { data: caretakers, totalRecords, currPage, setCurrPage } = usePaginatedData(getCaregiverPage, tab); + + const columns = React.useMemo(() => [ + { Header: "Name", accessor: "name" }, + { Header: "Email", accessor: "email" }, + { Header: "Phone", accessor: "phone" }, + ], []); + + const handleDelete = async (caregiver: any) => { + deleteCaretaker(caregiver.id).then(() => { + alert("Caretaker deleted"); + setCurrPage(1) + }) + }; + + const paginatedProps = {totalRecords: totalRecords, pageNumber: currPage} + const tableProps = {columns: columns, data: caretakers, onDelete: handleDelete} + + return ( +
+
+
+
+
+

Caregivers

+

+ {totalRecords + " People"} +

+
+
+
+ setCurrPage(currPage + 1)} + onPrevPage={() => setCurrPage(currPage - 1)} + /> +
-
- ); + ); } -export const getServerSideProps: GetServerSideProps = async (context) => { - const caregivers: Partial[] = await getCaregivers(); - return { props: { caregivers } }; -};