Skip to content

Commit 8b6bce6

Browse files
committed
feat: Add MaxDaysToCapturePaywall component
1 parent 0b8fa29 commit 8b6bce6

File tree

5 files changed

+59
-1
lines changed

5 files changed

+59
-1
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react'
2+
import PropTypes from 'prop-types'
3+
4+
import Paywall from './Paywall'
5+
import withPaywallLocales from './locales/withPaywallLocales'
6+
7+
/**
8+
* Paywall displayed when the user reach the maximum days allowed of capture geolocated data
9+
*/
10+
const MaxDaysToCapturePaywall = ({ days, onClose }) => {
11+
return (
12+
<Paywall
13+
variant="maxDaysToCapture"
14+
contentInterpolation={{ smart_count: days }}
15+
onClose={onClose}
16+
/>
17+
)
18+
}
19+
20+
MaxDaysToCapturePaywall.propTypes = {
21+
/** Maximum days allowed of capture geolocated data */
22+
days: PropTypes.number.isRequired,
23+
/** Callback used when the user close the paywall */
24+
onClose: PropTypes.func.isRequired
25+
}
26+
27+
export default withPaywallLocales(MaxDaysToCapturePaywall)

react/Paywall/Readme.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import {
2121
MaxAccountsByKonnectorPaywall,
2222
MaxAccountsPaywall,
2323
MaxPapersPaywall,
24-
QuotaPaywall
24+
QuotaPaywall,
25+
MaxDaysToCapturePaywall
2526
} from 'cozy-ui/transpiled/react/Paywall'
2627
import Variants from 'cozy-ui/docs/components/Variants'
2728
import DemoProvider from 'cozy-ui/docs/components/DemoProvider'
@@ -61,6 +62,10 @@ const paywalls = [
6162
{
6263
name: 'QuotaPaywall',
6364
component: QuotaPaywall
65+
},
66+
{
67+
name: 'MaxDaysToCapturePaywall',
68+
component: MaxDaysToCapturePaywall
6469
}
6570
]
6671

@@ -130,6 +135,7 @@ const makeClient = premiumLink =>
130135
<PaywallComponent
131136
isPublic={variant.isPublic}
132137
max={4}
138+
days={30}
133139
konnectorName="EDF"
134140
onClose={() => setState({ modalOpened: false })}
135141
/>

react/Paywall/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ export {
66
export { default as MaxAccountsPaywall } from './MaxAccountsPaywall'
77
export { default as MaxPapersPaywall } from './MaxPapersPaywall'
88
export { default as QuotaPaywall } from './QuotaPaywall'
9+
export { default as MaxDaysToCapturePaywall } from './MaxDaysToCapturePaywall'

react/Paywall/locales/en.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,17 @@
7979
"content": "Your disk storage is full.\n\nPlease remove files, empty your trash before uploading files.",
8080
"action": "I understand"
8181
}
82+
},
83+
"maxDaysToCapturePaywall": {
84+
"premium": {
85+
"title": "Upgrade your plan",
86+
"content": "Your plan allows you to capture only **%{smart_count} day of trips**.\n\nTo unlock this feature, or simply support us, you can change your Cozy plan. |||| Your plan allows you to capture only **%{smart_count} days of trips**.\n\nTo unlock this feature, or simply support us, you can change your Cozy plan.",
87+
"action": "Check our plans"
88+
},
89+
"default": {
90+
"title": "Information",
91+
"content": "Your current plan does not allow you to take advantage of this feature.",
92+
"action": "I understand"
93+
}
8294
}
8395
}

react/Paywall/locales/fr.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,17 @@
7979
"content": "Votre espace de stockage est plein.\n\nVeuillez supprimer des fichiers, et vider votre corbeille avant d'importer de nouveaux fichiers.",
8080
"action": "J'ai compris"
8181
}
82+
},
83+
"maxDaysToCapturePaywall": {
84+
"premium": {
85+
"title": "Augmentez votre offre",
86+
"content": "Vous avez atteint la limite de **%{smart_count} jour de trajet sauvegardé** inclus dans votre offre.\n\nPour débloquer cette fonctionnalité, ou simplement nous soutenir, vous pouvez modifier l'offre de votre Cozy. |||| Vous avez atteint la limite des **%{smart_count} jours de trajets sauvegardés** inclus dans votre offre.\n\nPour débloquer cette fonctionnalité, ou simplement nous soutenir, vous pouvez modifier l'offre de votre Cozy.",
87+
"action": "Check our plans"
88+
},
89+
"default": {
90+
"title": "Information",
91+
"content": "Votre offre actuelle ne vous permet pas de profiter de cette fonctionnalité.",
92+
"action": "J'ai compris"
93+
}
8294
}
8395
}

0 commit comments

Comments
 (0)