'), ' tag:', C.a.createElement('br', null), C.a.createElement(YE, {
language: 'html'
}, ''))), C.a.createElement('li', null, 'Append ', C.a.createElement('code', null, '#disqus_thread'), ' to the ', C.a.createElement('code', null, 'href'), ' attribute in your links. This will tell Disqus which links to look up and return the comment count. For example: ', C.a.createElement('code', null, 'Link'), '.')), C.a.createElement('h2', {
className: 'text-gray-dark text-larger spacing-bottom'
}, 'Additional customization'), C.a.createElement('div', {
className: 'alert alert--muted text-medium'
}, 'See our ', C.a.createElement('a', {
href: Pn.commentCountLinks
}, 'Adding comment count links to your home page'), ' documentation.')))
};
lh.displayName = 'UniversalCodeInstall',
lh.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
Fc = lh;
function nO(e) {
var t = window.opener;
t && t.postMessage(e, '*')
}
sl = {
configure: function (n, a) {
return function (e) {
e({
type: Ee.configuring
});
var t = a.trim().split(' ');
t.length < 2 ? e({
type: Ee.onConfigureError,
message: 'Your install token is invalid. Try copying and pasting it from your plugin installation page again.'
}) : io.a.call('integration/wordpress/updateConfiguration', {
method: 'POST',
data: {
forum: n,
url: t[0],
secret: t[1]
},
success: function () {
e({
type: Ee.onConfigure
}),
nO('configurationUpdated')
},
error: function () {
e({
type: Ee.onConfigureError,
message: 'An error occurred trying to configure your site. Make sure the Disqus plugin is installed and activated, and that your site is publicly accessible.'
}),
nO('configurationError')
}
})
}
},
updateInstallToken: function (e) {
return {
type: Ee.updateInstallToken,
token: e.data || e.target.value
}
}
};
function aO(e) {
return (aO = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function rO(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function oO(e, t) {
return (oO = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function iO(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = lO(n);
return e = a ? (e = lO(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== aO(e) && 'function' != typeof e ? sO(t) : e
}
}
function sO(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function lO(e) {
return (lO = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function cO(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var uO = !!window.opener,
yl = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && oO(e, t)
}(o, A);
var e,
t,
n,
r = iO(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return cO(sO(t = r.call.apply(r, [
this
].concat(n))), 'handleReceivePostMessage', function (e) {
~e.data.indexOf('disqus/v1/settings') && t.props.updateInstallToken(e)
}),
cO(sO(t), 'submitInstallForum', function (e) {
e.preventDefault();
e = t.props.selection && t.props.selection.forum && t.props.selection.forum.shortname;
e && t.props.configure(e, t.props.wordpressInstall.installToken)
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
nO('installPageReady'),
window.opener && window.addEventListener('message', this.handleReceivePostMessage, !1)
}
},
{
key: 'componentWillUnmount',
value: function () {
window.opener && window.removeEventListener('message', this.handleReceivePostMessage, !1)
}
},
{
key: 'render',
value: function () {
var e = (this.props.selection.forum || {
}).shortname,
t = this.props.wordpressInstall.installToken,
n = this.props.wordpressInstall.isConfiguring ? 'Contacting your site…' : C.a.createElement('span', null, 'Install ', C.a.createElement('em', null, e), ' on your site'),
e = this.props.wordpressInstall.isConfigured ? C.a.createElement('div', {
className: 'spacing-top-double spacing-bottom'
}, C.a.createElement('span', {
className: 'icon icon-checkmark'
}), ' Site updated. Click ', C.a.createElement('strong', null, 'Configure'), ' to continue setting up Disqus.') : e ? C.a.createElement('div', null, C.a.createElement('div', {
className: 'video-wrapper'
}, C.a.createElement('iframe', {
id: 'ytplayer',
type: 'text/html',
width: '720',
height: '405',
src: 'https://www.youtube.com/embed/a4JBJXyuaFk?modestbranding=1&rel=0&showinfo=0',
frameBorder: '0',
allowFullScreen: !0
})), C.a.createElement('ol', {
className: 'installation__instruction-list'
}, uO ? null : [
C.a.createElement('li', {
key: '1'
}, 'In the left panel of your WordPress admin, select ', C.a.createElement('strong', null, 'Plugins > Add New.')),
C.a.createElement('li', {
key: '2'
}, 'Search for "Disqus" and find the plugin provided by "Disqus".'),
C.a.createElement('li', {
key: '3'
}, 'Select ', C.a.createElement('strong', null, 'Install Now'), ' then ', C.a.createElement('strong', null, 'Activate Plugin')),
C.a.createElement('li', {
key: '4'
}, 'Click "Disqus" in the left panel of your WordPress admin.')
], C.a.createElement('li', null, C.a.createElement('form', {
onSubmit: this.submitInstallForum
}, C.a.createElement('label', null, 'Copy the ', C.a.createElement('strong', null, 'Installation Token'), ' and paste it into the form below to complete the installation', C.a.createElement('input', {
type: 'text',
className: 'input--textbox spacing-top-narrow',
name: 'installToken',
placeholder: 'Paste your WordPress install key here',
value: t,
onChange: this.props.updateInstallToken,
disabled: !e
})), C.a.createElement('button', {
className: 'button button-fill--brand button-padding-wide button-medium spacing-top-narrow',
disabled: this.props.wordpressInstall.isConfiguring || !t || !t.length
}, n)), this.props.wordpressInstall.configureError ? C.a.createElement(Ki, {
message: this.props.wordpressInstall.configureError,
alertType: 'error'
}) : null, C.a.createElement('div', null, C.a.createElement('h3', {
className: 'spacing-top'
}, 'Using manual installation?'), C.a.createElement('ul', {
className: 'list-bullet'
}, C.a.createElement('li', null, 'In the shortname field, enter your shortname: ', C.a.createElement('code', {
className: 'inline'
}, e)), C.a.createElement('li', null, 'Optionally, create an ', C.a.createElement('a', {
href: 'https://disqus.com/api/applications/'
}, 'API Application'), ' for your site.', C.a.createElement('ul', {
className: 'list-circle'
}, C.a.createElement('li', null, 'After registering the application, go to the settings tab and set ', C.a.createElement('strong', null, 'Default Access'), ' to ', C.a.createElement('em', null, 'Read, write, and manage forums'), '.'), C.a.createElement('li', null, 'On the plugin configuration page, enter the API key, secret, and access token and click ', C.a.createElement('strong', null, 'Save'), '.')))))))) : C.a.createElement('div', {
className: 'spacing-top-double spacing-bottom'
}, C.a.createElement('strong', null, 'Pick a Site'), ' or ', C.a.createElement('strong', null, 'Create a Site'), ' to continue installation.');
return C.a.createElement(tO, {
selection: this.props.selection,
platformClassName: 'wordpress',
platformPageName: 'WordPress',
isBaseInstallPath: this.props.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, e))
}
}
]) && rO(e.prototype, t),
n && rO(e, n),
o
}();
cO(yl, 'displayName', 'WordpressInstall'),
cO(yl, 'propTypes', {
selection: ht.isRequired,
configure: b.a.func.isRequired,
updateInstallToken: b.a.func.isRequired,
wordpressInstall: b.a.shape({
installToken: b.a.string,
isConfiguring: b.a.bool,
isConfigured: b.a.bool,
configureError: b.a.string
}).isRequired,
isBaseInstallPath: b.a.bool,
installToken: b.a.string,
isConfiguring: b.a.bool,
isConfigured: b.a.bool,
configureError: b.a.string
});
Vb = {
configure: sl.configure,
updateInstallToken: sl.updateInstallToken
},
cu = Object(u.connect) (function (e) {
return {
wordpressInstall: e.wordpressInstall
}
}, Vb) (yl);
function pO(e) {
return (pO = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function dO(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function mO(e, t) {
return (mO = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function fO(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = gO(n);
return e = a ? (e = gO(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== pO(e) && 'function' != typeof e ? hO(t) : e
}
}
function hO(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function gO(e) {
return (gO = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function yO(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Jc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && mO(e, t)
}(o, A);
var e,
t,
n,
r = fO(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return yO(hO(t = r.call.apply(r, [
this
].concat(n))), 'handleClick', function (e) {
e.preventDefault(),
Au.openCurrentInstance(t.props.path)
}),
t
}
return e = o,
(t = [
{
key: 'render',
value: function () {
return C.a.createElement('a', {
href: ho.getRoute(this.props.path),
onClick: this.handleClick,
className: this.props.linkClassName
}, this.props.children)
}
}
]) && dO(e.prototype, t),
n && dO(e, n),
o
}();
yO(Jc, 'propTypes', {
children: b.a.node.isRequired,
linkClassName: b.a.string,
path: b.a.string.isRequired
});
var bO = Jc,
Ru = function (e) {
e = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement('form', {
method: 'post',
action: 'https://www.blogger.com/add-widget',
target: '_blank'
}, C.a.createElement('input', {
type: 'hidden',
name: 'infoUrl',
value: 'https://'.concat(e, '.disqus.com/admin/settings/blogger/')
}), C.a.createElement('input', {
type: 'hidden',
name: 'logoUrl',
value: 'https://disqus.com/api/forums/favicons/'.concat(e, '.jpg')
}), C.a.createElement('input', {
type: 'hidden',
name: 'widget.title',
value: 'Disqus for '.concat(e)
}), C.a.createElement('textarea', {
name: 'widget.content',
className: 'installation__textarea',
style: {
display: 'none'
}
}, ''), C.a.createElement('input', {
type: 'hidden',
name: 'widget.template',
value: '\n\n\n\n\n\n\n\n')
}), C.a.createElement('button', {
className: 'button button-fill--brand button-padding-wide button-medium',
name: 'go'
}, 'Add '.concat(e, ' to my Blogger site')))
};
Ru.displayName = 'UniversalCodeInstallationBloggerWidget',
Ru.propTypes = {
selection: ht
};
var vO = Ru,
Bu = function (e, t) {
var n = t.auth.isAuthenticated,
t = ''.concat(dt, '/publishers/login/?next=').concat(window.location.pathname),
t = n ? e.selection.forum ? C.a.createElement(vO, {
selection: e.selection
}) : C.a.createElement('p', null, C.a.createElement(bO, null, 'Please select a site'), ' to add the Blogger widget.') : C.a.createElement('p', null, C.a.createElement('a', {
href: t
}, 'Please login'), ' to add the Blogger widget.');
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'blogger',
platformPageName: 'Blogger',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('div', {
className: 'video-wrapper'
}, C.a.createElement('iframe', {
id: 'ytplayer',
type: 'text/html',
width: '720',
height: '405',
src: 'https://www.youtube.com/embed/JldEG0XU9w8?modestbranding=1&rel=0&showinfo=0',
frameBorder: '0',
allowFullScreen: !0
})), C.a.createElement('ol', {
className: 'installation__instruction-list -blogger'
}, C.a.createElement('li', null, t), C.a.createElement('li', null, 'Import your existing Blogger comments into Disqus at ', C.a.createElement(Uo, {
path: '/discussions/import/platform/blogger/',
selection: e.selection
}, 'Discussions > Import'), '.'), C.a.createElement('li', null, 'Update your blogger template\'s meta tags for full Internet Explorer compatibility. ', C.a.createElement('a', {
href: Pn.bloggerIEFix
}, 'See instructions here.'))), C.a.createElement('div', {
className: 'alert alert--muted text-medium'
}, 'If the widget does not work, see ', C.a.createElement('a', {
href: Pn.bloggerManualInstall
}, 'Blogger Installation Help'), ' for instructions on how to update your Blogger template to work with the widget.')))
};
Bu.displayName = 'BloggerInstall',
Bu.contextTypes = {
auth: b.a.object.isRequired
},
Bu.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
xu = Bu,
h = function (e) {
var t = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'tumblr',
platformPageName: 'Tumblr',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'In Tumblr, visit ', C.a.createElement('a', {
href: 'https://www.tumblr.com/settings/',
target: '_blank'
}, C.a.createElement('strong', null, 'Settings')), ' > pick your blog > click ', C.a.createElement('span', {
className: 'installation__instruction-tumblr-edit-theme'
}, 'Edit theme')), C.a.createElement('li', null, 'In the shortname field, enter your shortname: ', C.a.createElement('code', {
className: 'inline'
}, t)), C.a.createElement('li', null, 'Save your theme and you\'re done.')), C.a.createElement('div', {
className: 'alert alert--muted text-medium'
}, C.a.createElement('p', null, C.a.createElement('strong', null, 'Note:'), ' If your Tumblr theme does not have built-in Disqus support, you can ', C.a.createElement('a', {
href: Pn.tumblrManualInstall,
target: '_blank'
}, 'install Disqus manually'), '.'))))
};
h.displayName = 'TumblrInstall',
h.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
y = h,
lt = function (e) {
var t = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'squarespace',
platformPageName: 'Squarespace',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'Navigate to your Squarespace ', C.a.createElement('strong', null, 'Settings > Blogging'), ' page.'), C.a.createElement('li', null, 'In the Disqus shortname field, enter your shortname: ', C.a.createElement('code', {
className: 'inline site-shortname'
}, t), '.'), C.a.createElement('li', null, 'Navigate to your ', C.a.createElement('strong', null, 'Comments Settings'), ' page and select ', C.a.createElement('strong', null, 'Enable Comments Globally'), '.')), C.a.createElement('div', {
className: 'alert alert--muted text-medium'
}, C.a.createElement('strong', null, 'Note:'), ' This installation method enables Disqus on blog pages only. To add Disqus to non-blog content like e-commerce pages, use the ', C.a.createElement(v.Link, {
to: '/install/platforms/universalcode/'
}, 'Universal Code'), ' instructions and Squarespace\'s ', C.a.createElement('a', {
href: 'https://support.squarespace.com/hc/en-us/articles/205815908-Using-Code-Injection',
target: '_blank'
}, 'Code Injection'), ' tool.')))
};
lt.displayName = 'SquarespaceInstall',
lt.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
p = lt,
ut = function (e) {
var t = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'typepad',
platformPageName: 'TypePad',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'In your TypePad dashboard select ', C.a.createElement('strong', null, 'Design'), '.'), C.a.createElement('li', null, 'On the left sidebar select ', C.a.createElement('strong', null, 'Content'), '.'), C.a.createElement('li', null, 'Under Modules, choose ', C.a.createElement('strong', null, 'Embed your own HTML'), ' > ', C.a.createElement('strong', null, 'Add this module'), '.', C.a.createElement('div', {
className: 'alert alert--muted text-medium'
}, 'Note: If you do not have the Content or \'Embed Your Own HTML\' option with your design, please see Typepad\'s more specific ', C.a.createElement('a', {
href: Pn.typePadHelp,
target: '_blank',
rel: 'noopener noreferrer'
}, 'installation instructions'), '.')), C.a.createElement('li', null, 'In the label field type "Disqus".'), C.a.createElement('li', null, 'Copy and paste the following code into the HTML field.', 'EXAMPLE' === t ? C.a.createElement(C.a.Fragment, null, C.a.createElement('div', {
className: 'alert alert--muted text-medium spacing-top-small spacing-bottom-none'
}, 'Make sure to replace ', C.a.createElement('i', null, 'EXAMPLE'), ' in the ', C.a.createElement('code', {
className: 'inline'
}, 'disqus_shortname'), ' with the shortname for your own forum.')) : null, C.a.createElement(YE, {
language: 'html'
}, ''))), C.a.createElement('li', null, 'On the left sidebar select ', C.a.createElement('strong', null, 'Custom CSS'), ' and copy and paste the following code.', C.a.createElement(YE, {
language: 'css'
}, '#all-comments {\n display: none !important;\n}\n.comments-open {\n display: none !important;\n}')), C.a.createElement('li', null, 'Save your changes.'))))
};
ut.displayName = 'TypepadInstall',
ut.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
Sn = ut,
qn = function (e) {
var t = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'movabletype',
platformPageName: 'Movable Type',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'Download the ', C.a.createElement('a', {
href: 'https://media.disqus.com/disqus-movabletype-2.02.zip'
}, 'Disqus plugin for Movable Type')), C.a.createElement('li', null, 'Unpack the archive to the ', C.a.createElement('code', {
className: 'inline'
}, '/path/to/movabletype'), ' directory inside of Movable Type.', C.a.createElement('div', {
className: 'alert alert--muted text-medium'
}, C.a.createElement('span', null, C.a.createElement('strong', null, 'Important:'), ' Maintain the directory structure of the archive. All extracted files should exist in: ', C.a.createElement('br', null), C.a.createElement('br', null), C.a.createElement('code', null, '/path/to/movabletype/plugins/disqus/'), ' — If your site doesn\'t allow global CGI execution, this path may be located in your cgi-bin.', C.a.createElement('br', null), C.a.createElement('br', null), C.a.createElement('code', null, '/path/to/movabletype/mt-static/plugins/disqus/')))), C.a.createElement('li', null, 'On your site\'s ', C.a.createElement('strong', null, 'Tools > Plugins'), ' page, enable the Disqus plugin.'), C.a.createElement('li', null, 'In the ', C.a.createElement('strong', null, 'Settings'), ' tab, choose ', C.a.createElement('strong', null, 'Install DISQUS')), C.a.createElement('li', null, 'Follow the walkthrough setup process. In the shortname field, enter your shortname: ', C.a.createElement('code', {
className: 'inline'
}, t), '.'), C.a.createElement('li', null, 'Choose ', C.a.createElement('strong', null, 'Publish Site'), ' and publish all files.'))))
};
qn.displayName = 'MovableTypeInstall',
qn.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
Ln = qn,
i = function (e) {
var t = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'drupal',
platformPageName: 'Drupal',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'Download the ', C.a.createElement('a', {
href: 'https://www.drupal.org/project/disqus',
target: '_blank'
}, 'Disqus Drupal module'), '.'), C.a.createElement('li', null, 'Upload the Disqus module to your site\'s modules directory in ', C.a.createElement('code', {
className: 'inline'
}, 'sites/all/modules')), C.a.createElement('li', null, 'Visit ', C.a.createElement('strong', null, 'Administer > Site building > Modules'), ' and enable the module.'), C.a.createElement('li', null, 'Visit ', C.a.createElement('strong', null, 'Administer > Site configuration > Disqus'), '.'), C.a.createElement('li', null, 'In the shortname field, enter your shortname: ', C.a.createElement('code', {
className: 'inline'
}, t), '.'), C.a.createElement('li', null, 'Visit ', C.a.createElement('strong', null, 'Administer > User Management > Permissions'), ' and enable the "View Disqus Comments" permission.'))))
};
i.displayName = 'DrupalInstall',
i.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
c = i,
go = function (e) {
var t = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'joomla',
platformPageName: 'Joomla',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'Download the ', C.a.createElement('a', {
href: 'http://extensions.joomla.org/extensions/extension/social-web/social-comments/disqus-comments',
target: '_blank'
}, 'Disqus for Joomla plug-in'), '.'), C.a.createElement('li', null, 'In your Joomla admin select ', C.a.createElement('strong', null, 'Extension Manager'), '.'), C.a.createElement('li', null, 'Upload the Disqus plugin.'), C.a.createElement('li', null, 'Under the Extensions menu choose ', C.a.createElement('strong', null, 'Plug-in Manager'), '.'), C.a.createElement('li', null, 'In the Disqus subdomain field, enter your shortname: ', C.a.createElement('code', {
className: 'inline'
}, t), '.'))))
};
go.displayName = 'JoomlaInstall',
go.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
bo = go,
Qs = function (e) {
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'weebly',
platformPageName: 'Weebly',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'Go to the Blog Settings button at the bottom of your blog.'), C.a.createElement('li', null, 'Choose "Disqus" from the Commenting System drop down menu.'), C.a.createElement('li', null, 'Enter your shortname in the Weebly "Disqus Shortname" field.'), C.a.createElement('li', null, 'Save your changes and Publish your site.'))))
};
Qs.displayName = 'WeeblyInstall',
Qs.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
Ts = Qs,
ac = function (e) {
var t = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'strikingly',
platformPageName: 'Strikingly',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'In Strikingly, click on ', C.a.createElement('strong', null, 'Manage Blog Posts'), '.'), C.a.createElement('li', null, 'In the ', C.a.createElement('strong', null, 'BLOG SETTINGS'), ' tab, enter your ', C.a.createElement('strong', null, 'shortname:'), ' ', C.a.createElement('code', {
className: 'inline'
}, t)), C.a.createElement('li', null, 'Click ', C.a.createElement('strong', null, 'SAVE CHANGES'), '.'))))
};
ac.displayName = 'StrikinglyInstall',
ac.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
cs = ac,
Ls = function (e) {
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'jekyll',
platformPageName: 'Jekyll',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'Add a variable called ', C.a.createElement('code', {
className: 'inline'
}, 'comments'), ' to the', C.a.createElement('a', {
href: Pn.yamlFrontMatter,
target: '_blank',
rel: 'noopener noreferrer'
}, ' ', 'YAML Front Matter'), ' and set its value to ', C.a.createElement('code', {
className: 'inline'
}, 'true'), '. A sample front matter might look like:', C.a.createElement('br', null), C.a.createElement(YE, {
language: 'yaml'
}, '---\nlayout: default\ncomments: true\n# other options\n---')), C.a.createElement('li', null, 'In between a ', C.a.createElement('code', {
className: 'inline'
}, '{% if page.comments %}'), ' and', ' ', 'a ', C.a.createElement('code', {
className: 'inline'
}, '{% endif %}'), ' tag, copy and paste the', ' ', C.a.createElement(v.Link, {
to: '/install/platforms/universalcode'
}, 'Universal Embed Code'), ' in the', ' ', 'appropriate template where you\'d like Disqus to load.')), C.a.createElement('div', {
className: 'alert alert--muted text-medium'
}, 'Note: Comments can be disabled per-page by setting ', C.a.createElement('code', {
className: 'inline'
}, 'comments: false'), ' or by not including the comments option at all.')))
};
Ls.displayName = 'JekyllInstall',
Ls.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
Lo = Ls,
Mo = function (e) {
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'ghost',
platformPageName: 'Ghost',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'Find the ', C.a.createElement('strong', null, 'post.hbs'), ' file located in your current theme\'s directory, for example ', C.a.createElement('code', {
className: 'inline'
}, 'yourghostdir/content/themes/casper/')), C.a.createElement('li', null, 'Copy and paste the ', C.a.createElement(v.Link, {
to: '/install/platforms/universalcode'
}, 'Universal Embed Code'), ' somewhere', ' ', 'between the opening ', C.a.createElement('code', {
className: 'inline'
}, '{{#post}}'), ' and closing', ' ', C.a.createElement('code', {
className: 'inline'
}, '{{/post}}'), ' helpers.'), C.a.createElement('li', null, 'Change ', C.a.createElement('code', {
className: 'inline'
}, 'PAGE_IDENTIFER'), 'to be', C.a.createElement('code', {
className: 'inline'
}, '"ghost-{{comment_id}}"'), ' (including quotes).'), C.a.createElement('li', null, 'Restart Ghost.')), C.a.createElement('div', {
className: 'alert alert--muted text-medium'
}, 'Note: If you choose to place the snippet outside of the', C.a.createElement('code', {
className: 'inline'
}, '{{#post}}{{/post}}'), 'block, your identifier would need to be', C.a.createElement('code', {
className: 'inline'
}, '"ghost-{{post.comment_id}}'), '. The ', C.a.createElement('code', {
className: 'inline'
}, 'comment_id'), ' identifier is required to avoid any issues caused by post URLs changing. ', C.a.createElement('a', {
href: Pn.splitThreads
}, 'Learn more'), '.')))
};
Mo.displayName = 'GhostInstall',
Mo.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
di = Mo,
wi = function (e) {
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'hubspot',
platformPageName: 'HubSpot',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'From your Hubspot blog admin click ', C.a.createElement('strong', null, 'options'), '.'), C.a.createElement('li', null, 'Under General options uncheck ', C.a.createElement('strong', null, 'Allow Comments'), '.'), C.a.createElement('li', null, 'Uncheck ', C.a.createElement('strong', null, 'Include Footer'), ' on Listing Pages.'), C.a.createElement('li', null, 'Click on ', C.a.createElement('strong', null, 'HTML'), ' in the blog footer edit menu.'), C.a.createElement('li', null, 'Copy and paste the ', C.a.createElement(v.Link, {
to: '/install/platforms/universalcode'
}, 'Universal Embed Code'), ' ', 'in the HTML Code widow.'))))
};
wi.displayName = 'HubspotInstall',
wi.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
Fi = wi,
Vi = function (e) {
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'shopify',
platformPageName: 'Shopify',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'In the Shopify store admin, go to ', C.a.createElement('strong', null, 'Online Store > Themes'), '.'), C.a.createElement('li', null, 'Click the ', C.a.createElement('strong', null, '...'), ' menu, and then click ', C.a.createElement('strong', null, 'Edit HTML/CSS'), '.'), C.a.createElement('li', null, 'Copy the ', C.a.createElement(v.Link, {
to: '/install/platforms/universalcode'
}, 'Universal Embed Code'), '.'), C.a.createElement('li', null, 'If you want the Disqus embed to load on your product pages, paste the code at the bottom of the ', C.a.createElement('code', {
className: 'inline'
}, 'product.liquid'), ' file.'), C.a.createElement('li', null, 'If you want the Disqus embed to load on your blog pages, paste the code at the bottom of the ', C.a.createElement('code', {
className: 'inline'
}, 'article.liquid'), ' file.'), C.a.createElement('li', null, C.a.createElement('strong', null, 'Save'), ' your changes.'))))
};
Vi.displayName = 'ShopifyInstall',
Vi.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
yc = Vi,
Pc = function (e) {
var t = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'amp',
platformPageName: 'Amp',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', {
id: 'step-1'
}, 'Create and host the following Universal Code file on a different domain than where you intend to load Disqus for AMP. This will be the URL that you will provide to the ', C.a.createElement('code', {
className: 'inline'
}, 'src'), ' attribute in ', C.a.createElement('a', {
className: 'text-bold',
href: '#step-4'
}, 'Step 4'), ' below.', 'EXAMPLE' === t ? C.a.createElement(C.a.Fragment, null, C.a.createElement('div', {
className: 'alert alert--muted text-medium spacing-top-small spacing-bottom-none'
}, 'Make sure to replace the ', C.a.createElement('i', null, 'EXAMPLE'), ' inside ', C.a.createElement('code', {
className: 'inline'
}, 's.src'), ' with the name of your own forum.')) : null, C.a.createElement(YE, {
language: 'html'
}, '
\n\n'))), C.a.createElement('li', {
id: 'step-2'
}, 'Refer to the ', C.a.createElement('code', {
className: 'inline'
}, 'amp-iframe'), ' ', C.a.createElement('a', {
href: 'https://www.ampproject.org/docs/reference/extended/amp-iframe.html',
target: '_blank',
rel: 'noopener noreferrer'
}, 'documentation'), ' and add the required ', C.a.createElement('code', {
className: 'inline'
}, 'amp-iframe'), ' script to your document\'s ', C.a.createElement('code', {
className: 'inline'
}, '
'), ':', C.a.createElement('br', null), C.a.createElement(YE, {
language: 'html'
}, '')), C.a.createElement('li', {
id: 'step-3'
}, 'Place the following ', C.a.createElement('code', {
className: 'inline'
}, ''), ' element anywhere within the ', C.a.createElement('code', {
className: 'inline'
}, '
'), ' of your AMP page. It will likely make sense to place it at the end of your article content, where ever your audience should engage further after reading.', C.a.createElement('br', null), C.a.createElement(YE, {
language: 'html'
}, '\n
\n Load more\n
\n')), C.a.createElement('li', {
id: 'step-4'
}, 'Replace ', C.a.createElement('code', {
className: 'inline'
}, 'hash'), ' in the ', C.a.createElement('code', {
className: 'inline'
}, 'src'), ' with a unique identifier that represents the page where you’d like a specific thread to display. If you are loading the ', C.a.createElement('code', {
className: 'inline'
}, ''), ' element on multiple pages, you will need to generate the ', C.a.createElement('code', {
className: 'inline'
}, 'hash'), ' dynamically for each page.', C.a.createElement('br', null), 'The hash you provide will be used in the ', C.a.createElement('code', {
className: 'inline'
}, 'identifier'), ' variable in ', C.a.createElement('a', {
className: 'text-bold',
href: '#step-1'
}, 'Step 1'), '. Learn more about ', C.a.createElement('a', {
href: Pn.pageIdentifiers
}, 'identifiers'), '.'), C.a.createElement('li', {
id: 'step-5'
}, 'Add the new domain as a Trusted Domain in your Admin › Settings › ', C.a.createElement(v.Link, {
to: '/settings/advanced/'
}, 'Advanced'), '.'))))
};
Pc.displayName = 'AmpInstall',
Pc.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
Cl = Pc,
Yc = function (e) {
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'adobemuse',
platformPageName: 'Adobe Muse',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'Open your website\'s ', C.a.createElement('strong', null, '.muse'), ' file and select a page where you would like Disqus to load'), C.a.createElement('li', null, 'In the menu, go to Object > ', C.a.createElement('strong', null, 'Insert HTML...')), C.a.createElement('li', null, 'Copy and paste the ', C.a.createElement(v.Link, {
to: '/install/platforms/universalcode'
}, 'Universal Embed Code'), ' ', 'in the HTML Code widow.'))))
};
Yc.displayName = 'AdobemuseInstall',
Yc.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
lh = Yc,
sl = function (e) {
var t = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'jimdo',
platformPageName: 'Jimdo',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'Log into Jimdo, open the menu in the top left, and click ', C.a.createElement('strong', null, 'Blog'), '.'), C.a.createElement('li', null, 'Click ', C.a.createElement('strong', null, 'General'), ' in the Settings section on the left.'), C.a.createElement('li', null, 'Enable comments, choose Disqus from the dropdown, enter your shortname:', ' ', C.a.createElement('code', {
className: 'inline'
}, t), ' and click ', C.a.createElement('strong', null, 'Save'), '.')), C.a.createElement('div', {
className: 'alert alert--muted text-medium'
}, C.a.createElement('strong', null, 'Note:'), ' This installation method enables Disqus on Blog Posts only. To add Disqus to other pages, use the ', C.a.createElement(v.Link, {
to: '/install/platforms/universalcode'
}, 'Universal Embed Code'), ' ', 'instructions and Jimdo\'s', ' ', C.a.createElement('a', {
href: Pn.jimdoHelp,
target: '_blank',
rel: 'noopener noreferrer'
}, 'Widget/HTML module'), '.')))
};
sl.displayName = 'JimdoInstall',
sl.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
Vb = sl,
yl = function (e) {
var t = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'postachio',
platformPageName: 'Postach.io',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'In Postach.io, on your Sites page, click on the ', C.a.createElement('strong', null, 'pencil icon'), ' to edit.'), C.a.createElement('li', null, 'Select ', C.a.createElement('strong', null, 'Add-Ons'), '. '), C.a.createElement('li', null, 'Find the ', C.a.createElement('strong', null, 'Disqus Comments'), ' Add-On and click ', C.a.createElement('strong', null, 'Set Up'), '.'), C.a.createElement('li', null, 'In the box provided, enter your shortname: ', C.a.createElement('code', {
className: 'inline'
}, t)), C.a.createElement('li', null, 'Save your changes.'))))
};
yl.displayName = 'PostachioInstall',
yl.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
Jc = yl,
Ru = function (e) {
var t = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'gatsby',
platformPageName: 'Gatsby',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'Install the ', C.a.createElement('code', {
className: 'inline'
}, 'gatsby-plugin-disqus'), ' plugin as a dependency with ', C.a.createElement('a', {
href: 'https://www.npmjs.com/',
target: '_blank',
rel: 'noopener noreferrer'
}, 'npm'), ' by running the following command in your website directory.', C.a.createElement('br', null), C.a.createElement(YE, {
language: 'sh'
}, 'npm install --save gatsby-plugin-disqus')), C.a.createElement('li', null, 'Add the plugin to your ', C.a.createElement('code', {
className: 'inline'
}, 'gatsby-config.js'), ' file with your Disqus shortname.', 'EXAMPLE' === t ? C.a.createElement(C.a.Fragment, null, C.a.createElement('div', {
className: 'alert alert--muted text-medium spacing-top-small spacing-bottom-none'
}, 'Make sure to replace the ', C.a.createElement('i', null, 'EXAMPLE'), ' inside ', C.a.createElement('code', {
className: 'inline'
}, 'options'), ' with the shortname for your own forum.')) : null, C.a.createElement('br', null), C.a.createElement(YE, {
language: 'javascript'
}, '// gatsby-config.js\nmodule.exports = {\n plugins: [\n {\n resolve: `gatsby-plugin-disqus`,\n options: {\n shortname: `'.concat(t, '`\n }\n },\n ]\n}'))), C.a.createElement('li', null, 'The plugin can then be used to place the Disqus comment section in your page as shown in the following example:', C.a.createElement('br', null), C.a.createElement(YE, {
language: 'jsx'
}, 'import { Disqus } from \'gatsby-plugin-disqus\';\n\nconst Template = () => (\n /* Page contents */\n\n \n);')))))
};
Ru.displayName = 'GatsbyInstall',
Ru.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
Bu = Ru,
h = function (e) {
var t = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'pattern',
platformPageName: 'Pattern by Etsy',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'padding-double'
}, C.a.createElement('ol', {
className: 'installation__instruction-list'
}, C.a.createElement('li', null, 'Navigate to your ', C.a.createElement('strong', null, 'Settings'), ' from your Pattern Dashboard.'), C.a.createElement('li', null, 'In the Disqus shortname field, enter your shortname: ', C.a.createElement('code', {
className: 'inline site-shortname'
}, t), '.'), C.a.createElement('li', null, 'Click ', C.a.createElement('strong', null, 'Publish'), '.')), C.a.createElement('div', {
className: 'alert alert--muted text-medium'
}, 'Note: For blog posts, you will have to enable comments on each post in your ', C.a.createElement('strong', null, 'Blog Settings'), '.')))
};
h.displayName = 'PatternInstall',
h.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
lt = h,
ut = function (e) {
var t = ((e.selection || {
}).forum || {
}).shortname || 'EXAMPLE';
return C.a.createElement(tO, {
selection: e.selection,
platformClassName: 'react',
platformPageName: 'React',
isBaseInstallPath: e.isBaseInstallPath
}, C.a.createElement('div', {
className: 'settings__content'
}, C.a.createElement('h2', {
className: 'text-gray-dark text-larger spacing-bottom'
}, 'Installation'), C.a.createElement('ul', {
className: 'spacing-bottom'
}, C.a.createElement('li', {
className: 'spacing-bottom'
}, 'Using npm:', C.a.createElement(YE, null, '$ npm install --save disqus-react')), C.a.createElement('li', null, 'Using yarn:', C.a.createElement(YE, null, '$ npm install --save disqus-react'))), C.a.createElement('h2', {
className: 'text-gray-dark text-larger spacing-bottom'
}, 'Usage: DiscussionEmbed'), C.a.createElement('p', null, 'This is the component that will load the main Disqus comments section.'), C.a.createElement(YE, {
language: 'typescript'
}, 'import { DiscussionEmbed } from \'disqus-react\';\n\n')), C.a.createElement('p', {
className: 'spacing-top spacing-bottom'
}, 'This component is limited to one instance in the DOM at a time and will handle updates to both the ', C.a.createElement('code', null, 'config'), ' and ', C.a.createElement('code', null, 'shortname'), ' props and reload appropriately with the new discussion thread.'), C.a.createElement('h2', {
className: 'text-gray-dark text-larger spacing-bottom'
}, 'Usage: CommentCount'), C.a.createElement('p', null, 'This component will display the comment count for the Disqus thread associated with the provided config.'), C.a.createElement(YE, {
language: 'typescript'
}, 'import { CommentCount } from \'disqus-react\';\n\n\n {/* Placeholder Text */}\n Comments\n')), C.a.createElement('p', {
className: 'spacing-top spacing-bottom'
}, 'Multiple instances of this component can be included on the same page with different', ' ', C.a.createElement('code', null, 'config'), ' variables (e.g. an article list showing the comment count for each). However, all threads on the site must be under the same primary site ', C.a.createElement('code', null, 'shortname'), '. If the component receives a new ', C.a.createElement('code', null, 'shortname'), ', all instances will be reset with counts for threads matching the updated site.'), C.a.createElement('div', {
className: 'alert alert--muted text-medium'
}, 'See our ', C.a.createElement('a', {
href: Pn.githubDisqusReact,
target: '_blank',
rel: 'noopener noreferrer'
}, 'GitHub'), ' ', 'for more examples.')))
};
ut.displayName = 'UniversalCodeInstall',
ut.propTypes = {
selection: ht,
isBaseInstallPath: b.a.bool
};
qn = ut;
function _O(e) {
return (_O = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function EO(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function OO(e, t) {
return (OO = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function SO(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = PO(n);
return e = a ? (e = PO(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== _O(e) && 'function' != typeof e ? wO(t) : e
}
}
function wO(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function PO(e) {
return (PO = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function kO(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
i = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && OO(e, t)
}(o, A);
var e,
t,
n,
r = SO(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return kO(wO(t = r.call.apply(r, [
this
].concat(n))), 'state', {
details: null,
fetchError: null,
isFetching: !1
}),
kO(wO(t), 'fetchImportDetails', function (e) {
return t.setState({
isFetching: !0,
fetchError: null
}),
t.apiCall = io.a.call('imports/details', {
data: {
forum: t.props.selection.forum.shortname,
group: e
}
}).done(t.handleFetchDetailsSuccess).fail(t.handleFetchError),
t.apiCall
}),
kO(wO(t), 'handleFetchDetailsSuccess', function (e) {
t.setState({
isFetching: !1,
details: e.response
})
}),
kO(wO(t), 'handleFetchError', function (e) {
t.setState({
isFetching: !1,
fetchError: t.parseErrorResponse(e)
})
}),
kO(wO(t), 'parseErrorResponse', function (e) {
var t;
try {
~(t = JSON.parse(e.responseText).response).indexOf('Invalid argument, \'group\': Unable to find group') && (t = 'No import was found with this ID.')
} catch (e) {
t = 'There was an error retrieving the details of this import.'
}
return t
}),
kO(wO(t), 'getComponentProps', function () {
return {
importHistoryDetails: t.state.details,
importHistoryIsFetching: t.state.isFetching,
importHistoryError: t.state.fetchError
}
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.params.groupId && this.fetchImportDetails(this.props.params.groupId)
}
},
{
key: 'componentWillUnmount',
value: function () {
this.apiCall && 'pending' === this.apiCall.state() && this.apiCall.abort()
}
}
]) && EO(e.prototype, t),
n && EO(e, n),
o
}();
kO(i, 'displayName', 'ImportHistoryDriver'),
kO(i, 'propTypes', {
selection: ht.isRequired,
params: b.a.object.isRequired
});
var go = Object(ki.createDriver) (i, function (e) {
return {
selection: e.selection
}
}),
NO = '//import.disqus.com/',
Qs = function (e) {
if (e.importHistoryIsFetching) return C.a.createElement(Ji, null);
if (e.importHistoryError) return C.a.createElement(Ki, {
message: e.importHistoryError,
alertType: 'error'
});
if (!e.importHistoryDetails) return null;
var t = e.importHistoryDetails,
n = t.startedAt && ct() (t.startedAt).format('LLL'),
a = t.finishedAt && ct() (t.finishedAt).format('LLL'),
r = 'text-gray';
return 100 <= t.statusCode ? r = 'text-success' : t.statusCode < 0 && (r = 'text-error'),
C.a.createElement('div', null, C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Import Details'), t ? C.a.createElement('p', {
className: r
}, t.statusName) : null), C.a.createElement('section', {
className: 'settings__content'
}, t ? C.a.createElement('div', {
className: 'text-medium text-gray-dark spacing-top-narrow'
}, C.a.createElement('p', null, C.a.createElement('strong', {
className: 'spacing-right text-gray-darker'
}, 'Started'), n), C.a.createElement('p', null, C.a.createElement('strong', {
className: 'spacing-right text-gray-darker'
}, 'Completed'), a), C.a.createElement('p', null, C.a.createElement('strong', {
className: 'spacing-right text-gray-darker'
}, 'Platform'), t.platform), C.a.createElement('p', null, C.a.createElement('strong', {
className: 'spacing-right text-gray-darker'
}, 'Progress'), ''.concat(t.chunksDone, ' / ').concat(t.chunksTotal, ' ').concat(1 === t.chunksTotal ? 'File' : 'Files')), C.a.createElement('p', {
className: 'spacing-bottom'
}, C.a.createElement('strong', {
className: 'spacing-right text-gray-darker'
}, 'Status'), C.a.createElement('span', {
className: r
}, t.statusName)), C.a.createElement('a', {
href: ''.concat(NO, 'group/').concat(t.forum, '/').concat(e.params.groupId, '/'),
className: 'button button-small button-outline'
}, 'More Details')) : null), C.a.createElement('footer', {
className: 'settings__footer'
}, C.a.createElement('a', {
href: ''.concat(NO + t.forum, '/?a=1'),
className: 'button button-outline button-medium'
}, 'All Imports for ', t.forum))))
};
Qs.displayName = 'ImportDetails',
Qs.propTypes = {
params: b.a.object.isRequired,
importHistoryDetails: b.a.object,
importHistoryIsFetching: b.a.bool,
importHistoryError: b.a.string
};
var ac = Object(u.connect) (function (e) {
return {
selection: e.selection
}
}) (Ni.a.attachDrivers(Qs, [
go
])),
CO = {
forum: 'signup_forum',
org: 'signup_org',
start: 'signup_start',
settingsOrg: 'settings_org',
deactivationHubOrg: 'deactivation_hub_organization_flow',
deactivationHubForum: 'deactivation_hub_forum_flow'
};
function RO(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function xO(a) {
for (var e = 1; e < arguments.length; e++) {
var r = null != arguments[e] ? arguments[e] : {
};
e % 2 ? RO(Object(r), !0).forEach(function (e) {
var t,
n;
n = r[t = e],
t in (e = a) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(r)) : RO(Object(r)).forEach(function (e) {
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(r, e))
})
}
return a
}
Ls = function (e) {
return C.a.createElement('div', {
className: 'section-contained'
}, C.a.createElement('div', {
className: 'layout layout--publishers'
}, C.a.createElement('div', {
className: 'layout__main'
}, C.a.createElement(ob, {
auth: e.auth,
selection: e.selection
}), C.a.createElement('div', {
className: 'layout__content'
}, C.a.cloneElement(e.children, xO(xO({
}, e), {
}, {
initialQuestionGroup: CO.settingsOrg
}))))))
};
Ls.displayName = 'OrgSettings',
Ls.propTypes = {
auth: Nc.isRequired,
children: b.a.node.isRequired,
forums: b.a.object.isRequired,
organizations: b.a.object.isRequired,
selection: ht.isRequired
};
var AO = Object(u.connect) (function (e) {
return {
selection: e.selection
}
}) (Ni.a.attachDrivers(Ls, [
bc
]));
function DO(e) {
return (DO = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function jO(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function TO(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? jO(Object(n), !0).forEach(function (e) {
MO(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : jO(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function IO(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function qO(e, t) {
return (qO = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function FO(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = UO(n);
return e = a ? (e = UO(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== DO(e) && 'function' != typeof e ? LO(t) : e
}
}
function LO(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function UO(e) {
return (UO = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function MO(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Mo = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && qO(e, t)
}(o, A);
var e,
t,
n,
r = FO(o);
function o() {
var a;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return MO(LO(a = r.call.apply(r, [
this
].concat(t))), 'state', {
newUsername: ''
}),
MO(LO(a), 'handleAddModerator', function () {
var e = a.state.newUsername.trim();
e && a.props.addOrgAdmin({
data: {
username: e
},
onSuccess: function () {
a.setState({
newUsername: ''
})
}
})
}),
MO(LO(a), 'handlePermissionChange', function (e, t, n) {
n = MO({
isAdmin: e.isAdmin ? 1 : 0,
isModerator: e.isModerator ? 1 : 0
}, t, n.target.checked ? 1 : 0);
a.props.updateOrgAdmin(e.user.username, n)
}),
a
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.fetchOrgAdminList()
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
this.props.orgAdminIsSaving && e.orgAdminIsSaved && this.props.fetchOrgAdminList()
}
},
{
key: 'render',
value: function () {
var a = this;
return this.props.orgAdminListIsFetching && !this.props.orgAdminList ? C.a.createElement(Ji, null) : this.props.orgAdminListError ? C.a.createElement(Ki, {
message: this.props.orgAdminListError,
alertType: 'error'
}) : C.a.createElement('div', null, C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Organization Admins'), C.a.createElement('p', {
className: 'text-gray'
}, 'Add and remove admins so they can help manage your organization. ', C.a.createElement('a', {
href: Pn.adminRoles,
target: '_blank',
rel: 'noopener noreferrer'
}, 'Learn more »'))), C.a.createElement('section', null, (this.props.orgAdminList || [
]).map(function (e) {
var t = e.user.username === a.props.selection.organization.owner,
n = '//'.concat(pt.a.disqusHost, '/by/').concat(e.user.username, '/');
return C.a.createElement('div', {
className: 'settings-list__item',
key: e.id
}, C.a.createElement('div', {
className: 'align align--between'
}, C.a.createElement('div', {
className: 'spacing-right align'
}, C.a.createElement('div', {
className: 'spacing-right spacing-top-small'
}, C.a.createElement('img', {
className: 'border-radius-base',
src: e.user.avatar.cache,
width: '40',
height: '40'
})), C.a.createElement('div', null, C.a.createElement('a', {
href: n,
className: 'text-medium text-semibold'
}, e.user.name), t ? C.a.createElement('p', {
className: 'text-small text-gray spacing-top-tiny'
}, 'You\'re the organization super admin and have full permissions.') : C.a.createElement('p', {
className: 'text-small text-gray spacing-top-tiny'
}, C.a.createElement('label', {
className: 'fieldset__inline-block--checkbox spacing-right-large'
}, C.a.createElement('input', {
type: 'checkbox',
className: 'input--checkbox',
checked: e.isAdmin,
onChange: a.handlePermissionChange.bind(a, e, 'isAdmin'),
disabled: a.props.orgAdminIsSaving
}), 'Can edit organization info'), C.a.createElement('label', {
className: 'fieldset__inline-block--checkbox'
}, C.a.createElement('input', {
type: 'checkbox',
className: 'input--checkbox',
checked: e.isModerator,
onChange: a.handlePermissionChange.bind(a, e, 'isModerator'),
disabled: a.props.orgAdminIsSaving
}), 'Can manage all organization sites')))), t ? null : C.a.createElement('div', {
className: 'align-min-tablet align--middle spacing-top-small spacing-bottom-small'
}, C.a.createElement('button', {
className: 'button button-outline text-medium',
onClick: a.props.removeOrgAdmin.bind(null, e.user.id),
disabled: a.props.orgAdminIsSaving
}, 'Remove'))))
}), C.a.createElement('div', {
className: 'settings-list__item'
}, C.a.createElement('form', {
onSubmit: function (e) {
return e.preventDefault()
}
}, C.a.createElement('div', {
className: 'align spacing-top-small'
}, C.a.createElement('div', {
className: 'spacing-right align__item--grow'
}, C.a.createElement('input', {
type: 'text',
className: 'input--textbox',
placeholder: 'Add a new org admin by username',
onChange: function (e) {
return a.setState({
newUsername: e.target.value
})
},
value: this.state.newUsername,
disabled: this.props.orgAdminIsSaving
})), C.a.createElement('button', {
className: 'button button-outline text-medium',
onClick: this.handleAddModerator,
disabled: this.props.orgAdminIsSaving || !this.state.newUsername
}, 'Add Admin')), C.a.createElement('p', {
className: 'fieldset__description spacing-bottom-small text-small text-gray spacing-top-tiny'
}, 'People you add will receive a notification that they\'re now an admin of this organization.'), this.props.orgAdminSaveError ? C.a.createElement('p', {
className: 'text-medium text-error text-semibold spacing-narrow'
}, this.props.orgAdminSaveError) : null)))))
}
}
]) && IO(e.prototype, t),
n && IO(e, n),
o
}();
MO(Mo, 'displayName', 'OrgSettingsAdmins'),
MO(Mo, 'propTypes', {
selection: ht.isRequired,
orgAdminList: b.a.arrayOf(b.a.shape({
id: b.a.number.isRequired,
organizationId: b.a.number.isRequired,
isAdmin: b.a.bool.isRequired,
isModerator: b.a.bool.isRequired,
user: To
})),
orgAdminIsFetching: b.a.bool,
orgAdminIsSaving: b.a.bool,
orgAdminIsSaved: b.a.bool,
orgAdminFetchError: b.a.string,
orgAdminSaveError: b.a.string,
fetchOrgAdminList: b.a.func.isRequired,
addOrgAdmin: b.a.func.isRequired,
updateOrgAdmin: b.a.func.isRequired,
removeOrgAdmin: b.a.func.isRequired
});
wi = Object(u.connect) (function (e) {
return TO({
selection: e.selection
}, e.orgAdmin)
}, TO({
}, Ss)) (Fo() (Mo));
function BO(e) {
return (BO = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function zO() {
return (zO = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function HO(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function GO(e, t) {
return (GO = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function VO(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = YO(n);
return e = a ? (e = YO(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== BO(e) && 'function' != typeof e ? WO(t) : e
}
}
function WO(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function YO(e) {
return (YO = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function QO(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Vi = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && GO(e, t)
}(o, A);
var e,
t,
n,
r = VO(o);
function o() {
var n;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) t[a] = arguments[a];
return QO(WO(n = r.call.apply(r, [
this
].concat(t))), 'state', {
name: n.props.selection.organization ? n.props.selection.organization.name : '',
error: null,
isLoading: !1
}),
QO(WO(n), 'handleUpdateOrg', function (e, t) {
return n.setState({
isLoading: !0,
error: null
}),
n.props.selection.organization && (e = zO({
organization: n.props.selection.organization.id
}, e)),
n.apiCall = io.a.call(t && t.useInternal ? 'internal/organizations/update' : 'organizations/update', {
data: e,
method: 'POST'
}).done(n.handleUpdateSuccess).fail(n.handleUpdateError),
n.apiCall
}),
QO(WO(n), 'handleDismissError', function () {
n.setState({
error: null
})
}),
QO(WO(n), 'handleUpdateSuccess', function () {
n.setState({
error: null,
isLoading: !1
})
}),
QO(WO(n), 'handleUpdateError', function (e) {
var t;
try {
~(t = JSON.parse(e.responseText).response).indexOf('Missing required argument: \'name\'') && (t = 'Name can\'t be blank')
} catch (e) {
t = 'There was an error saving your changes.'
}
n.setState({
error: t,
isLoading: !1
})
}),
QO(WO(n), 'getComponentProps', function () {
return {
orgUpdateName: n.state.name,
orgUpdateError: n.state.error,
orgUpdateIsLoading: n.state.isLoading,
orgUpdateOnUpdateOrg: n.handleUpdateOrg,
orgUpdateOnDismissError: n.handleDismissError
}
}),
n
}
return e = o,
(t = [
{
key: 'componentWillUnmount',
value: function () {
this.apiCall && 'pending' === this.apiCall.state() && this.apiCall.abort()
}
}
]) && HO(e.prototype, t),
n && HO(e, n),
o
}();
QO(Vi, 'displayName', 'OrgUpdateDriver'),
QO(Vi, 'propTypes', {
selection: ht.isRequired
});
Pc = Object(ki.createDriver) (Vi, function (e) {
return {
selection: e.selection
}
});
function KO(e) {
return (KO = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function JO(e) {
return function (e) {
if (Array.isArray(e)) return $O(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return $O(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? $O(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function $O(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function ZO(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function XO(e, t) {
return (XO = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function eS(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = nS(n);
return e = a ? (e = nS(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== KO(e) && 'function' != typeof e ? tS(t) : e
}
}
function tS(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function nS(e) {
return (nS = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function aS(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Yc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && XO(e, t)
}(o, A);
var e,
t,
n,
a = eS(o);
function o() {
var r;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return aS(tS(r = a.call.apply(a, [
this
].concat(t))), 'state', {
questions: null,
questionsGroup: r.props.initialQuestionGroup || (r.props.selection.type === ft.forum ? CO.deactivationHubForum : CO.start)
}),
aS(tS(r), 'fetchData', function (e) {
var t,
e = {
group: e || r.state.questionsGroup
};
r.props.selection.type === ft.forum ? (t = 'forums/questions/listGroup', e.forum = r.props.selection.forum.shortname) : r.props.selection.type === ft.organization && (t = 'organizations/questions/listGroup', e.organization = r.props.selection.organization.id),
r.apiCall = io.a.call(t, {
data: e
}).done(je.a.partial(r.onFetch, e.group))
}),
aS(tS(r), 'onFetch', function (e, t) {
var n = t.response.objects;
r.setState({
questionsGroup: e,
questions: t.response.items.map(function (e) {
return {
question: n[e.reference],
answer: e.answer
}
})
})
}),
aS(tS(r), 'updateAnswer', function (e, t) {
var n,
a = {
answer: t,
group: r.state.questionsGroup,
question: e
};
return r.updateLocalAnswer(e, t),
r.props.selection.type === ft.forum ? (n = 'forums/questions/answer', a.forum = r.props.selection.forum.shortname) : r.props.selection.type === ft.organization && (n = 'organizations/questions/answer', a.organization = r.props.selection.organization.id),
r.apiCall = io.a.call(n, {
data: a,
method: 'POST'
}),
r.apiCall
}),
aS(tS(r), 'updateLocalAnswer', function (t, e) {
var n = JO(r.state.questions);
n.find(function (e) {
return e.question.id === t
}).answer = '' === e.text ? e.choice : ''.concat(e.choice, ': ').concat(e.text),
r.setState({
questions: n
})
}),
aS(tS(r), 'getComponentProps', function () {
return {
questions: r.state.questions,
updateAnswer: r.updateAnswer
}
}),
r
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.fetchData()
}
}
]) && ZO(e.prototype, t),
n && ZO(e, n),
o
}();
aS(Yc, 'displayName', 'QuestionsDriver'),
aS(Yc, 'propTypes', {
selection: ht.isRequired,
initialQuestionGroup: b.a.string
});
sl = Object(ki.createDriver) (Yc, function (e) {
return {
selection: e.selection
}
});
function rS(e) {
return (rS = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function oS() {
return (oS = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function iS(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function sS(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? iS(Object(n), !0).forEach(function (e) {
mS(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : iS(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function lS(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function cS(e, t) {
return (cS = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function uS(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = dS(n);
return e = a ? (e = dS(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== rS(e) && 'function' != typeof e ? pS(t) : e
}
}
function pS(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function dS(e) {
return (dS = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function mS(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var fS = 'question_',
hS = 'error_',
gS = 'success_',
yl = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && cS(e, t)
}(i, A);
var e,
t,
n,
o = uS(i);
function i() {
var e,
r;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, i);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return mS(pS(r = o.call.apply(o, [
this
].concat(n))), 'state', sS(sS({
}, i.getAnswerStateFromQuestions(r.props.questions)), {
}, (mS(e = {
name: r.props.orgUpdateName
}, ''.concat(hS, 'name'), r.props.orgUpdateError), mS(e, 'isSaved', !1), mS(e, 'savedFields', sS(sS({
}, i.getAnswerStateFromQuestions(r.props.questions)), {
}, {
name: r.props.orgUpdateName
})), e))),
mS(pS(r), 'handleInputChange', function (e, t) {
var n = (mS(n = {
}, e, t.target.value), mS(n, hS + e, null), mS(n, gS + e, null), n);
r.setState(n)
}),
mS(pS(r), 'hasFieldChanged', function (e) {
return r.state[e] !== r.state.savedFields[e] && !(null === r.state.savedFields[e] && '' === r.state[e])
}),
mS(pS(r), 'hasUnsavedChanges', function () {
return Object.keys(r.state.savedFields).some(function (e) {
return r.hasFieldChanged(e)
})
}),
mS(pS(r), 'handleSaveChangesClick', function () {
var e,
a,
t;
r.props.orgUpdateIsSaving || (a = [
], (t = r.props.selection.organization.name !== (e = r.state.name)) && a.push(r.props.orgUpdateOnUpdateOrg({
name: e
})), r.props.questions && r.props.questions.forEach(function (e) {
var t = fS + e.question.id,
n = this.state[t];
void 0 !== n && e.answer !== n && a.push(this.props.updateAnswer(e.question.id, n).fail(this.handleQuestionApiCallFail.bind(this, t)))
}.bind(pS(r))), vo.a.when.apply(vo.a, a).then(r.handleAllApiCallsComplete.bind(pS(r), t)))
}),
mS(pS(r), 'handleAllApiCallsComplete', function (a) {
r.setState(function (n, e) {
var t = {
};
return mS(t, ''.concat(gS, 'name'), !!a),
mS(t, 'isSaved', !0),
mS(t, 'savedFields', e.questions.reduce(function (e, t) {
return e[fS + t.question.id] = n[fS + t.question.id],
e
}, {
name: n.name
})),
t
})
}),
mS(pS(r), 'handleQuestionApiCallFail', function (e, t) {
var n;
try {
~(n = JSON.parse(t.responseText).response).indexOf('Missing required argument: \'answer\'') && (n = 'Answer can\'t be blank')
} catch (e) {
n = 'Invalid answer'
}
r.setState((mS(t = {
}, hS + e, n), mS(t, gS + e, null), t))
}),
r
}
return e = i,
(t = [
{
key: 'componentWillReceiveProps',
value: function (e) {
var t,
n = {
};
(n = !this.props.questions && e.questions ? sS(sS({
}, t = i.getAnswerStateFromQuestions(e.questions)), {
}, {
savedFields: sS(sS({
}, t), {
}, {
name: e.orgUpdateName
})
}) : n) [''.concat(hS, 'name')] = e.orgUpdateError,
this.setState(n)
}
},
{
key: 'render',
value: function () {
var r = this,
e = this.props.selection.organization.forums.length;
return C.a.createElement('div', null, C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, ''.concat(this.props.selection.organization.name, ' Info')), C.a.createElement('p', {
className: 'text-gray'
}, 'Update your basic organization information.')), C.a.createElement('section', {
className: 'settings__content'
}, C.a.createElement(kf, {
label: 'Sites',
blockAdditionalClass: '-no-input text-medium'
}, C.a.createElement('span', {
className: 'spacing-right'
}, e, ' total.'), C.a.createElement(Us, {
path: '/settings/sites/',
orgId: this.props.selection.organization.id,
orgSlug: this.props.selection.organization.slug,
linkClassName: 'button button-outline text-medium spacing-left-small'
}, 'View'), C.a.createElement('a', {
href: pt.a.urls.createSite,
className: 'button button-outline text-medium spacing-left-small'
}, 'Add')), C.a.createElement($h, {
name: 'name',
value: this.state.name,
placeholder: 'Enter a name for your organization',
inputState: this.state[''.concat(hS, 'name')] ? 'error' : 'none',
label: 'Name',
onChange: this.handleInputChange.bind(this, 'name'),
idNamespace: this.constructor.displayName,
shouldHighlight: this.hasFieldChanged('name'),
tooltip: 'Only shown to other organization admins.'
}, this.state[''.concat(hS, 'name')] ? C.a.createElement('span', {
className: 'text-medium text-error text-semibold spacing-narrow'
}, this.state[''.concat(hS, 'name')]) : null, this.state[''.concat(gS, 'name')] ? C.a.createElement('span', {
className: 'text-medium text-success text-semibold spacing-narrow'
}, 'Your organizaton name was updated. You may need to ', C.a.createElement('a', {
href: window.location.href
}, 'Reload the page'), ' to see the changes.') : null), (this.props.questions || [
]).map(function (e) {
var t = fS + e.question.id,
n = r.state[hS + t];
if ('MULTIPLE_CHOICE' !== e.question.typeName) return C.a.createElement($h, {
key: e.question.id,
name: t,
value: r.state[t],
type: 'INTEGER' === e.question.typeName ? 'number' : 'text',
inputState: n ? 'error' : 'none',
label: e.question.text,
onChange: r.handleInputChange.bind(r, t),
idNamespace: r.constructor.displayName,
placeholder: e.question.placeholderText,
min: 'INTEGER' === e.question.typeName ? 0 : null,
shouldHighlight: r.hasFieldChanged(t)
}, n ? C.a.createElement('span', {
className: 'text-medium text-error text-semibold spacing-narrow'
}, n) : null);
var a = e.question.typeContext.map(function (e) {
return {
key: e,
value: e,
label: e
}
});
return C.a.createElement(Mf, {
key: e.question.id,
name: t,
disabled: !1,
options: a,
placeholder: 'Choose an answer',
value: r.state[t],
label: e.question.text,
onChange: r.handleInputChange.bind(r, t),
idNamespace: r.constructor.displayName,
shouldHighlight: r.hasFieldChanged(t)
}, n ? C.a.createElement('span', {
className: 'text-medium text-error text-semibold spacing-narrow'
}, n) : null)
})), C.a.createElement('footer', {
className: 'settings__footer'
}, C.a.createElement(Bh, {
disabled: !this.hasUnsavedChanges(),
onClick: this.handleSaveChangesClick,
isSaving: this.props.orgUpdateIsSaving,
isSaved: this.state.isSaved
}))), C.a.createElement('div', {
className: 'content__wrap hidden'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Payment'), C.a.createElement('p', {
className: 'text-gray'
}, 'Control the way Disqus pays your organization for earnings.')), C.a.createElement('section', {
className: 'settings__content'
}, C.a.createElement('div', {
className: 'fieldset'
}, C.a.createElement('label', {
htmlFor: '',
className: 'fieldset__label text-gray'
}, 'By Site'), C.a.createElement('div', {
className: 'fieldset__block'
}, C.a.createElement('div', {
className: 'fieldset__block--radio'
}, C.a.createElement('input', {
type: 'radio',
name: ''
}), C.a.createElement('label', {
htmlFor: '',
className: 'text-medium'
}, 'Subscribe automatically to discussions you comment on')), C.a.createElement('p', {
className: 'fieldset__description text-small text-gray'
}, 'Only shown to other organization admins.'))), C.a.createElement('div', {
className: 'fieldset'
}, C.a.createElement('label', {
htmlFor: '',
className: 'fieldset__label text-gray'
}, 'By Organization'), C.a.createElement('div', {
className: 'fieldset__block'
}, C.a.createElement('div', {
className: 'fieldset__block--radio'
}, C.a.createElement('input', {
type: 'radio',
name: ''
}), C.a.createElement('label', {
htmlFor: '',
className: 'text-medium'
}, 'The organization is paid once for all sites')), C.a.createElement('p', {
className: 'fieldset__description text-small spacing-bottom-narrow'
}, C.a.createElement('strong', null, 'Are you sure? This is a big deal. It affects the way you file taxes.')), C.a.createElement('button', {
className: 'button button-small button-fill--brand'
}, 'Yes, I understand. Let me set up my organization payment info »')))), C.a.createElement('footer', {
className: 'settings__footer'
}, C.a.createElement('div', {
className: 'fieldset fieldset--save'
}, C.a.createElement('div', {
className: 'fieldset__label'
}, C.a.createElement('div', {
className: 'spinner-small'
}), C.a.createElement('div', {
className: 'icon-checkmark'
})), C.a.createElement('div', {
className: 'fieldset__block'
}, C.a.createElement('button', {
className: 'button button-fill--brand button-padding-wider text-medium',
disabled: !0
}, 'Save'))))))
}
}
]) && lS(e.prototype, t),
n && lS(e, n),
i
}();
mS(yl, 'displayName', 'OrgSettingsGeneral'),
mS(yl, 'propTypes', {
forums: b.a.object.isRequired,
selection: ht.isRequired,
questions: b.a.array,
updateAnswer: b.a.func.isRequired,
orgUpdateName: b.a.string,
orgUpdateError: b.a.string,
orgUpdateIsSaving: b.a.bool,
orgUpdateOnUpdateOrg: b.a.func.isRequired
}),
mS(yl, 'getAnswerStateFromQuestions', function (e) {
return (e || [
]).reduce(function (e, t) {
return oS(e, mS({
}, fS + t.question.id, t.answer))
}, {
})
});
var yS = Object(u.connect) (function (e) {
return {
selection: e.selection
}
}) (Ni.a.attachDrivers(yl, [
Pc,
sl
])),
Ru = {
fetchOrgForums: function () {
return function (t, e) {
t({
type: se.fetching
});
e = e().selection.organization.id;
io.a.call('organizations/listForums', {
type: 'GET',
data: {
organization: e
},
success: function (e) {
t({
type: se.onFetch,
forumList: e.response,
cursor: e.cursor
})
},
error: function (e) {
t({
type: se.onFetchError,
data: e
})
}
})
}
},
fetchMoreOrgForums: function () {
return function (t, e) {
t({
type: se.fetching
});
var n = e().selection.organization.id,
e = e().orgForums.orgForumsCursor;
e && e.hasNext && io.a.call('organizations/listForums', {
type: 'GET',
data: {
organization: n,
cursor: e.next
},
success: function (e) {
t({
type: se.onFetchMore,
forumList: e.response,
cursor: e.cursor
})
},
error: function (e) {
t({
type: se.onFetchError,
data: e
})
}
})
}
}
};
function bS(e) {
return (bS = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function vS(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function _S(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? vS(Object(n), !0).forEach(function (e) {
kS(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : vS(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function ES(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function OS(e, t) {
return (OS = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function SS(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = PS(n);
return e = a ? (e = PS(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== bS(e) && 'function' != typeof e ? wS(t) : e
}
}
function wS(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function PS(e) {
return (PS = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function kS(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var NS = [
'adsProductVideoEnabled',
'adsProductStoriesEnabled',
'adsProductLinksEnabled'
],
h = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && OS(e, t)
}(o, A);
var e,
t,
n,
r = SS(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return kS(wS(e = r.call.apply(r, [
this
].concat(n))), 'loadMoreForums', function () {
e.props.fetchMoreOrgForums()
}),
e
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.fetchOrgForums()
}
},
{
key: 'render',
value: function () {
var n = this;
if (this.props.orgForumsIsFetching && !this.props.orgForumsList) return C.a.createElement(Ji, null);
if (this.props.orgForumsError) return C.a.createElement(Ki, {
message: this.props.orgForumsError,
alertType: 'error'
});
var e,
t,
a = this.props.selection.organization.forums.length,
r = this.props.orgForumsList ? this.props.orgForumsList.length : 0,
a = 1 === a ? '1 site' : ''.concat(a, ' sites');
return this.props.orgForumsHasMore ? (e = 'Info on '.concat(r, ' of ').concat(a, ' in this organization'), t = C.a.createElement('button', {
className: 'button button-large button-wide button-padding-wide button-wide--mobile button-fill--brand',
onClick: this.loadMoreForums
}, 'Load More')) : e = 'Info on the '.concat(a, ' in this organization.'),
C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Organization Sites'), C.a.createElement('p', {
className: 'text-gray'
}, e)), C.a.createElement('section', null, (this.props.orgForumsList || [
]).map(function (t) {
var e = je.a.some(NS, function (e) {
return t.settings[e]
}) && n.props.selection.organization.eligibleForEarnings;
return C.a.createElement('div', {
className: 'settings-list__item',
key: t.id
}, C.a.createElement('div', {
className: 'align align--between'
}, C.a.createElement('div', {
className: 'spacing-right align align--middle align--wrap'
}, t.signedUrl ? C.a.createElement('a', {
href: t.signedUrl,
target: '_blank',
rel: 'noopener noreferrer',
className: 'text-semibold spacing-right-large'
}, t.name) : C.a.createElement('span', {
className: 'text-semibold spacing-right-large'
}, t.name), C.a.createElement('span', {
className: 'text-small text-gray spacing-right-small'
}, 'Created ', ct() (t.createdAt).format('MMM Do YYYY')), e ? C.a.createElement('span', {
className: 'bullet text-small text-gray spacing-right-small'
}, 'Reveal enabled') : null), C.a.createElement('div', {
className: 'align-min-tablet align--middle spacing-top-small spacing-bottom-small'
}, C.a.createElement(Uo, {
linkClassName: 'button button-outline text-medium',
linkActiveClassName: 'active',
path: '/settings/general/',
selection: n.props.selection,
forumId: t.id
}, 'Edit Settings'))))
})), t)
}
}
]) && ES(e.prototype, t),
n && ES(e, n),
o
}();
kS(h, 'displayName', 'OrgSettingsSites'),
kS(h, 'propTypes', {
selection: ht.isRequired,
orgForumsList: b.a.array,
orgForumsError: b.a.string,
orgForumsIsFetching: b.a.bool,
orgForumsHasMore: b.a.bool.isRequired,
fetchOrgForums: b.a.func.isRequired,
fetchMoreOrgForums: b.a.func.isRequired
});
var ut = Object(u.connect) (function (e) {
return _S({
selection: e.selection
}, e.orgForums)
}, _S({
}, Ru)) (Fo() (h)),
CS = 'https://looker.local.disqus.net/looks/',
RS = [
'forum_id',
'website',
'url',
'ads_language',
'ads_review_status',
'ads_review_notes',
'adult_content',
'forum_category_id',
'ads_settings_and_analytics_viewable'
],
xS = {
'Daily-Inbox': 'F2BCMn6cW3KwnpQZHyzfBW6wBrrdPNN8',
'Needs-Review-English-Most-Traffic-Sort': 'bYKqFk7yc3t4nGyvtKDFrS2bf5FvDc5p',
'Needs-Category-Reveal-Active-Most-Traffic-Sort': 'H49RQHXfmzcjzhWPsFnrjmMRwf8F5jPm',
'Needs-Category-English-Most-Traffic-Sort': 'KR7tg543MH98qGnfkr2Rr7q7SFHyVCn6',
'Low-US-Sort': 'RPCnb6ddrBtczpmqdbRVxGr73sHyZvsJ',
'Search-by-Shortname': 'Ddtt8g7fzr9jKpNRV3PdKJdzyVK7dqtX'
},
i = Fm.data.map(function (e) {
return {
id: e.attributes.code,
code: e.attributes.code,
name: e.attributes.name
}
}).sort(function (e, t) {
return t.name < e.name ? 1 : e.name < t.name ? - 1 : 0
}),
AS = {
NOT_REVIEWED: '0',
QUALIFIED: '1',
DISQUALIFIED: '2'
},
DS = [
{
id: 4,
name: 'A - Paying'
},
{
id: 1,
name: 'B - Non-Commercial'
},
{
id: 3,
name: 'C - Policy Against Ads'
},
{
id: 5,
name: 'D - Squeaky'
},
{
id: 6,
name: 'E - Feature Instream Position'
},
{
id: 14,
name: 'F - Feature Niche Demand'
},
{
id: 15,
name: 'G - Feature Earnings'
},
{
id: 2,
name: 'H - Channel Conflict'
},
{
id: 8,
name: 'I - Data Value Risk'
},
{
id: 9,
name: 'J - Brand Value Risk'
},
{
id: 10,
name: 'K - Other Partner'
},
{
id: 'null',
name: 'Reviewed, not Excepted'
}
],
jS = Object.freeze({
_order: [
'url',
'website',
'ads_review_status',
'ads_review_notes',
'ads_settings_and_analytics_viewable',
'forum_category_id',
'ads_language',
'adult_content'
],
url: {
title: 'Forum Shortname',
type: 'text'
},
website: {
title: 'Website',
type: 'link'
},
ads_review_status: {
options: [
{
id: AS.NOT_REVIEWED,
name: 'Not Reviewed'
},
{
id: AS.QUALIFIED,
name: 'Qualified'
},
{
id: AS.DISQUALIFIED,
name: 'Disqualified'
}
],
title: 'Review Status',
type: 'select'
},
ads_review_notes: {
title: 'Notes',
type: 'input'
},
ads_settings_and_analytics_viewable: {
title: 'Reveal Eligible Settings Enabled',
type: 'checkbox',
computeValue: function (e) {
return 'true' === e
}
},
forum_category_id: {
defaultValue: {
id: '',
name: 'None'
},
options: [
{
id: '1',
name: 'Business'
},
{
id: '2',
name: 'Celebrity'
},
{
id: '3',
name: 'Culture'
},
{
id: '4',
name: 'Entertainment'
},
{
id: '5',
name: 'Games'
},
{
id: '6',
name: 'Living'
},
{
id: '7',
name: 'News'
},
{
id: '8',
name: 'Tech'
},
{
id: '9',
name: 'Style'
},
{
id: '10',
name: 'Sports'
}
],
title: 'Category',
type: 'select'
},
ads_language: {
defaultValue: {
id: '',
name: 'None'
},
optionId: 'code',
options: i,
title: 'Ads Language',
type: 'select'
},
adult_content: {
computeValue: function (e) {
return 'true' === e
},
title: 'Adult Content',
type: 'checkbox'
}
}),
TS = Object.freeze({
_order: [
'organization_id',
'organization_yesterday_pageviews',
'org_largest_forum_shortname',
'org_largest_forum_website',
'deactivation_date',
'open_to_ads',
'hub_answer_detail',
'suggested_exception_id',
'exception_granted'
],
organization_id: {
title: 'Org ID',
type: 'text'
},
organization_yesterday_pageviews: {
title: 'Total Daily Engage Loads',
type: 'text'
},
org_largest_forum_shortname: {
title: 'Largest Forum in Org (deactivated from campaign) or Forum (deactivated from Reveal)',
type: 'text'
},
org_largest_forum_website: {
title: 'Website URL for largest forum shortname by traffic',
type: 'link'
},
deactivation_date: {
title: 'Deactivation Date',
type: 'text'
},
open_to_ads: {
computeValue: function (e) {
return !0 === e ? 'Y' : 'N'
},
title: 'Open to Ads?',
type: 'text'
},
hub_answer_detail: {
title: 'Hub Question: Answer Detail',
type: 'text'
},
suggested_exception_id: {
computeValue: function (t) {
return '' === t ? '' : DS.filter(function (e) {
return e.id === t
}) [0].name
},
title: 'Suggested Exception (if available)',
type: 'text'
},
exception_granted: {
defaultValue: {
id: '',
name: 'To Be Reviewed'
},
options: DS,
title: 'Exception',
type: 'select'
}
});
function IS(e) {
return (IS = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function qS() {
return (qS = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function FS(e) {
return function (e) {
if (Array.isArray(e)) return LS(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return LS(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? LS(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function LS(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function US(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function MS(e, t) {
return (MS = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function BS(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = HS(n);
return e = a ? (e = HS(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== IS(e) && 'function' != typeof e ? zS(t) : e
}
}
function zS(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function HS(e) {
return (HS = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function GS(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Qs = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && MS(e, t)
}(o, A);
var e,
t,
n,
a = BS(o);
function o() {
var r;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return GS(zS(r = a.call.apply(a, [
this
].concat(t))), 'state', {
forums: [
],
isFetching: !1,
error: null
}),
GS(zS(r), 'fetchData', function (e) {
r.setState({
isFetching: !0,
error: null
});
e = xS[e || r.props.params.tab],
e = r.isExceptionTool() ? 'internal/exceptionManagement/list' : ''.concat(CS).concat(e, '.json');
io.a.call(e).done(r.onFetch).fail(r.onFail)
}),
GS(zS(r), 'onFetch', function (e) {
r.isExceptionTool() ? r.onExceptionFetch(e) : r.onOnboardingFetch(e)
}),
GS(zS(r), 'onExceptionFetch', function (e) {
r.setState({
forums: e.response,
isFetching: !1
})
}),
GS(zS(r), 'onOnboardingFetch', function (e) {
e.length && e[0].looker_error ? r.setError(e[0].looker_error) : r.setState({
forums: e.map(function (t) {
return Object.keys(t).map(function (e) {
return [e.split('.') [1],
t[e]]
}).reduce(function (e, t) {
return e[t[0]] = t[1],
e
}, {
})
}),
isFetching: !1
})
}),
GS(zS(r), 'onFail', function (e) {
r.setError(r.parseErrorResponse(e))
}),
GS(zS(r), 'setError', function (e) {
r.setState({
error: e,
isFetching: !1
})
}),
GS(zS(r), 'parseErrorResponse', function (e) {
var t;
try {
t = JSON.parse(e.responseText).response
} catch (e) {
t = 'There was an error loading the report'
}
return t
}),
GS(zS(r), 'onUpdate', function (e, t) {
r.updateForumKey(e, t, 'saving', !1)
}),
GS(zS(r), 'formatDataForUpdate', function (e) {
return r.isExceptionTool() ? {
organization: e.organization_id,
adsExceptionReason: 'null' === e.exception_granted ? null : + ('' + e.exception_granted)
}
: {
adsLanguage: e.ads_language,
adsReviewStatus: e.ads_review_status,
adsReviewNotes: e.ads_review_notes,
adsAnalyticsViewable: 'true' === e.ads_settings_and_analytics_viewable ? 1 : 0,
adsSettingsViewable: 'true' === e.ads_settings_and_analytics_viewable ? 1 : 0,
adultContent: 'true' === e.adult_content ? 1 : 0,
forum: e.url,
forumCategory: e.forum_category_id
}
}),
GS(zS(r), 'updateForum', function (e, t) {
r.updateForumKey(e, t, 'saving', !0);
var n = r.formatDataForUpdate(e);
(r.isExceptionTool() ? r.props.orgUpdateOnUpdateOrg(n, {
useInternal: !0
}) : r.props.forumUpdateOnSave(n, {
useInternal: !0
})).done(r.onUpdate.bind(zS(r), e, t))
}),
GS(zS(r), 'updateForumKey', function (e, t, n, a) {
r.setState({
forums: [
].concat(FS(r.state.forums.slice(0, t)), [
r.getDownstreamState(e, n, a)
], FS(r.state.forums.slice(t + 1)))
})
}),
GS(zS(r), 'isExceptionTool', function () {
return /exception/.test(r.props.route.path)
}),
GS(zS(r), 'getDownstreamState', function (e, t, n) {
var a = !('saving' === t && !n),
e = qS({
}, e, (GS(e = {
}, t, n), GS(e, 'isDirty', a), e));
return 'ads_review_status' === t && n === AS.QUALIFIED ? r.getDownstreamState(e, 'ads_settings_and_analytics_viewable', 'true') : 'adult_content' === t && 'true' === n ? r.getDownstreamState(e, 'ads_review_status', AS.DISQUALIFIED) : e
}),
GS(zS(r), 'getComponentProps', function () {
return {
onboardingToolForums: r.state.forums,
onboardingToolIsFetching: r.state.isFetching,
onboardingToolError: r.state.error,
onboardingToolFetchData: r.fetchData,
onboardingToolUpdateForum: r.updateForum,
onboardingToolUpdateForumKey: r.updateForumKey,
isExceptionTool: r.isExceptionTool()
}
}),
r
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.fetchData()
}
},
{
key: 'componentWillUpdate',
value: function (e) {
e.params.tab !== this.props.params.tab && this.fetchData(e.params.tab)
}
},
{
key: 'componentWillUnmount',
value: function () {
this.apiCall && 'pending' === this.apiCall.state() && this.apiCall.abort()
}
}
]) && US(e.prototype, t),
n && US(e, n),
o
}();
GS(Qs, 'displayName', 'OnboardingToolDriver'),
GS(Qs, 'propTypes', {
params: b.a.object.isRequired,
orgUpdateOnUpdateOrg: b.a.func.isRequired,
forumUpdateOnSave: b.a.func.isRequired,
route: b.a.object.isRequired
});
go = Object(ki.attachDrivers) (Object(ki.createDriver) (Qs), [
Pc,
m
]);
function VS(e) {
return (VS = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function WS(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function YS(e, t) {
return (YS = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function QS(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = JS(n);
return e = a ? (e = JS(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== VS(e) && 'function' != typeof e ? KS(t) : e
}
}
function KS(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function JS(e) {
return (JS = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function $S(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var ZS = Object.freeze({
text: function (e) {
return C.a.createElement('td', {
key: e.forumKey,
className: 'onboarding-table__text-cell'
}, e.forumKeyValue)
},
link: function (e) {
var t = e.forumKeyValue.match(/^https?:\/\//) ? e.forumKeyValue : 'http://'.concat(e.forumKeyValue);
return C.a.createElement('td', {
key: e.forumKey,
className: 'onboarding-table__text-cell'
}, C.a.createElement('a', {
href: t,
target: '_blank'
}, e.forumKeyValue))
},
select: function (e, t) {
var n,
a = e.forumKeyStatic.optionId || 'id';
return e.forumKeyStatic.defaultValue && (n = C.a.createElement('option', {
value: e.forumKeyStatic.defaultValue.id
}, e.forumKeyStatic.defaultValue.name)),
C.a.createElement('td', {
key: e.forumKey
}, C.a.createElement('select', {
value: e.forumKeyValue,
className: 'onboarding-table__select',
onChange: t.bind(null, e.forum, e.forumIndex, e.forumKey)
}, n, e.forumKeyStatic.options.map(function (e) {
return C.a.createElement('option', {
key: e[a],
value: e[a]
}, e.name)
})))
},
input: function (e, t) {
return C.a.createElement('td', {
key: e.forumKey
}, C.a.createElement('input', {
onChange: t.bind(null, e.forum, e.forumIndex, e.forumKey),
className: 'onboarding-table__input',
value: e.forumKeyValue
}))
},
checkbox: function (e, t) {
return C.a.createElement('td', {
key: e.forumKey
}, C.a.createElement('input', {
type: 'checkbox',
checked: e.forumKeyValue,
onChange: t.bind(null, e.forum, e.forumIndex, e.forumKey)
}))
}
}),
Ls = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && YS(e, t)
}(r, A);
var e,
t,
n,
a = QS(r);
function r() {
var l;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return $S(KS(l = a.call.apply(a, [
this
].concat(t))), 'getDynamicKeys', function () {
return je.a.isEmpty(l.props.forums) ? [
] : Object.keys(l.props.forums[0]).filter(function (e) {
return l.props.isExceptionTool ? TS[e] : !!~RS.indexOf(e)
})
}),
$S(KS(l), 'updateForum', function (e, t) {
l.props.updateForum(e, t)
}),
$S(KS(l), 'onInputChange', function (e, t, n, a) {
l.props.updateForumKey(e, t, n, a.target.value)
}),
$S(KS(l), 'onCheckboxChange', function (e, t, n, a) {
l.props.updateForumKey(e, t, n, a.target.checked ? 'true' : '')
}),
$S(KS(l), 'generateTableHeaders', function (t) {
return t._order.map(function (e) {
return C.a.createElement('th', {
key: e
}, t[e].title)
})
}),
$S(KS(l), 'generateTableElements', function (o, i, s) {
return o._order.map(function (e) {
var t,
n = o[e],
a = null,
r = null;
return n && (t = null === i[e] ? '' : i[e], n.computeValue && (t = n.computeValue(t)), 'input' !== n.type && 'select' !== n.type || (r = l.onInputChange), a = ZS[n.type]({
forumKey: e,
forumKeyValue: t,
forumKeyStatic: n,
forum: i,
forumIndex: s
}, r = 'checkbox' === n.type ? l.onCheckboxChange : r)),
a
})
}),
l
}
return e = r,
(t = [
{
key: 'render',
value: function () {
var e,
a = this;
return !1 === this.props.isExceptionTool && (e = this.getDynamicKeys().map(function (e) {
return C.a.createElement('th', {
key: e
}, e.replace(/_/g, ' ').split(' ').map(function (e) {
return (e[0] || '').toUpperCase() + e.slice(1)
}).join(' '))
})),
C.a.createElement('div', {
style: {
overflowX: 'scroll'
}
}, C.a.createElement('table', {
className: 'padding-top zebra-striped',
style: {
width: 'auto'
}
}, C.a.createElement('thead', null, C.a.createElement('tr', null, C.a.createElement('th', {
style: {
minWidth: '100px'
}
}), this.generateTableHeaders(this.props.isExceptionTool ? TS : jS), e)), C.a.createElement('tbody', null, this.props.forums.map(function (t, e) {
var n;
return !1 === a.props.isExceptionTool && (n = a.getDynamicKeys().map(function (e) {
return C.a.createElement('td', {
key: ''.concat(t.forum_id, '_').concat(e),
style: {
minWidth: '100px'
}
}, t[e])
})),
C.a.createElement('tr', {
key: t.organization_id
}, C.a.createElement('td', {
style: {
textAlign: 'center'
}
}, C.a.createElement('button', {
value: 'submit',
className: 'button button-fill--brand button-small',
disabled: t.saving || !t.isDirty,
onClick: a.updateForum.bind(a, t, e)
}, t.saving ? 'Saving...' : 'Save')), a.generateTableElements(a.props.isExceptionTool ? TS : jS, t, e), n)
}, this))))
}
}
]) && WS(e.prototype, t),
n && WS(e, n),
r
}();
$S(Ls, 'propTypes', {
forums: b.a.array.isRequired,
isExceptionTool: b.a.bool.isRequired,
updateForum: b.a.func.isRequired,
updateForumKey: b.a.func.isRequired
});
var XS = Ls;
function ew(e) {
return (ew = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function tw(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function nw(e, t) {
return (nw = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function aw(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = ow(n);
return e = a ? (e = ow(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== ew(e) && 'function' != typeof e ? rw(t) : e
}
}
function rw(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function ow(e) {
return (ow = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function iw(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Mo = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && nw(e, t)
}(o, A);
var e,
t,
n,
r = aw(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return iw(rw(t = r.call.apply(r, [
this
].concat(n))), 'state', {
isExpanded: !1
}),
iw(rw(t), 'fetchData', function (e) {
t.props.onboardingToolFetchData(e)
}),
iw(rw(t), 'toggleExpanded', function () {
t.setState({
isExpanded: !t.state.isExpanded
})
}),
t
}
return e = o,
(t = [
{
key: 'render',
value: function () {
if (!this.props.auth.staff) return C.a.createElement('div', {
className: 'section-contained'
}, C.a.createElement('div', null, ' You aren\'t allowed to access this page '));
var e,
t = this.state.isExpanded ? '' : 'section-contained section-contained-expanded';
return !1 === this.props.isExceptionTool && (e = C.a.createElement('div', {
className: 'spacing-bottom-double align align--between'
}, C.a.createElement('ul', {
className: 'nav-tabs -small -inline'
}, Object.keys(xS).map(function (e) {
return C.a.createElement('li', {
key: e
}, C.a.createElement(v.Link, {
to: '/tools/onboarding/'.concat(e, '/'),
activeClassName: 'active'
}, e.replace(/-/g, ' ')))
})), C.a.createElement('div', {
className: 'align align--middle'
}, C.a.createElement('button', {
onClick: this.toggleExpanded,
className: 'button button-fill button-small spacing-right'
}, this.state.isExpanded ? 'Make narrower' : 'Make wider'), C.a.createElement('button', {
className: 'button button-fill button-small',
onClick: this.fetchData.bind(this, this.props.params.tab)
}, 'Refresh')))),
C.a.createElement('div', {
className: t
}, C.a.createElement('div', {
className: 'layout content__wrap admin_content'
}, e, this.props.onboardingToolIsFetching ? C.a.createElement('div', {
className: 'spinner'
}) : C.a.createElement('div', null, this.props.onboardingToolForums && 0 < this.props.onboardingToolForums.length ? C.a.createElement(XS, {
fetchData: this.props.onboardingToolFetchData,
forums: this.props.onboardingToolForums,
tab: this.props.params.tab,
updateForum: this.props.onboardingToolUpdateForum,
updateForumKey: this.props.onboardingToolUpdateForumKey,
isExceptionTool: this.props.isExceptionTool
}) : C.a.createElement('div', null, this.props.onboardingToolError ? C.a.createElement(Ki, {
message: this.props.onboardingToolError,
alertType: 'error'
}) : 'No rows returned.', C.a.createElement('a', {
href: '#',
onClick: this.fetchData.bind(this, this.props.params.tab)
}, 'Try again')))))
}
}
]) && tw(e.prototype, t),
n && tw(e, n),
o
}();
iw(Mo, 'propTypes', {
auth: b.a.object,
isExceptionTool: b.a.bool,
onboardingToolForums: b.a.array.isRequired,
onboardingToolFetchData: b.a.func.isRequired,
onboardingToolIsFetching: b.a.bool.isRequired,
onboardingToolUpdateForum: b.a.func.isRequired,
onboardingToolUpdateForumKey: b.a.func.isRequired,
onboardingToolError: b.a.string,
params: b.a.shape({
tab: b.a.string
}).isRequired
});
Vi = Object(u.connect) (function (e) {
return {
auth: e.auth.auth,
selection: e.selection
}
}) (Ni.a.attachDrivers(Mo, [
go
]));
function sw(e) {
return (sw = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function lw(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function cw(e, t) {
return (cw = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function uw(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = dw(n);
return e = a ? (e = dw(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== sw(e) && 'function' != typeof e ? pw(t) : e
}
}
function pw(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function dw(e) {
return (dw = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function mw(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Yc = function (i) {
var e = (i[0] || '').toUpperCase() + i.substring(1),
t = 'ForumFlag'.concat(e, 'Driver'),
s = 'forumFlag'.concat(e),
e = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && cw(e, t)
}(o, A);
var e,
t,
n,
r = uw(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return mw(pw(t = r.call.apply(r, [
this
].concat(n))), 'state', mw({
}, s, null)),
mw(pw(t), 'fetchData', function () {
var e = {
forum: t.props.selection.forum.shortname
};
t.apiCall = io.a.call('forums/'.concat(i), {
data: e
}).done(t.onFetch)
}),
mw(pw(t), 'onFetch', function (e) {
null !== e.response && t.setState(mw({
}, s, e.response))
}),
mw(pw(t), 'getComponentProps', function () {
return mw({
}, s, t.state[s])
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.selection.type === ft.forum && this.fetchData()
}
},
{
key: 'componentWillUnmount',
value: function () {
this.apiCall && 'pending' === this.apiCall.state() && this.apiCall.abort()
}
}
]) && lw(e.prototype, t),
n && lw(e, n),
o
}();
return mw(e, 'displayName', t),
mw(e, 'propTypes', {
selection: ht.isRequired
}),
Object(ki.createDriver) (e, function (e) {
return {
selection: e.selection
}
})
};
function fw(e) {
return (fw = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function hw() {
return (hw = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function gw(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function yw(e, t) {
return (yw = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function bw(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = _w(n);
return e = a ? (e = _w(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== fw(e) && 'function' != typeof e ? vw(t) : e
}
}
function vw(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function _w(e) {
return (_w = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function Ew(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var Ow = 100,
yl = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && yw(e, t)
}(o, A);
var e,
t,
n,
r = bw(o);
function o() {
var n;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) t[a] = arguments[a];
return Ew(vw(n = r.call.apply(r, [
this
].concat(t))), 'state', {
revenue: null,
revenueErrorCode: null,
revenueLoading: null
}),
Ew(vw(n), 'shouldFetch', function () {
return null !== n.props.forumFlagHasCustomTerms && !n.props.forumFlagHasCustomTerms && (!n.state.revenue && !n.state.revenueLoading && (!n.props.selection.organization || !n.props.selection.organization.activeGuarantee))
}),
Ew(vw(n), 'fetchData', function () {
var e = {
forum: n.props.selection.forum.shortname
};
n.setState({
revenueLoading: !0,
revenueErrorCode: null
}),
n.apiCall = io.a.call('discovery/reports/revenueReport.json', {
data: e
}).done(n.onFetch).error(n.onError)
}),
Ew(vw(n), 'onFetch', function (e) {
e.response && n.setState({
revenue: e.response.earnings.map(function (e) {
return hw({
}, e, {
payDateStart: ct.a.utc(e.payDateStart),
payDateEnd: ct.a.utc(e.payDateEnd),
periodStart: ct.a.utc(e.periodStart),
periodEnd: ct.a.utc(e.periodEnd),
isLessThanMinimum: e.amount < Ow
})
}),
revenueErrorCode: null,
revenueLoading: !1
})
}),
Ew(vw(n), 'onError', function (e) {
try {
var t = JSON.parse(e.responseText).code
} catch (e) {
t = !0
}
n.setState({
revenueErrorCode: t,
revenueLoading: !1
})
}),
Ew(vw(n), 'getComponentProps', function () {
return {
revenue: n.state.revenue,
revenueErrorCode: n.state.revenueErrorCode,
revenueLoading: n.state.revenueLoading
}
}),
n
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.shouldFetch() && this.fetchData()
}
},
{
key: 'componentWillReceiveProps',
value: function () {
this.shouldFetch() && this.fetchData()
}
}
]) && gw(e.prototype, t),
n && gw(e, n),
o
}();
Ew(yl, 'displayName', 'RevenueDriver'),
Ew(yl, 'propTypes', {
forumFlagHasCustomTerms: b.a.bool,
forumFlagHasPaymentInfo: b.a.bool,
selection: ht.isRequired
});
function Sw() {
var e = (e = br.shortname && window._v5Config.forums[br.shortname]) && e.tipaltiUrl;
return C.a.createElement('div', {
className: 'alert alert--warning-light spacing-bottom'
}, C.a.createElement('div', {
className: 'spacing-narrow'
}, C.a.createElement('h2', {
className: 'spacing-bottom-narrow'
}, C.a.createElement('span', {
className: 'icon__position spacing-right-small'
}, C.a.createElement('img', {
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/icons/vip-info.png',
width: '20'
})), 'We need more info to pay you!'), C.a.createElement('p', {
className: 'text-medium'
}, 'You\'ve earned money that we\'d like to send you. Be sure to fill out your ', C.a.createElement('strong', null, C.a.createElement('a', {
href: e,
target: '_blank'
}, 'payment information')), ' so we can pay you soon.')))
}
h = Object(ki.attachDrivers) (Object(ki.createDriver) (yl), [
Yc('hasPaymentInfo'),
Yc('hasCustomTerms')
]);
function ww(e) {
return (ww = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function Pw(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function kw(e, t) {
return (kw = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function Nw(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = Rw(n);
return e = a ? (e = Rw(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== ww(e) && 'function' != typeof e ? Cw(t) : e
}
}
function Cw(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function Rw(e) {
return (Rw = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function xw(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
i = b.a.shape({
periodStart: s.moment,
periodEnd: s.moment,
payDateStart: s.moment,
payDateEnd: s.moment
}),
Qs = function n(e) {
var a = e.icon;
return C.a.createElement('table', {
className: 'table--no-border -inner-no-border earnings-table'
}, C.a.createElement('thead', {
className: 'earnings-table__subtext text-subheading'
}, C.a.createElement('tr', null, C.a.createElement('th', {
className: 'earnings-timeline__indicator'
}), C.a.createElement('th', null, 'Earnings Period'), C.a.createElement('th', null, 'Estimated Pay Date'), C.a.createElement('th', null, 'Amount'))), C.a.createElement('tbody', null, e.rows.map(function (e) {
var t = ct() (e.periodStart).format('MMDDYY');
return C.a.createElement(n.Row, {
key: t,
row: e,
icon: a
})
}), e.total ? C.a.createElement('tr', {
className: 'earnings-table__subtext text-subheading'
}, C.a.createElement('td', null), C.a.createElement('td', {
colSpan: '2'
}, 'Total'), C.a.createElement('td', null, '$', Dp.addThousandsSeparator(e.total.toFixed(2)))) : null))
};
Qs.displayName = 'EarningsTable',
Qs.propTypes = {
icon: b.a.string.isRequired,
rows: b.a.arrayOf(i).isRequired,
total: b.a.number
},
Qs.Row = (Ls = Pc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && kw(e, t)
}(o, A);
var e,
t,
n,
r = Nw(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return xw(Cw(e = r.call.apply(r, [
this
].concat(n))), 'formatDate', function (e) {
return e.utc().format('MM/D/YY')
}),
e
}
return e = o,
(t = [
{
key: 'render',
value: function () {
var e = this.props.row.periodStart.utc().format('MMM'),
t = this.formatDate(this.props.row.periodStart),
n = this.formatDate(this.props.row.periodEnd),
a = this.formatDate(this.props.row.payDateStart),
r = this.formatDate(this.props.row.payDateEnd);
return C.a.createElement('tr', null, C.a.createElement('td', {
className: 'earnings-timeline__indicator'
}, C.a.createElement('span', {
className: 'earnings-timeline__date'
}, e), C.a.createElement('img', {
src: '//c.disquscdn.com/next/current/publisher-admin/assets/'.concat(this.props.icon)
})), C.a.createElement('td', null, t, ' - ', n), C.a.createElement('td', null, this.props.row.isLessThanMinimum ? C.a.createElement(Md, {
tooltipKey: 'payment',
content: 'Payment dates can be estimated for upcoming payments of $100 or more.',
direction: 'top'
}) : ''.concat(a, ' - ').concat(r)), C.a.createElement('td', null, '$', Dp.addThousandsSeparator(this.props.row.amount.toFixed(2))))
}
}
]) && Pw(e.prototype, t),
n && Pw(e, n),
o
}(), xw(Pc, 'propTypes', {
icon: b.a.string.isRequired,
row: i.isRequired
}), Ls),
Qs.ROW_SHAPE = i;
var Aw = Qs,
Mo = function (e) {
var t,
n,
a,
r = 'earnings-timeline earnings-timeline--first';
return 0 === e.rows.length && (r += ' earnings-timeline--empty'),
0 === e.total ? a = C.a.createElement('p', null, 'You don\'t have any upcoming payments. ', C.a.createElement('a', {
href: 'https://help.disqus.com/customer/portal/articles/1208081-receiving-payments-from-disqus'
}, 'Learn more'), '.') : e.total < 100 ? a = C.a.createElement('p', {
className: 'text-error spacing-narrow'
}, 'Payment minimum not met. Payment will be scheduled when the balance reaches $100.') : 100 <= e.total && (n = e.rows[0], t = ct() (n.payDateStart).format('MMMM DD, YYYY'), n = ct() (n.payDateEnd).format('MMMM DD, YYYY'), a = C.a.createElement('p', {
className: 'spacing-bottom'
}, 'Estimated delivery ', t, ' - ', n)),
C.a.createElement('div', null, C.a.createElement('div', {
className: r
}, C.a.createElement('div', {
className: 'earnings-timeline__indicator pull-left'
}, C.a.createElement('span', {
className: 'earnings-timeline__date'
}), C.a.createElement('img', {
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/icons/icon-analytics-mail.png'
})), C.a.createElement('div', {
className: 'earnings-timeline__header'
}, C.a.createElement('h3', {
className: 'spacing-bottom-narrow'
}, C.a.createElement('strong', null, 'Upcoming Payment: '), C.a.createElement('span', {
className: 'text-success'
}, '$', Dp.addThousandsSeparator(e.total.toFixed(2)))), a), e.rows && 0 < e.rows.length ? C.a.createElement(Aw, {
rows: e.rows,
icon: '/img/icons/icon-analytics-check.png'
}) : null))
};
Mo.displayName = 'UpcomingPayments',
Mo.propTypes = {
total: b.a.number.isRequired,
rows: b.a.arrayOf(Aw.ROW_SHAPE).isRequired
};
var Dw = Mo,
go = function (e) {
var t = 'earnings-timeline earnings-timeline--last';
return 0 === e.rows.length && (t += ' earnings-timeline--empty'),
C.a.createElement('div', null, C.a.createElement('div', {
className: t
}, C.a.createElement('div', {
className: 'earnings-timeline__indicator pull-left'
}), C.a.createElement('div', {
className: 'earnings-timeline__header'
}, C.a.createElement('h3', {
className: 'spacing-bottom-narrow'
}, C.a.createElement('strong', null, 'Unpaid Earnings: '), C.a.createElement('span', {
className: 'text-warning'
}, '$', Dp.addThousandsSeparator(e.total.toFixed(2)))), 0 < e.total ? null : C.a.createElement('p', null, 'You don\'t have any unpaid earnings. ', C.a.createElement('a', {
href: 'https://help.disqus.com/customer/portal/articles/1208081-receiving-payments-from-disqus'
}, 'Learn more'), '.')), e.rows && 0 < e.rows.length ? C.a.createElement(Aw, {
rows: e.rows,
total: e.total,
icon: '/img/icons/icon-analytics-clock.png'
}) : null))
};
go.displayName = 'UnpaidEarnings',
go.propTypes = {
total: b.a.number.isRequired,
rows: b.a.arrayOf(Aw.ROW_SHAPE).isRequired
};
var jw = go;
function Tw(e) {
return (Tw = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function Iw(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function qw(e, t) {
return (qw = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function Fw(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = Uw(n);
return e = a ? (e = Uw(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== Tw(e) && 'function' != typeof e ? Lw(t) : e
}
}
function Lw(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function Uw(e) {
return (Uw = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function Mw(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
yl = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && qw(e, t)
}(o, A);
var e,
t,
n,
r = Fw(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return Mw(Lw(t = r.call.apply(r, [
this
].concat(n))), 'state', {
showHistory: !1
}),
Mw(Lw(t), 'onShowHistory', function (e) {
e.preventDefault(),
t.setState({
showHistory: !0
})
}),
t
}
return e = o,
(t = [
{
key: 'render',
value: function () {
if (null === this.props.forumFlagHasPaymentInfo || null === this.props.forumFlagHasCustomTerms) return C.a.createElement('div', {
className: 'admin_content'
}, C.a.createElement(o.Header, {
selection: this.props.selection
}), C.a.createElement(Ji, null));
if (this.props.forumFlagHasCustomTerms) return C.a.createElement('div', {
className: 'admin_content'
}, C.a.createElement(o.Header, {
selection: this.props.selection
}), C.a.createElement(o.SpecialTermsAlert, null));
var e = je.a.where(this.props.revenue, {
status: 'upcoming'
}),
t = e.reduce(function (e, t) {
return e + t.amount
}, 0),
n = je.a.where(this.props.revenue, {
status: 'unpaid'
}),
a = n.reduce(function (e, t) {
return e + t.amount
}, 0),
r = this.props.selection.organization && this.props.selection.organization.activeGuarantee;
return C.a.createElement('div', {
className: 'admin_content'
}, C.a.createElement(o.Header, {
selection: this.props.selection
}), !this.props.forumFlagHasPaymentInfo && 75 <= t ? C.a.createElement(Sw, null) : null, this.props.revenueErrorCode ? C.a.createElement(dd, {
isPermissionError: 22 === this.props.revenueErrorCode
}) : null, r ? C.a.createElement(pd, {
secondaryMessageType: 'payments',
startDate: ct() (r.start),
endDate: ct() (r.end),
amount: r.amount
}) : null, this.props.revenueLoading ? C.a.createElement(Ji, null) : null, this.props.revenueErrorCode || this.props.revenueLoading || r ? null : C.a.createElement('div', null, C.a.createElement(Dw, {
rows: e,
total: t
}), C.a.createElement(jw, {
rows: n,
total: a
})))
}
}
]) && Iw(e.prototype, t),
n && Iw(e, n),
o
}();
Mw(yl, 'propTypes', {
forumFlagHasCustomTerms: b.a.bool,
forumFlagHasPaymentInfo: b.a.bool,
revenue: b.a.array,
revenueErrorCode: b.a.number,
revenueLoading: b.a.bool,
selection: ht.isRequired
}),
yl.Header = function (e) {
return C.a.createElement('div', {
className: 'spacing-bottom'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker'
}, 'Your Site\'s Payment Schedule', C.a.createElement('div', {
className: 'tooltip-ct label--gray label--payments-tooltip'
}, 'What\'s This?', C.a.createElement('span', {
className: 'tooltip'
}, 'Disqus pays out monthly on a 90-day trailing basis and with a $100 minimum. Be sure to fill out your ', C.a.createElement('a', {
href: e.selection.forum.tipaltiUrl,
target: '_blank'
}, 'payment method and other information'), ' needed for your payment to reach you.'))))
},
yl.Header.displayName = 'PaymentsHeader',
yl.Header.propTypes = {
selection: ht.isRequired
},
yl.SpecialTermsAlert = function () {
return C.a.createElement('div', {
className: 'alert alert--warning-light spacing-bottom'
}, C.a.createElement('div', {
className: 'spacing-narrow'
}, C.a.createElement('h2', {
className: 'spacing-bottom-narrow'
}, C.a.createElement('span', {
className: 'icon__position spacing-right-small'
}, C.a.createElement('img', {
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/icons/credentials.png',
width: '20'
})), 'You have special payment terms!'), C.a.createElement('p', {
className: 'text-medium'
}, 'You can download your Earnings and Payments. Please ', C.a.createElement('strong', null, C.a.createElement('a', {
href: Pn.revealContact
}, 'contact our Publisher Support Team')), ' for further assistance.')))
},
yl.SpecialTermsAlert.displayName = 'PaymentsSpecialTermsAlert';
var Bw = Ni.a.attachDrivers(yl, [
h,
Yc('hasPaymentInfo'),
Yc('hasCustomTerms')
]),
Pc = n(493),
zw = n.n(Pc);
function Hw(e) {
return (Hw = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function Gw(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function Vw(e, t) {
return (Vw = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function Ww(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = Qw(n);
return e = a ? (e = Qw(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== Hw(e) && 'function' != typeof e ? Yw(t) : e
}
}
function Yw(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function Qw(e) {
return (Qw = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function Kw(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Ls = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && Vw(e, t)
}(o, A);
var e,
t,
n,
r = Ww(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return Kw(Yw(e = r.call.apply(r, [
this
].concat(n))), 'state', {
isOpen: !1
}),
Kw(Yw(e), 'handleClick', function () {
e.setState({
isOpen: !e.state.isOpen
})
}),
e
}
return e = o,
(t = [
{
key: 'render',
value: function () {
var e = this.state.isOpen ? 'nav__item dropdown-open' : 'nav__item';
return C.a.createElement('nav', {
className: 'layout__nav'
}, C.a.createElement('div', {
onClick: this.handleClick,
className: 'nav--mobile-dropdown'
}, C.a.createElement(ri, {
linkClassName: e,
linkActiveClassName: 'active',
path: '/analytics/revenue/',
selection: this.props.selection
}, C.a.createElement('div', {
className: 'nav-lnk -color-muted'
}, C.a.createElement('div', {
className: 'nav-lnk__blk'
}, C.a.createElement('span', {
className: 'button__text'
}, 'Analyze revenue')), C.a.createElement('div', {
className: 'nav-lnk__pointer'
}, C.a.createElement('span', {
className: 'icon icon-right-bracket'
})))), C.a.createElement(Uo, {
linkClassName: e,
linkActiveClassName: 'active',
path: '/analytics/payments/',
selection: this.props.selection
}, C.a.createElement('div', {
className: 'nav-lnk -color-muted'
}, C.a.createElement('div', {
className: 'nav-lnk__blk'
}, C.a.createElement('span', {
className: 'button__text'
}, 'Payments')), C.a.createElement('div', {
className: 'nav-lnk__pointer'
}, C.a.createElement('span', {
className: 'icon icon-right-bracket'
}))))), C.a.createElement(Uo, {
linkClassName: 'button button-fill--brand text-medium button-wide hidden-md',
linkActiveClassName: 'active',
path: '/settings/ads/',
selection: this.props.selection
}, C.a.createElement('span', {
className: 'icon-cog icon__position text-smaller spacing-right-small'
}), 'Ad Settings'))
}
}
]) && Gw(e.prototype, t),
n && Gw(e, n),
o
}();
Kw(Ls, 'propTypes', {
selection: ht.isRequired
});
var Jw = Ls,
i = function (e) {
var t = {
selection: e.selection,
initialQuestionGroup: CO.deactivationHubOrg
};
return C.a.createElement('div', {
className: 'section-contained'
}, C.a.createElement('div', {
className: 'layout layout--publishers'
}, C.a.createElement('div', {
className: 'layout__main'
}, C.a.createElement(Jw, {
selection: e.selection
}), C.a.createElement('div', {
className: 'layout__content'
}, C.a.cloneElement(e.children, t)))))
};
i.displayName = 'Reveal',
i.propTypes = {
children: b.a.node.isRequired,
selection: ht.isRequired
};
var $w = Object(u.connect) (function (e) {
return {
selection: e.selection
}
}) (i),
Qs = function (e) {
return C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, e.header ? C.a.createElement('header', {
className: 'settings__header'
}, e.header) : null, C.a.createElement('section', {
className: 'settings__content'
}, e.children), e.footer ? C.a.createElement('footer', {
className: 'settings__footer'
}, C.a.createElement('div', {
className: 'fieldset__block'
}, e.footer)) : null)
};
Qs.displayName = 'DeactivationBasePanel',
Qs.propTypes = {
header: b.a.node,
footer: b.a.node,
children: b.a.node.isRequired
};
var Zw = Qs,
Mo = function (t) {
return C.a.createElement(Zw, {
header: [
C.a.createElement('h1', {
key: 'header',
className: 'text-semibold text-larger text-gray-darker spacing-bottom-small'
}, t.header),
C.a.createElement('div', {
key: 'description',
className: 'text-gray'
}, t.description)
],
footer: [
t.goBackButton,
C.a.createElement('button', {
key: 'submitButton',
onClick: t.onAnswerSubmit,
className: 'button button-fill--brand button-medium button-padding-taller pull-right',
disabled: t.submitDisabled
}, C.a.createElement('span', {
className: 'spacing-left-small'
}, t.submitContent), C.a.createElement('span', {
className: 'icon-right-bracket icon__position -md spacing-left-small'
}))
]
}, C.a.createElement('div', {
className: 'spacing-top-narrow'
}, t.formHeader ? C.a.createElement('div', {
className: 'border-bottom spacing-bottom padding-bottom'
}, C.a.createElement('strong', null, t.formHeader)) : null, t.choices.map(function (e) {
return C.a.createElement('label', {
key: e.choice,
className: 'align spacing-bottom-narrow text-medium'
}, C.a.createElement('input', {
type: 'radio',
name: t.name,
className: 'spacing-right',
value: e.choice,
onChange: t.onAnswerSelected,
checked: e.choice === t.selectedAnswer
}), e.choice, e.has_arbitrary_text ? C.a.createElement('input', {
type: 'text',
className: 'input--textbox -text-small spacing-left deactivation-input--other',
value: t.selectedAnswerArbitraryText,
onChange: t.onAnswerArbitraryTextChange,
disabled: e.choice !== t.selectedAnswer
}) : null)
})))
};
Mo.displayName = 'DeactivationAnswerForm',
Mo.propTypes = {
onAnswerSelected: b.a.func.isRequired,
onAnswerArbitraryTextChange: b.a.func.isRequired,
onAnswerSubmit: b.a.func.isRequired,
header: b.a.string.isRequired,
name: b.a.string.isRequired,
goBackButton: b.a.element.isRequired,
submitContent: b.a.string.isRequired,
submitDisabled: b.a.bool,
description: b.a.oneOfType([b.a.string,
b.a.element]).isRequired,
formHeader: b.a.string.isRequired,
choices: b.a.arrayOf(b.a.shape({
choice: b.a.string.isRequired,
has_arbitrary_text: b.a.bool.isRequired
})).isRequired,
selectedAnswer: b.a.string,
selectedAnswerArbitraryText: b.a.string
};
var Xw = Mo,
go = function (e) {
return C.a.createElement(Zw, {
header: [
C.a.createElement('span', {
key: 'icon',
className: 'text-green icon-checkmark text-large icon__position -md spacing-right'
}),
C.a.createElement('span', {
key: 'answer',
className: 'text-gray'
}, e.answer)
],
footer: [
C.a.createElement('button', {
key: 'back',
onClick: e.onGoBack,
className: 'button button-outline text-medium button-padding-taller'
}, C.a.createElement('span', {
className: 'icon-right-bracket icon-flipped spacing-right-small'
}), C.a.createElement('span', {
className: 'spacing-right'
}, 'Go back')),
C.a.createElement('button', {
key: 'continue',
onClick: e.onContinue,
className: 'button button-fill--brand button-medium button-padding-taller pull-right'
}, C.a.createElement('span', {
className: 'spacing-left-small'
}, 'Continue Deactivating Ads'), C.a.createElement('span', {
className: 'icon-right-bracket icon__position -md spacing-left-small'
}))
]
}, C.a.createElement('div', {
className: 'spacing-top'
}, C.a.createElement('p', null, C.a.createElement('strong', null, e.followUpText)), e.followUpButton))
};
go.displayName = 'DeactivationFollowup',
go.propTypes = {
onGoBack: b.a.func.isRequired,
onContinue: b.a.func.isRequired,
answer: b.a.string.isRequired,
followUpText: b.a.string.isRequired,
followUpButton: b.a.element.isRequired
};
var eP = go,
yl = function (e) {
return C.a.createElement(Zw, {
header: [
C.a.createElement('h1', {
key: 'header',
className: 'text-semibold text-larger text-gray-darker spacing-bottom-small'
}, 'Please confirm that you’d like to deactivate Reveal'),
C.a.createElement('div', {
key: 'description',
className: 'text-gray'
}, 'Thanks again for your input! Please confirm that you’d like to deactivate Reveal on the following:')
],
footer: [
C.a.createElement('button', {
key: 'back',
onClick: e.onGoBack,
className: 'button button-outline text-medium button-padding-taller'
}, C.a.createElement('span', {
className: 'icon-right-bracket icon-flipped spacing-right-small'
}), C.a.createElement('span', {
className: 'spacing-right'
}, 'Go back')),
C.a.createElement('button', {
key: 'continue',
onClick: e.onConfirm,
className: 'button button-fill--brand button-medium button-padding-taller spacing-right pull-right'
}, 'Deactivate Ads Now')
]
}, C.a.createElement('div', {
className: 'spacing-top'
}, 'organization' === e.selection.type ? C.a.createElement('div', {
className: 'media spacing-top'
}, C.a.createElement('div', {
className: 'media-left'
}, C.a.createElement('span', {
className: 'icon-organization text-gray text-larger'
})), C.a.createElement('div', {
className: 'media-body'
}, C.a.createElement('p', {
className: 'text-large spacing-bottom'
}, C.a.createElement('strong', {
className: 'spacing-right-small'
}, e.selection.organization.name || 'Your Organization'), '(', function (e) {
e = e.length;
return 1 === e ? '1 site' : ''.concat(e, ' sites')
}(e.hubQualifiedForums), ')'), C.a.createElement('ul', {
className: 'list-bullet'
}, e.hubQualifiedForums.map(function (e) {
return C.a.createElement('li', {
key: e.id
}, e.name)
})))) : C.a.createElement('div', {
className: 'media spacing-top'
}, C.a.createElement('div', {
className: 'media-body'
}, C.a.createElement('p', {
className: 'text-large spacing-bottom'
}, C.a.createElement('strong', null, e.selection.forum.name))))))
};
yl.propTypes = {
selection: ht.isRequired,
onConfirm: b.a.func.isRequired,
onGoBack: b.a.func.isRequired,
hubQualifiedForums: b.a.array
},
yl.displayName = 'DeactivationConfirmation';
var tP = yl,
h = function (e) {
return C.a.createElement(Zw, {
footer: [
C.a.createElement(Uo, {
key: 'back',
path: '/settings/ads/',
linkClassName: 'button button-fill--brand button-medium button-padding-taller',
selection: e.selection
}, 'Ad Settings'),
C.a.createElement('a', {
key: 'contact',
href: e.contactUrl,
target: '_blank',
className: 'button button-outline button-medium spacing-left button-padding-taller'
}, 'Contact Support')
]
}, C.a.createElement('h1', {
className: 'text-semibold text-larger text-gray-darker spacing-top spacing-bottom'
}, 'You’ve successfully deactivated Reveal'), C.a.createElement('p', {
className: 'text-gray'
}, 'Thanks again for your responses. If you had Reveal ads running, please allow some time for your sites to update, as the system may take several minutes to remove your ads. Our publisher success team may follow up with you soon. In the meantime, if you have any questions about Reveal, please get in touch with us. Thanks again for using Disqus!'))
};
h.propTypes = {
selection: ht.isRequired,
contactUrl: b.a.string.isRequired
},
h.displayName = 'DeactivationComplete';
var nP = h;
function aP(e) {
return (aP = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function rP() {
return (rP = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function oP(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function iP(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? oP(Object(n), !0).forEach(function (e) {
fP(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : oP(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function sP(e) {
return function (e) {
if (Array.isArray(e)) return lP(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return lP(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? lP(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function lP(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function cP(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function uP(e, t) {
return (uP = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function pP(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = mP(n);
return e = a ? (e = mP(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== aP(e) && 'function' != typeof e ? dP(t) : e
}
}
function dP(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function mP(e) {
return (mP = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function fP(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Yc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && uP(e, t)
}(o, A);
var e,
t,
n,
a = pP(o);
function o() {
var r;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return fP(dP(r = a.call.apply(a, [
this
].concat(t))), 'state', {
currentQuestion: null,
currentAnswer: null,
currentAnswerArbitraryText: null,
previousAnswers: [
],
previousQuestions: [
],
followup: null,
hasCompletedFirstQuestion: !1,
hasDismissedFollowup: !1,
hasCompletedDeactivation: !1
}),
fP(dP(r), 'handleGoBack', function () {
var e,
t = sP(r.state.previousQuestions),
n = r.state.previousAnswers.slice(0, - 1),
a = t.pop().id;
a === r.props.questions[0].question.id ? r.setInitialQuestion(r.props.questions) : (e = {
}, e = r.state.hasDismissedFollowup ? {
hasDismissedFollowup: !1
}
: {
followup: null,
previousQuestions: t,
previousAnswers: n
}, r.setState(iP(iP({
}, r.parseQuestionId(a)), e)))
}),
fP(dP(r), 'setInitialQuestion', function (e) {
var t = e[0],
e = r.parseAnswer(t.answer);
r.setState({
currentQuestion: t.question,
currentAnswer: e.choice,
currentAnswerArbitraryText: e.text
})
}),
fP(dP(r), 'handleConfirmDeactivate', function () {
var e = r.props.params;
r.props.deactivateOnPerformAction(e.campaign, 'user-opt-out', e.hubspotCompanyId, r.jesterEmit),
r.setState({
hasCompletedDeactivation: !0
})
}),
fP(dP(r), 'jesterEmit', function (e) {
var t,
n,
a;
r.props.selection.type === ft.forum && (t = r.props.forumDetails.settings, n = e.response.settings, a = Jo.ADS_KEYS),
Jo.trackSettingsChanges({
selection: r.props.selection,
jesterData: {
verb: 'update',
zone: 'settings',
section: 'deactivation_hub'
},
oldState: Jo.ensureBooleans(t),
newState: Jo.ensureBooleans(n),
keys: a
})
}),
fP(dP(r), 'getFollowupButton', function (e) {
e = e.extra_data;
if (e.link_text) {
if (e.forum_admin_link_path) return C.a.createElement(Uo, {
path: e.forum_admin_link_path,
selection: r.props.selection,
linkClassName: 'button button-fill--brand button-medium button-padding-taller spacing-top'
}, e.link_text);
if (e.button_link) return C.a.createElement('a', {
className: 'button button-fill--brand button-medium button-padding-taller spacing-top',
href: e.button_link,
target: '_blank',
rel: 'noopener noreferrer'
}, e.link_text)
}
return C.a.createElement('a', {
href: ho.getRoot(),
className: 'button button-outline button-medium'
}, 'Back to Disqus')
}),
fP(dP(r), 'handleAnswerSelected', function (e) {
r.setState({
currentAnswer: e.target.value
})
}),
fP(dP(r), 'handleAnswerArbitraryTextChange', function (e) {
r.setState({
currentAnswerArbitraryText: e.target.value
})
}),
fP(dP(r), 'handleSaveAnswer', function () {
var e = r.findOptionForAnswer(r.state.currentQuestion, r.state.currentAnswer),
t = JSON.stringify({
choice: r.state.currentAnswer,
text: e.has_arbitrary_text ? r.state.currentAnswerArbitraryText : ''
});
r.props.updateAnswer(r.state.currentQuestion.id, t);
t = {
previousAnswers: [
].concat(sP(r.state.previousAnswers), [
r.state.currentAnswer
]),
previousQuestions: [
].concat(sP(r.state.previousQuestions), [
r.state.currentQuestion
])
};
r.state.currentQuestion.id === r.props.questions[0].question.id && (t.hasCompletedFirstQuestion = !0),
e.extra_data.follow_up_text && (t.followup = {
text: e.extra_data.follow_up_text,
button: r.getFollowupButton(e)
}),
e.extra_data.next_question_id ? rP(t, r.parseQuestionId(e.extra_data.next_question_id)) : (t.currentQuestion = null, t.currentAnswer = null, t.currentAnswerArbitraryText = null),
r.setState(t)
}),
fP(dP(r), 'findOptionForAnswer', function (e, t) {
return t ? je.a.findWhere(e.typeContext, {
choice: t
}) : null
}),
fP(dP(r), 'parseAnswer', function (e) {
if (~(e = e || '').indexOf(': ')) {
var t = e.split(':');
return {
choice: t[0],
text: t[1].trim()
}
}
return {
choice: e,
text: ''
}
}),
fP(dP(r), 'parseQuestionId', function (t) {
var e = je.a.find(r.props.questions, function (e) {
return e.question.id === t
}),
n = r.parseAnswer(e.answer);
return {
currentQuestion: e.question,
currentAnswer: n.choice,
currentAnswerArbitraryText: n.text
}
}),
fP(dP(r), 'dismissFollowup', function () {
r.setState({
hasDismissedFollowup: !0
})
}),
r
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.emitTrackingEvent({
verb: 'view',
section: this.props.selection.type === ft.forum ? 'forum' : 'organization'
}),
this.props.fetchCampaignData(this.props.params.campaign),
this.props.fetchForumDetails(),
this.props.fetchOrgForums()
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
e.questions && !this.props.questions && this.setInitialQuestion(e.questions)
}
},
{
key: 'render',
value: function () {
if (!this.props.campaign.canParticipate) return C.a.createElement('section', {
className: 'content__wrap'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker'
}, 'Uh-oh – this link is no longer valid.')), C.a.createElement('div', {
className: 'settings__content'
}, C.a.createElement('p', {
className: 'spacing-top spacing-bottom'
}, 'This link is no longer valid. If you’d like to make changes to your ad settings, visit the Revenue Settings page for your Disqus site(s).'), C.a.createElement(Uo, {
path: '/settings/ads/',
selection: this.props.selection,
linkClassName: 'button button-outline button-medium button-padding-taller'
}, 'View your Ad Settings')));
if (!this.props.questions) return C.a.createElement(Ji, null);
if (!this.state.hasCompletedFirstQuestion) return C.a.createElement(Xw, {
name: 'initial',
onAnswerSelected: this.handleAnswerSelected,
onAnswerArbitraryTextChange: this.handleAnswerArbitraryTextChange,
onAnswerSubmit: this.handleSaveAnswer,
header: 'Reveal ads may not be a good fit',
goBackButton: C.a.createElement(Uo, {
key: 'back',
path: '/settings/ads/',
selection: this.props.selection,
linkClassName: 'button button-outline button-medium button-padding-taller'
}, 'Go to Ad Settings'),
submitContent: 'Continue Deactivating Ads',
submitDisabled: !this.state.currentAnswer,
description: C.a.createElement('div', {
className: 'settings__description--nested align-min-tablet align--between align--row-reverse'
}, C.a.createElement('div', {
className: 'padding-default text-center'
}, C.a.createElement('img', {
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/engage-reveal-no-bg.svg',
className: 'img-responsive',
width: '250'
})), C.a.createElement('div', {
className: 'align__item--flex-1 text-gray text-medium spacing-right-large spacing-top spacing-bottom'
}, C.a.createElement('p', null, 'The Disqus platform helps publishers grow successfully with two products that go hand in hand:'), C.a.createElement('ol', {
className: 'spacing-left-large spacing-top-small spacing-bottom'
}, C.a.createElement('li', null, 'Engage: the Internet’s most popular comment system.'), C.a.createElement('li', null, 'Reveal: integrated native ads that help you earn money.')), C.a.createElement('p', null, 'Engage and Reveal work together to keep Disqus free and to help you earn money from your engaged audience. Smaller, non-commercial sites can turn off Reveal.'))),
formHeader: this.state.currentQuestion.text,
selectedAnswer: this.state.currentAnswer,
selectedAnswerArbitraryText: this.state.currentAnswerArbitraryText,
choices: this.state.currentQuestion.typeContext
});
if (this.state.followup && !this.state.hasDismissedFollowup) return C.a.createElement(eP, {
onGoBack: this.handleGoBack,
onContinue: this.dismissFollowup,
answer: C.a.createElement('span', null, 'You picked: ', C.a.createElement('em', null, this.state.previousAnswers[this.state.previousAnswers.length - 1])),
followUpText: this.state.followup.text,
followUpButton: this.state.followup.button
});
if (this.state.currentQuestion) {
var e = this.findOptionForAnswer(this.state.currentQuestion, this.state.currentAnswer),
e = e && e.has_arbitrary_text ? !(!this.state.currentAnswer || !this.state.currentAnswerArbitraryText) : !!this.state.currentAnswer;
return C.a.createElement(Xw, {
name: 'secondary',
onAnswerSelected: this.handleAnswerSelected,
onAnswerArbitraryTextChange: this.handleAnswerArbitraryTextChange,
onAnswerSubmit: this.handleSaveAnswer,
header: this.state.currentQuestion.text,
goBackButton: C.a.createElement('button', {
key: 'back',
onClick: this.handleGoBack,
className: 'button button-outline text-medium button-padding-taller'
}, C.a.createElement('span', {
className: 'icon-right-bracket icon-flipped spacing-right-small'
}), C.a.createElement('span', {
className: 'spacing-right'
}, 'Go back')),
submitContent: 'Continue Deactivating Ads',
submitDisabled: !e,
description: C.a.createElement('span', null, 'You picked: ', C.a.createElement('em', null, this.state.previousAnswers[this.state.previousAnswers.length - 1])),
formHeader: 'Select one',
selectedAnswer: this.state.currentAnswer,
selectedAnswerArbitraryText: this.state.currentAnswerArbitraryText,
choices: this.state.currentQuestion.typeContext
})
}
var t;
return this.state.hasCompletedDeactivation ? C.a.createElement(nP, {
contactUrl: Pn.revealDeactivationContact,
selection: this.props.selection
}) : (this.props.selection.type === ft.organization && (t = this.props.orgForumsList.filter(function (e) {
return !e.settings.adsEnabled
})), C.a.createElement(tP, {
selection: this.props.selection,
onConfirm: this.handleConfirmDeactivate,
onGoBack: this.handleGoBack,
hubQualifiedForums: t
}))
}
}
]) && cP(e.prototype, t),
n && cP(e, n),
o
}();
fP(Yc, 'displayName', 'RevealSettingsDeactivate'),
fP(Yc, 'propTypes', {
emitTrackingEvent: b.a.func.isRequired,
fetchCampaignData: b.a.func.isRequired,
selection: ht.isRequired,
updateAnswer: b.a.func.isRequired,
deactivateOnPerformAction: b.a.func.isRequired,
campaign: b.a.shape({
canParticipate: b.a.bool.isRequired
}).isRequired,
orgForumsList: b.a.array,
params: b.a.shape({
campaign: b.a.string,
hubspotCompanyId: b.a.string,
id: b.a.string,
name: b.a.string
}).isRequired,
forumDetails: $c,
fetchForumDetails: b.a.func.isRequired,
fetchOrgForums: b.a.func.isRequired,
questions: b.a.arrayOf(b.a.shape({
question: b.a.shape({
id: b.a.number.isRequired,
order: b.a.number.isRequired,
text: b.a.string.isRequired,
type: b.a.number.isRequired,
typeContext: b.a.arrayOf(b.a.shape({
choice: b.a.string.isRequired,
has_arbitrary_text: b.a.bool.isRequired,
extra_data: b.a.shape({
follow_up_text: b.a.string,
forum_admin_link_path: b.a.string,
mailto_link: b.a.string,
link_text: b.a.string
}).isRequired
})),
typeName: b.a.oneOf(['MULTIPLE_CHOICE',
'MULTIPLE_CHOICE_WITH_ARBITRARY_TEXT'])
}),
answer: b.a.string
}))
});
Pc = Object(u.connect) (function (e) {
return iP(iP({
campaign: e.campaign,
forumDetails: e.forumDetails.forumDetails
}, e.orgForums), {
}, {
defaultEventData: {
zone: 'deactivation_hub'
}
})
}, iP({
deactivateOnPerformAction: function (r, o, i, s) {
return function (e, t) {
var n,
a,
t = t().selection;
return t.type === ft.forum ? (a = 'forums/update', n = {
forum: t.forum.shortname,
adsPositionTopEnabled: 0,
adsPositionBottomEnabled: 0,
adsPositionInthreadEnabled: 0,
adsPositionRecommendationsEnabled: 0
}) : t.type === ft.organization && (a = 'organizations/campaigns/performAction', n = {
organization: t.organization.id,
campaign: r,
action: o,
hubspotCompanyId: i
}),
io.a.call(a, {
data: n,
method: 'POST'
}).done(s)
}
},
emitTrackingEvent: Xo({
zone: 'deactivation_hub'
}),
fetchCampaignData: function (o) {
return function (t, e) {
var n,
a,
r = e().selection;
return r.type === ft.forum ? (n = 'forums/update', a = {
data: {
forum: r.forum.shortname
},
method: 'POST'
}) : r.type === ft.organization && (n = 'organizations/campaigns/details', a = {
data: {
campaign: o,
organization: r.organization.id
}
}),
io.a.call(n, a).done(function (e) {
t({
type: G.onFetch,
response: e.response,
selection: r
})
}).fail(function () {
t({
type: G.onError
})
})
}
},
fetchForumDetails: ig
}, Ru)) (Ni.a.attachDrivers(Yc, [
sl
]));
function hP(e) {
return (hP = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function gP(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function yP(e, t) {
return (yP = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function bP(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = vP(n);
return e = a ? (e = vP(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== hP(e) && 'function' != typeof e ? function (e) {
if (void 0 !== e) return e;
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called')
}(t) : e
}
}
function vP(e) {
return (vP = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function _P(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Ls = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && yP(e, t)
}(r, A);
var e,
t,
n,
a = bP(r);
function r() {
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
a.apply(this, arguments)
}
return e = r,
(t = [
{
key: 'render',
value: function () {
var e = this.props.selection.type === ft.global ? C.a.createElement('div', {
className: 'start__icon -larger icon-group'
}) : this.props.isLoading ? C.a.createElement('div', {
className: 'start-stats__loading-wrapper'
}, C.a.createElement('div', {
className: 'spinner'
})) : C.a.createElement('div', null, C.a.createElement('div', {
className: 'start-stats__metric'
}, (this.props.data || 0).toLocaleString()), C.a.createElement('div', {
className: 'start-stats__label'
}, 'Total Active Polls'));
return C.a.createElement('div', {
className: 'start-stats__block align__item--grow'
}, C.a.createElement(Uo, {
path: '/polls/list/',
selection: this.props.selection,
linkClassName: 'start-stats__content -moderate'
}, e, C.a.createElement('button', {
className: 'button button-large button-padding-wide button-wide--mobile button-outline'
}, 'View Polls')))
}
}
]) && gP(e.prototype, t),
n && gP(e, n),
r
}();
_P(Ls, 'displayName', 'StartActivePollsButton'),
_P(Ls, 'propTypes', {
selection: ht.isRequired,
data: b.a.number,
isLoading: b.a.bool
});
function EP() {
return ct.a.utc().startOf('day')
}
var OP = Ls;
function SP(e) {
return (SP = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function wP(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function PP(e, t) {
return (PP = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function kP(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = NP(n);
return e = a ? (e = NP(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== SP(e) && 'function' != typeof e ? function (e) {
if (void 0 !== e) return e;
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called')
}(t) : e
}
}
function NP(e) {
return (NP = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function CP(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
i = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && PP(e, t)
}(r, A);
var e,
t,
n,
a = kP(r);
function r() {
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
a.apply(this, arguments)
}
return e = r,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.selection.type !== ft.global && this.props.fetchCommentCounts()
}
},
{
key: 'render',
value: function () {
var e;
return e = this.props.selection.type === ft.global ? C.a.createElement('div', {
className: 'start__icon -larger icon-graph'
}) : this.props.commentCounts ? (e = je.a.reduce(this.props.commentCounts, function (e, t) {
return e + t[1]
}, 0), C.a.createElement('div', null, C.a.createElement('div', {
className: 'start-stats__metric'
}, e.toLocaleString()), C.a.createElement('div', {
className: 'start-stats__label'
}, 'Comments This Week'))) : C.a.createElement('div', {
className: 'start-stats__loading-wrapper'
}, C.a.createElement('div', {
className: 'spinner'
})),
C.a.createElement('div', {
className: 'start-stats__block align__item--grow'
}, C.a.createElement(ri, {
path: '/analytics/comments/',
selection: this.props.selection,
linkClassName: 'start-stats__content -moderate'
}, e, C.a.createElement('button', {
className: 'button button-large button-padding-wide button-wide--mobile button-outline'
}, 'Analyze Engagement')))
}
}
]) && wP(e.prototype, t),
n && wP(e, n),
r
}();
CP(i, 'displayName', 'StartEngagementButton'),
CP(i, 'propTypes', {
selection: ht.isRequired,
commentCounts: b.a.array
});
function RP(e) {
return 1 === e ? 'One comment' : ''.concat(e, ' comments')
}
var xP = Object(u.connect) (function (e) {
return {
commentCounts: e.commentCounts.commentCounts,
selection: e.selection
}
}, {
fetchCommentCounts: function () {
return function (t, e) {
var n,
a = e().selection,
r = ct() (EP()).subtract(1, 'week'),
e = EP(),
e = {
start: r.toISOString(),
end: e.toISOString()
};
return a.type === ft.organization ? (e.organization = a.organization.id, n = 'organizations/admin/reports/interactionReport') : a.type === ft.forum && (e.forum = a.forum.shortname, n = 'forums/admin/reports/interactionReport'),
io.a.call(n, {
data: e
}).done(function (e) {
t({
type: V.onFetch,
response: e.response
})
})
}
}
}) (i),
AP = 'default_moderation_time',
DP = [
{
key: 'day',
label: 'Past Day'
},
{
key: 'week',
label: 'Past Week'
},
{
key: 'month',
label: 'Past Month'
},
{
key: 'year',
label: 'Past Year'
},
{
key: 'all',
label: 'All Time'
},
{
key: 'custom',
label: 'Custom'
}
],
jP = {
maxDate: ct() ().endOf('day'),
minDate: ct() ('01 01 2007', 'MM DD YYYY').startOf('day')
},
TP = 2000,
IP = {
all: [
'approved',
'unapproved',
'spam',
'deleted'
],
approved: 'approved',
pending: [
'unapproved',
'flagged'
],
spam: 'spam',
deleted: 'deleted'
},
qP = 'default_moderation_order',
FP = [
{
key: 'desc',
label: 'Newest'
},
{
key: 'asc',
label: 'Oldest'
},
{
key: 'worst',
label: 'Priority'
}
],
LP = Is.a.get(AP);
'custom' !== LP && je.a.find(DP, function (e) {
return e.key === LP
}) || (LP = 'year');
var UP = Is.a.get(qP),
MP = {
page: 'pending',
perPage: 25,
expandComments: !1,
fetchSize: 25,
lang: 'en',
sortOrder: UP = !je.a.find(FP, function (e) {
return e.key === UP
}) ? 'desc' : UP,
startDate: 'all' === LP ? jP.minDate : ct() ().startOf('day').subtract(1, LP),
endDate: ct() ().endOf('day')
},
BP = {
approve: {
apiPath: 'posts/approve',
status: 'approved',
successMessage: function (e) {
return ''.concat(RP(e), ' approved')
}
},
unapprove: {
apiPath: 'posts/unapprove',
status: 'unapproved',
successMessage: function (e) {
return ''.concat(RP(e), ' unapproved')
}
},
spam: {
apiPath: 'posts/spam',
status: 'spam',
successMessage: function (e) {
return ''.concat(RP(e), ' marked as spam')
}
},
delete : {
apiPath: 'posts/remove',
status: 'deleted',
successMessage: function (e) {
return ''.concat(RP(e), ' deleted')
}
}
},
zP = je.a.chain(BP).map(function (e, t) {
return [e.status,
t]
}).object().value(),
HP = {
']': {
callbackName: 'tabOver',
callbackArgs: [
1
]
},
'[': {
callbackName: 'tabOver',
callbackArgs: [
- 1
]
},
1: {
callbackName: 'tab',
callbackArgs: [
0
]
},
2: {
callbackName: 'tab',
callbackArgs: [
1
]
},
3: {
callbackName: 'tab',
callbackArgs: [
2
]
},
4: {
callbackName: 'tab',
callbackArgs: [
3
]
},
5: {
callbackName: 'tab',
callbackArgs: [
4
]
},
j: 'activateNextPost',
k: 'activatePreviousPost',
n: 'fetchMorePosts',
p: 'prevPage',
'/': 'focusSearch',
x: 'toggleActivePostChecked',
a: 'markCheckedPostsApproved',
s: 'markCheckedPostsSpam',
d: 'markCheckedPostsTrash',
z: 'undoAction',
o: 'toggleActivePostPanelVisible',
'?': 'toggleHelpVisible',
R: 'refreshCurrentPage',
Esc: {
callbackName: 'removeFocus',
options: {
exclude: [
]
}
}
};
je.a.extend(HP, {
'{': HP['['],
'}': HP[']'],
'>': HP.n,
'<': HP.p,
b: HP.p,
'!': HP.s,
'#': HP.d,
'.': HP.o,
Enter: HP.o
});
var GP = {
r: 'startReplyHotkey',
e: 'startEditHotkey',
Esc: 'removeFocus'
},
VP = {
posts: {
approve: {
text: 'Approve',
icon: 'checkmark'
},
unapprove: {
text: 'Mark Post as Pending',
icon: 'spam'
},
delete : {
text: 'Delete',
icon: 'delete'
},
spam: {
text: 'Mark as Spam',
icon: 'spam'
}
},
users: {
permaban: {
text: 'Ban Author',
banType: Wn.BAN_TYPES.PERMANENT
},
tempban: {
text: 'Timeout Author',
banType: Wn.BAN_TYPES.TEMP
},
shadowban: {
text: 'Shadowban Author',
banType: Wn.BAN_TYPES.SHADOW
}
}
},
WP = {
approve: 'icon-checkmark',
approved: 'icon-checkmark',
spam: 'icon-spam',
delete : 'icon-delete',
deleted: 'icon-delete',
pending: 'icon-pending'
},
Qs = {
forum: b.a.object.isRequired,
thread: b.a.object.isRequired,
id: b.a.string.isRequired,
url: b.a.string.isRequired,
author: b.a.object.isRequired,
ipAddress: b.a.string,
isDeletedByAuthor: b.a.bool.isRequired,
message: b.a.string.isRequired,
modMessage: b.a.string.isRequired,
media: b.a.array.isRequired,
createdAt: b.a.string.isRequired,
editableUntil: b.a.string.isRequired,
likes: b.a.number.isRequired,
dislikes: b.a.number.isRequired,
userScore: b.a.number.isRequired,
raw_message: b.a.string.isRequired,
moderationLabels: b.a.arrayOf(b.a.string).isRequired,
numReports: b.a.number.isRequired,
shadowBanned: b.a.bool,
child: b.a.object,
isFlagged: b.a.bool,
isApproved: b.a.bool,
isHighlighted: b.a.bool,
flaggers: b.a.arrayOf(b.a.shape({
name: b.a.string.isRequired,
username: b.a.string.isRequired,
profileUrl: b.a.string.isRequired
})),
rule: b.a.object,
isNewUserNeedsApproval: b.a.bool
},
YP = Object.keys(window._v5Config.moderated_forums.reduce(function (e, t) {
return e[window._v5Config.forums[t].organization] = !0,
e
}, {
})).some(function (e) {
return yo.a.isFeatureActive('suggested_actions', {
organization: e
})
}),
QP = {
approveModalIsOpen: !1,
approveModalPostId: null,
approveModalAuthor: null
};
function KP(e) {
return (KP = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function JP(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function $P(e, t) {
return ($P = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function ZP(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = ek(n);
return e = a ? (e = ek(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== KP(e) && 'function' != typeof e ? XP(t) : e
}
}
function XP(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function ek(e) {
return (ek = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function tk(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Mo = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && $P(e, t)
}(o, A);
var e,
t,
n,
r = ZP(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return tk(XP(t = r.call.apply(r, [
this
].concat(n))), 'state', {
pendingCounts: {
total: 0,
hasBadWords: 0,
hasLinks: 0,
hasLowRep: 0,
isFlagged: 0,
isAtFlagLimit: 0,
isAnonymous: 0,
isToxic: 0,
hasMedia: 0
},
isFetching: !1
}),
tk(XP(t), 'fetchData', function (e) {
e = e || {
},
t.setState({
isFetching: !0
}),
t.props.selection.type === ft.forum && (e.forum = t.props.selection.forum.shortname),
t.apiCall = io.a.call('posts/countPending', {
data: e
}).done(t.onFetch)
}),
tk(XP(t), 'onFetch', function (e) {
e = e.response;
e && t.setState({
pendingCounts: e,
isFetching: !1
})
}),
tk(XP(t), 'getComponentProps', function () {
return {
pendingCounts: t.state.pendingCounts,
refreshPendingCommentsCount: t.fetchData,
pendingCountsIsFetching: t.state.isFetching
}
}),
t
}
return e = o,
(t = [
{
key: 'componentWillUnmount',
value: function () {
this.apiCall && 'pending' === this.apiCall.state() && this.apiCall.abort()
}
}
]) && JP(e.prototype, t),
n && JP(e, n),
o
}();
tk(Mo, 'displayName', 'PendingCommentsCountDriver'),
tk(Mo, 'propTypes', {
selection: ht.isRequired
});
go = Object(ki.createDriver) (Mo);
function nk(e) {
return (nk = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function ak(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function rk(e, t) {
return (rk = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function ok(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = ik(n);
return e = a ? (e = ik(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== nk(e) && 'function' != typeof e ? function (e) {
if (void 0 !== e) return e;
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called')
}(t) : e
}
}
function ik(e) {
return (ik = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function sk(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
yl = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && rk(e, t)
}(r, A);
var e,
t,
n,
a = ok(r);
function r() {
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
a.apply(this, arguments)
}
return e = r,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.refreshPendingCommentsCount({
start: MP.startDate.toISOString(),
end: MP.endDate.toISOString()
})
}
},
{
key: 'render',
value: function () {
var e = this.props.selection.type === ft.global ? C.a.createElement('div', {
className: 'start__icon -larger icon-moderate'
}) : this.props.pendingCountsIsFetching ? C.a.createElement('div', {
className: 'start-stats__loading-wrapper'
}, C.a.createElement('div', {
className: 'spinner'
})) : C.a.createElement('div', null, C.a.createElement('div', {
className: 'start-stats__metric'
}, TP <= this.props.pendingCounts.total ? ''.concat(TP.toLocaleString(), '+') : this.props.pendingCounts.total.toLocaleString()), C.a.createElement('div', {
className: 'start-stats__label'
}, 'Pending Comments For All Sites'));
return C.a.createElement('div', {
className: 'start-stats__block align__item--grow'
}, C.a.createElement(v.Link, {
to: ho.getRoute('/moderate/'),
className: 'start-stats__content -moderate'
}, e, C.a.createElement('button', {
className: 'button button-large button-padding-wide button-wide--mobile button-outline'
}, 'Moderate Comments')))
}
}
]) && ak(e.prototype, t),
n && ak(e, n),
r
}();
sk(yl, 'displayName', 'StartModerateButton'),
sk(yl, 'propTypes', {
pendingCountsIsFetching: b.a.bool.isRequired,
pendingCounts: b.a.shape({
total: b.a.number
}),
refreshPendingCommentsCount: b.a.func.isRequired,
selection: ht.isRequired
});
var lk = Ni.a.attachDrivers(yl, [
go
]);
function ck(e) {
return (ck = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function uk(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function pk(e, t) {
return (pk = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function dk(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = mk(n);
return e = a ? (e = mk(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== ck(e) && 'function' != typeof e ? function (e) {
if (void 0 !== e) return e;
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called')
}(t) : e
}
}
function mk(e) {
return (mk = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function fk(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
h = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && pk(e, t)
}(r, A);
var e,
t,
n,
a = dk(r);
function r() {
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
a.apply(this, arguments)
}
return e = r,
(t = [
{
key: 'render',
value: function () {
var e = this.props.selection.type === ft.global ? C.a.createElement('div', {
className: 'start__icon -larger icon-graph'
}) : this.props.isLoading ? C.a.createElement('div', {
className: 'start-stats__loading-wrapper'
}, C.a.createElement('div', {
className: 'spinner'
})) : C.a.createElement('div', null, C.a.createElement('div', {
className: 'start-stats__metric'
}, (this.props.data || 0).toLocaleString()), C.a.createElement('div', {
className: 'start-stats__label'
}, 'Total Respondents'));
return C.a.createElement('div', {
className: 'start-stats__block align__item--grow'
}, C.a.createElement(Uo, {
path: '/polls/insights/',
selection: this.props.selection,
linkClassName: 'start-stats__content -moderate'
}, e, C.a.createElement('button', {
className: 'button button-large button-padding-wide button-wide--mobile button-outline'
}, 'View ', this.props.selection.type === ft.global || this.props.selection.type === ft.organization ? 'Poll' : '', ' Insights')))
}
}
]) && uk(e.prototype, t),
n && uk(e, n),
r
}();
fk(h, 'displayName', 'StartPollsRespondentsButton'),
fk(h, 'propTypes', {
selection: ht.isRequired,
data: b.a.number,
isLoading: b.a.bool
});
var hk = h;
function gk(e) {
return (gk = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function yk(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function bk(e, t) {
return (bk = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function vk(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = _k(n);
return e = a ? (e = _k(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== gk(e) && 'function' != typeof e ? function (e) {
if (void 0 !== e) return e;
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called')
}(t) : e
}
}
function _k(e) {
return (_k = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function Ek(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Ru = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && bk(e, t)
}(r, A);
var e,
t,
n,
a = vk(r);
function r() {
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
a.apply(this, arguments)
}
return e = r,
(t = [
{
key: 'render',
value: function () {
var e = this.props.selection.type === ft.global ? C.a.createElement('div', {
className: 'start__icon -larger icon-graph'
}) : this.props.isLoading ? C.a.createElement('div', {
className: 'start-stats__loading-wrapper'
}, C.a.createElement('div', {
className: 'spinner'
})) : C.a.createElement('div', null, C.a.createElement('div', {
className: 'start-stats__metric'
}, (this.props.data || 0).toLocaleString(void 0, {
style: 'percent',
minimumFractionDigits: 2
})), C.a.createElement('div', {
className: 'start-stats__label'
}, 'Avg. Overall Response Rate'));
return C.a.createElement('div', {
className: 'start-stats__block align__item--grow'
}, C.a.createElement(Uo, {
path: '/polls/insights/',
selection: this.props.selection,
linkClassName: 'start-stats__content -moderate'
}, e, C.a.createElement('button', {
className: 'button button-large button-padding-wide button-wide--mobile button-outline'
}, 'View ', this.props.selection.type === ft.global || this.props.selection.type === ft.organization ? 'Poll' : '', ' Insights')))
}
}
]) && yk(e.prototype, t),
n && yk(e, n),
r
}();
Ek(Ru, 'displayName', 'StartPollsResponseRateButton'),
Ek(Ru, 'propTypes', {
selection: ht.isRequired,
data: b.a.number,
isLoading: b.a.bool
});
var Ok = Ru;
function Sk(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function wk(a) {
for (var e = 1; e < arguments.length; e++) {
var r = null != arguments[e] ? arguments[e] : {
};
e % 2 ? Sk(Object(r), !0).forEach(function (e) {
var t,
n;
n = r[t = e],
t in (e = a) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(r)) : Sk(Object(r)).forEach(function (e) {
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(r, e))
})
}
return a
}
function Pk() {
return ct.a.utc().startOf('day')
}
function kk(e) {
return (kk = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function Nk(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function Ck(e, t) {
return (Ck = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function Rk(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = Ak(n);
return e = a ? (e = Ak(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== kk(e) && 'function' != typeof e ? xk(t) : e
}
}
function xk(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function Ak(e) {
return (Ak = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function Dk(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Yc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && Ck(e, t)
}(o, A);
var e,
t,
n,
r = Rk(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return Dk(xk(t = r.call.apply(r, [
this
].concat(n))), 'orgHasActiveGuarantee', function () {
return t.props.selection.organization && t.props.selection.organization.activeGuarantee
}),
Dk(xk(t), 'getMetric', function () {
if (t.orgHasActiveGuarantee()) return ct() (t.props.selection.organization.activeGuarantee.end).utc().diff(ct.a.utc(), 'days');
var e = t.props.earnings ? t.props.earnings.reduce(function (e, t) {
return e + t.earnings
}, 0) : 0;
return '$'.concat(e.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,'))
}),
Dk(xk(t), 'getLabel', function () {
return t.orgHasActiveGuarantee() ? 'Days Left of Reveal Promotional Period' : 'Revenue this week'
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.fetchEarningsData()
}
},
{
key: 'render',
value: function () {
var e = '/analytics/revenue/',
t = 'start-stats__content -revenue',
n = this.props.selection.isRevealVisible ? this.props.selection.type === ft.global ? C.a.createElement('div', {
className: 'start__icon -larger icon-revenue'
}) : this.props.earnings || this.orgHasActiveGuarantee() ? C.a.createElement('div', null, C.a.createElement('div', {
className: 'start-stats__metric'
}, this.getMetric()), C.a.createElement('div', {
className: 'start-stats__label'
}, this.getLabel())) : C.a.createElement('div', {
className: 'start-stats__loading-wrapper'
}, C.a.createElement('div', {
className: 'spinner'
})) : (e = 'https://publishers.disqus.com/reveal/', t += ' inactive', C.a.createElement('div', null, C.a.createElement('div', {
className: 'start-stats__metric'
}, '$0.00'), C.a.createElement('div', {
className: 'start-stats__label'
}, 'Reveal is not enabled. Monetize your content with Reveal.')));
return C.a.createElement('div', {
className: 'start-stats__block align__item--grow'
}, this.props.selection.isRevealVisible ? C.a.createElement(ri, {
path: e,
linkClassName: t,
selection: this.props.selection
}, n, C.a.createElement('button', {
className: 'button button-large button-padding-wide button-wide--mobile button-outline'
}, 'Analyze Revenue')) : C.a.createElement('a', {
href: e,
className: t
}, n, C.a.createElement('button', {
className: 'button button-large button-padding-wide button-wide--mobile button-outline text-gray -border-muted'
}, 'Learn More')))
}
}
]) && Nk(e.prototype, t),
n && Nk(e, n),
o
}();
Dk(Yc, 'propTypes', {
earnings: b.a.array,
selection: ht.isRequired
});
var jk = Object(u.connect) (function (e) {
return {
earnings: e.earnings.earnings,
selection: e.selection
}
}, {
fetchEarningsData: function () {
return function (t, e) {
var n = e().selection;
if (n && n.isRevealVisible && n.type !== ft.global && (n.type !== ft.organization || !n.organization.activeGuarantee)) {
var a,
e = {
start: ct() (Pk()).subtract(1, 'week'),
end: Pk()
};
return n.type === ft.organization ? (e.organization = n.organization.id, a = 'organizationRevealStats') : n.type === ft.forum && (e.forum = n.forum.shortname, a = 'revealStats'),
io.a.call('discovery/reports/'.concat(a), {
data: e
}).done(function (e) {
return t(wk({
type: Y.onFetch
}, e.response))
})
}
}
}
}) (Yc);
function Tk(e) {
return (Tk = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function Ik(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function qk(e, t) {
return (qk = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function Fk(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = Lk(n);
return e = a ? (e = Lk(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== Tk(e) && 'function' != typeof e ? function (e) {
if (void 0 !== e) return e;
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called')
}(t) : e
}
}
function Lk(e) {
return (Lk = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function Uk(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
sl = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && qk(e, t)
}(r, A);
var e,
t,
n,
a = Fk(r);
function r() {
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
a.apply(this, arguments)
}
return e = r,
(t = [
{
key: 'render',
value: function () {
return C.a.createElement('div', {
className: 'resubscribe content__wrap align align--column align--middle align--center'
}, C.a.createElement('img', {
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/astronauts.svg',
className: 'astronauts'
}), C.a.createElement('div', {
className: 'resubscribe'
}, 'Don\'t miss out — re-subscribe now to regain full access to Polls and continue engaging your audiences.'), this.props.organization ? C.a.createElement(Us, {
path: '/settings/subscription/',
orgId: this.props.organization.id,
orgSlug: this.props.organization.slug,
linkClassName: 'button button-fill--brand button-padding-wider text-medium'
}, 'Re-Subscribe') : C.a.createElement(v.Link, {
to: '/settings/subscription',
className: 'button button-fill--brand button-padding-wider text-medium'
}, 'Re-Subscribe'))
}
}
]) && Ik(e.prototype, t),
n && Ik(e, n),
r
}();
Uk(sl, 'displayName', 'Resubscribe'),
Uk(sl, 'propTypes', {
organization: b.a.shape({
id: b.a.number.isRequired,
slug: b.a.string.isRequired
})
});
var Mk = sl;
function Bk(e) {
return (Bk = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function zk(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function Hk(e, t) {
return (Hk = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function Gk(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = Wk(n);
return e = a ? (e = Wk(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== Bk(e) && 'function' != typeof e ? Vk(t) : e
}
}
function Vk(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function Wk(e) {
return (Wk = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function Yk(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Ls = {
zone: 'welcome'
},
i = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && Hk(e, t)
}(o, A);
var e,
t,
n,
r = Gk(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return Yk(Vk(t = r.call.apply(r, [
this
].concat(n))), 'state', {
showVerifiedAlert: !!fE() ().email_verified
}),
Yk(Vk(t), 'handleDismissVerification', function () {
t.setState({
showVerifiedAlert: !1
})
}),
Yk(Vk(t), 'handleClickEvent', function (e) {
t.props.emitTrackingEvent({
verb: 'click',
object_type: 'section',
object_id: e
})
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
yo.a.isFeatureActive('polls_pub_admin') && (this.props.selection.type === ft.forum && this.props.fetchPollForumStats(), this.props.selection.type === ft.organization && this.props.fetchPollOrgStats())
}
},
{
key: 'render',
value: function () {
var e,
t,
n,
a = this;
this.props.selection.organization ? (r = this.props.selection.organization.pollsActivationDate, t = Ur.SAAS_PRODUCT_PLAN_ACTIVE_STATUSES_SET.has(this.props.selection.organization.pollsSubscriptionStatus), n = !this.props.selection.organization.pollsOnly) : window._v5Config && window._v5Config.organizations && (t = r = (e = Object.values(window._v5Config.organizations)).some(function (e) {
return e.pollsActivationDate
}), n = e.some(function (e) {
return !e.pollsOnly
}));
var r = r && !t && !n;
return C.a.createElement('div', {
className: 'admin-layout admin-home'
}, C.a.createElement('div', {
className: 'layout section-contained'
}, C.a.createElement('div', {
className: 'layout__content'
}, this.state.showVerifiedAlert ? C.a.createElement(Ki, {
alertType: 'success',
message: C.a.createElement('strong', null, 'Your email has been verified successfully!'),
onRequestClose: this.handleDismissVerification
}) : null, C.a.createElement('div', {
className: 'box clearfix'
}, C.a.createElement('div', {
className: 'text-gray-darker align-min-tablet align--between spacing-bottom'
}, C.a.createElement('div', {
className: 'spacing-narrow start-welcome__intro'
}, C.a.createElement(o.Intro, {
selection: this.props.selection,
forums: this.props.forums,
user: this.props.user
})), this.props.selection.isSettingsVisible ? C.a.createElement('div', {
className: 'spacing-narrow start-welcome__link'
}, C.a.createElement(Uo, {
path: '/settings/general/',
selection: this.props.selection
}, 'Edit Settings')) : null), !yo.a.isFeatureActive('polls_pub_admin') && C.a.createElement(C.a.Fragment, null, C.a.createElement('div', {
className: 'start-stats__wrapper'
}, C.a.createElement(lk, {
selection: this.props.selection
}), C.a.createElement(xP, {
selection: this.props.selection
}), this.props.selection.isRevealVisible ? C.a.createElement(jk, {
selection: this.props.selection,
forums: this.props.forums
}) : null), C.a.createElement('div', {
className: 'start-help'
}, C.a.createElement('div', {
className: 'start-help__block'
}, C.a.createElement(v.Link, {
to: '/install/',
onClick: function () {
return a.handleClickEvent('platform_list')
}
}, C.a.createElement('div', {
className: 'start__icon -large icon icon-install'
}), 'Installing Disqus', C.a.createElement('span', {
className: 'start__icon -right-bracket icon-right-bracket'
}))), C.a.createElement(o.SecondaryButton, {
id: 'disqus',
url: 'https://about.disqus.com/disqus-101',
label: 'Disqus 101'
}), C.a.createElement(o.SecondaryButton, {
id: 'flag-tilted',
url: 'https://help.disqus.com/customer/portal/articles/466238',
label: 'Moderating your community'
}), C.a.createElement(o.SecondaryButton, {
id: 'conversation',
url: Pn.contactSupport,
label: 'Need Help?'
}))), yo.a.isFeatureActive('polls_pub_admin') && n && C.a.createElement('div', {
className: 'start-stats__wrapper'
}, C.a.createElement(lk, {
selection: this.props.selection
}), C.a.createElement(xP, {
selection: this.props.selection
}), this.props.selection.isRevealVisible ? C.a.createElement(jk, {
selection: this.props.selection,
forums: this.props.forums
}) : null), yo.a.isFeatureActive('polls_pub_admin') && t && C.a.createElement('div', {
className: 'start-stats__wrapper'
}, C.a.createElement(OP, {
data: this.props.pollStats && this.props.pollStats.activePolls,
selection: this.props.selection,
isLoading: this.props.pollStatsIsFetching
}), C.a.createElement(hk, {
data: this.props.pollStats && this.props.pollStats.respondents,
selection: this.props.selection,
isLoading: this.props.pollStatsIsFetching
}), C.a.createElement(Ok, {
data: this.props.pollStats && this.props.pollStats.responseRate,
selection: this.props.selection,
isLoading: this.props.pollStatsIsFetching
}), this.props.selection.isRevealVisible && !n ? C.a.createElement(jk, {
selection: this.props.selection,
forums: this.props.forums
}) : null), yo.a.isFeatureActive('polls_pub_admin') && r && C.a.createElement(Mk, {
organization: this.props.selection.organization
})))))
}
}
]) && zk(e.prototype, t),
n && zk(e, n),
o
}();
Yk(i, 'propTypes', {
forums: b.a.object.isRequired,
selection: ht.isRequired,
user: b.a.shape({
name: b.a.string
}),
emitTrackingEvent: b.a.func.isRequired,
emitDefaultViewEvent: b.a.func.isRequired,
pollStats: b.a.shape({
activePolls: b.a.number,
respondents: b.a.number,
responseRate: b.a.number
}).isRequired,
fetchPollForumStats: b.a.func.isRequired,
fetchPollOrgStats: b.a.func.isRequired
}),
i.Intro = function (e) {
var t = e.selection,
t = t.type === ft.organization ? ''.concat(t.organization.name || 'your organization', '.') : t.type === ft.forum ? ''.concat(t.forum.name || t.forum.shortname, '.') : C.a.createElement('span', null, 'your ', Object.keys(e.forums).length, ' sites. ', C.a.createElement(bO, {
path: '/'
}, 'Select a specific site.'));
return C.a.createElement('div', null, C.a.createElement('strong', null, 'Hey', e.user ? ' '.concat(e.user.name) : null, ', check out what\'s been happening on ', t))
},
i.Intro.displayName = 'StartIntro',
i.Intro.propTypes = {
forums: b.a.object.isRequired,
selection: ht.isRequired,
user: b.a.shape({
name: b.a.string
})
},
i.SecondaryButton = function (e) {
return C.a.createElement('div', {
className: 'start-help__block'
}, C.a.createElement('a', {
href: e.url
}, C.a.createElement('div', {
className: 'start__icon -large icon icon-'.concat(e.id)
}), e.label, C.a.createElement('span', {
className: 'start__icon -right-bracket icon-right-bracket'
})))
},
i.SecondaryButton.displayName = 'StartSecondaryButton',
i.SecondaryButton.propTypes = {
url: b.a.string.isRequired,
id: b.a.string.isRequired,
label: b.a.string.isRequired
};
Mo = Object(u.connect) (function (e) {
var t = e.pollStats;
return {
selection: e.selection,
pollStats: t.pollStats,
pollStatsIsFetching: t.isFetching,
subscription: e.subscription
}
}, {
emitTrackingEvent: Xo(Ls),
emitDefaultViewEvent: ei(Ls),
fetchPollForumStats: function () {
return function (t, e) {
e = e().selection;
return t({
type: pe.isFetching
}),
io.a.call('polls/overviewForum', {
data: {
forum: e.forum.shortname
}
}).done(function (e) {
t({
type: pe.onFetch,
response: e.response
})
})
}
},
fetchPollOrgStats: function () {
return function (t, e) {
e = e().selection;
return t({
type: pe.isFetching
}),
io.a.call('polls/overviewOrg', {
data: {
organization: e.organization.id
}
}).done(function (e) {
t({
type: pe.onFetch,
response: e.response
})
})
}
}
}) (Ni.a.attachDrivers(i, [
rc
]));
function Qk(e) {
return (Qk = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function Kk(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function Jk(e, t) {
return (Jk = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function $k(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = Xk(n);
return e = a ? (e = Xk(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== Qk(e) && 'function' != typeof e ? Zk(t) : e
}
}
function Zk(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function Xk(e) {
return (Xk = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function eN(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
yl = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && Jk(e, t)
}(o, A);
var e,
t,
n,
r = $k(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return eN(Zk(e = r.call.apply(r, [
this
].concat(n))), 'handleDismiss', function () {
Is.a.set('engageFeaturedMessage', !0),
e.setState({
engageFeaturedMessage: !0
})
}),
e
}
return e = o,
(t = [
{
key: 'render',
value: function () {
return Is.a.get('engageFeaturedMessage') ? null : C.a.createElement('div', {
className: 'content__wrap padding-small text-center'
}, C.a.createElement('img', {
className: 'img-responsive',
width: '120',
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/logos/logo-engage-black.png'
}), C.a.createElement('p', {
className: 'text-large spacing-bottom'
}, C.a.createElement('strong', null, 'Commenting platform for publishers')), C.a.createElement('p', {
className: 'text-medium spacing-narrow'
}, 'As you start to build a community, you may have questions on how to moderate or how to get started.'), C.a.createElement('a', {
href: 'https://disqus.com/features/',
className: 'button button-fill--brand text-medium spacing-narrow spacing-right'
}, 'Learn More'), C.a.createElement('button', {
className: 'button button-fill--brand text-medium spacing-narrow spacing-right',
onClick: this.handleDismiss
}, 'Dismiss'))
}
}
]) && Kk(e.prototype, t),
n && Kk(e, n),
o
}();
eN(yl, 'displayName', 'EngageFeaturedMessage');
h = yl;
function tN(e) {
return (tN = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function nN(e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}
function aN(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function rN(e, t, n) {
return t && aN(e.prototype, t),
n && aN(e, n),
e
}
function oN(e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && iN(e, t)
}
function iN(e, t) {
return (iN = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function sN(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = cN(n);
return e = a ? (e = cN(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== tN(e) && 'function' != typeof e ? lN(t) : e
}
}
function lN(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function cN(e) {
return (cN = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function uN(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var pN = Object(u.connect) (null, {
emitTrackingEvent: Xo({
zone: 'moderation_panel',
area: 'suggested_action_sidebar',
section: 'welcome',
product: 'publisher_admin'
})
}) (Ni.a.attachDrivers((Yc = Ru = function () {
oN(o, A);
var r = sN(o);
function o() {
var t;
nN(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return uN(lN(t = r.call.apply(r, [
this
].concat(n))), 'trackButtonClick', function (e) {
t.props.emitTrackingEvent({
verb: 'click',
object_type: 'button',
object_id: e
})
}),
t
}
return rN(o, [
{
key: 'render',
value: function () {
return this.props.selection.organization && this.props.selection.organization.pollsOnly ? null : C.a.createElement(C.a.Fragment, null, C.a.createElement('span', {
className: 'text-larger text-semibold'
}, 'Suggested actions are new to the moderation panel! Here are the basics:'), C.a.createElement('div', {
className: 'suggested-actions__module'
}, C.a.createElement('div', {
className: 'spacing-narrow spacing-bottom'
}, C.a.createElement('ul', {
className: 'suggested-actions__list'
}, C.a.createElement('li', {
className: 'suggested-actions__item'
}, C.a.createElement('span', {
className: 'icon-lightning'
}), C.a.createElement('span', {
className: 'text'
}, 'Suggested actions were made to help you moderate faster and more consistently.')), C.a.createElement('li', {
className: 'suggested-actions__item'
}, C.a.createElement('span', {
className: 'icon-lightning'
}), C.a.createElement('span', {
className: 'text'
}, 'If you take a different action than the suggestion, we\'ll use that information to improve our algorithm.')), C.a.createElement('li', {
className: 'suggested-actions__item'
}, C.a.createElement('span', {
className: 'icon-lightning'
}), C.a.createElement('span', {
className: 'text'
}, 'You can select multiple comments and accept all the suggested actions at once.')))), C.a.createElement('a', {
href: 'https://www.surveymonkey.com/r/8LWBQS3'.concat(this.props.user ? '?username='.concat(this.props.user.username) : ''),
className: 'button button-large button-fill--white text-medium spacing-narrow spacing-right',
target: '_blank',
rel: 'noopener noreferrer',
onClick: this.trackButtonClick.bind(null, 'leave_us_feedback')
}, 'Leave us Feedback'), C.a.createElement('a', {
href: Pn.suggestedActions,
className: 'button button-large button-fill--brand text-medium spacing-narrow spacing-right',
target: '_blank',
rel: 'noopener noreferrer',
onClick: this.trackButtonClick.bind(null, 'learn_more')
}, 'Learn more'), C.a.createElement('button', {
className: 'button button-large button-fill--brand text-medium spacing-narrow',
target: '_blank',
rel: 'noopener noreferrer',
onClick: this.props.handleDismiss
}, 'Dismiss')))
}
}
]),
o
}(), uN(Ru, 'propTypes', {
emitTrackingEvent: b.a.func.isRequired,
user: b.a.shape({
username: b.a.string
}),
handleDismiss: b.a.func.isRequired
}), Yc), [
rc
])),
dN = Object(u.connect) (null, {
emitTrackingEvent: Xo({
zone: 'moderation_panel',
area: 'moderation_rules_sidebar',
section: 'welcome',
product: 'publisher_admin'
}),
addIntercomScript: D,
intercomInitWithUser: I,
removeIntercomScript: F
}) (Ni.a.attachDrivers((Ls = sl = function () {
oN(o, A);
var r = sN(o);
function o() {
var t;
nN(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return uN(lN(t = r.call.apply(r, [
this
].concat(n))), 'componentWillMount', function () {
t.props.addIntercomScript()
}),
uN(lN(t), 'componentWillUnmount', function () {
t.props.removeIntercomScript()
}),
uN(lN(t), 'handleIntercomClick', function (e) {
t.trackButtonClick(e),
t.props.intercomInitWithUser(t.props.user)
}),
uN(lN(t), 'trackButtonClick', function (e) {
t.props.emitTrackingEvent({
verb: 'click',
object_type: 'button',
object_id: e
})
}),
t
}
return rN(o, [
{
key: 'render',
value: function () {
return this.props.selection.organization && this.props.selection.organization.pollsOnly ? null : C.a.createElement(C.a.Fragment, null, C.a.createElement('span', {
className: 'text-larger text-semibold'
}, 'Moderation rules have been added to the moderation panel!'), C.a.createElement('div', {
className: 'suggested-actions__module'
}, C.a.createElement('div', {
className: 'spacing-narrow spacing-bottom'
}, C.a.createElement('ul', {
className: 'suggested-actions__list'
}, C.a.createElement('li', {
className: 'moderation-rules__item'
}, C.a.createElement('span', {
className: 'icon-lightning'
}), C.a.createElement('span', {
className: 'text'
}, 'Moderation rules were made to help you moderate more efficiently while maintaining your moderation preferences.')), C.a.createElement('li', {
className: 'moderation-rules__item'
}, C.a.createElement('span', {
className: 'icon-lightning'
}), C.a.createElement('span', {
className: 'text'
}, 'Comments affected by a moderation rule will be marked with a reason like:', C.a.createElement('br', null), C.a.createElement('span', {
className: 'icon-pending'
}), C.a.createElement('strong', null, ' In Pending'), ' ', 'because ', C.a.createElement('strong', null, 'Toxic'))), C.a.createElement('li', {
className: 'moderation-rules__item'
}, C.a.createElement('span', {
className: 'icon-lightning'
}), C.a.createElement('span', {
className: 'text'
}, 'This feature is optional and you can choose not to use it.')))), C.a.createElement('button', {
className: 'button button-large button-fill--white text-medium spacing-narrow spacing-right',
target: '_blank',
rel: 'noopener noreferrer',
onClick: this.handleIntercomClick.bind(null, 'talk_to_support')
}, 'Talk to Support'), C.a.createElement('a', {
href: Pn.moderationRules,
className: 'button button-large button-fill--brand text-medium spacing-narrow spacing-right',
target: '_blank',
rel: 'noopener noreferrer',
onClick: this.trackButtonClick.bind(null, 'learn_more')
}, 'Learn more'), C.a.createElement('button', {
className: 'button button-large button-fill--brand text-medium spacing-narrow',
target: '_blank',
rel: 'noopener noreferrer',
onClick: this.props.handleDismiss
}, 'Dismiss')))
}
}
]),
o
}(), uN(sl, 'propTypes', {
emitTrackingEvent: b.a.func.isRequired,
addIntercomScript: b.a.func.isRequired,
intercomInitWithUser: b.a.func.isRequired,
removeIntercomScript: b.a.func.isRequired,
user: b.a.shape({
id: b.a.string.isRequired,
username: b.a.string.isRequired,
email: b.a.string.isRequired,
name: b.a.string.isRequired
}),
handleDismiss: b.a.func.isRequired
}), Ls), [
rc
])),
i = function () {
oN(o, A);
var r = sN(o);
function o() {
var t;
nN(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return uN(lN(t = r.call.apply(r, [
this
].concat(n))), 'handleDismiss', function (e) {
e && (Is.a.set(e, !0), t.setState(uN({
}, e, !0)))
}),
t
}
return rN(o, [
{
key: 'render',
value: function () {
if (this.props.selection.organization && this.props.selection.organization.pollsOnly) return null;
var e,
t = this.props,
n = t.selection,
t = t.saasFeatures[(n.organization || {
}).id] || {
};
return yo.a.isFeatureActive('moderationRulesMessage', {
forum: pt.a.currentForum
}) && n.organization && t.isFetched && t.allModRules && !Is.a.get('moderationRulesMessage') ? e = C.a.createElement(dN, {
handleDismiss: this.handleDismiss.bind(this, 'moderationRulesMessage')
}) : YP && !Is.a.get('suggestedActionsMessage') && (e = C.a.createElement(pN, {
handleDismiss: this.handleDismiss.bind(this, 'suggestedActionsMessage')
})),
C.a.createElement('div', null, e ? C.a.createElement(Ki, {
alertType: 'brand-new',
topMarginClass: 'spacing-top-none',
message: e
}) : null, C.a.createElement('p', {
className: 'spacing-top-bottom text-small text-gray'
}, 'Type ', C.a.createElement('code', null, '?'), ' to see shortcuts'))
}
}
]),
o
}();
uN(i, 'propTypes', {
selection: ht.isRequired,
saasFeatures: b.a.objectOf(b.a.objectOf(b.a.bool)).isRequired
});
var yl = Object(u.connect) (function (e) {
return {
selection: e.selection,
saasFeatures: e.saasFeatures
}
}) (i),
mN = [
{
module: C.a.createElement(yl, null),
routes: [
/^\/moderate/,
/^\/settings\/rules/
]
},
{
module: C.a.createElement(h, null),
routes: [
'/discussions/migrate/',
'/discussions/export/',
/^\/discussions\/import\//
]
},
{
module: null,
routes: [
'/discussions/',
/^\/discussions\/history\//,
'/tools/migrate-map/'
]
}
],
Ru = function (e) {
var t = {
auth: e.auth,
forums: e.forums,
location: e.location,
organizations: e.organizations,
selection: e.selection
},
n = fo(),
a = je.a.find(mN, function (e) {
return e.routes.some(function (e) {
return e.test ? e.test(n) : e === n
})
});
return C.a.createElement('div', {
className: 'section-contained'
}, C.a.createElement('div', {
className: 'layout layout--stacked-tablet'
}, C.a.createElement('div', {
className: (a = a && a.module) ? '' : 'layout__main'
}, C.a.createElement(Si, {
selection: e.selection,
pollsOnly: e.selection.organization && e.selection.organization.pollsOnly
}), C.a.createElement('div', {
className: 'layout__content'
}, a || null, C.a.cloneElement(e.children, t)))))
};
Ru.displayName = 'EngageLayout',
Ru.propTypes = {
auth: b.a.object.isRequired,
children: b.a.node.isRequired,
forums: b.a.object.isRequired,
location: b.a.object.isRequired,
organizations: b.a.object.isRequired,
selection: ht.isRequired
};
Yc = Object(u.connect) (function (e) {
return {
selection: e.selection
}
}) (Ru);
Yc.supportedRoutes = mN.reduce(function (e, t) {
return e.concat(t.routes)
}, [
]);
var fN = Yc,
D = {
updateBadgesModal: function (e) {
return {
type: z.updateModal,
isOpen: e.isOpen,
forum: e.forum,
user: e.author
}
},
awardBadge: function (e, n, a) {
return function (t) {
t({
type: z.awarding
}),
io.a.call('badges/award', {
type: 'POST',
data: e,
success: function (e) {
e = e.response;
t({
type: z.onAward,
badge: e
}),
n(e)
},
error: function () {
var e = 'An error occurred trying to award this badge. Try again.';
t({
type: z.onAwardError,
error: e
}),
a(e)
}
})
}
},
removeBadge: function (e, n, a) {
return function (t) {
t({
type: z.removing
}),
io.a.call('badges/remove', {
type: 'POST',
data: e,
success: function (e) {
e = e.response;
t({
type: z.onRemove,
badge: e
}),
n(e)
},
error: function () {
var e = 'An error occurred trying to remove this badge. Try again.';
t({
type: z.onRemoveError,
error: e
}),
a(e)
}
})
}
}
},
I = {
updateLocalQuery: function (e) {
return {
type: ne.update,
search: e
}
},
changeActive: function (e) {
return {
type: ne.changeActive,
isActive: e
}
}
},
F = {
fetch: function (r) {
return function (t, n) {
var a = n();
return r.every(function (e) {
return !!a.suggestedActions[e]
}) ? vo.a.Deferred().resolve({
suggestedActions: a.suggestedActions
}).promise() : io.a.call('apothecary/suggest', {
data: {
posts: r
}
}).done(function (e) {
return t({
type: ae.onFetch,
suggestedActions: e.response,
postIds: r
}),
{
suggestedActions: n().suggestedActions
}
})
}
}
},
hN = {
normalizeReputation: function (e) {
var t = e.toFixed(2),
n = {
raw: e,
rounded: t
},
e = '';
return n.verboseName = {
low1: 'Low Rep',
low2: 'Low Rep',
average: 'Average',
high: 'High Rep'
}
[
e = t < 0.25 ? 'low1' : t < 0.8 ? 'low2' : t < 2.9 ? 'average' : 'high'
],
n.shortName = {
low1: 'Low',
low2: 'Low',
average: 'Avg',
high: 'High'
}
[
e
],
n.type = e,
n
},
getUrl: function (e) {
var t = e.search,
n = e.filters;
return ho.getRoute('/moderate/' + e.tab + (1 === n.length ? '/filter/'.concat(n[0]) : '') + (t ? '/search/'.concat(t) : ''))
}
};
function gN(e) {
return (gN = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function yN() {
return (yN = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function bN(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function vN(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? bN(Object(n), !0).forEach(function (e) {
PN(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : bN(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function _N(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function EN(e, t) {
return (EN = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function ON(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = wN(n);
return e = a ? (e = wN(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== gN(e) && 'function' != typeof e ? SN(t) : e
}
}
function SN(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function wN(e) {
return (wN = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function PN(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var kN = {
isAnonymous: 1,
hasLinks: 2,
hasLowRep: 3,
hasBadWords: 4,
isFlagged: 5,
noIssue: 6,
isToxic: 7,
modifiedByRule: 8,
hasMedia: 10,
isAtFlagLimit: 11,
isNewUserNeedsApproval: 13,
isSexual: 14,
isHate: 15,
isBullying: 16,
isViolence: 17,
isPromotion: 18
},
sl = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && EN(e, t)
}(r, A);
var e,
t,
n,
a = ON(r);
function r() {
var l;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return PN(SN(l = a.call.apply(a, [
this
].concat(t))), 'state', {
cursor: {
},
posts: {
},
message: null,
include: null,
sortOrder: MP.sortOrder,
fetchingAmount: 0,
isPerformingAction: !1,
filters: l.props.params.filter ? [
l.props.params.filter
] : [
],
searchQuery: l.props.params.search ? window.decodeURIComponent(l.props.params.search) : '',
startDate: MP.startDate,
endDate: MP.endDate
}),
PN(SN(l), 'fetchMore', function (e) {
l.state.cursor && !l.state.cursor.hasNext || l.fetchData({
cursor: l.state.cursor.next
}, e, !0)
}),
PN(SN(l), 'getFetchData', function (e, t) {
t = t || l.props;
var n = je.a.extend({
attach: [
'postModHtml',
'postAuthorRep'
],
limit: MP.fetchSize,
include: l.state.include,
order: l.state.sortOrder,
related: [
'thread',
'forum'
],
filters: l.state.filters.map(function (e) {
return kN[e]
})
}, e);
'worst' === n.order && (n.order = 'desc', n.sortType = 'priority'),
l.state.searchQuery && (n.query = window.decodeURIComponent(l.state.searchQuery));
e = t.saasFeatures[(t.selection.organization || {
}).id] || {
};
t.selection.organization && e.isFetched && e.allModRules && n.attach.push('postRule'),
t.selection.organization && t.selection.forum && e.unapproveNewUsers && yo.a.isFeatureActive('new_user_premoderation', {
forum: t.selection.forum.name
}) && n.attach.push('postAuthorNewBypass');
e = Ve.a.getFromCookie();
if (t.selection.type === ft.organization) n.forum = je.a.intersection(t.selection.organization.forums, window._v5Config.moderated_forums);
else if (t.selection.type === ft.forum) n.forum = t.selection.forum.shortname;
else if (e.staff) n.forum = ':all';
else {
if (!e.isModerator) return;
n.forum = ':moderated'
}
return l.state.startDate && l.state.endDate && (n.start = l.state.startDate.toISOString(), n.end = l.state.endDate.toISOString()),
n
}),
PN(SN(l), 'fetchData', function (e, t, n, a) {
if ((a = a || l.props).selection && l.state.include) {
var r = a.saasFeatures[(a.selection.organization || {
}).id] || {
};
if (r.isFetching && !r.isFetched) return l.onSaasFeaturesFetched = l.onSaasFeaturesFetched || [
],
void l.onSaasFeaturesFetched.push(l.fetchData.bind(SN(l), e, t, n));
var o = l.getFetchData(e, a);
o && l.setState({
fetchingAmount: l.state.fetchingAmount + 1
}, function () {
l.apiCall = io.a.call('posts/list', {
cache: !1,
data: o
}).done(je.a.partial(l.onFetch, je.a, t, n)).fail(l.onFetchError)
})
}
}),
PN(SN(l), 'onFetch', function (e, t, n) {
var a,
r;
null !== e.response && (a = l.state.fetchingAmount - 1, r = je.a.chain(e.response).map(function (e) {
return e.forum.badges && e.forum.badges.length && e.author.badges && e.author.badges.length && (e.author.badges = l.getPostBadges(e)),
[
e.id,
e
]
}).object().value(), l.fetchFlaggers(r), n && je.a.extend(r, l.state.posts), a <= 0 ? l.setState({
fetchingAmount: 0,
cursor: e.cursor,
posts: r
}, t) : l.setState({
fetchingAmount: a
}))
}),
PN(SN(l), 'onFetchError', function () {
l.setState({
fetchingAmount: l.state.fetchingAmount - 1
})
}),
PN(SN(l), 'fetchFlaggers', function (n, e) {
var t = Object.keys(n).reduce(function (e, t) {
return n[t].numReports && e.push(t),
e
}, [
]);
t.length && io.a.call('posts/listReporters', {
data: {
posts: t,
numberPerPost: e = e || 1
}
}).done(l.onFetchFlaggers)
}),
PN(SN(l), 'onFetchFlaggers', function (e) {
var n = e.response;
l.setState({
posts: Object.keys(n).reduce(function (e, t) {
return e[t] = vN(vN({
}, e[t]), {
}, {
flaggers: n[t]
}),
e
}, vN({
}, l.state.posts))
})
}),
PN(SN(l), 'updateFetchData', function (t, e) {
var n = [
'filters',
'include',
'searchQuery',
'sortOrder',
'startDate',
'endDate'
];
je.a.all(n, function (e) {
return void 0 === t[e] || je.a.isEqual(t[e], this.state[e])
}, SN(l)) ? 'function' == typeof e && e() : l.setState(je.a.chain(t).pick(n).defaults(l.state).value(), je.a.partial(l.fetchData, {
}, e))
}),
PN(SN(l), 'getPostBadges', function (e) {
var n = {
};
return e.forum.badges.forEach(function (e) {
n[e.id] = e
}),
e.author.badges.reduce(function (e, t) {
return 'string' == typeof t && e.push(n[t]),
e
}, [
])
}),
PN(SN(l), 'performAction', function (e, t, n, a) {
e.length && (n = n || je.a.noop, l.setState({
isPerformingAction: !0
}), io.a.call(BP[t].apiPath, {
data: {
post: e,
attach: [
'postAuthorNewBypass'
],
newUserPremodBypass: a && a.newUserPremodBypass
},
method: 'POST'
}).done(je.a.partial(l.onPerformAction, je.a, n)))
}),
PN(SN(l), 'onPerformAction', function (e, t) {
var a = l.state.posts,
e = e.response.reduce(function (e, t) {
var n = a[t.id];
return yN(e, PN({
}, t.id, yN(n, t, {
thread: n.thread,
forum: n.forum
})))
}, {
});
l.setState({
isPerformingAction: !1,
posts: yN(l.state.posts, e)
}),
t.call(SN(l))
}),
PN(SN(l), 'getPostParents', function (e) {
var t = l.state.posts[e];
t && t.parent && io.a.call('posts/getContext', {
data: {
attach: [
'postModHtml',
'postAuthorRep'
],
post: t.parent,
depth: 4
}
}).done(je.a.partial(l.onFetchPostParents, je.a, e))
}),
PN(SN(l), 'onFetchPostParents', function (e, t) {
var n = l.state.posts[t];
n && (e = je.a.defaults({
parents: je.a.chain(e.response).map(function (e) {
return [e.id,
je.a.defaults({
forum: n.forum,
thread: n.thread
}, e)]
}).object().value()
}, n), l.setState({
posts: je.a.defaults(PN({
}, t, e), l.state.posts)
}))
}),
PN(SN(l), 'fetchThreadReactionsEnabled', function (e) {
return io.a.call('threadReactions/loadReactions', {
data: {
thread: e
},
method: 'GET'
}).done(je.a.partial(l.onFetchThreadReactions, je.a, e))
}),
PN(SN(l), 'onFetchThreadReactions', function (t, e) {
l.setState({
posts: l.applyPostsWithThreadId(e, function (e) {
return je.a.defaults({
thread: je.a.defaults({
reactionsEnabled: !!t.response.reactions.length,
reactionsEligible: t.response.eligible
}, e.thread)
}, e)
})
})
}),
PN(SN(l), 'toggleReactions', function (e, t) {
io.a.call('threadReactions/disableForThread', {
data: {
thread: e,
enable: t ? 1 : 0
},
method: 'POST'
}).done(je.a.partial(l.onToggleReactions, je.a, t))
}),
PN(SN(l), 'onToggleReactions', function (t, n) {
l.setState({
posts: l.applyPostsWithThreadId(t.response.id, function (e) {
return je.a.defaults({
thread: je.a.defaults(je.a.defaults({
reactionsEnabled: n
}, t.response), e.thread),
forum: je.a.defaults({
settings: je.a.defaults({
threadReactionsEnabled: n
}, e.forum.settings)
}, e.forum)
}, e)
})
})
}),
PN(SN(l), 'toggleThreadClosed', function (e, t) {
l.setState({
isTogglingClosed: !0
}),
io.a.call(t ? 'threads/close' : 'threads/open', {
data: {
thread: e
},
method: 'POST'
}).done(je.a.partial(l.onToggleThreadClosed, je.a, t))
}),
PN(SN(l), 'onToggleThreadClosed', function (e, t) {
l.setState({
isTogglingClosed: !1,
posts: l.applyPostsWithThreadId(e.response[0].id, function (e) {
return je.a.defaults({
thread: je.a.defaults({
isClosed: t
}, e.thread)
}, e)
})
})
}),
PN(SN(l), 'applyPostsWithThreadId', function (n, a) {
return je.a.chain(l.state.posts).map(function (e, t) {
return e.thread.id !== n ? [
t,
e
] : [
t,
a(e)
]
}).object().value()
}),
PN(SN(l), 'toggleThreadPremoderation', function (e, t) {
io.a.call('threads/update', {
data: {
thread: e,
validateAllPosts: t ? 1 : 0
},
method: 'POST'
}).then(l.onToggleThreadPremoderation)
}),
PN(SN(l), 'onToggleThreadPremoderation', function (e) {
var a = e.response;
l.setState({
posts: Object.keys(l.state.posts).reduce(function (e, t) {
var n = l.state.posts[t];
return e[t] = n.thread.id !== a.id ? n : vN(vN({
}, n), {
}, {
thread: vN(vN({
}, n.thread), a)
}),
e
}, {
})
})
}),
PN(SN(l), 'updateVote', function (e, t) {
var n,
a,
r = l.state.posts[e],
o = t === r.userScore,
i = t === - 1 * r.userScore,
s = o ? 0 : t;
io.a.call('posts/vote', {
data: {
post: e,
vote: s
},
method: 'POST'
}),
1 === t ? (n = o ? - 1 : 1, a = i ? - 1 : 0) : - 1 === t && (n = i ? - 1 : 0, a = o ? - 1 : 1);
r = je.a.defaults({
likes: r.likes + n,
dislikes: r.dislikes + a,
userScore: s
}, r);
l.setState({
posts: je.a.defaults(PN({
}, e, r), l.state.posts)
})
}),
PN(SN(l), 'updatePostMessage', function (e, t, n) {
io.a.call('posts/update', {
data: {
post: e,
message: t,
attach: [
'postModHtml',
'postAuthorRep'
]
},
method: 'POST'
}).done(je.a.partial(l.onUpdatePostMessage, je.a, n))
}),
PN(SN(l), 'onUpdatePostMessage', function (e, t) {
t = t || je.a.noop;
var n = e.response.id,
e = je.a.defaults({
modMessage: e.response.modMessage,
message: e.response.message,
raw_message: e.response.raw_message
}, l.state.posts[n]);
l.setState({
posts: je.a.defaults(PN({
}, n, e), l.state.posts)
}, t)
}),
PN(SN(l), 'savePostReply', function (e, t, n, a) {
io.a.call('posts/create', {
data: {
parent: e,
message: t,
attach: [
'postModHtml',
'postAuthorRep'
]
},
method: 'POST'
}).done(je.a.partial(l.onSavePostReply, je.a, n)).fail(a)
}),
PN(SN(l), 'onSavePostReply', function (e, t) {
e = e.response;
io.a.call('posts/approve', {
data: {
post: e.id
},
method: 'POST'
}).done(je.a.partial(l.onApprovePostReply, e, t))
}),
PN(SN(l), 'onApprovePostReply', function (e, t) {
var n = e.parent,
e = je.a.defaults({
child: e
}, l.state.posts[n]);
l.setState({
posts: je.a.defaults(PN({
}, n, e), l.state.posts)
}, t)
}),
PN(SN(l), 'updateUserBadges', function (n, a) {
var r = {
},
o = l.state.posts;
Object.keys(o).forEach(function (e) {
var t = o[e];
n.id === t.author.id && (t.author.badges = a),
r[e] = t
}),
l.setState({
posts: r
})
}),
PN(SN(l), 'getComponentProps', function () {
return {
posts: l.state.posts,
searchQuery: l.state.searchQuery,
updateFetchData: l.updateFetchData,
performAction: l.performAction,
message: l.state.message,
updateVote: l.updateVote,
updatePostMessage: l.updatePostMessage,
savePostReply: l.savePostReply,
sortOrder: l.state.sortOrder,
searchFilters: l.state.filters,
hasMorePosts: l.state.cursor.hasNext,
refreshPosts: l.fetchData,
fetchMorePosts: l.fetchMore,
postsAreFetching: !!l.state.fetchingAmount,
postsAreUpdating: l.state.isPerformingAction,
fetchThreadReactionsEnabled: l.fetchThreadReactionsEnabled,
toggleReactions: l.toggleReactions,
toggleThreadClosed: l.toggleThreadClosed,
toggleThreadPremoderation: l.toggleThreadPremoderation,
isTogglingClosed: l.state.isTogglingClosed,
getPostParents: l.getPostParents,
startDate: l.state.startDate,
endDate: l.state.endDate,
fetchFlaggers: l.fetchFlaggers,
updateUserBadges: l.updateUserBadges
}
}),
l
}
return e = r,
(t = [
{
key: 'componentWillUnmount',
value: function () {
this.apiCall && 'pending' === this.apiCall.state() && this.apiCall.abort()
}
},
{
key: 'componentWillReceiveProps',
value: function (t) {
!(this.props.saasFeatures[(this.props.selection.organization || {
}).id] || {
}).isFetched && (t.saasFeatures[(this.props.selection.organization || {
}).id] || {
}).isFetched && this.onSaasFeaturesFetched && this.onSaasFeaturesFetched.forEach(function (e) {
e(t)
})
}
}
]) && _N(e.prototype, t),
n && _N(e, n),
r
}();
PN(sl, 'displayName', 'PostListDriver'),
PN(sl, 'propTypes', {
selection: ht.isRequired,
saasFeatures: b.a.objectOf(b.a.objectOf(b.a.bool)).isRequired,
params: b.a.object.isRequired
});
Ls = Object(ki.createDriver) (sl, function (e) {
return {
saasFeatures: e.saasFeatures
}
});
function NN(e) {
return (NN = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function CN(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function RN(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? CN(Object(n), !0).forEach(function (e) {
IN(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : CN(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function xN(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function AN(e, t) {
return (AN = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function DN(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = TN(n);
return e = a ? (e = TN(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== NN(e) && 'function' != typeof e ? jN(t) : e
}
}
function jN(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function TN(e) {
return (TN = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function IN(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var qN = {
enter: 13,
return : 13,
esc: 27,
escape: 27,
backspace: 8
},
FN = je.a.chain(qN).values().reduce(function (e, t) {
return e[t] = !0,
e
}, {
}).value(),
i = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && AN(e, t)
}(o, A);
var e,
t,
n,
a = DN(o);
function o() {
var r;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return IN(jN(r = a.call.apply(a, [
this
].concat(t))), 'defaults', {
exclude: [
'input',
'textarea'
]
}),
IN(jN(r), 'state', {
shortcuts: {
}
}),
IN(jN(r), 'addMultiple', function (e) {
je.a.reduce(e, function (e, t) {
return je.a.partial(this.add, t.keyName, t.callback, t.options, e)
}, je.a.noop, jN(r)) ()
}),
IN(jN(r), 'add', function (e, t, n, a) {
1 === e.split(/\s+/).length && (n = RN(RN({
}, r.defaults), n), e = qN.hasOwnProperty(e.toLowerCase()) ? qN[e.toLowerCase()] : e.charCodeAt(0), (n = r.state.shortcuts[e] || {
callbacks: [
],
options: n
}).callbacks.push(t), r.setState({
shortcuts: je.a.defaults(IN({
}, e, n), r.state.shortcuts)
}, a))
}),
IN(jN(r), 'remove', function (e) {
e = e.toLowerCase(),
r.state.shortcuts.hasOwnProperty(e) && r.setState({
shortcuts: je.a.defaults(IN({
}, e, void 0), r.state.shortcuts)
})
}),
IN(jN(r), 'handleKeyEvent', function (t) {
var n,
a;
t.ctrlKey || t.altKey || t.metaKey || !je.a.size(r.state.shortcuts) || (n = t.which, 'keydown' === t.type && !FN.hasOwnProperty(n) || 'keypress' === t.type && FN.hasOwnProperty(n) || r.state.shortcuts.hasOwnProperty(n) && (a = r.state.shortcuts[n].options || r.defaults, je.a.each(r.state.shortcuts[n].callbacks, function (e) {
27 !== n && a.exclude.some(function (e) {
return e.toLowerCase() == t.target.tagName.toLowerCase()
}) || (e(t), t.preventDefault())
})))
}),
IN(jN(r), 'getComponentProps', function () {
return {
addHotkeys: r.addMultiple,
removeHotkey: r.remove
}
}),
r
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
var e = window.document;
e.addEventListener('keydown', this.handleKeyEvent),
e.addEventListener('keypress', this.handleKeyEvent)
}
},
{
key: 'componentWillUnmount',
value: function () {
var e = window.document;
e.removeEventListener('keydown', this.handleKeyEvent),
e.removeEventListener('keypress', this.handleKeyEvent)
}
}
]) && xN(e.prototype, t),
n && xN(e, n),
o
}();
IN(i, 'displayName', 'HotkeysDriver');
yl = Object(ki.createDriver) (i);
function LN(e) {
return (LN = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function UN(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function MN(e, t) {
return (MN = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function BN(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = HN(n);
return e = a ? (e = HN(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== LN(e) && 'function' != typeof e ? zN(t) : e
}
}
function zN(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function HN(e) {
return (HN = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function GN(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
h = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && MN(e, t)
}(o, A);
var e,
t,
n,
r = BN(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return GN(zN(t = r.call.apply(r, [
this
].concat(n))), 'onOpen', function () {
t.props.emitTrackingEvent({
verb: 'view',
object_type: 'area'
})
}),
GN(zN(t), 'onButtonClick', function (e) {
t.props.emitTrackingEvent({
verb: 'click',
object_type: 'button',
adverb: e
})
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.isOpen && this.onOpen()
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
!this.props.isOpen && e.isOpen && this.onOpen()
}
},
{
key: 'render',
value: function () {
var e = this;
return C.a.createElement('section', {
className: 'featured-message__moderation-rules'
}, C.a.createElement('div', {
className: 'icon icon-star-fourpoint -one'
}), C.a.createElement('div', {
className: 'icon icon-star-fourpoint -two'
}), C.a.createElement('div', {
className: 'icon icon-star-fourpoint -three'
}), C.a.createElement('div', {
className: 'icon icon-star-fourpoint -four'
}), C.a.createElement('div', {
className: 'icon icon-star-fourpoint -five'
}), C.a.createElement('div', {
className: 'icon icon-star-fourpoint -six'
}), C.a.createElement('div', {
className: 'icon icon-star-fourpoint -seven'
}), C.a.createElement('div', {
className: 'icon icon-star-fourpoint -eight'
}), C.a.createElement('div', {
className: 'icon icon-star-fourpoint -nine'
}), C.a.createElement('div', {
className: 'icon icon-star-fourpoint -ten'
}), C.a.createElement('div', {
className: 'icon icon-star-fourpoint -eleven'
}), C.a.createElement('div', {
className: 'admin-modal__header align align--column align--middle',
key: 'header'
}, C.a.createElement('h3', {
className: 'text-large'
}, 'New for You!'), C.a.createElement('img', {
className: 'img-responsive spacing-top-small',
style: {
marginLeft: '55px'
},
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/pam-new.svg'
})), C.a.createElement('div', {
className: 'admin-modal__content text-gray',
key: 'content'
}, C.a.createElement('p', {
className: 'spacing-bottom spacing-top'
}, C.a.createElement('strong', null, 'Moderation Rules are new to the moderation panel!')), C.a.createElement('p', {
className: 'spacing-bottom'
}, 'Tired of moderating the same types of comments the same way over and over? You can now create a moderation rule that will automatically perform an action based on the comment criteria that you choose.'), C.a.createElement('p', null, 'We plan to make updates and continually improve this feature, so be sure to leave us feedback via the Pam widget on the right!')), C.a.createElement('div', {
className: 'admin-modal__footer align align--between',
key: 'footer'
}, C.a.createElement('button', {
className: 'button button-fill button-small button-wide spacing-right-large',
onClick: function () {
e.onButtonClick('dismiss'),
e.props.onClose()
}
}, 'Thanks, I\'ll check it out later'), C.a.createElement(v.Link, {
className: 'button button-fill--brand button-small button-wide',
to: '/settings/moderation/',
onClick: this.onButtonClick.bind(this, 'continue')
}, 'Take me to the Moderation Rules')))
}
}
]) && UN(e.prototype, t),
n && UN(e, n),
o
}();
GN(h, 'propTypes', {
onClose: b.a.func.isRequired,
isOpen: b.a.bool.isRequired,
emitTrackingEvent: b.a.func.isRequired
});
var VN = {
moderationRules: {
modalContent: Object(u.connect) (null, {
emitTrackingEvent: Xo({
zone: 'moderation_panel',
section: 'welcome',
area: 'modal',
product: 'publisher_admin',
object_id: 'moderation_rules',
adjective: 'new_feature'
})
}) (h)
}
};
function WN(e) {
return function (t) {
io.a.call('announcements/messages/checkViewed', {
data: {
message: e.messageIds
}
}).success(function (e) {
t({
type: Q.onFetchViewStatus,
response: e.response
})
})
}
}
function YN(r) {
return function (a) {
io.a.call('announcements/messages/view', {
method: 'POST',
data: {
message: r.messageId
}
}).success(function () {
var e,
t,
n;
a({
type: Q.onFetchViewStatus,
response: (n = !0, (t = r.messageId) in (e = {
}) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n, e)
})
})
}
}
function QN(e) {
return (QN = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function KN(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function JN(e, t) {
return (JN = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function $N(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = XN(n);
return e = a ? (e = XN(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== QN(e) && 'function' != typeof e ? ZN(t) : e
}
}
function ZN(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function XN(e) {
return (XN = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function eC(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function tC(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? eC(Object(n), !0).forEach(function (e) {
nC(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : eC(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function nC(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var Ru = function (i) {
function e(a) {
var e,
t;
return Object(u.connect) (function (e) {
return tC({
}, e.featuredMessages)
}, {
fetchFeaturedMessagesViewStatuses: WN,
markFeaturedMessageAsViewed: YN
}) ((t = e = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && JN(e, t)
}(o, A);
var e,
t,
n,
r = $N(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return nC(ZN(e = r.call.apply(r, [
this
].concat(n))), 'state', {
isOpen: !1,
currentMessageId: null,
messageViewable: i.reduce(function (e, t) {
return tC(tC({
}, e), {
}, nC({
}, t, !1))
}, {
})
}),
nC(ZN(e), 'getComponentProps', function () {
return {
showFeaturedMessage: e.showFeaturedMessage
}
}),
nC(ZN(e), 'onClose', function () {
e.setState({
isOpen: !1
})
}),
nC(ZN(e), 'onOpen', function () {
e.props.markFeaturedMessageAsViewed({
messageId: e.state.currentMessageId
})
}),
nC(ZN(e), 'showFeaturedMessage', function (a, r) {
return (r = r || e.props).isFetched ? void e.setState(function (n) {
var t = i.reduce(function (e, t) {
return tC(tC({
}, e), {
}, nC({
}, t, VN[t] && (n.messageViewable[t] || !!~a.indexOf(t))))
}, {
}),
e = a.filter(function (e) {
return !1 === r.userHasViewedMessages[e] && t[e]
}) [0];
return {
isOpen: void 0 !== e,
currentMessageId: e,
messageViewable: t
}
}) : (e.onFetchFeaturedMessagesViewStatuses = e.onFetchFeaturedMessagesViewStatuses || [
], void e.onFetchFeaturedMessagesViewStatuses.push(e.showFeaturedMessage.bind(ZN(e), a)))
}),
e
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.fetchFeaturedMessagesViewStatuses({
messageIds: i
})
}
},
{
key: 'componentWillReceiveProps',
value: function (t) {
t.isFetched && !this.props.isFetched && this.onFetchFeaturedMessagesViewStatuses && (this.onFetchFeaturedMessagesViewStatuses.forEach(function (e) {
e(t)
}), this.onFetchFeaturedMessagesViewStatuses = null)
}
},
{
key: 'render',
value: function () {
var e = tC(tC({
}, this.props), this.getComponentProps()),
t = (VN[this.state.currentMessageId] || {
}).modalContent;
return C.a.createElement('section', null, C.a.createElement(_.a, {
isOpen: this.state.isOpen,
onRequestClose: this.onClose,
onAfterOpen: this.onOpen,
className: 'admin-modal -clipped -wider padding-double '.concat(this.state.modalClass || ''),
overlayClassName: 'modal-overlay -dark'
}, t ? C.a.createElement(t, {
isOpen: this.state.isOpen,
onClose: this.onClose
}) : null), C.a.createElement(a, e))
}
}
]) && KN(e.prototype, t),
n && KN(e, n),
o
}(), nC(e, 'displayName', ''.concat(a.displayName, ':').concat(n)), nC(e, 'propTypes', {
userHasViewedMessages: function (e, t, n, a, r) {
var o;
if (Object.keys(o = e[t]).some(function (e) {
return 'boolean' != typeof o[e]
})) return Error('The '.concat(a, ' `').concat(r || t, '` in `').concat(n, '` is expected to map string keys to boolean values.'))
},
isFetched: b.a.bool.isRequired,
fetchFeaturedMessagesViewStatuses: b.a.func.isRequired,
markFeaturedMessageAsViewed: b.a.func.isRequired
}), t))
}
var n = 'FeaturedMessageDriver';
return e.driverName = n,
e.isDriver = !0,
e
},
Yc = n(494),
aC = n.n(Yc);
function rC(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function oC(e) {
var t = e.badge,
n = e.user;
return C.a.createElement('span', {
id: ''.concat(e.context, '-badge_').concat(n.id, '-').concat(t.id),
className: 'user-badge badge-tooltip__wrapper',
'data-role': 'user-badge',
onClick: function (e) {
return e.stopPropagation()
},
tabIndex: 0
}, C.a.createElement('img', {
className: 'user-badge-image',
src: t.image,
alt: t.name
}), C.a.createElement('div', {
className: 'badge-tooltip__container'
}, C.a.createElement('div', {
className: 'tooltip show badge-tooltip'
}, C.a.createElement('span', {
className: 'badge-tooltip__content'
}, t.name))))
}
var iC,
sC = 99999,
lC = 25000,
cC = 0,
uC = 1,
pC = 2,
dC = [
{
key: We.BADGES_CRITERIA.MANUAL,
value: We.BADGES_CRITERIA.MANUAL,
label: 'Manual'
},
{
key: We.BADGES_CRITERIA.COMMENTS,
value: We.BADGES_CRITERIA.COMMENTS,
label: 'Number of comments'
},
{
key: We.BADGES_CRITERIA.FEATURED_COMMENTS,
value: We.BADGES_CRITERIA.FEATURED_COMMENTS,
label: 'Number of featured comments'
},
{
key: We.BADGES_CRITERIA.COMMENT_UPVOTES,
value: We.BADGES_CRITERIA.COMMENT_UPVOTES,
label: 'Number of upvotes on a comment'
}
],
sl = {
id: b.a.number.isRequired,
image: b.a.string,
name: b.a.string,
criteria: b.a.oneOf([].concat(function (e) {
if (Array.isArray(e)) return rC(e)
}(iC = Object.values(We.BADGES_CRITERIA)) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(iC) || function (e, t) {
if (e) {
if ('string' == typeof e) return rC(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? rC(e, t) : void 0
}
}(iC) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}(), [
''
])),
target: b.a.number
},
mC = {
image: '',
name: '',
criteria: '',
target: 0,
imageFile: null,
isNew: !0,
isInvalid: !0,
hasChanges: !1,
imageErrors: [
]
};
oC.propTypes = {
badge: b.a.shape(sl).isRequired,
user: b.a.shape({
id: b.a.string.isRequired
}).isRequired,
context: b.a.string.isRequired
};
i = function (e) {
var n = e.forum,
a = e.user,
r = e.context,
t = e.limit;
if (!n.settings.badgesEnabled || !a || a.isAnonymous || !a.badges || !a.badges.length) return null;
var e = t < a.badges.length,
o = e ? t - 1 : t;
return C.a.createElement('span', {
'data-role': 'badges',
className: 'user-badges-collection'
}, a.badges.map(function (e, t) {
return t < o ? C.a.createElement(oC, {
key: t,
badge: e,
user: a,
forumId: n.id,
context: r
}) : null
}), e ? C.a.createElement('span', {
className: 'user-badge truncate-badge publisher-background-color',
'data-role': 'user-badge',
tabIndex: 0
}, C.a.createElement('span', {
className: 'user-badge-more'
}, '+', a.badges.length - o)) : null)
};
i.propTypes = {
forum: b.a.shape({
id: b.a.string.isRequired,
settings: b.a.shape({
badgesEnabled: b.a.bool.isRequired
}).isRequired
}).isRequired,
user: b.a.shape({
id: b.a.string,
badges: b.a.arrayOf(b.a.shape(sl))
}).isRequired,
context: b.a.string.isRequired,
limit: b.a.number.isRequired
};
var fC = i;
function hC(e) {
return (hC = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function gC(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function yC(e, t) {
return (yC = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function bC(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = _C(n);
return e = a ? (e = _C(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== hC(e) && 'function' != typeof e ? vC(t) : e
}
}
function vC(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function _C(e) {
return (_C = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function EC(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
h = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && yC(e, t)
}(o, A);
var e,
t,
n,
r = bC(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return EC(vC(t = r.call.apply(r, [
this
].concat(n))), 'handleClick', function (e) {
if (!e || !e.nativeEvent || 1 === e.nativeEvent.which) return e.preventDefault(),
t.props.showUserPanel(t.props.post),
!1
}),
t
}
return e = o,
(t = [
{
key: 'render',
value: function () {
return C.a.createElement('a', {
href: this.props.post.author.profileUrl,
className: 'profile-launcher',
onClick: this.handleClick
}, this.props.contents)
}
}
]) && gC(e.prototype, t),
n && gC(e, n),
o
}();
EC(h, 'propTypes', {
contents: b.a.object.isRequired,
showUserPanel: b.a.func.isRequired,
post: b.a.shape({
author: b.a.object.isRequired,
ipAddress: b.a.string
}).isRequired
});
var OC = h;
function SC(e) {
return (SC = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function wC(e, t) {
return function (e) {
if (Array.isArray(e)) return e
}(e) || function (e, t) {
var n = e && ('undefined' != typeof Symbol && e[Symbol.iterator] || e['@@iterator']);
if (null != n) {
var a,
r,
o = [
],
i = !0,
s = !1;
try {
for (n = n.call(e); !(i = (a = n.next()).done) && (o.push(a.value), !t || o.length !== t); i = !0);
} catch (e) {
s = !0,
r = e
} finally {
try {
i || null == n.return || n.return()
} finally {
if (s) throw r
}
}
return o
}
}(e, t) || function (e, t) {
if (e) {
if ('string' == typeof e) return PC(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? PC(e, t) : void 0
}
}(e, t) || function () {
throw new TypeError('Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function PC(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function kC(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function NC(e, t) {
return (NC = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function CC(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = xC(n);
return e = a ? (e = xC(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== SC(e) && 'function' != typeof e ? RC(t) : e
}
}
function RC(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function xC(e) {
return (xC = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function AC(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var DC = {
badWords: 'Restricted Word',
links: 'Contains Link',
anonymous: 'Guest Comment',
media: 'Contains Media',
toxic: 'Toxic',
bullying: 'Bullying',
hate: 'Hate Speech',
violent: 'Violence',
sexual: 'Sexual',
promotion: 'Promotion',
spam: 'Spam',
shadowBannedGlobal: 'Shadow Banned Globally',
isNewUserNeedsApproval: 'New Commenter'
},
jC = [
'bullying',
'hate',
'violent',
'sexual',
'promotion'
],
Yc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && NC(e, t)
}(o, A);
var e,
t,
n,
r = CC(o);
function o() {
var n;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) t[a] = arguments[a];
return AC(RC(n = r.call.apply(r, [
this
].concat(t))), 'handleFlaggercardAfterShow', function () {
n.props.emitTrackingEvent({
verb: 'hover',
object_type: 'label',
object_id: 'flagged_post',
extra_data: JSON.stringify({
number_of_flags: n.props.numReports
})
})
}),
AC(RC(n), 'handleFlaggerClick', function (e) {
n.props.emitTrackingEvent({
verb: 'click',
object_type: 'user',
object_id: e.username
})
}),
AC(RC(n), 'getPostLabels', function () {
var e,
t = [
];
return !n.props.reputationLabel || 'Average' !== (e = n.props.reputationLabel.split(' ') [0]) && t.push({
key: ''.concat(e.toLowerCase(), 'Rep'),
content: ''.concat(e, ' Rep')
}),
n.props.shadowBanned && t.push({
key: 'shadowBanned',
content: 'Shadow Banned'
}),
n.props.moderationLabels && (0 === n.props.moderationLabels.length ? t.push({
key: 'noIssue',
content: 'No issue detected'
}) : t = t.concat(n.props.moderationLabels.filter(function (e) {
var t = n.props.hasAllModRules || yo.a.isFeatureActive('thehive', {
forum: n.props.forum.id
});
return !(~jC.indexOf(e) && !t) && DC[e.split(':').shift()]
}).map(function (e) {
var t = wC(e.split(':'), 2),
n = t[0],
e = t[1],
t = DC[n];
return e && (t += ' - '.concat(e)),
{
key: n,
className: e ? '-severity'.concat(e) : '',
content: t
}
}))),
n.props.numReports ? t.push({
key: 'flagged',
className: 'flaggercard-trigger',
content: [
C.a.createElement(Md, {
key: 'flaggerCard',
tooltipKey: 'flaggerCard',
direction: 'top',
additionalClass: 'hovercard flagger-card',
onShow: function () {
n.props.flaggers && n.props.numReports === n.props.flaggers.length || n.props.fetchAllFlaggers(),
n.handleFlaggercardAfterShow()
},
content: C.a.createElement(C.a.Fragment, null, C.a.createElement('div', {
className: 'hovercard__content flagger-card__content',
onClick: function (e) {
e.stopPropagation()
}
}, 'Flagged by ', n.props.flaggers && n.props.flaggers.length ? n.props.flaggers.map(function (e) {
return e.name ? C.a.createElement('a', {
className: 'flagger-card__link',
href: e.profileUrl,
target: '_blank',
rel: 'noopener noreferrer',
onClick: n.handleFlaggerClick.bind(RC(n), e),
key: e.name
}, e.name) : null
}) : 'Unknown'))
}, C.a.createElement('span', {
key: 'flaggercardTrigger',
'data-tip': !0,
'data-for': 'flaggerCard-'.concat(n.props.postId)
}, C.a.createElement('span', {
className: 'icon-person icon__position spacing-right-small'
}), 1 === n.props.numReports ? 'Flagged once' : 'Flagged '.concat(n.props.numReports, ' times')))
]
}) : n.props.numReports && t.push({
key: 'flagged',
content: 'Flagged '.concat(n.props.numReports, ' times')
}),
t
}),
n
}
return e = o,
(t = [
{
key: 'render',
value: function () {
return C.a.createElement('ul', {
className: 'badge--post-label__list'
}, this.getPostLabels().map(function (e) {
return C.a.createElement('li', {
key: e.key,
className: 'badge--post-label -'.concat(e.key, ' ').concat(e.className || '').trim()
}, e.content)
}))
}
}
]) && kC(e.prototype, t),
n && kC(e, n),
o
}();
AC(Yc, 'propTypes', {
moderationLabels: b.a.arrayOf(b.a.string),
numReports: b.a.number.isRequired,
shadowBanned: b.a.bool.isRequired,
postId: b.a.string.isRequired,
emitTrackingEvent: b.a.func.isRequired,
reputationLabel: b.a.string,
flaggers: b.a.arrayOf(b.a.shape({
name: b.a.string.isRequired,
username: b.a.string.isRequired,
profileUrl: b.a.string.isRequired
})),
fetchAllFlaggers: b.a.func.isRequired,
forum: b.a.shape({
id: b.a.string.isRequired
}).isRequired,
hasAllModRules: b.a.bool.isRequired
});
var TC = Object(u.connect) (null, {
emitTrackingEvent: Xo({
zone: 'moderation_panel',
area: 'post_label'
})
}) (Yc),
i = n(100),
IC = n.n(i);
function qC(e) {
return (qC = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function FC(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function LC(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? FC(Object(n), !0).forEach(function (e) {
YC(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : FC(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function UC() {
return (UC = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function MC(e) {
return function (e) {
if (Array.isArray(e)) return BC(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return BC(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? BC(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function BC(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function zC(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function HC(e, t) {
return (HC = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function GC(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = WC(n);
return e = a ? (e = WC(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== qC(e) && 'function' != typeof e ? VC(t) : e
}
}
function VC(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function WC(e) {
return (WC = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function YC(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
h = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && HC(e, t)
}(o, A);
var e,
t,
n,
r = GC(o);
function o() {
var a;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return YC(VC(a = r.call.apply(r, [
this
].concat(t))), 'state', {
isEditing: !1,
isSaving: !1,
isReplying: !1,
isExpanded: a.props.allExpanded,
isCollapsible: !1,
editInputContent: a.props.raw_message
}),
YC(VC(a), 'messageRef', C.a.createRef()),
YC(VC(a), 'editInput', C.a.createRef()),
YC(VC(a), 'replyInput', C.a.createRef()),
YC(VC(a), 'node', C.a.createRef()),
YC(VC(a), 'scrollToNode', function () {
var e,
t = a.node.current.getBoundingClientRect(),
n = window.innerHeight || window.document.documentElement.clientHeight;
0 <= t.top && t.bottom <= n || (e = t.top - window.document.body.getBoundingClientRect().top, window.scroll(0, Math.min(e - n / 2 + (t.bottom - t.top) / 2, e)))
}),
YC(VC(a), 'updateChecked', function (e) {
a.props.updateChecked(a.props.id, e.target.checked)
}),
YC(VC(a), 'toggleExpanded', function () {
var e = !a.state.isExpanded;
a.props.allExpanded && !e && a.props.updateExpanded(e),
a.setState({
isExpanded: e
})
}),
YC(VC(a), 'vote', function (e, t, n) {
e.preventDefault(),
a.props.updateVote(t, n)
}),
YC(VC(a), 'searchByIp', function (e) {
e.preventDefault(),
a.props.updateFetchData({
searchQuery: 'post_ip_lookup:'.concat(a.props.id)
})
}),
YC(VC(a), 'searchByEmail', function (e) {
e.preventDefault(),
a.props.updateFetchData({
searchQuery: 'post_email_lookup:'.concat(a.props.id)
})
}),
YC(VC(a), 'setPostActive', function (e) {
var t;
o.isActionableElement(e.target, a.node.current) || (t = je.a.partial(a.props.togglePostPanelVisible, a.props.id)),
a.props.updateActivePost(a.props.id, t)
}),
YC(VC(a), 'startEdit', function (e) {
'deleted' !== a.props.status && 'spam' !== a.props.status && (e && e.preventDefault(), a.props.emitTrackingEvent({
verb: 'click',
adjective: 'edit',
object_type: 'link',
object_id: a.props.id,
thread_id: a.props.thread.id,
page_url: a.props.url,
extra_data: JSON.stringify({
tab: a.props.activePage
})
}), a.state.isEditing ? a.getTextarea('edit').focus() : a.setState({
isEditing: !0
}))
}),
YC(VC(a), 'startEditHotkey', function (e) {
a.props.isActive && a.startEdit(e)
}),
YC(VC(a), 'saveEdit', function (e) {
e.preventDefault();
var t = a.cleanMessage(a.editInput.current.value),
e = a.validateEdit(t);
e ? a.showPostError(e) : (a.setState({
isSaving: !0
}), a.props.updateMessage(a.props.id, t, a.finishEdit))
}),
YC(VC(a), 'finishEdit', function () {
a.editInput.current.value = '',
a.clearPostError(),
a.setState({
isEditing: !1,
isSaving: !1
}),
a.props.emitTrackingEvent({
verb: 'update',
object_type: 'post',
object_id: a.props.id,
thread_id: a.props.thread.id,
page_url: a.props.url,
extra_data: JSON.stringify({
tab: a.props.activePage
})
})
}),
YC(VC(a), 'startReply', function (e) {
'deleted' !== a.props.status && 'spam' !== a.props.status && (e && e.preventDefault(), a.state.isReplying ? a.getTextarea('reply').focus() : a.setState({
isReplying: !0
}))
}),
YC(VC(a), 'startReplyHotkey', function (e) {
a.props.isActive && a.startReply(e)
}),
YC(VC(a), 'saveReply', function (e) {
e.preventDefault();
var t = a.cleanMessage(a.replyInput.current.value),
e = a.validateMessage(t);
e ? a.showPostError(e) : (a.setState({
isSaving: !0
}), a.props.saveReply(a.props.id, t, a.finishReply, je.a.partial(a.showPostError, null, je.a)))
}),
YC(VC(a), 'showPostError', function (t, e) {
try {
t = t || JSON.parse(e.responseText).response
} catch (e) {
t = 'There was an error posting your comment.'
}
je.a.isString(t) && ~t.indexOf('verify your email') && (t = C.a.createElement('a', {
href: 'https://disqus.com/verify',
target: '_blank',
rel: 'noopener noreferrer'
}, t)),
a.setState({
isSaving: !1,
error: t
})
}),
YC(VC(a), 'clearPostError', function () {
a.setState({
error: null
})
}),
YC(VC(a), 'finishReply', function () {
a.replyInput.current.value = '',
a.clearPostError(),
a.setState({
isReplying: !1,
isSaving: !1
})
}),
YC(VC(a), 'validateMessage', function (e) {
if (je.a.isString(e)) return '' === e ? 'Comments can\'t be blank.' : e.length < 2 ? 'Comments must have at least 2 characters.' : void 0
}),
YC(VC(a), 'validateEdit', function (e) {
var t = (new Date).toISOString();
return a.props.editableUntil < t ? C.a.createElement('span', null, 'You can no longer edit this comment. Comments can only be edited within 7 days after posting. ', C.a.createElement('a', {
href: 'https://help.disqus.com/commenting/remove-and-edit-your-comments',
target: '_blank',
rel: 'noopener noreferrer',
style: {
color: 'white ! important',
textDecoration: 'underline'
}
}, 'Learn more')) : a.validateMessage(e)
}),
YC(VC(a), 'cleanMessage', function (e) {
return e.replace(/^\s+|\s+$/g, '')
}),
YC(VC(a), 'setCollapsibility', function () {
window.setTimeout(function () {
a._styles || (a._styles = window.getComputedStyle(a.messageRef.current));
var e = a.messageRef.current.clientHeight > 2 * ('' + a._styles['line-height'].slice(0, - 2));
a.setState({
isCollapsible: e
})
}, 0)
}),
YC(VC(a), 'getTextarea', function (e) {
return a[''.concat(e, 'Input')].current
}),
YC(VC(a), 'removeFocus', function () {
a.state.isEditing && a.getTextarea('edit').blur(),
a.state.isReplying && a.getTextarea('reply').blur()
}),
YC(VC(a), 'performSuggestedUserAction', function () {
var e;
a.props.suggestedAction && yo.a.isFeatureActive('suggested_user_actions') && ((e = (VP.users[a.props.suggestedAction.userAction] || {
}).banType) && (a.props.showUserPanel(a.props), a.props.updateBanFormType(e), a.props.updateUserListsModal({
isOpen: !0,
listType: 'blacklist'
})))
}),
YC(VC(a), 'hasFeature', function (e) {
return !!(a.props.saasFeatures && a.props.selection.organization && a.props.saasFeatures[a.props.selection.organization.id] && a.props.saasFeatures[a.props.selection.organization.id][e])
}),
a
}
return e = o,
n = [
{
key: 'isActionableElement',
value: function (n, a) {
return ['a',
'button',
'input',
'textarea'].some(function (e) {
var t = n;
do {
if (t.nodeName.toLowerCase() === e) return !0
} while ((t = t.parentNode) && t !== a);
return !1
})
}
}
],
(t = [
{
key: 'componentWillReceiveProps',
value: function (e) {
e.isActive && !this.props.isActive && this.scrollToNode(),
e.allExpanded !== this.props.allExpanded && e.allExpanded !== this.state.isExpanded && this.setState({
isExpanded: e.allExpanded
})
}
},
{
key: 'componentDidUpdate',
value: function (e, t) {
this.state.isEditing && !t.isEditing && this.getTextarea('edit').focus(),
this.state.isReplying && !t.isReplying && this.getTextarea('reply').focus(),
e.message !== this.props.message && this.setCollapsibility()
}
},
{
key: 'componentDidMount',
value: function () {
this.props.selection.organization && this.props.fetchSaasFeatures(this.props.selection.organization.id),
this.setCollapsibility(),
this.props.addHotkeys(je.a.map(GP, function (e, t) {
return je.a.isString(e) && (e = {
callbackName: e
}),
je.a.extend({
keyName: t,
callback: je.a.partial.apply(je.a, [
this[e.callbackName]
].concat(MC(e.callbackArgs || [
]))),
options: {
}
}, e)
}, this))
}
},
{
key: 'getUrl',
value: function (e) {
var t = e.tab,
n = e.search,
e = e.filters;
return '/admin'.concat(hN.getUrl({
tab: t = void 0 === t ? this.props.activePage : t,
search: n = void 0 === n ? this.props.searchQuery : n,
filters: e = void 0 === e ? this.props.searchFilters : e
}))
}
},
{
key: 'render',
value: function () {
var t = this,
e = {
},
n = {
};
this.state.isSaving && (n.disabled = e.disabled = !0);
var a,
r,
o,
i = Ve.a.getFromCookie().staff,
s = !i && 'deleted' === this.props.status && this.props.isDeletedByAuthor,
l = window._v5Config.forums[this.props.forum.id],
c = (new Date).toISOString() < this.props.editableUntil,
u = l && (l.permissions.canEdit || i) && c && !this.props.thread.isClosed && !this.props.isHighlighted,
p = i && !u,
d = Os.prettyDatetime(''.concat(this.props.createdAt, ' GMT')),
m = Os.prettyDatetime(this.props.createdAt, 'absolute'),
f = this.props.allExpanded || this.state.isExpanded,
h = this.props.suggestedAction && (yo.a.isFeatureActive('suggested_user_actions') || VP.posts[this.props.suggestedAction.postAction]);
this.props.child && (a = Os.prettyDatetime(''.concat(this.props.child.createdAt, ' GMT')), r = Os.prettyDatetime(this.props.child.createdAt, 'absolute')),
o = ct() ().format(aC.a.ISO_8601) < this.props.editableUntil ? (b = Os.prettyDatetime(''.concat(this.props.editableUntil, ' GMT')), 'You have until '.concat(b, ' to edit this comment. ')) : 'The edit period for this comment has expired. ';
var g = [
'comment-moderate__card',
this.props.status
];
f || g.push('-collapsed'),
this.props.hidden && g.push('hidden'),
this.props.isActive && g.push('has-notch'),
this.props.isApproved && 'unapproved' === this.props.status && (g = g.filter(function (e) {
return 'unapproved' !== e
})).push('approved');
var g = g.join(' '),
l = this.state.error ? C.a.createElement(Ki, {
message: this.state.error,
alertType: 'error',
topMarginClass: 'spacing-top-narrow',
onRequestClose: this.clearPostError
}) : null,
y = f ? 'url' : 'thumbnailURL',
c = C.a.createElement('div', {
className: this.state.isEditing ? 'hidden' : ''
}, C.a.createElement('div', {
className: 'message-wrapper'
}, C.a.createElement('div', {
className: 'message',
ref: this.messageRef,
dangerouslySetInnerHTML: {
__html: this.props.modMessage || this.props.message
}
})), 0 < this.props.media.length ? C.a.createElement('div', {
className: 'comment-attachments'
}, this.props.media.map(function (e, t) {
return C.a.createElement('button', {
className: f ? '' : 'more',
key: t,
onClick: this.toggleExpanded
}, e.mediaType === IC.a.MEDIA_TYPES.MP4_VIDEO ? C.a.createElement('video', {
autoPlay: !0,
muted: !0,
loop: !0,
className: 'img-responsive border-radius-sm',
src: e[y]
}) : C.a.createElement('img', {
className: 'img-responsive border-radius-sm',
src: e[y]
}))
}, this)) : null, this.state.isCollapsible ? C.a.createElement('button', {
className: 'text-small',
onClick: this.toggleExpanded
}, f ? 'less' : 'more') : null),
i = this.props.selection.type === ft.forum && yo.a.isFeatureActive('spam_and_ban_moderation', {
forum: this.props.selection.forum.name
}),
b = this.hasFeature('unapproveNewUsers') && this.props.forum.settings.unapproveNewUsersEnabled && this.props.isNewUserNeedsApproval && !this.props.author.isNewUserBypassed && this.props.selection.type === ft.forum && yo.a.isFeatureActive('new_user_premoderation', {
forum: this.props.selection.forum.name
});
return C.a.createElement('li', {
className: g,
id: 'comment-'.concat(this.props.id),
onClick: this.setPostActive,
ref: this.node
}, C.a.createElement('div', {
className: 'align align--between align--wrap-mobile'
}, C.a.createElement('div', {
className: 'comment-moderate__title truncate-line'
}, C.a.createElement('span', {
className: 'spacing-right'
}, s ? null : C.a.createElement('input', {
className: 'post-checkbox',
type: 'checkbox',
checked: this.props.checked,
onChange: this.updateChecked
})), C.a.createElement('a', {
href: this.props.url,
target: 'new'
}, this.props.thread.clean_title)), C.a.createElement(TC, {
reputationLabel: this.props.author.reputationLabel,
numReports: this.props.numReports,
moderationLabels: this.props.moderationLabels,
shadowBanned: this.props.shadowBanned,
postId: this.props.id,
flaggers: this.props.flaggers,
fetchAllFlaggers: this.props.fetchAllFlaggers,
forum: this.props.forum,
hasAllModRules: this.hasFeature('allModRules')
})), C.a.createElement('div', {
className: 'comment-moderate__body'
}, C.a.createElement('div', {
className: 'spacing-top-narrow spacing-bottom align'
}, C.a.createElement('div', {
className: 'spacing-right spacing-top-small'
}, C.a.createElement(OC, {
contents: C.a.createElement('img', {
src: this.props.author.avatar.permalink,
className: 'comment-moderate__avatar border-radius-sm'
}),
showUserPanel: this.props.showUserPanel,
post: this.props
})), C.a.createElement('div', {
className: 'comment-moderate__content'
}, C.a.createElement('div', {
className: 'align-min-tablet align--between align--wrap'
}, C.a.createElement('div', null, C.a.createElement(OC, {
contents: C.a.createElement('strong', null, this.props.author.name),
showUserPanel: this.props.showUserPanel,
post: this.props
}), C.a.createElement(fC, {
forum: this.props.forum,
user: this.props.author,
context: 'moderation',
limit: 4
}), C.a.createElement('a', {
href: this.props.url,
target: 'new',
title: m,
className: 'link-gray bullet'
}, C.a.createElement('time', {
className: 'time-ago'
}, d)), this.props.isEdited ? C.a.createElement('span', {
className: 'has-edit bullet'
}, 'edited') : null), C.a.createElement('div', {
className: 'spacing-right'
}, C.a.createElement('span', {
className: 'comment-author-info'
}, this.props.author.email ? C.a.createElement('a', {
href: this.getUrl({
search: 'post_email_lookup:'.concat(this.props.id)
}),
onClick: this.searchByEmail
}, this.props.author.email) : 'email not available'), C.a.createElement('span', {
className: 'bullet',
'aria-hidden': 'true'
}), C.a.createElement('a', {
href: this.getUrl({
search: 'post_ip_lookup:'.concat(this.props.id)
}),
onClick: this.searchByIp
}, this.props.ipAddress))), C.a.createElement('div', {
className: 'comment-moderate__message'
}, C.a.createElement('span', {
className: 'flag'
}), c, C.a.createElement('div', {
className: 'spacing-narrow'.concat(this.state.isEditing ? '' : ' hidden')
}, C.a.createElement('textarea', {
className: 'comment-moderate__textarea',
ref: this.editInput,
rows: '5',
value: this.state.editInputContent,
onChange: function (e) {
return t.setState({
editInputContent: e.target.value
})
}
}), this.props.isApproved ? null : C.a.createElement('p', {
className: 'reply-notice'
}, 'Editing this comment will also approve it.'), C.a.createElement('div', {
className: 'time-ago'
}, o, C.a.createElement('a', {
href: 'https://help.disqus.com/commenting/remove-and-edit-your-comments',
target: '_blank',
rel: 'noopener noreferrer',
style: {
color: 'inherit',
textDecoration: 'underline',
textAlign: 'center'
}
}, 'Learn more')), C.a.createElement('div', null, C.a.createElement('button', {
className: 'button button-small button-fill--brand spacing-right-small',
onClick: this.saveEdit
}, this.state.isSaving ? 'Saving...' : 'Save Edit'), C.a.createElement('button', UC({
className: 'button button-small button-fill -dark-hover',
onClick: this.finishEdit
}, e), 'Cancel'), l)), 'deleted' === this.props.status || 'spam' === this.props.status || this.state.isEditing || this.state.isReplying ? null : C.a.createElement('div', {
className: 'comment-moderate__vote'
}, C.a.createElement('a', {
href: '#',
className: 'vote-up spacing-right link-gray'.concat(1 === this.props.userScore ? ' active' : ''),
onClick: je.a.partial(this.vote, je.a, this.props.id, 1)
}, C.a.createElement('span', {
className: 'icon-arrow-up icon-tiny'
}), ' ', C.a.createElement('span', {
className: 'vote__count text-gray'
}, this.props.likes)), C.a.createElement('a', {
href: '#',
className: 'vote-down spacing-right link-gray'.concat( - 1 === this.props.userScore ? ' active' : ''),
onClick: je.a.partial(this.vote, je.a, this.props.id, - 1)
}, C.a.createElement('span', {
className: 'icon-arrow-down icon-tiny'
}), ' ', C.a.createElement('span', {
className: 'vote__count text-gray',
'data-role': 'downvotes'
}, this.props.dislikes)), u ? C.a.createElement('a', {
href: '#',
className: 'spacing-right '.concat(p ? ' is-staff-only' : ''),
onClick: this.startEdit
}, 'Edit') : null, C.a.createElement('a', {
href: '#',
className: 'spacing-right',
onClick: this.startReply
}, 'Reply')), this.props.child ? C.a.createElement('div', {
className: 'spacing-top spacing-bottom align'
}, C.a.createElement('div', {
className: 'avatar spacing-top-small'
}, C.a.createElement(OC, {
contents: C.a.createElement('img', {
src: this.props.child.author.avatar.permalink,
className: 'comment-moderate__avatar border-radius-sm'
}),
showUserPanel: this.props.showUserPanel,
post: this.props.child
})), C.a.createElement('div', {
className: 'comment-moderate__content'
}, C.a.createElement('span', {
className: 'comment-name'
}, C.a.createElement(OC, {
contents: C.a.createElement('strong', null, this.props.child.author.name),
showUserPanel: this.props.showUserPanel,
post: this.props.child
})), C.a.createElement('span', {
className: 'bullet',
'aria-hidden': 'true'
}), C.a.createElement('a', {
href: this.props.child.url,
target: 'new',
title: r,
className: 'link-gray'
}, C.a.createElement('time', {
className: 'time-ago'
}, a)), C.a.createElement('div', {
className: 'reply-summary',
dangerouslySetInnerHTML: {
__html: this.props.child.modMessage || this.props.child.message
}
}))) : null, C.a.createElement('div', {
className: 'spacing-narrow spacing-top'.concat(this.state.isReplying ? '' : ' hidden')
}, C.a.createElement('textarea', {
className: 'comment-moderate__textarea',
ref: this.replyInput,
rows: '5'
}), this.props.isApproved ? null : C.a.createElement('p', {
className: 'reply-notice'
}, 'This comment will be automatically approved.'), C.a.createElement('div', null, C.a.createElement('button', {
className: 'button button-small button-fill--brand spacing-right-small',
onClick: this.saveReply
}, this.state.isSaving ? 'Posting...' : 'Post Reply'), C.a.createElement('button', UC({
className: 'button button-small button-fill -dark-hover',
onClick: this.finishReply
}, n), 'Cancel'), l))), C.a.createElement('div', {
className: 'comment-moderate__action'
}, this.props.isDeletedByAuthor ? C.a.createElement('em', null, ' This comment has been deleted by the user and can\'t be changed.') : C.a.createElement('div', null, C.a.createElement('button', {
onClick: b ? function () {
return t.props.updateApproveModal({
approveModalIsOpen: !0,
approveModalPostId: t.props.id,
approveModalAuthor: t.props.author
})
}
: this.props.performActionOnPost.bind(null, 'approve', this.props.id, !1),
className: 'action'.concat('approved' === this.props.status || s ? ' button-disabled' : ''),
disabled: 'approved' === this.props.status || s
}, C.a.createElement('span', {
className: 'icon '.concat(WP.approve)
}), 'Approve'), C.a.createElement('button', i ? {
onClick: function () {
return t.props.updateUserListsModal({
isOpen: !0,
listType: 'blacklist',
formValues: LC(LC({
}, Wn.DEFAULT_FORM_VALUES), {
}, {
retroactiveAction: Wn.RETROACTIVE_ACTION_TYPES.MARK_AS_SPAM,
type: 'permanent',
replaceCancel: !0,
username: t.props.author.name,
email: t.props.author.email,
reason: 'Spam'
}),
postId: t.props.id,
author: t.props.author
})
},
className: 'action'.concat('spam' === this.props.status ? ' button-disabled' : ''),
disabled: 'spam' === this.props.status
}
: {
onClick: this.props.performActionOnPost.bind(null, 'spam', this.props.id, !1),
className: 'action'.concat('spam' === this.props.status ? ' button-disabled' : ''),
disabled: 'spam' === this.props.status
}, C.a.createElement('span', {
className: 'icon '.concat(WP.spam)
}), 'Spam'), C.a.createElement('button', {
onClick: this.props.performActionOnPost.bind(null, 'delete', this.props.id, !1),
className: 'action'.concat('deleted' === this.props.status ? ' disabled' : ''),
disabled: 'deleted' === this.props.status
}, C.a.createElement('span', {
className: 'icon '.concat(WP.delete)
}), 'Delete'), YP && 'pending' === this.props.activePage ? C.a.createElement('div', {
className: 'comment-moderate__suggested-action'.concat(h ? '' : ' disabled')
}, C.a.createElement('span', {
className: 'icon icon-lightning'
}), C.a.createElement('span', null, h ? 'Suggested Action:' : 'No Suggested Action'), h ? C.a.createElement('span', {
className: 'action -'.concat(this.props.suggestedAction.postAction),
onClick: this.performSuggestedUserAction
}, C.a.createElement('span', {
className: [
'icon',
'icon-'.concat(VP.posts[this.props.suggestedAction.postAction].icon)
].join(' ')
}), [
(VP.posts[this.props.suggestedAction.postAction] || {
}).text,
yo.a.isFeatureActive('suggested_user_actions') ? (VP.users[this.props.suggestedAction.userAction] || {
}).text : null
].filter(function (e) {
return e
}).join(' & ')) : null) : null), this.props.rule && jn[this.props.rule.action] && Dn[In[this.props.rule.filterName]] ? C.a.createElement('div', {
className: 'comment-moderate__rule'
}, C.a.createElement('strong', {
className: '-'.concat(this.props.rule.action)
}, C.a.createElement('span', {
className: 'icon '.concat(WP[this.props.rule.action])
}), jn[this.props.rule.action].past), ' because ', C.a.createElement(v.Link, {
to: 'settings/moderation'
}, Dn[In[this.props.rule.filterName]][this.props.rule.filterName].title)) : null)))))
}
}
]) && zC(e.prototype, t),
n && zC(e, n),
o
}();
YC(h, 'propTypes', LC(LC({
}, Qs), {
}, {
showUserPanel: b.a.func.isRequired,
togglePostPanelVisible: b.a.func.isRequired,
activePage: b.a.oneOf(['pending',
'approved',
'spam',
'deleted',
'all']).isRequired,
checked: b.a.bool.isRequired,
updateChecked: b.a.func.isRequired,
status: b.a.oneOf(['deleted',
'spam',
'approved',
'unapproved']).isRequired,
hidden: b.a.bool.isRequired,
updateVote: b.a.func.isRequired,
updateMessage: b.a.func.isRequired,
saveReply: b.a.func.isRequired,
performActionOnPost: b.a.func.isRequired,
isActive: b.a.bool.isRequired,
updateActivePost: b.a.func.isRequired,
updateExpanded: b.a.func.isRequired,
allExpanded: b.a.bool.isRequired,
updateFetchData: b.a.func.isRequired,
suggestedAction: b.a.shape({
userAction: b.a.string,
postAction: b.a.string,
reasons: b.a.arrayOf(b.a.string).isRequired
}),
searchFilters: b.a.arrayOf(b.a.string).isRequired,
selection: ht,
searchQuery: b.a.string,
fetchAllFlaggers: b.a.func.isRequired,
saasFeatures: b.a.objectOf(b.a.objectOf(b.a.bool)).isRequired,
fetchSaasFeatures: b.a.func.isRequired,
updateUserListsModal: b.a.func.isRequired,
updateBanFormType: b.a.func.isRequired,
addHotkeys: b.a.func.isRequired,
emitTrackingEvent: b.a.func.isRequired
}));
var QC = Ni.a.attachDrivers(Object(u.connect) (function (e) {
return {
saasFeatures: e.saasFeatures,
selection: e.selection
}
}, {
fetchSaasFeatures: so.fetch,
updateUserListsModal: Js.updateUserListsModal,
updateBanFormType: Js.updateBanFormType,
emitTrackingEvent: Xo({
zone: 'moderation_panel',
section: 'welcome',
product: 'publisher_admin',
area: 'card'
})
}) (h), [
yl
]),
Yc = function (e) {
var t = e.children,
n = e.message;
return C.a.createElement('div', {
className: ''.concat(e.className || '', ' mod-bar__alert align--between align--middle')
}, C.a.createElement('p', {
className: 'mod-bar__alert-message spacing-left'
}, C.a.createElement('strong', null, n)), C.a.createElement('div', {
className: 'mod-bar__actions'
}, t))
};
Yc.displayName = 'ActionBar',
Yc.propTypes = {
children: b.a.node.isRequired,
className: b.a.string,
message: b.a.node.isRequired
};
var KC = Yc;
function JC(e) {
return (JC = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function $C(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function ZC(e, t) {
return (ZC = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function XC(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = tR(n);
return e = a ? (e = tR(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== JC(e) && 'function' != typeof e ? eR(t) : e
}
}
function eR(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function tR(e) {
return (tR = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function nR(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var aR = {
user: {
description: 'search by username'
},
ip: {
description: 'search by IP address'
},
email: {
description: 'search by email address'
},
thread: {
description: 'search by thread ID#'
},
id: {
description: 'search by comment ID#'
}
},
i = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && ZC(e, t)
}(o, A);
var e,
t,
n,
r = XC(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return nR(eR(t = r.call.apply(r, [
this
].concat(n))), 'activate', function () {
t.props.changeActive(!0)
}),
nR(eR(t), 'focus', function () {
t.searchInput.focus()
}),
nR(eR(t), 'clearSearch', function () {
t.props.updateFetchData({
searchQuery: ''
})
}),
nR(eR(t), 'fetchQuery', function () {
var e = t.props.localSearchQuery.replace(/\//g, '%2F');
t.props.updateFetchData({
searchQuery: e
}),
t.props.changeActive(!1)
}),
nR(eR(t), 'updateQueryTag', function (e) {
e = t.props.localSearchQuery.match(/^\s*\w+:/) ? t.props.localSearchQuery.replace(/^\s*\w*:/, ''.concat(e, ':')) : ''.concat(e, ':').concat(t.props.localSearchQuery);
t.props.updateLocalQuery(e)
}),
nR(eR(t), 'handleChange', function (e) {
t.props.updateLocalQuery(e.target.value)
}),
nR(eR(t), 'handleKeyDown', function (e) {
13 === e.keyCode && t.fetchQuery()
}),
nR(eR(t), 'handleBlur', function (e) {
t.searchDropdown && t.searchDropdown.contains(e.relatedTarget) || t.props.changeActive(!1)
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.searchQuery && this.props.updateLocalQuery(this.props.searchQuery)
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
this.props.searchQuery !== e.searchQuery && this.props.updateLocalQuery(e.searchQuery)
}
},
{
key: 'componentDidUpdate',
value: function () {
this.props.isActive ? this.focus() : this.searchInput.blur()
}
},
{
key: 'render',
value: function () {
var t = this,
e = this.props.isActive && !/[\w:]\s/.test(this.props.localSearchQuery);
return C.a.createElement('div', {
className: 'align align__item--grow'
}, C.a.createElement('input', {
ref: function (e) {
t.searchInput = e
},
'aria-label': 'Search all',
placeholder: 'Search all...',
value: window.decodeURIComponent(this.props.localSearchQuery),
onChange: this.handleChange,
onKeyDown: this.handleKeyDown,
onFocus: this.activate,
onBlur: this.handleBlur,
className: 'input--textbox mod-bar__search align__item--grow'
}), C.a.createElement('button', {
className: 'mod-bar__search-icon icon-mod-search',
onClick: this.fetchQuery
}), this.props.searchQuery ? C.a.createElement('span', {
className: 'mod-bar__clear',
onClick: this.clearSearch
}, '×') : null, e ? C.a.createElement('div', {
tabIndex: '1',
ref: function (e) {
t.searchDropdown = e
},
className: 'mod-bar__search-dropdown',
onClick: this.focus
}, C.a.createElement('strong', null, 'Try searching with one of these search parameters:'), C.a.createElement('ul', {
className: 'spacing-bottom'
}, Object.keys(aR).map(function (e) {
return C.a.createElement('li', {
className: 'mod-bar__search-dropdown-item',
key: e
}, C.a.createElement('button', {
className: 'mod-bar__search-dropdown-button',
onClick: t.updateQueryTag.bind(t, e),
tabIndex: '-1'
}, e, ':'), C.a.createElement('span', {
className: 'hidden-sm'
}, aR[e].description))
}))) : null)
}
}
]) && $C(e.prototype, t),
n && $C(e, n),
o
}();
nR(i, 'displayName', 'ModerateSearch'),
nR(i, 'propTypes', {
localSearchQuery: b.a.string.isRequired,
isActive: b.a.bool.isRequired,
updateLocalQuery: b.a.func.isRequired,
changeActive: b.a.func.isRequired,
searchQuery: b.a.string.isRequired,
updateFetchData: b.a.func.isRequired
});
function rR(e) {
var a = e.selected,
r = e.onChange;
return C.a.createElement('ul', {
className: 'mod-bar__dropdown-menu'
}, e.options.map(function (e) {
var t = e.key,
n = e.label,
e = !!~a.indexOf(t);
return C.a.createElement('li', {
key: t
}, C.a.createElement('button', {
onClick: function () {
return r(t)
},
className: [
'mod-bar__dropdown-menu-item mod-bar__section align align--middle',
e ? 'active' : ''
].join(' ')
}, C.a.createElement('span', {
className: [
'icon-mod-check text-gray-dark text-small mod-bar__dropdown-icon align__item',
e ? '' : '-no-icon'
].join(' ')
}), C.a.createElement('span', {
className: 'align__item'
}, n)))
}))
}
var oR = Object(u.connect) (function (e) {
return e.moderateSearch
}, I) (i),
h = b.a.arrayOf(b.a.shape({
key: b.a.string,
label: b.a.string
})).isRequired;
rR.propTypes = {
options: h,
selected: b.a.arrayOf(b.a.string).isRequired,
onChange: b.a.func.isRequired
};
Yc = function (t) {
var e,
n = t.buttonLabel || '';
return n || !t.selected.length || (e = je.a.find(t.options, function (e) {
return e.key === t.selected[0]
})) && (n = e.label),
C.a.createElement(Qc.a, {
className: 'mod-bar__item mod-bar__section',
buttonChildren: C.a.createElement('div', {
className: 'align align--middle'
}, C.a.createElement('span', {
className: ''.concat(t.icon, ' mod-bar__dropdown-icon align__item')
}), C.a.createElement('span', {
className: 'align__item align__item--grow'
}, n), C.a.createElement('span', {
className: 'icon-arrow mod-bar__dropdown-icon align__item'
})),
dropdownClassName: 'mod-bar__dropdown align__item--grow',
autoClose: t.autoClose,
onOpen: t.onOpen,
onClose: t.onClose
}, C.a.createElement(rR, {
options: t.options,
selected: t.selected,
onChange: t.onChange
}))
};
Yc.defaultProps = {
autoClose: !0
},
Yc.propTypes = {
buttonLabel: b.a.node,
icon: b.a.string.isRequired,
options: h,
selected: b.a.arrayOf(b.a.string).isRequired,
onChange: b.a.func.isRequired,
autoClose: b.a.bool,
onOpen: b.a.func,
onClose: b.a.func
};
var iR,
sR = Yc;
function lR(e) {
return (lR = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function cR() {
return (cR = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function uR(e) {
return function (e) {
if (Array.isArray(e)) return pR(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return pR(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? pR(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function pR(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function dR(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function mR(e, t) {
return (mR = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function fR(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = gR(n);
return e = a ? (e = gR(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== lR(e) && 'function' != typeof e ? hR(t) : e
}
}
function hR(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function gR(e) {
return (gR = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function yR(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var bR = 750,
i = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && mR(e, t)
}(o, A);
var e,
t,
n,
r = fR(o);
function o(e) {
var a,
t,
n;
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o),
yR(hR(a = r.call(this, e)), 'toggleChecked', function (e) {
a.props.updatePostsChecked(a.props.postIds, e.target.checked)
}),
yR(hR(a), 'toggleExpanded', function () {
a.props.updateExpanded(!a.props.allExpanded)
}),
yR(hR(a), 'updateDate', function (e, t) {
a.props.updateFetchData({
startDate: e,
endDate: t.endOf('day')
})
}),
yR(hR(a), 'hideDatePicker', function () {
a.setState({
showDatePicker: !1
})
}),
yR(hR(a), 'onDateChange', function (e) {
var t = a.props.startDate;
switch (e) {
case 'day':
case 'week':
case 'month':
case 'year':
t = ct() ().startOf('day').subtract(1, e);
break;
case 'custom':
return void a.setState({
dateRange: e,
showDatePicker: !0
});
case 'all':
default:
t = a.props.minDate
}
'custom' !== e && Is.a.set(AP, e),
a.setState({
dateRange: e
}),
a.updateDate(t, ct() ().endOf('day'))
}),
yR(hR(a), 'handleFilterToggle', function (e) {
clearTimeout(iR);
var t = uR(a.state.filters),
n = t.indexOf(e);
0 <= n ? t.splice(n, 1) : t.push(e),
a.setState({
filters: t
}),
iR = setTimeout(a.handleFiltersClose, bR)
}),
yR(hR(a), 'handleFiltersClose', function () {
clearTimeout(iR),
a.props.updateFetchData({
filters: a.state.filters
})
}),
yR(hR(a), 'handleScroll', function () {
var e;
a.actionBarContainer && (e = a.actionBarContainer.getBoundingClientRect().top <= 0, a.setState({
isFixed: e,
actionBarFillerHeight: e ? a.actionBarHolder.clientHeight : 0
}))
}),
yR(hR(a), 'undoAction', function (e) {
e.preventDefault(),
a.props.undoAction()
}),
yR(hR(a), 'updateSortOrder', function (e) {
a.props.updateFetchData({
sortOrder: e
}),
Is.a.set(qP, e)
}),
yR(hR(a), 'handleGoToTop', function () {
window.scroll(0, 0)
}),
n = a.props.endDate.isSame(ct() ().endOf('day')) ? a.props.startDate.isSame(a.props.minDate) ? 'all' : (t = a.props.startDate, (n = je.a.find(DP, function (e) {
return t.isSame(ct() ().startOf('day').subtract(1, e.key))
})) ? n.key : 'custom') : 'custom',
a.state = {
dateRange: n,
showDatePicker: !1,
filters: a.props.searchFilters,
isFixed: !1,
actionBarFillerHeight: 0
},
a
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.handleScroll = je.a.throttle(this.handleScroll, 250),
window.addEventListener('scroll', this.handleScroll)
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
this.props.searchFilters !== e.searchFilters && this.setState({
filters: e.searchFilters
})
}
},
{
key: 'componentWillUnmount',
value: function () {
window.removeEventListener('scroll', this.handleScroll)
}
},
{
key: 'render',
value: function () {
var t = this,
e = this.state.isFixed,
n = {
};
this.props.allChecked && (n.checked = !0);
var a = 'mod-bar__wrapper',
r = this.props.panelOpen ? 'align-min-desktop' : 'align-min-tablet',
o = null;
e && (o = C.a.createElement('button', {
className: 'button button-link visible-sm padding',
onClick: this.handleGoToTop
}, 'Back to Top'), a += ' fixed');
var i = null;
this.props.actionCompleteMessage ? i = C.a.createElement(KC, {
className: r,
message: this.props.actionCompleteMessage
}, C.a.createElement('span', null, this.props.canUndo ? C.a.createElement('button', {
key: 'undo',
className: 'mod-bar__button -secondary',
onClick: this.undoAction
}, 'Undo') : null, C.a.createElement('button', {
key: 'ok',
className: 'mod-bar__button -gray',
onClick: this.props.dismissMessage
}, 'OK'))) : this.props.numChecked && (i = C.a.createElement(KC, {
className: r,
message: ''.concat(RP(this.props.numChecked), ' selected')
}, YP && 'pending' === this.props.activePage ? C.a.createElement('span', null, C.a.createElement('button', {
key: 'suggestions',
className: 'mod-bar__button -gray spacing-right',
onClick: this.props.performSuggestedActions
}, 'Accept Suggested Actions')) : null, C.a.createElement('span', null, C.a.createElement('button', {
key: 'approve',
className: 'mod-bar__button -gray -grouped',
onClick: je.a.partial(this.props.performAction, 'approve')
}, 'Approve'), C.a.createElement('button', {
key: 'spam',
className: 'mod-bar__button -gray -grouped',
onClick: je.a.partial(this.props.performAction, 'spam')
}, 'Spam'), C.a.createElement('button', {
key: 'delete',
className: 'mod-bar__button -gray -grouped',
onClick: je.a.partial(this.props.performAction, 'delete')
}, 'Delete'))));
var s,
l = null;
return 'custom' === this.state.dateRange && (s = this.props.startDate.format('M/D/YY'), r = this.props.endDate.format('M/D/YY'), l = ''.concat(s, ' - ').concat(r)),
C.a.createElement('div', {
ref: function (e) {
t.actionBarContainer = e
}
}, C.a.createElement('div', {
style: {
height: this.state.actionBarFillerHeight
}
}), C.a.createElement('div', {
ref: function (e) {
t.actionBarHolder = e
},
className: a
}, C.a.createElement('div', {
className: 'mod-bar__filters align align--between align--middle'
}, o, C.a.createElement('div', {
className: 'align align--wrap align__item--grow'.concat(e ? ' hidden-sm' : '')
}, C.a.createElement('div', {
className: 'align align__item--grow'
}, C.a.createElement('span', {
className: 'mod-bar__item mod-bar__check align align--middle align--center'
}, C.a.createElement('input', cR({
type: 'checkbox',
checked: n.checked || !1,
onChange: this.toggleChecked
}, n))), C.a.createElement('div', {
className: 'mod-bar__item mod-bar__search-wrapper relative__wrapper align align__item--grow'
}, C.a.createElement(oR, {
searchQuery: this.props.searchQuery,
updateFetchData: this.props.updateFetchData
}))), C.a.createElement('button', {
className: 'mod-bar__section mod-bar__item -expand -no-icon',
onClick: this.toggleExpanded
}, this.props.allExpanded ? 'Collapse' : 'Expand'), C.a.createElement('div', {
className: 'align align__item--grow'
}, C.a.createElement(sR, {
buttonLabel: 'Filter '.concat(this.props.searchFilters.length ? '('.concat(this.props.searchFilters.length, ')') : 'by'),
options: this.props.searchFilterOptions,
selected: this.state.filters,
icon: 'icon-filter',
onChange: this.handleFilterToggle,
onClose: this.handleFiltersClose,
autoClose: !1
})), C.a.createElement('div', {
className: 'align align__item--grow'
}, C.a.createElement(sR, {
buttonLabel: l,
options: DP,
selected: [
this.state.dateRange
],
icon: 'icon-calendar',
onChange: this.onDateChange
}), C.a.createElement(zp.a, {
onOutsideClick: this.hideDatePicker,
className: 'mod-bar__date '.concat(this.state.showDatePicker && !e ? '' : 'hidden'),
active: this.state.showDatePicker
}, C.a.createElement(Zp, {
maxDate: this.props.maxDate,
minDate: this.props.minDate,
startDate: this.props.startDate,
endDate: this.props.endDate,
onDateChange: this.updateDate,
alwaysOpen: !0
})), C.a.createElement(sR, {
options: FP,
selected: [
this.props.sortOrder
],
icon: 'icon-sort',
onChange: this.updateSortOrder
})))), i))
}
}
]) && dR(e.prototype, t),
n && dR(e, n),
o
}();
yR(i, 'propTypes', {
postIds: b.a.array,
performAction: b.a.func.isRequired,
undoAction: b.a.func.isRequired,
canUndo: b.a.bool.isRequired,
updatePostsChecked: b.a.func.isRequired,
updateExpanded: b.a.func.isRequired,
dismissMessage: b.a.func.isRequired,
actionCompleteMessage: b.a.string,
allChecked: b.a.bool,
allExpanded: b.a.bool,
activePage: b.a.string,
sortOrder: b.a.string,
searchQuery: b.a.string.isRequired,
searchFilters: b.a.arrayOf(b.a.string).isRequired,
searchFilterOptions: b.a.arrayOf(b.a.object).isRequired,
updateFetchData: b.a.func.isRequired,
performSuggestedActions: b.a.func.isRequired,
numChecked: b.a.number.isRequired,
panelOpen: b.a.bool.isRequired,
startDate: s.moment.isRequired,
endDate: s.moment.isRequired,
maxDate: s.moment.isRequired,
minDate: s.moment.isRequired
});
var vR = i;
function _R(e) {
return (_R = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function ER(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function OR(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? ER(Object(n), !0).forEach(function (e) {
CR(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : ER(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function SR(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function wR(e, t) {
return (wR = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function PR(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = NR(n);
return e = a ? (e = NR(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== _R(e) && 'function' != typeof e ? kR(t) : e
}
}
function kR(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function NR(e) {
return (NR = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function CR(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
h = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && wR(e, t)
}(o, A);
var e,
t,
n,
r = PR(o);
function o() {
var n;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) t[a] = arguments[a];
return CR(kR(n = r.call.apply(r, [
this
].concat(t))), 'state', {
userItems: null,
postItems: null,
objects: {
}
}),
CR(kR(n), 'updateUserHistory', function (e, t) {
n.setState({
userItems: null
}),
n.userAPICall = io.a.call('forums/listUserModerationHistory', {
data: {
forum: t,
user: e,
limit: 10
}
}).done(function (t) {
n.setState(function (e) {
return {
userItems: t.response.items,
objects: OR(OR({
}, e.objects), t.response.objects)
}
})
})
}),
CR(kR(n), 'updatePostHistory', function (e) {
n.setState({
postItems: null
}),
n.postAPICall = io.a.call('posts/listModerationHistory', {
data: {
post: e,
limit: 10
}
}).done(function (t) {
n.setState(function (e) {
return {
postItems: t.response.items,
objects: OR(OR({
}, e.objects), t.response.objects)
}
})
})
}),
CR(kR(n), 'getComponentProps', function () {
function e(e) {
return OR(OR({
}, e = t[e]), {
}, {
forum: t[e.forum],
post: OR(OR({
}, t[e.post]), {
}, {
thread: t[t[e.post].thread]
}),
targetUser: t[e.targetUser],
thread: t[e.thread],
user: t[e.user]
})
}
var t = n.state.objects;
return {
userModerationHistory: n.state.userItems ? n.state.userItems.filter(function (e) {
return t[e].post && t[e].thread
}).map(e) : null,
postModerationHistory: n.state.postItems ? n.state.postItems.filter(function (e) {
return t[e].post && t[e].thread
}).map(e) : null,
updateUserHistory: n.updateUserHistory,
updatePostHistory: n.updatePostHistory
}
}),
n
}
return e = o,
(t = [
{
key: 'componentWillUnmount',
value: function () {
this.userAPICall && 'pending' === this.userAPICall.state() && this.userAPICall.abort(),
this.postAPICall && 'pending' === this.postAPICall.state() && this.postAPICall.abort()
}
}
]) && SR(e.prototype, t),
n && SR(e, n),
o
}();
CR(h, 'displayName', 'ModerationHistoryDriver');
Yc = Object(ki.createDriver) (h);
function RR(e) {
return (RR = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function xR(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function AR(e, t) {
return (AR = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function DR(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = jR(n);
return e = a ? (e = jR(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== RR(e) && 'function' != typeof e ? function (e) {
if (void 0 !== e) return e;
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called')
}(t) : e
}
}
function jR(e) {
return (jR = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function TR(e, t) {
return function (e) {
if (Array.isArray(e)) return e
}(e) || function (e, t) {
var n = e && ('undefined' != typeof Symbol && e[Symbol.iterator] || e['@@iterator']);
if (null != n) {
var a,
r,
o = [
],
i = !0,
s = !1;
try {
for (n = n.call(e); !(i = (a = n.next()).done) && (o.push(a.value), !t || o.length !== t); i = !0);
} catch (e) {
s = !0,
r = e
} finally {
try {
i || null == n.return || n.return()
} finally {
if (s) throw r
}
}
return o
}
}(e, t) || function (e, t) {
if (e) {
if ('string' == typeof e) return IR(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? IR(e, t) : void 0
}
}(e, t) || function () {
throw new TypeError('Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function IR(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function qR(e) {
var t = e.action,
n = e.activePage,
a = e.updateSearch,
r = Os.prettyDatetime(''.concat(t.dateAdded, ' GMT')),
o = Os.prettyDatetime(t.dateAdded, 'absolute'),
i = (s = TR(FR[t.type], 2)) [0],
e = s[1],
s = t.deletedUser ? C.a.createElement('p', null, t.deletedUser.name || t.deletedUser.username) : C.a.createElement('a', {
href: '//'.concat(pt.a.disqusHost, '/by/').concat(t.user.username),
target: '_blank',
rel: 'noopener noreferrer'
}, t.user.name || t.user.username);
return C.a.createElement('li', {
className: 'user-mod-history__item'
}, C.a.createElement('time', {
className: 'time-ago pull-right',
title: o
}, r), s, C.a.createElement('p', null, i, C.a.createElement('a', {
href: '/admin/moderate/'.concat(n, '/search/id:').concat(t.post.id),
onClick: function (e) {
e.preventDefault(),
a({
searchQuery: 'id:'.concat(t.post.id)
})
}
}, 'Comment #', t.post.id), e))
}
var FR = {
1: [
'Moved ',
' to approved'
],
2: [
'Unapproved ',
''
],
3: [
'Marked ',
' as spam'
],
4: [
'Unmarked ',
' as spam'
],
5: [
'Undeleted ',
''
],
6: [
'Deleted ',
''
],
7: [
'Highlighted ',
''
],
8: [
'Unhighlighted ',
''
],
17: [
'Excluded ',
' from new user pre-moderation'
]
},
i = b.a.shape({
name: b.a.string,
username: b.a.string.isRequired
}),
h = b.a.shape({
dateAdded: b.a.string.isRequired,
id: b.a.number.isRequired,
type: b.a.oneOf(Object.keys(FR).map(Number)).isRequired,
deletedUser: i,
user: i
});
qR.propTypes = {
action: h.isRequired,
activePage: b.a.string.isRequired,
updateSearch: b.a.func.isRequired
};
var LR,
UR,
MR,
i = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && AR(e, t)
}(r, A);
var e,
t,
n,
a = DR(r);
function r() {
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
a.apply(this, arguments)
}
return e = r,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.updatePostHistory(this.props.post.id),
this.props.post.author.id && this.props.updateUserHistory(this.props.post.author.id, this.props.post.forum.id)
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
e.post.id !== this.props.post.id && this.props.updatePostHistory(e.post.id),
!e.post.author.id || e.post.author.id === this.props.post.author.id && e.post.forum.id === this.props.post.forum.id || this.props.updateUserHistory(e.post.author.id, e.post.forum.id)
}
},
{
key: 'render',
value: function () {
function e(e) {
return C.a.createElement(qR, {
key: e.id,
action: e,
activePage: t.props.activePage,
updateSearch: t.props.updateSearch
})
}
var t = this,
n = C.a.createElement('div', {
className: 'spinner -sm spacing-top spacing-bottom'
}),
a = this.props.postModerationHistory ? this.props.postModerationHistory.length ? C.a.createElement('ul', null, this.props.postModerationHistory.map(e)) : C.a.createElement('p', {
className: 'user-mod-history__item'
}, 'This comment has no moderation history.') : n,
n = void 0 === this.props.post.author.id ? C.a.createElement('p', {
className: 'user-mod-history__item'
}, 'Cannot load moderation history for guest user.') : this.props.userModerationHistory ? this.props.userModerationHistory.length ? C.a.createElement('ul', null, this.props.userModerationHistory.map(e)) : C.a.createElement('p', {
className: 'user-mod-history__item'
}, 'This user has no comments with moderation history.') : n;
return C.a.createElement('div', {
className: 'user-mod-history side-panel__content overflow_panel fill_height'
}, C.a.createElement('p', {
className: 'user-mod-history__item'
}, 'Moderation actions on ', C.a.createElement('strong', null, 'this comment'), ':'), a, C.a.createElement('hr', {
className: 'user-mod-history__item'
}), C.a.createElement('p', {
className: 'user-mod-history__item'
}, 'Moderation actions on ', C.a.createElement('strong', null, 'all comments by this user'), ':'), n)
}
}
]) && xR(e.prototype, t),
n && xR(e, n),
r
}();
LR = i,
UR = 'propTypes',
MR = {
activePage: b.a.string.isRequired,
post: b.a.shape({
author: b.a.shape({
id: b.a.string
}).isRequired,
id: b.a.string.isRequired,
forum: b.a.shape({
id: b.a.string.isRequired
}).isRequired
}).isRequired,
updateSearch: b.a.func.isRequired,
userModerationHistory: b.a.arrayOf(h),
updateUserHistory: b.a.func.isRequired,
postModerationHistory: b.a.arrayOf(h),
updatePostHistory: b.a.func.isRequired
},
UR in LR ? Object.defineProperty(LR, UR, {
value: MR,
enumerable: !0,
configurable: !0,
writable: !0
}) : LR[UR] = MR;
var BR = Ni.a.attachDrivers(i, [
Yc
]);
function zR(e) {
return (zR = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function HR(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function GR(e, t) {
return (GR = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function VR(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = YR(n);
return e = a ? (e = YR(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== zR(e) && 'function' != typeof e ? WR(t) : e
}
}
function WR(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function YR(e) {
return (YR = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function QR(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
i = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && GR(e, t)
}(o, A);
var e,
t,
n,
r = VR(o);
function o() {
var a;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return QR(WR(a = r.call.apply(r, [
this
].concat(t))), 'state', {
cursor: {
},
posts: null,
user: null,
isFetching: !1
}),
QR(WR(a), 'updateUser', function (e) {
je.a.isEqual(a.state.user, e) || a.setState({
user: e,
cursor: {
},
posts: null
}, a.fetchData)
}),
QR(WR(a), 'fetchUserPosts', function (e, t) {
var n,
e = a.state.user.isPrivate ? (n = je.a.extend({
limit: 10,
related: [
'forum',
'thread'
],
include: 'approved',
order: 'desc',
query: 'user:'.concat(a.state.user.username)
}, e), 'posts/list') : (n = je.a.extend({
limit: 10,
related: [
'forum',
'thread'
],
user: 'username:'.concat(a.state.user.username)
}, e), 'users/listPosts');
a.setState({
isFetching: !0
}),
a.apiCall = io.a.call(e, {
data: n
}).done(je.a.partial(a.onFetchPosts, je.a, t))
}),
QR(WR(a), 'fetchAnonPosts', function (e, t) {
var n = je.a.extend({
query: 'email:'.concat(a.state.user.email),
related: [
'thread',
'forum'
]
}, e),
e = Ve.a.getFromCookie();
if (a.props.selection.type === ft.organization) n.forum = a.props.selection.organization.forums;
else if (a.props.selection.type === ft.forum) n.forum = a.props.selection.forum.shortname;
else if (e.staff) n.forum = ':all';
else {
if (!e.isModerator) return;
n.forum = ':moderated'
}
a.setState({
isFetching: !0
}),
a.apiCall = io.a.call('posts/list', {
data: n
}).done(je.a.partial(a.onFetchPosts, je.a, t))
}),
QR(WR(a), 'onFetchPosts', function (e, t) {
t = t ? a.state.posts.concat(e.response) : e.response;
a.setState({
posts: t,
isFetching: !1,
cursor: e.cursor
})
}),
QR(WR(a), 'fetchData', function (e, t) {
a.state.user.username ? a.fetchUserPosts(e, t) : a.state.user.email && a.fetchAnonPosts(e, t)
}),
QR(WR(a), 'fetchMore', function () {
a.state.cursor && !a.state.cursor.hasNext || a.fetchData({
cursor: a.state.cursor.next
}, !0)
}),
QR(WR(a), 'getComponentProps', function () {
return {
userPosts: a.state.posts,
userHasMorePosts: !!a.state.cursor.hasNext,
userPostsFetching: a.state.isFetching,
fetchMore: a.fetchMore,
updateUser: a.updateUser
}
}),
a
}
return e = o,
(t = [
{
key: 'componentWillUnmount',
value: function () {
this.apiCall && 'pending' === this.apiCall.state() && this.apiCall.abort()
}
}
]) && HR(e.prototype, t),
n && HR(e, n),
o
}();
QR(i, 'displayName', 'UserPostListDriver'),
QR(i, 'propTypes', {
selection: ht.isRequired
});
Yc = Object(ki.createDriver) (i);
function KR(e) {
return (KR = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function JR(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function $R(e, t) {
return ($R = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function ZR(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = ex(n);
return e = a ? (e = ex(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== KR(e) && 'function' != typeof e ? XR(t) : e
}
}
function XR(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function ex(e) {
return (ex = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function tx(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
i = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && $R(e, t)
}(o, A);
var e,
t,
n,
r = ZR(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return tx(XR(t = r.call.apply(r, [
this
].concat(n))), 'state', {
maxContentHeight: 0
}),
tx(XR(t), 'fetchMore', function (e) {
e.preventDefault(),
t.props.fetchMore()
}),
tx(XR(t), 'searchForUser', function (e) {
e.preventDefault(),
t.props.updateSearch({
searchQuery: t.props.post.author.username ? 'user:'.concat(encodeURIComponent(t.props.post.author.username)) : t.props.post.author.email ? 'post_email_lookup:'.concat(t.props.post.id) : ''
})
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.updateUser(this.props.post.author)
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
je.a.isEqual(e.post.author, this.props.post.author) || this.props.updateUser(e.post.author)
}
},
{
key: 'render',
value: function () {
var e = '/admin/moderate/'.concat(this.props.activePage, '/search/');
this.props.post.author.username ? e += 'user:'.concat(encodeURIComponent(this.props.post.author.username)) : this.props.post.author.email ? e += 'post_email_lookup:'.concat(this.props.post.id) : e = '';
var t = this.props.post.forum.settings.validateAllPosts,
n = null;
return this.props.post.thread.isClosed ? n = 'This discussion is closed' : this.props.post.thread.validateAllPosts && !t && (n = 'This discussion is premoderated'),
C.a.createElement('div', {
className: 'side-panel__content__container overflow_panel spacing-top'
}, n ? C.a.createElement('div', {
className: 'alert alert--muted-dark spacing-left spacing-right spacing-bottom'
}, C.a.createElement('strong', null, n)) : null, C.a.createElement('div', {
className: 'side-panel__content overflow_panel fill_height'
}, this.props.userPosts ? C.a.createElement('div', null, je.a.map(this.props.userPosts, function (e) {
return C.a.createElement('ul', {
key: e.id
}, C.a.createElement('li', {
className: 'user-activity__item'
}, C.a.createElement('div', {
className: 'pull-right'
}, C.a.createElement('img', {
src: e.forum.favicon.cache,
width: '16',
height: '16',
alt: ''
})), C.a.createElement('div', null, C.a.createElement('p', {
className: 'text-smaller'
}, C.a.createElement('a', {
href: e.url,
target: '_blank',
rel: 'noopener noreferrer',
className: 'comment',
'data-comment-id': e.id
}, e.thread.clean_title)), C.a.createElement('p', {
dangerouslySetInnerHTML: {
__html: e.message
}
}), C.a.createElement('p', {
className: 'text-smaller text-gray'
}, Os.prettyDatetime(''.concat(e.createdAt, ' GMT'))))))
}), this.props.userHasMorePosts ? C.a.createElement('a', {
href: '#',
className: 'spacing-bottom',
onClick: this.fetchMore
}, 'Load more comments') : null) : C.a.createElement('p', null, 'This person\'s activity is still being updated.'), this.props.userPostsFetching ? C.a.createElement('div', {
className: 'spinner -sm spacing-top spacing-bottom'
}) : null), e ? C.a.createElement('a', {
className: 'side-panel__button text-small',
href: e,
onClick: this.searchForUser
}, 'Moderate ', 'all' === this.props.activePage ? '' : ''.concat(this.props.activePage, ' '), 'comments from this user') : null, this.props.post.forum.settings.badgesEnabled && this.props.post.author.id ? C.a.createElement('button', {
className: 'side-panel__button text-small',
onClick: this.props.showBadgesModal
}, 'Manage user badges') : null, t ? null : C.a.createElement('button', {
className: 'side-panel__button text-small',
onClick: this.props.toggleThreadPremoderation
}, this.props.post.thread.validateAllPosts ? 'Don\'t premoderate this discussion' : 'Premoderate this discussion'), C.a.createElement('button', {
className: 'side-panel__button text-small',
onClick: this.props.toggleThreadClosed
}, this.props.post.thread.isClosed ? 'Open this discussion' : 'Close this discussion'))
}
}
]) && JR(e.prototype, t),
n && JR(e, n),
o
}();
tx(i, 'propTypes', {
post: b.a.shape(Qs).isRequired,
activePage: b.a.string.isRequired,
showBadgesModal: b.a.func.isRequired,
toggleThreadClosed: b.a.func.isRequired,
toggleThreadPremoderation: b.a.func.isRequired,
updateSearch: b.a.func.isRequired,
userPosts: b.a.array,
userHasMorePosts: b.a.bool.isRequired,
userPostsFetching: b.a.bool.isRequired,
updateUser: b.a.func.isRequired,
fetchMore: b.a.func.isRequired
});
var nx = Ni.a.attachDrivers(i, [
Yc
]);
function ax(e) {
return (ax = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function rx(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function ox(e, t) {
return (ox = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function ix(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = lx(n);
return e = a ? (e = lx(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== ax(e) && 'function' != typeof e ? sx(t) : e
}
}
function sx(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function lx(e) {
return (lx = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function cx(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
i = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && ox(e, t)
}(o, A);
var e,
t,
n,
r = ix(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return cx(sx(t = r.call.apply(r, [
this
].concat(n))), 'state', {
counts: null
}),
cx(sx(t), 'fetchData', function (e) {
e && e.id && (e = {
user: e.id
}, t.props.selection.type === ft.forum ? e.forum = t.props.selection.forum.shortname : t.props.auth.isModerator && (e.network = 'username:'.concat(t.props.auth.username)), t.apiCall = io.a.call('internal/users/moderationDetails', {
data: e
}).done(t.onFetch))
}),
cx(sx(t), 'onFetch', function (e) {
t.setState({
counts: e.response.counts
})
}),
cx(sx(t), 'getComponentProps', function () {
return {
moderationDetailsCounts: t.state.counts
}
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.fetchData(this.props.author)
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
e.author && this.props.author.id !== e.author.id && (this.setState({
counts: null
}), this.fetchData(e.author))
}
},
{
key: 'componentWillUnmount',
value: function () {
this.apiCall && 'pending' === this.apiCall.state() && this.apiCall.abort()
}
}
]) && rx(e.prototype, t),
n && rx(e, n),
o
}();
cx(i, 'displayName', 'ModerationDetailsDriver'),
cx(i, 'propTypes', {
auth: b.a.object.isRequired,
author: b.a.object,
selection: ht.isRequired
});
Yc = Object(ki.createDriver) (i);
function ux(e) {
return (ux = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function px(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function dx(e, t) {
return (dx = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function mx(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = hx(n);
return e = a ? (e = hx(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== ux(e) && 'function' != typeof e ? fx(t) : e
}
}
function fx(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function hx(e) {
return (hx = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function gx(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var yx = {
twitter: '//c.disquscdn.com/next/current/publisher-admin/assets/img/services/twitter-x.png',
facebook: '//c.disquscdn.com/next/current/publisher-admin/assets/img/services/facebook.png',
google: '//c.disquscdn.com/next/current/publisher-admin/assets/img/services/googleplus.png',
disqus: '//c.disquscdn.com/next/current/publisher-admin/assets/img/services/disqus.png',
guest: '//c.disquscdn.com/next/current/publisher-admin/assets/img/services/user.png'
},
bx = {
twitter: 'X (Twitter) user',
facebook: 'Facebook user',
google: 'Google user',
disqus: 'Disqus user',
guest: 'Guest user'
},
i = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && dx(e, t)
}(o, A);
var e,
t,
n,
r = mx(o);
function o() {
var n;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) t[a] = arguments[a];
return gx(fx(n = r.call.apply(r, [
this
].concat(t))), 'showWhitelistForm', function () {
n.props.updateUserListsModal({
isOpen: !0,
listType: 'whitelist',
postId: n.props.postId,
author: n.props.author
})
}),
gx(fx(n), 'showBlacklistForm', function () {
n.props.updateUserListsModal({
isOpen: !0,
listType: 'blacklist',
postId: n.props.postId,
author: n.props.author
})
}),
gx(fx(n), 'updateSearchQuery', function (e, t) {
t && t.nativeEvent && 1 !== t.nativeEvent.which || (t && t.preventDefault(), n.props.updateActivePage('all', je.a.partial(n.props.updateFetchData, {
searchQuery: e
})))
}),
n
}
return e = o,
(t = [
{
key: 'render',
value: function () {
var e,
t = this.props.author.remote ? this.props.author.remote.domain : this.props.author.username ? 'disqus' : 'guest';
return this.props.author.reputation && (e = hN.normalizeReputation(this.props.author.reputation)),
C.a.createElement('div', {
className: 'side-panel__footer'
}, C.a.createElement('div', {
className: 'align align--between spacing-top-small'
}, C.a.createElement('div', {
className: 'align align--column spacing-bottom user-info__wrapper'
}, C.a.createElement('div', {
className: 'align align--middle'
}, C.a.createElement('div', {
className: 'user-info__avatar spacing-right'
}, C.a.createElement('img', {
className: 'border-radius-sm',
src: this.props.author.avatar ? this.props.author.avatar.cache : '//c.disquscdn.com/next/current/publisher-admin/assets/img/noavatar32.png',
width: '32',
height: '32'
}), yx[t] ? C.a.createElement('img', {
className: 'service '.concat(t),
width: '16',
height: '16',
src: yx[t],
alt: bx[t]
}) : null), C.a.createElement('div', {
className: 'user-info__name'
}, C.a.createElement('strong', {
className: 'text-medium text-gray-darker text-bold'
}, this.props.author.name), C.a.createElement('p', {
className: 'text-gray text-smaller truncate-line'
}, this.props.author.email))), C.a.createElement(fC, {
forum: this.props.forum,
user: this.props.author,
context: 'moderation-side-panel',
limit: We.MAX_BADGE_COUNT
})), C.a.createElement('div', null, C.a.createElement('div', {
className: 'align align--row-reverse dropdown--side-panel'
}, C.a.createElement(Qc.a, {
ref: 'userDropdown',
className: 'button padding-small button-fill--gray-light dropdown-toggle',
buttonChildren: C.a.createElement('img', {
className: 'service',
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/services/user.png',
alt: 'Guest user'
})
}, C.a.createElement('ul', {
className: 'dropdown-menu'
}, this.props.author.username ? C.a.createElement('li', null, C.a.createElement('a', {
href: '/admin/moderate/all/search/user:'.concat(this.props.author.username),
onClick: this.updateSearchQuery.bind(this, 'user:'.concat(this.props.author.username))
}, 'View all from ', this.props.author.username)) : null, this.props.author.email ? C.a.createElement('li', null, C.a.createElement('a', {
href: '/admin/moderate/all/search/post_email_lookup:'.concat(this.props.postId),
onClick: this.updateSearchQuery.bind(this, 'post_email_lookup:'.concat(this.props.postId))
}, 'View all from ', this.props.author.email)) : null, this.props.ipAddress ? C.a.createElement('li', null, C.a.createElement('a', {
href: '/admin/moderate/all/search/post_ip_lookup:'.concat(this.props.postId),
onClick: this.updateSearchQuery.bind(this, 'post_ip_lookup:'.concat(this.props.postId))
}, 'View all from ', this.props.ipAddress)) : null)), C.a.createElement('button', {
onClick: this.showBlacklistForm,
className: 'button button-fill--gray-light panel-blacklist spacing-right-small'
}, 'Ban User'), C.a.createElement('button', {
onClick: this.showWhitelistForm,
className: 'button button-fill--gray-light panel-whitelist'
}, 'Trust User')))), C.a.createElement('div', null, C.a.createElement('div', {
className: 'clearfix'
}, e ? C.a.createElement('div', {
className: 'user-stat__block'
}, C.a.createElement('span', {
className: 'user-info__label'
}, C.a.createElement('span', {
className: 'icon-trophy icon__position text-gray-light'
})), C.a.createElement('span', {
className: 'badge--reputation '.concat(e.type)
}, e.verboseName)) : null, C.a.createElement('div', {
className: 'user-stat__block'
}, C.a.createElement('span', {
className: 'user-info__label text-smallest text-gray'
}, ' joined '), C.a.createElement('span', {
className: 'text-gray-darker'
}, ct() ().diff(ct() (this.props.author.joinedAt), 'days'), C.a.createElement('span', {
className: 'text-smallest text-uppercase spacing-left-small'
}, 'days ago'))), C.a.createElement('div', {
className: 'user-stat__block'
}, C.a.createElement('span', {
className: 'user-info__label'
}, C.a.createElement('span', {
className: 'icon-globe icon__position text-gray-light'
})), C.a.createElement('span', {
className: 'text-gray-darker text-small'
}, this.props.ipAddress)), this.props.moderationDetailsCounts ? C.a.createElement('div', null, C.a.createElement('div', {
className: 'user-stat__block'
}, C.a.createElement('span', {
className: 'user-info__label text-smallest text-gray'
}, 'posted'), C.a.createElement('span', {
className: 'text-gray-darker'
}, this.props.moderationDetailsCounts.global.all, C.a.createElement('span', {
className: 'text-smallest text-uppercase spacing-left-small'
}, 'comments'))), C.a.createElement('div', {
className: 'user-stat__block'
}, C.a.createElement('span', {
className: 'user-info__label text-smallest text-gray'
}, 'got'), C.a.createElement('span', {
className: 'text-gray-darker'
}, this.props.moderationDetailsCounts.global.flagged, C.a.createElement('span', {
className: 'text-smallest text-uppercase spacing-left-small'
}, 'flags'))), C.a.createElement('div', {
className: 'user-stat__block'
}, C.a.createElement('span', {
className: 'user-info__label text-smallest text-gray'
}, 'made'), C.a.createElement('span', {
className: 'text-gray-darker'
}, this.props.moderationDetailsCounts.global.spam, C.a.createElement('span', {
className: 'text-smallest text-uppercase spacing-left-small'
}, 'spam')))) : null)))
}
}
]) && px(e.prototype, t),
n && px(e, n),
o
}();
gx(i, 'propTypes', {
author: b.a.object.isRequired,
postId: b.a.string,
forum: b.a.object,
ipAddress: b.a.string,
moderationDetailsCounts: b.a.shape({
global: b.a.object
}),
selection: ht.isRequired,
updateFetchData: b.a.func.isRequired,
updateActivePage: b.a.func.isRequired,
updateUserListsModal: b.a.func.isRequired
});
var vx = Ni.a.attachDrivers(Object(u.connect) (null, {
updateUserListsModal: Js.updateUserListsModal
}) (i), [
Yc
]),
Yc = function (e) {
return C.a.createElement('div', {
className: 'side-panel__header align align--between align--middle'
}, C.a.createElement('div', {
className: 'side-panel__header__title align__item--grow '.concat(e.status)
}, C.a.createElement('p', null, e.children)), C.a.createElement('div', {
className: 'spacing-right-small'
}, C.a.createElement('button', {
id: 'close-panel',
className: 'link-gray spacing-right',
onClick: e.onRequestClose
}, C.a.createElement('span', {
className: 'icon-cancel icon__position icon-small'
}))))
};
Yc.propTypes = {
children: b.a.node.isRequired,
onRequestClose: b.a.func.isRequired,
status: b.a.string.isRequired
};
var _x = Yc,
Yc = function (n) {
var e = Os.prettyDatetime(''.concat(n.post.createdAt, ' GMT')),
t = [
];
if (n.post.parents) for (var a, r = n.post; a = n.post.parents[r.parent]; ) t.push(a),
r = a;
var o = n.post.forum.settings.validateAllPosts,
i = null;
n.post.thread.isClosed ? i = 'This discussion is closed' : n.post.thread.validateAllPosts && !o && (i = 'This discussion is premoderated');
return C.a.createElement('div', {
className: 'side-panel__content__container overflow_panel spacing-top'
}, i ? C.a.createElement('div', {
className: 'alert alert--muted-dark spacing-left spacing-right spacing-bottom'
}, C.a.createElement('strong', null, i)) : null, n.post.thread.reactionsEnabled || !n.post.thread.reactionsEligible ? null : C.a.createElement('div', {
className: 'alert alert--muted-dark spacing-left spacing-right spacing-bottom'
}, C.a.createElement('strong', null, 'Reactions for this discussion are removed')), C.a.createElement('div', {
className: 'side-panel__content overflow_panel fill_height'
}, C.a.createElement('div', {
className: 'comment-thread'
}, C.a.createElement(OC, {
contents: C.a.createElement('strong', null, n.post.author.name),
showUserPanel: n.showUserPanelFromThread,
post: n.post
}), C.a.createElement('time', {
className: 'bullet text-smaller text-gray text-normal'
}, e), C.a.createElement('div', {
className: 'message'
}, C.a.createElement('span', {
dangerouslySetInnerHTML: {
__html: n.post.modMessage || n.post.message
}
}), 0 < n.post.media.length ? C.a.createElement('div', {
className: 'comment-attachments'
}, n.post.media.map(function (e) {
return C.a.createElement('a', {
key: e.thumbnailURL,
href: e.url,
target: '_blank ',
rel: 'noopener noreferrer'
}, e.mediaType === IC.a.MEDIA_TYPES.MP4_VIDEO ? C.a.createElement('video', {
autoPlay: !0,
loop: !0,
muted: !0,
src: e.thumbnailURL,
width: '50'
}) : C.a.createElement('img', {
src: e.thumbnailURL,
width: '50'
}))
})) : null), je.a.map(t, function (e, t) {
return C.a.createElement('div', {
className: 'comment-thread parent parent-'.concat(t),
key: e.id
}, C.a.createElement(OC, {
contents: C.a.createElement('strong', null, e.author.name),
showUserPanel: n.showUserPanelFromThread,
post: e
}), C.a.createElement('time', {
className: 'bullet text-smaller text-gray text-normal'
}, Os.prettyDatetime(''.concat(e.createdAt, ' GMT'))), C.a.createElement('div', {
className: 'message'
}, C.a.createElement('span', {
dangerouslySetInnerHTML: {
__html: e.modMessage || e.message
}
})))
}, void 0))), C.a.createElement('div', {
className: 'side-panel__content spacing-top text-small spacing-bottom'
}, n.post.isApproved ? C.a.createElement('a', {
href: n.post.url,
target: 'new'
}, 'View on original page') : null), n.post.forum.settings.badgesEnabled && n.post.author.id ? C.a.createElement('button', {
className: 'side-panel__button text-small',
onClick: n.showBadgesModal
}, 'Manage user badges') : null, C.a.createElement('a', {
className: 'side-panel__button text-small',
href: '/admin/moderate/'.concat(n.activePage, '/search/thread:').concat(n.post.thread.id),
onClick: function (e) {
e.preventDefault(),
n.updateSearch({
searchQuery: 'thread:'.concat(n.post.thread.id)
})
}
}, 'Moderate ', 'all' === n.activePage ? '' : ''.concat(n.activePage, ' '), 'comments from this discussion'), n.post.thread.isClosed || !n.post.thread.reactionsEligible ? null : C.a.createElement('button', {
className: 'side-panel__button text-small',
onClick: n.toggleReactions
}, n.post.thread.reactionsEnabled ? 'Remove reactions from this discussion' : 'Restore reactions to this discussion'), o ? null : C.a.createElement('button', {
className: 'side-panel__button text-small',
onClick: n.toggleThreadPremoderation
}, n.post.thread.validateAllPosts ? 'Don\'t premoderate this discussion' : 'Premoderate this discussion'), C.a.createElement('button', {
className: 'side-panel__button text-small',
onClick: n.toggleThreadClosed
}, n.post.thread.isClosed ? 'Open this discussion' : 'Close this discussion'))
};
Yc.propTypes = {
post: b.a.shape({
id: b.a.string.isRequired,
thread: b.a.shape({
id: b.a.string.isRequired,
isClosed: b.a.bool,
validateAllPosts: b.a.bool,
reactionsEnabled: b.a.bool,
reactionsEligible: b.a.bool
}).isRequired,
author: b.a.object.isRequired,
createdAt: b.a.string.isRequired,
url: b.a.string.isRequired,
ipAddress: b.a.string,
message: b.a.string.isRequired,
modMessage: b.a.string.isRequired,
media: b.a.array.isRequired,
parents: b.a.object,
isFlagged: b.a.bool,
isApproved: b.a.bool,
forum: b.a.shape({
id: b.a.string.isRequired,
settings: b.a.objectOf(b.a.bool).isRequired
}).isRequired
}).isRequired,
activePage: b.a.string.isRequired,
showBadgesModal: b.a.func.isRequired,
showUserPanelFromThread: b.a.func.isRequired,
toggleReactions: b.a.func.isRequired,
toggleThreadClosed: b.a.func.isRequired,
toggleThreadPremoderation: b.a.func.isRequired,
updateSearch: b.a.func.isRequired
};
var Ex = Yc,
Yc = function (e) {
return C.a.createElement(_.a, {
isOpen: !0,
onRequestClose: e.closeModal,
className: 'admin-modal',
overlayClassName: 'modal-overlay'
}, C.a.createElement('div', {
className: 'admin-modal__header align align--between'
}, C.a.createElement('h3', {
className: 'text-large'
}, 'Keyboard Shortcuts'), C.a.createElement('button', {
className: 'link-gray',
onClick: e.closeModal
}, C.a.createElement('span', {
className: 'icon-cancel icon__position'
}))), C.a.createElement('div', {
className: 'admin-modal__content'
}, C.a.createElement('table', {
cellPadding: 0,
cellSpacing: 0,
className: 'admin-modal__table'
}, C.a.createElement('tbody', null, C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, '?')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Open/close keyboard shortcut cheat sheet modal')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, '] or }')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Tab right (pending / approved / spam / deleted)')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, '[ or {')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Tab left (pending / approved / spam / deleted)')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 'j')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Move cursor down one comment')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 'k')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Move cursor up one comment')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 'x')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Select comment (if cursor is located on it)')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 'o or Enter or .')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Open active comment')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 'r')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Reply to active comment')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 'e')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Edit active comment')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 'd or #')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Mark selected comments as deleted')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 's or !')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Mark selected comments as spam')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 'a')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Mark selected comments as approved')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 'n or >')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Next page')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 'p or < or b')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Previous page')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 'z')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Undo last action')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 'R')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Refresh comments')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, '/')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Search')))), C.a.createElement('tr', null, C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, C.a.createElement('code', null, 'Esc')))), C.a.createElement('td', null, C.a.createElement('p', null, C.a.createElement('span', null, 'Depending on context, close modal or remove focus'))))))))
};
Yc.propTypes = {
closeModal: b.a.func.isRequired
};
var Ox = Yc;
function Sx(e) {
return (Sx = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function wx(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function Px(e, t) {
return (Px = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function kx(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = Cx(n);
return e = a ? (e = Cx(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== Sx(e) && 'function' != typeof e ? Nx(t) : e
}
}
function Nx(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function Cx(e) {
return (Cx = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function Rx(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Yc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && Px(e, t)
}(o, A);
var e,
t,
n,
r = kx(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return Rx(Nx(t = r.call.apply(r, [
this
].concat(n))), 'onOpen', function (e) {
t.props.emitTrackingEvent({
verb: 'view',
object_type: 'modal',
object_id: t.props.postId
}),
e.forum || t.handleClose({
skipAction: !0
})
}),
Rx(Nx(t), 'handleClose', function (n) {
var a,
r;
n.skipAction || (a = t.props.user.id, r = t.props.forum.id, n = je.a.extend({
callback: function () {
var t = this;
n.newUserPremodBypass && Object.keys(this.props.posts).filter(function (e) {
return t.props.posts[e].author.id === a && t.props.posts[e].forum.id === r
}).forEach(function (e) {
t.props.posts[e].author.isNewUserBypassed = !!n.newUserPremodBypass
})
}
}, n || {
}), t.props.performAction('approve', t.props.postId, !1, n)),
t.props.isOpen && t.props.close()
}),
Rx(Nx(t), 'handleSubmit', function (e) {
e.preventDefault(),
t.props.emitTrackingEvent({
verb: 'click',
object_type: 'button',
object_id: t.props.postId
}),
t.handleClose({
newUserPremodBypass: 1
})
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.isOpen && this.onOpen(this.props)
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
e.isOpen && !this.props.isOpen && this.onOpen(e)
}
},
{
key: 'componentWillUnmount',
value: function () {
this.handleClose({
skipAction: !0
})
}
},
{
key: 'render',
value: function () {
return C.a.createElement(_.a, {
isOpen: this.props.isOpen,
onRequestClose: this.handleClose,
className: 'admin-modal -mobile',
overlayClassName: 'modal-overlay'
}, C.a.createElement('div', {
className: 'admin-modal__header align align--between'
}, C.a.createElement('h3', {
className: 'text-large text-capitalized'
}, 'Exclude from new user pre-moderation'), C.a.createElement('button', {
className: 'link-gray',
onClick: this.handleClose
}, C.a.createElement('span', {
className: 'icon-cancel icon__position'
}))), C.a.createElement('form', {
className: 'whitelist-form'
}, C.a.createElement('div', {
className: 'admin-modal__content'
}, C.a.createElement('div', null, C.a.createElement('div', {
className: 'modal__description ban__description'
}, C.a.createElement('p', {
className: 'text-small modal__option-subtext ban__option-subtext'
}, 'Allow this user to bypass the new user pre-moderation filter', this.props.forum.name ? ' on '.concat(this.props.forum.name) : null, '. This will not affect comments caught for other reasons (ex. violating a moderation rule).'), C.a.createElement('p', {
className: 'text-small modal__option-subtext ban__option-subtext'
}, C.a.createElement('b', null, 'Note:'), ' All previous comments flagged by the pre-moderation filter still need to be manually approved.')))), C.a.createElement('div', {
className: 'admin-modal__footer clearfix'
}, C.a.createElement('div', null, C.a.createElement('button', {
className: 'button button-fill--brand button-small text-capitalized spacing-right',
disabled: !1,
onClick: this.handleSubmit
}, 'Exclude'), C.a.createElement('button', {
className: 'button button-fill button-small text-capitalized',
onClick: this.handleClose
}, 'Skip')))))
}
}
]) && wx(e.prototype, t),
n && wx(e, n),
o
}();
Rx(Yc, 'displayName', 'ModerationUserListsModal'),
Rx(Yc, 'propTypes', {
emitTrackingEvent: b.a.func.isRequired,
user: b.a.object,
postId: b.a.string,
forum: b.a.object,
isOpen: b.a.bool.isRequired,
close: b.a.func.isRequired,
performAction: b.a.func.isRequired
});
var xx = Object(u.connect) (null, {
emitTrackingEvent: Xo({
zone: 'moderation_panel',
section: 'bypass_new_user_premoderation',
area: 'user_sidebar'
})
}) (Yc),
Yc = n(495),
Ax = n.n(Yc);
function Dx(e) {
return (Dx = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function jx() {
return (jx = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function Tx(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function Ix(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? Tx(Object(n), !0).forEach(function (e) {
Bx(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Tx(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function qx(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function Fx(e, t) {
return (Fx = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function Lx(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = Mx(n);
return e = a ? (e = Mx(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== Dx(e) && 'function' != typeof e ? Ux(t) : e
}
}
function Ux(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function Mx(e) {
return (Mx = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function Bx(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var zx = {
actionType: We.ACTION_TYPES.AWARD,
selectedBadgeId: null,
errorMessage: null
},
Yc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && Fx(e, t)
}(o, A);
var e,
t,
n,
a = Lx(o);
function o() {
var r;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return Bx(Ux(r = a.call.apply(a, [
this
].concat(t))), 'state', Ix({
}, zx)),
Bx(Ux(r), 'onOpen', function (e) {
r.emitActionEvent({
action: 'view',
forum: e.forum,
user: e.user
}),
e.forum && e.forum !== r.props.forum ? (e = r.getForumBadges(e.forum), r.setState(Ix(Ix({
}, zx), {
}, {
forumBadges: e
}))) : r.handleClose()
}),
Bx(Ux(r), 'getForumBadges', function (e) {
var t = {
};
return e.badges.forEach(function (e) {
t[e.id] = Ix({
}, e)
}),
t
}),
Bx(Ux(r), 'updateBadgeAction', function (e) {
r.setState({
actionType: e.target.value,
selectedBadgeId: null,
errorMessage: null
})
}),
Bx(Ux(r), 'updateBadgeSelection', function (e) {
e.target.disabled || r.setState({
selectedBadgeId: e.target.value
})
}),
Bx(Ux(r), 'getUpdatedUserBadges', function (n) {
var a,
e = r.props.user.badges || [
];
return r.state.actionType === We.ACTION_TYPES.AWARD ? e.unshift(n) : r.state.actionType === We.ACTION_TYPES.REMOVE && (a = null, e.forEach(function (e, t) {
e.id === n.id && (a = t)
}), e.splice(a, 1)),
e
}),
Bx(Ux(r), 'getAwardableBadges', function () {
var t = [
],
n = [
],
e = r.props.forum.badges.map(function (e) {
return Ix({
}, e)
}),
a = r.props.user.badges ? r.props.user.badges.map(function (e) {
return parseInt(e.id, 10)
}) : [
];
return e.forEach(function (e) {
e.criteria === We.BADGES_CRITERIA.MANUAL && (~a.indexOf(e.id) ? (e.disabled = !0, n.push(e)) : (e.disabled = !1, t.push(e)))
}),
[
].concat(t, n)
}),
Bx(Ux(r), 'getRemovableBadges', function () {
var t = [
],
n = [
];
return (r.props.user.badges || [
]).forEach(function (e) {
e.criteria === We.BADGES_CRITERIA.MANUAL ? (e.disabled = !1, t.push(e)) : (e.disabled = !0, n.push(e))
}),
[
].concat(t, n)
}),
Bx(Ux(r), 'getBadgeOptions', function () {
var e = r.state.actionType;
if (r.props.forum && r.props.user) {
if (e === We.ACTION_TYPES.AWARD) return r.getAwardableBadges();
if (e === We.ACTION_TYPES.REMOVE) return r.getRemovableBadges()
}
return []
}),
Bx(Ux(r), 'handleSubmit', function (e) {
e.preventDefault();
function t(e) {
r.setState({
errorMessage: e
})
}
var n,
a;
r.state.selectedBadgeId ? (n = {
badge: r.state.selectedBadgeId,
forum: r.props.forum.id,
user: r.props.user.id
}, e = function (e) {
r.emitActionEvent({
action: a,
badge: e
})
}, (a = r.state.actionType) === We.ACTION_TYPES.AWARD ? r.props.awardBadge(n, e, t) : a === We.ACTION_TYPES.REMOVE && r.props.removeBadge(n, e, t)) : t('You must select a badge to '.concat(r.state.actionType, '.'))
}),
Bx(Ux(r), 'handleClose', function () {
r.setState(Ix({
}, zx)),
r.props.isOpen && r.props.close()
}),
Bx(Ux(r), 'getFormValues', function () {
return {
forum: r.props.forum,
user: r.props.user,
badge: r.state.selectedBadgeId,
errorMessage: r.state.errorMessage
}
}),
Bx(Ux(r), 'emitActionEvent', function (e) {
var t = e.forum || r.props.forum,
n = e.user || r.props.user;
e.action && t && n && ((e = {
zone: 'moderation_panel',
section: 'manage_badges',
area: 'user_sidebar',
verb: e.action,
object_id: t.id,
extra_data: {
user: n.id,
badge: e.badge || null
}
}).extra_data = JSON.stringify(e.extra_data), r.props.emitTrackingEvent(e))
}),
r
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.isOpen && this.onOpen(this.props)
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
var t;
(this.props.isAwarding && e.isAwarded || this.props.isRemoving && e.isRemoved && e.targetBadge) && (t = this.getUpdatedUserBadges(e.targetBadge), this.props.updateUserBadges(this.props.user, t), this.handleClose()),
e.isOpen && !this.props.isOpen && this.onOpen(e)
}
},
{
key: 'componentWillUnmount',
value: function () {
this.handleClose()
}
},
{
key: 'render',
value: function () {
return C.a.createElement(_.a, {
isOpen: this.props.isOpen,
onRequestClose: this.handleClose,
className: 'admin-modal -mobile',
overlayClassName: 'modal-overlay'
}, C.a.createElement('div', {
className: 'admin-modal__header align align--between'
}, C.a.createElement('h3', {
className: 'text-large text-capitalized'
}, 'Manage user badges'), C.a.createElement('button', {
className: 'link-gray',
onClick: this.handleClose
}, C.a.createElement('span', {
className: 'icon-cancel icon__position'
}))), C.a.createElement(Ax.a, jx({
badgeAction: this.state.actionType,
formValues: this.getFormValues(),
badgeOptions: this.getBadgeOptions(),
updateBadgeAction: this.updateBadgeAction,
updateBadgeSelection: this.updateBadgeSelection,
handleSubmit: this.handleSubmit.bind(this),
handleClose: this.handleClose.bind(this)
}, this.props)))
}
}
]) && qx(e.prototype, t),
n && qx(e, n),
o
}();
Bx(Yc, 'displayName', 'ModerateBadgesModal'),
Bx(Yc, 'propTypes', {
emitTrackingEvent: b.a.func.isRequired,
isOpen: b.a.bool.isRequired,
user: b.a.shape({
id: b.a.string,
badges: b.a.arrayOf(b.a.shape(sl))
}),
forum: b.a.shape({
id: b.a.string,
badges: b.a.arrayOf(b.a.shape(sl))
}),
targetBadge: b.a.shape(sl),
updateUserBadges: b.a.func.isRequired,
close: b.a.func.isRequired,
selection: ht,
isAwarding: b.a.bool,
isAwarded: b.a.bool,
isRemoving: b.a.bool,
isRemoved: b.a.bool,
error: b.a.string,
awardBadge: b.a.func.isRequired,
removeBadge: b.a.func.isRequired
});
var Hx = Object(u.connect) (function (e) {
return Ix({
}, e.badgesManage)
}, Ix(Ix({
}, D), {
}, {
emitTrackingEvent: Xo({
zone: 'moderation_panel',
section: 'manage_badges',
area: 'user_sidebar'
})
})) (Yc);
function Gx(e) {
return (Gx = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function Vx() {
return (Vx = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function Wx(e) {
return function (e) {
if (Array.isArray(e)) return Yx(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return Yx(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Yx(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function Yx(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function Qx(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function Kx(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? Qx(Object(n), !0).forEach(function (e) {
tA(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Qx(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function Jx(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function $x(e, t) {
return ($x = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function Zx(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = eA(n);
return e = a ? (e = eA(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== Gx(e) && 'function' != typeof e ? Xx(t) : e
}
}
function Xx(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function eA(e) {
return (eA = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function tA(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var nA = {
USER: 'user',
POST: 'post',
HISTORY: 'history'
},
aA = {
postsChecked: {
},
postsHidden: {
},
lastPostsUpdated: [
],
lastActionName: null,
message: null,
allChecked: !1,
allExpanded: Is.a.get('moderationExpandAll') || !1,
activePostIndex: 0,
isHelpVisible: !1,
panelOpen: !1
},
Yc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && $x(e, t)
}(r, A);
var e,
t,
n,
a = Zx(r);
function r() {
var u;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return tA(Xx(u = a.call.apply(a, [
this
].concat(t))), 'state', Kx(Kx(Kx(Kx({
}, jP), aA), QP), {
}, {
activePageIndex: u.props.pages.indexOf(u.props.params.tab || MP.page),
postStatuses: {
},
sortedPosts: [
],
panelType: null,
panelFixed: !1,
panelContentMaxHeight: 0,
paginatorIndex: 0,
panelAuthor: {
},
panelIpAddress: {
},
panelPostId: null,
panelForum: null
})),
tA(Xx(u), 'panel', C.a.createRef()),
tA(Xx(u), 'panelContainer', C.a.createRef()),
tA(Xx(u), 'getActivePostId', function () {
return u.state.sortedPosts[u.state.activePostIndex]
}),
tA(Xx(u), 'getActivePageName', function () {
return u.props.pages[u.state.activePageIndex] || MP.page
}),
tA(Xx(u), 'toggleHelpVisible', function () {
u.setState({
isHelpVisible: !u.state.isHelpVisible
})
}),
tA(Xx(u), 'getUrl', function (e) {
var t = e.tab,
n = e.search,
e = e.filters;
return hN.getUrl({
tab: t = void 0 === t ? u.props.pages[u.state.activePageIndex] : t,
search: n = void 0 === n ? u.props.searchQuery : n,
filters: e = void 0 === e ? u.props.searchFilters : e
})
}),
tA(Xx(u), 'updateUrl', function (e) {
var t = e.tab,
n = e.search,
e = e.filters;
(void 0 !== t && u.props.params.tab !== t || void 0 !== n && u.props.searchQuery !== n || void 0 !== e && !je.a.isEqual(u.props.searchFilters, e)) && u.props.history.push(u.getUrl({
tab: t,
search: n,
filters: e
}))
}),
tA(Xx(u), 'jesterEmitTabChange', function (e, t, n) {
if (u._readyToEmitTabEvents) {
if (e !== t) {
var a = je.a.pick(u.getJesterExtraData(), 'num_comments', 'tab');
if ('pending' === a.tab && YP) {
if (u.suggestedActionsPromise && 'pending' === u.suggestedActionsPromise.state()) return void u.suggestedActionsPromise.then(u.jesterEmitTabChange.bind(Xx(u), e, t));
a.suggested_actions = u.getSuggestedActionCounts(n)
}
u.props.emitTrackingEvent({
verb: 'click',
area: 'toolbar',
object_type: 'tab',
object_id: a.tab,
extra_data: JSON.stringify(a)
})
}
} else u._readyToEmitTabEvents = !0
}),
tA(Xx(u), 'getJesterExtraData', function () {
return {
num_comments: Object.keys(u.props.posts).length - Object.keys(u.state.postsHidden).filter(function (e) {
return u.state.postsHidden[e]
}).length,
filter: je.a.sortBy(u.props.searchFilters || [
], je.a.identity),
sort: u.props.sortOrder || '',
tab: u.getActivePageName()
}
}),
tA(Xx(u), 'updateActivePage', function (e, t) {
return je.a.has(IP, e) ? (u.setState({
activePageIndex: je.a.indexOf(u.props.pages, e),
paginatorIndex: 0,
allChecked: !1,
postsChecked: {
}
}, t), !0) : (window.alert('This is not a valid URL.'), !1)
}),
tA(Xx(u), 'emitWelcomeEvent', function (t) {
var n;
u._hasEmitWelcomeEvent || (u._hasEmitWelcomeEvent = !0, vo.a.when.apply(vo.a, (n = 'pending' === t.tab && YP) ? [
u.suggestedActionsPromise
] : [
]).then(function (e) {
n && (t.suggested_actions = u.getSuggestedActionCounts(e)),
u.props.emitTrackingEvent({
verb: 'view',
object_type: 'product',
object_id: 'publisher_admin',
area: '' + u.state.paginatorIndex,
extra_data: JSON.stringify(t)
})
}))
}),
tA(Xx(u), 'getPostsSuggestedActions', function (e) {
return e.reduce(function (e, t) {
var n = (u.props.suggestedActions[t] || {
}).postAction;
return n && e.push({
post_id: t,
suggested_action: n
}),
e
}, [
])
}),
tA(Xx(u), 'getSuggestedActionCounts', function (e) {
var a = e && e.suggestedActions || u.props.suggestedActions || {
};
return Object.keys(a).reduce(function (e, t) {
var n = a[t].postAction;
return u.props.posts[t] && n && !u.state.postsHidden[t] && (e[n] += 1),
e
}, {
delete : 0,
spam: 0,
approve: 0
})
}),
tA(Xx(u), 'updateFetchData', function (n, a) {
n = n || {
};
var r = u.props.searchFilters,
o = u.props.searchQuery;
u.resetViewStates(),
u.props.updateFetchData(Kx({
include: IP[n.pageType]
}, n), function () {
var e,
t;
a && a(),
u.emitWelcomeEvent(je.a.pick(u.getJesterExtraData(), 'num_comments', 'tab')),
je.a.has(n, 'filters') && !je.a.isEqual(n.filters, r) && (e = n.filters.filter(function (e) {
return !~r.indexOf(e)
}), u.props.emitTrackingEvent({
verb: 'click',
area: 'toolbar',
object_type: 'filter',
object_id: e.length ? e[0] : '',
extra_data: JSON.stringify(u.getJesterExtraData())
})),
je.a.has(n, 'sortOrder') && (t = u.getJesterExtraData(), u.props.emitTrackingEvent({
verb: 'click',
object_type: 'sort',
object_id: t.sort,
extra_data: JSON.stringify(t)
})),
je.a.has(n, 'startDate') && je.a.has(n, 'endDate') && u.props.emitTrackingEvent({
verb: 'click',
area: 'toolbar',
object_type: 'filter',
object_id: 'date',
extra_data: JSON.stringify(Kx(Kx({
}, u.getJesterExtraData()), {
}, {
filter_start_date: n.startDate.toISOString(),
filter_end_date: n.endDate.toISOString()
}))
}),
je.a.has(n, 'searchQuery') && n.searchQuery !== o && (t = n.searchQuery && n.searchQuery.match(/\b(user|ip|email|thread|id):/), u.props.emitTrackingEvent({
verb: 'click',
area: 'toolbar',
object_type: 'search',
object_id: (t = t ? t[1] : '') ? 'keyword_enabled' : 'no_keywords',
extra_data: JSON.stringify(Kx(Kx({
}, u.getJesterExtraData()), {
}, {
search_keyword: t
}))
}))
})
}),
tA(Xx(u), 'resetViewStates', function () {
u.setState(aA, u.hidePanel)
}),
tA(Xx(u), 'refreshCurrentPage', function () {
u.props.refreshPosts({
}, u.resetViewStates)
}),
tA(Xx(u), 'focusSearch', function () {
u.props.searchChangeActive(!0)
}),
tA(Xx(u), 'removeFocus', function () {
u.props.searchChangeActive(!1),
u.hidePanel()
}),
tA(Xx(u), 'tab', function (e) {
u.navigateToPage(u.props.pages[e])
}),
tA(Xx(u), 'tabOver', function (e) {
var t = u.props.pages.length;
u.tab((u.state.activePageIndex + e + t) % t)
}),
tA(Xx(u), 'checkPostSetsDifferent', function (e, t) {
return !e || !t || je.a.keys(e).length !== je.a.keys(t).length || !je.a.isEqual(je.a.keys(e).sort(), je.a.keys(t).sort())
}),
tA(Xx(u), 'checkFeatureMessage', function (e) {
var t = (e = e || u.props).saasFeatures[(e.selection.organization || {
}).id] || {
};
e.selection.organization && t.isFetched && t.allModRules && u.props.showFeaturedMessage(['moderationRules'])
}),
tA(Xx(u), 'refreshPendingCommentsCount', function (e) {
e = e || u.props,
u.props.pendingCountsIsFetching || u.props.refreshPendingCommentsCount({
start: e.startDate.toISOString(),
end: e.endDate.toISOString()
})
}),
tA(Xx(u), 'getPostStatuses', function (e) {
return je.a.chain(e).map(function (e) {
var t = this.state.postStatuses[e.id] || {
};
return t.current = e.isDeleted ? 'deleted' : e.isSpam ? 'spam' : e.isApproved && !e.isFlagged ? 'approved' : 'unapproved',
[
e.id,
t
]
}, Xx(u)).object().value()
}),
tA(Xx(u), 'anchorPanel', function () {
var e = u.panelContainer.current.getBoundingClientRect().top <= 0;
e !== u.state.panelFixed && u.setState({
panelFixed: e
})
}),
tA(Xx(u), 'resizePanel', function () {
var e,
t;
u.state.panelOpen && (e = u.panel.current.getBoundingClientRect(), t = window.innerHeight || window.document.documentElement.clientHeight, u.setState({
panelMaxHeight: t - Math.max(e.top, 0)
}))
}),
tA(Xx(u), 'showUserPanel', function (e) {
u.setState({
panelOpen: !0,
panelType: nA.USER,
panelAuthor: e.author,
panelIpAddress: e.ipAddress,
panelPostId: e.id,
panelForum: e.forum
})
}),
tA(Xx(u), 'showUserPanelFromThread', function (e) {
u.setState({
panelType: nA.USER,
panelAuthor: e.author,
panelIpAddress: e.ipAddress
})
}),
tA(Xx(u), 'toggleActivePostPanelVisible', function () {
u.togglePostPanelVisible(u.getActivePostId())
}),
tA(Xx(u), 'handlePostClick', function (e) {
u.togglePostPanelVisible(e),
u.props.emitTrackingEvent({
verb: 'click',
area: 'card',
object_type: 'area',
object_id: 'card',
extra_data: JSON.stringify(je.a.pick(u.getJesterExtraData(), 'tab'))
})
}),
tA(Xx(u), 'togglePostPanelVisible', function (e) {
u.state.panelOpen && u.state.panelType === nA.POST && u.state.panelPostId === e ? u.hidePanel() : u.showPostPanel(e)
}),
tA(Xx(u), 'showPostPanel', function (e) {
var t = u.props.posts[e];
t && u.props.fetchThreadReactionsEnabled(t.thread.id).then(function () {
return u.setState({
panelOpen: !0,
panelPostId: e,
panelType: nA.POST,
panelAuthor: t.author,
panelIpAddress: t.ipAddress,
panelForum: t.forum
}, je.a.partial(u.props.getPostParents, e))
})
}),
tA(Xx(u), 'hidePanel', function () {
u.setState({
panelOpen: !1,
panelAuthor: null,
panelIpAddress: null,
panelPostId: null,
panelForum: null
})
}),
tA(Xx(u), 'handlePostMessageUpdate', function (e) {
for (var t, n = arguments.length, a = Array(1 < n ? n - 1 : 0), r = 1; r < n; r++) a[r - 1] = arguments[r];
(t = u.props).updatePostMessage.apply(t, [
e
].concat(a)),
u.props.emitTrackingEvent({
verb: 'update',
area: 'card',
object_type: 'post',
object_id: e,
extra_data: JSON.stringify(je.a.pick(u.getJesterExtraData(), 'filter', 'sort', 'tab'))
})
}),
tA(Xx(u), 'handlePostAction', function (e, t, n, a) {
u.performActionOnPosts(e, t, n, a);
n = je.a.pick(u.getJesterExtraData(), 'filter', 'sort', 'tab');
YP && 'pending' === n.tab && (n.suggested_actions = u.getPostsSuggestedActions([t])),
a && a.newUserPremodBypass && (n.newUserPremodBypass = a.newUserPremodBypass),
u.props.emitTrackingEvent({
verb: 'mark',
adverb: e,
area: 'card',
object_type: 'post',
object_id: t,
extra_data: JSON.stringify(n)
})
}),
tA(Xx(u), 'sortPosts', function (e, r) {
return je.a.chain(e || {
}).values().sort(function (e, t) {
var n = Os.parseISO8601(''.concat(e.createdAt, ' GMT')).getTime(),
a = Os.parseISO8601(''.concat(t.createdAt, ' GMT')).getTime();
return 'asc' === r ? n - a : 'desc' === r ? a - n : e.isFlagged && !t.isFlagged ? - 1 : !e.isFlagged && t.isFlagged ? 1 : a - n
}).pluck('id').value()
}),
tA(Xx(u), 'prevPage', function () {
u.updateActivePostIndex(Math.max(u.state.activePostIndex - MP.perPage, 0))
}),
tA(Xx(u), 'updateActivePost', function (e, t) {
u.updateActivePostIndex(je.a.indexOf(u.state.sortedPosts, e), t)
}),
tA(Xx(u), 'activateNextPost', function () {
u.updateActivePostIndex(u.state.activePostIndex + 1)
}),
tA(Xx(u), 'activatePreviousPost', function () {
u.updateActivePostIndex(u.state.activePostIndex - 1)
}),
tA(Xx(u), 'updateActivePostIndex', function (e, t) {
e < 0 || e === u.state.sortedPosts.length || u.setState({
activePostIndex: e
}, t)
}),
tA(Xx(u), 'savePostReply', function (e, t, n, a) {
u.props.savePostReply(e, t, je.a.bind(function () {
this.setState({
postStatuses: je.a.defaults(tA({
}, e, {
current: 'approved'
}), this.state.postStatuses)
}, n),
'pending' === this.getActivePageName() && this.refreshPendingCommentsCount()
}, Xx(u)), a)
}),
tA(Xx(u), 'toggleActivePostChecked', function () {
var e = u.getActivePostId();
u.updatePostsChecked(e, !u.state.postsChecked[e])
}),
tA(Xx(u), 'updatePostsChecked', function (n, a) {
je.a.isArray(n) || (n = [
n
]),
n = je.a.reject(n, function (e) {
return u.state.postsHidden[e]
}),
u.setState(function (e) {
var t = je.a.defaults(je.a.object(n, n.map(function () {
return a
})), e.postsChecked);
return {
postsChecked: t,
allChecked: je.a.every(this.props.posts, function (e) {
return t[e.id]
})
}
})
}),
tA(Xx(u), 'updateExpanded', function (e) {
Is.a.set('moderationExpandAll', e),
u.setState({
allExpanded: e
})
}),
tA(Xx(u), 'markCheckedPostsApproved', function () {
u.performActionOnCheckedPosts('approve')
}),
tA(Xx(u), 'markCheckedPostsSpam', function () {
u.performActionOnCheckedPosts('spam')
}),
tA(Xx(u), 'markCheckedPostsTrash', function () {
u.performActionOnCheckedPosts('delete')
}),
tA(Xx(u), 'getCheckedPostsIds', function () {
return je.a.chain(u.state.postsChecked).pick(je.a.identity).keys().value()
}),
tA(Xx(u), 'performActionOnCheckedPosts', function (e) {
var t = u.getCheckedPostsIds();
u.performActionOnPosts(e, t);
var n = Object.keys(u.state.postsChecked).reduce(function (e, t) {
return e + (u.state.postsChecked[t] ? 1 : 0)
}, 0),
n = Kx(Kx({
}, u.getJesterExtraData()), {
}, {
num_comments: n
});
YP && 'pending' === n.tab && (n.suggested_actions = u.getPostsSuggestedActions(t)),
u.props.emitTrackingEvent({
verb: 'mark',
adverb: e,
area: 'actionbar',
object_type: 'area',
object_id: 'actionbar',
extra_data: JSON.stringify(n)
})
}),
tA(Xx(u), 'performSuggestedActionsOnCheckedPosts', function () {
var n = 0,
a = {
},
r = [
];
u.getCheckedPostsIds().forEach(function (e) {
var t = (u.props.suggestedActions[e] || {
}).postAction;
t && VP.posts[t] && (n += 1, a[t] = a[t] || [
], a[t].push(e), r.push({
post_id: e,
suggested_action: t
}))
}),
u.props.emitTrackingEvent({
verb: 'click',
object_type: 'button',
object_id: 'accept_suggested_actions',
extra_data: JSON.stringify({
suggested_actions: r
})
}),
u.performActions(a, !1),
u.setState({
message: 1 === n ? 'One suggested action accepted' : ''.concat(n || 'No', ' suggested actions accepted'),
lastActionName: 'accept_suggested_actions'
})
}),
tA(Xx(u), 'performRetroactiveAction', function (t, n, e) {
e === Wn.RETROACTIVE_ACTION_TYPES.MARK_AS_SPAM ? u.performActions({
spam: je.a.keys(u.props.posts).filter(function (e) {
return u.props.posts[e].author.id === n && e !== t
})
}, !0) : e === Wn.RETROACTIVE_ACTION_TYPES.DELETE && u.performActions({
delete : je.a.keys(u.props.posts).filter(function (e) {
return u.props.posts[e].author.id === n && e !== t
})
}, !0)
}),
tA(Xx(u), 'performActionOnPosts', function (e, t, n, a) {
je.a.isArray(t) || (t = [
t
]);
var r = BP[e],
t = je.a.chain(u.props.posts).pick(t).filter(function (e) {
return this.state.postStatuses[e.id].current !== r.status
}, Xx(u)).pluck('id').value();
u.performActions(tA({
}, e, t), n, a),
u.setState({
message: r.successMessage(t.length),
lastActionName: e
})
}),
tA(Xx(u), 'performActions', function (e, t, a) {
var r,
o,
i,
s,
l,
c = u.getActivePageName(),
n = je.a.chain(e).values().flatten().value();
n.length && (je.a.isArray(r = IP[c]) || (r = [
r
]), o = {
}, i = {
}, s = 0, je.a.each(e, function (e, t) {
var n = !je.a.contains(r, (l = BP[t]).status);
je.a.each(e, function (e) {
o[e] = {
current: l.status,
previous: this.state.postStatuses[e].current
},
(i[e] = n) && (s += 1)
}, this),
this.props.performAction(e, t, je.a.bind(function () {
'pending' === c && this.refreshPendingCommentsCount(),
a && a.callback && a.callback.call(this)
}, this), a)
}, Xx(u)), u.setState({
allChecked: !1,
postsChecked: je.a.defaults(je.a.object(n, n.map(function () {
return !1
})), u.state.postsChecked),
postStatuses: je.a.defaults(o, u.state.postStatuses),
postsHidden: je.a.defaults(i, u.state.postsHidden),
lastPostsUpdated: t ? [
] : n,
message: t ? null : u.state.message
}), u.state.sortedPosts.length - s <= 0 && u.fetchMorePosts(function () {
var t = je.a.pick(u.getJesterExtraData(), 'num_comments', 'tab'),
n = 'pending' === t.tab && YP;
vo.a.when.apply(vo.a, n ? [
u.suggestedActionsPromise
] : [
]).then(function (e) {
n && (t.suggested_actions = u.getSuggestedActionCounts(e)),
u.props.emitTrackingEvent({
verb: 'view',
object_type: 'zone',
object_id: 'moderation_panel',
adverb: 'auto',
area: '' + u.state.paginatorIndex,
extra_data: JSON.stringify(t)
})
})
}))
}),
tA(Xx(u), 'undoAction', function () {
var e,
t = je.a.groupBy(u.state.lastPostsUpdated, function (e) {
return zP[this.state.postStatuses[e].previous]
}, Xx(u));
'accept_suggested_actions' === u.state.lastActionName ? e = {
verb: 'click',
object_type: 'button',
object_id: 'undo_accept_suggested_actions',
extra_data: {
suggested_actions: u.getPostsSuggestedActions(u.state.lastPostsUpdated)
}
}
: (e = {
verb: 'mark',
adverb: 'undo_'.concat(u.state.lastActionName),
area: 'actionbar',
extra_data: je.a.pick(u.getJesterExtraData(), 'filter', 'sort', 'tab')
}, YP && 'pending' === u.getActivePageName() && (e.extra_data.suggested_actions = u.getPostsSuggestedActions(u.state.lastPostsUpdated)), 1 === u.state.lastPostsUpdated.length ? (e.object_type = 'post', e.object_id = u.state.lastPostsUpdated[0]) : (e.object_type = 'area', e.object_id = 'actionbar', e.extra_data.num_comments = u.state.lastPostsUpdated.length)),
u.props.emitTrackingEvent(Kx(Kx({
}, e), {
}, {
extra_data: JSON.stringify(e.extra_data)
})),
u.performActions(t, !0)
}),
tA(Xx(u), 'dismissMessage', function () {
u.setState({
message: null
})
}),
tA(Xx(u), 'handleFetchMoreClick', function (e) {
e.preventDefault(),
u.fetchMorePosts(function () {
var t = je.a.pick(u.getJesterExtraData(), 'num_comments', 'tab'),
n = 'pending' === t.tab && YP;
vo.a.when.apply(vo.a, n ? [
u.suggestedActionsPromise
] : [
]).then(function (e) {
n && (t.suggested_actions = u.getSuggestedActionCounts(e)),
u.props.emitTrackingEvent({
verb: 'click',
object_type: 'button',
object_id: 'show_more_comments',
area: '' + u.state.paginatorIndex,
extra_data: JSON.stringify(t)
})
})
})
}),
tA(Xx(u), 'fetchMorePosts', function (e) {
var t;
u.props.hasMorePosts && (t = u.state.sortedPosts.length, u.props.fetchMorePosts(function () {
u.updateActivePostIndex(t),
u.setState(function (e) {
return {
paginatorIndex: e.paginatorIndex + 1
}
}, e)
}))
}),
tA(Xx(u), 'getSearchFilterOptions', function () {
var e,
t = [
{
key: 'noIssue',
label: 'No Issue'
},
{
key: 'isAnonymous',
label: 'Guest'
},
{
key: 'isNewUserNeedsApproval',
label: 'New Commenter'
},
{
key: 'hasLinks',
label: 'Contains Link'
},
{
key: 'hasLowRep',
label: 'Low Rep.'
},
{
key: 'hasBadWords',
label: 'Restricted Word'
},
{
key: 'isFlagged',
label: 'Flagged'
},
{
key: 'isAtFlagLimit',
label: 'Flagged At Threshold'
},
{
key: 'hasMedia',
label: 'Contains Media'
},
{
key: 'isToxic',
label: 'Toxic'
}
],
n = u.props.saasFeatures[(u.props.selection.organization || {
}).id] || {
};
return u.props.selection.type === ft.forum ? e = yo.a.isFeatureActive('thehive', {
forum: u.props.selection.forum.shortname
}) : u.props.selection.type === ft.organization && (e = Object.keys(u.props.selection.organizationForums).some(function (e) {
return yo.a.isFeatureActive('thehive', {
forum: e
})
})),
u.props.selection.organization && n.isFetched && (n.allModRules || e) && t.push({
key: 'isHate',
label: 'Hate Speech'
}, {
key: 'isBullying',
label: 'Bullying'
}, {
key: 'isSexual',
label: 'Sexual'
}, {
key: 'isViolence',
label: 'Violence'
}, {
key: 'isPromotion',
label: 'Promotion'
}),
t.push({
key: 'modifiedByRule',
label: 'Moderation Rules'
}),
'pending' === u.getActivePageName() && t.forEach(function (e) {
var t = u.props.pendingCounts[e.key];
je.a.isNumber(t) && (e.label += ' ('.concat(u.getPendingCount(t), ')'))
}),
t
}),
tA(Xx(u), 'getPendingCount', function (e) {
return TP <= e ? ''.concat(TP, '+') : e
}),
tA(Xx(u), 'toggleReactions', function (e) {
e && e.preventDefault();
e = u.props.posts[u.state.panelPostId].thread;
u.props.toggleReactions(e.id, !e.reactionsEnabled)
}),
tA(Xx(u), 'toggleThreadClosed', function (e) {
e && e.preventDefault(),
u.props.isTogglingClosed || u.props.toggleThreadClosed((e = u.props.posts[u.state.panelPostId].thread).id, !e.isClosed)
}),
tA(Xx(u), 'toggleThreadPremoderation', function (e) {
e && e.preventDefault(),
u.props.emitTrackingEvent({
verb: 'click',
section: 'default',
area: 'user_sidebar',
object_type: 'button',
object_id: 'premoderate_thread'
});
e = u.props.posts[u.state.panelPostId].thread;
u.props.toggleThreadPremoderation(e.id, !e.validateAllPosts)
}),
tA(Xx(u), 'showBadgesModal', function (e) {
u.props.updateBadgesModal({
isOpen: !0,
forum: e.forum || u.state.panelForum,
author: u.state.panelAuthor || u.props.author
})
}),
tA(Xx(u), 'handleUpdateBadges', function (e, t) {
u.setState(function (e) {
return {
panelAuthor: je.a.defaults({
badges: t
}, e.panelAuthor)
}
}, function () {
return u.props.updateUserBadges(e, t)
})
}),
tA(Xx(u), 'sidePanelSearch', function (e) {
e = e.searchQuery;
u.updateUrl({
search: e
}),
u.updateFetchData({
searchQuery: e
})
}),
tA(Xx(u), 'updateApproveModal', function (e) {
var t = e.approveModalIsOpen,
n = e.approveModalPostId,
a = e.approveModalAuthor;
u.setState(function (e) {
return {
approveModalIsOpen: 'boolean' == typeof t ? t : e.approveModalIsOpen,
approveModalPostId: n || e.approveModalPostId,
approveModalAuthor: a || e.approveModalAuthor
}
})
}),
u
}
return e = r,
(t = [
{
key: 'navigateToPage',
value: function (e) {
var t = this;
this.updateUrl({
tab: e = e || MP.page
});
var n = this.getActivePageName();
return this.updateActivePage(e, function () {
t.updateFetchData({
pageType: e
}, function () {
t.jesterEmitTabChange(e, n)
})
})
}
},
{
key: 'componentDidMount',
value: function () {
this.props.params.tab || this.props.history.push(ho.getRoute('/moderate/'.concat(this.props.pages[this.state.activePageIndex]))),
this._hasEmitWelcomeEvent = !1,
this._readyToEmitTabEvents = !1,
this.refreshPendingCommentsCount(),
this.checkFeatureMessage(),
this.navigateToPage(this.props.pages[this.state.activePageIndex]),
this.props.addHotkeys(je.a.map(HP, function (e, t) {
return je.a.isString(e) && (e = {
callbackName: e
}),
je.a.extend({
keyName: t,
callback: je.a.partial.apply(je.a, [
this[e.callbackName]
].concat(Wx(e.callbackArgs || [
]))),
options: {
}
}, e)
}, this)),
this.anchorPanel = je.a.throttle(this.anchorPanel, 250),
this.resizePanel = je.a.debounce(this.resizePanel, 100),
window.addEventListener('scroll', this.anchorPanel),
window.addEventListener('resize', this.resizePanel)
}
},
{
key: 'componentWillUnmount',
value: function () {
window.removeEventListener('scroll', this.anchorPanel),
window.removeEventListener('resize', this.resizePanel)
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
var t,
n;
this.props.saasFeatures !== e.saasFeatures && this.checkFeatureMessage(e),
this.props.postsAreFetching && !e.postsAreFetching || this.checkPostSetsDifferent(this.props.posts, e.posts) ? (t = this.getPostStatuses(e.posts), this.setState({
postStatuses: t,
sortedPosts: this.sortPosts(e.posts, e.sortOrder),
activePostIndex: null
}, je.a.partial(this.updateActivePostIndex, 0)), YP && (this.suggestedActionsPromise = this.props.fetchSuggestedActions(Object.keys(e.posts).filter(function (e) {
return 'unapproved' === t[e].current
})))) : this.props.postsAreUpdating && !e.postsAreUpdating ? (n = this.getPostStatuses(e.posts), this.setState({
postStatuses: n
})) : e.sortOrder !== this.props.sortOrder ? this.setState({
sortedPosts: this.sortPosts(e.posts, e.sortOrder),
activePostIndex: null
}, je.a.partial(this.updateActivePostIndex, 0)) : e.searchQuery !== this.props.searchQuery ? this.updateUrl({
search: e.searchQuery
}) : e.startDate !== this.props.startDate || e.endDate !== this.props.endDate ? this.refreshPendingCommentsCount(e) : this.props.params.tab !== e.params.tab ? this.navigateToPage(e.params.tab) : je.a.isEqual(this.props.searchFilters, e.searchFilters) || this.updateUrl({
filters: e.searchFilters
})
}
},
{
key: 'componentDidUpdate',
value: function (e, t) {
this.state.panelOpen && !t.panelOpen && this.anchorPanel(),
this.state.panelFixed === t.panelFixed && je.a.isEqual(this.state.panelAuthor, t.panelAuthor) || this.resizePanel()
}
},
{
key: 'render',
value: function () {
var n = this;
if (this.props.selection.organization && this.props.selection.organization.pollsOnly) return C.a.createElement(Cm, {
isPolls: !1,
organization: this.props.selection.organization
});
var e,
t = !!this.state.sortedPosts[this.state.activePostIndex] && this.props.posts[this.state.sortedPosts[this.state.activePostIndex]],
a = Object.keys(this.state.postsChecked).reduce(function (e, t) {
return e + (n.state.postsChecked[t] ? 1 : 0)
}, 0),
r = this.getActivePageName(),
o = {
all: 'All',
approved: 'Approved',
pending: 'Pending ('.concat(this.getPendingCount(this.props.pendingCounts.total), ')'),
spam: 'Spam',
deleted: 'Deleted'
},
i = C.a.createElement('div', {
className: 'mod-bar'
}, C.a.createElement(vR, {
postIds: Object.keys(this.props.posts).filter(function (e) {
return !n.props.posts[e].isDeletedByAuthor
}),
performAction: this.performActionOnCheckedPosts,
performSuggestedActions: this.performSuggestedActionsOnCheckedPosts,
canUndo: !!this.state.lastPostsUpdated.length,
undoAction: this.undoAction,
updatePostsChecked: this.updatePostsChecked,
allChecked: this.state.allChecked,
updateExpanded: this.updateExpanded,
allExpanded: this.state.allExpanded,
dismissMessage: this.dismissMessage,
actionCompleteMessage: this.state.message,
activePage: r,
sortOrder: this.props.sortOrder,
searchQuery: this.props.searchQuery,
updateFetchData: this.updateFetchData,
startDate: this.props.startDate,
endDate: this.props.endDate,
maxDate: this.state.maxDate,
minDate: this.state.minDate,
numChecked: a,
panelOpen: this.state.panelOpen,
searchFilters: this.props.searchFilters,
searchFilterOptions: this.getSearchFilterOptions()
}));
e = this.props.postsAreFetching ? C.a.createElement(Ji, null) : 0 < this.state.sortedPosts.length ? null : 'pending' === r && 0 === this.props.pendingCounts.total ? C.a.createElement('div', {
className: 'text-medium padding-default'
}, C.a.createElement('img', {
className: 'moderation__empty',
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/empty.png'
}), C.a.createElement('div', {
className: 'text-bold text-largest text-gray-darker text-center spacing-bottom-narrow'
}, 'Nice work! You\'ve moderated all Pending comments.'), C.a.createElement('div', {
className: 'text-gray-darker text-center'
}, 'Want to learn more about fostering a thriving community? Check out our ', C.a.createElement('a', {
href: 'https://help.disqus.com/customer/en/portal/topics/637329-community-tips/articles'
}, 'Community Tips'))) : C.a.createElement('div', {
className: 'text-medium padding-default'
}, C.a.createElement('img', {
className: 'moderation__empty',
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/empty.png'
}), C.a.createElement('div', {
className: 'text-bold text-largest text-gray-darker text-center spacing-bottom-narrow'
}, 'No comments match this status, filter, or search.'), C.a.createElement('div', {
className: 'text-gray-darker text-center'
}, 'Click another status tab, or adjust your search or filtering method.'));
function s(e) {
var t = e.panelType,
e = e.label;
return C.a.createElement('button', {
className: 'side-panel__tab'.concat(n.state.panelType === t ? ' -active' : ''),
onClick: function () {
return n.setState({
panelType: t
})
}
}, e)
}
var l = null,
c = null;
return this.state.panelOpen && (l = C.a.createElement(_x, {
onRequestClose: this.hidePanel,
status: a = this.state.postStatuses[this.state.panelPostId].current
}, 'This comment is ', 'unapproved' === a ? 'pending' : a), this.state.panelType === nA.USER && (c = C.a.createElement(nx, {
key: 'user-panel',
post: this.props.posts[this.state.panelPostId],
selection: this.props.selection,
activePage: r,
showBadgesModal: this.showBadgesModal,
toggleThreadClosed: this.toggleThreadClosed,
toggleThreadPremoderation: this.toggleThreadPremoderation,
updateSearch: this.sidePanelSearch
})), this.state.panelType === nA.POST && (c = C.a.createElement(Ex, {
key: 'post-panel',
post: this.props.posts[this.state.panelPostId],
activePage: r,
showUserPanelFromThread: this.showUserPanelFromThread,
showBadgesModal: this.showBadgesModal,
toggleReactions: this.toggleReactions,
toggleThreadClosed: this.toggleThreadClosed,
toggleThreadPremoderation: this.toggleThreadPremoderation,
updateSearch: this.sidePanelSearch
})), this.state.panelType === nA.HISTORY && (c = C.a.createElement(BR, {
key: 'history-panel',
activePage: r,
post: this.props.posts[this.state.panelPostId],
updateSearch: this.sidePanelSearch
}))),
C.a.createElement('div', {
className: 'moderation__wrapper'
}, C.a.createElement('div', {
id: 'primary',
className: 'moderation__content'.concat(this.state.panelOpen ? ' panel-open' : '')
}, C.a.createElement('ul', {
className: 'nav-tab-rounded'
}, this.props.pages.map(function (e) {
return C.a.createElement('li', {
className: r === e ? 'nav-tab-rounded__item active' : 'nav-tab-rounded__item',
key: e
}, C.a.createElement(v.Link, {
to: n.getUrl({
tab: e
}),
className: 'nav-tab-rounded__link'
}, C.a.createElement('span', {
className: 'align align--middle'
}, WP[e] ? C.a.createElement('span', {
className: 'spacing-right-small icon '.concat(WP[e])
}) : null, o[e])))
})), i, C.a.createElement('div', {
id: 'new-comments',
className: 'alert-message info',
style: {
display: 'none'
}
}, C.a.createElement('span', {
className: 'pull-right'
}, C.a.createElement('a', {
href: '#',
className: 'btn small'
}, 'Show comments')), C.a.createElement('p', null, '2 new comments')), C.a.createElement('ul', {
className: 'comment-moderate__wrapper'
}, e, this.state.sortedPosts.map(function (e, t) {
var n = this.props.posts[e];
return C.a.createElement(QC, Vx({
key: e,
shadowBanned: n.sb,
showUserPanel: this.showUserPanel,
activePage: r,
togglePostPanelVisible: this.handlePostClick,
checked: !!this.state.postsChecked[e],
updateChecked: this.updatePostsChecked,
updateExpanded: this.updateExpanded,
allExpanded: this.state.allExpanded,
status: this.state.postStatuses[e].current,
hidden: !!this.state.postsHidden[e],
updateVote: this.props.updateVote,
updateMessage: this.handlePostMessageUpdate,
saveReply: this.savePostReply,
performActionOnPost: this.handlePostAction,
isActive: t === this.state.activePostIndex,
updateActivePost: this.updateActivePost,
updateFetchData: this.updateFetchData,
suggestedAction: 'pending' === r ? this.props.suggestedActions[e] : null,
searchQuery: this.props.searchQuery,
searchFilters: this.props.searchFilters,
selection: this.props.selection,
fetchAllFlaggers: this.props.fetchFlaggers.bind(this, tA({
}, n.id, n), n.numReports),
updateApproveModal: this.updateApproveModal
}, n))
}, this)), C.a.createElement('div', {
className: 'moderation__footer'
}, this.props.posts && 0 < this.state.sortedPosts.length ? C.a.createElement('button', {
className: 'button button-wide button-outline button-medium',
disabled: !0 !== this.props.hasMorePosts,
onClick: this.handleFetchMoreClick
}, 'Show more comments') : null)), C.a.createElement('div', {
id: 'secondary',
ref: this.panelContainer,
className: 'moderation__panel'.concat(this.state.panelOpen ? ' panel-open' : '')
}, this.state.panelOpen ? C.a.createElement('div', {
className: 'side-panel__wrapper'.concat(this.state.panelFixed ? ' fixed' : ''),
ref: this.panel
}, C.a.createElement('div', {
className: 'side-panel',
style: {
maxHeight: this.state.panelMaxHeight
}
}, l, C.a.createElement(vx, {
key: this.state.panelPostId,
auth: this.props.auth,
author: this.state.panelAuthor,
postId: this.state.panelPostId,
forum: this.state.panelForum,
ipAddress: this.state.panelIpAddress,
selection: this.props.selection,
updateFetchData: this.updateFetchData,
updateActivePage: this.updateActivePage
}), C.a.createElement('div', {
className: 'align side-panel__tab-container'
}, s({
panelType: nA.POST,
label: 'Thread'
}), s({
panelType: nA.USER,
label: 'Comments'
}), s({
panelType: nA.HISTORY,
label: 'History'
})), c)) : null, t ? C.a.createElement(xx, {
postId: this.state.approveModalPostId || t.id,
user: this.state.approveModalAuthor || t.author,
isOpen: this.state.approveModalIsOpen,
forum: this.state.panelForum || t.forum,
close: function () {
return n.updateApproveModal({
approveModalIsOpen: !1,
approveModalPostId: n.state.approveModalPostId || t.id,
approveModalAuthor: n.state.approveModalAuthor || t.author
})
},
performAction: this.handlePostAction
}) : null, t ? C.a.createElement(ll, {
postId: this.state.panelPostId || t.id,
user: this.state.panelAuthor || t.author,
ipAddress: this.state.panelIpAddress || t.ipAddress,
selection: this.props.selection,
forum: this.state.panelForum || t.forum,
addUserToBlacklist: this.props.addUserToBlacklist,
performRetroactiveAction: this.performRetroactiveAction,
addUserToWhitelist: this.props.addUserToWhitelist,
close: function () {
return n.props.updateUserListsModal({
isOpen: !1,
postId: n.state.panelPostId || t.id,
author: n.state.panelAuthor || t.author
})
},
performActionOnReplacedCancel: this.handlePostAction
}) : null, C.a.createElement(Hx, {
user: this.state.panelAuthor || t.author,
forum: this.state.panelForum || t.forum,
selection: this.props.selection,
updateUserBadges: this.handleUpdateBadges,
close: function () {
return n.props.updateBadgesModal({
isOpen: !1,
author: n.state.panelAuthor || t.author
})
}
})), this.state.isHelpVisible ? C.a.createElement(Ox, {
closeModal: this.toggleHelpVisible
}) : null)
}
}
]) && Jx(e.prototype, t),
n && Jx(e, n),
r
}();
tA(Yc, 'propTypes', {
posts: b.a.objectOf(b.a.shape(Qs)),
searchQuery: b.a.string,
updateFetchData: b.a.func.isRequired,
performAction: b.a.func.isRequired,
updateVote: b.a.func.isRequired,
updatePostMessage: b.a.func.isRequired,
savePostReply: b.a.func.isRequired,
sortOrder: b.a.string.isRequired,
hasMorePosts: b.a.bool,
fetchMorePosts: b.a.func.isRequired,
refreshPosts: b.a.func.isRequired,
postsAreFetching: b.a.bool,
postsAreUpdating: b.a.bool,
fetchThreadReactionsEnabled: b.a.func.isRequired,
toggleReactions: b.a.func.isRequired,
toggleThreadClosed: b.a.func.isRequired,
toggleThreadPremoderation: b.a.func.isRequired,
isTogglingClosed: b.a.bool,
getPostParents: b.a.func.isRequired,
searchFilters: b.a.arrayOf(b.a.string).isRequired,
startDate: s.moment,
endDate: s.moment,
fetchFlaggers: b.a.func.isRequired,
updateUserBadges: b.a.func.isRequired,
pendingCounts: b.a.objectOf(b.a.number).isRequired,
refreshPendingCommentsCount: b.a.func.isRequired,
addHotkeys: b.a.func.isRequired,
emitTrackingEvent: b.a.func.isRequired,
addUserToWhitelist: b.a.func.isRequired,
addUserToBlacklist: b.a.func.isRequired,
showFeaturedMessage: b.a.func.isRequired,
history: b.a.shape({
push: b.a.func.isRequired
}).isRequired,
pages: b.a.array.isRequired,
params: b.a.object.isRequired,
auth: b.a.object.isRequired,
selection: ht.isRequired,
searchChangeActive: b.a.func.isRequired,
fetchSuggestedActions: b.a.func.isRequired,
updateUserListsModal: b.a.func.isRequired,
updateBadgesModal: b.a.func.isRequired,
suggestedActions: b.a.objectOf(b.a.shape({
reasons: b.a.arrayOf(b.a.string).isRequired,
postAction: b.a.oneOf(['approve',
'delete',
'spam',
'unapprove']),
userAction: b.a.oneOf(['permaban',
'tempban',
'shadowban'])
})),
saasFeatures: b.a.objectOf(b.a.objectOf(b.a.bool)).isRequired
}),
tA(Yc, 'defaultProps', {
pages: [
'pending',
'approved',
'spam',
'deleted',
'all'
]
});
I = Ni.a.attachDrivers(Object(u.connect) (function (e) {
return {
suggestedActions: e.suggestedActions,
saasFeatures: e.saasFeatures,
selection: e.selection
}
}, {
updateBadgesModal: D.updateBadgesModal,
updateUserListsModal: Js.updateUserListsModal,
searchChangeActive: I.changeActive,
fetchSuggestedActions: F.fetch,
emitTrackingEvent: Xo({
zone: 'moderation_panel',
section: 'welcome',
product: 'publisher_admin'
})
}) (Fo() (Yc)), [
Ru(['moderationRules']),
Wi,
go,
Ls,
yl
]);
function rA(e) {
return (rA = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function oA(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function iA(e, t) {
return (iA = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function sA(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = lA(n);
return e = a ? (e = lA(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== rA(e) && 'function' != typeof e ? function (e) {
if (void 0 !== e) return e;
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called')
}(t) : e
}
}
function lA(e) {
return (lA = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function cA(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
F = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && iA(e, t)
}(r, A);
var e,
t,
n,
a = sA(r);
function r() {
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
a.apply(this, arguments)
}
return e = r,
(t = [
{
key: 'render',
value: function () {
return C.a.createElement('div', {
className: 'section-contained padding-top'
}, C.a.createElement('div', {
className: 'layout layout__content--narrow'
}, C.a.createElement(wE, {
selection: this.props.selection,
history: this.props.history
})))
}
}
]) && oA(e.prototype, t),
n && oA(e, n),
r
}();
cA(F, 'displayName', 'SetupPolicy'),
cA(F, 'propTypes', {
history: b.a.object.isRequired,
selection: ht.isRequired
});
Yc = Object(u.connect) (function (e) {
return {
selection: e.selection
}
}) (Ni.a.attachDrivers(Fo() (F), [
rc
]));
function uA(e) {
return (uA = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function pA(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function dA(e, t) {
return (dA = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function mA(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = fA(n);
return e = a ? (e = fA(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== uA(e) && 'function' != typeof e ? function (e) {
if (void 0 !== e) return e;
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called')
}(t) : e
}
}
function fA(e) {
return (fA = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
var hA,
gA,
yA,
bA = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && dA(e, t)
}(r, A);
var e,
t,
n,
a = mA(r);
function r() {
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
a.apply(this, arguments)
}
return e = r,
(t = [
{
key: 'componentDidMount',
value: function () {
window._v5Config.moderated_forums.length || (window.location = '/pricing/'),
Au.openCurrentInstance(this.props.adminPath)
}
},
{
key: 'render',
value: function () {
var e = uo.getSupportedSelections(this.props.adminPath),
t = [
];
return e.forum && t.push('site'),
e.organization && t.push('organization'),
C.a.createElement('div', {
className: 'layout'
}, C.a.createElement('div', {
className: 'admin_content'
}, C.a.createElement('h2', {
className: 'text-gray-darker text-larger spacing-bottom-small'
}, this.props.route.title || this.props.children && this.props.children.props.route.title), C.a.createElement(bO, {
path: this.props.adminPath
}, 'You must select a', 'organization' === t[0] ? 'n' : '', ' ', t.join(' or '), ' for this page')))
}
}
]) && pA(e.prototype, t),
n && pA(e, n),
r
}();
function vA(e) {
return (vA = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function _A(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function EA(e, t) {
return (EA = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function OA(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = wA(n);
return e = a ? (e = wA(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== vA(e) && 'function' != typeof e ? SA(t) : e
}
}
function SA(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function wA(e) {
return (wA = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function PA(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
hA = bA,
gA = 'propTypes',
yA = {
adminPath: b.a.string.isRequired,
route: b.a.shape({
title: b.a.string
}).isRequired,
children: b.a.element
},
gA in hA ? Object.defineProperty(hA, gA, {
value: yA,
enumerable: !0,
configurable: !0,
writable: !0
}) : hA[gA] = yA;
Ru = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && EA(e, t)
}(o, A);
var e,
t,
n,
r = OA(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return PA(SA(e = r.call.apply(r, [
this
].concat(n))), 'handleDismiss', function () {
Is.a.set('audienceAnalyticsMessage', !0),
e.setState({
audienceAnalyticsMessage: !0
})
}),
e
}
return e = o,
(t = [
{
key: 'render',
value: function () {
var e = this;
return Is.a.get('audienceAnalyticsMessage') ? null : C.a.createElement(Ki, {
alertType: 'brand-new',
topMarginClass: 'spacing-top-none',
message: C.a.createElement(C.a.Fragment, null, C.a.createElement('span', {
className: 'text-larger text-semibold'
}, 'Explore Audience Analytics'), C.a.createElement('div', {
className: 'suggested-actions__module'
}, C.a.createElement('div', {
className: 'spacing-narrow spacing-bottom'
}, C.a.createElement('ul', {
className: 'suggested-actions__list'
}, C.a.createElement('li', {
className: 'suggested-actions__item'
}, C.a.createElement('span', {
className: 'icon-lightning'
}), C.a.createElement('span', {
className: 'text'
}, 'Identify the most active and loyal members of your community')), C.a.createElement('li', {
className: 'suggested-actions__item'
}, C.a.createElement('span', {
className: 'icon-lightning'
}), C.a.createElement('span', {
className: 'text'
}, 'Track the growth of your community over time')), C.a.createElement('li', {
className: 'suggested-actions__item'
}, C.a.createElement('span', {
className: 'icon-lightning'
}), C.a.createElement('span', {
className: 'text'
}, 'Develop engagement insights about different audience segments')))), C.a.createElement('a', {
href: Pn.audienceAnalytics,
className: 'button button-large button-fill--white text-medium spacing-narrow spacing-right',
target: '_blank',
rel: 'noopener noreferrer',
onClick: function () {
e.props.emitTrackingEvent({
verb: 'click',
object_type: 'link',
object_id: Pn.audienceAnalytics,
adverb: 'learn_more',
area: 'welcome'
})
}
}, 'Learn more'), C.a.createElement('button', {
className: 'button button-large button-fill--brand text-medium spacing-narrow',
target: '_blank',
rel: 'noopener noreferrer',
onClick: this.handleDismiss
}, 'Dismiss')))
})
}
}
]) && _A(e.prototype, t),
n && _A(e, n),
o
}();
PA(Ru, 'displayName', 'AudienceAnalyticsFeaturedMessage'),
PA(Ru, 'propTypes', {
emitTrackingEvent: b.a.func.isRequired
});
Wi = Ni.a.attachDrivers(Ru, [
rc
]);
function kA(e) {
return (kA = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function NA(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function CA(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? NA(Object(n), !0).forEach(function (e) {
TA(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : NA(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function RA(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function xA(e, t) {
return (xA = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function AA(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = jA(n);
return e = a ? (e = jA(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== kA(e) && 'function' != typeof e ? DA(t) : e
}
}
function DA(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function jA(e) {
return (jA = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function TA(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
go = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && xA(e, t)
}(o, A);
var e,
t,
n,
r = AA(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return TA(DA(t = r.call.apply(r, [
this
].concat(n))), 'emitTrackingEvent', function (e) {
return t.props.orgCurrentPackage && t.props.forumDetails ? void t.props.emitTrackingEvent(CA({
extra_data: JSON.stringify({
package: t.props.orgCurrentPackage.name,
aetBannerEnabled: t.props.forumDetails.aetBannerEnabled
})
}, e)) : (t.trackingQueue || (t.trackingQueue = [
]), void t.trackingQueue.push(t.emitTrackingEvent.bind(DA(t), e)))
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.fetchSubscription(),
this.props.fetchForumDetails()
}
},
{
key: 'componentDidUpdate',
value: function () {
if (this.trackingQueue && this.props.orgCurrentPackage && this.props.forumDetails) {
for (var e; e = this.trackingQueue.shift(); ) e();
delete this.trackingQueue
}
}
},
{
key: 'render',
value: function () {
return C.a.cloneElement(this.props.children, CA(CA({
}, this.props), {
}, {
emitTrackingEvent: this.emitTrackingEvent
}))
}
}
]) && RA(e.prototype, t),
n && RA(e, n),
o
}();
TA(go, 'propTypes', {
children: b.a.node,
selection: ht,
fetchSubscription: b.a.func.isRequired,
fetchForumDetails: b.a.func.isRequired,
emitTrackingEvent: b.a.func.isRequired,
forumDetails: $c,
orgCurrentPackage: Ur.PACKAGE_SHAPE
});
var IA = Object(u.connect) (function (e) {
var t = e.subscription;
return CA(CA({
}, e.forumDetails), t)
}, CA(CA(CA({
}, r), a), {
}, {
emitTrackingEvent: Xo({
zone: 'analytics',
section: 'audience_user_table'
})
})) (Ni.a.attachDrivers(go, [
bc
])),
qA = Object(u.connect) (function (e) {
var t = e.subscription;
return CA(CA({
}, e.forumDetails), t)
}, CA(CA(CA({
}, r), a), {
}, {
emitTrackingEvent: Xo({
zone: 'analytics',
section: 'reaction_analytics'
})
})) (Ni.a.attachDrivers(go, [
bc
]));
function FA(e) {
return (FA = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function LA(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function UA(e, t) {
return (UA = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function MA(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = zA(n);
return e = a ? (e = zA(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== FA(e) && 'function' != typeof e ? BA(t) : e
}
}
function BA(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function zA(e) {
return (zA = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function HA(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Ls = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && UA(e, t)
}(o, A);
var e,
t,
n,
r = MA(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return HA(BA(e = r.call.apply(r, [
this
].concat(n))), 'handleDismiss', function () {
Is.a.set('reactionsAnalyticsMessage', !0),
e.setState({
reactionsAnalyticsMessage: !0
})
}),
e
}
return e = o,
(t = [
{
key: 'render',
value: function () {
var e = this;
return Is.a.get('reactionsAnalyticsMessage') ? null : C.a.createElement(Ki, {
alertType: 'brand-new',
topMarginClass: 'spacing-top-none',
message: C.a.createElement(C.a.Fragment, null, C.a.createElement('span', {
className: 'text-larger text-semibold'
}, 'Reactions Analytics!'), C.a.createElement('div', {
className: 'suggested-actions__module'
}, C.a.createElement('div', {
className: 'spacing-narrow spacing-bottom'
}, C.a.createElement('ul', {
className: 'suggested-actions__list'
}, C.a.createElement('li', {
className: 'suggested-actions__item'
}, C.a.createElement('span', {
className: 'icon-lightning'
}), C.a.createElement('span', {
className: 'text'
}, 'Develop insights about how your audience is reacting to your content')), C.a.createElement('li', {
className: 'suggested-actions__item'
}, C.a.createElement('span', {
className: 'icon-lightning'
}), C.a.createElement('span', {
className: 'text'
}, 'From a bird\'s-eye view, compare anonymous and authenticated reactions across different time periods by date or by thread title')), C.a.createElement('li', {
className: 'suggested-actions__item'
}, C.a.createElement('span', {
className: 'icon-lightning'
}), C.a.createElement('span', {
className: 'text'
}, 'See a time period or thread that catches your eye? Use the bottom graph to take a closer look!')), C.a.createElement('li', {
className: 'suggested-actions__item'
}, C.a.createElement('span', {
className: 'icon-lightning'
}), C.a.createElement('span', {
className: 'text'
}, 'Don\'t have Reactions activated yet for your forum? Enable them by ', C.a.createElement('a', {
className: 'hyperlink',
href: 'https://help.disqus.com/en/articles/2199501-reactions',
target: '_blank',
rel: 'noopener noreferrer'
}, 'following the directions here'), '!')))), C.a.createElement('a', {
href: Pn.reactionsAnalytics,
className: 'button button-large button-fill--white text-medium spacing-narrow spacing-right',
target: '_blank',
rel: 'noopener noreferrer',
onClick: function () {
e.props.emitTrackingEvent({
verb: 'click',
object_type: 'link',
object_id: Pn.reactionsAnalytics,
adverb: 'learn_more',
area: 'welcome'
})
}
}, 'Learn more'), C.a.createElement('button', {
className: 'button button-large button-fill--brand text-medium spacing-narrow',
target: '_blank',
rel: 'noopener noreferrer',
onClick: this.handleDismiss
}, 'Dismiss')))
})
}
}
]) && LA(e.prototype, t),
n && LA(e, n),
o
}();
HA(Ls, 'displayName', 'ReactionsAnalyticsFeaturedMessage'),
HA(Ls, 'propTypes', {
emitTrackingEvent: b.a.func.isRequired
});
function GA() {
return yo.a.isFeatureActive('analytics_intercom') ? C.a.createElement('div', {
className: 'content__wrap text-center padding-default'
}, C.a.createElement('p', {
className: 'text-large spacing-narrow spacing-bottom'
}, C.a.createElement('strong', null, 'Have feedback about your analytics?')), C.a.createElement(Mg, null, 'Talk to Us')) : null
}
var yl = Ni.a.attachDrivers(Ls, [
rc
]),
VA = [
{
module: C.a.createElement(IA, null, C.a.createElement(Wi, null)),
routes: [
'/analytics/audience/'
]
},
{
module: null,
routes: [
'/analytics/top_comments/'
]
},
{
module: C.a.createElement(qA, null, C.a.createElement(yl, null)),
routes: [
'/analytics/reactions/'
]
}
],
F = function (e) {
var t = e.children,
n = e.selection,
a = e.history,
r = fo(),
e = je.a.find(VA, function (e) {
return e.routes.some(function (e) {
return e.test ? e.test(r) : e === r
})
});
return C.a.createElement('div', {
className: 'section-contained'
}, C.a.createElement('div', {
className: 'layout layout--stacked-tablet'
}, C.a.createElement('div', {
className: (e = !n.organization.pollsOnly && e && e.module) ? '' : 'layout__main'
}, yo.a.isFeatureActive('polls_pub_admin') ? C.a.createElement(Si, {
selection: n,
pollsOnly: n.organization.pollsOnly
}) : C.a.createElement(mi, {
selection: n,
pollsOnly: n.organization.pollsOnly
}), C.a.createElement('div', {
className: 'layout__content'
}, e || null, C.a.cloneElement(t, {
selection: n,
history: a
}), C.a.createElement(GA, null)))))
};
F.propTypes = {
children: b.a.element.isRequired,
selection: ht.isRequired,
history: b.a.object.isRequired
};
var WA = Object(u.connect) (function (e) {
return {
selection: e.selection
}
}) (Ni.a.attachDrivers(Fo() (F), [
bc
])),
YA = {
engagements: 'engagements',
totalCommenters: 'commenters',
newCommenters: 'new_commenters',
date_published: 'date_published',
comments: 'comments'
},
Ru = b.a.shape({
isFetching: b.a.bool.isRequired,
items: b.a.arrayOf(b.a.shape({
thread_id: b.a.number,
downvotes: b.a.number,
title: b.a.string,
newCommenters: b.a.number,
totalCommenters: b.a.number,
date_published: b.a.string,
signedLink: b.a.string,
link: b.a.string,
comments: b.a.number,
upvotes: b.a.number,
engagements: b.a.number
})),
cursor: b.a.shape({
prev: b.a.string,
hasNext: b.a.bool,
next: b.a.string,
hasPrev: b.a.bool,
total: b.a.string,
id: b.a.string,
more: b.a.bool
}),
hasMore: b.a.bool,
reportData: b.a.shape({
forum: b.a.string,
start: b.a.string,
end: b.a.string,
limit: b.a.number,
order: b.a.string,
sort: b.a.string,
api_key: b.a.string
})
});
function QA(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function KA(a) {
for (var e = 1; e < arguments.length; e++) {
var r = null != arguments[e] ? arguments[e] : {
};
e % 2 ? QA(Object(r), !0).forEach(function (e) {
var t,
n;
n = r[t = e],
t in (e = a) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(r)) : QA(Object(r)).forEach(function (e) {
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(r, e))
})
}
return a
}
function JA() {
return (JA = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function $A(e, t) {
if (null == e) return {
};
var n,
a = function (e, t) {
if (null == e) return {
};
var n,
a,
r = {
},
o = Object.keys(e);
for (a = 0; a < o.length; a++) ~t.indexOf(n = o[a]) || (r[n] = e[n]);
return r
}(e, t);
if (Object.getOwnPropertySymbols) for (var r = Object.getOwnPropertySymbols(e), o = 0; o < r.length; o++) ~t.indexOf(n = r[o]) || Object.prototype.propertyIsEnumerable.call(e, n) && (a[n] = e[n]);
return a
}
function ZA(e) {
var t = e.headers,
n = e.rows,
a = e.onSort,
o = e.reportClick;
return C.a.createElement('table', {
className: 'analytics-table'
}, C.a.createElement('thead', null, C.a.createElement('tr', null, t.map(function (e) {
var t = e.key,
n = e.colClass,
e = $A(e, [
'key',
'colClass'
]);
return C.a.createElement('th', {
key: t,
className: n
}, C.a.createElement(nD, JA({
onSort: a,
sortKey: t,
colClass: n
}, e)))
}))), C.a.createElement('tbody', null, n.map(function (r) {
return C.a.createElement('tr', {
key: r.id
}, t.map(function (e) {
var t = e.formatFn,
n = e.key,
a = e.urlFn,
a = void 0 === a ? function () {
return ''
}
: a,
e = e.colClass,
e = void 0 === e ? '' : e,
t = (void 0 === t ? function (e) {
return e
}
: t) (r[n]),
a = a(r);
return a && (t = C.a.createElement('a', {
href: a,
target: '_blank',
rel: 'noopener noreferrer',
onClick: o ? o.bind(null, {
object_type: 'thread',
object_id: r.id
}) : null
}, t)),
C.a.createElement('td', {
key: n,
className: e
}, C.a.createElement('span', null, t))
}))
})))
}
var XA = 'asc',
eD = 'desc',
tD = {
SORT_NONE: '',
SORT_ASC: XA,
SORT_DESC: eD
};
ZA.propTypes = {
headers: b.a.arrayOf(b.a.shape({
key: b.a.any.isRequired,
content: b.a.node.isRequired,
formatFn: b.a.func,
urlFn: b.a.func,
sortable: b.a.bool,
sortDir: b.a.oneOf(['',
XA,
eD])
})).isRequired,
rows: b.a.arrayOf(b.a.object).isRequired,
onSort: b.a.func.isRequired,
reportClick: b.a.func
};
var nD = function (e) {
var t = e.content,
n = e.onSort,
a = e.sortable,
r = void 0 === a || a,
o = e.sortKey,
i = e.description,
s = e.sortDir,
l = void 0 === s ? '' : s,
a = e.onShowDescription,
s = l === XA ? C.a.createElement('span', {
className: 'icon icon__position icon-small icon-arrow-up'
}) : l === eD ? C.a.createElement('span', {
className: 'icon icon__position icon-small icon-arrow-down'
}) : r ? C.a.createElement('span', {
className: 'icon icon__position icon-small icon-arrow-up icon-hidden'
}) : null,
e = '' === l ? '' : '-sorted',
a = i ? C.a.createElement(Md, {
tooltipKey: o,
content: i,
onShow: a,
direction: 'top'
}) : null;
return r ? C.a.createElement('div', {
className: e
}, C.a.createElement('button', {
onClick: function () {
return n(o, l === eD ? XA : eD)
}
}, s, ' ', t), a) : C.a.createElement('div', {
className: e
}, s, ' ', t, ' ', a)
};
function aD(e) {
return (aD = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function rD(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function oD(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? rD(Object(n), !0).forEach(function (e) {
pD(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : rD(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function iD(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function sD(e, t) {
return (sD = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function lD(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = uD(n);
return e = a ? (e = uD(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== aD(e) && 'function' != typeof e ? cD(t) : e
}
}
function cD(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function uD(e) {
return (uD = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function pD(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
nD.propTypes = {
content: b.a.node.isRequired,
sortable: b.a.bool,
sortKey: b.a.string.isRequired,
sortDir: b.a.oneOf(['',
XA,
eD]),
onSort: b.a.func.isRequired,
description: b.a.node,
onShowDescription: b.a.func
};
r = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && sD(e, t)
}(o, A);
var e,
t,
n,
r = lD(o);
function o() {
var n;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) t[a] = arguments[a];
return pD(cD(n = r.call.apply(r, [
this
].concat(t))), 'state', {
sortColumn: 'engagements',
sortDir: tD.SORT_DESC,
startDate: ct() ().subtract(1, 'month'),
endDate: ct() ()
}),
pD(cD(n), 'isAdvancedAnalyticsSupported', function () {
if (!n.props.selection.organization) return !1;
var e = n.props.saasFeatures[n.props.selection.organization.id];
return e && e.advancedAnalytics
}),
pD(cD(n), 'getExportUrl', function () {
var e = io.a.getURL('forums/admin/reports/threadReport.csv');
return Eo() (e, {
api_key: pt.a.keys.api,
forum: pt.a.currentForum,
start: ct.a.utc(n.state.startDate).format(),
end: ct.a.utc(n.state.endDate).format()
})
}),
pD(cD(n), 'reportExport', function () {
n.props.emitTrackingEvent({
verb: 'export',
object_type: 'file',
object_id: 'csv'
})
}),
pD(cD(n), 'handleSort', function (e, t) {
n.setState({
sortColumn: e,
sortDir: t
}, function () {
return n.fetch()
}),
n.reportClick({
object_type: 'sort',
object_id: 'column',
extra_data: JSON.stringify({
column: e,
sort: t
})
})
}),
pD(cD(n), 'handleDateChange', function (e, t) {
n.setState({
startDate: e,
endDate: t
}, function () {
return n.fetch()
}),
n.reportClick({
object_type: 'filter',
object_id: 'date',
extra_data: JSON.stringify({
filter_start_date: ct.a.utc(e).format(),
filter_end_date: ct.a.utc(t).format()
})
})
}),
pD(cD(n), 'fetch', function () {
n.props.fetchAnalyticsContent({
forum: pt.a.currentForum,
start: n.state.startDate.toISOString(),
end: n.state.endDate.toISOString(),
sortKey: n.state.sortColumn,
sortOrder: n.state.sortDir
})
}),
pD(cD(n), 'fetchMore', function () {
n.props.fetchAnalyticsContentMore(),
n.reportClick({
object_type: 'button',
object_id: 'show_more'
})
}),
pD(cD(n), 'reportClick', function (e) {
e.verb = 'click',
n.props.emitTrackingEvent(e)
}),
n
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.isAdvancedAnalyticsSupported() ? (this.fetch(), this.props.emitTrackingEvent({
verb: 'view',
object_type: 'page',
object_id: ''.concat(window.document.location.host).concat(window.document.location.pathname)
})) : this.props.history.push(ho.getRoute('/analytics/comments/'))
}
},
{
key: 'render',
value: function () {
var t = this;
if (!this.isAdvancedAnalyticsSupported()) return null;
if (this.props.organization && this.props.organization.pollsOnly) return C.a.createElement(Cm, {
isPolls: !1,
organization: this.props.organization
});
var e = C.a.createElement('div', {
className: 'card__header-right'
}, C.a.createElement('a', {
href: this.getExportUrl(),
target: '_blank',
rel: 'noopener noreferrer',
className: 'card__header-content-item -button -right -left text-semibold text-gray-dark',
onClick: this.reportExport
}, C.a.createElement('span', {
className: 'icon-download text-large spacing-right text-gray'
}), 'Download CSV'), C.a.createElement(Zp, {
minDate: gt,
maxDate: ct() (),
startDate: this.state.startDate,
endDate: this.state.endDate,
onDateChange: this.handleDateChange,
dateWrapperClass: 'card__header-datepicker',
shortcuts: yt
})),
n = function (e) {
return e.toLocaleString()
},
a = this.props.analyticsContent.isFetching ? C.a.createElement(Ji, null) : this.props.analyticsContent.items && 0 !== this.props.analyticsContent.items.length ? null : C.a.createElement('div', {
className: 'empty-content-message'
}, 'No items');
return C.a.createElement('div', null, C.a.createElement(Bp, {
className: 'spacing-bottom',
leftTitle: 'Top Articles',
rightTitle: e,
bodyClassName: '-overflow-scroll analytics-content text-medium padding-default'
}, C.a.createElement(ZA, {
headers: [
{
key: 'title',
content: 'Title',
urlFn: function (e) {
return e.signedLink
},
sortable: !1
},
{
key: 'date_published',
content: 'Date Published',
formatFn: function (e) {
return ct() (e).format('MM/DD/YY')
}
},
{
key: 'engagements',
content: 'Total Engagements',
formatFn: n
},
{
key: 'comments',
content: 'Comments',
formatFn: n
},
{
key: 'totalCommenters',
content: 'Commenters',
formatFn: n
},
{
key: 'newCommenters',
content: 'New Commenters',
formatFn: n
}
].map(function (e) {
return oD(oD({
}, e), {
}, {
sortDir: t.state.sortColumn === e.key ? t.state.sortDir : tD.SORT_NONE
})
}),
rows: (this.props.analyticsContent.items || [
]).map(function (e) {
return oD({
id: e.thread_id
}, e)
}),
onSort: this.handleSort,
reportClick: this.reportClick
}), a, !this.props.analyticsContent.isFetching && this.props.analyticsContent.hasMore ? C.a.createElement('button', {
className: 'button button-wide button-outline button-medium',
onClick: this.fetchMore
}, 'Show more results') : null))
}
}
]) && iD(e.prototype, t),
n && iD(e, n),
o
}();
pD(r, 'propTypes', {
analyticsContent: Ru.isRequired,
fetchAnalyticsContent: b.a.func.isRequired,
fetchAnalyticsContentMore: b.a.func.isRequired,
emitTrackingEvent: b.a.func.isRequired,
history: b.a.shape({
push: b.a.func.isRequired
}).isRequired,
selection: ht.isRequired,
saasFeatures: b.a.objectOf(b.a.objectOf(b.a.bool)).isRequired
});
a = Object(u.connect) (function (e) {
return {
analyticsContent: e.analyticsContent,
saasFeatures: e.saasFeatures,
organization: e.selection.organization
}
}, {
emitTrackingEvent: Xo({
zone: 'analytics',
section: 'content'
}),
fetchAnalyticsContent: function (e) {
return function (t) {
var n = {
forum: e.forum,
start: e.start,
end: e.end,
limit: 25,
order: 'desc' === e.sortOrder ? 'desc' : 'asc',
sort: YA[e.sortKey] || 'engagements'
};
t({
type: U.fetching
}),
io.a.call('forums/admin/reports/threadReport', {
data: n
}).done(function (e) {
t({
type: U.onFetch,
cursor: e.cursor,
isFetching: !1,
items: e.response,
reportData: n
})
})
}
},
fetchAnalyticsContentMore: function () {
return function (t, e) {
var n = e().analyticsContent,
a = n.reportData,
e = n.cursor,
r = n.items;
e && e.hasNext && (t({
type: U.fetching
}), io.a.call('forums/admin/reports/threadReport', {
data: KA(KA({
}, a), {
}, {
cursor: e.next
})
}).done(function (e) {
t({
type: U.onFetchMore,
cursor: e.cursor,
isFetching: !1,
items: r.concat(e.response)
})
}))
}
}
}) (Fo() (r));
function dD(e) {
return (dD = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function mD(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function fD(e, t) {
return (fD = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function hD(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = yD(n);
return e = a ? (e = yD(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== dD(e) && 'function' != typeof e ? gD(t) : e
}
}
function gD(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function yD(e) {
return (yD = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function bD(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
go = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && fD(e, t)
}(o, A);
var e,
t,
n,
r = hD(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return bD(gD(t = r.call.apply(r, [
this
].concat(n))), 'customerPulseSrc', 'https://disqus.com/customer_pulse'),
bD(gD(t), 'state', {
iframeHeight: '1000px'
}),
bD(gD(t), 'resizeIframe', function (e) {
e.data.cp_iframe_height && t.setState({
iframeHeight: ''.concat(e.data.cp_iframe_height, 'px')
})
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.emitTrackingEvent({
verb: 'view',
object_type: 'page',
object_id: ''.concat(window.document.location.host).concat(window.document.location.pathname)
}),
window.addEventListener('message', this.resizeIframe)
}
},
{
key: 'componentWillUnmount',
value: function () {
window.removeEventListener('message', this.resizeIframe)
}
},
{
key: 'render',
value: function () {
return C.a.createElement('div', {
className: 'admin_content'
}, C.a.createElement('iframe', {
src: this.customerPulseSrc,
width: '100%',
height: this.state.iframeHeight,
scrolling: 'no'
}))
}
}
]) && mD(e.prototype, t),
n && mD(e, n),
o
}(),
Ls = Object(u.connect) (function (e) {
return {
saasFeatures: e.saasFeatures
}
}, {
emitTrackingEvent: Xo({
zone: 'analytics',
section: 'pulse'
})
}) (Fo() (go));
function vD(e) {
return (vD = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function _D(e, t) {
return (_D = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function ED(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = SD(n);
return e = a ? (e = SD(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== vD(e) && 'function' != typeof e ? OD(t) : e
}
}
function OD(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function SD(e) {
return (SD = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function wD(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
rc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && _D(e, t)
}(o, A);
var r = ED(o);
function o() {
var a;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return wD(OD(a = r.call.apply(r, [
this
].concat(t))), 'state', {
articleReads: 0,
articleReadsDelta: 0,
commentReads: 0,
commentReadsDelta: 0,
engagements: 0,
engagementsDelta: 0,
topArticle: null,
topArticlePrevious: null,
loading: !0
}),
wD(OD(a), 'fetch', function (e) {
e = e.forum;
a.setState({
loading: !0
}),
io.a.call('forums/admin/reports/overviewStats', {
data: {
forum: e
}
}).done(function (e) {
var t = e.response,
n = !!t.current,
e = !!t.previous;
a.setState({
articleReads: n ? t.current.pageViews : 0,
articleReadsDelta: n && e ? Math.round((t.current.pageViews - t.previous.pageViews) / t.previous.pageViews * 100) : 0,
commentReads: n ? t.current.embedViews : 0,
commentReadsDelta: n && e ? Math.round((t.current.embedViews - t.previous.embedViews) / t.previous.embedViews * 100) : 0,
engagements: n ? t.current.engagements : 0,
engagementsDelta: n && e ? Math.round((t.current.engagements - t.previous.engagements) / t.previous.engagements * 100) : 0
})
}),
io.a.call('forums/admin/reports/threadReport', {
data: {
forum: e,
sort: 'engagements',
limit: 1,
start: ct() ().subtract(1, 'month').format('X'),
end: ct() ().format('X')
}
}).done(function (e) {
a.setState({
topArticle: e.response[0]
})
}),
io.a.call('forums/admin/reports/threadReport', {
data: {
forum: e,
sort: 'engagements',
limit: 1,
start: ct() ().subtract(2, 'month').format('X'),
end: ct() ().subtract(1, 'month').format('X')
}
}).done(function (e) {
a.setState({
topArticlePrevious: e.response[0],
loading: !1
})
})
}),
wD(OD(a), 'handleDismiss', function () {
Is.a.set('analyticsWelcome', !0),
a.setState({
analyticsWelcome: !0
})
}),
wD(OD(a), 'getComponentProps', function () {
return {
articleReads: a.state.articleReads,
articleReadsDelta: a.state.articleReadsDelta,
commentReads: a.state.commentReads,
commentReadsDelta: a.state.commentReadsDelta,
engagements: a.state.engagements,
engagementsDelta: a.state.engagementsDelta,
topArticle: a.state.topArticle,
topArticlePrevious: a.state.topArticlePrevious,
handleDismiss: a.handleDismiss,
overviewContentFetch: a.fetch,
overviewContentLoading: a.state.loading
}
}),
a
}
return o
}();
wD(rc, 'displayName', 'OverviewDriver');
Wi = Object(ki.createDriver) (rc),
yl = function (e) {
var t = Math.round(e.delta),
n = t < 0 ? '↓ ' : 0 < t ? '↑ +' : '',
a = t < 0 ? 'text-red' : 0 < t ? 'text-green' : 'text-gray',
t = [
];
return 'number' == typeof e.metric && t.push(C.a.createElement('p', {
className: 'text-huge',
key: 'metric'
}, e.metric.toLocaleString())),
'number' == typeof e.delta && t.push(C.a.createElement('p', {
className: a,
key: 'delta'
}, n, e.delta, '%', 0 === e.delta ? ' - No change' : null)),
C.a.createElement('div', {
className: 'admin-metric'
}, C.a.createElement('div', {
className: 'text-semibold'
}, e.title, e.tooltip ? C.a.createElement(Md, {
tooltipKey: e.title,
content: e.tooltip,
direction: 'bottom'
}) : null), e.tooltip ? null : C.a.createElement('div', {
className: 'text-medium text-gray'
}, e.children), t.length ? C.a.createElement('div', {
className: 'admin-metric__bottom'
}, t) : null)
};
yl.displayName = 'Metric',
yl.propTypes = {
title: b.a.node.isRequired,
metric: b.a.number,
delta: b.a.number,
tooltip: b.a.node,
children: b.a.node
};
var PD = yl;
function kD(e) {
return (kD = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function ND(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function CD(e, t) {
return (CD = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function RD(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = AD(n);
return e = a ? (e = AD(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== kD(e) && 'function' != typeof e ? xD(t) : e
}
}
function xD(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function AD(e) {
return (AD = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function DD(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var F = {
day: 'day',
month: 'month'
},
jD = (DD(Ru = {
}, F.day, 'YYYY-MM-DD'), DD(Ru, F.month, 'YYYY-MM'), Ru),
TD = ct.a.utc().startOf('day').subtract(1, 'year').add(1, 'day'),
ID = ct.a.utc().startOf('day'),
r = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && CD(e, t)
}(r, A);
var e,
t,
n,
a = RD(r);
function r() {
var c;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return DD(xD(c = a.call.apply(a, [
this
].concat(t))), 'state', {
series: {
votes: [
],
comments: [
],
pageViews: [
],
embedViews: [
]
},
loading: !0,
errorCode: null
}),
DD(xD(c), 'fetchData', function () {
c.setState({
loading: !0
});
var e = c.props.startDate.clone().startOf('month').subtract(1, 'day'),
t = c.props.endDate.clone().endOf('month').startOf('day');
c.apiCall = io.a.call('forums/admin/reports/interactionReport', {
data: {
start: ct.a.max(TD, e).toISOString(),
end: ct.a.min(ID, t).toISOString(),
forum: c.props.selection.forum.shortname
},
success: c.onFetch,
error: c.onError
})
}),
DD(xD(c), 'onFetch', function (e) {
c.setState({
series: {
votes: (e = e.response ? e.response : e).votes_series,
comments: e.comments_series,
pageViews: e.page_view_series,
embedViews: e.embed_view_series
},
loading: !1,
errorCode: null
})
}),
DD(xD(c), 'onError', function (e) {
c.setState({
errorCode: e,
loading: !1
})
}),
DD(xD(c), 'getRows', function () {
for (var e = c.props.startDate.clone().startOf(c.props.interval), t = c.props.endDate.clone().endOf(c.props.interval), n = c.formatDataByInterval(c.state.series.comments.concat(c.state.series.votes)), a = c.formatDataByInterval(c.state.series.comments), r = c.formatDataByInterval(c.state.series.pageViews), o = c.formatDataByInterval(c.state.series.embedViews), i = [
], s = e; s.isBefore(t); s.add(1, c.props.interval)) {
var l = s.format(jD[c.props.interval]);
i.push({
date_utc: s.clone(),
engagements: n[l] || 0,
comments: a[l] || 0,
articleReads: r[l] || 0,
embedReads: o[l] || 0
})
}
e = i.length - 1;
return c.isRowZero(i[e]) && i.splice(e, 1),
i
}),
DD(xD(c), 'isRowZero', function (e) {
return 0 === e.engagements && 0 === e.articleReads && 0 === e.embedReads
}),
DD(xD(c), 'formatDataByInterval', function (e) {
if (!e) return [];
var a = jD[c.props.interval];
return je.a.chain(e).reduce(function (e, t) {
var n = ct.a.utc(t[0]).format(a);
return e[n] = e[n] ? e[n] + t[1] : t[1],
e
}, {
}).value()
}),
DD(xD(c), 'getComponentProps', function () {
return {
overviewStartDate: c.props.startDate,
overviewEndDate: c.props.endDate,
overviewRows: c.getRows(),
overviewLoading: c.state.loading,
overviewErrorCode: c.state.errorCode,
overviewMinDate: TD,
overviewMaxDate: ID
}
}),
c
}
return e = r,
(t = [
{
key: 'componentWillMount',
value: function () {
this.fetchData()
}
},
{
key: 'componentWillUnmount',
value: function () {
this.apiCall && 'pending' === this.apiCall.state() && this.apiCall.abort()
}
},
{
key: 'componentDidUpdate',
value: function (e) {
this.props.startDate === e.startDate && this.props.endDate === e.endDate || this.fetchData()
}
}
]) && ND(e.prototype, t),
n && ND(e, n),
r
}();
DD(r, 'displayName', 'OverviewGraphDriver'),
DD(r, 'propTypes', {
startDate: s.moment.isRequired,
endDate: s.moment.isRequired,
interval: b.a.oneOf(je.a.values(F)).isRequired,
selection: ht.isRequired
});
go = Object(ki.createDriver) (r, function (e) {
return {
selection: e.selection
}
});
function qD(e) {
return (qD = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function FD() {
return (FD = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function LD(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function UD(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? LD(Object(n), !0).forEach(function (e) {
VD(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : LD(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function MD(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function BD(e, t) {
return (BD = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function zD(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = GD(n);
return e = a ? (e = GD(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== qD(e) && 'function' != typeof e ? HD(t) : e
}
}
function HD(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function GD(e) {
return (GD = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function VD(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
function WD(e) {
return e.toLocaleString()
}
var YD = {
key: 'date_utc',
name: 'Date (UTC)',
formatter: function (e) {
return ct.a.utc(e).format('MMM D YYYY')
}
},
QD = {
x: 'date_utc',
keys: {
value: [
'date_utc',
'articleReads',
'embedReads',
'engagements',
'comments'
]
},
names: {
articleReads: 'Article Reads',
embedReads: 'Comment Reads',
engagements: 'Engagements',
comments: 'Comments'
},
axes: {
articleReads: 'y',
embedReads: 'y',
engagements: 'y2',
comments: 'y2'
}
},
KD = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && BD(e, t)
}(o, A);
var e,
t,
n,
r = zD(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return VD(HD(e = r.call.apply(r, [
this
].concat(n))), 'getGraphData', function () {
return UD({
json: e.props.rows.map(function (e) {
return UD(UD({
}, e), {
}, {
date_utc: e.date_utc.toDate()
})
})
}, e.props.graphData || QD)
}),
e
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.chart = Ed.a.generate({
bindto: this.ref.graph,
data: this.getGraphData(),
color: {
pattern: [
'#752C85',
'#8B020E',
'#E56C00',
'#FDBE13'
]
},
transition: {
duration: 0
},
axis: {
y: {
min: 0,
padding: {
bottom: 0
},
tick: {
format: WD
}
},
y2: {
show: !0,
tick: {
format: WD
}
},
x: {
type: 'timeseries',
tick: {
format: YD.formatter
}
}
},
point: {
show: !1
}
})
}
},
{
key: 'componentDidUpdate',
value: function () {
this.chart.load(this.getGraphData())
}
},
{
key: 'componentWillUnmount',
value: function () {
this.chart && (this.chart = this.chart.destroy())
}
},
{
key: 'render',
value: function () {
var t = this;
return C.a.createElement('div', {
ref: function (e) {
t.ref = t.ref || {
},
t.ref.graph = e
}
})
}
}
]) && MD(e.prototype, t),
n && MD(e, n),
o
}();
VD(KD, 'propTypes', {
rows: b.a.arrayOf(b.a.shape({
date_utc: s.moment.isRequired,
engagements: b.a.number.isRequired,
comments: b.a.number.isRequired,
articleReads: b.a.number.isRequired,
embedReads: b.a.number.isRequired
})),
startDate: s.moment.isRequired,
endDate: s.moment.isRequired,
minDate: s.moment.isRequired,
maxDate: s.moment.isRequired,
graphData: b.a.object
});
rc = function (e) {
e = UD(UD({
}, {
startDate: e.overviewStartDate,
endDate: e.overviewEndDate,
minDate: e.overviewMinDate,
maxDate: e.overviewMaxDate
}), {
}, {
rows: e.overviewRows
});
return C.a.createElement(KD, FD({
graphData: QD
}, e))
};
rc.propTypes = {
overviewStartDate: s.moment.isRequired,
overviewEndDate: s.moment.isRequired,
overviewMinDate: s.moment.isRequired,
overviewMaxDate: s.moment.isRequired,
overviewRows: b.a.arrayOf(b.a.shape({
date_utc: s.moment.isRequired,
engagements: b.a.number.isRequired,
comments: b.a.number.isRequired,
articleReads: b.a.number.isRequired,
embedReads: b.a.number.isRequired
}))
};
var JD = Ni.a.attachDrivers(rc, [
go
]);
function $D(e) {
return ($D = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function ZD(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function XD(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? ZD(Object(n), !0).forEach(function (e) {
oj(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : ZD(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function ej(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function tj(e, t) {
return (tj = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function nj(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = rj(n);
return e = a ? (e = rj(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== $D(e) && 'function' != typeof e ? aj(t) : e
}
}
function aj(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function rj(e) {
return (rj = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function oj(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
yl = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && tj(e, t)
}(o, A);
var e,
t,
n,
r = nj(o);
function o() {
var n;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) t[a] = arguments[a];
return oj(aj(n = r.call.apply(r, [
this
].concat(t))), 'state', {
startDate: ct() ().subtract(1, 'month'),
endDate: ct() (),
metricStart: ct() ().subtract(1, 'month').format('MM/DD/YY'),
metricEnd: ct() ().format('MM/DD/YY'),
interval: 'day'
}),
oj(aj(n), 'getExportUrl', function () {
var e = io.a.getURL('forums/admin/reports/interactionReport.csv');
return Eo() (e, {
api_key: pt.a.keys.api,
forum: pt.a.currentForum,
start: ct.a.utc(n.state.startDate).toISOString(),
end: ct.a.utc(n.state.endDate).toISOString()
})
}),
oj(aj(n), 'reportExport', function () {
n.props.emitTrackingEvent({
verb: 'export',
object_type: 'file',
object_id: 'csv'
})
}),
oj(aj(n), 'handleDateChange', function (e, t) {
n.setState({
startDate: e,
endDate: t
}),
n.reportClick({
object_type: 'filter',
object_id: 'date',
extra_data: JSON.stringify({
filter_start_date: ct.a.utc(e).format(),
filter_end_date: ct.a.utc(t).format()
})
})
}),
oj(aj(n), 'onGroupChange', function (e) {
n.setState({
interval: e
}),
n.reportClick({
object_type: 'filter',
object_id: 'group',
extra_data: JSON.stringify({
filter_group: e
})
})
}),
oj(aj(n), 'handleDismiss', function () {
n.reportClick({
adverb: 'dismiss',
object_type: 'note',
object_id: 'welcome'
}),
n.props.handleDismiss()
}),
oj(aj(n), 'reportClick', function (e) {
n.props.emitTrackingEvent(XD(XD({
}, e), {
}, {
verb: 'click'
}))
}),
oj(aj(n), 'fetch', function () {
n.props.overviewContentFetch({
forum: pt.a.currentForum
})
}),
n
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.fetch(),
this.props.emitTrackingEvent({
verb: 'view',
object_type: 'page',
object_id: ''.concat(window.document.location.host).concat(window.document.location.pathname)
})
}
},
{
key: 'render',
value: function () {
if (this.props.organization && this.props.organization.pollsOnly) return C.a.createElement(Cm, {
isPolls: !1,
organization: this.props.organization
});
var e = Is.a.get('analyticsWelcome') ? null : C.a.createElement(Ki, {
alertType: 'brand-new',
topMarginClass: 'spacing-top-none',
message: C.a.createElement(C.a.Fragment, null, C.a.createElement('span', {
className: 'text-larger text-semibold'
}, 'Get started with Disqus Pro Analytics'), C.a.createElement('div', null, C.a.createElement('p', {
className: 'text-large spacing-narrow spacing-bottom'
}, 'Uncover insights about your audience including top performing stories by engagement, the growth of your community over time, and more!'), C.a.createElement('a', {
href: 'https://blog.disqus.com/unlock-content-engagement-insights-in-the-new-disqus-analytics',
target: '_blank',
rel: 'noopener noreferrer',
onClick: this.reportClick.bind(this, {
adverb: 'learn_more',
object_type: 'note',
object_id: 'welcome'
})
}, C.a.createElement('button', {
className: 'button button-large button-fill--white text-medium spacing-narrow spacing-right'
}, 'Learn More')), C.a.createElement('button', {
className: 'button button-large button-fill--brand text-medium spacing-narrow',
onClick: this.handleDismiss
}, 'Dismiss')))
});
return this.props.overviewContentLoading ? C.a.createElement(Ji, null) : C.a.createElement('div', {
className: 'section-contained'
}, e, C.a.createElement(Bp, {
className: 'spacing-bottom',
leftTitle: 'Topline Metrics',
rightTitle: C.a.createElement('div', null, C.a.createElement('b', null, 'Past 30 days'), ' (', this.state.metricStart, ' - ', this.state.metricEnd, ')')
}, C.a.createElement(PD, {
title: 'Article Reads',
metric: this.props.articleReads,
delta: this.props.articleReadsDelta,
tooltip: 'The number of times people view an article where Disqus is installed.'
}), C.a.createElement(PD, {
title: 'Comment Reads',
metric: this.props.commentReads,
delta: this.props.commentReadsDelta,
tooltip: 'The number of times people read the comments section.'
}), C.a.createElement(PD, {
title: 'Total Engagements',
metric: this.props.engagements,
delta: this.props.engagementsDelta,
tooltip: 'Total number of comments and votes by readers.'
})), C.a.createElement(Bp, {
className: 'spacing-bottom',
leftTitle: 'Traffic Overview',
rightTitle: C.a.createElement('div', {
className: 'card__header-right'
}, C.a.createElement('a', {
href: this.getExportUrl(),
target: '_blank',
rel: 'noopener noreferrer',
className: 'card__header-content-item -button -right text-gray-dark text-semibold',
onClick: this.reportExport
}, C.a.createElement('span', {
className: 'icon-download text-large spacing-right text-gray'
}), 'Download CSV'), C.a.createElement(Zp, {
dateWrapperClass: 'card__header-datepicker',
minDate: gt,
maxDate: ct() (),
startDate: this.state.startDate,
endDate: this.state.endDate,
onDateChange: this.handleDateChange,
shortcuts: yt,
group: this.state.interval,
onGroupChange: this.onGroupChange
}))
}, C.a.createElement(JD, {
startDate: this.state.startDate,
endDate: this.state.endDate,
interval: this.state.interval
})), this.props.topArticle || this.props.topArticlePrevious ? C.a.createElement(Bp, {
className: 'spacing-bottom',
leftTitle: 'Want to learn more?'
}, C.a.createElement('div', {
className: 'padding-default truncate-line'
}, this.props.topArticle ? C.a.createElement('div', null, C.a.createElement('div', {
className: 'text-medium text-semibold'
}, 'Top article in the past 30 days'), C.a.createElement('a', {
href: this.props.topArticle.signedLink,
target: '_blank',
rel: 'noopener noreferrer',
className: 'text-larger text-semibold truncate-line'
}, this.props.topArticle.title), C.a.createElement('div', {
className: 'text-medium text-gray spacing-bottom'
}, C.a.createElement('span', {
className: 'text-semibold'
}, 'Total Engagements:'), ' ', this.props.topArticle.engagements)) : null, this.props.topArticlePrevious ? C.a.createElement('div', null, C.a.createElement('div', {
className: 'text-medium text-semibold'
}, 'Top article in the 30-day period prior to this one'), C.a.createElement('a', {
href: this.props.topArticlePrevious.signedLink,
target: '_blank',
rel: 'noopener noreferrer',
className: 'text-larger text-semibold truncate-line'
}, this.props.topArticlePrevious.title), C.a.createElement('div', {
className: 'text-medium text-gray spacing-bottom'
}, C.a.createElement('span', {
className: 'text-semibold'
}, 'Total Engagements:'), ' ', this.props.topArticlePrevious.engagements)) : null)) : null, C.a.createElement('div', {
className: 'card__more-info'
}, C.a.createElement('div', null, C.a.createElement('p', {
className: 'text-larger text-semibold spacing-bottom-large'
}, 'How to grow total engagements:'), C.a.createElement('ol', null, C.a.createElement('li', null, 'Ask people to comment with a strong call-to-action.'), C.a.createElement('li', null, 'Be active and present in the comments by replying to readers (especially first-time commenters). Author participation makes a huge difference.'), C.a.createElement('li', null, 'Moderate the comments and establish a set of community guidelines for participation.')), C.a.createElement('a', {
href: 'https://help.disqus.com/customer/en/portal/topics/637329-community-tips/articles',
target: '_blank',
rel: 'noopener noreferrer',
onClick: this.reportClick.bind(this, {
adverb: 'learn_more',
area: 'footer',
object_type: 'area',
object_id: 'footer'
})
}, C.a.createElement('button', {
className: 'button button-large button-fill--brand text-medium spacing-top-double'
}, 'Learn More')))))
}
}
]) && ej(e.prototype, t),
n && ej(e, n),
o
}();
oj(yl, 'propTypes', {
overviewContentFetch: b.a.func.isRequired,
handleDismiss: b.a.func.isRequired,
articleReads: b.a.number.isRequired,
articleReadsDelta: b.a.number.isRequired,
commentReads: b.a.number.isRequired,
commentReadsDelta: b.a.number.isRequired,
engagements: b.a.number.isRequired,
engagementsDelta: b.a.number.isRequired,
topArticle: b.a.object,
topArticlePrevious: b.a.object,
emitTrackingEvent: b.a.func.isRequired,
overviewContentLoading: b.a.bool
});
var ij = Object(u.connect) (function (e) {
return {
organization: e.selection.organization
}
}, {
emitTrackingEvent: Xo({
zone: 'analytics',
section: 'welcome'
})
}) (Ni.a.attachDrivers(yl, [
Wi
]));
function sj(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function lj(a) {
for (var e = 1; e < arguments.length; e++) {
var r = null != arguments[e] ? arguments[e] : {
};
e % 2 ? sj(Object(r), !0).forEach(function (e) {
var t,
n;
n = r[t = e],
t in (e = a) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(r)) : sj(Object(r)).forEach(function (e) {
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(r, e))
})
}
return a
}
function cj(e, t, n) {
t.selection.forum && n(e = {
data: lj({
forum: t.selection.forum.shortname
}, e)
})
}
var uj = 5,
pj = function (e, t) {
return 0 === e ? 0 === t ? 0 : 100 : Math.round((t - e) / e * 100)
},
dj = {
new : '#8BCF93',
returning: '#2E9FFF',
recovered: '#7E919F'
},
mj = [
'new',
'returning',
'recovered'
],
Ru = b.a.shape({
periodDays: b.a.number.isRequired,
commentReaders: b.a.number.isRequired,
subscribedReaders: b.a.number.isRequired,
engagedReaders: b.a.shape({
new : b.a.number.isRequired,
returning: b.a.number.isRequired,
recovered: b.a.number.isRequired
}).isRequired
}),
F = b.a.shape({
current: Ru.isRequired,
previous: Ru.isRequired,
userExportEmail: b.a.bool.isRequired
}),
r = b.a.shape({
displayName: b.a.string,
username: b.a.string.isRequired,
engagements: b.a.number.isRequired,
comments: b.a.number.isRequired,
firstEngagement: b.a.string.isRequired,
lastEngagement: b.a.string.isRequired,
subscribedOn: b.a.string,
type: b.a.oneOf([].concat(mj, [
're-engaged',
'inactive'
]))
}),
s = function (e, t, n, a, r) {
t = e[t];
if (!Array.isArray(t) || 2 !== t.length || 'string' != typeof t[0] || 'number' != typeof t[1]) return Error('The '.concat(a, ' `').concat(r, '` in `').concat(n, '` is expected to be of the form [\'YYYY-MM-DD\', count].'))
},
rc = b.a.shape({
new : b.a.arrayOf(s).isRequired,
returning: b.a.arrayOf(s).isRequired,
recovered: b.a.arrayOf(s).isRequired,
inactive: b.a.arrayOf(s).isRequired
}),
fj = {
transition: {
duration: 0
},
interaction: {
enabled: !1
},
axis: {
rotated: !0,
x: {
show: !1
},
y: {
show: !1
}
},
legend: {
show: !1
},
bar: {
width: 50
},
size: {
width: 350
},
point: {
show: !1
}
};
function hj(e) {
return (hj = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function gj(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function yj(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? gj(Object(n), !0).forEach(function (e) {
Sj(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : gj(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function bj(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function vj(e, t) {
return (vj = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function _j(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = Oj(n);
return e = a ? (e = Oj(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== hj(e) && 'function' != typeof e ? Ej(t) : e
}
}
function Ej(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function Oj(e) {
return (Oj = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function Sj(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
go = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && vj(e, t)
}(o, A);
var e,
t,
n,
r = _j(o);
function o() {
var n;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) t[a] = arguments[a];
return Sj(Ej(n = r.call.apply(r, [
this
].concat(t))), 'state', {
sortColumn: 'engagements',
sortDir: tD.SORT_DESC,
modalIsOpen: !1,
isDisabled: !1
}),
Sj(Ej(n), 'getExportUrl', function () {
if (n.props.shouldEmailCsv) return '#';
var e = io.a.getURL('forums/admin/reports/userReportExport.csv');
return Eo() (e, {
api_key: pt.a.keys.api,
forum: pt.a.currentForum
})
}),
Sj(Ej(n), 'exportCSV', function (e) {
var t = {
verb: 'export',
object_type: 'file',
object_id: 'csv',
area: 'community_members',
adjectvie: 'community_members'
};
n.props.shouldEmailCsv ? (e.preventDefault(), n.props.exportUserReportCsv(), n.props.emitTrackingEvent(yj(yj({
}, t), {
}, {
adverb: 'email'
})), n.setState({
modalIsOpen: !0
})) : n.props.emitTrackingEvent(yj(yj({
}, t), {
}, {
adverb: 'direct'
}))
}),
Sj(Ej(n), 'closeModal', function () {
n.setState({
modalIsOpen: !1
})
}),
Sj(Ej(n), 'handleSort', function (e, t) {
n.setState({
sortColumn: e,
sortDir: t,
isDisabled: !0
}, function () {
return n.fetch()
}),
n.props.emitTrackingEvent({
verb: 'click',
object_type: 'sort',
object_id: e,
adjectvie: t,
area: 'community_members'
})
}),
Sj(Ej(n), 'fetch', function (e) {
n.props.fetchUserReport(yj({
forum: pt.a.currentForum,
sort: n.state.sortColumn,
order: n.state.sortDir
}, e))
}),
Sj(Ej(n), 'fetchMore', function () {
n.props.userReport.cursor.hasNext && (n.props.emitTrackingEvent({
verb: 'click',
object_type: 'button',
object_id: 'show_more_results',
area: 'community_members'
}), n.fetch({
cursor: n.props.userReport.cursor.next
}))
}),
Sj(Ej(n), 'getModerationUserFilterUrl', function (e) {
return '/admin/moderate/all/search/user%3A'.concat(e.username)
}),
n
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.fetch()
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
this.props.userReport.isFetching && !e.userReport.isFetching && this.setState({
isDisabled: !1
})
}
},
{
key: 'render',
value: function () {
var e,
t = this,
n = C.a.createElement('div', {
className: 'card__header-right'
}, C.a.createElement('a', {
href: this.getExportUrl(),
onClick: this.exportCSV,
target: '_blank',
rel: 'noopener noreferrer',
className: 'card__header-content-item -button -right text-semibold text-gray-dark'
}, C.a.createElement('span', {
className: 'icon-download text-large spacing-right text-gray'
}), 'Export .csv')),
a = function (e) {
return e ? ct() (e).format('MM/DD/YY') : ''
},
r = function (e) {
return e.toLocaleString()
},
o = 0 === this.props.userReport.users.length ? C.a.createElement('div', {
className: 'empty-content-message'
}, 'No items') : null;
this.state.isDisabled || (this.props.userReport.isFetching ? e = C.a.createElement('div', {
className: 'spinner'
}) : this.props.userReport.cursor.hasNext && (e = C.a.createElement('button', {
className: 'button button-wide button-outline button-medium',
onClick: this.fetchMore
}, C.a.createElement('span', null, 'Show more results'))));
var i = C.a.createElement('span', null, 'Readers logged-in to Disqus who subscribed to your email list using the ', C.a.createElement(v.Link, {
to: 'settings/email-subscriptions/',
onClick: function () {
t.props.emitTrackingEvent({
verb: 'click',
object_type: 'link',
object_id: 'email_subscriptions',
area: 'community_members'
})
}
}, 'Email Subscriptions'), ' feature.');
return C.a.createElement('div', {
className: 'community-table'
}, this.state.isDisabled ? C.a.createElement('div', {
className: 'overlay'
}, C.a.createElement('div', {
className: 'spinner'
})) : null, C.a.createElement(Bp, {
className: 'spacing-bottom',
leftTitle: 'Community Members',
rightTitle: n,
bodyClassName: 'text-medium -overflow-scroll'
}, C.a.createElement(ZA, {
headers: [
{
key: 'displayName',
content: 'Display Name',
urlFn: this.getModerationUserFilterUrl,
sortable: !1,
colClass: 'text-semibold'
},
{
key: 'engagements',
content: 'Engagements',
formatFn: r
},
{
key: 'comments',
content: 'Comments',
formatFn: r
},
{
key: 'firstEngagement',
content: 'First Engagement',
formatFn: a
},
{
key: 'lastEngagement',
content: 'Last Engagement',
formatFn: a
},
{
key: 'subscribedOn',
content: 'Subscribed On',
formatFn: a,
description: i,
onShowDescription: function () {
t.props.emitTrackingEvent({
verb: 'hover',
object_type: 'button',
object_id: 'subscribed_on',
area: 'community_members'
})
}
},
{
key: 'type',
colClass: 'col__type',
content: 'Type',
formatFn: function (e) {
return C.a.createElement('span', {
className: 'badge--user-label -'.concat(e)
}, 're-engaged' === e ? 'Recovered' : e)
},
sortable: !1
}
].map(function (e) {
return yj(yj({
}, e), {
}, {
sortDir: t.state.sortColumn === e.key ? t.state.sortDir : tD.SORT_NONE
})
}),
rows: this.props.userReport.users.map(function (e) {
return yj(yj({
}, e), {
}, {
id: e.username
})
}),
onSort: this.handleSort,
reportClick: function (e) {
t.props.emitTrackingEvent({
verb: 'click',
object_type: 'link',
object_id: t.getModerationUserFilterUrl({
username: e.object_id
}),
area: 'community_members'
})
}
}), o, e), C.a.createElement(_.a, {
className: 'admin-modal -clipped -wider',
overlayClassName: 'modal-overlay',
isOpen: this.state.modalIsOpen,
onRequestClose: this.closeModal
}, C.a.createElement('div', {
className: 'modal-content'
}, C.a.createElement('div', {
className: 'modal-header align align--between'
}, C.a.createElement('h4', {
className: 'modal-title'
}, 'Export audience'), C.a.createElement('button', {
className: 'link-gray',
onClick: this.closeModal
}, C.a.createElement('span', {
className: 'icon-cancel icon__position'
}))), C.a.createElement('div', {
className: 'modal-body'
}, 'We\'re processing your export request! You\'ll receive an email with a link to your export data when it\'s ready. The time it takes to receive this email may vary based on the size of your audience.'))))
}
}
]) && bj(e.prototype, t),
n && bj(e, n),
o
}();
Sj(go, 'propTypes', {
userReport: b.a.shape({
users: b.a.arrayOf(r).isRequired,
cursor: b.a.object.isRequired,
isFetching: b.a.bool
}).isRequired,
fetchUserReport: b.a.func.isRequired,
shouldEmailCsv: b.a.bool,
exportUserReportCsv: b.a.func.isRequired,
emitTrackingEvent: b.a.func.isRequired
});
var wj = go,
yl = function (e) {
var t = e.startDate,
n = e.endDate,
a = e.overviewMetrics,
r = e.isAudienceEmailSubscriptionSupported,
o = e.emitTrackingEvent,
i = function (e) {
return e.new + e.returning + e.recovered
},
e = i(a.current.engagedReaders),
i = i(a.previous.engagedReaders);
return C.a.createElement(Bp, {
className: 'spacing-bottom',
leftTitle: 'Overview',
rightTitle: C.a.createElement('div', null, C.a.createElement('b', null, 'Past 30 days'), ' (', t, ' - ', n, ')')
}, C.a.createElement(PD, {
title: 'Comment Readers',
metric: a.current.commentReaders,
delta: pj(a.previous.commentReaders, a.current.commentReaders),
tooltip: 'The number of readers who read the comments section on an article on your site.'
}), C.a.createElement(PD, {
title: 'Engaged Readers',
metric: e,
delta: pj(i, e),
tooltip: 'Readers who commented or voted on a comment on an article in the past 30 days.'
}), C.a.createElement(PD, {
title: 'Email Subscribers',
metric: r ? a.current.subscribedReaders : null,
delta: r ? pj(a.previous.subscribedReaders, a.current.subscribedReaders) : null,
tooltip: C.a.createElement(C.a.Fragment, null, 'Readers who subscribed to emails via', C.a.createElement(v.Link, {
to: 'settings/email-subscriptions/',
onClick: function () {
o({
verb: 'click',
object_type: 'link',
object_id: 'email_subscriptions',
area: 'topline_audience_metrics'
})
}
}, ' Disqus Email Subscriptions '), 'in the past 30 days.', r ? null : C.a.createElement('div', {
className: 'admin-metric__bottom'
}, C.a.createElement('p', {
className: 'text-gray-light text-huge'
}, '0'), C.a.createElement('p', {
className: 'admin-metric__delta text-gray-light'
}, 'Not enabled for your site')))
}))
};
yl.propTypes = {
startDate: b.a.string.isRequired,
endDate: b.a.string.isRequired,
overviewMetrics: F.isRequired,
isAudienceEmailSubscriptionSupported: b.a.bool,
emitTrackingEvent: b.a.func.isRequired
};
var Pj = yl;
function kj(e) {
return (kj = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function Nj(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function Cj(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? Nj(Object(n), !0).forEach(function (e) {
Tj(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Nj(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function Rj(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function xj(e, t) {
return (xj = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function Aj(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = jj(n);
return e = a ? (e = jj(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== kj(e) && 'function' != typeof e ? Dj(t) : e
}
}
function Dj(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function jj(e) {
return (jj = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function Tj(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Wi = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && xj(e, t)
}(o, A);
var e,
t,
n,
r = Aj(o);
function o() {
var a;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return Tj(Dj(a = r.call.apply(r, [
this
].concat(t))), 'graph-new', C.a.createRef()),
Tj(Dj(a), 'graph-returning', C.a.createRef()),
Tj(Dj(a), 'graph-recovered', C.a.createRef()),
Tj(Dj(a), 'initCharts', function (e) {
var n;
!a['graph-new'].current.parentElement.clientHeight && (e || 0) < uj ? setTimeout(a.initCharts.bind(Dj(a), (e || 0) + 1), 0) : (n = Math.max.apply(null, Object.keys(a.props.overviewMetrics.current.engagedReaders).map(function (e) {
return a.props.overviewMetrics.current.engagedReaders[e]
})), a.charts = mj.reduce(Function.bind.call(function (e, t) {
return e[t] = Ed.a.generate(Cj(Cj({
}, fj), {
}, {
axis: Cj(Cj({
}, fj.axis), {
}, {
y: Cj(Cj({
}, fj.axis.y), {
}, {
max: n
})
}),
bindto: a['graph-'.concat(t)].current,
data: a.getGraphData(t)
})),
e
}, Dj(a)), {
}))
}),
Tj(Dj(a), 'getGraphData', function (e) {
return {
columns: [
[''.concat(e, 'EngagedReaders'),
a.props.overviewMetrics.current.engagedReaders[e]]
],
type: 'bar',
labels: !0,
colors: Tj({
}, ''.concat(e, 'EngagedReaders'), dj[e])
}
}),
Tj(Dj(a), 'getEngagementReadersDelta', function (e) {
return pj(a.props.overviewMetrics.previous.engagedReaders[e], a.props.overviewMetrics.current.engagedReaders[e])
}),
a
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.initCharts()
}
},
{
key: 'componentDidUpdate',
value: function () {
var t = this;
this.charts && Object.keys(this.charts).forEach(function (e) {
t.charts[e].load(t.getGraphData(e))
})
}
},
{
key: 'componentWillUnmount',
value: function () {
var t = this;
this.charts && Object.keys(this.charts).forEach(function (e) {
t.charts[e].destroy()
})
}
},
{
key: 'render',
value: function () {
return C.a.createElement(Bp, {
className: 'spacing-bottom',
leftTitle: 'Snapshot of Engaged Readers',
rightTitle: C.a.createElement('div', null, C.a.createElement('b', null, 'Past 30 days'), ' (', this.props.startDate, ' - ', this.props.endDate, ')')
}, C.a.createElement('div', {
className: 'readers-snapshot'
}, C.a.createElement('div', null, C.a.createElement(PD, {
title: 'New',
delta: this.getEngagementReadersDelta('new')
}, 'Readers who engaged for the first time in the past 30 days.'), C.a.createElement('div', {
className: 'readers-snapshot__graph'
}, C.a.createElement('div', {
ref: this['graph-new']
}))), C.a.createElement('div', null, C.a.createElement(PD, {
title: 'Returning',
delta: this.getEngagementReadersDelta('returning')
}, 'Readers who engaged in the past 30 days and prior 30 days.'), C.a.createElement('div', {
className: 'readers-snapshot__graph'
}, C.a.createElement('div', {
ref: this['graph-returning']
}))), C.a.createElement('div', null, C.a.createElement(PD, {
title: 'Recovered',
delta: this.getEngagementReadersDelta('recovered')
}, 'Readers who engaged in the past 30 days but not in the prior 30 days.'), C.a.createElement('div', {
className: 'readers-snapshot__graph'
}, C.a.createElement('div', {
ref: this['graph-recovered']
})))))
}
}
]) && Rj(e.prototype, t),
n && Rj(e, n),
o
}();
Tj(Wi, 'propTypes', {
startDate: b.a.string.isRequired,
endDate: b.a.string.isRequired,
overviewMetrics: F.isRequired
});
var Ij = Wi;
function qj(e) {
return (qj = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function Fj(e) {
return function (e) {
if (Array.isArray(e)) return Lj(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return Lj(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Lj(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function Lj(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function Uj(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function Mj(e, t) {
return (Mj = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function Bj(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = Hj(n);
return e = a ? (e = Hj(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== qj(e) && 'function' != typeof e ? zj(t) : e
}
}
function zj(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function Hj(e) {
return (Hj = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function Gj(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var Vj = function (e) {
return e.toLocaleString()
},
Wj = {
key: 'date_utc',
name: 'Date (UTC)',
formatter: function (e) {
return ct.a.utc(e).format('MMM Do YYYY')
}
},
Ru = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && Mj(e, t)
}(o, A);
var e,
t,
n,
r = Bj(o);
function o() {
var n;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) t[a] = arguments[a];
return Gj(zj(n = r.call.apply(r, [
this
].concat(t))), 'state', {
group: 'day',
startDate: ct() ().utc().subtract(1, 'month'),
endDate: ct() ().utc()
}),
Gj(zj(n), 'initGraph', function (e) {
n.ref && (!n.ref.graph.parentElement.clientWidth && (e || 0) < uj ? setTimeout(n.initGraph.bind(zj(n), (e || 0) + 1), 0) : n.chart = Ed.a.generate({
bindto: n.ref.graph,
data: n.getGraphData(),
color: {
pattern: [
dj.new,
dj.returning,
dj.recovered
]
},
transition: {
duration: 0
},
axis: {
y: {
min: 0,
padding: {
bottom: 0
},
tick: {
format: Vj
}
},
x: {
type: 'timeseries',
tick: {
format: Wj.formatter
}
}
},
point: {
show: !1
}
}))
}),
Gj(zj(n), 'trackHover', function () {
n.isHoverTracked || (n.props.emitTrackingEvent({
verb: 'hover',
object_type: 'area',
object_id: 'community_growth',
adjectvie: 'engagements_over_time',
area: 'engaged_readers'
}), n.isHoverTracked = !0)
}),
Gj(zj(n), 'getGraphData', function () {
return {
x: 'dates',
columns: [
['dates'].concat(Fj(n.props.engagementReport.new.map(function (e) {
return e[0]
})))
].concat(Fj(mj.map(function (e) {
return [e].concat(Fj(n.props.engagementReport[e].map(function (e) {
return e[1]
})))
}))),
names: {
new : 'New',
returning: 'Returning',
recovered: 'Recovered'
},
onmouseover: n.trackHover
}
}),
Gj(zj(n), 'fetchUserEngagementReport', function () {
n.props.fetchUserEngagementReport({
interval: 'day' === n.state.group ? 'daily' : 'monthly',
start: n.state.startDate.toISOString(),
end: n.state.endDate.toISOString()
})
}),
Gj(zj(n), 'onGroupChange', function (e) {
n.props.emitTrackingEvent({
verb: 'click',
object_type: 'option',
object_id: 'day' === e ? 'daily' : 'monthly',
area: 'engaged_readers'
}),
n.setState({
group: e,
startDate: 'day' === e ? ct() ().utc().subtract(1, 'month') : ct() ().utc().subtract(1, 'year').startOf('month')
}, n.fetchUserEngagementReport)
}),
Gj(zj(n), 'onDateChange', function (e, t) {
n.setState({
startDate: e,
endDate: t
}, n.fetchUserEngagementReport)
}),
n
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.fetchUserEngagementReport(),
this.initGraph()
}
},
{
key: 'componentDidUpdate',
value: function () {
this.chart ? this.chart.load(this.getGraphData()) : this.initGraph()
}
},
{
key: 'componentWillUnmount',
value: function () {
this.chart && (this.chart = this.chart.destroy())
}
},
{
key: 'render',
value: function () {
var t = this;
return Object.keys(this.props.engagementReport).some(function (e) {
return t.props.engagementReport[e].length
}) ? C.a.createElement(Bp, {
className: 'engaged-readers spacing-bottom',
leftTitle: 'Engaged Readers Over Time',
rightTitle: C.a.createElement('div', {
className: 'card__header-right'
}, C.a.createElement(Zp, {
dateWrapperClass: 'card__header-datepicker',
minDate: ct() ().utc().subtract(1, 'year'),
maxDate: ct() ().utc(),
startDate: this.state.startDate,
endDate: this.state.endDate,
group: this.state.group,
onGroupChange: this.onGroupChange,
onDateChange: this.onDateChange
}))
}, C.a.createElement('div', {
ref: function (e) {
t.ref = t.ref || {
},
t.ref.graph = e
}
})) : null
}
}
]) && Uj(e.prototype, t),
n && Uj(e, n),
o
}();
Gj(Ru, 'propTypes', {
engagementReport: rc.isRequired,
fetchUserEngagementReport: b.a.func.isRequired,
emitTrackingEvent: b.a.func.isRequired
});
var Yj = Ru;
function Qj(e) {
return (Qj = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function Kj(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function Jj(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? Kj(Object(n), !0).forEach(function (e) {
nT(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Kj(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function $j(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function Zj(e, t) {
return (Zj = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function Xj(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = tT(n);
return e = a ? (e = tT(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== Qj(e) && 'function' != typeof e ? eT(t) : e
}
}
function eT(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function tT(e) {
return (tT = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function nT(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var aT = 200,
s = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && Zj(e, t)
}(o, A);
var e,
t,
n,
r = Xj(o);
function o() {
var a;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return nT(eT(a = r.call.apply(r, [
this
].concat(t))), 'initViewEvents', function () {
a.onScroll = je.a.debounce(a.onScroll, 100),
window.addEventListener('scroll', a.onScroll);
var e = {
verb: 'view',
object_type: 'area'
};
a.viewEvents = [
{
ref: 'readersTimeline',
onView: a.props.emitTrackingEvent.bind(eT(a), Jj(Jj({
}, e), {
}, {
object_id: 'community_growth',
area: 'engaged_readers'
}))
},
{
ref: 'community',
onView: a.props.emitTrackingEvent.bind(eT(a), Jj(Jj({
}, e), {
}, {
object_id: 'community_members',
area: 'community_members'
}))
}
]
}),
nT(eT(a), 'onScroll', function () {
a.viewEvents = a.viewEvents.filter(function (e) {
var t = window.innerHeight || window.document.documentElement.clientHeight,
n = a.ref[e.ref] && l.a.findDOMNode(a.ref[e.ref]),
n = n && n.getBoundingClientRect();
return !n || t - n.top < aT || n.bottom < aT || (e.onView(), !1)
}),
a.viewEvents.length || window.removeEventListener('scroll', a.onScroll)
}),
nT(eT(a), 'isSaasFeatureSupported', function (e) {
if (!a.props.selection.organization) return !1;
var t = a.props.saasFeatures[a.props.selection.organization.id];
return t && t[e]
}),
a
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.isSaasFeatureSupported('advancedAnalytics') ? (this.props.fetchOverviewMetrics(), this.props.emitTrackingEvent({
verb: 'view',
object_type: 'page',
object_id: ''.concat(window.document.location.host).concat(window.document.location.pathname)
}), this.initViewEvents()) : this.props.history.push(ho.getRoute('/analytics/comments/'))
}
},
{
key: 'componentWillUnmount',
value: function () {
window.removeEventListener('scroll', this.onScroll)
}
},
{
key: 'render',
value: function () {
var t = this;
if (!this.props.overviewMetrics && !this.props.engagementReport && !this.props.userReport.users.length) return C.a.createElement('div', {
className: 'section-contained'
}, C.a.createElement('div', {
className: 'loading-container'
}, C.a.createElement(Ji, null)));
if (this.props.organization && this.props.organization.pollsOnly) return C.a.createElement(Cm, {
isPolls: !1,
organization: this.props.organization
});
var e = ct() ().subtract(1, 'month').format('MM/DD/YY'),
n = ct() ().format('MM/DD/YY');
return C.a.createElement('div', {
className: 'section-contained audience-analytics'
}, this.props.overviewMetrics ? C.a.createElement(Pj, {
startDate: e,
endDate: n,
overviewMetrics: this.props.overviewMetrics,
isAudienceEmailSubscriptionSupported: this.isSaasFeatureSupported('audienceEmailTransfer'),
emitTrackingEvent: this.props.emitTrackingEvent
}) : null, this.props.overviewMetrics ? C.a.createElement(Ij, {
startDate: e,
endDate: n,
overviewMetrics: this.props.overviewMetrics
}) : null, C.a.createElement(Yj, {
engagementReport: this.props.engagementReport,
fetchUserEngagementReport: this.props.fetchUserEngagementReport,
emitTrackingEvent: this.props.emitTrackingEvent,
ref: function (e) {
t.ref = t.ref || {
},
t.ref.readersTimeline = e
}
}), C.a.createElement(wj, {
userReport: this.props.userReport,
fetchUserReport: this.props.fetchUserReport,
shouldEmailCsv: this.props.overviewMetrics && this.props.overviewMetrics.userExportEmail,
exportUserReportCsv: this.props.exportUserReportCsv,
emitTrackingEvent: this.props.emitTrackingEvent,
ref: function (e) {
t.ref = t.ref || {
},
t.ref.community = e
}
}))
}
}
]) && $j(e.prototype, t),
n && $j(e, n),
o
}();
nT(s, 'propTypes', {
overviewMetrics: F,
engagementReport: rc.isRequired,
userReport: b.a.shape({
users: b.a.arrayOf(r).isRequired,
cursor: b.a.object.isRequired,
isFetching: b.a.bool
}).isRequired,
fetchOverviewMetrics: b.a.func.isRequired,
fetchUserReport: b.a.func.isRequired,
fetchUserEngagementReport: b.a.func.isRequired,
saasFeatures: b.a.objectOf(b.a.objectOf(b.a.bool)).isRequired,
exportUserReportCsv: b.a.func.isRequired,
emitTrackingEvent: b.a.func.isRequired,
history: b.a.object.isRequired,
selection: ht.isRequired
});
var rT = Object(u.connect) (function (e) {
var t = e.saasFeatures,
n = e.selection;
return Jj(Jj({
}, e.audienceAnalytics), {
}, {
saasFeatures: t,
organization: n.organization
})
}, {
fetchOverviewMetrics: function (n) {
return function (t, e) {
cj(n, e(), function (e) {
io.a.call('forums/admin/reports/userOverview', e).success(function (e) {
t({
type: M.onFetchOverviewMetrics,
response: e.response
})
})
})
}
},
fetchUserReport: function (n) {
return function (t, e) {
t({
type: M.fetchingUserReport
}),
cj(n, e(), function (e) {
io.a.call('forums/admin/reports/userReport', e).success(function (e) {
t({
type: M.onFetchUserReport,
response: e.response,
cursor: e.cursor,
fetchMore: !!n.cursor
})
})
})
}
},
fetchUserEngagementReport: function (n) {
return function (t, e) {
cj(n, e(), function (e) {
io.a.call('forums/admin/reports/userEngagementReport', e).success(function (e) {
t({
type: M.onFetchEngagementReport,
response: e.response,
start: n.start,
end: n.end
})
})
})
}
},
exportUserReportCsv: function () {
return function (e, t) {
cj({
}, t(), function (e) {
io.a.call('forums/admin/reports/userReportEmailExport', e)
})
}
}
}) (Fo() (s));
function oT(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function iT(a) {
for (var e = 1; e < arguments.length; e++) {
var r = null != arguments[e] ? arguments[e] : {
};
e % 2 ? oT(Object(r), !0).forEach(function (e) {
var t,
n;
n = r[t = e],
t in (e = a) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(r)) : oT(Object(r)).forEach(function (e) {
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(r, e))
})
}
return a
}
function sT(e, t, n) {
t.selection.forum && n(e = {
data: iT({
forum: t.selection.forum.shortname
}, e)
})
}
function lT(e) {
var n = {
};
return e.standard_series.forEach(function (e) {
var t = e[2];
'https' != t.substring(0, 5) && (n[t] || (n[t] = {
date: '',
reactions: [
],
authenticated: [
],
anonymous: [
],
threadId: null
}), (t = n[t]).date || (t.date = e[0].split('T') [0]), t.threadId || (t.threadId = e[1]), t.reactions.push(e[3]), t.authenticated.push(e[4]), t.anonymous.push(e[5]))
}),
n
}
var cT = 5,
uT = {
authenticated: '#8BCF93',
anonymous: '#2E9FFF'
},
pT = [
'anon_series',
'logged_in_series'
],
go = function (e, t, n, a, r) {
t = e[t];
if (!Array.isArray(t) || 2 !== t.length || 'string' != typeof t[0] || 'number' != typeof t[1]) return Error('The '.concat(a, ' `').concat(r, '` in `').concat(n, '` is expected to be of the form [\'YYYY-MM-DD\', count].'))
},
yl = b.a.shape({
authenticated: b.a.arrayOf(go),
anonymous: b.a.arrayOf(go)
}),
Wi = b.a.object,
Ru = b.a.object;
function dT(e) {
return (dT = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function mT(e) {
return function (e) {
if (Array.isArray(e)) return fT(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return fT(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? fT(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function fT(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function hT(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function gT(e, t) {
return (gT = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function yT(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = vT(n);
return e = a ? (e = vT(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== dT(e) && 'function' != typeof e ? bT(t) : e
}
}
function bT(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function vT(e) {
return (vT = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function _T(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var ET = function (e) {
return e.toLocaleString()
},
OT = {
key: 'date_utc',
name: 'Date (UTC)',
formatter: function (e) {
return ct.a.utc(e).format('MMM Do YYYY')
}
},
F = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && gT(e, t)
}(r, A);
var e,
t,
n,
a = yT(r);
function r() {
var i;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return _T(bT(i = a.call.apply(a, [
this
].concat(t))), 'state', {
group: 'day',
startDate: ct() ().utc().subtract(1, 'month'),
endDate: ct() ().utc()
}),
_T(bT(i), 'initGraph', function (e) {
i.ref && (!i.ref.graph.parentElement.clientWidth && (e || 0) < cT ? setTimeout(i.initGraph.bind(bT(i), (e || 0) + 1), 0) : (e = {
date: {
padding: {
left: - 0.5
},
label: {
text: 'Sorted by Dates',
position: 'inner-left'
},
type: 'timeseries',
tick: {
format: OT.formatter
}
},
thread: {
padding: {
left: - 0.5,
bottom: 100
},
label: {
text: 'Up to Last 30 Threads (Hover for Titles)',
position: 'inner-left'
},
tick: {
centered: !0,
fit: !1,
rotate: - 45,
values: [
],
outer: !1
},
type: 'category'
}
}, i.chart = Ed.a.generate({
bindto: i.ref.graph,
data: 'thread' === i.state.group ? i.getThreadGraphData() : i.getDateGraphData(),
color: {
pattern: [
uT.anonymous,
uT.authenticated
]
},
transition: {
duration: 0
},
legend: {
position: 'inset'
},
padding: {
bottom: 'thread' === i.state.group ? 75 : 0,
right: 'thread' === i.state.group ? 0 : 20
},
axis: {
y: {
min: 0,
padding: {
bottom: 1.5,
right: 5
},
tick: {
format: ET
},
label: {
text: 'Total Reactions Count',
position: 'outer-bottom'
}
},
x: 'thread' === i.state.group ? e.thread : e.date
},
point: {
show: !1
}
})))
}),
_T(bT(i), 'trackHover', function () {
i.isHoverTracked || (i.props.emitTrackingEvent({
verb: 'hover',
object_type: 'area',
object_id: 'reactions_analytics',
adjective: 'total_reactions_by_date_or_thread',
area: 'total_reactions_section'
}), i.isHoverTracked = !0)
}),
_T(bT(i), 'getDateGraphData', function () {
return {
x: 'dates',
columns: [
['dates'].concat(mT(i.props.totalReactionsReportByDate.anon_series.map(function (e) {
return e[0]
})))
].concat(mT(pT.map(function (e) {
return [e].concat(mT(i.props.totalReactionsReportByDate[e].map(function (e) {
return e[1]
})))
}))),
types: {
anon_series: 'area',
logged_in_series: 'area'
},
names: {
logged_in_series: 'Authenticated',
anon_series: 'Anonymous'
},
groups: [
['logged_in_series',
'anon_series']
],
onmouseover: i.trackHover
}
}),
_T(bT(i), 'formatThreadTitle', function (e) {
var n = e.split('_');
return n.map(function (e, t) {
e && (n[t] = e[0].toUpperCase() + e.slice(1))
}),
n.join(' ')
}),
_T(bT(i), 'getThreadGraphData', function () {
var n = i.props.totalReactionsReportByThread,
a = Object.keys(n),
r = [
'anonymous'
],
o = [
'authenticated'
];
return a.map(function (e, t) {
r.push(n[e].anonymous),
o.push(n[e].authenticated),
a[t] = ''.concat(n[e].date, ': ').concat(i.formatThreadTitle(e))
}),
{
x: 'threads',
columns: [
['threads'].concat(mT(a)),
r,
o
],
types: {
anonymous: 'area',
authenticated: 'area'
},
names: {
authenticated: 'Authenticated',
anonymous: 'Anonymous'
},
groups: [
['anonymous',
'authenticated']
],
onmouseover: i.trackHover
}
}),
_T(bT(i), 'fetchTotalReactionsReportByDate', function () {
i.props.fetchTotalReactionsReportByDate({
start: i.state.startDate.toISOString(),
end: i.state.endDate.toISOString()
})
}),
_T(bT(i), 'fetchTotalReactionsReportByThread', function () {
i.props.fetchTotalReactionsReportByThread({
start: i.state.startDate.toISOString(),
end: i.state.endDate.toISOString()
})
}),
_T(bT(i), 'onGroupChange', function (e) {
i.props.emitTrackingEvent({
verb: 'click',
object_type: 'option',
object_id: 'day' === e ? 'daily' : 'by thread',
area: 'total_reactions_section'
}),
i.setState({
group: e,
startDate: 'day' === e ? ct() ().utc().subtract(1, 'month') : ct() ().utc().subtract(1, 'year').startOf('month')
}, 'thread' === e ? i.fetchTotalReactionsReportByThread : i.fetchTotalReactionsReportByDate)
}),
_T(bT(i), 'onDateChange', function (e, t) {
i.setState({
startDate: e,
endDate: t
}, 'thread' === i.state.group ? i.fetchTotalReactionsReportByThread : i.fetchTotalReactionsReportByDate)
}),
i
}
return e = r,
(t = [
{
key: 'componentDidMount',
value: function () {
this.fetchTotalReactionsReportByDate(),
this.initGraph()
}
},
{
key: 'componentDidUpdate',
value: function () {
this.initGraph()
}
},
{
key: 'componentWillUnmount',
value: function () {
this.chart && (this.chart = this.chart.destroy())
}
},
{
key: 'render',
value: function () {
var t = this;
return Object.keys(this.props.totalReactionsReportByDate).some(function (e) {
return t.props.totalReactionsReportByDate[e].length
}) ? C.a.createElement('div', null, C.a.createElement(Bp, {
className: 'engaged-readers spacing-bottom',
leftTitle: C.a.createElement('div', null, 'Total Reactions', C.a.createElement(Md, {
content: 'Total reaction count sorted by date or by thread. Sorting by date is customizable via date range while sorting by thread displays the last 30 threads from your site.'
})),
rightTitle: C.a.createElement('div', {
className: 'card__header-right'
}, C.a.createElement(Zp, {
sortByThread: !0,
dateWrapperClass: 'card__header-datepicker',
minDate: ct() ().utc().subtract(1, 'year'),
maxDate: ct() ().utc(),
startDate: this.state.startDate,
endDate: this.state.endDate,
group: this.state.group,
onGroupChange: this.onGroupChange,
onDateChange: this.onDateChange,
hideInput: 'thread' === this.state.group
}))
}, C.a.createElement('div', {
ref: function (e) {
t.ref = t.ref || {
},
t.ref.graph = e
}
}))) : null
}
}
]) && hT(e.prototype, t),
n && hT(e, n),
r
}();
_T(F, 'propTypes', {
totalReactionsReportByDate: yl.isRequired,
totalReactionsReportByThread: Wi.isRequired,
fetchTotalReactionsReportByDate: b.a.func.isRequired,
fetchTotalReactionsReportByThread: b.a.func.isRequired,
emitTrackingEvent: b.a.func.isRequired
});
var ST = F;
function wT(e) {
return (wT = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function PT(e) {
return function (e) {
if (Array.isArray(e)) return kT(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return kT(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? kT(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function kT(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function NT(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function CT(e, t) {
return (CT = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function RT(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = AT(n);
return e = a ? (e = AT(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== wT(e) && 'function' != typeof e ? xT(t) : e
}
}
function xT(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function AT(e) {
return (AT = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function DT(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var jT = function (e) {
return e.toLocaleString()
},
rc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && CT(e, t)
}(o, A);
var e,
t,
n,
r = RT(o);
function o() {
var a;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return DT(xT(a = r.call.apply(r, [
this
].concat(t))), 'state', {
thread: '',
threadList: [
],
startDate: ct() ().utc().subtract(3, 'month'),
endDate: ct() ().utc()
}),
DT(xT(a), 'initGraph', function (e, t) {
a.ref && a.props.threadSpecificReactionsReport !== {
}
&& a.ref.graph && (!a.ref.graph.parentElement.clientWidth && (e || 0) < cT ? setTimeout(a.initGraph.bind(xT(a), (e || 0) + 1), 0) : a.chart = Ed.a.generate({
bindto: a.ref.graph,
data: a.getGraphData(a.state.thread),
color: {
pattern: [
uT.anonymous,
uT.authenticated
]
},
transition: {
duration: 0
},
padding: {
bottom: 2
},
axis: {
y: {
min: 0,
padding: {
bottom: 1.5
},
tick: {
format: jT
},
label: {
text: '# of Reactions',
position: 'outer-bottom'
}
},
x: {
tick: {
centered: !0,
fit: !0
},
type: 'categories',
categories: [
'Like',
'Dislike',
'Surprise',
'Cry',
'Angry',
'Sad'
]
}
},
point: {
show: !1
}
}))
}),
DT(xT(a), 'trackHover', function () {
a.isHoverTracked || (a.props.emitTrackingEvent({
verb: 'hover',
object_type: 'area',
object_id: 'reactions_analytics',
adjective: 'thread_specific_reactions',
area: 'thread_specific_reactions_section'
}), a.isHoverTracked = !0)
}),
DT(xT(a), 'generateColumns', function (e) {
if (!a.props.threadSpecificReactionsReport[e]) return [['reactions',
'No threads in given time period'],
[
'anonymous',
0,
0,
0,
0,
0,
0
],
[
'authenticated',
0,
0,
0,
0,
0,
0
]];
var n = [
'reactions'
];
return a.props.threadSpecificReactionsReport[e].reactions.forEach(function (e, t) {
n.push('Reaction #'.concat(t + 1))
}),
[
n,
[
'anonymous'
].concat(PT(a.props.threadSpecificReactionsReport[e].anonymous)),
[
'authenticated'
].concat(PT(a.props.threadSpecificReactionsReport[e].authenticated))
]
}),
DT(xT(a), 'getGraphData', function (e) {
return {
x: 'reactions',
columns: a.generateColumns(e),
type: 'bar',
names: {
anonymous: 'Anonymous',
authenticated: 'Authenticated'
},
groups: [
['anonymous',
'authenticated']
],
onmouseover: a.trackHover
}
}),
DT(xT(a), 'fetchThreadSpecificReactionsReport', function () {
a.props.fetchThreadSpecificReactionsReport({
start: a.state.startDate.toISOString(),
end: a.state.endDate.toISOString()
})
}),
DT(xT(a), 'onThreadChange', function (e) {
a.props.emitTrackingEvent({
verb: 'click',
object_type: 'option',
object_id: e,
area: 'thread_specific_reactions_section'
}),
a.setState({
thread: e
})
}),
DT(xT(a), 'onDateChange', function (e, t) {
a.setState({
startDate: e,
endDate: t
}, a.fetchThreadSpecificReactionsReport)
}),
a
}
return e = o,
n = [
{
key: 'getDerivedStateFromProps',
value: function (e, t) {
return t.threadList !== e.threadList ? {
threadList: e.threadList,
thread: e.threadList[0]
}
: null
}
}
],
(t = [
{
key: 'componentDidMount',
value: function () {
this.fetchThreadSpecificReactionsReport(),
this.initGraph()
}
},
{
key: 'componentDidUpdate',
value: function () {
this.chart ? this.chart.load(this.getGraphData(this.state.thread)) : this.initGraph(this.state.thread)
}
},
{
key: 'componentWillUnmount',
value: function () {
this.chart && (this.chart = this.chart.destroy())
}
},
{
key: 'render',
value: function () {
var t = this,
n = [
];
return 1 <= Object.keys(this.props.threadSpecificReactionsReport).length ? this.props.threadSpecificReactionsReport[this.state.thread].reactions.forEach(function (e, t) {
n.push(C.a.createElement('div', {
className: 'reaction-image',
key: 'Reaction #'.concat(t, ' div')
}, C.a.createElement('img', {
src: e,
key: 'Reaction #'.concat(t, ' img'),
alt: 'Reaction #'.concat(t),
width: 100,
height: 100
}), C.a.createElement('h3', {
key: 'Reaction #'.concat(t, ' header')
}, 'Reaction #', t + 1)))
}) : n.push(C.a.createElement('div', {
key: 'No Reaction Display'
}, 'No reactions data for the below date range.')),
C.a.createElement('div', null, C.a.createElement(Bp, {
className: 'reactions-display spacing-bottom',
leftTitle: C.a.createElement('div', null, 'Thread Reactions Display', C.a.createElement(Md, {
content: 'The reactions from the thread chosen below'
}))
}, C.a.createElement('div', {
className: 'card__body'
}, n)), C.a.createElement(Bp, {
className: 'engaged-readers spacing-bottom',
leftTitle: C.a.createElement('div', null, 'Thread-Specific Reactions', C.a.createElement(Md, {
content: 'Reactions from a specific thread. The thread-selection menu displays up to 30 threads in the given time period.'
})),
rightTitle: C.a.createElement('div', {
className: 'card__header-right'
}, C.a.createElement(Zp, {
threadSpecificReactionsList: this.props.threadList,
threadSpecificReactionsReport: this.props.threadSpecificReactionsReport,
dateWrapperClass: 'card__header-datepicker',
minDate: ct() ().utc().subtract(1, 'year'),
maxDate: ct() ().utc(),
startDate: this.state.startDate,
endDate: this.state.endDate,
group: this.state.thread,
onGroupChange: this.onThreadChange,
onDateChange: this.onDateChange
}))
}, C.a.createElement('div', {
ref: function (e) {
t.ref = t.ref || {
},
t.ref.graph = e
}
})))
}
}
]) && NT(e.prototype, t),
n && NT(e, n),
o
}();
DT(rc, 'propTypes', {
threadSpecificReactionsReport: Ru.isRequired,
threadList: b.a.arrayOf(b.a.string),
fetchThreadSpecificReactionsReport: b.a.func.isRequired,
emitTrackingEvent: b.a.func.isRequired
});
var TT = rc;
function IT(e) {
return (IT = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function qT(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function FT(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? qT(Object(n), !0).forEach(function (e) {
HT(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : qT(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function LT(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function UT(e, t) {
return (UT = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function MT(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = zT(n);
return e = a ? (e = zT(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== IT(e) && 'function' != typeof e ? BT(t) : e
}
}
function BT(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function zT(e) {
return (zT = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function HT(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var GT = 200,
r = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && UT(e, t)
}(o, A);
var e,
t,
n,
r = MT(o);
function o() {
var a;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return HT(BT(a = r.call.apply(r, [
this
].concat(t))), 'initViewEvents', function () {
a.onScroll = je.a.debounce(a.onScroll, 100),
window.addEventListener('scroll', a.onScroll);
a.viewEvents = [
{
ref: 'reactionsAnalytics',
onView: a.props.emitTrackingEvent.bind(BT(a), FT(FT({
}, {
verb: 'view',
object_type: 'area'
}), {
}, {
object_id: 'reactions_analytics',
area: 'reactions_analytics'
}))
}
]
}),
HT(BT(a), 'onScroll', function () {
a.viewEvents = a.viewEvents.filter(function (e) {
var t = window.innerHeight || window.document.documentElement.clientHeight,
n = a.ref[e.ref] && l.a.findDOMNode(a.ref[e.ref]),
n = n && n.getBoundingClientRect();
return !n || t - n.top < GT || n.bottom < GT || (e.onView(), !1)
}),
a.viewEvents.length || window.removeEventListener('scroll', a.onScroll)
}),
a
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.emitTrackingEvent({
verb: 'view',
object_type: 'page',
object_id: ''.concat(window.document.location.host).concat(window.document.location.pathname)
}),
this.initViewEvents()
}
},
{
key: 'componentWillUnmount',
value: function () {
window.removeEventListener('scroll', this.onScroll)
}
},
{
key: 'render',
value: function () {
var t = this;
return this.props.totalReactionsReportByDate || this.props.threadSpecificReactionsReport ? this.props.organization && this.props.organization.pollsOnly ? C.a.createElement(Cm, {
isPolls: !1,
organization: this.props.organization
}) : C.a.createElement('div', null, C.a.createElement('div', {
className: 'section-contained audience-analytics'
}, C.a.createElement(ST, {
totalReactionsReportByDate: this.props.totalReactionsReportByDate,
fetchTotalReactionsReportByDate: this.props.fetchTotalReactionsReportByDate,
totalReactionsReportByThread: this.props.totalReactionsReportByThread,
fetchTotalReactionsReportByThread: this.props.fetchTotalReactionsReportByThread,
emitTrackingEvent: this.props.emitTrackingEvent,
ref: function (e) {
t.ref = t.ref || {
},
t.ref.totalReactionsSection = e
}
})), C.a.createElement('div', {
className: 'section-contained audience-analytics'
}, C.a.createElement(TT, {
threadSpecificReactionsReport: this.props.threadSpecificReactionsReport,
fetchThreadSpecificReactionsReport: this.props.fetchThreadSpecificReactionsReport,
threadList: Object.keys(this.props.threadSpecificReactionsReport),
emitTrackingEvent: this.props.emitTrackingEvent,
ref: function (e) {
t.ref = t.ref || {
},
t.ref.threadSpecificReactionsSection = e
}
}))) : C.a.createElement('div', {
className: 'section-contained'
}, C.a.createElement('div', {
className: 'loading-container'
}, C.a.createElement(Ji, null)))
}
}
]) && LT(e.prototype, t),
n && LT(e, n),
o
}();
HT(r, 'propTypes', {
totalReactionsReportByDate: yl.isRequired,
totalReactionsReportByThread: Wi.isRequired,
fetchTotalReactionsReportByDate: b.a.func.isRequired,
fetchThreadSpecificReactionsReport: b.a.func.isRequired,
threadSpecificReactionsReport: Ru.isRequired,
saasFeatures: b.a.objectOf(b.a.objectOf(b.a.bool)).isRequired,
emitTrackingEvent: b.a.func.isRequired,
history: b.a.object.isRequired,
selection: ht.isRequired
});
var VT = Object(u.connect) (function (e) {
var t = e.saasFeatures,
n = e.selection;
return FT(FT({
}, e.reactionsAnalytics), {
}, {
saasFeatures: t,
organization: n.organization
})
}, {
fetchTotalReactionsReportByDate: function (n) {
return function (t, e) {
sT(n, e(), function (e) {
io.a.call('forums/admin/reports/totalReactionsReport', e).success(function (e) {
t({
type: fe.onFetchTotalReactionsReportByDate,
response: (je.a.mapObject(e = e.response, function (e) {
e.map(function (n) {
n.map(function (e, t) {
0 === t && (n[0] = e.split('T') [0])
})
})
}), e)
})
})
})
}
},
fetchTotalReactionsReportByThread: function (n) {
return function (t, e) {
sT(n, e(), function (e) {
io.a.call('forums/admin/reports/threadReactionsReport', e).success(function (e) {
t({
type: fe.onFetchTotalReactionsReportByThread,
response: (e = iT({
}, lT(e.response)), je.a.mapObject(e, function (e) {
e.anonymous = e.anonymous.reduce(function (e, t) {
return e + t
}, 0),
e.authenticated = e.authenticated.reduce(function (e, t) {
return e + t
}, 0),
delete e.reactions
}), e)
})
})
})
}
},
fetchThreadSpecificReactionsReport: function (n) {
return function (t, e) {
sT(n, e(), function (e) {
io.a.call('forums/admin/reports/threadReactionsReport', e).success(function (e) {
t({
type: fe.onFetchThreadSpecificReactionsReport,
response: lT(e.response)
})
})
})
}
}
}) (Fo() (r)),
s = n(171),
WT = n.n(s),
go = n(516),
YT = n.n(go),
F = function (e) {
e = e.onClose;
return C.a.createElement(_.a, {
isOpen: !0,
onRequestClose: e,
className: 'admin-modal -clipped -wider padding-double',
overlayClassName: 'modal-overlay -dark'
}, C.a.createElement('h3', {
className: 'text-larger text-center spacing-bottom'
}, 'Cancel Paid Subscription'), C.a.createElement('p', {
className: 'spacing-bottom-double'
}, 'If you’d like to cancel your paid subscription and downgrade to our free, Ad-Supported plan, please email us at ', C.a.createElement('a', {
href: 'mailto:cancellation@disqus.com'
}, 'cancellation@disqus.com'), '. By downgrading to our Ad-Supported plan, you’ll lose access to all of your advanced features.'), C.a.createElement('div', {
className: 'align align--between align--center'
}, C.a.createElement('button', {
className: 'button button-fill--brand text-small button-wide',
onClick: e
}, 'OK')))
};
F.propTypes = {
onClose: b.a.func.isRequired
};
var QT = F,
rc = function (e) {
e = e.onClose;
return C.a.createElement(_.a, {
isOpen: !0,
onRequestClose: e,
className: 'admin-modal -clipped -wider padding-double',
overlayClassName: 'modal-overlay -dark'
}, C.a.createElement('h3', {
className: 'text-larger text-center spacing-bottom'
}, 'Thank You!'), C.a.createElement('p', {
className: 'spacing-bottom-double subscription-modal__paragraph-middle text-center'
}, 'Our sales team will get back to you soon about using Disqus for Business for your site.'), C.a.createElement('div', {
className: 'align align--between align--center'
}, C.a.createElement('button', {
className: 'button button-fill--brand text-small button-padding-wide',
onClick: e
}, 'Return to Subscription & Billing')))
};
rc.propTypes = {
onClose: b.a.func
};
var KT = rc;
function JT(e) {
return (JT = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function $T(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function ZT(e, t) {
return (ZT = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function XT(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = tI(n);
return e = a ? (e = tI(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== JT(e) && 'function' != typeof e ? eI(t) : e
}
}
function eI(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function tI(e) {
return (tI = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function nI(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
yl = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && ZT(e, t)
}(o, A);
var e,
t,
n,
r = XT(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return nI(eI(t = r.call.apply(r, [
this
].concat(n))), 'state', {
value: '',
error: ''
}),
nI(eI(t), 'handleChange', function (e) {
return t.setState({
value: e.target.value
})
}),
nI(eI(t), 'handleSubmit', function (e) {
return e.preventDefault(),
t.state.value ? void t.props.applyCoupon(t.state.value).then(t.props.onClose).catch(t.handleError) : t.setState({
error: 'You must enter a valid coupon.'
})
}),
nI(eI(t), 'handleError', function (e) {
e = e && e.responseText && je.a.isString(e.responseText) && JSON.parse(e.responseText),
e = je.a.isObject(e) && e.response;
e ? e.indexOf('Invalid argument, \'coupon\'') ? e.indexOf('Flat rate "amount off" coupons are not currently supported') ? t.setState({
error: e
}) : t.setState({
error: 'This coupon code is not valid.'
}) : t.setState({
error: 'This coupon code does not exist.'
}) : t.setState({
error: 'There was an unknown error.'
})
}),
t
}
return e = o,
(t = [
{
key: 'render',
value: function () {
return C.a.createElement(_.a, {
className: 'admin-modal coupon-modal',
overlayClassName: 'modal-overlay -dark',
isOpen: !0,
onRequestClose: this.props.onClose
}, C.a.createElement('header', {
role: 'banner',
className: 'coupon-modal__header'
}, C.a.createElement('div', {
className: 'coupon-modal__header-icon'
}, C.a.createElement('div', {
className: 'coupon-modal__header-icon-container'
}, C.a.createElement('div', {
className: 'coupon-modal__header-icon-bevel'
}), C.a.createElement('div', {
className: 'coupon-modal__header-icon-border'
}), C.a.createElement('div', {
className: 'coupon-modal__header-icon-image'
}))), C.a.createElement('h1', null, ' Disqus '), C.a.createElement('h2', null, ' Apply a coupon ')), C.a.createElement('form', {
className: 'coupon-modal__form',
onSubmit: this.handleSubmit
}, C.a.createElement('div', {
className: 'coupon-modal__input-container'
}, C.a.createElement('input', {
className: [
'input--textbox',
this.state.error ? 'is-error' : ''
].join(' '),
type: 'text',
value: this.state.value,
placeholder: 'Coupon code',
onChange: this.handleChange
})), this.state.error ? C.a.createElement('div', {
className: 'text-error'
}, this.state.error) : null, C.a.createElement('div', {
className: 'coupon-modal__submit-container'
}, C.a.createElement('button', {
className: 'button button-fill--brand button-medium button-wide',
type: 'submit'
}, 'Apply coupon'))))
}
}
]) && $T(e.prototype, t),
n && $T(e, n),
o
}();
nI(yl, 'propTypes', {
applyCoupon: b.a.func.isRequired,
onClose: b.a.func.isRequired
});
var aI = yl,
Wi = n(101),
rI = n.n(Wi),
Ru = n(102),
oI = n.n(Ru);
function iI() {
return (iI = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
r = function (e) {
var t,
n,
a = e.basicPackage,
r = e.filterInvoices,
o = e.isTrialActive,
i = e.onRequestInfo,
s = e.onStartTrial,
l = e.onSubscribe,
c = e.orgAvailableDiscount,
u = e.orgBilling,
p = e.orgCurrentPackage,
d = e.orgCurrentPackageWillCancel,
m = e.orgPackages,
f = e.orgTrial,
h = e.newSubscriptionFlow,
g = e.pollsOrgCurrentPackage,
y = e.pollsOrgAvailableDiscount,
b = e.pollsOrgCurrentPackageWillCancel,
v = e.pollsOrgTrial,
_ = e.organization,
E = e.pollsPlanStatus,
O = e.orgAvailableTrials,
S = g && je.a.find(g.plans, function (e) {
return e.isSubscribed
}),
w = null;
_.pollsOnly || (n = je.a.find(m, function (e) {
return e.id === Ur.DISQUS_PLUS_PACKAGE_ID
}), t = je.a.find(m, function (e) {
return e.id === Ur.DISQUS_PRO_PACKAGE_ID
}), e = je.a.find(p.plans, function (e) {
return e.isSubscribed
}), c = {
orgAvailableDiscount: c,
orgBilling: u,
orgCurrentPackage: p,
orgCurrentPackageWillCancel: d,
orgTrial: f,
onRequestInfo: i,
onSubscribe: l,
onStartTrial: s,
basicPackage: a,
subscribedPlan: !0,
newSubscriptionFlow: h,
organization: _
}, r = u && u.invoiceHistory.some(function (e) {
return 0 === parseFloat(e.total)
}) && p.id === Ur.DISQUS_BASIC_PACKAGE_ID && !r(u.invoiceHistory).length && (!O || !O.some(function (e) {
return 0 == e.indexOf('plus')
}) || !O.some(function (e) {
return 0 == e.indexOf('pro')
})), P = null, O = h ? null : C.a.createElement('p', {
className: 'text-gray text-medium spacing-bottom'
}, 'Your site will revert back to the Ad-Supported plan at the end of the trial unless you subscribe before the trial ends.'), o(f) ? P = C.a.createElement('div', null, C.a.createElement('p', {
className: 'spacing-top'
}, 'You are currently on a Comments ', p.name, ' trial ending in ', ct() (f.endDate).diff(ct() (), 'days'), ' days.'), d ? C.a.createElement('p', {
className: 'text-gray text-medium'
}, 'Your site will revert back to the Ad-Supported plan at the end of the trial.') : u && u.paymentInfo ? C.a.createElement('p', {
className: 'text-gray text-medium'
}, 'Your subscription to Comments ', p.name, ' will begin at the end of the trial.') : O) : r ? P = C.a.createElement('p', {
className: 'spacing-top'
}, 'Your trial has ended and your site is now on the Ad-Supported plan. Please subscribe to one of the plans below if you would like to continue using those features.') : d && (P = C.a.createElement('p', {
className: 'spacing-top'
}, 'You have canceled your subscription to ', p.name, ' and your organization will revert back to Ad-Supported at the end of the billing period.')), w = _.pollsOnly ? null : p.id === Ur.DISQUS_PLUS_FREE_PACKAGE_ID && n ? (n = je.a.find(m, function (e) {
return e.id === Ur.DISQUS_PLUS_FREE_PACKAGE_ID
}), C.a.createElement('section', {
className: 'align align--column'
}, C.a.createElement(oI.a, iI({
plan: je.a.find(n.plans, function (e) {
return e.id === Ur.DISQUS_PLUS_FREE_PLAN_ID
}),
package: n,
features: Object(Tl.getPackageFeatureList) (m, Ur.DISQUS_PLUS_PACKAGE_ID, {
showCustom: !0
}),
learnMoreLink: C.a.createElement(rI.a, {
package: n
}),
maxButtons: 0
}, c)), P)) : C.a.createElement('section', {
className: 'align align--column'
}, C.a.createElement(oI.a, iI({
plan: e,
package: p,
features: Object(Tl.getPackageFeatureList) (m, p.id, {
showCustom: !0
}),
learnMoreLink: C.a.createElement(rI.a, p.id === Ur.DISQUS_PREFERRED_CUSTOMER_PACKAGE_ID && t ? {
package: t
}
: {
package: p
}),
isCurrentPlan: !0
}, c)), P));
var P = null;
return _.pollsActivationDate && g && (s = {
pollsOrgAvailableDiscount: y,
orgBilling: u,
pollsOrgCurrentPackage: g,
pollsOrgCurrentPackageWillCancel: b,
pollsOrgTrial: v,
onRequestInfo: i,
onSubscribe: l,
onStartTrial: s,
basicPackage: a,
subscribedPlan: !0,
newSubscriptionFlow: h,
organization: _,
pollsPlanStatus: E
}, a = _.pollsActivationDate && !g, h = null, o(v) ? h = C.a.createElement('div', null, C.a.createElement('p', {
className: 'spacing-top'
}, 'You are currently on a Polls ', g.name, ' trial ending in ', ct() (v.endDate).diff(ct() (), 'days'), ' days.'), !b && u && u.paymentInfo ? C.a.createElement('p', {
className: 'text-gray text-medium'
}, 'Your subscription to Polls ', g.name, ' will continue at the end of the trial.') : C.a.createElement('p', {
className: 'text-gray text-medium spacing-top'
}, 'Your subscription to Polls ', g.name, ' will conclude at the end of your trial.')) : b ? h = C.a.createElement('p', {
className: 'spacing-top'
}, 'Your subscription will be cancelled at the end of the billing period.') : a && (h = C.a.createElement('p', {
className: 'spacing-top'
}, 'Your subscription has been cancelled. Please subscribe to one of the plans below if you would like to continue using Polls.')), P = C.a.createElement('section', {
className: 'align align--column'
}, C.a.createElement(oI.a, iI({
plan: S,
package: g,
features: Object(Tl.getPollsPackageFeatureList) (g.id),
isCurrentPlan: !0
}, s)), h)),
C.a.createElement('div', {
className: 'fieldset'
}, C.a.createElement('span', {
className: 'fieldset__label text-gray spacing-right'
}, 'Your'.concat(_.pollsOnly && E === Ur.SAAS_PRODUCT_PLAN_CANCELLED_STATUS ? ' previous' : '', ' plan')), C.a.createElement('div', {
className: 'fieldset__block spacing-bottom-double subscription-package__current'
}, w, P))
};
r.propTypes = {
basicPackage: Ur.PACKAGE_SHAPE.isRequired,
filterInvoices: b.a.func.isRequired,
isTrialActive: b.a.func.isRequired,
onRequestInfo: b.a.func.isRequired,
onStartTrial: b.a.func.isRequired,
onSubscribe: b.a.func.isRequired,
orgAvailableDiscount: b.a.number,
orgBilling: Ur.ORG_BILLING_SHAPE,
orgCurrentPackage: Ur.PACKAGE_SHAPE.isRequired,
orgCurrentPackageWillCancel: b.a.bool,
orgPackages: b.a.arrayOf(Ur.PACKAGE_SHAPE).isRequired,
orgTrial: Ur.TRIAL_SHAPE,
newSubscriptionFlow: b.a.bool,
pollsOrgCurrentPackage: Ur.PACKAGE_SHAPE,
pollsOrgAvailableDiscount: b.a.number,
pollsOrgCurrentPackageWillCancel: b.a.bool,
pollsOrgTrial: Ur.TRIAL_SHAPE,
organization: b.a.object,
pollsPlanStatus: b.a.oneOf(Ur.SAAS_PRODUCT_PLANS),
orgAvailableTrials: b.a.arrayOf(b.a.string)
};
var sI = Object(u.connect) (function (e) {
var t = e.subscription;
return {
organization: e.selection.organization,
orgAvailableDiscount: t.orgAvailableDiscount,
pollsPlanStatus: t.pollsPlanStatus,
orgAvailableTrials: t.orgAvailableTrials
}
}) (r),
s = function (e) {
var t = e.message,
e = e.onClose;
return C.a.createElement(_.a, {
isOpen: !0,
onRequestClose: e,
className: 'admin-modal -clipped -wider padding-double',
overlayClassName: 'modal-overlay -dark'
}, C.a.createElement('h3', {
className: 'text-large text-center spacing-bottom'
}, C.a.createElement('span', {
className: 'icon icon-warning icon__position spacing-right subscription-modal__warning'
}), 'Payment Error'), C.a.createElement('p', {
className: 'spacing-bottom-double subscription-modal__paragraph-middle text-center'
}, t), C.a.createElement('div', {
className: 'align align--between align--center'
}, C.a.createElement('button', {
className: 'button button-fill--brand text-small button-padding-wide',
onClick: e
}, 'Return to Subscription & Billing')))
};
s.propTypes = {
message: b.a.string.isRequired,
onClose: b.a.func.isRequired
};
var lI = s,
go = n(517),
cI = n.n(go);
function uI(e) {
return (uI = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function pI(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function dI(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? pI(Object(n), !0).forEach(function (e) {
bI(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : pI(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function mI(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function fI(e, t) {
return (fI = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function hI(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = yI(n);
return e = a ? (e = yI(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== uI(e) && 'function' != typeof e ? gI(t) : e
}
}
function gI(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function yI(e) {
return (yI = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function bI(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
F = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && fI(e, t)
}(o, A);
var e,
t,
n,
r = hI(o);
function o() {
var a;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return bI(gI(a = r.call.apply(r, [
this
].concat(t))), 'state', dI({
isDirty: !1,
isSaved: !1,
saveErr: null
}, Ur.INVOICE_FIELDS.reduce(function (e, t) {
return dI(dI({
}, e), {
}, bI({
}, t, (a.props.syncedInvoiceFields || {
}) [t] || ''))
}, {
}))),
bI(gI(a), 'onFieldChange', function (e, t) {
var n = bI({
isDirty: !0,
isSaved: !1
}, e, t.target.value);
'country' === e && (n.countryId = t.target.key),
a.setState(n)
}),
bI(gI(a), 'getCountryOptions', function () {
return cI.a.getAllCountries().map(function (e) {
return {
key: e.id,
value: e.sortname,
label: e.name
}
})
}),
bI(gI(a), 'getStateOptions', function () {
var e = cI.a.getStatesOfCountry(a.state.countryId);
return 1 < e.length ? e.map(function (e) {
return {
key: e.id,
value: e.name,
label: e.name
}
}) : [
]
}),
bI(gI(a), 'save', function () {
a.props.onSave(Ur.INVOICE_FIELDS.reduce(function (e, t) {
return dI(dI({
}, e), {
}, bI({
}, t, a.state[t]))
}, {
}))
}),
a
}
return e = o,
(t = [
{
key: 'componentWillReceiveProps',
value: function (e) {
var t,
n = this;
this.props.isInvoiceUpdating && !e.isInvoiceUpdating && (t = e.syncedInvoiceFields || {
}, e = Ur.INVOICE_FIELDS.every(function (e) {
return !n.state[e] && !t[e] || n.state[e] === t[e]
}), this.setState({
isDirty: !e,
isSaved: e,
saveErr: e ? null : 'We were unable to save your changes. Please try again later.'
}))
}
},
{
key: 'render',
value: function () {
var e = this.getCountryOptions(),
t = this.getStateOptions();
return C.a.createElement(_.a, {
className: 'admin-modal -clipped -wider invoice-modal',
overlayClassName: 'modal-overlay -dark',
isOpen: !0,
onRequestClose: this.props.onClose
}, C.a.createElement('div', {
className: 'admin-modal__header'
}, C.a.createElement('div', {
className: 'align align--between'
}, C.a.createElement('h3', {
className: 'text-larger spacing-bottom-small'
}, 'Customize Invoices'), C.a.createElement('button', {
className: 'link-gray',
onClick: this.props.onClose
}, C.a.createElement('span', {
className: 'icon-cancel icon__position'
}))), C.a.createElement('div', {
className: 'text-gray'
}, 'Add information to the invoices you receive from Disqus. This information will be stored securely.')), C.a.createElement('div', {
className: 'admin-modal__content spacing-bottom-narrow padding-default'
}, C.a.createElement('div', {
className: 'spacing-bottom'
}, C.a.createElement('label', {
className: 'text-semibold text-gray text-base'
}, 'Company Name', C.a.createElement('input', {
className: 'input--textbox',
type: 'text',
placeholder: 'Acme Inc.',
onChange: this.onFieldChange.bind(this, 'companyName'),
value: this.state.companyName
}))), C.a.createElement('div', {
className: 'spacing-bottom'
}, C.a.createElement('label', {
className: 'text-semibold text-gray text-base'
}, 'Tax ID', C.a.createElement('input', {
className: 'input--textbox',
type: 'text',
placeholder: '123-45-6789',
onChange: this.onFieldChange.bind(this, 'taxId'),
value: this.state.taxId
}))), C.a.createElement('div', {
className: 'text-base text-semibold text-gray spacing-top spacing-bottom-small'
}, 'Address'), C.a.createElement('div', {
className: 'align align--between spacing-top-small spacing-bottom-small'
}, C.a.createElement('label', {
className: 'text-semibold text-gray fieldset-item__input align align--column spacing-right'
}, 'Country', C.a.createElement(Mf, {
name: 'country',
placeholder: 'Select a Country',
options: e,
value: this.state.country,
onChange: this.onFieldChange.bind(this, 'country'),
searchable: !0,
inline: !0,
width: 290
})), C.a.createElement('label', {
className: 'text-semibold text-gray fieldset-item__input align align--column spacing-right'.concat(this.state.country && !t.length ? ' hidden' : '')
}, 'State/Province', C.a.createElement(Mf, {
name: 'state',
placeholder: 'Select a State',
options: t,
value: this.state.state,
onChange: this.onFieldChange.bind(this, 'state'),
searchable: !0,
inline: !0,
width: 240
}))), C.a.createElement('div', {
className: 'align align--between spacing-top spacing-bottom-small'
}, C.a.createElement('label', {
className: 'text-semibold text-gray align align--column fieldset-item__input spacing-right'
}, 'Street Address', C.a.createElement('input', {
className: 'input--textbox',
type: 'text',
placeholder: '1234 N. Broadway St.',
onChange: this.onFieldChange.bind(this, 'street'),
value: this.state.street
})), C.a.createElement('label', {
className: 'text-semibold text-gray align align--column'
}, 'City', C.a.createElement('input', {
className: 'input--textbox',
type: 'text',
placeholder: 'New York',
onChange: this.onFieldChange.bind(this, 'city'),
value: this.state.city
}))), C.a.createElement('div', {
className: 'align align--between spacing-top spacing-bottom-small'
}, C.a.createElement('label', {
className: 'text-semibold text-gray align align--column fieldset-item__input'
}, 'Zip/Postal Code', C.a.createElement('input', {
className: 'input--textbox',
type: 'text',
placeholder: '98765',
onChange: this.onFieldChange.bind(this, 'zipCode'),
value: this.state.zipCode,
style: {
width: '120px'
}
})))), C.a.createElement('div', {
className: 'admin-modal__footer'
}, C.a.createElement(Bh, {
disabled: !this.state.isDirty,
onClick: this.save,
isSaving: this.props.isInvoiceUpdating,
isSaved: this.state.isSaved,
saveErr: !!this.state.saveErr
}, this.state.saveErr ? C.a.createElement('div', {
className: 'spacing-top-narrow'
}, this.state.saveErr) : null, this.state.isSaved ? C.a.createElement('div', {
className: 'spacing-top-narrow save-message'
}, 'Your information was updated') : null)))
}
}
]) && mI(e.prototype, t),
n && mI(e, n),
o
}();
bI(F, 'propTypes', {
onClose: b.a.func.isRequired,
onSave: b.a.func.isRequired,
isInvoiceUpdating: b.a.bool,
syncedInvoiceFields: b.a.shape(Ur.INVOICE_SHAPE)
});
var vI = F,
rc = function (e) {
return C.a.createElement(_.a, {
className: 'admin-modal subscription-updating-modal -clipped padding-double padding-bottom-none',
overlayClassName: 'modal-overlay -dark',
isOpen: e.isOpen
}, C.a.createElement('h3', {
className: 'text-larger text-center spacing-bottom'
}, 'Launching Your Subscription!'), C.a.createElement('div', {
className: 'align'
}, C.a.createElement('div', {
className: 'align__item--flex-1'
}, C.a.createElement('img', {
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/rocket.svg',
className: 'img-responsive'
}))))
};
rc.propTypes = {
isOpen: b.a.bool
};
var _I = rc,
yl = function (e) {
var o = e.formatPaymentDate,
t = e.orgBilling,
r = e.orgCurrentPackage,
n = e.orgCurrentPackageWillCancel,
a = e.currentSubscription,
i = e.onUpdatePaymentInfo,
s = e.onSubscribe,
l = e.showInvoiceCustomizationModal,
c = e.orgAvailableDiscount,
u = e.currentPollsSubscription,
p = e.pollsOrgCurrentPackageWillCancel,
d = e.pollsOrgCurrentPackage,
m = e.pollsOrgAvailableDiscount,
f = e.organization,
h = e.pollsPlanStatus,
g = null;
a && (a.status === Ur.SAAS_PRODUCT_PLAN_TRIALING_STATUS ? g = a.trialEnd : a.status !== Ur.SAAS_PRODUCT_PLAN_ACTIVE_STATUS && a.status !== Ur.SAAS_PRODUCT_PLAN_PAST_DUE_STATUS || (g = a.currentPeriodEnd));
var y = null;
u && (u.status === Ur.SAAS_PRODUCT_PLAN_TRIALING_STATUS ? y = u.trialEnd : u.status !== Ur.SAAS_PRODUCT_PLAN_ACTIVE_STATUS && u.status !== Ur.SAAS_PRODUCT_PLAN_PAST_DUE_STATUS || (y = u.currentPeriodEnd));
var b,
v,
_,
E,
O = t.invoiceHistory.filter(function (e) {
return parseInt(e.total, 10)
}),
S = null !== g && !n && a.amount,
w = null !== y && !p && u.amount,
P = r && je.a.find(r.plans, function (e) {
return e.isSubscribed
}),
k = d && je.a.find(d.plans, function (e) {
return e.isSubscribed
}),
N = t.paymentInfo && '' + t.paymentInfo.expMonth,
e = t.paymentInfo && '' + t.paymentInfo.expYear,
p = function (e) {
e.preventDefault();
var t = !f.pollsOnly && P && P.interval || k && k.interval || 'month',
n = 'year' === t ? P.id.replace('yearly', 'monthly') : P.id.replace('monthly', 'yearly'),
e = n !== P.id && je.a.find(r.plans, function (e) {
return e.id === n && e.amount
}),
a = k && ('year' === t ? k.id.replace('yearly', 'monthly') : k.id.replace('monthly', 'yearly')),
t = d && a !== k.id && je.a.find(d.plans, function (e) {
return e.id === a && e.amount
});
e && t ? s(e, r, t, d) : t ? s(t, d) : s(e, r)
},
e = C.a.createElement('div', {
className: 'subscription__billing-info'
}, t.paymentInfo ? C.a.createElement('div', {
className: 'subscription__card'
}, C.a.createElement('section', null, C.a.createElement('p', {
className: 'card-info text-bold'
}, C.a.createElement('span', null, '************', t.paymentInfo.last4)), C.a.createElement('p', {
className: 'card-info'
}, C.a.createElement('span', {
className: 'card-info card-info__brand'
}, t.paymentInfo.brand), C.a.createElement('span', null, 1 === N.length ? '0' : '', N, '/', e.substr(e.length - 2, e.length))))) : C.a.createElement('div', {
className: 'subscription__card --no-card-info'
}, C.a.createElement('section', null, C.a.createElement('p', {
className: 'card-info'
}, 'No credit card found'))), C.a.createElement('a', {
className: 'update-card',
href: '#',
onClick: function (e) {
e.preventDefault(),
i()
}
}, 'Update payment info', t.paymentInfo ? '' : ' to continue your subscription'));
O.length && !O[0].paid && (b = _ = 'We attempted to charge your credit card on '.concat(o(O[0].date), ' but it was declined.'), a && a.status === Ur.SAAS_PRODUCT_PLAN_PAST_DUE_STATUS ? b += ' Please update your payment method to prevent being reverted to an Ad-Supported plan.' : r.id === Ur.DISQUS_BASIC_PACKAGE_ID && (b += ' You have been reverted to an Ad-Supported plan. Please re-subscribe to a plan with an updated payment method.'), u && u.status === Ur.SAAS_PRODUCT_PLAN_PAST_DUE_STATUS ? _ += ' Please update your payment method to prevent your subscription being cancelled.' : d && d.id || (_ += ' Your subscription to Polls has been cancelled for non-payment. To continue using Polls, please re-subscribe to a plan with an updated payment method.'));
g = S ? 'Your next charge is on '.concat(o(g)) : 'You have no upcoming payments due.',
y = w ? 'Your next charge is on '.concat(o(y)) : 'You have no upcoming payments due.';
f.pollsOnly || (v = r.id === Ur.DISQUS_BUSINESS_PACKAGE_ID ? C.a.createElement('span', {
className: 'text-bold'
}, 'Custom Pricing') : P.amount ? c ? C.a.createElement(C.a.Fragment, null, C.a.createElement('span', {
className: 'text-strikethrough text-bold spacing-right-small'
}, '$', Object(Tl.formatPlanAmount) (P.amount)), C.a.createElement('span', {
className: 'text-bold'
}, '$', Object(Tl.formatPlanAmount) (c))) : C.a.createElement('span', {
className: 'text-bold'
}, '$', Object(Tl.formatPlanAmount) (P.amount)) : C.a.createElement('span', {
className: 'text-bold'
}, 'Free')),
f.pollsActivationDate && d && (E = d.id === Ur.DISQUS_POLLS_BUSINESS_PACKAGE_ID ? C.a.createElement('span', {
className: 'text-bold'
}, 'Custom Pricing') : k.amount ? m ? C.a.createElement(C.a.Fragment, null, C.a.createElement('span', {
className: 'text-strikethrough text-bold spacing-right-small'
}, '$', Object(Tl.formatPlanAmount) (k.amount)), C.a.createElement('span', {
className: 'text-bold'
}, '$', Object(Tl.formatPlanAmount) (m))) : C.a.createElement('span', {
className: 'text-bold'
}, '$', Object(Tl.formatPlanAmount) (k.amount)) : C.a.createElement('span', {
className: 'text-bold'
}, 'Free'));
p = C.a.createElement('div', {
className: 'subscription__billing-info next-payment'
}, !f.pollsOnly && C.a.createElement(C.a.Fragment, null, C.a.createElement('div', {
className: 'align align--between'
}, C.a.createElement('p', {
className: 'text-bold'
}, 'Comments'), C.a.createElement('p', null, v, S && C.a.createElement('span', {
className: 'text-small'
}, ' Billed ', 'year' === P.interval ? 'Yearly' : 'Monthly'))), C.a.createElement('div', {
className: 'text-small spacing-top'
}, b || g), C.a.createElement('div', {
className: 'next-payment--divider'
})), h === Ur.SAAS_PRODUCT_PLAN_CANCELLED_STATUS ? null : f.pollsActivationDate && d && C.a.createElement(C.a.Fragment, null, C.a.createElement('div', {
className: 'align align--between'
}, C.a.createElement('p', {
className: 'text-bold'
}, 'Polls'), C.a.createElement('p', null, E, w && C.a.createElement('span', {
className: 'text-small'
}, ' Billed ', 'year' === k.interval ? 'Yearly' : 'Monthly'))), C.a.createElement('div', {
className: 'text-small spacing-top'
}, _ || y), C.a.createElement('div', {
className: 'next-payment--divider'
})), C.a.createElement('a', {
className: 'switch-interval',
href: '#',
onClick: p
}, 'Switch to ', f.pollsOnly ? 'year' === k.interval ? 'Monthly' : 'Yearly' : 'year' === P.interval ? 'Monthly' : 'Yearly', ' billing')),
n = C.a.createElement('p', {
className: 'text-gray text-small spacing-top'
}, t.paymentInfo ? null : C.a.createElement('span', null, 'We have no payment info on file.', n ? null : ' If you would like to continue your subscription, please enter payment info before your next charge.', ' ', 'Having no working payment method at the start of the billing cycle will result in your subscription being cancelled.'));
return C.a.createElement('section', null, C.a.createElement('div', {
className: 'fieldset spacing-bottom-double'
}, C.a.createElement('span', {
className: 'fieldset__label text-gray spacing-right padding-top-none '
}, 'Billing'), C.a.createElement('div', {
className: 'fieldset__block'
}, C.a.createElement('div', {
className: 'payment-info'
}, e, p), n)), C.a.createElement('div', {
className: 'fieldset subscription-payment'
}, C.a.createElement('span', {
className: 'fieldset__label text-gray spacing-right'
}, 'Invoice History'), C.a.createElement('div', {
className: 'fieldset__block spacing-top-narrow text-medium'
}, C.a.createElement('div', {
className: 'spacing-bottom'
}, 'Invoices are delivered to your organization\'s admin\'s email address.', ' ', C.a.createElement('a', {
href: '#',
onClick: l
}, 'Customize your invoices'), '.'), O.length ? C.a.createElement('ul', {
className: 'subscription-payment-list'
}, C.a.createElement('li', {
className: 'subscription-payment-list__list-item'
}, C.a.createElement('span', {
className: 'subscription-payment-list__header'
}, 'Invoice Date'), C.a.createElement('span', {
className: 'subscription-payment-list__header'
}, 'Total')), O.map(function (e, t) {
var n = e.total,
a = e.paid,
r = e.invoicePdf;
return C.a.createElement('li', {
key: t,
className: 'subscription-payment-list__list-item'
}, C.a.createElement('span', {
className: 'subscription-payment-list__payment-date'
}, o(e.date)), C.a.createElement('span', {
className: 'subscription-payment-list__payment-'.concat(a ? 'paid' : 'error')
}, a ? '$'.concat(n) : 'Payment declined', ' ', r ? C.a.createElement('a', {
href: r
}, C.a.createElement('span', {
className: 'icon-download'
})) : null))
})) : C.a.createElement('div', {
className: 'spacing-bottom'
}, 'Your organization has no payment history.'))))
};
yl.propTypes = {
formatPaymentDate: b.a.func.isRequired,
orgBilling: Ur.ORG_BILLING_SHAPE.isRequired,
orgCurrentPackage: Ur.PACKAGE_SHAPE.isRequired,
orgCurrentPackageWillCancel: b.a.bool,
currentSubscription: Ur.CURRENT_SUBSCRIPTION_SHAPE,
onUpdatePaymentInfo: b.a.func,
onSubscribe: b.a.func.isRequired,
showInvoiceCustomizationModal: b.a.func.isRequired,
orgAvailableDiscount: b.a.number,
currentPollsSubscription: Ur.CURRENT_SUBSCRIPTION_SHAPE,
pollsOrgCurrentPackageWillCancel: b.a.bool,
pollsOrgCurrentPackage: Ur.PACKAGE_SHAPE.isRequired,
pollsOrgAvailableDiscount: b.a.number,
organization: b.a.object.isRequired,
pollsPlanStatus: b.a.oneOf([Ur.SAAS_PRODUCT_PLAN_CANCELLED_STATUS,
Ur.SAAS_PRODUCT_PLAN_ACTIVE_STATUS,
Ur.SAAS_PRODUCT_PLAN_TRIALING_STATUS])
};
var EI = Object(u.connect) (function (e) {
var t = e.subscription;
return {
organization: e.selection.organization,
orgAvailableDiscount: t.orgAvailableDiscount,
pollsOrgAvailableDiscount: t.pollsOrgAvailableDiscount,
pollsPlanStatus: t.pollsPlanStatus
}
}) (yl);
function OI(e) {
return (OI = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function SI(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function wI(e, t) {
return (wI = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function PI(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = NI(n);
return e = a ? (e = NI(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== OI(e) && 'function' != typeof e ? kI(t) : e
}
}
function kI(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function NI(e) {
return (NI = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
var CI = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && wI(e, t)
}(l, A);
var e,
t,
n,
s = PI(l);
function l() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, l);
for (var t, n, a, r = arguments.length, o = Array(r), i = 0; i < r; i++) o[i] = arguments[i];
return e = s.call.apply(s, [
this
].concat(o)),
t = kI(e),
a = 'cancellation@disqus.com',
(n = 'email') in t ? Object.defineProperty(t, n, {
value: a,
enumerable: !0,
configurable: !0,
writable: !0
}) : t[n] = a,
e
}
return e = l,
(t = [
{
key: 'render',
value: function () {
return C.a.createElement('header', {
className: 'settings__header settings-inline-section align align--between align--middle'
}, C.a.createElement('div', {
className: 'align align--column spacing-right-large'
}, C.a.createElement('h2', {
className: 'text-gray-darker text-larger spacing-bottom-small'
}, 'Cancel your subscription'), C.a.createElement('p', {
className: 'text-gray spacing-bottom'
}, 'You may change or cancel your Disqus subscription at any time by emailing ', C.a.createElement('a', {
href: 'mailto:'.concat(this.email)
}, this.email), '.')))
}
}
]) && SI(e.prototype, t),
n && SI(e, n),
l
}(),
RI = n(175),
Wi = function (e) {
var t = e.onSubscribe,
n = e.onClose,
a = e.curPackage,
r = e.newPackage,
o = e.newPlan,
i = e.amountRemaining,
s = e.secondCurPackage,
l = e.secondNewPackage,
c = e.secondNewPlan,
u = e.secondAmountRemaining,
p = e.coupon,
d = e.orgAvailableDiscount,
m = e.paymentInfoAvailable,
f = e.organization,
h = function (e) {
return e.id === Ur.DISQUS_PLUS_FREE_PACKAGE_ID ? 'Plus Free' : e.name
},
g = a && h(a),
y = h(r),
b = g && g !== y,
v = o.amount && p && Object(Tl.isNewPackageCouponEligible) (a, r) ? Object(Tl.getDiscountedAmount) (o.amount, p) : o.amount,
e = c && (c.amount && p && Object(Tl.isNewPackageCouponEligible) (s, l) ? Object(Tl.getDiscountedAmount) (c.amount, p) : c.amount),
h = a && a.productName === Ur.SAAS_PRODUCT_COMMENTS && f && f.pollsOnly,
p = !a || h ? 'You are subscribing to '.concat(y, '.') : b ? 'You are unsubscribing from '.concat(g, ' and subscribing to ').concat(y, '.') : a && s ? 'You are updating your subscriptions.' : 'You are updating your subscription to '.concat(g, '.'),
f = '';
return o.amount && c && c.amount ? f = 'Your monthly subscription cost will now be $'.concat(Object(Tl.formatPlanAmount) ('year' === o.interval ? v / RI.MONTHS_PER_YEAR : v), ' for ').concat(o.productName, ' and $').concat(Object(Tl.formatPlanAmount) ('year' === c.interval ? e / RI.MONTHS_PER_YEAR : e), ' for ').concat(c.productName, '.') : o.amount && (f = 'Your monthly subscription cost will now be $'.concat(Object(Tl.formatPlanAmount) ('year' === o.interval ? v / RI.MONTHS_PER_YEAR : v), '.').concat(o.hasTrialAvailable ? ' You will not be charged until your trial ends.' : '')),
(i || u) && (u = (Number.parseFloat(i || 0) + Number.parseFloat(u || 0)).toFixed(2), f += ' The remaining amount of $'.concat(u, ' from your current').concat(a && s ? '' : ' '.concat(a.name), ' plan will be added as credit ').concat(o.amount ? ' towards your new'.concat(r && l ? '' : ' '.concat(r.name), ' plan.') : ' to your account. You can use this credit towards future subscriptions.')),
d && (f += ' Upon updating, any previously applied Coupons will be no longer be honored.'),
C.a.createElement(_.a, {
className: 'admin-modal -clipped -wider padding-double',
overlayClassName: 'modal-overlay -dark',
isOpen: !0,
onRequestClose: n
}, C.a.createElement('h3', {
className: 'text-larger text-center spacing-bottom'
}, m ? 'Billing Update' : 'Subscribe to '.concat(y)), C.a.createElement('div', {
className: 'spacing-bottom text-large'
}, C.a.createElement('p', {
className: 'text-semibold spacing-bottom-narrow'
}, p), C.a.createElement('div', null, f)), C.a.createElement('div', {
className: 'align align--between'
}, C.a.createElement('button', {
className: 'button button-fill text-small button-wide',
onClick: n
}, b && !h ? 'Stay on '.concat(g) : 'Cancel'), C.a.createElement('button', {
className: 'button button-fill--brand text-small button-wide spacing-left-large',
onClick: function () {
n(),
t()
}
}, b ? 'Subscribe to '.concat(y) : 'Confirm')))
};
Wi.propTypes = {
onSubscribe: b.a.func,
onClose: b.a.func.isRequired,
curPackage: Ur.PACKAGE_SHAPE.isRequired,
newPackage: Ur.PACKAGE_SHAPE.isRequired,
newPlan: Ur.PLAN_SHAPE.isRequired,
amountRemaining: b.a.string,
secondCurPackage: Ur.PACKAGE_SHAPE,
secondNewPackage: Ur.PACKAGE_SHAPE,
secondNewPlan: Ur.PLAN_SHAPE,
secondAmountRemaining: b.a.string,
coupon: Ur.COUPON_SHAPE,
orgAvailableDiscount: b.a.number,
paymentInfoAvailable: b.a.bool,
organization: b.a.object
};
var xI = Wi;
function AI(e) {
return (AI = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function DI(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function jI(e, t) {
return (jI = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function TI(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = qI(n);
return e = a ? (e = qI(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== AI(e) && 'function' != typeof e ? II(t) : e
}
}
function II(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function qI(e) {
return (qI = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function FI(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
function LI(e) {
return e && e.isActive
}
function UI(e) {
return e.filter(function (e) {
return 0 < parseFloat(e.total) && e.paid
})
}
function MI(e) {
return ct() (e).format('MM/DD/YY')
}
var BI = 0,
zI = 1,
HI = 2,
GI = 4,
VI = 5,
WI = 6,
YI = 7,
QI = 8,
Ru = {
zone: 'install',
section: 'plan'
},
KI = '/install/welcome',
JI = '/polls/list/',
r = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && jI(e, t)
}(o, A);
var e,
t,
n,
a = TI(o);
function o(e) {
var r;
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o),
FI(II(r = a.call(this, e)), 'handleCloseModal', function () {
r.setState({
modal: {
type: BI,
data: null
}
})
}),
FI(II(r), 'trackButtonClick', function (e) {
return r.props.emitTrackingEvent({
verb: 'click',
object_type: 'button',
object_id: e && e.id !== Ur.DISQUS_BASIC_PLAN_ID ? e.id : 'basic'
})
}),
FI(II(r), 'trackModalView', function () {
r.props.orgCurrentPackage && r.props.emitTrackingEvent({
verb: 'view',
section: 'plan_selected_modal',
extra_data: JSON.stringify({
package: r.props.orgCurrentPackage.id
})
})
}),
FI(II(r), 'handleConfirmSubscribe', function (e, t) {
var n = je.a.find(r.props.orgPackages, function (e) {
return e.id === Ur.DISQUS_BASIC_PACKAGE_ID
});
n.isSubscribed || t !== n ? (e.productName === Ur.SAAS_PRODUCT_POLLS ? !e.isSubscribed && !r.props.pollsOrgCurrentPackageWillCancel : r.props.selection.organization.pollsOnly ? t.id !== Ur.DISQUS_BASIC_PACKAGE_ID : !e.isSubscribed && !n.isSubscribed && !r.props.orgCurrentPackageWillCancel) ? r.setState({
modal: {
type: GI,
data: {
plan: e,
package: t
}
}
}) : r.handleSubscribe(e) : r.setState({
modal: {
type: YI
}
})
}),
FI(II(r), 'handleConfirmToggleInterval', function (e, t, n, a) {
e.isSubscribed || r.props.orgCurrentPackageWillCancel ? r.handleSubscribe(e, n) : r.setState({
modal: {
type: GI,
data: {
plan: e,
package: t,
secondPlan: n,
secondPackage: a
}
}
})
}),
FI(II(r), 'handleSubscribe', function (e, t) {
var n = r.getReturnUrl(e);
return r.trackButtonClick(e),
r.props.onSubscribe(e, r.props.history, n, t)
}),
FI(II(r), 'handleRequestInfo', function (e) {
var t = je.a.find(je.a.flatten(r.props.orgPackages.map(function (e) {
return e.plans
}), !0), function (e) {
return e.id === Il.a.getCurrentPlusPlanId()
});
vo.a.when(t && r.props.orgCurrentPackage.id === Ur.DISQUS_BASIC_PACKAGE_ID && t.hasTrialAvailable && r.props.onSubscribe(t, r.state.coupon), r.trackButtonClick(e)).then(function () {
r.setState({
modal: {
type: HI,
data: null
}
})
})
}),
FI(II(r), 'getReturnUrl', function (e) {
var t = r.props.selection.organization;
return e.productName === Ur.SAAS_PRODUCT_COMMENTS && t && t.pollsOnly ? ''.concat(window.location.origin, '/admin').concat(KI) : e.productName !== Ur.SAAS_PRODUCT_POLLS || r.props.pollsOrgCurrentPackage || !t || t.pollsActivationDate ? window.location.href : ''.concat(window.location.origin, '/admin').concat(JI, '?').concat(Ur.CHECKOUT_SUCCESS_QUERY_PARAM, '=').concat(Ur.CHECKOUT_SUCCESS_QUERY_PARAM_VALUE_POLLS)
}),
FI(II(r), 'showInvoiceCustomizationModal', function (e) {
e.preventDefault(),
r.setState({
modal: {
type: VI,
data: null
}
})
}),
FI(II(r), 'openCouponModal', function (e) {
e.preventDefault(),
r.setState({
modal: {
type: WI,
data: null
}
})
}),
FI(II(r), 'applyCoupon', function (e) {
return Promise.resolve(io.a.call('organizations/saas/validateCoupon', {
data: {
organization: r.props.selection.organization && r.props.selection.organization.id,
coupon: e
}
}).then(function (e) {
return r.setState({
coupon: e.response
})
}))
}),
FI(II(r), 'removeCoupon', function () {
return r.setState({
coupon: null
})
}),
r.state = {
modal: r.props.location.query[Ur.CHECKOUT_SUCCESS_QUERY_PARAM] === Ur.CHECKOUT_SUCCESS_QUERY_PARAM_VALUE_COMMENTS ? {
type: zI,
data: null
}
: r.props.location.query[Ur.CHECKOUT_SUCCESS_QUERY_PARAM] === Ur.CHECKOUT_SUCCESS_QUERY_PARAM_VALUE_POLLS ? {
type: QI,
data: null
}
: {
type: BI,
data: null
},
coupon: null
},
r
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
ql(this.props.selection) || this.props.history.push(ho.getRoute('/settings/general/')),
this.props.fetchSubscription()
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
var t = this;
this.props.orgCurrentPackage && e.orgCurrentPackage && this.props.orgCurrentPackage.id !== e.orgCurrentPackage.id && e.orgCurrentPackage.id !== Ur.DISQUS_BASIC_PACKAGE_ID && 3 !== this.state.modal.type ? this.setState({
modal: {
type: zI,
data: this.props.selection.organization && this.props.selection.organization.pollsOnly ? {
redirectTo: '/install/'
}
: null
}
}, function () {
return t.trackModalView()
}) : !this.props.pollsOrgCurrentPackage && e.pollsOrgCurrentPackage && this.props.selection.organization && !this.props.selection.organization.pollsActivationDate && 3 !== this.state.modal.type ? this.setState({
modal: {
type: QI,
data: {
redirectTo: JI
}
}
}, function () {
return t.trackModalView()
}) : e.pollsOrgCurrentPackage && this.props.pollsOrgCurrentPackage && (this.props.pollsOrgCurrentPackage.id !== e.pollsOrgCurrentPackage.id || this.props.pollsPlanStatus === Ur.SAAS_PRODUCT_PLAN_CANCELLED_STATUS && e.pollsPlanStatus !== Ur.SAAS_PRODUCT_PLAN_CANCELLED_STATUS) && 3 !== this.state.modal.type && this.setState({
modal: {
type: QI,
data: null
}
}, function () {
return t.trackModalView()
})
}
},
{
key: 'render',
value: function () {
var e = this;
if (!ql(this.props.selection)) return null;
if (this.props.orgSubscriptionIsFetching || !this.props.orgPackages) return C.a.createElement(Qi, null);
var t,
n,
t = (t = (o = this.props).orgBilling, n = o.orgCurrentPackage, r = o.pollsOrgCurrentPackage, (!LI(o.orgTrial) || t.paymentInfo) && n && n.id !== Ur.DISQUS_BASIC_PACKAGE_ID && n.id !== Ur.DISQUS_BUSINESS_PACKAGE_ID && !o.orgCurrentPackageWillCancel || (!LI(o.pollsOrgTrial) || t.paymentInfo) && r && r.id !== Ur.DISQUS_POLLS_AD_SUPPORTED_PACKAGE_ID && r.id !== Ur.DISQUS_POLLS_BUSINESS_PACKAGE_ID && !o.pollsOrgCurrentPackageWillCancel),
a = Il.a.isNewFlow('cc_v2', {
orgId: br.orgId,
trial: this.props.orgTrial || {
}
}),
r = je.a.find(this.props.orgCurrentPackage.plans, function (e) {
return e.isSubscribed
}),
o = this.props.pollsOrgCurrentPackage && je.a.find(this.props.pollsOrgCurrentPackage.plans, function (e) {
return e.isSubscribed
}),
r = r && r.amount && !this.props.orgCurrentPackageWillCancel,
o = o && o.amount && !this.props.pollsOrgCurrentPackageWillCancel,
r = !this.props.selection.organization.pollsOnly && this.props.orgCurrentPackage.id !== Ur.DISQUS_BUSINESS_PACKAGE_ID && (UI(this.props.orgBilling.invoiceHistory).length || r || this.props.orgBilling.paymentInfo) || this.props.selection.organization.pollsActivationDate && this.props.pollsPlanStatus !== Ur.SAAS_PRODUCT_PLAN_CANCELLED_STATUS && this.props.pollsOrgCurrentPackage && this.props.pollsOrgCurrentPackage.id !== Ur.DISQUS_POLLS_BUSINESS_PACKAGE_ID && (UI(this.props.orgBilling.invoiceHistory).length || o || this.props.orgBilling.paymentInfo);
switch (this.state.modal.type) {
case zI:
u = C.a.createElement(Ty, {
package: this.props.orgCurrentPackage,
isTrial: LI(this.props.orgTrial),
onClose: function () {
e.handleCloseModal(),
e.state.modal.data && e.state.modal.data.redirectTo && e.props.history.push(e.state.modal.data.redirectTo)
},
newSubscriptionFlow: a
});
break;
case QI:
u = C.a.createElement(Ty, {
package: this.props.pollsOrgCurrentPackage,
isTrial: LI(this.props.pollsOrgTrial),
onClose: function () {
e.handleCloseModal(),
e.state.modal.data && e.state.modal.data.redirectTo && e.props.history.push(e.state.modal.data.redirectTo)
},
newSubscriptionFlow: a
});
break;
case HI:
u = C.a.createElement(KT, {
onClose: this.handleCloseModal
});
break;
case 3:
u = C.a.createElement(lI, {
message: this.state.modal.data.errorMessage,
onClose: this.handleCloseModal
});
break;
case GI:
var i = this.state.modal.data.package.productName === Ur.SAAS_PRODUCT_POLLS ? this.props.pollsOrgCurrentPackage : this.props.orgCurrentPackage,
s = this.props.orgBilling && (this.state.modal.data.package.productName === Ur.SAAS_PRODUCT_POLLS ? this.props.orgBilling.currentPollsSubscription : this.props.orgBilling.currentSubscription),
l = this.state.modal.data.secondPackage && (this.state.modal.data.secondPackage.productName === Ur.SAAS_PRODUCT_POLLS ? this.props.pollsOrgCurrentPackage : this.props.orgCurrentPackage),
c = this.state.modal.data.secondPackage && this.props.orgBilling && (this.state.modal.data.secondPackage.productName === Ur.SAAS_PRODUCT_POLLS ? this.props.orgBilling.currentPollsSubscription : this.props.orgBilling.currentSubscription),
u = C.a.createElement(xI, {
onSubscribe: this.handleSubscribe.bind(this, this.state.modal.data.plan, this.state.modal.data.secondPlan),
onClose: this.handleCloseModal,
curPackage: i,
newPackage: this.state.modal.data.package,
newPlan: this.state.modal.data.plan,
amountRemaining: s && s.amountRemaining,
secondCurPackage: l,
secondNewPackage: this.state.modal.data.secondPackage,
secondNewPlan: this.state.modal.data.secondPlan,
secondAmountRemaining: c && c.amountRemaining,
coupon: this.state.coupon,
orgAvailableDiscount: this.props.orgAvailableDiscount,
paymentInfoAvailable: !!this.props.orgBilling.paymentInfo,
organization: this.props.selection.organization
});
break;
case VI:
u = C.a.createElement(vI, {
onClose: this.handleCloseModal,
onSave: this.props.onUpdateInvoiceInfo,
syncedInvoiceFields: this.props.orgBilling.invoiceInfo,
isInvoiceUpdating: this.props.isInvoiceUpdating
});
break;
case WI:
u = C.a.createElement(aI, {
applyCoupon: this.applyCoupon,
onClose: this.handleCloseModal
});
break;
case YI:
u = C.a.createElement(QT, {
onClose: this.handleCloseModal
});
break;
default:
u = null
}
o = je.a.find(this.props.orgPackages, function (e) {
return e.id === Ur.DISQUS_BASIC_PACKAGE_ID
});
return C.a.createElement('div', null, u, this.props.orgBilling.currentSubscription && this.props.orgBilling.currentSubscription.status === Ur.SAAS_PRODUCT_PLAN_PAST_DUE_STATUS ? C.a.createElement('div', {
className: 'content__wrap payment_error'
}, C.a.createElement('div', {
className: 'spacing-right-large'
}, C.a.createElement('h2', {
className: 'text-large text-red spacing-bottom-small'
}, 'Your credit card has been declined'), C.a.createElement('p', {
className: 'text-gray'
}, 'Your payment is now overdue. Please update your payment method to prevent being reverted to an Ad-Supported plan.')), C.a.createElement('span', {
className: 'icon icon-declined-card text-red spacing-left-large text-huge'
})) : null, C.a.createElement('div', {
className: 'content__wrap'
}, C.a.createElement(nE, {
headline: 'Your Plan and Billing',
description: C.a.createElement('span', null, 'Review the Disqus plan to which your organization is currently subscribed, manage your billing, and see your past invoices.')
}), C.a.createElement('section', {
className: 'settings__content'
}, C.a.createElement(sI, {
filterInvoices: UI,
isTrialActive: LI,
orgCurrentPackage: this.props.orgCurrentPackage,
basicPackage: o,
orgPackages: this.props.orgPackages,
orgBilling: this.props.orgBilling,
orgCurrentPackageWillCancel: this.props.orgCurrentPackageWillCancel,
orgTrial: this.props.orgTrial,
onRequestInfo: this.handleRequestInfo,
onSubscribe: this.handleConfirmSubscribe,
onStartTrial: this.handleConfirmSubscribe,
newSubscriptionFlow: a,
pollsOrgCurrentPackage: this.props.pollsOrgCurrentPackage,
pollsOrgAvailableDiscount: this.props.pollsOrgAvailableDiscount,
pollsOrgCurrentPackageWillCancel: this.props.pollsOrgCurrentPackageWillCancel,
pollsOrgTrial: this.props.pollsOrgTrial,
pollsPlanStatus: this.props.pollsPlanStatus
}), r ? C.a.createElement(EI, {
formatPaymentDate: MI,
orgBilling: this.props.orgBilling,
orgCurrentPackage: this.props.orgCurrentPackage,
orgCurrentPackageWillCancel: this.props.orgCurrentPackageWillCancel,
currentSubscription: this.props.orgBilling.currentSubscription,
onUpdatePaymentInfo: this.props.onUpdatePaymentInfo,
onSubscribe: this.handleConfirmToggleInterval,
showInvoiceCustomizationModal: this.showInvoiceCustomizationModal,
currentPollsSubscription: this.props.orgBilling.currentPollsSubscription,
pollsOrgCurrentPackageWillCancel: this.props.pollsOrgCurrentPackageWillCancel,
pollsOrgCurrentPackage: this.props.pollsOrgCurrentPackage
}) : null)), this.props.orgCurrentPackage.id === Ur.DISQUS_BUSINESS_PACKAGE_ID || this.props.pollsOrgCurrentPackage && this.props.pollsOrgCurrentPackage.id === Ur.DISQUS_POLLS_BUSINESS_PACKAGE_ID ? null : C.a.createElement('div', {
className: 'content__wrap'
}, C.a.createElement(nE, {
headline: 'Other Subscription Plans',
description: C.a.createElement('span', null, 'Manage your subscription and billing for your organization. Your organization\'s plan affects ', C.a.createElement('em', null, 'all'), ' sites in your organization. ', C.a.createElement('a', {
href: Pn.pricingAndPlans
}, 'Learn more about plans'), '.')
}), C.a.createElement('section', {
className: 'settings__content'
}, C.a.createElement(WT.a, {
onRequestInfo: this.handleRequestInfo,
onStartTrial: this.handleConfirmSubscribe,
onSubscribe: this.handleConfirmSubscribe,
orgBilling: this.props.orgBilling,
orgCurrentPackage: this.props.orgCurrentPackage,
orgCurrentPackageWillCancel: this.props.orgCurrentPackageWillCancel,
orgTrial: this.props.orgTrial,
orgAvailableDiscount: this.props.orgAvailableDiscount,
pollsOrgCurrentPackage: this.props.pollsOrgCurrentPackage,
pollsOrgCurrentPackageWillCancel: this.props.pollsOrgCurrentPackageWillCancel,
pollsOrgTrial: this.props.pollsOrgTrial,
pollsOrgAvailableDiscount: this.props.pollsOrgAvailableDiscount,
packages: this.props.orgPackages.reduce(function (e, t) {
return e[t.id] = t,
e
}, {
}),
openCouponModal: this.openCouponModal,
coupon: this.state.coupon,
removeCoupon: this.removeCoupon,
newSubscriptionFlow: a,
useAdSupportedCard: !0,
organization: this.props.selection.organization
}), C.a.createElement(_I, {
isOpen: this.props.isSubscriptionUpdating && this.state.modal.type === BI
}))), C.a.createElement('div', {
className: 'content__wrap'
}, C.a.createElement(YT.a, {
newSubscriptionFlow: a
})), C.a.createElement(Bg, null), t ? C.a.createElement('div', {
className: 'content__wrap'
}, C.a.createElement(CI, null)) : null)
}
}
]) && DI(e.prototype, t),
n && DI(e, n),
o
}();
FI(r, 'propTypes', {
fetchSubscription: b.a.func.isRequired,
onSubscribe: b.a.func.isRequired,
onUpdateInvoiceInfo: b.a.func.isRequired,
onUpdatePaymentInfo: b.a.func.isRequired,
orgSubscriptionIsFetching: b.a.bool.isRequired,
isSubscriptionUpdating: b.a.bool.isRequired,
isInvoiceUpdating: b.a.bool.isRequired,
orgBilling: Ur.ORG_BILLING_SHAPE,
orgCurrentPackage: Ur.PACKAGE_SHAPE,
orgCurrentPackageWillCancel: b.a.bool,
orgCurrentPlan: Ur.PLAN_SHAPE,
orgPackages: b.a.arrayOf(Ur.PACKAGE_SHAPE),
orgTrial: Ur.TRIAL_SHAPE,
orgAvailableDiscount: b.a.number,
pollsOrgTrial: Ur.TRIAL_SHAPE,
pollsOrgCurrentPlan: Ur.PLAN_SHAPE,
pollsOrgAvailableDiscount: b.a.number,
pollsOrgCurrentPackageWillCancel: b.a.bool,
pollsOrgCurrentPackage: Ur.PACKAGE_SHAPE,
pollsPlanStatus: b.a.oneOf([Ur.SAAS_PRODUCT_PLAN_CANCELLED_STATUS,
Ur.SAAS_PRODUCT_PLAN_ACTIVE_STATUS]),
history: b.a.shape({
push: b.a.func.isRequired
}).isRequired,
location: kh.locationShape,
selection: ht.isRequired,
emitTrackingEvent: b.a.func.isRequired,
emitDefaultViewEvent: b.a.func.isRequired
});
s = Object(u.connect) (function (e) {
var t = e.subscription;
return {
isInvoiceUpdating: t.isInvoiceUpdating,
isSubscriptionUpdating: t.isSubscriptionUpdating,
orgBilling: t.orgBilling,
orgCurrentPackage: t.orgCurrentPackage,
orgCurrentPackageWillCancel: t.orgCurrentPackageWillCancel,
orgCurrentPlan: t.orgCurrentPlan,
orgPackages: t.orgPackages,
orgSubscriptionIsFetching: t.orgSubscriptionIsFetching,
orgTrial: t.orgTrial,
pollsOrgCurrentPackageWillCancel: t.pollsOrgCurrentPackageWillCancel,
pollsOrgCurrentPackage: t.pollsOrgCurrentPackage,
pollsPlanStatus: t.pollsPlanStatus,
pollsOrgTrial: t.pollsOrgTrial,
pollsOrgCurrentPlan: t.pollsOrgCurrentPlan,
selection: e.selection,
orgAvailableDiscount: t.orgAvailableDiscount,
pollsOrgAvailableDiscount: t.pollsOrgAvailableDiscount
}
}, {
fetchSubscription: Hl,
onSubscribe: Wl,
onUpdatePaymentInfo: Kl,
onUpdateInvoiceInfo: Vl,
emitTrackingEvent: Xo(Ru),
emitDefaultViewEvent: ei(Ru)
}) (Ni.a.attachDrivers(Fo() (r), [
bc
]));
function $I(t, e, n, a) {
t({
type: W.fetchingDiscussions
}),
a = {
forum: e().selection.forum.shortname,
related: [
'author'
],
after: n,
since: a
},
(e = e().discussionsEdit.cursor) && (a.cursor = e.next),
io.a.call('forums/listThreads', {
data: a,
success: function (e) {
t({
type: W.fetchedDiscussions,
threads: e.response,
cursor: e.cursor
})
},
error: function () {
t({
type: W.onFetchError
})
}
})
}
function ZI(e, t, n, a, r) {
var o = r.response.id ? r.response : r.response[0];
(a = (r = a().discussionsEdit.threads).findIndex(function (e) {
return e.id === o.id
})) < 0 ? n({
type: W.threadUpdateError
}) : ('isClosed' === e && ((o = r[a]).isClosed = t), o.author = 'author' === e ? {
username: t,
id: o.author
}
: r[a].author, n({
method: 'POST',
type: W.updatedThread,
threads: r.slice(0, a).concat([o]).concat(r.slice(a + 1))
}), setTimeout(function () {
n({
type: W.clearAlert
})
}, 5000))
}
function XI(e, t) {
var n;
try {
n = JSON.parse(t.responseText).response
} catch (e) {
n = 'There was an error making these changes.'
}
e({
type: W.updateThreadError,
errorMessage: n
}),
setTimeout(function () {
e({
type: W.clearAlert
})
}, 5000)
}
go = {
fetchCategories: function () {
return function (t, e) {
io.a.call('categories/list', {
data: {
forum: e().selection.forum.shortname
},
success: function (e) {
t({
type: W.fetchedCategories,
categories: e.response
})
},
error: function () {
t({
type: W.onFetchError
})
}
}),
$I(t, e)
}
},
fetchMoreDiscussions: function (n, a) {
return function (e, t) {
$I(e, t, n, a)
}
},
resetDiscussions: function (n, a) {
return function (e, t) {
e({
type: W.resetDiscussions
}),
$I(e, t, n, a)
}
},
updateThreadField: function (o, i, s) {
return function (e, t) {
var n,
a,
r;
e({
type: W.clearAlert
}),
io.a.call('threads/update', {
method: 'POST',
data: (n = {
thread: o
}, r = 'author' === (a = i) ? 'username:'.concat(s) : s, a in n ? Object.defineProperty(n, a, {
value: r,
enumerable: !0,
configurable: !0,
writable: !0
}) : n[a] = r, n),
success: ZI.bind(null, i, s, e, t),
error: XI.bind(null, e)
})
}
},
toggleThreadClosed: function (a) {
return function (e, t) {
var n = t().discussionsEdit.threads.find(function (e) {
return e.id === a
});
n ? (e({
type: W.clearAlert
}), io.a.call(n.isClosed ? 'threads/open' : 'threads/close', {
method: 'POST',
data: {
thread: a
},
success: ZI.bind(null, 'isClosed', !n.isClosed, e, t),
error: XI.bind(null, e)
})) : XI(e)
}
}
};
function eq(e) {
return (eq = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function tq(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function nq(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? tq(Object(n), !0).forEach(function (e) {
lq(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : tq(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function aq(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function rq(e, t) {
return (rq = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function oq(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = sq(n);
return e = a ? (e = sq(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== eq(e) && 'function' != typeof e ? iq(t) : e
}
}
function iq(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function sq(e) {
return (sq = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function lq(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
F = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && rq(e, t)
}(o, A);
var e,
t,
n,
r = oq(o);
function o() {
var a;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return lq(iq(a = r.call.apply(r, [
this
].concat(t))), 'state', {
editing: {
},
dateRange: 'all',
startDate: ct() ().startOf('day').subtract(1, 'month'),
endDate: ct() ().endOf('day'),
modalData: null
}),
lq(iq(a), 'toggleEdit', function (e, t) {
a.setState({
editing: nq(nq({
}, a.state.editing), {
}, lq({
}, e, nq(nq({
}, a.state.editing[e]), {
}, lq({
}, t, !(a.state.editing[e] || {
}) [t]))))
})
}),
lq(iq(a), 'updateField', function (e, t, n) {
a.props.updateThreadField(e, t, n.target.value),
a.toggleEdit(e, t)
}),
lq(iq(a), 'onInputKeyPress', function (e, t, n) {
13 === n.charCode && a.updateField(e, t, n)
}),
lq(iq(a), 'getEditableTextCell', function (e, t, n) {
return C.a.createElement('td', {
onClick: a.toggleEdit.bind(iq(a), e.id, t)
}, a.state.editing[e.id] && a.state.editing[e.id][t] ? C.a.createElement('input', {
type: 'text',
defaultValue: n || e[t],
onBlur: a.updateField.bind(iq(a), e.id, t),
onKeyPress: a.onInputKeyPress.bind(iq(a), e.id, t),
autoFocus: !0
}) : C.a.createElement('span', null, n || e[t]))
}),
lq(iq(a), 'onDateRangeChange', function (e) {
var t = 'custom' === e;
e === a.state.dateRange ? a.setState({
showDatePicker: t
}) : a.setState({
dateRange: e,
showDatePicker: t
}, a.fetchDiscussions.bind(iq(a), !0))
}),
lq(iq(a), 'onDateChange', function (e, t) {
a.setState({
startDate: e,
endDate: t.endOf('day')
}, a.fetchDiscussions.bind(iq(a), !0))
}),
lq(iq(a), 'hideDatePicker', function () {
a.setState({
showDatePicker: !1
})
}),
lq(iq(a), 'fetchDiscussions', function (e) {
e = e ? a.props.resetDiscussions : a.props.fetchMoreDiscussions;
'all' === a.state.dateRange ? e() : e(a.state.startDate.toISOString(), a.state.endDate.toISOString())
}),
lq(iq(a), 'handleOpenModal', function (e) {
a.setState({
modalData: e
})
}),
lq(iq(a), 'handleCloseModal', function () {
a.setState({
modalData: null
})
}),
a
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.selection.forum && this.props.fetchCategories()
}
},
{
key: 'render',
value: function () {
var t = this;
if (this.props.selection.organization && this.props.selection.organization.pollsOnly) return C.a.createElement(Cm, {
isPolls: !1,
organization: this.props.selection.organization
});
var e,
n,
a = null;
return 'custom' === this.state.dateRange && (e = this.state.startDate.format('M/D/YY'), n = this.state.endDate.format('M/D/YY'), a = ''.concat(e, ' - ').concat(n)),
C.a.createElement('div', {
className: 'admin_content _discussions_'
}, this.state.modalData ? C.a.createElement(_.a, {
className: 'admin-modal thread-identifiers-modal',
overlayClassName: 'modal-overlay -dark',
isOpen: !0,
onRequestClose: this.handleCloseModal
}, C.a.createElement('div', {
className: 'admin-modal__header align align--between'
}, C.a.createElement('h3', {
className: 'text-large text-capitalized'
}, 'Thread Identifiers'), C.a.createElement('button', {
className: 'link-gray',
onClick: this.handleCloseModal
}, C.a.createElement('span', {
className: 'icon-cancel icon__position'
}))), C.a.createElement('ul', {
className: 'thread-identifiers-list text-small'
}, this.state.modalData.map(function (e) {
return C.a.createElement('li', {
key: e,
className: 'thread-identifiers-list--item'
}, e)
}))) : null, C.a.createElement('div', {
className: 'page-header'
}, C.a.createElement('h2', null, 'Edit Discussions', C.a.createElement('div', {
className: 'settings-subheading'
}, 'Set specific authors for each post, update titles, and close old discussions. ', C.a.createElement('a', {
href: Pn.discussionsEdit,
target: '_blank',
rel: 'noopener noreferrer'
}, 'Learn more »')))), this.props.alert ? C.a.createElement(Ki, {
message: this.props.alert.message,
alertType: this.props.alert.status
}) : null, C.a.createElement('div', {
className: 'align align__item--grow mod-bar'
}, C.a.createElement(sR, {
buttonLabel: a,
options: o.DATE_RANGE_OPTIONS,
selected: [
this.state.dateRange
],
icon: 'icon-calendar',
onChange: this.onDateRangeChange
}), C.a.createElement(zp.a, {
onOutsideClick: this.hideDatePicker,
className: 'mod-bar__date '.concat(this.state.showDatePicker ? '' : 'hidden'),
active: this.state.showDatePicker
}, C.a.createElement(Zp, {
maxDate: o.maxDate,
minDate: o.minDate,
startDate: this.state.startDate,
endDate: this.state.endDate,
onDateChange: this.onDateChange,
alwaysOpen: !0
}))), C.a.createElement('table', {
className: 'zebra-striped'
}, C.a.createElement('thead', null, C.a.createElement('tr', null, C.a.createElement('th', null, 'Title'), C.a.createElement('th', null, 'Link'), C.a.createElement('th', {
width: '105'
}, 'Thread ID'), C.a.createElement('th', null, 'Author ', C.a.createElement(Md, {
tooltipKey: 'author',
content: 'Change who receives moderation notifications for this discussion by default. You must specify a registered Disqus username.',
direction: 'top'
})), C.a.createElement('th', {
width: '110'
}, 'Category ', C.a.createElement(Md, {
tooltipKey: 'category',
content: 'Categories are used with our API for results filtering; categories are not used for moderation.',
direction: 'top'
})), C.a.createElement('th', {
width: '125'
}, 'Created'), C.a.createElement('th', {
width: '90'
}, 'Identifiers'), C.a.createElement('th', {
width: '80'
}, 'Status'))), C.a.createElement('tbody', null, this.props.threads.map(function (e) {
return C.a.createElement('tr', {
key: e.id
}, t.getEditableTextCell(e, 'title'), t.getEditableTextCell(e, 'url', e.link), C.a.createElement('td', null, e.id), t.getEditableTextCell(e, 'author', e.author.username || e.author.name || 'Unknown'), C.a.createElement('td', null, C.a.createElement('select', {
defaultValue: e.category,
onChange: t.updateField.bind(t, e.id, 'category')
}, t.props.categories.map(function (e) {
return C.a.createElement('option', {
key: e.id,
value: e.id
}, e.title)
}))), C.a.createElement('td', {
title: e.createdAt
}, Os.prettyDatetime(e.createdAt, 'relative')), C.a.createElement('td', null, e.identifiers.length && C.a.createElement('a', {
className: 'thread-identifiers-count',
onClick: function () {
return t.handleOpenModal(e.identifiers)
}
}, e.identifiers.length)), C.a.createElement('td', {
className: 'editable-switch '.concat(e.isClosed ? 'closed' : 'open'),
title: e.isClosed ? 'Open this discussion' : 'Close this discussion',
onClick: function () {
t.props.toggleThreadClosed(e.id)
}
}))
}))), C.a.createElement('div', null, this.props.threads ? C.a.createElement('button', {
className: 'button button-wide button-outline button-medium',
disabled: this.props.isFetchingThreads || !this.props.hasNextPage,
onClick: this.fetchDiscussions.bind(this, !1)
}, 'Show more discussions') : null), C.a.createElement('p', null, C.a.createElement('br', null), 'Links cannot be updated to a URL that already exists in your forum. Use the ', C.a.createElement(Uo, {
path: '/discussions/migrate/',
selection: this.props.selection
}, 'URL Mapper tool'), ' to batch edit or merge discussions.'))
}
}
]) && aq(e.prototype, t),
n && aq(e, n),
o
}();
lq(F, 'propTypes', {
categories: b.a.arrayOf(b.a.shape({
id: b.a.string.isRequired,
title: b.a.string.isRequired
})).isRequired,
threads: b.a.arrayOf(b.a.shape({
title: b.a.string.isRequired,
link: b.a.string.isRequired,
author: b.a.shape({
username: b.a.string.isRequired
}).isRequired,
category: b.a.string.isRequired,
createdAt: b.a.string.isRequired,
isClosed: b.a.bool.isRequired
})).isRequired,
hasNextPage: b.a.bool.isRequired,
numPerPage: b.a.number.isRequired,
isFetchingThreads: b.a.bool.isRequired,
fetchCategories: b.a.func.isRequired,
fetchMoreDiscussions: b.a.func.isRequired,
resetDiscussions: b.a.func.isRequired,
updateThreadField: b.a.func.isRequired,
toggleThreadClosed: b.a.func.isRequired,
selection: ht.isRequired,
alert: b.a.shape({
message: b.a.string.isRequired,
status: b.a.string.isRequired
})
}),
lq(F, 'DATE_RANGE_OPTIONS', [
{
key: 'all',
label: 'All Time'
},
{
key: 'custom',
label: 'Custom'
}
]),
lq(F, 'minDate', ct() ('01 01 2007', 'MM DD YYYY').startOf('day')),
lq(F, 'maxDate', ct() ().endOf('day'));
var rc = Object(u.connect) (function (e) {
return nq({
selection: e.selection
}, e.discussionsEdit)
}, nq({
}, go)) (F),
yl = n(176),
cq = n.n(yl);
function uq(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function pq(a) {
for (var e = 1; e < arguments.length; e++) {
var r = null != arguments[e] ? arguments[e] : {
};
e % 2 ? uq(Object(r), !0).forEach(function (e) {
var t,
n;
n = r[t = e],
t in (e = a) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(r)) : uq(Object(r)).forEach(function (e) {
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(r, e))
})
}
return a
}
var Wi = {
toggleBadges: function (e) {
var n = e.forum,
a = e.data,
r = e.onSuccess;
return function (t) {
t({
type: B.toggling
}),
io.a.call('forums/update', {
type: 'POST',
data: pq({
forum: n
}, a),
success: function (e) {
t({
type: B.onToggle,
badgesEnabled: e.response.settings.badgesEnabled
}),
r({
badgesEnabled: e.response.settings.badgesEnabled
})
},
error: function () {
t({
type: B.onToggleError,
message: 'An error occurred trying to '.concat(a.badgesEnabled ? 'disable' : 'enable', ' the badges feature')
})
}
})
}
},
fetchBadges: function (e) {
return function (t) {
t({
type: B.fetching
}),
io.a.call('badges/list', {
data: {
forum: e
},
success: function (e) {
t({
type: B.onFetch,
badgesEnabled: e.response.enabled,
badges: e.response.badges
})
},
error: function () {
t({
type: B.onFetchError,
message: 'We couldn\'t retrieve the badges for your website. Try again.'
})
}
})
}
},
uploadImages: function (e) {
var r = e.data,
o = e.onSuccess;
return function (n) {
var e = r.options || {
},
a = !1;
n({
type: B.uploading
});
var t = r.badges.map(function (t) {
return t.imageFile && 'blob' === t.image.split(':') [0] ? cq.a.uploadMediaUrl([t.imageFile], e).then(function (e) {
return pq(pq({
}, t), {
}, {
image: e.get('url'),
imageFile: null,
imageErrors: [
]
})
}).catch(function () {
a = !0,
n({
type: B.onUploadError,
message: 'We weren\'t able to upload the provided badge images. Try again.'
})
}) : t
});
Promise.all(t).then(function (e) {
a || (n({
type: B.onUpload,
badges: e
}), o(e))
})
}
},
saveBadges: function (e) {
var n = e.forum,
a = e.data,
r = e.onSuccess;
return function (t) {
t({
type: B.saving
}),
io.a.call('badges/update', {
type: 'POST',
data: {
forum: n,
badges: JSON.stringify(a.badges)
},
success: function (e) {
e = {
badgesEnabled: e.response.enabled,
badges: e.response.badges
};
t(pq({
type: B.onSave
}, e)),
r(e)
},
error: function () {
t({
type: B.onSaveError,
message: 'An error occurred trying to save your badges. Try again.'
})
}
})
}
}
},
dq = window.URL || window.webkitURL,
mq = function (e) {
return e ? dq.createObjectURL(e) : null
},
fq = function (e) {
return e ? dq.revokeObjectURL(e) : null
},
hq = function (e, t) {
return !!e && (!t || e.size <= t)
};
function gq(e) {
return (gq = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function yq(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function bq(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? yq(Object(n), !0).forEach(function (e) {
wq(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : yq(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function vq(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function _q(e, t) {
return (_q = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function Eq(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = Sq(n);
return e = a ? (e = Sq(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== gq(e) && 'function' != typeof e ? Oq(t) : e
}
}
function Oq(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function Sq(e) {
return (Sq = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function wq(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var Pq = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && _q(e, t)
}(o, A);
var e,
t,
n,
a = Eq(o);
function o() {
var r;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return wq(Oq(r = a.call.apply(a, [
this
].concat(t))), 'handleChange', function (e, t) {
var n,
a = {
};
'image' === e && t.target.files ? (n = t.target.files[0], r.props.image && 'blob' === r.props.image.split(':') [0] && fq(r.props.image), a.imageFile = n, a.image = mq(n), a.imageErrors = hq(n, lC) ? [
] : [
'The image must be less than '.concat(lC / 1000, 'KB')
], a.isInvalid = 0 < a.imageErrors.length) : 'criteria' === e ? (a.criteria = t.target.value, a.criteria === We.BADGES_CRITERIA.MANUAL ? a.target = 0 : r.props.target && r.props.target || (a.target = 1)) : 'target' === e ? a.target = parseInt(t.target.value, 10) : a[e] = t.target.value,
r.props.onChange(a)
}),
wq(Oq(r), 'isManuallyAssigned', function () {
return r.props.criteria === We.BADGES_CRITERIA.MANUAL
}),
wq(Oq(r), 'hasValidTarget', function () {
return r.isManuallyAssigned() ? 0 === r.props.target : 0 < r.props.target && r.props.target <= sC
}),
r
}
return e = o,
(t = [
{
key: 'render',
value: function () {
var e = this.props.imageErrors && 0 < this.props.imageErrors.length;
return C.a.createElement('div', {
className: 'badge row'
}, C.a.createElement('div', {
className: 'row__header'.concat(this.props.hasChanges ? ' settings__highlighted' : '')
}, C.a.createElement('div', {
className: 'align row__header-left text-gray'
}, C.a.createElement('div', {
className: 'badge-inputs-wrapper align align--middle align--wrap'
}, C.a.createElement('span', {
className: 'image-wrapper align--wrap'
}, C.a.createElement('input', {
type: 'file',
id: 'badge-image-input__'.concat(this.props.id),
className: 'input--display-label',
onChange: this.handleChange.bind(this, 'image'),
accept: '.png, .jpg, .jpeg'
}), C.a.createElement('label', {
htmlFor: 'badge-image-input__'.concat(this.props.id),
className: 'badge-image-label'.concat(this.props.image ? ' has-image' : '').concat(this.props.highlightInvalid && !this.props.image || e ? ' is-error' : '')
}, C.a.createElement('div', {
className: 'badge-image-mask'
}, this.props.image ? C.a.createElement('img', {
className: 'badge-image-content',
src: this.props.image,
alt: ''.concat(this.props.name, ' badge')
}) : C.a.createElement('span', {
className: 'badge-image-placeholder'
}, C.a.createElement('img', {
className: 'image-upload-icon',
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/image-upload.svg',
alt: 'Upload a badge'
}))))), C.a.createElement('span', {
className: 'badge-input-group'
}, C.a.createElement('span', {
className: 'name-wrapper align--wrap spacing-left'
}, C.a.createElement($h, {
name: 'name',
idNamespace: 'badge__'.concat(this.props.id),
value: this.props.name,
placeholder: 'Name',
className: 'input--textbox'.concat(this.props.highlightInvalid && !this.props.name ? ' is-error' : ''),
onChange: this.handleChange.bind(this, 'name'),
maxLength: 20,
inline: !0,
showLimit: !0,
width: 210,
autocomplete: !1
})), C.a.createElement('span', {
className: 'criteria-wrapper align--wrap spacing-left'
}, C.a.createElement(Mf, {
name: 'criteria',
className: 'select__criteria'.concat(this.props.highlightInvalid && !this.props.criteria ? ' is-error' : ''),
options: dC,
value: this.props.criteria || '',
placeholder: 'Select a criteria',
onChange: this.handleChange.bind(this, 'criteria'),
width: 275,
inline: !0
})), C.a.createElement('span', {
className: 'target-wrapper align--wrap spacing-left'
}, C.a.createElement('input', {
type: 'number',
name: 'target',
id: 'badge_target_'.concat(this.props.id),
className: 'input--textbox -inline'.concat(this.props.highlightInvalid && !this.hasValidTarget() ? ' is-error' : ''),
min: 0,
max: sC,
value: this.props.target || 0,
onChange: this.handleChange.bind(this, 'target'),
readOnly: this.isManuallyAssigned() || !this.props.criteria,
disabled: this.isManuallyAssigned() || !this.props.criteria
}))))), C.a.createElement('div', {
className: 'align row__header-right'
}, C.a.createElement('button', {
className: 'button button-outline button-small',
onClick: this.props.removeBadge
}, 'Remove'))), C.a.createElement('ul', {
className: 'badge-error-list text-small'
}, e && this.props.imageErrors.map(function (e, t) {
return C.a.createElement('li', {
key: t,
className: 'badge-error'
}, e)
})))
}
}
]) && vq(e.prototype, t),
n && vq(e, n),
o
}();
wq(Pq, 'propTypes', bq(bq({
}, sl), {
}, {
hasChanges: b.a.bool,
highlightInvalid: b.a.bool,
imageErrors: b.a.arrayOf(b.a.string),
onChange: b.a.func.isRequired,
removeBadge: b.a.func.isRequired
}));
Ru = function (e) {
var t,
n = e.type,
a = e.badge,
r = e.onConfirm,
e = e.onClose;
return n === uC ? t = {
title: 'Are you sure you want to change the criteria for this badge?',
message: C.a.createElement('div', null, 'Changing the criteria for this badge will not remove it from commenters that have already received it.', ' ', a.criteria === We.BADGES_CRITERIA.MANUAL ? null : C.a.createElement('span', null, 'Additionally, all progress made towards this badge criteria will be reset.', C.a.createElement('p', {
className: 'text-bold'
}, 'This action will take effect once the changes are saved and cannot be undone.'))),
closeButton: 'Don\'t change this badge',
confirmButton: 'Change this badge'
}
: n === cC && (t = {
title: 'Are you sure you want to remove this badge?',
message: C.a.createElement('div', null, 'Removing this badge will permanently remove it from all commenters that have received it.', ' ', a.criteria === We.BADGES_CRITERIA.MANUAL ? null : C.a.createElement('span', null, 'Additionally, all progress made towards this badge criteria will be reset.'), C.a.createElement('p', {
className: 'text-bold'
}, 'This action will take effect once the changes are saved and cannot be undone.')),
closeButton: 'Keep this badge',
confirmButton: 'Remove this badge'
}),
C.a.createElement(_.a, {
isOpen: !0,
shouldCloseOnEsc: !1,
className: 'admin-modal -clipped -wider -centered',
overlayClassName: 'modal-overlay -dark'
}, C.a.createElement('div', {
className: 'admin-modal__header align align--between padding-gutter'
}, C.a.createElement('h3', {
className: 'text-large'
}, t.title), C.a.createElement('button', {
className: 'link-gray',
onClick: e
}, C.a.createElement('span', {
className: 'icon-cancel icon__position'
}))), C.a.createElement('div', {
className: 'admin-modal__content padding-gutter'
}, t.message, C.a.createElement('div', {
className: 'spacing-top-double align align--between'
}, C.a.createElement('button', {
className: 'button button-medium button-fill',
onClick: e
}, t.closeButton), C.a.createElement('button', {
className: 'button button-medium button-fill--red',
onClick: r
}, t.confirmButton))))
};
Ru.propTypes = {
type: b.a.number.isRequired,
badge: b.a.shape(sl).isRequired,
onConfirm: b.a.func.isRequired,
onClose: b.a.func.isRequired
};
var kq = Ru,
r = function (e) {
var t = e.onConfirm,
e = e.onClose;
return C.a.createElement(_.a, {
isOpen: !0,
onRequestClose: e,
shouldCloseOnEsc: !1,
className: 'admin-modal -clipped -wider -centered',
overlayClassName: 'modal-overlay -dark'
}, C.a.createElement('div', {
className: 'admin-modal__header align align--between padding-gutter'
}, C.a.createElement('h3', {
className: 'text-large'
}, 'Are you sure you want to disable badges?'), C.a.createElement('button', {
className: 'link-gray',
onClick: e
}, C.a.createElement('span', {
className: 'icon-cancel icon__position'
}))), C.a.createElement('div', {
className: 'admin-modal__content padding-gutter'
}, C.a.createElement('div', null, 'All assigned badges will be removed from users on your site. This will also reset any progress that commenters have made towards each badge criteria.', C.a.createElement('p', {
className: 'text-bold'
}, 'This cannot be undone.')), C.a.createElement('div', {
className: 'spacing-top-double align align--between'
}, C.a.createElement('button', {
className: 'button button-medium button-fill',
onClick: e
}, 'Keep Badges on'), C.a.createElement('button', {
className: 'button button-medium button-fill--red',
onClick: t
}, 'Yes, turn Badges off'))))
};
r.propTypes = {
onConfirm: b.a.func.isRequired,
onClose: b.a.func.isRequired
};
var Nq = r;
function Cq(e) {
return (Cq = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function Rq() {
return (Rq = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function xq(e) {
return function (e) {
if (Array.isArray(e)) return Aq(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return Aq(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Aq(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function Aq(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function Dq(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function jq(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? Dq(Object(n), !0).forEach(function (e) {
Uq(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : Dq(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function Tq(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function Iq(e, t) {
return (Iq = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function qq(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = Lq(n);
return e = a ? (e = Lq(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== Cq(e) && 'function' != typeof e ? Fq(t) : e
}
}
function Fq(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function Lq(e) {
return (Lq = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function Uq(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var Mq = function (e) {
return !!(e.image && e.name && e.criteria && 0 === e.imageErrors.length) && (e.criteria === We.BADGES_CRITERIA.MANUAL && 0 === e.target || e.criteria !== We.BADGES_CRITERIA.MANUAL && 0 < e.target && e.target <= sC)
},
go = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && Iq(e, t)
}(r, A);
var e,
t,
n,
a = qq(r);
function r() {
var i;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return Uq(Fq(i = a.call.apply(a, [
this
].concat(t))), 'state', {
badgesEnabled: !1,
badges: i.props.badges,
highlightInvalidFields: null,
hasInvalidBadges: !1,
hasNewImages: !1,
hasRemovedBadge: !1,
savedBadges: [
],
errors: [
],
modal: {
}
}),
Uq(Fq(i), 'confirmNavigationIfUnsaved', function () {
if (i.hasUnsavedChanges()) return 'You have unsaved changes. Do you want to leave this page?'
}),
Uq(Fq(i), 'hasUnsavedChanges', function () {
return i.state.badges.some(function (e) {
return e.hasChanges
}) || i.state.hasRemovedBadge
}),
Uq(Fq(i), 'hasBadgesFeature', function () {
return !!(i.props.forumDetails && i.props.forumDetails.features && i.props.forumDetails.features.badges)
}),
Uq(Fq(i), 'getBadgeById', function (t) {
var e = i.state.badges.filter(function (e) {
return e.id === t
});
return e.length ? e[0] : null
}),
Uq(Fq(i), 'getChangedFields', function (t) {
var e = [
'image',
'name',
'criteria',
'target'
];
if (t.isNew) return e;
var n = i.state.savedBadges.filter(function (e) {
return e.id === t.id
}).pop() || {
};
return e.filter(function (e) {
return n[e] !== t[e]
})
}),
Uq(Fq(i), 'updateBadgesData', function (e) {
return e.length ? e.map(function (e) {
return jq(jq({
}, e), {
}, {
imageFile: null,
imageErrors: [
],
isNew: !1,
isInvalid: !1,
hasChanges: !1
})
}) : i.state.badges.length ? i.state.badges : [
jq(jq({
}, mC), {
}, {
id: i.generateBadgeId()
})
]
}),
Uq(Fq(i), 'generateBadgeId', function () {
for (var e = null; !e || i.getBadgeById(e); ) e = Math.floor(10 * Math.random()) + We.MAX_BADGE_COUNT;
return e
}),
Uq(Fq(i), 'getTrackingData', function () {
var e = i.state.badges.map(function (e) {
return je.a.pick(e, 'id', 'image', 'name', 'criteria', 'target', 'forum')
});
return {
zone: 'badges',
section: 'settings',
verb: 'update',
object_type: 'forum',
object_id: i.props.selection.forum.id,
area: 'modal',
extra_data: {
badgesEnabled: {
before: i.state.badgesEnabled,
after: null
},
badges: {
before: e,
after: null
}
}
}
}),
Uq(Fq(i), 'emitEvent', function (e) {
e.extra_data = JSON.stringify(e.extra_data),
i.props.emitTrackingEvent(e)
}),
Uq(Fq(i), 'createBadge', function () {
var t = i.generateBadgeId();
i.setState(function (e) {
return {
badges: [
].concat(xq(e.badges), [
jq(jq({
}, mC), {
}, {
id: t,
hasChanges: !1
})
]),
hasInvalidBadges: !0,
highlightInvalidFields: !1
}
})
}),
Uq(Fq(i), 'removeBadge', function (a, e) {
var r = i.getBadgeById(a);
r || e ? i.setState(function (e) {
var t = e.badges.filter(function (e) {
return e.id !== a
}),
n = t.some(function (e) {
return e.isInvalid
});
return {
hasInvalidBadges: n,
badges: t,
modal: {
},
hasRemovedBadge: e.hasRemovedBadge || !r.isNew,
errors: n ? e.errors : [
]
}
}) : i.openModal(cC, r, i.removeBadge.bind(Fq(i), a, !0))
}),
Uq(Fq(i), 'handleBadgeChange', function (n, e, t) {
var a = i.getBadgeById(n),
r = jq(jq({
}, a), e),
o = i.getChangedFields(r);
!e.criteria || r.isNew || !~o.indexOf('criteria') || t ? i.setState(function (e) {
var t = e.badges.findIndex(function (e) {
return e.id === n
}),
t = [
].concat(xq(e.badges.slice(0, t)), [
jq(jq({
imageErrors: [
]
}, r), {
}, {
isInvalid: !Mq(r),
hasChanges: 0 < o.length
})
], xq(e.badges.slice(t + 1)));
return {
badges: t,
hasNewImages: e.hasNewImages || !!~o.indexOf('image'),
hasInvalidBadges: t.some(function (e) {
return e.isInvalid
}),
modal: {
},
errors: [
]
}
}) : i.openModal(uC, a, i.handleBadgeChange.bind(Fq(i), a.id, e, !0))
}),
Uq(Fq(i), 'uploadBadgeImages', function () {
i.props.uploadImages({
data: {
badges: i.state.badges
},
onSuccess: function (n) {
var e = n.length ? i.state.badges.map(function (e, t) {
return jq(jq({
}, e), n[t])
}) : i.state.badges;
i.setState({
badges: e,
hasNewImages: !1,
hasInvalidBadges: !1
}, i.saveBadges)
}
})
}),
Uq(Fq(i), 'saveBadges', function () {
var t;
i.state.badgesEnabled ? i.state.hasInvalidBadges ? i.setState(function () {
return {
highlightInvalidFields: !0,
errors: [
'Unable to save these changes because you have one or more invalid badge field. Fix the highlighted fields and try again.'
]
}
}) : i.state.hasNewImages ? i.uploadBadgeImages() : (t = i.getTrackingData(), i.setState(function () {
i.props.saveBadges({
forum: i.props.selection.forum.shortname,
data: {
badges: i.state.badges.map(function (e) {
return {
id: e.isNew ? null : e.id,
name: e.name,
image: e.image,
criteria: e.criteria,
target: e.target
}
})
},
onSuccess: function (e) {
t.extra_data.badgesEnabled.after = e.badgesEnabled,
t.extra_data.badges.after = e.badges,
i.emitEvent(t)
}
})
})) : i.toggleBadgesEnabled(!1)
}),
Uq(Fq(i), 'toggleBadgesEnabled', function (e) {
var t;
i.state.badgesEnabled && !e ? i.openModal(pC, null, i.toggleBadgesEnabled.bind(Fq(i), !0)) : (t = i.getTrackingData(), i.props.toggleBadges({
forum: i.props.selection.forum.shortname,
data: {
badgesEnabled: i.state.badgesEnabled ? 0 : 1
},
onSuccess: function (e) {
t.verb = e.badgesEnabled ? 'enable' : 'disable',
t.extra_data.badgesEnabled.after = e.badgesEnabled,
i.emitEvent(t)
}
}))
}),
Uq(Fq(i), 'openModal', function (e, t, n) {
i.setState({
modal: {
type: e,
badge: t,
onConfirm: n
}
})
}),
Uq(Fq(i), 'closeModal', function () {
i.setState({
modal: {
}
})
}),
Uq(Fq(i), 'getBadgesModal', function () {
return i.state.modal.type === cC || i.state.modal.type === uC ? C.a.createElement(kq, Rq({
}, i.state.modal, {
onClose: i.closeModal
})) : i.state.modal.type === pC ? C.a.createElement(Nq, Rq({
}, i.state.modal, {
onClose: i.closeModal
})) : void 0
}),
i
}
return e = r,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.history.setRouteLeaveHook(this.props.route, this.confirmNavigationIfUnsaved),
window.onbeforeunload = this.confirmNavigationIfUnsaved,
this.props.emitTrackingEvent({
verb: 'view',
object_type: 'page',
object_id: ''.concat(window.document.location.host).concat(window.document.location.pathname)
}),
this.props.forumDetails ? this.hasBadgesFeature() && this.props.fetchBadges(this.props.selection.forum.shortname) : this.props.fetchForumDetails()
}
},
{
key: 'componentWillReceiveProps',
value: function (t) {
var n = {
};
!this.hasBadgesFeature() || t.isFetching || this.props.isFetched || t.isFetched || this.props.fetchBadges(this.props.selection.forum.shortname),
this.props.isFetching && !t.isFetching ? n.savedBadges = t.badgesSynced : this.props.isToggling && !t.isToggled && t.badgesEnabledSynced && this.hasUnsavedChanges() ? this.saveBadges() : this.props.isSaving && t.isSaved && (n.savedBadges = t.badgesSynced, n.hasRemovedBadge = !1),
(t.errors || t.forumDetailsError) && (n.errors = t.errors, t.forumDetailsError && n.errors.push(t.forumDetailsError)),
n.badges = this.updateBadgesData(t.badgesSynced),
this.setState(function (e) {
return jq(jq({
}, n), {
}, {
badgesEnabled: void 0 === t.badgesEnabledSynced ? e.badgesEnabled : t.badgesEnabledSynced,
highlightInvalidFields: !1,
errors: t.errors,
modal: {
}
})
})
}
},
{
key: 'render',
value: function () {
var t = this;
if (!this.props.forumDetails && !this.props.forumDetailsError || this.props.forumDetailsIsFetching || this.props.isFetching) return C.a.createElement(Ji, null);
var e = this.hasUnsavedChanges() && !(this.state.highlightInvalidFields && this.state.hasInvalidBadges),
n = this.hasBadgesFeature();
return C.a.createElement('div', null, n ? null : C.a.createElement(ch, {
headline: 'Looking to create badges for your website?',
promotionalPlan: 'Disqus Pro',
planDetailsUrl: 'https://disqus.com/pricing/',
upsellMessageLeft: 'Upgrade to',
upsellMessageRight: ' to create and award badges for your audience.',
selection: this.props.selection,
emitTrackingEvent: this.props.emitTrackingEvent
}), C.a.createElement('div', {
className: 'settings-badges'
}, C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Configure Badges'), C.a.createElement('p', {
className: 'text-gray'
}, 'Create custom badges to reward engagement on your site. ', C.a.createElement('a', {
href: Pn.badges,
target: '_blank',
rel: 'noopener noreferrer'
}, 'Learn more »'))), C.a.createElement('section', {
className: 'settings__content'
}, C.a.createElement('header', null, C.a.createElement('p', {
className: 'text-gray text-medium'
}, 'Define up to ', We.MAX_BADGE_COUNT, ' badges that you would like to award to commenters on your website. A badge can be awarded manually or automatically based on one of the provided criteria.'), C.a.createElement('p', {
className: 'text-gray text-medium'
}, C.a.createElement('b', null, 'Having trouble coming up with badge images?'), ' You can download a collection of images ', C.a.createElement('a', {
href: Pn.badgesImageCollection,
target: '_blank',
rel: 'noopener noreferrer'
}, 'here'), '.')), this.state.errors && this.state.errors.length || this.props.error ? C.a.createElement(Ki, {
message: this.state.errors && this.state.errors.length ? C.a.createElement('span', null, this.state.errors.map(function (e, t) {
return C.a.createElement('span', {
key: t
}, e, C.a.createElement('br', null))
})) : this.props.error,
alertType: 'error'
}) : null, C.a.createElement('div', {
className: 'badges-section spacing-top'
}, C.a.createElement('div', {
className: 'rows__container'
}, C.a.createElement('div', {
className: 'badges-input-header row text-gray-dark text-medium'
}, C.a.createElement('span', {
className: 'image-header align--wrap'
}, 'Image', C.a.createElement(Md, {
tooltipKey: 'badge_images',
content: 'We recommend a small, distinctive image to make sure the badge is discernible when displayed next to a username.\n (Max size: '.concat(lC / 1000, 'KB)')
})), C.a.createElement('span', {
className: 'badges-header-group'
}, C.a.createElement('span', {
className: 'name-header align--wrap spacing-left'
}, 'Name'), C.a.createElement('span', {
className: 'criteria-header align--wrap spacing-left'
}, 'Criteria', C.a.createElement(Md, {
tooltipKey: 'badge_criteria',
content: 'The criteria will only apply to future engagement and will not reflect activity prior to the badge creation.'
})), C.a.createElement('span', {
className: 'target-header align--wrap spacing-left'
}, 'Target', C.a.createElement(Md, {
tooltipKey: 'badge_target',
content: 'Changing the target will not remove the badge from users that have already received it.'
})))), this.state.badges ? this.state.badges.map(function (e) {
return C.a.createElement(Pq, Rq({
}, e, {
key: e.id,
onChange: t.handleBadgeChange.bind(t, e.id),
removeBadge: t.removeBadge.bind(t, e.id, !1),
isBadgeValid: Mq.bind(t, e),
highlightInvalid: t.state.highlightInvalidFields
}))
}) : null, C.a.createElement('div', {
className: 'add-row align spacing-top-narrow'
}, C.a.createElement('button', {
className: 'button button-fill--brand button-small',
onClick: this.createBadge,
disabled: We.MAX_BADGE_COUNT <= this.state.badges.length
}, '+ Add badge'))))), C.a.createElement('footer', {
className: 'settings__footer'
}, C.a.createElement(Bh, {
onClick: this.saveBadges,
buttonLabel: this.state.badgesEnabled && n ? 'Save' : 'Enable Badges on your site',
disabled: this.state.badgesEnabled ? !e : !n,
fieldsetAdditionalClass: 'unset-width',
isSaving: this.props.isSaving,
isSaved: this.props.isSaved,
saveErr: !!this.state.errors.length
}))), this.state.badgesEnabled ? C.a.createElement('div', {
className: 'content__wrap'
}, C.a.createElement('header', {
className: 'settings__header disable-section align align--between align--middle'
}, C.a.createElement('div', {
className: 'spacing-right-large'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Disable Badges'), C.a.createElement('p', {
className: 'text-gray'
}, 'The badges will be removed from all commenters on your site.')), C.a.createElement('div', {
className: 'align__item--no-shrink'
}, C.a.createElement('button', {
className: 'button button-fill--red button-medium',
onClick: this.toggleBadgesEnabled.bind(this, !1)
}, 'Turn Badges off')))) : null, this.getBadgesModal()))
}
}
]) && Tq(e.prototype, t),
n && Tq(e, n),
r
}();
Uq(go, 'displayName', 'ForumSettingsBadges'),
Uq(go, 'propTypes', {
selection: ht.isRequired,
badgesEnabledSynced: b.a.bool,
badgesSynced: b.a.arrayOf(b.a.shape(sl)),
isFetching: b.a.bool,
isFetched: b.a.bool,
isSaving: b.a.bool,
isSaved: b.a.bool,
error: b.a.string,
toggleBadges: b.a.func.isRequired,
fetchBadges: b.a.func.isRequired,
uploadImages: b.a.func.isRequired,
saveBadges: b.a.func.isRequired,
emitTrackingEvent: b.a.func.isRequired,
forumDetails: $c,
forumDetailsError: b.a.string,
forumDetailsIsFetching: b.a.bool,
fetchForumDetails: b.a.func.isRequired,
saasFeatures: b.a.objectOf(b.a.objectOf(b.a.bool)).isRequired,
history: b.a.shape({
push: b.a.func.isRequired,
setRouteLeaveHook: b.a.func.isRequired
}).isRequired,
route: b.a.object
});
var F = Object(u.connect) (function (e) {
var t = e.badges,
n = e.saasFeatures,
a = e.selection;
return jq(jq({
forumDetails: e.forumDetails.forumDetails
}, t), {
}, {
badgesEnabledSynced: t.badgesEnabled,
badgesSynced: t.badges,
saasFeatures: n,
selection: a
})
}, jq(jq({
fetchForumDetails: ig
}, Wi), {
}, {
emitTrackingEvent: Xo({
zone: 'badges',
section: 'settings'
})
})) (Fo() (go)),
yl = n(520),
Bq = n.n(yl),
Ru = n(521),
zq = n.n(Ru),
Hq = n(54),
Gq = 10,
Vq = 20,
r = b.a.shape({
text: b.a.string.isRequired,
votes: b.a.number,
imageUrl: b.a.string,
imageID: b.a.number,
isSelected: b.a.bool,
errs: b.a.shape({
text: b.a.bool,
imageUrl: b.a.bool,
imageID: b.a.bool
})
}),
sl = b.a.shape({
imageUrl: b.a.string.isRequired,
imageID: b.a.number.isRequired
}),
Wq = 'You must have least 2 reactions',
Yq = 'You may not have more than 6 reactions',
Qq = 'You must select an image for each reaction',
Kq = 'You must enter a description for each reaction',
Jq = 'You may not use the same image more than once',
$q = 'You may not use the same description more than once';
function Zq(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function Xq(a) {
for (var e = 1; e < arguments.length; e++) {
var r = null != arguments[e] ? arguments[e] : {
};
e % 2 ? Zq(Object(r), !0).forEach(function (e) {
var t,
n;
n = r[t = e],
t in (e = a) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(r)) : Zq(Object(r)).forEach(function (e) {
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(r, e))
})
}
return a
}
function eF(e) {
return (e().selection.forum || {
}).shortname
}
Wi = {
fetchReactions: function () {
return function (t, e) {
e = eF(e);
e && (t({
type: me.fetchReactions
}), io.a.call('threadReactions/loadTemplateAndImages', {
data: {
forum: e
},
success: function (e) {
t(Xq({
type: me.onFetch
}, e.response))
},
error: function () {
t({
type: me.onError,
message: 'An unknown error occurred trying to fetch your reactions'
})
}
}))
}
},
fetchDefaultReactions: function () {
return function (t) {
io.a.call('threadReactions/getDefaultImages', {
success: function (e) {
var n;
t({
type: me.onFetchDefaultReactions,
payload: Object.keys(n = e.response).map(function (e, t) {
return {
imageID: t + 1,
imageUrl: n[e].url,
text: n[e].reaction_text
}
})
})
},
error: function () {
t({
type: me.onError,
message: 'An unknown error occurred fetching default reactions'
})
}
})
}
},
validateReactions: function (e) {
var l = e.reactions,
c = e.existingErrors;
return function () {
var a,
r,
e,
o,
i,
s,
n = {
},
t = void 0 !== c;
return t || l.forEach(function (e) {
e.errors = {
}
}),
l.length < 2 ? n[Wq] = !0 : 6 < l.length && (n[Yq] = !0),
r = 'imageUrl',
e = t,
o = [
],
i = [
],
s = {
},
(a = l).forEach(function (e, t) {
var n = 'imageUrl' === r ? je.a.last(e[r].split('/')).split('-') [0].split('.') [0] : e[r];
n && n.trim() || (o.push('imageUrl' === r ? Qq : Kq), i.push(e)),
s.hasOwnProperty(n) ? (o.push('imageUrl' === r ? Jq : $q), i.push(e), (e = a[s[n]]) && i.push(e)) : s[n] = t
}),
e ? a.forEach(function (e) {
e.errors && e.errors[r] && !~i.indexOf(e) && (e.errors[r] = !1)
}) : i.forEach(function (e) {
e.errors = e.errors || {
},
e.errors[r] = !0
}),
o.forEach(function (e) {
n[e] = !0
}),
Object.keys(n).length ? t ? c && c.reduce(function (e, t) {
return n[t] && e.push(t),
e
}, [
]) : Object.keys(n) : null
}
},
saveReactions: function (e) {
var n = e.data,
a = e.onSuccess,
r = e.onError;
return function (t, e) {
e = eF(e);
e && (t({
type: me.saveReactions
}), io.a.call('threadReactions/saveTemplate', {
type: 'POST',
data: Xq({
forum: e
}, n),
success: function (e) {
t({
type: me.onSave
}),
a && a(e)
},
error: function (e) {
t({
type: me.onError,
message: 'An error occurred trying to save your reactions'
}),
r && r(e)
}
}))
}
},
setReactionsEnabled: function (e) {
var n = e.enabled,
a = e.onSuccess,
r = e.onError;
return function (t, e) {
e = eF(e);
e && (t({
type: me.saveReactions
}), io.a.call('threadReactions/enableForForum', {
type: 'POST',
data: {
forum: e,
disable: n ? 0 : 1
},
success: function (e) {
t({
type: me.onSave
}),
a && a(e)
},
error: function (e) {
t({
type: me.onError,
message: 'An error occurred trying to '.concat(n ? 'enable' : 'disable', ' your reactions')
}),
r && r(e)
}
}))
}
}
};
function tF(e) {
return (tF = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function nF(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function aF(e, t) {
return (aF = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function rF(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = iF(n);
return e = a ? (e = iF(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== tF(e) && 'function' != typeof e ? oF(t) : e
}
}
function oF(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function iF(e) {
return (iF = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function sF(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
go = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && aF(e, t)
}(o, A);
var e,
t,
n,
r = rF(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return sF(oF(e = r.call.apply(r, [
this
].concat(n))), 'onDelete', function () {
e.props.closeModal(),
e.props.deleteImages()
}),
e
}
return e = o,
(t = [
{
key: 'render',
value: function () {
return C.a.createElement('div', null, C.a.createElement(_.a, {
isOpen: this.props.isOpen,
onRequestClose: this.props.closeModal,
contentLabel: 'Delete Confirmation',
className: 'admin-modal__custom-images padding-double'
}, C.a.createElement('h2', null, 'Do you want to delete '.concat(this.props.isMultiple ? 'these reactions' : 'this reaction', '?')), C.a.createElement('div', null, C.a.createElement('button', {
onClick: this.onDelete,
className: 'button button-fill--red button-small'
}, 'Delete'), C.a.createElement('button', {
onClick: this.props.closeModal,
className: 'button button-fill--brand button-small'
}, 'Cancel'))))
}
}
]) && nF(e.prototype, t),
n && nF(e, n),
o
}();
sF(go, 'propTypes', {
deleteImages: b.a.func.isRequired,
isOpen: b.a.bool.isRequired,
closeModal: b.a.func.isRequired,
isMultiple: b.a.bool.isRequired
});
var lF = go;
function cF(e) {
return (cF = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function uF(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function pF(e, t) {
return (pF = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function dF(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = fF(n);
return e = a ? (e = fF(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== cF(e) && 'function' != typeof e ? mF(t) : e
}
}
function mF(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function fF(e) {
return (fF = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function hF(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
yl = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && pF(e, t)
}(o, A);
var e,
t,
n,
r = dF(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return hF(mF(e = r.call.apply(r, [
this
].concat(n))), 'onClickDeletableReactions', function () {
e.props.toggleImageSelection(e.props.id),
e.props.clearHighlight(e.props.id),
e.props.numHighlightedImages || e.props.updateErrorMessage('')
}),
hF(mF(e), 'onClickNoneDeletableReaction', function () {
return e.props.updateErrorMessage('You may not delete images currently used in the template.')
}),
e
}
return e = o,
(t = [
{
key: 'componentWillReceiveProps',
value: function (e) {
this.props.isDeletable !== e.isDeletable && !e.isDeletable && e.selected && this.props.toggleImageSelection(this.props.id)
}
},
{
key: 'render',
value: function () {
return C.a.createElement('div', {
className: 'custom-image'.concat(this.props.selected && this.props.isDeletable ? '-selected' : this.props.highlighted ? '-highlighted' : ''),
key: this.props.id
}, C.a.createElement('img', {
src: this.props.url,
onClick: this.props.isDeletable ? this.onClickDeletableReactions : this.onClickNoneDeletableReaction
}))
}
}
]) && uF(e.prototype, t),
n && uF(e, n),
o
}();
hF(yl, 'propTypes', {
id: b.a.number.isRequired,
url: b.a.string.isRequired,
toggleImageSelection: b.a.func.isRequired,
clearHighlight: b.a.func.isRequired,
isDeletable: b.a.bool.isRequired,
updateErrorMessage: b.a.func.isRequired,
selected: b.a.bool.isRequired,
highlighted: b.a.bool.isRequired,
numHighlightedImages: b.a.number.isRequired
});
var gF = yl;
function yF(e) {
return (yF = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function bF(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function vF(e, t) {
return (vF = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function _F(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = OF(n);
return e = a ? (e = OF(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== yF(e) && 'function' != typeof e ? EF(t) : e
}
}
function EF(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function OF(e) {
return (OF = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function SF(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Ru = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && vF(e, t)
}(o, A);
var e,
t,
n,
a = _F(o);
function o() {
var r;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return SF(EF(r = a.call.apply(a, [
this
].concat(t))), 'state', {
isLoading: !1,
enabled: !0
}),
SF(EF(r), 'fileSelectedHandler', function (e) {
if (e.target.files.length) {
var t = [
],
n = e.target.files.length;
if (Gq < n + r.props.numImages) r.props.updateErrorMessage('You can have up to '.concat(Gq, ' images'));
else {
r.setState({
isLoading: !0,
enabled: !1
});
for (var a = 0; a < n; a++) cq.a.uploadMediaUrl([e.target.files[a]]).then(function (e) {
t.push(e.get('url')),
t.length === n && r.saveUrlsToDb(t)
}).catch(function (e) {
var t = (t = e && e.code ? Hq.UPLOAD_IMAGE_ERROR_MESSAGES[e.code] : t) || JSON.parse(e.responseText).response;
r.props.updateErrorMessage(t),
r.setState({
isLoading: !1
})
})
}
}
}),
SF(EF(r), 'saveUrlsToDb', function (e) {
io.a.call('threadReactions/createImages', {
type: 'POST',
data: {
urls: e,
forum: r.props.forum
},
success: function (e) {
e = e.response;
e.images.length && (t = e.images.map(function (e) {
return {
imageID: e.id,
imageUrl: e.url
}
}), r.props.addNewCustomImages(t));
var t = '';
e.duplicateImageIds.length ? (t = 'Duplicate reactions are not allowed.', r.props.highlightDuplicateImages(e.duplicateImageIds)) : e.invalidUrls.length && (t = 'Invalid image url(s)'),
t && r.props.updateErrorMessage(t)
},
error: function (e) {
r.props.updateErrorMessage(JSON.parse(e.responseText).response)
}
}),
r.setState(function (e) {
return {
isLoading: !1,
enabled: e.numImages < Gq
}
})
}),
SF(EF(r), 'onClick', function (e) {
r.props.updateErrorMessage(''),
r.props.clearHighlights(),
r.props.clearSelectedIDs(),
(e.target || e.srcElement).value.length || r.setState({
enabled: !0
})
}),
r
}
return e = o,
(t = [
{
key: 'componentWillReceiveProps',
value: function (e) {
this.setState({
enabled: e.numImages < Gq
})
}
},
{
key: 'render',
value: function () {
return C.a.createElement(C.a.Fragment, null, C.a.createElement('div', {
className: 'loading'.concat(this.state.isLoading ? '-show' : '-hide')
}), C.a.createElement('div', {
className: 'upload-button'.concat(this.state.enabled ? '' : '-disabled')
}, C.a.createElement('input', {
type: 'file',
id: 'custom-reaction-input',
className: 'custom-reaction-input',
onChange: this.fileSelectedHandler,
onClick: this.onClick,
disabled: !this.state.enabled,
accept: 'image/*',
multiple: !0,
value: ''
}), C.a.createElement('label', {
htmlFor: 'custom-reaction-input'
}, C.a.createElement('img', {
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/add-avatar-plus.svg',
className: 'custom-reaction-upload-icon',
alt: 'Upload a Custom Reaction'
}))))
}
}
]) && bF(e.prototype, t),
n && bF(e, n),
o
}();
SF(Ru, 'propTypes', {
forum: b.a.string.isRequired,
updateErrorMessage: b.a.func.isRequired,
addNewCustomImages: b.a.func.isRequired,
highlightDuplicateImages: b.a.func.isRequired,
clearHighlights: b.a.func.isRequired,
numImages: b.a.number.isRequired,
clearSelectedIDs: b.a.func.isRequired
});
var wF = Ru;
function PF(e) {
return (PF = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function kF(e) {
return function (e) {
if (Array.isArray(e)) return NF(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return NF(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? NF(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function NF(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function CF(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function RF(e, t) {
return (RF = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function xF(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = DF(n);
return e = a ? (e = DF(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== PF(e) && 'function' != typeof e ? AF(t) : e
}
}
function AF(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function DF(e) {
return (DF = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function jF(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
go = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && RF(e, t)
}(o, A);
var e,
t,
n,
r = xF(o);
function o() {
var n;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) t[a] = arguments[a];
return jF(AF(n = r.call.apply(r, [
this
].concat(t))), 'state', {
selectedIDs: [
],
duplicateIDs: [
],
errorMessage: '',
isOpenConfirmDialog: !1
}),
jF(AF(n), 'toggleImageSelection', function (t) {
n.state.selectedIDs.includes(t) ? n.setState(function (e) {
return {
selectedIDs: e.selectedIDs.filter(function (e) {
return e !== t
})
}
}) : n.setState(function (e) {
return {
selectedIDs: [
].concat(kF(e.selectedIDs), [
t
])
}
})
}),
jF(AF(n), 'openConfirmDialog', function () {
return n.setState({
isOpenConfirmDialog: !0
})
}),
jF(AF(n), 'closeConfirmDialog', function () {
return n.setState({
isOpenConfirmDialog: !1
})
}),
jF(AF(n), 'deleteImages', function () {
io.a.call('threadReactions/deleteImages', {
type: 'POST',
data: {
imageIds: n.state.selectedIDs,
forum: n.props.forum
},
success: function () {
n.props.updateRemainingCustomImages(n.props.images.filter(function (t) {
return !n.state.selectedIDs.some(function (e) {
return e === t.imageID
})
})),
n.resetSelectedIDs()
},
error: function (e) {
n.updateErrorMessage(JSON.parse(e.responseText).response)
}
})
}),
jF(AF(n), 'resetSelectedIDs', function () {
return n.setState({
selectedIDs: [
]
})
}),
jF(AF(n), 'resetDuplicateIDs', function () {
return n.setState({
duplicateIDs: [
]
})
}),
jF(AF(n), 'updateErrorMessage', function (e) {
return n.setState({
errorMessage: e
})
}),
jF(AF(n), 'highlightDuplicateImages', function (e) {
return n.setState({
duplicateIDs: e
})
}),
jF(AF(n), 'clearHighlight', function (t) {
n.state.duplicateIDs.includes(t) && n.setState(function (e) {
return {
duplicateIDs: e.duplicateIDs.filter(function (e) {
return e !== t
})
}
})
}),
jF(AF(n), 'closeAlertBar', function () {
n.updateErrorMessage(''),
n.resetDuplicateIDs()
}),
jF(AF(n), 'isImageDeletable', function (t) {
return !(n.props.reactions.some(function (e) {
return e.imageID === t.imageID || e.imageUrl === t.imageUrl
}) || n.props.templateReactions.some(function (e) {
return e.imageID === t.imageID || e.imageUrl === t.imageUrl
}))
}),
n
}
return e = o,
(t = [
{
key: 'render',
value: function () {
var t = this;
return this.props.canEnableCustomReactions ? C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Customize your Reactions'), C.a.createElement('p', {
className: 'text-gray'
}, 'Personalize reactions with your own images.')), C.a.createElement('section', {
className: 'settings__content custom-images'
}, this.state.errorMessage.length ? C.a.createElement(Ki, {
message: this.state.errorMessage,
alertType: 'error',
onRequestClose: function () {
return t.closeAlertBar()
}
}) : null, C.a.createElement(kf, {
label: 'Custom Images',
blockAdditionalClass: 'text-medium',
tooltip: 'We recommend a square, distinctive image that is larger than 42x42px.'
}, C.a.createElement('div', {
className: 'spacing-top-narrow'
}, C.a.createElement('div', {
className: 'images-and-upload-button-block'
}, this.props.images.map(function (e) {
return C.a.createElement(gF, {
key: e.imageID,
id: e.imageID,
url: e.imageUrl,
toggleImageSelection: t.toggleImageSelection,
isDeletable: t.isImageDeletable(e),
updateErrorMessage: t.updateErrorMessage,
selected: t.state.selectedIDs.includes(e.imageID),
highlighted: t.state.duplicateIDs.includes(e.imageID),
clearHighlight: t.clearHighlight,
numHighlightedImages: t.state.duplicateIDs.length
})
}), C.a.createElement(wF, {
forum: this.props.forum,
addNewCustomImages: this.props.addNewCustomImages,
updateErrorMessage: this.updateErrorMessage,
numImages: this.props.images.length,
clearSelectedIDs: this.resetSelectedIDs,
highlightDuplicateImages: this.highlightDuplicateImages,
clearHighlights: this.resetDuplicateIDs
})), C.a.createElement('div', {
className: 'delete-custom-image-btn'
}, C.a.createElement('button', {
onClick: this.openConfirmDialog,
className: this.props.images.length ? 'button button-fill--red button-medium' : 'hide-btn',
disabled: 0 === this.state.selectedIDs.length
}, 'Delete'), C.a.createElement('p', {
className: 'num-images-status text-gray'
}, ''.concat(this.props.images.length, '/').concat(Gq))), C.a.createElement(lF, {
deleteImages: this.deleteImages,
isOpen: this.state.isOpenConfirmDialog,
closeModal: this.closeConfirmDialog,
isMultiple: 1 < this.state.selectedIDs.length
}))))) : null
}
}
]) && CF(e.prototype, t),
n && CF(e, n),
o
}();
jF(go, 'propTypes', {
images: b.a.arrayOf(sl).isRequired,
forum: b.a.string.isRequired,
updateRemainingCustomImages: b.a.func.isRequired,
addNewCustomImages: b.a.func.isRequired,
reactions: b.a.arrayOf(r).isRequired,
templateReactions: b.a.arrayOf(r).isRequired,
canEnableCustomReactions: b.a.bool.isRequired
});
var TF = go,
yl = function (e) {
var t = e.onConfirm,
e = e.onClose;
return C.a.createElement(_.a, {
isOpen: !0,
onRequestClose: e,
className: 'admin-modal -clipped -wider',
overlayClassName: 'modal-overlay -dark'
}, C.a.createElement('div', {
className: 'admin-modal__header align align--between padding-gutter'
}, C.a.createElement('h3', {
className: 'text-large'
}, 'Turn Reactions off'), C.a.createElement('button', {
className: 'link-gray',
onClick: e
}, C.a.createElement('span', {
className: 'icon-cancel icon__position'
}))), C.a.createElement('div', {
className: 'admin-modal__content padding-gutter'
}, C.a.createElement('div', null, 'Are you sure you want to turn reactions off? The Reactions widget will be removed from all new and prior articles on your site. Readers will no longer be able to add Reactions on articles.'), C.a.createElement('div', {
className: 'spacing-top align align--between'
}, C.a.createElement('button', {
className: 'button button-medium button-fill',
onClick: e
}, 'Keep Reactions on'), C.a.createElement('button', {
className: 'button button-medium button-fill--red',
onClick: function () {
return t({
disableConfirmed: !0
})
}
}, 'Yes, turn Reactions off'))))
};
yl.propTypes = {
onConfirm: b.a.func.isRequired,
onClose: b.a.func.isRequired
};
var IF = yl;
function qF(e) {
return (qF = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function FF(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function LF(e, t) {
return (LF = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function UF(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = BF(n);
return e = a ? (e = BF(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== qF(e) && 'function' != typeof e ? MF(t) : e
}
}
function MF(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function BF(e) {
return (BF = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function zF(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Ru = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && LF(e, t)
}(o, A);
var e,
t,
n,
r = UF(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return zF(MF(e = r.call.apply(r, [
this
].concat(n))), 'state', {
applyRetroactively: !1
}),
zF(MF(e), 'toggleRetroactive', function () {
e.setState(function (e) {
return {
applyRetroactively: !e.applyRetroactively
}
})
}),
zF(MF(e), 'onConfirm', function () {
e.props.onConfirm({
saveConfirmed: !0,
applyRetroactively: e.state.applyRetroactively
})
}),
e
}
return e = o,
(t = [
{
key: 'render',
value: function () {
return C.a.createElement(_.a, {
isOpen: !0,
onRequestClose: this.props.onClose,
className: 'admin-modal -clipped -wider ',
overlayClassName: 'modal-overlay -dark'
}, C.a.createElement('div', {
className: 'admin-modal__header align align--between padding-gutter'
}, C.a.createElement('h3', {
className: 'text-large'
}, 'Save new Reactions'), C.a.createElement('button', {
className: 'link-gray',
onClick: this.props.onClose
}, C.a.createElement('span', {
className: 'icon-cancel icon__position'
}))), C.a.createElement('div', {
className: 'admin-modal__content padding-gutter'
}, C.a.createElement('div', null, 'Apply new reactions to ', C.a.createElement('strong', null, 'future'), ' articles on your site. Existing articles will not updated and will keep their existing reactions.'), C.a.createElement('div', {
className: 'spacing-top align text-gray'
}, C.a.createElement('input', {
type: 'checkbox',
onChange: this.toggleRetroactive,
value: this.state.applyRetroactively,
id: 'apply-retroactive'
}), C.a.createElement('label', {
htmlFor: 'apply-retroactive',
className: 'spacing-left'
}, 'Also apply new reactions to ', C.a.createElement('strong', null, 'existing articles with reactions'), '. This overwrites all reactions people have made on existing articles. ', C.a.createElement('span', {
className: 'text-red'
}, 'All reaction counts will be set to 0, this cannot be reverted.'))), C.a.createElement('div', {
className: 'spacing-top align align--row-reverse'
}, C.a.createElement('button', {
className: 'button button-fill--brand button-medium',
onClick: this.onConfirm
}, 'Save new Reactions'))))
}
}
]) && FF(e.prototype, t),
n && FF(e, n),
o
}();
zF(Ru, 'propTypes', {
onConfirm: b.a.func.isRequired,
onClose: b.a.func.isRequired
});
var HF = Ru;
function GF(e) {
return (GF = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function VF(e) {
return function (e) {
if (Array.isArray(e)) return WF(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return WF(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? WF(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function WF(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function YF(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function QF(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? YF(Object(n), !0).forEach(function (e) {
eL(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : YF(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function KF(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function JF(e, t) {
return (JF = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function $F(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = XF(n);
return e = a ? (e = XF(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== GF(e) && 'function' != typeof e ? ZF(t) : e
}
}
function ZF(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function XF(e) {
return (XF = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function eL(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var tL = 0,
nL = 1,
aL = 100,
go = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && JF(e, t)
}(r, A);
var e,
t,
n,
a = $F(r);
function r() {
var o;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return eL(ZF(o = a.call.apply(a, [
this
].concat(t))), 'state', {
templateId: null,
prompt: null,
customImages: [
],
reactions: [
],
templateReactions: [
],
reactionsEnabled: !1,
reactionIndexImagesExpanded: - 1,
isPreviewVisible: !0,
previewSelection: null,
modalType: null,
validationError: null,
errorMessage: null,
savedFields: {
reactions: [
],
prompt: null
}
}),
eL(ZF(o), 'confirmNavigationIfUnsaved', function () {
if (o.hasUnsavedChanges()) return 'You have unsaved changes. Do you want to leave this page?'
}),
eL(ZF(o), 'handlePromptChange', function (e) {
o.setState({
prompt: e.target.value
})
}),
eL(ZF(o), 'resetDefaults', function (e) {
e.preventDefault();
e = o.props.defaultReactions.map(function (e) {
return QF(QF({
}, e), {
}, {
votes: Math.floor(Math.random() * aL)
})
});
o.setState({
prompt: Hq.DEFAULT_PROMPT,
validationError: null,
reactions: e
})
}),
eL(ZF(o), 'backfillReactionImages', function (e) {
var t = {
};
o.props.defaultReactions.forEach(function (e) {
t[e.text] = e.imageUrl
});
var n,
a,
r = [
];
return e.forEach(function (e) {
e.imageUrl || (t[e.text] ? (e.imageUrl = t[e.text], delete t[e.text]) : r.push(e))
}),
r.length && (n = Object.values(t), a = 0, r.forEach(function (e) {
e.imageUrl = n[a],
a += 1
})),
e
}),
eL(ZF(o), 'toggleImagesExpanded', function (t, e) {
e.preventDefault(),
o.setState(function (e) {
e = e.reactionIndexImagesExpanded !== t;
return e ? window.document.body.addEventListener('click', o.blurImagesDropdown) : window.document.body.removeEventListener('click', o.blurImagesDropdown),
{
reactionIndexImagesExpanded: e ? t : - 1
}
})
}),
eL(ZF(o), 'blurImagesDropdown', function (t) {
o.state.reactionIndexImagesExpanded < 0 || o.imageDropdownRefs && o.imageDropdownRefs.some(function (e) {
return e && e.contains(t.target)
}) || (window.document.body.removeEventListener('click', o.blurImagesDropdown), o.setState({
reactionIndexImagesExpanded: - 1
}))
}),
eL(ZF(o), 'handleImageSelection', function (n, a, r) {
o.setState(function (e) {
var t = {
reactions: [
].concat(VF(e.reactions.slice(0, n)), [
QF(QF({
}, e.reactions[n]), {
}, {
imageID: a,
imageUrl: r,
errs: QF(QF({
}, e.reactions[n].errs), {
}, {
imageUrl: null,
imageID: null
})
})
], VF(e.reactions.slice(n + 1)))
};
return t.validationError = o.props.validateReactions({
reactions: t.reactions,
existingErrs: e.validationError
}),
t
})
}),
eL(ZF(o), 'handleTextChange', function (n, a) {
Vq < a.target.value.length || (a.persist(), o.setState(function (e) {
var t = {
reactions: [
].concat(VF(e.reactions.slice(0, n)), [
QF(QF({
}, e.reactions[n]), {
}, {
text: a.target.value,
errs: QF(QF({
}, e.reactions[n].errs), {
}, {
text: null
})
})
], VF(e.reactions.slice(n + 1)))
};
return t.validationError = o.props.validateReactions({
reactions: t.reactions,
existingErrs: e.validationError
}),
t
}))
}),
eL(ZF(o), 'addReaction', function () {
var n = o.props.defaultReactions.find(function (t) {
return !o.state.reactions.some(function (e) {
return e.imageID === t.imageID || e.imageUrl === t.imageUrl
})
});
n && o.setState(function (e) {
var t = {
reactions: [
].concat(VF(e.reactions), [
{
text: '',
imageUrl: n.imageUrl,
imageID: n.imageID,
votes: 0
}
])
};
return t.validationError = o.props.validateReactions({
reactions: t.reactions,
existingErrs: e.validationError
}),
t
})
}),
eL(ZF(o), 'removeReaction', function (n) {
o.setState(function (e) {
var t = {
reactions: [
].concat(VF(e.reactions.slice(0, n)), VF(e.reactions.slice(n + 1)))
};
return t.validationError = o.props.validateReactions({
reactions: t.reactions,
existingErrs: e.validationError
}),
t
})
}),
eL(ZF(o), 'hasReactionChanged', function (e) {
return o.state.reactions[e] && !o.state.savedFields.reactions[e] || !o.state.reactions[e] && o.state.savedFields.reactions[e] || o.state.reactions[e] && o.state.savedFields.reactions[e] && (o.state.reactions[e].text !== o.state.savedFields.reactions[e].text || o.state.reactions[e].imageUrl !== o.state.savedFields.reactions[e].imageUrl || o.state.reactions[e].imageId !== o.state.savedFields.reactions[e].imageId)
}),
eL(ZF(o), 'hasFieldChanged', function (e) {
return 'reactions' === e ? o.state.savedFields.reactions.some(function (e, t) {
return o.hasReactionChanged(t)
}) : o.state[e] !== o.state.savedFields[e] && !(null === o.state.savedFields[e] && '' === o.state[e])
}),
eL(ZF(o), 'togglePreview', function () {
o.setState(function (e) {
return {
isPreviewVisible: !e.isPreviewVisible
}
})
}),
eL(ZF(o), 'selectPreviewReaction', function (a) {
o.setState(function (e) {
return {
reactions: e.reactions.map(function (e, t) {
var n = t === a,
t = e.votes;
return n && (t += 1),
e.isSelected && --t,
QF(QF({
}, e), {
}, {
isSelected: n,
votes: t
})
})
}
})
}),
eL(ZF(o), 'getUpdateTrackData', function () {
return {
verb: 'update',
object_type: 'forum',
object_id: o.props.selection.forum.id,
area: 'modal',
extra_data: {
reactionsEnabled: {
before: o.state.reactionsEnabled
},
template_id: {
before: o.state.templateId,
after: null
}
}
}
}),
eL(ZF(o), 'enableReactions', function () {
var e = o.getUpdateTrackData();
e.verb = 'enable',
o.props.setReactionsEnabled({
enabled: !0,
onSuccess: function () {
o.setState({
reactionsEnabled: !0
}),
e.extra_data.reactionsEnabled.after = !0,
e.extra_data.template_id.after = o.state.templateId,
e.extra_data = JSON.stringify(e.extra_data),
o.props.emitTrackingEvent(e)
},
onError: function () {
e.adverb = 'errored',
e.extra_data.reactionsEnabled.after = null,
e.extra_data.imagesEnabled.after = null,
e.extra_data.template_id.after = null,
e.extra_data = JSON.stringify(e.extra_data),
o.props.emitTrackingEvent(e)
}
})
}),
eL(ZF(o), 'hasUnsavedChanges', function () {
return Object.keys(o.state.savedFields).some(function (e) {
return o.hasFieldChanged(e)
})
}),
eL(ZF(o), 'saveReactions', function (e) {
var a,
t = e.saveConfirmed,
r = e.applyRetroactively;
o.setState({
errorMessage: null
}),
o.state.reactionsEnabled || !o.props.hadPreviousReactions || o.hasUnsavedChanges() ? (e = o.props.validateReactions({
reactions: o.state.reactions
}), o.setState({
validationError: e
}), e && e.length || (!o.props.hadPreviousReactions || t ? ((a = o.getUpdateTrackData()).verb = 'enable', o.setState({
modalType: null
}, function () {
var n = this;
this.props.saveReactions({
data: {
reactionsData: JSON.stringify(this.state.reactions.map(function (e) {
return {
text: e.text,
imageUrl: e.imageUrl,
imageID: e.imageID
}
})),
prompt: this.state.prompt.trim(),
applyRetroactively: r ? 1 : 0
},
onSuccess: function (e) {
var t = e.response.reactions[0].template;
n.setState(function (e) {
return {
reactionsEnabled: !0,
templateId: t,
templateReactions: e.reactions,
savedFields: {
reactions: e.reactions,
prompt: e.prompt
}
}
}),
a.extra_data.reactionsEnabled.after = !0,
a.extra_data.template_id.after = n.state.templateId,
a.extra_data = JSON.stringify(a.extra_data),
n.props.emitTrackingEvent(a)
},
onError: function (e) {
n.setState({
errorMessage: JSON.parse(e.responseText).response
}),
a.adverb = 'errored',
a.extra_data.reactionsEnabled.after = null,
a.extra_data.imagesEnabled.after = null,
a.extra_data.template_id.after = null,
a.extra_data = JSON.stringify(a.extra_data),
n.props.emitTrackingEvent(a)
}
})
})) : o.openModal(tL))) : o.enableReactions()
}),
eL(ZF(o), 'openModal', function (e) {
o.setState({
modalType: e
})
}),
eL(ZF(o), 'closeModal', function () {
o.setState({
modalType: null
})
}),
eL(ZF(o), 'handleDisable', function (e) {
var t;
e.disableConfirmed ? ((t = o.getUpdateTrackData()).verb = 'disable', o.setState({
modalType: null
}, function () {
var e = this;
this.props.setReactionsEnabled({
enabled: !1,
onSuccess: function () {
e.setState({
reactionsEnabled: !1,
modalType: null
}),
t.extra_data.reactionsEnabled.after = !1,
t.extra_data.imagesEnabled.after = !1,
t.extra_data = JSON.stringify(t.extra_data),
e.props.emitTrackingEvent(t)
},
onError: function () {
t.adverb = 'errored',
t.extra_data.reactionsEnabled.after = null,
t.extra_data.imagesEnabled.after = null,
t.extra_data = JSON.stringify(t.extra_data),
e.props.emitTrackingEvent(t)
}
})
})) : o.openModal(nL)
}),
eL(ZF(o), 'updateRemainingCustomImages', function (e) {
o.setState({
customImages: e
})
}),
eL(ZF(o), 'addNewCustomImages', function (t) {
o.setState(function (e) {
return {
customImages: [
].concat(VF(e.customImages), VF(t))
}
})
}),
eL(ZF(o), 'renderIconsForDropdownMenu', function (e, t, n) {
var a = {
};
o.state.reactions.forEach(function (e) {
a[e.imageID] = e.imageID !== t.imageID
});
e = e.filter(function (e) {
return e.imageID !== t.imageID && e.imageUrl !== t.imageUrl
});
return e.unshift(t),
e.map(function (e) {
return C.a.createElement('span', {
key: e.imageID,
className: ('image--dropdown__item' + (a[e.imageID] ? ' invalid' : '') + (e.imageUrl === t.imageUrl || e.imageID === t.imageID ? ' checked' : '')).trim()
}, C.a.createElement('img', {
src: e.imageUrl,
onClick: n === o.state.reactionIndexImagesExpanded ? o.handleImageSelection.bind(ZF(o), n, e.imageID, e.imageUrl) : null
}))
})
}),
o
}
return e = r,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.history.setRouteLeaveHook(this.props.route, this.confirmNavigationIfUnsaved),
window.onbeforeunload = this.confirmNavigationIfUnsaved,
this.props.fetchReactions(),
this.props.fetchForumDetails(),
this.props.fetchDefaultReactions(),
Bq.a.attachReactionsListener(this)
}
},
{
key: 'componentWillUnmount',
value: function () {
window.document.body.removeEventListener('click', this.blurImagesDropdown),
window.onbeforeunload = null,
Bq.a.detachReactionsListener(this)
}
},
{
key: 'componentDidUpdate',
value: function (e, t) {
this.state.reactions !== t.reactions && Bq.a.formatReactionsItems()
}
},
{
key: 'componentWillReceiveProps',
value: function (t) {
var n,
a;
this.props.isFetching && !t.isFetching && (n = (t.reactionsSynced.length ? t.reactionsSynced : t.defaultReactions).map(function (e) {
return QF(QF({
}, e), {
}, {
votes: Math.floor(Math.random() * aL)
})
}), a = t.includesImagesSynced ? n : this.backfillReactionImages(n.map(function (e) {
return QF({
}, e)
})), this.setState(function (e) {
return {
customImages: t.customImagesSynced.length ? t.customImagesSynced : e.customImages,
templateId: t.templateIdSynced,
prompt: t.promptSynced || Hq.DEFAULT_PROMPT,
reactionsEnabled: t.reactionsEnabledSynced,
templateReactions: a,
reactions: a,
savedFields: {
reactions: n,
prompt: t.promptSynced || Hq.DEFAULT_PROMPT
}
}
}), this.props.emitTrackingEvent({
verb: 'view',
object_type: 'zone',
object_id: 'reactions',
extra_data: JSON.stringify({
reactionsEnabled: t.reactionsEnabledSynced
})
}))
}
},
{
key: 'render',
value: function () {
var n = this;
if (this.props.selection.organization && this.props.selection.organization.pollsOnly) return C.a.createElement(Cm, {
isPolls: !1,
organization: this.props.selection.organization
});
var e,
t = !!(this.props.forumDetails && this.props.forumDetails.features && this.props.forumDetails.features.customReactions),
a = t ? this.state.customImages.concat(this.props.defaultReactions) : this.props.defaultReactions,
r = !t && yo.a.isFeatureActive('custom_reactions'),
o = this.state.validationError && this.state.validationError.length ? C.a.createElement('span', null, this.state.validationError.map(function (e, t) {
return C.a.createElement('span', {
key: t
}, e, C.a.createElement('br', null))
})) : this.props.error;
if (this.props.isFetching) return C.a.createElement(Ji, null);
switch (this.state.modalType) {
case tL:
e = C.a.createElement(HF, {
onConfirm: this.saveReactions,
onClose: this.closeModal
});
break;
case nL:
e = C.a.createElement(IF, {
onConfirm: this.handleDisable,
onClose: this.closeModal
})
}
return C.a.createElement('div', {
className: 'settings-reactions'
}, r ? C.a.createElement(ch, {
headline: 'Looking to make your Reactions more unique?',
promotionalPlan: 'Disqus Pro',
planDetailsUrl: 'https://about.disqus.com/pro',
upsellMessageLeft: 'Upgrade to',
upsellMessageRight: ' to access Custom Reactions, allowing even more creative freedom and customization to match your site.',
selection: this.props.selection,
emitTrackingEvent: this.props.emitTrackingEvent
}) : null, e, C.a.createElement(TF, {
images: this.state.customImages,
forum: this.props.selection.forum.shortname,
updateRemainingCustomImages: this.updateRemainingCustomImages,
addNewCustomImages: this.addNewCustomImages,
reactions: this.state.reactions,
templateReactions: this.state.templateReactions,
canEnableCustomReactions: t
}), C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Configure and enable Reactions'), C.a.createElement('p', {
className: 'text-gray'
}, 'Increase audience engagement beyond comments with Article Reactions. ', C.a.createElement('a', {
href: Pn.adminArticles,
target: '_blank',
rel: 'noopener noreferrer'
}, 'Learn more »'))), C.a.createElement('section', {
className: 'settings__content'
}, this.state.validationError && this.state.validationError.length || this.props.error ? C.a.createElement(Ki, {
message: this.state.errorMessage || o,
alertType: 'error'
}) : null, C.a.createElement($h, {
name: 'prompt',
value: this.state.prompt,
label: 'Prompt',
onChange: this.handlePromptChange,
idNamespace: this.constructor.displayName,
maxLength: 60,
showLimit: !0,
shouldHighlight: this.hasFieldChanged('prompt')
}), C.a.createElement(kf, {
label: 'Reactions',
blockAdditionalClass: 'text-medium',
shouldHighlight: this.state.savedFields.reactions.some(function (e, t) {
return n.hasReactionChanged(t)
})
}, C.a.createElement('div', {
className: 'spacing-top-small'
}, 'Define the set of reactions you would like your readers to be able to react with. You can also ', C.a.createElement('a', {
href: '#',
onClick: this.resetDefaults
}, 'Reset to Default Reactions.'), ' Need ideas? We also have a post for ', C.a.createElement('a', {
href: '//help.disqus.com/moderation/reactions',
rel: 'noopener noreferrer',
target: '_blank'
}, 'How to Use Reactions.')), C.a.createElement('div', {
className: 'spacing-top align align--middle reactions-list__header'
}, C.a.createElement('span', {
className: 'spacing-right'
}, 'Image'), C.a.createElement('span', null, 'Description')), C.a.createElement('div', {
className: 'spacing-top-small'
}, this.state.reactions.map(function (e, t) {
return C.a.createElement('div', {
key: t,
className: 'align align--middle spacing-top-small'.concat(n.hasReactionChanged(t) ? ' settings__highlighted' : '')
}, C.a.createElement('div', {
className: 'image--dropdown spacing-right',
onClick: n.toggleImagesExpanded.bind(n, t),
ref: function (e) {
n.imageDropdownRefs = n.imageDropdownRefs || [
],
n.imageDropdownRefs[t] = e
}
}, C.a.createElement('img', {
src: e.imageUrl,
className: 'template-reaction'
}), C.a.createElement('div', {
className: [
'image--dropdown__menu',
e.errs && (e.errs.imageID || e.errs.imageUrl) ? 'err' : '',
t === n.state.reactionIndexImagesExpanded ? 'expanded' : ''
].join(' ').trim()
}, t === n.state.reactionIndexImagesExpanded ? n.renderIconsForDropdownMenu(a, e, t) : null)), C.a.createElement('div', {
className: 'reactions__text-input-wrapper'
}, C.a.createElement('input', {
className: 'input--textbox'.concat(e.errs && e.errs.text ? ' err' : ''),
type: 'text',
value: e.text,
onChange: n.handleTextChange.bind(n, t)
}), C.a.createElement('span', {
className: 'reactions__char-count text-gray'
}, e.text.length, '/', Vq)), C.a.createElement('div', {
className: 'remove-button'
}, C.a.createElement('button', {
onClick: 1 < t ? n.removeReaction.bind(n, t) : function () {
},
className: [
'button button-outline spacing-left button-medium',
1 < t ? '' : 'invisible'
].join(' ')
}, 'Remove')))
})), C.a.createElement('div', {
className: 'spacing-top'
}, C.a.createElement('button', {
className: 'button button-fill--gray-light button-medium',
onClick: this.addReaction,
disabled: 6 <= this.state.reactions.length
}, '+ Add reaction'), C.a.createElement('div', {
className: 'text-gray text-small spacing-top-small'
}, 'You can have a maximum of 6 reactions. Do not select the same image more than once.'))), C.a.createElement('div', {
className: 'spacing-top-double'
}, C.a.createElement(Bh, {
buttonLabel: this.state.reactionsEnabled ? 'Save' : 'Enable Reactions on your site',
disabled: this.state.reactionsEnabled && !this.hasUnsavedChanges(),
isSaving: this.props.isSaving,
saveErr: !!this.props.error,
isSaved: this.props.isSaved,
onClick: this.saveReactions
}), C.a.createElement('div', {
className: 'fieldset fieldset--save spacing-top'
}, C.a.createElement('div', {
className: 'fieldset__label'
}), C.a.createElement('div', {
className: 'fieldset__block'
}, C.a.createElement('button', {
className: 'button button-fill button-medium',
onClick: this.togglePreview
}, this.state.isPreviewVisible ? 'Hide Preview' : 'Show Preview', C.a.createElement('span', {
className: 'spacing-left-small icon icon-arrow'
}))))), this.state.isPreviewVisible ? C.a.createElement('div', {
className: 'spacing-top-double reactions__preview'
}, C.a.createElement(zq.a, {
reactionsList: this.state.reactions,
prompt: this.state.prompt,
CDN_ROOT: '//c.disquscdn.com/next/current/publisher-admin',
onSubmitReaction: this.selectPreviewReaction
}), C.a.createElement('div', {
className: 'embed_preview'
}, C.a.createElement('img', {
className: 'email_preview__wide',
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/email_preview/logged_in_wide.png'
}), C.a.createElement('img', {
className: 'email_preview__narrow',
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/email_preview/logged_in_narrow.png'
}), C.a.createElement('img', {
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/email_preview/below.png'
}))) : null)), this.state.reactionsEnabled ? C.a.createElement('div', {
className: 'content__wrap'
}, C.a.createElement('header', {
className: 'settings__header settings-inline-section align align--between align--middle'
}, C.a.createElement('div', {
className: 'spacing-right-large'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Turn Reactions off'), C.a.createElement('p', {
className: 'text-gray'
}, 'The Reactions widget will be removed from all new and prior articles on your site.')), C.a.createElement('div', {
className: 'align__item--no-shrink'
}, C.a.createElement('button', {
className: 'button button-fill--red button-medium',
onClick: this.handleDisable
}, 'Turn Reactions off')))) : null)
}
}
]) && KF(e.prototype, t),
n && KF(e, n),
r
}();
eL(go, 'propTypes', {
selection: ht.isRequired,
forumDetails: $c,
fetchForumDetails: b.a.func.isRequired,
templateIdSynced: b.a.number,
reactionsSynced: b.a.arrayOf(r).isRequired,
defaultReactions: b.a.arrayOf(r).isRequired,
customImagesSynced: b.a.arrayOf(sl).isRequired,
promptSynced: b.a.string,
hadPreviousReactions: b.a.bool,
isFetching: b.a.bool,
isSaving: b.a.bool,
isSaved: b.a.bool,
error: b.a.string,
reactionsEnabledSynced: b.a.bool,
includesImagesSynced: b.a.bool,
validationError: b.a.string,
fetchReactions: b.a.func.isRequired,
fetchDefaultReactions: b.a.func.isRequired,
saveReactions: b.a.func.isRequired,
setReactionsEnabled: b.a.func.isRequired,
validateReactions: b.a.func.isRequired,
emitTrackingEvent: b.a.func.isRequired,
history: b.a.shape({
push: b.a.func.isRequired,
setRouteLeaveHook: b.a.func.isRequired
}).isRequired,
route: b.a.object
});
yl = Object(u.connect) (function (e) {
var t = e.reactions;
return QF(QF({
forumDetails: e.forumDetails.forumDetails,
selection: e.selection
}, t), {
}, {
templateIdSynced: t.templateId,
reactionsSynced: t.reactions,
defaultReactions: t.defaultReactions,
customImagesSynced: t.customImages,
promptSynced: t.prompt,
reactionsEnabledSynced: t.reactionsEnabled,
includesImagesSynced: t.includesImages
})
}, QF(QF({
fetchForumDetails: ig
}, Wi), {
}, {
emitTrackingEvent: Xo({
zone: 'reactions',
section: 'settings'
})
})) (Fo() (go));
function rL(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function oL(a) {
for (var e = 1; e < arguments.length; e++) {
var r = null != arguments[e] ? arguments[e] : {
};
e % 2 ? rL(Object(r), !0).forEach(function (e) {
var t,
n;
n = r[t = e],
t in (e = a) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(r)) : rL(Object(r)).forEach(function (e) {
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(r, e))
})
}
return a
}
Ru = {
toggleRecommendations: function (e) {
var n = e.forum,
a = e.data,
r = e.onSuccess,
o = e.onError;
return function (t) {
t({
type: he.enabling
}),
io.a.call('forums/update', {
type: 'POST',
data: oL({
forum: n
}, a),
success: function (e) {
t({
type: he.onEnable
}),
r(e)
},
error: function (e) {
t({
type: he.onEnableError,
message: 'An error occurred trying to '.concat(a.organicDiscoveryEnabled ? 'disable' : 'enable', ' Recommendations')
}),
o(e)
}
})
}
},
fetchSettings: function (e) {
return function (t) {
t({
type: he.fetching
}),
io.a.call('discovery/details', {
data: {
forum: e
},
success: function (e) {
t(oL({
type: he.onFetch
}, e.response))
},
error: function () {
t({
type: he.onFetchError,
message: 'An error occurred trying to fetch your Recommendations settings'
})
}
})
}
},
saveSettings: function (e) {
var n = e.data,
a = e.forum,
r = e.onSuccess,
o = e.onError;
return function (t) {
t({
type: he.saving
}),
io.a.call('discovery/update', {
type: 'POST',
data: {
forum: a,
contentPreview: n.contentPreview ? 1 : 0,
disableOverlay: n.disableOverlay ? 1 : 0,
maxAgeDays: n.maxAgeDays,
metaComments: n.metaComments ? 1 : 0,
metaDate: n.metaDate ? 1 : 0,
placement: n.placement,
titleHidden: n.titleHidden ? 1 : 0
},
success: function (e) {
t({
type: he.onSave
}),
r(e)
},
error: function (e) {
t({
type: he.onSaveError,
message: 'An error occurred trying to save your Recommendations settings'
}),
o(e)
}
})
}
}
};
function iL(e) {
return (iL = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function sL() {
return (sL = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function lL(e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}
function cL(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function uL(e, t, n) {
return t && cL(e.prototype, t),
n && cL(e, n),
e
}
function pL(e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && dL(e, t)
}
function dL(e, t) {
return (dL = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function mL(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = hL(n);
return e = a ? (e = hL(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== iL(e) && 'function' != typeof e ? fL(t) : e
}
}
function fL(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function hL(e) {
return (hL = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function gL(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
function yL(e) {
return C.a.createElement('div', {
className: 'content-preview-wrapper'
}, C.a.createElement('div', {
className: 'recommend-content'
}, e.settings.titleHidden || !e.settings.disableOverlay ? C.a.createElement('span', {
'data-role': 'recommend-description-snippet',
className: 'line-truncate',
'data-line-truncate': '5'
}, e.description) : C.a.createElement('h3', {
className: 'recommend-post-title',
title: e.title
}, C.a.createElement('span', {
'data-role': 'recommend-thread-title',
className: 'title line-truncate',
'data-line-truncate': 3,
'data-content': e.title,
dangerouslySetInnerHTML: {
__html: e.title
}
}))))
}
yL.propTypes = {
title: b.a.string.isRequired,
description: b.a.string.isRequired,
settings: b.a.shape({
titleHidden: b.a.bool.isRequired,
disableOverlay: b.a.bool.isRequired
}).isRequired
};
var bL = function () {
pL(a, A);
var n = mL(a);
function a(e) {
var t;
return lL(this, a),
gL(fL(t = n.call(this, e)), 'adjustMetaPlacement', function () {
var e;
t.title.current ? t.meta.current.style.bottom = e = ''.concat('' + (t.title.current.offsetHeight + 18), 'px') : e = '10px',
t.meta.current.style.bottom = e
}),
t.meta = C.a.createRef(),
t.title = C.a.createRef(),
t
}
return uL(a, [
{
key: 'componentDidMount',
value: function () {
this.adjustMetaPlacement()
}
},
{
key: 'componentDidUpdate',
value: function () {
this.adjustMetaPlacement()
}
},
{
key: 'render',
value: function () {
var e = this.props.settings;
return C.a.createElement('div', {
key: this.props.title,
className: 'recommend-post',
id: 'recommend-link',
'data-role': 'recommended-post',
'data-link': this.props.recommendationsLink
}, C.a.createElement('header', {
className: 'recommend-post-header'
}, C.a.createElement('div', {
className: 'recommend-image-wrapper'
}, C.a.createElement('img', {
src: this.props.images[0].url,
alt: this.props.title,
title: this.props.title
}), C.a.createElement('span', {
className: 'overlay'
})), e.disableOverlay ? null : C.a.createElement('h3', {
className: 'recommend-post-title',
title: this.props.title,
ref: this.title
}, C.a.createElement('span', {
'data-role': 'recommend-thread-title',
className: 'title line-truncate',
'data-line-truncate': 3,
'data-content': this.props.title,
dangerouslySetInnerHTML: {
__html: this.props.title
}
}))), C.a.createElement('ul', {
className: 'meta',
ref: this.meta
}, e.metaDate ? C.a.createElement('li', {
className: 'time'
}, this.props.createdAgo) : null, ' ', e.metaComments && 0 < this.props.posts ? C.a.createElement('li', {
className: 'comments'
}, 1 === this.props.posts ? '1 comment' : ''.concat(this.props.posts, ' comments'), ' ') : null), e.contentPreview ? C.a.createElement(yL, this.props) : null)
}
}
]),
a
}();
bL.propTypes = {
createdAgo: b.a.string.isRequired,
description: b.a.string.isRequired,
recommendationsLink: b.a.string.isRequired,
forumName: b.a.string.isRequired,
images: b.a.arrayOf(b.a.shape({
url: b.a.string.isRequired
})).isRequired,
posts: b.a.number.isRequired,
settings: b.a.shape({
contentPreview: b.a.bool.isRequired,
metaDate: b.a.bool.isRequired,
metaComments: b.a.bool.isRequired,
disableOverlay: b.a.bool.isRequired,
titleHidden: b.a.bool.isRequired
}).isRequired,
title: b.a.string.isRequired
};
var vL = function () {
pL(n, A);
var t = mL(n);
function n(e) {
var o;
return lL(this, n),
gL(fL(o = t.call(this, e)), 'clickScrollLeft', function () {
o.scroll( - 1)
}),
gL(fL(o), 'clickScrollRight', function () {
o.scroll(1)
}),
gL(fL(o), 'scroll', function (e) {
var t = vo() (o.wrapper.current),
n = vo() (o.postList.current).width() / o.postCount,
a = 2 * n,
r = 700;
t.width() < a && (a = n, r /= 2);
e = t.scrollLeft() + a * e;
t.animate({
scrollLeft: e
}, r)
}),
o.postCount = e.collection.length,
o.wrapper = C.a.createRef(),
o.postList = C.a.createRef(),
o
}
return uL(n, [
{
key: 'render',
value: function () {
var n = this,
e = this.props.settings,
t = e.contentPreview ? 'has-preview' : 'no-preview',
a = e.metaDate || e.metaComments ? '' : 'no-meta';
return C.a.createElement('div', {
className: 'recommend-main '.concat(t = e.titleHidden || !e.disableOverlay ? t : 'has-preview-title', ' ').concat(a)
}, C.a.createElement('section', {
className: 'col-organic'
}, C.a.createElement('header', {
className: 'recommend-col-header'
}, C.a.createElement('h2', null, 'Also on ', C.a.createElement('strong', null, 'The Disqus Blog'))), C.a.createElement('div', {
className: 'recommendation-container'
}, C.a.createElement('button', {
className: 'scroll-btn scroll-left',
'data-action': 'scroll-left',
onClick: function () {
return n.clickScrollLeft()
}
}, '❮'), C.a.createElement('div', {
className: 'recommend-wrapper',
ref: this.wrapper
}, C.a.createElement('div', {
className: 'recommend-posts',
'data-role': 'recommend-posts',
ref: this.postList
}, Object(De.map) (this.props.collection, function (e, t) {
return C.a.createElement(bL, sL({
key: t
}, Object(De.extend) (e, n.props)))
}))), C.a.createElement('button', {
className: 'scroll-btn scroll-right',
'data-action': 'scroll-right',
onClick: function () {
return n.clickScrollRight()
}
}, '❯'))))
}
}
]),
n
}();
function _L(e) {
return (_L = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function EL(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function OL(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? EL(Object(n), !0).forEach(function (e) {
CL(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : EL(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function SL(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function wL(e, t) {
return (wL = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function PL(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = NL(n);
return e = a ? (e = NL(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== _L(e) && 'function' != typeof e ? kL(t) : e
}
}
function kL(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function NL(e) {
return (NL = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function CL(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
vL.propTypes = {
collection: b.a.arrayOf(b.a.shape({
title: b.a.string.isRequired,
description: b.a.string.isRequired,
forumName: b.a.string.isRequired,
createdAgo: b.a.string.isRequired,
posts: b.a.number.isRequired
})).isRequired,
settings: b.a.shape({
contentPreview: b.a.bool.isRequired,
metaDate: b.a.bool.isRequired,
metaComments: b.a.bool.isRequired,
disableOverlay: b.a.bool.isRequired,
titleHidden: b.a.bool.isRequired
}).isRequired
};
r = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && wL(e, t)
}(o, A);
var e,
t,
n,
r = PL(o);
function o() {
var n;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) t[a] = arguments[a];
return CL(kL(n = r.call.apply(r, [
this
].concat(t))), 'state', OL(OL({
recommendationsEnabled: !!(n.props.forumDetails && n.props.forumDetails.features && n.props.forumDetails.features.recommendations)
}, rr), {
}, {
selectedLayout: 0,
isPreviewVisible: !0,
validationError: [
],
savedFields: rr
})),
CL(kL(n), 'confirmNavigationIfUnsaved', function () {
if (n.hasUnsavedChanges()) return 'You have unsaved changes. Do you want to leave this page?'
}),
CL(kL(n), 'hasUnsavedChanges', function () {
return Object.keys(n.state.savedFields).some(function (e) {
return n.hasFieldChanged(e)
})
}),
CL(kL(n), 'saveRecommendations', function () {
n.state.recommendationsEnabled ? n.hasUnsavedChanges() && n.setState(function () {
n.props.saveSettings({
forum: n.props.selection.forum.shortname,
data: {
contentPreview: n.state.contentPreview,
disableOverlay: n.state.disableOverlay,
maxAgeDays: n.state.maxAgeDays,
metaComments: n.state.metaComments,
metaDate: n.state.metaDate,
placement: n.state.placement,
titleHidden: n.state.titleHidden
},
onSuccess: function () {
n.setState(function (e) {
return {
validationError: [
],
savedFields: {
recommendationsEnabled: e.recommendationsEnabled,
contentPreview: e.contentPreview,
disableOverlay: e.disableOverlay,
maxAgeDays: e.maxAgeDays,
metaComments: e.metaComments,
metaDate: e.metaDate,
placement: e.placement,
selectedLayout: e.selectedLayout
}
}
})
},
onError: function (t) {
n.setState(function (e) {
return {
validationError: e.validationError.push(t)
}
})
}
})
}) : n.toggleRecommendationsEnabled()
}),
CL(kL(n), 'toggleRecommendationsEnabled', function () {
n.setState(function (t) {
n.props.toggleRecommendations({
forum: n.props.selection.forum.shortname,
data: {
organicDiscoveryEnabled: t.recommendationsEnabled ? 0 : 1
},
onSuccess: function () {
n.setState({
recommendationsEnabled: !t.recommendationsEnabled,
validationError: [
]
}),
t.recommendationsEnabled || n.saveRecommendations()
},
onError: function (e) {
n.setState({
validationError: t.validationError.push(e)
})
}
})
})
}),
CL(kL(n), 'handleCheckboxChange', function (e) {
n.setState(CL({
}, e.target.name, e.target.checked))
}),
CL(kL(n), 'resolveLayout', function (t) {
var e = or.filter(function (e) {
return t.disableOverlay === e.value.disableOverlay && t.titleHidden === e.value.titleHidden && t.contentPreview === e.value.contentPreview
});
return e.length ? e[0].key : - 1
}),
CL(kL(n), 'handleLayoutChange', function (e) {
e = parseInt(e.target.parentElement.getAttribute('index'), 10);
n.setState(OL({
selectedLayout: e
}, or[e].value))
}),
CL(kL(n), 'handleDateThresholdChange', function (e) {
n.setState({
maxAgeDays: parseInt(e.target.value, 10)
})
}),
CL(kL(n), 'handlePlacementChange', function (e) {
n.setState({
placement: e.target.value
})
}),
CL(kL(n), 'hasFieldChanged', function (e) {
return n.state[e] !== n.state.savedFields[e] && !(null === n.state.savedFields[e] && '' === n.state[e])
}),
CL(kL(n), 'togglePreview', function () {
n.setState(function (e) {
return {
isPreviewVisible: !e.isPreviewVisible
}
})
}),
CL(kL(n), 'recsOutsideAllowed', function () {
return yo.a.isFeatureActive('recs_outside_embed', {
forum: n.props.selection.forum.shortname
})
}),
CL(kL(n), 'filterPlacementOptions', function () {
return n.recsOutsideAllowed() ? ir : ir.filter(function (e) {
return 'standalone' !== e.key
})
}),
n
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
window.onbeforeunload = this.confirmNavigationIfUnsaved,
this.props.fetchSettings(this.props.selection.forum.shortname),
this.props.fetchForumDetails()
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
var t;
this.props.isFetching && !e.isFetching && (t = this.resolveLayout(e), this.setState({
recommendationsEnabled: e.recommendationsEnabledSynced,
contentPreview: e.contentPreviewSynced,
disableOverlay: e.disableOverlaySynced,
maxAgeDays: e.maxAgeDaysSynced,
metaComments: e.metaCommentsSynced,
metaDate: e.metaDateSynced,
placement: e.placementSynced,
selectedLayout: t,
titleHidden: e.titleHiddenSynced,
savedFields: {
recommendationsEnabled: e.recommendationsEnabledSynced,
contentPreview: e.contentPreviewSynced,
disableOverlay: e.disableOverlaySynced,
maxAgeDays: e.maxAgeDaysSynced,
metaComments: e.metaCommentsSynced,
metaDate: e.metaDateSynced,
placement: e.placementSynced,
selectedLayout: t
}
}))
}
},
{
key: 'render',
value: function () {
return this.props.selection.organization && this.props.selection.organization.pollsOnly ? C.a.createElement(Cm, {
isPolls: !1,
organization: this.props.selection.organization
}) : this.props.isFetching ? C.a.createElement(Ji, null) : (lr.settings = this.state, C.a.createElement('div', {
className: 'settings-recommendations'
}, this.recsOutsideAllowed() ? C.a.createElement(sh, {
type: 'info',
icon: 'info-badge',
headline: C.a.createElement(C.a.Fragment, null, C.a.createElement('span', {
className: 'dialog_box-tag',
style: {
background: '#5cb767'
}
}, 'BETA'), 'Looking to bring Recommendations outside the comments?'),
detailsUrl: Pn.standaloneRecommendations,
message: 'You can now display Recommendations as a standalone unit, anywhere on your site. Giving you the freedom to cultivate your audience and engage readers anywhere!',
buttonText: 'Get started now',
selection: this.props.selection
}) : null, C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Configure Recommendations'), C.a.createElement('p', {
className: 'text-gray'
}, 'Show links to discussions taking place on your site. ', C.a.createElement('a', {
href: Pn.recommendations,
target: '_blank',
rel: 'noopener noreferrer'
}, 'Learn more »'))), C.a.createElement('section', {
className: 'settings__content'
}, this.state.validationError && this.state.validationError.length || this.props.error ? C.a.createElement(Ki, {
message: this.state.validationError && this.state.validationError.length ? C.a.createElement('span', null, this.state.validationError.map(function (e, t) {
return C.a.createElement('span', {
key: t
}, e, C.a.createElement('br', null))
})) : this.props.error,
alertType: 'error'
}) : null, C.a.createElement('div', {
className: 'spacing-top'
}, C.a.createElement(qv, {
name: 'layout',
label: 'Layout',
idNamespace: 'recommendation-layout',
additionalClass: 'recommendation-layout-image',
options: or,
value: this.state.selectedLayout,
onChange: this.handleLayoutChange,
shouldHighlight: this.hasFieldChanged('selectedLayout')
})), C.a.createElement('div', {
className: 'spacing-top'
}, C.a.createElement(Ob, {
name: 'metaDate',
label: 'Meta Content',
secondaryLabel: 'Show Publish Date',
fieldsetAdditionalClass: 'fieldset__list',
checked: this.state.metaDate,
onChange: this.handleCheckboxChange,
shouldHighlight: this.hasFieldChanged('metaDate') || this.hasFieldChanged('metaComments')
}, C.a.createElement(Ob, {
name: 'metaComments',
secondaryLabel: 'Show Comment Count',
fieldsetAdditionalClass: 'fieldset__list',
checked: this.state.metaComments,
onChange: this.handleCheckboxChange,
ignoreFieldset: !0
}))), C.a.createElement('div', {
className: 'spacing-top'
}, C.a.createElement(Mf, {
name: 'dateThreshold',
idNamespace: 'date-threshold',
label: 'Date Threshold',
options: sr,
value: this.state.maxAgeDays,
onChange: this.handleDateThresholdChange,
readOnly: this.props.isSaving,
disabled: this.props.isSaving,
shouldHighlight: this.hasFieldChanged('maxAgeDays'),
tooltip: 'Set a limit for the recommended article selection.'
})), C.a.createElement('div', {
className: 'spacing-top'
}, C.a.createElement(Mf, {
name: 'placement',
idNamespace: 'placement',
label: 'Placement',
options: this.filterPlacementOptions(),
value: this.state.placement,
onChange: this.handlePlacementChange,
width: 180,
readOnly: this.props.isSaving,
disabled: this.props.isSaving,
shouldHighlight: this.hasFieldChanged('placement'),
tooltip: 'Specify whether recommendations will appear above or below the comment thread.'
})), C.a.createElement('div', {
className: 'spacing-top-double'
}, C.a.createElement(Bh, {
buttonLabel: this.state.recommendationsEnabled ? 'Save' : 'Enable Recommendations on your site',
disabled: this.state.recommendationsEnabled && !this.hasUnsavedChanges(),
isSaving: this.props.isSaving,
saveErr: !!this.props.error,
isSaved: this.props.isSaved,
onClick: this.saveRecommendations
}), C.a.createElement('div', {
className: 'fieldset fieldset--save spacing-top'
}, C.a.createElement('div', {
className: 'fieldset__label'
}), C.a.createElement('div', {
className: 'fieldset__block'
}, C.a.createElement('button', {
className: 'button button-fill button-medium',
onClick: this.togglePreview
}, this.state.isPreviewVisible ? 'Hide Preview' : 'Show Preview', C.a.createElement('span', {
className: 'spacing-left-small icon icon-arrow'
}))))), this.state.isPreviewVisible ? C.a.createElement('div', {
className: 'spacing-top-double preview_container'
}, C.a.createElement('div', {
className: 'preview-heading text-gray'
}, 'Desktop'), C.a.createElement(vL, lr)) : null, this.state.isPreviewVisible ? C.a.createElement('div', {
className: 'spacing-top-double preview_container recommendations-mobile-preview'
}, C.a.createElement('div', {
className: 'preview-heading text-gray'
}, 'Mobile'), C.a.createElement(vL, lr)) : null)), this.state.recommendationsEnabled ? C.a.createElement('div', {
className: 'content__wrap'
}, C.a.createElement('header', {
className: 'settings__header settings-inline-section align align--between align--middle'
}, C.a.createElement('div', {
className: 'spacing-right-large'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Turn Recommendations off'), C.a.createElement('p', {
className: 'text-gray'
}, 'The Recommendations widget will be removed from all articles on your site.')), C.a.createElement('div', {
className: 'align__item--no-shrink'
}, C.a.createElement('button', {
className: 'button button-fill--red button-medium',
onClick: this.toggleRecommendationsEnabled
}, 'Turn Recommendations off')))) : null))
}
}
]) && SL(e.prototype, t),
n && SL(e, n),
o
}();
CL(r, 'displayName', 'ForumSettingsRecommendations'),
CL(r, 'propTypes', {
selection: ht.isRequired,
recommendationsEnabledSynced: b.a.bool,
contentPreviewSynced: b.a.bool,
disableOverlaySynced: b.a.bool,
maxAgeDaysSynced: b.a.number,
metaCommentsSynced: b.a.bool,
metaDateSynced: b.a.bool,
placementSynced: b.a.string,
titleHiddenSynced: b.a.bool,
isFetching: b.a.bool,
isSaving: b.a.bool,
isSaved: b.a.bool,
error: b.a.string,
toggleRecommendations: b.a.func.isRequired,
fetchSettings: b.a.func.isRequired,
saveSettings: b.a.func.isRequired,
emitTrackingEvent: b.a.func.isRequired,
forumDetails: $c,
fetchForumDetails: b.a.func.isRequired
});
var sl = Object(u.connect) (function (e) {
var t = e.recommendations;
return OL(OL({
forumDetails: e.forumDetails.forumDetails,
selection: e.selection
}, t), {
}, {
recommendationsEnabledSynced: t.recommendationsEnabled,
contentPreviewSynced: t.contentPreview,
disableOverlaySynced: t.disableOverlay,
maxAgeDaysSynced: t.maxAgeDays,
metaCommentsSynced: t.metaComments,
metaDateSynced: t.metaDate,
placementSynced: t.placement,
titleHiddenSynced: t.titleHidden
})
}, OL(OL({
fetchForumDetails: ig
}, Ru), {
}, {
emitTrackingEvent: Xo({
zone: 'recommendations',
section: 'settings'
})
})) (Fo() (r)),
RL = n(177),
Wi = n(523),
xL = n.n(Wi);
function AL(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function DL(a) {
for (var e = 1; e < arguments.length; e++) {
var r = null != arguments[e] ? arguments[e] : {
};
e % 2 ? AL(Object(r), !0).forEach(function (e) {
var t,
n;
n = r[t = e],
t in (e = a) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(r)) : AL(Object(r)).forEach(function (e) {
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(r, e))
})
}
return a
}
go = {
fetchSettings: function (e) {
return function (t) {
t({
type: H.fetching
}),
io.a.call('forums/behindClick/details', {
data: {
forum: e
},
success: function (e) {
t(DL({
type: H.onFetch
}, e.response))
},
error: function () {
t({
type: H.onFetchError,
message: 'An error occurred trying to fetch your Behind a Click settings'
})
}
})
}
},
saveSettings: function (e) {
var n = e.data,
a = e.shortname,
r = e.onSuccess,
o = e.onError;
return function (t) {
t({
type: H.saving
}),
io.a.call('forums/behindClick/update', {
type: 'POST',
data: {
forum: a,
titleEnabled: n.titleEnabled ? 1 : 0,
titleText: n.titleText,
titleCSS: n.titleCSS,
buttonText: n.buttonText,
buttonCSS: n.buttonCSS
},
success: function (e) {
t({
type: H.onSave
}),
r(e)
},
error: function (e) {
t({
type: H.onSaveError,
message: 'An error occured trying to save your Behind a Click settings'
}),
o(e)
}
})
}
}
};
function jL(e) {
return (jL = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function TL(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function IL(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? TL(Object(n), !0).forEach(function (e) {
BL(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : TL(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function qL(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function FL(e, t) {
return (FL = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function LL(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = ML(n);
return e = a ? (e = ML(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== jL(e) && 'function' != typeof e ? UL(t) : e
}
}
function UL(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function ML(e) {
return (ML = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function BL(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Ru = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && FL(e, t)
}(o, A);
var e,
t,
n,
r = LL(o);
function o() {
var n;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) t[a] = arguments[a];
return BL(UL(n = r.call.apply(r, [
this
].concat(t))), 'state', {
titleEnabled: !1,
titleText: null,
titleCSS: null,
buttonText: null,
buttonCSS: null,
isPreviewVisible: !0,
isDirty: !1,
validationError: [
]
}),
BL(UL(n), 'confirmNavigationIfUnsaved', function () {
if (n.state.isDirty) return 'You have unsaved changes. Do you want to leave this page?'
}),
BL(UL(n), 'resetDefaults', function (e) {
e.preventDefault(),
n.setState({
buttonText: null,
buttonCSS: null,
isDirty: !0
})
}),
BL(UL(n), 'togglePreview', function () {
n.setState(function (e) {
return {
isPreviewVisible: !e.isPreviewVisible
}
})
}),
BL(UL(n), 'saveBehindClick', function () {
var e;
n.state.isDirty && (e = {
titleEnabled: n.state.titleEnabled,
titleText: n.state.titleText,
titleCSS: n.state.titleCSS,
buttonText: n.state.buttonText,
buttonCSS: n.state.buttonCSS
}, n.setState(function () {
n.props.saveSettings({
data: e,
shortname: n.props.selection.forum.shortname,
onSuccess: function () {
n.setState({
isDirty: !1,
validationError: [
]
})
},
onError: function (t) {
n.setState(function (e) {
return {
isDirty: !0,
validationError: e.validationError.push(t)
}
})
}
})
}))
}),
BL(UL(n), 'handleTitleEnabledChange', function (e) {
n.setState({
titleEnabled: 'true' === e.target.value,
isDirty: !0
})
}),
BL(UL(n), 'handleTitleTextChange', function (e) {
n.setState({
titleText: e.target.value,
isDirty: !0
})
}),
BL(UL(n), 'handleTitleCSSChange', function (e) {
n.setState({
titleCSS: e.target.value,
isDirty: !0
})
}),
BL(UL(n), 'handleButtonTextChange', function (e) {
n.setState({
buttonText: e.target.value,
isDirty: !0
})
}),
BL(UL(n), 'handleButtonCSSChange', function (e) {
n.setState({
buttonCSS: e.target.value,
isDirty: !0
})
}),
n
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
window.onbeforeunload = this.confirmNavigationIfUnsaved,
this.props.fetchSettings(this.props.selection.forum.shortname)
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
this.props.isFetching && !e.isFetching && this.setState({
titleEnabled: e.titleEnabledSynced || !1,
titleText: e.titleTextSynced,
titleCSS: e.titleCSSSynced,
buttonText: e.buttonTextSynced,
buttonCSS: e.buttonCSSSynced
})
}
},
{
key: 'render',
value: function () {
return this.props.isFetching ? C.a.createElement(Ji, null) : C.a.createElement('div', {
className: 'settings-behind-click'
}, C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Behind a Click Configuration'), C.a.createElement('p', {
className: 'text-gray'
}, 'Improve page-loading by placing your comment section behind a button.')), C.a.createElement('section', {
className: 'settings__content'
}, this.state.validationError && this.state.validationError.length || this.props.error ? C.a.createElement(Ki, {
message: this.state.validationError && this.state.validationError.length ? C.a.createElement('span', null, this.state.validationError.map(function (e, t) {
return C.a.createElement('span', {
key: t
}, e, C.a.createElement('br', null))
})) : this.props.error,
alertType: 'error'
}) : null, C.a.createElement(kf, {
label: 'Enable Title',
blockAdditionalClass: 'text-medium'
}, C.a.createElement('p', {
className: 'spacing-top-small'
}, C.a.createElement('label', null, C.a.createElement('input', {
type: 'radio',
name: 'enable-title',
value: !0,
checked: this.state.titleEnabled,
onChange: this.handleTitleEnabledChange
}), 'Yes')), C.a.createElement('p', {
className: 'spacing-top-small'
}, C.a.createElement('label', null, C.a.createElement('input', {
type: 'radio',
name: 'enable-title',
value: !1,
checked: !this.state.titleEnabled,
onChange: this.handleTitleEnabledChange
}), 'No'))), this.state.titleEnabled ? C.a.createElement('div', {
className: 'spacing-top'
}, C.a.createElement($h, {
name: 'title-text',
value: this.state.titleText,
label: 'Title',
onChange: this.handleTitleTextChange,
idNamespace: this.constructor.displayName
}, C.a.createElement('p', {
className: 'text-gray text-small spacing-top-small'
}, 'You can use {postCount} to display the current number of comments.')), C.a.createElement($h, {
name: 'button-css',
value: this.state.titleCSS,
label: 'CSS',
onChange: this.handleTitleCSSChange,
idNamespace: this.constructor.displayName,
useTextarea: !0,
rows: 5
})) : null, C.a.createElement(kf, {
label: 'Customize Button',
blockAdditionalClass: 'text-medium'
}, C.a.createElement('div', {
className: 'spacing-top-small'
}, 'The following options can be used to customize the appearance of the button that will be displayed on your site. You can also ', C.a.createElement('a', {
href: '#',
onClick: this.resetDefaults
}, 'Reset to Default.'))), C.a.createElement('div', {
className: 'spacing-top'
}, C.a.createElement($h, {
name: 'button-text',
value: this.state.buttonText,
label: 'Text',
placeholder: RL.DEFAULT_BUTTON_TEXT,
onChange: this.handleButtonTextChange,
idNamespace: this.constructor.displayName
}, C.a.createElement('p', {
className: 'text-gray text-small spacing-top-small'
}, 'You can use {postCount} to display the current number of comments.')), C.a.createElement($h, {
name: 'button-css',
value: this.state.buttonCSS,
label: 'CSS',
onChange: this.handleButtonCSSChange,
idNamespace: this.constructor.displayName,
useTextarea: !0,
rows: 5
})), C.a.createElement('div', {
className: 'spacing-top-double'
}, C.a.createElement(Bh, {
buttonLabel: 'Save',
disabled: !this.state.isDirty,
isSaving: this.props.isSaving,
saveErr: !!this.props.error,
isSaved: this.props.isSaved,
onClick: this.saveBehindClick
}), C.a.createElement('div', {
className: 'fieldset fieldset--save spacing-top'
}, C.a.createElement('div', {
className: 'fieldset__label'
}), C.a.createElement('div', {
className: 'fieldset__block'
}, C.a.createElement('button', {
className: 'button button-fill button-medium',
onClick: this.togglePreview
}, this.state.isPreviewVisible ? 'Hide Preview' : 'Show Preview', C.a.createElement('span', {
className: 'spacing-left-small icon icon-arrow'
}))))), this.state.isPreviewVisible ? C.a.createElement('div', {
className: 'spacing-top-double behindclick__preview'
}, C.a.createElement(xL.a, {
postCount: 1337,
buttonText: this.state.buttonText,
buttonCSS: this.state.buttonCSS,
titleEnabled: this.state.titleEnabled,
titleText: this.state.titleText,
titleCSS: this.state.titleCSS
})) : null)))
}
}
]) && qL(e.prototype, t),
n && qL(e, n),
o
}();
BL(Ru, 'displayName', 'ForumSettingsBehindClick'),
BL(Ru, 'propTypes', {
selection: ht.isRequired,
titleEnabledSynced: b.a.bool,
titleTextSynced: b.a.string,
titleCSSSynced: b.a.string,
buttonTextSynced: b.a.string,
buttonCSSSynced: b.a.string,
isFetching: b.a.bool,
isSaving: b.a.bool,
isSaved: b.a.bool,
error: b.a.string,
fetchSettings: b.a.func.isRequired,
saveSettings: b.a.func.isRequired,
route: b.a.object
});
r = Object(u.connect) (function (e) {
var t = e.selection,
e = e.behindClick;
return IL(IL({
}, e), {
}, {
titleEnabledSynced: e.titleEnabled,
titleTextSynced: e.titleText,
titleCSSSynced: e.titleCSS,
buttonTextSynced: e.buttonText,
buttonCSSSynced: e.buttonCSS,
selection: t
})
}, go) (Fo() (Ru));
function zL(e) {
return (zL = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function HL(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function GL(e, t) {
return (GL = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function VL(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = YL(n);
return e = a ? (e = YL(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== zL(e) && 'function' != typeof e ? WL(t) : e
}
}
function WL(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function YL(e) {
return (YL = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function QL(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Wi = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && GL(e, t)
}(o, A);
var e,
t,
n,
r = VL(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return QL(WL(t = r.call.apply(r, [
this
].concat(n))), 'handleChange', function (e) {
t.props.editWords(e.target.value)
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.fetchWords(this.props.selection.forum.shortname)
}
},
{
key: 'render',
value: function () {
return this.props.isFetching ? C.a.createElement(Ji, null) : C.a.createElement('div', null, C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Set the tone for discussions in your community.'), C.a.createElement('p', {
className: 'text-gray text-medium'
}, 'Automatically approve/reject specific phrases and users.', C.a.createElement('a', {
href: Pn.restrictedWordsHelp,
target: '_blank'
}, 'Learn more »'))), C.a.createElement('section', {
className: 'section-contained clearfix text-gray settings__content text-medium'
}, C.a.createElement($h, {
useTextarea: !0,
name: 'restricted-words',
label: C.a.createElement('div', null, C.a.createElement('h2', null, 'Restricted Words'), C.a.createElement('p', {
className: 'text-normal text-small'
}, 'Comments containing these words will require moderator approval before being published.')),
idNamespace: 'settings',
value: this.props.words,
inputOverrideClassName: 'input--textbox -taller',
onChange: this.handleChange
}, C.a.createElement('p', {
className: 'text-gray text-small spacing-top-small spacing-bottom-narrow'
}, 'Separate words with commas. You may use ', C.a.createElement('code', null, '.*'), ' (dot asterisk) as a wildcard, but be careful not to be too aggressive. For example, ', C.a.createElement('code', null, 's.*ck'), ' will match ', C.a.createElement('em', null, 'suck'), ', but also ', C.a.createElement('em', null, 'sock'), ' and ', C.a.createElement('em', null, 'stack'), '.'), C.a.createElement('p', {
className: 'text-gray text-small spacing-top-small spacing-bottom-narrow'
}, C.a.createElement('a', {
href: Pn.sampleBadwords,
target: '_blank'
}, 'Here is a sample list of restricted words.')))), C.a.createElement('footer', {
className: 'settings__footer'
}, C.a.createElement(Bh, {
onClick: this.props.updateWords.bind(this, this.props.selection.forum.shortname),
isSaving: this.props.isSaving,
isSaved: this.props.isSaved,
disabled: !this.props.wordsChanged
}), this.props.error ? C.a.createElement(Ki, {
message: this.props.error,
alertType: 'error',
onRequestClose: this.props.clearError
}) : null)))
}
}
]) && HL(e.prototype, t),
n && HL(e, n),
o
}();
QL(Wi, 'displayName', 'ForumSettingsRestrictedWords'),
QL(Wi, 'propTypes', {
selection: ht.isRequired,
fetchWords: b.a.func.isRequired,
editWords: b.a.func.isRequired,
updateWords: b.a.func.isRequired,
clearError: b.a.func.isRequired,
words: b.a.string.isRequired,
wordsChanged: b.a.bool.isRequired,
isSaved: b.a.bool.isRequired,
isSaving: b.a.bool.isRequired,
isFetching: b.a.bool.isRequired,
error: b.a.string
});
function KL(e) {
var t = vo.a.Deferred();
if (e.forum && e.entries) if (0 === e.entries.length) t.resolve();
else {
var n = e.checkErrors && e.checkErrors(e.entries);
if (!n) return io.a.call(e.endpoint, {
data: {
forum: e.forum,
word: e.entries
},
method: 'POST'
});
t.reject(n)
} else t.reject();
return t.promise()
}
go = {
fetch: function (e) {
return function (t) {
t({
type: ge.fetching
}),
io.a.call('blacklists/list', {
data: {
forum: e,
type: 'word',
limit: 0
},
success: function (e) {
t({
type: ge.update,
entries: e.response.map(function (e) {
return e.value
})
})
},
error: function () {
t({
type: ge.fetchFailed,
message: 'An unknown error occurred trying to fetch your restricted words.'
})
}
})
}
},
save: function (s) {
return function (t, e) {
var n = e().restrictedWords,
a = s,
e = n.wordArr,
r = e.reduce(function (e, t) {
return e[t] = !0,
e
}, {
}),
o = je.a.uniq(je.a.escape(n.words.trim()).split(/\s*,\s*/)),
i = o.reduce(function (e, t) {
return e[t] = !0,
e
}, {
}),
n = o.filter(function (e) {
return e && !r[e]
}),
e = e.filter(function (e) {
return e && !i[e]
});
t({
type: ge.saving
}),
KL({
forum: a,
entries: e,
endpoint: 'blacklists/remove'
}).then(function (e, t) {
return KL({
forum: e,
entries: t,
endpoint: 'blacklists/add',
checkErrors: function (e) {
for (var t = 0; t < e.length; t++) if (200 < e[t].length) return Error('Blacklist word '.concat(e[t], ' is too long. Only words of at most 200 characters can be added to the blacklist.'))
}
})
}.bind(void 0, a, n)).then(function () {
t({
type: ge.saved,
entries: o
})
}).fail(function (e) {
t({
type: ge.saveFailed,
message: (e.length ? e[0] : e).message || 'An unknown error occurred trying to save your restricted words.'
})
})
}
},
edit: function (e) {
return {
type: ge.edit,
words: e
}
},
clearError: function () {
return {
type: ge.clearError
}
}
};
function JL(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function $L(a) {
for (var e = 1; e < arguments.length; e++) {
var r = null != arguments[e] ? arguments[e] : {
};
e % 2 ? JL(Object(r), !0).forEach(function (e) {
var t,
n;
n = r[t = e],
t in (e = a) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(r)) : JL(Object(r)).forEach(function (e) {
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(r, e))
})
}
return a
}
function ZL(e, t) {
if (null == e) return {
};
var n,
a = function (e, t) {
if (null == e) return {
};
var n,
a,
r = {
},
o = Object.keys(e);
for (a = 0; a < o.length; a++) ~t.indexOf(n = o[a]) || (r[n] = e[n]);
return r
}(e, t);
if (Object.getOwnPropertySymbols) for (var r = Object.getOwnPropertySymbols(e), o = 0; o < r.length; o++) ~t.indexOf(n = r[o]) || Object.prototype.propertyIsEnumerable.call(e, n) && (a[n] = e[n]);
return a
}
Ru = Object(u.connect) (function (e) {
var t = e.restrictedWords,
t = ZL(t, [
'wordArr'
]),
e = e.selection;
return $L($L({
}, t), {
}, {
selection: e
})
}, {
fetchWords: go.fetch,
editWords: go.edit,
updateWords: go.save,
clearError: go.clearError
}) (Wi),
go = function () {
return C.a.createElement('div', {
className: 'layout__content'
}, C.a.createElement('div', {
className: 'box clearfix'
}, C.a.createElement('div', {
className: 'admin_content'
}, C.a.createElement('h1', null, '404'), C.a.createElement('p', null, 'Huh, this page is not available. Did you type the address correctly?'))))
};
function XL(e) {
return (XL = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function eU(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function tU(e, t) {
return (tU = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function nU(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = rU(n);
return e = a ? (e = rU(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== XL(e) && 'function' != typeof e ? aU(t) : e
}
}
function aU(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function rU(e) {
return (rU = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function oU(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var Wi = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && tU(e, t)
}(o, A);
var e,
t,
n,
r = nU(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return oU(aU(e = r.call.apply(r, [
this
].concat(n))), 'state', {
isOpen: !1
}),
oU(aU(e), 'handleClick', function () {
e.setState({
isOpen: !e.state.isOpen
})
}),
e
}
return e = o,
(t = [
{
key: 'render',
value: function () {
var e = Gc.test(window.location.pathname),
t = Vc.test(window.location.pathname),
n = this.state.isOpen ? 'nav__item dropdown-open' : 'nav__item';
return C.a.createElement('nav', {
className: 'layout__nav spacing-bottom'
}, C.a.createElement('div', {
className: 'nav--tablet-dropdown'
}, C.a.createElement(v.Link, {
className: n,
activeClassName: 'active',
to: ho.getRoute(Wc.LIST),
onClick: this.handleClick,
disabled: !this.props.organization.pollsActivationDate
}, C.a.createElement('div', {
className: 'nav-lnk -color-muted'
}, C.a.createElement('div', {
className: 'nav-lnk__blk'
}, C.a.createElement('span', {
className: 'button__text'
}, 'My Polls')), C.a.createElement('div', {
className: 'nav-lnk__pointer'
}, C.a.createElement('span', {
className: 'icon icon-right-bracket'
})))), C.a.createElement(v.Link, {
className: ''.concat(n).concat(e ? ' active' : ''),
to: ho.getRoute(Wc.EDITOR),
onClick: this.handleClick,
disabled: !this.props.organization.pollsActivationDate
}, C.a.createElement('div', {
className: 'nav-lnk -color-muted'
}, C.a.createElement('div', {
className: 'nav-lnk__blk'
}, C.a.createElement('span', {
className: 'button__text'
}, 'Editor')), C.a.createElement('div', {
className: 'nav-lnk__pointer'
}, C.a.createElement('span', {
className: 'icon icon-right-bracket'
})))), C.a.createElement(v.Link, {
className: ''.concat(n).concat(t ? ' active' : ''),
activeClassName: 'active',
to: ho.getRoute(Wc.INSIGHTS),
onClick: this.handleClick,
disabled: !this.props.organization.pollsActivationDate
}, C.a.createElement('div', {
className: 'nav-lnk -color-muted'
}, C.a.createElement('div', {
className: 'nav-lnk__blk'
}, C.a.createElement('span', {
className: 'button__text'
}, 'Analytics')), C.a.createElement('div', {
className: 'nav-lnk__pointer'
}, C.a.createElement('span', {
className: 'icon icon-right-bracket'
}))))))
}
}
]) && eU(e.prototype, t),
n && eU(e, n),
o
}(),
iU = Object(u.connect) (function (e) {
return {
organization: e.selection.organization
}
}) (Wi);
function sU(e, t) {
if (null == e) return {
};
var n,
a = function (e, t) {
if (null == e) return {
};
var n,
a,
r = {
},
o = Object.keys(e);
for (a = 0; a < o.length; a++) ~t.indexOf(n = o[a]) || (r[n] = e[n]);
return r
}(e, t);
if (Object.getOwnPropertySymbols) for (var r = Object.getOwnPropertySymbols(e), o = 0; o < r.length; o++) ~t.indexOf(n = r[o]) || Object.prototype.propertyIsEnumerable.call(e, n) && (a[n] = e[n]);
return a
}
Wi = function (e) {
var t = e.children,
e = sU(e, [
'children'
]);
return C.a.createElement('div', {
className: 'section-contained'
}, C.a.createElement('div', {
className: 'layout layout--stacked-tablet'
}, C.a.createElement('div', {
className: 'layout__main'
}, C.a.createElement(iU, null), C.a.createElement('div', {
className: 'layout__content'
}, C.a.cloneElement(t, e)))))
};
Wi.propTypes = {
children: b.a.element.isRequired
};
var lU = Fo() (Wi);
function cU(e) {
return (cU = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function uU(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function pU(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? uU(Object(n), !0).forEach(function (e) {
vU(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : uU(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function dU(e) {
return function (e) {
if (Array.isArray(e)) return mU(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return mU(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? mU(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function mU(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function fU(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function hU(e, t) {
return (hU = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function gU(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = bU(n);
return e = a ? (e = bU(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== cU(e) && 'function' != typeof e ? yU(t) : e
}
}
function yU(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function bU(e) {
return (bU = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function vU(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Wi = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && hU(e, t)
}(o, A);
var e,
t,
n,
a = gU(o);
function o() {
var r;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return vU(yU(r = a.call.apply(a, [
this
].concat(t))), 'inputRef', C.a.createRef()),
vU(yU(r), 'handleFocus', function () {
r.inputRef.current && r.inputRef.current.focus()
}),
vU(yU(r), 'handleAddAnswer', function (e) {
var t = {
answers: [
].concat(dU(r.props.questions[e].answers), [
{
text: ''
}
])
};
r.props.updateQuestion(e, t, r.handleFocus)
}),
vU(yU(r), 'handleUpdateAnswer', function (e, n, a) {
var t = r.props.questions[e],
t = t.answers && t.answers.map(function (e, t) {
return t === n ? pU(pU({
}, e), a) : e
});
r.props.updateQuestion(e, {
answers: t
})
}),
vU(yU(r), 'handleDeleteAnswer', function (e, n) {
var t = r.props.questions[e],
t = t && t.answers.filter(function (e, t) {
return t !== n
});
r.props.updateQuestion(e, {
answers: t
})
}),
r
}
return e = o,
(t = [
{
key: 'render',
value: function () {
var r = this;
return C.a.createElement('div', {
className: 'poll-creator__container'
}, C.a.createElement('header', {
className: 'polls__section-header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Poll Questions')), C.a.createElement('table', {
className: 'poll-creator__table'
}, C.a.createElement('colgroup', null, C.a.createElement('col', {
span: '1',
className: 'poll-creator__table-label-col'
}), C.a.createElement('col', {
span: '1',
className: 'poll-creator__table-input-col'
}), C.a.createElement('col', {
span: '1',
className: 'poll-creator__table-type-col'
})), C.a.createElement('tbody', null, this.props.questions.map(function (n, a) {
return C.a.createElement(C.a.Fragment, {
key: a
}, C.a.createElement('tr', {
className: 'poll-creator__table-row'
}, C.a.createElement('td', {
className: 'question-label-cell --mobile'
}, C.a.createElement('label', {
htmlFor: 'question-'.concat(a + 1),
className: 'fieldset__label text-gray'
}, 'Question ', a + 1))), C.a.createElement('tr', {
className: 'poll-creator__table-row'
}, C.a.createElement('td', {
className: 'question-type-cell --mobile'
}, C.a.createElement(Mf, {
name: 'question-type',
options: jc,
value: n.type,
onChange: function (e) {
return r.props.updateQuestion(a, {
type: e.target.value
})
},
idNamespace: r.constructor.displayName,
disabled: r.props.isSyncing || r.props.isPublished
}), !r.props.isPublished && C.a.createElement('button', {
className: 'delete-button'.concat(r.props.questions.length <= Cc.MIN_QUESTIONS ? ' --hidden' : '').concat(r.props.isSyncing ? ' -disabled' : ''),
onClick: function () {
return r.props.deleteQuestion(a)
},
disabled: r.props.isSyncing
}, C.a.createElement('span', {
className: 'icon-delete'
})))), C.a.createElement('tr', {
className: 'poll-creator__table-row'
}, C.a.createElement('td', {
className: 'question-label-cell --desktop'
}, C.a.createElement('label', {
htmlFor: 'question-'.concat(a + 1),
className: 'fieldset__label text-gray'
}, 'Question ', a + 1)), C.a.createElement('td', {
className: 'question-input-cell'
}, C.a.createElement($h, {
name: 'question-'.concat(a),
value: n.text,
placeholder: 'What\'s your question?',
labelAdditionalClass: 'hidden',
fieldsetAdditionalClass: 'spacing-top-none',
onChange: function (e) {
return r.props.updateQuestion(a, {
text: e.target.value
})
},
maxLength: Cc.MAX_QUESTION_LENGTH,
disabled: r.props.isSyncing || r.props.isPublished,
inputState: r.props.errors[a] && r.props.errors[a].text ? 'error' : 'none',
showLimit: Cc.MAX_QUESTION_LENGTH - 10 <= n.text.length,
spellCheck: !0
})), C.a.createElement('td', {
className: 'question-type-cell --desktop'
}, C.a.createElement(Mf, {
name: 'question-type',
options: jc,
value: n.type,
onChange: function (e) {
return r.props.updateQuestion(a, {
type: e.target.value
})
},
idNamespace: r.constructor.displayName,
disabled: r.props.isSyncing || r.props.isPublished
}), !r.props.isPublished && C.a.createElement('button', {
className: 'delete-button'.concat(r.props.questions.length <= Cc.MIN_QUESTIONS ? ' --hidden' : '').concat(r.props.isSyncing ? ' -disabled' : ''),
onClick: function () {
return r.props.deleteQuestion(a)
},
disabled: r.props.isSyncing
}, C.a.createElement('span', {
className: 'icon-delete'
})))), n.answers.map(function (e, t) {
return C.a.createElement('tr', {
className: 'poll-creator__table-row',
key: t
}, C.a.createElement('td', null), C.a.createElement('td', null, C.a.createElement('div', {
className: 'poll-creator__question-answer__container'
}, C.a.createElement($h, {
name: 'answer',
value: e.text,
placeholder: 'Answer '.concat(t + 1),
inputOverrideClassName: 'input--textbox poll-creator__answer-input',
fieldsetAdditionalClass: 'spacing-top-none',
onChange: function (e) {
return r.handleUpdateAnswer(a, t, {
text: e.target.value
})
},
maxLength: Cc.MAX_ANSWER_LENGTH,
inputRef: r.inputRef,
disabled: r.props.isSyncing || r.props.isPublished,
inputState: r.props.errors[a] && r.props.errors[a].answers && r.props.errors[a].answers.has(t) ? 'error' : 'none',
showLimit: Cc.MAX_ANSWER_LENGTH - 10 <= e.text.length,
spellCheck: !0
}), C.a.createElement('input', {
type: n.type === xc.MULTI ? 'checkbox' : 'radio',
className: 'poll-creator__answer-icon',
disabled: !0
}))), C.a.createElement('td', null, !r.props.isPublished && C.a.createElement('button', {
className: 'delete-button'.concat(n.answers.length <= Cc.MIN_ANSWERS ? ' --hidden' : '').concat(r.props.isSyncing ? ' -disabled' : ''),
onClick: function () {
return r.handleDeleteAnswer(a, t)
},
disabled: r.props.isSyncing
}, C.a.createElement('span', {
className: 'icon-delete'
}))))
}), r.props.questions[a].answers.length < Cc.MAX_ANSWERS && !r.props.isPublished ? C.a.createElement('tr', {
className: 'poll-creator__table-row'
}, C.a.createElement('td', null), C.a.createElement('td', null, C.a.createElement('div', {
className: 'poll-creator__question-answer__container'
}, C.a.createElement($h, {
name: 'answer',
placeholder: 'Add Answer',
fieldsetAdditionalClass: 'spacing-top-none',
onChange: function () {
return r.handleAddAnswer(a)
},
onClick: function () {
return r.handleAddAnswer(a)
},
disabled: r.props.isSyncing,
readOnly: !0
}))), C.a.createElement('td', null)) : null)
}), this.props.questions.length < Cc.MAX_QUESTIONS && !this.props.isPublished && C.a.createElement('tr', null, C.a.createElement('td', null), C.a.createElement('td', null, C.a.createElement('button', {
id: 'add-question-button',
className: 'poll-creator__add-question button button-fill--brand button-padding-wider button-medium',
onClick: this.props.addQuestion,
disabled: this.props.isSyncing
}, '+ Add another question')), C.a.createElement('td', null)))))
}
}
]) && fU(e.prototype, t),
n && fU(e, n),
o
}();
vU(Wi, 'displayName', 'PollQuestionsEditor'),
vU(Wi, 'propTypes', {
questions: b.a.arrayOf(Lc).isRequired,
updateQuestion: b.a.func.isRequired,
addQuestion: b.a.func.isRequired,
deleteQuestion: b.a.func.isRequired,
isSyncing: b.a.bool.isRequired,
isPublished: b.a.bool.isRequired,
errors: b.a.arrayOf(Mc)
});
var _U = Wi,
EU = function (e, t) {
return '\n\n')
};
function OU(e) {
return (OU = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function SU(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function wU(e, t) {
return (wU = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function PU(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = NU(n);
return e = a ? (e = NU(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== OU(e) && 'function' != typeof e ? kU(t) : e
}
}
function kU(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function NU(e) {
return (NU = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function CU(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Mc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && wU(e, t)
}(o, A);
var e,
t,
n,
r = PU(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return CU(kU(e = r.call.apply(r, [
this
].concat(n))), 'state', {
isOpen: !0,
isChecked: !1
}),
CU(kU(e), 'open', function () {
e.setState({
isOpen: !0
})
}),
CU(kU(e), 'close', function () {
e.setState({
isOpen: !1
}),
Is.a.set(Hc, e.state.isChecked),
e.props.handleShowPollTagInstructions(!1)
}),
CU(kU(e), 'handleCheck', function () {
e.setState(function (e) {
return {
isChecked: !e.isChecked
}
})
}),
e
}
return e = o,
(t = [
{
key: 'render',
value: function () {
return C.a.createElement('div', null, C.a.createElement(_.a, {
isOpen: this.state.isOpen,
onRequestClose: this.close,
'admin-modal': 'admin-modal',
portalClassName: 'ReactModalPortal --poll-tag-instructions'
}, C.a.createElement('div', {
className: 'modal-content'
}, C.a.createElement('div', {
className: 'modal-header'
}, C.a.createElement('h4', {
className: 'modal-title'
}, C.a.createElement('span', null, 'Disqus Poll Tag Installation'))), C.a.createElement('div', {
className: 'modal-body'
}, C.a.createElement('p', null, 'Your copied Disqus Poll Tags include a snippet of code that can be placed in your page source code. More specifically, placed in the page ', C.a.createElement('code', null, ''), ' ', C.a.createElement('span', {
className: 'hljs-emphasis'
}, '(ex. In-article, side rail)'), ' essentially wherever you want the poll to load.'), C.a.createElement('p', null, 'We recommend that you copy and paste the tags to your page source, save, and then preview the page to confirm desired poll placement prior to launching. Any modification of these tags may impact the functionality of the poll itself, including engagement metrics.'), C.a.createElement('p', null, 'For a more detailed guide on how to install Disqus Poll Tags, reference our ', C.a.createElement('a', {
href: 'https://help.disqus.com/en/',
target: '_blank',
rel: 'noopener noreferrer'
}, 'Help FAQ'), '.'), C.a.createElement(YE, {
language: 'html'
}, EU(this.props.forum, this.props.pollId || 'universal'))), C.a.createElement('div', {
className: 'modal-footer'
}, C.a.createElement(Ob, {
name: 'pollTagInstructionsCheckbox',
checked: this.state.isChecked,
secondaryLabel: 'Do not show this to me again',
onChange: this.handleCheck
}), C.a.createElement('button', {
type: 'button',
className: 'button button-link button-outline -border-blue-dark',
onClick: this.close
}, 'Close')))))
}
}
]) && SU(e.prototype, t),
n && SU(e, n),
o
}();
CU(Mc, 'displayName', 'PollTagInstructions');
var RU = Mc,
Wi = n(524);
function xU(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function AU(a) {
for (var e = 1; e < arguments.length; e++) {
var r = null != arguments[e] ? arguments[e] : {
};
e % 2 ? xU(Object(r), !0).forEach(function (e) {
var t,
n;
n = r[t = e],
t in (e = a) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(r)) : xU(Object(r)).forEach(function (e) {
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(r, e))
})
}
return a
}
var DU = new (n.n(Wi).a) ('previewed_polls_cache', 86400);
DU.getAll();
function jU(e) {
return ct.a.utc(e).local().format()
}
Mc = {
fetchPollDetails: function (t) {
return function (a, e) {
e = (e().selection.forum || {
}).shortname;
return a({
type: ce.isFetching
}),
io.a.call('polls/details', {
data: {
forum: e,
pollId: t
}
}).then(function (e) {
var t = jU(e.response.startDate),
n = jU(e.response.endDate),
n = AU(AU({
}, e.response), {
}, {
startDate: t,
endDate: n
});
a({
type: ce.onFetch,
response: n
})
})
}
},
save: function (n) {
return function (a, e) {
var t = n.id ? 'polls/update' : 'polls/create',
e = (e().selection.forum || {
}).shortname;
return a({
type: ce.isSyncing
}),
io.a.call(t, {
data: {
forum: e,
poll: JSON.stringify(n)
},
method: 'POST'
}).then(function (e) {
var t = jU(e.response.startDate),
n = jU(e.response.endDate),
n = AU(AU({
}, e.response), {
}, {
startDate: t,
endDate: n
});
return a({
type: ce.onSave,
response: n
}),
n
})
}
},
delete : function (n) {
return function (e, t) {
t = (t().selection.forum || {
}).shortname;
return e({
type: ce.isSyncing
}),
io.a.call('polls/delete', {
data: {
pollId: n,
forum: t
},
method: 'POST'
}).then(function () {
e({
type: ce.onDelete,
pollId: n
})
})
}
},
publish: function (n) {
return function (e, t) {
t = (t().selection.forum || {
}).shortname;
return e({
type: ce.isSyncing
}),
io.a.call('polls/publish', {
data: {
pollId: n,
forum: t
},
method: 'POST'
}).then(function () {
e({
type: ce.onPublish,
pollId: n
})
})
}
},
preview: function (r) {
return function (n, e) {
var t,
a = (e().selection.forum || {
}).shortname;
return n({
type: ce.isSyncing
}),
(e = DU.getItem((t = r).id) || DU.getItem(zc)) && JSON.stringify(e.lastPreviewedPollState.questions) === JSON.stringify(t.questions) && e.lastPreviewedPollState.name === t.name && e.lastPreviewedPollState.id === t.id ? Promise.resolve({
previewId: DU.getItem(r.id || zc).previewId
}).then(function (e) {
return n({
type: ce.onPreview
}),
e
}) : io.a.call('polls/preview', {
data: {
forum: a,
poll: JSON.stringify(r)
},
method: 'POST'
}).then(function (e) {
var t = e.response;
return DU.setItem((e = r).id || zc, {
lastPreviewedPollState: e,
previewId: t.previewId
}),
n({
type: ce.onPreview
}),
t
})
}
},
resetSyncedPoll: function () {
return function (e) {
e({
type: ce.reset
})
}
}
};
function TU(e) {
return (TU = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function IU(e) {
return function (e) {
if (Array.isArray(e)) return qU(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return qU(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? qU(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function qU(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function FU(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function LU(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? FU(Object(n), !0).forEach(function (e) {
GU(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : FU(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function UU(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function MU(e, t) {
return (MU = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function BU(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = HU(n);
return e = a ? (e = HU(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== TU(e) && 'function' != typeof e ? zU(t) : e
}
}
function zU(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function HU(e) {
return (HU = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function GU(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var VU = 'error_',
WU = 'success_',
Wi = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && MU(e, t)
}(r, A);
var e,
t,
n,
a = BU(r);
function r() {
var o;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return GU(zU(o = a.call.apply(a, [
this
].concat(t))), 'state', {
hasChanges: !1,
hasCopied: !1,
pollHasChanged: !1,
id: null,
name: '',
startDate: ct() ().startOf('day'),
endDate: ct() ().add(1, 'week').endOf('day'),
nonUniversal: !1,
published: !1,
requireAuth: !1,
voteInterval: null,
questions: [
{
text: '',
type: Ac,
answers: [
{
text: ''
},
{
text: ''
}
]
}
],
errors: {
pollName: !1,
questions: [
]
},
showPollTagInstructions: !1
}),
GU(zU(o), 'syncPollState', function () {
o.setState(LU(LU({
}, o.props.syncedPoll), {
}, {
startDate: ct() (o.props.syncedPoll.startDate),
endDate: ct() (o.props.syncedPoll.endDate),
hasChanges: !1,
pollHasChanged: !0
})),
o.props.history.push(ho.getRoute('/polls/editor/'.concat(o.props.syncedPoll.id)))
}),
GU(zU(o), 'resetPollState', function () {
o.setState({
hasChanges: !1,
hasCopied: !1,
pollHasChanged: !1,
id: null,
name: '',
startDate: ct() ().startOf('day'),
endDate: ct() ().add(1, 'week').endOf('day'),
published: !1,
requireAuth: !1,
voteInterval: null,
questions: [
{
text: '',
type: Ac,
answers: [
{
text: ''
},
{
text: ''
}
]
}
]
})
}),
GU(zU(o), 'handleDateChange', function (e, t) {
o.setState({
startDate: e.startOf('day'),
endDate: t.endOf('day'),
hasChanges: !0
})
}),
GU(zU(o), 'handleInputChange', function (e, t) {
var n = (GU(n = {
}, e, 'checkbox' === t.target.type ? t.target.checked : t.target.value), GU(n, VU + e, null), GU(n, WU + e, null), GU(n, 'hasChanges', !0), n);
o.setState(n)
}),
GU(zU(o), 'handleVoteIntervalToggle', function (e) {
o.setState({
voteInterval: e.target.checked ? Ic : null,
hasChanges: !0
})
}),
GU(zU(o), 'handleUpdateQuestion', function (n, a, e) {
var t = o.state.questions.map(function (e, t) {
return t === n ? LU(LU({
}, e), a) : e
});
o.setState({
questions: t,
hasChanges: !0
}, e)
}),
GU(zU(o), 'handleAddQuestion', function () {
var e = {
text: '',
type: Ac,
answers: [
{
text: ''
},
{
text: ''
}
]
},
e = [
].concat(IU(o.state.questions), [
e
]);
o.setState({
questions: e,
hasChanges: !0
})
}),
GU(zU(o), 'handleDeleteQuestion', function (n) {
var e = o.state.questions.filter(function (e, t) {
return t !== n
});
o.setState({
questions: e,
hasChanges: !0
})
}),
GU(zU(o), 'validateEntries', function () {
var a = {
pollName: !1,
questions: [
]
},
r = !0;
return o.state.name || (r = !(a.pollName = !0)),
o.state.questions.forEach(function (e, t) {
var n = {
text: !1,
answers: new Set
};
e.text || (r = !(n.text = !0)),
e.answers.forEach(function (e, t) {
e.text || (n.answers.add(t), r = !1)
}),
(n.text || 0 < n.answers.size) && (a.questions[t] = n)
}),
o.setState({
errors: a
}),
r
}),
GU(zU(o), 'handleSave', function () {
o.validateEntries() && o.props.save({
id: o.state.id,
name: o.state.name,
startDate: o.state.startDate,
endDate: o.state.endDate,
published: o.state.published,
requireAuth: o.state.requireAuth,
voteInterval: o.state.voteInterval,
questions: o.state.questions,
nonUniversal: o.state.nonUniversal
}).then(o.syncPollState.bind(zU(o)))
}),
GU(zU(o), 'handlePublish', function () {
o.props.publish(o.state.id).then(function () {
o.setState({
published: !0
});
var e = o.props.selection.organization && o.props.selection.organization.id || o.props.selection.forum && o.props.selection.forum.organization;
!bc.hasSeenPublishedPoll && e && o.state.id && (o.props.onSegmentCall('group', '' + e, {
pollId: o.state.id
}), bc.hasSeenPublishedPoll = !0)
})
}),
GU(zU(o), 'previewPoll', function () {
o.validateEntries() && o.props.preview({
id: o.state.id,
name: o.state.name,
startDate: o.state.startDate,
endDate: o.state.endDate,
published: o.state.published,
requireAuth: o.state.requireAuth,
voteInterval: o.state.voteInterval,
questions: o.state.questions
}).then(function (e) {
o.showPreview(e.previewId)
})
}),
GU(zU(o), 'showPreview', function (e) {
e && window.open(Bc + e, '_blank')
}),
GU(zU(o), 'handleShowPollTagInstructions', function () {
o.setState({
showPollTagInstructions: !o.state.showPollTagInstructions
})
}),
GU(zU(o), 'handleCopyTags', function () {
var e = EU(o.props.selection && o.props.selection.forum && o.props.selection.forum.shortname, o.state.id);
Object(Dl.copyToClipboard) (e),
o.setState({
hasCopied: !0,
showPollTagInstructions: !Is.a.get(Hc)
}),
setTimeout(function () {
o.setState({
hasCopied: !1
})
}, 2000)
}),
GU(zU(o), 'handleDeletePoll', function () {
window.confirm('Are you sure you want to delete this poll?') && o.props.delete(o.state.id).then(o.props.history.push(ho.getRoute('/polls/list/')))
}),
GU(zU(o), 'confirmNavigationIfUnsaved', function () {
if (o.state.hasChanges) return 'Are you sure you want to leave without saving changes?'
}),
o
}
return e = r,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.pollsOrgCurrentPackage || this.props.fetchSubscription(),
this.props.history.setRouteLeaveHook(this.props.route, this.confirmNavigationIfUnsaved),
this.props.resetSyncedPoll(),
this.props.params && this.props.params.pollId && this.props.fetchPollDetails(this.props.params.pollId).then(this.syncPollState.bind(this))
}
},
{
key: 'componentDidUpdate',
value: function (e) {
e.location.pathname !== this.props.location.pathname && '/polls/editor/new/' === this.props.location.pathname && this.state.pollHasChanged && (this.props.resetSyncedPoll(), this.resetPollState())
}
},
{
key: 'render',
value: function () {
var t = this,
e = this.props.selection.organization && this.props.selection.organization.pollsActivationDate,
n = this.props.selection.organization && Ur.SAAS_PRODUCT_PLAN_ACTIVE_STATUSES_SET.has(this.props.selection.organization.pollsSubscriptionStatus);
return e ? this.props.isFetching ? C.a.createElement(Ji, null) : n ? (n = this.state.id && this.state.published ? 'Published' : this.state.id ? 'Draft' : 'Pending', C.a.createElement('div', {
className: 'polls__wrapper polls-editor__container'
}, this.state.showPollTagInstructions && C.a.createElement(RU, {
handleShowPollTagInstructions: this.handleShowPollTagInstructions,
forum: this.props.selection && this.props.selection.forum && this.props.selection.forum.shortname,
pollId: this.state.id
}), C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'polls__section-header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Create a new poll')), C.a.createElement('section', {
className: 'polls-editor__content'
}, C.a.createElement($h, {
name: 'name',
value: this.state.name,
placeholder: 'Example: Opinions on Star Wars Characters',
label: 'Give the poll a name',
onChange: function (e) {
return t.handleInputChange('name', e)
},
tooltip: 'Your poll\'s name will not be visible to participants.',
disabled: this.props.isSyncing,
inputState: this.state.errors.pollName ? 'error' : 'none',
maxLength: Cc.MAX_POLL_NAME_LENGTH,
showLimit: Cc.MAX_POLL_NAME_LENGTH / 2 <= this.state.name.length,
spellCheck: !0,
childIsInput: !0
}), C.a.createElement('div', {
className: 'fieldset'
}, C.a.createElement('label', {
className: 'fieldset__label text-gray'
}, 'Start and end date'), C.a.createElement(Zp, {
key: this.state.startDate,
dateWrapperClass: 'polls-editor__datepicker select__control',
minDate: ct.a.min(ct() ().startOf('day'), this.state.startDate),
maxDate: this.state.startDate.clone().add(90, 'days'),
startDate: this.state.startDate,
endDate: this.state.endDate,
onDateChange: this.handleDateChange,
persistLocalTime: !0
})), C.a.createElement('div', {
className: 'fieldset'
}, C.a.createElement('label', {
className: 'fieldset__label text-gray'
}, 'Status'), C.a.createElement('span', {
className: 'label status-label '.concat(this.state.published ? ' status-label__success' : '')
}, n)), C.a.createElement(Ob, {
name: 'requireAuth',
checked: !!this.state.requireAuth,
secondaryLabel: 'Require login to submit response',
onChange: function (e) {
return t.handleInputChange('requireAuth', e)
},
idNamespace: this.constructor.displayName,
readOnly: this.props.isSyncing
}), C.a.createElement(Ob, {
name: 'voteIntervalCheckbox',
checked: !!this.state.voteInterval,
secondaryLabel: this.state.voteInterval ? C.a.createElement('span', null, 'Allow user to take poll again after ', C.a.createElement(Mf, {
name: 'voteInterval',
options: Tc,
value: this.state.voteInterval,
onChange: function (e) {
return t.handleInputChange('voteInterval', e)
},
idNamespace: this.constructor.displayName,
disabled: this.props.isSyncing,
inline: !0
})) : 'Allow user to take poll again',
onChange: this.handleVoteIntervalToggle,
idNamespace: this.constructor.displayName,
readOnly: this.props.isSyncing,
fieldsetAdditionalClass: 'polls-editor__vote-interval-checkbox'
}), C.a.createElement(Ob, {
name: 'excludeFromUniversalCheckbox',
checked: !!this.state.nonUniversal,
secondaryLabel: 'Exclude from Universal Tag',
onChange: function (e) {
return t.handleInputChange('nonUniversal', e)
},
idNamespace: this.constructor.displayName,
disabled: this.props.isSyncing
})), C.a.createElement(_U, {
questions: this.state.questions,
addQuestion: this.handleAddQuestion,
updateQuestion: this.handleUpdateQuestion,
deleteQuestion: this.handleDeleteQuestion,
isSyncing: this.props.isSyncing,
isPublished: this.state.published,
errors: this.state.errors.questions
}), C.a.createElement('p', {
className: 'text-medium text-error text-semibold polls-editor__error'.concat(this.state.errors.pollName || 0 < this.state.errors.questions.length ? '' : ' --placeholder')
}, 'Error: All text input fields must have an entry before saving or previewing.'), C.a.createElement('footer', {
className: 'polls-editor__footer align align--between'
}, C.a.createElement('div', {
className: 'polls-editor__footer-button__container-left align'
}, C.a.createElement('button', {
className: 'button button-fill--brand button-padding-wider button-medium',
onClick: this.handleSave,
disabled: this.props.isSyncing || !this.state.hasChanges
}, 'Save'), this.state.published ? C.a.createElement('button', {
className: 'button button-fill--brand button-padding-wider button-medium polls__copy-tags',
onClick: this.handleCopyTags
}, 'Tags', this.state.hasCopied && C.a.createElement('span', {
className: 'polls__copy-tags-success'
}, 'Copied to clipboard')) : C.a.createElement('button', {
className: 'button button-fill--brand button-padding-wider button-medium',
onClick: this.handlePublish,
disabled: this.props.isSyncing || !this.state.id || this.state.hasChanges
}, 'Publish'), C.a.createElement('button', {
className: 'button button-fill button-padding-wider button-medium',
onClick: this.previewPoll
}, 'Preview')), C.a.createElement('div', {
className: 'polls-editor__footer-button__container-right'
}, this.state.id && !this.state.published && C.a.createElement('button', {
className: 'button button-outline -border-gray button-medium nav-lnk',
onClick: this.handleDeletePoll
}, C.a.createElement('div', {
className: 'nav-lnk__blk'
}, C.a.createElement('span', {
className: 'button__text'
}, 'Delete'))), C.a.createElement(v.Link, {
activeClassName: 'active',
to: ho.getRoute('/polls/list/')
}, C.a.createElement('div', {
className: 'button button-outline -border-blue-dark button-medium nav-lnk'
}, C.a.createElement('div', {
className: 'nav-lnk__blk'
}, C.a.createElement('span', {
className: 'button__text'
}, 'Cancel'))))))))) : C.a.createElement(Mk, {
organization: this.props.organization
}) : C.a.createElement(Cm, {
isPolls: !0,
organization: this.props.selection.organization
})
}
}
]) && UU(e.prototype, t),
n && UU(e, n),
r
}();
GU(Wi, 'displayName', 'PollsEditor'),
GU(Wi, 'propTypes', {
params: b.a.shape({
pollId: b.a.string
}),
history: b.a.shape({
push: b.a.func.isRequired
}).isRequired,
onSegmentCall: b.a.func.isRequired,
syncedPoll: Uc,
isSyncing: b.a.bool.isRequired,
isFetching: b.a.bool.isRequired,
selection: ht,
fetchPollDetails: b.a.func.isRequired,
save: b.a.func.isRequired,
delete : b.a.func.isRequired,
publish: b.a.func.isRequired,
preview: b.a.func.isRequired
});
var YU = Object(u.connect) (function (e) {
var t = e.pollsEditor;
return {
syncedPoll: t.poll,
isSyncing: t.isSyncing,
isFetching: t.isFetching,
selection: e.selection,
pollsOrgCurrentPackage: e.subscription.pollsOrgCurrentPackage
}
}, {
fetchPollDetails: Mc.fetchPollDetails,
save: Mc.save,
delete : Mc.delete,
publish: Mc.publish,
resetSyncedPoll: Mc.resetSyncedPoll,
preview: Mc.preview,
fetchSubscription: Hl
}) (Ni.a.attachDrivers(Wi, [
bc
]));
function QU(e) {
return (QU = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function KU(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function JU(e, t) {
return (JU = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function $U(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = XU(n);
return e = a ? (e = XU(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== QU(e) && 'function' != typeof e ? ZU(t) : e
}
}
function ZU(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function XU(e) {
return (XU = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function eM(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Mc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && JU(e, t)
}(o, A);
var e,
t,
n,
r = $U(o);
function o() {
var e;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var t = arguments.length, n = Array(t), a = 0; a < t; a++) n[a] = arguments[a];
return eM(ZU(e = r.call.apply(r, [
this
].concat(n))), 'handleBackToPollsList', function () {
e.props.fetchPolls()
}),
e
}
return e = o,
(t = [
{
key: 'render',
value: function () {
return this.props.noPollData ? C.a.createElement('div', {
className: 'no-polls__container align align--column align--middle align--center'
}, C.a.createElement('span', {
className: 'no_poll_data__img'
}), C.a.createElement('div', {
className: 'no-polls__prompt'
}, 'No poll data available (...yet)')) : C.a.createElement('div', {
className: 'no-polls__container align align--column align--middle align--center'
}, C.a.createElement('span', {
className: 'no-polls__img'
}), this.props.noSearchResults ? C.a.createElement(C.a.Fragment, null, C.a.createElement('div', null, 'No poll names containing ', C.a.createElement('strong', null, this.props.query), ' found belonging to shortname ', C.a.createElement('strong', null, this.props.forum), '.'), C.a.createElement('div', null, 'Refine your search and try again!'), C.a.createElement('button', {
className: 'button button-fill--brand button-padding-wider text-medium',
onClick: this.handleBackToPollsList
}, C.a.createElement('div', {
className: 'nav-lnk'
}, C.a.createElement('div', {
className: 'nav-lnk__blk'
}, C.a.createElement('span', {
className: 'button__text'
}, 'Back to Polls List'))))) : C.a.createElement(C.a.Fragment, null, C.a.createElement('div', {
className: 'no-polls__prompt'
}, 'You don\'t have any polls yet. Click below to begin!'), C.a.createElement(v.Link, {
className: 'button button-fill--brand button-padding-wider text-medium',
activeClassName: 'active',
to: ho.getRoute('/polls/editor/new/')
}, C.a.createElement('div', {
className: 'nav-lnk'
}, C.a.createElement('div', {
className: 'nav-lnk__blk'
}, C.a.createElement('span', {
className: 'button__text'
}, '+ Poll'))))))
}
}
]) && KU(e.prototype, t),
n && KU(e, n),
o
}();
eM(Mc, 'displayName', 'NoPolls'),
eM(Mc, 'propTypes', {
noSearchResults: b.a.bool,
fetchPolls: b.a.func,
query: b.a.string,
forum: b.a.string,
noPollData: b.a.bool
});
var tM = Mc,
Wi = {
updateSearchQuery: function (e) {
return {
type: ue.updateSearchQuery,
searchQuery: e
}
},
fetchPolls: function () {
var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {
limit: 10
},
r = e.limit,
o = e.query;
return function (t, e) {
var n = e().pollsList,
a = (o = 'string' != typeof o ? n.searchQuery : o) === n.searchQuery,
e = (e().selection.forum || {
}).shortname;
return t({
type: ue.isFetching
}),
io.a.call('polls/list', {
data: {
forum: e,
query: o,
limit: r,
cursor: a ? n.cursor.next : void 0
}
}).then(function (e) {
t({
type: ue.onFetch,
response: e.response,
cursor: e.cursor,
query: o,
shouldAppend: a
})
})
}
},
delete : function (n) {
return function (e, t) {
return io.a.call('polls/delete', {
data: {
pollId: n,
forum: (t().selection.forum || {
}).shortname
},
method: 'POST'
}).then(function () {
e({
type: ue.onDelete,
pollId: n
})
})
}
},
resetList: function () {
return function (e) {
e({
type: ue.reset
})
}
},
previewPoll: function (n) {
return function (e, t) {
t = (t().selection.forum || {
}).shortname;
return io.a.call('polls/preview', {
data: {
forum: t,
poll: JSON.stringify({
id: n
})
},
method: 'POST'
}).then(function (e) {
return e.response
})
}
}
};
function nM(e) {
return (nM = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function aM(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function rM(e, t) {
return (rM = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function oM(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = sM(n);
return e = a ? (e = sM(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== nM(e) && 'function' != typeof e ? iM(t) : e
}
}
function iM(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function sM(e) {
return (sM = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function lM(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Mc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && rM(e, t)
}(r, A);
var e,
t,
n,
a = oM(r);
function r(e) {
var n;
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
lM(iM(n = a.call(this, e)), 'handleChangeSearch', function (e) {
n.setState({
localSearchQuery: e.target.value
})
}),
lM(iM(n), 'handleSearch', function () {
n.state.localSearchQuery !== n.props.searchQuery && n.props.fetchPolls({
query: n.state.localSearchQuery
})
}),
lM(iM(n), 'handleLoadMore', function () {
return n.props.fetchPolls({
query: n.props.searchQuery
})
}),
lM(iM(n), 'handleKeyDownSearch', function (e) {
13 === e.keyCode && n.handleSearch()
}),
lM(iM(n), 'handlePreviewPoll', function (e) {
n.props.previewPoll(e).then(function (e) {
return n.showPreview(e.previewId)
})
}),
lM(iM(n), 'showPreview', function (e) {
e && window.open(Bc + e, '_blank')
}),
lM(iM(n), 'handleShowPollTagInstructions', function () {
n.setState({
showPollTagInstructions: !n.state.showPollTagInstructions
})
}),
lM(iM(n), 'handleCopyTags', function (e) {
var t = EU(n.props.selection && n.props.selection.forum && n.props.selection.forum.shortname, e = e || 'universal');
Object(Dl.copyToClipboard) (t),
n.setState({
copiedPoll: e,
showPollTagInstructions: !Is.a.get(Hc)
}),
setTimeout(function () {
n.setState({
copiedPoll: null
})
}, 2000)
}),
lM(iM(n), 'handleDeletePoll', function (e) {
window.confirm('Are you sure you want to delete this poll?') && n.props.deletePoll(e)
}),
n.state = {
localSearchQuery: '',
copiedPoll: null,
showPollTagInstructions: !1,
subscribeModalOpen: n.props.location.query[Ur.CHECKOUT_SUCCESS_QUERY_PARAM] === Ur.CHECKOUT_SUCCESS_QUERY_PARAM_VALUE_POLLS
},
n
}
return e = r,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.pollsOrgCurrentPackage || this.props.fetchSubscription(),
this.props.resetList(),
this.props.fetchPolls()
}
},
{
key: 'render',
value: function () {
var t = this,
e = this.props.selection.organization && this.props.selection.organization.pollsActivationDate,
n = this.props.selection.organization && Ur.SAAS_PRODUCT_PLAN_ACTIVE_STATUSES_SET.has(this.props.selection.organization.pollsSubscriptionStatus);
return e ? this.props.isFetching ? C.a.createElement(Ji, null) : n ? C.a.createElement('div', {
className: 'polls__wrapper'
}, this.state.subscribeModalOpen && this.props.pollsOrgCurrentPackage && C.a.createElement(Ty, {
package: this.props.pollsOrgCurrentPackage,
onClose: function () {
return t.setState({
subscribeModalOpen: !1
})
}
}), this.state.showPollTagInstructions && C.a.createElement(RU, {
handleShowPollTagInstructions: this.handleShowPollTagInstructions,
forum: this.props.selection && this.props.selection.forum && this.props.selection.forum.shortname,
pollId: this.state.copiedPoll
}), C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'polls__section-header'
}, C.a.createElement('h2', {
className: 'text-largest text-gray-darker spacing-bottom-small'
}, 'Polls Configuration')), C.a.createElement('div', {
className: 'polls-list__container'
}, C.a.createElement('div', {
className: 'polls-list__top-container align align--between align--middle'
}, C.a.createElement('div', {
className: 'relative__wrapper'
}, C.a.createElement('input', {
'aria-label': 'Search for a poll',
placeholder: 'Search for a poll',
value: this.state.localSearchQuery,
onChange: this.handleChangeSearch,
onKeyDown: this.handleKeyDownSearch,
className: 'input--textbox poll-search align__item--grow',
spellCheck: !0
}), C.a.createElement('button', {
className: 'poll-search-icon icon-mod-search',
onClick: this.handleSearch
})), C.a.createElement('div', {
className: 'polls-list__general-actions-container'
}, C.a.createElement('div', {
className: 'copy-universal-tag-container'
}, C.a.createElement('button', {
className: 'create-poll-btn button button-fill--brand text-large polls__copy-tags',
onClick: this.handleCopyTags.bind(this, 'universal')
}, C.a.createElement('div', {
className: 'nav-lnk'
}, C.a.createElement('div', {
className: 'nav-lnk__blk'
}, C.a.createElement('span', {
className: 'button__text'
}, 'Copy Universal Tags'), 'universal' === this.state.copiedPoll && C.a.createElement('span', {
className: 'polls__copy-tags-success'
}, 'Copied to clipboard')))), C.a.createElement(Md, {
content: C.a.createElement(C.a.Fragment, null, 'Universal tags let you deploy new polls to your site without having to update your code each time. Learn more ', C.a.createElement('a', {
href: _l.a.contactSupport,
target: '_blank',
rel: 'noopener noreferrer'
}, 'here'), '.'),
direction: 'top-left'
})), C.a.createElement(v.Link, {
className: 'create-poll-btn button button-fill--brand text-large',
activeClassName: 'active',
to: ho.getRoute('/polls/editor/new/')
}, C.a.createElement('div', {
className: 'nav-lnk'
}, C.a.createElement('div', {
className: 'nav-lnk__blk'
}, C.a.createElement('span', {
className: 'button__text'
}, '+ Poll')))))), !(!this.props.polls.length || this.state.localSearchQuery !== this.props.searchQuery && this.props.isFetching) && C.a.createElement('table', {
className: 'polls-list__table'
}, C.a.createElement('thead', null, C.a.createElement('tr', null, Rc.map(function (e, t) {
return C.a.createElement('th', {
key: t,
className: 'polls-list__table__header --'.concat(e.split(' ') [0].toLowerCase())
}, C.a.createElement('div', {
className: 'polls-list__table__header__item'
}, e))
}))), C.a.createElement('tbody', null, this.props.polls.map(function (e) {
return C.a.createElement('tr', {
key: e.id
}, C.a.createElement('td', {
className: 'polls-list__table__data --id'
}, e.id), C.a.createElement('td', {
className: 'polls-list__table__data --name'
}, C.a.createElement(v.Link, {
className: 'polls-list__action-button',
to: ho.getRoute('/polls/editor/'.concat(e.id)),
title: e.name
}, e.name)), C.a.createElement('td', {
className: 'polls-list__table__data --status'
}, C.a.createElement('span', {
className: 'poll-status '.concat(e.published ? '--published' : '--draft')
}, e.published ? 'Published' : 'Draft')), C.a.createElement('td', {
className: 'polls-list__table__data --responses'
}, e.responses || '--'), C.a.createElement('td', {
className: 'polls-list__table__data --created'
}, ct() (e.createdAt).format('MMMM DD, YYYY')), C.a.createElement('td', {
className: 'polls-list__table__data --exclude'
}, e.nonUniversal ? 'Yes' : 'No'), C.a.createElement('td', {
className: 'polls-list__table__data --actions'
}, C.a.createElement('div', {
className: 'buttons__container align align--middle'
}, C.a.createElement(v.Link, {
className: 'polls-list__action-button',
to: ho.getRoute('/polls/editor/'.concat(e.id)),
title: 'Edit'
}, C.a.createElement('span', {
className: 'icon-pencil-thin'
})), C.a.createElement('button', {
className: 'polls-list__action-button',
onClick: t.handlePreviewPoll.bind(t, e.id),
title: 'Preview'
}, C.a.createElement('span', {
className: 'icon-eye'
})), C.a.createElement('button', {
className: 'polls-list__action-button polls__copy-tags'.concat(e.published ? '' : ' -disabled'),
onClick: t.handleCopyTags.bind(t, e.id),
title: 'Copy Tags',
disabled: !e.published
}, C.a.createElement('span', {
className: 'icon-universal-code'
}), t.state.copiedPoll === e.id && C.a.createElement('span', {
className: 'polls__copy-tags-success'
}, 'Copied to clipboard')), C.a.createElement('button', {
className: 'polls-list__action-button'.concat(e.published ? ' -disabled' : ''),
onClick: t.handleDeletePoll.bind(t, e.id),
title: 'Delete',
disabled: e.published
}, C.a.createElement('span', {
className: 'icon-delete'
})))))
}))), !this.props.isFetching && !this.props.polls.length && C.a.createElement(tM, {
noSearchResults: !!this.props.searchQuery,
fetchPolls: this.props.fetchPolls,
query: this.props.searchQuery,
forum: this.props.selection && this.props.selection.forum && this.props.selection.forum.shortname
}), this.props.isFetching && C.a.createElement(Ji, null), !this.props.isFetching && !!this.props.polls.length && C.a.createElement(C.a.Fragment, null, this.props.hasMorePolls && C.a.createElement(C.a.Fragment, null, C.a.createElement('p', {
className: 'spacing-top-bottom text-small text-gray text-center'
}, 'Showing ', this.props.polls.length, ' of ', this.props.totalPolls, ' polls'), C.a.createElement('button', {
className: 'button button-wide button-outline button-medium',
disabled: !this.props.hasMorePolls,
onClick: this.handleLoadMore
}, 'Show more polls')))))) : C.a.createElement(Mk, {
organization: this.props.organization
}) : C.a.createElement(Cm, {
isPolls: !0,
organization: this.props.selection.organization
})
}
}
]) && aM(e.prototype, t),
n && aM(e, n),
r
}();
lM(Mc, 'displayName', 'PollsList'),
lM(Mc, 'propTypes', {
searchQuery: b.a.string.isRequired,
polls: qc,
isFetching: b.a.bool.isRequired,
hasMorePolls: b.a.bool.isRequired,
totalPolls: b.a.number.isRequired,
selection: ht,
pollsOrgCurrentPackage: Ur.PACKAGE_SHAPE,
fetchPolls: b.a.func.isRequired,
updateSearchQuery: b.a.func.isRequired,
deletePoll: b.a.func.isRequired,
previewPoll: b.a.func.isRequired,
location: kh.locationShape.isRequired
});
var cM = Object(u.connect) (function (e) {
var t = e.pollsList;
return {
searchQuery: t.searchQuery,
polls: t.polls,
isFetching: t.isFetching,
hasMorePolls: t.hasNext,
totalPolls: t.total,
selection: e.selection,
pollsOrgCurrentPackage: e.subscription.pollsOrgCurrentPackage
}
}, {
search: Wi.search,
updateSearchQuery: Wi.updateSearchQuery,
fetchPolls: Wi.fetchPolls,
deletePoll: Wi.delete,
resetList: Wi.resetList,
previewPoll: Wi.previewPoll,
fetchSubscription: Hl
}) (Mc),
Mc = function (e) {
return C.a.createElement('div', {
className: 'section-contained'
}, C.a.createElement('div', {
className: 'layout layout--publishers'
}, C.a.createElement('div', {
className: 'layout__main'
}, C.a.createElement(ob, {
auth: e.auth,
selection: e.selection
}), C.a.createElement('div', {
className: 'layout__content'
}, C.a.cloneElement(e.children, e)))))
};
Mc.displayName = 'PollsSettings',
Mc.propTypes = {
auth: Nc.isRequired,
children: b.a.node.isRequired,
selection: ht.isRequired
};
Nc = Object(u.connect) (function (e) {
return {
selection: e.selection
}
}) (Ni.a.attachDrivers(Mc, [
bc
]));
function uM(e) {
return (uM = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function pM(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function dM(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? pM(Object(n), !0).forEach(function (e) {
bM(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : pM(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function mM(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function fM(e, t) {
return (fM = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function hM(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = yM(n);
return e = a ? (e = yM(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== uM(e) && 'function' != typeof e ? gM(t) : e
}
}
function gM(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function yM(e) {
return (yM = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function bM(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Mc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && fM(e, t)
}(r, A);
var e,
t,
n,
a = hM(r);
function r() {
var o;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return bM(gM(o = a.call.apply(a, [
this
].concat(t))), 'state', dM(dM({
}, r.getEditableFieldsFromForum(o.props.forumDetails)), {
}, {
selectedFaviconIndex: 0,
faviconOptions: [
],
hasPendingFaviconChange: !1,
fontOptionList: r.getFontOptionsList(),
savedFields: dM(dM({
}, r.getEditableFieldsFromForum(o.props.forumDetails)), {
}, {
hasPendingFaviconChange: !1
})
})),
bM(gM(o), 'faviconFileInput', C.a.createRef()),
bM(gM(o), 'confirmNavigationIfUnsaved', function () {
if (o.hasUnsavedChanges()) return 'You have unsaved changes. Do you want to leave this page?'
}),
bM(gM(o), 'getUploadedFaviconFile', function () {
var e = o.faviconFileInput.current && o.faviconFileInput.current.files;
return e && e[0]
}),
bM(gM(o), 'getFaviconOptions', function () {
return o.state.faviconOptions.map(function (e, t) {
return {
key: t,
value: t,
image: e
}
})
}),
bM(gM(o), 'getFontCategory', function (t) {
return o.state.fontOptionList.filter(function (e) {
return e.name === t
}) [0].category
}),
bM(gM(o), 'handleFontSelection', function (r) {
return function (e) {
var t,
n = o.state.customFont,
a = o.state.typeface;
'typeface' === r ? (a = e.target.value, t = o.getFontCategory(n), 'auto' !== a && 'auto' !== t && a !== t && (n = cf.name)) : 'auto' !== o.getFontCategory(n = e.target.value) && (a = o.getFontCategory(n)),
o.setState({
typeface: a,
customFont: n
})
}
}),
bM(gM(o), 'hasValidFavicon', function () {
var e = o.getUploadedFaviconFile();
return !!(e ? o.props.forumFaviconValidateImageFile(e) : o.lastValidFavicon)
}),
bM(gM(o), 'isNewFaviconSelected', function () {
return o.hasValidFavicon() && 1 === o.state.selectedFaviconIndex
}),
bM(gM(o), 'handleFaviconTypeChange', function (e) {
var t = parseInt(e.target.parentElement.getAttribute('index'), 10),
e = o.getUploadedFaviconFile() || 0 !== t;
o.setState({
selectedFaviconIndex: t,
hasNewFavicon: o.hasValidFavicon(),
hasPendingFaviconChange: e
})
}),
bM(gM(o), 'handleInputChange', function (a) {
return function (e) {
var e = e.target,
n = 'checkbox' === e.type ? e.checked : e.value;
'radio' === e.type ? n = 'true' === n : 'text' === e.type || 'boolean' == typeof n || '' === n || isNaN(n) || (n = parseInt(n, 10)),
o.setState(function (e) {
var t = {
};
return bM(t, a, n),
bM(t, 'hasPendingFaviconChange', 'hasNewFavicon' === a || e.hasPendingFaviconChange),
t
})
}
}),
bM(gM(o), 'hasFieldChanged', function (e) {
return o.state[e] !== o.state.savedFields[e] && !(null === o.state.savedFields[e] && '' === o.state[e])
}),
bM(gM(o), 'handleFaviconFileInputChange', function () {
var e,
t;
o.hasValidFavicon() ? (o.props.forumFaviconOnDismissError(), e = o.state.faviconOptions, t = o.getUploadedFaviconFile(), e[1] = URL.createObjectURL(t), o.setState({
hasNewFavicon: !0,
hasPendingFaviconChange: !0,
faviconOptions: e,
selectedFaviconIndex: 1
})) : o.setState({
hasNewFavicon: !1
})
}),
bM(gM(o), 'hasUnsavedChanges', function () {
return Object.keys(o.state.savedFields).some(function (e) {
return o.hasFieldChanged(e)
})
}),
bM(gM(o), 'handleSaveChanges', function () {
var e;
o.state.hasPendingFaviconChange ? o.handleSaveFavicon() : (e = {
name: o.state.name,
website: o.state.website,
forumCategory: o.state.category,
adultContent: o.state.adultContent ? 1 : 0,
description: o.state.description,
colorScheme: o.state.colorScheme,
typeface: o.state.typeface,
translationLanguage: o.state.language,
disableDisqusBrandingOnPolls: o.state.enableDisqusBranding ? 0 : 1
}, o.hasFeature('customFonts') && (e.customFont = o.state.customFont), o.props.forumUpdateOnSave(e).done(function () {
o.setState(function (e) {
return {
savedFields: {
name: e.name,
website: e.website,
category: e.category,
adultContent: e.adultContent,
colorScheme: e.colorScheme,
typeface: e.typeface,
customFont: e.customFont,
description: e.description,
language: e.language,
enableDisqusBranding: e.enableDisqusBranding,
hasPendingFaviconChange: !1
}
}
})
}))
}),
bM(gM(o), 'handleSaveFavicon', function () {
var e = o.getUploadedFaviconFile();
e && o.isNewFaviconSelected() ? o.props.forumFaviconOnSave(e).done(function () {
this.faviconFileInput.current.value = '',
this.lastValidFavicon = this.props.forumFaviconNewUrl,
this.setState({
hasPendingFaviconChange: !1,
faviconOptions: [
this.props.forumFaviconNewUrl
]
}, this.handleSaveChanges)
}.bind(gM(o))) : o.setState({
hasPendingFaviconChange: !1
}, o.handleSaveChanges)
}),
bM(gM(o), 'hasFeature', function (e) {
return !!(o.props.forumDetails && o.props.forumDetails.features && o.props.forumDetails.features[e])
}),
bM(gM(o), 'getInputId', function (e) {
return ''.concat(o.constructor.displayName, '_').concat(e)
}),
o
}
return e = r,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.pollsOrgCurrentPackage || this.props.fetchSubscription(),
this.props.history.setRouteLeaveHook(this.props.route, this.confirmNavigationIfUnsaved),
this.props.emitTrackingEvent({
verb: 'view',
object_type: 'page',
object_id: ''.concat(window.document.location.host).concat(window.document.location.pathname)
}),
this.props.fetchForumCategories(),
this.props.fetchForumDetails(),
this.props.fetchForumLanguages()
}
},
{
key: 'componentWillReceiveProps',
value: function (t) {
var n;
!this.props.forumDetails && t.forumDetails && (n = r.getEditableFieldsFromForum(t.forumDetails), this.setState(function (e) {
return dM(dM({
}, n), {
}, {
savedFields: dM(dM({
}, r.getEditableFieldsFromForum(t.forumDetails)), {
}, {
hasPendingFaviconChange: !1
}),
faviconOptions: !e.faviconOptions.length && t.forumDetails.favicon.permalink ? [
t.forumDetails.favicon.permalink
] : e.faviconOptions
})
}, Function.bind.call(function () {
var e;
this.state.hasNewFavicon && (this.lastValidFavicon = (e = t.forumDetails.favicon) && e.permalink)
}, this)))
}
},
{
key: 'componentWillUnmount',
value: function () {
this.props.abortUpdateForumFaviconApiCall()
}
},
{
key: 'render',
value: function () {
var t = this,
e = this.props.selection.organization && this.props.selection.organization.pollsActivationDate,
n = this.props.selection.organization && Ur.SAAS_PRODUCT_PLAN_ACTIVE_STATUSES_SET.has(this.props.selection.organization.pollsSubscriptionStatus),
a = this.props.pollsOrgCurrentPackage && this.props.pollsOrgCurrentPackage.id === Ur.DISQUS_POLLS_BUSINESS_PACKAGE_ID;
if (!e) return C.a.createElement(Cm, {
isPolls: !0,
organization: this.props.selection.organization
});
if (this.props.forumDetailsIsFetching) return C.a.createElement(Ji, null);
if (!n) return C.a.createElement(Mk, {
organization: this.props.organization
});
if (!this.props.forumDetailsIsFetching && this.props.forumDetailsError) return C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement(Ki, {
message: this.props.forumDetailsError,
alertType: 'error'
}));
var r = this.props.forumDetails,
o = this.props.organizations[this.props.selection.forum.organization],
i = this.props.forumCategories.allCategories.map(function (e) {
return {
key: e.id,
value: e.id,
label: e.name
}
}),
s = this.props.forumLanguages.map(function (e) {
return {
key: e.code,
value: e.code,
label: e.name
}
}),
l = this.getInputId('colorScheme'),
c = this.getInputId('typeface'),
u = this.hasFeature('pollsBrandingOptional'),
e = yo.a.isFeatureActive('custom_fonts', {
forum: (this.props.selection.forum || {
}).shortname
}),
n = u || ql(this.props.selection);
return C.a.createElement('div', null, C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Configure Disqus for Your Site'), C.a.createElement('p', {
className: 'text-gray'
}, 'Disqus automatically adapts to your community and offers powerful customization options. ', C.a.createElement('a', {
href: Pn.adminArticles,
target: '_blank',
rel: 'noopener noreferrer'
}, 'Learn more »'))), C.a.createElement('section', {
className: 'settings__content'
}, this.props.forumUpdateError ? C.a.createElement(Ki, {
message: this.props.forumUpdateError,
onRequestClose: this.props.forumUpdateOnDismissError,
alertType: 'error'
}) : null, C.a.createElement(kf, {
label: 'Organization',
blockAdditionalClass: 'text-medium',
tooltip: o.name ? C.a.createElement(C.a.Fragment, null, 'Organizations are used to manage multiple sites, and this is the organization this site belongs to.', C.a.createElement('span', null, ' ', C.a.createElement(Us, {
path: '/settings/general/',
orgId: o.id,
orgSlug: o.slug
}, 'Edit organization settings.'))) : null
}, C.a.createElement('div', null, o.name ? C.a.createElement('h4', {
className: 'spacing-top-narrow'
}, o.name) : C.a.createElement('p', {
className: 'spacing-top-small'
}, 'Organizations are used to manage multiple sites, and this is the organization this site belongs to.', C.a.createElement('span', null, ' ', C.a.createElement(Us, {
path: '/settings/general/',
orgId: o.id,
orgSlug: o.slug
}, 'Edit organization settings.'))))), C.a.createElement(kf, {
label: 'Shortname',
fieldsetAdditionalClass: 'spacing-top-narrow',
blockAdditionalClass: 'text-medium',
tooltip: 'This is used to uniquely identify your website on Disqus. It cannot be changed.'
}, r ? C.a.createElement('div', {
className: 'spacing-top-narrow'
}, C.a.createElement('h4', null, r.id)) : null), C.a.createElement($h, {
name: 'name',
value: this.state.name,
label: 'Website Name',
onChange: this.handleInputChange('name'),
idNamespace: this.constructor.displayName,
readOnly: this.props.forumUpdateIsSaving,
disabled: this.props.forumUpdateIsSaving,
shouldHighlight: this.hasFieldChanged('name'),
maxLength: '64'
}), C.a.createElement($h, {
name: 'website',
value: this.state.website,
label: 'Website URL',
onChange: this.handleInputChange('website'),
idNamespace: this.constructor.displayName,
readOnly: this.props.forumUpdateIsSaving,
disabled: this.props.forumUpdateIsSaving,
shouldHighlight: this.hasFieldChanged('website'),
tooltip: C.a.createElement(C.a.Fragment, null, 'Changing domains? ', C.a.createElement('a', {
href: '/admin/discussions/migrate/'
}, 'Learn how'), '.')
}), C.a.createElement(qv, {
name: 'forum-favicon',
label: 'Website Favicon',
idNamespace: 'forum-favicon',
className: 'spacing-bottom-large',
options: this.getFaviconOptions(),
value: this.state.selectedFaviconIndex,
onChange: this.handleFaviconTypeChange,
error: this.props.forumFaviconError,
shouldHighlight: this.hasFieldChanged('hasPendingFaviconChange'),
width: '48px',
height: '48px',
tooltip: C.a.createElement(C.a.Fragment, null, 'This will be the image for your site, which will appear at the top of your ', C.a.createElement('a', {
href: '//disqus.com/home/forum/'.concat(r && r.id)
}, 'forum profile'), '.')
}, C.a.createElement('input', {
type: 'file',
id: 'custom-favicon-input',
className: 'input--display-label',
ref: this.faviconFileInput,
onChange: this.handleFaviconFileInputChange
}), C.a.createElement('label', {
htmlFor: 'custom-favicon-input'
}, C.a.createElement('img', {
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/add-avatar-plus.svg',
alt: 'Upload a favicon'
}))), C.a.createElement(Mf, {
name: 'category',
label: 'Category',
value: this.state.category,
options: i,
placeholder: 'Please select a category',
onChange: this.handleInputChange('category'),
idNamespace: this.constructor.displayName,
readOnly: this.props.forumUpdateIsSaving,
disabled: !i.length || this.props.forumUpdateIsSaving,
shouldHighlight: this.hasFieldChanged('category')
}), C.a.createElement($h, {
name: 'description',
value: this.state.description,
label: 'Description',
onChange: this.handleInputChange('description'),
idNamespace: this.constructor.displayName,
useTextarea: !0,
readOnly: this.props.forumUpdateIsSaving,
disabled: this.props.forumUpdateIsSaving,
shouldHighlight: this.hasFieldChanged('description'),
maxLength: '300'
}), C.a.createElement(Mf, {
name: 'language',
label: 'Language',
value: this.state.language,
options: s,
placeholder: 'Select a Language',
onChange: this.handleInputChange('language'),
disabled: !s.length,
idNamespace: this.constructor.displayName,
shouldHighlight: this.hasFieldChanged('language'),
tooltip: C.a.createElement(C.a.Fragment, null, C.a.createElement('a', {
href: Pn.translate
}, 'Make Disqus available in your language.'))
}), n ? C.a.createElement(Ob, {
name: 'enableDisqusBranding',
checked: this.state.enableDisqusBranding,
label: C.a.createElement('span', null, u ? null : C.a.createElement(Ks, {
emitEvent: function (e) {
return t.props.emitTrackingEvent(dM({
area: 'disqus_branding'
}, e))
},
organization: o,
iconClass: 'spacing-right-small',
plan: !a && Ur.DISQUS_POLLS_BUSINESS_PLAN_ID
}), 'Disqus Branding'),
secondaryLabel: 'Show "Powered by Disqus" banner at the bottom of polls',
onChange: this.handleInputChange('enableDisqusBranding'),
idNamespace: this.constructor.displayName,
readOnly: !u || this.props.forumUpdateIsSaving,
shouldHighlight: this.hasFieldChanged('enableDisqusBranding')
}, u ? null : C.a.createElement('p', {
className: 'fieldset__description text-small text-gray'
}, 'This feature is only available to publishers on a Disqus Polls Business plan.', ' ', C.a.createElement(Us, {
path: '/settings/subscription/?product=polls',
orgId: o.id,
orgSlug: o.slug
}, 'View upgrade options'), '.')) : null, C.a.createElement(Ob, {
name: 'adultContent',
checked: this.state.adultContent,
label: 'Adult Content',
secondaryLabel: 'Flag my site as adult oriented or NSFW',
onChange: this.handleInputChange('adultContent'),
idNamespace: this.constructor.displayName,
readOnly: this.props.forumUpdateIsSaving,
shouldHighlight: this.hasFieldChanged('adultContent'),
tooltip: C.a.createElement(C.a.Fragment, null, C.a.createElement('a', {
href: Pn.nsfwContent
}, 'What does this mean?'))
}), e ? C.a.createElement('span', null, C.a.createElement(Mf, {
id: l,
name: 'colorScheme',
label: 'Color scheme',
className: 'fieldset-item__select',
value: this.state.colorScheme,
options: pf,
onChange: this.handleInputChange('colorScheme'),
readOnly: this.props.forumUpdateIsSaving,
loading: this.props.forumUpdateIsSaving,
shouldHighlight: this.hasFieldChanged('colorScheme')
}), C.a.createElement(kf, {
label: 'Typeface',
labelId: c,
blockAdditionalClass: '-text text-medium align align--wrap',
shouldHighlight: this.hasFieldChanged('typeface') || this.hasFieldChanged('customFont')
}, C.a.createElement(Mf, {
id: c,
name: 'typeface',
secondaryLabel: 'Category',
className: 'fieldset-item__select',
value: this.state.typeface,
options: lf,
onChange: this.handleFontSelection('typeface'),
inline: !0,
readOnly: this.props.forumUpdateIsSaving,
loading: this.props.forumUpdateIsSaving
}))) : C.a.createElement(kf, {
label: 'Appearance',
labelId: l,
blockAdditionalClass: '-text text-medium align align--wrap',
shouldHighlight: this.hasFieldChanged('colorScheme') || this.hasFieldChanged('typeface')
}, C.a.createElement(Mf, {
id: l,
name: 'colorScheme',
secondaryLabel: 'Color scheme',
className: 'fieldset-item__select',
value: this.state.colorScheme,
options: pf,
onChange: this.handleInputChange('colorScheme'),
inline: !0,
readOnly: this.props.forumUpdateIsSaving,
loading: this.props.forumUpdateIsSaving
}), C.a.createElement(Mf, {
id: c,
name: 'typeface',
secondaryLabel: 'Typeface',
className: 'fieldset-item__select',
value: this.state.typeface,
options: lf,
onChange: this.handleInputChange('typeface'),
inline: !0,
readOnly: this.props.forumUpdateIsSaving,
loading: this.props.forumUpdateIsSaving
}))), C.a.createElement('footer', {
className: 'settings__footer'
}, C.a.createElement(Bh, {
disabled: !this.hasUnsavedChanges(),
onClick: this.handleSaveChanges,
isSaving: this.props.forumUpdateIsSaving || this.props.forumFaviconIsSaving,
isSaved: this.props.forumUpdateIsSaved
}))))
}
}
]) && mM(e.prototype, t),
n && mM(e, n),
r
}();
bM(Mc, 'displayName', 'PollsSettingsGeneral'),
bM(Mc, 'propTypes', {
history: b.a.shape({
setRouteLeaveHook: b.a.func.isRequired
}).isRequired,
route: b.a.object.isRequired,
organizations: b.a.object.isRequired,
selection: ht.isRequired,
forumDetails: $c,
forumDetailsError: b.a.string,
forumDetailsIsFetching: b.a.bool,
fetchForumDetails: b.a.func.isRequired,
forumUpdateError: b.a.string,
forumUpdateIsSaving: b.a.bool,
forumUpdateIsSaved: b.a.bool,
forumUpdateOnSave: b.a.func.isRequired,
forumUpdateOnDismissError: b.a.func.isRequired,
forumCategories: b.a.shape({
allCategories: b.a.arrayOf(vl)
}).isRequired,
forumLanguages: b.a.arrayOf(xl).isRequired,
emitTrackingEvent: b.a.func.isRequired,
fetchForumCategories: b.a.func.isRequired,
fetchForumLanguages: b.a.func.isRequired,
abortUpdateForumFaviconApiCall: b.a.func.isRequired,
forumFaviconValidateImageFile: b.a.func.isRequired,
forumFaviconOnSave: b.a.func.isRequired,
forumFaviconOnDismissError: b.a.func.isRequired,
forumFaviconError: b.a.string,
forumFaviconIsSaving: b.a.bool,
forumFaviconNewUrl: b.a.string
}),
bM(Mc, 'getEditableFieldsFromForum', function (e) {
return {
name: (e = e || {
}).name,
website: e.url,
category: e.forumCategory && e.forumCategory.id || null,
adultContent: !!(e.settings || {
}).adultContent,
typeface: e.typeface,
customFont: e.customFont || cf.name,
colorScheme: e.colorScheme,
description: e.raw_description,
lastValidFavicon: e.favicon && e.favicon.permalink,
language: e.language,
enableDisqusBranding: !e.disableDisqusBrandingOnPolls
}
}),
bM(Mc, 'getFontOptionsList', function () {
var e = (Sb.a.lounge || {
}).font_options;
return e[0] !== cf && e.unshift(cf),
e
});
bp = Object(u.connect) (function (e) {
var t = e.forumDetails,
n = e.forumUpdateFavicon;
return {
forumCategories: e.forumCategories,
forumLanguages: e.forumLanguages.languages,
forumDetails: t.forumDetails,
forumDetailsError: t.forumDetailsError,
forumDetailsIsFetching: t.forumDetailsIsFetching,
forumFaviconError: n.error,
forumFaviconIsSaving: n.isSaving,
forumFaviconNewUrl: n.forumFaviconNewUrl,
selection: e.selection,
pollsOrgCurrentPackage: e.subscription.pollsOrgCurrentPackage
}
}, {
emitTrackingEvent: Xo({
zone: 'settings',
section: 'polls/general'
}),
fetchForumCategories: Nh,
fetchForumLanguages: vu,
fetchForumDetails: ig,
abortUpdateForumFaviconApiCall: Zu,
forumFaviconValidateImageFile: hv,
forumFaviconOnSave: cp,
forumFaviconOnDismissError: bp,
fetchSubscription: Hl
}) (Ni.a.attachDrivers(Fo() (Mc), [
m
]));
function vM(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function _M(a) {
for (var e = 1; e < arguments.length; e++) {
var r = null != arguments[e] ? arguments[e] : {
};
e % 2 ? vM(Object(r), !0).forEach(function (e) {
var t,
n;
n = r[t = e],
t in (e = a) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(r)) : vM(Object(r)).forEach(function (e) {
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(r, e))
})
}
return a
}
function EM() {
return (EM = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
Mc = {
fetchModeratorList: function () {
return function (t, e) {
t({
type: X.fetching
});
e = e().selection.forum.shortname;
io.a.call('polls/listModerators', {
type: 'GET',
data: {
forum: e
},
success: function (e) {
t({
type: X.onFetch,
moderatorList: e.response
})
},
error: function (e) {
t({
type: X.onFetchError,
data: e
})
}
})
}
},
addModerator: function (n, a) {
return function (t, e) {
t({
type: X.saving
});
e = e().selection.forum.shortname,
e = EM({
user: 'username:'.concat(n),
forum: e
}, a);
io.a.call('polls/addModerator', {
type: 'POST',
data: e,
success: function () {
t({
type: X.onSave
})
},
error: function (e) {
t({
type: X.onSaveError,
data: e
})
}
})
}
},
removeModerator: function (e) {
var n = e.userId,
a = e.forumId;
return function (t) {
t({
type: X.saving
}),
io.a.call('polls/removeModerator', {
type: 'POST',
data: {
forum: a,
user: n
},
success: function () {
t({
type: X.onSave
})
},
error: function (e) {
t({
type: X.onSaveError,
data: e
})
}
})
}
},
updateModeratorPermissions: function (n, a) {
return function (t, e) {
t({
type: X.updating,
username: n,
permissions: {
isSaving: !0
}
});
e = e().selection.forum.shortname,
e = EM({
user: 'username:'.concat(n),
forum: e
}, a);
io.a.call('polls/addModerator', {
type: 'POST',
data: e,
success: function (e) {
t({
type: X.onUpdate,
username: n,
permissions: _M(_M({
}, e.response), {
}, {
isSaving: !1
})
})
},
error: function (e) {
t(_M({
type: X.onUpdateError,
username: n,
permissions: {
isSaving: !1
}
}, e))
}
})
}
}
};
function OM(e) {
return (OM = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function SM(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function wM(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? SM(Object(n), !0).forEach(function (e) {
xM(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : SM(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function PM(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function kM(e, t) {
return (kM = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function NM(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = RM(n);
return e = a ? (e = RM(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== OM(e) && 'function' != typeof e ? CM(t) : e
}
}
function CM(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function RM(e) {
return (RM = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function xM(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
m = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && kM(e, t)
}(o, A);
var e,
t,
n,
r = NM(o);
function o() {
var a;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return xM(CM(a = r.call.apply(r, [
this
].concat(t))), 'state', {
newUsername: ''
}),
xM(CM(a), 'handleAddModerator', function () {
var e = a.state.newUsername.trim();
e && a.props.addModerator(e)
}),
xM(CM(a), 'handlePermissionChange', function (e, t, n) {
a.props.updateModeratorPermissions(e.user.username, xM({
}, t, n.target.checked ? 1 : 0))
}),
xM(CM(a), 'getOrgAdminPermissions', function (e) {
var t = [
];
e.isAdmin && t.push('can edit organization info'),
e.isModerator && t.push('can moderate all organization polls');
e = t.join(', ');
return t.length ? (e[0] || '').toUpperCase() + e.slice(1) : ''
}),
a
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.pollsOrgCurrentPackage || this.props.fetchSubscription(),
this.props.fetchModeratorList(),
this.props.selection.organization && this.props.fetchOrgAdminList()
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
var t = {
};
!e.isSaving && this.props.isSaving && (this.props.fetchModeratorList(), t.newUsername = ''),
this.setState(t)
}
},
{
key: 'render',
value: function () {
var r = this,
e = this.props.selection.organization && this.props.selection.organization.pollsActivationDate,
t = this.props.selection.organization && Ur.SAAS_PRODUCT_PLAN_ACTIVE_STATUSES_SET.has(this.props.selection.organization.pollsSubscriptionStatus);
return e ? this.props.isFetching || this.props.orgAdminIsFetching ? C.a.createElement(Ji, null) : t ? C.a.createElement('div', null, this.props.fetchError || this.props.updateError && C.a.createElement(Ki, {
message: this.props.fetchError || this.props.updateError,
alertType: 'error'
}), C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Poll Moderators'), C.a.createElement('p', {
className: 'text-gray text-medium'
}, 'Add people to help moderate your polls.', C.a.createElement('a', {
href: Pn.modArticles,
target: '_blank',
rel: 'noopener noreferrer'
}, ' Learn more » '))), C.a.createElement('section', null, this.props.isFetching && !this.props.pollModeratorList ? C.a.createElement(Ji, null) : null, (this.props.pollModeratorList || [
]).map(function (e) {
var t = e.user.username === r.props.selection.forum.founder.username,
n = '//'.concat(pt.a.disqusHost, '/by/').concat(e.user.username, '/'),
a = r.props.isSaving || e.isSaving;
return C.a.createElement('div', {
key: e.user.id,
className: 'settings-list__item',
style: {
opacity: e.isSaving ? '0.7' : '1'
}
}, C.a.createElement('div', {
className: 'align align--between'
}, C.a.createElement('div', {
className: 'spacing-right align align--middle'
}, C.a.createElement('div', {
className: 'spacing-right spacing-top-small'
}, C.a.createElement('img', {
className: 'block__item border-radius-base',
src: e.user.avatar.cache,
width: '40',
height: '40'
})), C.a.createElement('div', null, C.a.createElement('a', {
href: n,
className: 'text-medium text-semibold'
}, e.user.name), t && C.a.createElement('p', {
className: 'text-small text-gray spacing-top-tiny'
}, 'Primary moderator has full permissions. ', C.a.createElement('a', {
href: Pn.changePrimaryMod,
target: '_blank',
rel: 'noopener noreferrer'
}, 'Need to change the primary moderator?')))), t ? null : C.a.createElement('div', {
className: 'align-min-tablet align--middle spacing-top-small spacing-bottom-small'
}, C.a.createElement('button', {
className: 'button button-outline text-medium',
onClick: r.props.removeModerator.bind(null, {
forumId: e.forum,
userId: e.user.id
}),
disabled: a
}, 'Remove'))))
}), C.a.createElement('div', {
className: 'settings-list__item'
}, C.a.createElement('form', {
onSubmit: function (e) {
return e.preventDefault()
}
}, C.a.createElement('div', {
className: 'align spacing-top-small'
}, C.a.createElement('div', {
className: 'spacing-right align__item--grow'
}, C.a.createElement('input', {
type: 'text',
className: 'input--textbox',
placeholder: 'Add a new poll moderator by their username',
onChange: function (e) {
return r.setState({
newUsername: e.target.value
})
},
value: this.state.newUsername,
disabled: this.props.isSaving
})), C.a.createElement('button', {
className: 'button button-outline text-medium',
onClick: this.handleAddModerator,
disabled: this.props.isSaving || !this.state.newUsername
}, 'Add')), C.a.createElement('p', {
className: 'fieldset__description spacing-bottom-small text-small text-gray spacing-top-tiny'
}, 'Moderators require a Disqus account.', C.a.createElement('a', {
href: Pn.modArticles,
target: '_blank',
rel: 'noopener noreferrer'
}, ' Learn more » ')), this.props.saveError && C.a.createElement('p', {
className: 'text-medium text-error text-semibold spacing-narrow'
}, this.props.saveError))))), this.props.selection.organization && C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double'
}, C.a.createElement('header', {
className: 'settings__header'
}, C.a.createElement('h2', {
className: 'text-larger text-gray-darker spacing-bottom-small'
}, 'Organization Admins'), C.a.createElement('p', {
className: 'text-gray text-medium'
}, 'Organization admins have full moderation permissions on each of the polls in the organization.', ' ', C.a.createElement(Us, {
path: '/settings/admins/',
orgId: this.props.selection.organization.id,
orgSlug: this.props.selection.organization.slug
}, 'Manage Admins »'))), C.a.createElement('section', null, this.props.orgAdminListIsFetching && !this.props.orgAdminList && C.a.createElement(Ji, null), (this.props.orgAdminList || [
]).map(function (e) {
var t = r.props.selection.organization && e.user.username === r.props.selection.organization.owner,
n = '//'.concat(pt.a.disqusHost, '/by/').concat(e.user.username, '/');
return C.a.createElement('div', {
className: 'settings-list__item',
key: e.id
}, C.a.createElement('div', {
className: 'align align--between'
}, C.a.createElement('div', {
className: 'spacing-right align'
}, C.a.createElement('div', {
className: 'spacing-right spacing-top-small'
}, C.a.createElement('img', {
className: 'border-radius-base',
src: e.user.avatar.cache,
width: '40',
height: '40'
})), C.a.createElement('div', null, C.a.createElement('a', {
href: n,
className: 'text-medium text-semibold'
}, e.user.name), C.a.createElement('p', {
className: 'text-small text-gray spacing-top-tiny'
}, t ? 'Organization owner has full permissions.' : r.getOrgAdminPermissions(e))))))
})))) : C.a.createElement(Mk, {
organization: this.props.organization
}) : C.a.createElement(Cm, {
isPolls: !0,
organization: this.props.selection.organization
})
}
}
]) && PM(e.prototype, t),
n && PM(e, n),
o
}();
xM(m, 'displayName', 'PollsSettingsModerators'),
xM(m, 'propTypes', {
selection: ht.isRequired,
pollModeratorList: b.a.arrayOf(b.a.shape({
user: b.a.shape({
id: b.a.string,
username: b.a.string,
name: b.a.string,
avatar: b.a.shape({
cache: b.a.string
})
}),
id: b.a.string,
forum: b.a.string
})),
isFetching: b.a.bool,
isSaving: b.a.bool,
isUpdating: b.a.bool,
fetchError: b.a.string,
saveError: b.a.string,
updateError: b.a.string,
orgAdminList: b.a.arrayOf(b.a.shape({
id: b.a.number.isRequired,
organizationId: b.a.number.isRequired,
isAdmin: b.a.bool.isRequired,
isModerator: b.a.bool.isRequired,
user: To
})),
orgAdminIsFetching: b.a.bool,
fetchOrgAdminList: b.a.func.isRequired,
fetchModeratorList: b.a.func.isRequired,
addModerator: b.a.func.isRequired,
removeModerator: b.a.func.isRequired,
updateModeratorPermissions: b.a.func.isRequired
});
To = Object(u.connect) (function (e) {
var t = e.orgAdmin,
n = e.subscription;
return wM(wM(wM({
selection: e.selection
}, e.pollModerator), t), {
}, {
pollsOrgCurrentPackage: n.pollsOrgCurrentPackage
})
}, wM(wM(wM({
}, Mc), Ss), {
}, {
fetchSubscription: Hl
})) (Fo() (m));
function AM(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function DM(a) {
for (var e = 1; e < arguments.length; e++) {
var r = null != arguments[e] ? arguments[e] : {
};
e % 2 ? AM(Object(r), !0).forEach(function (e) {
var t,
n;
n = r[t = e],
t in (e = a) ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(r)) : AM(Object(r)).forEach(function (e) {
Object.defineProperty(a, e, Object.getOwnPropertyDescriptor(r, e))
})
}
return a
}
function jM(e, t, n) {
t.selection.forum && n(e = {
data: DM({
forum: t.selection.forum.shortname
}, e)
})
}
var Mc = n(525),
TM = n.n(Mc);
function IM(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
var qM = - 1,
Ss = b.a.shape({
impressions: b.a.number,
responses: b.a.number,
response_rate: b.a.number,
respondents: b.a.number,
impressions_series: b.a.arrayOf(b.a.array),
responses_series: b.a.arrayOf(b.a.array),
response_rate_series: b.a.arrayOf(b.a.array)
}),
m = b.a.shape({
totalResponses: b.a.number,
questions: b.a.arrayOf(b.a.shape({
text: b.a.string,
answers: b.a.arrayOf(b.a.shape({
text: b.a.string,
count: b.a.number
}))
}))
}),
Mc = b.a.objectOf(Uc),
FM = 5,
LM = {
DAY: 'day',
MONTH: 'month'
},
UM = (IM(Uc = {
}, LM.DAY, 'daily'), IM(Uc, LM.MONTH, 'monthly'), Uc),
MM = (IM(Uc = {
}, LM.DAY, 'YYYY-MM-DD'), IM(Uc, LM.MONTH, 'YYYY-MM'), Uc),
BM = {
IMPRESSIONS: 'impressions',
RESPONSES: 'responses',
RESPONSE_RATE: 'response_rate',
RESPONDENTS: 'respondents'
},
zM = (IM(Uc = {
}, BM.IMPRESSIONS, 'impressions_series'), IM(Uc, BM.RESPONSES, 'responses_series'), IM(Uc, BM.RESPONSE_RATE, 'response_rate_series'), IM(Uc, BM.RESPONDENTS, 'respondents_series'), Uc),
HM = [
BM.IMPRESSIONS,
BM.RESPONSES,
BM.RESPONSE_RATE
],
GM = [
BM.IMPRESSIONS,
BM.RESPONSES,
BM.RESPONDENTS,
BM.RESPONSE_RATE
],
VM = (IM(Uc = {
}, BM.IMPRESSIONS, '#F66B1D'), IM(Uc, BM.RESPONSES, '#2E9FFF'), IM(Uc, BM.RESPONSE_RATE, '#3DC51B'), IM(Uc, BM.RESPONDENTS, '#FF006E'), Uc),
WM = [
'#FF006E',
'#FFBE0C',
'#3A86FE',
'#D0D0DA'
],
YM = (IM(Uc = {
}, BM.IMPRESSIONS, 'Impressions'), IM(Uc, BM.RESPONSES, 'Responses'), IM(Uc, BM.RESPONSE_RATE, 'Response Rate'), IM(Uc, BM.RESPONDENTS, 'Respondents'), Uc),
QM = (IM(Uc = {
}, BM.IMPRESSIONS, 'Total Impressions'), IM(Uc, BM.RESPONSES, 'Total Responses'), IM(Uc, BM.RESPONSE_RATE, 'Avg. Overall Response Rate'), IM(Uc, BM.RESPONDENTS, 'Total Respondents'), Uc),
KM = {
color: {
pattern: [
VM[BM.RESPONSES],
VM[BM.IMPRESSIONS]
]
},
legend: {
show: !1
},
padding: {
bottom: 16,
top: 16
},
axis: {
y: {
min: 0,
default:
[
0,
100
],
padding: {
bottom: 0,
right: 20
},
tick: {
format: function (e) {
return e.toLocaleString(void 0, {
maximumFractionDigits: 0
})
}
}
},
y2: {
min: 0,
max: 1,
show: !0,
default:
[
0,
1
],
tick: {
format: TM.a
},
padding: {
top: 0,
bottom: 0
}
},
x: {
padding: {
left: 0,
top: 20
},
type: 'timeseries',
tick: {
culling: !0
}
}
},
grid: {
x: {
show: !0
},
y: {
show: !0
}
},
point: {
show: !1
},
size: {
height: 400
},
tooltip: {
format: {
value: function (e, t, n) {
return n === BM.RESPONSE_RATE ? TM() (e) : e.toLocaleString()
}
}
}
},
JM = {
legend: {
show: !1
},
size: {
width: 100,
height: 140
},
padding: {
top: - 5,
bottom: - 10
},
pie: {
label: {
show: !1
}
}
};
function $M(e) {
return ($M = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function ZM(e) {
return function (e) {
if (Array.isArray(e)) return XM(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return XM(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? XM(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function XM(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function eB(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function tB(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? eB(Object(n), !0).forEach(function (e) {
sB(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : eB(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function nB(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function aB(e, t) {
return (aB = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function rB(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = iB(n);
return e = a ? (e = iB(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== $M(e) && 'function' != typeof e ? oB(t) : e
}
}
function oB(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function iB(e) {
return (iB = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function sB(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Uc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && aB(e, t)
}(o, A);
var e,
t,
n,
a = rB(o);
function o() {
var r;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return sB(oB(r = a.call.apply(a, [
this
].concat(t))), 'initGraph', function (e) {
r.ref && (!r.ref.graph.parentElement.clientWidth && (e || 0) < FM ? setTimeout(r.initGraph.bind(oB(r), (e || 0) + 1), 0) : (e = r.getDateGraphData(), r.chart = Ed.a.generate(tB(tB({
}, KM), {
}, {
axis: tB(tB({
}, KM.axis), {
}, {
x: tB(tB({
}, KM.axis.x), {
}, {
tick: tB(tB({
}, KM.axis.x.tick), {
}, {
format: r.props.groupBy === LM.DAY ? '%b %d %Y' : '%b %Y'
})
})
}),
point: tB(tB({
}, KM.point), {
}, {
show: e.columns[0].length < 3
}),
data: e,
bindto: r.ref.graph
}))))
}),
sB(oB(r), 'getDateGraphData', function () {
var e = r.formatDataByInterval(r.props.report[zM[BM.IMPRESSIONS]]),
t = r.formatDataByInterval(r.props.report[zM[BM.RESPONSES]]),
n = r.formatDataByInterval(r.props.report[zM[BM.RESPONDENTS]]),
a = r.formatDataByInterval(r.props.report[zM[BM.RESPONSE_RATE]]);
return {
x: 'dates',
xFormat: r.props.groupBy === LM.DAY ? '%Y-%m-%d' : '%Y-%m',
columns: [
['dates'].concat(ZM(Object.keys(e))),
[
BM.IMPRESSIONS
].concat(ZM(Object.values(e))),
[
BM.RESPONSES
].concat(ZM(Object.values(t)))
].concat(ZM(r.props.isMultiSubmission ? [
[BM.RESPONDENTS].concat(ZM(Object.values(n)))
] : [
]), [
[BM.RESPONSE_RATE].concat(ZM(Object.values(a)))
]),
axes: (sB(a = {
}, BM.IMPRESSIONS, 'y'), sB(a, BM.RESPONSES, 'y'), sB(a, BM.RESPONDENTS, 'y'), sB(a, BM.RESPONSE_RATE, 'y2'), a),
types: (sB(a = {
}, BM.IMPRESSIONS, 'area'), sB(a, BM.RESPONSES, 'area'), sB(a, BM.RESPONDENTS, 'area'), sB(a, BM.RESPONSE_RATE, 'line'), a),
names: YM,
colors: VM
}
}),
sB(oB(r), 'formatDataByInterval', function (e) {
if (!e) return [];
var a = MM[r.props.groupBy];
return e.reduce(function (e, t) {
var n = ct.a.utc(t[0]).format(a);
return e[n] = e[n] ? e[n] + t[1] : t[1],
e
}, {
})
}),
r
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.initGraph()
}
},
{
key: 'componentDidUpdate',
value: function () {
this.initGraph()
}
},
{
key: 'componentWillUnmount',
value: function () {
this.chart && (this.chart = this.chart.destroy())
}
},
{
key: 'render',
value: function () {
var t = this,
n = this.props.isTotal ? QM : YM;
return C.a.createElement('div', {
className: 'poll-responses-chart'
}, C.a.createElement('div', {
className: 'poll-responses-chart__metrics'
}, (this.props.isMultiSubmission ? GM : HM).map(function (e) {
return C.a.createElement('div', {
key: e,
className: 'poll-responses-chart__metric'
}, C.a.createElement('div', {
className: 'poll-responses-chart__metric-inner'
}, C.a.createElement('div', {
className: 'poll-responses-chart__metric-name'
}, C.a.createElement('span', {
className: 'poll-responses-chart__legend',
style: {
background: VM[e]
}
}), n[e], 'response_rate' === e && C.a.createElement(Md, {
content: C.a.createElement(C.a.Fragment, null, 'The number of completions divided by the number of users who viewed or started the poll(s).'),
direction: 'top'
})), C.a.createElement('div', {
className: 'poll-responses-chart__metric-value'
}, function () {
var e = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : 0;
return BM.RESPONSE_RATE === (1 < arguments.length ? arguments[1] : void 0) ? TM() (e) : e.toLocaleString()
}(t.props.report[e], e))))
})), C.a.createElement('div', {
className: 'poll-responses-chart__plot',
ref: function (e) {
t.ref = t.ref || {
},
t.ref.graph = e
}
}))
}
}
]) && nB(e.prototype, t),
n && nB(e, n),
o
}();
sB(Uc, 'propTypes', {
report: Ss.isRequired,
groupBy: b.a.string,
isTotal: b.a.bool,
isMultiSubmission: b.a.bool
}),
sB(Uc, 'defaultProps', {
report: {
},
groupBy: LM.DAY,
isTotal: !1
});
var lB = Uc;
function cB(e) {
return (cB = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function uB(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function pB(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? uB(Object(n), !0).forEach(function (e) {
yB(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : uB(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function dB(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function mB(e, t) {
return (mB = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function fB(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = gB(n);
return e = a ? (e = gB(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== cB(e) && 'function' != typeof e ? hB(t) : e
}
}
function hB(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function gB(e) {
return (gB = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function yB(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Uc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && mB(e, t)
}(o, A);
var e,
t,
n,
r = fB(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return yB(hB(t = r.call.apply(r, [
this
].concat(n))), 'initGraph', function (e) {
t.ref && (!t.ref.graph.parentElement.clientWidth && (e || 0) < FM ? setTimeout(t.initGraph.bind(hB(t), (e || 0) + 1), 0) : t.chart = Ed.a.generate(pB(pB({
}, JM), {
}, {
bindto: t.ref.graph,
data: t.getDateGraphData()
})))
}),
yB(hB(t), 'getDateGraphData', function () {
return {
type: 'pie',
columns: t.props.question.answers.map(function (e, t) {
return ['' + (t + 1),
e.count]
}),
names: t.props.question.answers.reduce(function (e, t, n) {
return pB(pB({
}, e), {
}, yB({
}, '' + (n + 1), t.text))
}, {
}),
colors: WM.reduce(function (e, t, n) {
return pB(pB({
}, e), {
}, yB({
}, '' + (n + 1), t))
}, {
})
}
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.initGraph()
}
},
{
key: 'componentDidUpdate',
value: function () {
this.initGraph()
}
},
{
key: 'componentWillUnmount',
value: function () {
this.chart && (this.chart = this.chart.destroy())
}
},
{
key: 'render',
value: function () {
var t = this;
return C.a.createElement('div', {
className: 'poll-breakdown-chart'
}, C.a.createElement('div', {
className: 'poll-breakdown-chart__header'
}, C.a.createElement('div', {
className: 'poll-breakdown-chart__title'
}, 'Question ', this.props.index), C.a.createElement('div', {
className: 'poll-breakdown-chart__question'
}, this.props.question.text), C.a.createElement('span', {
className: 'poll-breakdown-chart__answers-count'
}, this.props.totalResponses.toLocaleString()), ' ', C.a.createElement('span', {
className: 'poll-breakdown-chart__answers-label'
}, 'answers')), C.a.createElement('div', {
className: 'poll-breakdown-chart__plot',
ref: function (e) {
t.ref = t.ref || {
},
t.ref.graph = e
}
}), C.a.createElement('div', {
className: 'poll-breakdown-chart__legend'
}, this.props.question.answers.map(function (e, t) {
return C.a.createElement('div', {
key: t,
className: 'poll-breakdown-chart__legend-item'
}, C.a.createElement('span', {
className: 'poll-breakdown-chart__legend-point',
style: {
background: WM[t]
}
}), C.a.createElement('span', {
className: 'poll-breakdown-chart__legend-text'
}, e.text), C.a.createElement('span', {
className: 'poll-breakdown-chart__legend-count'
}, e.count.toLocaleString()))
})))
}
}
]) && dB(e.prototype, t),
n && dB(e, n),
o
}();
yB(Uc, 'propTypes', {
index: b.a.number,
question: b.a.shape({
text: b.a.string,
answers: b.a.arrayOf(b.a.shape({
text: b.a.string,
count: b.a.number
}))
}),
totalResponses: b.a.number
});
var bB = Uc;
function vB(e) {
return (vB = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function _B(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function EB(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? _B(Object(n), !0).forEach(function (e) {
RB(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : _B(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function OB(e) {
return function (e) {
if (Array.isArray(e)) return SB(e)
}(e) || function (e) {
if ('undefined' != typeof Symbol && null != e[Symbol.iterator] || null != e['@@iterator']) return Array.from(e)
}(e) || function (e, t) {
if (e) {
if ('string' == typeof e) return SB(e, t);
var n = Object.prototype.toString.call(e).slice(8, - 1);
return 'Map' === (n = 'Object' === n && e.constructor ? e.constructor.name : n) || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? SB(e, t) : void 0
}
}(e) || function () {
throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.')
}()
}
function SB(e, t) {
for (var n = 0, a = Array(t = null == t || e.length < t ? e.length : t); n < t; n++) a[n] = e[n];
return a
}
function wB(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function PB(e, t) {
return (PB = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function kB(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = CB(n);
return e = a ? (e = CB(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== vB(e) && 'function' != typeof e ? NB(t) : e
}
}
function NB(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function CB(e) {
return (CB = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function RB(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
Uc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && PB(e, t)
}(o, A);
var e,
t,
n,
a = kB(o);
function o() {
var r;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, t = Array(e), n = 0; n < e; n++) t[n] = arguments[n];
return RB(NB(r = a.call.apply(a, [
this
].concat(t))), 'state', {
pollId: + ('' + (r.props.params.pollId || qM)),
groupBy: LM.DAY,
startDate: ct() ().utc().subtract(1, 'month'),
endDate: ct() ().utc()
}),
RB(NB(r), 'handlePollChange', function (e) {
e = e.target.value;
r.setState({
pollId: e
}, r.fetchReport),
r.props.history.push({
pathname: ''.concat(Wc.INSIGHTS).concat(e === qM ? '' : ''.concat(e))
})
}),
RB(NB(r), 'onGroupChange', function (e) {
r.setState({
groupBy: e
}, r.fetchReport)
}),
RB(NB(r), 'onDateChange', function (e, t) {
r.setState({
startDate: e,
endDate: t
}, r.fetchReport)
}),
RB(NB(r), 'getResponsesReportData', function () {
return 1 === r.state.pollId ? r.props.totalResponsesReport : r.props.pollResponsesReport
}),
RB(NB(r), 'fetchReport', function () {
return r.state.pollId === qM ? r.fetchTotalReport() : r.fetchPollReport()
}),
RB(NB(r), 'fetchTotalReport', function () {
return r.props.fetchTotalResponsesReport({
start: r.state.startDate.toISOString(),
end: r.state.endDate.endOf('day').toISOString(),
agg_period: UM[r.state.groupBy]
})
}),
RB(NB(r), 'fetchPollReport', function () {
var e = r.state,
t = e.groupBy,
n = e.endDate,
a = e.pollId,
e = e.startDate.toISOString(),
n = n.endOf('day').toISOString();
r.props.pollDetails[a] || r.props.fetchPollDetails(a),
r.props.fetchPollResponsesReport({
agg_period: UM[t],
start: e,
end: n,
pollId: a
}),
r.props.fetchPollBreakdownReport({
start: e,
end: n,
pollId: a
})
}),
RB(NB(r), 'isFetching', function () {
return r.props.isFetching || r.props.isFetchingDetails
}),
RB(NB(r), 'getExportUrl', function () {
var e = io.a.getURL('polls/export.xlsx');
return Eo() (e, {
api_key: pt.a.keys.api,
forum: pt.a.currentForum,
start: r.state.startDate.toISOString(),
end: r.state.endDate.endOf('day').toISOString(),
pollId: r.state.pollId
})
}),
r
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.pollsOrgCurrentPackage || this.props.fetchSubscription(),
this.fetchReport(),
this.props.resetList(),
this.props.fetchPolls({
limit: 25
})
}
},
{
key: 'componentWillUnmount',
value: function () {
window.removeEventListener('scroll', this.onScroll)
}
},
{
key: 'render',
value: function () {
var n = this,
e = this.props.organization && this.props.organization.pollsActivationDate,
t = this.props.organization && Ur.SAAS_PRODUCT_PLAN_ACTIVE_STATUSES_SET.has(this.props.organization.pollsSubscriptionStatus);
if (!e) return C.a.createElement(Cm, {
isPolls: !0,
organization: this.props.selection.organization
});
if (this.isFetching()) return C.a.createElement(Ji, null);
if (!t) return C.a.createElement(Mk, {
organization: this.props.organization
});
var a = this.state.pollId === qM,
r = !!(this.state.pollId && this.props.pollDetails[this.state.pollId] && 0 < this.props.pollDetails[this.state.pollId].voteInterval),
e = [
{
key: qM,
value: qM,
label: 'All polls'
}
].concat(OB(this.props.polls.map(function (e) {
return {
key: e.id,
value: e.id,
label: e.name
}
}))),
t = a && 0 < this.props.totalResponsesReport.impressions || !a && 0 < this.props.pollResponsesReport.impressions ? C.a.createElement('div', {
className: 'polls-analytics__section-content'
}, C.a.createElement(lB, {
groupBy: this.state.groupBy,
report: a ? this.props.totalResponsesReport : this.props.pollResponsesReport,
isTotal: a,
isMultiSubmission: r
})) : C.a.createElement(tM, {
noPollData: !0
}),
r = !this.isFetching() && !a && 0 < this.props.pollBreakdownReport.questions.length;
return C.a.createElement('div', {
className: 'content__wrap spacing-bottom-double polls-analytics'
}, C.a.createElement('header', {
className: 'polls__section-header'
}, C.a.createElement('h2', {
className: 'text-largest text-gray-darker'
}, 'Poll Insights')), C.a.createElement('div', {
className: 'polls-analytics__poll-selector'
}, C.a.createElement(Mf, {
name: 'poll-id',
label: 'Select poll',
value: this.state.pollId,
options: e,
placeholder: 'All polls',
onChange: this.handlePollChange,
idNamespace: this.constructor.displayName,
readOnly: this.props.isFetchingPolls,
disabled: !e.length || this.props.isFetchingPolls
})), C.a.createElement(C.a.Fragment, null, C.a.createElement('section', {
className: 'polls-analytics__section'
}, C.a.createElement('div', {
className: 'polls-analytics__section-header'
}, C.a.createElement('div', {
className: 'polls-analytics__section-title'
}, 'Engagement Data Overview'), C.a.createElement('div', {
className: 'polls-analytics__filters'
}, !a && C.a.createElement('div', {
className: 'polls-analytics__filters-item'
}, C.a.createElement('a', {
href: this.getExportUrl(),
className: 'polls-analytics__button -button -right text-gray-dark text-semibold'
}, C.a.createElement('span', {
className: 'icon-download text-large spacing-right text-gray'
}), 'Export Data')), C.a.createElement('div', {
className: 'polls-analytics__filters-item'
}, C.a.createElement(Zp, {
dateWrapperClass: 'card__header-datepicker',
minDate: ct() ().utc().subtract(1, 'year'),
maxDate: ct() ().utc(),
startDate: this.state.startDate,
endDate: this.state.endDate,
onDateChange: this.onDateChange,
group: this.state.groupBy,
onGroupChange: this.onGroupChange
})))), this.isFetching() ? C.a.createElement(Ji, null) : t), r && C.a.createElement('section', {
className: 'polls-analytics__section'
}, C.a.createElement('div', {
className: 'polls-analytics__section-header'
}, C.a.createElement('div', {
className: 'polls-analytics__section-title'
}, 'Responses: Answers Breakdown')), C.a.createElement('div', {
className: 'polls-analytics__section-content poll-breakdown'
}, this.props.pollBreakdownReport.questions.map(function (e, t) {
return C.a.createElement(bB, {
key: t,
index: t + 1,
question: e,
totalResponses: n.props.pollBreakdownReport.total_responses
})
})))))
}
}
]) && wB(e.prototype, t),
n && wB(e, n),
o
}();
RB(Uc, 'propTypes', {
isFetching: b.a.bool,
isFetchingDetails: b.a.bool,
totalResponsesReport: Ss.isRequired,
pollResponsesReport: Ss.isRequired,
pollBreakdownReport: m.isRequired,
pollDetails: Mc.isRequired,
fetchTotalResponsesReport: b.a.func.isRequired,
fetchPollResponsesReport: b.a.func.isRequired,
fetchPollBreakdownReport: b.a.func.isRequired,
fetchPollDetails: b.a.func.isRequired,
isFetchingPolls: b.a.bool.isRequired,
polls: qc.isRequired,
fetchPolls: b.a.func.isRequired,
resetList: b.a.func.isRequired,
organization: b.a.shape({
id: b.a.number.isRequired,
slug: b.a.string.isRequired,
pollsActivationDate: b.a.string
})
});
var xB = Object(u.connect) (function (e) {
var t = e.pollsList,
n = e.selection,
a = e.subscription;
return EB(EB({
}, e.pollAnalytics), {
}, {
polls: t.polls,
isFetchingPolls: t.isFetching,
organization: n.organization,
pollsOrgCurrentPackage: a.pollsOrgCurrentPackage
})
}, {
fetchTotalResponsesReport: function (n) {
return function (t, e) {
jM(n, e(), function (e) {
return t({
type: de.isFetching
}),
io.a.call('polls/statsTimelines', e).success(function (e) {
t({
type: de.onFetchTotalResponsesReport,
response: e.response
})
})
})
}
},
fetchPollResponsesReport: function (n) {
return function (t, e) {
jM(n, e(), function (e) {
return t({
type: de.isFetching
}),
io.a.call('polls/statsTimelines', e).success(function (e) {
t({
type: de.onFetchPollResponsesReport,
response: e.response
})
})
})
}
},
fetchPollBreakdownReport: function (n) {
return function (t, e) {
jM(n, e(), function (e) {
return t({
type: de.isFetching
}),
io.a.call('polls/statsBreakdown', e).success(function (e) {
t({
type: de.onFetchPollBreakdownReport,
response: e.response
})
})
})
}
},
fetchPollDetails: function (n) {
return function (t, e) {
jM({
pollId: n
}, e(), function (e) {
return t({
type: de.isFetchingDetails
}),
io.a.call('polls/details', e).success(function (e) {
t({
type: de.onFetchPollDetails,
response: e.response
})
})
})
}
},
fetchPolls: Wi.fetchPolls,
resetList: Wi.resetList,
fetchSubscription: Hl
}) (Fo() (Uc));
function AB(e) {
return (AB = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function DB(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function jB(e, t) {
return (jB = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function TB(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = qB(n);
return e = a ? (e = qB(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== AB(e) && 'function' != typeof e ? IB(t) : e
}
}
function IB(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function qB(e) {
return (qB = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
function FB(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
function LB(e) {
return e.orgCurrentPackage && e.orgCurrentPackage.id !== Ur.DISQUS_BASIC_PACKAGE_ID
}
Wi = {
zone: 'install',
section: 'plan'
},
Uc = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && jB(e, t)
}(o, A);
var e,
t,
n,
r = TB(o);
function o() {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, o);
for (var e = arguments.length, n = Array(e), a = 0; a < e; a++) n[a] = arguments[a];
return FB(IB(t = r.call.apply(r, [
this
].concat(n))), 'advanceStep', function () {
t.props.history.push(ho.getRoute('/install/welcome/'))
}),
FB(IB(t), 'trackButtonClick', function (e) {
return t.props.emitTrackingEvent({
verb: 'click',
object_type: 'button',
object_id: e && e.id !== Ur.DISQUS_BASIC_PLAN_ID ? e.id : 'basic'
})
}),
FB(IB(t), 'handleSubscribe', function (e) {
t.trackButtonClick(e),
t.props.onSubscribe(e, t.props.history, ''.concat(window.location.origin, '/admin/install/welcome'))
}),
t
}
return e = o,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.fetchSubscription(),
LB(this.props) && this.advanceStep()
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
LB(e) && this.advanceStep()
}
},
{
key: 'render',
value: function () {
return C.a.createElement('section', null, C.a.createElement('div', {
className: 'content__wrap'
}, C.a.createElement('header', {
className: 'basic-acknowledge'
}, C.a.createElement('img', {
src: '//c.disquscdn.com/next/current/publisher-admin/assets/img/disqus-logo-blue-transparent.png',
width: '174',
height: '32',
alt: 'Disqus',
title: 'Disqus'
}), C.a.createElement('h2', {
className: 'basic-acknowledge__header'
}, 'Confirm your Plan'), C.a.createElement('div', {
className: 'basic-acknowledge__body'
}, C.a.createElement('p', null, 'You\'ve selected a plan that is free and ad-supported. We place every ad-supported site under review.'), C.a.createElement('p', null, 'To use our free-plan, sites must have ads properly enabled and viewable on page load and meet the quality standards of the Disqus advertising network.'), C.a.createElement('p', null, 'For more info on eligiblity requirements, ', C.a.createElement('a', {
href: 'https://help.disqus.com/en/articles/4555311-disqus-advertising-qualification'
}, 'see here'), '.')), C.a.createElement('button', {
className: 'basic-acknowledge__button',
onClick: this.advanceStep
}, 'Acknowledge'), C.a.createElement('div', {
className: 'basic-acknowledge__separator'
}, 'or'), C.a.createElement('div', {
className: 'basic-acknowledge__plan-text'
}, 'If your site won\'t be eligible for our free, ad-supported plan, you\'ll need to select a paid plan below:')), C.a.createElement('section', {
className: 'settings__content'
}, this.props.orgPackages ? C.a.createElement(WT.a, {
packages: this.props.orgPackages.reduce(function (e, t) {
return e[t.id] = t,
e
}, {
}),
onSubscribe: this.handleSubscribe,
onStartTrial: this.handleSubscribe,
newSubscriptionFlow: Object(Tl.isNewFlow) ('cc_v2', {
orgId: (this.props.selection.organization || {
}).id
}),
hideAdSupported: !0
}) : C.a.createElement(Qi, null))))
}
}
]) && DB(e.prototype, t),
n && DB(e, n),
o
}();
FB(Uc, 'propTypes', {
history: b.a.shape({
push: b.a.func.isRequired
}).isRequired,
orgBilling: Ur.ORG_BILLING_SHAPE,
orgCurrentPackage: Ur.PACKAGE_SHAPE,
orgPackages: b.a.arrayOf(Ur.PACKAGE_SHAPE),
onSubscribe: b.a.func.isRequired,
selection: ht.isRequired,
emitTrackingEvent: b.a.func.isRequired,
emitDefaultViewEvent: b.a.func.isRequired
});
Ni = Object(u.connect) (function (e) {
var t = e.subscription;
return {
orgBilling: t.orgBilling,
orgCurrentPackage: t.orgCurrentPackage,
orgPackages: t.orgPackages,
selection: e.selection
}
}, {
onSubscribe: Wl,
fetchSubscription: Hl,
emitTrackingEvent: Xo(Wi),
emitDefaultViewEvent: ei(Wi)
}) (Ni.a.attachDrivers(Fo() (Uc), [
bc
]));
function UB(e) {
return (UB = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function MB(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
function BB() {
return (BB = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function zB(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function HB(e, t) {
return (HB = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function GB(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = VB(n);
return e = a ? (e = VB(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== UB(e) && 'function' != typeof e ? function (e) {
if (void 0 !== e) return e;
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called')
}(t) : e
}
}
function VB(e) {
return (VB = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
pt.a.debug && yo.a.forceFeature('polls_pub_admin');
Fo = window.document.getElementById('app-root');
_.a.setAppElement('#app-root');
var Uc = Object(v.useRouterHistory) (o.createHistory) ({
basename: '/admin'
}),
o = ro(),
ro = o.getState(),
WB = ro.selection,
YB = ro.saasFeatures;
o.dispatch(so.fetch());
var so = window.document.getElementsByClassName('admin_content') [0] || window.document.querySelector('article#error'),
QB = {
__html: so && so.innerHTML
},
KB = ho.getAdminPath(window.location.pathname),
so = window.document.title;
function JB(i, a) {
return function (e, t) {
var o,
n;
ho.getAdminPath(e.location.basename + e.location.pathname) === KB ? (o = 'admin_content '.concat(KB.replace(/\//g, '_')), n = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && HB(e, t)
}(r, A);
var e,
t,
n,
a = GB(r);
function r() {
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
a.apply(this, arguments)
}
return e = r,
(t = [
{
key: 'componentDidMount',
value: function () {
i && i()
}
},
{
key: 'render',
value: function () {
return C.a.createElement('div', {
className: o,
dangerouslySetInnerHTML: QB
})
}
}
]) && zB(e.prototype, t),
n && zB(e, n),
r
}(), t(null, function (e) {
return a ? C.a.createElement(a, e, C.a.createElement(n, null)) : C.a.createElement(n, null)
})) : t(null, zw.a)
}
}
function $B(r) {
return function (e, t) {
var n = ho.getAdminPath(e.location.basename + e.location.pathname),
a = fN.supportedRoutes.some(function (e) {
return e.test ? e.test(n) : e === n
});
JB(r, a ? fN : null) (e, t)
}
}
function ZB(a) {
return function (e, t) {
var n = ho.getAdminPath(e.location.basename + e.location.pathname);
uo.addSupportedSelections(ho.getAdminPath(n), a);
e = a[WB.type];
e && window._v5Config.httpStatusCode !== g.a.FORBIDDEN ? t(null, e) : t(null, function (e) {
return C.a.createElement(bA, BB({
}, e, {
adminPath: n
}))
})
}
}
function XB(e) {
return ZB(MB({
}, ft.forum, e))
}
function ez(e) {
return ZB(MB({
}, ft.organization, e))
}
function tz(e) {
var t;
return ZB((MB(t = {
}, ft.global, e), MB(t, ft.forum, e), t))
}
function nz(e, t) {
var n;
return ZB((MB(n = {
}, ft.forum, e), MB(n, ft.organization, t || e), n))
}
function az(e) {
var t;
return ZB((MB(t = {
}, ft.forum, e), MB(t, ft.organization, e), MB(t, ft.global, e), t))
}
function rz(e) {
return C.a.createElement(WA, e, C.a.createElement(wh, null))
}
function oz(e) {
return C.a.createElement(WA, e, C.a.createElement(ij, null))
}
ac = C.a.createElement(v.Route, {
path: 'tools'
}, C.a.createElement(v.Route, {
getComponent: XB(fN)
}, C.a.createElement(v.IndexRoute, {
component: zw.a
}), C.a.createElement(v.Route, {
path: 'import/details/:groupId',
component: ac,
title: 'Import Details'
})), C.a.createElement(v.Route, {
path: 'migrate-map',
getComponent: $B(function () {
n.e(4).then(n.bind(null, 526))
}),
title: 'Migrate Discussions'
})),
s = C.a.createElement(v.Route, {
path: 'settings',
getComponent: ez(AO)
}, C.a.createElement(v.Route, {
path: 'sites',
component: ut,
title: 'Organization Sites'
}), C.a.createElement(v.Route, {
path: 'admins',
component: wi,
title: 'Organization Admins'
}), C.a.createElement(v.Route, {
path: 'subscription',
component: s,
title: 'Site Subscription Settings'
})),
qn = [
{
path: 'universalcode',
component: Fc,
title: 'Install instructions for Universal Code'
},
{
path: 'wordpress',
component: cu,
title: 'Install instructions for Wordpress',
requiresForum: !0
},
{
path: 'blogger',
component: xu,
title: 'Install instructions for Blogger'
},
{
path: 'tumblr',
component: y,
title: 'Install instructions for Tumblr'
},
{
path: 'squarespace',
component: p,
title: 'Install instructions for Squarespace'
},
{
path: 'typepad',
component: Sn,
title: 'Install instructions for TypePad'
},
{
path: 'movabletype',
component: Ln,
title: 'Install instructions for Movable Type'
},
{
path: 'drupal',
component: c,
title: 'Install instructions for Drupal'
},
{
path: 'joomla',
component: bo,
title: 'Install instructions for Joomla'
},
{
path: 'weebly',
component: Ts,
title: 'Install instructions for Weebly'
},
{
path: 'strikingly',
component: cs,
title: 'Install instructions for Strikingly'
},
{
path: 'jekyll',
component: Lo,
title: 'Install instructions for Jekyll'
},
{
path: 'ghost',
component: di,
title: 'Install instructions for Ghost'
},
{
path: 'hubspot',
component: Fi,
title: 'Install instructions for HubSpot'
},
{
path: 'shopify',
component: yc,
title: 'Install instructions for Shopify'
},
{
path: 'amp',
component: Cl,
title: 'Install instructions for AMP'
},
{
path: 'adobemuse',
component: lh,
title: 'Install instructions for Adobe Muse'
},
{
path: 'jimdo',
component: Vb,
title: 'Install instructions for Jimdo'
},
{
path: 'postachio',
component: Jc,
title: 'Install instructions for Postach.io'
},
{
path: 'gatsby',
component: Bu,
title: 'Install instructions for Gatsby'
},
{
path: 'pattern',
component: lt,
title: 'Install instructions for Pattern'
},
{
path: 'react',
component: qn,
title: 'Install instructions for React'
}
].map(function (e) {
return C.a.createElement(v.Route, {
key: e.path,
path: e.path,
getComponent: (e.requiresForum ? XB : tz) (e.component),
title: e.title
})
}),
Ds = C.a.createElement(v.Route, {
path: 'install',
getComponent: az(wn)
}, C.a.createElement(v.IndexRoute, {
getComponent: tz(Oi),
title: 'Choose a platform'
}), C.a.createElement(v.Route, {
path: 'welcome',
getComponent: XB(Oi),
title: 'Choose a platform'
}), C.a.createElement(v.Route, {
path: 'settings',
getComponent: XB(_o),
title: 'Configure Disqus'
}), C.a.createElement(v.Route, {
path: 'moderation',
getComponent: XB(ti),
title: 'Configure Moderation'
}), C.a.createElement(v.Route, {
path: 'complete',
getComponent: XB(Ds),
title: 'Setup Complete!'
}), C.a.createElement(v.Route, {
path: 'platforms'
}, C.a.createElement(v.IndexRedirect, {
to: '/install/'
}), qn)),
bl = C.a.createElement(v.Route, {
path: 'access',
getComponent: XB(Pi)
}, C.a.createElement(v.Route, {
path: 'banned',
component: bl,
accessListType: 'blacklist',
title: 'Banned/Trusted Users'
}), C.a.createElement(v.Route, {
path: 'trusted',
component: bl,
accessListType: 'whitelist',
title: 'Banned/Trusted Users'
})),
qn = C.a.createElement(v.Route, {
path: 'settings',
getComponent: XB(ib)
}, C.a.createElement(v.Route, {
path: 'community',
component: Sh,
title: 'Site Community Settings'
}), C.a.createElement(v.Route, {
path: 'moderation',
component: oo,
title: 'Site Moderation Settings'
}), yo.a.isFeatureActive('polls_pub_admin') && C.a.createElement(v.Route, {
path: 'moderators',
component: qs,
title: 'Moderator Settings'
}), C.a.createElement(v.Route, {
path: 'ads',
component: ai,
title: 'Site Ad Settings'
}), C.a.createElement(v.Route, {
path: 'email-subscriptions',
component: Ju,
title: 'Email Subscriptions'
}), C.a.createElement(v.Route, {
path: 'advanced',
component: vh,
title: 'Site Advanced Settings'
}), C.a.createElement(v.Route, {
path: 'webhooks',
component: Li,
title: 'Site Webhooks'
}), C.a.createElement(v.Route, {
path: 'reactions',
component: yl,
title: 'Site Reactions'
}), C.a.createElement(v.Route, {
path: 'recommendations',
component: sl,
title: 'Site Recommendations'
}), C.a.createElement(v.Route, {
path: 'badges',
component: F,
title: 'Site Badges'
}), C.a.createElement(v.Route, {
path: 'behind-click',
component: r,
title: 'Site Behind a Click'
}), C.a.createElement(v.Route, {
path: 'install',
component: Yi,
title: 'Choose a platform'
}), ',', qn, C.a.createElement(v.Redirect, {
from: 'revenue',
to: 'ads'
}), C.a.createElement(v.Redirect, {
path: 'revenue/hub/:campaign/:hubspotCompanyId',
to: 'revenue'
})),
Ru = C.a.createElement(v.Route, {
path: 'settings',
getComponent: XB(fN)
}, !yo.a.isFeatureActive('polls_pub_admin') && C.a.createElement(v.Route, {
path: 'moderators',
component: qs,
title: 'Moderator Settings'
}), C.a.createElement(v.Route, {
path: 'access',
component: Ru,
title: 'Restricted Words Settings'
})),
bp = C.a.createElement(v.Route, {
path: 'settings/polls',
getComponent: XB(Nc)
}, C.a.createElement(v.Route, {
path: 'general',
component: bp,
title: 'General Settings'
}), C.a.createElement(v.Route, {
path: 'pollsters',
component: To,
title: 'Poll Moderator Settings'
})),
To = C.a.createElement(v.Route, {
path: 'settings',
getComponent: az($w)
}, C.a.createElement(v.Route, {
path: 'revenue/hub/:campaign/:hubspotCompanyId',
title: 'Deactivate Reveal ads',
getComponent: ez(Pc)
})),
Dc = C.a.createElement(v.Route, {
path: 'internal/tools',
getComponent: az(qo)
}, C.a.createElement(v.Route, {
path: 'bulk',
component: Dc,
title: 'Bulk Actions Tool'
}), C.a.createElement(v.Route, {
path: 'onboarding/:tab',
component: Vi,
title: 'Onboarding Tool'
})),
Vi = C.a.createElement(v.Route, {
path: 'tools'
}, C.a.createElement(v.Route, {
path: 'onboarding/:tab',
getComponent: az(Vi),
title: 'Onboarding Tool'
}), C.a.createElement(v.Route, {
path: 'exception',
getComponent: az(Vi),
title: 'Exception Tool'
})),
I = C.a.createElement(v.Route, {
path: 'moderate(/:tab)(/filter/:filter)(/search/:search)',
getComponent: az(fN)
}, C.a.createElement(v.IndexRoute, {
component: I,
title: 'Moderate'
})),
Ph = C.a.createElement(v.Route, {
path: 'create',
getComponent: az(Ph)
}, C.a.createElement(v.IndexRoute, {
component: Ap,
title: 'Register Site'
})),
Ap = C.a.createElement(v.Route, {
path: 'settings',
getComponent: XB($w)
}, C.a.createElement(v.Route, {
path: 'revenue/hub/',
component: Pc,
title: 'Deactivate Reveal ads'
})),
Pc = C.a.createElement(v.Route, {
path: 'discussions',
getComponent: XB(fN)
}, C.a.createElement(v.IndexRoute, {
component: rc,
title: 'Edit Discussions'
}), C.a.createElement(v.Route, {
path: 'migrate',
getComponent: JB(function () {
n.e(0).then(n.bind(null, 527)).then(function (e) {
e.default.migrate.init()
})
}),
title: 'Migrate Discussions'
}), C.a.createElement(v.Route, {
path: 'history',
getComponent: JB(function () {
window.document.querySelectorAll('.paging a').forEach(function (e) {
e.className += ' btn'
}),
window.document.querySelectorAll('.paging span').forEach(function (e) {
e.className += ' btn',
e.setAttribute('disabled', 'disabled')
})
}),
title: 'Discussions History'
}), C.a.createElement(v.Route, {
path: 'import/platform/blogger',
getComponent: JB(function () {
n.e(0).then(n.bind(null, 527)).then(function (e) {
e.default.importexport.bloggerSync(pt.a.bloggerSyncOauthUrl)
})
}),
title: 'Import Discussions'
}), C.a.createElement(v.Route, {
path: 'export',
getComponent: JB(function () {
n.e(0).then(n.bind(null, 527)).then(function (e) {
e.default.importexport.init()
})
}),
title: 'Import Discussions'
})),
rc = function (e) {
return C.a.createElement(lU, e, C.a.createElement(YU, null))
},
so = C.a.createElement(u.Provider, {
store: o
}, C.a.createElement(v.Router, {
history: Uc,
onUpdate: function () {
j.a.updateTitle(this.state, 'title', 'Disqus Admin'),
this.router.isActive('/install/platforms/') && window.scrollTo(0, 0)
}
}, C.a.createElement(v.Route, {
path: '/',
component: t
}, C.a.createElement(v.IndexRoute, {
component: Mo,
title: 'Start'
}), C.a.createElement(v.Route, {
path: '(orgs/:id/:name)'
}, C.a.createElement(v.IndexRoute, {
getComponent: az(Mo),
title: 'Start'
}), I, C.a.createElement(v.Route, {
path: 'analytics/top_comments',
title: 'Top Comments',
getComponent: az(function (e) {
return C.a.createElement(WA, e, C.a.createElement(qm, null))
})
}), C.a.createElement(v.Route, {
path: 'analytics/revenue',
title: 'Revenue',
getComponent: nz(function (e) {
return C.a.createElement($w, e, C.a.createElement(mm, null))
})
}), C.a.createElement(v.Route, {
path: 'analytics/comments',
title: 'Analytics Overview',
getComponent: function (e, t) {
return (WB.organization && (YB[WB.organization.id] || {
}).advancedAnalytics ? XB(oz) : nz(rz)) (e, t)
}
}), C.a.createElement(v.Route, {
path: 'settings/general',
title: 'General Settings',
getComponent: nz(function (e) {
return C.a.createElement(ib, e, C.a.createElement(Wv, null))
}, function (e) {
return C.a.createElement(AO, e, C.a.createElement(yS, null))
})
}), C.a.createElement(v.Route, {
path: 'setup',
title: 'Setup',
getComponent: nz(Yc)
}), s, To, ac, qn, bl, Ru, Ap, Pc, C.a.createElement(v.Route, {
path: 'analytics/payments',
title: 'Payments',
getComponent: XB(function (e) {
return C.a.createElement($w, e, C.a.createElement(Bw, null))
})
}), C.a.createElement(v.Route, {
path: 'analytics',
component: WA
}, C.a.createElement(v.Route, {
path: 'content',
title: 'Content Analysis',
getComponent: XB(a)
}), C.a.createElement(v.Route, {
path: 'audience',
title: 'Audience Analysis',
getComponent: XB(function (e) {
return C.a.createElement(IA, e, C.a.createElement(rT, null))
})
}), C.a.createElement(v.Route, {
path: 'reactions',
title: 'Reactions Analysis',
getComponent: XB(function (e) {
return C.a.createElement(qA, e, C.a.createElement(VT, null))
})
}), C.a.createElement(v.Route, {
path: 'pulse',
title: 'Attention Analytics',
getComponent: XB(Ls)
})), Ds, Ph, Dc, Vi, yo.a.isFeatureActive('polls_pub_admin') && C.a.createElement(C.a.Fragment, null, C.a.createElement(v.Redirect, {
path: 'polls',
to: 'polls/list/'
}), C.a.createElement(v.Redirect, {
path: 'settings/polls',
to: 'settings/polls/general/'
}), C.a.createElement(v.Route, {
path: 'polls/list',
title: 'My Polls',
getComponent: XB(function (e) {
return C.a.createElement(lU, e, C.a.createElement(cM, null))
})
}), C.a.createElement(v.Route, {
path: 'polls/editor/new/',
title: 'Polls Editor - New Poll',
getComponent: XB(rc)
}), C.a.createElement(v.Route, {
path: 'polls/editor/(:pollId)',
title: 'Polls Editor',
getComponent: XB(rc)
}), bp, C.a.createElement(v.Route, {
path: 'polls/insights/(:pollId)',
title: 'Polls Insights',
getComponent: XB(function (e) {
return C.a.createElement(lU, e, C.a.createElement(xB, null))
})
})), C.a.createElement(v.Route, {
path: 'checkout',
getComponent: az(Io),
title: 'Checkout'
})), C.a.createElement(v.Route, {
path: 'acknowledge',
getComponent: XB(Ni),
title: 'Confirm your Plan'
}), C.a.createElement(v.Redirect, {
path: 'analytics/overview',
to: '/analytics/comments/'
}), C.a.createElement(v.Redirect, {
path: 'orgs/:id/:name/analytics/overview',
to: '/orgs/:id/:name/analytics/comments/'
}), C.a.createElement(v.Redirect, {
from: 'create/*',
to: '/'
}), C.a.createElement(v.Redirect, {
from: 'install/*',
to: '/install/'
}), C.a.createElement(v.Route, {
path: '(internal/)tools/*',
component: go,
title: 'Page Not Found'
}), C.a.createElement(v.Route, {
path: '*',
getComponent: $B(),
title: so
}))));
f() (d.a.loadCSS('//c.disquscdn.com/next/current/publisher-admin/css/main.css'), l.a.render.bind(l.a, so, Fo))
},
265: function (e, t, n) {
'use strict';
var a = {
updateTitle: function (e, t, n) {
t = (e = e.routes) [e.length - 1][t],
n = n ? ' - '.concat(n) : '';
window.document.title = ''.concat(t).concat(n)
}
};
e.exports = a
},
268: function (e, t, n) {
t = function () {
'use strict';
return {
isIE: function () {
return !!window.document.documentMode
},
isSafari: function () {
var e = window.navigator.userAgent.toLowerCase();
return !!~e.indexOf('safari') && !~e.indexOf('chrome')
},
isFirefox: function () {
var e = window.navigator.userAgent.toLowerCase();
return !!~e.indexOf('firefox') && !~e.indexOf('chrome')
},
isChrome: function () {
var e = window.navigator.userAgent.toLowerCase();
return !!~e.indexOf('crios') || !!window.chrome && 'Google Inc.' === window.navigator.vendor && void 0 === window.opr && !~e.indexOf('edge')
},
isEdge: function () {
return !!~window.navigator.userAgent.toLowerCase().indexOf('edge')
},
isOpera: function () {
var e = window.navigator.userAgent.toLowerCase();
return !!~e.indexOf('opera') || !!~e.indexOf('opr')
},
isCrawler: function (e) {
return void 0 === e && (e = window),
/bot|crawl|slurp|spider|facebookexternalhit|embedly|feedly|pinterest/i.test(e.navigator.userAgent)
}
}
}.apply(t, [
]);
void 0 === t || (e.exports = t)
},
269: function (e, t, n) {
var a = function () {
'use strict';
return function (e) {
return e = e || window,
/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/i.test(e.navigator.userAgent || e.navigator.vendor || e.opera)
}
}();
e.exports = a
},
270: function (e, t, n) {
!function (e) {
'use strict';
var t = n(145);
e.exports = function (e) {
var n = [
];
return t(e, function (e, t) {
void 0 !== e && n.push(encodeURIComponent(t) + (null === e ? '' : '=' + encodeURIComponent(e)))
}),
n.join('&')
}
}(e)
},
271: function (e, t, n) {
var a = function () {
'use strict';
return function (e, t) {
return Object.prototype.hasOwnProperty.call(e, t)
}
}();
e.exports = a
},
272: function (e, t, n) {
'use strict';
t = function () {
return {
jester: 'https://referrer.disqus.com/juggler'
}
}.apply(t, [
]);
void 0 === t || (e.exports = t)
},
273: function (e, t, n) {
'use strict';
var n = [
n(25),
n(7),
n(61),
n(51)
],
n = function (S, w, e, t) {
var P = this,
k = e.gettext,
N = t.LIST_TYPES,
C = t.BAN_TYPES,
R = t.RETROACTIVE_ACTION_TYPES,
x = [
{
label: k('1 day'),
durationHours: '24'
},
{
label: k('1 week'),
durationHours: '168'
},
{
label: k('2 weeks'),
durationHours: '336'
}
];
return function (e) {
var t = e.user,
n = e.listName,
a = e.ipAddress,
r = e.formValues,
o = e.supportsShadowBanning,
i = e.supportsTempBanning,
s = e.selectRetroactiveAction,
l = e.toggleBanTypeCallback,
c = e.toggleUserValueChecked,
u = e.toggleIpAddressChecked,
p = e.updateDuration,
d = e.updateCustomDurationAmount,
m = e.updateCustomDurationScale,
f = e.updateReason,
h = e.handleSubmit,
g = e.handleClose,
y = e.handleChangeValue,
b = e.closeText,
v = e.getPlaceholderForValue,
_ = e.itemTypes,
E = e.itemType,
O = e.UpgradeIcon,
e = e.itemValue;
return n ? S.createElement('form', {
className: ''.concat(n, '-form')
}, S.createElement('div', {
className: 'admin-modal__content padding-bottom'
}, S.createElement('div', null, n === N.WHITELIST ? S.createElement('p', {
className: 'spacing-default'
}, k('Adding this person to the whitelist will automatically approve his or her new comments from now on.')) : S.createElement('div', {
className: 'align align--stretch align--wrap'
}, S.createElement('label', {
className: [
'padding-default align align__item--grow align__item--equal align--center align--column modal__option ban__option',
i ? null : '-disabled',
r.type === C.TEMP ? '-selected' : null
].join(' ')
}, S.createElement('input', {
type: 'radio',
name: 'ban_type',
value: C.TEMP,
checked: r.type === C.TEMP,
onChange: l,
disabled: !i
}), S.createElement('p', {
className: 'text-semibold text-center modal__option-text ban__option-text'
}, k('Timeout'), i ? null : S.createElement(O, {
tooltipClass: 'tooltip-timeout'
}))), n === N.BLACKLIST && r.type === C.TEMP ? S.createElement('div', {
className: 'padding-default modal__description ban__description border-bottom-dark'
}, S.createElement('div', {
className: 'text-small modal__option-subtext ban__option-subtext'
}, k('Restrict a user\'s ability to comment for a period of time. This notifies the user of their timeout. If discussions get heated, enforce timeouts so that users cool off and improve their behavior.'), x.map(function (e) {
return S.createElement('label', {
className: 'fieldset__block--checkbox text-medium spacing-bottom-small text-semibold text-gray-dark',
key: e.durationHours
}, S.createElement('input', {
type: 'radio',
name: 'duration',
checked: r.durationHours === e.durationHours,
onChange: p,
value: e.durationHours,
className: 'spacing-right-small'
}), e.label)
}), S.createElement('div', null, S.createElement('label', {
className: 'text-medium spacing-bottom-small inline__item spacing-right text-semibold text-gray-dark'
}, S.createElement('input', {
type: 'radio',
name: 'duration',
checked: 'custom' === r.durationHours,
onChange: p,
value: 'custom',
className: 'spacing-right-small'
}), k('Custom')), S.createElement('input', {
name: 'customDurationAmount',
type: 'number',
value: r.customDurationAmount,
onChange: d,
onFocus: d,
onKeyPress: d,
className: 'spacing-right-small -text-small',
maxLength: '2',
style: {
width: '50px'
},
min: '0'
}), S.createElement('select', {
value: r.customDurationScale,
onChange: m
}, S.createElement('option', {
value: '1'
}, 'Hour(s)'), S.createElement('option', {
value: '24'
}, 'Day(s)'), S.createElement('option', {
value: '168'
}, 'Week(s)'))))) : null, S.createElement('label', {
className: [
'padding-default align align__item--grow align__item--equal align--center align--column modal__option ban__option',
o ? null : '-disabled',
r.type === C.SHADOW ? '-selected' : null
].join(' ')
}, S.createElement('input', {
type: 'radio',
name: 'ban_type',
value: C.SHADOW,
checked: r.type === C.SHADOW,
onChange: l,
disabled: !o
}), S.createElement('p', {
className: 'text-semibold text-center modal__option-text ban__option-text'
}, k('Shadow Ban'), o ? null : S.createElement(O, null))), n === N.BLACKLIST && r.type === C.SHADOW ? S.createElement('div', {
className: 'modal__description ban__description border-bottom-dark'
}, S.createElement('p', {
className: 'text-small modal__option-subtext ban__option-subtext'
}, k('Ban a user without them knowing. The user can still comment, however, their posts will only be visible to themselves. Use it against trolls and spammers who attempt to circumvent a ban with new accounts.'))) : null, S.createElement('label', {
className: [
'padding-default align align__item--grow align__item--equal align--center align--column modal__option ban__option',
r.type === C.PERMANENT ? '-selected' : null
].join(' ')
}, S.createElement('input', {
type: 'radio',
name: 'ban_type',
value: C.PERMANENT,
checked: r.type === C.PERMANENT,
onChange: l
}), S.createElement('p', {
className: 'text-semibold text-center modal__option-text ban__option-text'
}, 'Permanent Ban')), n === N.BLACKLIST && r.type === C.PERMANENT ? S.createElement('div', {
className: 'modal__description ban__description border-bottom-dark'
}, S.createElement('p', {
className: 'text-small modal__option-subtext ban__option-subtext'
}, k('Permanently ban the user so they can no longer post, vote, or flag comments on your site. If the user repeatedly violates your comment policy, revoke their ability to participate.'), S.createElement('label', {
className: 'fieldset__block--checkbox text-medium spacing-bottom-small'
}, S.createElement('span', {
className: 'text-semibold text-gray-dark'
}, k('Last 30 days of comments:'), ' '), S.createElement('select', {
value: r.retroactiveAction,
onChange: s,
className: 'custom-select'
}, S.createElement('option', {
value: R.DO_NOTHING
}, k('Do nothing')), S.createElement('option', {
value: R.DELETE
}, k('Delete')), S.createElement('option', {
value: R.MARK_AS_SPAM
}, k('Mark as spam')))))) : null)), S.createElement('div', {
className: 'padding-default modal__config ban__config'
}, !t || t.isAnonymous ? null : S.createElement('div', {
className: 'align align--stretch access__block spacing-bottom embed-hidden'
}, S.createElement('a', {
href: t.profileUrl,
className: 'spacing-right'
}, S.createElement('img', {
src: t.avatar.cache,
alt: t.name,
className: 'comment-__avatar border-radius-sm'
})), S.createElement('div', {
className: 'access__value'
}, S.createElement('h4', null, t.name), S.createElement('p', {
className: 'text-gray text-small'
}, ' ', t.username, ' '))), t ? S.createElement('label', {
className: 'fieldset__block--checkbox text-medium spacing-bottom-small'
}, S.createElement('input', {
type: 'checkbox',
checked: !!r.username,
onChange: w.partial(c, w, 'username'),
className: 'spacing-right-small'
}), k('User:'), ' ', ' ', S.createElement('strong', null, ' ', t.username, ' ')) : S.createElement(S.Fragment, null, S.createElement('div', {
className: 'spacing-top spacing-bottom form-attribute-input'
}, S.createElement('div', null, S.createElement('h3', {
className: 'text-gray-darker'
}, 'Type')), S.createElement('select', {
name: 'itemType',
className: 'input--select',
value: P.itemType,
onChange: y,
disabled: _.length <= 1
}, _.map(function (e) {
return S.createElement('option', {
key: e.value,
value: e.value
}, ' ', e.displayName, ' ')
}))), S.createElement('div', {
className: 'spacing-top spacing-bottom form-attribute-input'
}, S.createElement('h3', {
className: 'text-gray-darker'
}, 'Value'), S.createElement('div', null, S.createElement('input', {
className: 'input--textbox',
name: 'itemValue',
type: 'text',
placeholder: v(E),
value: e,
onChange: y
})))), t && n === N.BLACKLIST ? S.createElement('label', {
className: 'fieldset__block--checkbox text-medium spacing-bottom-small'
}, S.createElement('input', {
type: 'checkbox',
checked: !!r.email,
onChange: w.partial(c, w, 'email'),
className: 'spacing-right-small'
}), k('Email:'), ' ', S.createElement('strong', null, ' ', t.email, ' ')) : null, n === N.BLACKLIST && a ? S.createElement('label', {
className: 'fieldset__block--checkbox text-medium spacing-bottom-small'
}, S.createElement('input', {
type: 'checkbox',
checked: !!r.ipAddress,
onChange: u,
className: 'spacing-right-small'
}), k('IP Address:'), ' ', S.createElement('strong', null, ' ', a, ' '), S.createElement('div', {
className: 'spacing-default-narrow text-small text-gray spacing-left-large embed-hidden'
}, S.createElement('strong', null, k('Note:'), ' '), k('Adding an IP address to the banned list may also unintentionally block others who may share this IP address.'))) : null, n === N.BLACKLIST ? S.createElement('div', null, S.createElement('div', {
className: 'spacing-bottom-small spacing-top-narrow'
}, S.createElement('label', {
className: 'modal__reason ban__reason'
}, k('Reason for banning:'), S.createElement('input', {
name: 'reason',
type: 'text',
value: r.reason || '',
onChange: f,
className: 'input--textbox -text-small border-gray-light',
maxLength: '50'
}))), S.createElement('p', {
className: 'text-small modal__option-subtext ban__option-subtext'
}, k('You can remove the user from the banned list at any time.'))) : null)), S.createElement('div', {
className: 'admin-modal__footer clearfix'
}, S.createElement('div', null, S.createElement('button', {
className: 'button button-fill--brand button-small text-capitalized',
disabled: !(r.email || r.username || r.ipAddress || e),
onClick: h
}, k(n === N.WHITELIST ? 'Add to Trusted List' : 'Add to Banned List')), n === N.BLACKLIST ? S.createElement('button', {
className: 'button button-fill button-small text-capitalized',
onClick: g
}, k(b)) : null))) : null
}
}.apply(t, n);
void 0 === n || (e.exports = n)
},
275: function (e, t, n) {
'use strict';
var a = {
};
e.exports = a
},
276: function (e, t, n) {
'use strict';
function r(e) {
return (r = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function s(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function l(e, t) {
return (l = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function c(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = o(n);
return e = a ? (e = o(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== r(e) && 'function' != typeof e ? function (e) {
if (void 0 !== e) return e;
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called')
}(t) : e
}
}
function o(e) {
return (o = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
n = [
n(25),
n(26),
n(29),
n(277)
],
void 0 === (n = function (o, e, t, n) {
var i = Object.freeze({
admin: 'admin',
home: 'home',
marketing: 'marketing'
}),
a = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && l(e, t)
}(r, o.Component);
var e,
t,
n,
a = c(r);
function r() {
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
a.apply(this, arguments)
}
return e = r,
(t = [
{
key: 'render',
value: function () {
if (this.props.motdDismissed || !this.props.motdTitle || !this.props.motdUrl || !this.props.motdCTA) return null;
var e = 'motd-alert alert--';
return e += this.props.zone === i.marketing ? 'success-light' : 'brand',
this.props.isNewMotdBar && (e += ' motd-alert--updated'),
o.createElement('div', {
id: 'motd-bar',
className: e
}, o.createElement('div', {
className: this.props.isNewMotdBar ? '' : 'padding-default'
}, o.createElement('div', {
className: 'text-center'.concat(this.props.isNewMotdBar ? '' : ' spacing-narrow')
}, this.props.isNewMotdBar ? null : o.createElement('span', {
className: 'icon-megaphone icon__position spacing-right'
}), o.createElement(this.props.isNewMotdBar ? 'span' : 'strong', {
className: 'spacing-right'
}, this.props.motdTitle), o.createElement('a', {
href: this.props.motdUrl,
className: 'text-underline '.concat(this.props.isNewMotdBar ? 'motd-cta' : 'link-inverted-opaque text-semibold'),
target: '_blank',
rel: 'noopener noreferrer'
}, this.props.motdCTA), this.props.canDismiss ? o.createElement('button', {
className: 'link-inverted-opaque spacing-left-large',
onClick: this.props.motdOnDismiss
}, o.createElement('span', {
className: 'icon-cancel'
})) : null)))
}
}
]) && s(e.prototype, t),
n && s(e, n),
r
}();
return a.displayName = 'MotdBar',
a.propTypes = {
zone: e.oneOf(Object.keys(i)).isRequired,
motdUrl: e.string.isRequired,
motdTitle: e.string.isRequired,
motdCTA: e.string.isRequired,
motdOnDismiss: e.func.isRequired,
motdDismissed: e.bool,
canDismiss: e.bool,
isNewMotdBar: e.bool
},
a.defaultProps = {
zone: i.admin
},
t.attachDrivers(a, [
n
])
}.apply(t, n)) || (e.exports = n)
},
277: function (e, t, n) {
'use strict';
function r(e) {
return (r = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function c(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function u(e, t) {
return (u = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function p(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = o(n);
return e = a ? (e = o(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== r(e) && 'function' != typeof e ? d(t) : e
}
}
function d(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function o(e) {
return (o = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
n = [
n(25),
n(26),
n(29),
n(39),
n(8)
],
void 0 === (n = function (o, e, t, i, n) {
var s = n.lounge || {
},
l = 'motd',
n = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && u(e, t)
}(r, o.Component);
var e,
t,
n,
a = p(r);
function r(e) {
var t;
!function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
(t = a.call(this, e)).getDataForZone = t.getDataForZone.bind(d(t)),
t.handleDismiss = t.handleDismiss.bind(d(t)),
t.getComponentProps = t.getComponentProps.bind(d(t));
e = t.getDataForZone(t.props.zone);
return t.state = {
dismissed: !(!t.props.canDismiss || !i.get(l)) && i.get(l) [e.url],
url: e.url,
title: e.title,
cta: e.cta
},
t
}
return e = r,
(t = [
{
key: 'getDataForZone',
value: function (e) {
var t = s['motd_'.concat(e, '_url')];
return {
title: (s['motd_'.concat(e, '_title')] || '').replace('&', '&'),
url: t,
cta: (s['motd_'.concat(e, '_cta')] || '').replace('&', '&')
}
}
},
{
key: 'handleDismiss',
value: function () {
var e = this.getDataForZone(this.props.zone),
t = i.get(l) ? i.get(l) : {
};
t[e.url] = !0,
i.set(l, t),
this.setState({
dismissed: !0
})
}
},
{
key: 'getComponentProps',
value: function () {
return {
motdUrl: this.state.url,
motdTitle: this.state.title,
motdCTA: this.state.cta || 'Learn more »',
motdDismissed: this.state.dismissed,
motdOnDismiss: this.handleDismiss
}
}
}
]) && c(e.prototype, t),
n && c(e, n),
r
}();
return n.displayName = 'MotdDriver',
n.propTypes = {
zone: e.oneOf(['admin',
'home',
'marketing']).isRequired,
canDismiss: e.bool.isRequired
},
n.defaultProps = {
canDismiss: !0
},
t.createDriver(n)
}.apply(t, n)) || (e.exports = n)
},
278: function (e, t, n) {
'use strict';
function a(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
n = [
t,
n(33)
],
void 0 === (n = function (e, t) {
var n;
e.DISPLAY_SUBSCRIPTIONS_PACKAGES_FEATURES = (a(n = {
}, t.DISQUS_PLUS_PACKAGE_ID, [
'1',
'-14'
]), a(n, t.DISQUS_PRO_PACKAGE_ID, [
'1',
'-18',
'2',
'10',
'3',
'14',
'15',
'19',
'4'
]), a(n, t.DISQUS_BUSINESS_PACKAGE_ID, [
'6',
'5',
'-13',
'-11',
'-3',
'-20'
]), a(n, t.DISQUS_BASIC_PACKAGE_ID, [
'-34',
'-14'
]), n),
e.DISPLAY_SUBSCRIPTIONS_PACKAGES_FEATURES_ALT = (a(n = {
}, t.DISQUS_PLUS_PACKAGE_ID, [
'-22',
'-23',
'-29',
'-30'
]), a(n, t.DISQUS_PRO_PACKAGE_ID, [
'-31',
'-32',
'4',
'-33',
'3'
]), a(n, t.DISQUS_BUSINESS_PACKAGE_ID, [
'6',
'-3',
'5',
'-13',
'-27'
]), a(n, t.DISQUS_BASIC_PACKAGE_ID, [
'-34',
'-14'
]), n),
e.DISPLAY_POLLS_SUBSCRIPTIONS_PACKAGES_FEATURES = (a(e = {
}, t.DISQUS_POLLS_PRO_PACKAGE_ID, [
'-35',
'-36',
'-37',
'4'
]), a(e, t.DISQUS_POLLS_BUSINESS_PACKAGE_ID, [
'6',
'-39',
'-38',
'-40'
]), a(e, t.DISQUS_POLLS_ADS_SUPPORTED_PACKAGE_ID, [
'-34',
'-14'
]), e)
}.apply(t, n)) || (e.exports = n)
},
279: function (e, t, n) {
'use strict';
function r(e) {
return (r = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function s(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function l(e, t) {
return (l = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function c(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = o(n);
return e = a ? (e = o(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== r(e) && 'function' != typeof e ? u(t) : e
}
}
function u(e) {
if (void 0 === e) throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
return e
}
function o(e) {
return (o = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
n = [
n(25),
n(26),
n(73)
],
void 0 === (n = function (o, e, i) {
var t = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && l(e, t)
}(r, o.Component);
var e,
t,
n,
a = c(r);
function r(e) {
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
(e = a.call(this, e)).handleToggleDropdown = e.handleToggleDropdown.bind(u(e)),
e.handleKeyDown = e.handleKeyDown.bind(u(e)),
e.listenToKeyDown = e.listenToKeyDown.bind(u(e)),
e
}
return e = r,
(t = [
{
key: 'componentDidMount',
value: function () {
this.props.isOpen && this.listenToKeyDown(!0)
}
},
{
key: 'componentWillUnmount',
value: function () {
this.listenToKeyDown(!1)
}
},
{
key: 'componentWillReceiveProps',
value: function (e) {
this.props.isOpen !== e.isOpen && this.listenToKeyDown(e.isOpen)
}
},
{
key: 'listenToKeyDown',
value: function (e) {
e ? window.document.addEventListener('keydown', this.handleKeyDown) : window.document.removeEventListener('keydown', this.handleKeyDown)
}
},
{
key: 'handleToggleDropdown',
value: function () {
this.props.isOpen ? this.props.onClose() : this.props.onOpen()
}
},
{
key: 'handleKeyDown',
value: function (e) {
27 === e.keyCode && this.props.onClose()
}
},
{
key: 'render',
value: function () {
return o.createElement(i, {
active: this.props.isOpen,
onOutsideClick: this.props.onClose,
className: (this.props.dropdownClassName || 'dropdown') + (this.props.isOpen ? ' open' : '')
}, o.createElement('button', {
onClick: this.handleToggleDropdown,
className: this.props.className || 'dropdown-toggle'
}, this.props.buttonChildren), this.props.children)
}
}
]) && s(e.prototype, t),
n && s(e, n),
r
}();
return t.displayName = 'DropdownStateless',
t.propTypes = {
className: e.string,
dropdownClassName: e.string,
children: e.node.isRequired,
buttonChildren: e.node.isRequired,
onOpen: e.func.isRequired,
onClose: e.func.isRequired,
isOpen: e.bool.isRequired
},
t
}.apply(t, n)) || (e.exports = n)
},
28: function (e, t, n) {
var n = [
n(37),
n(7),
n(65),
n(35),
n(60)
],
n = function (n, r, e, a, o) {
'use strict';
var t = window.document.createElement('a');
function i(e) {
return t.href = e,
t.origin || t.protocol + '//' + t.hostname + (t.port ? ':' + t.port : '')
}
var s = {
};
function l(e) {
return e.replace(/^(http:)?\/\//, 'https://')
}
function c(e) {
(e = r.defaults(e, s)).traditional = !0,
i(window.location.href) !== i(e.url) && (e.xhrFields = {
withCredentials: !0
}),
e.omitDisqusApiKey || (e.data = e.data || {
}, window.FormData && e.data instanceof window.FormData ? e.url = o.serialize(e.url, {
api_key: a.keys.api
}) : e.data.api_key = a.keys.api);
var t = e.error;
return e.error = function (e) {
p.trigger('error', e),
r.isFunction(t) && t(e)
},
n.ajax(e)
}
function u(e) {
return /(https?:)?\/\//.test(e) ? l(e) : a.urls.api + e
}
var p = {
ERROR_CODES: {
OBJ_NOT_FOUND: 8,
MAX_ITEMS_REACHED: 24
},
ajax: c,
call: function (e, t) {
return (t = t || {
}).url = u(e),
t.omitDisqusApiKey || (t.data = r.extend(t.data || {
}, {
api_key: a.keys.api
})),
p.trigger('call', t),
c(t).always(r.bind(this.trigger, this, 'complete', t))
},
getURL: u,
defaults: function (a) {
Object.keys(a).forEach(function (e) {
var t = a[e],
n = s[e];
r.isObject(t) && r.isObject(n) ? r.extend(n, t) : s[e] = t
})
},
headers: function (e) {
e = r.extend({
}, s.headers, e);
return s.headers = r.pick(e, Boolean),
s.headers
},
makeHttps: l
};
return r.extend(p, e.Events),
p
}.apply(t, n);
void 0 === n || (e.exports = n)
},
29: function (e, t, n) {
'use strict';
function r(e) {
return (r = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? function (e) {
return typeof e
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? 'symbol' : typeof e
}) (e)
}
function c(e, t) {
for (var n = 0; n < t.length; n++) {
var a = t[n];
a.enumerable = a.enumerable || !1,
a.configurable = !0,
'value' in a && (a.writable = !0),
Object.defineProperty(e, a.key, a)
}
}
function u(e, t) {
return (u = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t,
e
}) (e, t)
}
function p(n) {
var a = function () {
if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ('function' == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [
], function () {
})),
!0
} catch (e) {
return !1
}
}();
return function () {
var e,
t = o(n);
return e = a ? (e = o(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments),
t = this,
!(e = e) || 'object' !== r(e) && 'function' != typeof e ? function (e) {
if (void 0 !== e) return e;
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called')
}(t) : e
}
}
function o(e) {
return (o = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
}) (e)
}
n = [
n(7),
n(25),
n(27)
],
void 0 === (n = function (s, l, a) {
function n(e, t, n) {
return s.isArray(e) && (e = s.chain(e[1]).map(function (t) {
return s.findIndex(n, function (e) {
return s.isArray(e) ? e[0].driverName === t.driverName : e.driverName === t.driverName
})
}).map(function (e) {
return - 1 < e ? e : t
}).min().value()) < t ? e - 1 : t
}
function r(t, e, n) {
return s.findLastIndex(n, function (e) {
return t.driverName === e.driverName
}) !== e
}
function o(e, t) {
return t(e)
}
function i(t, e) {
e.forEach(function (e) {
t.propTypes = s.extend({
}, e.propTypes, t.propTypes)
})
}
return {
createDriver: function (i, t, n) {
function e(o) {
var e = s.isFunction(i) ? ((e = function () {
!function (e, t) {
if ('function' != typeof t && null !== t) throw new TypeError('Super expression must either be null or a function');
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}),
t && u(e, t)
}(r, i);
var e,
t,
n,
a = p(r);
function r() {
return function (e, t) {
if (!(e instanceof t)) throw new TypeError('Cannot call a class as a function')
}(this, r),
a.apply(this, arguments)
}
return e = r,
(t = [
{
key: 'render',
value: function () {
var e = s.extend({
}, this.props, this.getComponentProps());
return l.createElement(o, e)
}
}
]) && c(e.prototype, t),
n && c(e, n),
r
}()).displayName = ''.concat(o.displayName, ':').concat(i.displayName), e) : l.createClass(s.extend({
}, i, {
displayName: ''.concat(o.displayName, ':').concat(i.displayName),
render: function () {
var e = s.extend({
}, this.props, this.getComponentProps());
return l.createElement(o, e)
}
}));
return t || n ? a.connect(t, n) (e) : e
}
return e.driverName = i.displayName,
e.isDriver = !0,
e
},
attachDrivers: function (e, t) {
return e.isDriver ? [
e,
t
] : s.chain(t).sortBy(n).flatten().reject(r).tap(s.partial(i, e)).reduce(o, e).value()
}
}
}.apply(t, n)) || (e.exports = n)
},
317: function (e, t, n) {
'use strict';
var n = [
n(25),
n(34)
],
n = function (r, o) {
return function (e) {
var t = e.forum,
n = e.isVerified,
a = e.onDismiss;
return r.createElement('div', {
className: 'newsletter-box spacing-bottom-large text-center'
}, r.createElement('div', {
className: o.isFeatureActive('embed_refresh', {
forum: t.name
}) ? 'text-large spacing-bottom-small' : 'text-medium spacing-bottom-small'
}, r.createElement('strong', null, 'Thanks for subscribing!')), n ? r.createElement('div', {
className: 'spacing-bottom-small'
}, (t.aetBannerConfirmation || '').split('\n').map(function (e, t) {
return r.createElement('div', {
key: t
}, e)
})) : r.createElement('div', {
className: 'spacing-bottom-small'
}, 'To begin receiving email updates from ', t.name, ', please click the link in the confirmation email we\'ve sent to your inbox.'), r.createElement('a', {
className: 'newsletter-box__hide',
href: '#',
onClick: function (e) {
e.preventDefault(),
a()
}
}, 'Dismiss this message'))
}
}.apply(t, n);
void 0 === n || (e.exports = n)
},
318: function (e, t, n) {
'use strict';
var n = [
n(25),
n(61),
n(34)
],
n = function (s, e, l) {
var c = e.gettext;
return function (e) {
var t = e.forum,
n = e.isLoading,
a = e.isLoggedIn,
r = e.onDismiss,
o = e.onSubscribe,
i = e.allowEmpty;
return s.createElement('div', {
className: 'newsletter-box spacing-bottom-large'
}, s.createElement('div', {
className: l.isFeatureActive('embed_refresh', {
forum: t.name
}) ? 'text-large spacing-bottom-small' : 'text-medium spacing-bottom-small'
}, s.createElement('strong', null, t.aetBannerTitle)), a ? s.createElement('button', {
className: 'button button-fill--brand button-padding-wider pull-right',
disabled: n,
onClick: function () {
o && o()
}
}, 'Subscribe') : null, s.createElement('div', {
className: 'spacing-bottom'
}, (t.aetBannerDescription || '').split('\n').map(function (e, t) {
return s.createElement('div', {
key: t
}, e)
})), s.createElement('div', {
className: 'align align--wrap'
}, a ? null : s.createElement('form', {
className: 'align__item--grow',
onSubmit: function (e) {
e.preventDefault();
e = e.target.elements.email.value.trim();
(e || i) && o && o(e)
}
}, s.createElement('div', {
className: 'newsletter-box__input-group'
}, s.createElement('span', {
className: 'icon icon-mail text-large newsletter-box__input-group__icon'
}), s.createElement('input', {
type: 'email',
name: 'email',
placeholder: c('Enter email address'),
'aria-label': 'Enter your email address here to opt into receiving a weekly digest of the latest articles from this publisher'
})), s.createElement('input', {
type: 'submit',
className: 'button button-fill--brand button-padding-wider newsletter-box__submit',
disabled: n,
value: c('Subscribe'),
'aria-label': 'Submit your email address'
})), s.createElement('a', {
href: '#',
className: 'newsletter-box__hide publisher-anchor-color',
onClick: function (e) {
e.preventDefault(),
r && r()
}
}, c('Hide this message'))))
}
}.apply(t, n);
void 0 === n || (e.exports = n)
},
32: function (e, t, n) {
'use strict';
function o() {
return (o = Object.assign || function (e) {
for (var t = 1; t < arguments.length; t++) {
var n,
a = arguments[t];
for (n in a) Object.prototype.hasOwnProperty.call(a, n) && (e[n] = a[n])
}
return e
}).apply(this, arguments)
}
function i(e, t) {
if (null == e) return {
};
var n,
a = function (e, t) {
if (null == e) return {
};
var n,
a,
r = {
},
o = Object.keys(e);
for (a = 0; a < o.length; a++) ~t.indexOf(n = o[a]) || (r[n] = e[n]);
return r
}(e, t);
if (Object.getOwnPropertySymbols) for (var r = Object.getOwnPropertySymbols(e), o = 0; o < r.length; o++) ~t.indexOf(n = r[o]) || Object.prototype.propertyIsEnumerable.call(e, n) && (a[n] = e[n]);
return a
}
n = [
n(25),
n(26),
n(49)
],
void 0 === (n = function (r, t, n) {
return function (a) {
function e(e, t) {
var n = t.router,
t = e.wrappedComponentRef,
e = i(e, [
'wrappedComponentRef'
]);
return r.createElement(a, o({
}, e, {
history: n,
ref: t
}))
}
return e.displayName = 'withRouter('.concat(a.displayName || a.name, ')'),
e.WrappedComponent = a,
e.contextTypes = {
router: n.routerShape.isRequired
},
e.propTypes = {
wrappedComponentRef: t.func
},
e
}
}.apply(t, n)) || (e.exports = n)
},
33: function (e, t, n) {
'use strict';
function a(t, e) {
var n,
a = Object.keys(t);
return Object.getOwnPropertySymbols && (n = Object.getOwnPropertySymbols(t), e && (n = n.filter(function (e) {
return Object.getOwnPropertyDescriptor(t, e).enumerable
})), a.push.apply(a, n)),
a
}
function r(t) {
for (var e = 1; e < arguments.length; e++) {
var n = null != arguments[e] ? arguments[e] : {
};
e % 2 ? a(Object(n), !0).forEach(function (e) {
o(t, e, n[e])
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : a(Object(n)).forEach(function (e) {
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(n, e))
})
}
return t
}
function o(e, t, n) {
return t in e ? Object.defineProperty(e, t, {
value: n,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = n,
e
}
n = [
t,
n(26)
],
void 0 === (n = function (e, n) {
e.SAAS_PRODUCT_COMMENTS = 'comments',
e.SAAS_PRODUCT_POLLS = 'polls',
e.SAAS_PRODUCT_PLAN_CANCELLED_STATUS = 'canceled',
e.SAAS_PRODUCT_PLAN_ACTIVE_STATUS = 'active',
e.SAAS_PRODUCT_PLAN_TRIALING_STATUS = 'trialing',
e.SAAS_PRODUCT_PLAN_PAST_DUE_STATUS = 'past_due',
e.SAAS_PRODUCT_PLAN_UNPAID_STATUS = 'unpaid',
e.SAAS_PRODUCT_PLANS = [
e.SAAS_PRODUCT_PLAN_CANCELLED_STATUS,
e.SAAS_PRODUCT_PLAN_ACTIVE_STATUS,
e.SAAS_PRODUCT_PLAN_TRIALING_STATUS,
e.SAAS_PRODUCT_PLAN_PAST_DUE_STATUS
],
e.SAAS_PRODUCT_PLAN_ACTIVE_STATUSES_SET = new Set([e.SAAS_PRODUCT_PLAN_ACTIVE_STATUS,
e.SAAS_PRODUCT_PLAN_TRIALING_STATUS,
e.SAAS_PRODUCT_PLAN_PAST_DUE_STATUS]),
e.DISQUS_BASIC_PACKAGE_ID = - 10,
e.DISQUS_PLUS_PACKAGE_ID = 1,
e.DISQUS_PLUS_FREE_PACKAGE_ID = 4,
e.DISQUS_BUSINESS_PACKAGE_ID = 2,
e.DISQUS_PRO_PACKAGE_ID = 3,
e.DISQUS_PREFERRED_CUSTOMER_PACKAGE_ID = 5,
e.DISQUS_BASIC_PLAN_ID = 'basic__plan',
e.DISQUS_PLUS_PLAN_ID = 'plus',
e.DISQUS_PLUS_ANNUAL_PLAN_ID = 'plus-yearly',
e.DISQUS_PLUS_2021_PLAN_ID = 'plus-2021',
e.DISQUS_PLUS_ANNUAL_2021_PLAN_ID = 'plus-yearly-2021',
e.DISQUS_PLUS_100K_PLAN_ID = 'plus-100k-monthly',
e.DISQUS_PLUS_100K_YEARLY_PLAN_ID = 'plus-100k-yearly',
e.DISQUS_PLUS_350K_PLAN_ID = 'plus-350k-monthly',
e.DISQUS_PLUS_350K_YEARLY_PLAN_ID = 'plus-350k-yearly',
e.DISQUS_PLUS_900K_PLAN_ID = 'plus-900k-monthly',
e.DISQUS_PLUS_900K_YEARLY_PLAN_ID = 'plus-900k-yearly',
e.DISQUS_PLUS_FREE_PLAN_ID = 'non-commercial-free',
e.DISQUS_PRO_PLAN_ID = 'pro',
e.DISQUS_PRO_ANNUAL_PLAN_ID = 'pro-yearly',
e.DISQUS_PRO_2021_PLAN_ID = 'pro-2021',
e.DISQUS_PRO_ANNUAL_2021_PLAN_ID = 'pro-yearly-2021',
e.DISQUS_PRO_1M_PLAN_ID = 'pro-1m-monthly',
e.DISQUS_PRO_1M_YEARLY_PLAN_ID = 'pro-1m-yearly',
e.DISQUS_PRO_2_5M_PLAN_ID = 'pro-2_5m-monthly',
e.DISQUS_PRO_2_5M_YEARLY_PLAN_ID = 'pro-2_5m-yearly',
e.DISQUS_PRO_5M_PLAN_ID = 'pro-5m-monthly',
e.DISQUS_PRO_5M_YEARLY_PLAN_ID = 'pro-5m-yearly',
e.DISQUS_BUSINESS_PLAN_ID = 'business',
e.DISQUS_POLLS_PRO_PACKAGE_ID = 6,
e.DISQUS_POLLS_BUSINESS_PACKAGE_ID = 7,
e.DISQUS_POLLS_AD_SUPPORTED_PACKAGE_ID = 8,
e.DISQUS_POLLS_AD_SUPPORTED_PLAN_ID = 'polls-ad-supported',
e.DISQUS_POLLS_PRO_250K_PLAN_ID = 'polls-pro-250k-monthly',
e.DISQUS_POLLS_PRO_ANNUAL_250K_PLAN_ID = 'polls-pro-250k-yearly',
e.DISQUS_POLLS_PRO_1_5M_PLAN_ID = 'polls-pro-1_5m-monthly',
e.DISQUS_POLLS_PRO_1_5M_YEARLY_PLAN_ID = 'polls-pro-1_5m-yearly',
e.DISQUS_POLLS_PRO_3M_PLAN_ID = 'polls-pro-3m-monthly',
e.DISQUS_POLLS_PRO_3M_YEARLY_PLAN_ID = 'polls-pro-3m-yearly',
e.DISQUS_POLLS_PRO_10M_PLAN_ID = 'polls-pro-10m-monthly',
e.DISQUS_POLLS_PRO_10M_YEARLY_PLAN_ID = 'polls-pro-10m-yearly',
e.DISQUS_POLLS_BUSINESS_PLAN_ID = 'polls-business',
e.PAYMENT_INTERVAL = {
month: 'monthly',
year: 'annual'
},
e.OLD_PLAN_IDS = [
e.DISQUS_PLUS_PLAN_ID,
e.DISQUS_PLUS_ANNUAL_PLAN_ID,
e.DISQUS_PRO_PLAN_ID,
e.DISQUS_PRO_ANNUAL_PLAN_ID
],
e.PLUS_MONTHLY_SLIDER_PLAN_IDS = [
e.DISQUS_PLUS_100K_PLAN_ID,
e.DISQUS_PLUS_350K_PLAN_ID,
e.DISQUS_PLUS_900K_PLAN_ID
],
e.PLUS_YEARLY_SLIDER_PLAN_IDS = [
e.DISQUS_PLUS_100K_YEARLY_PLAN_ID,
e.DISQUS_PLUS_350K_YEARLY_PLAN_ID,
e.DISQUS_PLUS_900K_YEARLY_PLAN_ID
],
e.PRO_MONTHLY_SLIDER_PLAN_IDS = [
e.DISQUS_PRO_1M_PLAN_ID,
e.DISQUS_PRO_2_5M_PLAN_ID,
e.DISQUS_PRO_5M_PLAN_ID
],
e.PRO_YEARLY_SLIDER_PLAN_IDS = [
e.DISQUS_PRO_1M_YEARLY_PLAN_ID,
e.DISQUS_PRO_2_5M_YEARLY_PLAN_ID,
e.DISQUS_PRO_5M_YEARLY_PLAN_ID
],
e.POLLS_PRO_MONTHLY_SLIDER_PLAN_IDS = [
e.DISQUS_POLLS_PRO_250K_PLAN_ID,
e.DISQUS_POLLS_PRO_1_5M_PLAN_ID,
e.DISQUS_POLLS_PRO_3M_PLAN_ID,
e.DISQUS_POLLS_PRO_10M_PLAN_ID
],
e.POLLS_PRO_YEARLY_SLIDER_PLAN_IDS = [
e.DISQUS_POLLS_PRO_ANNUAL_250K_PLAN_ID,
e.DISQUS_POLLS_PRO_1_5M_YEARLY_PLAN_ID,
e.DISQUS_POLLS_PRO_3M_YEARLY_PLAN_ID,
e.DISQUS_POLLS_PRO_10M_YEARLY_PLAN_ID
],
e.ADS_OPTIONAL_FEATURE_ID = 1,
e.AD_SUPPORTED_FEATURE_ID = - 19,
e.SERVER_FEATURES = {
ADS_OPTIONAL: {
id: 1,
name: 'Ads Optional'
},
SHADOW_BANNING: {
id: 2,
name: 'Shadow Banning'
},
ADVANCED_ANALYTICS: {
id: 3,
name: 'Advanced Analytics'
},
PRIORITY_SUPPORT: {
id: 4,
name: 'Priority Support'
},
BRANDING_OPTIONAL: {
id: 5,
name: 'Branding Optional'
},
SSO: {
id: 6,
name: 'Single Sign-On'
},
PARTNER_KEY: {
id: 8,
name: 'Unlimited API Access'
},
TEMPORARY_BANNING: {
id: 10,
name: 'Timeouts'
},
DIRECT_SUPPORT: {
id: 11,
name: 'Direct Support'
},
AUDIENCE_EMAIL_TRANSFER: {
id: 12,
name: 'Email Subscriptions'
},
ALL_MOD_RULES: {
id: 13,
name: 'All Moderation Rules'
},
THREAD_RATINGS: {
id: 14,
name: 'Star Ratings'
},
CUSTOM_REACTIONS: {
id: 15,
name: 'Custom Reactions'
},
EMBED_CUSTOMIZATIONS: {
id: 16,
name: 'Embed Customizations'
},
BADGES: {
id: 19,
name: 'Commenter Badges'
}
},
e.DISPLAY_FEATURES = {
EVERYTHING_BASIC: {
id: - 1,
name: 'Everything in Basic',
isBold: !0
},
EVERYTHING_PLUS: {
id: - 2,
name: 'Everything in Plus',
isBold: !0
},
DIRECT_ACCOUNT_MANAGER: {
id: - 3,
name: 'Direct Account Manager'
},
COMMENTS_PLUG_IN: {
id: - 4,
name: 'Comments Plug-in'
},
ADVANCED_SPAM_FILTERS: {
id: - 5,
name: 'Advanced Spam Filters'
},
MODERATION_TOOLS: {
id: - 6,
name: 'Moderation Tools'
},
BASIC_ANALYTICS: {
id: - 7,
name: 'Basic Analytics'
},
CONFIGURABLE_ADS: {
id: - 8,
name: 'Configurable Ads'
},
REACTIONS: {
id: - 9,
name: 'Reactions'
},
EVERYTHING_PRO: {
id: - 10,
name: 'Everything in Pro',
isBold: !0
},
LIGHTBOXES_PROMPTS: {
id: - 11,
name: 'Targeted Lightboxes and Sign-up Prompts'
},
AI_RECOMMENDATIONS: {
id: - 12,
name: 'AI-powered Content Recommendations'
},
EMAIL_PERSONALIZATION: {
id: - 13,
name: 'Branded Email Notifications'
},
DISQUS_CORE_FEATURES: {
id: - 14,
name: 'Disqus Core Features'
},
FORUM_LIMIT_PLUS: {
id: - 15,
name: 'Supports up to 3 Websites'
},
FORUM_LIMIT_PRO: {
id: - 16,
name: 'Supports up to 20 Websites'
},
FORUM_LIMIT_BUSINESS: {
id: - 17,
name: 'Supports Unlimited Websites'
},
ADVANCED_MODERATION: {
id: - 18,
name: 'Advanced Moderation Tools'
},
AD_SUPPORTED: {
id: - 19,
name: 'Ad Supported'
},
CUSTOM_FONTS: {
id: - 20,
name: 'Custom Fonts'
},
CUSTOM_BRANDING: {
id: - 27,
name: 'Custom Branding & Optimizations'
},
DIRECT_EMAIL_SUPPORT: {
id: - 28,
name: 'Direct Email Support'
}
},
e.RENDER_FEATURE_TEXT = {
1: 'Ad-Free',
2: 'Shadow Banning',
3: 'Advanced Analytics',
4: 'Priority Support',
5: 'Whitelabeling',
6: 'SSO Integration',
8: 'Unlimited API Access',
10: 'Timeouts',
11: 'Direct Support',
12: 'Email Subscriptions',
13: 'All Moderation Rules',
14: 'Star Ratings',
15: 'Custom Reactions',
19: 'Commenter Badges',
'-1': 'Everything in Basic',
'-2': 'Everything in Plus',
'-3': 'Direct Account Manager',
'-4': 'Comments Plug-in',
'-5': 'Advanced Spam Filters',
'-6': 'Moderation Tools',
'-7': 'Basic Analytics',
'-8': 'Configurable Ads',
'-9': 'Reactions',
'-10': 'Everything in Pro',
'-11': 'Targeted Lightboxes',
'-12': 'AI-powered Content Recommendations',
'-13': 'Branded Email Notifications',
'-14': 'Disqus Core Features',
'-15': 'Supports up to 3 Websites',
'-16': 'Supports up to 20 Websites',
'-17': 'Supports Unlimited Websites',
'-18': 'Advanced Moderation Tools',
'-19': 'Ad-Supported',
'-20': 'Custom Fonts',
'-21': 'Disqus Comment Platform',
'-22': 'Core Engagement Features',
'-23': 'Easy Installation',
'-24': 'Basic Reporting and Analytics',
'-25': 'Simple Moderation Tools',
'-26': 'Cross-site and Email Notifications',
'-27': 'Custom Branding & Optimizations',
'-28': 'Direct Email Support',
'-29': 'Essential Moderation Tools',
'-30': '3 Moderator Seats',
'-31': 'AI Moderation Features',
'-32': 'Customizable Engagement Tools',
'-33': 'Unlimited Moderator Seats',
'-34': 'Free',
'-35': 'Customizable question formats',
'-36': 'Flexible poll placements',
'-37': 'Real-time Results & Analytics',
'-38': 'Custom Integrations',
'-39': 'Dedicated Account Management',
'-40': 'Remove Disqus Branding'
},
e.BASIC_PLAN = {
id: e.DISQUS_BASIC_PLAN_ID,
description: null,
interval: null,
amount: 0,
trialLengthDays: null,
isEligible: !0,
productName: e.SAAS_PRODUCT_COMMENTS
},
e.BASIC_PACKAGE = {
id: e.DISQUS_BASIC_PACKAGE_ID,
name: 'Ad-Supported',
color: '#494E58',
pageViewRange: {
min: 0,
max: null
},
features: [
e.DISPLAY_FEATURES.COMMENTS_PLUG_IN,
e.DISPLAY_FEATURES.ADVANCED_SPAM_FILTERS,
e.DISPLAY_FEATURES.MODERATION_TOOLS,
e.DISPLAY_FEATURES.BASIC_ANALYTICS,
e.DISPLAY_FEATURES.CONFIGURABLE_ADS,
e.DISPLAY_FEATURES.REACTIONS
],
plans: [
e.BASIC_PLAN
],
productName: e.SAAS_PRODUCT_COMMENTS
},
e.BASIC_SUBSCRIPTION = {
amount: '0.00',
amountRemaining: '0.00',
currentPeriodEnd: null,
currentPeriodStart: null,
status: e.SAAS_PRODUCT_PLAN_ACTIVE_STATUS,
trialEnd: null,
trialStart: null
},
e.POLLS_BUSINESS_PLAN = {
id: e.DISQUS_POLLS_BUSINESS_PLAN_ID,
description: null,
interval: null,
amount: 0,
trialLengthDays: null,
isEligible: !0,
productName: e.SAAS_PRODUCT_POLLS
},
e.POLLS_AD_SUPPORTED_PLAN = {
id: e.DISQUS_POLLS_AD_SUPPORTED_PLAN_ID,
description: null,
interval: null,
amount: 0,
trialLengthDays: null,
isEligible: !0,
productName: e.SAAS_PRODUCT_POLLS
},
e.COUPON_SHAPE = n.shape({
amountOff: n.number,
percentOff: n.number,
duration: n.string.isRequired,
durationInMonths: n.number,
stripeId: n.string.isRequired
}),
e.PLAN_SHAPE = n.shape({
id: n.string.isRequired,
description: n.node,
amount: n.number,
hasTrialAvailable: n.bool,
isSubscribed: n.bool,
interval: n.oneOf(['month',
'year']),
trialLengthDays: n.number,
isEligible: n.bool,
productName: n.oneOf([e.SAAS_PRODUCT_COMMENTS,
e.SAAS_PRODUCT_POLLS])
}),
e.FEATURE_SHAPE = n.shape({
id: n.number.isRequired,
name: n.string.isRequired,
isCustom: n.bool,
isBold: n.bool
}),
e.PACKAGE_SHAPE = n.shape({
id: n.number.isRequired,
name: n.string.isRequired,
color: n.string.isRequired,
isSubscribed: n.bool.isRequired,
plans: n.arrayOf(e.PLAN_SHAPE).isRequired,
pageViewRange: n.shape({
min: n.number,
max: n.number
}).isRequired,
features: n.arrayOf(e.FEATURE_SHAPE).isRequired
}),
e.TRIAL_SHAPE = n.shape({
startDate: n.string,
endDate: n.string,
isActive: n.bool.isRequired
}),
e.CURRENT_SUBSCRIPTION_SHAPE = n.shape({
amount: n.string,
amountRemaining: n.string,
currentPeriodEnd: n.string,
currentPeriodStart: n.string,
status: n.oneOf([e.SAAS_PRODUCT_PLAN_TRIALING_STATUS,
e.SAAS_PRODUCT_PLAN_ACTIVE_STATUS,
e.SAAS_PRODUCT_PLAN_PAST_DUE_STATUS,
e.SAAS_PRODUCT_PLAN_CANCELLED_STATUS,
e.SAAS_PRODUCT_PLAN_UNPAID_STATUS]).isRequired,
trialEnd: n.string,
trialStart: n.string
}),
e.INVOICE_FIELDS = [
'companyName',
'taxId',
'street',
'city',
'state',
'country',
'zipCode'
],
e.INVOICE_SHAPE = e.INVOICE_FIELDS.reduce(function (e, t) {
return r(r({
}, e), {
}, o({
}, t, n.string))
}, {
}),
e.ORG_BILLING_SHAPE = n.shape({
currentSubscription: e.CURRENT_SUBSCRIPTION_SHAPE,
invoiceHistory: n.arrayOf(n.shape({
date: n.string.isRequired,
total: n.string.isRequired,
paid: n.bool.isRequired
})).isRequired,
paymentInfo: n.shape({
last4: n.string.isRequired,
expMonth: n.number.isRequired,
expYear: n.number.isRequired,
brand: n.string
}),
invoiceInfo: n.shape(e.INVOICE_SHAPE)
}),
e.CHECKOUT_SUCCESS_QUERY_PARAM = 'checkout',
e.CHECKOUT_SUCCESS_QUERY_PARAM_VALUE_COMMENTS = '1',
e.CHECKOUT_SUCCESS_QUERY_PARAM_VALUE_POLLS = '2'
}.apply(t, n)) || (e.exports = n)
},
34: function (e, t, n) {
var n = [
n(7),
n(8),
n(2),
n(39),
n(42)
],
n = function (r, n, o, a, i) {
'use strict';
var s = {
},
l = {
_getKey: function (e) {
return 'switch:' + e
},
disableFeature: function (e) {
s[e] = !1
},
resetFeature: function (e) {
s[e] = null
},
forceFeature: function (e) {
s[e] = !0
},
getSwitchContext: function (e) {
var t = a.get(this._getKey(e));
if (null !== t) return t;
t = s[e];
return null != t ? t : (n.lounge && n.lounge.switches || {
}) [e]
},
isFeatureActive: function (e, t) {
var n = l.getSwitchContext(e);
if (r.isBoolean(n)) return n;
if (!n) return !1;
var e = i.getFromCookie(),
e = {
percent: o.clientPercent(),
user_id: e.id,
username: e.username,
is_staff: e.staff,
is_moderator: e.isModerator
},
a = r.defaults(t || {
}, e);
return r.any(n, function (e, t) {
var n = a[t];
if (/percent$/.test(t) && r.isNumber(e)) {
if (r.isNumber(n)) return n < e;
if (r.isString(n)) {
t = 0;
return e !== Math.round(e) && (t = ('' + e).split('.').pop().length),
e > o.getPercentBucketForString(n, t)
}
return !1
}
return r.isArray(e) ? r.contains(e, n) : e === n
})
}
};
return l
}.apply(t, n);
void 0 === n || (e.exports = n)
},
35: function (e, t, n) {
'use strict';
var a,
r,
o,
i,
s;
a = /(^|\.)disqus\.com$/.test(window.location.host) ? 'disqus.com' : 'dev.disqus.org:8000',
o = (r = 'disqus.com' == a ? 'https://' : 'http://') + a,
i = window.location.host.split(a) [0].replace('.', ''),
s = r + window.location.host,
o = {
urls: {
api: ''.concat(r).concat(a, '/api/3.0/'),
createSite: ''.concat(o, '/admin/create/'),
cdnCurrent: 'https://c.disquscdn.com/next/current/embed/'
},
disqusHost: a,
currentForum: i,
keys: {
api: 'Y1S1wGIzdc63qnZ5rhHfjqEABGA4ZTDncauWFFWWTUBqkmLjdxloTb7ilhGnZ7z1',
stripe: 'pk_live_XiH6fxBBLXCOH7KF6K7fDlGf',
segmentIO: 'WskYYFRdZvvOmLhuFN9r7ZygELBNKkvH'
},
debug: !1,
disqusUrl: o,
resync_forum_url: ''.concat(s, '/admin/discussions/import/platform/blogger/resync/'),
bloggerSyncOauthUrl: ''.concat(o, '/_ax/blogger/begin'),
intercomAppId: 'x2byp8hg',
feedApiVersion: '12'
},
e.exports = o
},
37: function (Ht, e) {
!function (f, O) {
function t(e, t) {
return t.toUpperCase()
}
function a(e) {
!g.addEventListener && 'load' !== e.type && 'complete' !== g.readyState || (x(), de.ready())
}
var r,
h = typeof O,
g = f.document,
e = f.location,
n = f.jQuery,
o = f.$,
i = {
},
p = [
],
y = p.concat,
s = p.push,
u = p.slice,
l = p.indexOf,
c = i.toString,
b = i.hasOwnProperty,
d = '1.9.1'.trim,
de = function (e, t) {
return new de.fn.init(e, t, D)
},
m = '[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)',
S = /\S+/g,
v = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
_ = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
E = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
w = /^[\],:{}\s]*$/,
P = /(?:^|:|,)(?:\s*\[)+/g,
k = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
N = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
C = /^-ms-/,
R = /-([\da-z])/gi,
x = function () {
g.addEventListener ? (g.removeEventListener('DOMContentLoaded', a, !1), f.removeEventListener('load', a, !1)) : (g.detachEvent('onreadystatechange', a), f.detachEvent('onload', a))
};
function A(e) {
var t = e.length,
n = de.type(e);
return !de.isWindow(e) && (!(1 !== e.nodeType || !t) || ('array' === n || 'function' !== n && (0 === t || 'number' == typeof t && 0 < t && t - 1 in e)))
}
de.fn = de.prototype = {
jquery: '1.9.1',
constructor: de,
init: function (e, t, n) {
var a,
r;
if (!e) return this;
if ('string' != typeof e) return e.nodeType ? (this.context = this[0] = e, this.length = 1, this) : de.isFunction(e) ? n.ready(e) : (e.selector !== O && (this.selector = e.selector, this.context = e.context), de.makeArray(e, this));
if (!(a = '<' == (e[0] || '') && '>' == (e[0 | e.length - 1] || '') && 3 <= e.length ? [
null,
e,
null
] : _.exec(e)) || !a[1] && t) return (!t || t.jquery ? t || n : this.constructor(t)).find(e);
if (a[1]) {
if (de.merge(this, de.parseHTML(a[1], (t = t instanceof de ? t[0] : t) && t.nodeType ? t.ownerDocument || t : g, !0)), E.test(a[1]) && de.isPlainObject(t)) for (a in t) de.isFunction(this[a]) ? this[a](t[a]) : this.attr(a, t[a]);
return this
}
if ((r = g.getElementById(a[2])) && r.parentNode) {
if (r.id !== a[2]) return n.find(e);
this.length = 1,
this[0] = r
}
return this.context = g,
this.selector = e,
this
},
selector: '',
length: 0,
size: function () {
return this.length
},
toArray: function () {
return u.call(this)
},
get: function (e) {
return null == e ? this.toArray() : e < 0 ? this[this.length + e] : this[e]
},
pushStack: function (e) {
e = de.merge(this.constructor(), e);
return e.prevObject = this,
e.context = this.context,
e
},
each: function (e, t) {
return de.each(this, e, t)
},
ready: function (e) {
return de.ready.promise().done(e),
this
},
slice: function () {
return this.pushStack(u.apply(this, arguments))
},
first: function () {
return this.eq(0)
},
last: function () {
return this.eq( - 1)
},
eq: function (e) {
var t = this.length,
e = + e + (e < 0 ? t : 0);
return this.pushStack(0 <= e && e < t ? [
this[e]
] : [
])
},
map: function (n) {
return this.pushStack(de.map(this, function (e, t) {
return n.call(e, t, e)
}))
},
end: function () {
return this.prevObject || this.constructor(null)
},
push: s,
sort: [
].sort,
splice: [
].splice
},
de.fn.init.prototype = de.fn,
de.extend = de.fn.extend = function () {
var e,
t,
n,
a,
r,
o = arguments[0] || {
},
i = 1,
s = arguments.length,
l = !1;
for ('boolean' == typeof o && (l = o, o = arguments[1] || {
}, i = 2), 'object' == typeof o || de.isFunction(o) || (o = {
}), s === i && (o = this, --i); i < s; i++) if (null != (a = arguments[i])) for (n in a) r = o[n],
o !== (t = a[n]) && (l && t && (de.isPlainObject(t) || (e = de.isArray(t))) ? (r = e ? (e = !1, r && de.isArray(r) ? r : [
]) : r && de.isPlainObject(r) ? r : {
}, o[n] = de.extend(l, r, t)) : t !== O && (o[n] = t));
return o
},
de.extend({
noConflict: function (e) {
return f.$ === de && (f.$ = o),
e && f.jQuery === de && (f.jQuery = n),
de
},
isReady: !1,
readyWait: 1,
holdReady: function (e) {
e ? de.readyWait++ : de.ready(!0)
},
ready: function (e) {
if (!0 === e ? !--de.readyWait : !de.isReady) {
if (!g.body) return setTimeout(de.ready);
(de.isReady = !0) !== e && 0 < --de.readyWait || (r.resolveWith(g, [
de
]), de.fn.trigger && de(g).trigger('ready').off('ready'))
}
},
isFunction: function (e) {
return 'function' === de.type(e)
},
isArray: Array.isArray || function (e) {
return 'array' === de.type(e)
},
isWindow: function (e) {
return null != e && e == e.window
},
isNumeric: function (e) {
return !isNaN(parseFloat(e)) && isFinite(e)
},
type: function (e) {
return null == e ? '' + e : 'object' == typeof e || 'function' == typeof e ? i[c.call(e)] || 'object' : typeof e
},
isPlainObject: function (e) {
if (!e || 'object' !== de.type(e) || e.nodeType || de.isWindow(e)) return !1;
try {
if (e.constructor && !b.call(e, 'constructor') && !b.call(e.constructor.prototype, 'isPrototypeOf')) return !1
} catch (e) {
return !1
}
for (var t in e);
return t === O || b.call(e, t)
},
isEmptyObject: function (e) {
for (var t in e) return !1;
return !0
},
error: function (e) {
throw Error(e)
},
parseHTML: function (e, t, n) {
if (!e || 'string' != typeof e) return null;
'boolean' == typeof t && (n = t, t = !1),
t = t || g;
var a = E.exec(e),
n = !n && [
];
return a ? [
t.createElement(a[1])
] : (a = de.buildFragment([e], t, n), n && de(n).remove(), de.merge([], a.childNodes))
},
parseJSON: function (e) {
return f.JSON && f.JSON.parse ? f.JSON.parse(e) : null === e ? e : 'string' == typeof e && (e = de.trim(e)) && w.test(e.replace(k, '@').replace(N, ']').replace(P, '')) ? Function('return ' + e) () : void de.error('Invalid JSON: ' + e)
},
parseXML: function (e) {
var t;
if (!e || 'string' != typeof e) return null;
try {
f.DOMParser ? t = (new DOMParser).parseFromString(e, 'text/xml') : ((t = new ActiveXObject('Microsoft.XMLDOM')).async = 'false', t.loadXML(e))
} catch (e) {
t = O
}
return t && t.documentElement && !t.getElementsByTagName('parsererror').length || de.error('Invalid XML: ' + e),
t
},
noop: function () {
},
globalEval: function (e) {
e && de.trim(e) && (f.execScript || function (e) {
f.eval.call(f, e)
}) (e)
},
camelCase: function (e) {
return e.replace(C, 'ms-').replace(R, t)
},
nodeName: function (e, t) {
return e.nodeName && e.nodeName.toLowerCase() == t.toLowerCase()
},
each: function (e, t, n) {
var a = 0,
r = e.length,
o = A(e);
if (n) {
if (o) for (; a < r && !1 !== t.apply(e[a], n); a++);
else for (a in e) if (!1 === t.apply(e[a], n)) break
} else if (o) for (; a < r && !1 !== t.call(e[a], a, e[a]); a++);
else for (a in e) if (!1 === t.call(e[a], a, e[a])) break;
return e
},
trim: d && !d.call(' ') ? function (e) {
return null == e ? '' : d.call(e)
}
: function (e) {
return null == e ? '' : (e + '').replace(v, '')
},
makeArray: function (e, t) {
t = t || [
];
return null != e && (A(Object(e)) ? de.merge(t, 'string' == typeof e ? [
e
] : e) : s.call(t, e)),
t
},
inArray: function (e, t, n) {
var a;
if (t) {
if (l) return l.call(t, e, n);
for (a = t.length, n = n ? n < 0 ? Math.max(0, a + n) : n : 0; n < a; n++) if (n in t && t[n] === e) return n
}
return - 1
},
merge: function (e, t) {
var n = t.length,
a = e.length,
r = 0;
if ('number' == typeof n) for (; r < n; r++) e[a++] = t[r];
else for (; t[r] !== O; ) e[a++] = t[r++];
return e.length = a,
e
},
grep: function (e, t, n) {
var a = [
],
r = 0,
o = e.length;
for (n = !!n; r < o; r++) n !== !!t(e[r], r) && a.push(e[r]);
return a
},
map: function (e, t, n) {
var a,
r = 0,
o = e.length,
i = [
];
if (A(e)) for (; r < o; r++) null != (a = t(e[r], r, n)) && (i[i.length] = a);
else for (r in e) null != (a = t(e[r], r, n)) && (i[i.length] = a);
return y.apply([], i)
},
guid: 1,
proxy: function (e, t) {
var n,
a;
return 'string' == typeof t && (a = e[t], t = e, e = a),
de.isFunction(e) ? (n = u.call(arguments, 2), (a = function () {
return e.apply(t || this, n.concat(u.call(arguments)))
}).guid = e.guid = e.guid || de.guid++, a) : O
},
access: function (e, t, n, a, r, o, i) {
var s = 0,
l = e.length,
c = null == n;
if ('object' === de.type(n)) for (s in r = !0, n) de.access(e, t, s, n[s], !0, o, i);
else if (a !== O && (r = !0, de.isFunction(a) || (i = !0), t = c ? i ? (t.call(e, a), null) : (c = t, function (e, t, n) {
return c.call(de(e), n)
}) : t)) for (; s < l; s++) t(e[s], n, i ? a : a.call(e[s], s, t(e[s], n)));
return r ? e : c ? t.call(e) : l ? t(e[0], n) : o
},
now: function () {
return (new Date).getTime()
}
}),
de.ready.promise = function (e) {
if (!r) if (r = de.Deferred(), 'complete' === g.readyState) setTimeout(de.ready);
else if (g.addEventListener) g.addEventListener('DOMContentLoaded', a, !1),
f.addEventListener('load', a, !1);
else {
g.attachEvent('onreadystatechange', a),
f.attachEvent('onload', a);
var n = !1;
try {
n = null == f.frameElement && g.documentElement
} catch (e) {
}
n && n.doScroll && !function t() {
if (!de.isReady) {
try {
n.doScroll('left')
} catch (e) {
return setTimeout(t, 50)
}
x(),
de.ready()
}
}()
}
return r.promise(e)
},
de.each('Boolean Number String Function Array Date RegExp Object Error'.split(' '), function (e, t) {
i['[object ' + t + ']'] = t.toLowerCase()
});
var D = de(g),
j = {
};
de.Callbacks = function (r) {
var e,
n;
r = 'string' == typeof r ? j[r] || (n = j[e = r] = {
}, de.each(e.match(S) || [
], function (e, t) {
n[t] = !0
}), n) : de.extend({
}, r);
var a,
t,
o,
i,
s,
l,
c = [
],
u = !r.once && [
],
p = function (e) {
for (t = r.memory && e, o = !0, s = l || 0, i = c.length, a = !(l = 0); c && s < i; s++) if (!1 === c[s].apply(e[0], e[1]) && r.stopOnFalse) {
t = !1;
break
}
a = !1,
c && (u ? u.length && p(u.shift()) : t ? c = [
] : d.disable())
},
d = {
add: function () {
var e;
return c && (e = c.length, function a(e) {
de.each(e, function (e, t) {
var n = de.type(t);
'function' === n ? r.unique && d.has(t) || c.push(t) : t && t.length && 'string' !== n && a(t)
})
}(arguments), a ? i = c.length : t && (l = e, p(t))),
this
},
remove: function () {
return c && de.each(arguments, function (e, t) {
for (var n; - 1 < (n = de.inArray(t, c, n)); ) c.splice(n, 1),
a && (n <= i && i--, n <= s && s--)
}),
this
},
has: function (e) {
return e ? - 1 < de.inArray(e, c) : !(!c || !c.length)
},
empty: function () {
return c = [
],
this
},
disable: function () {
return c = u = t = O,
this
},
disabled: function () {
return !c
},
lock: function () {
return u = O,
t || d.disable(),
this
},
locked: function () {
return !u
},
fireWith: function (e, t) {
return t = [
e,
(t = t || [
]).slice ? t.slice() : t
],
!c || o && !u || (a ? u.push(t) : p(t)),
this
},
fire: function () {
return d.fireWith(this, arguments),
this
},
fired: function () {
return !!o
}
};
return d
},
de.extend({
Deferred: function (e) {
var i = [
['resolve',
'done',
de.Callbacks('once memory'),
'resolved'],
[
'reject',
'fail',
de.Callbacks('once memory'),
'rejected'
],
[
'notify',
'progress',
de.Callbacks('memory')
]
],
r = 'pending',
s = {
state: function () {
return r
},
always: function () {
return l.done(arguments).fail(arguments),
this
},
then: function () {
var o = arguments;
return de.Deferred(function (r) {
de.each(i, function (e, t) {
var n = t[0],
a = de.isFunction(o[e]) && o[e];
l[t[1]](function () {
var e = a && a.apply(this, arguments);
e && de.isFunction(e.promise) ? e.promise().done(r.resolve).fail(r.reject).progress(r.notify) : r[n + 'With'](this === s ? r.promise() : this, a ? [
e
] : arguments)
})
}),
o = null
}).promise()
},
promise: function (e) {
return null != e ? de.extend(e, s) : s
}
},
l = {
};
return s.pipe = s.then,
de.each(i, function (e, t) {
var n = t[2],
a = t[3];
s[t[1]] = n.add,
a && n.add(function () {
r = a
}, i[1 ^ e][2].disable, i[2][2].lock),
l[t[0]] = function () {
return l[t[0] + 'With'](this === l ? s : this, arguments),
this
},
l[t[0] + 'With'] = n.fireWith
}),
s.promise(l),
e && e.call(l, l),
l
},
when: function (e) {
function t(t, n, a) {
return function (e) {
n[t] = this,
a[t] = 1 < arguments.length ? u.call(arguments) : e,
a === r ? c.notifyWith(n, a) : --l || c.resolveWith(n, a)
}
}
var r,
n,
a,
o = 0,
i = u.call(arguments),
s = i.length,
l = 1 !== s || e && de.isFunction(e.promise) ? s : 0,
c = 1 === l ? e : de.Deferred();
if (1 < s) for (r = Array(s), n = Array(s), a = Array(s); o < s; o++) i[o] && de.isFunction(i[o].promise) ? i[o].promise().done(t(o, a, i)).fail(c.reject).progress(t(o, n, r)) : --l;
return l || c.resolveWith(a, i),
c.promise()
}
}),
de.support = function () {
var o,
e,
t,
n,
a,
r,
i,
s,
l,
c,
u = g.createElement('div');
if (u.setAttribute('className', 't'), u.innerHTML = '
'
]
},
Ne = ue(g).appendChild(g.createElement('div'));
function Ce(e) {
var t = e.getAttributeNode('type');
return e.type = (t && t.specified) + '/' + e.type,
e
}
function Re(e) {
var t = we.exec(e.type);
return t ? e.type = t[1] : e.removeAttribute('type'),
e
}
function xe(e, t) {
for (var n, a = 0; null != (n = e[a]); a++) de._data(n, 'globalEval', !t || de._data(t[a], 'globalEval'))
}
function Ae(e, t) {
if (1 === t.nodeType && de.hasData(e)) {
var n,
a,
r,
o = de._data(e),
e = de._data(t, o),
i = o.events;
if (i) for (n in delete e.handle, e.events = {
}, i) for (a = 0, r = i[n].length; a < r; a++) de.event.add(t, n, i[n][a]);
e.data && (e.data = de.extend({
}, e.data))
}
}
function De(e, t) {
var n,
a,
r = 0,
o = typeof e.getElementsByTagName !== h ? e.getElementsByTagName(t || '*') : typeof e.querySelectorAll !== h ? e.querySelectorAll(t || '*') : O;
if (!o) for (o = [
], n = e.childNodes || e; null != (a = n[r]); r++) !t || de.nodeName(a, t) ? o.push(a) : de.merge(o, De(a, t));
return t === O || t && de.nodeName(e, t) ? de.merge([e], o) : o
}
function je(e) {
Ee.test(e.type) && (e.defaultChecked = e.checked)
}
ke.optgroup = ke.option,
ke.tbody = ke.tfoot = ke.colgroup = ke.caption = ke.thead,
ke.th = ke.td,
de.fn.extend({
text: function (e) {
return de.access(this, function (e) {
return e === O ? de.text(this) : this.empty().append((this[0] && this[0].ownerDocument || g).createTextNode(e))
}, null, e, arguments.length)
},
wrapAll: function (t) {
return de.isFunction(t) ? this.each(function (e) {
de(this).wrapAll(t.call(this, e))
}) : (this[0] && (e = de(t, this[0].ownerDocument).eq(0).clone(!0), this[0].parentNode && e.insertBefore(this[0]), e.map(function () {
for (var e = this; e.firstChild && 1 === e.firstChild.nodeType; ) e = e.firstChild;
return e
}).append(this)), this);
var e
},
wrapInner: function (n) {
return de.isFunction(n) ? this.each(function (e) {
de(this).wrapInner(n.call(this, e))
}) : this.each(function () {
var e = de(this),
t = e.contents();
t.length ? t.wrapAll(n) : e.append(n)
})
},
wrap: function (t) {
var n = de.isFunction(t);
return this.each(function (e) {
de(this).wrapAll(n ? t.call(this, e) : t)
})
},
unwrap: function () {
return this.parent().each(function () {
de.nodeName(this, 'body') || de(this).replaceWith(this.childNodes)
}).end()
},
append: function () {
return this.domManip(arguments, !0, function (e) {
1 !== this.nodeType && 11 !== this.nodeType && 9 !== this.nodeType || this.appendChild(e)
})
},
prepend: function () {
return this.domManip(arguments, !0, function (e) {
1 !== this.nodeType && 11 !== this.nodeType && 9 !== this.nodeType || this.insertBefore(e, this.firstChild)
})
},
before: function () {
return this.domManip(arguments, !1, function (e) {
this.parentNode && this.parentNode.insertBefore(e, this)
})
},
after: function () {
return this.domManip(arguments, !1, function (e) {
this.parentNode && this.parentNode.insertBefore(e, this.nextSibling)
})
},
remove: function (e, t) {
for (var n, a = 0; null != (n = this[a]); a++) (!e || 0 < de.filter(e, [
n
]).length) && (t || 1 !== n.nodeType || de.cleanData(De(n)), n.parentNode && (t && de.contains(n.ownerDocument, n) && xe(De(n, 'script')), n.parentNode.removeChild(n)));
return this
},
empty: function () {
for (var e, t = 0; null != (e = this[t]); t++) {
for (1 === e.nodeType && de.cleanData(De(e, !1)); e.firstChild; ) e.removeChild(e.firstChild);
e.options && de.nodeName(e, 'select') && (e.options.length = 0)
}
return this
},
clone: function (e, t) {
return e = null != e && e,
t = null == t ? e : t,
this.map(function () {
return de.clone(this, e, t)
})
},
html: function (e) {
return de.access(this, function (e) {
var t = this[0] || {
},
n = 0,
a = this.length;
if (e === O) return 1 === t.nodeType ? t.innerHTML.replace(me, '') : O;
if ('string' == typeof e && !_e.test(e) && (de.support.htmlSerialize || !fe.test(e)) && (de.support.leadingWhitespace || !he.test(e)) && !ke[(ye.exec(e) || [
'',
''
]) [1].toLowerCase()]) {
e = e.replace(ge, '<$1>$2>');
try {
for (; n < a; n++) 1 === (t = this[n] || {
}).nodeType && (de.cleanData(De(t, !1)), t.innerHTML = e);
t = 0
} catch (e) {
}
}
t && this.empty().append(e)
}, null, e, arguments.length)
},
replaceWith: function (e) {
return de.isFunction(e) || 'string' == typeof e || (e = de(e).not(this).detach()),
this.domManip([e], !0, function (e) {
var t = this.nextSibling,
n = this.parentNode;
n && (de(this).remove(), n.insertBefore(e, t))
})
},
detach: function (e) {
return this.remove(e, !0)
},
domManip: function (n, a, r) {
n = y.apply([], n);
var e,
t,
o,
i,
s,
l,
c,
u,
p = 0,
d = this.length,
m = this,
f = d - 1,
h = n[0],
g = de.isFunction(h);
if (g || !(d <= 1 || 'string' != typeof h || de.support.checkClone) && Oe.test(h)) return this.each(function (e) {
var t = m.eq(e);
g && (n[0] = h.call(this, e, a ? t.html() : O)),
t.domManip(n, a, r)
});
if (d && (e = (l = de.buildFragment(n, this[0].ownerDocument, !1, this)).firstChild, 1 === l.childNodes.length && (l = e), e)) {
for (a = a && de.nodeName(e, 'tr'), o = (i = de.map(De(l, 'script'), Ce)).length; p < d; p++) t = l,
p !== f && (t = de.clone(t, !0, !0), o && de.merge(i, De(t, 'script'))),
r.call(a && de.nodeName(this[p], 'table') ? (c = this[p]).getElementsByTagName(u = 'tbody') [0] || c.appendChild(c.ownerDocument.createElement(u)) : this[p], t, p);
if (o) for (s = i[i.length - 1].ownerDocument, de.map(i, Re), p = 0; p < o; p++) Se.test((t = i[p]).type || '') && !de._data(t, 'globalEval') && de.contains(s, t) && (t.src ? de.ajax({
url: t.src,
type: 'GET',
dataType: 'script',
async: !1,
global: !1,
throws: !0
}) : de.globalEval((t.text || t.textContent || t.innerHTML || '').replace(Pe, '')));
l = e = null
}
return this
}
}),
de.each({
appendTo: 'append',
prependTo: 'prepend',
insertBefore: 'before',
insertAfter: 'after',
replaceAll: 'replaceWith'
}, function (e, i) {
de.fn[e] = function (e) {
for (var t, n = 0, a = [
], r = de(e), o = r.length - 1; n <= o; n++) t = n === o ? this : this.clone(!0),
de(r[n]) [i](t),
s.apply(a, t.get());
return this.pushStack(a)
}
}),
de.extend({
clone: function (e, t, n) {
var a,
r,
o,
i,
s,
l = de.contains(e.ownerDocument, e);
if (de.support.html5Clone || de.isXMLDoc(e) || !fe.test('<' + e.nodeName + '>') ? o = e.cloneNode(!0) : (Ne.innerHTML = e.outerHTML, Ne.removeChild(o = Ne.firstChild)), !(de.support.noCloneEvent && de.support.noCloneChecked || 1 !== e.nodeType && 11 !== e.nodeType || de.isXMLDoc(e))) for (a = De(o), s = De(e), i = 0; null != (r = s[i]); ++i) a[i] && function (e, t) {
var n,
a,
r;
if (1 === t.nodeType) {
if (n = t.nodeName.toLowerCase(), !de.support.noCloneEvent && t[de.expando]) {
for (a in (r = de._data(t)).events) de.removeEvent(t, a, r.handle);
t.removeAttribute(de.expando)
}
'script' == n && t.text !== e.text ? (Ce(t).text = e.text, Re(t)) : 'object' == n ? (t.parentNode && (t.outerHTML = e.outerHTML), de.support.html5Clone && e.innerHTML && !de.trim(t.innerHTML) && (t.innerHTML = e.innerHTML)) : 'input' == n && Ee.test(e.type) ? (t.defaultChecked = t.checked = e.checked, t.value !== e.value && (t.value = e.value)) : 'option' == n ? t.defaultSelected = t.selected = e.defaultSelected : 'input' != n && 'textarea' != n || (t.defaultValue = e.defaultValue)
}
}(r, a[i]);
if (t) if (n) for (s = s || De(e), a = a || De(o), i = 0; null != (r = s[i]); i++) Ae(r, a[i]);
else Ae(e, o);
return 0 < (a = De(o, 'script')).length && xe(a, !l && De(e, 'script')),
a = s = r = null,
o
},
buildFragment: function (e, t, n, a) {
for (var r, o, i, s, l, c, u, p = e.length, d = ue(t), m = [
], f = 0; f < p; f++) if ((o = e[f]) || 0 === o) if ('object' === de.type(o)) de.merge(m, o.nodeType ? [
o
] : o);
else if (ve.test(o)) {
for (s = s || d.appendChild(t.createElement('div')), l = (ye.exec(o) || [
'',
''
]) [1].toLowerCase(), s.innerHTML = (u = ke[l] || ke._default) [1] + o.replace(ge, '<$1>$2>') + u[2], r = u[0]; r--; ) s = s.lastChild;
if (!de.support.leadingWhitespace && he.test(o) && m.push(t.createTextNode(he.exec(o) [0])), !de.support.tbody) for (r = (o = 'table' != l || be.test(o) ? '
' !== u[1] || be.test(o) ? 0 : s : s.firstChild) && o.childNodes.length; r--; ) de.nodeName(c = o.childNodes[r], 'tbody') && !c.childNodes.length && o.removeChild(c);
for (de.merge(m, s.childNodes), s.textContent = ''; s.firstChild; ) s.removeChild(s.firstChild);
s = d.lastChild
} else m.push(t.createTextNode(o));
for (s && d.removeChild(s), de.support.appendChecked || de.grep(De(m, 'input'), je), f = 0; o = m[f++]; ) if ((!a || - 1 === de.inArray(o, a)) && (i = de.contains(o.ownerDocument, o), s = De(d.appendChild(o), 'script'), i && xe(s), n)) for (r = 0; o = s[r++]; ) Se.test(o.type || '') && n.push(o);
return s = null,
d
},
cleanData: function (e, t) {
for (var n, a, r, o, i = 0, s = de.expando, l = de.cache, c = de.support.deleteExpando, u = de.event.special; null != (n = e[i]); i++) if ((t || de.acceptData(n)) && (o = (r = n[s]) && l[r])) {
if (o.events) for (a in o.events) u[a] ? de.event.remove(n, a) : de.removeEvent(n, a, o.handle);
l[r] && (delete l[r], c ? delete n[s] : typeof n.removeAttribute !== h ? n.removeAttribute(s) : n[s] = null, p.push(r))
}
}
});
var Te,
Ie,
qe,
Fe = /alpha\([^)]*\)/i,
Le = /opacity\s*=\s*([^)]*)/,
Ue = /^(top|right|bottom|left)$/,
Me = /^(none|table(?!-c[ea]).+)/,
Be = /^margin/,
ze = RegExp('^(' + m + ')(.*)$', 'i'),
He = RegExp('^(' + m + ')(?!px)[a-z%]+$', 'i'),
Ge = RegExp('^([+-])=(' + m + ')', 'i'),
Ve = {
BODY: 'block'
},
We = {
position: 'absolute',
visibility: 'hidden',
display: 'block'
},
Ye = {
letterSpacing: 0,
fontWeight: 400
},
Qe = [
'Top',
'Right',
'Bottom',
'Left'
],
Ke = [
'Webkit',
'O',
'Moz',
'ms'
];
function Je(e, t) {
if (t in e) return t;
for (var n = (t[0] || '').toUpperCase() + t.slice(1), a = t, r = 4; r--; ) if ((t = Ke[r] + n) in e) return t;
return a
}
function $e(e, t) {
return 'none' === de.css(e = t || e, 'display') || !de.contains(e.ownerDocument, e)
}
function Ze(e, t) {
for (var n, a, r, o = [
], i = 0, s = e.length; i < s; i++) (a = e[i]).style && (o[i] = de._data(a, 'olddisplay'), n = a.style.display, t ? (o[i] || 'none' !== n || (a.style.display = ''), '' === a.style.display && $e(a) && (o[i] = de._data(a, 'olddisplay', nt(a.nodeName)))) : o[i] || (r = $e(a), (n && 'none' !== n || !r) && de._data(a, 'olddisplay', r ? n : de.css(a, 'display'))));
for (i = 0; i < s; i++) (a = e[i]).style && (t && 'none' !== a.style.display && '' !== a.style.display || (a.style.display = t ? o[i] || '' : 'none'));
return e
}
function Xe(e, t, n) {
var a = ze.exec(t);
return a ? Math.max(0, a[1] - (n || 0)) + (a[2] || 'px') : t
}
function et(e, t, n, a, r) {
for (var o = n === (a ? 'border' : 'content') ? 4 : 'width' === t ? 1 : 0, i = 0; o < 4; o += 2) 'margin' === n && (i += de.css(e, n + Qe[o], !0, r)),
a ? ('content' === n && (i -= de.css(e, 'padding' + Qe[o], !0, r)), 'margin' !== n && (i -= de.css(e, 'border' + Qe[o] + 'Width', !0, r))) : (i += de.css(e, 'padding' + Qe[o], !0, r), 'padding' !== n && (i += de.css(e, 'border' + Qe[o] + 'Width', !0, r)));
return i
}
function tt(e, t, n) {
var a = !0,
r = 'width' === t ? e.offsetWidth : e.offsetHeight,
o = Ie(e),
i = de.support.boxSizing && 'border-box' === de.css(e, 'boxSizing', !1, o);
if (r <= 0 || null == r) {
if (r = qe(e, t, o), He.test(r = r < 0 || null == r ? e.style[t] : r)) return r;
a = i && (de.support.boxSizingReliable || r === e.style[t]),
r = parseFloat(r) || 0
}
return r + et(e, t, n || (i ? 'border' : 'content'), a, o) + 'px'
}
function nt(e) {
var t = g,
n = Ve[e];
return n || ('none' !== (n = at(e, t)) && n || ((t = ((Te = (Te || de('