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

@peerboard/core

Package Overview
Dependencies
Maintainers
3
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@peerboard/core - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

32

dist/peerboard-core.cjs.js

@@ -32,2 +32,6 @@ 'use strict';

var PEERBOARD_EMBED_SDK_URL = 'https://static.peerboard.com/embed/embed.js';
(function (ExcludeOptions) {
ExcludeOptions["Subdomain"] = "subdomain";
ExcludeOptions["QueryParams"] = "query";
})(exports.ExcludeOptions || (exports.ExcludeOptions = {}));
var trimLeftSlash = function (str) {

@@ -104,5 +108,33 @@ return str.startsWith('/') ? str.substr(1) : str;

};
var createCommentsWidget = function (communityID, container, exclude, spaceID, options) {
if (spaceID === void 0) { spaceID = 0; }
return loadSdk(options.sdkURL).then(function () {
if (!forumSDK) {
throw new Error("Forum should be loaded at the moment.");
}
return new Promise(function (resolve, reject) {
var api = forumSDK.createCommentWidget(communityID, exclude, container, spaceID, __assign(__assign({}, options), { onFail: function () {
if (options.onFail) {
options.onFail();
}
reject(new Error("failed to initialize PeerBoard iframe internals"));
}, onReady: function () {
if (options.onReady) {
options.onReady();
}
resolve(api);
} }));
});
}).catch(function (err) {
console.error("Error creating forum: ", err);
if (options.onFail) {
options.onFail();
}
throw err;
});
};
exports.loadSdk = loadSdk;
exports.createForum = createForum;
exports.createCommentsWidget = createCommentsWidget;
//# sourceMappingURL=peerboard-core.cjs.js.map

@@ -34,2 +34,6 @@ (function (global, factory) {

var PEERBOARD_EMBED_SDK_URL = 'https://static.peerboard.com/embed/embed.js';
(function (ExcludeOptions) {
ExcludeOptions["Subdomain"] = "subdomain";
ExcludeOptions["QueryParams"] = "query";
})(exports.ExcludeOptions || (exports.ExcludeOptions = {}));
var trimLeftSlash = function (str) {

@@ -106,5 +110,33 @@ return str.startsWith('/') ? str.substr(1) : str;

};
var createCommentsWidget = function (communityID, container, exclude, spaceID, options) {
if (spaceID === void 0) { spaceID = 0; }
return loadSdk(options.sdkURL).then(function () {
if (!forumSDK) {
throw new Error("Forum should be loaded at the moment.");
}
return new Promise(function (resolve, reject) {
var api = forumSDK.createCommentWidget(communityID, exclude, container, spaceID, __assign(__assign({}, options), { onFail: function () {
if (options.onFail) {
options.onFail();
}
reject(new Error("failed to initialize PeerBoard iframe internals"));
}, onReady: function () {
if (options.onReady) {
options.onReady();
}
resolve(api);
} }));
});
}).catch(function (err) {
console.error("Error creating forum: ", err);
if (options.onFail) {
options.onFail();
}
throw err;
});
};
exports.loadSdk = loadSdk;
exports.createForum = createForum;
exports.createCommentsWidget = createCommentsWidget;

@@ -111,0 +143,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

37

dist/types/peerboard-core.d.ts

@@ -1,14 +0,32 @@

interface Options {
export declare enum ExcludeOptions {
Subdomain = "subdomain",
QueryParams = "query"
}
export interface TitleOptions {
onTitleChanged?: (title: string) => void;
}
export interface SdkUrlOptions {
sdkURL?: string;
}
export interface LoginOptions {
/**
* Authentication parameters
*/
jwtToken?: string;
}
export interface FunctionOptions {
onReady?: () => void;
onFail?: () => void;
onLogout?: () => void;
}
export interface WidgetOptions extends FunctionOptions, LoginOptions, SdkUrlOptions, TitleOptions {
}
interface Options extends FunctionOptions, LoginOptions, SdkUrlOptions, TitleOptions {
prefix?: string;
jwtToken?: string;
anon?: boolean;
minHeight?: number | string;
onPathChanged?: (forumPath: string) => void;
onTitleChanged?: (title: string) => void;
onCustomProfile?: (url: string) => void;
onReady?: () => void;
onFail?: () => void;
path?: string;
baseURL?: string;
sdkURL?: string;
resize?: boolean;

@@ -18,7 +36,6 @@ hideMenu?: boolean;

}
interface InternalSDKOptions {
interface InternalSDKOptions extends FunctionOptions, LoginOptions {
prefix?: string;
prefixProxy?: string;
baseURL?: string;
jwtToken?: string;
anon?: boolean;

@@ -34,4 +51,2 @@ wpPayload?: string;

onCustomProfile?: (url: string) => void;
onReady?: () => void;
onFail?: () => void;
scrollToTopOnNavigationChanged?: boolean;

@@ -46,5 +61,7 @@ sendReferrer?: boolean;

createForum(forumID: number, container: HTMLElement, options: InternalSDKOptions): ForumAPI;
createCommentWidget(communityID: number, exclude: ExcludeOptions[], container: HTMLElement, spaceID: number, options: WidgetOptions): ForumAPI;
}
export declare const loadSdk: (embedSDKURL?: string | undefined) => Promise<void>;
export declare const createForum: (forumID: number, container: HTMLElement, options: Readonly<Options>) => Promise<ForumAPI>;
export declare const createCommentsWidget: (communityID: number, container: HTMLElement, exclude: ExcludeOptions[], spaceID: number | undefined, options: Readonly<WidgetOptions>) => Promise<ForumAPI>;
export {};
{
"name": "@peerboard/core",
"version": "0.0.12",
"version": "0.0.13",
"description": "peerboard.com frontend components",

@@ -5,0 +5,0 @@ "keywords": [

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