@veltdev/types
Version:
Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.
391 lines (356 loc) • 12.7 kB
TypeScript
// @ts-nocheck
import { Observable } from "rxjs";
import { Config, DisableLogsConfig } from "../models/data/config.data.model";
import { DocumentUser } from "../models/data/document-user.data.model";
import { Location } from "../models/data/location.model";
import { User, UserOptions, VeltAuthProvider, VeltPermissionProvider } from "../models/data/user.data.model";
import { CustomCss } from "../models/data/custom-css.data.model";
import { AreaElement } from "../models/element/area-element.model";
import { ArrowElement } from "../models/element/arrow-element.model";
import { CommentElement } from "../models/element/comment-element.model";
import { ContactElement } from "../models/element/contact-element.model";
import { CursorElement } from "../models/element/cursor-element.model";
import { LiveStateSyncElement } from "../models/element/live-state-sync-element.model";
import { PresenceElement } from "../models/element/presence-element.model";
import { RecorderElement } from "../models/element/recorder-element.model";
import { RewriterElement } from "../models/element/rewriter-element.model";
import { HuddleElement } from "../models/element/huddle-element.model";
import { SelectionElement } from "../models/element/selection-element.model";
import { ViewsElement } from "../models/element/views-element.model";
import { NotificationElement } from "../models/element/notification-element.model";
import { AutocompleteElement } from "../models/element/autocomplete-element.model";
import { TagElement } from "../models/element/tag-element.model";
import { FeatureType } from "../utils/enums";
import { UserContact } from "../models/data/user-contact.data.model";
import { DocumentMetadata } from "../models/data/document-metadata.model";
import { ReactionElement } from "../models/element/reaction-element.model";
import { CrdtElement } from "../models/element/crdt-element.model";
import { VeltEventMetadata, VeltDebugInfo } from "../models/data/event-metadata.data.model";
import { CoreEventTypesMap } from "../models/data/core-events.data.model";
import { Document, SetDocumentsRequestOptions, FetchDocumentsRequest, FetchFoldersRequest, UpdateDocumentsRequest, UpdateLocationsRequest } from "../models/data/document.data.model";
import { FetchDocumentsResponse, FetchFoldersResponse } from "../models/data/document-events.data.model";
import { UserDataProvider, GetUserPermissionsRequest, GetUserPermissionsResponse } from "../models/data/user-resolver.data.model";
import { VeltDataProvider } from "../models/data/provider.data.model";
import { VeltEncryptionProvider } from "../models/data/encryption-provider.data.model";
import { VeltResetButtonStateConfig } from "../models/data/button.data.model";
import { SetLocationsRequestOptions } from "../models/data/location.model";
export declare class Snippyly {
constructor();
initConfig: (apiKey: string, config?: Config) => void;
identify: (user: User, userOptions?: UserOptions) => Promise<unknown>;
setVeltAuthProvider: (veltAuthProvider: VeltAuthProvider) => Promise<User | null>;
/**
* Tell us who the currently logged in user is.
*
* Call whenever the user is updated: signs in, signs out, signs up etc.
* @deprecated This method is deprecated.
*/
updateUser: (user: User) => void;
/**
* Tell us the unique ID of the current document/resource on which you want to enable collaboration.
* @param id unique document ID
* @param documentMetadata Document Metadata
*/
setDocument: (id: string, documentMetadata?: DocumentMetadata) => Promise<void>;
/**
* Tell us the unique ID of the current document/resource on which you want to enable collaboration.
* @param id unique document ID
* @deprecated This method is deprecated. Use `setDocuments` method instead.
*/
setDocumentId: (id: string) => Promise<void>;
/**
* To set multiple documents
*/
setDocuments: (documents: Document[], options?: SetDocumentsRequestOptions) => Promise<void>;
/**
* To set the root document
* @param document Document object
*/
setRootDocument: (document: Document) => Promise<void>;
/**
* To unset the document id
* @deprecated This method is deprecated. Use `unsetDocuments` method instead.
*/
unsetDocumentId: () => void;
/**
* To unset the documents
*/
unsetDocuments: () => void;
/**
* To fetch documents
*/
fetchDocuments: (options?: FetchDocumentsRequest) => Promise<FetchDocumentsResponse>;
/**
* To update documents
*/
updateDocuments: (request: UpdateDocumentsRequest) => Promise<any>;
updateLocations: (request: UpdateLocationsRequest) => Promise<any>;
/**
* To fetch folders
*/
fetchFolders: (options?: FetchFoldersRequest) => Promise<FetchFoldersResponse>;
/**
* To set the user data provider.
*/
setUserDataProvider: (userDataProvider: UserDataProvider) => void;
/**
* To set the data provider.
*/
setDataProviders: (dataProvider: VeltDataProvider) => void;
setPermissionProvider: (permissionProvider: VeltPermissionProvider) => void;
/**
* To set the encryption provider.
*/
setEncryptionProvider: (encryptionProvider: VeltEncryptionProvider) => void;
/**
* Get Document ID
*/
getDocumentId: () => string;
/**
* Tell us the custom params of the current document/resource to identify sub document inside a document.
* @param params Location
* @param appendLocation Append location to existing location
*/
setLocation: (params: Location, appendLocation?: boolean) => Promise<void>;
/**
* To set the root location
* @param location Location object
*/
setRootLocation: (location: Location) => Promise<void>;
/**
* To set multiple locations
* @param locations Location objects
* @param options Set locations options
*/
setLocations: (locations: Location[], options?: SetLocationsRequestOptions) => Promise<void>;
/**
* To remove location from a User
* @param location Location
*/
removeLocation: (location?: Location) => void;
/**
* To remove multiple locations
* @param locations Location objects
*/
removeLocations: (locations?: Location[]) => void;
/**
* To remove location ids
* @param locationIds Location ids
*/
unsetLocationIds: (locationIds?: string[]) => void;
/**
* To exclude data of specific location ids
* @param ids Location Ids
*/
excludeLocationIds: (ids: string[]) => void;
/**
* Tell us the about the scrollable document ids to keep track on its scroll changes
* @param ids scrollable elements ids
*/
setScrollableElementsIds: (ids: string[]) => void;
/**
* To remove document params from a User
*/
removeScrollableElementsIds: () => void;
/**
* Get the Presence Element Object to access the raw presence data.
*
* This is for Pros who don't want to use Snippyly Presence web component and want to design their own UI.
*/
getPresenceElement: () => PresenceElement;
/**
* Get the Cursor Element Object to access the raw cursor data.
*
* This is for Pros who don't want to use Snippyly Presence web component and want to design their own UI.
*/
getCursorElement: () => CursorElement;
/**
* Get the Comment Element Object to access the raw comment data.
*
* This is for Pros who don't want to use Snippyly Comment web component and want to design their own UI.
*/
getCommentElement: () => CommentElement;
/**
* Get the Tag Pin Annotation Object to access the raw tag data.
*
* This is for Pros who don't want to use Snippyly Tag web component and want to design their own UI.
*/
getTagElement: () => TagElement;
/**
* Get the Selection Object to enable/disable the feature.
*/
getSelectionElement: () => SelectionElement;
/**
* Get the Recorder Object.
*/
getRecorderElement: () => RecorderElement;
/**
* Get the Contact Object.
*/
getContactElement: () => ContactElement;
/**
* Get the Rewriter Object.
*/
getRewriterElement: () => RewriterElement;
/**
* Get the Huddle element.
*/
getHuddleElement: () => HuddleElement;
/**
* Get the LiveStateSync Object.
*/
getLiveStateSyncElement: () => LiveStateSyncElement;
/**
* Get the Arrow Object.
*/
getArrowElement: () => ArrowElement;
/**
* Get the Views Object.
*/
getViewsElement: () => ViewsElement;
/**
* Get the Notification Object.
*/
getNotificationElement: () => NotificationElement;
/**
* Get the Autocomplete Object.
*/
getAutocompleteElement: () => AutocompleteElement;
/**
* Get the Area Object.
*/
getAreaElement: () => AreaElement;
/**
* Get the Area Object.
*/
getReactionElement: () => ReactionElement;
/**
* Get the CRDT Element Object.
*/
getCrdtElement: () => CrdtElement;
/**
* Get the metadata of the current resource.
*/
getMetadata: () => Promise<VeltEventMetadata | null>;
/**
* To fetch debug info.
*/
fetchDebugInfo: () => Promise<VeltDebugInfo | null>;
/**
* To subscribe to debug info.
*/
getDebugInfo: () => Observable<VeltDebugInfo | null>;
/**
* To signout a user
*/
signOutUser: () => any;
/**
* Provide a list of features to disable.
* Provide an empty array to enable all the features.
* @param features List of features
*/
disableFeatures: (features: Array<FeatureType>) => void;
/**
* Add location to show comments, tags, recorders etc. for provided location also.
* @param location Location object
* @deprecated This method is deprecated and will be removed in next release. Use `setLocation` method with `appendLocation: true` instead.
*/
addLocation: (location: any) => Promise<any>;
/**
* To set the dark mode of Velt components.
* @param value {boolean} true/false
*/
setDarkMode: (darkMode: boolean) => void;
/**
* To check if user allowed in provided document or not.
*/
isUserAllowed$: () => Observable<boolean>;
/**
* To get user.
*/
getUser: () => User | null;
/**
* To get user role in provided document.
*/
getUserRole$: () => Observable<string | null>;
/**
* To get user permissions.
*/
getUserPermissions: (request?: GetUserPermissionsRequest) => Promise<GetUserPermissionsResponse>;
/**
* To check if plan is expired or not.
*/
isPlanExpired$: () => Observable<boolean>;
/**
* To get if the Velt is initialized or not.
* @returns Observable<boolean | undefined>
*/
getVeltInitState: () => Observable<boolean | undefined>;
/**
* To remove velt specific content from provided html content.
*/
removeVeltContent: (htmlContent: string) => string;
/**
* To inject custom css.
*/
injectCustomCss: (customCss: CustomCss) => void;
/**
* To set the language.
* @param language Language code
*/
setLanguage: (language: string) => void;
/**
* To set translations for multiple languages
* @param translations Object containing translations for multiple languages
*/
setTranslations: (translations: { [language: string]: { [key: string]: string } }) => void;
/**
* To enable auto translation.
*/
enableAutoTranslation: () => void;
/**
* To disable auto translation.
*/
disableAutoTranslation: () => void;
/**
* To update user contact list.
*/
updateContactList: (userContacts: UserContact[], config?: { merge: boolean }) => void;
/**
* To get document metadata.
* @deprecated This method is deprecated. Use `fetchDocuments` method instead.
*/
getDocumentMetadata: () => Observable<DocumentMetadata | null>;
/**
* To subscribe to core actions
*/
on: <T extends keyof CoreEventTypesMap>(action: T) => Observable<CoreEventTypesMap[T]>;
/**
* To set the ui state.
*/
setUiState: <T extends object>(uiState: T) => void;
/**
* To get the ui state.
*/
getUiState: <T extends object>() => Observable<T>;
/**
* To enable logs.
*/
enableLogs: () => void;
/**
* To disable logs.
*/
disableLogs: (config?: DisableLogsConfig) => void;
/**
* To enable safe eval.
*/
enableSafeEval: () => void;
/**
* To disable safe eval.
*/
disableSafeEval: () => void;
/**
* To reset the button toggle map.
*/
resetVeltButtonState: (config?: VeltResetButtonStateConfig) => void;
}