web-push-notifications 3.110.0 → 3.113.1
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.
- package/CHANGELOG.md +51 -0
- package/core/Pushwoosh.d.ts +3 -0
- package/core/elementPickerRequest.d.ts +8 -0
- package/npm.js +1 -1
- package/npm.js.map +1 -1
- package/package.json +1 -1
- package/service-worker.js +1 -1
- package/widget-inbox.js +1 -1
- package/widget-inbox.js.map +1 -1
- package/widget-recommendations.js +1 -1
- package/widget-recommendations.js.map +1 -1
- package/widget-subscribe-popup.js +1 -1
- package/widget-subscribe-popup.js.map +1 -1
- package/widget-subscription-button.js +1 -1
- package/widget-subscription-button.js.map +1 -1
- package/widget-subscription-prompt.js +1 -1
- package/widget-subscription-prompt.js.map +1 -1
- package/widget-subscription.js +1 -1
- package/widget-subscription.js.map +1 -1
- package/widget-web-popups.js +1 -1
- package/widget-web-popups.js.map +1 -1
- package/widgets/ElementPicker/ElementPicker.d.ts +48 -0
- package/widgets/ElementPicker/__tests__/elementPicker.test.d.ts +1 -0
- package/widgets/ElementPicker/__tests__/selector.test.d.ts +1 -0
- package/widgets/ElementPicker/selector.d.ts +16 -0
- package/widgets/WebPopups/WebPopupsWidget.d.ts +10 -2
- package/widgets/WebPopups/__tests__/clickTrigger.test.d.ts +1 -0
- package/widgets/WebPopups/__tests__/exitIntentTrigger.test.d.ts +1 -0
- package/widgets/WebPopups/clickTrigger.d.ts +5 -0
- package/widgets/WebPopups/exitIntent.d.ts +6 -0
- package/widgets/WebPopups/types.d.ts +3 -3
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type ElementPickerRequest } from '../../core/elementPickerRequest';
|
|
2
|
+
export declare const ELEMENT_PICKER_MESSAGE_SOURCE = "pushwoosh-element-picker";
|
|
3
|
+
export type ElementPickerMessage = {
|
|
4
|
+
source: typeof ELEMENT_PICKER_MESSAGE_SOURCE;
|
|
5
|
+
type: 'ready' | 'selected' | 'cancelled';
|
|
6
|
+
nonce: string;
|
|
7
|
+
applicationCode: string;
|
|
8
|
+
selector?: string;
|
|
9
|
+
};
|
|
10
|
+
/** Highlights the element under the cursor and sends the selector of the clicked one back to the Control Panel. */
|
|
11
|
+
export declare class ElementPicker {
|
|
12
|
+
private readonly request;
|
|
13
|
+
private readonly getApplicationCode;
|
|
14
|
+
private readonly win;
|
|
15
|
+
private readonly host;
|
|
16
|
+
private readonly shadow;
|
|
17
|
+
private readonly hoverBox;
|
|
18
|
+
private readonly matchBoxes;
|
|
19
|
+
private readonly toolbar;
|
|
20
|
+
private hovered;
|
|
21
|
+
private picked;
|
|
22
|
+
private similar;
|
|
23
|
+
private result;
|
|
24
|
+
private stops;
|
|
25
|
+
constructor(request: ElementPickerRequest, getApplicationCode: () => string, win?: Window);
|
|
26
|
+
run(): void;
|
|
27
|
+
private get connected();
|
|
28
|
+
private post;
|
|
29
|
+
private box;
|
|
30
|
+
private listen;
|
|
31
|
+
private pick;
|
|
32
|
+
private unpick;
|
|
33
|
+
private toParent;
|
|
34
|
+
private compute;
|
|
35
|
+
private place;
|
|
36
|
+
private position;
|
|
37
|
+
private render;
|
|
38
|
+
private matchesText;
|
|
39
|
+
private noSelectorText;
|
|
40
|
+
private buttons;
|
|
41
|
+
private toggleSimilar;
|
|
42
|
+
private copy;
|
|
43
|
+
private submit;
|
|
44
|
+
private cancel;
|
|
45
|
+
/** Removes the overlay and gives the page its clicks back; the request stays for the next page. */
|
|
46
|
+
stop(): void;
|
|
47
|
+
private finish;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ElementPickerMode } from '../../core/elementPickerRequest';
|
|
2
|
+
export type BuiltSelector = {
|
|
3
|
+
selector: string;
|
|
4
|
+
count: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function isStableToken(value: string): boolean;
|
|
7
|
+
export declare function isSimpleSelector(selector: string, element: Element): boolean;
|
|
8
|
+
/** Selectors of the element itself, most stable first; each is one compound selector without combinators. */
|
|
9
|
+
export declare function ownCandidates(element: Element): Array<string>;
|
|
10
|
+
/**
|
|
11
|
+
* The most stable selector that matches only this element. `embedded` keeps to one compound selector,
|
|
12
|
+
* the only form an inline campaign accepts, and returns null when the element has none.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildSelector(element: Element, mode: ElementPickerMode, root?: Document): BuiltSelector | null;
|
|
15
|
+
/** A class selector shared by this element and its look-alikes ("every Add to cart button"), or null. */
|
|
16
|
+
export declare function buildSimilarSelector(element: Element, root?: Document): BuiltSelector | null;
|
|
@@ -26,6 +26,8 @@ export declare class WebPopupsWidget implements IWebPopupsPublicApi {
|
|
|
26
26
|
private autoShowEnabled;
|
|
27
27
|
private colorScheme;
|
|
28
28
|
private isNavigationSubscribed;
|
|
29
|
+
private stopClickWatch;
|
|
30
|
+
private badClickSelectors;
|
|
29
31
|
private openPopupsCount;
|
|
30
32
|
private bodyOverflowBeforeLock;
|
|
31
33
|
/** Built once from `pw`: the device-API side of the choice/rating/subscribe slots. */
|
|
@@ -89,26 +91,32 @@ export declare class WebPopupsWidget implements IWebPopupsPublicApi {
|
|
|
89
91
|
private canAutoDisplay;
|
|
90
92
|
/** What any kind needs to show by itself; kind-specific checks stay with the caller. */
|
|
91
93
|
private isAutoEligible;
|
|
94
|
+
/** The conditions a popup shown without show() passes, whatever its trigger. */
|
|
95
|
+
private passesDisplayConditions;
|
|
92
96
|
/** What a waiting or queued popup must still pass: the page, the push permission and the countdown. */
|
|
93
97
|
private isStillEligible;
|
|
94
98
|
private isAutoTrigger;
|
|
99
|
+
private watchClickTriggers;
|
|
100
|
+
private onTriggerClick;
|
|
101
|
+
private isClickTarget;
|
|
95
102
|
private arm;
|
|
96
103
|
private armDelay;
|
|
97
104
|
private armScrollDepth;
|
|
105
|
+
private armExitIntent;
|
|
98
106
|
private enqueueArmed;
|
|
99
107
|
/**
|
|
100
108
|
* VISIT is reported once per page load, when the popup is armed for the
|
|
101
109
|
* current page — the same moment as before the queue existed.
|
|
102
110
|
*/
|
|
103
111
|
private recordVisit;
|
|
104
|
-
/** Ordering: shorter delay first (
|
|
112
|
+
/** Ordering: shorter delay first (SCROLL and EXIT_INTENT count as 0), then the order the server returned them. */
|
|
105
113
|
private insertIntoQueue;
|
|
106
114
|
/**
|
|
107
115
|
* Return waiting and queued popups that stopped matching the page or the push permission, or whose countdown
|
|
108
116
|
* passed, to `idle`; a returning visitor re-arms them with a full delay.
|
|
109
117
|
*/
|
|
110
118
|
private releaseUnmatchedPending;
|
|
111
|
-
/** Clear an entry's armed timer,
|
|
119
|
+
/** Clear an entry's armed timer, trigger listeners and queue slot, leaving its state to the caller. */
|
|
112
120
|
private detachFromAutoPipeline;
|
|
113
121
|
/** Show the head of the queue if the display slot is free. */
|
|
114
122
|
private drain;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type WebPopup } from './types';
|
|
2
|
+
export declare const isClickWebPopup: (popup: WebPopup) => boolean;
|
|
3
|
+
/** Whether the click landed on an element matching the selector or inside one. Throws on an invalid selector. */
|
|
4
|
+
export declare function clickMatchesSelector(event: Event, selector: string): boolean;
|
|
5
|
+
export declare function watchClicks(onClick: (event: MouseEvent) => void): () => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type WebPopup } from './types';
|
|
2
|
+
export type ExitIntentFormFactor = 'DESKTOP' | 'MOBILE';
|
|
3
|
+
/** Returns whether a popup is now on screen: Back that showed nothing must still leave. */
|
|
4
|
+
export type ExitIntentHandler = () => boolean;
|
|
5
|
+
export declare const isExitIntentWebPopup: (popup: WebPopup) => boolean;
|
|
6
|
+
export declare function watchExitIntent(formFactor: ExitIntentFormFactor, onExit: ExitIntentHandler): () => void;
|
|
@@ -43,7 +43,7 @@ export type PageRule = {
|
|
|
43
43
|
path: string;
|
|
44
44
|
operator: PageRuleOperator;
|
|
45
45
|
};
|
|
46
|
-
export type WebPopupTriggerType = 'PAGE_LOAD' | 'API' | 'SCROLL' | (string & {});
|
|
46
|
+
export type WebPopupTriggerType = 'PAGE_LOAD' | 'API' | 'SCROLL' | 'EXIT_INTENT' | 'CLICK' | (string & {});
|
|
47
47
|
export type WebPopupDisplayKind = 'POPUP' | 'EMBEDDED' | (string & {});
|
|
48
48
|
export type WebPopup = {
|
|
49
49
|
code: string;
|
|
@@ -92,8 +92,8 @@ export type WebPopupEntry = {
|
|
|
92
92
|
passedFrequency: boolean;
|
|
93
93
|
/** Armed delay timer while state === 'waiting'. */
|
|
94
94
|
timeoutId: number | null;
|
|
95
|
-
/** Removes the
|
|
96
|
-
|
|
95
|
+
/** Removes the listeners of a waiting SCROLL or EXIT_INTENT popup. */
|
|
96
|
+
stopTriggerWatch: (() => void) | null;
|
|
97
97
|
/** VISIT already reported for this page load. */
|
|
98
98
|
visitRecorded: boolean;
|
|
99
99
|
};
|