/** @module Survey-Taking Question Client */ import PluginClient from '@qualtrics/plugin-client'; import { PluginHandler, QuestionDef, QuestionResponse, PluginStateDataDef } from '../../survey-taking-shared/src/index'; import { FetchResponse, PredefinedRequestHandler, UserProvidedPredefinedRequest } from '../../survey-question-shared/src/predefined-request'; export type ClientOptions = { handlers: PluginHandler; stateData?: PluginStateData; }; export default class SurveyTakingQuestionClient implements PredefinedRequestHandler { private _pluginClient; get pluginClient(): PluginClient; private _question; get question(): QuestionType; private _response; get response(): ResponseType; private _stateData; get stateData(): PluginStateData; private _language; get language(): string; private _surveyId; get surveyId(): string; private _surveyVersionId; get surveyVersionId(): string; private _sessionToken; get sessionToken(): string; static initialize(config: ClientOptions): Promise>; private constructor(); private getPluginClientHandler; /** * Notifies the survey-taking host application that the plugin iframe has initialized * and that the question can be shown in place of the loading spinner */ private loadPlugin; /** * Retrieves localized strings from the Plugin's translation files, specifically * from the translation that matches the User's language. Valid keys are defined by top-level * properties of the `strings` object in the translation file. * * @param key The key for the text template to use * @param options.placeHolders (optional) - An object with values for any named placeholders in the template text * @param options.defaultVal (optional) - A default value to return if the key or translation doesn't exist * @returns the translation associated with the key */ getText(key: string, options?: { placeHolders?: Record; defaultVal?: string; }): string; /** * Returns the language code of the logged in user given by the host on init. * @returns the language code of the logged user given by the host on init. */ getLanguage(): string; private postMessage; /** * Notifies the survey-taking host application of updated response data. Plugin * response data will be preserved by the survey-taking host through any navigation * event * @param response the updated response */ updateResponse(response?: ResponseType): void; /** * Notifies the survey-taking host application of updated plugin state data. Plugin * state data will be dismissed by the survey-taking host on any navigation event. * @param stateData the updated state data object */ updatePluginStateDataObject(stateData?: PluginStateData): Promise; /** * Notifies the survey-taking host application of an update to the plugin state data. * A single field of the stateData object is updated and then the updated object is * passed to the survey-taking host application. Plugin state data will be dismissed * by the survey-taking host on any navigation event. * @param stateData the updated state data object * @param key key of the field to be updated * @param value new value for the field specified by the key */ updatePluginStateDataField(stateData: PluginStateDataDef, key: string, value: any): void; /** * Notifies the survey-taking host application of an update to the plugin height * @param height the height in pixels */ setContainerHeight(height: number): void; /** * Invokes a predefined request configured for this question type. * @see {@link InvokePredefinedRequest} */ invokePredefinedRequest(request: UserProvidedPredefinedRequest, timeout?: number): Promise; } //# sourceMappingURL=survey-taking-question-client.d.ts.map