import { ShareType } from "./share-type"; import "../ui/share-popup"; export type { ShareType }; /** Options to pass to {@link share}. */ export declare type ShareOptions = { /** Files to be included in share. For file compatibility, see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share#shareable_file_types */ files?: File[]; /** Text to be shared. */ text?: string; /** The type of share, defaults to "any". */ type?: ShareType; /** Additional tracking properties that will be sent along with the Share events. */ trackProps?: Record; /** Optional, share type dependent, ID of a social media post at which to target this share. Twitter is only supported. */ inReplyTo?: string; }; /** Options to pass to {@link createLink}. */ export declare type CreateLinkOptions = { /** The entry channel to use for tracking, defaults to "SHARE". */ channel?: string; /** Payload to include with shared link. */ data?: unknown; /** Create a link to this explicit URL. It must have the same origin as the current document. If not specified, the current URL will be used. */ url?: string; /** Open Graph title to display in embedded shares. */ title?: string; /** Open Graph description to display in embedded shares. */ description?: string; /** Open Graph image to display in embedded shares. */ image?: string; /** * Additional tracking properties that will be sent along with the EntryFinal/EntryConversion * event. * * The event properties will also be prefixed and stored as firstEntry and lastEntry user * properties for the converted user. * * Eg: The link created by `playpass.createLink({ trackProps: { feature: "test" }})` will send a * `feature` event property with EntryFinal, and set the `lastEntryFeature` and * `firstEntryFeature` user properties. */ trackProps?: Record; }; /** * Open the device share dialog. * * WARNING! This function must be called in a user gesture handler such as pointerup. * * Sending a share with a game link: * ```javascript * playpass.share({ * text: "Here's a coin gift for you: " + playpass.createLink({data: { coins: 123 } }), * }); * ``` * * Receive data from the game link: * ```javascript * const data = playpass.getLinkData(); * if (data) { * console.log("Opened a link with coins!", data.coins); * } * ``` * * @returns Whether the share was successfully sent. */ export declare function share(opts?: ShareOptions): Promise; export declare function setGCSharePayload(sharePayload: Record): void; export declare function setAmplitudeKey(key: string): void; /** * Generate a short link for sharing the game. Use this when a shareable link is desired for use outside of the `share` method. * @param opts - CreateLinkOptions * @returns A string representing the shortened url containing the payload data */ export declare function createLink(opts?: CreateLinkOptions): string; /** * Generate a context based share link. Use this when a shareable link is desired for use outside of the `share` method. * @param opts - CreateLinkOptions * @returns Promise A string representing the shortened url containing the payload data */ export declare function createContextLink(opts?: CreateLinkOptions): string; /** * Uploads an image to a temporary URL. The image URL will only be valid for up to 90 days. * * This is designed to be used in combination with `createLink()` for dynamic share images. * * ```js * const imageUrl = await playpass.uploadTemporaryImage(canvas); * * const link = playpass.createLink({ * image: imageUrl, * }); * ``` */ export declare function uploadTemporaryImage(canvas: HTMLCanvasElement, type?: "image/png" | "image/jpeg"): Promise; /** @hidden */ export declare function copyToClipboard(text: string): Promise;