feat(channels): add Shangwutong connector

This commit is contained in:
2026-08-03 10:13:40 +08:00
parent 96f5c796a6
commit 897b4e018f
126 changed files with 20207 additions and 272 deletions
@@ -5,6 +5,7 @@ export const INBOX_TYPES = {
TWILIO: 'Channel::TwilioSms',
WHATSAPP: 'Channel::Whatsapp',
API: 'Channel::Api',
SHANGWUTONG: 'Channel::Shangwutong',
EMAIL: 'Channel::Email',
TELEGRAM: 'Channel::Telegram',
LINE: 'Channel::Line',
@@ -45,6 +46,7 @@ const INBOX_ICON_MAP_FILL = {
[INBOX_TYPES.TWITTER]: 'i-ri-twitter-x-fill',
[INBOX_TYPES.WHATSAPP]: 'i-ri-whatsapp-fill',
[INBOX_TYPES.API]: 'i-ri-cloudy-fill',
[INBOX_TYPES.SHANGWUTONG]: 'i-ri-customer-service-2-fill',
[INBOX_TYPES.EMAIL]: 'i-ri-mail-fill',
[INBOX_TYPES.TELEGRAM]: 'i-ri-telegram-fill',
[INBOX_TYPES.LINE]: 'i-ri-line-fill',
@@ -60,6 +62,7 @@ const INBOX_ICON_MAP_LINE = {
[INBOX_TYPES.TWITTER]: 'i-woot-x',
[INBOX_TYPES.WHATSAPP]: 'i-woot-whatsapp',
[INBOX_TYPES.API]: 'i-woot-api',
[INBOX_TYPES.SHANGWUTONG]: 'i-ri-customer-service-2-line',
[INBOX_TYPES.EMAIL]: 'i-woot-mail',
[INBOX_TYPES.TELEGRAM]: 'i-woot-telegram',
[INBOX_TYPES.LINE]: 'i-woot-line',
@@ -105,6 +108,9 @@ export const getReadableInboxByType = (type, phoneNumber) => {
case INBOX_TYPES.API:
return 'api';
case INBOX_TYPES.SHANGWUTONG:
return 'shangwutong';
case INBOX_TYPES.EMAIL:
return 'email';
@@ -141,6 +147,9 @@ export const getInboxClassByType = (type, phoneNumber) => {
case INBOX_TYPES.API:
return 'cloud';
case INBOX_TYPES.SHANGWUTONG:
return 'customer-service-2';
case INBOX_TYPES.EMAIL:
return 'mail';
@@ -35,6 +35,11 @@ describe('#Inbox Helpers', () => {
it('should return correct class for Api', () => {
expect(getInboxClassByType('Channel::Api')).toEqual('cloud');
});
it('should return correct class for Shangwutong', () => {
expect(getInboxClassByType(INBOX_TYPES.SHANGWUTONG)).toEqual(
'customer-service-2'
);
});
it('should return correct class for Email', () => {
expect(getInboxClassByType('Channel::Email')).toEqual('mail');
});
@@ -69,6 +74,12 @@ describe('#Inbox Helpers', () => {
expect(getInboxIconByType(INBOX_TYPES.API)).toBe('i-ri-cloudy-fill');
});
it('returns correct icon for Shangwutong', () => {
expect(getInboxIconByType(INBOX_TYPES.SHANGWUTONG)).toBe(
'i-ri-customer-service-2-fill'
);
});
it('returns correct icon for Email', () => {
expect(getInboxIconByType(INBOX_TYPES.EMAIL)).toBe('i-ri-mail-fill');
});