mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix(console,core,connector): fix display issues and POST /connectors
API code guard (#6481)
* fix(console,core,connector): fix display issues * chore: add changeset
This commit is contained in:
parent
2caeacaf93
commit
763dd60cd6
7 changed files with 14 additions and 20 deletions
5
.changeset/hip-cats-destroy.md
Normal file
5
.changeset/hip-cats-destroy.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@logto/connector-wecom": patch
|
||||
---
|
||||
|
||||
fix wecom connector platform, should be `Universal` instead of `null`
|
|
@ -1,5 +1,5 @@
|
|||
import type { ConnectorMetadata } from '@logto/connector-kit';
|
||||
import { ConnectorConfigFormItemType } from '@logto/connector-kit';
|
||||
import { ConnectorConfigFormItemType, ConnectorPlatform } from '@logto/connector-kit';
|
||||
|
||||
export const authorizationEndpointInside = 'https://open.weixin.qq.com/connect/oauth2/authorize';
|
||||
export const authorizationEndpointQrcode = 'https://open.work.weixin.qq.com/wwopen/sso/qrConnect';
|
||||
|
@ -15,7 +15,7 @@ export const invalidAccessTokenErrcode = [40_001, 40_014];
|
|||
export const defaultMetadata: ConnectorMetadata = {
|
||||
id: 'wecom-universal',
|
||||
target: 'wecom',
|
||||
platform: null,
|
||||
platform: ConnectorPlatform.Universal,
|
||||
name: {
|
||||
en: 'WeCom',
|
||||
'zh-CN': '企业微信',
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import { type ConnectorFactoryResponse } from '@logto/schemas';
|
||||
import { useContext } from 'react';
|
||||
import { Trans, useTranslation } from 'react-i18next';
|
||||
|
||||
|
@ -7,22 +6,15 @@ import QuotaGuardFooter from '@/components/QuotaGuardFooter';
|
|||
import SkuName from '@/components/SkuName';
|
||||
import { SubscriptionDataContext } from '@/contexts/SubscriptionDataProvider';
|
||||
import Button from '@/ds-components/Button';
|
||||
import { type ConnectorGroup } from '@/types/connector';
|
||||
import { hasReachedSubscriptionQuotaLimit } from '@/utils/quota';
|
||||
|
||||
type Props = {
|
||||
readonly isCreatingSocialConnector: boolean;
|
||||
readonly selectedConnectorGroup?: ConnectorGroup<ConnectorFactoryResponse>;
|
||||
readonly isCreateButtonDisabled: boolean;
|
||||
readonly onClickCreateButton: () => void;
|
||||
};
|
||||
|
||||
function Footer({
|
||||
isCreatingSocialConnector,
|
||||
selectedConnectorGroup,
|
||||
isCreateButtonDisabled,
|
||||
onClickCreateButton,
|
||||
}: Props) {
|
||||
function Footer({ isCreatingSocialConnector, isCreateButtonDisabled, onClickCreateButton }: Props) {
|
||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console.upsell.paywall' });
|
||||
const { currentSku, currentSubscriptionUsage, currentSubscriptionQuota } =
|
||||
useContext(SubscriptionDataContext);
|
||||
|
@ -33,12 +25,7 @@ function Footer({
|
|||
quota: currentSubscriptionQuota,
|
||||
});
|
||||
|
||||
if (
|
||||
isCreatingSocialConnector &&
|
||||
selectedConnectorGroup &&
|
||||
isSocialConnectorsReachLimit &&
|
||||
!selectedConnectorGroup.isStandard
|
||||
) {
|
||||
if (isCreatingSocialConnector && isSocialConnectorsReachLimit) {
|
||||
return (
|
||||
<QuotaGuardFooter>
|
||||
<Trans
|
||||
|
|
|
@ -121,7 +121,6 @@ function CreateConnectorForm({ onClose, isOpen: isFormOpen, type }: Props) {
|
|||
existingConnectors && (
|
||||
<Footer
|
||||
isCreatingSocialConnector={isCreatingSocialConnector}
|
||||
selectedConnectorGroup={activeGroup}
|
||||
isCreateButtonDisabled={!activeFactoryId}
|
||||
onClickCreateButton={() => {
|
||||
onClose?.(activeFactoryId);
|
||||
|
|
|
@ -185,7 +185,7 @@ function PlanComparisonTable() {
|
|||
{ name: appLogoAndFavicon, data: ['✓', '✓', '✓'] },
|
||||
{ name: darkMode, data: ['✓', '✓', '✓'] },
|
||||
{ name: i18n, data: ['✓', '✓', '✓'] },
|
||||
{ name: bringYourUi, data: ['-', comingSoon, comingSoon] },
|
||||
{ name: bringYourUi, data: ['-', '✓', '✓'] },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
"200": {
|
||||
"description": "The created connector."
|
||||
},
|
||||
"403": {
|
||||
"description": "The tenant has reached the maximum number of connectors."
|
||||
},
|
||||
"422": {
|
||||
"description": "Invalid request body."
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ export default function connectorRoutes<T extends ManagementApiRouter>(
|
|||
*/
|
||||
.merge(Connectors.createGuard.pick({ id: true }).partial()),
|
||||
response: connectorResponseGuard,
|
||||
status: [200, 400, 422],
|
||||
status: [200, 400, 403, 422],
|
||||
}),
|
||||
async (ctx, next) => {
|
||||
const {
|
||||
|
|
Loading…
Reference in a new issue