@droppii-org/chat-mobile 0.2.95 → 0.2.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/lib/module/assets/images/index.js +1 -0
- package/lib/module/assets/images/index.js.map +1 -1
- package/lib/module/assets/images/tag_bot_mall.png +0 -0
- package/lib/module/components/Avatar/Avatar.utils.js +9 -2
- package/lib/module/components/Avatar/Avatar.utils.js.map +1 -1
- package/lib/module/config/api-endpoints.js +3 -2
- package/lib/module/config/api-endpoints.js.map +1 -1
- package/lib/module/config/configuration.js +24 -2
- package/lib/module/config/configuration.js.map +1 -1
- package/lib/module/core/index.js +7 -1
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/hooks/groups/useJoinGroupByInviteLink.js +155 -0
- package/lib/module/hooks/groups/useJoinGroupByInviteLink.js.map +1 -0
- package/lib/module/hooks/groups/useResolveGroupInviteLink.js +18 -0
- package/lib/module/hooks/groups/useResolveGroupInviteLink.js.map +1 -0
- package/lib/module/hooks/message/useSearchMessage.js +9 -8
- package/lib/module/hooks/message/useSearchMessage.js.map +1 -1
- package/lib/module/hooks/query-keys.js +2 -1
- package/lib/module/hooks/query-keys.js.map +1 -1
- package/lib/module/screens/inbox/Inbox.js +11 -1
- package/lib/module/screens/inbox/Inbox.js.map +1 -1
- package/lib/module/services/endpoints.js +2 -1
- package/lib/module/services/endpoints.js.map +1 -1
- package/lib/module/services/groupInvite.js +12 -0
- package/lib/module/services/groupInvite.js.map +1 -0
- package/lib/module/translation/resources/i18n.js +6 -1
- package/lib/module/translation/resources/i18n.js.map +1 -1
- package/lib/module/types/chat.js +2 -0
- package/lib/module/types/chat.js.map +1 -1
- package/lib/module/utils/messageUtils.js +14 -4
- package/lib/module/utils/messageUtils.js.map +1 -1
- package/lib/typescript/src/assets/images/index.d.ts +1 -0
- package/lib/typescript/src/assets/images/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Avatar/Avatar.utils.d.ts.map +1 -1
- package/lib/typescript/src/config/api-endpoints.d.ts +1 -0
- package/lib/typescript/src/config/api-endpoints.d.ts.map +1 -1
- package/lib/typescript/src/config/configuration.d.ts +15 -0
- package/lib/typescript/src/config/configuration.d.ts.map +1 -1
- package/lib/typescript/src/core/index.d.ts +7 -0
- package/lib/typescript/src/core/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/groups/useJoinGroupByInviteLink.d.ts +21 -0
- package/lib/typescript/src/hooks/groups/useJoinGroupByInviteLink.d.ts.map +1 -0
- package/lib/typescript/src/hooks/groups/useResolveGroupInviteLink.d.ts +3 -0
- package/lib/typescript/src/hooks/groups/useResolveGroupInviteLink.d.ts.map +1 -0
- package/lib/typescript/src/hooks/message/useSearchMessage.d.ts +24 -25
- package/lib/typescript/src/hooks/message/useSearchMessage.d.ts.map +1 -1
- package/lib/typescript/src/hooks/query-keys.d.ts +1 -0
- package/lib/typescript/src/hooks/query-keys.d.ts.map +1 -1
- package/lib/typescript/src/screens/inbox/Inbox.d.ts +4 -3
- package/lib/typescript/src/screens/inbox/Inbox.d.ts.map +1 -1
- package/lib/typescript/src/services/endpoints.d.ts +1 -0
- package/lib/typescript/src/services/endpoints.d.ts.map +1 -1
- package/lib/typescript/src/services/groupInvite.d.ts +5 -0
- package/lib/typescript/src/services/groupInvite.d.ts.map +1 -0
- package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
- package/lib/typescript/src/types/chat.d.ts +13 -2
- package/lib/typescript/src/types/chat.d.ts.map +1 -1
- package/lib/typescript/src/utils/messageUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/assets/images/index.ts +1 -0
- package/src/assets/images/tag_bot_mall.png +0 -0
- package/src/components/Avatar/Avatar.utils.ts +7 -2
- package/src/config/api-endpoints.ts +3 -1
- package/src/config/configuration.ts +24 -1
- package/src/core/index.ts +14 -2
- package/src/hooks/groups/useJoinGroupByInviteLink.tsx +167 -0
- package/src/hooks/groups/useResolveGroupInviteLink.ts +20 -0
- package/src/hooks/message/useSearchMessage.ts +9 -12
- package/src/hooks/query-keys.ts +2 -0
- package/src/screens/inbox/Inbox.tsx +21 -2
- package/src/services/endpoints.ts +2 -0
- package/src/services/groupInvite.ts +15 -0
- package/src/translation/resources/i18n.ts +6 -0
- package/src/types/chat.ts +14 -8
- package/src/utils/messageUtils.ts +18 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../../src/types/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,KAAK,KAAK,GAAG,CACX,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,GAAG,EACZ,QAAQ,CAAC,EAAE,GAAG,MAAM,OAAO,aAAa,EAAE,KACvC,IAAI,CAAC;AAEV,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAA;KAAE,CAAC;IACxC,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAA;KAAE,CAAC;IACxC,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,CAAC,MAAM,E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AAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,eAAe,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/messageUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"messageUtils.d.ts","sourceRoot":"","sources":["../../../../src/utils/messageUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAEL,WAAW,EAEX,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,eAAO,MAAM,gBAAgB,GAAI,SAAS,WAAW,KAAG,OACL,CAAC;AAKpD,eAAO,MAAM,uBAAuB,EAAE,OAAO,CAC3C,MAAM,CAAC,WAAW,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CAqEjE,CAAC;AAMF,eAAO,MAAM,wBAAwB,EAEpB,WAAW,EAAE,CAAC;AA2B/B,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAQD,eAAO,MAAM,uBAAuB,GAClC,SAAS,WAAW,KACnB,wBAAwB,GAAG,SAsE7B,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,SAAS,WAAW,KAAG,MAYzD,CAAC;AAEF,eA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AM,EAAE,WAAW,MAAM,KAAG,MAUhE,CAAC"}
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ const Images = {
|
|
|
7
7
|
ICON_WORD: require('./icon_word.png'),
|
|
8
8
|
NOTIFICATION_WARNING: require('./notification-warning.png'),
|
|
9
9
|
TAG_BOT: require('./tag_bot.png'),
|
|
10
|
+
TAG_BOT_MALL: require('./tag_bot_mall.png'),
|
|
10
11
|
TAG_MALL: require('./tag_mall.png'),
|
|
11
12
|
ICON_DROPPII: require('./icon_droppii.png'),
|
|
12
13
|
BTN_RESEND: require('./btn_resend.png'),
|
|
Binary file
|
|
@@ -39,14 +39,19 @@ export const getInitials = (fullName?: string): string => {
|
|
|
39
39
|
|
|
40
40
|
export const getBadgeImage = (variant?: string) => {
|
|
41
41
|
const Images = require('../../assets/images').default;
|
|
42
|
+
const { getPlatform } = require('../../config/configuration');
|
|
43
|
+
const { DChatProject } = require('../../types/chat');
|
|
44
|
+
const botImage =
|
|
45
|
+
getPlatform() === DChatProject.CUS ? Images.TAG_BOT_MALL : Images.TAG_BOT;
|
|
46
|
+
|
|
42
47
|
switch (variant) {
|
|
43
48
|
case 'mall':
|
|
44
49
|
return Images.TAG_MALL;
|
|
45
50
|
case 'bot':
|
|
46
51
|
case 'support':
|
|
47
|
-
return
|
|
52
|
+
return botImage;
|
|
48
53
|
default:
|
|
49
|
-
return
|
|
54
|
+
return botImage;
|
|
50
55
|
}
|
|
51
56
|
};
|
|
52
57
|
|
|
@@ -23,13 +23,14 @@ export interface ApiEndpoints {
|
|
|
23
23
|
messagesResources: string;
|
|
24
24
|
messages: string;
|
|
25
25
|
contacts: string;
|
|
26
|
+
groupJoinLink: string;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
const DEFAULT_ENDPOINTS: ApiEndpoints = {
|
|
29
30
|
urlMetadata: '/chat-service/v1/utils/url-metadata',
|
|
30
31
|
conversation: '/chat-service/v1/app/conversations',
|
|
31
32
|
imageUpload: '/uploader-service/v1/uploader/permanently',
|
|
32
|
-
bot: '/chat-service/v1/app/bots
|
|
33
|
+
bot: '/chat-service/v1/app/bots',
|
|
33
34
|
uploadFcmToken: '/chat-service/third/fcm_update_token',
|
|
34
35
|
stickerCategories: '/chat-service/v1/app/sticker-categories',
|
|
35
36
|
stickersByCategory: '/chat-service/v1/app/sticker-categories',
|
|
@@ -37,6 +38,7 @@ const DEFAULT_ENDPOINTS: ApiEndpoints = {
|
|
|
37
38
|
messagesResources: '/chat-service/v1/app/messages/resources',
|
|
38
39
|
messages: '/chat-service/v1/app/messages',
|
|
39
40
|
contacts: '/chat-service/v1/app/contacts',
|
|
41
|
+
groupJoinLink: '/chat-service/v1/app/conversations/join-link',
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
let endpoints: ApiEndpoints = { ...DEFAULT_ENDPOINTS };
|
|
@@ -6,12 +6,16 @@
|
|
|
6
6
|
* from the same base URL configuration.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { DChatProject } from '../types/chat';
|
|
10
|
+
|
|
9
11
|
export interface AppConfig {
|
|
10
12
|
apiBaseUrl: string;
|
|
13
|
+
platform: DChatProject;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
let config: AppConfig = {
|
|
14
17
|
apiBaseUrl: '',
|
|
18
|
+
platform: DChatProject.BIZ,
|
|
15
19
|
};
|
|
16
20
|
|
|
17
21
|
/**
|
|
@@ -39,7 +43,26 @@ export const getBaseUrl = (): string => {
|
|
|
39
43
|
* Reset configuration (useful for testing)
|
|
40
44
|
*/
|
|
41
45
|
export const resetBaseUrl = (): void => {
|
|
42
|
-
config = { apiBaseUrl: '' };
|
|
46
|
+
config = { apiBaseUrl: '', platform: DChatProject.BIZ };
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Initialize which app (project) the library is running in.
|
|
51
|
+
* This should be called during app startup, e.g. via initChatSdk().
|
|
52
|
+
* Components that render app-specific assets (e.g. bot badge) read this
|
|
53
|
+
* instead of requiring every call site to pass it down as a prop.
|
|
54
|
+
*
|
|
55
|
+
* @param platform - DChatProject.BIZ (default) or DChatProject.CUS
|
|
56
|
+
*/
|
|
57
|
+
export const initPlatform = (platform: DChatProject): void => {
|
|
58
|
+
config.platform = platform;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Get the configured platform (DChatProject.BIZ by default)
|
|
63
|
+
*/
|
|
64
|
+
export const getPlatform = (): DChatProject => {
|
|
65
|
+
return config.platform;
|
|
43
66
|
};
|
|
44
67
|
|
|
45
68
|
/**
|
package/src/core/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import OpenIMSDK from '@droppii/openim-rn-client-sdk';
|
|
2
2
|
import type { InitOptions } from '@droppii/openim-rn-client-sdk';
|
|
3
|
-
import { initBaseUrl } from '../config/configuration';
|
|
3
|
+
import { initBaseUrl, initPlatform } from '../config/configuration';
|
|
4
|
+
import type { DChatProject } from '../types/chat';
|
|
4
5
|
import { useUserListener } from './useUserListener';
|
|
5
6
|
import { useChatListener } from './useChatListener';
|
|
6
7
|
import { useBackgroundStatusSync } from './notification/useBackgroundStatusSync';
|
|
@@ -14,6 +15,12 @@ export interface InitChatSdkOptions extends InitOptions {
|
|
|
14
15
|
* Will be set as the centralized configuration
|
|
15
16
|
*/
|
|
16
17
|
apiBaseUrl?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Which app the library is running in — DChatProject.BIZ (default) or
|
|
20
|
+
* DChatProject.CUS. Drives app-specific assets (e.g. the bot avatar
|
|
21
|
+
* badge) without requiring every consumer to pass it down manually.
|
|
22
|
+
*/
|
|
23
|
+
platform?: DChatProject;
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
/**
|
|
@@ -21,7 +28,7 @@ export interface InitChatSdkOptions extends InitOptions {
|
|
|
21
28
|
* @param options - SDK initialization options + apiBaseUrl for centralized config
|
|
22
29
|
*/
|
|
23
30
|
export const initChatSdk = (options: InitChatSdkOptions) => {
|
|
24
|
-
const { apiBaseUrl, ...sdkOptions } = options;
|
|
31
|
+
const { apiBaseUrl, platform, ...sdkOptions } = options;
|
|
25
32
|
|
|
26
33
|
// Initialize OpenIM SDK
|
|
27
34
|
OpenIMSDK.initSDK(sdkOptions);
|
|
@@ -30,6 +37,11 @@ export const initChatSdk = (options: InitChatSdkOptions) => {
|
|
|
30
37
|
if (apiBaseUrl) {
|
|
31
38
|
initBaseUrl(apiBaseUrl);
|
|
32
39
|
}
|
|
40
|
+
|
|
41
|
+
// Initialize which app (biz/mall) the library is running in
|
|
42
|
+
if (platform) {
|
|
43
|
+
initPlatform(platform);
|
|
44
|
+
}
|
|
33
45
|
};
|
|
34
46
|
|
|
35
47
|
export const useChatSdk = () => {
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { memo, useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
import { GroupJoinSource } from '@droppii/openim-rn-client-sdk';
|
|
3
|
+
import { KButton, KColors, KContainer, KLabel } from '@droppii/libs';
|
|
4
|
+
import { Avatar } from '../../components/Avatar';
|
|
5
|
+
import { UIUtils } from '../../utils/UIUtils';
|
|
6
|
+
import { trans } from '../../translation';
|
|
7
|
+
import type { GroupInviteLinkInfo } from '../../types/chat';
|
|
8
|
+
import { useJoinGroup } from './useJoinGroup';
|
|
9
|
+
import { useResolveGroupInviteLink } from './useResolveGroupInviteLink';
|
|
10
|
+
|
|
11
|
+
const showGroupInviteLinkUnavailableModal = () => {
|
|
12
|
+
UIUtils.alert.open({
|
|
13
|
+
title: trans('group:invite_link_unavailable_title'),
|
|
14
|
+
message: trans('group:invite_link_unavailable_desc'),
|
|
15
|
+
primaryIndex: 0,
|
|
16
|
+
buttonType: 'horizontal-button',
|
|
17
|
+
buttons: [{ label: trans('group:access_blocked_button'), kind: 'primary' }],
|
|
18
|
+
ignoreStack: true,
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
interface JoinGroupConfirmSheetContentProps {
|
|
23
|
+
groupInfo: GroupInviteLinkInfo;
|
|
24
|
+
onJoined: () => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const JoinGroupConfirmSheetContent = memo(
|
|
28
|
+
({ groupInfo, onJoined }: JoinGroupConfirmSheetContentProps) => {
|
|
29
|
+
const { mutate: joinGroup, isPending } = useJoinGroup();
|
|
30
|
+
|
|
31
|
+
const handleConfirm = useCallback(() => {
|
|
32
|
+
if (isPending) return;
|
|
33
|
+
joinGroup(
|
|
34
|
+
{
|
|
35
|
+
groupID: groupInfo.groupId,
|
|
36
|
+
reqMsg: '',
|
|
37
|
+
joinSource: GroupJoinSource.QrCode,
|
|
38
|
+
groupName: groupInfo.groupName,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
onSuccess: () => {
|
|
42
|
+
UIUtils.bottomSheet.dismiss();
|
|
43
|
+
onJoined();
|
|
44
|
+
},
|
|
45
|
+
onError: () => {
|
|
46
|
+
UIUtils.toast.open({
|
|
47
|
+
title: trans('chat:generic_error'),
|
|
48
|
+
theme: 'error',
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}, [joinGroup, groupInfo, onJoined, isPending]);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<KContainer.View paddingH="1rem" paddingB="1rem" alignItems>
|
|
57
|
+
<Avatar
|
|
58
|
+
size="4xlg"
|
|
59
|
+
source={groupInfo.groupAvatar}
|
|
60
|
+
fullName={groupInfo.groupName}
|
|
61
|
+
/>
|
|
62
|
+
<KLabel.Text
|
|
63
|
+
typo="TextLgBold"
|
|
64
|
+
color={KColors.black}
|
|
65
|
+
paddingT="0.75rem"
|
|
66
|
+
numberOfLines={2}
|
|
67
|
+
textAlign="center"
|
|
68
|
+
>
|
|
69
|
+
{groupInfo.groupName}
|
|
70
|
+
</KLabel.Text>
|
|
71
|
+
<KLabel.Text
|
|
72
|
+
typo="TextMdNormal"
|
|
73
|
+
color={KColors.gray.normal}
|
|
74
|
+
paddingT="0.25rem"
|
|
75
|
+
>
|
|
76
|
+
{trans('group:member_count', { count: groupInfo.groupTotalMember })}
|
|
77
|
+
</KLabel.Text>
|
|
78
|
+
<KButton.Solid
|
|
79
|
+
label={trans('group:join_group_confirm_button')}
|
|
80
|
+
onPress={handleConfirm}
|
|
81
|
+
loading={isPending}
|
|
82
|
+
isLightSolid
|
|
83
|
+
kind="primary"
|
|
84
|
+
stretch
|
|
85
|
+
marginT="1rem"
|
|
86
|
+
/>
|
|
87
|
+
</KContainer.View>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const openJoinGroupConfirmSheet = (params: {
|
|
93
|
+
groupInfo: GroupInviteLinkInfo;
|
|
94
|
+
onJoined: () => void;
|
|
95
|
+
}) => {
|
|
96
|
+
UIUtils.bottomSheet.open({
|
|
97
|
+
header: {
|
|
98
|
+
title: { text: trans('group:join_group_confirm_title') },
|
|
99
|
+
alignment: 'left',
|
|
100
|
+
showCloseButton: true,
|
|
101
|
+
},
|
|
102
|
+
touchOutsideToDismiss: true,
|
|
103
|
+
body: {
|
|
104
|
+
renderContent: () => (
|
|
105
|
+
<JoinGroupConfirmSheetContent
|
|
106
|
+
groupInfo={params.groupInfo}
|
|
107
|
+
onJoined={params.onJoined}
|
|
108
|
+
/>
|
|
109
|
+
),
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
interface UseJoinGroupByInviteLinkParams {
|
|
115
|
+
code?: string;
|
|
116
|
+
/** Fired once membership is resolved (existing member, or just-joined group) — navigate into the group thread. */
|
|
117
|
+
onAllowed: (target: { groupId: string; conversationId: string }) => void;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Orchestrates the invite-link entry flow: resolves the code via BE, then
|
|
122
|
+
* routes to the right outcome — existing member / public non-member both
|
|
123
|
+
* resolve immediately via `onAllowed` (the group screen's own access guard
|
|
124
|
+
* derives view-only vs full access on its own), a private non-member sees a
|
|
125
|
+
* confirm-join bottom sheet first, and any resolve failure shows the
|
|
126
|
+
* Unavailable Link modal. Settles at most once per `code` — a background
|
|
127
|
+
* refetch of the resolve query must not re-open the sheet or re-fire
|
|
128
|
+
* `onAllowed`.
|
|
129
|
+
*/
|
|
130
|
+
export const useJoinGroupByInviteLink = ({
|
|
131
|
+
code,
|
|
132
|
+
onAllowed,
|
|
133
|
+
}: UseJoinGroupByInviteLinkParams) => {
|
|
134
|
+
const { data, isLoading, isError } = useResolveGroupInviteLink(code);
|
|
135
|
+
const settledCodeRef = useRef<string | undefined>(undefined);
|
|
136
|
+
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (!code || isLoading || settledCodeRef.current === code) return;
|
|
139
|
+
|
|
140
|
+
if (isError || !data) {
|
|
141
|
+
settledCodeRef.current = code;
|
|
142
|
+
showGroupInviteLinkUnavailableModal();
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (data.isMember) {
|
|
147
|
+
settledCodeRef.current = code;
|
|
148
|
+
onAllowed({ groupId: data.groupId, conversationId: data.conversationId });
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
settledCodeRef.current = code;
|
|
153
|
+
UIUtils.bottomSheet.dismiss();
|
|
154
|
+
openJoinGroupConfirmSheet({
|
|
155
|
+
groupInfo: data,
|
|
156
|
+
onJoined: () => {
|
|
157
|
+
onAllowed({
|
|
158
|
+
groupId: data.groupId,
|
|
159
|
+
conversationId: data.conversationId,
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
// Do not add code as dependency
|
|
164
|
+
// Because data is delayed compared to code -> cause stalling data
|
|
165
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
166
|
+
}, [isLoading, isError, data, onAllowed]);
|
|
167
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { groupQueryKeys } from '../query-keys';
|
|
3
|
+
import type { GroupInviteLinkInfo } from '../../types/chat';
|
|
4
|
+
import { apiInstance, unwrapEnvelope } from '../../services/apis';
|
|
5
|
+
import type { BaseResponse } from '../../types/auth';
|
|
6
|
+
import { ENDPOINTS } from '../../services/endpoints';
|
|
7
|
+
|
|
8
|
+
export const useResolveGroupInviteLink = (code?: string) => {
|
|
9
|
+
return useQuery({
|
|
10
|
+
queryKey: groupQueryKeys.inviteInfo(code ?? ''),
|
|
11
|
+
enabled: Boolean(code),
|
|
12
|
+
queryFn: async () => {
|
|
13
|
+
const res = await apiInstance?.get<BaseResponse<GroupInviteLinkInfo>>(
|
|
14
|
+
ENDPOINTS.chatService.groupJoinLink(code!)
|
|
15
|
+
);
|
|
16
|
+
return unwrapEnvelope<GroupInviteLinkInfo>(res);
|
|
17
|
+
},
|
|
18
|
+
refetchOnWindowFocus: false,
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useInfiniteQuery } from '@tanstack/react-query';
|
|
2
2
|
import { messageQueryKeys } from '../query-keys';
|
|
3
|
-
import { apiInstance } from '../../services/apis';
|
|
3
|
+
import { apiInstance, unwrapEnvelope } from '../../services/apis';
|
|
4
4
|
import { ENDPOINTS } from '../../services/endpoints';
|
|
5
5
|
import { MessageType } from '@droppii/openim-rn-client-sdk';
|
|
6
6
|
import type {
|
|
@@ -45,17 +45,18 @@ export const useSearchMessage = ({
|
|
|
45
45
|
searchTerm: query.trim(),
|
|
46
46
|
conversationId,
|
|
47
47
|
};
|
|
48
|
-
console.log('params', params);
|
|
49
48
|
const res = await apiInstance?.post<BaseResponse<ISearchMessageItem[]>>(
|
|
50
49
|
ENDPOINTS.chatService.searchMessages(),
|
|
51
50
|
params
|
|
52
51
|
);
|
|
53
|
-
return res
|
|
52
|
+
return unwrapEnvelope<ISearchMessageItem[]>(res) ?? [];
|
|
54
53
|
},
|
|
55
|
-
getNextPageParam: (lastPage) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
getNextPageParam: (lastPage, allPages) => {
|
|
55
|
+
// unwrapEnvelope always resolves a page down to the bare item array, so there's
|
|
56
|
+
// no server-echoed pageable metadata here — derive the next page from how many
|
|
57
|
+
// pages we've already fetched instead of `lastPage.pageable.pageNumber`.
|
|
58
|
+
const dataLength = lastPage?.length || 0;
|
|
59
|
+
return dataLength < pageSize ? undefined : allPages.length + 1;
|
|
59
60
|
},
|
|
60
61
|
initialPageParam: 1,
|
|
61
62
|
enabled: enabled && !!query && !!applicationType,
|
|
@@ -63,11 +64,7 @@ export const useSearchMessage = ({
|
|
|
63
64
|
|
|
64
65
|
const baseItems = useMemo<ISearchMessageItem[]>(() => {
|
|
65
66
|
if (!query.trim() || !data) return [];
|
|
66
|
-
return (
|
|
67
|
-
data?.pages
|
|
68
|
-
?.flatMap?.((page) => page?.data)
|
|
69
|
-
?.filter((item) => item !== undefined) || []
|
|
70
|
-
);
|
|
67
|
+
return data?.pages?.flat?.() || [];
|
|
71
68
|
}, [data, query]);
|
|
72
69
|
|
|
73
70
|
const [dataFlatten, setDataFlatten] =
|
package/src/hooks/query-keys.ts
CHANGED
|
@@ -81,4 +81,6 @@ export const groupQueryKeys = {
|
|
|
81
81
|
[...groupQueryKeys.public(), keyword] as const,
|
|
82
82
|
join: () => [...groupQueryKeys.all, 'join'] as const,
|
|
83
83
|
leave: () => [...groupQueryKeys.all, 'leave'] as const,
|
|
84
|
+
inviteInfo: (code: string) =>
|
|
85
|
+
[...groupQueryKeys.all, 'inviteInfo', code] as const,
|
|
84
86
|
};
|
|
@@ -9,17 +9,22 @@ import {
|
|
|
9
9
|
KRadiusValue,
|
|
10
10
|
KSpacingValue,
|
|
11
11
|
} from '@droppii/libs';
|
|
12
|
+
import {
|
|
13
|
+
GroupJoinSource,
|
|
14
|
+
type ConversationItem,
|
|
15
|
+
} from '@droppii/openim-rn-client-sdk';
|
|
12
16
|
import { MessagesTab } from './MessagesTab';
|
|
13
|
-
import type { ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
14
17
|
import { trans } from '../../translation';
|
|
15
18
|
import { CommunityTab } from './CommunityTab';
|
|
19
|
+
import { useJoinGroupByInviteLink } from '../../hooks/groups/useJoinGroupByInviteLink';
|
|
16
20
|
|
|
17
21
|
interface InboxProps {
|
|
18
22
|
onPressThread?: (item?: ConversationItem) => void;
|
|
19
23
|
onPressSearch?: () => void;
|
|
20
24
|
onPressEdit?: () => void;
|
|
21
25
|
onPressContact?: () => void;
|
|
22
|
-
onPressGroup?: (groupId: string) => void;
|
|
26
|
+
onPressGroup?: (groupId: string, groupJoinSource?: GroupJoinSource) => void;
|
|
27
|
+
groupInviteLinkCode?: string;
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
type TabRoute = { key: string; title: string };
|
|
@@ -36,8 +41,22 @@ const Inbox = memo(
|
|
|
36
41
|
onPressEdit,
|
|
37
42
|
onPressContact,
|
|
38
43
|
onPressGroup,
|
|
44
|
+
groupInviteLinkCode,
|
|
39
45
|
}: InboxProps) => {
|
|
40
46
|
const [index, setIndex] = useState(0);
|
|
47
|
+
|
|
48
|
+
const handleGroupInviteLinkAllowed = useCallback(
|
|
49
|
+
(target: { groupId: string; conversationId: string }) => {
|
|
50
|
+
onPressGroup?.(target.groupId, GroupJoinSource.QrCode);
|
|
51
|
+
},
|
|
52
|
+
[onPressGroup]
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
useJoinGroupByInviteLink({
|
|
56
|
+
code: groupInviteLinkCode,
|
|
57
|
+
onAllowed: handleGroupInviteLinkAllowed,
|
|
58
|
+
});
|
|
59
|
+
|
|
41
60
|
const [routes] = useState<TabRoute[]>(TabRoutes);
|
|
42
61
|
|
|
43
62
|
const renderScene = useCallback(
|
|
@@ -40,6 +40,8 @@ export const ENDPOINTS = {
|
|
|
40
40
|
stickerHistory: () => getApiEndpoint('stickerHistory'),
|
|
41
41
|
searchMessages: () => `${getApiEndpoint('messages')}/search`,
|
|
42
42
|
searchContacts: () => `${getApiEndpoint('contacts')}/search`,
|
|
43
|
+
groupJoinLink: (code: string) =>
|
|
44
|
+
`${getApiEndpoint('groupJoinLink')}/${code}`,
|
|
43
45
|
},
|
|
44
46
|
uploaderService: {
|
|
45
47
|
get uploadImage() {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { apiInstance, unwrapEnvelope } from './apis';
|
|
2
|
+
import { getApiEndpoint } from '../config/api-endpoints';
|
|
3
|
+
import type { BaseResponse } from '../types/auth';
|
|
4
|
+
import type { GroupInviteLinkInfo } from '../types/chat';
|
|
5
|
+
|
|
6
|
+
export namespace GroupInviteService {
|
|
7
|
+
export const fetchGroupInviteLinkInfo = async (
|
|
8
|
+
code: string
|
|
9
|
+
): Promise<GroupInviteLinkInfo | null> => {
|
|
10
|
+
const res = await apiInstance?.get<BaseResponse<GroupInviteLinkInfo>>(
|
|
11
|
+
`${getApiEndpoint('groupJoinLink')}/${code}`
|
|
12
|
+
);
|
|
13
|
+
return unwrapEnvelope<GroupInviteLinkInfo>(res);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -104,6 +104,7 @@ const i18nKey: Record<string, string> = {
|
|
|
104
104
|
'chat:group_message_unpinned_by': '{{sender}} đã bỏ ghim một tin nhắn',
|
|
105
105
|
'msg_type_member_enter': 'Đã tham gia nhóm',
|
|
106
106
|
'chat:member_enter_by': '{{sender}} đã tham gia nhóm',
|
|
107
|
+
'chat:member_enter_via_link': '{{sender}} đã tham gia nhóm qua link',
|
|
107
108
|
'msg_type_group_dismissed': 'Nhóm đã bị giải tán',
|
|
108
109
|
'chat:group_dismissed_by': '{{sender}} đã giải tán nhóm',
|
|
109
110
|
'msg_type_group_member_muted': 'Đã tắt tiếng thành viên',
|
|
@@ -227,6 +228,11 @@ const i18nKey: Record<string, string> = {
|
|
|
227
228
|
'group:access_blocked_desc':
|
|
228
229
|
'Bạn hiện không có quyền truy cập vào cuộc trò chuyện hoặc tin nhắn này.',
|
|
229
230
|
'group:access_blocked_button': 'Đã hiểu',
|
|
231
|
+
'group:join_group_confirm_title': 'Tham gia nhóm',
|
|
232
|
+
'group:join_group_confirm_button': 'Tham gia nhóm',
|
|
233
|
+
'group:invite_link_unavailable_title': 'Liên kết không còn khả dụng',
|
|
234
|
+
'group:invite_link_unavailable_desc':
|
|
235
|
+
'Liên kết đã bị thu hồi, thay thế hoặc nhóm không còn tồn tại. Vui lòng liên hệ người gửi để nhận liên kết mới.',
|
|
230
236
|
};
|
|
231
237
|
|
|
232
238
|
export default {
|
package/src/types/chat.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
MessageType,
|
|
3
3
|
type ConversationItem,
|
|
4
4
|
type GroupItem,
|
|
5
|
+
type GroupVisibility,
|
|
5
6
|
type MessageItem,
|
|
6
7
|
type SelfUserInfo,
|
|
7
8
|
} from '@droppii/openim-rn-client-sdk';
|
|
@@ -37,14 +38,7 @@ export interface ChatUIAdapter {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
export type GenerateChatDetailLinkFn = (
|
|
40
|
-
params: Pick<
|
|
41
|
-
ChatDetailProps,
|
|
42
|
-
| 'targetConversationId'
|
|
43
|
-
| 'targetUserId'
|
|
44
|
-
| 'targetGroupId'
|
|
45
|
-
| 'targetBotId'
|
|
46
|
-
| 'targetMessageId'
|
|
47
|
-
>
|
|
41
|
+
params: Pick<ChatDetailProps, 'targetConversationId' | 'targetMessageId'>
|
|
48
42
|
) => string;
|
|
49
43
|
|
|
50
44
|
export interface ChatContextType {
|
|
@@ -407,3 +401,15 @@ export interface IContactSearchItem {
|
|
|
407
401
|
memberCount?: number;
|
|
408
402
|
description?: string;
|
|
409
403
|
}
|
|
404
|
+
|
|
405
|
+
/** Response shape of `GET /chat-service/v1/app/conversations/join-link/{code}`. */
|
|
406
|
+
export interface GroupInviteLinkInfo {
|
|
407
|
+
conversationId: string;
|
|
408
|
+
groupId: string;
|
|
409
|
+
groupName: string;
|
|
410
|
+
groupDescription: string;
|
|
411
|
+
groupVisibility: GroupVisibility;
|
|
412
|
+
groupAvatar: string;
|
|
413
|
+
isMember: boolean;
|
|
414
|
+
groupTotalMember: number;
|
|
415
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
+
GroupJoinSource,
|
|
6
7
|
MessageType,
|
|
7
8
|
PeerType,
|
|
8
9
|
type ConversationItem,
|
|
@@ -196,6 +197,14 @@ export const resolveNotificationText = (
|
|
|
196
197
|
}
|
|
197
198
|
break;
|
|
198
199
|
}
|
|
200
|
+
case MessageType.MemberEnter: {
|
|
201
|
+
const joinSource = detail?.entrantUser?.joinSource;
|
|
202
|
+
if (joinSource === GroupJoinSource.QrCode) {
|
|
203
|
+
previewKey = 'chat:member_enter_via_link';
|
|
204
|
+
bySenderKey = 'chat:member_enter_via_link';
|
|
205
|
+
}
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
199
208
|
default:
|
|
200
209
|
break;
|
|
201
210
|
}
|
|
@@ -433,10 +442,16 @@ export const getNotificationOpUserNickname = (
|
|
|
433
442
|
const parsed = JSON.parse(message.notificationElem.detail) as {
|
|
434
443
|
opUser?: { nickname?: string };
|
|
435
444
|
quitUser?: { nickname?: string };
|
|
445
|
+
entrantUser?: { nickname?: string };
|
|
436
446
|
};
|
|
437
|
-
// MemberQuit puts the leaver in `quitUser
|
|
438
|
-
//
|
|
439
|
-
|
|
447
|
+
// MemberQuit puts the leaver in `quitUser`
|
|
448
|
+
// MemberEnter puts the joiner in `entrantUser`
|
|
449
|
+
// every other group-notification content type uses `opUser` for the actor.
|
|
450
|
+
return (
|
|
451
|
+
parsed?.opUser?.nickname ??
|
|
452
|
+
parsed?.quitUser?.nickname ??
|
|
453
|
+
parsed?.entrantUser?.nickname
|
|
454
|
+
);
|
|
440
455
|
} catch {
|
|
441
456
|
return undefined;
|
|
442
457
|
}
|