New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@pusher/push-notifications-web

Package Overview
Dependencies
Maintainers
7
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pusher/push-notifications-web - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

index.test-d.ts

8

CHANGELOG.md

@@ -8,4 +8,10 @@ # Changelog

## [Unreleased](https://github.com/pusher/push-notifications-web/compare/1.0.1...HEAD)
## [Unreleased](https://github.com/pusher/push-notifications-web/compare/1.0.3...HEAD)
## [1.0.3](https://github.com/pusher/push-notifications-web/compare/1.0.2...1.0.3) - 2020-08-24
- Fix bug in SDK where we weren't waiting for custom Service Workers to become
ready before starting the SDK
- Update out of date TypeScript type definitions & add static check to CI
to ensure they remain correct.
## [1.0.2](https://github.com/pusher/push-notifications-web/compare/1.0.1...1.0.2) - 2020-08-24

@@ -12,0 +18,0 @@ - Fix bug in service worker where analytics events would cause runtime errors

50

dist/service-worker.js

@@ -1,3 +0,3 @@

// SDK version: v1.0.1
// Git commit: c3858ad495ef22fd72fb543f4be65412b4f5ff23
// SDK version: v1.0.2
// Git commit: bc6831d1ab41b3b1a3de2297f7024efbb2772d8e

@@ -1236,10 +1236,6 @@ 'use strict';

eventType = _ref.eventType, pusherMetadata = _ref.pusherMetadata;
console.log('reporting', {
eventType: eventType,
pusherMetadata: pusherMetadata
});
instanceId = pusherMetadata.instanceId, publishId = pusherMetadata.publishId, hasDisplayableContent = pusherMetadata.hasDisplayableContent, hasData = pusherMetadata.hasData;
if (!(!instanceId || !publishId)) {
_context.next = 5;
_context.next = 4;
break;

@@ -1250,21 +1246,21 @@ }

case 5:
case 4:
deviceStateStore = new DeviceStateStore(instanceId);
_context.next = 8;
_context.next = 7;
return deviceStateStore.connect();
case 8:
_context.next = 10;
case 7:
_context.next = 9;
return deviceStateStore.getDeviceId();
case 10:
case 9:
deviceId = _context.sent;
_context.next = 13;
_context.next = 12;
return deviceStateStore.getUserId();
case 13:
case 12:
_context.t0 = _context.sent;
if (_context.t0) {
_context.next = 16;
_context.next = 15;
break;

@@ -1275,8 +1271,8 @@ }

case 16:
case 15:
userId = _context.t0;
_context.next = 19;
_context.next = 18;
return self.PusherPushNotifications._hasVisibleClient();
case 19:
case 18:
appInBackground = !_context.sent;

@@ -1298,15 +1294,15 @@ path = "".concat(self.PusherPushNotifications._endpoint(instanceId), "/reporting_api/v2/instances/").concat(instanceId, "/events");

};
_context.prev = 22;
_context.next = 25;
_context.prev = 21;
_context.next = 24;
return doRequest(options);
case 25:
_context.next = 29;
case 24:
_context.next = 28;
break;
case 27:
_context.prev = 27;
_context.t1 = _context["catch"](22);
case 26:
_context.prev = 26;
_context.t1 = _context["catch"](21);
case 29:
case 28:
case "end":

@@ -1316,3 +1312,3 @@ return _context.stop();

}
}, _callee, null, [[22, 27]]);
}, _callee, null, [[21, 26]]);
}));

@@ -1319,0 +1315,0 @@

@@ -1,56 +0,51 @@

declare module '@pusher/push-notifications-web' {
export interface TokenProviderResponse {
token: string;
}
export interface ITokenProvider {
fetchToken(userId: string): Promise<TokenProviderResponse>;
}
export interface TokenProviderResponse {
token: string;
}
export interface ITokenProvider {
fetchToken(userId: string): Promise<TokenProviderResponse>;
}
interface TokenProviderOptions {
url: string;
queryParams?: { [key: string]: any };
headers?: { [key: string]: string };
}
interface TokenProviderOptions {
url: string;
queryParams?: { [key: string]: any };
headers?: { [key: string]: string };
}
class TokenProvider implements ITokenProvider {
constructor(options: TokenProviderOptions);
fetchToken(userId: string): Promise<TokenProviderResponse>;
}
export class TokenProvider implements ITokenProvider {
constructor(options: TokenProviderOptions);
fetchToken(userId: string): Promise<TokenProviderResponse>;
}
enum RegistrationState {
PERMISSION_GRANTED_REGISTERED_WITH_BEAMS = 'PERMISSION_GRANTED_REGISTERED_WITH_BEAMS',
PERMISSION_GRANTED_NOT_REGISTERED_WITH_BEAMS = 'PERMISSION_GRANTED_NOT_REGISTERED_WITH_BEAMS',
PERMISSION_PROMPT_REQUIRED = 'PERMISSION_PROMPT_REQUIRED',
PERMISSION_DENIED = 'PERMISSION_DENIED',
}
export enum RegistrationState {
PERMISSION_GRANTED_REGISTERED_WITH_BEAMS = 'PERMISSION_GRANTED_REGISTERED_WITH_BEAMS',
PERMISSION_GRANTED_NOT_REGISTERED_WITH_BEAMS = 'PERMISSION_GRANTED_NOT_REGISTERED_WITH_BEAMS',
PERMISSION_PROMPT_REQUIRED = 'PERMISSION_PROMPT_REQUIRED',
PERMISSION_DENIED = 'PERMISSION_DENIED',
}
class PushNotificationsInstance {
instanceId: string;
deviceId: string;
userId: string;
export class Client {
instanceId: string;
deviceId: string;
userId: string;
start(): Promise<PushNotificationsInstance>;
addDeviceInterest(interest: string): Promise<undefined>;
removeDeviceInterest(interest: string): Promise<undefined>;
getDeviceInterests(): Promise<Array<string>>;
setDeviceInterests(interests: Array<string>): Promise<undefined>;
clearDeviceInterests(): Promise<undefined>;
setUserId(
userId: string,
tokenProvider: ITokenProvider
): Promise<undefined>;
stop(): Promise<undefined>;
clearAllState(): Promise<undefined>;
getRegistrationState(): Promise<RegistrationState>;
}
constructor(options: ClientOptions);
interface InitOptions {
instanceId: string;
serviceWorkerRegistration?: ServiceWorkerRegistration;
endpointOverride?: string;
}
start(): Promise<undefined>;
getDeviceId(): Promise<string>;
addDeviceInterest(interest: string): Promise<undefined>;
removeDeviceInterest(interest: string): Promise<undefined>;
getDeviceInterests(): Promise<Array<string>>;
setDeviceInterests(interests: Array<string>): Promise<undefined>;
clearDeviceInterests(): Promise<undefined>;
getUserId(): Promise<string>;
setUserId(userId: string, tokenProvider: ITokenProvider): Promise<undefined>;
stop(): Promise<undefined>;
clearAllState(): Promise<undefined>;
getRegistrationState(): Promise<RegistrationState>;
}
export function init(
options: InitOptions
): Promise<PushNotificationsInstance>;
interface ClientOptions {
instanceId: string;
serviceWorkerRegistration?: ServiceWorkerRegistration;
endpointOverride?: string;
}
{
"name": "@pusher/push-notifications-web",
"version": "1.0.2",
"version": "1.0.3",
"description": "",

@@ -15,2 +15,3 @@ "main": "dist/push-notifications-esm.js",

"test:unit": "jest ./src/*",
"test:ts": "tsd .",
"test:e2e": "jest ./end-to-end-tests/* --runInBand",

@@ -42,3 +43,4 @@ "prepublishchecks": "npm run lint && npm run test:unit && npm run build:cdn && npm run build:esm && npm run test:e2e",

"rollup-plugin-node-resolve": "^4.2.3",
"selenium-webdriver": "^4.0.0-alpha.3"
"selenium-webdriver": "^4.0.0-alpha.3",
"tsd": "^0.13.1"
},

@@ -45,0 +47,0 @@ "browserify": {

@@ -95,3 +95,7 @@ import doRequest from './do-request';

if (!this._serviceWorkerRegistration) {
if (this._serviceWorkerRegistration) {
// If we have been given a service worker, wait for it to be ready
await window.navigator.serviceWorker.ready;
} else {
// Otherwise register our own one
this._serviceWorkerRegistration = await getServiceWorkerRegistration();

@@ -98,0 +102,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc