web-push-notifications 3.124.0 → 3.125.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 +57 -0
- package/core/Pushwoosh.d.ts +5 -0
- package/core/__tests__/sharedDevice/browser.d.ts +66 -0
- package/core/__tests__/sharedDevice/excludedSites.test.d.ts +1 -0
- package/core/__tests__/sharedDevice/getHWID.test.d.ts +1 -0
- package/core/__tests__/sharedDevice/isSubscribed.test.d.ts +1 -0
- package/core/__tests__/sharedDevice/legacyApplication.test.d.ts +1 -0
- package/core/__tests__/sharedDevice/merge.test.d.ts +1 -0
- package/core/__tests__/sharedDevice/registerUser.test.d.ts +1 -0
- package/core/__tests__/sharedDevice/removeAllDeviceData.test.d.ts +1 -0
- package/core/__tests__/sharedDevice/requests.test.d.ts +1 -0
- package/core/__tests__/sharedDevice/serviceWorker.test.d.ts +1 -0
- package/core/__tests__/sharedDevice/setCommunicationEnabled.test.d.ts +1 -0
- package/core/__tests__/sharedDevice/setTags.test.d.ts +1 -0
- package/core/__tests__/sharedDevice/unsubscribe.test.d.ts +1 -0
- package/core/resolveInitParams.d.ts +5 -1
- package/core/storage.d.ts +1 -0
- package/modules/Api/Api.d.ts +10 -3
- package/modules/ApiClient/ApiClient.types.d.ts +1 -0
- package/modules/Data/Data.d.ts +11 -0
- package/modules/SharedDevice/SharedDevice.d.ts +29 -0
- package/modules/SharedDevice/SharedDeviceRecord.d.ts +18 -0
- package/modules/SharedDevice/excludedSites.d.ts +2 -0
- package/modules/SharedDevice/rootDomain.d.ts +1 -0
- package/npm.js +1 -1
- package/npm.js.map +1 -1
- package/package.json +1 -1
- package/service-worker.js +1 -1
- package/service-worker.js.map +1 -1
- package/services/PushService/drivers/PushServiceDefault/PushServiceDefault.types.d.ts +1 -0
- package/widget-recommendations.js.map +1 -1
- package/widget-subscription.js.map +1 -1
- package/widget-web-popups.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,63 @@ 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(shared-device): one device for the subdomains of a root domain, with merged duplicates and excluded sites
|
|
13
|
+
|
|
14
|
+
- An application with `sharedDevice.enable` in its panel-managed config (`web_sdk`, or `web_sdk_modules` for a legacy application) gives the
|
|
15
|
+
subdomains of one root domain one device: a visitor subscribed on `shop.example.com` is subscribed on
|
|
16
|
+
`blog.example.com` and `example.com` too, with one HWID. Without the key every site keeps its own device, as before.
|
|
17
|
+
- The shared device lives in a cookie `pw_shared_device_<applicationCode>` on the root domain: its HWID, whether it is
|
|
18
|
+
subscribed, the origin whose push token it holds, a manual unsubscribe, whether the visitor must be asked before it
|
|
19
|
+
is subscribed again, and the userId of its owner. The root
|
|
20
|
+
domain is the widest one the browser lets a page set a cookie on, so `co.uk` and shared hostings like `vercel.app`
|
|
21
|
+
are never shared.
|
|
22
|
+
- Only the site whose push token the shared device holds unsubscribes it when its permission is gone; another site,
|
|
23
|
+
even one with an older token of its own, does not, and does not report its own `Push Permission Status` over a
|
|
24
|
+
subscription made elsewhere. A manual unsubscribe on any site holds on all of them, one made before the key was
|
|
25
|
+
switched on holds on its site, and a shared subscription that is gone is asked for again, not renewed quietly:
|
|
26
|
+
a site with permission does not subscribe by itself, one without it shows the subscribe popup.
|
|
27
|
+
- A sign-in on any subdomain makes the visitor the owner without a new HWID; a site that passes no userId works as
|
|
28
|
+
that owner, user tags included.
|
|
29
|
+
- `setCommunicationEnabled(false)` and `removeAllDeviceData()` on one subdomain retire the shared device: the others
|
|
30
|
+
start on a new unsubscribed one, which they ask the visitor to subscribe rather than subscribe by themselves, and the
|
|
31
|
+
site stays off it until the visitor consents again.
|
|
32
|
+
- A site that passes no userId and worked as the owner of the retired shared device does not take that owner to the
|
|
33
|
+
new one, merging into it or not: it goes back to the userId signed in on it, if any.
|
|
34
|
+
- Switching the key off moves every site but the one holding the push token back to a device of its own; nothing is
|
|
35
|
+
unsubscribed.
|
|
36
|
+
- The service worker sends `keep_user_id: true` with the `registerDevice` of a renewed push subscription, so the
|
|
37
|
+
device keeps the owner it cannot see from there.
|
|
38
|
+
- `PW_SiteOpened` is sent once the device is chosen, so the visit on which a site joins the shared device is reported
|
|
39
|
+
on the shared HWID.
|
|
40
|
+
- A site with a push subscription of its own that joins a subscribed shared device under another HWID merges into it:
|
|
41
|
+
its previous device is unsubscribed (`unregisterDevice` by the previous HWID, no `unsubscribe` event, no manual
|
|
42
|
+
unsubscribe), and its tags and history stay there. The visitor gets each push once.
|
|
43
|
+
- A site merges only into a shared subscription the server still holds (`checkDevice` by the shared HWID): if the
|
|
44
|
+
server has dropped it, the site keeps its subscription and its device becomes the shared one.
|
|
45
|
+
- The merged site keeps no subscription of its own: its push token and its browser push subscription are dropped, the
|
|
46
|
+
permission is left as is. A browser renewal on that site then cannot replace the shared subscription, and switching
|
|
47
|
+
the feature off moves the site to a device of its own without touching the shared one.
|
|
48
|
+
- A visitor signed in on the merged site, by `userId` in init or an earlier `registerUser`, becomes the owner of the
|
|
49
|
+
shared device; an anonymous site leaves the owner as it is. The owner changes before the site unsubscribes or drops
|
|
50
|
+
anything, so a merge cut short by a closed tab either runs again in full on the next visit or has already handed
|
|
51
|
+
the device over.
|
|
52
|
+
- A site that joined the shared device before merging existed and kept its own subscription drops it the same way on
|
|
53
|
+
its next visit; its previous device is not unsubscribed, as its HWID is no longer known, and that token just dies.
|
|
54
|
+
- `sharedDevice.excludedSites` in the panel-managed config lists sites that keep a device of their own, as without the
|
|
55
|
+
feature: their own HWID, and the subscribe popup by their own permission. A site is excluded when its host equals a
|
|
56
|
+
listed one, `www.` and case aside; its subdomains and the root domain stay on the shared device. A host with a
|
|
57
|
+
Cyrillic domain is compared in punycode, which is how the panel saves it.
|
|
58
|
+
- A site that becomes excluded while the shared device holds its subscription takes that subscription to a new HWID of
|
|
59
|
+
its own; the shared device is marked unsubscribed, and the other sites ask the visitor again instead of subscribing.
|
|
60
|
+
- A site leaving the shared device, excluded or with the feature off, keeps only the userId signed in on it, one an
|
|
61
|
+
earlier release stored included; the owner taken from the shared device stays there. A manual unsubscribe taken
|
|
62
|
+
from the shared device is dropped, unless a refusal of communication on the site made it its own; the site's own,
|
|
63
|
+
even one made before it joined, comes back.
|
|
64
|
+
- A legacy application, set up by the snippet, takes `sharedDevice` from `web_sdk_modules` as well, so the feature and
|
|
65
|
+
its excluded sites work there as for a panel-managed one; without the key there the feature stays off.
|
|
66
|
+
- `setCommunicationEnabled(false)` now survives a page reload: a stored `false`, `0` or empty string was read back as
|
|
67
|
+
no value, so the next `init` took communication as enabled again.
|
|
68
|
+
|
|
12
69
|
## feat(web-popups): taller side arrows from websdk-common 6.35.2
|
|
13
70
|
|
|
14
71
|
- The side arrows of a web popup are taller: 14×36 px (was 14×28), the width unchanged.
|
package/core/Pushwoosh.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export declare class Pushwoosh {
|
|
|
22
22
|
private readonly apiClient;
|
|
23
23
|
private isCommunicationDisabled?;
|
|
24
24
|
readonly api: Api;
|
|
25
|
+
private readonly sharedDevice;
|
|
26
|
+
private isSharedDeviceEnabled;
|
|
25
27
|
driver?: IPushService;
|
|
26
28
|
/** @internal browser, push capabilities and form factor, detected once at startup */
|
|
27
29
|
readonly environment: IEnvironment;
|
|
@@ -31,6 +33,7 @@ export declare class Pushwoosh {
|
|
|
31
33
|
private isPushPermissionWatched;
|
|
32
34
|
private subscriptionInFlight;
|
|
33
35
|
private isWebVapidConfigured;
|
|
36
|
+
private isSiteOpenedEventOn;
|
|
34
37
|
private isLegacySafari;
|
|
35
38
|
private knownPermission?;
|
|
36
39
|
private readonly waitForPermissionWork;
|
|
@@ -243,9 +246,11 @@ export declare class Pushwoosh {
|
|
|
243
246
|
* not_determined as DEFAULT, granted_explicit as GRANTED, denied as DENIED and unsupported as UNSUPPORTED.
|
|
244
247
|
*/
|
|
245
248
|
getPushPermissionStatus(): TPushPermissionStatus;
|
|
249
|
+
private getReportedPushPermissionStatus;
|
|
246
250
|
private readPermission;
|
|
247
251
|
private announcePermissionChange;
|
|
248
252
|
private reportPushPermissionChange;
|
|
253
|
+
private dropSubscription;
|
|
249
254
|
private dropRevokedSubscription;
|
|
250
255
|
private reportPushPermissionChangeInBackground;
|
|
251
256
|
private watchPushPermission;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Pushwoosh as TPushwoosh } from '../../Pushwoosh';
|
|
2
|
+
type TApiRequest = Record<string, any>;
|
|
3
|
+
interface IServerDevice {
|
|
4
|
+
pushToken?: string;
|
|
5
|
+
userId?: string;
|
|
6
|
+
tags: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
/** Device API as the SDK sees it: one device per application and hwid, one push token and one owner per device. */
|
|
9
|
+
export declare class FakeBackend {
|
|
10
|
+
readonly calls: Array<{
|
|
11
|
+
method: string;
|
|
12
|
+
request: TApiRequest;
|
|
13
|
+
}>;
|
|
14
|
+
private readonly devices;
|
|
15
|
+
private readonly configs;
|
|
16
|
+
private readonly modules;
|
|
17
|
+
private readonly events;
|
|
18
|
+
private readonly pending;
|
|
19
|
+
/** Runs once, right before the first such call is answered: what another tab does while this page waits. */
|
|
20
|
+
beforeAnswer(method: string, hwid: string, action: () => void): void;
|
|
21
|
+
/** The Web SDK config a managed application saved in the panel. */
|
|
22
|
+
setWebSdkConfig(application: string, config: Record<string, unknown>): void;
|
|
23
|
+
/** The keys of the Web SDK config the server hands to a legacy application, which gets no whole config. */
|
|
24
|
+
setWebSdkModules(application: string, modules: Record<string, unknown>): void;
|
|
25
|
+
/** Default events the application has on, such as PW_SiteOpened. */
|
|
26
|
+
setEvents(application: string, events: string[]): void;
|
|
27
|
+
device(application: string, hwid: string): IServerDevice | undefined;
|
|
28
|
+
hwids(application: string): string[];
|
|
29
|
+
callsOf(method: string, hwid?: string): TApiRequest[];
|
|
30
|
+
handle(method: string, request: TApiRequest): Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
export interface IPage {
|
|
33
|
+
readonly pw: TPushwoosh;
|
|
34
|
+
init(params: object): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
export declare const settle: (ms?: number) => Promise<void>;
|
|
37
|
+
/** Whether the subscribe popup would invite the visitor on this page. */
|
|
38
|
+
export declare function isInvitedToSubscribe(page: IPage): Promise<boolean>;
|
|
39
|
+
/** One browser profile: a cookie jar for all sites, and storage, permission and push subscription per origin. */
|
|
40
|
+
export declare class FakeBrowser {
|
|
41
|
+
readonly backend: FakeBackend;
|
|
42
|
+
private readonly sites;
|
|
43
|
+
private current;
|
|
44
|
+
constructor();
|
|
45
|
+
/** Sets what the browser holds for an origin; `answer` is what the visitor picks in the permission dialog. */
|
|
46
|
+
setPermission(url: string, permission: NotificationPermission, answer?: NotificationPermission): void;
|
|
47
|
+
permission(url: string): NotificationPermission;
|
|
48
|
+
subscription(url: string): PushSubscription | null;
|
|
49
|
+
/** How many times one push to the application, or to one of its users, reaches the visitor: once per device with a live token. */
|
|
50
|
+
deliveries(application: string, userId?: string): number;
|
|
51
|
+
/** The visitor closes the tab once its page starts to drop the push subscription of the site: that page goes no further. */
|
|
52
|
+
closeOnUnsubscribe(url: string): Promise<void>;
|
|
53
|
+
/** Drops keys the SDK stored for an origin, leaving its storage as a release that never wrote them would. */
|
|
54
|
+
forgetStored(url: string, ...keys: string[]): Promise<void>;
|
|
55
|
+
/** The cookie jar of the whole profile, to be put back later. */
|
|
56
|
+
saveCookies(): unknown;
|
|
57
|
+
restoreCookies(saved: unknown): void;
|
|
58
|
+
/** The visitor changes the permission of the current site in the browser settings while its page is open. */
|
|
59
|
+
changePermission(permission: NotificationPermission): Promise<void>;
|
|
60
|
+
/** The browser renews the push subscription of the current site, if it has one, and tells its service worker. */
|
|
61
|
+
renewPushSubscription(): Promise<PushSubscription | null>;
|
|
62
|
+
open(url: string): Promise<IPage>;
|
|
63
|
+
private site;
|
|
64
|
+
private pushSubscription;
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
@@ -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 @@
|
|
|
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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -11,8 +11,12 @@ export interface IServerInitParams {
|
|
|
11
11
|
subscriptionWidget?: ISubscriptionWidgetParams;
|
|
12
12
|
inboxWidget?: Partial<IInboxWidget>;
|
|
13
13
|
webPopups?: Pick<IWebPopupsConfig, 'enable'>;
|
|
14
|
+
sharedDevice?: {
|
|
15
|
+
enable?: boolean;
|
|
16
|
+
excludedSites?: string[];
|
|
17
|
+
};
|
|
14
18
|
}
|
|
15
|
-
export type IServerModules = Pick<IServerInitParams, 'inboxWidget' | 'webPopups'>;
|
|
19
|
+
export type IServerModules = Pick<IServerInitParams, 'inboxWidget' | 'webPopups' | 'sharedDevice'>;
|
|
16
20
|
export declare function serverInitParams(features?: {
|
|
17
21
|
web_sdk?: IServerInitParams;
|
|
18
22
|
web_sdk_modules?: IServerModules;
|
package/core/storage.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare class LogMessage extends LogBase {
|
|
|
19
19
|
}
|
|
20
20
|
export declare const keyValue: {
|
|
21
21
|
get<K extends string, D>(key: K, defaultValue?: D): any;
|
|
22
|
+
getStored<K extends string>(key: K): any;
|
|
22
23
|
getAll(): any;
|
|
23
24
|
extend(key: string, value: any): Promise<void>;
|
|
24
25
|
set<K, D>(key: K, value: D): any;
|
package/modules/Api/Api.d.ts
CHANGED
|
@@ -22,7 +22,10 @@ export declare class Api {
|
|
|
22
22
|
constructor(eventBus: EventBus, data?: Data, apiClient?: ApiClient, getIsCommunicationDisabled?: () => boolean | undefined, getInitUserId?: () => string | undefined, getPushPermissionStatus?: () => TPushPermissionStatus | undefined);
|
|
23
23
|
checkDevice(): Promise<IMapResponse['checkDevice']>;
|
|
24
24
|
private requestCheckDevice;
|
|
25
|
+
/** The page moved to another device: what it knew about the previous one says nothing about this one. */
|
|
26
|
+
forgetDeviceStatus(): void;
|
|
25
27
|
checkDeviceSubscribeForPushNotifications(useCache?: boolean): Promise<boolean>;
|
|
28
|
+
isDeviceSubscribed(hwid: string): Promise<boolean>;
|
|
26
29
|
ensureDeviceRegistered(): Promise<boolean>;
|
|
27
30
|
private registerDeviceIfNotExist;
|
|
28
31
|
reportPushPermissionStatus(isTokenDead?: boolean): Promise<void>;
|
|
@@ -30,9 +33,13 @@ export declare class Api {
|
|
|
30
33
|
private rememberReportedPushPermissionStatus;
|
|
31
34
|
getConfig(features: string[]): Promise<IMapResponse['getConfig']>;
|
|
32
35
|
applicationOpen(): Promise<IMapResponse['applicationOpen']>;
|
|
33
|
-
registerDevice(
|
|
36
|
+
registerDevice({ keepUserId }?: {
|
|
37
|
+
keepUserId?: boolean;
|
|
38
|
+
}): Promise<IMapResponse['registerDevice']>;
|
|
34
39
|
private requestRegisterDevice;
|
|
35
|
-
unregisterDevice(
|
|
40
|
+
unregisterDevice({ silent }?: {
|
|
41
|
+
silent?: boolean;
|
|
42
|
+
}): Promise<IMapResponse['unregisterDevice']>;
|
|
36
43
|
deleteDevice(): Promise<IMapResponse['deleteDevice']>;
|
|
37
44
|
messageDeliveryEvent(hash: string, isTrackingLogOnFailure?: boolean, metaData?: {
|
|
38
45
|
[key: string]: any;
|
|
@@ -47,7 +54,7 @@ export declare class Api {
|
|
|
47
54
|
setLanguage(language: string): Promise<IMapResponse['setTags']>;
|
|
48
55
|
setLocale(locale: string | null): Promise<void>;
|
|
49
56
|
getLocale(): Promise<string | undefined>;
|
|
50
|
-
registerUser(userId: string | number, isManual?: boolean): Promise<IMapResponse['registerUser']>;
|
|
57
|
+
registerUser(userId: string | number, isManual?: boolean, deviceHwid?: string): Promise<IMapResponse['registerUser']>;
|
|
51
58
|
registerEmail(email: string, isManual?: boolean): Promise<IMapResponse['registerEmail']>;
|
|
52
59
|
registerSmsNumber(number: string, isManual?: boolean): Promise<IMapResponse['registerSmsNumber']>;
|
|
53
60
|
registerWhatsappNumber(number: string, isManual?: boolean): Promise<IMapResponse['registerWhatsappNumber']>;
|
package/modules/Data/Data.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export declare class Data {
|
|
|
12
12
|
getApiToken(): Promise<string>;
|
|
13
13
|
setHwid(hwid: string): Promise<void>;
|
|
14
14
|
getHwid(): Promise<string>;
|
|
15
|
+
setSharedDeviceHwid(hwid: string | undefined): Promise<void>;
|
|
16
|
+
getSharedDeviceHwid(): Promise<string | undefined>;
|
|
15
17
|
setDeviceType(type: number): Promise<void>;
|
|
16
18
|
getDeviceType(): Promise<number>;
|
|
17
19
|
setFormFactor(formFactor: 'DESKTOP' | 'MOBILE'): Promise<void>;
|
|
@@ -40,6 +42,10 @@ export declare class Data {
|
|
|
40
42
|
getDefaultNotificationTitle(): Promise<string>;
|
|
41
43
|
setUserId(userId?: string | number | undefined): Promise<void>;
|
|
42
44
|
getUserId(): Promise<string | undefined>;
|
|
45
|
+
/** The owner of the shared device stands in for the user this site signed in, which is kept aside. */
|
|
46
|
+
setUserIdFromSharedDevice(userId: string): Promise<void>;
|
|
47
|
+
getOwnUserId(): Promise<string | undefined>;
|
|
48
|
+
keepOwnUserId(): Promise<void>;
|
|
43
49
|
getFeatureFlags(): Promise<IFeatureFlagsCache | undefined>;
|
|
44
50
|
setFeatureFlags(cache: IFeatureFlagsCache | undefined): Promise<void>;
|
|
45
51
|
getFeatureFlagImpressions(): Promise<TFeatureFlagImpressions>;
|
|
@@ -62,6 +68,11 @@ export declare class Data {
|
|
|
62
68
|
getLastPermissionStatus(): Promise<NotificationPermission | undefined>;
|
|
63
69
|
setStatusManualUnsubscribed(status: boolean): Promise<void>;
|
|
64
70
|
getStatusManualUnsubscribed(): Promise<boolean>;
|
|
71
|
+
/** The status of the shared device stands in for the one of this site, which is kept aside. */
|
|
72
|
+
setStatusManualUnsubscribedFromSharedDevice(status: boolean): Promise<void>;
|
|
73
|
+
getOwnStatusManualUnsubscribed(): Promise<boolean>;
|
|
74
|
+
/** Once, before the shared device first stands in: a status an earlier release stored is this site's own. */
|
|
75
|
+
keepOwnStatusManualUnsubscribed(): Promise<void>;
|
|
65
76
|
setStatusCommunicationDisabled(status: boolean): Promise<void>;
|
|
66
77
|
getStatusCommunicationDisabled(): Promise<boolean>;
|
|
67
78
|
setCommunicationEnabled(status?: boolean): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type EventBus } from '../../core/modules/EventBus';
|
|
2
|
+
import { type Api } from '../Api/Api';
|
|
3
|
+
import { type Data } from '../Data/Data';
|
|
4
|
+
/** Picks the device a site works with: its own, or the one shared by the subdomains of its root domain. */
|
|
5
|
+
export declare class SharedDevice {
|
|
6
|
+
private readonly data;
|
|
7
|
+
private readonly api;
|
|
8
|
+
private readonly isPermissionGranted;
|
|
9
|
+
private record;
|
|
10
|
+
private readonly origin;
|
|
11
|
+
constructor(eventBus: EventBus, data: Data, api: Api, isPermissionGranted: () => boolean);
|
|
12
|
+
/** Runs once the application config is known, before anything reports the device. */
|
|
13
|
+
choose(applicationCode: string, isEnabled: boolean, siteUserId?: string, isExcluded?: boolean): Promise<void>;
|
|
14
|
+
isSubscribed(): boolean;
|
|
15
|
+
mayDropSubscription(): boolean;
|
|
16
|
+
private isOwnDeviceSubscribed;
|
|
17
|
+
private hasPushToken;
|
|
18
|
+
private holdsOwnSubscription;
|
|
19
|
+
private readShared;
|
|
20
|
+
private dropOwnSubscription;
|
|
21
|
+
private join;
|
|
22
|
+
mustAskToSubscribe(): boolean;
|
|
23
|
+
private holdManualUnsubscribe;
|
|
24
|
+
retire(applicationCode: string): Promise<void>;
|
|
25
|
+
private leave;
|
|
26
|
+
private dropSharedSubscription;
|
|
27
|
+
private update;
|
|
28
|
+
private switchTo;
|
|
29
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ISharedDeviceState {
|
|
2
|
+
hwid: string;
|
|
3
|
+
subscribed?: boolean;
|
|
4
|
+
manualUnsubscribed?: boolean;
|
|
5
|
+
askToSubscribe?: boolean;
|
|
6
|
+
userId?: string;
|
|
7
|
+
tokenOrigin?: string;
|
|
8
|
+
}
|
|
9
|
+
/** The device every subdomain of one root domain uses for one application, and its owner, kept in a cookie they all see. */
|
|
10
|
+
export declare class SharedDeviceRecord {
|
|
11
|
+
private readonly name;
|
|
12
|
+
private readonly domain;
|
|
13
|
+
private constructor();
|
|
14
|
+
/** Null where no cookie can span subdomains: an IP or a single-label host. */
|
|
15
|
+
static forApplication(applicationCode: string): SharedDeviceRecord | null;
|
|
16
|
+
read(): ISharedDeviceState | null;
|
|
17
|
+
write(state: ISharedDeviceState): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function findRootDomain(hostname: string): string | null;
|