web-push-notifications 3.118.1 → 3.122.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 +35 -0
- package/core/Pushwoosh.d.ts +3 -2
- package/core/__tests__/deprecatedPlatformChecker.test.d.ts +1 -0
- package/core/events.types.d.ts +5 -0
- package/helpers/url.d.ts +2 -0
- package/models/InboxCell.d.ts +3 -1
- package/models/InboxCell.types.d.ts +32 -0
- package/models/InboxMessages.types.d.ts +7 -2
- package/modules/Api/Api.d.ts +1 -1
- package/modules/ApiClient/ApiClient.d.ts +2 -1
- package/modules/ApiClient/ApiClient.types.d.ts +2 -0
- package/modules/ApiClient/__tests__/ApiClient.test.d.ts +1 -0
- package/modules/InboxMessagesPublic.d.ts +3 -0
- package/modules/SdkUsage/SdkUsage.d.ts +3 -0
- 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-inbox.js +1 -1
- package/widget-inbox.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/Inbox/InboxWidget.d.ts +3 -0
- package/widgets/Inbox/constants.d.ts +2 -0
- package/widgets/Inbox/renderer.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,41 @@ the same mapping is in the
|
|
|
9
9
|
Entries for 3.71.0 through 3.78.0 are grouped under version headings, which is how this file was
|
|
10
10
|
kept before the version moved to the tag; earlier versions live only in the git history.
|
|
11
11
|
|
|
12
|
+
## feat(web-popups): growing slide-out close and 750 ms hide delay from websdk-common 6.35.0
|
|
13
|
+
|
|
14
|
+
- The hover controls of a web popup wait 750 ms (was 150 ms) after the pointer leaves before hiding.
|
|
15
|
+
- The slide-out close button grows ×1.5 (28 → 42 px) as it slides out and ×1.14 under the pointer, like the arrows;
|
|
16
|
+
with a right arrow on the page it stops at the arrow's tip.
|
|
17
|
+
|
|
18
|
+
## feat(web-popups): side arrows and slide-out close from websdk-common 6.34.0
|
|
19
|
+
|
|
20
|
+
- Web popups can carry per-page side arrows (go to a page, close, open a link) and a slide-out close button; they
|
|
21
|
+
slide out from under the popup one after another while the pointer is over it, and hide together when it leaves.
|
|
22
|
+
On touch screens there are no arrows and the close button stays inside. The renderer comes from
|
|
23
|
+
`@pushwoosh/websdk-common` 6.34.0; popups without the new fields render as before.
|
|
24
|
+
|
|
25
|
+
## feat(usage): report reads of deprecated public APIs
|
|
26
|
+
|
|
27
|
+
- The daily `sdkUsage` report now carries `deprecated_apis`: names of deprecated public members a site
|
|
28
|
+
touched. First one is `Pushwoosh.platformChecker`, now a getter that records the read and returns the
|
|
29
|
+
same facade as before, so nothing changes for the site.
|
|
30
|
+
|
|
31
|
+
## feat(inbox): card buttons in the inbox widget (DEV-1062)
|
|
32
|
+
|
|
33
|
+
- An inbox message may carry up to three buttons in `action_params.u.buttons` (unlabeled ones are dropped before counting;
|
|
34
|
+
the id is the payload's `"0"`..`"2"`, or the position among the kept buttons when there is none, as in the mobile SDKs); the widget draws them under the text
|
|
35
|
+
(a button without a background is drawn as a link; colours other than `#RRGGBB`/`#RRGGBBAA` are ignored, the rest are
|
|
36
|
+
upper-cased; a legacy item without a valid id keeps no colours and opens its url or arrives as `custom`).
|
|
37
|
+
- `open` goes to the button's url (script schemes, `intent:` and scheme-less urls are dropped), `copy` puts `copy_text` on the
|
|
38
|
+
clipboard and shows a short "Copied", `custom` fires the new `click-inbox-button` event with
|
|
39
|
+
`{messageCode, buttonId, data}`. A mobile-only action (`dismiss`, `markread`) or an unknown one arrives as `custom`,
|
|
40
|
+
with the rest of the item as `data`; a legacy `{title, url}` item opens its url.
|
|
41
|
+
- A tap reports the message opened (status 3, once per message, as a card tap does) and then `inboxStatus` with
|
|
42
|
+
status 6 and `button_id`, the order the Android SDK uses; both go with `keepalive`, 6 starting once 3 is sent, and `open`
|
|
43
|
+
navigates as soon as both are sent, not answered, so the reports outlive the page; it never runs the message's own action. Sites with their own inbox UI read `buttons` from
|
|
44
|
+
`pwinbox.loadMessages()` and report a tap with `pwinbox.reportButtonClick(code, buttonId)`.
|
|
45
|
+
- Needs `@pushwoosh/websdk-common` 6.33.0.
|
|
46
|
+
|
|
12
47
|
## fix(platform-checker): detect the legacy Safari path on window.safari alone again
|
|
13
48
|
|
|
14
49
|
- 3.117.0 took `window.safari.pushNotification` as the sign of the legacy Safari path. Apple exposes
|
package/core/Pushwoosh.d.ts
CHANGED
|
@@ -25,8 +25,7 @@ export declare class Pushwoosh {
|
|
|
25
25
|
driver?: IPushService;
|
|
26
26
|
/** @internal browser, push capabilities and form factor, detected once at startup */
|
|
27
27
|
readonly environment: IEnvironment;
|
|
28
|
-
|
|
29
|
-
readonly platformChecker: PlatformChecker;
|
|
28
|
+
private readonly legacyPlatformChecker;
|
|
30
29
|
private isPushDisabled;
|
|
31
30
|
private isInitAborted;
|
|
32
31
|
private isPushPermissionWatched;
|
|
@@ -54,6 +53,8 @@ export declare class Pushwoosh {
|
|
|
54
53
|
takeWebPlacements(): Array<WebPlacement>;
|
|
55
54
|
private deliverWebPlacements;
|
|
56
55
|
private loadWebPopupsWidget;
|
|
56
|
+
/** @deprecated undocumented facade over `environment` kept for sites that read it; removed in the next major */
|
|
57
|
+
get platformChecker(): PlatformChecker;
|
|
57
58
|
/**
|
|
58
59
|
* Add Web SDK Event Handler.
|
|
59
60
|
* Alias to addEventHandler method of EventBus module.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/core/events.types.d.ts
CHANGED
|
@@ -48,6 +48,11 @@ export interface EventHandlerMap {
|
|
|
48
48
|
'update-inbox-messages': EventHandler<EventPayload<{
|
|
49
49
|
messages: unknown;
|
|
50
50
|
}>>;
|
|
51
|
+
'click-inbox-button': EventHandler<EventPayload<{
|
|
52
|
+
messageCode: string;
|
|
53
|
+
buttonId: string;
|
|
54
|
+
data: Record<string, unknown>;
|
|
55
|
+
}>>;
|
|
51
56
|
'receive-in-app-code': EventHandler<EventPayload<{
|
|
52
57
|
code: string;
|
|
53
58
|
}>>;
|
package/helpers/url.d.ts
CHANGED
|
@@ -2,3 +2,5 @@
|
|
|
2
2
|
export declare function isSafeUrl(url: string): boolean;
|
|
3
3
|
/** True when the url carries a scheme and that scheme is safe to navigate to. */
|
|
4
4
|
export declare function isSafeAbsoluteUrl(url: string): boolean;
|
|
5
|
+
/** True when the url opens an Android intent, whitespace and control characters ignored. */
|
|
6
|
+
export declare function isIntentUrl(url: string): boolean;
|
package/models/InboxCell.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { type IInboxMessageSlide, type IInboxUserData } from './InboxCell.types';
|
|
1
|
+
import { type IInboxMessageButton, type IInboxMessageSlide, type IInboxUserData } from './InboxCell.types';
|
|
2
2
|
import { type IInboxMessageActionParams } from './InboxMessages.types';
|
|
3
3
|
export declare function parseUserData(actionParams: IInboxMessageActionParams): IInboxUserData;
|
|
4
4
|
/** Slides we can draw: the ones with an image, at most {@link INBOX_MAX_CAROUSEL_SLIDES}. */
|
|
5
5
|
export declare function getValidSlides(userData: IInboxUserData): Array<IInboxMessageSlide>;
|
|
6
|
+
/** Labeled card buttons, at most {@link INBOX_MAX_BUTTONS}; id from the payload or the position, as in the mobile SDKs. */
|
|
7
|
+
export declare function getButtons(userData: IInboxUserData): Array<IInboxMessageButton>;
|
|
6
8
|
export declare function getHeroUrl(actionParams: IInboxMessageActionParams, userData: IInboxUserData, messageImage: string): string;
|
|
7
9
|
/** Small round avatar of a cell: the message image, or the one inside `u`. */
|
|
8
10
|
export declare function getIconUrl(userData: IInboxUserData, messageImage: string): string;
|
|
@@ -10,10 +10,23 @@ export interface IInboxSlideRaw {
|
|
|
10
10
|
title?: string;
|
|
11
11
|
url?: string;
|
|
12
12
|
}
|
|
13
|
+
/** One card button inside `action_params.u`; mobile-only legacy items may carry other actions and keys. */
|
|
14
|
+
export interface IInboxButtonRaw {
|
|
15
|
+
id?: unknown;
|
|
16
|
+
title?: unknown;
|
|
17
|
+
text_color?: unknown;
|
|
18
|
+
bg_color?: unknown;
|
|
19
|
+
action?: unknown;
|
|
20
|
+
url?: unknown;
|
|
21
|
+
copy_text?: unknown;
|
|
22
|
+
data?: unknown;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
}
|
|
13
25
|
/** Cell contract plus the campaign's custom data, merged flat by the pipeline. */
|
|
14
26
|
export interface IInboxUserData {
|
|
15
27
|
displayType?: string;
|
|
16
28
|
carousel?: Array<IInboxSlideRaw>;
|
|
29
|
+
buttons?: unknown;
|
|
17
30
|
image?: string;
|
|
18
31
|
[key: string]: unknown;
|
|
19
32
|
}
|
|
@@ -25,3 +38,22 @@ export interface IInboxMessageSlide {
|
|
|
25
38
|
/** Where a tap on the slide goes; empty when the slide has none, and the message action applies. */
|
|
26
39
|
link: string;
|
|
27
40
|
}
|
|
41
|
+
/** What a tap on a card button does. */
|
|
42
|
+
export type TInboxButtonAction = 'open' | 'copy' | 'custom';
|
|
43
|
+
/** One card button of a public inbox message. */
|
|
44
|
+
export interface IInboxMessageButton {
|
|
45
|
+
/** Button id from the payload, `"0"`..`"2"`; the position among the labeled buttons when the payload has none. Reported with the click. */
|
|
46
|
+
id: string;
|
|
47
|
+
title: string;
|
|
48
|
+
/** `#RRGGBB` or `#RRGGBBAA`; empty for the default of the style. */
|
|
49
|
+
textColor: string;
|
|
50
|
+
/** `#RRGGBB` or `#RRGGBBAA`; empty draws the button as a link. */
|
|
51
|
+
bgColor: string;
|
|
52
|
+
action: TInboxButtonAction;
|
|
53
|
+
/** Target of an `open` button; empty when none was sent or its scheme is unsafe. */
|
|
54
|
+
url: string;
|
|
55
|
+
/** Text a `copy` button puts on the clipboard. */
|
|
56
|
+
copyText: string;
|
|
57
|
+
/** Payload of a `custom` button, passed to the `click-inbox-button` event. */
|
|
58
|
+
data: Record<string, unknown>;
|
|
59
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IInboxMessageSlide, type TInboxLayout } from './InboxCell.types';
|
|
1
|
+
import { type IInboxMessageButton, type IInboxMessageSlide, type TInboxLayout } from './InboxCell.types';
|
|
2
2
|
export type TInboxActionLink = 1;
|
|
3
3
|
export type TInboxActionRichMedia = 2;
|
|
4
4
|
export type TInboxActionType = TInboxActionLink | TInboxActionRichMedia;
|
|
@@ -7,6 +7,7 @@ export type TInboxMessageStatusRead = 2;
|
|
|
7
7
|
export type TInboxMessageStatusOpen = 3;
|
|
8
8
|
export type TInboxMessageStatusDeleted = 4;
|
|
9
9
|
export type TInboxMessageStatus = TInboxMessageStatusDelivered | TInboxMessageStatusRead | TInboxMessageStatusOpen | TInboxMessageStatusDeleted;
|
|
10
|
+
export type TInboxMessageStatusButtonClick = 6;
|
|
10
11
|
export type TReadInboxMessagesStatusRange = [TInboxMessageStatusRead, TInboxMessageStatusOpen];
|
|
11
12
|
export interface IInboxMessageActionParams {
|
|
12
13
|
l?: string | null;
|
|
@@ -52,7 +53,8 @@ export interface IInboxStatusRequest {
|
|
|
52
53
|
application: string;
|
|
53
54
|
inbox_code: string;
|
|
54
55
|
time: number;
|
|
55
|
-
status: TInboxMessageStatus;
|
|
56
|
+
status: TInboxMessageStatus | TInboxMessageStatusButtonClick;
|
|
57
|
+
button_id?: string;
|
|
56
58
|
hash?: string;
|
|
57
59
|
device_type: number;
|
|
58
60
|
}
|
|
@@ -89,6 +91,8 @@ export interface IInboxMessagePublic {
|
|
|
89
91
|
customData: Record<string, unknown>;
|
|
90
92
|
/** Web popup a tap opens; empty when the message opens `link` instead. */
|
|
91
93
|
webPopupCode: string;
|
|
94
|
+
/** Card buttons by position, at most three; a label-less one is not drawn. */
|
|
95
|
+
buttons: Array<IInboxMessageButton>;
|
|
92
96
|
}
|
|
93
97
|
export interface IInboxMessages {
|
|
94
98
|
messagesWithNoActionPerformedCount(): Promise<number>;
|
|
@@ -97,6 +101,7 @@ export interface IInboxMessages {
|
|
|
97
101
|
loadMessages(): Promise<Array<IInboxMessagePublic>>;
|
|
98
102
|
readMessagesWithCodes(codes: Array<string>): Promise<void>;
|
|
99
103
|
performActionForMessageWithCode(code: string): Promise<void>;
|
|
104
|
+
reportButtonClick(code: string, buttonId: string): Promise<void>;
|
|
100
105
|
deleteMessagesWithCodes(codes: Array<string>): Promise<void>;
|
|
101
106
|
syncMessages(): Promise<void>;
|
|
102
107
|
publicMessageBuilder(message: IInboxMessage): Promise<IInboxMessagePublic>;
|
package/modules/Api/Api.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare class Api {
|
|
|
62
62
|
[key: string]: any;
|
|
63
63
|
}, init?: IRequestInit): Promise<IMapResponse['postEvent']>;
|
|
64
64
|
getInboxMessages(count?: number): Promise<IMapResponse['getInboxMessages']>;
|
|
65
|
-
inboxStatus(order: string, status: number): Promise<IMapResponse['inboxStatus']>;
|
|
65
|
+
inboxStatus(order: string, status: number, buttonId?: string, init?: IRequestInit): Promise<IMapResponse['inboxStatus']>;
|
|
66
66
|
multiRegisterDevice(request: Partial<MultiRegisterDeviceRequest>): Promise<IMapResponse['multiRegisterDevice']>;
|
|
67
67
|
getParams(): Promise<any>;
|
|
68
68
|
private getRequestParams;
|
|
@@ -3,6 +3,7 @@ import { Logger } from '../../core/logger';
|
|
|
3
3
|
import { Data } from '../Data/Data';
|
|
4
4
|
export type IRequestInit = {
|
|
5
5
|
keepalive?: boolean;
|
|
6
|
+
onSent?: () => void;
|
|
6
7
|
};
|
|
7
8
|
export declare class ApiClient {
|
|
8
9
|
private readonly data;
|
|
@@ -30,7 +31,7 @@ export declare class ApiClient {
|
|
|
30
31
|
setEmailTags(options: IMapRequest['setEmailTags']): Promise<IMapResponse['setEmailTags']>;
|
|
31
32
|
postEvent(options: IMapRequest['postEvent'], init?: IRequestInit): Promise<IMapResponse['postEvent']>;
|
|
32
33
|
getInboxMessages(options: IMapRequest['getInboxMessages']): Promise<IMapResponse['getInboxMessages']>;
|
|
33
|
-
inboxStatus(options: IMapRequest['inboxStatus']): Promise<IMapResponse['inboxStatus']>;
|
|
34
|
+
inboxStatus(options: IMapRequest['inboxStatus'], init?: IRequestInit): Promise<IMapResponse['inboxStatus']>;
|
|
34
35
|
multiRegisterDevice(options: IMapRequest['multiRegisterDevice']): Promise<IMapResponse['multiRegisterDevice']>;
|
|
35
36
|
sdkUsage(options: IMapRequest['sdkUsage'], init?: IRequestInit): Promise<IMapResponse['sdkUsage']>;
|
|
36
37
|
private createRequest;
|
|
@@ -138,6 +138,7 @@ interface IRequestInboxStatus extends IRequest {
|
|
|
138
138
|
inbox_code: string;
|
|
139
139
|
time: number;
|
|
140
140
|
status: number;
|
|
141
|
+
button_id?: string;
|
|
141
142
|
hash?: string;
|
|
142
143
|
device_type: number;
|
|
143
144
|
}
|
|
@@ -178,6 +179,7 @@ interface IRequestSdkUsage extends IRequest {
|
|
|
178
179
|
init_keys: string[];
|
|
179
180
|
events: string[];
|
|
180
181
|
legacy_events: string[];
|
|
182
|
+
deprecated_apis: string[];
|
|
181
183
|
}
|
|
182
184
|
interface IResponsePostEvent {
|
|
183
185
|
code?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -57,6 +57,9 @@ export default class InboxMessages implements IInboxMessages {
|
|
|
57
57
|
* @param code
|
|
58
58
|
*/
|
|
59
59
|
performActionForMessageWithCode(code: string): Promise<void>;
|
|
60
|
+
/** Report a card button tap: status 3 once per message, then 6 with `buttonId`; resolves once both are sent. */
|
|
61
|
+
reportButtonClick(code: string, buttonId: string): Promise<void>;
|
|
62
|
+
private sendStatus;
|
|
60
63
|
private showWebPopup;
|
|
61
64
|
/**
|
|
62
65
|
* Delete messages by codes
|
|
@@ -4,16 +4,19 @@ export interface ISdkUsageReport {
|
|
|
4
4
|
init_keys: string[];
|
|
5
5
|
events: string[];
|
|
6
6
|
legacy_events: string[];
|
|
7
|
+
deprecated_apis: string[];
|
|
7
8
|
}
|
|
8
9
|
export type TSendSdkUsage = (report: ISdkUsageReport, init: IRequestInit) => Promise<unknown>;
|
|
9
10
|
export declare class SdkUsage {
|
|
10
11
|
private readonly initKeys;
|
|
11
12
|
private readonly events;
|
|
12
13
|
private readonly legacyEvents;
|
|
14
|
+
private readonly deprecatedApis;
|
|
13
15
|
private isListening;
|
|
14
16
|
recordInitParams(params: object): void;
|
|
15
17
|
recordEvent(name: string): void;
|
|
16
18
|
recordLegacyEvent(name: string): void;
|
|
19
|
+
recordDeprecatedApi(name: string): void;
|
|
17
20
|
listen(send: TSendSdkUsage): void;
|
|
18
21
|
flush(send: TSendSdkUsage): void;
|
|
19
22
|
}
|