@amityco/ts-sdk 7.8.4-fa122d17.0 → 7.8.5-a43f7f3.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/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/@types/domains/message.d.ts +4 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/@types/domains/message.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/@types/domains/message.js.map +1 -1
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/addReactionToMessage.d.ts +2 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/addReactionToMessage.d.ts.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/addReactionToMessage.js +6 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/addReactionToMessage.js.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/removeReactionToMessage.d.ts +2 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/removeReactionToMessage.d.ts.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/removeReactionToMessage.js +6 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/messageRepository/utils/removeReactionToMessage.js.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/addReaction.d.ts +5 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/addReaction.d.ts.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/addReaction.js +92 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/addReaction.js.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/index.d.ts +3 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/index.d.ts.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/index.js +3 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/index.js.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/removeReaction.d.ts +2 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/removeReaction.d.ts.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/removeReaction.js +68 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/reactionRepository/internalApi/removeReaction.js.map +1 -0
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/utils/linkedObject/messageLinkedObject.d.ts.map +1 -1
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/utils/linkedObject/messageLinkedObject.js +3 -1
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/dist/utils/linkedObject/messageLinkedObject.js.map +1 -1
- package/.rollup.cache/home/runner/work/AmityTypescriptSDK/AmityTypescriptSDK/packages/sdk/tsconfig.tsbuildinfo +1 -1
- package/dist/@types/domains/message.d.ts +4 -0
- package/dist/@types/domains/message.d.ts.map +1 -1
- package/dist/index.cjs.js +187 -27
- package/dist/index.esm.js +187 -27
- package/dist/index.umd.js +2 -2
- package/dist/messageRepository/utils/addReactionToMessage.d.ts +2 -0
- package/dist/messageRepository/utils/addReactionToMessage.d.ts.map +1 -0
- package/dist/messageRepository/utils/removeReactionToMessage.d.ts +2 -0
- package/dist/messageRepository/utils/removeReactionToMessage.d.ts.map +1 -0
- package/dist/reactionRepository/internalApi/addReaction.d.ts +5 -0
- package/dist/reactionRepository/internalApi/addReaction.d.ts.map +1 -0
- package/dist/reactionRepository/internalApi/index.d.ts +3 -0
- package/dist/reactionRepository/internalApi/index.d.ts.map +1 -0
- package/dist/reactionRepository/internalApi/removeReaction.d.ts +2 -0
- package/dist/reactionRepository/internalApi/removeReaction.d.ts.map +1 -0
- package/dist/utils/linkedObject/messageLinkedObject.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/domains/message.ts +4 -0
- package/src/messageRepository/utils/addReactionToMessage.ts +12 -0
- package/src/messageRepository/utils/removeReactionToMessage.ts +12 -0
- package/src/reactionRepository/internalApi/addReaction.ts +137 -0
- package/src/reactionRepository/internalApi/index.ts +2 -0
- package/src/reactionRepository/internalApi/removeReaction.ts +95 -0
- package/src/utils/linkedObject/messageLinkedObject.ts +4 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -25,6 +25,7 @@ declare global {
|
|
|
25
25
|
userPublicIds: string[];
|
|
26
26
|
})>;
|
|
27
27
|
messageFeedId: Amity.RawSubChannel['messageFeedId'];
|
|
28
|
+
publicId: string;
|
|
28
29
|
messageId: string;
|
|
29
30
|
myReactions?: string[];
|
|
30
31
|
parentId?: string;
|
|
@@ -42,6 +43,7 @@ declare global {
|
|
|
42
43
|
editedAt?: Amity.timestamp;
|
|
43
44
|
parentId?: string;
|
|
44
45
|
messageId: string;
|
|
46
|
+
publicId: string;
|
|
45
47
|
subChannelId: Amity.SubChannel['subChannelId'];
|
|
46
48
|
channelType: Amity.Channel['type'];
|
|
47
49
|
uniqueId: string;
|
|
@@ -49,6 +51,8 @@ declare global {
|
|
|
49
51
|
deliveredCount: number;
|
|
50
52
|
referenceId?: string;
|
|
51
53
|
markRead: () => void;
|
|
54
|
+
addReaction: (reactionName: string) => Promise<boolean>;
|
|
55
|
+
removeReaction: (reactionName: string) => Promise<boolean>;
|
|
52
56
|
} & Amity.Content<T> & Amity.Flaggable & Amity.Mentionable<'user' | 'channel'> & Amity.Metadata & Amity.Reactable & Amity.SoftDelete & Amity.Subscribable & Amity.Timestamps & Amity.Taggable & Amity.MessageOptimistic;
|
|
53
57
|
type InternalMessage<T extends Amity.MessageContentType = any> = Omit<Amity.Message<T>, 'readCount' | 'deliveredCount' | 'markRead'> & {
|
|
54
58
|
creatorPrivateId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/message.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB;;;;;;;EAO7B,CAAC;AAEH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,kBAAkB,GAAG,OAAO,CAAC,OAAO,kBAAkB,CAAC,CAAC;QAE7D,KAAK,iBAAiB,GAClB,UAAU,GACV,UAAU,GACV,UAAU,GACV,SAAS,GACT,WAAW,GACX,aAAa,GACb,eAAe,GACf,iBAAiB,GACjB,mBAAmB,CAAC;QAExB,KAAK,iBAAiB,GAAG;YACvB,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;SAC7B,CAAC;QAEF,KAAK,UAAU,CAAC,CAAC,SAAS,KAAK,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
try {
|
|
179
|
-
// the string ''v7.8.
|
|
180
|
-
return 'v7.8.
|
|
179
|
+
// the string ''v7.8.4-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
180
|
+
return 'v7.8.4-cjs';
|
|
181
181
|
}
|
|
182
182
|
catch (error) {
|
|
183
183
|
return '__dev__';
|
|
@@ -11904,6 +11904,185 @@ const postLinkedObject = (post) => {
|
|
|
11904
11904
|
});
|
|
11905
11905
|
};
|
|
11906
11906
|
|
|
11907
|
+
/** @hidden */
|
|
11908
|
+
const dispatchReactable = (referenceType, model) => {
|
|
11909
|
+
if (referenceType === 'message')
|
|
11910
|
+
// @ts-ignore: refactor later
|
|
11911
|
+
fireEvent('local.message.updated', { messages: [model] });
|
|
11912
|
+
else if (referenceType === 'post')
|
|
11913
|
+
// @ts-ignore: refactor later
|
|
11914
|
+
fireEvent('post.updated', { posts: [model] });
|
|
11915
|
+
else if (referenceType === 'comment')
|
|
11916
|
+
// @ts-ignore: refactor later
|
|
11917
|
+
fireEvent('comment.updated', { comments: [model] });
|
|
11918
|
+
else if (referenceType === 'story')
|
|
11919
|
+
// Need to provide all data same StoryPayload from BE
|
|
11920
|
+
fireEvent('story.updated', {
|
|
11921
|
+
categories: [],
|
|
11922
|
+
comments: [],
|
|
11923
|
+
communities: [],
|
|
11924
|
+
communityUsers: [],
|
|
11925
|
+
files: [],
|
|
11926
|
+
users: [],
|
|
11927
|
+
stories: [model],
|
|
11928
|
+
});
|
|
11929
|
+
};
|
|
11930
|
+
|
|
11931
|
+
const addReaction$1 = async (referenceType, referenceId, reactionName, referenceVersion) => {
|
|
11932
|
+
var _a, _b, _c;
|
|
11933
|
+
const client = getActiveClient();
|
|
11934
|
+
client.log('reaction/createReaction', {
|
|
11935
|
+
referenceId,
|
|
11936
|
+
referenceType,
|
|
11937
|
+
reactionName,
|
|
11938
|
+
});
|
|
11939
|
+
if (!['post', 'comment', 'story', 'message'].includes(referenceType))
|
|
11940
|
+
throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
11941
|
+
const { data } = await client.http.post('/api/v2/reactions', {
|
|
11942
|
+
referenceId,
|
|
11943
|
+
referenceType,
|
|
11944
|
+
reactionName,
|
|
11945
|
+
referenceVersion,
|
|
11946
|
+
});
|
|
11947
|
+
if (client.cache) {
|
|
11948
|
+
const model = pullFromCache([
|
|
11949
|
+
referenceType,
|
|
11950
|
+
'get',
|
|
11951
|
+
referenceId,
|
|
11952
|
+
]);
|
|
11953
|
+
if (!model || ((_a = model.data.myReactions) === null || _a === void 0 ? void 0 : _a.includes(reactionName)))
|
|
11954
|
+
return true;
|
|
11955
|
+
const updatedModel = Object.assign(Object.assign({}, model.data), { reactionsCount: model.data.reactionsCount + 1, myReactions: [...((_b = model.data.myReactions) !== null && _b !== void 0 ? _b : []), reactionName], reactions: Object.assign(Object.assign({}, model.data.reactions), { [reactionName]: ((_c = model.data.reactions[reactionName]) !== null && _c !== void 0 ? _c : 0) + 1 }), updatedAt: new Date().toISOString() });
|
|
11956
|
+
if (referenceType === 'comment') {
|
|
11957
|
+
fireEvent('local.comment.addReaction', {
|
|
11958
|
+
comment: updatedModel,
|
|
11959
|
+
reactor: {
|
|
11960
|
+
userId: client.userId,
|
|
11961
|
+
reactionName,
|
|
11962
|
+
reactionId: data.addedId,
|
|
11963
|
+
},
|
|
11964
|
+
});
|
|
11965
|
+
return true;
|
|
11966
|
+
}
|
|
11967
|
+
if (referenceType === 'post') {
|
|
11968
|
+
fireEvent('local.post.addReaction', {
|
|
11969
|
+
post: updatedModel,
|
|
11970
|
+
reactor: {
|
|
11971
|
+
userId: client.userId,
|
|
11972
|
+
reactionName,
|
|
11973
|
+
reactionId: data.addedId,
|
|
11974
|
+
},
|
|
11975
|
+
});
|
|
11976
|
+
return true;
|
|
11977
|
+
}
|
|
11978
|
+
if (referenceType === 'story') {
|
|
11979
|
+
fireEvent('local.story.reactionAdded', {
|
|
11980
|
+
story: updatedModel,
|
|
11981
|
+
reactor: {
|
|
11982
|
+
userId: client.userId,
|
|
11983
|
+
reactionName,
|
|
11984
|
+
reactionId: data.addedId,
|
|
11985
|
+
},
|
|
11986
|
+
});
|
|
11987
|
+
return true;
|
|
11988
|
+
}
|
|
11989
|
+
}
|
|
11990
|
+
return true;
|
|
11991
|
+
};
|
|
11992
|
+
addReaction$1.optimistically = (referenceType, referenceId, reactionName) => {
|
|
11993
|
+
var _a, _b, _c, _d, _e;
|
|
11994
|
+
const client = getActiveClient();
|
|
11995
|
+
client.log('reaction/createReaction.optimistically', {
|
|
11996
|
+
referenceId,
|
|
11997
|
+
referenceType,
|
|
11998
|
+
reactionName,
|
|
11999
|
+
});
|
|
12000
|
+
if (!client.cache)
|
|
12001
|
+
return;
|
|
12002
|
+
const model = pullFromCache([
|
|
12003
|
+
referenceType,
|
|
12004
|
+
'get',
|
|
12005
|
+
referenceId,
|
|
12006
|
+
]);
|
|
12007
|
+
if (!(model === null || model === void 0 ? void 0 : model.data) || ((_a = model.data.myReactions) === null || _a === void 0 ? void 0 : _a.includes(reactionName)))
|
|
12008
|
+
return;
|
|
12009
|
+
const reaction = Object.assign(Object.assign({}, model.data), { reactionsCount: model.data.reactionsCount + 1, myReactions: [...((_b = model.data.myReactions) !== null && _b !== void 0 ? _b : []), reactionName], reactions: Object.assign(Object.assign({}, model.data.reactions), { [reactionName]: ((_c = model.data.reactions[reactionName]) !== null && _c !== void 0 ? _c : 0) + 1 }) });
|
|
12010
|
+
upsertInCache([referenceType, 'get', referenceId], reaction, {
|
|
12011
|
+
cachedAt: UNSYNCED_OBJECT_CACHED_AT_VALUE,
|
|
12012
|
+
});
|
|
12013
|
+
dispatchReactable(referenceType, reaction);
|
|
12014
|
+
return (_e = (_d = reaction === null || reaction === void 0 ? void 0 : reaction.myReactions) === null || _d === void 0 ? void 0 : _d.includes(reactionName)) !== null && _e !== void 0 ? _e : false;
|
|
12015
|
+
};
|
|
12016
|
+
|
|
12017
|
+
const removeReaction$1 = async (referenceType, referenceId, reactionName, referenceVersion) => {
|
|
12018
|
+
var _a, _b;
|
|
12019
|
+
const client = getActiveClient();
|
|
12020
|
+
client.log('reaction/removeReaction', {
|
|
12021
|
+
referenceId,
|
|
12022
|
+
referenceType,
|
|
12023
|
+
reactionName,
|
|
12024
|
+
});
|
|
12025
|
+
if (!['post', 'comment', 'story', 'message'].includes(referenceType))
|
|
12026
|
+
throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
12027
|
+
const { data } = await client.http.delete(`/api/v2/reactions`, {
|
|
12028
|
+
data: {
|
|
12029
|
+
referenceId,
|
|
12030
|
+
referenceType,
|
|
12031
|
+
reactionName,
|
|
12032
|
+
referenceVersion,
|
|
12033
|
+
},
|
|
12034
|
+
});
|
|
12035
|
+
if (client.cache) {
|
|
12036
|
+
const model = pullFromCache([
|
|
12037
|
+
referenceType,
|
|
12038
|
+
'get',
|
|
12039
|
+
referenceId,
|
|
12040
|
+
]);
|
|
12041
|
+
if (!model)
|
|
12042
|
+
return true;
|
|
12043
|
+
const updatedModel = Object.assign(Object.assign({}, model.data), { reactionsCount: Math.max(0, model.data.reactionsCount - 1), myReactions: ((_a = model.data.myReactions) !== null && _a !== void 0 ? _a : []).filter(item => item !== reactionName), reactions: Object.assign(Object.assign({}, model.data.reactions), { [reactionName]: Math.max(0, ((_b = model.data.reactions[reactionName]) !== null && _b !== void 0 ? _b : 0) - 1) }), updatedAt: new Date().toISOString() });
|
|
12044
|
+
if (referenceType === 'comment') {
|
|
12045
|
+
fireEvent('local.comment.removeReaction', {
|
|
12046
|
+
comment: updatedModel,
|
|
12047
|
+
reactor: {
|
|
12048
|
+
reactionId: data.removedId,
|
|
12049
|
+
reactionName,
|
|
12050
|
+
userId: client.userId,
|
|
12051
|
+
},
|
|
12052
|
+
});
|
|
12053
|
+
return true;
|
|
12054
|
+
}
|
|
12055
|
+
if (referenceType === 'post') {
|
|
12056
|
+
fireEvent('local.post.removeReaction', {
|
|
12057
|
+
post: updatedModel,
|
|
12058
|
+
reactor: {
|
|
12059
|
+
reactionId: data.removedId,
|
|
12060
|
+
reactionName,
|
|
12061
|
+
userId: client.userId,
|
|
12062
|
+
},
|
|
12063
|
+
});
|
|
12064
|
+
return true;
|
|
12065
|
+
}
|
|
12066
|
+
if (referenceType === 'story') {
|
|
12067
|
+
fireEvent('local.story.reactionAdded', {
|
|
12068
|
+
story: updatedModel,
|
|
12069
|
+
reactor: {
|
|
12070
|
+
userId: client.userId,
|
|
12071
|
+
reactionName,
|
|
12072
|
+
reactionId: data.removedId,
|
|
12073
|
+
},
|
|
12074
|
+
});
|
|
12075
|
+
return true;
|
|
12076
|
+
}
|
|
12077
|
+
}
|
|
12078
|
+
return true;
|
|
12079
|
+
};
|
|
12080
|
+
|
|
12081
|
+
const addReactionToMessage = (reactionName, message) => {
|
|
12082
|
+
const isMessageV3 = message.publicId !== message.messageId;
|
|
12083
|
+
return addReaction$1('message', isMessageV3 ? message.publicId : message.messageId, reactionName, isMessageV3 ? 3 : 5);
|
|
12084
|
+
};
|
|
12085
|
+
|
|
11907
12086
|
const getCachedMarker = (message) => {
|
|
11908
12087
|
var _a, _b;
|
|
11909
12088
|
const key = {
|
|
@@ -11925,6 +12104,11 @@ const getMessageReadCount = (message, marker) => {
|
|
|
11925
12104
|
getCachedMarker(message)) !== null && _a !== void 0 ? _a : { readCount: 0, deliveredCount: 0 };
|
|
11926
12105
|
}; // and if not found in cache use default value `0`
|
|
11927
12106
|
|
|
12107
|
+
const removeReactionToMessage = (reactionName, message) => {
|
|
12108
|
+
const isMessageV3 = message.publicId !== message.messageId;
|
|
12109
|
+
return removeReaction$1('message', isMessageV3 ? message.publicId : message.messageId, reactionName, isMessageV3 ? 3 : 5);
|
|
12110
|
+
};
|
|
12111
|
+
|
|
11928
12112
|
const messageLinkedObject = (message) => {
|
|
11929
12113
|
const rest = __rest(message, ["creatorPrivateId"]);
|
|
11930
12114
|
return Object.assign(Object.assign({}, rest), { get readCount() {
|
|
@@ -11936,7 +12120,7 @@ const messageLinkedObject = (message) => {
|
|
|
11936
12120
|
get creator() {
|
|
11937
12121
|
var _a;
|
|
11938
12122
|
return (_a = pullFromCache(['user', 'get', message.creatorId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
11939
|
-
}, markRead: () => markReadMessage(message) });
|
|
12123
|
+
}, markRead: () => markReadMessage(message), addReaction: (reactionName) => addReactionToMessage(reactionName, message), removeReaction: (reactionName) => removeReactionToMessage(reactionName, message) });
|
|
11940
12124
|
};
|
|
11941
12125
|
|
|
11942
12126
|
const reactorLinkedObject = (reactor) => {
|
|
@@ -14558,30 +14742,6 @@ getRole.locally = (roleId) => {
|
|
|
14558
14742
|
};
|
|
14559
14743
|
};
|
|
14560
14744
|
|
|
14561
|
-
/** @hidden */
|
|
14562
|
-
const dispatchReactable = (referenceType, model) => {
|
|
14563
|
-
if (referenceType === 'message')
|
|
14564
|
-
// @ts-ignore: refactor later
|
|
14565
|
-
fireEvent('local.message.updated', { messages: [model] });
|
|
14566
|
-
else if (referenceType === 'post')
|
|
14567
|
-
// @ts-ignore: refactor later
|
|
14568
|
-
fireEvent('post.updated', { posts: [model] });
|
|
14569
|
-
else if (referenceType === 'comment')
|
|
14570
|
-
// @ts-ignore: refactor later
|
|
14571
|
-
fireEvent('comment.updated', { comments: [model] });
|
|
14572
|
-
else if (referenceType === 'story')
|
|
14573
|
-
// Need to provide all data same StoryPayload from BE
|
|
14574
|
-
fireEvent('story.updated', {
|
|
14575
|
-
categories: [],
|
|
14576
|
-
comments: [],
|
|
14577
|
-
communities: [],
|
|
14578
|
-
communityUsers: [],
|
|
14579
|
-
files: [],
|
|
14580
|
-
users: [],
|
|
14581
|
-
stories: [model],
|
|
14582
|
-
});
|
|
14583
|
-
};
|
|
14584
|
-
|
|
14585
14745
|
/**
|
|
14586
14746
|
* ```js
|
|
14587
14747
|
* import { getMessage } from '@amityco/ts-sdk'
|
package/dist/index.esm.js
CHANGED
|
@@ -161,8 +161,8 @@ var FeedSourceEnum;
|
|
|
161
161
|
|
|
162
162
|
function getVersion() {
|
|
163
163
|
try {
|
|
164
|
-
// the string ''v7.8.
|
|
165
|
-
return 'v7.8.
|
|
164
|
+
// the string ''v7.8.4-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
165
|
+
return 'v7.8.4-esm';
|
|
166
166
|
}
|
|
167
167
|
catch (error) {
|
|
168
168
|
return '__dev__';
|
|
@@ -27996,6 +27996,185 @@ const postLinkedObject = (post) => {
|
|
|
27996
27996
|
});
|
|
27997
27997
|
};
|
|
27998
27998
|
|
|
27999
|
+
/** @hidden */
|
|
28000
|
+
const dispatchReactable = (referenceType, model) => {
|
|
28001
|
+
if (referenceType === 'message')
|
|
28002
|
+
// @ts-ignore: refactor later
|
|
28003
|
+
fireEvent('local.message.updated', { messages: [model] });
|
|
28004
|
+
else if (referenceType === 'post')
|
|
28005
|
+
// @ts-ignore: refactor later
|
|
28006
|
+
fireEvent('post.updated', { posts: [model] });
|
|
28007
|
+
else if (referenceType === 'comment')
|
|
28008
|
+
// @ts-ignore: refactor later
|
|
28009
|
+
fireEvent('comment.updated', { comments: [model] });
|
|
28010
|
+
else if (referenceType === 'story')
|
|
28011
|
+
// Need to provide all data same StoryPayload from BE
|
|
28012
|
+
fireEvent('story.updated', {
|
|
28013
|
+
categories: [],
|
|
28014
|
+
comments: [],
|
|
28015
|
+
communities: [],
|
|
28016
|
+
communityUsers: [],
|
|
28017
|
+
files: [],
|
|
28018
|
+
users: [],
|
|
28019
|
+
stories: [model],
|
|
28020
|
+
});
|
|
28021
|
+
};
|
|
28022
|
+
|
|
28023
|
+
const addReaction$1 = async (referenceType, referenceId, reactionName, referenceVersion) => {
|
|
28024
|
+
var _a, _b, _c;
|
|
28025
|
+
const client = getActiveClient();
|
|
28026
|
+
client.log('reaction/createReaction', {
|
|
28027
|
+
referenceId,
|
|
28028
|
+
referenceType,
|
|
28029
|
+
reactionName,
|
|
28030
|
+
});
|
|
28031
|
+
if (!['post', 'comment', 'story', 'message'].includes(referenceType))
|
|
28032
|
+
throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
28033
|
+
const { data } = await client.http.post('/api/v2/reactions', {
|
|
28034
|
+
referenceId,
|
|
28035
|
+
referenceType,
|
|
28036
|
+
reactionName,
|
|
28037
|
+
referenceVersion,
|
|
28038
|
+
});
|
|
28039
|
+
if (client.cache) {
|
|
28040
|
+
const model = pullFromCache([
|
|
28041
|
+
referenceType,
|
|
28042
|
+
'get',
|
|
28043
|
+
referenceId,
|
|
28044
|
+
]);
|
|
28045
|
+
if (!model || ((_a = model.data.myReactions) === null || _a === void 0 ? void 0 : _a.includes(reactionName)))
|
|
28046
|
+
return true;
|
|
28047
|
+
const updatedModel = Object.assign(Object.assign({}, model.data), { reactionsCount: model.data.reactionsCount + 1, myReactions: [...((_b = model.data.myReactions) !== null && _b !== void 0 ? _b : []), reactionName], reactions: Object.assign(Object.assign({}, model.data.reactions), { [reactionName]: ((_c = model.data.reactions[reactionName]) !== null && _c !== void 0 ? _c : 0) + 1 }), updatedAt: new Date().toISOString() });
|
|
28048
|
+
if (referenceType === 'comment') {
|
|
28049
|
+
fireEvent('local.comment.addReaction', {
|
|
28050
|
+
comment: updatedModel,
|
|
28051
|
+
reactor: {
|
|
28052
|
+
userId: client.userId,
|
|
28053
|
+
reactionName,
|
|
28054
|
+
reactionId: data.addedId,
|
|
28055
|
+
},
|
|
28056
|
+
});
|
|
28057
|
+
return true;
|
|
28058
|
+
}
|
|
28059
|
+
if (referenceType === 'post') {
|
|
28060
|
+
fireEvent('local.post.addReaction', {
|
|
28061
|
+
post: updatedModel,
|
|
28062
|
+
reactor: {
|
|
28063
|
+
userId: client.userId,
|
|
28064
|
+
reactionName,
|
|
28065
|
+
reactionId: data.addedId,
|
|
28066
|
+
},
|
|
28067
|
+
});
|
|
28068
|
+
return true;
|
|
28069
|
+
}
|
|
28070
|
+
if (referenceType === 'story') {
|
|
28071
|
+
fireEvent('local.story.reactionAdded', {
|
|
28072
|
+
story: updatedModel,
|
|
28073
|
+
reactor: {
|
|
28074
|
+
userId: client.userId,
|
|
28075
|
+
reactionName,
|
|
28076
|
+
reactionId: data.addedId,
|
|
28077
|
+
},
|
|
28078
|
+
});
|
|
28079
|
+
return true;
|
|
28080
|
+
}
|
|
28081
|
+
}
|
|
28082
|
+
return true;
|
|
28083
|
+
};
|
|
28084
|
+
addReaction$1.optimistically = (referenceType, referenceId, reactionName) => {
|
|
28085
|
+
var _a, _b, _c, _d, _e;
|
|
28086
|
+
const client = getActiveClient();
|
|
28087
|
+
client.log('reaction/createReaction.optimistically', {
|
|
28088
|
+
referenceId,
|
|
28089
|
+
referenceType,
|
|
28090
|
+
reactionName,
|
|
28091
|
+
});
|
|
28092
|
+
if (!client.cache)
|
|
28093
|
+
return;
|
|
28094
|
+
const model = pullFromCache([
|
|
28095
|
+
referenceType,
|
|
28096
|
+
'get',
|
|
28097
|
+
referenceId,
|
|
28098
|
+
]);
|
|
28099
|
+
if (!(model === null || model === void 0 ? void 0 : model.data) || ((_a = model.data.myReactions) === null || _a === void 0 ? void 0 : _a.includes(reactionName)))
|
|
28100
|
+
return;
|
|
28101
|
+
const reaction = Object.assign(Object.assign({}, model.data), { reactionsCount: model.data.reactionsCount + 1, myReactions: [...((_b = model.data.myReactions) !== null && _b !== void 0 ? _b : []), reactionName], reactions: Object.assign(Object.assign({}, model.data.reactions), { [reactionName]: ((_c = model.data.reactions[reactionName]) !== null && _c !== void 0 ? _c : 0) + 1 }) });
|
|
28102
|
+
upsertInCache([referenceType, 'get', referenceId], reaction, {
|
|
28103
|
+
cachedAt: UNSYNCED_OBJECT_CACHED_AT_VALUE,
|
|
28104
|
+
});
|
|
28105
|
+
dispatchReactable(referenceType, reaction);
|
|
28106
|
+
return (_e = (_d = reaction === null || reaction === void 0 ? void 0 : reaction.myReactions) === null || _d === void 0 ? void 0 : _d.includes(reactionName)) !== null && _e !== void 0 ? _e : false;
|
|
28107
|
+
};
|
|
28108
|
+
|
|
28109
|
+
const removeReaction$1 = async (referenceType, referenceId, reactionName, referenceVersion) => {
|
|
28110
|
+
var _a, _b;
|
|
28111
|
+
const client = getActiveClient();
|
|
28112
|
+
client.log('reaction/removeReaction', {
|
|
28113
|
+
referenceId,
|
|
28114
|
+
referenceType,
|
|
28115
|
+
reactionName,
|
|
28116
|
+
});
|
|
28117
|
+
if (!['post', 'comment', 'story', 'message'].includes(referenceType))
|
|
28118
|
+
throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
28119
|
+
const { data } = await client.http.delete(`/api/v2/reactions`, {
|
|
28120
|
+
data: {
|
|
28121
|
+
referenceId,
|
|
28122
|
+
referenceType,
|
|
28123
|
+
reactionName,
|
|
28124
|
+
referenceVersion,
|
|
28125
|
+
},
|
|
28126
|
+
});
|
|
28127
|
+
if (client.cache) {
|
|
28128
|
+
const model = pullFromCache([
|
|
28129
|
+
referenceType,
|
|
28130
|
+
'get',
|
|
28131
|
+
referenceId,
|
|
28132
|
+
]);
|
|
28133
|
+
if (!model)
|
|
28134
|
+
return true;
|
|
28135
|
+
const updatedModel = Object.assign(Object.assign({}, model.data), { reactionsCount: Math.max(0, model.data.reactionsCount - 1), myReactions: ((_a = model.data.myReactions) !== null && _a !== void 0 ? _a : []).filter(item => item !== reactionName), reactions: Object.assign(Object.assign({}, model.data.reactions), { [reactionName]: Math.max(0, ((_b = model.data.reactions[reactionName]) !== null && _b !== void 0 ? _b : 0) - 1) }), updatedAt: new Date().toISOString() });
|
|
28136
|
+
if (referenceType === 'comment') {
|
|
28137
|
+
fireEvent('local.comment.removeReaction', {
|
|
28138
|
+
comment: updatedModel,
|
|
28139
|
+
reactor: {
|
|
28140
|
+
reactionId: data.removedId,
|
|
28141
|
+
reactionName,
|
|
28142
|
+
userId: client.userId,
|
|
28143
|
+
},
|
|
28144
|
+
});
|
|
28145
|
+
return true;
|
|
28146
|
+
}
|
|
28147
|
+
if (referenceType === 'post') {
|
|
28148
|
+
fireEvent('local.post.removeReaction', {
|
|
28149
|
+
post: updatedModel,
|
|
28150
|
+
reactor: {
|
|
28151
|
+
reactionId: data.removedId,
|
|
28152
|
+
reactionName,
|
|
28153
|
+
userId: client.userId,
|
|
28154
|
+
},
|
|
28155
|
+
});
|
|
28156
|
+
return true;
|
|
28157
|
+
}
|
|
28158
|
+
if (referenceType === 'story') {
|
|
28159
|
+
fireEvent('local.story.reactionAdded', {
|
|
28160
|
+
story: updatedModel,
|
|
28161
|
+
reactor: {
|
|
28162
|
+
userId: client.userId,
|
|
28163
|
+
reactionName,
|
|
28164
|
+
reactionId: data.removedId,
|
|
28165
|
+
},
|
|
28166
|
+
});
|
|
28167
|
+
return true;
|
|
28168
|
+
}
|
|
28169
|
+
}
|
|
28170
|
+
return true;
|
|
28171
|
+
};
|
|
28172
|
+
|
|
28173
|
+
const addReactionToMessage = (reactionName, message) => {
|
|
28174
|
+
const isMessageV3 = message.publicId !== message.messageId;
|
|
28175
|
+
return addReaction$1('message', isMessageV3 ? message.publicId : message.messageId, reactionName, isMessageV3 ? 3 : 5);
|
|
28176
|
+
};
|
|
28177
|
+
|
|
27999
28178
|
const getCachedMarker = (message) => {
|
|
28000
28179
|
var _a, _b;
|
|
28001
28180
|
const key = {
|
|
@@ -28017,6 +28196,11 @@ const getMessageReadCount = (message, marker) => {
|
|
|
28017
28196
|
getCachedMarker(message)) !== null && _a !== void 0 ? _a : { readCount: 0, deliveredCount: 0 };
|
|
28018
28197
|
}; // and if not found in cache use default value `0`
|
|
28019
28198
|
|
|
28199
|
+
const removeReactionToMessage = (reactionName, message) => {
|
|
28200
|
+
const isMessageV3 = message.publicId !== message.messageId;
|
|
28201
|
+
return removeReaction$1('message', isMessageV3 ? message.publicId : message.messageId, reactionName, isMessageV3 ? 3 : 5);
|
|
28202
|
+
};
|
|
28203
|
+
|
|
28020
28204
|
const messageLinkedObject = (message) => {
|
|
28021
28205
|
const rest = __rest(message, ["creatorPrivateId"]);
|
|
28022
28206
|
return Object.assign(Object.assign({}, rest), { get readCount() {
|
|
@@ -28028,7 +28212,7 @@ const messageLinkedObject = (message) => {
|
|
|
28028
28212
|
get creator() {
|
|
28029
28213
|
var _a;
|
|
28030
28214
|
return (_a = pullFromCache(['user', 'get', message.creatorId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
28031
|
-
}, markRead: () => markReadMessage(message) });
|
|
28215
|
+
}, markRead: () => markReadMessage(message), addReaction: (reactionName) => addReactionToMessage(reactionName, message), removeReaction: (reactionName) => removeReactionToMessage(reactionName, message) });
|
|
28032
28216
|
};
|
|
28033
28217
|
|
|
28034
28218
|
const reactorLinkedObject = (reactor) => {
|
|
@@ -30650,30 +30834,6 @@ getRole.locally = (roleId) => {
|
|
|
30650
30834
|
};
|
|
30651
30835
|
};
|
|
30652
30836
|
|
|
30653
|
-
/** @hidden */
|
|
30654
|
-
const dispatchReactable = (referenceType, model) => {
|
|
30655
|
-
if (referenceType === 'message')
|
|
30656
|
-
// @ts-ignore: refactor later
|
|
30657
|
-
fireEvent('local.message.updated', { messages: [model] });
|
|
30658
|
-
else if (referenceType === 'post')
|
|
30659
|
-
// @ts-ignore: refactor later
|
|
30660
|
-
fireEvent('post.updated', { posts: [model] });
|
|
30661
|
-
else if (referenceType === 'comment')
|
|
30662
|
-
// @ts-ignore: refactor later
|
|
30663
|
-
fireEvent('comment.updated', { comments: [model] });
|
|
30664
|
-
else if (referenceType === 'story')
|
|
30665
|
-
// Need to provide all data same StoryPayload from BE
|
|
30666
|
-
fireEvent('story.updated', {
|
|
30667
|
-
categories: [],
|
|
30668
|
-
comments: [],
|
|
30669
|
-
communities: [],
|
|
30670
|
-
communityUsers: [],
|
|
30671
|
-
files: [],
|
|
30672
|
-
users: [],
|
|
30673
|
-
stories: [model],
|
|
30674
|
-
});
|
|
30675
|
-
};
|
|
30676
|
-
|
|
30677
30837
|
/**
|
|
30678
30838
|
* ```js
|
|
30679
30839
|
* import { getMessage } from '@amityco/ts-sdk'
|