2023-09-21 14:00:04 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __, sprintf } from '@wordpress/i18n';
|
|
|
|
import { Button, Tooltip } from '@wordpress/components';
|
|
|
|
import { getNewPath } from '@woocommerce/navigation';
|
|
|
|
import { help } from '@wordpress/icons';
|
|
|
|
import { Table } from '@woocommerce/components';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import { getAdminSetting } from '~/utils/admin-settings';
|
|
|
|
import { Subscription } from './types';
|
|
|
|
import './my-subscriptions.scss';
|
|
|
|
|
|
|
|
export default function MySubscriptions(): JSX.Element {
|
2023-09-21 14:11:19 +00:00
|
|
|
const updateConnectionUrl = getNewPath(
|
|
|
|
{
|
|
|
|
page: 'wc-addons',
|
|
|
|
section: 'helper',
|
|
|
|
filter: 'all',
|
|
|
|
'wc-helper-refresh': 1,
|
|
|
|
'wc-helper-nonce': getAdminSetting( 'wc_helper_nonces' ).refresh,
|
|
|
|
},
|
|
|
|
''
|
|
|
|
);
|
|
|
|
const updateConnectionHTML = sprintf(
|
|
|
|
__(
|
|
|
|
'If you don\'t see your subscription, try <a href="%s">updating</a> your connection.',
|
|
|
|
'woocommerce'
|
|
|
|
),
|
|
|
|
updateConnectionUrl
|
|
|
|
);
|
2023-09-21 14:00:04 +00:00
|
|
|
|
|
|
|
const tableHeadersInstalled = [
|
|
|
|
{
|
|
|
|
key: 'name',
|
|
|
|
label: __( 'Name', 'woocommerce' ),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'status',
|
|
|
|
label: __( 'Status', 'woocommerce' ),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'expiry',
|
|
|
|
label: __( 'Expiry/Renewal date', 'woocommerce' ),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'autoRenew',
|
|
|
|
label: __( 'Auto-renew', 'woocommerce' ),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'version',
|
|
|
|
label: __( 'Version', 'woocommerce' ),
|
|
|
|
isNumeric: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'activated',
|
|
|
|
label: __( 'Activated', 'woocommerce' ),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'actions',
|
|
|
|
label: __( 'Actions', 'woocommerce' ),
|
|
|
|
},
|
|
|
|
];
|
2023-09-21 14:11:19 +00:00
|
|
|
const subscriptionsInstalled: Array< Subscription > = [];
|
2023-09-21 14:00:04 +00:00
|
|
|
|
|
|
|
const tableHeadersAvailable = [
|
|
|
|
{
|
|
|
|
key: 'name',
|
|
|
|
label: __( 'Name', 'woocommerce' ),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'status',
|
|
|
|
label: __( 'Status', 'woocommerce' ),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'expiry',
|
|
|
|
label: __( 'Expiry/Renewal date', 'woocommerce' ),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'autoRenew',
|
|
|
|
label: __( 'Auto-renew', 'woocommerce' ),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'version',
|
|
|
|
label: __( 'Version', 'woocommerce' ),
|
|
|
|
isNumeric: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'install',
|
|
|
|
label: __( 'Install', 'woocommerce' ),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'actions',
|
|
|
|
label: __( 'Actions', 'woocommerce' ),
|
|
|
|
},
|
|
|
|
];
|
2023-09-21 14:11:19 +00:00
|
|
|
const subscriptionsAvailable: Array< Subscription > = [];
|
2023-09-21 14:00:04 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="woocommerce-marketplace__my-subscriptions">
|
|
|
|
<section>
|
2023-09-21 14:11:19 +00:00
|
|
|
<h2>{ __( 'Installed on this store', 'woocommerce' ) }</h2>
|
2023-09-21 14:00:04 +00:00
|
|
|
<p>
|
2023-09-21 14:11:19 +00:00
|
|
|
<span
|
|
|
|
dangerouslySetInnerHTML={ {
|
|
|
|
__html: updateConnectionHTML,
|
|
|
|
} }
|
|
|
|
/>
|
2023-09-21 14:00:04 +00:00
|
|
|
<Tooltip
|
|
|
|
text={
|
|
|
|
<>
|
2023-09-21 14:17:53 +00:00
|
|
|
<h3>Still don't see your subscriptions?</h3>
|
2023-09-21 14:11:19 +00:00
|
|
|
<p>
|
|
|
|
To see all your subscriptions go to your
|
|
|
|
account on WooCommerce.com.
|
|
|
|
</p>
|
2023-09-21 14:00:04 +00:00
|
|
|
</>
|
|
|
|
}
|
|
|
|
>
|
2023-09-21 14:11:19 +00:00
|
|
|
<Button
|
|
|
|
icon={ help }
|
|
|
|
iconSize={ 20 }
|
|
|
|
isSmall={ true }
|
|
|
|
label={ __( 'Help', 'woocommerce' ) }
|
|
|
|
/>
|
2023-09-21 14:00:04 +00:00
|
|
|
</Tooltip>
|
|
|
|
</p>
|
|
|
|
<Table
|
|
|
|
headers={ tableHeadersInstalled }
|
|
|
|
rows={ subscriptionsInstalled.map( ( item ) => {
|
|
|
|
return [
|
|
|
|
{ display: item.name },
|
|
|
|
{ display: item.status },
|
|
|
|
{ display: item.expiry },
|
|
|
|
{ display: item.autoRenew ? 'true' : 'false' },
|
|
|
|
{ display: item.version },
|
|
|
|
{ display: item.activated ? 'true' : 'false' },
|
|
|
|
{ display: '...' },
|
|
|
|
];
|
|
|
|
} ) }
|
|
|
|
/>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
2023-09-21 14:11:19 +00:00
|
|
|
<h2>{ __( 'Available', 'woocommerce' ) }</h2>
|
2023-09-21 14:00:04 +00:00
|
|
|
<p>
|
2023-09-21 14:11:19 +00:00
|
|
|
{ __(
|
|
|
|
'Your unused and free WooCommerce.com subscriptions.',
|
|
|
|
'woocommerce'
|
|
|
|
) }
|
2023-09-21 14:00:04 +00:00
|
|
|
</p>
|
|
|
|
<Table
|
2023-09-21 14:11:19 +00:00
|
|
|
headers={ tableHeadersAvailable }
|
2023-09-21 14:00:04 +00:00
|
|
|
rows={ subscriptionsAvailable.map( ( item ) => {
|
|
|
|
return [
|
|
|
|
{ display: item.name },
|
|
|
|
{ display: item.status },
|
|
|
|
{ display: item.expiry },
|
|
|
|
{ display: item.autoRenew ? 'true' : 'false' },
|
|
|
|
{ display: item.version },
|
|
|
|
{ display: '...' },
|
|
|
|
{ display: '...' },
|
|
|
|
];
|
|
|
|
} ) }
|
|
|
|
/>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|