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

elevio

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elevio - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

2

esm/client.d.ts

@@ -90,3 +90,3 @@ import { WindowElev, OnEventTypes } from './elevio';

*/
on: <T extends "load" | "ready" | "widget:opened" | "widget:closed" | "module:opened" | "popup:opened" | "popup:closed" | "search:query" | "search:article:clicked" | "category:article:clicked" | "widget:article:view" | "helper:clicked">(elevioEvent: T, cb: OnEventTypes[T]) => void;
on: <T extends Readonly<keyof OnEventTypes>>(elevioEvent: T, cb: OnEventTypes[T]) => void;
/** Open the widget to the last page the user was on. */

@@ -93,0 +93,0 @@ open: () => void;

@@ -17,2 +17,7 @@ export declare type Nullable<T> = {

'widget:closed': () => void;
/** Called after a module is loaded. The callback has the module type and any options that are relevant. */
'module:loaded': (result: {
type: string;
data: object;
}) => void;
/** Called after a module is opened. The callback has the module ID as it’s first argument. */

@@ -75,2 +80,82 @@ 'module:opened': (moduleId: string) => void;

}) => void;
'suggestions:article:clicked': (result: {
articleId: string;
source: string;
}) => void;
'related:article:clicked': (result: {
articleId: string;
source: string;
relatedFrom: string;
}) => void;
'article:interlink:clicked': (result: {
id: string;
type: string;
clickedFrom: string;
}) => void;
'article:feedback:reaction': (result: {
id: string;
reaction: number;
title: string;
}) => void;
'article:feedback:text': (result: {
id: string;
text: string;
title: string;
}) => void;
'article:kblink:clicked': (articleId: string) => void;
'page:view': (result: {
pageUrl: string;
}) => void;
'article:data:loaded': (result: {
articleId: string;
source: string;
title: string;
body: string;
}) => void;
'article:data:error': (result: {
articleId: string;
source: string;
}) => void;
'category:data:loaded': (result: {
id: string;
title: string;
source: string;
articles: Array<{
id: string;
title: string;
}>;
subCategories: Array<{
articles: Array<{
id: string;
title: string;
}>;
articlesCount: number;
id: string;
title: string;
}>;
}) => void;
'article:feedback:loading': (result: {
articleId: number;
source: string;
stage: 'reaction' | 'text' | 'email' | 'success';
}) => void;
'article:feedback:loaded': (result: {
articleId: number;
source: string;
stage: 'reaction' | 'text' | 'email' | 'success';
}) => void;
'article:feedback:error': (result: {
articleId: number;
source: string;
stage: 'reaction' | 'text' | 'email' | 'success';
}) => void;
'article:related:loaded': (result: {
source: string;
}) => void;
'suggestions:data:loaded': (result: {
source: string;
}) => void;
'suggestions:data:error': (result: {
source: string;
}) => void;
};

@@ -77,0 +162,0 @@ export declare type OnEventKey = keyof OnEventTypes;

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

import { Nullable, User, SettingsOptions, WindowElev, RenderType } from './elevio';
import { Nullable, User, SettingsOptions, OnEventTypes } from './elevio';
import * as React from 'react';

@@ -52,15 +52,16 @@ import Elevio from './client';

*/
onLoad?: (apiInstance: WindowElev) => void;
onLoad?: OnEventTypes['load'];
/** Called after the Elevio app has been initialised. */
onReady?: () => void;
onReady?: OnEventTypes['ready'];
/** Called after the widget is opened. */
onWidgetOpened?: () => void;
onWidgetOpened?: OnEventTypes['widget:opened'];
/** Called after the widget is closed. */
onWidgetClosed?: () => void;
onWidgetClosed?: OnEventTypes['widget:closed'];
onModuleLoaded?: OnEventTypes['module:loaded'];
/** Called after a module is opened. The callback has the module ID as it’s first argument. */
onModuleOpened?: (moduleId: string) => void;
onModuleOpened?: OnEventTypes['module:opened'];
/** Called after a popup is opened. The callback has the article ID as it’s first argument. */
onPopupOpened?: (articleId: string) => void;
onPopupOpened?: OnEventTypes['popup:opened'];
/** Called after a popup is closed. The callback has the article ID as it’s first argument. */
onPopupClosed?: (articleId: string) => void;
onPopupClosed?: OnEventTypes['popup:closed'];
/**

@@ -70,10 +71,3 @@ * Called when results for a search query are shown to user.

*/
onSearchQuery?: (results: {
query: string;
results: Array<{
category_id: string;
id: string;
title: string;
}>;
}) => void;
onSearchQuery?: OnEventTypes['search:query'];
/**

@@ -85,7 +79,3 @@ * Called when results for a search query is clicked by a user.

*/
onSearchArticleClicked?: (result: {
articleId: string;
categoryId: string;
source: string;
}) => void;
onSearchArticleClicked?: OnEventTypes['search:article:clicked'];
/**

@@ -97,7 +87,3 @@ * Called when an article is clicked in the category display.

*/
onCategoryArticleClicked?: (result: {
articleId: string;
categoryId: string;
source: string;
}) => void;
onCategoryArticleClicked?: OnEventTypes['category:article:clicked'];
/**

@@ -107,3 +93,3 @@ * Called after an article is viewed in the widget.

*/
onWidgetArticleView?: (articleId: string) => void;
onWidgetArticleView?: OnEventTypes['widget:article:view'];
/**

@@ -116,7 +102,19 @@ * Called when a helper is clicked.

*/
onHelperClicked?: (result: {
actionId: string;
type: RenderType;
target: HTMLElement;
}) => void;
onHelperClicked?: OnEventTypes['helper:clicked'];
onSuggestionsArticleClicked?: OnEventTypes['suggestions:article:clicked'];
onRelatedArticleClicked?: OnEventTypes['related:article:clicked'];
onArticleInterlinkClicked?: OnEventTypes['article:interlink:clicked'];
onArticleFeedbackReaction?: OnEventTypes['article:feedback:reaction'];
onArticleFeedbackText?: OnEventTypes['article:feedback:text'];
onArticleKBlinkClicked?: OnEventTypes['article:kblink:clicked'];
onPageView?: OnEventTypes['page:view'];
onArticleDataLoaded?: OnEventTypes['article:data:loaded'];
onArticleDataError?: OnEventTypes['article:data:error'];
onCategoryDataLoaded?: OnEventTypes['category:data:loaded'];
onArticleFeedbackLoading?: OnEventTypes['article:feedback:loading'];
onArticleFeedbackLoaded?: OnEventTypes['article:feedback:loaded'];
onArticleFeedbackError?: OnEventTypes['article:feedback:error'];
onArticleRelatedLoaded?: OnEventTypes['article:related:loaded'];
onSuggestionsDataLoaded?: OnEventTypes['suggestions:data:loaded'];
onSuggestionsDataError?: OnEventTypes['suggestions:data:error'];
};

@@ -137,5 +135,7 @@ declare class ElevioReact extends React.Component<Props> {

onWidgetClosed: PropTypes.Requireable<(...args: any[]) => any>;
onModuleLoaded: PropTypes.Requireable<(...args: any[]) => any>;
onModuleOpened: PropTypes.Requireable<(...args: any[]) => any>;
onPopupOpened: PropTypes.Requireable<(...args: any[]) => any>;
onPopupClosed: PropTypes.Requireable<(...args: any[]) => any>;
onHelperClicked: PropTypes.Requireable<(...args: any[]) => any>;
onSearchQuery: PropTypes.Requireable<(...args: any[]) => any>;

@@ -145,3 +145,18 @@ onSearchArticleClicked: PropTypes.Requireable<(...args: any[]) => any>;

onWidgetArticleView: PropTypes.Requireable<(...args: any[]) => any>;
onHelperClicked: PropTypes.Requireable<(...args: any[]) => any>;
onSuggestionsArticleClicked: PropTypes.Requireable<(...args: any[]) => any>;
onRelatedArticleClicked: PropTypes.Requireable<(...args: any[]) => any>;
onArticleInterlinkClicked: PropTypes.Requireable<(...args: any[]) => any>;
onArticleFeedbackReaction: PropTypes.Requireable<(...args: any[]) => any>;
onArticleFeedbackText: PropTypes.Requireable<(...args: any[]) => any>;
onArticleKBlinkClicked: PropTypes.Requireable<(...args: any[]) => any>;
onPageView: PropTypes.Requireable<(...args: any[]) => any>;
onArticleDataLoaded: PropTypes.Requireable<(...args: any[]) => any>;
onArticleDataError: PropTypes.Requireable<(...args: any[]) => any>;
onCategoryDataLoaded: PropTypes.Requireable<(...args: any[]) => any>;
onArticleFeedbackLoading: PropTypes.Requireable<(...args: any[]) => any>;
onArticleFeedbackLoaded: PropTypes.Requireable<(...args: any[]) => any>;
onArticleFeedbackError: PropTypes.Requireable<(...args: any[]) => any>;
onArticleRelatedLoaded: PropTypes.Requireable<(...args: any[]) => any>;
onSuggestionsDataLoaded: PropTypes.Requireable<(...args: any[]) => any>;
onSuggestionsDataError: PropTypes.Requireable<(...args: any[]) => any>;
};

@@ -152,35 +167,33 @@ constructor(props: Props);

componentDidUpdate(prevProps: Props): void;
onLoad: (_elev: WindowElev) => void;
onReady: () => void;
onWidgetOpened: () => void;
onWidgetClosed: () => void;
onModuleOpened: (moduleId: string) => void;
onPopupOpened: (articleId: string) => void;
onPopupClosed: (articleId: string) => void;
onSearchQuery: (results: {
query: string;
results: Array<{
category_id: string;
id: string;
title: string;
}>;
}) => void;
onSearchArticleClicked: (result: {
articleId: string;
categoryId: string;
source: string;
}) => void;
onCategoryArticleClicked: (result: {
articleId: string;
categoryId: string;
source: string;
}) => void;
onWidgetArticleView: (articleId: string) => void;
onHelperClicked: (result: {
actionId: string;
type: RenderType;
target: HTMLElement;
}) => void;
onReady: OnEventTypes['ready'];
onLoad: OnEventTypes['load'];
onWidgetOpened: OnEventTypes['widget:opened'];
onWidgetClosed: OnEventTypes['widget:closed'];
onModuleLoaded: OnEventTypes['module:loaded'];
onModuleOpened: OnEventTypes['module:opened'];
onPopupOpened: OnEventTypes['popup:opened'];
onPopupClosed: OnEventTypes['popup:closed'];
onSearchQuery: OnEventTypes['search:query'];
onSearchArticleClicked: OnEventTypes['search:article:clicked'];
onCategoryArticleClicked: OnEventTypes['category:article:clicked'];
onWidgetArticleView: OnEventTypes['widget:article:view'];
onHelperClicked: OnEventTypes['helper:clicked'];
onSuggestionsArticleClicked: OnEventTypes['suggestions:article:clicked'];
onRelatedArticleClicked: OnEventTypes['related:article:clicked'];
onArticleInterlinkClicked: OnEventTypes['article:interlink:clicked'];
onArticleFeedbackReaction: OnEventTypes['article:feedback:reaction'];
onArticleFeedbackText: OnEventTypes['article:feedback:text'];
onArticleKBlinkClicked: OnEventTypes['article:kblink:clicked'];
onPageView: OnEventTypes['page:view'];
onArticleDataLoaded: OnEventTypes['article:data:loaded'];
onArticleDataError: OnEventTypes['article:data:error'];
onCategoryDataLoaded: OnEventTypes['category:data:loaded'];
onArticleFeedbackLoading: OnEventTypes['article:feedback:loading'];
onArticleFeedbackLoaded: OnEventTypes['article:feedback:loaded'];
onArticleFeedbackError: OnEventTypes['article:feedback:error'];
onArticleRelatedLoaded: OnEventTypes['article:related:loaded'];
onSuggestionsDataLoaded: OnEventTypes['suggestions:data:loaded'];
onSuggestionsDataError: OnEventTypes['suggestions:data:error'];
render(): null;
}
export default ElevioReact;

@@ -5,6 +5,8 @@ var __extends = (this && this.__extends) || (function () {

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -32,5 +34,2 @@ function __() { this.constructor = d; }

var _this = _super.call(this, props) || this;
_this.onLoad = function (_elev) {
_this.props.onLoad && _this.props.onLoad(_elev);
};
_this.onReady = function () {

@@ -43,37 +42,104 @@ if (typeof serverEnabled === 'undefined') {

};
_this.onLoad = function (result) {
return _this.props.onLoad && _this.props.onLoad(result);
};
_this.onWidgetOpened = function () {
_this.props.onWidgetOpened && _this.props.onWidgetOpened();
return _this.props.onWidgetOpened && _this.props.onWidgetOpened();
};
_this.onWidgetClosed = function () {
_this.props.onWidgetClosed && _this.props.onWidgetClosed();
return _this.props.onWidgetClosed && _this.props.onWidgetClosed();
};
_this.onModuleOpened = function (moduleId) {
_this.props.onModuleOpened && _this.props.onModuleOpened(moduleId);
_this.onModuleLoaded = function (result) {
return _this.props.onModuleLoaded && _this.props.onModuleLoaded(result);
};
_this.onPopupOpened = function (articleId) {
_this.props.onPopupOpened && _this.props.onPopupOpened(articleId);
_this.onModuleOpened = function (result) {
return _this.props.onModuleOpened && _this.props.onModuleOpened(result);
};
_this.onPopupClosed = function (articleId) {
_this.props.onPopupClosed && _this.props.onPopupClosed(articleId);
_this.onPopupOpened = function (result) {
return _this.props.onPopupOpened && _this.props.onPopupOpened(result);
};
_this.onSearchQuery = function (results) {
_this.props.onSearchQuery && _this.props.onSearchQuery(results);
_this.onPopupClosed = function (result) {
return _this.props.onPopupClosed && _this.props.onPopupClosed(result);
};
_this.onSearchQuery = function (result) {
_this.props.onSearchQuery && _this.props.onSearchQuery(result);
};
_this.onSearchArticleClicked = function (result) {
_this.props.onSearchArticleClicked &&
return _this.props.onSearchArticleClicked &&
_this.props.onSearchArticleClicked(result);
};
_this.onCategoryArticleClicked = function (result) {
_this.props.onCategoryArticleClicked &&
return _this.props.onCategoryArticleClicked &&
_this.props.onCategoryArticleClicked(result);
};
_this.onWidgetArticleView = function (articleId) {
_this.props.onWidgetArticleView && _this.props.onWidgetArticleView(articleId);
_this.onWidgetArticleView = function (result) {
return _this.props.onWidgetArticleView && _this.props.onWidgetArticleView(result);
};
_this.onHelperClicked = function (result) {
_this.props.onHelperClicked && _this.props.onHelperClicked(result);
return _this.props.onHelperClicked && _this.props.onHelperClicked(result);
};
_this.onSuggestionsArticleClicked = function (result) {
return _this.props.onSuggestionsArticleClicked &&
_this.props.onSuggestionsArticleClicked(result);
};
_this.onRelatedArticleClicked = function (result) {
return _this.props.onRelatedArticleClicked &&
_this.props.onRelatedArticleClicked(result);
};
_this.onArticleInterlinkClicked = function (result) {
return _this.props.onArticleInterlinkClicked &&
_this.props.onArticleInterlinkClicked(result);
};
_this.onArticleFeedbackReaction = function (result) {
return _this.props.onArticleFeedbackReaction &&
_this.props.onArticleFeedbackReaction(result);
};
_this.onArticleFeedbackText = function (result) {
return _this.props.onArticleFeedbackText &&
_this.props.onArticleFeedbackText(result);
};
_this.onArticleKBlinkClicked = function (result) {
return _this.props.onArticleKBlinkClicked &&
_this.props.onArticleKBlinkClicked(result);
};
_this.onPageView = function (result) {
return _this.props.onPageView && _this.props.onPageView(result);
};
_this.onArticleDataLoaded = function (result) {
return _this.props.onArticleDataLoaded && _this.props.onArticleDataLoaded(result);
};
_this.onArticleDataError = function (result) {
return _this.props.onArticleDataError && _this.props.onArticleDataError(result);
};
_this.onCategoryDataLoaded = function (result) {
return _this.props.onCategoryDataLoaded && _this.props.onCategoryDataLoaded(result);
};
_this.onArticleFeedbackLoading = function (result) {
return _this.props.onArticleFeedbackLoading &&
_this.props.onArticleFeedbackLoading(result);
};
_this.onArticleFeedbackLoaded = function (result) {
return _this.props.onArticleFeedbackLoaded &&
_this.props.onArticleFeedbackLoaded(result);
};
_this.onArticleFeedbackError = function (result) {
return _this.props.onArticleFeedbackError &&
_this.props.onArticleFeedbackError(result);
};
_this.onArticleRelatedLoaded = function (result) {
return _this.props.onArticleRelatedLoaded &&
_this.props.onArticleRelatedLoaded(result);
};
_this.onSuggestionsDataLoaded = function (result) {
return _this.props.onSuggestionsDataLoaded &&
_this.props.onSuggestionsDataLoaded(result);
};
_this.onSuggestionsDataError = function (result) {
return _this.props.onSuggestionsDataError &&
_this.props.onSuggestionsDataError(result);
};
Elevio.on('ready', _this.onReady);
Elevio.on('widget:opened', _this.onWidgetOpened);
Elevio.on('widget:closed', _this.onWidgetClosed);
Elevio.on('module:loaded', _this.onModuleLoaded);
Elevio.on('module:opened', _this.onModuleOpened);

@@ -87,2 +153,18 @@ Elevio.on('popup:opened', _this.onPopupOpened);

Elevio.on('helper:clicked', _this.onHelperClicked);
Elevio.on('suggestions:article:clicked', _this.onSuggestionsArticleClicked);
Elevio.on('related:article:clicked', _this.onRelatedArticleClicked);
Elevio.on('article:interlink:clicked', _this.onArticleInterlinkClicked);
Elevio.on('article:feedback:reaction', _this.onArticleFeedbackReaction);
Elevio.on('article:feedback:text', _this.onArticleFeedbackText);
Elevio.on('article:kblink:clicked', _this.onArticleKBlinkClicked);
Elevio.on('page:view', _this.onPageView);
Elevio.on('article:data:loaded', _this.onArticleDataLoaded);
Elevio.on('article:data:error', _this.onArticleDataError);
Elevio.on('category:data:loaded', _this.onCategoryDataLoaded);
Elevio.on('article:feedback:loading', _this.onArticleFeedbackLoading);
Elevio.on('article:feedback:loaded', _this.onArticleFeedbackLoaded);
Elevio.on('article:feedback:error', _this.onArticleFeedbackError);
Elevio.on('article:related:loaded', _this.onArticleRelatedLoaded);
Elevio.on('suggestions:data:loaded', _this.onSuggestionsDataLoaded);
Elevio.on('suggestions:data:error', _this.onSuggestionsDataError);
return _this;

@@ -104,20 +186,14 @@ }

// Wait until Elevio has loaded before setting settings.
if (_this.props.keywords) {
if (_this.props.keywords)
Elevio.setKeywords(_this.props.keywords);
}
if (_this.props.language) {
if (_this.props.language)
Elevio.setLanguage(_this.props.language);
}
if (_this.props.user) {
if (_this.props.user)
Elevio.setUser(_this.props.user);
}
if (_this.props.settings) {
if (_this.props.settings)
Elevio.setSettings(_this.props.settings);
}
if (_this.props.pageUrl) {
if (_this.props.pageUrl)
Elevio.setPage(_this.props.pageUrl);
}
if (_this.props.translations) {
if (_this.props.translations)
Elevio.setTranslations(_this.props.translations);
}
if (serverEnabled) {

@@ -183,5 +259,7 @@ Elevio.enable();

onWidgetClosed: PropTypes.func,
onModuleLoaded: PropTypes.func,
onModuleOpened: PropTypes.func,
onPopupOpened: PropTypes.func,
onPopupClosed: PropTypes.func,
onHelperClicked: PropTypes.func,
onSearchQuery: PropTypes.func,

@@ -191,3 +269,18 @@ onSearchArticleClicked: PropTypes.func,

onWidgetArticleView: PropTypes.func,
onHelperClicked: PropTypes.func,
onSuggestionsArticleClicked: PropTypes.func,
onRelatedArticleClicked: PropTypes.func,
onArticleInterlinkClicked: PropTypes.func,
onArticleFeedbackReaction: PropTypes.func,
onArticleFeedbackText: PropTypes.func,
onArticleKBlinkClicked: PropTypes.func,
onPageView: PropTypes.func,
onArticleDataLoaded: PropTypes.func,
onArticleDataError: PropTypes.func,
onCategoryDataLoaded: PropTypes.func,
onArticleFeedbackLoading: PropTypes.func,
onArticleFeedbackLoaded: PropTypes.func,
onArticleFeedbackError: PropTypes.func,
onArticleRelatedLoaded: PropTypes.func,
onSuggestionsDataLoaded: PropTypes.func,
onSuggestionsDataError: PropTypes.func,
};

@@ -194,0 +287,0 @@ return ElevioReact;

@@ -90,3 +90,3 @@ import { WindowElev, OnEventTypes } from './elevio';

*/
on: <T extends "load" | "ready" | "widget:opened" | "widget:closed" | "module:opened" | "popup:opened" | "popup:closed" | "search:query" | "search:article:clicked" | "category:article:clicked" | "widget:article:view" | "helper:clicked">(elevioEvent: T, cb: OnEventTypes[T]) => void;
on: <T extends Readonly<keyof OnEventTypes>>(elevioEvent: T, cb: OnEventTypes[T]) => void;
/** Open the widget to the last page the user was on. */

@@ -93,0 +93,0 @@ open: () => void;

@@ -17,2 +17,7 @@ export declare type Nullable<T> = {

'widget:closed': () => void;
/** Called after a module is loaded. The callback has the module type and any options that are relevant. */
'module:loaded': (result: {
type: string;
data: object;
}) => void;
/** Called after a module is opened. The callback has the module ID as it’s first argument. */

@@ -75,2 +80,82 @@ 'module:opened': (moduleId: string) => void;

}) => void;
'suggestions:article:clicked': (result: {
articleId: string;
source: string;
}) => void;
'related:article:clicked': (result: {
articleId: string;
source: string;
relatedFrom: string;
}) => void;
'article:interlink:clicked': (result: {
id: string;
type: string;
clickedFrom: string;
}) => void;
'article:feedback:reaction': (result: {
id: string;
reaction: number;
title: string;
}) => void;
'article:feedback:text': (result: {
id: string;
text: string;
title: string;
}) => void;
'article:kblink:clicked': (articleId: string) => void;
'page:view': (result: {
pageUrl: string;
}) => void;
'article:data:loaded': (result: {
articleId: string;
source: string;
title: string;
body: string;
}) => void;
'article:data:error': (result: {
articleId: string;
source: string;
}) => void;
'category:data:loaded': (result: {
id: string;
title: string;
source: string;
articles: Array<{
id: string;
title: string;
}>;
subCategories: Array<{
articles: Array<{
id: string;
title: string;
}>;
articlesCount: number;
id: string;
title: string;
}>;
}) => void;
'article:feedback:loading': (result: {
articleId: number;
source: string;
stage: 'reaction' | 'text' | 'email' | 'success';
}) => void;
'article:feedback:loaded': (result: {
articleId: number;
source: string;
stage: 'reaction' | 'text' | 'email' | 'success';
}) => void;
'article:feedback:error': (result: {
articleId: number;
source: string;
stage: 'reaction' | 'text' | 'email' | 'success';
}) => void;
'article:related:loaded': (result: {
source: string;
}) => void;
'suggestions:data:loaded': (result: {
source: string;
}) => void;
'suggestions:data:error': (result: {
source: string;
}) => void;
};

@@ -77,0 +162,0 @@ export declare type OnEventKey = keyof OnEventTypes;

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

import { Nullable, User, SettingsOptions, WindowElev, RenderType } from './elevio';
import { Nullable, User, SettingsOptions, OnEventTypes } from './elevio';
import * as React from 'react';

@@ -52,15 +52,16 @@ import Elevio from './client';

*/
onLoad?: (apiInstance: WindowElev) => void;
onLoad?: OnEventTypes['load'];
/** Called after the Elevio app has been initialised. */
onReady?: () => void;
onReady?: OnEventTypes['ready'];
/** Called after the widget is opened. */
onWidgetOpened?: () => void;
onWidgetOpened?: OnEventTypes['widget:opened'];
/** Called after the widget is closed. */
onWidgetClosed?: () => void;
onWidgetClosed?: OnEventTypes['widget:closed'];
onModuleLoaded?: OnEventTypes['module:loaded'];
/** Called after a module is opened. The callback has the module ID as it’s first argument. */
onModuleOpened?: (moduleId: string) => void;
onModuleOpened?: OnEventTypes['module:opened'];
/** Called after a popup is opened. The callback has the article ID as it’s first argument. */
onPopupOpened?: (articleId: string) => void;
onPopupOpened?: OnEventTypes['popup:opened'];
/** Called after a popup is closed. The callback has the article ID as it’s first argument. */
onPopupClosed?: (articleId: string) => void;
onPopupClosed?: OnEventTypes['popup:closed'];
/**

@@ -70,10 +71,3 @@ * Called when results for a search query are shown to user.

*/
onSearchQuery?: (results: {
query: string;
results: Array<{
category_id: string;
id: string;
title: string;
}>;
}) => void;
onSearchQuery?: OnEventTypes['search:query'];
/**

@@ -85,7 +79,3 @@ * Called when results for a search query is clicked by a user.

*/
onSearchArticleClicked?: (result: {
articleId: string;
categoryId: string;
source: string;
}) => void;
onSearchArticleClicked?: OnEventTypes['search:article:clicked'];
/**

@@ -97,7 +87,3 @@ * Called when an article is clicked in the category display.

*/
onCategoryArticleClicked?: (result: {
articleId: string;
categoryId: string;
source: string;
}) => void;
onCategoryArticleClicked?: OnEventTypes['category:article:clicked'];
/**

@@ -107,3 +93,3 @@ * Called after an article is viewed in the widget.

*/
onWidgetArticleView?: (articleId: string) => void;
onWidgetArticleView?: OnEventTypes['widget:article:view'];
/**

@@ -116,7 +102,19 @@ * Called when a helper is clicked.

*/
onHelperClicked?: (result: {
actionId: string;
type: RenderType;
target: HTMLElement;
}) => void;
onHelperClicked?: OnEventTypes['helper:clicked'];
onSuggestionsArticleClicked?: OnEventTypes['suggestions:article:clicked'];
onRelatedArticleClicked?: OnEventTypes['related:article:clicked'];
onArticleInterlinkClicked?: OnEventTypes['article:interlink:clicked'];
onArticleFeedbackReaction?: OnEventTypes['article:feedback:reaction'];
onArticleFeedbackText?: OnEventTypes['article:feedback:text'];
onArticleKBlinkClicked?: OnEventTypes['article:kblink:clicked'];
onPageView?: OnEventTypes['page:view'];
onArticleDataLoaded?: OnEventTypes['article:data:loaded'];
onArticleDataError?: OnEventTypes['article:data:error'];
onCategoryDataLoaded?: OnEventTypes['category:data:loaded'];
onArticleFeedbackLoading?: OnEventTypes['article:feedback:loading'];
onArticleFeedbackLoaded?: OnEventTypes['article:feedback:loaded'];
onArticleFeedbackError?: OnEventTypes['article:feedback:error'];
onArticleRelatedLoaded?: OnEventTypes['article:related:loaded'];
onSuggestionsDataLoaded?: OnEventTypes['suggestions:data:loaded'];
onSuggestionsDataError?: OnEventTypes['suggestions:data:error'];
};

@@ -137,5 +135,7 @@ declare class ElevioReact extends React.Component<Props> {

onWidgetClosed: PropTypes.Requireable<(...args: any[]) => any>;
onModuleLoaded: PropTypes.Requireable<(...args: any[]) => any>;
onModuleOpened: PropTypes.Requireable<(...args: any[]) => any>;
onPopupOpened: PropTypes.Requireable<(...args: any[]) => any>;
onPopupClosed: PropTypes.Requireable<(...args: any[]) => any>;
onHelperClicked: PropTypes.Requireable<(...args: any[]) => any>;
onSearchQuery: PropTypes.Requireable<(...args: any[]) => any>;

@@ -145,3 +145,18 @@ onSearchArticleClicked: PropTypes.Requireable<(...args: any[]) => any>;

onWidgetArticleView: PropTypes.Requireable<(...args: any[]) => any>;
onHelperClicked: PropTypes.Requireable<(...args: any[]) => any>;
onSuggestionsArticleClicked: PropTypes.Requireable<(...args: any[]) => any>;
onRelatedArticleClicked: PropTypes.Requireable<(...args: any[]) => any>;
onArticleInterlinkClicked: PropTypes.Requireable<(...args: any[]) => any>;
onArticleFeedbackReaction: PropTypes.Requireable<(...args: any[]) => any>;
onArticleFeedbackText: PropTypes.Requireable<(...args: any[]) => any>;
onArticleKBlinkClicked: PropTypes.Requireable<(...args: any[]) => any>;
onPageView: PropTypes.Requireable<(...args: any[]) => any>;
onArticleDataLoaded: PropTypes.Requireable<(...args: any[]) => any>;
onArticleDataError: PropTypes.Requireable<(...args: any[]) => any>;
onCategoryDataLoaded: PropTypes.Requireable<(...args: any[]) => any>;
onArticleFeedbackLoading: PropTypes.Requireable<(...args: any[]) => any>;
onArticleFeedbackLoaded: PropTypes.Requireable<(...args: any[]) => any>;
onArticleFeedbackError: PropTypes.Requireable<(...args: any[]) => any>;
onArticleRelatedLoaded: PropTypes.Requireable<(...args: any[]) => any>;
onSuggestionsDataLoaded: PropTypes.Requireable<(...args: any[]) => any>;
onSuggestionsDataError: PropTypes.Requireable<(...args: any[]) => any>;
};

@@ -152,35 +167,33 @@ constructor(props: Props);

componentDidUpdate(prevProps: Props): void;
onLoad: (_elev: WindowElev) => void;
onReady: () => void;
onWidgetOpened: () => void;
onWidgetClosed: () => void;
onModuleOpened: (moduleId: string) => void;
onPopupOpened: (articleId: string) => void;
onPopupClosed: (articleId: string) => void;
onSearchQuery: (results: {
query: string;
results: Array<{
category_id: string;
id: string;
title: string;
}>;
}) => void;
onSearchArticleClicked: (result: {
articleId: string;
categoryId: string;
source: string;
}) => void;
onCategoryArticleClicked: (result: {
articleId: string;
categoryId: string;
source: string;
}) => void;
onWidgetArticleView: (articleId: string) => void;
onHelperClicked: (result: {
actionId: string;
type: RenderType;
target: HTMLElement;
}) => void;
onReady: OnEventTypes['ready'];
onLoad: OnEventTypes['load'];
onWidgetOpened: OnEventTypes['widget:opened'];
onWidgetClosed: OnEventTypes['widget:closed'];
onModuleLoaded: OnEventTypes['module:loaded'];
onModuleOpened: OnEventTypes['module:opened'];
onPopupOpened: OnEventTypes['popup:opened'];
onPopupClosed: OnEventTypes['popup:closed'];
onSearchQuery: OnEventTypes['search:query'];
onSearchArticleClicked: OnEventTypes['search:article:clicked'];
onCategoryArticleClicked: OnEventTypes['category:article:clicked'];
onWidgetArticleView: OnEventTypes['widget:article:view'];
onHelperClicked: OnEventTypes['helper:clicked'];
onSuggestionsArticleClicked: OnEventTypes['suggestions:article:clicked'];
onRelatedArticleClicked: OnEventTypes['related:article:clicked'];
onArticleInterlinkClicked: OnEventTypes['article:interlink:clicked'];
onArticleFeedbackReaction: OnEventTypes['article:feedback:reaction'];
onArticleFeedbackText: OnEventTypes['article:feedback:text'];
onArticleKBlinkClicked: OnEventTypes['article:kblink:clicked'];
onPageView: OnEventTypes['page:view'];
onArticleDataLoaded: OnEventTypes['article:data:loaded'];
onArticleDataError: OnEventTypes['article:data:error'];
onCategoryDataLoaded: OnEventTypes['category:data:loaded'];
onArticleFeedbackLoading: OnEventTypes['article:feedback:loading'];
onArticleFeedbackLoaded: OnEventTypes['article:feedback:loaded'];
onArticleFeedbackError: OnEventTypes['article:feedback:error'];
onArticleRelatedLoaded: OnEventTypes['article:related:loaded'];
onSuggestionsDataLoaded: OnEventTypes['suggestions:data:loaded'];
onSuggestionsDataError: OnEventTypes['suggestions:data:error'];
render(): null;
}
export default ElevioReact;

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

({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);

@@ -31,3 +33,3 @@ function __() { this.constructor = d; }

var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);

@@ -58,5 +60,2 @@ return result;

var _this = _super.call(this, props) || this;
_this.onLoad = function (_elev) {
_this.props.onLoad && _this.props.onLoad(_elev);
};
_this.onReady = function () {

@@ -69,37 +68,104 @@ if (typeof serverEnabled === 'undefined') {

};
_this.onLoad = function (result) {
return _this.props.onLoad && _this.props.onLoad(result);
};
_this.onWidgetOpened = function () {
_this.props.onWidgetOpened && _this.props.onWidgetOpened();
return _this.props.onWidgetOpened && _this.props.onWidgetOpened();
};
_this.onWidgetClosed = function () {
_this.props.onWidgetClosed && _this.props.onWidgetClosed();
return _this.props.onWidgetClosed && _this.props.onWidgetClosed();
};
_this.onModuleOpened = function (moduleId) {
_this.props.onModuleOpened && _this.props.onModuleOpened(moduleId);
_this.onModuleLoaded = function (result) {
return _this.props.onModuleLoaded && _this.props.onModuleLoaded(result);
};
_this.onPopupOpened = function (articleId) {
_this.props.onPopupOpened && _this.props.onPopupOpened(articleId);
_this.onModuleOpened = function (result) {
return _this.props.onModuleOpened && _this.props.onModuleOpened(result);
};
_this.onPopupClosed = function (articleId) {
_this.props.onPopupClosed && _this.props.onPopupClosed(articleId);
_this.onPopupOpened = function (result) {
return _this.props.onPopupOpened && _this.props.onPopupOpened(result);
};
_this.onSearchQuery = function (results) {
_this.props.onSearchQuery && _this.props.onSearchQuery(results);
_this.onPopupClosed = function (result) {
return _this.props.onPopupClosed && _this.props.onPopupClosed(result);
};
_this.onSearchQuery = function (result) {
_this.props.onSearchQuery && _this.props.onSearchQuery(result);
};
_this.onSearchArticleClicked = function (result) {
_this.props.onSearchArticleClicked &&
return _this.props.onSearchArticleClicked &&
_this.props.onSearchArticleClicked(result);
};
_this.onCategoryArticleClicked = function (result) {
_this.props.onCategoryArticleClicked &&
return _this.props.onCategoryArticleClicked &&
_this.props.onCategoryArticleClicked(result);
};
_this.onWidgetArticleView = function (articleId) {
_this.props.onWidgetArticleView && _this.props.onWidgetArticleView(articleId);
_this.onWidgetArticleView = function (result) {
return _this.props.onWidgetArticleView && _this.props.onWidgetArticleView(result);
};
_this.onHelperClicked = function (result) {
_this.props.onHelperClicked && _this.props.onHelperClicked(result);
return _this.props.onHelperClicked && _this.props.onHelperClicked(result);
};
_this.onSuggestionsArticleClicked = function (result) {
return _this.props.onSuggestionsArticleClicked &&
_this.props.onSuggestionsArticleClicked(result);
};
_this.onRelatedArticleClicked = function (result) {
return _this.props.onRelatedArticleClicked &&
_this.props.onRelatedArticleClicked(result);
};
_this.onArticleInterlinkClicked = function (result) {
return _this.props.onArticleInterlinkClicked &&
_this.props.onArticleInterlinkClicked(result);
};
_this.onArticleFeedbackReaction = function (result) {
return _this.props.onArticleFeedbackReaction &&
_this.props.onArticleFeedbackReaction(result);
};
_this.onArticleFeedbackText = function (result) {
return _this.props.onArticleFeedbackText &&
_this.props.onArticleFeedbackText(result);
};
_this.onArticleKBlinkClicked = function (result) {
return _this.props.onArticleKBlinkClicked &&
_this.props.onArticleKBlinkClicked(result);
};
_this.onPageView = function (result) {
return _this.props.onPageView && _this.props.onPageView(result);
};
_this.onArticleDataLoaded = function (result) {
return _this.props.onArticleDataLoaded && _this.props.onArticleDataLoaded(result);
};
_this.onArticleDataError = function (result) {
return _this.props.onArticleDataError && _this.props.onArticleDataError(result);
};
_this.onCategoryDataLoaded = function (result) {
return _this.props.onCategoryDataLoaded && _this.props.onCategoryDataLoaded(result);
};
_this.onArticleFeedbackLoading = function (result) {
return _this.props.onArticleFeedbackLoading &&
_this.props.onArticleFeedbackLoading(result);
};
_this.onArticleFeedbackLoaded = function (result) {
return _this.props.onArticleFeedbackLoaded &&
_this.props.onArticleFeedbackLoaded(result);
};
_this.onArticleFeedbackError = function (result) {
return _this.props.onArticleFeedbackError &&
_this.props.onArticleFeedbackError(result);
};
_this.onArticleRelatedLoaded = function (result) {
return _this.props.onArticleRelatedLoaded &&
_this.props.onArticleRelatedLoaded(result);
};
_this.onSuggestionsDataLoaded = function (result) {
return _this.props.onSuggestionsDataLoaded &&
_this.props.onSuggestionsDataLoaded(result);
};
_this.onSuggestionsDataError = function (result) {
return _this.props.onSuggestionsDataError &&
_this.props.onSuggestionsDataError(result);
};
client_1.default.on('ready', _this.onReady);
client_1.default.on('widget:opened', _this.onWidgetOpened);
client_1.default.on('widget:closed', _this.onWidgetClosed);
client_1.default.on('module:loaded', _this.onModuleLoaded);
client_1.default.on('module:opened', _this.onModuleOpened);

@@ -113,2 +179,18 @@ client_1.default.on('popup:opened', _this.onPopupOpened);

client_1.default.on('helper:clicked', _this.onHelperClicked);
client_1.default.on('suggestions:article:clicked', _this.onSuggestionsArticleClicked);
client_1.default.on('related:article:clicked', _this.onRelatedArticleClicked);
client_1.default.on('article:interlink:clicked', _this.onArticleInterlinkClicked);
client_1.default.on('article:feedback:reaction', _this.onArticleFeedbackReaction);
client_1.default.on('article:feedback:text', _this.onArticleFeedbackText);
client_1.default.on('article:kblink:clicked', _this.onArticleKBlinkClicked);
client_1.default.on('page:view', _this.onPageView);
client_1.default.on('article:data:loaded', _this.onArticleDataLoaded);
client_1.default.on('article:data:error', _this.onArticleDataError);
client_1.default.on('category:data:loaded', _this.onCategoryDataLoaded);
client_1.default.on('article:feedback:loading', _this.onArticleFeedbackLoading);
client_1.default.on('article:feedback:loaded', _this.onArticleFeedbackLoaded);
client_1.default.on('article:feedback:error', _this.onArticleFeedbackError);
client_1.default.on('article:related:loaded', _this.onArticleRelatedLoaded);
client_1.default.on('suggestions:data:loaded', _this.onSuggestionsDataLoaded);
client_1.default.on('suggestions:data:error', _this.onSuggestionsDataError);
return _this;

@@ -130,20 +212,14 @@ }

// Wait until Elevio has loaded before setting settings.
if (_this.props.keywords) {
if (_this.props.keywords)
client_1.default.setKeywords(_this.props.keywords);
}
if (_this.props.language) {
if (_this.props.language)
client_1.default.setLanguage(_this.props.language);
}
if (_this.props.user) {
if (_this.props.user)
client_1.default.setUser(_this.props.user);
}
if (_this.props.settings) {
if (_this.props.settings)
client_1.default.setSettings(_this.props.settings);
}
if (_this.props.pageUrl) {
if (_this.props.pageUrl)
client_1.default.setPage(_this.props.pageUrl);
}
if (_this.props.translations) {
if (_this.props.translations)
client_1.default.setTranslations(_this.props.translations);
}
if (serverEnabled) {

@@ -160,3 +236,3 @@ client_1.default.enable();

ElevioReact.prototype.componentDidUpdate = function (prevProps) {
if (!fast_deep_equal_1.default(this.props.keywords, prevProps.keywords)) {
if (!(0, fast_deep_equal_1.default)(this.props.keywords, prevProps.keywords)) {
client_1.default.setKeywords(this.props.keywords);

@@ -168,3 +244,3 @@ }

// Check the user
if (!fast_deep_equal_1.default(this.props.user, prevProps.user)) {
if (!(0, fast_deep_equal_1.default)(this.props.user, prevProps.user)) {
// Either update if user has change, or log them out.

@@ -182,3 +258,3 @@ if (this.props.user) {

if (this.props.settings &&
!fast_deep_equal_1.default(this.props.settings, prevProps.settings)) {
!(0, fast_deep_equal_1.default)(this.props.settings, prevProps.settings)) {
if (this.props.settings.enabled) {

@@ -192,3 +268,3 @@ serverEnabled = this.props.settings.enabled;

}
if (!fast_deep_equal_1.default(this.props.translations, prevProps.translations)) {
if (!(0, fast_deep_equal_1.default)(this.props.translations, prevProps.translations)) {
client_1.default.setTranslations(this.props.translations);

@@ -213,5 +289,7 @@ }

onWidgetClosed: prop_types_1.default.func,
onModuleLoaded: prop_types_1.default.func,
onModuleOpened: prop_types_1.default.func,
onPopupOpened: prop_types_1.default.func,
onPopupClosed: prop_types_1.default.func,
onHelperClicked: prop_types_1.default.func,
onSearchQuery: prop_types_1.default.func,

@@ -221,3 +299,18 @@ onSearchArticleClicked: prop_types_1.default.func,

onWidgetArticleView: prop_types_1.default.func,
onHelperClicked: prop_types_1.default.func,
onSuggestionsArticleClicked: prop_types_1.default.func,
onRelatedArticleClicked: prop_types_1.default.func,
onArticleInterlinkClicked: prop_types_1.default.func,
onArticleFeedbackReaction: prop_types_1.default.func,
onArticleFeedbackText: prop_types_1.default.func,
onArticleKBlinkClicked: prop_types_1.default.func,
onPageView: prop_types_1.default.func,
onArticleDataLoaded: prop_types_1.default.func,
onArticleDataError: prop_types_1.default.func,
onCategoryDataLoaded: prop_types_1.default.func,
onArticleFeedbackLoading: prop_types_1.default.func,
onArticleFeedbackLoaded: prop_types_1.default.func,
onArticleFeedbackError: prop_types_1.default.func,
onArticleRelatedLoaded: prop_types_1.default.func,
onSuggestionsDataLoaded: prop_types_1.default.func,
onSuggestionsDataError: prop_types_1.default.func,
};

@@ -224,0 +317,0 @@ return ElevioReact;

@@ -11,3 +11,3 @@ {

],
"version": "1.1.0",
"version": "1.2.0",
"devDependencies": {

@@ -17,15 +17,13 @@ "@skypack/package-check": "^0.2.2",

"@types/express": "^4.17.12",
"@types/html-webpack-plugin": "^3.2.5",
"@types/prop-types": "^15.7.3",
"@types/react": "16.8.19",
"@types/react-dom": "16.8.4",
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11",
"@types/webpack": "^5.28.0",
"@types/webpack-dev-middleware": "^5.0.0",
"@types/webpack-dev-server": "^3.11.4",
"cypress": "3.3.1",
"ejs": "2.6.1",
"express": "4.17.1",
"html-webpack-plugin": "3.2.0",
"react": "16.8.6",
"react-dom": "16.8.6",
"cypress": "^3.8.3",
"ejs": "^3.1.6",
"express": "^4.17.2",
"html-webpack-plugin": "^5.5.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"start-server-and-test": "^1.12.5",

@@ -38,3 +36,3 @@ "ts-loader": "^9.2.3",

"webpack-dev-middleware": "^5.0.0",
"webpack-dev-server": "^3.11.2"
"webpack-dev-server": "^4.7.1"
},

@@ -53,3 +51,3 @@ "scripts": {

"fast-deep-equal": "^3.1.3",
"prop-types": "15.7.2"
"prop-types": "^15.8.0"
},

@@ -56,0 +54,0 @@ "files": [

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