0
Fork 0
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:
Darcy Ye 2024-08-21 11:17:28 +08:00 committed by GitHub
parent 2caeacaf93
commit 763dd60cd6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 14 additions and 20 deletions

View file

@ -0,0 +1,5 @@
---
"@logto/connector-wecom": patch
---
fix wecom connector platform, should be `Universal` instead of `null`

View file

@ -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': '企业微信',

View file

@ -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

View file

@ -121,7 +121,6 @@ function CreateConnectorForm({ onClose, isOpen: isFormOpen, type }: Props) {
existingConnectors && (
<Footer
isCreatingSocialConnector={isCreatingSocialConnector}
selectedConnectorGroup={activeGroup}
isCreateButtonDisabled={!activeFactoryId}
onClickCreateButton={() => {
onClose?.(activeFactoryId);

View file

@ -185,7 +185,7 @@ function PlanComparisonTable() {
{ name: appLogoAndFavicon, data: ['✓', '✓', '✓'] },
{ name: darkMode, data: ['✓', '✓', '✓'] },
{ name: i18n, data: ['✓', '✓', '✓'] },
{ name: bringYourUi, data: ['-', comingSoon, comingSoon] },
{ name: bringYourUi, data: ['-', '✓', '✓'] },
],
},
{

View file

@ -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."
}

View file

@ -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 {