announcekit-react
Advanced tools
Comparing version 3.0.1 to 3.1.0
@@ -8,2 +8,3 @@ import * as React from "react"; | ||
name?: string; | ||
trackLocationChanges?: boolean; | ||
onWidgetOpen?: Function; | ||
@@ -10,0 +11,0 @@ onWidgetClose?: Function; |
@@ -55,3 +55,3 @@ "use strict"; | ||
}); | ||
}, | ||
} | ||
}; | ||
@@ -95,3 +95,3 @@ var scripttag = document.createElement("script"); | ||
return this.withWidget(function (widget) { return widget.state.ui.unreadCount; }); | ||
}, | ||
} | ||
}); }); | ||
@@ -123,2 +123,14 @@ var onWidgetOpen = props.onWidgetOpen, onWidgetClose = props.onWidgetClose, onWidgetResize = props.onWidgetResize, onWidgetUnread = props.onWidgetUnread; | ||
var customConfig = props.customConfig, widget = props.widget, floatWidget = props.floatWidget, embedWidget = props.embedWidget, _b = props.boosters, boosters = _b === void 0 ? true : _b, widgetStyle = props.widgetStyle, lang = props.lang, name = props.name, user = props.user, data = props.data; | ||
var _c = React.useState(window.location.href), loc = _c[0], setLoc = _c[1]; | ||
(0, react_1.useEffect)(function () { | ||
if (!props.trackLocationChanges) { | ||
return; | ||
} | ||
var timer = setInterval(function () { | ||
if (loc !== window.location.href) { | ||
setLoc(window.location.href); | ||
} | ||
}, 250); | ||
return function () { return clearInterval(timer); }; | ||
}, [props.trackLocationChanges, loc]); | ||
// Push new widget config | ||
@@ -136,3 +148,3 @@ (0, use_deep_compare_effect_1.default)(function () { | ||
badge: floatWidget ? {} : __assign({}, widgetStyle), | ||
float: __assign({}, widgetStyle), | ||
float: __assign({}, widgetStyle) | ||
}, onInit: function (w) { | ||
@@ -161,2 +173,3 @@ var _a; | ||
boosters, | ||
loc | ||
]); | ||
@@ -163,0 +176,0 @@ return (React.createElement("div", { ref: elementRef, style: { display: "inline" }, className: (_a = props.className) !== null && _a !== void 0 ? _a : "" }, props.children)); |
{ | ||
"name": "announcekit-react", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "Use AnnounceKit widgets in your React App", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -33,3 +33,3 @@ ![](https://announcekit.app/images/logo@2x.png) | ||
<li> | ||
<AnnounceKit widget="https://announcekit.app/widgets/v2/34MmKA"> | ||
<AnnounceKit widget="https://announcekit.co/widgets/v2/3xdhio"> | ||
<span>Whats new</span> | ||
@@ -56,2 +56,4 @@ </AnnounceKit> | ||
- `data` - [Segmentation data](https://announcekit.app/docs#segmentation) | ||
- `labels` - In case you want to filter and display posts under a specific label or tag. | ||
- `user_token` - JWT setup: https://announcekit.app/docs/jwt | ||
- `onWidgetOpen` - Called when the widget is opened. | ||
@@ -84,3 +86,3 @@ - `onWidgetClose` - Called when the widget is closed. | ||
</button> | ||
<AnnounceKit ref={ref} widget="https://announcekit.app/widgets/v2/3739N6"> | ||
<AnnounceKit ref={ref} widget="https://announcekit.co/widgets/v2/3xdhio"> | ||
<span>Whats new</span> | ||
@@ -87,0 +89,0 @@ </AnnounceKit> |
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
18971
9
399
91