Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Shared with you" badge to Extensions > My Subscriptions list as applicable #46229

Merged
merged 24 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6eb177b
Add 'shared with you' badge
Dan-Q Apr 4, 2024
b5c2a64
Improve spacing where multiple badges span multiple lines
Dan-Q Apr 4, 2024
d0e84af
Decrease font size of badges per new designs
Dan-Q Apr 4, 2024
50ad13f
Include 'Manage on Woo.com' only for non-shared subscriptions
Dan-Q Apr 4, 2024
a9cd822
Made TypeScript happier
Dan-Q Apr 4, 2024
483f089
Add 'shared with you' badge
Dan-Q Apr 4, 2024
d83a5ab
Improve spacing where multiple badges span multiple lines
Dan-Q Apr 4, 2024
b6ba57b
Decrease font size of badges per new designs
Dan-Q Apr 4, 2024
5023920
Include 'Manage on Woo.com' only for non-shared subscriptions
Dan-Q Apr 4, 2024
7220171
Made TypeScript happier
Dan-Q Apr 4, 2024
86abab3
Add changefile(s) from automation for the following project(s): wooco…
invalid-email-address Apr 4, 2024
99a996c
Addressing linter errors.
andfinally Apr 8, 2024
a2f8106
Merge branch 'trunk' into add/wccom19063-in-app-shared-by-badge
Dan-Q Apr 16, 2024
38e52ff
Merge branch 'add/wccom19063-in-app-shared-by-badge' of https://githu…
Dan-Q Apr 16, 2024
e636709
Allow unusually-long email addresses of sharers to wrap
Dan-Q Apr 16, 2024
a1fc0ed
Merge branch 'trunk' into add/wccom19063-in-app-shared-by-badge
Dan-Q May 10, 2024
d5e4c7e
Switch wordWrap for overflowWrap
Dan-Q May 13, 2024
65d5843
Merge branch 'trunk' into add/wccom19063-in-app-shared-by-badge
Dan-Q May 13, 2024
d627bcd
Prettier linting
Dan-Q May 13, 2024
c7b3400
Update plugins/woocommerce/changelog/46229-add-wccom19063-in-app-shar…
Dan-Q May 17, 2024
e313276
Add changefile(s) from automation for the following project(s): wooco…
invalid-email-address May 17, 2024
4aca8c4
Use pointer as cursor for status popovers
Dan-Q May 17, 2024
b0a3789
Merge branch 'add/wccom19063-in-app-shared-by-badge' of https://githu…
Dan-Q May 17, 2024
2a36975
Don't focus-within the status badge popover on load (prevents ugly li…
Dan-Q May 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export const MARKETPLACE_CART_PATH = MARKETPLACE_HOST + '/cart/';
export const MARKETPLACE_COLLABORATION_PATH =
MARKETPLACE_HOST +
'/document/managing-woocommerce-com-subscriptions/#transfer-a-woocommerce-com-subscription';
export const MARKETPLACE_SHARING_PATH =
MARKETPLACE_HOST +
'/document/managing-woocommerce-com-subscriptions/#share-a-subscription';
export const WP_ADMIN_PLUGIN_LIST_URL = ADMIN_URL + 'plugins.php';
export const WOO_CONNECT_PLUGIN_DOWNLOAD_URL =
MARKETPLACE_HOST + '/product-download/woo-update-manager';
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,13 @@
align-items: center;
border-radius: 2px;
border: none;
cursor: pointer;
padding: 2px $grid-unit-10;
margin-left: $grid-unit-15;
margin-bottom: $grid-unit-05;
text-align: left;
white-space: nowrap;
font-size: 12px;

&--error {
color: var(--wp-red-red-70, #8a2424);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ export default function ActionsDropdownMenu( props: {
} ) {
const controls = [
{
title: __( 'Manage in Plugins', 'woocommerce' ),
icon: <></>,
onClick: () => {
window.location.href = ADMIN_URL + 'plugins.php';
},
},
];

if ( ! props.subscription.is_shared ) {
controls.unshift( {
title: __( 'Manage on WooCommerce.com', 'woocommerce' ),
icon: <></>,
onClick: () => {
Expand All @@ -24,15 +34,8 @@ export default function ActionsDropdownMenu( props: {
'_blank'
);
},
},
{
title: __( 'Manage in Plugins', 'woocommerce' ),
icon: <></>,
onClick: () => {
window.location.href = ADMIN_URL + 'plugins.php';
},
},
];
} );
}

if ( props.subscription.documentation_url ) {
controls.unshift( {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import {
renewUrl,
subscribeUrl,
} from '../../../../utils/functions';
import { MARKETPLACE_COLLABORATION_PATH } from '../../../constants';
import {
MARKETPLACE_COLLABORATION_PATH,
MARKETPLACE_SHARING_PATH,
} from '../../../constants';
import { getAdminSetting } from '../../../../../utils/admin-settings';

type StatusBadge = {
Expand Down Expand Up @@ -209,6 +212,39 @@ export function nameAndStatus( subscription: Subscription ): TableRow {
explanation={ statusBadge.explanation ?? '' }
/>
) }
{ subscription.is_shared && (
<StatusPopover
text={ __( 'Shared with you', 'woocommerce' ) }
level={ StatusLevel.Info }
explanation={ createInterpolateElement(
sprintf(
/* translators: %s is the email address of the user who shared the subscription. */
__(
'This subscription was shared by <email>%s</email>. <link>Learn more</link>.',
'woocommerce'
),
subscription.owner_email
),
{
email: (
<strong
style={ { overflowWrap: 'anywhere' } }
>
email
</strong>
),
link: (
<a
href={ MARKETPLACE_SHARING_PATH }
rel="nofollow noopener noreferrer"
>
Learn more
</a>
),
}
) }
/>
) }
</span>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default function StatusPopover( props: {
<Popover
className="woocommerce-marketplace__my-subscriptions__popover"
position="top center"
focusOnMount={ false }
>
{ props.explanation }
</Popover>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export type Subscription = {
subscription_installed: boolean;
subscription_available: boolean;
is_installable: boolean;
is_shared: boolean;
owner_email: boolean;
};

export interface SubscriptionLocal {
Expand All @@ -55,4 +57,5 @@ export interface SubscriptionShare {
export enum StatusLevel {
Warning = 'warning',
Error = 'error',
Info = 'info',
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

For shared subscriptions, My Subscriptions now shows "Shared with you" and the email address of the person who shared it with you.
Dan-Q marked this conversation as resolved.
Show resolved Hide resolved