@pushwoosh/websdk-common 0.0.0 → 6.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,90 @@
1
+ import { type WebPopupColors, type WebPopupColorSchemePref, type WebPopupDark } from '../web-popups/types';
2
+ /** How the ask is drawn: a corner/edge card, a full-width bar, or a centered modal. */
3
+ export type SubscriptionWidgetLayout = 'card' | 'bar' | 'modal';
4
+ /** Screen corner a launcher or a card sits in. */
5
+ export type SubscriptionWidgetCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
6
+ /** Where the prompt sits; each layout accepts a subset (see SUBSCRIPTION_WIDGET_POSITIONS). */
7
+ export type SubscriptionWidgetPosition = SubscriptionWidgetCorner | 'top' | 'bottom' | 'center';
8
+ /** What opens the prompt: a timer on page load, a launcher click only, or the host API only. */
9
+ export type SubscriptionWidgetTrigger = 'auto' | 'launcher' | 'manual';
10
+ /** Browser notification permission as the host sees it; 'granted' = subscribed. */
11
+ export type SubscriptionWidgetPermission = 'default' | 'granted' | 'denied' | 'unsupported';
12
+ /** 'ask' invites to subscribe, 'blocked' explains how to unblock notifications in the browser. */
13
+ export type SubscriptionWidgetPromptVariant = 'ask' | 'blocked';
14
+ /** Every visitor-facing string of the widget. */
15
+ export type SubscriptionWidgetTexts = {
16
+ title: string;
17
+ message: string;
18
+ acceptText: string;
19
+ declineText: string;
20
+ /** Dismisses the 'blocked' prompt. */
21
+ closeText: string;
22
+ blockedTitle: string;
23
+ blockedMessage: string;
24
+ /** Launcher tooltip while the visitor can still subscribe. */
25
+ launcherLabel: string;
26
+ /** Launcher tooltip while notifications are blocked. */
27
+ launcherBlockedLabel: string;
28
+ };
29
+ /** The ask itself. */
30
+ export type SubscriptionWidgetPrompt = {
31
+ layout: SubscriptionWidgetLayout;
32
+ position: SubscriptionWidgetPosition;
33
+ /** Image drawn beside the copy; absent = no image. */
34
+ iconUrl?: string;
35
+ borderRadius: number;
36
+ /** Page dim behind the prompt; a modal always has one. */
37
+ overlay: boolean;
38
+ };
39
+ /** The floating bell that reopens the prompt. */
40
+ export type SubscriptionWidgetLauncher = {
41
+ enabled: boolean;
42
+ position: SubscriptionWidgetCorner;
43
+ /** Distance from the screen edges, px. */
44
+ offset: number;
45
+ /** Button diameter, px. */
46
+ size: number;
47
+ };
48
+ /** When the prompt shows by itself. */
49
+ export type SubscriptionWidgetDisplay = {
50
+ trigger: SubscriptionWidgetTrigger;
51
+ /** Seconds after page load before an auto show. */
52
+ delay: number;
53
+ /** Auto shows per visitor; 0 = unlimited. */
54
+ cappingCount: number;
55
+ /** Hours between two auto shows. */
56
+ cappingInterval: number;
57
+ };
58
+ /** The whole widget configuration as stored in the WebSDK config (`subscriptionWidget`). */
59
+ export type SubscriptionWidgetConfig = {
60
+ enable: boolean;
61
+ prompt: SubscriptionWidgetPrompt;
62
+ launcher: SubscriptionWidgetLauncher;
63
+ display: SubscriptionWidgetDisplay;
64
+ texts: SubscriptionWidgetTexts;
65
+ colors: WebPopupColors;
66
+ dark?: WebPopupDark;
67
+ fontFamily: string;
68
+ zIndex: number;
69
+ };
70
+ /** What the host remembers about auto shows for one visitor. */
71
+ export type SubscriptionWidgetHistory = {
72
+ shownCount: number;
73
+ /** Epoch ms of the last auto show; null = never shown. */
74
+ lastShownAt: number | null;
75
+ };
76
+ /** 'live' draws fixed to the viewport; 'preview' draws the same inside the nearest positioned parent. */
77
+ export type SubscriptionWidgetReaderMode = 'live' | 'preview';
78
+ export type SubscriptionWidgetReaderProps = {
79
+ config: SubscriptionWidgetConfig;
80
+ permission: SubscriptionWidgetPermission;
81
+ /** Whether the prompt is on screen; the host owns this state. */
82
+ open: boolean;
83
+ mode?: SubscriptionWidgetReaderMode;
84
+ colorScheme?: WebPopupColorSchemePref;
85
+ /** Disables the accept button while the browser permission dialog is up. */
86
+ busy?: boolean;
87
+ onAccept?: () => void;
88
+ onDecline?: () => void;
89
+ onLauncherClick?: () => void;
90
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { type WebPopupBoxProps, type WebPopupReaderProps, type WebPopupSlotViewProps } from './types';
2
+ export declare function WebPopupSlotView({ slot, align, inverse, colors, mode, onRequestClose, onPageChange, onSubmitForm, onSubmitChoice, onSubmitRating, onRequestSubscribe, }: WebPopupSlotViewProps): import("react").JSX.Element;
3
+ export declare function WebPopupBox({ page, params, mode, colorScheme, leafRenderers, animatePage, onRequestClose, onPageChange, onSubmitForm, onSubmitChoice, onSubmitRating, onRequestSubscribe, }: WebPopupBoxProps): import("react").JSX.Element;
4
+ export declare function WebPopupReader({ params, mode, colorScheme, onRequestClose, onSubmitForm, onSubmitChoice, onSubmitRating, onRequestSubscribe, leafRenderers, }: WebPopupReaderProps): import("react").JSX.Element | null;