From 263930e776e396a69bcad72e4880ec222e6be570 Mon Sep 17 00:00:00 2001 From: Dylan Munson <65001528+CodeyGuyDylan@users.noreply.github.com> Date: Fri, 7 Feb 2025 09:20:21 -0700 Subject: [PATCH] Update/unowned section to list (#41312) * Add redbubble and notice when paid plan is missing plugin(s). * Add activate-multiple-plugins endpoint & logic. * Delay last-backup-failed red-bubble until 30 min after purchase. Also fix $not_shown_products. * Refactor how we derive shown_products & not_shown_products. * Cleanup & add GlobalNotice after successfull activation/installation. * Remove single product endpoints from mj REST_Products. * Update unowned section to list * changelog * Remove filter : * Add text domain for dataviews * Remove print statement * Add missing text domain package" * Update lockfile * Fix package versions * Fix bug where hook was being used in a loop * Memoize fields to avoid CTA 'jumping' * Add filter for dataview list (#41483) * Add filter for dataview list * Add changelog * Update filter styling * Change how category label is capitlized * Styling tweaks * Update lockfile --------- Co-authored-by: Bryan Elliott --- pnpm-lock.yaml | 41 ++- .../_inc/components/action-button/index.tsx | 9 +- .../_inc/components/product-card/index.tsx | 2 +- .../components/product-cards-section/all.ts | 1 + .../product-cards-section/index.tsx | 38 +-- .../products-table-view/constants.ts | 5 + .../products-table-view/icons/anti-spam.tsx | 37 +++ .../products-table-view/icons/backup.tsx | 20 ++ .../products-table-view/icons/boost.tsx | 20 ++ .../products-table-view/icons/crm.tsx | 34 +++ .../products-table-view/icons/jetpack-ai.tsx | 26 ++ .../products-table-view/icons/protect.tsx | 20 ++ .../products-table-view/icons/search.tsx | 20 ++ .../products-table-view/icons/social.tsx | 22 ++ .../products-table-view/icons/stats.tsx | 17 ++ .../products-table-view/icons/videopress.tsx | 20 ++ .../components/products-table-view/index.tsx | 236 ++++++++++++++++++ .../components/products-table-view/style.scss | 100 ++++++++ .../components/products-table-view/types.ts | 14 ++ .../changelog/add-filter-to-unowned-list | 4 + .../changelog/update-unowned-section-to-list | 4 + projects/packages/my-jetpack/global.d.ts | 15 +- projects/packages/my-jetpack/package.json | 2 + .../my-jetpack/src/class-rest-products.php | 1 + .../src/products/class-anti-spam.php | 7 + .../my-jetpack/src/products/class-backup.php | 7 + .../my-jetpack/src/products/class-boost.php | 7 + .../my-jetpack/src/products/class-crm.php | 7 + .../src/products/class-jetpack-ai.php | 7 + .../src/products/class-newsletter.php | 7 + .../my-jetpack/src/products/class-product.php | 8 + .../my-jetpack/src/products/class-protect.php | 7 + .../src/products/class-related-posts.php | 7 + .../my-jetpack/src/products/class-scan.php | 7 + .../my-jetpack/src/products/class-search.php | 7 + .../src/products/class-site-accelerator.php | 7 + .../my-jetpack/src/products/class-social.php | 7 + .../my-jetpack/src/products/class-stats.php | 11 + .../src/products/class-videopress.php | 7 + .../packages/my-jetpack/webpack.config.js | 14 ++ .../changelog/update-unowned-section-to-list | 4 + .../changelog/update-unowned-section-to-list | 4 + .../changelog/update-unowned-section-to-list | 4 + .../changelog/update-unowned-section-to-list | 4 + .../changelog/update-unowned-section-to-list | 4 + .../changelog/update-unowned-section-to-list | 4 + .../changelog/update-unowned-section-to-list | 4 + .../changelog/update-unowned-section-to-list | 4 + 48 files changed, 837 insertions(+), 27 deletions(-) create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/constants.ts create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/icons/anti-spam.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/icons/backup.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/icons/boost.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/icons/crm.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/icons/jetpack-ai.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/icons/protect.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/icons/search.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/icons/social.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/icons/stats.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/icons/videopress.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/index.tsx create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/style.scss create mode 100644 projects/packages/my-jetpack/_inc/components/products-table-view/types.ts create mode 100644 projects/packages/my-jetpack/changelog/add-filter-to-unowned-list create mode 100644 projects/packages/my-jetpack/changelog/update-unowned-section-to-list create mode 100644 projects/plugins/backup/changelog/update-unowned-section-to-list create mode 100644 projects/plugins/boost/changelog/update-unowned-section-to-list create mode 100644 projects/plugins/jetpack/changelog/update-unowned-section-to-list create mode 100644 projects/plugins/protect/changelog/update-unowned-section-to-list create mode 100644 projects/plugins/search/changelog/update-unowned-section-to-list create mode 100644 projects/plugins/social/changelog/update-unowned-section-to-list create mode 100644 projects/plugins/starter-plugin/changelog/update-unowned-section-to-list create mode 100644 projects/plugins/videopress/changelog/update-unowned-section-to-list diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c795514741650..108e5ab1b09b7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2778,6 +2778,9 @@ importers: projects/packages/my-jetpack: dependencies: + '@automattic/babel-plugin-replace-textdomain': + specifier: workspace:* + version: link:../../js-packages/babel-plugin-replace-textdomain '@automattic/format-currency': specifier: 1.0.1 version: 1.0.1 @@ -2820,6 +2823,9 @@ importers: '@wordpress/data': specifier: 10.17.0 version: 10.17.0(react@18.3.1) + '@wordpress/dataviews': + specifier: 4.12.0 + version: 4.12.0(patch_hash=uzs6glhpt3sq2uqjvqzk6vk2ze)(@types/react@18.3.18)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@wordpress/date': specifier: 5.17.0 version: 5.17.0 @@ -8462,6 +8468,12 @@ packages: peerDependencies: react: ^18.0.0 + '@wordpress/dataviews@4.12.0': + resolution: {integrity: sha512-hxUJ7OyXL131r1nY0Fm5PiN12+oMclCVooON3hwlh5/x0t/FydcsMp0toGrLmtQQz38VVKl9dIpjjLgUmpSbEw==} + engines: {node: '>=18.12.0', npm: '>=8.19.2'} + peerDependencies: + react: ^18.0.0 + '@wordpress/dataviews@4.13.0': resolution: {integrity: sha512-fJyHzNBvI/mivZh5z5+XC3tOSHojNOYVbSA9ifPB6hNcZjFJ+fsNt/I8tmOQdmOOb4dUESkOOKmk6RlPKCjErg==} engines: {node: '>=18.12.0', npm: '>=8.19.2'} @@ -14597,6 +14609,9 @@ packages: third-party-web@0.26.2: resolution: {integrity: sha512-taJ0Us0lKoYBqcbccMuDElSUPOxmBfwlHe1OkHQ3KFf+RwovvBHdXhbFk9XJVQE2vHzxbTwvwg5GFsT9hbDokQ==} + third-party-web@0.26.4: + resolution: {integrity: sha512-cH8Y2deNWtUan3u7DM8Z9aPIMll3ATwFBpuYFo7IXfz58X/hwz3Re+nUEpu6stViCeDvgkuR7RjeyNr495cULA==} + thread-loader@3.0.4: resolution: {integrity: sha512-ByaL2TPb+m6yArpqQUZvP+5S1mZtXsEP7nWKKlAUTm7fCml8kB5s1uI3+eHRP2bk5mVYfRSBI7FFf+tWEyLZwA==} engines: {node: '>= 10.13.0'} @@ -17327,7 +17342,7 @@ snapshots: '@paulirish/trace_engine@0.0.39': dependencies: - third-party-web: 0.26.2 + third-party-web: 0.26.4 '@pkgjs/parseargs@0.11.0': optional: true @@ -20627,6 +20642,28 @@ snapshots: rememo: 4.0.2 use-memo-one: 1.1.3(react@18.3.1) + '@wordpress/dataviews@4.12.0(patch_hash=uzs6glhpt3sq2uqjvqzk6vk2ze)(@types/react@18.3.18)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + dependencies: + '@ariakit/react': 0.4.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@babel/runtime': 7.25.7 + '@wordpress/components': 29.3.0(@types/react@18.3.18)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@wordpress/compose': 7.17.0(react@18.3.1) + '@wordpress/data': 10.17.0(react@18.3.1) + '@wordpress/element': 6.17.0 + '@wordpress/i18n': 5.17.0 + '@wordpress/icons': 10.17.0(react@18.3.1) + '@wordpress/primitives': 4.17.0(react@18.3.1) + '@wordpress/private-apis': 1.17.0 + '@wordpress/warning': 3.17.0 + clsx: 2.1.1 + react: 18.3.1 + remove-accents: 0.5.0 + transitivePeerDependencies: + - '@emotion/is-prop-valid' + - '@types/react' + - react-dom + - supports-color + '@wordpress/dataviews@4.13.0(patch_hash=uzs6glhpt3sq2uqjvqzk6vk2ze)(@types/react@18.3.18)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@ariakit/react': 0.4.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -29231,6 +29268,8 @@ snapshots: third-party-web@0.26.2: {} + third-party-web@0.26.4: {} + thread-loader@3.0.4(webpack@5.94.0): dependencies: json-parse-better-errors: 1.0.2 diff --git a/projects/packages/my-jetpack/_inc/components/action-button/index.tsx b/projects/packages/my-jetpack/_inc/components/action-button/index.tsx index 7b20c13bc6991..37219a19268a0 100644 --- a/projects/packages/my-jetpack/_inc/components/action-button/index.tsx +++ b/projects/packages/my-jetpack/_inc/components/action-button/index.tsx @@ -138,7 +138,7 @@ const ActionButton: FC< ActionButtonProps > = ( { installStandalonePlugin(); }, [ slug, installStandalonePlugin, recordEvent, tracksIdentifier ] ); - const getStatusAction = useCallback( (): SecondaryButtonProps => { + const statusAction: SecondaryButtonProps = useMemo( () => { switch ( status ) { case PRODUCT_STATUSES.ABSENT: { const buttonText = __( 'Learn more', 'jetpack-my-jetpack' ); @@ -322,9 +322,8 @@ const ActionButton: FC< ActionButtonProps > = ( { ] ); const allActions = useMemo( - () => - hasAdditionalActions ? [ ...additionalActions, getStatusAction() ] : [ getStatusAction() ], - [ additionalActions, getStatusAction, hasAdditionalActions ] + () => ( hasAdditionalActions ? [ ...additionalActions, statusAction ] : [ statusAction ] ), + [ additionalActions, statusAction, hasAdditionalActions ] ); const recordDropdownStateChange = useCallback( () => { @@ -374,7 +373,7 @@ const ActionButton: FC< ActionButtonProps > = ( { const dropdown = hasAdditionalActions && (