Skip to content

Commit 58f9075

Browse files
authored
Merge pull request #105 from terminusdb/fix_payment
review label in subscription
2 parents a319950 + e635b41 commit 58f9075

File tree

5 files changed

+90
-43
lines changed

5 files changed

+90
-43
lines changed

packages/tdb-dashboard/src/pages/PlansPage.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { PLANS_DESCRIPTION,COMMUNITY_PLAN,PROFESSIONAL_PLAN,SCALE_PLAN,ENTERPRIS
33
import {Layout} from "./Layout"
44
import {Container, Card, Row, Col, Button, Stack} from "react-bootstrap"
55
import {useNavigate} from "react-router-dom"
6-
import {PaymentPage} from "./PaymentPage"
6+
import {PaymentPage} from "../payment/PaymentPage"
77
import {WOQLClientObj} from '../init-woql-client'
88
import { Feedback } from "./Feedback";
99
import {MdEuroSymbol} from "react-icons/md"
@@ -78,21 +78,20 @@ export const PlansPage = (props) => {
7878
<Card.Title style={{color:"white !important"}} className=" fw-bold m-5">{arr.title}</Card.Title>
7979
</Card.Header>
8080
<Card.Body>
81+
8182
<Stack direction="horizontal" gap={0} className="justify-content-center">
8283
{(arr.title === PROFESSIONAL_PLAN || arr.title === SCALE_PLAN) &&
8384
<MdEuroSymbol size="35"/>
8485
}
8586
<h1>{arr.price} <span className="h6" style={{marginLeft:"-10px;"}}>{arr.subprice}</span></h1>
8687
</Stack>
87-
{planButton}
88+
{planButton}
89+
<Stack direction="vertical" className="mb-3">
90+
{getLabels(arr)}
91+
</Stack>
8892
<Card.Text className="text-light text-left h6">
8993
{arr.text}
9094
</Card.Text>
91-
92-
<Stack direction="vertical">
93-
{getLabels(arr)}
94-
</Stack>
95-
9695
</Card.Body>
9796
<Card.Footer style={{background:arr.color}}>
9897
</Card.Footer >
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React from "react"
2+
import {WOQLClientObj} from '../init-woql-client'
3+
import {Modal,Button,Stack, Card} from "react-bootstrap"
4+
import {MdEuroSymbol} from "react-icons/md"
5+
6+
export const PaymentPage = ({showModal, setShowModal, tier}) => {
7+
const {woqlClient, } = WOQLClientObj()
8+
if(!woqlClient) return ""
9+
10+
const closeModal = () =>{
11+
setShowModal(false)
12+
}
13+
14+
return <Modal size="lg" className="modal-dialog-right" show={showModal} onHide={closeModal}>
15+
<Modal.Header style={{background:subscriptionObj.color}}>
16+
<Stack direction="horizontal" gap={10} className="justify-content-center">
17+
<Modal.Title className="h4 fw-bold">Remove the {tier} Subscription</Modal.Title>
18+
</Stack>
19+
<Button variant="close" aria-label="Close" onClick={closeModal} />
20+
</Modal.Header>
21+
<Modal.Body className="p-3">
22+
<Card>
23+
<Card.Text className="justify-content-right">Subscription Details</Card.Text>
24+
<Stack direction="horizontal" gap={10} className="justify-content-end">
25+
<Card.Text>
26+
{props.subscriptionObj.title} <MdEuroSymbol /> {props.subscriptionObj.price} (Billed monthly)</Card.Text>
27+
</Stack>
28+
29+
<div className="d-flex justify-content-end mt-2">
30+
<Button onClick={props.closeModal} disabled={processing} variant="light" >Cancel</Button>
31+
<Button type={"submit"} disabled={processing || !enableSubmit || !stripe} className="ml-3">
32+
{processing ? "Processing…" : "Subscribe"}
33+
</Button>
34+
</div>
35+
<div className="d-flex justify-content-end mt-2">
36+
<span style={{fontSize: "15px", color: "#888" }}>* your account will be billed monthly until cancelled.
37+
</span>
38+
</div>
39+
</Card>
40+
</Modal.Body>
41+
</Modal>
42+
}

packages/tdb-dashboard/src/pages/PaymentPage.js renamed to packages/tdb-dashboard/src/payment/PaymentPage.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from "react"
2-
import MyStoreCheckout from "../payment/MyStoreCheckout"
3-
import { Layout } from "./Layout"
2+
import MyStoreCheckout from "./MyStoreCheckout"
43
import {WOQLClientObj} from '../init-woql-client'
54
import {Container,Modal,Button,Stack} from "react-bootstrap"
65
import {MdEuroSymbol} from "react-icons/md"

packages/tdb-dashboard/src/payment/StripeManager.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ export function StripeManager(stripe=null){
1818
const [enableSubmit, setEnableSubmit] = useState(false)
1919
const [paymentMethod, setPaymentMethod] = useState(false)
2020

21+
22+
async function deleteSubscrition(){
23+
try{
24+
processStart()
25+
const token = await clientUser.getTokenSilently()
26+
const options = getOptions(token);
27+
const response = await axiosHub.delete(`${baseUrl}/private/subscription`, options)
28+
return true
29+
}catch(err){
30+
const message = err && err.response && err.response.data ? err.response.data.message : 'There was an error processing your request'
31+
processError(message)
32+
}finally{
33+
setProcessing(false)
34+
}
35+
}
36+
2137
async function getPaymentMethod(){
2238
try{
2339
const token = await clientUser.getTokenSilently()
@@ -155,7 +171,7 @@ export function StripeManager(stripe=null){
155171
}
156172

157173

158-
return {getPublicStripeKey,
174+
return {getPublicStripeKey, deleteSubscrition,
159175
createCustomer,
160176
updateSubscription,
161177
processError,

packages/tdb-dashboard/src/payment/labels.js

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@ export const PLANS_DESCRIPTION = [
3434
price:'Free',
3535
subprice:'',
3636
labelsList:[
37-
'Dashboard Sign Up',
3837
'3 Teams',
3938
'10 Users',
40-
'10 Documents',
39+
'10 Data Products',
4140
'5 Roles',
42-
'10,000 document limit',
41+
'10,000 Documents limit',
4342
'100,000 API calls per month',
4443
'Unlimited Remote Sources'
4544
],
@@ -52,21 +51,19 @@ export const PLANS_DESCRIPTION = [
5251
subtitle: 'Modern data infrastructure',
5352
limitation : ['- 10,000 document limit',
5453
'- 100,000 API calls'],
55-
text: `Hosted by us, TerminusCMS is a full featured content and knowledge management system. The free account is limited on object storage and API calls.
54+
text: `Hosted by us, TerminusCMS is a full featured content and knowledge management system.
5655
57-
If you exceed the limits you will need to upgrade to professional within a month.
58-
We will inform you when you are close and when you cross the threshold.`,
56+
The professional package features 10 teams, 30 seats, 1 million API calls, and 100,000 documents.`,
5957
preprice:'',
6058
price:'100',
61-
subprice:'/month',
59+
subprice:'per month',
6260
labelsList:[
63-
'Dashboard Sign Up',
64-
'3 Teams',
65-
'10 Users',
66-
'10 Documents',
61+
'10 Teams',
62+
'30 Users',
63+
'Unlimited Data Products',
6764
'5 Roles',
68-
'10,000 document limit',
69-
'100,000 API calls per month',
65+
'100,000 document limit',
66+
'1 million API calls per month',
7067
'Unlimited Remote Sources'
7168
],
7269
color:"#e87cd6",
@@ -77,21 +74,17 @@ export const PLANS_DESCRIPTION = [
7774
subtitle: 'Modern data infrastructure',
7875
limitation : ['- 10,000 document limit',
7976
'- 100,000 API calls'],
80-
text: `Hosted by us, TerminusCMS is a full featured content and knowledge management system. The free account is limited on object storage and API calls.
81-
82-
If you exceed the limits you will need to upgrade to professional within a month.
83-
We will inform you when you are close and when you cross the threshold.`,
77+
text: `Hosted by us with guaranteed compute resource. API limits apply.`,
8478
preprice:'from ',
8579
price:'600',
8680
subprice:'per month',
8781
labelsList:[
88-
'Dashboard Sign Up',
89-
'3 Teams',
90-
'10 Users',
91-
'10 Documents',
82+
'Unlimited Teams',
83+
'Unlimited Users',
84+
'Unlimited Documents',
9285
'5 Roles',
93-
'10,000 document limit',
94-
'100,000 API calls per month',
86+
'10 million document limit',
87+
'10 million API calls per month',
9588
'Unlimited Remote Sources'
9689
],
9790
color:"#8659fa",
@@ -102,19 +95,17 @@ export const PLANS_DESCRIPTION = [
10295
subtitle: 'Modern data infrastructure',
10396
limitation : ['- 10,000 document limit',
10497
'- 100,000 API calls'],
105-
text: `Hosted by us, TerminusCMS is a full featured content and knowledge management system. The free account is limited on object storage and API calls.
98+
text: `Custom plans to help with your organization-wide content and knowledge management.
10699
107-
If you exceed the limits you will need to upgrade to professional within a month.
108-
We will inform you when you are close and when you cross the threshold.`,
100+
We can provide bespoke services for deloyment, feature development, customization, and support. Please get in touch to discuss your requirements.`,
109101
price:'Get in touch',
110102
labelsList:[
111-
'Dashboard Sign Up',
112-
'3 Teams',
113-
'10 Users',
114-
'10 Documents',
115-
'5 Roles',
116-
'10,000 document limit',
117-
'100,000 API calls per month',
103+
'Unlimited Teams',
104+
'Unlimited Users',
105+
'Unlimited Documents',
106+
'Unlimited Roles',
107+
'Unlimited document limit',
108+
'Unlimited API calls per month',
118109
'Unlimited Remote Sources'
119110
],
120111
color:"#3450dc",

0 commit comments

Comments
 (0)