web-push-notifications 3.116.0 → 3.118.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 +24 -0
- package/core/Pushwoosh.d.ts +5 -2
- package/modules/PlatformChecker/PlatformChecker.constants.d.ts +5 -1
- package/modules/PlatformChecker/PlatformChecker.d.ts +21 -45
- package/modules/PlatformChecker/PlatformChecker.types.d.ts +14 -1
- package/modules/PlatformChecker/__tests__/detectBrowser.test.d.ts +1 -0
- package/modules/PlatformChecker/__tests__/detectEnvironment.test.d.ts +1 -0
- package/modules/PlatformChecker/__tests__/getFormFactor.test.d.ts +1 -0
- package/modules/PlatformChecker/__tests__/getPushCapabilities.test.d.ts +1 -0
- package/modules/PlatformChecker/__tests__/resolvePlatform.test.d.ts +1 -0
- package/modules/PlatformChecker/detectBrowser.d.ts +4 -0
- package/modules/PlatformChecker/detectEnvironment.d.ts +3 -0
- package/modules/PlatformChecker/getFormFactor.d.ts +8 -0
- package/modules/PlatformChecker/getPushCapabilities.d.ts +2 -0
- package/modules/PlatformChecker/index.d.ts +5 -0
- package/modules/PlatformChecker/resolvePlatform.d.ts +15 -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-subscription-button.js +1 -1
- package/widget-subscription-button.js.map +1 -1
- package/widget-web-popups.js +1 -1
- package/widget-web-popups.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,30 @@ 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
|
+
## refactor(platform-checker): deprecate the PlatformChecker facade
|
|
13
|
+
|
|
14
|
+
- The SDK keeps what it detects about the browser in `Pushwoosh.environment` (`browser`, `capabilities`,
|
|
15
|
+
`formFactor`; tagged `@internal`) and reads it from there; `Pushwoosh.platformChecker` is a facade
|
|
16
|
+
over it that nothing in the SDK uses any more.
|
|
17
|
+
- `PlatformChecker` and `Pushwoosh.platformChecker` are deprecated. They were never documented;
|
|
18
|
+
a site that reads them keeps working in 3.x and loses them in the next major version.
|
|
19
|
+
|
|
20
|
+
## refactor(platform-checker): split browser detection into pure functions
|
|
21
|
+
|
|
22
|
+
- `PlatformChecker` is split into `detectBrowser`, `getFormFactor`, `getPushCapabilities` and `resolvePlatform`; the
|
|
23
|
+
class stays as a facade for sites that read `Pushwoosh.platformChecker`, its remaining getters marked deprecated.
|
|
24
|
+
- The Safari driver choice no longer reads the user agent: the legacy path follows `window.safari.pushNotification`.
|
|
25
|
+
The platform code comes from that path and `unifiedPlatform`; the user agent only tells Firefox (`12`) from the rest.
|
|
26
|
+
- Device type and device model sent with `registerDevice` are unchanged. Legacy EdgeHTML, which no longer exists in
|
|
27
|
+
the wild, is reported as `11` instead of the unrouted `150`.
|
|
28
|
+
- The subscription button shows the Safari help images to every Safari, iOS included; iOS Safari used to get Chrome's.
|
|
29
|
+
- `platformChecker` behaviour changes for sites that read it: `isSafari` now means `window.safari.pushNotification`
|
|
30
|
+
exists, where it used to need only `window.safari` and "Safari" in the user agent; `isEdge` is now true for Chromium
|
|
31
|
+
Edge.
|
|
32
|
+
- Breaking for sites that call them: the `isSafariBrowser`, `isOperaBrowser`, `isEdgeBrowser`, `isFirefoxBrowser`,
|
|
33
|
+
`isChromeBrowser`, `isMacOS`, `canUseServiceWorkers` and `canReceiveNotifications` methods are removed. Use
|
|
34
|
+
`browser.name`, `capabilities` and `isAvailableNotifications` instead; `isMacOS` has no replacement.
|
|
35
|
+
|
|
12
36
|
## feat(web-popups): count push subscriptions made by a campaign's subscribe button
|
|
13
37
|
|
|
14
38
|
- A `subscribe` button of a web campaign now reports `recordPopupFormEvent` with event `4` (`PUSH_SUBSCRIBE`) when the
|
package/core/Pushwoosh.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { Data } from '../modules/Data/Data';
|
|
|
6
6
|
import { FeatureFlags } from '../modules/FeatureFlags/FeatureFlags';
|
|
7
7
|
import InboxMessagesPublic from '../modules/InboxMessagesPublic';
|
|
8
8
|
import { PlatformChecker } from '../modules/PlatformChecker';
|
|
9
|
+
import { type IEnvironment } from '../modules/PlatformChecker/PlatformChecker.types';
|
|
9
10
|
import { Recommendations } from '../modules/Recommendations/Recommendations';
|
|
10
11
|
import { type IProductView } from '../modules/Recommendations/Recommendations.types';
|
|
11
12
|
import { type TPushPermissionStatus } from '../services/PushService/pushPermissionStatus';
|
|
@@ -22,7 +23,10 @@ export declare class Pushwoosh {
|
|
|
22
23
|
private isCommunicationDisabled?;
|
|
23
24
|
readonly api: Api;
|
|
24
25
|
driver?: IPushService;
|
|
25
|
-
|
|
26
|
+
/** @internal browser, push capabilities and form factor, detected once at startup */
|
|
27
|
+
readonly environment: IEnvironment;
|
|
28
|
+
/** @deprecated undocumented facade over `environment` kept for sites that read it; removed in the next major */
|
|
29
|
+
readonly platformChecker: PlatformChecker;
|
|
26
30
|
private isPushDisabled;
|
|
27
31
|
private isInitAborted;
|
|
28
32
|
private isPushPermissionWatched;
|
|
@@ -209,7 +213,6 @@ export declare class Pushwoosh {
|
|
|
209
213
|
/** Logged once per init and read by the integrator in the console, so it names the parameter to fix. */
|
|
210
214
|
private abortInit;
|
|
211
215
|
private resolvePlatformType;
|
|
212
|
-
private detectLegacySafari;
|
|
213
216
|
private ensureHwid;
|
|
214
217
|
private readHwid;
|
|
215
218
|
/** `user_id` is the documented placeholder for "no userId", so it identifies nobody. */
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { type TPlatformChrome, type TPlatformFirefox, type TPlatformSafari } from './PlatformChecker.types';
|
|
2
|
+
export declare const PLATFORM_SAFARI: TPlatformSafari;
|
|
3
|
+
export declare const PLATFORM_CHROME: TPlatformChrome;
|
|
4
|
+
export declare const PLATFORM_FIREFOX: TPlatformFirefox;
|
|
5
|
+
export declare const UNIFIED_PLATFORM: 11;
|
|
@@ -1,54 +1,30 @@
|
|
|
1
|
-
import { type TFormFactor, type TPlatform } from './PlatformChecker.types';
|
|
1
|
+
import { type IBrowserInfo, type IEnvironment, type IPushCapabilities, type TFormFactor, type TPlatform } from './PlatformChecker.types';
|
|
2
|
+
/** @deprecated undocumented facade kept for sites reading `Pushwoosh.platformChecker`; removed in the next major */
|
|
2
3
|
export declare class PlatformChecker {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Browser name + version
|
|
14
|
-
* Example: "Chrome 70"
|
|
15
|
-
*/
|
|
16
|
-
private readonly _browserVersion;
|
|
17
|
-
private readonly _platform;
|
|
18
|
-
private readonly _formFactor;
|
|
19
|
-
constructor(global: typeof globalThis);
|
|
20
|
-
get isEdge(): boolean;
|
|
4
|
+
readonly browser: IBrowserInfo;
|
|
5
|
+
readonly capabilities: IPushCapabilities;
|
|
6
|
+
readonly formFactor: TFormFactor;
|
|
7
|
+
constructor(environment: IEnvironment);
|
|
8
|
+
/** @deprecated use Pushwoosh.isAvailableNotifications() */
|
|
9
|
+
get isAvailableNotifications(): boolean;
|
|
10
|
+
/** @deprecated use capabilities.webPush */
|
|
11
|
+
get isAvailableServiceWorker(): boolean;
|
|
12
|
+
/** @deprecated use capabilities.safariLegacy */
|
|
21
13
|
get isSafari(): boolean;
|
|
14
|
+
/** @deprecated use browser.name */
|
|
22
15
|
get isOpera(): boolean;
|
|
23
|
-
|
|
24
|
-
get
|
|
25
|
-
|
|
16
|
+
/** @deprecated use browser.name */
|
|
17
|
+
get isEdge(): boolean;
|
|
18
|
+
/** @deprecated use browser.model */
|
|
26
19
|
get browserVersion(): string;
|
|
27
|
-
get formFactor(): TFormFactor;
|
|
28
20
|
get isMobile(): boolean;
|
|
29
21
|
get isDesktop(): boolean;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
isFirefoxBrowser(): boolean;
|
|
34
|
-
isChromeBrowser(): boolean;
|
|
35
|
-
isMacOS(): boolean;
|
|
36
|
-
canUseServiceWorkers(): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Check availability ServiceWorker or safari browser on macos
|
|
39
|
-
*/
|
|
40
|
-
canReceiveNotifications(): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Get Pushwoosh system platform code
|
|
43
|
-
*/
|
|
22
|
+
/** @deprecated the SDK resolves the platform with its init params */
|
|
23
|
+
get platform(): TPlatform;
|
|
24
|
+
/** @deprecated the SDK resolves the platform with its init params */
|
|
44
25
|
getPlatformType(): TPlatform;
|
|
45
|
-
/**
|
|
46
|
-
* Detect whether the current device is mobile or desktop.
|
|
47
|
-
* Prefers the modern `navigator.userAgentData` hint and falls back to userAgent parsing.
|
|
48
|
-
*/
|
|
49
|
-
getFormFactor(): TFormFactor;
|
|
50
|
-
/**
|
|
51
|
-
* Get browser name + version from userAgent
|
|
52
|
-
*/
|
|
26
|
+
/** @deprecated use browser.model */
|
|
53
27
|
getBrowserVersion(): string;
|
|
28
|
+
/** @deprecated use formFactor */
|
|
29
|
+
getFormFactor(): TFormFactor;
|
|
54
30
|
}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
export type TPlatformSafari = 10;
|
|
2
2
|
export type TPlatformChrome = 11;
|
|
3
3
|
export type TPlatformFirefox = 12;
|
|
4
|
-
export type TPlatformEdge = 150;
|
|
5
4
|
export type TPlatform = TPlatformSafari | TPlatformChrome | TPlatformFirefox;
|
|
6
5
|
export type TFormFactor = 'MOBILE' | 'DESKTOP';
|
|
6
|
+
export type TBrowserName = 'opera' | 'edge' | 'firefox' | 'chrome' | 'safari' | 'unknown';
|
|
7
|
+
export interface IBrowserInfo {
|
|
8
|
+
name: TBrowserName;
|
|
9
|
+
model: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IPushCapabilities {
|
|
12
|
+
webPush: boolean;
|
|
13
|
+
safariLegacy: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface IEnvironment {
|
|
16
|
+
browser: IBrowserInfo;
|
|
17
|
+
capabilities: IPushCapabilities;
|
|
18
|
+
formFactor: TFormFactor;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type TFormFactor } from './PlatformChecker.types';
|
|
2
|
+
type TNavigatorWithHints = Pick<Navigator, 'userAgent'> & {
|
|
3
|
+
userAgentData?: {
|
|
4
|
+
mobile?: boolean;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare function getFormFactor(navigator: TNavigatorWithHints): TFormFactor;
|
|
8
|
+
export {};
|
|
@@ -1 +1,6 @@
|
|
|
1
1
|
export { PlatformChecker } from './PlatformChecker';
|
|
2
|
+
export { canReceivePush, detectEnvironment } from './detectEnvironment';
|
|
3
|
+
export { detectBrowser } from './detectBrowser';
|
|
4
|
+
export { getFormFactor } from './getFormFactor';
|
|
5
|
+
export { getPushCapabilities } from './getPushCapabilities';
|
|
6
|
+
export { isLegacySafariPath, resolvePlatform } from './resolvePlatform';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type IPushCapabilities, type TBrowserName, type TPlatform } from './PlatformChecker.types';
|
|
2
|
+
interface ILegacySafariInput {
|
|
3
|
+
capabilities: IPushCapabilities;
|
|
4
|
+
hasLegacySubscription: boolean;
|
|
5
|
+
webVapidConfigured: boolean;
|
|
6
|
+
unifiedPlatform: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function isLegacySafariPath({ capabilities, hasLegacySubscription, webVapidConfigured, unifiedPlatform }: ILegacySafariInput): boolean;
|
|
9
|
+
interface IPlatformInput {
|
|
10
|
+
legacySafari: boolean;
|
|
11
|
+
unifiedPlatform: boolean;
|
|
12
|
+
browser: TBrowserName;
|
|
13
|
+
}
|
|
14
|
+
export declare function resolvePlatform({ legacySafari, unifiedPlatform, browser }: IPlatformInput): TPlatform;
|
|
15
|
+
export {};
|