import { AccountApi as EliceExternalContentsAccountApi, AiApi as EliceExternalAiApi, AuthApi as EliceExternalAuthApi, EspProxyApi as EliceExternalEspProxyApi } from "./apis"; import { EliceCDKAiChat } from './EliceCDKAiChat'; import { EliceCDKFilestore } from './EliceCDKFilestore'; import { EliceCDKKvstore } from './EliceCDKKvstore'; import { EliceCDKMaterialKvstore } from './EliceCDKMaterialKvstore'; import { EliceCDKNavigation } from './EliceCDKNavigation'; import { EliceCDKTranslation } from './EliceCDKTranslation'; import { EliceCDKTutoring } from './EliceCDKTutoring'; import type { AccountGetResponse, ProgressPostRequest } from "./apis"; interface InternalUseApiInstMap { account: EliceExternalContentsAccountApi; ai: EliceExternalAiApi; auth: EliceExternalAuthApi; espProxy: EliceExternalEspProxyApi; } /** * Configuration options for creating an EliceCDK instance. */ export interface EliceCDKOptions { /** * Base URL of the Elice external contents API server. * * @default 'https://api-external-contents.elice.io' */ baseUrl?: string; /** * Base URL of the Elice ESP proxy server. * * @default 'https://api-esp-proxy.elice.io' */ espProxyBaseUrl?: string; } /** * Options for SDK initialization. */ export interface EliceCDKInitOptions { /** * Query string containing initialization parameters (`extToken`, `courseId`, `materialId`, etc.). * If omitted, reads from `window.location.search`. * * @default window.location.search */ search?: string; } /** * Metadata identifying the current course and material (lecture page). */ export interface EliceCDKMetadata { courseId: number; materialId: number; } /** * User account information returned after SDK initialization. */ export type EliceCDKAccount = Omit & { /** * Legacy account identifier. * @deprecated Will be removed in v1.0.0. Use `uid` instead. */ accountId: string; /** * Indicates whether the current user is accessing as a tutor. */ __isTutorAccount: boolean; }; export declare class EliceCDK { #private; private readonly options; initialized: boolean; /** @deprecated internal use only */ internal_apis: InternalUseApiInstMap; constructor(options?: EliceCDKOptions); /** * AI features namespace providing chat capabilities. */ get ai(): { /** * AI chat interface for conversational interactions. */ chat: EliceCDKAiChat; }; /** * File storage interface for uploading and managing user files. */ get filestore(): EliceCDKFilestore; /** * Key-value storage interface for persisting user data (material or course-scoped). */ get kvstore(): EliceCDKKvstore; /** * Material-level key-value storage interface (not user-scoped, shared across all users). */ get materialKvstore(): EliceCDKMaterialKvstore; /** * Navigation interface for moving between lecture pages within Elice. * Requires the content to be embedded in an iframe. */ get navigation(): EliceCDKNavigation; /** * Translation interface for enabling Google Translate on content. * Browser-only feature. */ get translation(): EliceCDKTranslation; /** * Tutoring interface for accessing student data when viewing as a tutor. */ get tutoring(): EliceCDKTutoring; /** * Returns the current user's account information. * * @returns Account object with `uid`, `fullname`, and `__isTutorAccount`, or `null` if not initialized. * * @example * ```ts * import { EliceCDK } from '@eliceio/cdk'; * * const sdk = new EliceCDK(); * await sdk.init(); * * const account = sdk.account; * // { uid: 12345, fullname: 'John Doe', __isTutorAccount: false, ... } * ``` */ get account(): EliceCDKAccount | null; /** * Returns metadata identifying the current course and material (lecture page). * * @returns Object containing `courseId` and `materialId`. Returns `0` for both if not initialized. * * @example * ```ts * import { EliceCDK } from '@eliceio/cdk'; * * const sdk = new EliceCDK(); * await sdk.init(); * * const metadata = sdk.metadata; * // { courseId: 123, materialId: 456 } * ``` */ get metadata(): EliceCDKMetadata; /** * Returns the user's locale, parsed from initialization parameters. * * Supported locales: `'ko'`, `'en'`, `'ja'`, `'th'`. * * @default 'ko' * * @example * ```ts * import { EliceCDK } from '@eliceio/cdk'; * * const sdk = new EliceCDK(); * await sdk.init(); * * const locale = sdk.locale; // 'ko' * ``` */ get locale(): string; /** * Initializes the SDK by parsing query parameters and authenticating with the Elice platform. * * Must be called before using any other SDK methods. By default, reads parameters from * `window.location.search`. Pass `{ search }` to provide parameters manually. * * Required query parameters: `extToken`, `courseId`, `materialId`. * Optional: `locale`, `parentUrl`. * * @param initOptions - Optional configuration for initialization. * @returns The initialized SDK instance. * @throws {EliceCDKError} If required parameters are missing or authentication fails. * * @example * ```ts * import { EliceCDK } from '@eliceio/cdk'; * * const sdk = new EliceCDK(); * * // Default: reads from window.location.search * await sdk.init(); * * // Or pass query string manually * await sdk.init({ search: '?extToken=...&courseId=123&materialId=456' }); * ``` */ init(initOptions?: EliceCDKInitOptions): Promise; /** * Reports the user's completion score to the Elice platform. * * Call this method when the user completes the content or reaches a checkpoint. * The score must be between 0 and 100 (inclusive). * * @param params - Object containing the `score` (0–100). * @param init - Optional fetch request configuration. * @throws {EliceCDKError} If SDK is not initialized or the score is invalid. * * @example * ```ts * import { EliceCDK } from '@eliceio/cdk'; * * const sdk = new EliceCDK(); * await sdk.init(); * * // Report full completion * await sdk.sendScore({ score: 100 }); * * // Report partial progress * await sdk.sendScore({ score: 50 }); * ``` */ sendScore(params: ProgressPostRequest, init?: RequestInit): Promise; /** * Checks if the current user is in tutoring mode. * @deprecated Use `tutoring.isEnabled` instead. */ get isTutoringMode(): boolean; /** * Retrieves a value from the key-value store. * @deprecated Use `kvstore.get` instead. */ getKeyValue(params: any, init?: RequestInit): Promise; /** * Saves a value to the key-value store. * @deprecated Use `kvstore.post` instead. */ postKeyValue(params: any, init?: RequestInit): Promise; /** * Displays the Google Translate language selector. * @deprecated Use `translation.displayAutoLanguageOptions` instead. */ displayAutoLanguageOptions(): Promise; } export {};