feat(publish): Wechat OffiAccount (#2386)

* feat: OffiAccount fe

* feat: offiaccount

* fix: wecom requires AES key

* fix: OffiAccountEditModal

* chore: change wechat svg icon

* chore: add offiaccount svg

* chore: hide unimplemented wecom entries
This commit is contained in:
Finley Ge
2024-08-15 12:06:13 +08:00
committed by GitHub
parent 5bbaa8264a
commit f8b8fcc172
14 changed files with 486 additions and 13 deletions

View File

@@ -3,5 +3,6 @@ export enum PublishChannelEnum {
iframe = 'iframe',
apikey = 'apikey',
feishu = 'feishu',
wecom = 'wecom'
wecom = 'wecom',
officialAccount = 'official_account'
}

View File

@@ -25,7 +25,18 @@ export interface WecomAppType {
// TODO: unused
export interface WechatAppType {}
export type OutlinkAppType = FeishuAppType | WecomAppType | undefined;
export interface OffiAccountAppType {
appId: string;
isVerified?: boolean; // if isVerified, we could use '客服接口' to reply
secret: string;
CallbackToken: string;
CallbackEncodingAesKey?: string;
timeoutReply?: string; // if timeout (15s), will reply this content.
// timeout reply is optional, but when isVerified is false, the wechat will reply a default message which is `该公众号暂时无法提供服务,请稍后再试`
// because we can not reply anything in 15s. Thus, the wechat server will treat this request as a failed request.
}
export type OutlinkAppType = FeishuAppType | WecomAppType | OffiAccountAppType | undefined;
export type OutLinkSchema<T extends OutlinkAppType = undefined> = {
_id: string;

View File

@@ -1,6 +1,7 @@
export enum TmpDataEnum {
FeishuAccessToken = 'feishu_access_token',
WecomAccessToken = 'wecom_access_token'
WecomAccessToken = 'wecom_access_token',
OffiAccountAccessToken = 'offiaccount_access_token'
}
type _TmpDataMetadata = {
@@ -11,6 +12,9 @@ type _TmpDataMetadata = {
CorpId: string;
AgentId: string;
};
[TmpDataEnum.OffiAccountAccessToken]: {
AppId: string;
};
};
type _TmpDataType = {
@@ -20,11 +24,15 @@ type _TmpDataType = {
[TmpDataEnum.WecomAccessToken]: {
accessToken: string;
};
[TmpDataEnum.OffiAccountAccessToken]: {
accessToken: string;
};
};
export const TmpDataExpireTime = {
[TmpDataEnum.FeishuAccessToken]: 1000 * 60 * 60 * 1.5, // 1.5 hours
[TmpDataEnum.WecomAccessToken]: 1000 * 60 * 60 * 2 // 2 hours
[TmpDataEnum.WecomAccessToken]: 1000 * 60 * 60 * 2, // 2 hours
[TmpDataEnum.OffiAccountAccessToken]: 1000 * 60 * 60 * 2 // 2 hours
};
export type TmpDataMetadata<T extends TmpDataEnum> = _TmpDataMetadata[T];