Skip to content

Commit da82bce

Browse files
CalebJamesHbrianchandotcom
authored andcommitted
LPD-67547 Add option to create new account on Product Purchase flow
1 parent c764b0e commit da82bce

File tree

12 files changed

+193
-47
lines changed

12 files changed

+193
-47
lines changed

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/components/Checkout/AccountSelection.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ const AccountSelection: React.FC<AccountSelectionProps> = ({
7878
selectedAccount?.externalReferenceCode ===
7979
accountInfo.externalReferenceCode,
8080
title: accountInfo.name,
81+
type: accountInfo.type,
8182
value: accountInfo,
8283
};
8384
})
@@ -116,7 +117,12 @@ const AccountSelection: React.FC<AccountSelectionProps> = ({
116117
contentList={accounts.map((account) => ({
117118
...account,
118119
selected: selectedAccount?.id === account?.id,
119-
title: <span className="h5">{account.title}</span>,
120+
title: (
121+
<div className='pt-2'>
122+
<p className="h5 mb-1">{account.title}</p>
123+
<p className="h5 text-muted mb-0 text-capitalize">{account.type}</p>
124+
</div>
125+
),
120126
}))}
121127
leftRadio
122128
onSelect={handleSelectAccount}

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/components/ProductPurchase/Footer/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const ProductPurchaseFooter: React.FC<ProductPurchaseFooterProps> = ({
2727
const {productPurchaseCart} = useProductPurchaseOutletContext();
2828

2929
return (
30-
<div className="d-flex flex-column mt-6 w-100">
31-
<div className="align-items-center d-flex justify-content-between mt-6 w-100">
30+
<div className="d-flex flex-column mt-3 w-100">
31+
<div className="align-items-center d-flex justify-content-between mt-3 w-100">
3232
<ClayButton
3333
className="font-weight-bold"
3434
displayType="unstyled"

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/components/RadioCardList/RadioCardList.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ type RadioCardContent<T = any> = {
2222

2323
type RadioCardListProps<T> = {
2424
contentList: RadioCardContent<T>[];
25-
customization?: boolean;
2625
leftRadio?: boolean;
2726
onSelect: (value: RadioOption<T>) => void;
2827
showImage?: boolean;

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/components/RadioCardList/components/RadioCard.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
*/
55

66
import {ClayRadio} from '@clayui/form';
7+
import {ReactNode} from 'react';
8+
import classNames from 'classnames';
9+
import ClayIcon from '@clayui/icon';
710
import ClayLabel from '@clayui/label';
811
import ClaySticker from '@clayui/sticker';
9-
import classNames from 'classnames';
1012

1113
import './RadioCard.scss';
1214

13-
import ClayIcon from '@clayui/icon';
14-
import {ReactNode} from 'react';
15-
1615
interface RadioCardProps {
1716
activeRadio: boolean | undefined;
1817
description?: ReactNode;

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/enums/Account.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@ export enum AccountType {
1515
TECHNOLOGY_PARTNER = 'Technology Partner',
1616
STRATEGIC_PARTNER = 'Strategic Partner',
1717
}
18+
19+
export enum AccountTypes {
20+
BUSINESS = 'business',
21+
GUEST = 'guest',
22+
PERSON = 'person',
23+
SUPPLIER = 'supplier'
24+
}

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/i18n/en_US.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ export default {
9999
'billing-email': 'Billing Email',
100100
'blank-site': 'Blank Site',
101101
'build': 'Build',
102+
'business': 'Business',
103+
'business-account': 'Business Account',
102104
'business-address': 'Business Address',
103105
'by-requesting-a-publisher-account-you-agree-to-the':
104106
'By requesting a Publisher account, you agree to the',
@@ -200,6 +202,8 @@ export default {
200202
'Design the storefront for your solution. This will set the information displayed on the solution’s page. This section is dedicated to creating the solution’s detail content.',
201203
'design-the-storefront-for-your-solution-this-will-set-the-information-displayed-on-the-solutions-page-this-section-is-dedicated-to-creating-the-solutions-header':
202204
'Design the storefront for your solution. This will set the information displayed on the solution’s page. This section is dedicated to creating the solution’s header.',
205+
'designed-for-companies-with-a-taxvat-number-this-account-type-also-lets-you-manage-multiple-users-under-one-profile-click-the-button-below-to-create-your-first-business-account-today':
206+
'Designed for companies with a Tax/VAT number, this account type also lets you manage multiple users under one profile. Click the button below to create your first Business Account today!',
203207
'details': 'Details',
204208
'developer-license-prices': 'Developer License Prices',
205209
'developer-licenses-are-limited-to-5-unique-addresses-and-should-not-be-used-for-full-scale-production-deployments':
@@ -271,6 +275,10 @@ export default {
271275
'file-not-available-for-download': 'File not available for download.',
272276
'filter': 'Filter',
273277
'first-name': 'First Name',
278+
'for-businesses-with-a-vattax-number-this-account-type-support-multiple-users-it-also-possible-to-join-an-already-existing-business-account':
279+
'For businesses with a VAT/Tax number; this account type support multiple users. It also possible to join an already existing business account',
280+
'for-individuals-without-a-vattax-number-this-account-support-single-user-only':
281+
'For individuals without a VAT/Tax number; this account support single user only.',
274282
'form': 'Form',
275283
'fragment': 'Fragment',
276284
'fragment-collection-of-fragments': 'Fragment/Collection of Fragments',
@@ -440,6 +448,8 @@ export default {
440448
'payment-summary': 'Payment Summary',
441449
'paypal-account': 'PayPal Account',
442450
'pending': 'Pending',
451+
'personal': 'Personal',
452+
'personal-account': 'Personal Account',
443453
'phone': 'Phone',
444454
'phone-number': 'Phone Number',
445455
'please-be-aware-that-since-you-are-adding-a-new-version-of-the-app-the-only-section-visible-is-the-build':
@@ -677,6 +687,8 @@ export default {
677687
'Unable to download your license file. Please try again and/or contact support via the manage menu on the dashboard.',
678688
'under-review': 'Under Review',
679689
'uninstall': 'Uninstall',
690+
'unlock-exclusive-benefits-with-a-business-account':
691+
'Unlock exclusive benefits with a Business Account!',
680692
'unpaid': 'Unpaid',
681693
'upload-at-least-one-image-or-add-a-video-url':
682694
'Upload at least one image, or add a video URL',

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/pages/ProductPurchase/ProductPurchaseOutlet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ const ProductPurchaseOutlet: React.FC<ProductPurchaseOutletProps> = ({
229229
className={classNames('mt-7', {'mt-7': accounts.length === 1})}
230230
>
231231
{isTinyDisplay && (
232-
<ProductPurchase.CircleSteps
232+
<ProductPurchase.CircleSteps
233233
className="my-5 px-8"
234234
steps={steps}
235235
/>

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/pages/ProductPurchase/pages/AccountSelection.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import ProductPurchaseFooter from '../../../components/ProductPurchase/Footer';
1111
import {useMarketplaceContext} from '../../../context/MarketplaceContext';
1212
import i18n from '../../../i18n';
1313
import {useProductPurchaseOutletContext} from '../ProductPurchaseOutlet';
14+
import CreateNewAccount from './CreateNewAccount';
1415

1516
type ProductPurchaseAccountSelectionProps = {
1617
children?: ReactNode;
@@ -57,11 +58,15 @@ const ProductPurchaseAccountSelection: React.FC<
5758
}}
5859
title={i18n.translate('account-selection')}
5960
>
60-
<AccountSelection
61-
onSelectAccount={setSelectedAccount}
62-
selectedAccount={selectedAccount}
63-
userAccount={myUserAccount}
64-
/>
61+
{!!accounts.length && (
62+
<AccountSelection
63+
onSelectAccount={setSelectedAccount}
64+
selectedAccount={selectedAccount}
65+
userAccount={myUserAccount}
66+
/>
67+
)}
68+
69+
<CreateNewAccount accounts={accounts} />
6570

6671
{children}
6772
</ProductPurchase.Shell>

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/pages/ProductPurchase/pages/App/AccountSelection.tsx

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
44
*/
55

6-
import {useEffect} from 'react';
76
import {useNavigate} from 'react-router-dom';
87

98
import i18n from '../../../../i18n';
@@ -13,43 +12,13 @@ import ProductPurchaseAccountSelection from '../AccountSelection';
1312

1413
const AccountSelection = () => {
1514
const {
16-
accounts,
1715
actions: {nextStep},
18-
isSingleAccount,
1916
product,
2017
selectedAccount,
21-
setSelectedAccount,
2218
} = useProductPurchaseOutletContext();
2319

2420
const navigate = useNavigate();
2521

26-
useEffect(() => {
27-
const {isFreeApp} = getProductPriceModel(product);
28-
29-
if (isFreeApp && isSingleAccount) {
30-
if (isSingleAccount && !selectedAccount) {
31-
setSelectedAccount(accounts[0]);
32-
}
33-
34-
return navigate('summary', {replace: true});
35-
}
36-
37-
if (isSingleAccount) {
38-
if (isSingleAccount && !selectedAccount) {
39-
setSelectedAccount(accounts[0]);
40-
}
41-
42-
navigate('license', {replace: true});
43-
}
44-
}, [
45-
accounts,
46-
isSingleAccount,
47-
selectedAccount,
48-
product,
49-
navigate,
50-
setSelectedAccount,
51-
]);
52-
5322
const {isFreeApp} = getProductPriceModel(product);
5423

5524
return (

workspaces/liferay-marketplace-workspace/client-extensions/liferay-marketplace-custom-element/src/pages/ProductPurchase/pages/App/PaymentMethod/OrderSummary/OrderSummary.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ const OrderSummary = () => {
6969
const {
7070
actions: {previousStep},
7171
handlePurchase,
72-
isSingleAccount,
7372
marketplaceDeliveryProduct,
7473
product,
7574
productPurchaseCart,
@@ -129,7 +128,6 @@ const OrderSummary = () => {
129128
className="product-purchase-summary select-payment-step"
130129
footerProps={{
131130
backButtonProps: {
132-
disabled: isSingleAccount && isFreeApp,
133131
onClick: previousStep,
134132
},
135133
continueButtonProps: {

0 commit comments

Comments
 (0)