@@ -14,7 +14,7 @@ import PaymentTable from '../../components/account/paymentTable.js/paymentTable.
14
14
import PaymentMethodCard from '../../components/account/paymentMethodCard/paymentMethodCard.js' ;
15
15
import AccountPlansModal from '../../components/accountPlansModal/accountPlansModal.js' ;
16
16
import AddPaymentMethodForm from '../../components/account/addPaymentMethodForm/addPaymentMethodForm.js' ;
17
- import { earlyAdopterPlan , plans , plansEarly } from '../../components/contexts/plansContext' ;
17
+ import { plans , freePlan } from '../../components/contexts/plansContext' ;
18
18
import { userBillingSettings } from '../../lib/api' ;
19
19
import GeneralPageData from '../../content/pages/general.json' ;
20
20
import constants from '../../lib/constants.js' ;
@@ -23,7 +23,6 @@ import constants from '../../lib/constants.js';
23
23
* @typedef {import('../../components/contexts/plansContext').Plan } Plan
24
24
* @typedef {import('../../components/contexts/plansContext').StorageSubscription } StorageSubscription
25
25
* @typedef {import('../../components/contexts/plansContext').StoragePrice } StoragePrice
26
- * @typedef {import('../../components/contexts/plansContext').EarlyAdopterPlanId } EarlyAdopterPlanId
27
26
*/
28
27
29
28
/**
@@ -96,19 +95,6 @@ const PaymentSettingsPage = props => {
96
95
loadPaymentSettings ( ) ;
97
96
} , [ needsFetchPaymentSettings ] ) ;
98
97
99
- // When storageSubscription is null, user sees a version of planList that contains 'Early Adopter' instead of 'free'
100
- /** @type {Array<Plan> } */
101
- const planList = useMemo ( ( ) => {
102
- if ( typeof paymentSettings === 'undefined' ) {
103
- return plans ;
104
- }
105
- const storageSubscription = paymentSettings . subscription . storage ;
106
- if ( storageSubscription === null ) {
107
- return plansEarly ;
108
- }
109
- return plans ;
110
- } , [ paymentSettings ] ) ;
111
-
112
98
// whenever the optimisticCurrentPlan is set, enqueue a fetch of actual payment settings
113
99
useEffect ( ( ) => {
114
100
if ( optimisticCurrentPlan ) {
@@ -126,15 +112,14 @@ const PaymentSettingsPage = props => {
126
112
}
127
113
const storageSubscription = paymentSettings . subscription . storage ;
128
114
if ( ! storageSubscription ) {
129
- // user has no storage subscription, show early adopter plan
130
- return earlyAdopterPlan ;
115
+ return freePlan ;
131
116
}
132
117
return typeof storageSubscription . price === 'string'
133
- ? planList . find ( plan => {
118
+ ? plans . find ( plan => {
134
119
return plan . id === storageSubscription . price ;
135
120
} )
136
121
: storageSubscription . price ;
137
- } , [ planList , paymentSettings , optimisticCurrentPlan ] ) ;
122
+ } , [ paymentSettings , optimisticCurrentPlan ] ) ;
138
123
const savedPaymentMethod = useMemo ( ( ) => {
139
124
return paymentSettings ?. paymentMethod ;
140
125
} , [ paymentSettings ] ) ;
@@ -160,7 +145,7 @@ const PaymentSettingsPage = props => {
160
145
< Loading message = "Fetching user info..." />
161
146
) : (
162
147
< PaymentTable
163
- plans = { planList }
148
+ plans = { plans }
164
149
currentPlan = { currentPlan }
165
150
setPlanSelection = { setPlanSelection }
166
151
setIsPaymentPlanModalOpen = { setIsPaymentPlanModalOpen }
@@ -214,7 +199,7 @@ const PaymentSettingsPage = props => {
214
199
removePlanQueryParam ( ) ;
215
200
}
216
201
} }
217
- planList = { planList }
202
+ planList = { plans }
218
203
planSelection = { planSelection }
219
204
setCurrentPlan = { setOptimisticCurrentPlan }
220
205
savedPaymentMethod = { savedPaymentMethod }
0 commit comments