mirror of
https://github.com/hanzoai/agency.git
synced 2026-11-02 19:13:28 +00:00
56 lines
2.3 KiB
Plaintext
56 lines
2.3 KiB
Plaintext
import { PointValues } from './client';
|
|
export type SharePlatformId = 'webshare' | 'email' | 'x' | 'linkedin' | 'facebook' | 'reddit' | 'telegram' | 'whatsapp' | 'sms' | 'copy';
|
|
export interface ShareTarget {
|
|
id: SharePlatformId | string;
|
|
label: string;
|
|
/** Points awarded for this action. If undefined, falls back to pointValues.SHARE. */
|
|
points?: number;
|
|
/**
|
|
* Returns a URL to open, OR `null` to skip the navigation (e.g. for copy /
|
|
* webshare which do their own thing in `onClick`).
|
|
*/
|
|
href: (ctx: ShareContext) => string | null;
|
|
/** Optional custom click handler — runs INSTEAD of href navigation. */
|
|
onClick?: (ctx: ShareContext) => void | Promise<void>;
|
|
}
|
|
export interface ShareContext {
|
|
url: string;
|
|
text: string;
|
|
rank: number;
|
|
refCode: string;
|
|
}
|
|
export interface WaitlistShareProps {
|
|
/** Slug of the waitlist (needed for track-share calls). */
|
|
waitlist: string;
|
|
/** The viewer's referral code (server credits points to this code). */
|
|
refCode: string;
|
|
/** Full share URL (typically the host page with `?ref=<code>` appended). */
|
|
shareUrl: string;
|
|
/** Optional viewer rank — used in default share text. */
|
|
rank?: number;
|
|
/** Optional total — used in default share text. */
|
|
total?: number;
|
|
/**
|
|
* Override the share message. Receives the same ctx as href functions.
|
|
* Default: `I'm #N on the waitlist. Join me:`
|
|
*/
|
|
message?: (ctx: ShareContext) => string;
|
|
/**
|
|
* Restrict / reorder targets. Pass an array of platform IDs from the
|
|
* built-in set, OR a full ShareTarget for custom platforms. Defaults to
|
|
* the full built-in roster.
|
|
*/
|
|
shareTargets?: Array<SharePlatformId | ShareTarget>;
|
|
/**
|
|
* Override the server's published point values for display only. The
|
|
* actual point award still happens server-side per pointValues; this is
|
|
* for showing custom labels.
|
|
*/
|
|
pointValues?: Partial<PointValues>;
|
|
/** Base server URL. Defaults to current origin. */
|
|
baseUrl?: string;
|
|
/** Callback after a successful track-share (or copy). */
|
|
onShared?: (platform: string, awarded: number, alreadyClaimed: boolean) => void;
|
|
}
|
|
export declare function WaitlistShare(props: WaitlistShareProps): import("react").JSX.Element;
|