diff --git a/packages/webapp/src/containers/Subscriptions/BillingForm.tsx b/packages/webapp/src/containers/Subscriptions/BillingForm.tsx deleted file mode 100644 index 3b4a7cd13..000000000 --- a/packages/webapp/src/containers/Subscriptions/BillingForm.tsx +++ /dev/null @@ -1,95 +0,0 @@ -// @ts-nocheck -import React, { useEffect } from 'react'; -import intl from 'react-intl-universal'; -import { Formik, Form } from 'formik'; -import { DashboardInsider, If, Alert, T } from '@/components'; - -import '@/style/pages/Billing/BillingPage.scss'; - -import { compose } from '@/utils'; -import { MasterBillingTabs } from './SubscriptionTabs'; -import { getBillingFormValidationSchema } from './utils'; - -import withBillingActions from './withBillingActions'; -import withDashboardActions from '@/containers/Dashboard/withDashboardActions'; -import withSubscriptionPlansActions from './withSubscriptionPlansActions'; -import withSubscriptions from './withSubscriptions'; - -/** - * Billing form. - */ -function BillingForm({ - // #withDashboardActions - changePageTitle, - - // #withBillingActions - requestSubmitBilling, - - initSubscriptionPlans, - - // #withSubscriptions - isSubscriptionInactive, -}) { - useEffect(() => { - changePageTitle(intl.get('billing')); - }, [changePageTitle]); - - React.useEffect(() => { - initSubscriptionPlans(); - }, [initSubscriptionPlans]); - - // Initial values. - const initialValues = { - plan_slug: 'essentials', - period: 'month', - license_code: '', - }; - - // Handle form submitting. - const handleSubmit = (values, { setSubmitting }) => { - requestSubmitBilling({ - ...values, - plan_slug: 'essentials-monthly', - }) - .then((response) => { - setSubmitting(false); - }) - .catch((errors) => { - setSubmitting(false); - }); - }; - - return ( - -
- - } - description={} - /> - - - -
- - -
-
-
- ); -} - -export default compose( - withDashboardActions, - withBillingActions, - withSubscriptionPlansActions, - withSubscriptions( - ({ isSubscriptionInactive }) => ({ isSubscriptionInactive }), - 'main', - ), -)(BillingForm); diff --git a/packages/webapp/src/containers/Subscriptions/BillingPaymentMethod.tsx b/packages/webapp/src/containers/Subscriptions/BillingPaymentMethod.tsx deleted file mode 100644 index ec65c64fc..000000000 --- a/packages/webapp/src/containers/Subscriptions/BillingPaymentMethod.tsx +++ /dev/null @@ -1,16 +0,0 @@ -// @ts-nocheck -import React from 'react'; - -import { T } from '@/components'; -import { PaymentMethodTabs } from './SubscriptionTabs'; - -export default ({ formik, title, description }) => { - return ( -
-

-

- - -
- ); -}; diff --git a/packages/webapp/src/containers/Subscriptions/BillingPeriod.tsx b/packages/webapp/src/containers/Subscriptions/BillingPeriod.tsx deleted file mode 100644 index a36921452..000000000 --- a/packages/webapp/src/containers/Subscriptions/BillingPeriod.tsx +++ /dev/null @@ -1,59 +0,0 @@ -// @ts-nocheck -import React from 'react'; -import classNames from 'classnames'; -import { get } from 'lodash'; - - -import '@/style/pages/Subscription/PlanPeriodRadio.scss'; - -import withPlan from '@/containers/Subscriptions/withPlan'; - -import { saveInvoke, compose } from '@/utils'; - -/** - * Billing period. - */ -function BillingPeriod({ - // #ownProps - label, - value, - selectedOption, - onSelected, - period, - - // #withPlan - price, - currencyCode, -}) { - const handlePeriodClick = () => { - saveInvoke(onSelected, value); - }; - return ( -
- {label} - -
- - {price} {currencyCode} - - {label} -
-
- ); -} - -export default compose( - withPlan(({ plan }, state, { period }) => ({ - price: get(plan, `price.${period}`), - currencyCode: get(plan, 'currencyCode'), - })), -)(BillingPeriod); diff --git a/packages/webapp/src/containers/Subscriptions/BillingPeriodsInput.tsx b/packages/webapp/src/containers/Subscriptions/BillingPeriodsInput.tsx deleted file mode 100644 index eceda78ad..000000000 --- a/packages/webapp/src/containers/Subscriptions/BillingPeriodsInput.tsx +++ /dev/null @@ -1,49 +0,0 @@ -// @ts-nocheck -import React from 'react'; -import { Field } from 'formik'; -import * as R from 'ramda'; - -import { T, SubscriptionPeriods } from '@/components'; - -import withPlan from './withPlan'; - -/** - * Sunscription periods enhanced. - */ -const SubscriptionPeriodsEnhanced = R.compose( - withPlan(({ plan }) => ({ plan })), -)(({ plan, ...restProps }) => { - if (!plan) return null; - - return ; -}); - -/** - * Billing periods. - */ -export default function BillingPeriods() { - return ( -
-

- -

-
-

- -

-
- - - {({ field: { value }, form: { values, setFieldValue } }) => ( - { - setFieldValue('period', period); - }} - /> - )} - -
- ); -} diff --git a/packages/webapp/src/containers/Subscriptions/BillingPlan.tsx b/packages/webapp/src/containers/Subscriptions/BillingPlan.tsx deleted file mode 100644 index a463dc52d..000000000 --- a/packages/webapp/src/containers/Subscriptions/BillingPlan.tsx +++ /dev/null @@ -1,54 +0,0 @@ -// @ts-nocheck -import React from 'react'; -import classNames from 'classnames'; -import { FormattedMessage as T } from '@/components'; - -import { saveInvoke } from '@/utils'; - -/** - * Billing plan. - */ -export default function BillingPlan({ - name, - description, - price, - currencyCode, - - value, - selectedOption, - onSelected, -}) { - const handlePlanClick = () => { - saveInvoke(onSelected, value); - }; - return ( -
-
-
{name}
-
- -
-
    - {description.map((line) => ( -
  • {line}
  • - ))} -
-
- -
- - {price} {currencyCode} - - - - -
-
- ); -} diff --git a/packages/webapp/src/containers/Subscriptions/BillingPlansForm.tsx b/packages/webapp/src/containers/Subscriptions/BillingPlansForm.tsx deleted file mode 100644 index fc2c319cc..000000000 --- a/packages/webapp/src/containers/Subscriptions/BillingPlansForm.tsx +++ /dev/null @@ -1,41 +0,0 @@ -// @ts-nocheck -import React from 'react'; -import * as R from 'ramda'; - -import '@/style/pages/Subscription/BillingPlans.scss'; - -import BillingPlansInput from './BillingPlansInput'; -import BillingPeriodsInput from './BillingPeriodsInput'; -import BillingPaymentMethod from './BillingPaymentMethod'; - -import withSubscriptions from './withSubscriptions'; - -/** - * Billing plans form. - */ -export default function BillingPlansForm() { - return ( -
- - - -
- ); -} - -/** - * Billing payment methods when subscription is inactive. - * @returns {JSX.Element} - */ -function BillingPaymentMethodWhenSubscriptionInactiveJSX({ - // # withSubscriptions - isSubscriptionActive, - - ...props -}) { - return !isSubscriptionActive ? : null; -} - -const BillingPaymentMethodWhenSubscriptionInactive = R.compose( - withSubscriptions(({ isSubscriptionActive }) => ({ isSubscriptionActive })), -)(BillingPaymentMethodWhenSubscriptionInactiveJSX); diff --git a/packages/webapp/src/containers/Subscriptions/BillingPlansInput.tsx b/packages/webapp/src/containers/Subscriptions/BillingPlansInput.tsx deleted file mode 100644 index d7bdfa23e..000000000 --- a/packages/webapp/src/containers/Subscriptions/BillingPlansInput.tsx +++ /dev/null @@ -1,38 +0,0 @@ -// @ts-nocheck -import React from 'react'; -import { Field } from 'formik'; -import { T, SubscriptionPlans } from '@/components'; - -import withPlans from './withPlans'; -import { compose } from '@/utils'; - -/** - * Billing plans. - */ -function BillingPlans({ plans, title, description, selectedOption }) { - return ( -
-

- -

-
-

- -

-
- - - {({ form: { setFieldValue }, field: { value } }) => ( - { - setFieldValue('plan_slug', value); - }} - /> - )} - -
- ); -} -export default compose(withPlans(({ plans }) => ({ plans })))(BillingPlans); diff --git a/packages/webapp/src/containers/Subscriptions/BillingTab.tsx b/packages/webapp/src/containers/Subscriptions/BillingTab.tsx deleted file mode 100644 index e4235d14c..000000000 --- a/packages/webapp/src/containers/Subscriptions/BillingTab.tsx +++ /dev/null @@ -1,7 +0,0 @@ -// @ts-nocheck -import React from 'react'; -import BillingPlansForm from './BillingPlansForm'; - -export default function BillingTab() { - return (); -} \ No newline at end of file diff --git a/packages/webapp/src/containers/Subscriptions/LicenseTab.tsx b/packages/webapp/src/containers/Subscriptions/LicenseTab.tsx deleted file mode 100644 index e069ffbf9..000000000 --- a/packages/webapp/src/containers/Subscriptions/LicenseTab.tsx +++ /dev/null @@ -1,42 +0,0 @@ -// @ts-nocheck -import React from 'react'; -import { Intent, Button } from '@blueprintjs/core'; -import { useFormikContext } from 'formik'; -import { FormattedMessage as T } from '@/components'; -import { compose } from '@/utils'; - -import withDialogActions from '@/containers/Dialog/withDialogActions'; - -/** - * Payment via license code tab. - */ -function LicenseTab({ openDialog }) { - const { submitForm, values } = useFormikContext(); - - const handleSubmitBtnClick = () => { - submitForm().then(() => { - openDialog('payment-via-voucher', { ...values }); - }); - }; - - return ( -
-

- -

-

- -

- - -
- ); -} - -export default compose(withDialogActions)(LicenseTab); diff --git a/packages/webapp/src/containers/Subscriptions/SubscriptionTabs.tsx b/packages/webapp/src/containers/Subscriptions/SubscriptionTabs.tsx deleted file mode 100644 index 3f2ec6a05..000000000 --- a/packages/webapp/src/containers/Subscriptions/SubscriptionTabs.tsx +++ /dev/null @@ -1,47 +0,0 @@ -// @ts-nocheck -import React from 'react'; -import intl from 'react-intl-universal'; -import { Tabs, Tab } from '@blueprintjs/core'; -import BillingTab from './BillingTab'; -import LicenseTab from './LicenseTab'; - -/** - * Master billing tabs. - */ -export const MasterBillingTabs = ({ formik }) => { - return ( -
- - } - /> - - -
- ); -}; - -/** - * Payment methods tabs. - */ -export const PaymentMethodTabs = ({ formik }) => { - return ( -
- - } - /> - - - -
- ); -}; diff --git a/packages/webapp/src/containers/Subscriptions/utils.tsx b/packages/webapp/src/containers/Subscriptions/utils.tsx deleted file mode 100644 index 041234fc9..000000000 --- a/packages/webapp/src/containers/Subscriptions/utils.tsx +++ /dev/null @@ -1,9 +0,0 @@ -// @ts-nocheck -import * as Yup from 'yup'; - -export const getBillingFormValidationSchema = () => - Yup.object().shape({ - plan_slug: Yup.string().required(), - period: Yup.string().required(), - license_code: Yup.string().trim(), - });