web-push-notifications 3.104.1 → 3.107.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.
- package/CHANGELOG.md +33 -0
- package/core/Pushwoosh.d.ts +8 -0
- package/core/Pushwoosh.types.d.ts +3 -1
- package/core/__tests__/unknownInitKeys.test.d.ts +1 -0
- package/core/events.types.d.ts +4 -1
- package/core/unknownInitKeys.d.ts +6 -0
- package/modules/Api/Api.d.ts +3 -1
- package/modules/ApiClient/ApiClient.d.ts +2 -0
- package/modules/ApiClient/ApiClient.types.d.ts +16 -2
- package/modules/Recommendations/Recommendations.types.d.ts +1 -1
- package/npm.js +1 -1
- package/npm.js.map +1 -1
- package/package.json +2 -2
- package/service-worker.js +1 -1
- package/service-worker.js.map +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/WebPopups/EmbeddedWebPopups.d.ts +3 -0
- package/widgets/WebPopups/WebPopupsWidget.d.ts +32 -0
- package/widgets/WebPopups/__tests__/placements.test.d.ts +1 -0
- package/widgets/WebPopups/__tests__/productsHost.test.d.ts +1 -0
- package/widgets/WebPopups/constants.d.ts +2 -0
- package/widgets/WebPopups/productsHost.d.ts +6 -0
- package/widgets/WebPopups/renderer.d.ts +2 -1
- package/widgets/WebPopups/types.d.ts +27 -2
|
@@ -10,6 +10,8 @@ export type EmbeddedWebPopupsDeps = {
|
|
|
10
10
|
recordImpression: (code: string) => void;
|
|
11
11
|
recordFormViews: (code: string, params: WebPopupParams) => void;
|
|
12
12
|
dispatchShown: (code: string, trigger: WebPopupShowTrigger) => void;
|
|
13
|
+
/** The ✕ the SDK draws on a dismissible journey placement. */
|
|
14
|
+
dismiss: (entry: WebPopupEntry) => void;
|
|
13
15
|
};
|
|
14
16
|
/** EMBEDDED campaigns render inside the site's own elements: no delay, queue,
|
|
15
17
|
* frequency or display slot — every eligible one renders. */
|
|
@@ -29,6 +31,7 @@ export declare class EmbeddedWebPopups {
|
|
|
29
31
|
/** Remove the blocks the predicate picks, show() ones included; places nothing. */
|
|
30
32
|
removeWhere(shouldRemove: (entry: WebPopupEntry) => boolean): void;
|
|
31
33
|
private place;
|
|
34
|
+
private createDismissButton;
|
|
32
35
|
private firstBlockAfter;
|
|
33
36
|
private remove;
|
|
34
37
|
private findContainer;
|
|
@@ -7,6 +7,17 @@ export declare class WebPopupsWidget implements IWebPopupsPublicApi {
|
|
|
7
7
|
private readonly entries;
|
|
8
8
|
/** Contents shown by their own code, outside of any campaign; never auto-displayed. */
|
|
9
9
|
private readonly contentEntries;
|
|
10
|
+
/** Journey placements of this page load, keyed by hash; never mixed into the campaigns above. */
|
|
11
|
+
private readonly placementEntries;
|
|
12
|
+
/** Arrival sequence of each placement: the newer one wins a priority tie. */
|
|
13
|
+
private readonly placementSeq;
|
|
14
|
+
private placementCounter;
|
|
15
|
+
/** Closed by the visitor; a pull answered before the server saw the dismiss must not bring them back. */
|
|
16
|
+
private readonly dismissedPlacements;
|
|
17
|
+
/** SHOW is reported once per placement per page load. */
|
|
18
|
+
private readonly shownPlacements;
|
|
19
|
+
/** The application has placements, or a postEvent response brought some: pull them on every navigation. */
|
|
20
|
+
private placementsActive;
|
|
10
21
|
/** Codes whose delay has elapsed, waiting for the display slot. */
|
|
11
22
|
private readonly queue;
|
|
12
23
|
/** The single popup on screen, if any. */
|
|
@@ -44,6 +55,26 @@ export declare class WebPopupsWidget implements IWebPopupsPublicApi {
|
|
|
44
55
|
getVisibleCode(): string | null;
|
|
45
56
|
getAvailableCodes(): Array<string>;
|
|
46
57
|
getState(): WebPopupsPublicState;
|
|
58
|
+
private placementsAllowed;
|
|
59
|
+
/** Takes over delivery from the core and returns what it buffered; an older core has neither hook. */
|
|
60
|
+
private acceptPlacements;
|
|
61
|
+
/** Placements a postEvent response released: shown at once, and the page starts pulling them. */
|
|
62
|
+
private receivePlacements;
|
|
63
|
+
/** The server's queue for this user is the truth: a placement it no longer returns is taken off the page or the queue. */
|
|
64
|
+
private pullPlacements;
|
|
65
|
+
private syncPlacements;
|
|
66
|
+
private renderPlacements;
|
|
67
|
+
/** One placement per element: the highest priority, the newest on a tie. */
|
|
68
|
+
private renderPlacementBlocks;
|
|
69
|
+
/** At most one placement popup at a time takes the display slot, ahead of campaigns. */
|
|
70
|
+
private queuePlacementPopup;
|
|
71
|
+
private placementBeats;
|
|
72
|
+
private scheduleExpiry;
|
|
73
|
+
private dropPlacement;
|
|
74
|
+
private dismissPlacement;
|
|
75
|
+
private onPlacementsNavigate;
|
|
76
|
+
private trackPlacement;
|
|
77
|
+
private entryByCode;
|
|
47
78
|
private createEntry;
|
|
48
79
|
private getContentEntry;
|
|
49
80
|
/**
|
|
@@ -96,6 +127,7 @@ export declare class WebPopupsWidget implements IWebPopupsPublicApi {
|
|
|
96
127
|
private checkCanBeShownByMatchingPagesCondition;
|
|
97
128
|
private matchPageRule;
|
|
98
129
|
private checkCanBeShownByVisitorsTypeCondition;
|
|
130
|
+
private recordImpression;
|
|
99
131
|
private recordPopupShownEvent;
|
|
100
132
|
private listenForInteractions;
|
|
101
133
|
private markAsShown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,4 +3,6 @@ export declare const WEB_POPUPS_LOG_PREFIX = "[WebPopups]";
|
|
|
3
3
|
export declare const POPUP_HOST_Z_INDEX = 2147483647;
|
|
4
4
|
export declare const QUEUE_GAP_MS = 400;
|
|
5
5
|
export declare const EMBEDDED_ORDER_ATTRIBUTE = "data-pushwoosh-embedded-order";
|
|
6
|
+
export declare const EMBEDDED_DISMISS_ATTRIBUTE = "data-pushwoosh-placement-dismiss";
|
|
7
|
+
export declare const PLACEMENT_ORDER = -1;
|
|
6
8
|
export declare const SUBSCRIPTION_FORMS_API_URL = "https://subscription-form.svc-nue.pushwoosh.com/api/v1";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type WebPopupParams, type WebPopupProductsHost } from '@pushwoosh/websdk-common/web-popups';
|
|
2
|
+
import { type Recommendations } from '../../modules/Recommendations/Recommendations';
|
|
3
|
+
/** Products slots load from the onsite recommendations feed; a click goes out as PW_RecommendationClick. */
|
|
4
|
+
export declare function createProductsHost(recommendations: Pick<Recommendations, 'fetch' | 'trackClick'>): WebPopupProductsHost;
|
|
5
|
+
/** False when a `hideWhenEmpty` products slot has nothing, its fallback included: the popup is then not shown at all. */
|
|
6
|
+
export declare function webPopupProductsAvailable(params: WebPopupParams, host: WebPopupProductsHost): Promise<boolean>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { type WebPopupChoiceSubmitHandler, type WebPopupColorSchemePref, type WebPopupFormValuesSubmitHandler, type WebPopupParams, type WebPopupRatingSubmitHandler, type WebPopupSubscribeResult } from '@pushwoosh/websdk-common/web-popups';
|
|
1
|
+
import { type WebPopupChoiceSubmitHandler, type WebPopupColorSchemePref, type WebPopupFormValuesSubmitHandler, type WebPopupParams, type WebPopupProductsHost, type WebPopupRatingSubmitHandler, type WebPopupSubscribeResult } from '@pushwoosh/websdk-common/web-popups';
|
|
2
2
|
/** The device-API handlers, passed in rather than imported: this module renders, it doesn't know the core. */
|
|
3
3
|
export type WebPopupDeviceHandlers = {
|
|
4
4
|
onSubmitChoice: WebPopupChoiceSubmitHandler;
|
|
5
5
|
onSubmitRating: WebPopupRatingSubmitHandler;
|
|
6
6
|
onRequestSubscribe: () => Promise<WebPopupSubscribeResult>;
|
|
7
|
+
products: WebPopupProductsHost;
|
|
7
8
|
};
|
|
8
9
|
export type WebPopupSubmitHandlers = WebPopupDeviceHandlers & {
|
|
9
10
|
onSubmitFormValues: WebPopupFormValuesSubmitHandler;
|
|
@@ -18,6 +18,26 @@ export type IWebPopupsConfig = {
|
|
|
18
18
|
*/
|
|
19
19
|
autoShow?: boolean;
|
|
20
20
|
};
|
|
21
|
+
export type IWebPlacementsConfig = {
|
|
22
|
+
/** `false` ignores the placements journeys queue for this visitor; campaigns are unaffected. Defaults to `true`. */
|
|
23
|
+
enable?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type WebPlacementKind = 'WEB_PLACEMENT_KIND_POPUP' | 'WEB_PLACEMENT_KIND_EMBEDDED' | (string & {});
|
|
26
|
+
export type WebPlacementPriority = 'WEB_PLACEMENT_PRIORITY_LOW' | 'WEB_PLACEMENT_PRIORITY_MEDIUM' | 'WEB_PLACEMENT_PRIORITY_HIGH' | (string & {});
|
|
27
|
+
export type WebPlacementAction = 'WEB_PLACEMENT_ACTION_SHOW' | 'WEB_PLACEMENT_ACTION_CLICK' | 'WEB_PLACEMENT_ACTION_DISMISS';
|
|
28
|
+
/** A popup or inline block a journey queued for this user (post-event-api `WebPlacement`). */
|
|
29
|
+
export type WebPlacement = {
|
|
30
|
+
/** Opaque id every show, click and dismiss is reported by. */
|
|
31
|
+
hash: string;
|
|
32
|
+
content_code: string;
|
|
33
|
+
kind?: WebPlacementKind;
|
|
34
|
+
css_selector?: string;
|
|
35
|
+
width?: string;
|
|
36
|
+
priority?: WebPlacementPriority;
|
|
37
|
+
/** RFC 3339; absent means no deadline of its own. */
|
|
38
|
+
expires_at?: string | null;
|
|
39
|
+
dismissible?: boolean;
|
|
40
|
+
};
|
|
21
41
|
export type PageRuleOperator = 'EQUALS' | 'STARTS_WITH' | (string & {});
|
|
22
42
|
export type PageRule = {
|
|
23
43
|
path: string;
|
|
@@ -50,8 +70,11 @@ export type WebPopup = {
|
|
|
50
70
|
export type WebPopupEntryState = 'idle' | 'waiting' | 'queued' | 'visible' | 'done';
|
|
51
71
|
/** Everything the widget knows about one popup, for the whole page load. */
|
|
52
72
|
export type WebPopupEntry = {
|
|
53
|
-
/** 'content': a bare popup content code opened via show(), e.g. from the inbox; no campaign behind it.
|
|
54
|
-
|
|
73
|
+
/** 'content': a bare popup content code opened via show(), e.g. from the inbox; no campaign behind it.
|
|
74
|
+
* 'placement': queued by a journey, keyed by its hash, reported through trackWebPlacement. */
|
|
75
|
+
kind: 'campaign' | 'content' | 'placement';
|
|
76
|
+
/** Set for kind 'placement' only. */
|
|
77
|
+
placement?: WebPlacement;
|
|
55
78
|
popup: WebPopup;
|
|
56
79
|
/** Index in the server response — the ordering tiebreaker after `delay`. */
|
|
57
80
|
order: number;
|
|
@@ -60,6 +83,8 @@ export type WebPopupEntry = {
|
|
|
60
83
|
content: WebPopupParams | null;
|
|
61
84
|
/** In-flight fetch, memoised so run() and show() never duplicate a request. */
|
|
62
85
|
loading: Promise<WebPopupParams | null> | null;
|
|
86
|
+
/** A `hideWhenEmpty` products slot came back empty: the content is not shown. */
|
|
87
|
+
productsEmpty: boolean;
|
|
63
88
|
/** device_type + visitors_type, evaluated exactly once in run(). */
|
|
64
89
|
passedStrongConditions: boolean;
|
|
65
90
|
/** Frequency capping, evaluated exactly once in run(); only POPUP obeys it. */
|