@amityco/ts-sdk-react-native 6.29.2-310dd78.0 → 6.29.3-669217e.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/client/api/index.d.ts.map +1 -1
- package/dist/index.cjs.js +21 -7
- package/dist/index.esm.js +21 -7
- package/dist/index.umd.js +2 -2
- package/dist/messageRepository/api/deleteMessage.d.ts.map +1 -1
- package/dist/messageRepository/utils/prepareMessagePayload.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client/api/index.ts +1 -0
- package/src/messageRepository/api/deleteMessage.ts +9 -5
- package/src/messageRepository/utils/prepareMessagePayload.ts +22 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,cAAc,cAAc,CAAC;AAE7B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAE/B,cAAc,eAAe,CAAC;AAE9B,cAAc,mBAAmB,CAAC;AAElC,cAAc,WAAW,CAAC;AAE1B,cAAc,cAAc,CAAC;AAE7B,cAAc,qBAAqB,CAAC;AAEpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,cAAc,cAAc,CAAC;AAE7B,cAAc,gBAAgB,CAAC;AAE/B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAE/B,cAAc,eAAe,CAAC;AAE9B,cAAc,mBAAmB,CAAC;AAElC,cAAc,WAAW,CAAC;AAE1B,cAAc,cAAc,CAAC;AAE7B,cAAc,qBAAqB,CAAC;AAEpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAE7C,cAAc,6BAA6B,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -125,8 +125,8 @@ const PostContentType = Object.freeze({
|
|
|
125
125
|
|
|
126
126
|
function getVersion() {
|
|
127
127
|
try {
|
|
128
|
-
// the string ''v6.29.
|
|
129
|
-
return 'v6.29.
|
|
128
|
+
// the string ''v6.29.2-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
129
|
+
return 'v6.29.2-cjs';
|
|
130
130
|
}
|
|
131
131
|
catch (error) {
|
|
132
132
|
return '__dev__';
|
|
@@ -6711,9 +6711,21 @@ function convertFromRaw$1(_a) {
|
|
|
6711
6711
|
} }, rest), { channelId: channelPublicId, creatorId: creatorPublicId, displayName: name, lastActivity: lastMessageTimestamp, latestMessageId: lastMessageId, messageCount: childCount, subChannelId: messageFeedId, isUnreadCountSupport: isUnreadCountSupport$1({ channelType }) });
|
|
6712
6712
|
}
|
|
6713
6713
|
|
|
6714
|
+
const mergePayloadWithLocal = (payload) => {
|
|
6715
|
+
var _a, _b, _c;
|
|
6716
|
+
const localMessage = (_b = (_a = queryCache(['message', 'get'])) === null || _a === void 0 ? void 0 : _a.find(({ data }) => data.messageId === payload.messageId)) === null || _b === void 0 ? void 0 : _b.data;
|
|
6717
|
+
if (localMessage) {
|
|
6718
|
+
return Object.assign(Object.assign(Object.assign({}, localMessage), payload), {
|
|
6719
|
+
// NOTE: referenceId is missing in the payload. If we have local message data with referenceId, use it instead.
|
|
6720
|
+
// TODO: Remove this logic when BE fixes the payload
|
|
6721
|
+
referenceId: (_c = localMessage.referenceId) !== null && _c !== void 0 ? _c : payload.referenceId });
|
|
6722
|
+
}
|
|
6723
|
+
return payload;
|
|
6724
|
+
};
|
|
6714
6725
|
function convertFromRaw(message, reactors, event) {
|
|
6715
6726
|
var _a;
|
|
6716
|
-
const
|
|
6727
|
+
const mergeMessage = mergePayloadWithLocal(message);
|
|
6728
|
+
const { channelPublicId, childCount, creatorPublicId, mentionedUsers, messageFeedId, myReactions, reactionCount, reactions, referenceId, segment, messageId, creatorId } = mergeMessage, rest = __rest(mergeMessage, ["channelPublicId", "childCount", "creatorPublicId", "mentionedUsers", "messageFeedId", "myReactions", "reactionCount", "reactions", "referenceId", "segment", "messageId", "creatorId"]);
|
|
6717
6729
|
let cache;
|
|
6718
6730
|
if (referenceId) {
|
|
6719
6731
|
cache = pullFromCache(['message', 'get', referenceId]);
|
|
@@ -14975,10 +14987,12 @@ const deleteMessage = async (messageId) => {
|
|
|
14975
14987
|
const client = getActiveClient();
|
|
14976
14988
|
client.log('message/deleteMessage', messageId);
|
|
14977
14989
|
// API-FIX: This endpoint has not been implemented yet.
|
|
14978
|
-
await client.http.delete(`/api/v5/messages/${encodeURIComponent(messageId)}`);
|
|
14979
|
-
const
|
|
14980
|
-
fireEvent('local.message.deleted', {
|
|
14981
|
-
|
|
14990
|
+
const { data: deleted } = await client.http.delete(`/api/v5/messages/${encodeURIComponent(messageId)}`);
|
|
14991
|
+
const payload = await prepareMessagePayload(deleted);
|
|
14992
|
+
fireEvent('local.message.deleted', {
|
|
14993
|
+
messages: [payload.messages[0]],
|
|
14994
|
+
});
|
|
14995
|
+
return LinkedObject.message(payload.messages[0]);
|
|
14982
14996
|
};
|
|
14983
14997
|
/**
|
|
14984
14998
|
* ```js
|
package/dist/index.esm.js
CHANGED
|
@@ -90,8 +90,8 @@ const PostContentType = Object.freeze({
|
|
|
90
90
|
|
|
91
91
|
function getVersion() {
|
|
92
92
|
try {
|
|
93
|
-
// the string ''v6.29.
|
|
94
|
-
return 'v6.29.
|
|
93
|
+
// the string ''v6.29.2-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
94
|
+
return 'v6.29.2-esm';
|
|
95
95
|
}
|
|
96
96
|
catch (error) {
|
|
97
97
|
return '__dev__';
|
|
@@ -22783,9 +22783,21 @@ function convertFromRaw$1(_a) {
|
|
|
22783
22783
|
} }, rest), { channelId: channelPublicId, creatorId: creatorPublicId, displayName: name, lastActivity: lastMessageTimestamp, latestMessageId: lastMessageId, messageCount: childCount, subChannelId: messageFeedId, isUnreadCountSupport: isUnreadCountSupport$1({ channelType }) });
|
|
22784
22784
|
}
|
|
22785
22785
|
|
|
22786
|
+
const mergePayloadWithLocal = (payload) => {
|
|
22787
|
+
var _a, _b, _c;
|
|
22788
|
+
const localMessage = (_b = (_a = queryCache(['message', 'get'])) === null || _a === void 0 ? void 0 : _a.find(({ data }) => data.messageId === payload.messageId)) === null || _b === void 0 ? void 0 : _b.data;
|
|
22789
|
+
if (localMessage) {
|
|
22790
|
+
return Object.assign(Object.assign(Object.assign({}, localMessage), payload), {
|
|
22791
|
+
// NOTE: referenceId is missing in the payload. If we have local message data with referenceId, use it instead.
|
|
22792
|
+
// TODO: Remove this logic when BE fixes the payload
|
|
22793
|
+
referenceId: (_c = localMessage.referenceId) !== null && _c !== void 0 ? _c : payload.referenceId });
|
|
22794
|
+
}
|
|
22795
|
+
return payload;
|
|
22796
|
+
};
|
|
22786
22797
|
function convertFromRaw(message, reactors, event) {
|
|
22787
22798
|
var _a;
|
|
22788
|
-
const
|
|
22799
|
+
const mergeMessage = mergePayloadWithLocal(message);
|
|
22800
|
+
const { channelPublicId, childCount, creatorPublicId, mentionedUsers, messageFeedId, myReactions, reactionCount, reactions, referenceId, segment, messageId, creatorId } = mergeMessage, rest = __rest(mergeMessage, ["channelPublicId", "childCount", "creatorPublicId", "mentionedUsers", "messageFeedId", "myReactions", "reactionCount", "reactions", "referenceId", "segment", "messageId", "creatorId"]);
|
|
22789
22801
|
let cache;
|
|
22790
22802
|
if (referenceId) {
|
|
22791
22803
|
cache = pullFromCache(['message', 'get', referenceId]);
|
|
@@ -31047,10 +31059,12 @@ const deleteMessage = async (messageId) => {
|
|
|
31047
31059
|
const client = getActiveClient();
|
|
31048
31060
|
client.log('message/deleteMessage', messageId);
|
|
31049
31061
|
// API-FIX: This endpoint has not been implemented yet.
|
|
31050
|
-
await client.http.delete(`/api/v5/messages/${encodeURIComponent(messageId)}`);
|
|
31051
|
-
const
|
|
31052
|
-
fireEvent('local.message.deleted', {
|
|
31053
|
-
|
|
31062
|
+
const { data: deleted } = await client.http.delete(`/api/v5/messages/${encodeURIComponent(messageId)}`);
|
|
31063
|
+
const payload = await prepareMessagePayload(deleted);
|
|
31064
|
+
fireEvent('local.message.deleted', {
|
|
31065
|
+
messages: [payload.messages[0]],
|
|
31066
|
+
});
|
|
31067
|
+
return LinkedObject.message(payload.messages[0]);
|
|
31054
31068
|
};
|
|
31055
31069
|
/**
|
|
31056
31070
|
* ```js
|