UNPKG

@polls-platform/web

Version:

Polls Platform SDK

151 lines (146 loc) 4.6 kB
// Generated by dts-bundle-generator v6.13.0 import { AnalyticsEvent, OpenPollFlow, Theme } from '@polls-platform/core'; import React from 'react'; import { CSSProperties } from 'react'; /** * Props for `init`, a shorthand initializer for customers with hard-coded configs * @deprecated please use `initializePolls` * @category 1. Initialization */ export interface InitProps { apiKey: string; } /** * This is shorthand initializer for customers with hard-coded configs * @deprecated please use `initializePolls` * @category 1. Initialization * @param apiKey */ export declare function init({ apiKey }: InitProps): void; export declare enum CornerRounding { square = "square", light = "light", heavy = "heavy" } /** * CSS in JS font styles */ export interface FontStyle { fontFamily?: string; fontSize?: string; fontWeight?: string; letterSpacing?: string; } /** * Appearance controls for the poll view */ export interface PollViewAppearance { /** * Controls the appearance of the loading screen when creating/opening a poll * default: light */ theme?: Theme; /** * Font style overrides */ fontStyles?: { /** * Default font styles to be applied everywhere, unless overridden by more specific font styles below */ default?: FontStyle; /** * Font style for the title text on the poll loading screen */ loadingTitleFont?: FontStyle; }; } /** * Props to pass the `PollView` Component * @category 3. PollView */ export interface PollViewProps { /** * styles to be applied to the outer most component of the PollView. * styles will be merged by overriding default styles */ style?: CSSProperties; /** * The poll source can be either a Poll ID or Poll URL * When creating a poll with the `createPoll` or `createPollAsync` functions * the url returned by those functions can be passed directly to this prop. * This prop is also used when opening an existing poll. */ pollSource: string; /** * The `PollView` component is used for both creating polls and opening polls. * This property is used to determine which flow the user is in */ openPollFlow: OpenPollFlow; /** * @deprecated please use the appearance prop instead * Controls the appearance of the loading screen when creating/opening a poll * default: light */ theme?: Theme; /** * Appearance controls for the poll view */ appearance?: PollViewAppearance; /** * This callback forwards analytics events that occur within the poll. * For more information, go to https://docs.pollsplatform.com/analytics * Analytics can be forwarded to your own data warehouse such as Google Analytics. */ didReceiveAnalyticsEvent?: (event: AnalyticsEvent) => void; } /** * The `PollView` component is used for both creating and opening polls. * For more information, go to https://docs.pollsplatform.com/react. * Before navigating the user to this screen, you must have a poll URL. * You can create a poll using the `createPoll` and `createPollAsync` functions * which will respond with a URL that can be passed here. * Or if you already have the URL of an existing poll you can pass it * @category 3. PollView */ export declare const PollView: React.FC<PollViewProps>; export declare enum Corner { topLeft = "topLeft", topRight = "topRight", bottomRight = "bottomRight", bottomLeft = "bottomLeft" } /** * Props for `openPoll` * @category 3. PollView */ export interface OpenPollProps { /** * Props to be passed to the underlying `PollView`, see `PollViewProps` for details. */ pollViewProps: PollViewProps; /** * The node in the DOM in which you'd like the poll to be presented. * This should typically be the document.body (which is the default) * Note that scrolling will temporarily be disabled while the poll is open. */ domTargetNode?: Node; /** * The function to be called when the user closes the poll */ onClose?: () => void; } /** * This function opens a newly created or existing poll. * The background of the target node will be darkened and the poll * will be presented in a modal view with animation. * When the user dismisses the modal, it will dismiss with animation * and all injected elements will be cleaned up from the DOM. * This is intended to be used by projects that do not use React. * If you use React, consider using the <PollView> component. * @category 3. PollView * @param OpenPollProps */ export declare function openPoll({ pollViewProps, domTargetNode, onClose }: OpenPollProps): void; export * from "@polls-platform/core"; export {}; export * as _internal from './internal';