Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/modules/hoc/with-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export default ( getName = noop ) => ( WrappedComponent ) => {
static propTypes = {
registerForm: PropTypes.func,
postType: PropTypes.string,
createDraft: PropTypes.func,
sendForm: PropTypes.func,
setSubmit: PropTypes.func,
editEntry: PropTypes.func,
maybeRemoveEntry: PropTypes.func,
};

componentDidMount() {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/utils/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { rest } from '@moderntribe/common/utils/globals';
/**
* Send a request into a wp-json endpoint
*
* @param {object} params An object with the following properties:
* @param {Object} params An object with the following properties:
* - path: Path for the endpoint
* - headers: Array of extra headers for the request
* - initParams: Params send into the fetch along with headers and credentials
Expand Down
2 changes: 1 addition & 1 deletion src/modules/utils/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const isRootNode = ( node ) => node === window.top.document;
* Utility to search the parent of a node looking from the current node Up to the highest
* node on the DOM Tree
*
* @param {(HTMLElement|object)} node - The DOM node where the search starts
* @param {(HTMLElement | Object)} node - The DOM node where the search starts
* @param {Function} callback - Is executed on every iteration, it should return a boolean
* @returns {boolean} Returns tre if the callback returns true with any of the parents.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/modules/utils/proptypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const timeRegex = /^([01]?[0-9]|2[0-3]):[0-5][0-9]$/;
* PropTypes check for type string and time format using 24h clock in hh:mm format
* e.g. 00:24, 03:57, 21:12
*
* @param {object} props Properties object.
* @param {Object} props Properties object.
* @param {string} propName Property name.
* @param {string} componentName Component name to validate property.
*/
Expand Down
6 changes: 2 additions & 4 deletions src/modules/utils/recurrence.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { plugins } from '@moderntribe/common/data';
* Returns whether the Event has at least one recurrence rule or not.
*
* @since 5.0.0
* @param {object} state The current container state.
* @param {Object} state The current container state.
* @returns {boolean} Whether the Event has at least one recurrence rule or not.
*/
export const hasRecurrenceRules = ( state ) => {
Expand All @@ -25,7 +25,6 @@ export const hasRecurrenceRules = ( state ) => {
* Returns whether tickets are allowed on Recurring events or not.
*
* @since 5.0.0
*
* @returns {boolean} Whether tickets are allowed on Recurring events or not.
*/
export const noTicketsOnRecurring = () => {
Expand All @@ -36,9 +35,8 @@ export const noTicketsOnRecurring = () => {
* Returns whether RSVPs are allowed on Recurring events or not.
*
* @since 5.8.0
*
* @returns {boolean} Whether RSVPs are allowed on Recurring events or not.
*/
export const noRsvpsOnRecurring = () => {
return document.body.classList.contains( 'tec-no-rsvp-on-recurring' )
return document.body.classList.contains( 'tec-no-rsvp-on-recurring' );
};
2 changes: 1 addition & 1 deletion src/modules/utils/time.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const HOUR_IN_MS = HOUR_IN_SECONDS * SECOND_IN_MS;
/**
* Formats time object to time string in the format provided
*
* @param {object} time Time object to format from
* @param {Object} time Time object to format from
* @param {string} format Format of time to format to
* @returns {string} Time string in format provided
*/
Expand Down
12 changes: 10 additions & 2 deletions src/resources/js/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@
"browser": true,
"es6": true
},
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"es5/no-block-scoping": 0,
"es5/no-template-literals": 0,
"es5/no-arrow-functions": 0
"es5/no-arrow-functions": 0,
"es5/no-shorthand-properties": 0,
"es5/no-destructuring": 0,
"es5/no-es6-methods": 0,
"es5/no-spread": 0
},
"globals": {
"_": true,
Expand All @@ -27,6 +34,7 @@
"TribeOnboardingHints": true,
"TribeOnboardingTour": true,
"tec_automator": true,
"tribe_dropdowns": true
"tribe_dropdowns": true,
"commonIan": true
}
}
16 changes: 10 additions & 6 deletions src/resources/js/admin/help-hub-iframe.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
/* eslint-disable max-len */
// eslint-disable-next-line no-redeclare
var tribe = tribe || {};
tribe.helpPage = tribe.helpPage || {};
window.DocsBotAI = window.DocsBotAI || {};

( ( $, obj ) => {
'use strict';

/* global zE, helpHubSettings */

obj.selectors = {
body: 'body',
helpHubPageID: 'help-hub-page',
Expand Down Expand Up @@ -247,7 +251,7 @@ window.DocsBotAI = window.DocsBotAI || {};
if ( element ) {
return resolve( element );
}
const observer = new MutationObserver( ( mutations ) => {
const observer = new MutationObserver( () => {
const foundElement = document.querySelector( selector );
if ( foundElement ) {
resolve( foundElement );
Expand All @@ -272,7 +276,7 @@ window.DocsBotAI = window.DocsBotAI || {};
obj.initializeDocsBot = () => {
const bodyElement = document.getElementById( obj.selectors.helpHubPageID );
document.getElementById(obj.selectors.docsbotWidget).classList.remove( 'hide' );
DocsBotAI.init = ( e ) => {
window.DocsBotAI.init = ( e ) => {
return new Promise( ( resolve, reject ) => {
const script = document.createElement( 'script' );
script.type = 'text/javascript';
Expand All @@ -289,9 +293,9 @@ window.DocsBotAI = window.DocsBotAI || {};
'load',
() => {
Promise.all( [
window.DocsBotAI.mount( { ...e } ),
obj.observeElement( '#docsbotai-root' ),
] )
window.DocsBotAI.mount( { ...e } ),
obj.observeElement( '#docsbotai-root' ),
] )
.then( resolve )
.catch( reject );
}
Expand All @@ -306,7 +310,7 @@ window.DocsBotAI = window.DocsBotAI || {};
} );
};

DocsBotAI.init( {
window.DocsBotAI.init( {
id: helpHubSettings.docsbot_key,
options: {
customCSS: obj.DocsBotAIcss,
Expand Down
4 changes: 3 additions & 1 deletion src/resources/js/admin/help-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ tribe.helpPage = tribe.helpPage || {};

// Find the currently active tab and corresponding container.
let currentTab = document.querySelector( '.tec-nav__tab.tec-nav__tab--active' );
let tabContainer = currentTab ? document.getElementById( currentTab.getAttribute( 'data-tab-target' ) ) : null;
let tabContainer = currentTab
? document.getElementById( currentTab.getAttribute( 'data-tab-target' ) )
: null;

// Update modal button span text to the active tab’s text by default.
if (currentTab) {
Expand Down
20 changes: 15 additions & 5 deletions src/resources/js/ian-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
window.addEventListener("resize", calculateSidebarPosition);
window.addEventListener("scroll", onScroll);

if (Ian.consent == "true") getIan(true);
if (Ian.consent === "true") getIan(true);
};

/**
Expand All @@ -40,7 +40,9 @@
* @return {void}
*/
const wrapHeadings = () => {
const headings = document.querySelectorAll(".edit-php.post-type-tribe_events h1, .post-php.post-type-tribe_events h1");
const headings = document.querySelectorAll(
".edit-php.post-type-tribe_events h1, .post-php.post-type-tribe_events h1"
);
headings.forEach(heading => {
const pageAction = heading.nextElementSibling;
if (pageAction) {
Expand Down Expand Up @@ -119,6 +121,7 @@
break;

default:
// eslint-disable-next-line no-console
console.log('e.composedPath', e.composedPath());
// Not an event we care about.
break;
Expand Down Expand Up @@ -188,7 +191,9 @@

let settingstabs = document.getElementById("tribe-settings-tabs");
if (settingstabs) {
settingstabs = window.innerWidth > 500 ? settingstabs : document.querySelector('.tec-settings-header-wrap');
settingstabs = window.innerWidth > 500
? settingstabs
: document.querySelector('.tec-settings-header-wrap');
rect = settingstabs.getBoundingClientRect();
}

Expand Down Expand Up @@ -232,7 +237,6 @@
*/
const updatePosition = () => {
const offset = window.innerWidth > 782 ? 32 : window.innerWidth > 600 ? 46 : 0;
const scrollY = window.scrollY;
const initialTop = getParentPosition();
if (initialTop <= offset) {
Ian.sidebar.style.top = offset + 'px';
Expand Down Expand Up @@ -311,6 +315,7 @@
let read = "";
let unread = "";

// eslint-disable-next-line es5/no-destructuring, no-unused-vars
Object.entries(response.data).forEach(([key, item]) => {
if (item.read) {
read += item.html;
Expand All @@ -321,6 +326,7 @@
}
});

// eslint-disable-next-line max-len
const separator = `<div class="ian-sidebar__separator"><div>${Ian.readTxt}</div><span></span></div>`;
Ian.notifications.innerHTML = unread + separator + read;
}
Expand Down Expand Up @@ -456,12 +462,16 @@
Ian.loader.classList.add("is-hidden");

if (response.success) {
// eslint-disable-next-line es5/no-spread
Ian.feed.read = [...Ian.feed.read, ...Ian.feed.unread];
Ian.feed.unread = [];
const read = Ian.feed.read.map(item => item.html).join("");
// eslint-disable-next-line max-len
const separator = `<div class="ian-sidebar__separator"><div>${Ian.readTxt}</div><span></span></div>`;
Ian.notifications.innerHTML = separator + read;
document.querySelectorAll('.ian-sidebar__notification-link--right').forEach(el => el.remove());
document
.querySelectorAll('.ian-sidebar__notification-link--right')
.forEach(el => el.remove());
updateIan();
} else {
console.error("Failed to read all notifications:", response.message || "Unknown error");
Expand Down