@peerboard/core
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -107,4 +107,6 @@ 'use strict'; | ||
}; | ||
var createCommentsWidget = function (communityID, container, exclude, spaceID, options) { | ||
var createCommentWidget = function (communityID, container, exclude, spaceID, options) { | ||
if (spaceID === void 0) { spaceID = 0; } | ||
var opts = __assign(__assign({}, defaultOptions), { scrollToTopOnNavigationChanged: true, onPathChanged: function () { return true; } }); | ||
Object.assign(opts, options); | ||
return loadSdk(options.sdkURL).then(function () { | ||
@@ -115,10 +117,10 @@ if (!forumSDK) { | ||
return new Promise(function (resolve, reject) { | ||
var api = forumSDK.createCommentWidget(communityID, exclude, container, spaceID, __assign(__assign({}, options), { onFail: function () { | ||
if (options.onFail) { | ||
options.onFail(); | ||
var api = forumSDK.createCommentWidget(communityID, exclude, container, spaceID, __assign(__assign({}, opts), { onFail: function () { | ||
if (opts.onFail) { | ||
opts.onFail(); | ||
} | ||
reject(new Error("failed to initialize PeerBoard iframe internals")); | ||
}, onReady: function () { | ||
if (options.onReady) { | ||
options.onReady(); | ||
if (opts.onReady) { | ||
opts.onReady(); | ||
} | ||
@@ -130,4 +132,4 @@ resolve(api); | ||
console.error("Error creating forum: ", err); | ||
if (options.onFail) { | ||
options.onFail(); | ||
if (opts.onFail) { | ||
opts.onFail(); | ||
} | ||
@@ -140,3 +142,3 @@ throw err; | ||
exports.createForum = createForum; | ||
exports.createCommentsWidget = createCommentsWidget; | ||
exports.createCommentWidget = createCommentWidget; | ||
//# sourceMappingURL=peerboard-core.cjs.js.map |
@@ -109,4 +109,6 @@ (function (global, factory) { | ||
}; | ||
var createCommentsWidget = function (communityID, container, exclude, spaceID, options) { | ||
var createCommentWidget = function (communityID, container, exclude, spaceID, options) { | ||
if (spaceID === void 0) { spaceID = 0; } | ||
var opts = __assign(__assign({}, defaultOptions), { scrollToTopOnNavigationChanged: true, onPathChanged: function () { return true; } }); | ||
Object.assign(opts, options); | ||
return loadSdk(options.sdkURL).then(function () { | ||
@@ -117,10 +119,10 @@ if (!forumSDK) { | ||
return new Promise(function (resolve, reject) { | ||
var api = forumSDK.createCommentWidget(communityID, exclude, container, spaceID, __assign(__assign({}, options), { onFail: function () { | ||
if (options.onFail) { | ||
options.onFail(); | ||
var api = forumSDK.createCommentWidget(communityID, exclude, container, spaceID, __assign(__assign({}, opts), { onFail: function () { | ||
if (opts.onFail) { | ||
opts.onFail(); | ||
} | ||
reject(new Error("failed to initialize PeerBoard iframe internals")); | ||
}, onReady: function () { | ||
if (options.onReady) { | ||
options.onReady(); | ||
if (opts.onReady) { | ||
opts.onReady(); | ||
} | ||
@@ -132,4 +134,4 @@ resolve(api); | ||
console.error("Error creating forum: ", err); | ||
if (options.onFail) { | ||
options.onFail(); | ||
if (opts.onFail) { | ||
opts.onFail(); | ||
} | ||
@@ -142,3 +144,3 @@ throw err; | ||
exports.createForum = createForum; | ||
exports.createCommentsWidget = createCommentsWidget; | ||
exports.createCommentWidget = createCommentWidget; | ||
@@ -145,0 +147,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -5,2 +5,11 @@ export declare enum ExcludeOptions { | ||
} | ||
export interface UrlOptions { | ||
/** | ||
* May be used for testing or if a customer or platform has several | ||
* subdomains and want to show the same forum everywhere | ||
* Also this option is used to implement proxy integration type in WordPress | ||
* baseUrl+prefixProxy TODO: Remove the prefixProxy parameter on WP side | ||
*/ | ||
baseURL?: string; | ||
} | ||
export interface TitleOptions { | ||
@@ -23,5 +32,5 @@ onTitleChanged?: (title: string) => void; | ||
} | ||
export interface WidgetOptions extends FunctionOptions, LoginOptions, SdkUrlOptions, TitleOptions { | ||
export interface WidgetOptions extends FunctionOptions, LoginOptions, SdkUrlOptions, TitleOptions, UrlOptions { | ||
} | ||
interface Options extends FunctionOptions, LoginOptions, SdkUrlOptions, TitleOptions { | ||
interface Options extends FunctionOptions, LoginOptions, SdkUrlOptions, TitleOptions, UrlOptions { | ||
prefix?: string; | ||
@@ -33,3 +42,2 @@ anon?: boolean; | ||
path?: string; | ||
baseURL?: string; | ||
resize?: boolean; | ||
@@ -66,3 +74,3 @@ hideMenu?: boolean; | ||
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 declare const createCommentWidget: (communityID: number, container: HTMLElement, exclude: ExcludeOptions[], spaceID: number | undefined, options: Readonly<WidgetOptions>) => Promise<ForumAPI>; | ||
export {}; |
{ | ||
"name": "@peerboard/core", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49338
10
463