Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@knocklabs/client

Package Overview
Dependencies
Maintainers
2
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@knocklabs/client - npm Package Compare versions

Comparing version 0.5.3 to 0.5.4

dist/cjs/clients/Feed/feed.js

1

dist/cjs/api.js

@@ -111,3 +111,2 @@ "use strict";

_context.t0 = _context["catch"](0);
// tslint:disable-next-line
console.error(_context.t0);

@@ -114,0 +113,0 @@ return _context.abrupt("return", {

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=interfaces.js.map

@@ -14,12 +14,12 @@ "use strict";

};
Object.defineProperty(exports, "FeedClient", {
Object.defineProperty(exports, "Feed", {
enumerable: true,
get: function get() {
return _feed["default"];
return _feed.Feed;
}
});
Object.defineProperty(exports, "Feed", {
Object.defineProperty(exports, "FeedClient", {
enumerable: true,
get: function get() {
return _feed.Feed;
return _feed["default"];
}

@@ -26,0 +26,0 @@ });

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=interfaces.js.map

@@ -6,4 +6,4 @@ "use strict";

});
exports.NetworkStatus = void 0;
exports.isRequestInFlight = isRequestInFlight;
exports.NetworkStatus = void 0;
var NetworkStatus;

@@ -10,0 +10,0 @@ exports.NetworkStatus = NetworkStatus;

@@ -78,5 +78,4 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";

status: result.status
};
}; // eslint:disable-next-line
} catch (e) {
// tslint:disable-next-line
console.error(e);

@@ -83,0 +82,0 @@ return {

@@ -1,2 +0,2 @@

export {};
//# sourceMappingURL=interfaces.js.map

@@ -1,2 +0,2 @@

export {};
//# sourceMappingURL=interfaces.js.map
import { StoreApi } from "zustand";
import { FeedRealTimeEvent, FeedItemOrItems, FeedStoreState } from "./types";
import { BindableFeedEvent, FeedEventCallback, FeedItemOrItems, FeedStoreState, FeedRealTimeCallback } from "./types";
import { FeedClientOptions, FetchFeedOptions } from "./interfaces";

@@ -18,4 +18,4 @@ import Knock from "../../knock";

listenForUpdates(): () => void;
on(eventName: FeedRealTimeEvent, callback: () => void): void;
off(eventName: FeedRealTimeEvent, callback: () => void): void;
on(eventName: BindableFeedEvent, callback: FeedEventCallback | FeedRealTimeCallback): void;
off(eventName: BindableFeedEvent, callback: FeedEventCallback | FeedRealTimeCallback): void;
getState(): FeedStoreState;

@@ -29,11 +29,4 @@ markAsSeen(itemOrItems: FeedItemOrItems): Promise<import("../../api").ApiResponse>;

fetch(options?: FetchFeedOptions): Promise<{
status: "error";
status: "ok" | "error";
data: any;
} | {
data: {
entries: any;
meta: any;
page_info: any;
};
status: "ok";
} | undefined>;

@@ -40,0 +33,0 @@ fetchNextPage(): Promise<void>;

@@ -14,2 +14,3 @@ import { Activity, GenericData, User, PageInfo } from "../../interfaces";

__loadingType?: NetworkStatus.loading | NetworkStatus.fetchMore;
__fetchSource?: "socket" | "http";
} & FeedClientOptions;

@@ -26,3 +27,3 @@ export interface ContentBlock {

}
export interface FeedItem {
export interface FeedItem<T = GenericData> {
__cursor: string;

@@ -37,5 +38,6 @@ id: string;

seen_at: string | null;
archived_at: string | null;
total_activities: number;
total_actors: number;
data: GenericData;
data: T | null;
source: NotificationSource;

@@ -42,0 +44,0 @@ }

@@ -24,3 +24,12 @@ import { PageInfo } from "../../interfaces";

export declare type FeedRealTimeEvent = "messages.new";
export declare type FeedEvent = FeedRealTimeEvent | "items.received.page" | "items.received.realtime";
export declare type BindableFeedEvent = FeedEvent | "items.received.*";
export declare type FeedEventPayload = {
event: Omit<FeedEvent, "messages.new">;
items: FeedItem[];
metadata: FeedMetadata;
};
export declare type FeedRealTimeCallback = (resp: FeedResponse) => void;
export declare type FeedEventCallback = (payload: FeedEventPayload) => void;
export declare type FeedItemOrItems = FeedItem | FeedItem[];
//# sourceMappingURL=types.d.ts.map
import { FeedItem } from "./interfaces";
export declare function deduplicateItems(items: FeedItem[]): FeedItem[];
export declare function sortItems(items: FeedItem[]): FeedItem[];
export declare function sortItems(items: FeedItem[]): FeedItem<import("../..").JsonObject>[];
//# sourceMappingURL=utils.d.ts.map

@@ -1,5 +0,4 @@

export declare type ChannelType = "email" | "in_app_feed";
export declare type ChannelType = "email" | "in_app_feed" | "sms" | "push" | "chat";
export declare type ChannelTypePreferences = {
email: boolean;
in_app_feed: boolean;
[K in ChannelType]: boolean;
};

@@ -6,0 +5,0 @@ export declare type WorkflowPreferenceSetting = boolean | {

@@ -0,7 +1,10 @@

export declare type JsonValue = string | number | boolean | JsonObject | JsonArray | null | undefined;
export interface JsonObject {
[x: string]: JsonValue;
}
export declare type JsonArray = Array<JsonValue>;
export interface KnockOptions {
host?: string;
}
export interface GenericData {
[key: string]: any;
}
export declare type GenericData = JsonObject;
export interface User extends GenericData {

@@ -8,0 +11,0 @@ id: string;

{
"name": "@knocklabs/client",
"version": "0.5.3",
"version": "0.5.4",
"description": "The clientside library for interacting with Knock",

@@ -30,3 +30,3 @@ "homepage": "https://github.com/knocklabs/knock-client-js",

"scripts": {
"lint": "tslint -p tsconfig.json -c tslint.json",
"lint": "eslint \"src/**/*.+(ts|js|tsx)\"",
"prettier": "prettier \"src/**/*.{js,ts,tsx}\" --check",

@@ -45,15 +45,17 @@ "format": "prettier \"src/**/*.{js,ts,tsx}\" --write",

"devDependencies": {
"@babel/cli": "^7.13.16",
"@babel/core": "^7.14.0",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
"@babel/plugin-transform-runtime": "^7.13.15",
"@babel/preset-env": "^7.14.1",
"@babel/preset-typescript": "^7.13.0",
"@babel/cli": "^7.16.7",
"@babel/core": "^7.16.7",
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-object-rest-spread": "^7.16.7",
"@babel/plugin-transform-runtime": "^7.16.7",
"@babel/preset-env": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@types/phoenix": "^1.5.1",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"cross-env": "^7.0.3",
"eslint": "7.23.0",
"prettier": "^2.2.1",
"rimraf": "^3.0.2",
"rollup": "^2.46.0",
"tslint": "^6.1.3",
"typescript": "^4.2.4"

@@ -64,3 +66,3 @@ },

"axios-retry": "^3.1.9",
"eventemitter3": "^4.0.7",
"eventemitter2": "^6.4.5",
"phoenix": "1.5.8",

@@ -67,0 +69,0 @@ "zustand": "^3.5.10"

@@ -70,7 +70,17 @@ # Knock Javascript client library

// Setup a callback for when a batch of messages is received (including on first load)
feedClient.on("messages.new", ({ entries }) => {
console.log(entries);
// Setup a callback for when a batch of items is received (including on first load and subsequent page load)
feedClient.on("items.received.page", ({ items }) => {
console.log(items);
});
// Setup a callback for when new items arrive in real-time
feedClient.on("items.received.realtime", ({ items }) => {
console.log(items);
});
// Listen to all received items
feedClient.on("items.received.*", ({ items }) => {
console.log(items);
});
// Fetch the feed items

@@ -77,0 +87,0 @@ feedClient.fetch({

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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