-
-
Notifications
You must be signed in to change notification settings - Fork 90
License upsell section #2401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
License upsell section #2401
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f55f23a
license upsell section - initial implementation
j-chmielewski 485a8e5
use the dividers, spacing fixes
j-chmielewski 32c153f
expired icon
j-chmielewski c0ce889
grace period calculations for expired license settings
j-chmielewski 19bedaa
distinguish between subscription and non-subscription licenses
j-chmielewski 62334d2
business, enterprise translations
j-chmielewski ce1d4c6
display grace period as expired
j-chmielewski 003f9d4
extract license types and helpers and reuse them
j-chmielewski d82916e
common license expired message
j-chmielewski 7d44af5
display badge when license expired
j-chmielewski cc5d3cf
fix expired label
j-chmielewski 0dd390c
update translations
j-chmielewski 260c806
display limits if in grace period
j-chmielewski 214276d
"expires soon" warning
j-chmielewski b5fe9ea
"contact sales" button
j-chmielewski e15d2f2
remove "open in new window" icon from buttons
j-chmielewski 8ba2f0b
update translation message
j-chmielewski 66a2b31
grace period calculation helper
j-chmielewski fd65e41
Merge branch 'dev' into try-business-for-free
j-chmielewski 34fca24
fix translations
j-chmielewski 833fbaa
review fixes
j-chmielewski b9e72de
fix image size in upsell sections
j-chmielewski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+10.3 KB
...src/pages/settings/SettingsIndexPage/tabs/SettingsLicenseTab/assets/expired.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-17.5 KB
...src/pages/settings/SettingsIndexPage/tabs/SettingsLicenseTab/assets/starter.png
Binary file not shown.
51 changes: 51 additions & 0 deletions
51
.../components/SettingsLicenseBusinessUpsellSection/SettingsLicenseBusinessUpsellSection.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { m } from '../../../../../../../paraglide/messages'; | ||
| import { SettingsCard } from '../../../../../../../shared/components/SettingsCard/SettingsCard'; | ||
| import { externalLink } from '../../../../../../../shared/constants'; | ||
| import { Button } from '../../../../../../../shared/defguard-ui/components/Button/Button'; | ||
| import { ExternalLink } from '../../../../../../../shared/defguard-ui/components/ExternalLink/ExternalLink'; | ||
| import { SizedBox } from '../../../../../../../shared/defguard-ui/components/SizedBox/SizedBox'; | ||
| import { ThemeSpacing } from '../../../../../../../shared/defguard-ui/types'; | ||
| import enterpriseImage from '../../assets/enterprise.png'; | ||
|
|
||
| export const SettingsLicenseBusinessUpsellSection = () => { | ||
| return ( | ||
| <SettingsCard id="license-plans"> | ||
| <header> | ||
| <h5>{m.settings_license_expand_plan_title()}</h5> | ||
| <ExternalLink | ||
| href={externalLink.defguard.pricing} | ||
| rel="noreferrer noopener" | ||
| target="_blank" | ||
| > | ||
| {m.settings_license_compare_our_plans()} | ||
| </ExternalLink> | ||
| </header> | ||
| <SizedBox height={ThemeSpacing.Xl3} /> | ||
| <div className="license-item"> | ||
| <div className="track"> | ||
| <div className="image-track"> | ||
| <img src={enterpriseImage} alt="" /> | ||
| </div> | ||
| <div className="content"> | ||
| <div className="top"> | ||
| <p className="title">{m.settings_license_plan_enterprise_title()}</p> | ||
| </div> | ||
| <p className="description"> | ||
| {m.settings_license_plan_enterprise_description()} | ||
| </p> | ||
| <SizedBox height={ThemeSpacing.Md} /> | ||
| <div className="actions"> | ||
| <a | ||
| href={externalLink.defguard.sales} | ||
| rel="noreferrer noopener" | ||
| target="_blank" | ||
| > | ||
| <Button variant="outlined" text={m.contact_sales()} /> | ||
| </a> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </SettingsCard> | ||
| ); | ||
| }; |
62 changes: 62 additions & 0 deletions
62
...ttingsLicenseTab/components/SettingsLicenseExpiredNotice/SettingsLicenseExpiredNotice.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import dayjs from 'dayjs'; | ||
| import { m } from '../../../../../../../paraglide/messages'; | ||
| import type { LicenseInfo } from '../../../../../../../shared/api/types'; | ||
| import { SettingsCard } from '../../../../../../../shared/components/SettingsCard/SettingsCard'; | ||
| import { | ||
| externalLink, | ||
| licenseGracePeriodDays, | ||
| } from '../../../../../../../shared/constants'; | ||
| import { Button } from '../../../../../../../shared/defguard-ui/components/Button/Button'; | ||
| import expiredImage from '../../assets/expired.png'; | ||
|
|
||
| type Props = { | ||
| licenseInfo: LicenseInfo; | ||
| state: 'gracePeriod' | 'expiredLicense'; | ||
| }; | ||
|
|
||
| export const SettingsLicenseExpiredNotice = ({ licenseInfo, state }: Props) => { | ||
| const gracePeriodDaysLeft = getGracePeriodDaysLeft(licenseInfo.valid_until); | ||
|
|
||
| const remainingDuration = m.settings_duration_days({ days: gracePeriodDaysLeft }); | ||
|
|
||
| const description = | ||
| state === 'expiredLicense' | ||
| ? m.settings_license_expired_notice_description({ tier: licenseInfo.tier }) | ||
| : m.settings_license_expired_notice_description_grace_period({ | ||
| duration: remainingDuration, | ||
| }); | ||
|
|
||
| return ( | ||
| <SettingsCard id="license-expired-notice"> | ||
| <div className="notice-track"> | ||
| <div className="image-track"> | ||
| <img src={expiredImage} alt="" /> | ||
| </div> | ||
| <div className="content-track"> | ||
| <p className="title">{m.settings_license_expired_notice_title()}</p> | ||
| <p className="description">{description}</p> | ||
| <a | ||
| href={externalLink.defguard.pricing} | ||
| rel="noreferrer noopener" | ||
| target="_blank" | ||
| > | ||
| <Button | ||
| variant="outlined" | ||
| text={m.settings_license_expired_notice_button()} | ||
| /> | ||
| </a> | ||
| </div> | ||
| </div> | ||
| </SettingsCard> | ||
| ); | ||
| }; | ||
|
|
||
| const getGracePeriodDaysLeft = (validUntil: string | null): number => { | ||
| const gracePeriodEndsAt = validUntil | ||
| ? dayjs.utc(validUntil).local().add(licenseGracePeriodDays, 'day') | ||
| : null; | ||
|
|
||
| return gracePeriodEndsAt | ||
| ? Math.max(gracePeriodEndsAt.startOf('day').diff(dayjs().startOf('day'), 'day'), 0) | ||
| : 0; | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.