@@ -55,6 +55,13 @@ import {
55
55
import Export from "./export" ;
56
56
import UnpaidSubscriptions from "./unpaid-subscriptions" ;
57
57
58
+ // Cancel immediately makes it pointless to ever buy a license without
59
+ // buying a subscription, since you can just buy a license via a subscription,
60
+ // get a big discount, and cancel exactly at the end of the period. Hence
61
+ // disabling this for now, unless we come up with something better. This
62
+ // flag can be toggled to turn the functionality back on.
63
+ const SUPPORT_CANCEL_IMMEDIATELY = false ;
64
+
58
65
export function SubscriptionStatus ( { status } ) {
59
66
return (
60
67
< Tag color = { STATUS_TO_COLOR [ status ] } >
@@ -171,6 +178,70 @@ function SubscriptionActions({
171
178
}
172
179
} ;
173
180
181
+ const footer = [
182
+ < Button
183
+ disabled = { loading }
184
+ key = "nothing"
185
+ onClick = { ( ) => setModalOpen ( false ) }
186
+ type = "primary"
187
+ >
188
+ No Change
189
+ </ Button > ,
190
+ ] ;
191
+ if ( SUPPORT_CANCEL_IMMEDIATELY ) {
192
+ footer . push (
193
+ < Popconfirm
194
+ key = "cancelNow"
195
+ title = { "Cancel this subscription immediately?" }
196
+ description = { ( ) => {
197
+ setTimeout ( updateCreditToCancel , 1 ) ;
198
+ if ( creditToCancel == null ) {
199
+ return < Spin /> ;
200
+ }
201
+
202
+ return (
203
+ < div style = { { maxWidth : "450px" } } >
204
+ The license will immediately become invalid and any projects using
205
+ it will stop.
206
+ { license ?. info ?. purchased . type == "disk" && (
207
+ < b > All data on the disk will be permanently deleted.</ b >
208
+ ) } { " " }
209
+ You will receive a < b > credit of { currency ( creditToCancel ) } </ b > for
210
+ the prorated time left on the subscription. There are no
211
+ transaction fees for canceling or resuming a subscription, and you
212
+ can resume your subscription at any point later.
213
+ </ div >
214
+ ) ;
215
+ } }
216
+ onConfirm = { ( ) => handleCancel ( true ) }
217
+ okText = "Yes"
218
+ cancelText = "No"
219
+ >
220
+ < Button disabled = { loading } danger >
221
+ Cancel Now...
222
+ </ Button >
223
+ </ Popconfirm > ,
224
+ ) ;
225
+ }
226
+ footer . push (
227
+ < Popconfirm
228
+ key = "cancelEnd"
229
+ title = { "Cancel this subscription at period end?" }
230
+ description = {
231
+ < div style = { { maxWidth : "450px" } } >
232
+ The license will still be valid until the subscription period ends.
233
+ You can always restart the subscription or edit the license to change
234
+ the subscription price.
235
+ </ div >
236
+ }
237
+ onConfirm = { ( ) => handleCancel ( false ) }
238
+ okText = "Yes"
239
+ cancelText = "No"
240
+ >
241
+ < Button disabled = { loading } > Cancel at Period End...</ Button >
242
+ </ Popconfirm > ,
243
+ ) ;
244
+
174
245
return (
175
246
< Space direction = "vertical" >
176
247
{ loading && < Spin /> }
@@ -218,79 +289,31 @@ function SubscriptionActions({
218
289
title = "Cancel Subscription"
219
290
open = { modalOpen }
220
291
onCancel = { ( ) => setModalOpen ( false ) }
221
- footer = { [
222
- < Button
223
- disabled = { loading }
224
- key = "nothing"
225
- onClick = { ( ) => setModalOpen ( false ) }
226
- type = "primary"
227
- >
228
- No Change
229
- </ Button > ,
230
- < Popconfirm
231
- key = "cancelNow"
232
- title = { "Cancel this subscription immediately?" }
233
- description = { ( ) => {
234
- setTimeout ( updateCreditToCancel , 1 ) ;
235
- if ( creditToCancel == null ) {
236
- return < Spin /> ;
237
- }
238
-
239
- return (
240
- < div style = { { maxWidth : "450px" } } >
241
- The license will immediately become invalid and any projects
242
- using it will stop.
243
- { license ?. info ?. purchased . type == "disk" && (
244
- < b > All data on the disk will be permanently deleted.</ b >
245
- ) } { " " }
246
- You will receive a{ " " }
247
- < b > credit of { currency ( creditToCancel ) } </ b > for the prorated
248
- time left on the subscription. There are no transaction fees
249
- for canceling or resuming a subscription, and you can resume
250
- your subscription at any point later.
251
- </ div >
252
- ) ;
253
- } }
254
- onConfirm = { ( ) => handleCancel ( true ) }
255
- okText = "Yes"
256
- cancelText = "No"
257
- >
258
- < Button disabled = { loading } danger >
259
- Cancel Now...
260
- </ Button >
261
- </ Popconfirm > ,
262
- < Popconfirm
263
- key = "cancelEnd"
264
- title = { "Cancel this subscription at period end?" }
265
- description = {
266
- < div style = { { maxWidth : "450px" } } >
267
- The license will still be valid until the subscription period
268
- ends. You can always restart the subscription or edit the
269
- license to change the subscription price.
270
- </ div >
271
- }
272
- onConfirm = { ( ) => handleCancel ( false ) }
273
- okText = "Yes"
274
- cancelText = "No"
275
- >
276
- < Button disabled = { loading } > Cancel at Period End...</ Button >
277
- </ Popconfirm > ,
278
- ] }
292
+ footer = { footer }
279
293
>
280
294
< div style = { { maxWidth : "450px" } } >
281
295
Are you sure you want to cancel this subscription? The corresponding
282
296
license will not be renewed.
283
297
< ul style = { { margin : "15px 0" } } >
284
298
< li >
285
- Select "Cancel at Period End" to let your license continue to
286
- the end of the current period.
299
+ Select "Cancel at Period End" to cancel your subscription. You
300
+ have already paid for your license, so it will continue to the
301
+ end of the current period.
287
302
</ li >
288
303
< li >
289
- To receive a prorated credit for the remainder of this license,
290
- select "Cancel Now". You can spend your credit on another
291
- license, pay-as-you-go project upgrades, etc.
304
+ You can always edit the license, which will change the
305
+ subscription price. Click the license code to the left, then
306
+ click "Edit License..."
292
307
</ li >
293
- < li > You can always resume a canceled subscription later.</ li >
308
+ { SUPPORT_CANCEL_IMMEDIATELY && (
309
+ < li >
310
+ To receive a prorated credit for the remainder of this
311
+ license, select "Cancel Now". You can spend your
312
+ non-refundable credit on another license, pay-as-you-go
313
+ project upgrades, etc.
314
+ </ li >
315
+ ) }
316
+ < li > You can resume a canceled subscription later.</ li >
294
317
</ ul >
295
318
{ license ?. info ?. purchased . type == "disk" && (
296
319
< Alert
@@ -319,16 +342,16 @@ function SubscriptionActions({
319
342
return (
320
343
< div style = { { maxWidth : "450px" } } >
321
344
The corresponding license will become active again, and{ " " }
322
- < b > you will be charged { currency ( round2up ( costToResume ) ) } </ b > for the
323
- remainder of the current period.
345
+ < b > you will be charged { currency ( round2up ( costToResume ) ) } </ b > { " " }
346
+ for the remainder of the current period.
324
347
{ periodicCost != null && (
325
348
< span >
326
349
{ " " }
327
350
The cost will then be{ " " }
328
351
< b >
329
352
{ currency ( round2up ( periodicCost ) ) } /{ interval }
330
- </ b > , { " " }
331
- which is the current rate.
353
+ </ b >
354
+ , which is the current rate.
332
355
</ span >
333
356
) }
334
357
</ div >
0 commit comments