-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: new pricing features #9176
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
Changes from 10 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6f7d29f
feat: new pricing
xiaodemen 6a817a5
fix: remove button
xiaodemen 458c8c0
Add upgrade plan banner in invite modal
yaoweiprc e815d9a
fix type issue
yaoweiprc 356e13a
fix smoke test
yaoweiprc 9661071
Remove console.log
yaoweiprc 32dccb2
fix: fix quota issue
xiaodemen 9a00985
update useIsLightTheme
yaoweiprc a774ffb
fix type
yaoweiprc d91c183
Merge branch 'develop' into feat/new-pricing
xiaodemen 008058e
add annotation
yaoweiprc 47cc939
move doc link
yaoweiprc dc8d376
fix: fix source
xiaodemen 4a0572b
Merge branch 'develop' into feat/new-pricing
xiaodemen 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export * from '../ui/components/icon'; | ||
| // https://fontawesome.com/search?q=user&ic=free&o=r |
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,69 @@ | ||
| import classnames from 'classnames'; | ||
| import type React from 'react'; | ||
| import { Button, Dialog, Heading, Modal as RAModal, ModalOverlay } from 'react-aria-components'; | ||
|
|
||
| import { Icon } from '~/basic-components/icon'; | ||
|
|
||
| interface Props { | ||
| isOpen: boolean; | ||
| onClose?: () => void; | ||
| title?: React.ReactNode; | ||
| closable?: boolean; | ||
| className?: string; | ||
| } | ||
|
|
||
| export const Modal: React.FC<React.PropsWithChildren<Props>> = ({ | ||
| isOpen, | ||
| onClose, | ||
| className, | ||
| title, | ||
| closable, | ||
| children, | ||
| }) => { | ||
| return ( | ||
| <ModalOverlay | ||
| isOpen={isOpen} | ||
| onOpenChange={isOpen => { | ||
| !isOpen && onClose?.(); | ||
| }} | ||
| isDismissable | ||
| className="fixed left-0 top-0 z-10 flex h-[--visual-viewport-height] w-full items-center justify-center bg-black/30" | ||
| > | ||
| <RAModal | ||
| onOpenChange={isOpen => { | ||
| !isOpen && onClose?.(); | ||
| }} | ||
| className={classnames( | ||
| 'flex flex-col rounded-md border border-solid border-[--hl-sm] bg-[--color-bg] p-[--padding-lg] text-[--color-font]', | ||
| className, | ||
| )} | ||
| > | ||
| <Dialog className="flex h-full flex-1 flex-col overflow-hidden outline-none"> | ||
| {({ close }) => ( | ||
| <> | ||
| <div className="flex flex-1 flex-col gap-4 overflow-hidden"> | ||
| {' '} | ||
| <div className="flex flex-shrink-0 items-center justify-between gap-2"> | ||
| {title && ( | ||
| <Heading slot="title" className="text-3xl"> | ||
| {title} | ||
| </Heading> | ||
| )} | ||
| {closable && ( | ||
| <Button | ||
| className="flex aspect-square h-6 flex-shrink-0 items-center justify-center rounded-sm text-sm text-[--color-font] ring-1 ring-transparent transition-all hover:bg-[--hl-xs] focus:ring-inset focus:ring-[--hl-md] aria-pressed:bg-[--hl-sm]" | ||
| onPress={() => close()} | ||
| > | ||
| <Icon icon="x" /> | ||
| </Button> | ||
| )} | ||
| </div> | ||
| </div> | ||
| {children} | ||
| </> | ||
| )} | ||
| </Dialog> | ||
| </RAModal> | ||
| </ModalOverlay> | ||
| ); | ||
| }; |
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,32 @@ | ||
| import classNames from 'classnames'; | ||
|
|
||
| interface Props { | ||
| percent: number; | ||
| className?: string; | ||
| status?: 'success' | 'error' | 'normal'; | ||
| } | ||
|
|
||
| export const Progress = ({ className, percent, status }: Props) => { | ||
| return ( | ||
| <div | ||
| // FIXME: use css variables for colors | ||
| className={classNames( | ||
| 'h-[10px] flex-grow overflow-hidden rounded-full bg-[#f1e6ff]', | ||
| status === 'error' && 'bg-[#db110040]', | ||
| status === 'success' && 'bg-[#00bf7340]', | ||
| className, | ||
| )} | ||
| > | ||
| <div | ||
| className={classNames( | ||
| 'transition-width h-full rounded-full bg-[--color-surprise] duration-1000 ease-in-out', | ||
| status === 'error' && 'bg-[--color-danger]', | ||
| status === 'success' && 'bg-[--color-success]', | ||
| )} | ||
| style={{ | ||
| width: `${percent}%`, | ||
| }} | ||
| /> | ||
| </div> | ||
| ); | ||
| }; |
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
45 changes: 45 additions & 0 deletions
45
packages/insomnia/src/routes/organization.$organizationId.collaborators-check-seats.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,45 @@ | ||
| import { href } from 'react-router'; | ||
| import { v4 as uuidv4 } from 'uuid'; | ||
|
|
||
| import { userSession } from '~/models'; | ||
| import { insomniaFetch } from '~/ui/insomniaFetch'; | ||
| import { createFetcherLoadHook } from '~/utils/router'; | ||
|
|
||
| import type { Route } from './+types/organization.$organizationId.collaborators-check-seats'; | ||
|
|
||
| export const needsToUpgrade = 'NEEDS_TO_UPGRADE'; | ||
| export const needsToIncreaseSeats = 'NEEDS_TO_INCREASE_SEATS'; | ||
|
|
||
| export interface CheckSeatsResponse { | ||
| isAllowed: boolean; | ||
| code?: typeof needsToUpgrade | typeof needsToIncreaseSeats; | ||
| } | ||
|
|
||
| export async function clientLoader({ params }: Route.ClientLoaderArgs) { | ||
| const { id: sessionId } = await userSession.get(); | ||
|
|
||
| const { organizationId } = params; | ||
|
|
||
| try { | ||
| const checkResponseData = await insomniaFetch<CheckSeatsResponse>({ | ||
| method: 'POST', | ||
| path: `/v1/organizations/${organizationId}/check-seats`, | ||
| data: { emails: [`insomnia-mock-check-seats-${uuidv4()}@konghq.com`] }, | ||
yaoweiprc marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| sessionId, | ||
| onlyResolveOnSuccess: true, | ||
| }); | ||
| return checkResponseData; | ||
| } catch { | ||
| return { isAllowed: true }; | ||
| } | ||
| } | ||
|
|
||
| export const useCollaboratorsCheckSeatsLoaderFetcher = createFetcherLoadHook( | ||
| load => | ||
| ({ organizationId, query }: { organizationId: string; query?: string }) => { | ||
| return load( | ||
| `${href(`/organization/:organizationId/collaborators-check-seats`, { organizationId })}?${encodeURIComponent(query || '')}`, | ||
| ); | ||
| }, | ||
| clientLoader, | ||
| ); | ||
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.
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.