feat(core): serve connector logo (#931)
4
packages/connector-alipay-native/logo.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M18.797 2H5.20356C3.43362 2 2 3.44594 2 5.2314V18.9389C2 20.7228 3.43362 22.1698 5.20356 22.1698H18.797C20.5669 22.1698 21.9995 20.7228 21.9995 18.9389V5.2314C21.9995 3.44594 20.5669 2 18.797 2Z" fill="#1677FF"/>
|
||||
<path d="M7.40468 17.5112C4.29324 17.5112 3.37319 15.0391 4.91124 13.6875C5.42428 13.2301 6.362 13.0073 6.86165 12.957C8.70977 12.7728 10.4208 13.484 12.4398 14.4779C11.0206 16.3448 9.21318 17.5112 7.40468 17.5112ZM18.4672 14.6653C17.6666 14.3949 16.5928 13.9815 15.397 13.545C16.1146 12.2854 16.6887 10.8513 17.0657 9.29287H13.1236V7.86086H17.9531V7.06077H13.1236V4.67444H11.1529C10.8069 4.67444 10.8069 5.01825 10.8069 5.01825V7.06131H5.92286V7.86086H10.8069V9.29287H6.77436V10.0919H14.5953C14.3194 11.0548 13.9418 11.9856 13.4691 12.8686C10.9306 12.0241 8.22298 11.3397 6.52159 11.7606C5.43392 12.0311 4.73291 12.5136 4.32162 13.0191C2.43173 15.338 3.78716 18.8591 7.77741 18.8591C10.1364 18.8591 12.4098 17.5326 14.1711 15.346C16.7985 16.6206 22.0006 18.8071 22.0006 18.8071V15.6903C22.0006 15.6903 21.3473 15.6379 18.4672 14.6653Z" fill="white"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -8,7 +8,8 @@
|
|||
"license": "MPL-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"docs"
|
||||
"docs",
|
||||
"logo.svg"
|
||||
],
|
||||
"private": false,
|
||||
"scripts": {
|
||||
|
|
|
@ -30,7 +30,7 @@ export const defaultMetadata: ConnectorMetadata = {
|
|||
en: 'Alipay',
|
||||
'zh-CN': '支付宝',
|
||||
},
|
||||
logo: 'https://gist.githubusercontent.com/darcyYe/31bc893a0a305dc43cf831bf0b14f0fc/raw/faf985d3fbeed88180b8f3cb709892320d66ae45/alipay.svg',
|
||||
logo: './logo.svg',
|
||||
description: {
|
||||
en: 'Sign In with Alipay',
|
||||
'zh-CN': '支付宝登录',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ConnectorError, ConnectorErrorCodes, GetConnectorConfig } from '@logto/connector-types';
|
||||
import nock from 'nock';
|
||||
|
||||
import { AlipayNativeConnector } from '.';
|
||||
import AlipayNativeConnector from '.';
|
||||
import { alipayEndpoint } from './constant';
|
||||
import { mockedAlipayNativeConfig, mockedAlipayNativeConfigWithValidPrivateKey } from './mock';
|
||||
import { AlipayNativeConfig } from './types';
|
||||
|
|
|
@ -41,7 +41,7 @@ import { signingParameters } from './utils';
|
|||
|
||||
export type { AlipayNativeConfig } from './types';
|
||||
|
||||
export class AlipayNativeConnector implements SocialConnector {
|
||||
export default class AlipayNativeConnector implements SocialConnector {
|
||||
public metadata: ConnectorMetadata = defaultMetadata;
|
||||
|
||||
private readonly signingParameters = signingParameters;
|
||||
|
|
4
packages/connector-alipay/logo.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M18.797 2H5.20356C3.43362 2 2 3.44594 2 5.2314V18.9389C2 20.7228 3.43362 22.1698 5.20356 22.1698H18.797C20.5669 22.1698 21.9995 20.7228 21.9995 18.9389V5.2314C21.9995 3.44594 20.5669 2 18.797 2Z" fill="#1677FF"/>
|
||||
<path d="M7.40468 17.5112C4.29324 17.5112 3.37319 15.0391 4.91124 13.6875C5.42428 13.2301 6.362 13.0073 6.86165 12.957C8.70977 12.7728 10.4208 13.484 12.4398 14.4779C11.0206 16.3448 9.21318 17.5112 7.40468 17.5112ZM18.4672 14.6653C17.6666 14.3949 16.5928 13.9815 15.397 13.545C16.1146 12.2854 16.6887 10.8513 17.0657 9.29287H13.1236V7.86086H17.9531V7.06077H13.1236V4.67444H11.1529C10.8069 4.67444 10.8069 5.01825 10.8069 5.01825V7.06131H5.92286V7.86086H10.8069V9.29287H6.77436V10.0919H14.5953C14.3194 11.0548 13.9418 11.9856 13.4691 12.8686C10.9306 12.0241 8.22298 11.3397 6.52159 11.7606C5.43392 12.0311 4.73291 12.5136 4.32162 13.0191C2.43173 15.338 3.78716 18.8591 7.77741 18.8591C10.1364 18.8591 12.4098 17.5326 14.1711 15.346C16.7985 16.6206 22.0006 18.8071 22.0006 18.8071V15.6903C22.0006 15.6903 21.3473 15.6379 18.4672 14.6653Z" fill="white"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
|
@ -8,7 +8,8 @@
|
|||
"license": "MPL-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"docs"
|
||||
"docs",
|
||||
"logo.svg"
|
||||
],
|
||||
"private": false,
|
||||
"scripts": {
|
||||
|
|
|
@ -31,7 +31,7 @@ export const defaultMetadata: ConnectorMetadata = {
|
|||
en: 'Alipay',
|
||||
'zh-CN': '支付宝',
|
||||
},
|
||||
logo: 'https://gist.githubusercontent.com/darcyYe/31bc893a0a305dc43cf831bf0b14f0fc/raw/faf985d3fbeed88180b8f3cb709892320d66ae45/alipay.svg',
|
||||
logo: './logo.svg',
|
||||
description: {
|
||||
en: 'Sign In with Alipay',
|
||||
'zh-CN': '支付宝登录',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ConnectorError, ConnectorErrorCodes, GetConnectorConfig } from '@logto/connector-types';
|
||||
import nock from 'nock';
|
||||
|
||||
import { AlipayConnector } from '.';
|
||||
import AlipayConnector from '.';
|
||||
import { alipayEndpoint, authorizationEndpoint } from './constant';
|
||||
import { mockedAlipayConfig, mockedAlipayConfigWithValidPrivateKey } from './mock';
|
||||
import { AlipayConfig } from './types';
|
||||
|
|
|
@ -35,7 +35,7 @@ import { signingParameters } from './utils';
|
|||
|
||||
export type { AlipayConfig } from './types';
|
||||
|
||||
export class AlipayConnector implements SocialConnector {
|
||||
export default class AlipayConnector implements SocialConnector {
|
||||
public metadata: ConnectorMetadata = defaultMetadata;
|
||||
|
||||
private readonly signingParameters = signingParameters;
|
||||
|
|
3
packages/connector-aliyun-dm/logo.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4.71942 6.071C3.80784 6.2585 2.82876 6.98664 2.42188 7.78477C2.015 8.58291 2 8.77916 2 12.1389C2 13.9317 2.03 15.4083 2.075 15.639C2.34251 17.0065 3.4119 18.0759 4.77942 18.3434C5.1938 18.4184 10.5873 18.4565 10.5873 18.3734C10.5873 18.3131 10.1279 16.5052 10.1051 16.4827C10.0976 16.4677 9.14074 16.2568 7.98072 16.0077C5.2763 15.4202 5.35568 15.4427 5.13317 15.1715L4.93723 14.938V9.46918L5.13317 9.23167C5.35911 8.96042 5.2763 8.98323 7.98072 8.39541L10.1051 7.9204C10.1283 7.90478 10.5876 6.09662 10.5876 6.03975C10.5876 5.96787 5.0813 6.00225 4.71942 6.07725V6.071ZM13.4502 6.08225C13.4577 6.21787 13.8796 7.87509 13.9252 7.9204C13.9402 7.9429 14.9721 8.17665 16.2077 8.4401C17.4434 8.70354 18.5431 8.97135 18.6409 9.02761C18.7734 9.10448 18.8846 9.21323 18.965 9.34386C19.0856 9.5548 19.1006 9.78074 19.1006 12.2064C19.1006 14.6321 19.0856 14.858 18.965 15.0689C18.8828 15.198 18.7719 15.3062 18.6409 15.3852C18.5431 15.4383 17.4534 15.7015 16.2077 15.9727L13.9252 16.4962C13.8799 16.5415 13.458 18.1987 13.4502 18.3343C13.4502 18.4171 13.9927 18.4321 16.373 18.4093C19.6543 18.3793 19.695 18.3718 20.5312 17.8068C21.1319 17.3934 21.5856 16.7999 21.8269 16.1118C22 15.6071 22 15.5618 22 12.2095C22 8.85729 22 8.81198 21.8269 8.30728C21.5855 7.61926 21.1318 7.02571 20.5312 6.61226C19.695 6.04787 19.6575 6.03975 16.373 6.01006C13.9927 5.98756 13.4502 5.99881 13.4502 6.08506V6.08225ZM10.0876 12.0517C10.0635 12.1323 10.0584 12.2173 10.0726 12.3002C10.0951 12.4252 10.2308 12.4358 12.0008 12.4583L13.8992 12.4733V11.9461H12.0189C10.4445 11.9461 10.1204 11.9611 10.0908 12.0514L10.0876 12.0517Z" fill="#373C41"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
|
@ -8,7 +8,8 @@
|
|||
"license": "MPL-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"docs"
|
||||
"docs",
|
||||
"logo.svg"
|
||||
],
|
||||
"private": false,
|
||||
"scripts": {
|
||||
|
|
|
@ -28,7 +28,7 @@ export const defaultMetadata: ConnectorMetadata = {
|
|||
en: 'Aliyun Direct Mail',
|
||||
'zh-CN': '阿里云邮件推送',
|
||||
},
|
||||
logo: 'https://gist.githubusercontent.com/darcyYe/31bc893a0a305dc43cf831bf0b14f0fc/raw/faf985d3fbeed88180b8f3cb709892320d66ae45/alibabacloud.svg',
|
||||
logo: './logo.svg',
|
||||
description: {
|
||||
en: 'A simple and efficient email service to help you send transactional notifications and batch email.',
|
||||
'zh-CN':
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GetConnectorConfig } from '@logto/connector-types';
|
||||
|
||||
import { AliyunDmConnector } from '.';
|
||||
import AliyunDmConnector from '.';
|
||||
import { mockedConfig } from './mock';
|
||||
import { singleSendMail } from './single-send-mail';
|
||||
import { AliyunDmConfig } from './types';
|
||||
|
|
|
@ -14,7 +14,7 @@ import { defaultMetadata } from './constant';
|
|||
import { singleSendMail } from './single-send-mail';
|
||||
import { SendEmailResponse, AliyunDmConfig, aliyunDmConfigGuard } from './types';
|
||||
|
||||
export class AliyunDmConnector implements EmailConnector {
|
||||
export default class AliyunDmConnector implements EmailConnector {
|
||||
public metadata: ConnectorMetadata = defaultMetadata;
|
||||
|
||||
constructor(public readonly getConfig: GetConnectorConfig<AliyunDmConfig>) {}
|
||||
|
|
3
packages/connector-aliyun-sms/logo.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M4.71942 6.071C3.80784 6.2585 2.82876 6.98664 2.42188 7.78477C2.015 8.58291 2 8.77916 2 12.1389C2 13.9317 2.03 15.4083 2.075 15.639C2.34251 17.0065 3.4119 18.0759 4.77942 18.3434C5.1938 18.4184 10.5873 18.4565 10.5873 18.3734C10.5873 18.3131 10.1279 16.5052 10.1051 16.4827C10.0976 16.4677 9.14074 16.2568 7.98072 16.0077C5.2763 15.4202 5.35568 15.4427 5.13317 15.1715L4.93723 14.938V9.46918L5.13317 9.23167C5.35911 8.96042 5.2763 8.98323 7.98072 8.39541L10.1051 7.9204C10.1283 7.90478 10.5876 6.09662 10.5876 6.03975C10.5876 5.96787 5.0813 6.00225 4.71942 6.07725V6.071ZM13.4502 6.08225C13.4577 6.21787 13.8796 7.87509 13.9252 7.9204C13.9402 7.9429 14.9721 8.17665 16.2077 8.4401C17.4434 8.70354 18.5431 8.97135 18.6409 9.02761C18.7734 9.10448 18.8846 9.21323 18.965 9.34386C19.0856 9.5548 19.1006 9.78074 19.1006 12.2064C19.1006 14.6321 19.0856 14.858 18.965 15.0689C18.8828 15.198 18.7719 15.3062 18.6409 15.3852C18.5431 15.4383 17.4534 15.7015 16.2077 15.9727L13.9252 16.4962C13.8799 16.5415 13.458 18.1987 13.4502 18.3343C13.4502 18.4171 13.9927 18.4321 16.373 18.4093C19.6543 18.3793 19.695 18.3718 20.5312 17.8068C21.1319 17.3934 21.5856 16.7999 21.8269 16.1118C22 15.6071 22 15.5618 22 12.2095C22 8.85729 22 8.81198 21.8269 8.30728C21.5855 7.61926 21.1318 7.02571 20.5312 6.61226C19.695 6.04787 19.6575 6.03975 16.373 6.01006C13.9927 5.98756 13.4502 5.99881 13.4502 6.08506V6.08225ZM10.0876 12.0517C10.0635 12.1323 10.0584 12.2173 10.0726 12.3002C10.0951 12.4252 10.2308 12.4358 12.0008 12.4583L13.8992 12.4733V11.9461H12.0189C10.4445 11.9461 10.1204 11.9611 10.0908 12.0514L10.0876 12.0517Z" fill="#373C41"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
|
@ -8,7 +8,8 @@
|
|||
"license": "MPL-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"docs"
|
||||
"docs",
|
||||
"logo.svg"
|
||||
],
|
||||
"private": false,
|
||||
"scripts": {
|
||||
|
|
|
@ -44,7 +44,7 @@ export const defaultMetadata: ConnectorMetadata = {
|
|||
en: 'Aliyun Short Message Service',
|
||||
'zh-CN': '阿里云短信服务',
|
||||
},
|
||||
logo: 'https://gist.githubusercontent.com/darcyYe/31bc893a0a305dc43cf831bf0b14f0fc/raw/faf985d3fbeed88180b8f3cb709892320d66ae45/alibabacloud.svg',
|
||||
logo: './logo.svg',
|
||||
description: {
|
||||
en: 'Short Message Service (SMS) has a batch sending feature and various API operations to send one-time password (OTP) messages, notification messages, and promotional messages to customers.',
|
||||
'zh-CN':
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GetConnectorConfig } from '@logto/connector-types';
|
||||
|
||||
import { AliyunSmsConnector } from '.';
|
||||
import AliyunSmsConnector from '.';
|
||||
import { mockedConnectorConfig, mockedValidConnectorConfig, phoneTest, codeTest } from './mock';
|
||||
import { sendSms } from './single-send-text';
|
||||
import { AliyunSmsConfig } from './types';
|
||||
|
|
|
@ -14,7 +14,7 @@ import { defaultMetadata } from './constant';
|
|||
import { sendSms } from './single-send-text';
|
||||
import { aliyunSmsConfigGuard, AliyunSmsConfig, SendSmsResponse } from './types';
|
||||
|
||||
export class AliyunSmsConnector implements SmsConnector {
|
||||
export default class AliyunSmsConnector implements SmsConnector {
|
||||
public metadata: ConnectorMetadata = defaultMetadata;
|
||||
|
||||
constructor(public readonly getConfig: GetConnectorConfig<AliyunSmsConfig>) {}
|
||||
|
|
4
packages/connector-facebook/logo.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M22 12C22 6.47658 17.5234 2 12 2C6.47658 2 2 6.47658 2 12C2 16.9922 5.65625 21.1289 10.4375 21.8789V14.8906H7.89842V12H10.4375V9.79688C10.4375 7.291 11.9297 5.90625 14.2148 5.90625C15.3086 5.90625 16.4531 6.10156 16.4531 6.10156V8.5625H15.1914C13.9492 8.5625 13.5625 9.334 13.5625 10.125V12H16.3359L15.8926 14.8906H13.5625V21.8789C18.3438 21.1289 22 16.9922 22 12Z" fill="#1877F2"/>
|
||||
<path d="M15.8926 14.8906L16.3359 12H13.5625V10.125C13.5625 9.334 13.9492 8.5625 15.1914 8.5625H16.4531V6.10156C16.4531 6.10156 15.3086 5.90625 14.2149 5.90625C11.9297 5.90625 10.4375 7.291 10.4375 9.79687V12H7.89844V14.8906H10.4375V21.8789C10.9473 21.959 11.4688 22 12 22C12.5313 22 13.0528 21.959 13.5625 21.8789V14.8906H15.8926Z" fill="white"/>
|
||||
</svg>
|
After Width: | Height: | Size: 843 B |
|
@ -8,7 +8,8 @@
|
|||
"license": "MPL-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"docs"
|
||||
"docs",
|
||||
"logo.svg"
|
||||
],
|
||||
"private": false,
|
||||
"scripts": {
|
||||
|
|
|
@ -33,7 +33,7 @@ export const defaultMetadata: ConnectorMetadata = {
|
|||
en: 'Facebook',
|
||||
'zh-CN': 'Facebook',
|
||||
},
|
||||
logo: 'https://gist.githubusercontent.com/darcyYe/31bc893a0a305dc43cf831bf0b14f0fc/raw/faf985d3fbeed88180b8f3cb709892320d66ae45/facebook.svg',
|
||||
logo: './logo.svg',
|
||||
description: {
|
||||
en: 'Sign In with Facebook',
|
||||
'zh-CN': 'Facebook 登录',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ConnectorError, ConnectorErrorCodes, GetConnectorConfig } from '@logto/connector-types';
|
||||
import nock from 'nock';
|
||||
|
||||
import { FacebookConnector } from '.';
|
||||
import FacebookConnector from '.';
|
||||
import { accessTokenEndpoint, authorizationEndpoint, userInfoEndpoint } from './constant';
|
||||
import { clientId, clientSecret, code, dummyRedirectUri, fields, mockedConfig } from './mock';
|
||||
import { FacebookConfig } from './types';
|
||||
|
|
|
@ -32,7 +32,7 @@ import {
|
|||
UserInfoResponse,
|
||||
} from './types';
|
||||
|
||||
export class FacebookConnector implements SocialConnector {
|
||||
export default class FacebookConnector implements SocialConnector {
|
||||
public metadata: ConnectorMetadata = defaultMetadata;
|
||||
|
||||
constructor(public readonly getConfig: GetConnectorConfig<FacebookConfig>) {}
|
||||
|
|
3
packages/connector-github/logo.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M12 2.2467C9.6255 2.2468 7.32849 3.09182 5.51999 4.63055C3.71149 6.16929 2.50953 8.30133 2.12916 10.6452C1.74879 12.989 2.21485 15.3918 3.44393 17.4235C4.67301 19.4551 6.58491 20.9832 8.83755 21.7342C9.33755 21.8217 9.52505 21.5217 9.52505 21.2592C9.52505 21.0217 9.51254 20.2342 9.51254 19.3967C7.00003 19.8592 6.35003 18.7842 6.15003 18.2217C5.9281 17.6747 5.5763 17.1899 5.12503 16.8092C4.77503 16.6217 4.27503 16.1592 5.11252 16.1467C5.4323 16.1814 5.73901 16.2927 6.00666 16.4711C6.2743 16.6495 6.49499 16.8899 6.65003 17.1717C6.7868 17.4174 6.97071 17.6337 7.19122 17.8082C7.41173 17.9827 7.6645 18.112 7.93506 18.1886C8.20562 18.2652 8.48864 18.2877 8.76791 18.2548C9.04717 18.2219 9.3172 18.1342 9.56251 17.9967C9.6058 17.4883 9.83237 17.013 10.2 16.6592C7.97503 16.4092 5.65003 15.5467 5.65003 11.7217C5.63597 10.7279 6.00271 9.76631 6.67503 9.03423C6.36931 8.17045 6.40508 7.22252 6.77503 6.38423C6.77503 6.38423 7.6125 6.12172 9.52503 7.40923C11.1613 6.95921 12.8887 6.95921 14.525 7.40923C16.4375 6.10923 17.275 6.38423 17.275 6.38423C17.645 7.22251 17.6808 8.17046 17.375 9.03423C18.0494 9.76506 18.4164 10.7275 18.4 11.7217C18.4 15.5592 16.0625 16.4092 13.8375 16.6592C14.0762 16.9011 14.26 17.1915 14.3764 17.5107C14.4929 17.83 14.5393 18.1705 14.5125 18.5092C14.5125 19.8468 14.5 20.9217 14.5 21.2592C14.5 21.5217 14.6875 21.8342 15.1875 21.7342C17.4362 20.9771 19.3426 19.4455 20.5664 17.4128C21.7903 15.38 22.2519 12.9785 21.8689 10.6369C21.4859 8.29535 20.2832 6.16608 18.4755 4.62922C16.6678 3.09235 14.3727 2.24794 12 2.2467Z" fill="black"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
|
@ -8,7 +8,8 @@
|
|||
"license": "MPL-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"docs"
|
||||
"docs",
|
||||
"logo.svg"
|
||||
],
|
||||
"private": false,
|
||||
"scripts": {
|
||||
|
|
|
@ -24,7 +24,7 @@ export const defaultMetadata: ConnectorMetadata = {
|
|||
en: 'GitHub',
|
||||
'zh-CN': 'GitHub',
|
||||
},
|
||||
logo: 'https://gist.githubusercontent.com/darcyYe/31bc893a0a305dc43cf831bf0b14f0fc/raw/faf985d3fbeed88180b8f3cb709892320d66ae45/github.svg',
|
||||
logo: './logo.svg',
|
||||
description: {
|
||||
en: 'Sign In with GitHub',
|
||||
'zh-CN': 'GitHub登录',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ConnectorError, ConnectorErrorCodes, GetConnectorConfig } from '@logto/connector-types';
|
||||
import nock from 'nock';
|
||||
|
||||
import { GithubConnector } from '.';
|
||||
import GithubConnector from '.';
|
||||
import { accessTokenEndpoint, authorizationEndpoint, userInfoEndpoint } from './constant';
|
||||
import { mockedConfig } from './mock';
|
||||
import { GithubConfig } from './types';
|
||||
|
|
|
@ -22,7 +22,7 @@ import {
|
|||
} from './constant';
|
||||
import { githubConfigGuard, AccessTokenResponse, GithubConfig, UserInfoResponse } from './types';
|
||||
|
||||
export class GithubConnector implements SocialConnector {
|
||||
export default class GithubConnector implements SocialConnector {
|
||||
public metadata: ConnectorMetadata = defaultMetadata;
|
||||
|
||||
constructor(public readonly getConfig: GetConnectorConfig<GithubConfig>) {}
|
||||
|
|
6
packages/connector-google/logo.svg
Normal file
|
@ -0,0 +1,6 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.64 12.2046C20.64 11.5664 20.5827 10.9527 20.4764 10.3636H12V13.845H16.8436C16.635 14.97 16.0009 15.9232 15.0477 16.5614V18.8196H17.9564C19.6582 17.2527 20.64 14.9455 20.64 12.2046Z" fill="#4285F4"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9998 21C14.4298 21 16.467 20.1941 17.9561 18.8195L15.0475 16.5613C14.2416 17.1013 13.2107 17.4204 11.9998 17.4204C9.65567 17.4204 7.67158 15.8372 6.96385 13.71H3.95703V16.0418C5.43794 18.9831 8.48158 21 11.9998 21Z" fill="#34A853"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.96409 13.7099C6.78409 13.1699 6.68182 12.5931 6.68182 11.9999C6.68182 11.4068 6.78409 10.8299 6.96409 10.2899V7.95813H3.95727C3.34773 9.17313 3 10.5477 3 11.9999C3 13.4522 3.34773 14.8268 3.95727 16.0418L6.96409 13.7099Z" fill="#FBBC05"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9998 6.57955C13.3211 6.57955 14.5075 7.03364 15.4402 7.92545L18.0216 5.34409C16.4629 3.89182 14.4257 3 11.9998 3C8.48158 3 5.43794 5.01682 3.95703 7.95818L6.96385 10.29C7.67158 8.16273 9.65567 6.57955 11.9998 6.57955Z" fill="#EA4335"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
|
@ -8,7 +8,8 @@
|
|||
"license": "MPL-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"docs"
|
||||
"docs",
|
||||
"logo.svg"
|
||||
],
|
||||
"private": false,
|
||||
"scripts": {
|
||||
|
|
|
@ -24,7 +24,7 @@ export const defaultMetadata: ConnectorMetadata = {
|
|||
en: 'Google',
|
||||
'zh-CN': 'Google',
|
||||
},
|
||||
logo: 'https://gist.githubusercontent.com/darcyYe/31bc893a0a305dc43cf831bf0b14f0fc/raw/faf985d3fbeed88180b8f3cb709892320d66ae45/google.svg',
|
||||
logo: './logo.svg',
|
||||
description: {
|
||||
en: 'Sign In with Google',
|
||||
'zh-CN': 'Google登录',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ConnectorError, ConnectorErrorCodes, GetConnectorConfig } from '@logto/connector-types';
|
||||
import nock from 'nock';
|
||||
|
||||
import { GoogleConnector } from '.';
|
||||
import GoogleConnector from '.';
|
||||
import { accessTokenEndpoint, authorizationEndpoint, userInfoEndpoint } from './constant';
|
||||
import { mockedConfig } from './mock';
|
||||
import { GoogleConfig } from './types';
|
||||
|
|
|
@ -26,7 +26,7 @@ import {
|
|||
} from './constant';
|
||||
import { googleConfigGuard, AccessTokenResponse, GoogleConfig, UserInfoResponse } from './types';
|
||||
|
||||
export class GoogleConnector implements SocialConnector {
|
||||
export default class GoogleConnector implements SocialConnector {
|
||||
public metadata: ConnectorMetadata = defaultMetadata;
|
||||
|
||||
constructor(public readonly getConfig: GetConnectorConfig<GoogleConfig>) {}
|
||||
|
|
9
packages/connector-sendgrid-mail/logo.svg
Normal file
|
@ -0,0 +1,9 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M15.3215 15.3384H8.66016V21.9997H15.3215V15.3384Z" fill="#99E1F4"/>
|
||||
<path d="M8.66134 8.66138H2V15.3384H8.66134V8.66138Z" fill="#99E1F4"/>
|
||||
<path d="M8.66134 15.3384H2V21.9997H8.66134V15.3384Z" fill="#1A82E2"/>
|
||||
<path d="M21.9992 8.66138H15.3379V15.3384H21.9992V8.66138Z" fill="#00B2E3"/>
|
||||
<path d="M15.3215 2H8.66016V8.66135H15.3215V2Z" fill="#00B2E3"/>
|
||||
<path d="M8.66016 8.66138V15.3384H15.3372V8.66138H8.66016Z" fill="#009DD9"/>
|
||||
<path d="M21.9992 2H15.3379V8.66135H21.9992V2Z" fill="#1A82E2"/>
|
||||
</svg>
|
After Width: | Height: | Size: 606 B |
|
@ -8,7 +8,8 @@
|
|||
"license": "MPL-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"docs"
|
||||
"docs",
|
||||
"logo.svg"
|
||||
],
|
||||
"private": false,
|
||||
"scripts": {
|
||||
|
|
|
@ -21,7 +21,7 @@ export const defaultMetadata: ConnectorMetadata = {
|
|||
en: 'SendGrid Mail Service',
|
||||
'zh-CN': 'SendGrid 邮件服务',
|
||||
},
|
||||
logo: 'https://gist.githubusercontent.com/darcyYe/31bc893a0a305dc43cf831bf0b14f0fc/raw/faf985d3fbeed88180b8f3cb709892320d66ae45/sendgrid.svg',
|
||||
logo: './logo.svg',
|
||||
description: {
|
||||
en: 'Leverage the email service that customer-first brands trust for reliable inbox delivery at scale.',
|
||||
'zh-CN': '客户至上品牌信任的电子邮件服务,实现大规模可靠的收件箱递送。',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GetConnectorConfig } from '@logto/connector-types';
|
||||
|
||||
import { SendGridMailConnector } from '.';
|
||||
import SendGridMailConnector from '.';
|
||||
import { mockedConfig } from './mock';
|
||||
import { ContextType, SendGridMailConfig } from './types';
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import {
|
|||
PublicParameters,
|
||||
} from './types';
|
||||
|
||||
export class SendGridMailConnector implements EmailConnector {
|
||||
export default class SendGridMailConnector implements EmailConnector {
|
||||
public metadata: ConnectorMetadata = defaultMetadata;
|
||||
|
||||
constructor(public readonly getConfig: GetConnectorConfig<SendGridMailConfig>) {}
|
||||
|
|
3
packages/connector-twilio-sms/logo.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.9854 2C6.48023 2 2 6.48677 2 11.9999C2 17.5131 6.48023 21.9999 11.9854 21.9999C17.5198 22.0292 22 17.5424 22 11.9999C22 6.45745 17.5198 2 11.9854 2ZM11.9854 19.3899C7.94436 19.3899 4.63543 16.0761 4.63543 11.9999C4.63543 7.95304 7.94436 4.63928 11.9854 4.63928C16.0556 4.63928 19.3646 7.95304 19.3646 11.9999C19.3646 16.0761 16.0556 19.3899 11.9854 19.3899ZM14.4749 11.5894C15.6231 11.5894 16.554 10.6572 16.554 9.50731C16.554 8.3574 15.6231 7.42521 14.4749 7.42521C13.3267 7.42521 12.3958 8.3574 12.3958 9.50731C12.3958 10.6572 13.3267 11.5894 14.4749 11.5894ZM16.554 14.4926C16.554 15.6425 15.6231 16.5747 14.4749 16.5747C13.3267 16.5747 12.3958 15.6425 12.3958 14.4926C12.3958 13.3427 13.3267 12.4105 14.4749 12.4105C15.6231 12.4105 16.554 13.3427 16.554 14.4926ZM9.49703 16.5747C10.6453 16.5747 11.5761 15.6425 11.5761 14.4926C11.5761 13.3427 10.6453 12.4105 9.49703 12.4105C8.3488 12.4105 7.41797 13.3427 7.41797 14.4926C7.41797 15.6425 8.3488 16.5747 9.49703 16.5747ZM11.5761 9.50731C11.5761 10.6572 10.6453 11.5894 9.49703 11.5894C8.3488 11.5894 7.41797 10.6572 7.41797 9.50731C7.41797 8.3574 8.3488 7.42521 9.49703 7.42521C10.6453 7.42521 11.5761 8.3574 11.5761 9.50731Z" fill="#E31E26"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
|
@ -8,7 +8,8 @@
|
|||
"license": "MPL-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"docs"
|
||||
"docs",
|
||||
"logo.svg"
|
||||
],
|
||||
"private": false,
|
||||
"scripts": {
|
||||
|
|
|
@ -21,7 +21,7 @@ export const defaultMetadata: ConnectorMetadata = {
|
|||
en: 'Twilio SMS Service',
|
||||
'zh-CN': 'Twilio 短信服务',
|
||||
},
|
||||
logo: 'https://gist.githubusercontent.com/darcyYe/31bc893a0a305dc43cf831bf0b14f0fc/raw/faf985d3fbeed88180b8f3cb709892320d66ae45/twilio.svg',
|
||||
logo: './logo.svg',
|
||||
description: {
|
||||
en: 'Messaging APIs for reliable SMS delivery.',
|
||||
'zh-CN': '可信赖的短信消息 API。',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { GetConnectorConfig } from '@logto/connector-types';
|
||||
|
||||
import { TwilioSmsConnector } from '.';
|
||||
import TwilioSmsConnector from '.';
|
||||
import { mockedConfig } from './mock';
|
||||
import { TwilioSmsConfig } from './types';
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import got from 'got';
|
|||
import { defaultMetadata, endpoint } from './constant';
|
||||
import { twilioSmsConfigGuard, SendSmsResponse, TwilioSmsConfig, PublicParameters } from './types';
|
||||
|
||||
export class TwilioSmsConnector implements SmsConnector {
|
||||
export default class TwilioSmsConnector implements SmsConnector {
|
||||
public metadata: ConnectorMetadata = defaultMetadata;
|
||||
|
||||
constructor(public readonly getConfig: GetConnectorConfig<TwilioSmsConfig>) {}
|
||||
|
|
4
packages/connector-wechat-native/logo.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.21 9.06286C16.1105 9.05736 16.0104 9.05636 15.9094 9.05636C12.3153 9.05636 9.39968 11.4987 9.39968 14.5129C9.39968 15.0062 9.48023 15.484 9.62681 15.9387C9.46772 15.9468 9.30763 15.9533 9.14654 15.9533C8.35659 15.9533 7.59516 15.8462 6.88526 15.6486C6.84474 15.6366 6.76369 15.6136 6.76369 15.6136L4.18023 16.9293L4.87062 14.7666L4.80509 14.7251C3.09962 13.6329 2 11.9125 2 9.97688C2 6.67601 5.19931 4 9.14654 4C12.7216 4 15.6837 6.19474 16.21 9.06286ZM6.65896 8.8903C6.10465 8.8903 5.65539 8.45456 5.65539 7.91825C5.65539 7.38145 6.10465 6.9472 6.65896 6.9472C7.21327 6.9472 7.66353 7.38145 7.66353 7.91825C7.66353 8.45456 7.21327 8.8903 6.65896 8.8903ZM11.6336 6.9472C12.1879 6.9472 12.6367 7.38145 12.6367 7.91825C12.6367 8.45456 12.1879 8.8903 11.6336 8.8903C11.0788 8.8903 10.6305 8.45456 10.6305 7.91825C10.6305 7.38145 11.0788 6.9472 11.6336 6.9472Z" fill="#1AAD19"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.9627 19.5983C12.6279 19.5983 9.92383 17.3376 9.92383 14.5485C9.92383 11.7604 12.6279 9.49963 15.9627 9.49963C19.2961 9.49963 21.9992 11.7604 21.9992 14.5485C21.9992 16.1844 21.0696 17.6377 19.6293 18.5603L19.5738 18.5948L20.1571 20.4228L17.9754 19.3102C17.9754 19.3102 17.9068 19.3307 17.8723 19.3397C17.273 19.5073 16.6296 19.5983 15.9627 19.5983ZM13.0136 12.8089C13.0136 12.3566 13.3938 11.9889 13.8616 11.9889C14.3304 11.9889 14.7101 12.3566 14.7101 12.8089C14.7101 13.2631 14.3304 13.6313 13.8616 13.6313C13.3938 13.6313 13.0136 13.2631 13.0136 12.8089ZM17.2143 12.8089C17.2143 12.3566 17.5935 11.9889 18.0617 11.9889C18.5305 11.9889 18.9097 12.3566 18.9097 12.8089C18.9097 13.2631 18.5305 13.6313 18.0617 13.6313C17.5935 13.6313 17.2143 13.2631 17.2143 12.8089Z" fill="#1AAD19"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.8 KiB |
|
@ -8,7 +8,8 @@
|
|||
"license": "MPL-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"docs"
|
||||
"docs",
|
||||
"logo.svg"
|
||||
],
|
||||
"private": false,
|
||||
"scripts": {
|
||||
|
|
|
@ -24,7 +24,7 @@ export const defaultMetadata: ConnectorMetadata = {
|
|||
en: 'WeChat',
|
||||
'zh-CN': '微信',
|
||||
},
|
||||
logo: 'https://gist.githubusercontent.com/darcyYe/31bc893a0a305dc43cf831bf0b14f0fc/raw/faf985d3fbeed88180b8f3cb709892320d66ae45/wechat.svg',
|
||||
logo: './logo.svg',
|
||||
description: {
|
||||
en: 'Sign In with WeChat',
|
||||
'zh-CN': '微信登录',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ConnectorError, ConnectorErrorCodes, GetConnectorConfig } from '@logto/connector-types';
|
||||
import nock from 'nock';
|
||||
|
||||
import { WeChatNativeConnector } from '.';
|
||||
import WeChatNativeConnector from '.';
|
||||
import { accessTokenEndpoint, authorizationEndpoint, userInfoEndpoint } from './constant';
|
||||
import { mockedConfig } from './mock';
|
||||
import { WeChatNativeConfig } from './types';
|
||||
|
|
|
@ -34,7 +34,7 @@ import {
|
|||
// As creating a WeChat Web/Mobile application needs a real App or Website record, the real test is temporarily not finished.
|
||||
// TODO: test with our own wechat mobile/web application (LOG-1910), already tested with other verified wechat web application
|
||||
|
||||
export class WeChatNativeConnector implements SocialConnector {
|
||||
export default class WeChatNativeConnector implements SocialConnector {
|
||||
public metadata: ConnectorMetadata = defaultMetadata;
|
||||
|
||||
constructor(public readonly getConfig: GetConnectorConfig<WeChatNativeConfig>) {}
|
||||
|
|
4
packages/connector-wechat/logo.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.21 9.06286C16.1105 9.05736 16.0104 9.05636 15.9094 9.05636C12.3153 9.05636 9.39968 11.4987 9.39968 14.5129C9.39968 15.0062 9.48023 15.484 9.62681 15.9387C9.46772 15.9468 9.30763 15.9533 9.14654 15.9533C8.35659 15.9533 7.59516 15.8462 6.88526 15.6486C6.84474 15.6366 6.76369 15.6136 6.76369 15.6136L4.18023 16.9293L4.87062 14.7666L4.80509 14.7251C3.09962 13.6329 2 11.9125 2 9.97688C2 6.67601 5.19931 4 9.14654 4C12.7216 4 15.6837 6.19474 16.21 9.06286ZM6.65896 8.8903C6.10465 8.8903 5.65539 8.45456 5.65539 7.91825C5.65539 7.38145 6.10465 6.9472 6.65896 6.9472C7.21327 6.9472 7.66353 7.38145 7.66353 7.91825C7.66353 8.45456 7.21327 8.8903 6.65896 8.8903ZM11.6336 6.9472C12.1879 6.9472 12.6367 7.38145 12.6367 7.91825C12.6367 8.45456 12.1879 8.8903 11.6336 8.8903C11.0788 8.8903 10.6305 8.45456 10.6305 7.91825C10.6305 7.38145 11.0788 6.9472 11.6336 6.9472Z" fill="#1AAD19"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.9627 19.5983C12.6279 19.5983 9.92383 17.3376 9.92383 14.5485C9.92383 11.7604 12.6279 9.49963 15.9627 9.49963C19.2961 9.49963 21.9992 11.7604 21.9992 14.5485C21.9992 16.1844 21.0696 17.6377 19.6293 18.5603L19.5738 18.5948L20.1571 20.4228L17.9754 19.3102C17.9754 19.3102 17.9068 19.3307 17.8723 19.3397C17.273 19.5073 16.6296 19.5983 15.9627 19.5983ZM13.0136 12.8089C13.0136 12.3566 13.3938 11.9889 13.8616 11.9889C14.3304 11.9889 14.7101 12.3566 14.7101 12.8089C14.7101 13.2631 14.3304 13.6313 13.8616 13.6313C13.3938 13.6313 13.0136 13.2631 13.0136 12.8089ZM17.2143 12.8089C17.2143 12.3566 17.5935 11.9889 18.0617 11.9889C18.5305 11.9889 18.9097 12.3566 18.9097 12.8089C18.9097 13.2631 18.5305 13.6313 18.0617 13.6313C17.5935 13.6313 17.2143 13.2631 17.2143 12.8089Z" fill="#1AAD19"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.8 KiB |
|
@ -8,7 +8,8 @@
|
|||
"license": "MPL-2.0",
|
||||
"files": [
|
||||
"lib",
|
||||
"docs"
|
||||
"docs",
|
||||
"logo.svg"
|
||||
],
|
||||
"private": false,
|
||||
"scripts": {
|
||||
|
|
|
@ -24,7 +24,7 @@ export const defaultMetadata: ConnectorMetadata = {
|
|||
en: 'WeChat',
|
||||
'zh-CN': '微信',
|
||||
},
|
||||
logo: 'https://gist.githubusercontent.com/darcyYe/31bc893a0a305dc43cf831bf0b14f0fc/raw/faf985d3fbeed88180b8f3cb709892320d66ae45/wechat.svg',
|
||||
logo: './logo.svg',
|
||||
description: {
|
||||
en: 'Sign In with WeChat',
|
||||
'zh-CN': '微信登录',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ConnectorError, ConnectorErrorCodes, GetConnectorConfig } from '@logto/connector-types';
|
||||
import nock from 'nock';
|
||||
|
||||
import { WeChatConnector } from '.';
|
||||
import WeChatConnector from '.';
|
||||
import { accessTokenEndpoint, authorizationEndpoint, userInfoEndpoint } from './constant';
|
||||
import { mockedConfig } from './mock';
|
||||
import { WeChatConfig } from './types';
|
||||
|
|
|
@ -30,7 +30,7 @@ import { weChatConfigGuard, AccessTokenResponse, UserInfoResponse, WeChatConfig
|
|||
// As creating a WeChat Web/Mobile application needs a real App or Website record, the real test is temporarily not finished.
|
||||
// TODO: test with our own wechat mobile/web application (LOG-1910), already tested with other verified wechat web application
|
||||
|
||||
export class WeChatConnector implements SocialConnector {
|
||||
export default class WeChatConnector implements SocialConnector {
|
||||
public metadata: ConnectorMetadata = defaultMetadata;
|
||||
|
||||
constructor(public readonly getConfig: GetConnectorConfig<WeChatConfig>) {}
|
||||
|
|
|
@ -12,7 +12,6 @@ import Card from '@/components/Card';
|
|||
import CodeEditor from '@/components/CodeEditor';
|
||||
import DetailsSkeleton from '@/components/DetailsSkeleton';
|
||||
import Drawer from '@/components/Drawer';
|
||||
import ImagePlaceholder from '@/components/ImagePlaceholder';
|
||||
import LinkButton from '@/components/LinkButton';
|
||||
import Markdown from '@/components/Markdown';
|
||||
import Status from '@/components/Status';
|
||||
|
@ -115,11 +114,7 @@ const ConnectorDetails = () => {
|
|||
{data && (
|
||||
<Card className={styles.header}>
|
||||
<div className={styles.imagePlaceholder}>
|
||||
{data.logo.startsWith('http') ? (
|
||||
<img src={data.logo} className={styles.logo} />
|
||||
) : (
|
||||
<ImagePlaceholder size={60} borderRadius={16} />
|
||||
)}
|
||||
<img src={data.logo} className={styles.logo} />
|
||||
</div>
|
||||
<div className={styles.metadata}>
|
||||
<div>
|
||||
|
|
|
@ -23,13 +23,7 @@ const ConnectorName = ({ connector, titlePlaceholder = '' }: Props) => {
|
|||
<ItemPreview
|
||||
title={<UnnamedTrans resource={connector.name} />}
|
||||
subtitle={connector.id}
|
||||
icon={
|
||||
connector.logo.startsWith('http') ? (
|
||||
<img className={styles.logo} src={connector.logo} />
|
||||
) : (
|
||||
<ImagePlaceholder />
|
||||
)
|
||||
}
|
||||
icon={<img className={styles.logo} src={connector.logo} />}
|
||||
/>
|
||||
</Link>
|
||||
);
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
"@logto/connector-wechat": "^0.1.0",
|
||||
"@logto/connector-wechat-native": "^0.1.0",
|
||||
"@logto/phrases": "^0.1.0",
|
||||
"@logto/shared": "^0.1.0",
|
||||
"@logto/schemas": "^0.1.0",
|
||||
"@logto/shared": "^0.1.0",
|
||||
"@silverhand/essentials": "^1.1.6",
|
||||
"argon2": "^0.28.5",
|
||||
"chalk": "^4",
|
||||
|
@ -60,6 +60,7 @@
|
|||
"oidc-provider": "^7.10.0",
|
||||
"p-retry": "^4.6.1",
|
||||
"query-string": "^7.0.1",
|
||||
"resolve-package-path": "^4.0.3",
|
||||
"roarr": "^7.11.0",
|
||||
"slonik": "^28.0.0",
|
||||
"slonik-interceptor-preset": "^1.2.10",
|
||||
|
@ -68,9 +69,9 @@
|
|||
"zod": "^3.14.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@silverhand/jest-config": "^0.14.0",
|
||||
"@shopify/jest-koa-mocks": "^4.0.0",
|
||||
"@silverhand/eslint-config": "^0.14.0",
|
||||
"@silverhand/jest-config": "^0.14.0",
|
||||
"@silverhand/ts-config": "^0.14.0",
|
||||
"@types/inquirer": "^8.2.1",
|
||||
"@types/jest": "^27.4.1",
|
||||
|
|
14
packages/core/src/connectors/consts.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
// TODO: move to environment variable
|
||||
export const connectorPackages = [
|
||||
'@logto/connector-alipay',
|
||||
'@logto/connector-alipay-native',
|
||||
'@logto/connector-aliyun-dm',
|
||||
'@logto/connector-aliyun-sms',
|
||||
'@logto/connector-facebook',
|
||||
'@logto/connector-github',
|
||||
'@logto/connector-google',
|
||||
'@logto/connector-sendgrid-email',
|
||||
'@logto/connector-twilio-sms',
|
||||
'@logto/connector-wechat',
|
||||
'@logto/connector-wechat-native',
|
||||
];
|
|
@ -1,39 +1,57 @@
|
|||
import { AlipayConnector } from '@logto/connector-alipay';
|
||||
import { AlipayNativeConnector } from '@logto/connector-alipay-native';
|
||||
import { AliyunDmConnector } from '@logto/connector-aliyun-dm';
|
||||
import { AliyunSmsConnector } from '@logto/connector-aliyun-sms';
|
||||
import { FacebookConnector } from '@logto/connector-facebook';
|
||||
import { GithubConnector } from '@logto/connector-github';
|
||||
import { GoogleConnector } from '@logto/connector-google';
|
||||
import { SendGridMailConnector } from '@logto/connector-sendgrid-email';
|
||||
import { TwilioSmsConnector } from '@logto/connector-twilio-sms';
|
||||
import { WeChatConnector } from '@logto/connector-wechat';
|
||||
import { WeChatNativeConnector } from '@logto/connector-wechat-native';
|
||||
import { existsSync, readFileSync } from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import resolvePackagePath from 'resolve-package-path';
|
||||
|
||||
import RequestError from '@/errors/RequestError';
|
||||
import { findAllConnectors, insertConnector } from '@/queries/connector';
|
||||
|
||||
import { connectorPackages } from './consts';
|
||||
import { ConnectorInstance, ConnectorType, IConnector, SocialConnectorInstance } from './types';
|
||||
import { getConnectorConfig } from './utilities';
|
||||
|
||||
const allConnectors: IConnector[] = [
|
||||
new AlipayConnector(getConnectorConfig),
|
||||
new AlipayNativeConnector(getConnectorConfig),
|
||||
new AliyunDmConnector(getConnectorConfig),
|
||||
new AliyunSmsConnector(getConnectorConfig),
|
||||
new FacebookConnector(getConnectorConfig),
|
||||
new GithubConnector(getConnectorConfig),
|
||||
new GoogleConnector(getConnectorConfig),
|
||||
new SendGridMailConnector(getConnectorConfig),
|
||||
new TwilioSmsConnector(getConnectorConfig),
|
||||
new WeChatConnector(getConnectorConfig),
|
||||
new WeChatNativeConnector(getConnectorConfig),
|
||||
];
|
||||
// eslint-disable-next-line @silverhand/fp/no-let
|
||||
let cachedConnectors: IConnector[] | undefined;
|
||||
|
||||
const loadConnectors = async () => {
|
||||
if (cachedConnectors) {
|
||||
return cachedConnectors;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @silverhand/fp/no-mutation
|
||||
cachedConnectors = await Promise.all(
|
||||
connectorPackages.map(async (packageName) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const { default: Builder } = await import(packageName);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||
const instance = new Builder(getConnectorConfig) as IConnector;
|
||||
// eslint-disable-next-line unicorn/prefer-module
|
||||
const packagePath = resolvePackagePath(packageName, __dirname);
|
||||
|
||||
// For relative path logo url, try to read local asset.
|
||||
if (
|
||||
packagePath &&
|
||||
!instance.metadata.logo.startsWith('http') &&
|
||||
existsSync(path.join(packagePath, '..', instance.metadata.logo))
|
||||
) {
|
||||
const data = readFileSync(path.join(packagePath, '..', instance.metadata.logo));
|
||||
// eslint-disable-next-line @silverhand/fp/no-mutation
|
||||
instance.metadata.logo = `data:image/svg+xml;base64,${data.toString('base64')}`;
|
||||
}
|
||||
|
||||
return instance;
|
||||
})
|
||||
);
|
||||
|
||||
return cachedConnectors;
|
||||
};
|
||||
|
||||
export const getConnectorInstances = async (): Promise<ConnectorInstance[]> => {
|
||||
const connectors = await findAllConnectors();
|
||||
const connectorMap = new Map(connectors.map((connector) => [connector.id, connector]));
|
||||
|
||||
const allConnectors = await loadConnectors();
|
||||
|
||||
return allConnectors.map((element) => {
|
||||
const { id } = element.metadata;
|
||||
const connector = connectorMap.get(id);
|
||||
|
@ -99,6 +117,7 @@ export const getEnabledSocialConnectorIds = async <T extends ConnectorInstance>(
|
|||
export const initConnectors = async () => {
|
||||
const connectors = await findAllConnectors();
|
||||
const existingConnectors = new Map(connectors.map((connector) => [connector.id, connector]));
|
||||
const allConnectors = await loadConnectors();
|
||||
const newConnectors = allConnectors.filter(({ metadata: { id } }) => {
|
||||
const connector = existingConnectors.get(id);
|
||||
|
||||
|
|
21
pnpm-lock.yaml
generated
|
@ -756,6 +756,7 @@ importers:
|
|||
p-retry: ^4.6.1
|
||||
prettier: ^2.3.2
|
||||
query-string: ^7.0.1
|
||||
resolve-package-path: ^4.0.3
|
||||
roarr: ^7.11.0
|
||||
slonik: ^28.0.0
|
||||
slonik-interceptor-preset: ^1.2.10
|
||||
|
@ -808,6 +809,7 @@ importers:
|
|||
oidc-provider: 7.10.4
|
||||
p-retry: 4.6.1
|
||||
query-string: 7.0.1
|
||||
resolve-package-path: 4.0.3
|
||||
roarr: 7.11.0
|
||||
slonik: 28.1.0
|
||||
slonik-interceptor-preset: 1.2.10
|
||||
|
@ -15327,6 +15329,18 @@ packages:
|
|||
/path-parse/1.0.7:
|
||||
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
|
||||
|
||||
/path-root-regex/0.1.2:
|
||||
resolution: {integrity: sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: false
|
||||
|
||||
/path-root/0.1.1:
|
||||
resolution: {integrity: sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dependencies:
|
||||
path-root-regex: 0.1.2
|
||||
dev: false
|
||||
|
||||
/path-to-regexp/0.1.7:
|
||||
resolution: {integrity: sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=}
|
||||
dev: true
|
||||
|
@ -17305,6 +17319,13 @@ packages:
|
|||
global-dirs: 0.1.1
|
||||
dev: true
|
||||
|
||||
/resolve-package-path/4.0.3:
|
||||
resolution: {integrity: sha512-SRpNAPW4kewOaNUt8VPqhJ0UMxawMwzJD8V7m1cJfdSTK9ieZwS6K7Dabsm4bmLFM96Z5Y/UznrpG5kt1im8yA==}
|
||||
engines: {node: '>= 12'}
|
||||
dependencies:
|
||||
path-root: 0.1.1
|
||||
dev: false
|
||||
|
||||
/resolve-path/1.4.0:
|
||||
resolution: {integrity: sha1-xL2p9e+y/OZSR4c6s2u02DT+Fvc=}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
|