import { CollectionAPI } from "./api/collection"; import { CollectionsAPI } from "./api/collections"; import { PermissionsAPI } from "./api/permissions"; import { SocialAPI } from "./api/social"; import type { BazaarOptions, CollectionOptions, ContextOptions, Doc, LoginType } from "./types"; import { BazaarContext } from "./api/context"; /** * Types of errors that can return from the API */ export { ErrorTypes, BazaarError, isNoAppUserError, isNoPermissionError, arrayMirrorSubscribeListener, objectMirrorSubscribeListener, noSharingNotification, } from "./utils"; export { CollectionAPI } from "./api/collection"; export { CollectionsAPI } from "./api/collections"; export { PermissionsAPI } from "./api/permissions"; export { SocialAPI } from "./api/social"; export { BazaarContext } from "./api/context"; /** * Enums */ export { OrderByType, PermissionType, LoginType, SendNotification, GranteeType } from "./types"; export type { User, Contact, Team, Org, AnyPermission, UserPermission, GroupPermission, OrgPermission, Permission, NewPermission, PermissionTemplate, GrantedPermission, PermissionGroup, SharingNotification, FilterObject, FilterComparison, OrderBy, BazaarMessage, Link, Doc, AnyDoc, DeepPartial, SubscribeListener, BazaarOptions, CollectionOptions, ContextOptions, PermissionsQuery, LinksQuery, GrantedPermissionsQuery, CalendarInvite, EmailMessage, } from "./types"; /** * The primary class of the Bazaar JS SDK to help you more easily build web apps with Bazaar. */ export declare class BazaarApp { /** * Auth handles authentication and login */ private auth; /** * A wrapper of the low level Data API */ private api; /** * Access to the collections API */ collections: CollectionsAPI; /** * Access to the permissions API */ permissions: PermissionsAPI; /** * Access to the notifications API * @alpha */ private notifications; /** * Access to the social API */ social: SocialAPI; /** * Access to the organizations API * @alpha */ private orgs; /** * Access to the email API * @alpha */ private email; private bazaarUri; constructor(options: BazaarOptions); /** * Sets a callback function an app can run when it connects or re-connects to the API. */ onApiConnect(f: (bzr: BazaarApp) => Promise): void; /** * Sets a callback function an app can run when an API disconnection occurs. * * e.g. Invalid access token */ onApiConnectError(f: (bzr: BazaarApp, message: string) => Promise): void; /** * Sets a callback function an app can run a login error occurs. * * e.g. Authorization code is invalid */ onLoginError(f: (bzr: BazaarApp, message: string) => Promise): void; /** * Sets a callback function an app can run when a user has successfully logged in. * * e.g. Set state, redirect, etc. */ onLogin(f: (bzr: BazaarApp) => Promise): void; /** * Opens a pop-up window to perform OAuth login. * Will fallback to redirect login if pop-up fails to open, if `options.type` is not `popup` (meaning an app has explicitly opted out of falling back to redirect login) */ login(options?: { type?: LoginType; }): Promise; /** * Checks if the user is logged in. * i.e. if an access token is in local storage. */ isLoggedIn(): boolean; /** * Logs out a user. * Deletes the access token from local storage and reloads the page. */ logOut(): void; /** * Gets a collection interface (API access to the specified collection) * @param collectionName - The name of the collection to create the interface for. * @param collectionOptions - An optional object for specifying an onCreate hook. The onCreate hook sets up a collection when it is created (e.g., to set up permissions) */ collection(collectionName: string, collectionOptions?: CollectionOptions): CollectionAPI; createContext(options: ContextOptions): Promise; }