@amityco/ts-sdk 7.4.1-0e170b02.0 → 7.4.1-18d364a3.0
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/dist/@types/domains/joinRequest.d.ts +4 -4
- package/dist/@types/domains/joinRequest.d.ts.map +1 -1
- package/dist/@types/domains/notification.d.ts +4 -2
- package/dist/@types/domains/notification.d.ts.map +1 -1
- package/dist/communityRepository/internalAPI/joinCommunity.d.ts.map +1 -1
- package/dist/communityRepository/joinRequest/internalAPI/approveJoinRequest.d.ts.map +1 -1
- package/dist/communityRepository/joinRequest/internalAPI/cancelJoinRequest.d.ts.map +1 -1
- package/dist/communityRepository/joinRequest/internalAPI/rejectJoinRequest.d.ts.map +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/index.cjs.js +18 -15
- package/dist/index.esm.js +18 -15
- package/dist/index.umd.js +2 -2
- package/dist/utils/linkedObject/joinRequestLinkedObject.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/domains/joinRequest.ts +4 -4
- package/src/@types/domains/notification.ts +2 -0
- package/src/communityRepository/internalAPI/joinCommunity.ts +4 -2
- package/src/communityRepository/joinRequest/internalAPI/approveJoinRequest.ts +1 -5
- package/src/communityRepository/joinRequest/internalAPI/cancelJoinRequest.ts +0 -5
- package/src/communityRepository/joinRequest/internalAPI/rejectJoinRequest.ts +3 -0
- package/src/core/model/index.ts +1 -0
- package/src/utils/linkedObject/joinRequestLinkedObject.ts +8 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"joinRequestLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/joinRequestLinkedObject.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,gBACrB,MAAM,mBAAmB,KACrC,MAAM,
|
|
1
|
+
{"version":3,"file":"joinRequestLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/joinRequestLinkedObject.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,gBACrB,MAAM,mBAAmB,KACrC,MAAM,WAsBR,CAAC"}
|
package/package.json
CHANGED
|
@@ -35,10 +35,10 @@ declare global {
|
|
|
35
35
|
requestorInternalId: string;
|
|
36
36
|
requestorPublicId: string;
|
|
37
37
|
|
|
38
|
-
respondedAt: Amity.timestamp;
|
|
39
|
-
responderId: string;
|
|
40
|
-
responderInternalId: string;
|
|
41
|
-
responderPublicId: string;
|
|
38
|
+
respondedAt: Amity.timestamp | null;
|
|
39
|
+
responderId: string | null;
|
|
40
|
+
responderInternalId: string | null;
|
|
41
|
+
responderPublicId: string | null;
|
|
42
42
|
|
|
43
43
|
status: Amity.JoinRequestStatus;
|
|
44
44
|
targetId: string;
|
|
@@ -10,6 +10,7 @@ declare global {
|
|
|
10
10
|
POST_REACT = 'reaction_on_post',
|
|
11
11
|
COMMENT_REACT = 'reaction_on_comment',
|
|
12
12
|
REPLY_REACT = 'reaction_on_reply',
|
|
13
|
+
RESPONSE_JOIN_REQUEST = 'respond_on_join_request',
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const enum TrayAction {
|
|
@@ -19,6 +20,7 @@ declare global {
|
|
|
19
20
|
REACTION = 'reaction',
|
|
20
21
|
MENTION = 'mention',
|
|
21
22
|
REPLY = 'reply',
|
|
23
|
+
JOIN_REQUEST = 'join_request',
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
type RawNotificationTrayItem = {
|
|
@@ -2,7 +2,7 @@ import { getActiveClient } from '~/client/api/activeClient';
|
|
|
2
2
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
3
3
|
import { prepareCommunityJoinRequestPayload } from '~/communityRepository/utils';
|
|
4
4
|
import { fireEvent } from '~/core/events';
|
|
5
|
-
import { JoinResultStatusEnum } from '~/@types/domains/joinRequest';
|
|
5
|
+
import { JoinRequestStatusEnum, JoinResultStatusEnum } from '~/@types/domains/joinRequest';
|
|
6
6
|
import { joinRequestLinkedObject } from '~/utils/linkedObject/joinRequestLinkedObject';
|
|
7
7
|
|
|
8
8
|
/* begin_public_function
|
|
@@ -40,7 +40,9 @@ export const joinRequest = async (
|
|
|
40
40
|
fireEvent('local.community.join', data.joinRequests);
|
|
41
41
|
|
|
42
42
|
const status =
|
|
43
|
-
data.joinRequests.
|
|
43
|
+
data.joinRequests[0].status === JoinRequestStatusEnum.Approved
|
|
44
|
+
? JoinResultStatusEnum.Success
|
|
45
|
+
: JoinResultStatusEnum.Pending;
|
|
44
46
|
|
|
45
47
|
return status === JoinResultStatusEnum.Success
|
|
46
48
|
? { status }
|
|
@@ -29,14 +29,10 @@ export const approveJoinRequest = async (
|
|
|
29
29
|
const { data } = await client.http.post<{ success: boolean }>(
|
|
30
30
|
`/api/v4/communities/${joinRequest.targetId}/join/approve`,
|
|
31
31
|
{
|
|
32
|
-
|
|
33
|
-
userId: joinRequest.userId,
|
|
34
|
-
},
|
|
32
|
+
userId: joinRequest.requestorInternalId,
|
|
35
33
|
},
|
|
36
34
|
);
|
|
37
35
|
|
|
38
|
-
// TODO : Check cache id
|
|
39
|
-
|
|
40
36
|
const joinRequestCache = pullFromCache<Amity.InternalJoinRequest>([
|
|
41
37
|
'joinRequest',
|
|
42
38
|
'get',
|
|
@@ -27,11 +27,6 @@ export const cancelJoinRequest = async (
|
|
|
27
27
|
|
|
28
28
|
const { data } = await client.http.delete<{ success: boolean }>(
|
|
29
29
|
`/api/v4/communities/${joinRequest.targetId}/join`,
|
|
30
|
-
{
|
|
31
|
-
params: {
|
|
32
|
-
userId: joinRequest.userId,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
30
|
);
|
|
36
31
|
|
|
37
32
|
const joinRequestCache = pullFromCache<Amity.InternalJoinRequest>([
|
|
@@ -28,6 +28,9 @@ export const rejectJoinRequest = async (
|
|
|
28
28
|
|
|
29
29
|
const { data } = await client.http.post<{ success: boolean }>(
|
|
30
30
|
`/api/v4/communities/${joinRequest.targetId}/join/reject`,
|
|
31
|
+
{
|
|
32
|
+
userId: joinRequest.requestorInternalId,
|
|
33
|
+
},
|
|
31
34
|
);
|
|
32
35
|
|
|
33
36
|
const joinRequestCache = pullFromCache<Amity.InternalJoinRequest>([
|
package/src/core/model/index.ts
CHANGED
|
@@ -9,10 +9,14 @@ export const joinRequestLinkedObject = (
|
|
|
9
9
|
): Amity.JoinRequest => {
|
|
10
10
|
return {
|
|
11
11
|
...joinRequest,
|
|
12
|
-
get user() {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
get user(): Amity.User | undefined {
|
|
13
|
+
const user = pullFromCache<Amity.InternalUser>([
|
|
14
|
+
'user',
|
|
15
|
+
'get',
|
|
16
|
+
joinRequest.requestorPublicId,
|
|
17
|
+
])?.data;
|
|
18
|
+
if (!user) return undefined;
|
|
19
|
+
return userLinkedObject(user);
|
|
16
20
|
},
|
|
17
21
|
cancel: async () => {
|
|
18
22
|
await cancelJoinRequest(joinRequest);
|