-
Notifications
You must be signed in to change notification settings - Fork 13.1k
feat: subscription page #30551
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
feat: subscription page #30551
Changes from all commits
Commits
Show all changes
94 commits
Select commit
Hold shift + click to select a range
f7ab26c
adding mock types and payloads
hugocostadev d0ad203
adding props to Card components
hugocostadev 8f8cf24
add new admin page route
hugocostadev ad41c51
Manage subscription page
hugocostadev e59e531
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev a51a7a1
plan name util
hugocostadev b46b39d
preventing UI error when using V2
hugocostadev 4bf6b93
hasLicenseModule util
hugocostadev be9b575
useIsSelfHosted
hugocostadev b5c5416
Adding translations and UI improvements
hugocostadev f5b4bef
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev 4a4179a
fix: Seats count card
hugocostadev de19a69
feat: Concurrent Users Card and changes
hugocostadev 48abf03
feat: apps usage card
hugocostadev 515ff18
fix: layout changes and fixes
hugocostadev 75c21f2
feat: Checkout URL API and Integration with UpgradeButton
hugocostadev 6375c8c
feat: adding new settings
hugocostadev 2030211
new translations
hugocostadev 8d28e28
fix: adding and updating external links
hugocostadev 042037c
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev 1a8381a
improving billing.checkoutUrl endpoint
hugocostadev 7f97037
replacing license.get with license.info endpoint at useLicense hook
hugocostadev c1f57c4
fix: using new license.info endpoint
hugocostadev 4037c2f
chore: improving getPlanName function
hugocostadev 87960d2
fix: broken import
hugocostadev 640597d
rebasing IServerInfo changes
hugocostadev c6f2926
Merge branch 'develop' into feat/manage-subscription
hugocostadev ef01d72
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev f460835
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev 8f13569
improviments and implementations
hugocostadev efbc168
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev 12dfa21
UX writer changes request
hugocostadev fbb8d0f
add: refetch license button
hugocostadev f458334
fix: testunit
hugocostadev 19b20d8
Create brown-donuts-drive.md
hugocostadev 6e2e1fc
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev c08d60f
fix: TS CI
hugocostadev bbee004
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev 8be509b
remove unused i18n key
hugocostadev b454c9b
chore: improving useRegistrationStatus hook
hugocostadev 393956a
fix url callbacks
hugocostadev 7a4e55f
new cloud endpoint and sync implementation
hugocostadev eca3341
hook loading state and removing color token
hugocostadev c3bc1cb
changes requested
hugocostadev 8da2029
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev 84c53c7
fixing ts check
hugocostadev 53d6ab0
fix ts check error
hugocostadev a86f99b
improving code
hugocostadev 00d3c29
Merge branch 'develop' into feat/manage-subscription
hugocostadev 7755f6f
fix: :bug: percentage error at AppsUsageCard
hugocostadev 2f2bc89
fix: :bug: billing callbackUrl for development environments
hugocostadev d38c81d
fix: :wheelchair: aria-label to IconButton
hugocostadev 546ba46
fix: :bug: MAC card infinite skeleton
hugocostadev f044dae
fix: :art: change Skeleton size
hugocostadev 8c72c56
fix: :bug: plan selection scenarios
hugocostadev 1e42f31
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev 0dacfb2
fix: :bug: dev env callbackURL and improving error handling
hugocostadev 2741b04
Merge branch 'develop' into feat/manage-subscription
hugocostadev ce71d47
fix: :bug: cloud.syncWorkspace permissionRequired
hugocostadev 67610b1
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev f277fc8
fix: prevent plan name translation
hugocostadev c524e22
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev a09e99b
uselicensehook
hugocostadev 7930f32
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev b67cf13
fix: :bug: updating useLicense usage to ManageSubscriptionPage
hugocostadev 2ea999b
Merge branch 'develop' into feat/manage-subscription
hugocostadev b2d0701
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev 918574f
fix: :bug: useLicense hook implementation
hugocostadev f5391f7
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev 1ffc680
fix: :recycle: improving typo
hugocostadev 1f95bab
refactor: :recycle: updating CE feature set
hugocostadev fae798e
refactor code to meet new requirements
hugocostadev 8664b0a
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev e2ce48e
add new accessibility-certification module
hugocostadev d2c8a8c
adding limit validations
hugocostadev a3f61c0
Merge branch 'develop' into feat/manage-subscription
hugocostadev 7241988
fix: :bug: replacing GET with POST method in cloud.syncWorkspace
hugocostadev ec3f387
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
hugocostadev 067ba1e
Merge branch 'develop' into feat/manage-subscription
hugocostadev 990c0b4
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
ggazzo 1829c08
fix: rollback Card component changes
hugocostadev 9f5d596
fix: reverting Card widget component changes
hugocostadev 105fabd
fix: revert license token change
hugocostadev e0e2bb6
fix: :pencil2:
hugocostadev a0b6a3a
Merge remote-tracking branch 'origin/develop' into feat/manage-subscr…
ggazzo d870b4b
review
ggazzo 0d25829
fix subscriptionSuccess
ggazzo 590fc33
fix billing rest type location
ggazzo 4477c68
rename endpoint billing to cloud
ggazzo 2fbdaa8
comment related to endpoint
ggazzo 7906d0b
remove unnecessary `space`
ggazzo 18a8dd2
Allow Sync license if is registered or just subscribed
ggazzo 6121c47
Update ee/packages/license/src/license.ts
ggazzo 4652b7f
fix sync button
ggazzo 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@rocket.chat/meteor": minor | ||
| --- | ||
|
|
||
| Added a new admin page called `Subscription`, this page is responsible of managing the current workspace subscription and it has a overview of the usage and limits of the plan |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { serverFetch as fetch } from '@rocket.chat/server-fetch'; | ||
|
|
||
| import { SystemLogger } from '../../../../server/lib/logger/system'; | ||
| import { settings } from '../../../settings/server'; | ||
| import { getURL } from '../../../utils/server/getURL'; | ||
| import { getWorkspaceAccessTokenOrThrow } from './getWorkspaceAccessToken'; | ||
|
|
||
| export const getCheckoutUrl = async () => { | ||
| try { | ||
| const token = await getWorkspaceAccessTokenOrThrow(false, 'workspace:billing'); | ||
|
|
||
| const subscriptionURL = getURL('admin/subscription', { | ||
| full: true, | ||
| }); | ||
|
|
||
| const body = { | ||
| okCallback: `${subscriptionURL}?subscriptionSuccess=true`, | ||
| cancelCallback: subscriptionURL, | ||
| }; | ||
|
|
||
| const billingUrl = settings.get<string>('Cloud_Billing_Url'); | ||
|
|
||
| const response = await fetch(`${billingUrl}/api/v2/checkout`, { | ||
| method: 'POST', | ||
| headers: { | ||
| Authorization: `Bearer ${token}`, | ||
| }, | ||
| body, | ||
| }); | ||
|
|
||
| if (!response.ok) { | ||
| throw new Error(await response.json()); | ||
|
Comment on lines
+31
to
+32
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ggazzo I could not reproduce a scenario that got this error, because I didn't find a |
||
| } | ||
|
|
||
| return response.json(); | ||
| } catch (err: any) { | ||
| SystemLogger.error({ | ||
| msg: 'Failed to get Checkout URL with Rocket.Chat Billing Service', | ||
| url: '/api/v2/checkout', | ||
| err, | ||
| }); | ||
|
|
||
| throw err; | ||
ggazzo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| }; | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,13 @@ | ||
| import type { OperationResult } from '@rocket.chat/rest-typings'; | ||
| import { useEndpoint } from '@rocket.chat/ui-contexts'; | ||
| import type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query'; | ||
| import type { UseQueryResult } from '@tanstack/react-query'; | ||
| import { useQuery } from '@tanstack/react-query'; | ||
|
|
||
| const queryKey = ['licenses', 'isEnterprise'] as const; | ||
|
|
||
| export const useIsEnterprise = ( | ||
| options?: UseQueryOptions< | ||
| OperationResult<'GET', '/v1/licenses.isEnterprise'>, | ||
| unknown, | ||
| OperationResult<'GET', '/v1/licenses.isEnterprise'>, | ||
| typeof queryKey | ||
| >, | ||
| ): UseQueryResult<OperationResult<'GET', '/v1/licenses.isEnterprise'>> => { | ||
| export const useIsEnterprise = (): UseQueryResult<OperationResult<'GET', '/v1/licenses.isEnterprise'>> => { | ||
| const isEnterpriseEdition = useEndpoint('GET', '/v1/licenses.isEnterprise'); | ||
|
|
||
| return useQuery(queryKey, () => isEnterpriseEdition(), { | ||
| return useQuery(['licenses', 'isEnterprise'], () => isEnterpriseEdition(), { | ||
| keepPreviousData: true, | ||
| staleTime: Infinity, | ||
| ...options, | ||
| }); | ||
| }; |
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,9 @@ | ||
| import { useStatistics } from '../views/hooks/useStatistics'; | ||
|
|
||
| export const useIsSelfHosted = (): { isSelfHosted: boolean; isLoading: boolean } => { | ||
| const { data, isLoading } = useStatistics(); | ||
|
|
||
| const isSelfHosted = data?.deploy?.platform !== 'rocket-cloud'; | ||
hugocostadev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return { isSelfHosted, isLoading }; | ||
| }; | ||
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
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
hugocostadev marked this conversation as resolved.
Show resolved
Hide resolved
|
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
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
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.