2018-06-28 13:52:45 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2018-06-29 15:20:08 +00:00
|
|
|
import { __ } from '@wordpress/i18n';
|
2018-07-06 12:40:05 +00:00
|
|
|
import clickOutside from 'react-click-outside';
|
2020-04-29 18:01:27 +00:00
|
|
|
import { Component, lazy, Suspense } from '@wordpress/element';
|
2020-08-05 22:02:24 +00:00
|
|
|
import { Button } from '@wordpress/components';
|
2020-06-30 15:10:26 +00:00
|
|
|
import { compose } from '@wordpress/compose';
|
2020-08-05 22:02:24 +00:00
|
|
|
import { withDispatch } from '@wordpress/data';
|
|
|
|
import { uniqueId, find } from 'lodash';
|
2020-04-29 18:01:27 +00:00
|
|
|
import PagesIcon from 'gridicons/dist/pages';
|
|
|
|
import CrossIcon from 'gridicons/dist/cross-small';
|
2020-08-05 22:02:24 +00:00
|
|
|
import classnames from 'classnames';
|
2020-08-03 21:54:57 +00:00
|
|
|
import { Icon, lifesaver } from '@wordpress/icons';
|
2020-08-05 22:02:24 +00:00
|
|
|
import { getSetting, getAdminLink } from '@woocommerce/wc-admin-settings';
|
2020-07-14 12:20:51 +00:00
|
|
|
import { H, Section, Spinner } from '@woocommerce/components';
|
|
|
|
import { OPTIONS_STORE_NAME } from '@woocommerce/data';
|
2020-08-05 22:02:24 +00:00
|
|
|
import { getHistory, getNewPath } from '@woocommerce/navigation';
|
2020-07-14 12:20:51 +00:00
|
|
|
|
2018-06-28 13:52:45 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2018-06-29 15:20:08 +00:00
|
|
|
import './style.scss';
|
2018-07-09 15:46:31 +00:00
|
|
|
import ActivityPanelToggleBubble from './toggle-bubble';
|
2019-03-29 02:45:19 +00:00
|
|
|
import {
|
|
|
|
getUnreadNotes,
|
|
|
|
getUnreadOrders,
|
2019-04-30 09:40:10 +00:00
|
|
|
getUnapprovedReviews,
|
2019-03-29 02:45:19 +00:00
|
|
|
getUnreadStock,
|
|
|
|
} from './unread-indicators';
|
2020-08-13 02:05:22 +00:00
|
|
|
import { isOnboardingEnabled, isWCAdmin } from '../../dashboard/utils';
|
|
|
|
import withSelect from '../../wc-api/with-select';
|
|
|
|
import { Tabs } from './tabs';
|
|
|
|
import { SetupProgress } from './setup-progress';
|
2020-07-14 12:20:51 +00:00
|
|
|
|
|
|
|
const HelpPanel = lazy( () =>
|
|
|
|
import( /* webpackChunkName: "activity-panels-help" */ './panels/help' )
|
|
|
|
);
|
|
|
|
|
2020-04-29 18:01:27 +00:00
|
|
|
const InboxPanel = lazy( () =>
|
|
|
|
import( /* webpackChunkName: "activity-panels-inbox" */ './panels/inbox' )
|
|
|
|
);
|
|
|
|
const OrdersPanel = lazy( () =>
|
|
|
|
import( /* webpackChunkName: "activity-panels-orders" */ './panels/orders' )
|
|
|
|
);
|
|
|
|
const StockPanel = lazy( () =>
|
|
|
|
import( /* webpackChunkName: "activity-panels-stock" */ './panels/stock' )
|
|
|
|
);
|
|
|
|
const ReviewsPanel = lazy( () =>
|
|
|
|
import( /* webpackChunkName: "activity-panels-inbox" */ './panels/reviews' )
|
|
|
|
);
|
|
|
|
|
2019-09-23 21:47:08 +00:00
|
|
|
const manageStock = getSetting( 'manageStock', 'no' );
|
|
|
|
const reviewsEnabled = getSetting( 'reviewsEnabled', 'no' );
|
2020-07-14 12:20:51 +00:00
|
|
|
export class ActivityPanel extends Component {
|
2020-08-05 22:02:24 +00:00
|
|
|
constructor( props ) {
|
|
|
|
super( props );
|
2018-06-28 13:52:45 +00:00
|
|
|
this.state = {
|
2018-06-29 15:20:08 +00:00
|
|
|
isPanelOpen: false,
|
|
|
|
mobileOpen: false,
|
2018-06-28 13:52:45 +00:00
|
|
|
currentTab: '',
|
2019-07-25 01:34:53 +00:00
|
|
|
isPanelSwitching: false,
|
2018-06-28 13:52:45 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-08-05 22:02:24 +00:00
|
|
|
togglePanel( { name: tabName }, isTabOpen ) {
|
2020-02-14 02:23:21 +00:00
|
|
|
this.setState( ( state ) => {
|
2020-08-05 22:02:24 +00:00
|
|
|
const isPanelSwitching =
|
|
|
|
tabName !== state.currentTab &&
|
|
|
|
state.currentTab !== '' &&
|
|
|
|
isTabOpen &&
|
|
|
|
state.isPanelOpen;
|
|
|
|
|
|
|
|
return {
|
|
|
|
isPanelOpen: isTabOpen,
|
|
|
|
mobileOpen: isTabOpen,
|
|
|
|
currentTab: tabName,
|
|
|
|
isPanelSwitching,
|
|
|
|
};
|
2018-06-29 15:20:08 +00:00
|
|
|
} );
|
|
|
|
}
|
|
|
|
|
2020-08-05 22:02:24 +00:00
|
|
|
closePanel() {
|
|
|
|
this.setState( () => ( {
|
|
|
|
isPanelOpen: false,
|
|
|
|
currentTab: '',
|
|
|
|
} ) );
|
|
|
|
}
|
|
|
|
|
2019-07-25 01:33:41 +00:00
|
|
|
clearPanel() {
|
2020-08-05 22:02:24 +00:00
|
|
|
this.setState( () => ( {
|
|
|
|
isPanelSwitching: false,
|
|
|
|
} ) );
|
2019-07-25 01:33:41 +00:00
|
|
|
}
|
|
|
|
|
2018-06-29 15:20:08 +00:00
|
|
|
// On smaller screen, the panel buttons are hidden behind a toggle.
|
|
|
|
toggleMobile() {
|
2018-09-05 18:52:48 +00:00
|
|
|
const tabs = this.getTabs();
|
2020-02-14 02:23:21 +00:00
|
|
|
this.setState( ( state ) => ( {
|
2018-06-29 15:20:08 +00:00
|
|
|
mobileOpen: ! state.mobileOpen,
|
2018-09-05 18:52:48 +00:00
|
|
|
currentTab: state.mobileOpen ? '' : tabs[ 0 ].name,
|
2018-06-29 15:20:08 +00:00
|
|
|
isPanelOpen: ! state.mobileOpen,
|
|
|
|
} ) );
|
2018-06-28 13:52:45 +00:00
|
|
|
}
|
|
|
|
|
Inbox notification: layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4218)
* Inbox notification: Added layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4256)
* Added notes layout and image to the API
Added note layout and note image to the API and the DB
* Unit test modified
Unit test where modified to adapt them to the new elements
* Changed the frontend following the new designs.
The fronted was changed to follow the new inbox messages design.
* Changed default layout type in DB
* Added all the requested visual element
Changed the cards' js, css and actions to achieve the visual requirements
* Added "layout" and "image" to inboxQuery
* Modal confirmation buttons repaired
* Added "layout" and "image" to docs examples.
* Removed "updateNote" from action.js
Removed "updateNote" from action.js, I left it by mistake.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* noteName removed and icon added to make code reviewing easier
This commit removes the "noteName" from card.js and adds the icon to make code reviewing easier
* Dismiss action button refactor
Refactor of the dismiss action button in the InboxNoteCard class
* Removed unnecessary control
* Destructured all the note properties
* Colors replaced by existing variable
* Removed setting of layout and image in the creation of the notes
* Removed blank lines added by mistake
* Close dismiss dropdown when clicking away from the popover.
* Prevented the closing of the inbox panel with an action in the modal
* Added small design changes
* Removed unused "Gridicon" import
* Prevent showing the image tag when the layout is blank
* The method name getDismissButton was changed to getDismissConfirmationButton
* Removed unnecessary vendor-prefixed properties
* Improved note filtering in unreadNotes method
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Remove icons (https://github.com/woocommerce/woocommerce-admin/pull/4258)
* Info icon removed from inbox notifications
The info icon was removed from inbox notifications
# Conflicts:
# src/Notes/DataStore.php
* Removed "icon" from inboxQuery
* Tests repeared
Some problems with the unit tests were repaired in this commit
# Conflicts:
# docs/examples/activity-panel-inbox.md
# Conflicts:
# tests/api/admin-notes.php
* Removed icon from card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Inbox notification: Add dismiss functionality (https://github.com/woocommerce/woocommerce-admin/pull/4262)
* Added is_deleted param to soft delete
# Conflicts:
# src/API/Notes.php
# src/Install.php
# src/Notes/DataStore.php
# src/Notes/WC_Admin_Note.php
# src/Notes/WC_Admin_Notes.php
# tests/api/admin-notes.php
* Added the Dismiss functionality
# Conflicts:
# client/header/activity-panel/panels/inbox/action.js
* Where clause repeared
* Added Snackbar after action.
* API modified to dismiss notes
* Small refactor in "get_item" method
This commit adds a small refactor in "get_item" method to use "prepare_note_data_for_response"
* Added missing logic to Dismiss note
This commit adds missing client logic to Dismiss note.
# Conflicts:
# client/header/activity-panel/panels/inbox/action.js
# client/header/activity-panel/panels/inbox/card.js
* Moved the delete action to WC_Admin_Notes.php
The delete action was moved to WC_Admin_Notes.php to follow the pattern.
* Added changes to dismiss messages
This commit addeds changes to the messages soft delete.
* DataStore.php repaired
This commits adds some code that was deleted by mistake and the param "is_deleted" has been escaped.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* Repaired "get_notes_where_clauses" method
A problem with the deleted notes was repaired
* Added a comment to DataStore.php
* Stopped sending the "dismissType" to action.js
The "dismissType" is not sent to action.js anymore.
* Bugfix: now the method get_notes_with_name also returns deleted notes
* Bugfix: repaired empty notification list
This commit repairs a bug that happens when there isn't anything in the inbox notification list
* Small refactor to not use "some" Lodash method anymore
* Small refactor in rednderNotes method
* Added check to set_layout
* Added small refactor to delete_all_notes method
* Fixed code comment error
* Bugfix: repaired the "delete_note" call
* Inbox notification: Added layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4256)
* Added notes layout and image to the API
Added note layout and note image to the API and the DB
* Unit test modified
Unit test where modified to adapt them to the new elements
* Changed the frontend following the new designs.
The fronted was changed to follow the new inbox messages design.
* Changed default layout type in DB
* Added all the requested visual element
Changed the cards' js, css and actions to achieve the visual requirements
* Added "layout" and "image" to inboxQuery
* Modal confirmation buttons repaired
* Added "layout" and "image" to docs examples.
* Removed "updateNote" from action.js
Removed "updateNote" from action.js, I left it by mistake.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* noteName removed and icon added to make code reviewing easier
This commit removes the "noteName" from card.js and adds the icon to make code reviewing easier
* Dismiss action button refactor
Refactor of the dismiss action button in the InboxNoteCard class
* Removed unnecessary control
* Destructured all the note properties
* Colors replaced by existing variable
* Removed setting of layout and image in the creation of the notes
* Removed blank lines added by mistake
* Close dismiss dropdown when clicking away from the popover.
* Prevented the closing of the inbox panel with an action in the modal
* Added small design changes
* Removed unused "Gridicon" import
* Prevent showing the image tag when the layout is blank
* The method name getDismissButton was changed to getDismissConfirmationButton
* Removed unnecessary vendor-prefixed properties
* Improved note filtering in unreadNotes method
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Remove icons (https://github.com/woocommerce/woocommerce-admin/pull/4258)
* Info icon removed from inbox notifications
The info icon was removed from inbox notifications
# Conflicts:
# src/Notes/DataStore.php
* Removed "icon" from inboxQuery
* Tests repeared
Some problems with the unit tests were repaired in this commit
# Conflicts:
# docs/examples/activity-panel-inbox.md
# Conflicts:
# tests/api/admin-notes.php
* Removed icon from card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Improved error handling for the set_layout method
* Bugfix: fixed error handling clicks inside dropdowns
* Bugfix: repaired dropdown onBlur handler
This commit repairs a weird behavior that the dropdown onBlur handler method had sometimes.
* Text error changed
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Add undo snackbar button after deletion (https://github.com/woocommerce/woocommerce-admin/pull/4281)
* Added undo snakbar button for a single note
# Conflicts:
# client/wc-api/notes/mutations.js
# src/Notes/DataStore.php
# src/Notes/WC_Admin_Notes.php
* Added a button to undo the deletion of all notes
# Conflicts:
# client/wc-api/notes/operations.js
# src/API/Notes.php
* Code adapted to make code reviewing easier
There was some code that also was present in another PR, that code was removed to make code reviewing easier.
* UnitTest added
This commit adds some unit tests
* Added verification for API response
* Added casting to $note_id
* Inbox notification: Added layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4256)
* Added notes layout and image to the API
Added note layout and note image to the API and the DB
* Unit test modified
Unit test where modified to adapt them to the new elements
* Changed the frontend following the new designs.
The fronted was changed to follow the new inbox messages design.
* Changed default layout type in DB
* Added all the requested visual element
Changed the cards' js, css and actions to achieve the visual requirements
* Added "layout" and "image" to inboxQuery
* Modal confirmation buttons repaired
* Added "layout" and "image" to docs examples.
* Removed "updateNote" from action.js
Removed "updateNote" from action.js, I left it by mistake.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* noteName removed and icon added to make code reviewing easier
This commit removes the "noteName" from card.js and adds the icon to make code reviewing easier
* Dismiss action button refactor
Refactor of the dismiss action button in the InboxNoteCard class
* Removed unnecessary control
* Destructured all the note properties
* Colors replaced by existing variable
* Removed setting of layout and image in the creation of the notes
* Removed blank lines added by mistake
* Close dismiss dropdown when clicking away from the popover.
* Prevented the closing of the inbox panel with an action in the modal
* Added small design changes
* Removed unused "Gridicon" import
* Prevent showing the image tag when the layout is blank
* The method name getDismissButton was changed to getDismissConfirmationButton
* Removed unnecessary vendor-prefixed properties
* Improved note filtering in unreadNotes method
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Remove icons (https://github.com/woocommerce/woocommerce-admin/pull/4258)
* Info icon removed from inbox notifications
The info icon was removed from inbox notifications
# Conflicts:
# src/Notes/DataStore.php
* Removed "icon" from inboxQuery
* Tests repeared
Some problems with the unit tests were repaired in this commit
# Conflicts:
# docs/examples/activity-panel-inbox.md
# Conflicts:
# tests/api/admin-notes.php
* Removed icon from card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Inbox notification: Add dismiss functionality (https://github.com/woocommerce/woocommerce-admin/pull/4262)
* Added is_deleted param to soft delete
# Conflicts:
# src/API/Notes.php
# src/Install.php
# src/Notes/DataStore.php
# src/Notes/WC_Admin_Note.php
# src/Notes/WC_Admin_Notes.php
# tests/api/admin-notes.php
* Added the Dismiss functionality
# Conflicts:
# client/header/activity-panel/panels/inbox/action.js
* Where clause repeared
* Added Snackbar after action.
* API modified to dismiss notes
* Small refactor in "get_item" method
This commit adds a small refactor in "get_item" method to use "prepare_note_data_for_response"
* Added missing logic to Dismiss note
This commit adds missing client logic to Dismiss note.
# Conflicts:
# client/header/activity-panel/panels/inbox/action.js
# client/header/activity-panel/panels/inbox/card.js
* Moved the delete action to WC_Admin_Notes.php
The delete action was moved to WC_Admin_Notes.php to follow the pattern.
* Added changes to dismiss messages
This commit addeds changes to the messages soft delete.
* DataStore.php repaired
This commits adds some code that was deleted by mistake and the param "is_deleted" has been escaped.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* Repaired "get_notes_where_clauses" method
A problem with the deleted notes was repaired
* Added a comment to DataStore.php
* Stopped sending the "dismissType" to action.js
The "dismissType" is not sent to action.js anymore.
* Bugfix: now the method get_notes_with_name also returns deleted notes
* Bugfix: repaired empty notification list
This commit repairs a bug that happens when there isn't anything in the inbox notification list
* Small refactor to not use "some" Lodash method anymore
* Small refactor in rednderNotes method
* Added check to set_layout
* Added small refactor to delete_all_notes method
* Fixed code comment error
* Bugfix: repaired the "delete_note" call
* Inbox notification: Added layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4256)
* Added notes layout and image to the API
Added note layout and note image to the API and the DB
* Unit test modified
Unit test where modified to adapt them to the new elements
* Changed the frontend following the new designs.
The fronted was changed to follow the new inbox messages design.
* Changed default layout type in DB
* Added all the requested visual element
Changed the cards' js, css and actions to achieve the visual requirements
* Added "layout" and "image" to inboxQuery
* Modal confirmation buttons repaired
* Added "layout" and "image" to docs examples.
* Removed "updateNote" from action.js
Removed "updateNote" from action.js, I left it by mistake.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* noteName removed and icon added to make code reviewing easier
This commit removes the "noteName" from card.js and adds the icon to make code reviewing easier
* Dismiss action button refactor
Refactor of the dismiss action button in the InboxNoteCard class
* Removed unnecessary control
* Destructured all the note properties
* Colors replaced by existing variable
* Removed setting of layout and image in the creation of the notes
* Removed blank lines added by mistake
* Close dismiss dropdown when clicking away from the popover.
* Prevented the closing of the inbox panel with an action in the modal
* Added small design changes
* Removed unused "Gridicon" import
* Prevent showing the image tag when the layout is blank
* The method name getDismissButton was changed to getDismissConfirmationButton
* Removed unnecessary vendor-prefixed properties
* Improved note filtering in unreadNotes method
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Remove icons (https://github.com/woocommerce/woocommerce-admin/pull/4258)
* Info icon removed from inbox notifications
The info icon was removed from inbox notifications
# Conflicts:
# src/Notes/DataStore.php
* Removed "icon" from inboxQuery
* Tests repeared
Some problems with the unit tests were repaired in this commit
# Conflicts:
# docs/examples/activity-panel-inbox.md
# Conflicts:
# tests/api/admin-notes.php
* Removed icon from card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Improved error handling for the set_layout method
* Bugfix: fixed error handling clicks inside dropdowns
* Bugfix: repaired dropdown onBlur handler
This commit repairs a weird behavior that the dropdown onBlur handler method had sometimes.
* Text error changed
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Stopped sending the "dismissType" to action.js
The "dismissType" is not sent to action.js anymore.
# Conflicts:
# client/header/activity-panel/panels/inbox/card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Bugfix: solved problem when a note was undismissed
There was a problem with the undismiss functionality. When a note was undismissed, it always was recovered with "plain" layout. This commit solves this problem.
* Inbox notification: add event recording (https://github.com/woocommerce/woocommerce-admin/pull/4320)
* Added events recording
This commit adds events recording to the inbox notifications
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Added 'home_screen' verification
Changed recorded name, now when the client is in the WooCommerce 'home' page we record 'home_screen' instead of 'wc-admin'.
* Added a naming fix and a new prop to the recordEvent
* bugfix: added control before interaction with bodyNotificationRef
* Added more unit tests for new endpoints
This commit adds tests for deleting a single note and for deleting all the notes, both without permission.
* Modified variable name
* Refactor: prop rename and small logic change
* Screen name getter moved into the InboxNoteCard
This commit moves the screen name getter inside the InboxNoteCard.
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Removed "screen" from state
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Refactor in admin-notes unit tests
Some unnecessary controls were removed from the admin-notes unit tests
* Indentation fixed in Install.php. Replaced spaces with tabs.
* Inbox notification: added new placeholder and empty card (https://github.com/woocommerce/woocommerce-admin/pull/4379)
* Added a new placeholder and an empty card
This commit adds a new placeholder and a new empty card to the inbox panel
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
# client/header/activity-panel/panels/inbox/style.scss
* Added border to read notes
* Improved note filtering in unreadNotes method and validNotes
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Actions render refactored
The actions render was refactored in InboxNoteCard component
* Refactor of InboxPanel component
The methods getUnreadNotesCount and hasValidNotes were separated from the InboxPanel component
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Refactor inbox panel subtitle classes
* Added changes for when a note is undismissed
This commit adds the requested changes in behavior and design for when a note is dismissed.
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Bugfix: Added key to itemlist
The InboxNotePlaceholder is shown as an itemlist but it didn't have a key. This commit adds it.
* Removed unnecessary validation
* Refactored actionList map
This commit adds a refactor to the actionList map
* Changes to the getUndoDismissRequesting functionality
This commit adds a few changes to the getUndoDismissRequesting functionality
* Changed className prop
* Changed other className prop
* Modified InboxPanel rendering
* Removed unnecessary method in placeholder.js
* Simplified the card.js renderActions method
* Change renderActions return in card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Inbox notification: add client unit tests (https://github.com/woocommerce/woocommerce-admin/pull/4386)
* Added client unit tests
* Added test cases for getUnreadNotesCount and hasValidNotes
* Corrected typo error
* Removed Enzyme and added React Testing Library
* Removed unnecessary param
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Resolved some conflicts with master
* Marketing note test repaired
This commit repairs the marketing note test
* Added note type 'marketing' to delete all functionality
* Removed set_icon method from some notes and docs
* Added set_icon method as deprecated to prevent errors.
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2020-06-03 11:43:35 +00:00
|
|
|
handleClickOutside( event ) {
|
2020-08-05 22:02:24 +00:00
|
|
|
const { isPanelOpen } = this.state;
|
Inbox notification: layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4218)
* Inbox notification: Added layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4256)
* Added notes layout and image to the API
Added note layout and note image to the API and the DB
* Unit test modified
Unit test where modified to adapt them to the new elements
* Changed the frontend following the new designs.
The fronted was changed to follow the new inbox messages design.
* Changed default layout type in DB
* Added all the requested visual element
Changed the cards' js, css and actions to achieve the visual requirements
* Added "layout" and "image" to inboxQuery
* Modal confirmation buttons repaired
* Added "layout" and "image" to docs examples.
* Removed "updateNote" from action.js
Removed "updateNote" from action.js, I left it by mistake.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* noteName removed and icon added to make code reviewing easier
This commit removes the "noteName" from card.js and adds the icon to make code reviewing easier
* Dismiss action button refactor
Refactor of the dismiss action button in the InboxNoteCard class
* Removed unnecessary control
* Destructured all the note properties
* Colors replaced by existing variable
* Removed setting of layout and image in the creation of the notes
* Removed blank lines added by mistake
* Close dismiss dropdown when clicking away from the popover.
* Prevented the closing of the inbox panel with an action in the modal
* Added small design changes
* Removed unused "Gridicon" import
* Prevent showing the image tag when the layout is blank
* The method name getDismissButton was changed to getDismissConfirmationButton
* Removed unnecessary vendor-prefixed properties
* Improved note filtering in unreadNotes method
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Remove icons (https://github.com/woocommerce/woocommerce-admin/pull/4258)
* Info icon removed from inbox notifications
The info icon was removed from inbox notifications
# Conflicts:
# src/Notes/DataStore.php
* Removed "icon" from inboxQuery
* Tests repeared
Some problems with the unit tests were repaired in this commit
# Conflicts:
# docs/examples/activity-panel-inbox.md
# Conflicts:
# tests/api/admin-notes.php
* Removed icon from card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Inbox notification: Add dismiss functionality (https://github.com/woocommerce/woocommerce-admin/pull/4262)
* Added is_deleted param to soft delete
# Conflicts:
# src/API/Notes.php
# src/Install.php
# src/Notes/DataStore.php
# src/Notes/WC_Admin_Note.php
# src/Notes/WC_Admin_Notes.php
# tests/api/admin-notes.php
* Added the Dismiss functionality
# Conflicts:
# client/header/activity-panel/panels/inbox/action.js
* Where clause repeared
* Added Snackbar after action.
* API modified to dismiss notes
* Small refactor in "get_item" method
This commit adds a small refactor in "get_item" method to use "prepare_note_data_for_response"
* Added missing logic to Dismiss note
This commit adds missing client logic to Dismiss note.
# Conflicts:
# client/header/activity-panel/panels/inbox/action.js
# client/header/activity-panel/panels/inbox/card.js
* Moved the delete action to WC_Admin_Notes.php
The delete action was moved to WC_Admin_Notes.php to follow the pattern.
* Added changes to dismiss messages
This commit addeds changes to the messages soft delete.
* DataStore.php repaired
This commits adds some code that was deleted by mistake and the param "is_deleted" has been escaped.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* Repaired "get_notes_where_clauses" method
A problem with the deleted notes was repaired
* Added a comment to DataStore.php
* Stopped sending the "dismissType" to action.js
The "dismissType" is not sent to action.js anymore.
* Bugfix: now the method get_notes_with_name also returns deleted notes
* Bugfix: repaired empty notification list
This commit repairs a bug that happens when there isn't anything in the inbox notification list
* Small refactor to not use "some" Lodash method anymore
* Small refactor in rednderNotes method
* Added check to set_layout
* Added small refactor to delete_all_notes method
* Fixed code comment error
* Bugfix: repaired the "delete_note" call
* Inbox notification: Added layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4256)
* Added notes layout and image to the API
Added note layout and note image to the API and the DB
* Unit test modified
Unit test where modified to adapt them to the new elements
* Changed the frontend following the new designs.
The fronted was changed to follow the new inbox messages design.
* Changed default layout type in DB
* Added all the requested visual element
Changed the cards' js, css and actions to achieve the visual requirements
* Added "layout" and "image" to inboxQuery
* Modal confirmation buttons repaired
* Added "layout" and "image" to docs examples.
* Removed "updateNote" from action.js
Removed "updateNote" from action.js, I left it by mistake.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* noteName removed and icon added to make code reviewing easier
This commit removes the "noteName" from card.js and adds the icon to make code reviewing easier
* Dismiss action button refactor
Refactor of the dismiss action button in the InboxNoteCard class
* Removed unnecessary control
* Destructured all the note properties
* Colors replaced by existing variable
* Removed setting of layout and image in the creation of the notes
* Removed blank lines added by mistake
* Close dismiss dropdown when clicking away from the popover.
* Prevented the closing of the inbox panel with an action in the modal
* Added small design changes
* Removed unused "Gridicon" import
* Prevent showing the image tag when the layout is blank
* The method name getDismissButton was changed to getDismissConfirmationButton
* Removed unnecessary vendor-prefixed properties
* Improved note filtering in unreadNotes method
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Remove icons (https://github.com/woocommerce/woocommerce-admin/pull/4258)
* Info icon removed from inbox notifications
The info icon was removed from inbox notifications
# Conflicts:
# src/Notes/DataStore.php
* Removed "icon" from inboxQuery
* Tests repeared
Some problems with the unit tests were repaired in this commit
# Conflicts:
# docs/examples/activity-panel-inbox.md
# Conflicts:
# tests/api/admin-notes.php
* Removed icon from card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Improved error handling for the set_layout method
* Bugfix: fixed error handling clicks inside dropdowns
* Bugfix: repaired dropdown onBlur handler
This commit repairs a weird behavior that the dropdown onBlur handler method had sometimes.
* Text error changed
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Add undo snackbar button after deletion (https://github.com/woocommerce/woocommerce-admin/pull/4281)
* Added undo snakbar button for a single note
# Conflicts:
# client/wc-api/notes/mutations.js
# src/Notes/DataStore.php
# src/Notes/WC_Admin_Notes.php
* Added a button to undo the deletion of all notes
# Conflicts:
# client/wc-api/notes/operations.js
# src/API/Notes.php
* Code adapted to make code reviewing easier
There was some code that also was present in another PR, that code was removed to make code reviewing easier.
* UnitTest added
This commit adds some unit tests
* Added verification for API response
* Added casting to $note_id
* Inbox notification: Added layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4256)
* Added notes layout and image to the API
Added note layout and note image to the API and the DB
* Unit test modified
Unit test where modified to adapt them to the new elements
* Changed the frontend following the new designs.
The fronted was changed to follow the new inbox messages design.
* Changed default layout type in DB
* Added all the requested visual element
Changed the cards' js, css and actions to achieve the visual requirements
* Added "layout" and "image" to inboxQuery
* Modal confirmation buttons repaired
* Added "layout" and "image" to docs examples.
* Removed "updateNote" from action.js
Removed "updateNote" from action.js, I left it by mistake.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* noteName removed and icon added to make code reviewing easier
This commit removes the "noteName" from card.js and adds the icon to make code reviewing easier
* Dismiss action button refactor
Refactor of the dismiss action button in the InboxNoteCard class
* Removed unnecessary control
* Destructured all the note properties
* Colors replaced by existing variable
* Removed setting of layout and image in the creation of the notes
* Removed blank lines added by mistake
* Close dismiss dropdown when clicking away from the popover.
* Prevented the closing of the inbox panel with an action in the modal
* Added small design changes
* Removed unused "Gridicon" import
* Prevent showing the image tag when the layout is blank
* The method name getDismissButton was changed to getDismissConfirmationButton
* Removed unnecessary vendor-prefixed properties
* Improved note filtering in unreadNotes method
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Remove icons (https://github.com/woocommerce/woocommerce-admin/pull/4258)
* Info icon removed from inbox notifications
The info icon was removed from inbox notifications
# Conflicts:
# src/Notes/DataStore.php
* Removed "icon" from inboxQuery
* Tests repeared
Some problems with the unit tests were repaired in this commit
# Conflicts:
# docs/examples/activity-panel-inbox.md
# Conflicts:
# tests/api/admin-notes.php
* Removed icon from card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Inbox notification: Add dismiss functionality (https://github.com/woocommerce/woocommerce-admin/pull/4262)
* Added is_deleted param to soft delete
# Conflicts:
# src/API/Notes.php
# src/Install.php
# src/Notes/DataStore.php
# src/Notes/WC_Admin_Note.php
# src/Notes/WC_Admin_Notes.php
# tests/api/admin-notes.php
* Added the Dismiss functionality
# Conflicts:
# client/header/activity-panel/panels/inbox/action.js
* Where clause repeared
* Added Snackbar after action.
* API modified to dismiss notes
* Small refactor in "get_item" method
This commit adds a small refactor in "get_item" method to use "prepare_note_data_for_response"
* Added missing logic to Dismiss note
This commit adds missing client logic to Dismiss note.
# Conflicts:
# client/header/activity-panel/panels/inbox/action.js
# client/header/activity-panel/panels/inbox/card.js
* Moved the delete action to WC_Admin_Notes.php
The delete action was moved to WC_Admin_Notes.php to follow the pattern.
* Added changes to dismiss messages
This commit addeds changes to the messages soft delete.
* DataStore.php repaired
This commits adds some code that was deleted by mistake and the param "is_deleted" has been escaped.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* Repaired "get_notes_where_clauses" method
A problem with the deleted notes was repaired
* Added a comment to DataStore.php
* Stopped sending the "dismissType" to action.js
The "dismissType" is not sent to action.js anymore.
* Bugfix: now the method get_notes_with_name also returns deleted notes
* Bugfix: repaired empty notification list
This commit repairs a bug that happens when there isn't anything in the inbox notification list
* Small refactor to not use "some" Lodash method anymore
* Small refactor in rednderNotes method
* Added check to set_layout
* Added small refactor to delete_all_notes method
* Fixed code comment error
* Bugfix: repaired the "delete_note" call
* Inbox notification: Added layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4256)
* Added notes layout and image to the API
Added note layout and note image to the API and the DB
* Unit test modified
Unit test where modified to adapt them to the new elements
* Changed the frontend following the new designs.
The fronted was changed to follow the new inbox messages design.
* Changed default layout type in DB
* Added all the requested visual element
Changed the cards' js, css and actions to achieve the visual requirements
* Added "layout" and "image" to inboxQuery
* Modal confirmation buttons repaired
* Added "layout" and "image" to docs examples.
* Removed "updateNote" from action.js
Removed "updateNote" from action.js, I left it by mistake.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* noteName removed and icon added to make code reviewing easier
This commit removes the "noteName" from card.js and adds the icon to make code reviewing easier
* Dismiss action button refactor
Refactor of the dismiss action button in the InboxNoteCard class
* Removed unnecessary control
* Destructured all the note properties
* Colors replaced by existing variable
* Removed setting of layout and image in the creation of the notes
* Removed blank lines added by mistake
* Close dismiss dropdown when clicking away from the popover.
* Prevented the closing of the inbox panel with an action in the modal
* Added small design changes
* Removed unused "Gridicon" import
* Prevent showing the image tag when the layout is blank
* The method name getDismissButton was changed to getDismissConfirmationButton
* Removed unnecessary vendor-prefixed properties
* Improved note filtering in unreadNotes method
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Remove icons (https://github.com/woocommerce/woocommerce-admin/pull/4258)
* Info icon removed from inbox notifications
The info icon was removed from inbox notifications
# Conflicts:
# src/Notes/DataStore.php
* Removed "icon" from inboxQuery
* Tests repeared
Some problems with the unit tests were repaired in this commit
# Conflicts:
# docs/examples/activity-panel-inbox.md
# Conflicts:
# tests/api/admin-notes.php
* Removed icon from card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Improved error handling for the set_layout method
* Bugfix: fixed error handling clicks inside dropdowns
* Bugfix: repaired dropdown onBlur handler
This commit repairs a weird behavior that the dropdown onBlur handler method had sometimes.
* Text error changed
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Stopped sending the "dismissType" to action.js
The "dismissType" is not sent to action.js anymore.
# Conflicts:
# client/header/activity-panel/panels/inbox/card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Bugfix: solved problem when a note was undismissed
There was a problem with the undismiss functionality. When a note was undismissed, it always was recovered with "plain" layout. This commit solves this problem.
* Inbox notification: add event recording (https://github.com/woocommerce/woocommerce-admin/pull/4320)
* Added events recording
This commit adds events recording to the inbox notifications
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Added 'home_screen' verification
Changed recorded name, now when the client is in the WooCommerce 'home' page we record 'home_screen' instead of 'wc-admin'.
* Added a naming fix and a new prop to the recordEvent
* bugfix: added control before interaction with bodyNotificationRef
* Added more unit tests for new endpoints
This commit adds tests for deleting a single note and for deleting all the notes, both without permission.
* Modified variable name
* Refactor: prop rename and small logic change
* Screen name getter moved into the InboxNoteCard
This commit moves the screen name getter inside the InboxNoteCard.
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Removed "screen" from state
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Refactor in admin-notes unit tests
Some unnecessary controls were removed from the admin-notes unit tests
* Indentation fixed in Install.php. Replaced spaces with tabs.
* Inbox notification: added new placeholder and empty card (https://github.com/woocommerce/woocommerce-admin/pull/4379)
* Added a new placeholder and an empty card
This commit adds a new placeholder and a new empty card to the inbox panel
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
# client/header/activity-panel/panels/inbox/style.scss
* Added border to read notes
* Improved note filtering in unreadNotes method and validNotes
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Actions render refactored
The actions render was refactored in InboxNoteCard component
* Refactor of InboxPanel component
The methods getUnreadNotesCount and hasValidNotes were separated from the InboxPanel component
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Refactor inbox panel subtitle classes
* Added changes for when a note is undismissed
This commit adds the requested changes in behavior and design for when a note is dismissed.
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Bugfix: Added key to itemlist
The InboxNotePlaceholder is shown as an itemlist but it didn't have a key. This commit adds it.
* Removed unnecessary validation
* Refactored actionList map
This commit adds a refactor to the actionList map
* Changes to the getUndoDismissRequesting functionality
This commit adds a few changes to the getUndoDismissRequesting functionality
* Changed className prop
* Changed other className prop
* Modified InboxPanel rendering
* Removed unnecessary method in placeholder.js
* Simplified the card.js renderActions method
* Change renderActions return in card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Inbox notification: add client unit tests (https://github.com/woocommerce/woocommerce-admin/pull/4386)
* Added client unit tests
* Added test cases for getUnreadNotesCount and hasValidNotes
* Corrected typo error
* Removed Enzyme and added React Testing Library
* Removed unnecessary param
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Resolved some conflicts with master
* Marketing note test repaired
This commit repairs the marketing note test
* Added note type 'marketing' to delete all functionality
* Removed set_icon method from some notes and docs
* Added set_icon method as deprecated to prevent errors.
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2020-06-03 11:43:35 +00:00
|
|
|
const isClickOnModalOrSnackbar =
|
|
|
|
event.target.closest(
|
|
|
|
'.woocommerce-inbox-dismiss-confirmation_modal'
|
|
|
|
) || event.target.closest( '.components-snackbar__action' );
|
2018-07-06 12:40:05 +00:00
|
|
|
|
Inbox notification: layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4218)
* Inbox notification: Added layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4256)
* Added notes layout and image to the API
Added note layout and note image to the API and the DB
* Unit test modified
Unit test where modified to adapt them to the new elements
* Changed the frontend following the new designs.
The fronted was changed to follow the new inbox messages design.
* Changed default layout type in DB
* Added all the requested visual element
Changed the cards' js, css and actions to achieve the visual requirements
* Added "layout" and "image" to inboxQuery
* Modal confirmation buttons repaired
* Added "layout" and "image" to docs examples.
* Removed "updateNote" from action.js
Removed "updateNote" from action.js, I left it by mistake.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* noteName removed and icon added to make code reviewing easier
This commit removes the "noteName" from card.js and adds the icon to make code reviewing easier
* Dismiss action button refactor
Refactor of the dismiss action button in the InboxNoteCard class
* Removed unnecessary control
* Destructured all the note properties
* Colors replaced by existing variable
* Removed setting of layout and image in the creation of the notes
* Removed blank lines added by mistake
* Close dismiss dropdown when clicking away from the popover.
* Prevented the closing of the inbox panel with an action in the modal
* Added small design changes
* Removed unused "Gridicon" import
* Prevent showing the image tag when the layout is blank
* The method name getDismissButton was changed to getDismissConfirmationButton
* Removed unnecessary vendor-prefixed properties
* Improved note filtering in unreadNotes method
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Remove icons (https://github.com/woocommerce/woocommerce-admin/pull/4258)
* Info icon removed from inbox notifications
The info icon was removed from inbox notifications
# Conflicts:
# src/Notes/DataStore.php
* Removed "icon" from inboxQuery
* Tests repeared
Some problems with the unit tests were repaired in this commit
# Conflicts:
# docs/examples/activity-panel-inbox.md
# Conflicts:
# tests/api/admin-notes.php
* Removed icon from card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Inbox notification: Add dismiss functionality (https://github.com/woocommerce/woocommerce-admin/pull/4262)
* Added is_deleted param to soft delete
# Conflicts:
# src/API/Notes.php
# src/Install.php
# src/Notes/DataStore.php
# src/Notes/WC_Admin_Note.php
# src/Notes/WC_Admin_Notes.php
# tests/api/admin-notes.php
* Added the Dismiss functionality
# Conflicts:
# client/header/activity-panel/panels/inbox/action.js
* Where clause repeared
* Added Snackbar after action.
* API modified to dismiss notes
* Small refactor in "get_item" method
This commit adds a small refactor in "get_item" method to use "prepare_note_data_for_response"
* Added missing logic to Dismiss note
This commit adds missing client logic to Dismiss note.
# Conflicts:
# client/header/activity-panel/panels/inbox/action.js
# client/header/activity-panel/panels/inbox/card.js
* Moved the delete action to WC_Admin_Notes.php
The delete action was moved to WC_Admin_Notes.php to follow the pattern.
* Added changes to dismiss messages
This commit addeds changes to the messages soft delete.
* DataStore.php repaired
This commits adds some code that was deleted by mistake and the param "is_deleted" has been escaped.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* Repaired "get_notes_where_clauses" method
A problem with the deleted notes was repaired
* Added a comment to DataStore.php
* Stopped sending the "dismissType" to action.js
The "dismissType" is not sent to action.js anymore.
* Bugfix: now the method get_notes_with_name also returns deleted notes
* Bugfix: repaired empty notification list
This commit repairs a bug that happens when there isn't anything in the inbox notification list
* Small refactor to not use "some" Lodash method anymore
* Small refactor in rednderNotes method
* Added check to set_layout
* Added small refactor to delete_all_notes method
* Fixed code comment error
* Bugfix: repaired the "delete_note" call
* Inbox notification: Added layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4256)
* Added notes layout and image to the API
Added note layout and note image to the API and the DB
* Unit test modified
Unit test where modified to adapt them to the new elements
* Changed the frontend following the new designs.
The fronted was changed to follow the new inbox messages design.
* Changed default layout type in DB
* Added all the requested visual element
Changed the cards' js, css and actions to achieve the visual requirements
* Added "layout" and "image" to inboxQuery
* Modal confirmation buttons repaired
* Added "layout" and "image" to docs examples.
* Removed "updateNote" from action.js
Removed "updateNote" from action.js, I left it by mistake.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* noteName removed and icon added to make code reviewing easier
This commit removes the "noteName" from card.js and adds the icon to make code reviewing easier
* Dismiss action button refactor
Refactor of the dismiss action button in the InboxNoteCard class
* Removed unnecessary control
* Destructured all the note properties
* Colors replaced by existing variable
* Removed setting of layout and image in the creation of the notes
* Removed blank lines added by mistake
* Close dismiss dropdown when clicking away from the popover.
* Prevented the closing of the inbox panel with an action in the modal
* Added small design changes
* Removed unused "Gridicon" import
* Prevent showing the image tag when the layout is blank
* The method name getDismissButton was changed to getDismissConfirmationButton
* Removed unnecessary vendor-prefixed properties
* Improved note filtering in unreadNotes method
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Remove icons (https://github.com/woocommerce/woocommerce-admin/pull/4258)
* Info icon removed from inbox notifications
The info icon was removed from inbox notifications
# Conflicts:
# src/Notes/DataStore.php
* Removed "icon" from inboxQuery
* Tests repeared
Some problems with the unit tests were repaired in this commit
# Conflicts:
# docs/examples/activity-panel-inbox.md
# Conflicts:
# tests/api/admin-notes.php
* Removed icon from card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Improved error handling for the set_layout method
* Bugfix: fixed error handling clicks inside dropdowns
* Bugfix: repaired dropdown onBlur handler
This commit repairs a weird behavior that the dropdown onBlur handler method had sometimes.
* Text error changed
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Add undo snackbar button after deletion (https://github.com/woocommerce/woocommerce-admin/pull/4281)
* Added undo snakbar button for a single note
# Conflicts:
# client/wc-api/notes/mutations.js
# src/Notes/DataStore.php
# src/Notes/WC_Admin_Notes.php
* Added a button to undo the deletion of all notes
# Conflicts:
# client/wc-api/notes/operations.js
# src/API/Notes.php
* Code adapted to make code reviewing easier
There was some code that also was present in another PR, that code was removed to make code reviewing easier.
* UnitTest added
This commit adds some unit tests
* Added verification for API response
* Added casting to $note_id
* Inbox notification: Added layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4256)
* Added notes layout and image to the API
Added note layout and note image to the API and the DB
* Unit test modified
Unit test where modified to adapt them to the new elements
* Changed the frontend following the new designs.
The fronted was changed to follow the new inbox messages design.
* Changed default layout type in DB
* Added all the requested visual element
Changed the cards' js, css and actions to achieve the visual requirements
* Added "layout" and "image" to inboxQuery
* Modal confirmation buttons repaired
* Added "layout" and "image" to docs examples.
* Removed "updateNote" from action.js
Removed "updateNote" from action.js, I left it by mistake.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* noteName removed and icon added to make code reviewing easier
This commit removes the "noteName" from card.js and adds the icon to make code reviewing easier
* Dismiss action button refactor
Refactor of the dismiss action button in the InboxNoteCard class
* Removed unnecessary control
* Destructured all the note properties
* Colors replaced by existing variable
* Removed setting of layout and image in the creation of the notes
* Removed blank lines added by mistake
* Close dismiss dropdown when clicking away from the popover.
* Prevented the closing of the inbox panel with an action in the modal
* Added small design changes
* Removed unused "Gridicon" import
* Prevent showing the image tag when the layout is blank
* The method name getDismissButton was changed to getDismissConfirmationButton
* Removed unnecessary vendor-prefixed properties
* Improved note filtering in unreadNotes method
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Remove icons (https://github.com/woocommerce/woocommerce-admin/pull/4258)
* Info icon removed from inbox notifications
The info icon was removed from inbox notifications
# Conflicts:
# src/Notes/DataStore.php
* Removed "icon" from inboxQuery
* Tests repeared
Some problems with the unit tests were repaired in this commit
# Conflicts:
# docs/examples/activity-panel-inbox.md
# Conflicts:
# tests/api/admin-notes.php
* Removed icon from card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Inbox notification: Add dismiss functionality (https://github.com/woocommerce/woocommerce-admin/pull/4262)
* Added is_deleted param to soft delete
# Conflicts:
# src/API/Notes.php
# src/Install.php
# src/Notes/DataStore.php
# src/Notes/WC_Admin_Note.php
# src/Notes/WC_Admin_Notes.php
# tests/api/admin-notes.php
* Added the Dismiss functionality
# Conflicts:
# client/header/activity-panel/panels/inbox/action.js
* Where clause repeared
* Added Snackbar after action.
* API modified to dismiss notes
* Small refactor in "get_item" method
This commit adds a small refactor in "get_item" method to use "prepare_note_data_for_response"
* Added missing logic to Dismiss note
This commit adds missing client logic to Dismiss note.
# Conflicts:
# client/header/activity-panel/panels/inbox/action.js
# client/header/activity-panel/panels/inbox/card.js
* Moved the delete action to WC_Admin_Notes.php
The delete action was moved to WC_Admin_Notes.php to follow the pattern.
* Added changes to dismiss messages
This commit addeds changes to the messages soft delete.
* DataStore.php repaired
This commits adds some code that was deleted by mistake and the param "is_deleted" has been escaped.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* Repaired "get_notes_where_clauses" method
A problem with the deleted notes was repaired
* Added a comment to DataStore.php
* Stopped sending the "dismissType" to action.js
The "dismissType" is not sent to action.js anymore.
* Bugfix: now the method get_notes_with_name also returns deleted notes
* Bugfix: repaired empty notification list
This commit repairs a bug that happens when there isn't anything in the inbox notification list
* Small refactor to not use "some" Lodash method anymore
* Small refactor in rednderNotes method
* Added check to set_layout
* Added small refactor to delete_all_notes method
* Fixed code comment error
* Bugfix: repaired the "delete_note" call
* Inbox notification: Added layout changes (https://github.com/woocommerce/woocommerce-admin/pull/4256)
* Added notes layout and image to the API
Added note layout and note image to the API and the DB
* Unit test modified
Unit test where modified to adapt them to the new elements
* Changed the frontend following the new designs.
The fronted was changed to follow the new inbox messages design.
* Changed default layout type in DB
* Added all the requested visual element
Changed the cards' js, css and actions to achieve the visual requirements
* Added "layout" and "image" to inboxQuery
* Modal confirmation buttons repaired
* Added "layout" and "image" to docs examples.
* Removed "updateNote" from action.js
Removed "updateNote" from action.js, I left it by mistake.
* Spelling error corrected
The button text "Dismiss all message" was corrected
* noteName removed and icon added to make code reviewing easier
This commit removes the "noteName" from card.js and adds the icon to make code reviewing easier
* Dismiss action button refactor
Refactor of the dismiss action button in the InboxNoteCard class
* Removed unnecessary control
* Destructured all the note properties
* Colors replaced by existing variable
* Removed setting of layout and image in the creation of the notes
* Removed blank lines added by mistake
* Close dismiss dropdown when clicking away from the popover.
* Prevented the closing of the inbox panel with an action in the modal
* Added small design changes
* Removed unused "Gridicon" import
* Prevent showing the image tag when the layout is blank
* The method name getDismissButton was changed to getDismissConfirmationButton
* Removed unnecessary vendor-prefixed properties
* Improved note filtering in unreadNotes method
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Update client/header/activity-panel/panels/inbox/style.scss
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Inbox notification: Remove icons (https://github.com/woocommerce/woocommerce-admin/pull/4258)
* Info icon removed from inbox notifications
The info icon was removed from inbox notifications
# Conflicts:
# src/Notes/DataStore.php
* Removed "icon" from inboxQuery
* Tests repeared
Some problems with the unit tests were repaired in this commit
# Conflicts:
# docs/examples/activity-panel-inbox.md
# Conflicts:
# tests/api/admin-notes.php
* Removed icon from card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Improved error handling for the set_layout method
* Bugfix: fixed error handling clicks inside dropdowns
* Bugfix: repaired dropdown onBlur handler
This commit repairs a weird behavior that the dropdown onBlur handler method had sometimes.
* Text error changed
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Stopped sending the "dismissType" to action.js
The "dismissType" is not sent to action.js anymore.
# Conflicts:
# client/header/activity-panel/panels/inbox/card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* Bugfix: solved problem when a note was undismissed
There was a problem with the undismiss functionality. When a note was undismissed, it always was recovered with "plain" layout. This commit solves this problem.
* Inbox notification: add event recording (https://github.com/woocommerce/woocommerce-admin/pull/4320)
* Added events recording
This commit adds events recording to the inbox notifications
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Added 'home_screen' verification
Changed recorded name, now when the client is in the WooCommerce 'home' page we record 'home_screen' instead of 'wc-admin'.
* Added a naming fix and a new prop to the recordEvent
* bugfix: added control before interaction with bodyNotificationRef
* Added more unit tests for new endpoints
This commit adds tests for deleting a single note and for deleting all the notes, both without permission.
* Modified variable name
* Refactor: prop rename and small logic change
* Screen name getter moved into the InboxNoteCard
This commit moves the screen name getter inside the InboxNoteCard.
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Removed "screen" from state
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Refactor in admin-notes unit tests
Some unnecessary controls were removed from the admin-notes unit tests
* Indentation fixed in Install.php. Replaced spaces with tabs.
* Inbox notification: added new placeholder and empty card (https://github.com/woocommerce/woocommerce-admin/pull/4379)
* Added a new placeholder and an empty card
This commit adds a new placeholder and a new empty card to the inbox panel
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
# client/header/activity-panel/panels/inbox/style.scss
* Added border to read notes
* Improved note filtering in unreadNotes method and validNotes
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Actions render refactored
The actions render was refactored in InboxNoteCard component
* Refactor of InboxPanel component
The methods getUnreadNotesCount and hasValidNotes were separated from the InboxPanel component
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Refactor inbox panel subtitle classes
* Added changes for when a note is undismissed
This commit adds the requested changes in behavior and design for when a note is dismissed.
# Conflicts:
# client/header/activity-panel/panels/inbox/index.js
* Bugfix: Added key to itemlist
The InboxNotePlaceholder is shown as an itemlist but it didn't have a key. This commit adds it.
* Removed unnecessary validation
* Refactored actionList map
This commit adds a refactor to the actionList map
* Changes to the getUndoDismissRequesting functionality
This commit adds a few changes to the getUndoDismissRequesting functionality
* Changed className prop
* Changed other className prop
* Modified InboxPanel rendering
* Removed unnecessary method in placeholder.js
* Simplified the card.js renderActions method
* Change renderActions return in card.js
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Inbox notification: add client unit tests (https://github.com/woocommerce/woocommerce-admin/pull/4386)
* Added client unit tests
* Added test cases for getUnreadNotesCount and hasValidNotes
* Corrected typo error
* Removed Enzyme and added React Testing Library
* Removed unnecessary param
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
* Resolved some conflicts with master
* Marketing note test repaired
This commit repairs the marketing note test
* Added note type 'marketing' to delete all functionality
* Removed set_icon method from some notes and docs
* Added set_icon method as deprecated to prevent errors.
Co-authored-by: Fernando Marichal <contacto@fernandomarichal.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
2020-06-03 11:43:35 +00:00
|
|
|
if ( isPanelOpen && ! isClickOnModalOrSnackbar ) {
|
2020-08-05 22:02:24 +00:00
|
|
|
this.closePanel();
|
2018-07-06 12:40:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-06 06:41:53 +00:00
|
|
|
// @todo Pull in dynamic unread status/count
|
2018-06-28 13:52:45 +00:00
|
|
|
getTabs() {
|
2020-02-14 02:23:21 +00:00
|
|
|
const {
|
|
|
|
hasUnreadNotes,
|
|
|
|
hasUnreadOrders,
|
|
|
|
hasUnapprovedReviews,
|
|
|
|
hasUnreadStock,
|
2020-06-30 15:10:26 +00:00
|
|
|
isEmbedded,
|
2020-07-14 12:20:51 +00:00
|
|
|
requestingTaskListOptions,
|
2020-08-05 22:02:24 +00:00
|
|
|
taskListEnabledResolving,
|
2020-07-14 12:20:51 +00:00
|
|
|
taskListComplete,
|
|
|
|
taskListHidden,
|
2020-08-05 22:02:24 +00:00
|
|
|
taskListEnabled,
|
2020-07-14 12:20:51 +00:00
|
|
|
query,
|
2020-02-14 02:23:21 +00:00
|
|
|
} = this.props;
|
2020-06-30 15:10:26 +00:00
|
|
|
|
|
|
|
// Don't show the inbox on the Home screen.
|
2020-07-14 12:20:51 +00:00
|
|
|
const { location } = this.props.getHistory();
|
2020-07-28 02:32:58 +00:00
|
|
|
const showInbox =
|
|
|
|
isEmbedded ||
|
|
|
|
! window.wcAdminFeatures.homescreen ||
|
|
|
|
location.pathname !== '/';
|
2020-07-14 12:20:51 +00:00
|
|
|
const isPerformingSetupTask =
|
|
|
|
query.task &&
|
|
|
|
! query.path &&
|
|
|
|
( requestingTaskListOptions === true ||
|
2020-07-28 02:32:58 +00:00
|
|
|
( taskListHidden === false && taskListComplete === false ) );
|
2020-06-30 15:10:26 +00:00
|
|
|
|
2020-08-05 22:02:24 +00:00
|
|
|
// To prevent a flicker between 2 different tab groups, while this option resolves just display no tabs.
|
|
|
|
if ( taskListEnabledResolving ) {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! taskListComplete && taskListEnabled && showInbox ) {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
name: 'inbox',
|
|
|
|
title: __( 'Inbox', 'woocommerce-admin' ),
|
|
|
|
icon: <i className="material-icons-outlined">inbox</i>,
|
|
|
|
unread: hasUnreadNotes,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'setup',
|
|
|
|
title: __( 'Store Setup', 'woocommerce-admin' ),
|
|
|
|
icon: <SetupProgress />,
|
|
|
|
},
|
|
|
|
isPerformingSetupTask && {
|
|
|
|
name: 'help',
|
|
|
|
title: __( 'Help', 'woocommerce-admin' ),
|
|
|
|
icon: <i className="material-icons-outlined">support</i>,
|
|
|
|
},
|
|
|
|
].filter( Boolean );
|
|
|
|
}
|
|
|
|
|
2018-06-28 13:52:45 +00:00
|
|
|
return [
|
2020-07-14 12:20:51 +00:00
|
|
|
! isPerformingSetupTask && showInbox
|
2020-06-30 15:10:26 +00:00
|
|
|
? {
|
2020-07-28 02:32:58 +00:00
|
|
|
name: 'inbox',
|
|
|
|
title: __( 'Inbox', 'woocommerce-admin' ),
|
|
|
|
icon: <i className="material-icons-outlined">inbox</i>,
|
|
|
|
unread: hasUnreadNotes,
|
|
|
|
}
|
2020-06-30 15:10:26 +00:00
|
|
|
: null,
|
2020-07-14 12:20:51 +00:00
|
|
|
! isPerformingSetupTask && {
|
2018-06-29 15:20:08 +00:00
|
|
|
name: 'orders',
|
2019-03-13 17:14:02 +00:00
|
|
|
title: __( 'Orders', 'woocommerce-admin' ),
|
2020-04-29 18:01:27 +00:00
|
|
|
icon: <PagesIcon />,
|
2019-03-29 02:45:19 +00:00
|
|
|
unread: hasUnreadOrders,
|
2018-06-28 13:52:45 +00:00
|
|
|
},
|
2020-07-14 12:20:51 +00:00
|
|
|
! isPerformingSetupTask && manageStock === 'yes'
|
2019-03-21 05:42:07 +00:00
|
|
|
? {
|
|
|
|
name: 'stock',
|
|
|
|
title: __( 'Stock', 'woocommerce-admin' ),
|
2020-04-29 18:01:27 +00:00
|
|
|
icon: (
|
|
|
|
<i className="material-icons-outlined">widgets</i>
|
|
|
|
),
|
2019-03-29 02:45:19 +00:00
|
|
|
unread: hasUnreadStock,
|
2020-02-14 02:23:21 +00:00
|
|
|
}
|
2019-03-21 05:42:07 +00:00
|
|
|
: null,
|
2020-07-14 12:20:51 +00:00
|
|
|
! isPerformingSetupTask && reviewsEnabled === 'yes'
|
2019-03-20 10:24:12 +00:00
|
|
|
? {
|
|
|
|
name: 'reviews',
|
|
|
|
title: __( 'Reviews', 'woocommerce-admin' ),
|
2020-04-29 18:01:27 +00:00
|
|
|
icon: (
|
|
|
|
<i className="material-icons-outlined">
|
|
|
|
star_border
|
|
|
|
</i>
|
|
|
|
),
|
2019-04-30 09:40:10 +00:00
|
|
|
unread: hasUnapprovedReviews,
|
2020-02-14 02:23:21 +00:00
|
|
|
}
|
2019-03-20 10:24:12 +00:00
|
|
|
: null,
|
2020-07-14 12:20:51 +00:00
|
|
|
isPerformingSetupTask && {
|
|
|
|
name: 'help',
|
|
|
|
title: __( 'Help', 'woocommerce-admin' ),
|
2020-08-03 21:54:57 +00:00
|
|
|
icon: <Icon icon={ lifesaver } />,
|
2020-07-14 12:20:51 +00:00
|
|
|
},
|
2019-03-20 10:24:12 +00:00
|
|
|
].filter( Boolean );
|
2018-06-28 13:52:45 +00:00
|
|
|
}
|
|
|
|
|
2018-07-06 12:40:05 +00:00
|
|
|
getPanelContent( tab ) {
|
2020-08-05 22:02:24 +00:00
|
|
|
const { hasUnreadOrders, query, hasUnapprovedReviews } = this.props;
|
|
|
|
const { task } = query;
|
|
|
|
|
2018-07-06 12:40:05 +00:00
|
|
|
switch ( tab ) {
|
2018-10-12 19:20:48 +00:00
|
|
|
case 'inbox':
|
|
|
|
return <InboxPanel />;
|
2018-06-28 13:52:45 +00:00
|
|
|
case 'orders':
|
2019-04-15 07:06:34 +00:00
|
|
|
return <OrdersPanel hasActionableOrders={ hasUnreadOrders } />;
|
2018-07-09 15:46:31 +00:00
|
|
|
case 'stock':
|
|
|
|
return <StockPanel />;
|
|
|
|
case 'reviews':
|
2020-02-14 02:23:21 +00:00
|
|
|
return (
|
|
|
|
<ReviewsPanel
|
|
|
|
hasUnapprovedReviews={ hasUnapprovedReviews }
|
|
|
|
/>
|
|
|
|
);
|
2020-07-14 12:20:51 +00:00
|
|
|
case 'help':
|
|
|
|
return <HelpPanel taskName={ task } />;
|
2018-06-28 13:52:45 +00:00
|
|
|
default:
|
2018-07-09 15:46:31 +00:00
|
|
|
return null;
|
2018-06-28 13:52:45 +00:00
|
|
|
}
|
2018-07-06 12:40:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
renderPanel() {
|
2020-08-05 22:02:24 +00:00
|
|
|
const { updateOptions, taskListHidden } = this.props;
|
2019-07-25 01:34:53 +00:00
|
|
|
const { isPanelOpen, currentTab, isPanelSwitching } = this.state;
|
2018-07-13 20:28:01 +00:00
|
|
|
const tab = find( this.getTabs(), { name: currentTab } );
|
2020-08-05 22:02:24 +00:00
|
|
|
|
2018-07-13 20:28:01 +00:00
|
|
|
if ( ! tab ) {
|
2020-02-14 02:23:21 +00:00
|
|
|
return (
|
|
|
|
<div className="woocommerce-layout__activity-panel-wrapper" />
|
|
|
|
);
|
2018-07-13 20:28:01 +00:00
|
|
|
}
|
|
|
|
|
2020-08-05 22:02:24 +00:00
|
|
|
const clearPanel = () => {
|
|
|
|
this.clearPanel();
|
|
|
|
};
|
|
|
|
|
|
|
|
if ( currentTab === 'setup' ) {
|
|
|
|
const currentLocation = window.location.href;
|
|
|
|
const homescreenLocation = getAdminLink(
|
|
|
|
'admin.php?page=wc-admin'
|
|
|
|
);
|
|
|
|
|
|
|
|
// Don't navigate if we're already on the homescreen, this will cause an infinite loop
|
|
|
|
if ( currentLocation !== homescreenLocation ) {
|
|
|
|
// Ensure that if the user is trying to get to the task list they can see it even if
|
|
|
|
// it was dismissed.
|
|
|
|
if ( taskListHidden === 'no' ) {
|
|
|
|
this.redirectToHomeScreen();
|
|
|
|
} else {
|
|
|
|
updateOptions( {
|
|
|
|
woocommerce_task_list_hidden: 'no',
|
|
|
|
} ).then( this.redirectToHomeScreen );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-02-14 02:23:21 +00:00
|
|
|
const classNames = classnames(
|
|
|
|
'woocommerce-layout__activity-panel-wrapper',
|
|
|
|
{
|
|
|
|
'is-open': isPanelOpen,
|
|
|
|
'is-switching': isPanelSwitching,
|
|
|
|
}
|
|
|
|
);
|
2018-07-17 17:07:36 +00:00
|
|
|
|
2018-06-29 15:20:08 +00:00
|
|
|
return (
|
2019-07-25 01:33:41 +00:00
|
|
|
<div
|
|
|
|
className={ classNames }
|
|
|
|
tabIndex={ 0 }
|
|
|
|
role="tabpanel"
|
|
|
|
aria-label={ tab.title }
|
2020-08-05 22:02:24 +00:00
|
|
|
onTransitionEnd={ clearPanel }
|
|
|
|
onAnimationEnd={ clearPanel }
|
2019-07-25 01:33:41 +00:00
|
|
|
>
|
|
|
|
<div
|
|
|
|
className="woocommerce-layout__activity-panel-content"
|
|
|
|
key={ 'activity-panel-' + currentTab }
|
|
|
|
id={ 'activity-panel-' + currentTab }
|
|
|
|
>
|
2020-04-29 18:01:27 +00:00
|
|
|
<Suspense fallback={ <Spinner /> }>
|
|
|
|
{ this.getPanelContent( currentTab ) }
|
|
|
|
</Suspense>
|
2019-07-25 01:33:41 +00:00
|
|
|
</div>
|
2018-07-13 19:31:58 +00:00
|
|
|
</div>
|
2018-06-29 15:20:08 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-08-05 22:02:24 +00:00
|
|
|
redirectToHomeScreen() {
|
|
|
|
if ( isWCAdmin( window.location.href ) ) {
|
|
|
|
getHistory().push( getNewPath( {}, '/', {} ) );
|
|
|
|
} else {
|
|
|
|
window.location.href = getAdminLink( 'admin.php?page=wc-admin' );
|
2018-07-13 20:28:01 +00:00
|
|
|
}
|
2018-06-28 13:52:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const tabs = this.getTabs();
|
2020-08-05 22:02:24 +00:00
|
|
|
const { mobileOpen, currentTab, isPanelOpen } = this.state;
|
2018-07-13 19:31:58 +00:00
|
|
|
const headerId = uniqueId( 'activity-panel-header_' );
|
2018-06-29 15:20:08 +00:00
|
|
|
const panelClasses = classnames( 'woocommerce-layout__activity-panel', {
|
|
|
|
'is-mobile-open': this.state.mobileOpen,
|
|
|
|
} );
|
2018-06-28 13:52:45 +00:00
|
|
|
|
Merge final `version/1.0` branch with `master` (https://github.com/woocommerce/woocommerce-admin/pull/3848)
* Try: Moving Customers to main Woo Menu (https://github.com/woocommerce/woocommerce-admin/pull/3632)
* Only add onboarding settings on wc-admin pages when task list should be shown. (https://github.com/woocommerce/woocommerce-admin/pull/3722)
* Use cron for unsnoozing admin notes (https://github.com/woocommerce/woocommerce-admin/pull/3662)
* Use wp-cron for admin note snoozing.
* Remove "unsnooze" scheduled action.
* Use correct version.
* Avoid using deprecated method for unscheduling actions.
* Onboarding: Fix toggle tracking events (https://github.com/woocommerce/woocommerce-admin/pull/3645)
* Fix errant wcadmin prefix on event name
* Track the onboarding toggle on the option in case enable_onboarding isn't used
* Move toggle actions to separate function
* Move onboarding actions
* Move onboarding filters
* Move help tab updates to add_toggle_actions
* Only run onboarding actions when enabled
* Onboarding: Add tracks events when profiler steps are completed (https://github.com/woocommerce/woocommerce-admin/pull/3726)
* Add tracks for store profiler step completion
* Record event when profiler is completed
* Ensure continue setup loads the onboarding profiler (https://github.com/woocommerce/woocommerce-admin/pull/3646)
* 'All that include' option removed when input field is empty (https://github.com/woocommerce/woocommerce-admin/pull/3700)
* 'All that include' option removed when input field is empty
Added a control to check that when the input field 'Search by customer name' is empty, the 'All that include' option is not appearing.
* Const name improved
The constant name hasValues was changed to optionsHaveValues (more descriptive)
* Fix select text alignment (https://github.com/woocommerce/woocommerce-admin/pull/3723)
* Stock panel indicator - cache and use lookup tables. (https://github.com/woocommerce/woocommerce-admin/pull/3729)
* Stock panel indicator - cache and use lookup tables.
* Revise query, clear transient on product update.
* Fix error, ht Josh.
* Checklist: Remove sideloaded images to reduce build size, take 2 (https://github.com/woocommerce/woocommerce-admin/pull/3731)
* Remove homepage template images.
* Use other-small on all industries, adjust text color.
* Remove background dim and opacity set to 0
* Fix/3631 (https://github.com/woocommerce/woocommerce-admin/pull/3730)
* Added CBD as an industry type
CBD was added as an industry type in API
* Industries options modified
Modified the industries options. Now we are able to choose if we will use an input or not in the option.
* API control changed for industries.
API control changed for industries. Now it accepts the data type we need.
* Added input in Industries list for the option "Other"
Added an input for the option "Other" in the industries list
* Added suggested changes in review comments.
* Added data preparation for recordEvent
* Changed variable to snake_case
The variable "industriesWithDetail" was changed to "industries_with_detail" (snake_case)
* Onboarding: Create homepage without redirect (https://github.com/woocommerce/woocommerce-admin/pull/3727)
* Add link to edit homepage instead of redirect
* Add busy state to homepage creation button
* Publish homepage on create via API
* Update homepage notice to show on first post update
* Update homepage creation notice per design
* Record event on customize homepage
* Set homepage to frontpage on creation
* Add deactivation note for feature plugin (https://github.com/woocommerce/woocommerce-admin/pull/3687)
* Add version deactivation note
* Add the note to deactivate if the version is older than the current WC version
* Deactivate wc admin feature plugin on action click
* Add notes version hooks
* change the Package class namespace to exclude from standalone autoloader
* add use statement for FeaturePlugin
* add note explaining namespace
* use wc-admin-deactivate-plugin note name
* Rename file and class to WC_Admin_Notes_Deactivate_Plugin
Co-authored-by: Ron Rennick <ron@ronandandrea.com>
Co-authored-by: Paul Sealock <psealock@gmail.com>
* Add Travis tests on GH for release branch (https://github.com/woocommerce/woocommerce-admin/pull/3751)
* Add Travis tests on GH for release branch
* fix linter errors
* ActivityPanels.php -> use public static functions
* Remove free text Search option when no query exists (https://github.com/woocommerce/woocommerce-admin/pull/3755)
* Revert changes in woocommerce/woocommerce-admin#3700
* Don't add free text search if no query exists
* Add tests for Search without query
* Add test for showing free text search option
* Fix image sideloading for store industries. (https://github.com/woocommerce/woocommerce-admin/pull/3743)
* Fix image sideloading for store industries.
Data format changed in https://github.com/woocommerce/woocommerce-admin/pull/3730
* Fix industry image sideload in cases where the count is less than requested.
* Be backwards compatible with the old industry data format.
* Added event props to identify stores with WCS and Jetpack installed (https://github.com/woocommerce/woocommerce-admin/pull/3750)
* Added event props to identify stores with WCS and Jetpack installed
Also, added Jeckpack connected status
* Improved variable name
* Simplified method
Simplified method. "intersection" check was removed
* Tests errors repeared
The method "clear_low_out_of_stock_count_transient" now is static.
* OBW: fix sideloading image test error (https://github.com/woocommerce/woocommerce-admin/pull/3762)
* Release 0.26.0 changes (https://github.com/woocommerce/woocommerce-admin/pull/3753)
* add deactivation hook to Package.php (https://github.com/woocommerce/woocommerce-admin/pull/3770)
* Add active version functions (https://github.com/woocommerce/woocommerce-admin/pull/3772)
* add active version functions to Package.php
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
* 0.26.1 changes (https://github.com/woocommerce/woocommerce-admin/pull/3773)
* Customers Report: fix missing report param in search (https://github.com/woocommerce/woocommerce-admin/pull/3778)
* Product titles include encoded entities (https://github.com/woocommerce/woocommerce-admin/pull/3765)
* Stripped HTML from product titles and decoded before displaying them
Stripped html from product titles and entities are decoded before displaying them
* Stripped HTML from product titles and decoded in Stock report
Stripped html from product titles and entities are decoded before displaying them. Now in Stock report
* Added support for HTML tags and encoded entities on product titles
Added support for HTML tags and encoded entities on filtered product list, dropdown menus and tag names.
Also, strip_tags() function was replaced with wp_strip_all_tags() instead.
* strip_tags() function was replaced with wp_strip_all_tags() instead.
* Added control for a variable
Added control for "item->data" before applying wp_strip_all_tags method.
* pre-commit changes
* Test text corrected
* Enable taxes on automatic tax setup (https://github.com/woocommerce/woocommerce-admin/pull/3795)
* Update Country Labeling to Match Core (https://github.com/woocommerce/woocommerce-admin/pull/3790)
* Updated country labeling
Country labeling on Customer Report was updated
* Updated country labeling in other files
* remove .jitm-card notice padding (https://github.com/woocommerce/woocommerce-admin/pull/3814)
* OBW Connect: Fix requesting state (https://github.com/woocommerce/woocommerce-admin/pull/3786)
* OBW Connect: Fix requesting state
* pass down setIsPending
* setIspending propType
* defaultProps
* test
* Revert "test"
This reverts commit e921092b19401931cc1aec8ee84fa53c53b67f36.
* better comparison for redirect
* Fixes Taxes Report search bug and adds initial documentation. (https://github.com/woocommerce/woocommerce-admin/pull/3816)
* Initial Taxes Report documentation.
* Fix taxes endpoint search parameter.
* OBW: Fix retry plugin install button disappearing (https://github.com/woocommerce/woocommerce-admin/pull/3787)
* OBW: Fix retry plugin install btn disappearing
* try suggestion
* Revert "try suggestion"
This reverts commit 5b9386957a501ac3e729e5f16b0ee71c9d792859.
* Fix special character escaping in search. (https://github.com/woocommerce/woocommerce-admin/pull/3826)
* Properly prepare/escape special characters in Product search.
* Properly prepare/escape special characters in Coupon search.
* Properly prepare/escape special characters in Tax code search.
* Fix tracking on migrated options (https://github.com/woocommerce/woocommerce-admin/pull/3828)
* Don't track onboarding toggle if migrating options
* Prevent WC_Tracks from recording event post types not yet registered
* Activity Panels: Remove W Panel (https://github.com/woocommerce/woocommerce-admin/pull/3827)
* Remove W Notif Panel.
* Add back in trapping logic, and hide on non-embed pages.
* add npm run test:zip command (https://github.com/woocommerce/woocommerce-admin/pull/3823)
* add npm run test:zip command
* 1.0.0 release changes🎉 (https://github.com/woocommerce/woocommerce-admin/pull/3831)
* 1.0.0 release changes🎉
* changelog
* 0.26.1 changelog
* Add Report Extension Example: Add default props to ReportFilters (https://github.com/woocommerce/woocommerce-admin/pull/3830)
* ReportFilters component: Add sane defaults
* styles
* add required column
* add left join to sku ordering (https://github.com/woocommerce/woocommerce-admin/pull/3845)
* Deal with lint errors, and improperly merged files
* regenerate package-lock.json
* attempting to resolve package lock conflict.
Co-authored-by: Jeff Stieler <jeff.m.stieler@gmail.com>
Co-authored-by: Joshua T Flowers <joshuatf@gmail.com>
Co-authored-by: Ron Rennick <ron@ronandandrea.com>
Co-authored-by: Fernando <ultimoround@gmail.com>
Co-authored-by: edmundcwm <edmundcwm@gmail.com>
Co-authored-by: Paul Sealock <psealock@gmail.com>
2020-03-10 02:47:39 +00:00
|
|
|
const hasUnread = tabs.some( ( tab ) => tab.unread );
|
2018-07-18 15:20:00 +00:00
|
|
|
const viewLabel = hasUnread
|
2020-02-14 02:23:21 +00:00
|
|
|
? __(
|
|
|
|
'View Activity Panel, you have unread activity',
|
|
|
|
'woocommerce-admin'
|
|
|
|
)
|
2019-03-13 17:14:02 +00:00
|
|
|
: __( 'View Activity Panel', 'woocommerce-admin' );
|
2018-07-18 15:20:00 +00:00
|
|
|
|
2018-06-28 13:52:45 +00:00
|
|
|
return (
|
2018-07-13 19:31:58 +00:00
|
|
|
<div>
|
|
|
|
<H id={ headerId } className="screen-reader-text">
|
2019-03-13 17:14:02 +00:00
|
|
|
{ __( 'Store Activity', 'woocommerce-admin' ) }
|
2018-07-13 19:31:58 +00:00
|
|
|
</H>
|
2020-02-14 02:23:21 +00:00
|
|
|
<Section
|
|
|
|
component="aside"
|
|
|
|
id="woocommerce-activity-panel"
|
|
|
|
aria-labelledby={ headerId }
|
|
|
|
>
|
2020-05-29 02:32:37 +00:00
|
|
|
<Button
|
2020-08-05 22:02:24 +00:00
|
|
|
onClick={ () => {
|
|
|
|
this.toggleMobile();
|
|
|
|
} }
|
2020-02-14 02:23:21 +00:00
|
|
|
label={
|
|
|
|
mobileOpen
|
|
|
|
? __(
|
|
|
|
'Close Activity Panel',
|
|
|
|
'woocommerce-admin'
|
|
|
|
)
|
|
|
|
: viewLabel
|
|
|
|
}
|
2018-07-13 19:31:58 +00:00
|
|
|
aria-expanded={ mobileOpen }
|
|
|
|
className="woocommerce-layout__activity-panel-mobile-toggle"
|
2020-05-29 02:32:37 +00:00
|
|
|
>
|
|
|
|
{ mobileOpen ? (
|
|
|
|
<CrossIcon />
|
|
|
|
) : (
|
|
|
|
<ActivityPanelToggleBubble
|
|
|
|
hasUnread={ hasUnread }
|
|
|
|
/>
|
|
|
|
) }
|
|
|
|
</Button>
|
2018-07-13 19:31:58 +00:00
|
|
|
<div className={ panelClasses }>
|
2020-08-05 22:02:24 +00:00
|
|
|
<Tabs
|
|
|
|
tabs={ tabs }
|
|
|
|
tabOpen={ isPanelOpen }
|
|
|
|
selectedTab={ currentTab }
|
|
|
|
onTabClick={ ( tab, tabOpen ) => {
|
|
|
|
this.togglePanel( tab, tabOpen );
|
|
|
|
} }
|
|
|
|
/>
|
2018-07-13 19:31:58 +00:00
|
|
|
{ this.renderPanel() }
|
2018-06-29 15:20:08 +00:00
|
|
|
</div>
|
2018-07-13 19:31:58 +00:00
|
|
|
</Section>
|
2018-07-06 12:40:05 +00:00
|
|
|
</div>
|
2018-06-28 13:52:45 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-14 12:20:51 +00:00
|
|
|
ActivityPanel.defaultProps = {
|
|
|
|
getHistory,
|
|
|
|
};
|
|
|
|
|
2020-06-30 15:10:26 +00:00
|
|
|
export default compose(
|
|
|
|
withSelect( ( select ) => {
|
|
|
|
const hasUnreadNotes = getUnreadNotes( select );
|
|
|
|
const hasUnreadOrders = getUnreadOrders( select );
|
|
|
|
const hasUnreadStock = getUnreadStock();
|
|
|
|
const hasUnapprovedReviews = getUnapprovedReviews( select );
|
2020-07-14 12:20:51 +00:00
|
|
|
const { getOption, isResolving } = select( OPTIONS_STORE_NAME );
|
|
|
|
|
2020-08-05 22:02:24 +00:00
|
|
|
const taskListEnabledResolving = isResolving( 'getOption', [
|
|
|
|
'woocommerce_homescreen_enabled',
|
|
|
|
] );
|
|
|
|
|
|
|
|
// This indicates the task list is in progress, but not if it has been hidden or not
|
|
|
|
const taskListEnabled = isOnboardingEnabled();
|
|
|
|
|
2020-07-14 12:20:51 +00:00
|
|
|
let requestingTaskListOptions, taskListComplete, taskListHidden;
|
|
|
|
|
|
|
|
if ( isOnboardingEnabled() ) {
|
2020-07-28 02:32:58 +00:00
|
|
|
taskListComplete =
|
|
|
|
getOption( 'woocommerce_task_list_complete' ) === 'yes';
|
|
|
|
taskListHidden =
|
|
|
|
getOption( 'woocommerce_task_list_hidden' ) === 'yes';
|
2020-07-14 12:20:51 +00:00
|
|
|
requestingTaskListOptions =
|
|
|
|
isResolving( 'getOption', [
|
|
|
|
'woocommerce_task_list_complete',
|
|
|
|
] ) ||
|
2020-07-28 02:32:58 +00:00
|
|
|
isResolving( 'getOption', [ 'woocommerce_task_list_hidden' ] );
|
2020-07-14 12:20:51 +00:00
|
|
|
}
|
|
|
|
|
2020-06-30 15:10:26 +00:00
|
|
|
return {
|
|
|
|
hasUnreadNotes,
|
|
|
|
hasUnreadOrders,
|
|
|
|
hasUnreadStock,
|
|
|
|
hasUnapprovedReviews,
|
2020-07-14 12:20:51 +00:00
|
|
|
requestingTaskListOptions,
|
2020-08-05 22:02:24 +00:00
|
|
|
taskListEnabledResolving,
|
2020-07-14 12:20:51 +00:00
|
|
|
taskListComplete,
|
|
|
|
taskListHidden,
|
2020-08-05 22:02:24 +00:00
|
|
|
taskListEnabled,
|
2020-06-30 15:10:26 +00:00
|
|
|
};
|
|
|
|
} ),
|
2020-08-05 22:02:24 +00:00
|
|
|
withDispatch( ( dispatch ) => ( {
|
|
|
|
updateOptions: dispatch( OPTIONS_STORE_NAME ).updateOptions,
|
|
|
|
} ) ),
|
2020-06-30 15:10:26 +00:00
|
|
|
clickOutside
|
|
|
|
)( ActivityPanel );
|