Skip to content

Commit

Permalink
Add price to update dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustem Mussabekov committed Jun 17, 2024
1 parent 7522935 commit 8d05958
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
27 changes: 22 additions & 5 deletions src/co/user/upgrade/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
import s from './index.module.styl'
import React, { useCallback } from 'react'
import React, { useState, useCallback, useEffect } from 'react'
import links from '~config/links'

import Modal, { Content, Header } from '~co/overlay/modal'
import Icon from '~co/common/icon'
import Button from '~co/common/button'

export default function UserUpgrade({ onClose }) {
//load monthly price
const [price, setPrice] = useState('')
useEffect(()=>{
(async()=>{
const res = await fetch('https://raindrop.onfastspring.com/popup-raindrop/builder', {
method: 'POST',
body: `put=${encodeURIComponent('{"items":[{"path":"promonthly1","quantity":1}]}')}`,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
const json = await res.json()
setPrice(json.total)
})()
}, [])

//close on click buy
const onBuyClick = useCallback(()=>onClose(), [onClose])

return (
Expand All @@ -26,16 +43,16 @@ export default function UserUpgrade({ onClose }) {
<div>
<Header
data-no-shadow
title='Go Pro' />
title={`Go Pro ${price ? `for ${price}/mo`:''}`} />

<Content className={s.content}>
<p>
Unlock powerful features to help you do more with the content you save. <a href={links.pro['help-learn-more']} target='_blank'>Learn more</a>
Unlock powerful features to help you do more with the content you save. <a href={links.pro.compare} target='_blank'>Learn more</a>
</p>

<h4>Includes</h4>
<ul>
<li><Icon className={s.icon} name='ai' /> Collection & tag suggestions</li>
<li><Icon className={s.icon} name='ai' /> Suggested collections & tags</li>
<li><Icon className={s.icon} name='sort_score' /> Full-text search</li>
<li><Icon className={s.icon} name='export' /> Forever copies</li>
<li><Icon className={s.icon} name='highlights' /> Annotations</li>
Expand All @@ -54,7 +71,7 @@ export default function UserUpgrade({ onClose }) {
href={links.pro.buy}
target='_blank'
onClick={onBuyClick}>
Upgrade
Subscribe
</Button>
</div>
</Content>
Expand Down
2 changes: 1 addition & 1 deletion src/config/csp.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
hosts: 'https://app.raindrop.io https://*.sentry.io https://sentry.io'
hosts: 'https://app.raindrop.io https://*.sentry.io https://sentry.io https://raindrop.onfastspring.com'
}

0 comments on commit 8d05958

Please sign in to comment.